Changeset 1376 for trunk/MagicSoft/Mars
- Timestamp:
- 07/04/02 18:40:55 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1368 r1376 1 1 -*-*- 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 2 14 2002/06/14: Thomas Bretz 3 15 -
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 -
trunk/MagicSoft/Mars/mmontecarlo/MMcTriggerRateCalc.cc
r1342 r1376 21 21 ! Copyright: MAGIC Software Development, 2000-2001 22 22 ! 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 ! 23 27 ! 24 28 \* ======================================================================== */ … … 47 51 fMcRate = NULL; 48 52 49 for (int i=0;i<10;i++)50 fTrigger[i] = dim&&trigbg ? trigbg[i] : 0;51 52 53 fShowers = 0; 53 54 fAnalShow = simbg; … … 59 60 60 61 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; 61 67 62 68 AddToBranchList("MMcEvt.fImpact"); -
trunk/MagicSoft/Mars/mmontecarlo/MMcTriggerRateCalc.h
r1205 r1376 26 26 UInt_t fLast; 27 27 28 Float_t fTrigger[10]; // Number of triggered showers 28 Float_t* fTrigger; // Number of triggered showers 29 29 30 Float_t fShowers; // Number of simulated showers 30 31 Float_t fAnalShow; // Number of analysed showers
Note:
See TracChangeset
for help on using the changeset viewer.