Changeset 9343 for trunk/MagicSoft/Mars/mjobs
- Timestamp:
- 02/15/09 23:12:04 (16 years ago)
- Location:
- trunk/MagicSoft/Mars/mjobs
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mjobs/MJSimulation.cc
r9336 r9343 209 209 } 210 210 211 void MJSimulation::SetupCommonFileStructure(MWriteRootFile &write) const 212 { 213 // Common run headers 214 write.AddContainer("MCorsikaRunHeader", "RunHeaders", kFALSE); 215 write.AddContainer("MRawRunHeader", "RunHeaders"); 216 write.AddContainer("MGeomCam", "RunHeaders"); 217 write.AddContainer("MMcRunHeader", "RunHeaders"); 218 219 // Common events 220 write.AddContainer("MCorsikaEvtHeader", "Events", kFALSE); 221 write.AddContainer("MRawEvtHeader", "Events"); 222 write.AddContainer("MMcEvt", "Events"); 223 } 224 211 225 Bool_t MJSimulation::Process(const MArgs &args) 212 226 { … … 429 443 write3b.SetName("WriteCamMC"); 430 444 431 write1a.AddContainer("MCorsikaEvtHeader", "Events", kFALSE);432 write1a.AddContainer("MPhotonEvent", "Events");433 434 write2a.AddContainer("MCorsikaRunHeader", "RunHeaders", kFALSE); 435 write2a.AddContainer("MRawRunHeader", "RunHeaders");436 write 2a.AddContainer("MGeomCam", "RunHeaders");437 write2a.AddContainer("MSignalCam", "Events"); 438 write2a.AddContainer("MRawEvtHeader", "Events", kFALSE);445 SetupCommonFileStructure(write1a); 446 SetupCommonFileStructure(write2a); 447 SetupCommonFileStructure(write3a); 448 449 // R: Dedicated file structureedicated events 450 write1a.AddContainer("MPhotonEvent", "Events"); 451 452 // I: Dedicated file structureedicated events 439 453 write2a.AddContainer("MPedPhotFromExtractorRndm", "RunHeaders"); // FIXME: Needed for the signal files to be display in MARS 440 write2a.AddContainer("MMcRunHeader", "RunHeaders"); 441 /* Monte Carlo Headers 442 write.AddContainer("MMcRunHeader", "RunHeaders", kFALSE); 443 write.AddContainer("MMcFadcHeader", "RunHeaders", kFALSE); 444 write.AddContainer("MMcTrigHeader", "RunHeaders", kFALSE); 445 write.AddContainer("MMcConfigRunHeader", "RunHeaders", kFALSE); 446 write.AddContainer("MMcCorsikaRunHeader", "RunHeaders", kFALSE); 447 // Monte Carlo 448 write.AddContainer("MMcEvt", "Events", kFALSE); 449 write.AddContainer("MMcTrig", "Events", kFALSE); 450 */// Data tree 451 //write.AddContainer("MPedPhotFromExtractor", "Events"); 452 //write.AddContainer("MPedPhotFromExtractorRndm", "Events"); 453 //write.AddContainer("MTime", "Events", kFALSE); 454 //write.AddContainer("MRawEvtHeader", "Events"); 455 //write.AddContainer("MTriggerPattern", "Events"); 456 457 write3a.AddContainer("MRawEvtData", "Events"); 458 write3a.AddContainer("MRawRunHeader", "RunHeaders"); 459 write3a.AddContainer("MGeomCam", "RunHeaders"); 460 write3a.AddContainer("MRawEvtHeader", "Events", kFALSE); 461 //write3.AddContainer("MPedestalCam", "RunHeaders", kFALSE); 462 write3a.AddContainer("MMcRunHeader", "RunHeaders"); 463 write3a.AddContainer("MMcCorsikaRunHeader", "RunHeaders", kFALSE); 464 write3a.AddContainer("ElectronicNoise", "RunHeaders", kFALSE); 465 write3a.AddContainer("MMcEvt", "Events", kFALSE); 466 467 write1b.AddContainer("MMcEvtBasic", "OriginalMC"); 468 write2b.AddContainer("MMcEvtBasic", "OriginalMC"); 469 write3b.AddContainer("MMcEvtBasic", "OriginalMC"); 454 write2a.AddContainer("MSignalCam", "Events"); 455 456 // D: Dedicated file structureedicated events 457 write3a.AddContainer("ElectronicNoise", "RunHeaders"); 458 write3a.AddContainer("MRawEvtData", "Events"); 459 460 // Basic MC data 461 write1b.AddContainer("MMcEvtBasic", "OriginalMC"); 462 write2b.AddContainer("MMcEvtBasic", "OriginalMC"); 463 write3b.AddContainer("MMcEvtBasic", "OriginalMC"); 470 464 471 465 // ------------------------------------------------------------------- -
trunk/MagicSoft/Mars/mjobs/MJSimulation.h
r9317 r9343 9 9 class MArgs; 10 10 class MParList; 11 class MWriteRootFile; 11 12 12 13 class MJSimulation : public MJob … … 22 23 23 24 void SetupHist(MHn &hist) const; 25 void SetupCommonFileStructure(MWriteRootFile &write) const; 24 26 25 27 public: -
trunk/MagicSoft/Mars/mjobs/MJSpectrum.cc
r9335 r9343 64 64 65 65 // Spectrum 66 #include "../mhflux/MAlphaFitter.h" 67 #include "../mhflux/MHAlpha.h" 68 #include "../mhflux/MHCollectionArea.h" 69 #include "../mhflux/MHEnergyEst.h" 70 #include "../mhflux/MMcSpectrumWeight.h" 66 #include "MAlphaFitter.h" 67 #include "MHAlpha.h" 68 #include "MHCollectionArea.h" 69 #include "MHEnergyEst.h" 70 #include "MMcSpectrumWeight.h" 71 #include "MHEffectiveOnTime.h" 71 72 72 73 // Eventloop … … 91 92 MJSpectrum::MJSpectrum(const char *name, const char *title) 92 93 : fCutQ(0), fCut0(0),fCut1(0), fCut2(0), fCut3(0), fCutS(0), 93 fEstimateEnergy(0), fCalcHadronness(0), fCalcDisp(0), fForceTheta(kFALSE) 94 fEstimateEnergy(0), fCalcHadronness(0), fCalcDisp(0), 95 fForceTheta(kFALSE), fForceRunTime(kFALSE), fForceOnTimeFit(kFALSE) 94 96 { 95 97 fName = name ? name : "MJSpectrum"; … … 296 298 return -1; 297 299 300 // We don't have to proceed. We later overwrite the result anyway 301 if (fForceOnTimeFit) 302 return 0; 303 298 304 const Double_t ufl = vstime->GetBinContent(0); 299 305 const Double_t ofl = vstime->GetBinContent(vstime->GetNbinsX()+1); … … 750 756 MFillH fill2(Form("HistE [%s]", cls.Data()), "", "FillHistE"); 751 757 758 // Fill a new MHEffectiveOnTime. It can either be used to 759 // re-calculate the on-time or just for manual cross check 760 MFillH fillT("MHEffectiveOnTime", "MTime", "FillOnTime"); 761 fillT.SetNameTab("OnTime"); 762 752 763 MFDataMember f0("DataType.fVal", '<', 0.5, "FilterOffData"); 753 764 MFDataMember f1("DataType.fVal", '>', 0.5, "FilterOnData"); … … 755 766 fill1.SetFilter(&f0); 756 767 fill2.SetFilter(&f1); 768 fillT.SetFilter(&f1); 757 769 758 770 tlist.AddToList(&read); 759 771 //tlist.AddToList(&taskenv0); // not necessary, stored in file! 760 772 //tlist.AddToList(&taskenv1); // not necessary, stored in file! 773 tlist.AddToList(&f1); 774 tlist.AddToList(&fillT); 761 775 tlist.AddToList(fCutS); 762 776 tlist.AddToList(&taskenv2); 763 777 tlist.AddToList(&f0); 764 tlist.AddToList(&f1);765 778 tlist.AddToList(&fill1); 766 779 tlist.AddToList(&fill2); … … 1545 1558 // Read from the ganymed file 1546 1559 TH1D htheta, size; 1547 constFloat_t ontime = ReadInput(plist, htheta, size);1560 Float_t ontime = ReadInput(plist, htheta, size); 1548 1561 if (ontime<0) 1549 1562 { … … 1562 1575 } 1563 1576 plist.AddToList(&bins2); // For later use in MC processing 1577 1578 // -------------- Fill excess events versus energy --------------- 1579 1580 TH1D excess; 1581 1582 if (fForceOnTimeFit) 1583 { 1584 // Refill excess histogram to determine the excess events 1585 // If we use the eff. on-time fit we have to loop over the data first 1586 // This is not really desired, because if something is wrong with 1587 // the Monte Carlos the program runs quite long before it fails 1588 if (!Refill(plist, excess)) 1589 return kFALSE; 1590 1591 // Print the setup and result of the MAlphaFitter, print used cuts 1592 PrintSetup(fit); 1593 1594 // ------------ On user request redo eff. on-time fit ------------ 1595 const MHEffectiveOnTime *htime = (MHEffectiveOnTime*)plist.FindObject("MHEffectiveOnTime"); 1596 if (!htime) 1597 { 1598 // This should never happen, bt you never know 1599 *fLog << err; 1600 *fLog << "ERROR - Use of new effective on-time fit requested for on-time determination," << endl; 1601 *fLog << " but MHEffectiveOnTime not found in parameter list... aborting." << endl; 1602 return kFALSE; 1603 } 1604 1605 const TH1D &h = htime->GetHEffOnTheta(); 1606 /* 1607 if (!htime->IsConsistent() || h.GetNbinsX()!=htheta.GetNbinsX()) 1608 { 1609 *fLog << err << "ERROR - Effective on-time from newly filles MHEffectiveOnTime (Tab='OnTime) invalid... aborting." << endl; 1610 return kFALSE; 1611 }*/ 1612 1613 *fLog << inf; 1614 *fLog << "Using eff. on-time from new MHEffectiveOnTime (see also 'OnTime')" << endl; 1615 *fLog << " Orig. value: " << ontime << "s" << endl; 1616 1617 // Copy ontime from newly filled and fitted eff on-time histogram 1618 ontime = htime->GetEffOnTime(); 1619 1620 *fLog << " New value: " << ontime << "s" << endl; 1621 1622 h.Copy(htheta); // Copy contents of newly filled hist into on-time vs. theta 1623 htheta.SetName("Theta"); // Copy overwrites the name needed in DisplayResult 1624 htheta.SetDirectory(0); // Remove from global directory added by SetName 1625 } 1626 1627 // --------------------------------------------------------------- 1564 1628 1565 1629 // Initialize weighting to a new spectrum as defined in the resource file … … 1612 1676 return kFALSE; 1613 1677 1614 // -------------- Fill excess events versus energy ---------------1615 1616 1678 // Refill excess histogram to determine the excess events 1617 TH1D excess; 1618 if (!Refill(plist, excess)) 1619 return kFALSE; 1620 1621 // Print the setup and result of the MAlphaFitter, print used cuts 1622 PrintSetup(fit); 1623 1679 if (!fForceOnTimeFit) 1680 { 1681 if (!Refill(plist, excess)) 1682 return kFALSE; 1683 1684 // Print the setup and result of the MAlphaFitter, print used cuts 1685 PrintSetup(fit); 1686 } 1624 1687 1625 1688 // ------------------------- Final loop -------------------------- … … 1768 1831 fillsp.SetWeight(); 1769 1832 1770 // Try to find the class used to determine the signal!1771 1833 // FIXME: To be done: A task checking the lower 1% after the lower 1772 1834 // energy limit! … … 1789 1851 return kFALSE; 1790 1852 par->SetVal(2); 1853 1854 // Not really necessary but for sanity 1855 TObject *cam = plist.FindObject("MSrcPosCam"); 1856 if (cam) 1857 cam->Clear(); 1791 1858 1792 1859 tlist2.AddToList(&read); -
trunk/MagicSoft/Mars/mjobs/MJSpectrum.h
r9335 r9343 38 38 Bool_t fForceTheta; 39 39 Bool_t fForceRunTime; 40 Bool_t fForceOnTimeFit; 40 41 41 42 // Setup Histograms … … 76 77 void ForceTheta(Bool_t b=kTRUE) { fForceTheta=b; } 77 78 void ForceRunTime(Bool_t b=kTRUE) { fForceRunTime=b; } 79 void ForceOnTimeFit(Bool_t b=kTRUE) { fForceOnTimeFit=b; } 78 80 79 81 void SetEnergyEstimator(const MTask *task); -
trunk/MagicSoft/Mars/mjobs/MJStar.cc
r9332 r9343 334 334 write.AddContainer("MMcEvt", "Events"); 335 335 write.AddContainer("MMcTrig", "Events", kFALSE); 336 write.AddContainer("MSrcPosCam", "Events"); 336 337 // Monte Carlo Run Headers 337 338 write.AddContainer("MMcRunHeader", "RunHeaders");
Note:
See TracChangeset
for help on using the changeset viewer.