9 #include <svd/online/SVDStripNoiseMap.h>
10 #include <framework/logging/Logger.h>
19 m_onl2offl_map_ptr(onl2offl_map_ptr)
30 const string& noisefilename):
31 m_onl2offl_map_ptr(onl2offl_map_ptr)
39 B2INFO(
"initializeMap()");
41 if (noisefilename ==
"") {
42 B2INFO(
"CAUTION:: Pedestal and noise values are not changed, because noise file is not specified.");
47 B2ERROR(
"SVDOnlineToOfflineMap is not assigned correctly.");
56 ifstream noisefile(noisefilename.c_str());
57 if (!noisefile.is_open()) {
58 B2ERROR(
"Cannot open noise file: " << noisefilename);
62 int module, apv, strip, fadc, fadc_ch, good;
63 float pedestal, gaus_noise, noise, rms, cmc;
65 short file_section = 0;
67 while (getline(noisefile, line)) {
69 if (line.substr(0, 1) ==
"#")
continue;
72 while ((space_pos = line.find(
" ")) != string::npos) {
73 line.erase(space_pos, 1);
76 if (line.empty())
continue;
80 if (line.substr(0, 1) ==
"[" && line.substr(line.size() - 1, 1) ==
"]") {
81 if (line ==
"[noi]") file_section = 1;
82 else if (line ==
"[fit]") file_section = 2;
83 else file_section = 3;
85 else if (file_section == 1) {
86 sscanf(line.c_str(),
"str=%d,%d,%d,%d,%d,%d,%f,%f,%f,%f,%f",
87 &module, &apv, &strip, &fadc, &fadc_ch, &good,
88 &pedestal, &gaus_noise, &noise, &rms, &cmc);
96 if (fadc == 0) fadc_id = 1;
97 else if (fadc == 1) fadc_id = 129;
102 unsigned short apv_base = 0;
104 case 1 : apv_base = 0;
break;
105 case 2 : apv_base = 6;
break;
106 case 3 : apv_base = 24;
break;
107 case 4 : apv_base = 30;
break;
108 case 8 : apv_base = 0;
break;
109 case 9 : apv_base = 6;
break;
110 case 10 : apv_base = 24;
break;
111 case 11 : apv_base = 30;
break;
112 default : apv_base = 0;
break;
114 unsigned short apv_id = apv_base + apv;
120 short svd_sensor_id = SVDPar::getSVDSensorID(vxd_id, is_u);
121 if (svd_sensor_id < 0) {
122 B2ERROR(
"Invalid SVDSensorID: " << svd_sensor_id <<
" (FADC ID: " << fadc_id <<
", APV: " << apv <<
")");
126 B2INFO(
"Sensor ID: " << svd_sensor_id <<
" Module: " << module <<
" VxdID: " << vxd_id.
getID() <<
" (FADC ID: " << fadc_id <<
127 ", APV: " << apv <<
", STRIP: " << strip <<
") " << ((good == 0) ?
"BAD" :
" ") <<
" ped: " << pedestal <<
", noi: " << noise);
130 m_noiseMap [svd_sensor_id][strip] = gaus_noise;
132 m_goodStripMap[svd_sensor_id][strip] = (good == 0) ?
false :
true;
144 if (strip < 0 || SVDPar::maxStrip <= strip) {
145 B2ERROR(
"Invalid strip number: " << strip);
149 short sensor_id = SVDPar::getSVDSensorID(
id, is_u);
150 if (sensor_id < 0 || SVDPar::nSensorID <= sensor_id) {
151 B2ERROR(
"Invalid SVDSensorID: " << sensor_id);
161 if (strip < 0 || SVDPar::maxStrip <= strip) {
162 B2ERROR(
"Invalid strip number: " << strip);
166 short sensor_id = SVDPar::getSVDSensorID(
id, is_u);
167 if (sensor_id < 0 || SVDPar::nSensorID <= sensor_id) {
168 B2ERROR(
"Invalid SVDSensorID: " << sensor_id);
178 if (strip < 0 || SVDPar::maxStrip <= strip) {
179 B2ERROR(
"Invalid strip number: " << strip);
183 short sensor_id = SVDPar::getSVDSensorID(
id, is_u);
184 if (sensor_id < 0 || SVDPar::nSensorID <= sensor_id) {
185 B2ERROR(
"Invalid SVDSensorID: " << sensor_id);
195 if (strip < 0 || SVDPar::maxStrip <= strip) {
196 B2ERROR(
"Invalid strip number: " << strip);
200 short sensor_id = SVDPar::getSVDSensorID(
id, is_u);
201 if (sensor_id < 0 || SVDPar::nSensorID <= sensor_id) {
202 B2ERROR(
"Invalid SVDSensorID: " << sensor_id);
This class implements the methods to map raw SVD hits to basf2 SVD hits.
const SensorInfo & getSensorInfo(unsigned char FADC, unsigned char APV25)
Get SensorInfo for a given FADC/APV combination.
SVDStripNoiseMap(SVDOnlineToOfflineMap *onl2offl_map_ptr=nullptr)
Constructor.
bool isGood(VxdID id, bool is_u, short strip)
Check whether the strip is available or not.
float getThreshold(VxdID id, bool is_u, short strip)
Get pedestal, noise, and threshold values.
float getPedestal(VxdID id, bool is_u, short strip)
Get pedestal, noise, and threshold values.
int initializeMap(const std::string &noisefilename="")
Initialize maps with input noisefile.
SVDOnlineToOfflineMap * m_onl2offl_map_ptr
Pointer to SVDOnlineToOfflineMap.
bool m_goodStripMap[SVDPar::nSensorID][SVDPar::maxStrip]
Good strip map.
float m_pedestalMap[SVDPar::nSensorID][SVDPar::maxStrip]
Pedestal map for all strips in ladders.
float m_thresholdMap[SVDPar::nSensorID][SVDPar::maxStrip]
threshold map for all strips in ladders.
float m_noiseMap[SVDPar::nSensorID][SVDPar::maxStrip]
noise map for all strips in ladders.
float getNoise(VxdID id, bool is_u, short strip)
Get pedestal, noise, and threshold values.
Class to uniquely identify a any structure of the PXD and SVD.
baseType getID() const
Get the unique id.
Abstract base class for different kinds of events.