Changeset 12
- Timestamp:
- 03/10/09 10:34:17 (16 years ago)
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pixelmap/Pixel.cc
r9 r12 2 2 #include <iostream> 3 3 4 Pixel::Pixel() : _DRSboard( -1), _DRSchip(-1), _DRSchannel(-1),5 _HVboard( -1), _HVchain(-1), _HVchannel(-1) { }4 Pixel::Pixel() : _DRSboard(999999999), _DRSchip(999999999), _DRSchannel(999999999), 5 _HVboard(999999999), _HVchain(999999999), _HVchannel(999999999) { } 6 6 7 7 Pixel::Pixel(unsigned int DRSboard, unsigned int DRSchip, unsigned int DRSchannel, -
pixelmap/PixelMap.cc
r9 r12 4 4 #include <cstring> 5 5 #include <cstdlib> 6 #include <cctype> 6 7 7 8 PixelMap::PixelMap() { … … 27 28 std::cout<<"Reading mapping file: "<<filename<<std::endl<<std::endl; 28 29 29 if (!infile.good()) {30 if (!infile.good()) { 30 31 std::cerr<<"ERROR in PixelMap::ReadPixelMap: File "<<filename<<" cannot be found."<<std::endl; 31 32 } … … 33 34 while (infile.good()) { 34 35 35 char line[ 256];36 37 infile.getline(line, 256);38 39 if (line[0] == '#') {40 if (verbose) {36 char line[1024]; 37 38 infile.getline(line, 1024); 39 40 if (line[0] == '#') { 41 if (verbose) { 41 42 std::cout << "Ignoring comment: " << line << std::endl; 42 43 } … … 45 46 else { 46 47 47 if (strlen(line)!=0){48 if (strlen(line)!=0) { 48 49 49 50 char delim[] = ":"; 50 char *name = NULL; 51 char *name = NULL; //unformated name before : tokens 52 char name2[256] = ""; //formated name without whitespaces 51 53 char *rest = NULL; 52 54 53 55 name = strtok(line, delim); 54 56 55 if(strlen(name) > 4){ 57 unsigned int count1 = 0; //count non-whitespace characters in name 58 unsigned int count2 = 0; //count number of - in name 59 60 for (unsigned int i = 0; i < strlen(name); i++) { 61 62 if ( !(isspace(name[i])) ) { 63 64 name2[count1] = name[i]; 65 count1+=1; 66 67 if ( (name[i] == 45) ) { 68 count2+=1; 69 } 70 71 } 72 73 } 74 75 if (verbose) { 76 std::cout << "Formated pixel name: " << name2 << std::endl; 77 } 78 79 if( (count1 > 4) && (count1 < 7) && (count2 == 2) ) { 56 80 57 81 rest = strtok(NULL, delim); … … 66 90 unsigned int HVchannel = (unsigned int)strtod(rest, &rest); 67 91 68 pixelmap[name ] = new Pixel(DRSboard, DRSchip, DRSchannel,69 HVboard, HVchain, HVchannel);92 pixelmap[name2] = new Pixel(DRSboard, DRSchip, DRSchannel, 93 HVboard, HVchain, HVchannel); 70 94 71 95 } … … 75 99 else { 76 100 77 std::cout << "ERROR in PixelMap::ReadPixelMap: Wrong pixel name: " << name << "-> pixel not initialized" << std::endl; 101 std::cout << "ERROR in PixelMap::ReadPixelMap: Wrong pixel name: " << name2 << " -> pixel not initialized" << std::endl; 102 103 } 104 105 } 106 107 else { 108 109 if(verbose){ 110 111 std::cout << "Skipping empty line" << std::endl; 78 112 79 113 } -
tools/pixelmap_test/PixelMap.txt
r10 r12 9 9 # to be edited if DRS or HV channels change 10 10 # 11 # !!! do NOT edit the pixel name (x-x-x) !!!11 # Format for pixel names is (x-x-x), to be followed by : delimiter 12 12 # 13 13 # gAPD arrangement within pixel is NOT defined here … … 15 15 # ===================================================================== 16 16 # 17 # allowed field separators: space , tab, commain arbitrary combination17 # allowed field separators: space and tab in arbitrary combination 18 18 # 19 19 # empty lines allowed 20 20 # 21 # lines starting with # considered as comment21 # lines _starting_ with # considered as comment (first character!) 22 22 # 23 23 # =====================================================================
Note:
See TracChangeset
for help on using the changeset viewer.