- Timestamp:
- 11/13/11 18:06:05 (13 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/PixelMap.cc
r12165 r12507 1 1 #include "PixelMap.h" 2 2 3 const PixelMapEntry PixelMap::empty = { -1, 0, 0, 0, 0, 0 }; 3 const PixelMapEntry PixelMap::empty = { -1, 0, 0, 0, 0 }; 4 const BiasMapEntry BiasMap::empty = { -1, 0, 0, 0 }; -
trunk/FACT++/src/PixelMap.h
r12407 r12507 20 20 int cbpx; /// Hardware index as CBPX 21 21 int gapd; /// gAPD index 22 float Vgapd; /// gAPD Bias voltage22 // float Vgapd; /// gAPD Bias voltage 23 23 int hv_board; /// Bias suppply board 24 24 int hv_channel; /// Bias supply channel … … 62 62 std::stringstream str(buf); 63 63 64 int idummy; 64 int idummy; 65 float fdummy; 65 66 66 67 PixelMapEntry entry; … … 71 72 str >> idummy; 72 73 str >> entry.gapd; 73 str >> entry.Vgapd;74 str >> fdummy; //entry.Vgapd; 74 75 str >> entry.hv_board; 75 76 str >> entry.hv_channel; … … 140 141 } 141 142 143 /* 142 144 float Vgapd(int board, int channel) const 143 145 { … … 180 182 181 183 return avg; 182 } 183 }; 184 185 #endif 184 }*/ 185 }; 186 187 struct BiasMapEntry 188 { 189 int hv_board; /// Bias suppply board 190 int hv_channel; /// Bias supply channel 191 float Vnom; /// Channel bias voltage nominal 192 float Voff; /// Channel bias voltage offset 193 194 int hv() const { return hv_channel+hv_board*32; } 195 }; 196 197 class BiasMap : public std::vector<BiasMapEntry> 198 { 199 public: 200 static const BiasMapEntry empty; 201 202 BiasMap() : std::vector<BiasMapEntry>(416) 203 { 204 } 205 206 bool Read(const std::string &fname) 207 { 208 std::ifstream fin(fname); 209 210 int l = 0; 211 212 std::string buf; 213 while (getline(fin, buf, '\n')) 214 { 215 if (l>416) 216 break; 217 218 buf = Tools::Trim(buf); 219 if (buf[0]=='#') 220 continue; 221 222 std::stringstream str(buf); 223 224 BiasMapEntry entry; 225 226 str >> entry.hv_board; 227 str >> entry.hv_channel; 228 str >> entry.Vnom; 229 str >> entry.Voff; 230 231 if (entry.hv_channel+32*entry.hv_board>=416) 232 { 233 #ifdef DEBUG 234 cerr << "Invalid board/channel read from " << fname << "." << endl; 235 #endif 236 return false; 237 } 238 239 (*this)[l++] = entry; 240 } 241 242 return l==1440; 243 } 244 245 const BiasMapEntry &hv(int board, int channel) const 246 { 247 for (std::vector<BiasMapEntry>::const_iterator it=begin(); it!=end(); it++) 248 if (it->hv_board==board && it->hv_channel==channel) 249 return *it; 250 #ifdef DEBUG 251 std::cerr << "PixelMap: hv " << board << "/" << channel << " not found" << std::endl; 252 #endif 253 return empty; 254 } 255 256 const BiasMapEntry &hv(int idx) const 257 { 258 return hv(idx/32, idx%32); 259 } 260 261 float Vgapd(int board, int channel) const 262 { 263 const BiasMapEntry &entry = hv(board, channel); 264 return entry.Vnom+entry.Voff; 265 } 266 267 float Vgapd(int idx) const 268 { 269 return Vgapd(idx/32, idx%32); 270 } 271 272 std::vector<float> Vgapd() const 273 { 274 std::vector<float> volt(416); 275 276 for (std::vector<BiasMapEntry>::const_iterator it=begin(); it!=end(); it++) 277 { 278 const int ch = it->hv_board*32 + it->hv_channel; 279 volt[ch] += it->Vnom+it->Voff; 280 } 281 282 return volt; 283 } 284 }; 285 286 #endif -
trunk/FACT++/src/biasctrl.cc
r12360 r12507 2058 2058 // -------------------------------------------------------------------------- 2059 2059 2060 PixelMap map;2061 if (!map.Read(conf.Get<string>(" pixel-map-file")))2062 { 2063 T::Error("Reading reference voltages from "+conf.Get<string>(" pixel-map-file")+" failed.");2060 BiasMap map; 2061 if (!map.Read(conf.Get<string>("bias-map-file"))) 2062 { 2063 T::Error("Reading reference voltages from "+conf.Get<string>("bias-map-file")+" failed."); 2064 2064 return 5; 2065 2065 } … … 2102 2102 ("volt-max-abs", var<float>(75), "Absolte upper limit for the voltage (in Volts)") 2103 2103 ("volt-max-rel", var<float>(2.5), "Relative upper limit for the voltage w.r.t. the G-APD reference voltage (in Volts)") 2104 (" pixel-map-file", var<string>("FACTmapV5a.txt"), "Pixel mapping file. Used here to get the default reference voltage.")2104 ("bias-map-file", var<string>("GAPDmap.txt"), "File with nominal and offset voltages for each channel.") 2105 2105 ; 2106 2106
Note:
See TracChangeset
for help on using the changeset viewer.