Changeset 16
- Timestamp:
- 03/23/09 15:38:22 (16 years ago)
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pixelmap/Pixel.cc
r12 r16 10 10 _HVboard(HVboard), _HVchain(HVchain), _HVchannel(HVchannel) { 11 11 12 // check here whether values make sense and eventually give error messages12 //???check here whether values make sense and eventually give error messages??? 13 13 14 14 } -
pixelmap/PixelMap.cc
r12 r16 6 6 #include <cctype> 7 7 8 PixelMap::PixelMap( ) {8 PixelMap::PixelMap(bool verbose) { 9 9 10 10 pixelmap.clear(); 11 ReadPixelMap(pixelmap, false);11 ReadPixelMap(pixelmap, verbose); 12 12 13 13 } … … 26 26 std::ifstream infile(filename.c_str(), std::fstream::in); 27 27 28 std::cout<<"Reading mapping file: "<<filename<<std::endl<<std::endl; 29 30 if (!infile.good()) { 31 std::cerr<<"ERROR in PixelMap::ReadPixelMap: File "<<filename<<" cannot be found."<<std::endl; 28 if (verbose) { 29 std::cout<<"Reading mapping file: "<<filename<<std::endl<<std::endl; 30 if (!infile.good()) { 31 std::cerr<<"ERROR in PixelMap::ReadPixelMap: File "<<filename<<" cannot be found."<<std::endl; 32 } 32 33 } 33 34 … … 73 74 } 74 75 75 if (verbose) {76 77 }76 //if (verbose) { 77 // std::cout << "Formated pixel name: " << name2 << std::endl; 78 //} 78 79 79 80 if( (count1 > 4) && (count1 < 7) && (count2 == 2) ) { … … 99 100 else { 100 101 101 std::cout << "ERROR in PixelMap::ReadPixelMap: Wrong pixel name: " << name2 << " -> pixel not initialized" << std::endl; 102 if (verbose) { 103 std::cout << "ERROR in PixelMap::ReadPixelMap: Wrong pixel name: " << name2 << " -> pixel not initialized" << std::endl; 104 } 102 105 103 106 } … … 108 111 109 112 if(verbose){ 110 111 113 std::cout << "Skipping empty line" << std::endl; 112 113 114 } 114 115 … … 119 120 } 120 121 121 if(verbose){ 122 for( std::map<const std::string, Pixel*>::iterator iter = pixelmap.begin(); iter != pixelmap.end(); ++iter ) { 123 std::cout << std::endl << (*iter).first << std::endl << "-----------" << std::endl << *((*iter).second); 124 } 125 } 126 127 std::cout << pixelmap.size() << " pixels found" << std::endl << std::endl; 122 if (verbose) { 123 std::cout << std::endl << pixelmap.size() << " pixels found" << std::endl << std::endl; 124 } 128 125 129 126 infile.close(); … … 141 138 } 142 139 143 std::string PixelMap::DRS_to_Pixel(unsigned int DRSboard, unsigned int DRSchip, unsigned int DRSchannel ) {140 std::string PixelMap::DRS_to_Pixel(unsigned int DRSboard, unsigned int DRSchip, unsigned int DRSchannel, bool verbose) { 144 141 145 142 std::string pixelname = ""; … … 158 155 159 156 if(pixelname == ""){ 160 161 std::cout << "ERROR in PixelMap::DRS_to_Pixel: No pixel with DRS board, chip, channel = "162 << DRSboard << ", "163 << DRSchip << ", "164 << DRSchannel << " found in pixelmap" << std::endl;165 157 158 if (verbose) { 159 std::cout << "ERROR in PixelMap::DRS_to_Pixel: No pixel with DRS board, chip, channel = " 160 << DRSboard << ", " 161 << DRSchip << ", " 162 << DRSchannel << " found in pixelmap" << std::endl; 163 } 164 166 165 } 167 166 … … 170 169 } 171 170 172 std::string PixelMap::HV_to_Pixel(unsigned int HVboard, unsigned int HVchain, unsigned int HVchannel ) {171 std::string PixelMap::HV_to_Pixel(unsigned int HVboard, unsigned int HVchain, unsigned int HVchannel, bool verbose) { 173 172 174 173 std::string pixelname = ""; … … 188 187 if(pixelname == ""){ 189 188 190 std::cout << "ERROR in PixelMap::HV_to_Pixel: No pixel with HV board, chain, channel = " 191 << HVboard << ", " 192 << HVchain << ", " 193 << HVchannel << " found in pixelmap" << std::endl; 194 189 if (verbose) { 190 std::cout << "ERROR in PixelMap::HV_to_Pixel: No pixel with HV board, chain, channel = " 191 << HVboard << ", " 192 << HVchain << ", " 193 << HVchannel << " found in pixelmap" << std::endl; 194 } 195 195 196 } 196 197 … … 199 200 } 200 201 201 unsigned int PixelMap::Pixel_to_DRSboard(std::string pixelname ) {202 unsigned int PixelMap::Pixel_to_DRSboard(std::string pixelname, bool verbose) { 202 203 203 204 unsigned int DRSboard = 999999999; 204 205 205 if(pixelmap[pixelname] != NULL) { 206 207 DRSboard = pixelmap[pixelname]->GetPixelDRSboard(); 208 209 } 210 211 else { 212 213 std::cout << "ERROR in PixelMap::Pixel_to_DRSboard: No pixel with name = " 214 << pixelname << " found in pixelmap" << std::endl; 206 for( std::map<const std::string, Pixel*>::iterator iter = pixelmap.begin(); iter != pixelmap.end(); ++iter ) { 207 208 if( ((*iter).first) == pixelname ){ 209 DRSboard = ((*iter).second)->GetPixelDRSboard(); 210 } 211 212 } 213 214 if (DRSboard == 999999999) { 215 216 if (verbose) { 217 std::cout << "ERROR in PixelMap::Pixel_to_DRSboard: No pixel with name = " 218 << pixelname << " found in pixelmap" << std::endl; 219 } 215 220 216 221 } … … 220 225 } 221 226 222 unsigned int PixelMap::Pixel_to_DRSchip(std::string pixelname ) {227 unsigned int PixelMap::Pixel_to_DRSchip(std::string pixelname, bool verbose) { 223 228 224 229 unsigned int DRSchip = 999999999; 225 230 226 if(pixelmap[pixelname] != NULL) { 227 228 DRSchip = pixelmap[pixelname]->GetPixelDRSchip(); 229 230 } 231 232 else { 233 234 std::cout << "ERROR in PixelMap::Pixel_to_DRSchip: No pixel with name = " 235 << pixelname << " found in pixelmap" << std::endl; 231 for( std::map<const std::string, Pixel*>::iterator iter = pixelmap.begin(); iter != pixelmap.end(); ++iter ) { 232 233 if( ((*iter).first) == pixelname ){ 234 DRSchip = ((*iter).second)->GetPixelDRSchip(); 235 } 236 237 } 238 239 if (DRSchip == 999999999) { 240 241 if (verbose) { 242 std::cout << "ERROR in PixelMap::Pixel_to_DRSchip: No pixel with name = " 243 << pixelname << " found in pixelmap" << std::endl; 244 } 236 245 237 246 } … … 241 250 } 242 251 243 unsigned int PixelMap::Pixel_to_DRSchannel(std::string pixelname ) {252 unsigned int PixelMap::Pixel_to_DRSchannel(std::string pixelname, bool verbose) { 244 253 245 254 unsigned int DRSchannel = 999999999; 246 255 247 if(pixelmap[pixelname] != NULL) { 248 249 DRSchannel = pixelmap[pixelname]->GetPixelDRSchannel(); 250 251 } 252 253 else { 254 255 std::cout << "ERROR in PixelMap::Pixel_to_DRSchannel: No pixel with name = " 256 << pixelname << " found in pixelmap" << std::endl; 256 for( std::map<const std::string, Pixel*>::iterator iter = pixelmap.begin(); iter != pixelmap.end(); ++iter ) { 257 258 if( ((*iter).first) == pixelname ){ 259 DRSchannel = ((*iter).second)->GetPixelDRSchannel(); 260 } 261 262 } 263 264 if (DRSchannel == 999999999) { 265 266 if (verbose) { 267 std::cout << "ERROR in PixelMap::Pixel_to_DRSchannel: No pixel with name = " 268 << pixelname << " found in pixelmap" << std::endl; 269 } 257 270 258 271 } … … 262 275 } 263 276 264 unsigned int PixelMap::Pixel_to_HVboard(std::string pixelname ) {277 unsigned int PixelMap::Pixel_to_HVboard(std::string pixelname, bool verbose) { 265 278 266 279 unsigned int HVboard = 999999999; 267 280 268 if(pixelmap[pixelname] != NULL) { 269 270 HVboard = pixelmap[pixelname]->GetPixelHVboard(); 271 272 } 273 274 else { 275 276 std::cout << "ERROR in PixelMap::Pixel_to_HVboard: No pixel with name = " 277 << pixelname << " found in pixelmap" << std::endl; 281 for( std::map<const std::string, Pixel*>::iterator iter = pixelmap.begin(); iter != pixelmap.end(); ++iter ) { 282 283 if( ((*iter).first) == pixelname ){ 284 HVboard = ((*iter).second)->GetPixelHVboard(); 285 } 286 287 } 288 289 if (HVboard == 999999999) { 290 291 if (verbose) { 292 std::cout << "ERROR in PixelMap::Pixel_to_HVboard: No pixel with name = " 293 << pixelname << " found in pixelmap" << std::endl; 294 } 278 295 279 296 } … … 283 300 } 284 301 285 unsigned int PixelMap::Pixel_to_HVchain(std::string pixelname ) {302 unsigned int PixelMap::Pixel_to_HVchain(std::string pixelname, bool verbose) { 286 303 287 304 unsigned int HVchain = 999999999; 288 305 289 if(pixelmap[pixelname] != NULL) { 290 291 HVchain = pixelmap[pixelname]->GetPixelHVchain(); 292 293 } 294 295 else { 296 297 std::cout << "ERROR in PixelMap::Pixel_to_HVchain: No pixel with name = " 298 << pixelname << " found in pixelmap" << std::endl; 306 for( std::map<const std::string, Pixel*>::iterator iter = pixelmap.begin(); iter != pixelmap.end(); ++iter ) { 307 308 if( ((*iter).first) == pixelname ){ 309 HVchain = ((*iter).second)->GetPixelHVchain(); 310 } 311 312 } 313 314 if (HVchain == 999999999) { 315 316 if (verbose) { 317 std::cout << "ERROR in PixelMap::Pixel_to_HVchain: No pixel with name = " 318 << pixelname << " found in pixelmap" << std::endl; 319 } 299 320 300 321 } … … 304 325 } 305 326 306 unsigned int PixelMap::Pixel_to_HVchannel(std::string pixelname ) {327 unsigned int PixelMap::Pixel_to_HVchannel(std::string pixelname, bool verbose) { 307 328 308 329 unsigned int HVchannel = 999999999; 309 330 310 if(pixelmap[pixelname] != NULL) { 311 312 HVchannel = pixelmap[pixelname]->GetPixelHVchannel(); 313 314 } 315 316 else { 317 318 std::cout << "ERROR in PixelMap::Pixel_to_HVchannel: No pixel with name = " 319 << pixelname << " found in pixelmap" << std::endl; 320 321 } 331 for( std::map<const std::string, Pixel*>::iterator iter = pixelmap.begin(); iter != pixelmap.end(); ++iter ) { 332 333 if( ((*iter).first) == pixelname ){ 334 HVchannel = ((*iter).second)->GetPixelHVchannel(); 335 } 336 337 } 338 339 if (HVchannel == 999999999) { 340 341 if (verbose) { 342 std::cout << "ERROR in PixelMap::Pixel_to_HVchannel: No pixel with name = " 343 << pixelname << " found in pixelmap" << std::endl; 344 } 345 346 } 322 347 323 348 return HVchannel; -
pixelmap/PixelMap.h
r9 r16 13 13 public: 14 14 15 PixelMap( );15 PixelMap(bool verbose=false); 16 16 ~PixelMap(); 17 17 … … 21 21 void Print(); 22 22 23 std::string DRS_to_Pixel(unsigned int DRSboard, unsigned int DRSchip, unsigned int DRSchannel );24 std::string HV_to_Pixel(unsigned int HVboard, unsigned int HVchain, unsigned int HVchannel );23 std::string DRS_to_Pixel(unsigned int DRSboard, unsigned int DRSchip, unsigned int DRSchannel, bool verbose=false); 24 std::string HV_to_Pixel(unsigned int HVboard, unsigned int HVchain, unsigned int HVchannel, bool verbose=false); 25 25 26 unsigned int Pixel_to_DRSboard(std::string pixelname );27 unsigned int Pixel_to_DRSchip(std::string pixelname );28 unsigned int Pixel_to_DRSchannel(std::string pixelname );26 unsigned int Pixel_to_DRSboard(std::string pixelname, bool verbose=false); 27 unsigned int Pixel_to_DRSchip(std::string pixelname, bool verbose=false); 28 unsigned int Pixel_to_DRSchannel(std::string pixelname, bool verbose=false); 29 29 30 unsigned int Pixel_to_HVboard(std::string pixelname );31 unsigned int Pixel_to_HVchain(std::string pixelname );32 unsigned int Pixel_to_HVchannel(std::string pixelname );30 unsigned int Pixel_to_HVboard(std::string pixelname, bool verbose=false); 31 unsigned int Pixel_to_HVchain(std::string pixelname, bool verbose=false); 32 unsigned int Pixel_to_HVchannel(std::string pixelname, bool verbose=false); 33 33 34 34 }; -
tools/pixelmap_test/PixelMapTest.cc
r11 r16 12 12 std::cout << std::endl; 13 13 14 PixelMap* pm = new PixelMap( );14 PixelMap* pm = new PixelMap(true); 15 15 16 16 pm->Print(); 17 17 18 std::string drs1 = pm->DRS_to_Pixel(0,0,0 );18 std::string drs1 = pm->DRS_to_Pixel(0,0,0,true); 19 19 std::cout << "Name: " << drs1 << std::endl; 20 20 21 std::string drs2 = pm->DRS_to_Pixel(1,0,0 );21 std::string drs2 = pm->DRS_to_Pixel(1,0,0,true); 22 22 std::cout << "Name: " << drs2 << std::endl; 23 23 24 std::string hv1 = pm->HV_to_Pixel(6,1,8); 24 std::string drs3 = pm->DRS_to_Pixel(0,0,0,true); 25 std::cout << "Name: " << drs3 << std::endl; 26 27 std::string hv1 = pm->HV_to_Pixel(6,1,8,true); 25 28 std::cout << "Name: " << hv1 << std::endl; 26 29 27 std::string hv2 = pm->HV_to_Pixel( 1,0,0);30 std::string hv2 = pm->HV_to_Pixel(6,9,1,true); 28 31 std::cout << "Name: " << hv2 << std::endl; 29 32 30 unsigned int drsb1 = pm->Pixel_to_DRSboard("0-1-1"); 33 std::string hv3 = pm->HV_to_Pixel(1,0,0,true); 34 std::cout << "Name: " << hv3 << std::endl; 35 36 unsigned int drsb1 = pm->Pixel_to_DRSboard("0-1-1",true); 31 37 std::cout << "Board: " << drsb1 << std::endl; 32 38 33 unsigned int drsb2 = pm->Pixel_to_DRSboard("1-0-0" );39 unsigned int drsb2 = pm->Pixel_to_DRSboard("1-0-0",true); 34 40 std::cout << "Board: " << drsb2 << std::endl; 35 41 36 unsigned int hvchain1 = pm->Pixel_to_HVchain("0-1-1"); 42 pm->Print(); 43 44 std::string drs4 = pm->DRS_to_Pixel(0,0,1,true); 45 std::cout << "Name: " << drs4 << std::endl; 46 47 unsigned int hvchain1 = pm->Pixel_to_HVchain("0-1-1",true); 37 48 std::cout << "Chain: " << hvchain1 << std::endl; 38 49 39 unsigned int hvchain2 = pm->Pixel_to_HVchain("1-0-0" );50 unsigned int hvchain2 = pm->Pixel_to_HVchain("1-0-0",true); 40 51 std::cout << "Chain: " << hvchain2 << std::endl; 41 52
Note:
See TracChangeset
for help on using the changeset viewer.