Changeset 1379 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
07/05/02 14:03:31 (22 years ago)
Author:
bigongia
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r1377 r1379  
    11                                                                  -*-*- END -*-*-
     2 2002/07/04: Abelardo Moralejo
     3
     4   * macros/trigrate.C:
     5     - Introduced some style improvements suggested by T. Bretz.
     6
    27 2002/07/04: Abelardo Moralejo
    38
  • trunk/MagicSoft/Mars/macros/trigrate.C

    r1376 r1379  
    2929!
    3030\* ======================================================================== */
    31 
    3231
    3332void trigrate(int dim=0, char *filename = "data/camera.root",
     
    101100    // Now we have to build the BgR array, containing the number
    102101    // of triggers (may be more than 1 trigger/event!) from the
    103     // total_nsb_events simulated in the nsbfile (3rd input parameter).
     102    // numnsbevents simulated in the nsbfile (3rd input parameter).
    104103    // If no nsbfile is supplied, we assume no triggers from NSB
    105104
    106     Float_t total_nsb_events = 5.e4; // some default value.
     105    Float_t numnsbevents = 5.e4; // some default value.
    107106
    108107    Float_t* BgR = new float[num];
     
    110109      BgR[i] = 0.;
    111110
    112     //    Float_t* BgR = new float[36];
    113     //    for(Int_t i = 0; i < 36; i++)
    114     //      BgR[i] = 0.;
    115 
    116111    if (nsbfile)
    117112      {
    118         nsb_events = new TChain("Events");
    119         nsb_events->Add(nsbfile);
     113        TChain nsb_events("Events");
     114        nsb_events.Add(nsbfile);
    120115
    121         //      nsb_events = new TFile(nsbfile);
    122         //      nsb_events->cd();
     116        TH1F h("h","",5,.5,5.5);
    123117
    124         h = new TH1F("h","",5,.5,5.5);
    125 
    126         Char_t plot[256];
    127118        for (Int_t i = from; i <= to; i++)
    128119          {
    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");
     120            TString plot = "MMcTrig;";
     121            plot+=i;
     122            plot+=".fNumFirstLevel>>h";
     123
     124            nsb_events.Draw(plot,"", "goff");
    133125            // 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();
     126            BgR[dim>0? i-1: 0] = h.Integral()*h.GetMean();
    138127
    139             total_nsb_events = (Float_t) h->GetEntries();
     128            numnsbevents = (Float_t) h.GetEntries();
    140129          }
    141         h->Delete();
    142         nsb_events->Delete();
    143         //      nsb_headers = new TChain("RunHeaders");
    144         //      nsb_headers->Add(nsbfile);
    145130      }
    146131
    147132    cout << "Number of Trigger conditions: " << num << endl;
    148133
    149     MMcTriggerRateCalc rate(dim, kPROTON, BgR, total_nsb_events);
     134    MMcTriggerRateCalc rate(dim, kPROTON, BgR, numnsbevents);
    150135    tasklist.AddToList(&rate);
    151136
Note: See TracChangeset for help on using the changeset viewer.