Belle II Software development
SVDStripNoiseMap Class Reference

strip noise map More...

#include <SVDStripNoiseMap.h>

Public Member Functions

 SVDStripNoiseMap (SVDOnlineToOfflineMap *onl2offl_map_ptr=nullptr)
 Constructor.
 
 SVDStripNoiseMap (SVDOnlineToOfflineMap *onl2offl_map_ptr, const std::string &noisefilename)
 Constructor including map initialization.
 
 ~SVDStripNoiseMap ()
 Destructor.
 
int initializeMap (const std::string &noisefilename="")
 Initialize maps with input noisefile.
 
float getPedestal (VxdID id, bool is_u, short strip)
 Get pedestal, noise, and threshold values.
 
float getNoise (VxdID id, bool is_u, short strip)
 Get pedestal, noise, and threshold values.
 
float getThreshold (VxdID id, bool is_u, short strip)
 Get pedestal, noise, and threshold values.
 
bool isGood (VxdID id, bool is_u, short strip)
 Check whether the strip is available or not.
 

Private Attributes

SVDOnlineToOfflineMapm_onl2offl_map_ptr
 Pointer to SVDOnlineToOfflineMap.
 
float m_pedestalMap [SVDPar::nSensorID][SVDPar::maxStrip]
 Pedestal map for all strips in ladders.
 
float m_noiseMap [SVDPar::nSensorID][SVDPar::maxStrip]
 noise map for all strips in ladders.
 
float m_thresholdMap [SVDPar::nSensorID][SVDPar::maxStrip]
 threshold map for all strips in ladders.
 
bool m_goodStripMap [SVDPar::nSensorID][SVDPar::maxStrip]
 Good strip map.
 

Detailed Description

strip noise map

Definition at line 30 of file SVDStripNoiseMap.h.

Constructor & Destructor Documentation

◆ SVDStripNoiseMap() [1/2]

SVDStripNoiseMap ( SVDOnlineToOfflineMap onl2offl_map_ptr = nullptr)

Constructor.

Definition at line 18 of file SVDStripNoiseMap.cc.

18 :
19 m_onl2offl_map_ptr(onl2offl_map_ptr)
20{
21
22 memset(m_pedestalMap, 0, sizeof(m_pedestalMap));
23 memset(m_noiseMap, 0, sizeof(m_noiseMap));
24 memset(m_thresholdMap, 0, sizeof(m_thresholdMap));
25 memset(m_goodStripMap, 0, sizeof(m_goodStripMap));
26
27}
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.

◆ SVDStripNoiseMap() [2/2]

SVDStripNoiseMap ( SVDOnlineToOfflineMap onl2offl_map_ptr,
const std::string &  noisefilename 
)

Constructor including map initialization.

Definition at line 29 of file SVDStripNoiseMap.cc.

30 :
31 m_onl2offl_map_ptr(onl2offl_map_ptr)
32{
33 this->initializeMap(noisefilename);
34}
int initializeMap(const std::string &noisefilename="")
Initialize maps with input noisefile.

◆ ~SVDStripNoiseMap()

~SVDStripNoiseMap ( )
inline

Destructor.

Definition at line 40 of file SVDStripNoiseMap.h.

40{};

Member Function Documentation

◆ getNoise()

float getNoise ( VxdID  id,
bool  is_u,
short  strip 
)

Get pedestal, noise, and threshold values.

Parameters
idVxdID of the required sensor, with segment number 0 for v, 1 for u
is_utrue: u-side (p-side), false: v-side (n-side)
stripStrip number
Returns
noise value

Definition at line 158 of file SVDStripNoiseMap.cc.

159{
160
161 if (strip < 0 || SVDPar::maxStrip <= strip) {
162 B2ERROR("Invalid strip number: " << LogVar("strip number", strip));
163 return -9999.0;
164 }
165
166 short sensor_id = SVDPar::getSVDSensorID(id, is_u);
167 if (sensor_id < 0 || SVDPar::nSensorID <= sensor_id) {
168 B2ERROR("Invalid SVDSensorID: " << LogVar("SVDSensorID", sensor_id));
169 return -9999.0;
170 }
171
172 return m_noiseMap[sensor_id][strip];
173}
Class to store variables with their name which were sent to the logging service.

