]>
Commit | Line | Data |
---|---|---|
0cb382c1 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
e54bf126 | 16 | // $Id$ |
0cb382c1 | 17 | |
e54bf126 | 18 | /// \ingroup macros |
19 | /// \file MUONTriggerEfficiency.C | |
20 | /// \brief Macro for checking trigger integrated efficiency for dimuons. | |
21 | /// | |
22 | /// The efficiency is calculated with respect to the 3/4 coincidence. | |
23 | /// | |
24 | /// \author Fabien Guerin, LPC Clermont-Ferrand, Jan. 2006 | |
0cb382c1 | 25 | |
26 | #if !defined(__CINT__) || defined(__MAKECINT__) | |
27 | // ROOT includes | |
28 | #include "TBranch.h" | |
29 | #include "TClonesArray.h" | |
30 | #include "TObject.h" | |
31 | #include "TFile.h" | |
32 | #include "TH1.h" | |
33 | #include "TH2.h" | |
34 | #include "TTree.h" | |
35 | #include "TParticle.h" | |
36 | ||
37 | // STEER includes | |
38 | #include "AliRun.h" | |
39 | #include "AliRunLoader.h" | |
40 | #include "AliHeader.h" | |
41 | #include "AliLoader.h" | |
42 | #include "AliStack.h" | |
9665028d | 43 | #include "AliCDBManager.h" |
0cb382c1 | 44 | |
45 | // MUON includes | |
46 | #include "AliMUON.h" | |
0cb382c1 | 47 | #include "AliMUONHit.h" |
48 | #include "AliMUONConstants.h" | |
49 | #include "AliMUONDigit.h" | |
0cb382c1 | 50 | #include "AliMUONGlobalTrigger.h" |
0cb382c1 | 51 | #include "AliMUONTrack.h" |
b1f2fbb2 | 52 | |
53 | #include "AliMUONDataInterface.h" | |
54 | #include "AliMUONMCDataInterface.h" | |
55 | #include "AliMUONVHitStore.h" | |
56 | #include "AliMUONVTriggerStore.h" | |
57 | ||
0cb382c1 | 58 | #endif |
59 | ||
60 | // Upsilon(1S) | |
61 | ||
62 | ||
b1f2fbb2 | 63 | void MUONTriggerEfficiency(const char* filenameSim="galice_sim.root", |
64 | const char* filenameRec="galice.root", | |
65 | Bool_t readFromRP = 0) | |
66 | { | |
67 | ||
9665028d | 68 | // Set default CDB storage |
69 | AliCDBManager* man = AliCDBManager::Instance(); | |
162637e4 | 70 | man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); |
ce350193 | 71 | man->SetRun(0); |
72 | ||
b1f2fbb2 | 73 | // output file |
74 | ||
75 | AliMUONMCDataInterface diSim(filenameSim); | |
76 | AliMUONDataInterface diRec(filenameRec); | |
77 | ||
78 | if (!diSim.IsValid()) | |
79 | { | |
80 | cerr << "Cannot access " << filenameSim << endl; | |
81 | return; | |
82 | } | |
83 | ||
84 | if (!diRec.IsValid()) | |
85 | { | |
86 | cerr << "Cannot access " << filenameRec << endl; | |
87 | return; | |
88 | } | |
0cb382c1 | 89 | |
b1f2fbb2 | 90 | FILE* fdat = fopen("MUONTriggerEfficiency.out","w"); |
91 | if (!fdat) | |
92 | { | |
93 | cerr << "Cannot create output file" << endl; | |
94 | return; | |
95 | } | |
0cb382c1 | 96 | |
b1f2fbb2 | 97 | Int_t coincmuon,muonlpt,muonhpt; |
0cb382c1 | 98 | Int_t CoincMuPlus,CoincMuMinus; |
99 | coincmuon=0; | |
0cb382c1 | 100 | muonlpt=0; |
394cb950 | 101 | muonhpt=0; |
b1f2fbb2 | 102 | |
103 | Int_t nevents = diSim.NumberOfEvents(); | |
104 | ||
105 | for (Int_t ievent=0; ievent<nevents; ++ievent) | |
106 | { | |
107 | CoincMuPlus=0; | |
108 | CoincMuMinus=0; | |
0cb382c1 | 109 | |
b1f2fbb2 | 110 | if (ievent%1000==0) printf("\t Event = %d\n",ievent); |
6b092dfc | 111 | |
b1f2fbb2 | 112 | // Hits |
113 | ||
114 | Int_t NbHits[2][4]; | |
115 | for (Int_t j=0; j<2; j++) | |
116 | { | |
117 | for (Int_t jj=0; jj<4; jj++) | |
118 | { | |
119 | NbHits[j][jj]=0; | |
120 | } | |
0cb382c1 | 121 | } |
6b092dfc | 122 | |
b1f2fbb2 | 123 | Int_t ntracks = (Int_t) diSim.NumberOfTracks(ievent); |
124 | ||
125 | for ( Int_t itrack=0; itrack<ntracks; ++itrack ) | |
126 | { | |
127 | AliMUONVHitStore* hitStore = diSim.HitStore(ievent,itrack); | |
0cb382c1 | 128 | AliMUONHit* mHit; |
b1f2fbb2 | 129 | TIter next(hitStore->CreateIterator()); |
130 | ||
131 | while ( ( mHit = static_cast<AliMUONHit*>(next()) ) ) | |
132 | { | |
133 | Int_t Nch = mHit->Chamber(); | |
134 | Int_t hittrack = mHit->Track(); | |
135 | Float_t IdPart = mHit->Particle(); | |
136 | ||
137 | for (Int_t j=0;j<4;j++) | |
138 | { | |
139 | Int_t kch=11+j; | |
140 | if (hittrack==1 || hittrack==2) | |
141 | { | |
142 | if (Nch==kch && IdPart==-13 && NbHits[0][j]==0) NbHits[0][j]++; | |
143 | if (Nch==kch && IdPart==13 && NbHits[1][j]==0) NbHits[1][j]++; | |
0cb382c1 | 144 | } |
145 | } | |
b1f2fbb2 | 146 | } |
0cb382c1 | 147 | } // end track loop |
148 | ||
b1f2fbb2 | 149 | // 3/4 coincidence |
150 | Int_t SumNbHits=NbHits[0][0]+NbHits[0][1]+NbHits[0][2]+NbHits[0][3]; | |
0cb382c1 | 151 | if (SumNbHits==3 || SumNbHits==4) CoincMuPlus=1; |
b1f2fbb2 | 152 | |
0cb382c1 | 153 | SumNbHits=NbHits[1][0]+NbHits[1][1]+NbHits[1][2]+NbHits[1][3]; |
154 | if (SumNbHits==3 || SumNbHits==4) CoincMuMinus=1; | |
155 | ||
156 | if (CoincMuPlus==1 && CoincMuMinus==1) coincmuon++; | |
b1f2fbb2 | 157 | |
158 | TString tree("D"); | |
159 | if ( readFromRP ) tree = "R"; | |
6b092dfc | 160 | |
b1f2fbb2 | 161 | AliMUONVTriggerStore* triggerStore = diRec.TriggerStore(ievent,tree.Data()); |
162 | ||
163 | AliMUONGlobalTrigger* gloTrg = triggerStore->Global(); | |
0cb382c1 | 164 | |
b1f2fbb2 | 165 | if (gloTrg->PairUnlikeLpt()>=1) muonlpt++; |
166 | if (gloTrg->PairUnlikeHpt()>=1) muonhpt++; | |
0cb382c1 | 167 | |
168 | } // end loop on event | |
0cb382c1 | 169 | |
170 | // calculate efficiency with as a ref. at least 3/4 planes fired | |
ad705f30 | 171 | Float_t efficiencylpt,efficiencyhpt; |
172 | Double_t coincmu,lptmu,hptmu; | |
0cb382c1 | 173 | Float_t error; |
ad705f30 | 174 | coincmu=Double_t(coincmuon); |
0cb382c1 | 175 | lptmu=Double_t(muonlpt); |
176 | hptmu=Double_t(muonhpt); | |
177 | ||
0cb382c1 | 178 | // output |
179 | fprintf(fdat,"\n"); | |
180 | fprintf(fdat," Number of events = %d \n",nevents); | |
181 | fprintf(fdat," Number of events with 3/4 coinc = %d \n",coincmuon); | |
0cb382c1 | 182 | fprintf(fdat," Nomber of dimuons with 3/4 coinc Lpt cut = %d \n",muonlpt); |
183 | fprintf(fdat," Number of dimuons with 3/4 coinc Hpt cut = %d \n",muonhpt); | |
184 | fprintf(fdat,"\n"); | |
185 | ||
0cb382c1 | 186 | efficiencylpt=lptmu/coincmu; |
187 | error=efficiencylpt*TMath::Sqrt((lptmu+coincmu)/(lptmu*coincmu)); | |
188 | fprintf(fdat," Efficiency Lpt cut = %4.4f +/- %4.4f\n",efficiencylpt,error); | |
189 | ||
190 | efficiencyhpt=hptmu/coincmu; | |
191 | error=efficiencyhpt*TMath::Sqrt((hptmu+coincmu)/(hptmu*coincmu)); | |
192 | fprintf(fdat," Efficiency Hpt cut = %4.4f +/- %4.4f\n",efficiencyhpt,error); | |
193 | ||
194 | ||
195 | fclose(fdat); | |
196 | } | |
197 | ||
198 | ||
199 | ||
200 | ||
201 |