Ignore:
Timestamp:
02/20/09 00:39:31 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhflux
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhflux/MHCollectionArea.cc

    r9301 r9359  
    1919!   Author(s): Harald Kornmayer 1/2001
    2020!
    21 !   Copyright: MAGIC Software Development, 2000-2008
     21!   Copyright: MAGIC Software Development, 2000-2009
    2222!
    2323!
     
    6767//
    6868MHCollectionArea::MHCollectionArea(const char *name, const char *title)
    69   : fMcEvt(0), fMcAreaRadius(-1), fIsExtern(kFALSE)
     69  : fMcEvt(0), fHeader(0), fMcAreaRadius(-1), fIsExtern(kFALSE)
    7070{
    7171    //   initialize the histogram for the distribution r vs E
     
    148148    MH::SetBinomialErrors(fHEnergy, *hsel, *hall);
    149149#endif
    150 
    151     fHEnergy.Scale(totalarea);
     150    if (fMcAreaRadius>0)
     151        fHEnergy.Scale(totalarea);
    152152
    153153    delete hsel;
     
    161161    if (!fIsExtern)
    162162        fHistAll.Reset();
     163
     164    fHeader = (MMcRunHeader*)pl->FindObject("MMcRunHeader");
     165    if (!fHeader)
     166    {
     167        *fLog << err << "MMcRunHeader not found... abort." << endl;
     168        return kFALSE;
     169    }
    163170
    164171    fMcEvt = (MMcEvt*)pl->FindObject("MMcEvt");
     
    202209}
    203210
     211void MHCollectionArea::GetImpactMax()
     212{
     213    if (fHeader->GetImpactMax()<=fMcAreaRadius*100)
     214        return;
     215
     216    fMcAreaRadius = 0.01*fHeader->GetImpactMax(); // cm->m
     217    *fLog << inf << "Maximum simulated impact: " << fMcAreaRadius << "m" << endl;
     218}
     219
    204220Bool_t MHCollectionArea::ReInit(MParList *plist)
    205221{
    206     MMcRunHeader *runheader = (MMcRunHeader*)plist->FindObject("MMcRunHeader");
    207     if (!runheader)
    208     {
    209         *fLog << err << "MMcRunHeader not found... abort." << endl;
    210         return kFALSE;
    211     }
    212 
    213     if (runheader->GetImpactMax()>fMcAreaRadius*100)
    214     {
    215         fMcAreaRadius = 0.01*runheader->GetImpactMax(); // cm->m
    216         *fLog << inf << "Maximum simulated impact: " << fMcAreaRadius << "m" << endl;
    217     }
    218 
    219     if (fCorsikaVersion!=0 && fCorsikaVersion!=runheader->GetCorsikaVersion())
     222    GetImpactMax();
     223
     224    if (fCorsikaVersion!=0 && fCorsikaVersion!=fHeader->GetCorsikaVersion())
    220225    {
    221226        *fLog << warn;
    222227        *fLog << "Warning - Read files have different Corsika versions..." << endl;
    223         *fLog << "          Last file=" << fCorsikaVersion << "   New file=" << runheader->GetCorsikaVersion() << endl;
    224     }
    225     fCorsikaVersion = runheader->GetCorsikaVersion();
     228        *fLog << "          Last file=" << fCorsikaVersion << "   New file=" << fHeader->GetCorsikaVersion() << endl;
     229    }
     230    fCorsikaVersion = fHeader->GetCorsikaVersion();
    226231
    227232    if (fIsExtern)
    228233        return kTRUE;
    229234
    230     fTotalNumSimulatedShowers += runheader->GetNumSimulatedShowers();
     235    fTotalNumSimulatedShowers += fHeader->GetNumSimulatedShowers();
    231236    *fLog << inf << "Total Number of Simulated showers: " << fTotalNumSimulatedShowers << endl;
    232237
    233     fAllEvtsTriggered |= runheader->GetAllEvtsTriggered();
     238    fAllEvtsTriggered |= fHeader->GetAllEvtsTriggered();
    234239    *fLog << inf << "Only triggered events avail: " << (fAllEvtsTriggered?"yes":"no") << endl;
    235240
     
    248253    const Float_t emax = crh->GetEUppLim();
    249254    const Float_t expo = 1 + crh->GetSlopeSpec();
    250     const Float_t k = runheader->GetNumSimulatedShowers() /
     255    const Float_t k = fHeader->GetNumSimulatedShowers() /
    251256        (pow(emax,expo) - pow(emin,expo));
    252257
     
    271276
    272277        const Float_t energy = (e1+e2)/2.;
    273         fHistAll.Fill(20, energy, events);
     278        for (int j=0; j<TMath::Nint(events); j++)
     279            fHistAll.Fill(0., energy);
    274280        // you have  MMcRunHeader.fShowerThetaMin and MMcRunHeader.fShowerThetaMax
    275281    }
     
    280286void MHCollectionArea::Paint(Option_t *option)
    281287{
    282     if (TString(option)=="paint3")
    283     {
    284         /*
    285         TH1 *h = dynamic_cast<TH1*>(gPad->FindObject("Efficiency"));
    286         if (h)
    287         {
    288             const TString txt = Form("N/N_{0}=%.2f",
    289                                  GetCollectionAreaEff(),
    290                                  GetCollectionAreaAbs(), fMcAreaRadius);
    291 
    292         TLatex text(0.31, 0.95, txt);
    293         text.SetBit(TLatex::kTextNDC);
    294         text.SetTextSize(0.04);
    295         text.Paint();*/
    296         return;
    297     }
    298     if (TString(option)=="paint4")
    299     {
    300         //const TString txt = Form("A_{eff}=%.0fm^{2}  A_{abs}=%.0fm^{2}  r=%.0fm",
    301         //                         GetCollectionAreaEff(),
    302         //                         GetCollectionAreaAbs(), fMcAreaRadius);
     288    if (TString(option)=="paint4" && fMcAreaRadius>0)
     289    {
    303290        const TString txt = MString::Format("r_{max}=%.0fm --> A_{max}=%.0fm^{2}",
    304291                                            fMcAreaRadius, GetCollectionAreaAbs());
     
    445432        MH::SetBinomialErrors(*h, *h2, *h1);
    446433#endif
    447         h->SetNameTitle("Efficiency", "Combined cut and trigger efficiency");
     434        h->SetNameTitle("Efficiency", "Efficiency");
    448435        h->SetDirectory(NULL);
    449         AppendPad("paint3");
     436        //AppendPad("paint3");
    450437    }
    451438    else
     
    477464Bool_t MHCollectionArea::Finalize()
    478465{
     466    GetImpactMax();
     467
    479468    *fLog << all << "Maximum simulated impact found: " << fMcAreaRadius << "m" << endl;
    480469
  • trunk/MagicSoft/Mars/mhflux/MHCollectionArea.h

    r9153 r9359  
    1616class MMcEvt;
    1717class MParameterD;
     18class MMcRunHeader;
    1819
    1920class MHCollectionArea : public MH
     
    2122private:
    2223    MMcEvt *fMcEvt;             //!
     24    MMcRunHeader *fHeader;      //!
    2325    //MParameterD *fEnergy;     //!
    2426
     
    3537    Bool_t fIsExtern;
    3638
     39    void GetImpactMax();
    3740    void Calc(TH2D &hsel, TH2D &hall);
    3841    void CalcEfficiency();
Note: See TracChangeset for help on using the changeset viewer.