◆ getPedestal()

float getPedestal ( VxdID  id,
bool  is_u,
short  strip 
)

Get pedestal, noise, and threshold values.

Parameters
idVxdID of the required sensor, with segment number 0 for v, 1 for u
is_utrue: u-side (p-side), false: v-side (n-side)
stripStrip number
Returns
pedestal value

Definition at line 141 of file SVDStripNoiseMap.cc.

142{
143
144 if (strip < 0 || SVDPar::maxStrip <= strip) {
145 B2ERROR("Invalid strip number: " << strip);
146 return -9999.0;
147 }
148
149 short sensor_id = SVDPar::getSVDSensorID(id, is_u);
150 if (sensor_id < 0 || SVDPar::nSensorID <= sensor_id) {
151 B2ERROR("Invalid SVDSensorID: " << LogVar("SVDSensorID", sensor_id));
152 return -9999.0;
153 }
154
155 return m_pedestalMap[sensor_id][strip];
156}

◆ getThreshold()

float getThreshold ( VxdID  id,
bool  is_u,
short  strip 
)

Get pedestal, noise, and threshold values.

Parameters
idVxdID of the required sensor, with segment number 0 for v, 1 for u
is_utrue: u-side (p-side), false: v-side (n-side)
stripStrip number
Returns
threshold value

Definition at line 175 of file SVDStripNoiseMap.cc.

176{
177
178 if (strip < 0 || SVDPar::maxStrip <= strip) {
179 B2ERROR("Invalid strip number: " << LogVar("strip number", strip));
180 return -9999.0;
181 }
182
183 short sensor_id = SVDPar::getSVDSensorID(id, is_u);
184 if (sensor_id < 0 || SVDPar::nSensorID <= sensor_id) {
185 B2ERROR("Invalid SVDSensorID: " << LogVar("SVDSensorID", sensor_id));
186 return -9999.0;
187 }
188
189 return m_thresholdMap[sensor_id][strip];
190}

◆ initializeMap()

int initializeMap ( const std::string &  noisefilename = "")

Initialize maps with input noisefile.

Definition at line 36 of file SVDStripNoiseMap.cc.

37{
38
39 B2INFO("initializeMap()");
40
41 if (noisefilename == "") {
42 B2INFO("CAUTION:: Pedestal and noise values are not changed, because noise file is not specified.");
43 return 0;
44 }
45
46 if (m_onl2offl_map_ptr == nullptr) {
47 B2ERROR("SVDOnlineToOfflineMap is not assigned correctly.");
48 return -1;
49 }
50
51 memset(m_pedestalMap, 0, sizeof(m_pedestalMap));
52 memset(m_noiseMap, 0, sizeof(m_noiseMap));
53 memset(m_thresholdMap, 0, sizeof(m_thresholdMap));
54 memset(m_goodStripMap, 0, sizeof(m_goodStripMap));
55
56 ifstream noisefile(noisefilename.c_str());
57 if (!noisefile.is_open()) {
58 B2ERROR("Cannot open noise file: " << noisefilename);
59 return -1;
60 }
61
62 int module, apv, strip, fadc, fadc_ch, good;
63 float pedestal, gaus_noise, noise, rms, cmc;
64
65 short file_section = 0;
66 string line;
67 while (getline(noisefile, line)) {
68
69 if (line.substr(0, 1) == "#") continue;
70
71 size_t space_pos;
72 while ((space_pos = line.find(" ")) != string::npos) {
73 line.erase(space_pos, 1);
74 }
75
76 if (line.empty()) continue;
77
78 //B2INFO(line);
79
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;
84 }//if(line.substr(0,1)=="["&&line.substr(line.size()-1,1)=="]"){
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);
89
90 //**************************************************
91 //*** This fadc_id definition is workround solution
92 //*** for DESY beam data analysis.
93 //*** It must be removed in future. (Katsuro)
94 //**************************************************
95 short fadc_id = 0;
96 if (fadc == 0) fadc_id = 1; //0x01 (p-side)
97 else if (fadc == 1) fadc_id = 129; //0x81 (n-side)
98 else fadc_id = 1; //0x01
99 //**************************************************
100
101 //*** module value starts from 1 ***//
102 unsigned short apv_base = 0;
103 switch (module) {
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;
113 }
114 unsigned short apv_id = apv_base + apv;
115 VxdID vxd_id =
116 (m_onl2offl_map_ptr->getSensorInfo(fadc_id, apv_id)).m_sensorID;
117 //bool is_u = (((fadc_id>>7)&0x1)==0x0) ? true : false;
118 bool is_u =
119 (m_onl2offl_map_ptr->getSensorInfo(fadc_id, apv_id)).m_uSide;
120 short svd_sensor_id = SVDPar::getSVDSensorID(vxd_id, is_u);
121 if (svd_sensor_id < 0) {
122 B2ERROR("Invalid SVDSensorID: " << LogVar("SVDSensorID", svd_sensor_id) << " (FADC ID: " << fadc_id << ", APV: " << apv << ")");
123 return -1;
124 }
125
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);
128
129 m_pedestalMap [svd_sensor_id][strip] = pedestal;
130 m_noiseMap [svd_sensor_id][strip] = gaus_noise;
131 m_thresholdMap[svd_sensor_id][strip] = 5 * gaus_noise;
132 m_goodStripMap[svd_sensor_id][strip] = (good == 0) ? false : true;
133
134 }//else if(file_section==1){
135
136 }//while(getline(noisefile,line)){
137
138 return 0;
139}
const SensorInfo & getSensorInfo(unsigned char FADC, unsigned char APV25)
Get SensorInfo for a given FADC/APV combination.
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
baseType getID() const
Get the unique id.
Definition: VxdID.h:94

