Changeset 7430 for trunk/MagicSoft/Mars/mreport
- Timestamp:
- 11/25/05 14:47:57 (19 years ago)
- Location:
- trunk/MagicSoft/Mars/mreport
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/MagicSoft/Mars/mreport/MReportCC.cc ¶
r7188 r7430 43 43 #include "MLogManip.h" 44 44 45 #include "MAstro.h" 45 #include "MParList.h" 46 47 #include "MCameraTH.h" 48 #include "MCameraTD.h" 49 #include "MCameraRecTemp.h" 46 50 47 51 ClassImp(MReportCC); … … 62 66 // -------------------------------------------------------------------------- 63 67 // 68 // FindCreate the following objects: 69 // - MCameraTH 70 // 71 Bool_t MReportCC::SetupReading(MParList &plist) 72 { 73 fTH = (MCameraTH*)plist.FindCreateObj("MCameraTH"); 74 if (!fTH) 75 return kFALSE; 76 77 fTD = (MCameraTD*)plist.FindCreateObj("MCameraTD"); 78 if (!fTD) 79 return kFALSE; 80 81 fRecTemp = (MCameraRecTemp*)plist.FindCreateObj("MCameraRecTemp"); 82 if (!fRecTemp) 83 return kFALSE; 84 85 return MReport::SetupReading(plist); 86 } 87 88 // -------------------------------------------------------------------------- 89 // 90 // Check whether the given TString begins with the given tag. Remove 91 // the tag from the string. 92 // 93 Bool_t MReportCC::CheckTag(TString &str, const char *tag) const 94 { 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 Tag 101 return kTRUE; 102 } 103 104 105 // -------------------------------------------------------------------------- 106 // 64 107 // Interprete the body of the CC-REPORT string 65 108 // 66 Int_t MReportCC::InterpreteBody(TString &str, Int_t ver) 67 { 68 if (ver<200404070) 69 { 70 *fLog << err << "ERROR - MReportCC::InterpreteBody not prepared for "; 71 *fLog << " report-files with version<200404070" << endl; 72 return kFALSE; 73 } 74 109 Bool_t MReportCC::InterpreteCC(TString &str, Int_t ver) 110 { 75 111 const Int_t skip = ver<200407270 ? 30 : 31; 76 112 113 // Remove the 30/31 tokens of the subsystem status 114 // table 12.1 p59 77 115 for (int i=0; i<skip; i++) 78 116 str.Remove(0, str.First(' ')+1); … … 86 124 { 87 125 *fLog << warn << "WARNING - Wrong number of arguments." << endl; 88 return k CONTINUE;126 return kFALSE; 89 127 } 90 128 91 129 str.Remove(0, len); 92 130 93 for (int i=0; i<4; i++) // 2*UPS, TH, 577%x, TD, 577%x 94 str.Remove(0, str.First(' ')+1); 131 return kTRUE; 132 } 133 134 // -------------------------------------------------------------------------- 135 // 136 // Interprete the TH (discriminator thresholds) part of the report 137 // 138 Bool_t MReportCC::InterpreteTH(TString &str) 139 { 140 if (!CheckTag(str, "TH ")) 141 return kFALSE; 142 143 const char *pos = str.Data(); 144 const char *end = str.Data()+577*2; 145 146 Int_t i=0; 147 while (pos<end) 148 { 149 const Char_t hex[2] = { pos[0], pos[1] }; 150 pos += 2; 151 152 const Int_t n=sscanf(hex, "%2hx", &fTH->fTH[i++]); 153 if (n==1) 154 continue; 155 156 *fLog << warn << "WARNING - Reading hexadecimal TH information." << endl; 157 return kFALSE; 158 } 159 160 str.Remove(0, end-str.Data()); // Remove TH 161 str=str.Strip(TString::kLeading); 162 return kTRUE; 163 } 164 165 // -------------------------------------------------------------------------- 166 // 167 // Interprete the TD (discriminator delays) part of the report 168 // 169 Bool_t MReportCC::InterpreteTD(TString &str, Int_t ver) 170 { 171 if (!CheckTag(str, "TD ")) 172 return kFALSE; 173 174 const Int_t numpix = ver<200510250 ? 500 : 577; 175 176 const char *pos = str.Data(); 177 const char *end = str.Data()+numpix*2; 178 179 Int_t i=0; 180 while (pos<end) 181 { 182 const Char_t hex[3] = { pos[0], pos[1], 0 }; 183 pos += 2; 184 185 const Int_t n=sscanf(hex, "%2hx", &fTD->fTD[i++]); 186 if (n==1) 187 continue; 188 189 *fLog << warn << "WARNING - Reading hexadecimal TD information." << endl; 190 return kFALSE; 191 } 192 193 str.Remove(0, end-str.Data()); // Remove TD 194 str=str.Strip(TString::kLeading); 195 return kTRUE; 196 } 197 198 199 // -------------------------------------------------------------------------- 200 // 201 // Interprete the receiver board temperature part of the report 202 // 203 Bool_t MReportCC::InterpreteRecTemp(TString &str) 204 { 205 if (!CheckTag(str, "RECTEMP ")) 206 return kFALSE; 207 208 Int_t len; 209 for (Int_t i=0; i<76; i++) 210 { 211 const Int_t n=sscanf(str.Data(), "%f %n", &fRecTemp->fRecTemp[i], &len); 212 str.Remove(0, len); 213 214 if (n==1) 215 continue; 216 217 *fLog << warn << "WARNING - Reading Receiver Board Temperature information." << endl; 218 return kFALSE; 219 } 220 221 return kTRUE; 222 } 223 224 // -------------------------------------------------------------------------- 225 // 226 // Interprete the body of the CC-REPORT string 227 // 228 Int_t MReportCC::InterpreteBody(TString &str, Int_t ver) 229 { 230 if (ver<200404070) 231 { 232 *fLog << err << "ERROR - MReportCC::InterpreteBody not prepared for "; 233 *fLog << " report-files with version<200404070" << endl; 234 return kFALSE; 235 } 236 237 if (!InterpreteCC(str, ver)) 238 return kCONTINUE; 239 240 if (!InterpreteTH(str)) 241 return kCONTINUE; 242 243 if (!InterpreteTD(str, ver)) 244 return kCONTINUE; 245 246 if (ver>200510250) 247 if (!InterpreteRecTemp(str)) 248 return kCONTINUE; 95 249 96 250 if (str.Strip(TString::kBoth)!=(TString)"OVER") 97 251 { 98 *fLog << err << "ERROR - Termination (OVER) too far away." << endl;252 *fLog << warn << "WARNING - 'OVER' tag not found." << endl; 99 253 return kCONTINUE; 100 254 } -
TabularUnified trunk/MagicSoft/Mars/mreport/MReportCC.h ¶
r7188 r7430 6 6 #endif 7 7 8 class MCameraTH; 9 class MCameraTD; 10 class MCameraRecTemp; 11 8 12 class MReportCC : public MReport 9 13 { 10 14 private: 11 Float_t fHumidity; // [%]12 Float_t fTemperature; // [deg] celsius13 Float_t fWindSpeed; // [km/h]14 Float_t fSolarRadiation; // [W/m^2] IR-Radiation15 Float_t fHumidity; // [%] 16 Float_t fTemperature; // [deg] celsius 17 Float_t fWindSpeed; // [km/h] 18 Float_t fSolarRadiation; // [W/m^2] IR-Radiation 15 19 16 Float_t fUPSStatus; // arbitrary units (still not properly defined)17 Float_t fDifRubGPS; // [us] Difference between the Rubidium clock time and the time provided by the GPS receiver20 Float_t fUPSStatus; // arbitrary units (still not properly defined) 21 Float_t fDifRubGPS; // [us] Difference between the Rubidium clock time and the time provided by the GPS receiver 18 22 23 MCameraTH *fTH; //! Discriminator thresholds 24 MCameraTD *fTD; //! Discriminator delays 25 MCameraRecTemp *fRecTemp; //! Receiver Board temperatures 26 27 // Internal 28 Bool_t SetupReading(MParList &plist); 29 Bool_t CheckTag(TString &str, const char *tag) const; 30 31 Bool_t InterpreteCC(TString &str, Int_t ver); 32 Bool_t InterpreteTH(TString &str); 33 Bool_t InterpreteTD(TString &str, Int_t ver); 34 Bool_t InterpreteRecTemp(TString &str); 35 36 // MReport 19 37 Int_t InterpreteBody(TString &str, Int_t ver); 20 38
Note:
See TracChangeset
for help on using the changeset viewer.