Ignore:
Timestamp:
07/04/02 18:40:55 (22 years ago)
Author:
bigongia
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.