- Timestamp:
- 05/26/04 17:20:43 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mtemp/mpisa/classes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mtemp/mpisa/classes/MReportTrigger.cc
r4185 r4195 97 97 Bool_t MReportTrigger::InterpreteCell(TString &str) 98 98 { 99 Int_t len , n, i=0;99 Int_t len=0, n, i=0; 100 100 Int_t gsNCells=32; 101 101 102 const char *pos = str.Data(); 103 const char *end = str.Data() + gsNCells; 104 105 while (pos < end) 106 { 107 n = sscanf(pos, " %f %n", &fCell->fCellRate[i++], &len); 102 for (i=0;i<gsNCells;i++) 103 { 104 n = sscanf(str.Data(), " %f %n", &fCell->fCellRate[i], &len); 108 105 if (n!=1) 109 106 { … … 111 108 return kCONTINUE; 112 109 } 110 str.Remove(0, len); // Remove cell rates from report string 111 } 112 113 str=str.Strip(TString::kLeading); 114 115 *fLog << warn << "Cell ok!" <<endl; 116 return kTRUE; 117 } 118 119 // -------------------------------------------------------------------------- 120 // 121 // Interprete the Prescaling factors part of the report 122 // 123 Bool_t MReportTrigger::InterpretePrescFact(TString &str) 124 { 125 Int_t len=0, n, i=0; 126 Int_t gsNPrescFacts=8; 127 128 *fLog << warn << "Presca"<<endl; 129 for (i=0;i<gsNPrescFacts;i++) 130 { 131 const Int_t ws = str.First(' '); 132 *fLog << str << endl; 133 134 if (ws<=0) 135 { 136 *fLog << warn << "WARNING - Cannot determine name of L1 trigger table." << endl; 137 return kCONTINUE; 138 } 139 140 TString L1tablename = str(0, ws); 141 *fLog << "Presc " <<L1tablename <<endl; 142 str.Remove(0, ws); 143 144 n = sscanf(str.Data(), " %li %n", &fPrescFactor->fPrescFact[i], &len); 145 if (n!=2) 146 { 147 *fLog << warn << "WARNING - prescaler factor " << i << " missing." << endl; 148 return kCONTINUE; 149 } 150 str.Remove(0, len); // Remove Prescal. factors from report string 151 *fLog << warn << fPrescFactor->fPrescFact[i]<<endl; 152 } 153 str=str.Strip(TString::kLeading); 154 155 *fLog << warn << "PrescFact ok!" <<endl; 156 return kTRUE; 157 } 158 159 // -------------------------------------------------------------------------- 160 // 161 // Interprete the Scaler with Live-Deadtime part of the report 162 // Read 4x5 integers separated with a blank 163 // 164 Bool_t MReportTrigger::InterpreteLiveTime(TString &str) 165 { 166 Int_t len, n, i=0; 167 Int_t gsNScalers=5; 168 Int_t D_LSB, D_MSB,L_LSB, L_MSB; 169 170 const char *pos = str.Data(); 171 const char *end = str.Data() + gsNScalers; 172 173 while (pos < end) 174 { 175 i++; 176 n = sscanf(pos, " %d %d %d %d %n", &L_LSB, &L_MSB,&D_LSB, &D_MSB, &len); 177 if (n!=4) 178 { 179 *fLog << warn << "WARNING - Live-Deadtime Scaler Value #" << i << " missing." << endl; 180 return kCONTINUE; 181 } 113 182 pos += len; 114 } 115 183 184 //convert to seconds and fill container 185 // (FIXME! only the MSB (seconds is now considered) 186 fLiveTime->fLiveTime[i] = L_MSB; 187 fLiveTime->fDeadTime[i] = D_MSB; 188 } 189 190 str.Remove(0, end-str.Data()); // Remove Live-Deadtimes from report string 191 str=str.Strip(TString::kLeading); 192 193 *fLog << warn << "LiveTime ok!" <<endl; 116 194 return kTRUE; 117 195 } … … 120 198 // 121 199 // Interprete the Bit rates part of the report 200 // 20 integers. First and last two are not used 122 201 // 123 202 Bool_t MReportTrigger::InterpreteBit(TString &str) 124 203 { 125 204 Int_t len, n, i=0; 205 Int_t gsNBits=20; 206 207 const char *pos = str.Data(); 208 const char *end = str.Data() + gsNBits; 209 210 while (pos < end) 211 { 212 n = sscanf(pos, " %f %n", &fBit->fBit[i++], &len); 213 if (n!=1) 214 { 215 *fLog << warn << "WARNING - Bit rate #" << i << " missing." << endl; 216 return kCONTINUE; 217 } 218 pos += len; 219 } 220 221 str.Remove(0, end-str.Data()); // Remove output bit rates from report string 222 str=str.Strip(TString::kLeading); 223 224 *fLog << warn << "Bit ok!" <<endl; 225 return kTRUE; 226 } 227 228 // -------------------------------------------------------------------------- 229 // 230 // Interprete the L1 and L2 table names 231 // 1String + 1Int +1 String 232 // 233 Bool_t MReportTrigger::InterpreteL1L2Table(TString &str) 234 { 235 const Int_t wsL1 = str.First(' '); 236 237 if (wsL1<=0) 238 { 239 *fLog << warn << "WARNING - Cannot determine name of L1 trigger table." << endl; 240 return kCONTINUE; 241 } 242 243 TString L1tablename = str(0, wsL1); 244 *fLog << "L1: " <<L1tablename <<endl; 245 str.Remove(0, wsL1); 246 247 // remove an integer between names 248 Int_t len; 249 Int_t mi; 250 Int_t n=sscanf(str.Data(), "%d %n", &mi, &len); 251 if (n!=1) 252 { 253 *fLog << warn << "WARNING - Not enough arguments." << endl; 254 return kCONTINUE; 255 } 256 str.Remove(0, len); 257 258 // L2 tablename 259 const Int_t wsL2 = str.First(' '); 260 261 if (wsL2<=0) 262 { 263 *fLog << warn << "WARNING - Cannot determine name of L2 trigger table." << endl; 264 return kCONTINUE; 265 } 266 TString L2tablename = str(0, wsL2); 267 *fLog << "L2: " <<L2tablename <<endl; 268 str.Remove(0,wsL2); 269 str.Strip(TString::kBoth); 270 271 return kTRUE; 272 } 273 274 // -------------------------------------------------------------------------- 275 // 276 // Interprete a part of the report without meaning by this time 277 // 18 integers 278 // 279 Bool_t MReportTrigger::InterpreteDummy(TString &str) 280 { 281 Int_t len, n, i=0; 282 Int_t gsNDummies=18; 283 Int_t dummy; 284 285 const char *pos = str.Data(); 286 const char *end = str.Data() + gsNDummies; 287 288 while (pos < end) 289 { 290 n = sscanf(pos, " %d %n", &dummy, &len); 291 if (n!=1) 292 { 293 *fLog << warn << "WARNING - Dummy #" << i << " missing." << endl; 294 return kCONTINUE; 295 } 296 pos += len; 297 } 298 299 str.Remove(0, end-str.Data()); // Remove dummies from report string 300 str=str.Strip(TString::kLeading); 301 302 *fLog << warn << "Dummy ok!" <<endl; 126 303 return kTRUE; 127 304 } … … 134 311 { 135 312 136 return kTRUE; 137 } 138 139 // -------------------------------------------------------------------------- 140 // 141 // Interprete the Prescaling factors part of the report 142 // 143 Bool_t MReportTrigger::InterpretePrescFact(TString &str) 144 { 145 146 return kTRUE; 147 } 313 314 *fLog << warn << "IPR ok!" <<endl; 315 return kTRUE; 316 } 317 148 318 149 319 // -------------------------------------------------------------------------- … … 172 342 return kCONTINUE; 173 343 174 175 /*176 const char *pos = str.Data();177 178 const Char_t pro[4] = {pos[0],pos[1],pos[2],pos[3]};179 *fLog << warn << pro[0] <<" " <<pro[1] <<" " <<pro[2] <<" " <<pro[3]<<endl;180 181 Int_t len, n;182 Float_t dummy;183 */184 185 344 // Read L1 and L2 table name (2 fields) 345 if (!InterpreteL1L2Table(str)) 346 return kCONTINUE; 186 347 187 348 // Read prescaling factors (2x8 fields) … … 190 351 191 352 // Read livetime and deadtime (5x4 fields) 353 if (!InterpreteLiveTime(str)) 354 return kCONTINUE; 192 355 193 356 // Read L2 outout bit rates … … 196 359 197 360 // Read global rates (before and after prescaling) 361 Int_t len, n; 362 n = sscanf(str.Data(), " %f %f %n", &fL2BeforePrescaler, &fL2AfterPrescaler, &len); 363 if (n!=2) 364 { 365 *fLog << warn << "WARNING - Couldn't read Trigger rates." << endl; 366 return kFALSE; 367 } 368 str.Remove(0,len); 369 str.Strip(TString::kBoth); 198 370 199 371 // Read 18 dummy fields 372 if (!InterpreteDummy(str)) 373 return kCONTINUE; 200 374 201 375 // Read IPR 202 if (!Interprete Bit(str))376 if (!InterpreteIPR(str)) 203 377 return kCONTINUE; 204 378 … … 226 400 // Read Individual pixel rates 227 401 pos = str.Data(); 228 end = str.Data() + 344;229 402 end = str.Data() + 344; 403 230 404 Int_t i=0; 231 405 while (pos < end) … … 243 417 */ 244 418 245 Int_t len=1;246 419 str.Remove(0,len); 247 420 str.Strip(TString::kBoth); -
trunk/MagicSoft/Mars/mtemp/mpisa/classes/MReportTrigger.h
r4185 r4195 37 37 Bool_t InterpreteBit(TString &str); 38 38 Bool_t InterpretePrescFact(TString &str); 39 Bool_t InterpreteLiveTime(TString &str); 40 Bool_t InterpreteDummy(TString &str); 41 Bool_t InterpreteL1L2Table(TString &str); 39 42 40 43 Int_t InterpreteBody(TString &str); -
trunk/MagicSoft/Mars/mtemp/mpisa/classes/mtrigger/MTriggerBit.h
r4185 r4195 9 9 #endif 10 10 11 #ifndef ROOT_TArray L12 #include <TArray L.h>11 #ifndef ROOT_TArrayF 12 #include <TArrayF.h> 13 13 #endif 14 14 … … 20 20 Byte_t fStatus; // Monitor of the L2T status 21 21 22 static const Int_t gsNBits= 16; // number of output bits22 static const Int_t gsNBits=20; // number of output bits 23 23 24 TArray L fBit; // Array with the prescaling factors24 TArrayF fBit; // Array with the output bit rates 25 25 26 26 public:
Note:
See TracChangeset
for help on using the changeset viewer.