Changeset 19848 for trunk/Mars
- Timestamp:
- 11/01/19 14:18:10 (5 years ago)
- Location:
- trunk/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/ceres.cc
r19728 r19848 148 148 gLog.Setup(arg); 149 149 150 StartUpMessage(); 150 const Bool_t kCheckOnly = arg.HasOnlyAndRemove("--check"); 151 152 if (!kCheckOnly) 153 StartUpMessage(); 151 154 152 155 if (arg.HasOnly("-V") || arg.HasOnly("--version")) … … 159 162 } 160 163 161 const Bool_t kBatch = arg.HasOnlyAndRemove("-b") ;164 const Bool_t kBatch = arg.HasOnlyAndRemove("-b") || kCheckOnly; 162 165 //const Int_t kCompLvl = arg.GetIntAndRemove("--comp=", 1); 163 const Bool_t kForce = arg.HasOnlyAndRemove("-ff") ;166 const Bool_t kForce = arg.HasOnlyAndRemove("-ff") && !kCheckOnly; 164 167 const Bool_t kDebugMem = arg.HasOnlyAndRemove("--debug-mem"); 165 168 const Bool_t kNullOut = arg.HasOnlyAndRemove("--dev-null"); … … 340 343 MArray::Class()->IgnoreTObjectStreamer(); 341 344 MParContainer::Class()->IgnoreTObjectStreamer(); 345 346 if (kCheckOnly) 347 gROOT->SetBatch(); 342 348 343 349 TApplication app("ceres", &argc, argv); … … 381 387 // job.SetPathIn(kInpath); // not yet needed 382 388 383 if (!job.Process(arg, seq)) 384 { 385 gLog << err << "Calculation of ceres failed." << endl << endl; 389 if (!job.Process(arg, seq, kCheckOnly)) 390 { 391 if (job.GetDisplay()) 392 delete d; 393 394 if (!kCheckOnly) 395 gLog << err << "Calculation of ceres failed." << endl << endl; 386 396 return 2; 387 397 } -
trunk/Mars/mcorsika/MCorsikaRead.cc
r19696 r19848 167 167 // This opens the next file in the list and deletes its name from the list. 168 168 // 169 Int_t MCorsikaRead::OpenNextFile(Bool_t print )169 Int_t MCorsikaRead::OpenNextFile(Bool_t print, Bool_t telrequired) 170 170 { 171 171 … … 196 196 return kERROR; 197 197 198 *fLog << inf << "Open file: '" << name << "'" << endl; 199 200 // Check if thsi is a single telescope from a CORSIKA telescope array 201 // This is indicated by the -telXXX attached to the filename 202 TObjArray *res = TPRegexp("(.*/)?cer([0-9]+)-tel([0-9]+)").MatchS(name, "i"); 203 if (res->GetLast()==3) 198 *fLog << (telrequired?inf:all) << "Open file: '" << name << "'" << endl; 199 200 if (telrequired) 204 201 { 205 const TString match = res->At(0)->GetName(); 206 const TString path = res->At(1)->GetName(); 207 const UInt_t runid = atoi(res->At(2)->GetName()); 208 const UInt_t telid = atoi(res->At(3)->GetName()); 209 210 *fLog << inf2 << "Run " << runid << " detected to be for telescope #" << telid << endl; 211 212 if (telid>=fNumTelescopes) 202 // Check if thsi is a single telescope from a CORSIKA telescope array 203 // This is indicated by the -telXXX attached to the filename 204 TObjArray *res = TPRegexp("(.*/)?cer([0-9]+)-tel([0-9]+)").MatchS(name, "i"); 205 if (res->GetLast()==3) 213 206 { 214 *fLog << err << "Position of telescope " << telid << " not defined." << endl; 215 return kERROR; 207 const TString match = res->At(0)->GetName(); 208 const TString path = res->At(1)->GetName(); 209 const UInt_t runid = atoi(res->At(2)->GetName()); 210 const UInt_t telid = atoi(res->At(3)->GetName()); 211 212 *fLog << inf2 << "Run " << runid << " detected to be for telescope #" << telid << endl; 213 214 if (telid>=fNumTelescopes) 215 { 216 *fLog << err << "Position of telescope " << telid << " not defined." << endl; 217 return kERROR; 218 } 219 220 *fLog << inf << "Telescope #" << telid << " [X/Y/Z (R)]: "; 221 *fLog << fTelescopeX[telid] << "/"; 222 *fLog << fTelescopeY[telid] << "/"; 223 *fLog << fTelescopeZ[telid] << " (R=" << fTelescopeR[telid] << ")" << endl; 224 225 fNumTelescope = telid+1; 216 226 } 217 218 *fLog << inf << "Telescope #" << telid << " [X/Y/Z (R)]: "; 219 *fLog << fTelescopeX[telid] << "/"; 220 *fLog << fTelescopeY[telid] << "/"; 221 *fLog << fTelescopeZ[telid] << " (R=" << fTelescopeR[telid] << ")" << endl; 222 223 fNumTelescope = telid+1; 227 delete res; 224 228 } 225 delete res;226 227 229 228 230 if (fDisplay) … … 288 290 fNumTotalEvents = 0; 289 291 292 MCorsikaRunHeader runheader; 293 290 294 Bool_t rc = kTRUE; 291 295 292 296 while (1) 293 297 { 294 switch (OpenNextFile(kFALSE ))298 switch (OpenNextFile(kFALSE, kFALSE)) 295 299 { 296 300 case kFALSE: … … 310 314 { 311 315 if (blockType == 1200) 312 status = fRunHeader->ReadEvt(fInFormat, blockLength / sizeof(Float_t));316 status = runheader.ReadEvt(fInFormat, blockLength / sizeof(Float_t)); 313 317 314 318 else if(blockType == 1201) … … 319 323 vector<Float_t> buffer(blockLength / sizeof(Float_t)); 320 324 status = fInFormat->Read(buffer.data(), blockLength); 321 status = fRunHeader->ReadEventHeader(buffer.data());325 status = runheader.ReadEventHeader(buffer.data()); 322 326 break; 323 327 } … … 325 329 fInFormat->Seek(blockLength); 326 330 } 327 331 328 332 if (status != kTRUE) 329 333 return status; … … 331 335 if (!fInFormat->SeekEvtEnd()) 332 336 { 333 *fLog << (fForceMode?warn:err) << "E rror:RUNE section not found in file." << endl;337 *fLog << (fForceMode?warn:err) << "ERROR - RUNE section not found in file." << endl; 334 338 if (!fForceMode) 335 339 return fForceMode ? kTRUE : kFALSE; 336 340 } 337 341 338 if (! fRunHeader->ReadEvtEnd(fInFormat, kTRUE))342 if (!runheader.ReadEvtEnd(fInFormat, kTRUE)) 339 343 { 340 *fLog << (fForceMode?warn:err) << "E rror:Reading RUNE section failed." << endl;344 *fLog << (fForceMode?warn:err) << "ERROR - Reading RUNE section failed." << endl; 341 345 if (!fForceMode) 342 346 return kFALSE; 343 347 } 344 348 345 fNumTotalEvents += fRunHeader->GetNumEvents()*fRunHeader->GetNumReuse()*349 fNumTotalEvents += runheader.GetNumEvents()*runheader.GetNumReuse()* 346 350 (fTelescopeIdx<0 && fNumTelescope==0 ? fNumTelescopes : 1); 347 351 continue; … … 806 810 *fLog << inf2 << "Reading Telecope positions from " << fname << ":" << endl; 807 811 808 TPRegexp regexp("\\s*TELESCOPE"809 "\\s+([-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)"810 "\\s+([-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)"811 "\\s+([-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)"812 "\\s+([-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)"813 "\\s+([0-9]+)\\s*");814 815 812 ifstream fin(fname); 816 813 … … 823 820 break; 824 821 825 const TObjArray *res = regexp.MatchS(buf); 826 if (res->GetLast()==9) 822 buf = buf.Strip(TString::kBoth); 823 if (buf(0, 9)!="TELESCOPE") 824 continue; 825 826 float x, y, z, r; 827 int idx; 828 if (sscanf(buf.Data()+9, "%f %f %f %f %d", &x, &y, &z, &r, &idx)!=5) 829 continue; 830 831 if (idx>=fNumTelescopes) 827 832 { 828 const UInt_t idx = atoi(res->At(9)->GetName()); 829 if (idx>=fNumTelescopes) 830 { 831 fNumTelescopes = idx+1; 832 fTelescopeX.Set(fNumTelescopes); 833 fTelescopeY.Set(fNumTelescopes); 834 fTelescopeZ.Set(fNumTelescopes); 835 fTelescopeR.Set(fNumTelescopes); 836 } 837 838 fTelescopeX[idx] = atof(res->At(1)->GetName()); 839 fTelescopeY[idx] = atof(res->At(3)->GetName()); 840 fTelescopeZ[idx] = atof(res->At(5)->GetName()); 841 fTelescopeR[idx] = atof(res->At(7)->GetName()); 833 fNumTelescopes = idx+1; 834 fTelescopeX.Set(fNumTelescopes); 835 fTelescopeY.Set(fNumTelescopes); 836 fTelescopeZ.Set(fNumTelescopes); 837 fTelescopeR.Set(fNumTelescopes); 842 838 } 843 delete res; 839 840 fTelescopeX[idx] = x; 841 fTelescopeY[idx] = y; 842 fTelescopeZ[idx] = z; 843 fTelescopeR[idx] = r; 844 844 } 845 845 -
trunk/Mars/mcorsika/MCorsikaRead.h
r19669 r19848 67 67 //Bool_t fForce; 68 68 69 70 Int_t OpenNextFile(Bool_t print=kTRUE); 71 Bool_t CalcNumTotalEvents(); 69 Int_t OpenNextFile(Bool_t print=kTRUE, Bool_t telrequired=kTRUE); 72 70 Int_t ReadTelescopePosition(); 73 71 Int_t ReadNextBlockHeader(); … … 82 80 MCorsikaRead(const char *filename=NULL, const char *name=NULL, const char *title=NULL); 83 81 ~MCorsikaRead(); 82 83 Bool_t CalcNumTotalEvents(); 84 84 85 85 void SetForceMode(Bool_t b=kTRUE) { fForceMode=b; } -
trunk/Mars/mjobs/MJSimulation.cc
r19723 r19848 396 396 } 397 397 398 Bool_t MJSimulation::Process(const MArgs &args, const MSequence &seq )398 Bool_t MJSimulation::Process(const MArgs &args, const MSequence &seq, Bool_t checkonly) 399 399 { 400 400 // -------------------------------------------------------------------------------- … … 409 409 // - description of the job itself 410 410 // - list of the to processed sequence 411 if (!checkonly) 412 fLog->Separator(GetDescriptor()); 413 411 414 *fLog << inf; 412 fLog->Separator(GetDescriptor());413 414 415 if (!CheckEnv()) 415 416 return kFALSE; … … 418 419 *fLog << fSequence.GetFileName() << endl; 419 420 else 420 *fLog << "Input: " << args.GetNumArguments() << " -files" << endl;421 *fLog << "Input: " << args.GetNumArguments() << " file(s)" << endl; 421 422 *fLog << endl; 422 423 … … 550 551 return kFALSE; 551 552 } 553 554 if (checkonly) 555 return read.CalcNumTotalEvents(); 552 556 553 557 // -------------------------------------------------------------------------------- … … 823 827 824 828 const char *regex = fRunNumber<0 ? 825 "s/[cC][eE][rR]([0-9]+)(-[tT][eE][lL]([0-9]+))?/%s\\/00$1.%03d%%s_MonteCarlo$ 3.root/" :826 "s/[cC][eE][rR][0-9]+([0-9][0-9][0-9])(-[tT][eE][lL]([0-9]+))?/%s\\/%08d.$1%%s_MonteCarlo$ 3.root/";829 "s/[cC][eE][rR]([0-9]+)(-[tT][eE][lL]([0-9]+))?/%s\\/00$1.%03d%%s_MonteCarlo$2.root/" : 830 "s/[cC][eE][rR][0-9]+([0-9][0-9][0-9])(-[tT][eE][lL]([0-9]+))?/%s\\/%08d.$1%%s_MonteCarlo$2.root/"; 827 831 828 832 const char *fmt = fFileOut.IsNull() ? -
trunk/Mars/mjobs/MJSimulation.h
r18450 r19848 54 54 55 55 // Process 56 Bool_t Process(const MArgs &args, const MSequence &seq );56 Bool_t Process(const MArgs &args, const MSequence &seq, Bool_t checkonly); 57 57 58 58 ClassDef(MJSimulation, 0) // Job to run the simulation (ceres)
Note:
See TracChangeset
for help on using the changeset viewer.