Changeset 9359 for trunk/MagicSoft/Mars


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

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r9358 r9359  
    145145
    146146
    147 
    148 
    149147 2009/02/18 Thomas Bretz
    150148
  • trunk/MagicSoft/Mars/NEWS

    r9351 r9359  
    6666   * The camera ''electronics'' can now be ''switched off''
    6767
    68    * A new tab ''info'' now display basic things like the reflector
     68   * A new tab ''Info'' now display basic things like the reflector
    6969     layout
    7070
     
    8383   * For caluclating the displayed image parameters in ceres a basic
    8484     image cleaning removing isolated pixels is now done.
     85
     86   * The magnetic field direction (ARRANG) is now taken into account
     87
     88   * Added plot for the energy threshold after trigger ''Threshold''
     89
     90   * Added plot for the effective collection area after trigger ''TrigArea''
    8591
    8692 ;star
  • trunk/MagicSoft/Mars/mcorsika/MCorsikaRunHeader.cc

    r9352 r9359  
    183183    // g[93] angle between array x-direction and magnetic north
    184184
    185 
    186     fImpactMax = g[86];
     185    // This is a trick to use CERARY for storage of the
     186    // maximum simulated impact
     187    fImpactMax = -1;
     188    if (TMath::Nint(g[84])==1 && TMath::Nint(g[85])==1 &&
     189        TMath::Nint(g[88])==1 && TMath::Nint(g[89])==1 &&
     190        g[86]==g[87])
     191        fImpactMax = g[86];
    187192
    188193    fWavelengthMin = g[94];        // Cherenkov bandwidth lower end in nm
     
    283288        *fLog << "  w.r.t. magnetic North." << endl;
    284289    }
     290
     291    if (fImpactMax>0)
     292        *fLog << "Max.sim.Impact: " << fImpactMax << "cm" << endl;
    285293
    286294    *fLog << "Options used:  ";
  • 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();
  • trunk/MagicSoft/Mars/mjobs/MJSimulation.cc

    r9356 r9359  
    542542    //MFillH fillx2("MHHillasExt",       "",                "FillHillasExt");
    543543    MFillH fillx3("MHHillasSrc",       "MHillasSrc",      "FillHillasSrc");
     544    MFillH fillth("MHThreshold",       "",                "FillThreshold");
     545    MFillH fillca("MHCollectionArea",  "",                "FillTrigArea");
    544546    //MFillH fillx4("MHImagePar",        "MImagePar",       "FillImagePar");
    545547    //MFillH fillx5("MHNewImagePar",     "MNewImagePar",    "FillNewImagePar");
     548
     549    fillth.SetNameTab("Threshold");
     550    fillca.SetNameTab("TrigArea");
    546551
    547552    // -------------------------------------------------------------------
     
    648653        //tasks.AddToList(&fillx2);
    649654        tasks.AddToList(&fillx3);
     655        tasks.AddToList(&fillth);
     656        tasks.AddToList(&fillca);
    650657        //tasks.AddToList(&fillx4);
    651658        //tasks.AddToList(&fillx5);
  • trunk/MagicSoft/Mars/msim/MSimMMCS.cc

    r9352 r9359  
    6767Int_t MSimMMCS::PreProcess(MParList *plist)
    6868{
    69     if (!plist->FindCreateObj("MMcRunHeader"))
     69    fMcRunHeader = (MMcRunHeader*)plist->FindCreateObj("MMcRunHeader");
     70    if (!fMcRunHeader)
    7071        return kFALSE;
    7172
     
    105106    }
    106107
    107 
    108108    return kTRUE;
    109109}
     
    126126    // ----------------------------------------------------
    127127
    128     MMcRunHeader *mrh = (MMcRunHeader*)plist->FindObject("MMcRunHeader");
    129     if (!mrh)
    130     {
    131         *fLog << err << "MMcRunHeader not found... aborting." << endl;
    132         return kFALSE;
    133     }
    134 
    135128    //    fNumPheFromDNSB        MMcPedestalNSBAdd   // Number of phe/ns from diffuse NSB
    136129
    137130    // FIXME: Is there a way to write them as LAST entry in the file?
    138     mrh->SetNumSimulatedShowers(fRunHeader->GetNumEvents());
    139     mrh->SetImpactMax(fRunHeader->GetImpactMax());
    140     mrh->SetCorsikaVersion(TMath::Nint(fRunHeader->GetProgramVersion()*100));
     131    fMcRunHeader->SetNumSimulatedShowers(fRunHeader->GetNumEvents());
     132    fMcRunHeader->SetCorsikaVersion(TMath::Nint(fRunHeader->GetProgramVersion()*100));
     133
     134    if (fRunHeader->GetImpactMax()>0)
     135        fMcRunHeader->SetImpactMax(fRunHeader->GetImpactMax());
    141136
    142137    // ----------------------------------------------------
     
    185180    fMcEvt->SetPhotElfromShower(0);
    186181
     182    if (fRunHeader->GetImpactMax()<0 &&
     183        fEvtHeader->GetImpact()>fMcRunHeader->GetImpactMax())
     184        fMcRunHeader->SetImpactMax(fEvtHeader->GetImpact());
     185
    187186    return kTRUE;
    188187}
  • trunk/MagicSoft/Mars/msim/MSimMMCS.h

    r9336 r9359  
    1212class MCorsikaEvtHeader;
    1313class MCorsikaRunHeader;
     14class MMcRunHeader;
    1415
    1516class MSimMMCS : public MTask
     
    2122    MCorsikaEvtHeader *fEvtHeader;
    2223    MCorsikaRunHeader *fRunHeader;
     24    MMcRunHeader      *fMcRunHeader;
    2325
    2426    // MTask
Note: See TracChangeset for help on using the changeset viewer.