Changeset 8955 for trunk/MagicSoft/Mars/mreport/MReportCC.cc
- Timestamp:
- 06/14/08 15:19:45 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mreport/MReportCC.cc
r8287 r8955 18 18 ! Author(s): Thomas Bretz, 12/2003 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 320 ! Copyright: MAGIC Software Development, 2000-2008 21 21 ! 22 22 ! … … 44 44 45 45 #include "MParList.h" 46 47 #include "MReportRec.h" 46 48 47 49 #include "MCameraTH.h" … … 71 73 Bool_t MReportCC::SetupReading(MParList &plist) 72 74 { 75 fRecRep = (MReportRec*)plist.FindCreateObj("MReportRec"); 76 if (!fRecRep) 77 return kFALSE; 78 79 fRecTime = (MTime*)plist.FindCreateObj("MTime", "MTimeRec"); 80 if (!fRecTime) 81 return kFALSE; 82 83 73 84 fTH = (MCameraTH*)plist.FindCreateObj("MCameraTH"); 74 85 if (!fTH) … … 83 94 return kFALSE; 84 95 96 85 97 return MReport::SetupReading(plist); 86 98 } 87 88 // --------------------------------------------------------------------------89 //90 // Check whether the given TString begins with the given tag. Remove91 // the tag from the string.92 //93 Bool_t MReportCC::CheckTag(TString &str, const char *tag) const94 {95 if (!str.BeginsWith(tag))96 {97 *fLog << warn << "WARNING - '" << tag << "' tag not found." << endl;98 return kFALSE;99 }100 str.Remove(0, strlen(tag)); // Remove Tag101 return kTRUE;102 }103 104 99 105 100 // -------------------------------------------------------------------------- … … 123 118 if (n!=6) 124 119 { 125 *fLog << warn << "WARNING - Wrong number of arguments." << endl; 120 cout << n << endl; 121 *fLog << warn << "WARNING - Wrong number of arguments (should be 6)." << endl; 126 122 return kFALSE; 127 123 } 128 124 129 125 str.Remove(0, len); 130 131 return kTRUE;132 }133 134 // --------------------------------------------------------------------------135 //136 // Interprete the TH (discriminator thresholds) part of the report137 //138 Bool_t MReportCC::InterpreteTH(TString &str, Int_t ver)139 {140 if (!CheckTag(str, "TH "))141 return kFALSE;142 143 // Skip the TH (discriminator thresholds) part of the report (for old144 // CC files with wrong or nonsense number of TH-Bytes)145 if (ver<200507190)146 {147 Ssiz_t pr = str.First(' ');148 if (pr<0)149 {150 *fLog << warn << "WARNING - No TH information found at all." << endl;151 return kFALSE;152 }153 if (pr!=1154)154 {155 fTD->Invalidate();156 157 str.Remove(0, pr);158 str=str.Strip(TString::kLeading);159 return kTRUE;160 }161 }162 163 const char *pos = str.Data();164 const char *end = str.Data()+577*2;165 166 Int_t i=0;167 while (pos<end)168 {169 const Char_t hex[3] = { pos[0], pos[1], 0 };170 pos += 2;171 172 const Int_t n=sscanf(hex, "%2hhx", &fTH->fTH[i++]);173 if (n==1)174 continue;175 176 *fLog << warn << "WARNING - Reading hexadecimal TH information." << endl;177 return kFALSE;178 }179 180 fTH->SetValid();181 182 str.Remove(0, end-str.Data()); // Remove TH183 str=str.Strip(TString::kLeading);184 return kTRUE;185 }186 187 // --------------------------------------------------------------------------188 //189 // Interprete the TD (discriminator delays) part of the report190 //191 Bool_t MReportCC::InterpreteTD(TString &str, Int_t ver)192 {193 if (!CheckTag(str, "TD "))194 return kFALSE;195 196 // Skip the TD (discriminator delays) part of the report (for old197 // CC files with wrong or nonsense number of TD-Bytes)198 if (ver<200412210)199 {200 Ssiz_t pr = str.First(' ');201 if (pr<0)202 {203 *fLog << warn << "WARNING - No TD information found at all." << endl;204 return kFALSE;205 }206 if (pr!=1000)207 {208 fTD->Invalidate();209 210 str.Remove(0, pr);211 str=str.Strip(TString::kLeading);212 return kTRUE;213 }214 }215 216 // Older files have less bytes (pixels) stored217 const Int_t numpix = ver<200510250 ? 500 : 577;218 219 const char *pos = str.Data();220 const char *end = str.Data()+numpix*2;221 222 Int_t i=0;223 while (pos<end)224 {225 const Char_t hex[3] = { pos[0], pos[1], 0 };226 pos += 2;227 228 const Int_t n=sscanf(hex, "%2hhx", &fTD->fTD[i++]);229 if (n==1)230 continue;231 232 *fLog << warn << "WARNING - Reading hexadecimal TD information." << endl;233 return kFALSE;234 }235 236 fTD->SetValid();237 238 str.Remove(0, end-str.Data()); // Remove TD239 str=str.Strip(TString::kLeading);240 241 return kTRUE;242 }243 244 245 // --------------------------------------------------------------------------246 //247 // Interprete the receiver board temperature part of the report248 //249 Bool_t MReportCC::InterpreteRecTemp(TString &str)250 {251 if (!CheckTag(str, "RECTEMP "))252 return kFALSE;253 254 Int_t len;255 for (Int_t i=0; i<76; i++)256 {257 const Int_t n=sscanf(str.Data(), "%f %n", &fRecTemp->fRecTemp[i], &len);258 str.Remove(0, len);259 260 if (n==1)261 continue;262 263 if (n==0 && i==0)264 {265 *fLog << inf << "Receiver Board Temperatures empty." << endl;266 fRecTemp->Invalidate();267 break;268 }269 270 *fLog << warn << "WARNING - Reading Receiver Board Temperature information." << endl;271 return kFALSE;272 }273 126 274 127 return kTRUE; … … 291 144 return kCONTINUE; 292 145 293 if ( str.BeginsWith("RECEIVERS-COM-ERROR"))146 if (ver<200805190) 294 147 { 295 *fLog << inf << "Receiver Com-error... threshold setting and receiver board temp. invalid." << endl; 296 fTD->Invalidate(); 297 fTH->Invalidate(); 298 fRecTemp->Invalidate(); 299 str.Remove(0, 19); 300 } 301 else 302 { 303 if (!InterpreteTH(str, ver)) 304 return kCONTINUE; 305 306 if (!InterpreteTD(str, ver)) 307 return kCONTINUE; 308 309 if (ver>=200510250) 310 if (!InterpreteRecTemp(str)) 311 return kCONTINUE; 148 fRecRep->InterpreteRec(str, ver, *fTH, *fTD, *fRecTemp); 149 fRecRep->Copy(*this); 150 fRecRep->SetReadyToSave(); 312 151 } 313 152
Note:
See TracChangeset
for help on using the changeset viewer.