Changeset 1376 for trunk


Ignore:
Timestamp:
07/04/02 18:40:55 (22 years ago)
Author:
bigongia
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r1368 r1376  
    11                                                                  -*-*- END -*-*-
     2 2002/07/04: Abelardo Moralejo
     3
     4   * mmontecarlo/MMcTriggerRateCalc.h,cc:
     5     - Now the dimension of fTrigger is set dinamically, to allow
     6       the processing of files with an arbitrarily large number of
     7       trigger conditions inside.
     8   * macros/trigrate.C:
     9     - Adapted the macro to changes above, and added a third argument:
     10       the name of a file containing pure NSB events from which the
     11       accidental trigger rate is calculated. Previously, this had to
     12       be introduced in the macro by hand by the user.
     13
    214 2002/06/14: Thomas Bretz
    315
  • trunk/MagicSoft/Mars/macros/trigrate.C

    r1163 r1376  
    2020!   Copyright: MAGIC Software Development, 2000-2001
    2121!
     22!   Modified 4/7/2002, Abelardo Moralejo:
     23!   Added one optional input parameter: a camera .root file containing
     24!   pure NSB events. One such file is generated running the camera over an
     25!   "empty" reflector file, with the NSB option on, and MINPHOT=0. The nsb
     26!   files must contain the same trigger conditions as the proton file.
     27!   If no nsb file is supplied, the macro will assume no triggers from
     28!   pure NSB fluctuations.
    2229!
    2330\* ======================================================================== */
    2431
    2532
    26 void trigrate(int dim=0, char *filename = "data/camera.root" )
     33void trigrate(int dim=0, char *filename = "data/camera.root",
     34              char *nsbfile = NULL)
    2735{
    28     // This macro has two input parameter:
     36    // The dim parameter has three possible values:
    2937    // dim : = 0 -> root file with 1 trigger condition.
    3038    //       > 0 -> number of trigger condition to be analised
     
    9098    tasklist.AddToList(&reader);
    9199
    92     Float_t BgR[10]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
     100 
     101    // Now we have to build the BgR array, containing the number
     102    // of triggers (may be more than 1 trigger/event!) from the
     103    // total_nsb_events simulated in the nsbfile (3rd input parameter).
     104    // If no nsbfile is supplied, we assume no triggers from NSB
     105
     106    Float_t total_nsb_events = 5.e4; // some default value.
     107
     108    Float_t* BgR = new float[num];
     109    for(Int_t i = 0; i < num; i++)
     110      BgR[i] = 0.;
     111
     112    //    Float_t* BgR = new float[36];
     113    //    for(Int_t i = 0; i < 36; i++)
     114    //      BgR[i] = 0.;
     115
     116    if (nsbfile)
     117      {
     118        nsb_events = new TChain("Events");
     119        nsb_events->Add(nsbfile);
     120
     121        //      nsb_events = new TFile(nsbfile);
     122        //      nsb_events->cd();
     123
     124        h = new TH1F("h","",5,.5,5.5);
     125
     126        Char_t plot[256];
     127        for (Int_t i = from; i <= to; i++)
     128          {
     129            // For each trigger condition (i)...
     130            // histogram Number of L1 triggers:
     131            sprintf(plot, "MMcTrig;%d.fNumFirstLevel>>h", i);
     132            nsb_events->Draw(plot,"", "goff");
     133            // Get total number of L1 triggers from histogram:
     134            if (dim > 0)
     135              BgR[i-1] = h->Integral()*h->GetMean();
     136            else
     137              BgR[0] = h->Integral()*h->GetMean();
     138
     139            total_nsb_events = (Float_t) h->GetEntries();
     140          }
     141        h->Delete();
     142        nsb_events->Delete();
     143        //      nsb_headers = new TChain("RunHeaders");
     144        //      nsb_headers->Add(nsbfile);
     145      }
     146
    93147    cout << "Number of Trigger conditions: " << num << endl;
    94148
    95     MMcTriggerRateCalc rate(dim, 14, BgR, 100000);
     149    MMcTriggerRateCalc rate(dim, kPROTON, BgR, total_nsb_events);
    96150    tasklist.AddToList(&rate);
    97151
  • trunk/MagicSoft/Mars/mmontecarlo/MMcTriggerRateCalc.cc

    r1342 r1376  
    2121!   Copyright: MAGIC Software Development, 2000-2001
    2222!
     23!   Modified 4/7/2002 Abelardo Moralejo: now the dimension of fTrigger is
     24!    set dinamically, to allow an arbitrary large number of trigger
     25!    conditions to be processed.
     26!
    2327!
    2428\* ======================================================================== */
     
    4751    fMcRate = NULL;
    4852
    49     for (int i=0;i<10;i++)
    50         fTrigger[i] = dim&&trigbg ? trigbg[i] : 0;
    51 
    5253    fShowers = 0;
    5354    fAnalShow = simbg;
     
    5960
    6061    fNum = fLast-fFirst+1;
     62
     63    fTrigger = new float[fNum];
     64
     65    for (UInt_t i=0;i<fNum;i++)
     66        fTrigger[i] = dim&&trigbg ? trigbg[i] : 0;
    6167
    6268    AddToBranchList("MMcEvt.fImpact");
  • trunk/MagicSoft/Mars/mmontecarlo/MMcTriggerRateCalc.h

    r1205 r1376  
    2626    UInt_t     fLast;
    2727
    28     Float_t    fTrigger[10];   // Number of triggered showers
     28    Float_t*    fTrigger;   // Number of triggered showers
     29
    2930    Float_t    fShowers;       // Number of simulated showers
    3031    Float_t    fAnalShow;      // Number of analysed showers
Note: See TracChangeset for help on using the changeset viewer.