◆ isGood()

bool isGood ( VxdID  id,
bool  is_u,
short  strip 
)

Check whether the strip is available or not.

Parameters
idVxdID of the required sensor, with segment number 0 for v, 1 for u
is_utrue: u-side (p-side), false: v-side (n-side)
stripStrip number
Returns
true if the strip is available, otherwise false

Definition at line 192 of file SVDStripNoiseMap.cc.

193{
194
195 if (strip < 0 || SVDPar::maxStrip <= strip) {
196 B2ERROR("Invalid strip number: " << LogVar("strip number", strip));
197 return false;
198 }
199
200 short sensor_id = SVDPar::getSVDSensorID(id, is_u);
201 if (sensor_id < 0 || SVDPar::nSensorID <= sensor_id) {
202 B2ERROR("Invalid SVDSensorID: " << LogVar("SVDSensorID", sensor_id));
203 return false;
204 }
205
206 return m_goodStripMap[sensor_id][strip];
207}

Member Data Documentation

◆ m_goodStripMap

bool m_goodStripMap[SVDPar::nSensorID][SVDPar::maxStrip]
private

Good strip map.

Definition at line 102 of file SVDStripNoiseMap.h.

◆ m_noiseMap

float m_noiseMap[SVDPar::nSensorID][SVDPar::maxStrip]
private

noise map for all strips in ladders.

Definition at line 94 of file SVDStripNoiseMap.h.

◆ m_onl2offl_map_ptr

SVDOnlineToOfflineMap* m_onl2offl_map_ptr
private

Pointer to SVDOnlineToOfflineMap.

This map represents relationship between ADC+APV and Layer+Ladder+Sensor and it is necessary to convert the noise file to pedestal, noise, and threshold maps with initializeMap() function.

Definition at line 86 of file SVDStripNoiseMap.h.

◆ m_pedestalMap

float m_pedestalMap[SVDPar::nSensorID][SVDPar::maxStrip]
private

Pedestal map for all strips in ladders.

Definition at line 90 of file SVDStripNoiseMap.h.

◆ m_thresholdMap

float m_thresholdMap[SVDPar::nSensorID][SVDPar::maxStrip]
private

threshold map for all strips in ladders.

Definition at line 98 of file SVDStripNoiseMap.h.


The documentation for this class was generated from the following files: