Changeset 1787 for trunk/MagicSoft/Mars
- Timestamp:
- 02/24/03 11:15:05 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1786 r1787 6 6 - Fixed mistake when analysing camera files containing all events 7 7 (including non-triggers): fShowers was always zero. 8 9 * macros/trigrate.C 10 - Added some explanations. Style improvements in function GetNSBEvents. 8 11 9 12 2003/02/22: Wolfgang Wittek -
trunk/MagicSoft/Mars/macros/trigrate.C
r1783 r1787 23 23 ! Added one optional input parameter: a camera .root file containing 24 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. 25 ! "empty" reflector file, with the NSB option on, and asking the camera 26 ! program (see camera program manual) to do the simulation even if no 27 ! photoelectron from the shower arrives at the camera. One also needs to 28 ! write to the output file all the events, both triggered and untriggered 29 ! (see again camera manual). These nsb camera files must contain the same 30 ! trigger conditions as the proton file. 31 ! 27 32 ! If no nsb file is supplied, the macro will assume no triggers from 28 33 ! pure NSB fluctuations. … … 30 35 \* ======================================================================== */ 31 36 32 Int_t GetNSBEvents(TString name, Float_t *BgR)37 Float_t GetNSBEvents(TString name, Float_t *BgR, int dim) 33 38 { 34 39 Int_t numnsbevents; 35 40 36 T Chain events("Events");37 events.Add(name);41 TFile bgfile(name); 42 TTree *events = (TTree*) bgfile.Get("Events"); 38 43 39 44 TH1F h("h","",5,.5,5.5); 40 45 41 for (Int_t i = from; i <= to; i++) 46 UInt_t from = dim>0 ? 1 : -dim; 47 UInt_t to = dim>0 ? dim : -dim; 48 49 for (UInt_t i = from; i <= to; i++) 42 50 { 43 TString plot = "MMcTrig;"; 44 plot+=i; 45 plot+=".fNumFirstLevel>>h"; 51 TString cond("MMcTrig;"); 52 cond += i; 53 cond += "."; 54 TBranch *b = events->GetBranch(cond); 55 MMcTrig *mctrig; 56 b->SetAddress(&mctrig); 46 57 47 if (i == 0) 48 plot = "MMcTrig.fNumFirstLevel>>h"; 58 Int_t tottrig = 0.; 59 60 UInt_t imax = b->GetEntries(); 49 61 50 events.Draw(plot,"", "goff"); 62 for (UInt_t iev = 0; iev < imax; iev++) 63 { 64 b->GetEvent(iev); 65 tottrig += mctrig->GetFirstLevel(); 66 } 67 // Set total number of L1 triggers: 68 BgR[dim>0? i-1: 0] = (Float_t) tottrig; 51 69 52 // Get total number of L1 triggers from histogram:53 BgR[dim>0? i-1: 0] = h.Integral()*h.GetMean();70 numnsbevents = (Float_t) imax; 71 } 54 72 55 numnsbevents = (Float_t) h.GetEntries(); 56 } 73 cout << endl<<endl << numnsbevents << " " << BgR[0] << endl<<endl<<endl; 57 74 58 75 return numnsbevents; … … 138 155 Float_t numnsbevents = 5.e4; // some default value. 139 156 if (nsbfile) 140 numnsbevents = GetNSBEvents(nsbfile, BgR);157 numnsbevents = GetNSBEvents(nsbfile, BgR, dim); 141 158 142 159 cout << "Number of Trigger conditions: " << num << endl;
Note:
See TracChangeset
for help on using the changeset viewer.