Changeset 6949 for trunk/MagicSoft/Mars/mjobs/MJCut.cc
- Timestamp:
- 04/18/05 10:35:54 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mjobs/MJCut.cc
r6948 r6949 45 45 46 46 #include "MReadReports.h" 47 #include "MReadMarsFile.h" 47 48 #include "MPrint.h" 48 49 #include "MContinue.h" … … 74 75 MJCut::MJCut(const char *name, const char *title) 75 76 : fStoreSummary(kFALSE), fStoreResult(kFALSE), fWriteOnly(kFALSE), 76 fIsWobble(kFALSE), f FullDisplay(kFALSE), /*fSubstraction(kFALSE),*/77 fIsWobble(kFALSE), fIsMonteCarlo(kFALSE), fFullDisplay(kFALSE), /*fSubstraction(kFALSE),*/ 77 78 fEstimateEnergy(0), fCalcHadronness(0) 78 79 { … … 181 182 return kFALSE; 182 183 } 183 env1 = o ? (MTask*)o->Clone() : NULL;184 env1 = o ? (MTask*)o->Clone() : FNULL; 184 185 185 186 o = file.Get("CalcHadronness"); … … 212 213 *fLog << inf << "Writing to file: " << oname << endl; 213 214 214 TFile file(oname, fOverwrite?"RECREATE":"NEW", "File created by MJCut", 9); 215 if (!file.IsOpen()) 215 TFile *file = 0; 216 if (fNameResult.IsNull()) 217 { 218 file = (TFile*)gROOT->GetListOfFiles()->FindObject(oname); 219 if (file) 220 file->cd(); 221 } 222 else 223 file = TFile::Open(oname, fOverwrite?"RECREATE":"NEW", "File created by MJCut", 9); 224 225 if (!file) 216 226 { 217 227 *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl; … … 219 229 } 220 230 221 return WriteContainer(cont); 231 const Bool_t rc = WriteContainer(cont); 232 233 if (!fNameResult.IsNull()) 234 delete file; 235 236 return rc; 222 237 } 223 238 … … 260 275 EnableStorageOfResult(GetEnv("ResultFile", fStoreResult)); 261 276 EnableWobbleMode(GetEnv("WobbleMode", fIsWobble)); 277 EnableMonteCarloMode(GetEnv("MonteCarlo", fIsMonteCarlo)); 262 278 EnableFullDisplay(GetEnv("FullDisplay", fFullDisplay)); 263 279 //EnableSubstraction(GetEnv("HistogramSubstraction", fSubstraction)); … … 292 308 write->AddContainer("MHadronness", "Events", kFALSE); 293 309 write->AddContainer("MEnergyEst", "Events", kFALSE); 310 write->AddContainer("MMcEvt", "Events", kFALSE); 294 311 write->AddContainer("DataType", "Events"); 295 312 … … 398 415 399 416 // ------------- Loop Off Data -------------------- 400 MReadReports readoff; 401 readoff.AddTree("Events", "MTime.", kTRUE); 402 readoff.AddTree("Drive"); 403 readoff.AddTree("EffectiveOnTime"); 417 MReadReports readoffdata; 418 readoffdata.AddTree("Events", "MTime.", kTRUE); 419 readoffdata.AddTree("Drive"); 420 readoffdata.AddTree("EffectiveOnTime"); 421 422 MReadMarsFile readoffmc("Events"); 423 readoffmc.DisableAutoScheme(); 424 425 MRead &readoff = fIsMonteCarlo ? (MRead&)readoffmc : (MRead&)readoffdata; 404 426 if (fIsWobble) 405 427 set.AddFilesOn(readoff); … … 411 433 TString fname1(path); 412 434 fname0 += fNameSummary.IsNull() ? (TString) Form("ganymed%08d-summary.root", set.GetNumAnalysis()) : fNameSummary; 413 fname1 += fNameResult.IsNull() ? (TString) Form("ganymed%08d -result.root",set.GetNumAnalysis()) : fNameResult;435 fname1 += fNameResult.IsNull() ? (TString) Form("ganymed%08d.root", set.GetNumAnalysis()) : fNameResult; 414 436 415 437 MWriteRootFile *write0 = CanStoreSummary() ? new MWriteRootFile(fPathOut.IsNull()?0:fname0.Data(), fOverwrite?"RECREATE":"NEW") : 0; … … 443 465 444 466 MPrint print2("MEffectiveOnTime"); 467 print2.EnableSkip(); 445 468 446 469 // How to get source position from off- and on-data? … … 460 483 if (fIsWobble) 461 484 tlist2.AddToList(&hcalc2); 462 tlist2.AddToList(&taskenv1);463 485 tlist2.AddToList(&taskenv2); 464 486 tlist2.AddToList(&cont0); … … 468 490 tlist2.AddToList(&fill1a); 469 491 tlist2.AddToList(&cont1); 492 tlist2.AddToList(&taskenv1); 470 493 if (!fWriteOnly && !fIsWobble) 471 494 tlist2.AddToList(&ffs); … … 503 526 return kFALSE; 504 527 528 TObjArray cont; 529 cont.Add(&fit); 530 cont.Add(&cont0); 531 cont.Add(&cont1); 532 cont.Add(&cont2); 533 cont.Add(&cont3); 534 if (taskenv1.GetTask()) 535 cont.Add(taskenv1.GetTask()); 536 if (taskenv2.GetTask()) 537 cont.Add(taskenv2.GetTask()); 538 539 if (!WriteTasks(set.GetNumAnalysis(), cont)) 540 return kFALSE; 541 505 542 if (set.HasOffSequences() || fIsWobble) 506 543 { … … 524 561 525 562 // ------------- Loop On Data -------------------- 526 MReadReports readon; 527 readon.AddTree("Events", "MTime.", kTRUE); 528 readon.AddTree("Drive"); 529 readon.AddTree("EffectiveOnTime"); 563 MReadReports readondata; 564 readondata.AddTree("Events", "MTime.", kTRUE); 565 readondata.AddTree("Drive"); 566 readondata.AddTree("EffectiveOnTime"); 567 568 MReadMarsFile readonmc("Events"); 569 readonmc.DisableAutoScheme(); 570 571 MRead &readon = fIsMonteCarlo ? (MRead&)readonmc : (MRead&)readondata; 530 572 set.AddFilesOn(readon); 531 573 … … 614 656 tlist2.Replace(&ffs2); 615 657 616 tlist.AddToList(&fillvs, "EffectiveOnTime"); 658 if (!fIsMonteCarlo) 659 tlist.AddToList(&fillvs, "EffectiveOnTime"); 617 660 } 618 661 619 662 par.SetVal(1); 620 621 TObjArray cont;622 cont.Add(&cont0);623 cont.Add(&cont1);624 cont.Add(&cont2);625 cont.Add(&cont3);626 if (taskenv1.GetTask())627 cont.Add(taskenv1.GetTask());628 if (taskenv2.GetTask())629 cont.Add(taskenv2.GetTask());630 631 if (!WriteTasks(set.GetNumAnalysis(), cont))632 return kFALSE;633 663 634 664 // Execute first analysis
Note:
See TracChangeset
for help on using the changeset viewer.