Changeset 1376 for trunk/MagicSoft/Mars/macros
- Timestamp:
- 07/04/02 18:40:55 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/macros/trigrate.C
r1163 r1376 20 20 ! Copyright: MAGIC Software Development, 2000-2001 21 21 ! 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. 22 29 ! 23 30 \* ======================================================================== */ 24 31 25 32 26 void trigrate(int dim=0, char *filename = "data/camera.root" ) 33 void trigrate(int dim=0, char *filename = "data/camera.root", 34 char *nsbfile = NULL) 27 35 { 28 // Th is macro has two input parameter:36 // The dim parameter has three possible values: 29 37 // dim : = 0 -> root file with 1 trigger condition. 30 38 // > 0 -> number of trigger condition to be analised … … 90 98 tasklist.AddToList(&reader); 91 99 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 93 147 cout << "Number of Trigger conditions: " << num << endl; 94 148 95 MMcTriggerRateCalc rate(dim, 14, BgR, 100000);149 MMcTriggerRateCalc rate(dim, kPROTON, BgR, total_nsb_events); 96 150 tasklist.AddToList(&rate); 97 151
Note:
See TracChangeset
for help on using the changeset viewer.