]>
Commit | Line | Data |
---|---|---|
88cb7938 | 1 | // |
2 | // Macro for checking aliroot output and associated files contents | |
3 | // Gines Martinez, Subatech June 2003 | |
4 | // | |
5 | ||
6 | // ROOT includes | |
7 | #include "TBranch.h" | |
8 | #include "TClonesArray.h" | |
9 | #include "TFile.h" | |
10 | #include "TH1.h" | |
11 | #include "TParticle.h" | |
12 | #include "TTree.h" | |
13 | ||
14 | // STEER includes | |
15 | #include "AliRun.h" | |
16 | #include "AliRunLoader.h" | |
17 | #include "AliHeader.h" | |
18 | #include "AliLoader.h" | |
19 | #include "AliStack.h" | |
20 | ||
21 | // MUON includes | |
22 | #include "AliMUON.h" | |
ce3f5e87 | 23 | #include "AliMUONData.h" |
88cb7938 | 24 | #include "AliMUONHit.h" |
25 | #include "AliMUONConstants.h" | |
26 | #include "AliMUONDigit.h" | |
27 | #include "AliMUONRawCluster.h" | |
28 | #include "AliMUONGlobalTrigger.h" | |
29 | #include "AliMUONLocalTrigger.h" | |
30 | ||
31 | void MUONkine(char * filename="galice.root") | |
32 | { | |
33 | TClonesArray * ListOfParticles = new TClonesArray("TParticle",1000); | |
34 | TParticle * particle = new TParticle(); | |
35 | // Creating Run Loader and openning file containing Hits | |
36 | AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ"); | |
37 | if (RunLoader ==0x0) { | |
38 | printf(">>> Error : Error Opening %s file \n",filename); | |
39 | return; | |
40 | } | |
41 | RunLoader->LoadKinematics("READ"); | |
42 | Int_t ievent, nevents; | |
43 | nevents = RunLoader->GetNumberOfEvents(); | |
44 | ||
45 | for(ievent=0; ievent<nevents; ievent++) { // Event loop | |
46 | Int_t iparticle, nparticles; | |
47 | // Getting event ievent | |
48 | RunLoader->GetEvent(ievent); | |
49 | RunLoader->TreeK()->GetBranch("Particles")->SetAddress(&particle); | |
50 | nparticles = RunLoader->TreeK()->GetEntries(); | |
51 | printf(">>> Event %d, Number of particles is %d \n",ievent, nparticles); | |
52 | for(iparticle=0; iparticle<nparticles; iparticle++) { | |
53 | RunLoader->TreeK()->GetEvent(iparticle); | |
54 | particle->Print(""); | |
55 | } | |
56 | } | |
57 | RunLoader->UnloadKinematics(); | |
58 | } | |
59 | ||
60 | ||
61 | void MUONhits(char * filename="galice.root") | |
62 | { | |
88cb7938 | 63 | // Creating Run Loader and openning file containing Hits |
64 | AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ"); | |
65 | if (RunLoader ==0x0) { | |
66 | printf(">>> Error : Error Opening %s file \n",filename); | |
67 | return; | |
68 | } | |
88cb7938 | 69 | // Loading MUON subsystem |
70 | AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader"); | |
1a1cdff8 | 71 | MUONLoader->LoadHits("READ"); // Loading Tree of hits for MUON |
72 | AliMUONData muondata(MUONLoader,"MUON","MUON"); // Creating MUON data container | |
88cb7938 | 73 | Int_t ievent, nevents; |
74 | nevents = RunLoader->GetNumberOfEvents(); | |
75 | ||
76 | for(ievent=0; ievent<nevents; ievent++) { // Event loop | |
77 | printf(">>> Event %d \n",ievent); | |
88cb7938 | 78 | // Getting event ievent |
79 | RunLoader->GetEvent(ievent); | |
ce3f5e87 | 80 | muondata.SetTreeAddress("H"); |
88cb7938 | 81 | Int_t itrack, ntracks; |
1a1cdff8 | 82 | ntracks = (Int_t) muondata.GetNtracks(); |
88cb7938 | 83 | for (itrack=0; itrack<ntracks; itrack++) { // Track loop |
84 | printf(">>> Track %d \n",itrack); | |
85 | ||
86 | //Getting List of Hits of Track itrack | |
1a1cdff8 | 87 | muondata.GetTrack(itrack); |
88cb7938 | 88 | |
89 | Int_t ihit, nhits; | |
ce3f5e87 | 90 | nhits = (Int_t) muondata.Hits()->GetEntriesFast(); |
88cb7938 | 91 | printf(">>> Number of hits %d \n",nhits); |
92 | AliMUONHit* mHit; | |
93 | for(ihit=0; ihit<nhits; ihit++) { | |
ce3f5e87 | 94 | mHit = static_cast<AliMUONHit*>(muondata.Hits()->At(ihit)); |
88cb7938 | 95 | Int_t Nch = mHit->Chamber(); // chamber number |
96 | Int_t hittrack = mHit->Track(); | |
97 | Float_t x = mHit->X(); | |
98 | Float_t y = mHit->Y(); | |
99 | Float_t z = mHit->Z(); | |
100 | Float_t elos = mHit->Eloss(); | |
101 | Float_t theta = mHit->Theta(); | |
102 | Float_t phi = mHit->Phi(); | |
103 | Float_t momentum = mHit->Momentum(); | |
104 | printf(">>> Hit %2d Chamber %2d Track %4d x %6.3f y %6.3f z %7.3f elos %g theta %6.3f phi %5.3f momentum %5.3f\n", | |
105 | ihit, Nch,hittrack,x,y,z,elos,theta,phi, momentum); | |
106 | } | |
ce3f5e87 | 107 | muondata.ResetHits(); |
88cb7938 | 108 | } // end track loop |
109 | } // end event loop | |
110 | MUONLoader->UnloadHits(); | |
111 | } | |
112 | ||
113 | ||
114 | void MUONdigits(char * filename="galice.root") | |
115 | { | |
88cb7938 | 116 | // Creating Run Loader and openning file containing Hits |
117 | AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ"); | |
118 | if (RunLoader ==0x0) { | |
119 | printf(">>> Error : Error Opening %s file \n",filename); | |
120 | return; | |
121 | } | |
ce3f5e87 | 122 | // Loading MUON subsystem |
88cb7938 | 123 | AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader"); |
124 | MUONLoader->LoadDigits("READ"); | |
ce3f5e87 | 125 | // Creating MUON data container |
126 | AliMUONData muondata(MUONLoader,"MUON","MUON"); | |
127 | ||
88cb7938 | 128 | Int_t ievent, nevents; |
129 | nevents = RunLoader->GetNumberOfEvents(); | |
88cb7938 | 130 | AliMUONDigit * mDigit; |
131 | ||
88cb7938 | 132 | for(ievent=0; ievent<nevents; ievent++) { |
133 | printf(">>> Event %d \n",ievent); | |
134 | RunLoader->GetEvent(ievent); | |
135 | ||
136 | // Addressing | |
137 | Int_t ichamber, nchambers; | |
138 | nchambers = AliMUONConstants::NCh(); ; | |
ce3f5e87 | 139 | muondata.SetTreeAddress("D"); |
88cb7938 | 140 | char branchname[30]; |
ce3f5e87 | 141 | |
88cb7938 | 142 | Int_t icathode, ncathodes; |
143 | ncathodes=2; | |
144 | //Loop on cathodes | |
145 | for(icathode=0; icathode<ncathodes; icathode++) { | |
146 | printf(">>> Cathode %d\n",icathode); | |
1a1cdff8 | 147 | muondata.GetCathode(icathode); |
88cb7938 | 148 | // Loop on chambers |
149 | for( ichamber=0; ichamber<nchambers; ichamber++) { | |
150 | printf(">>> Chamber %d\n",ichamber); | |
88cb7938 | 151 | |
152 | Int_t idigit, ndigits; | |
1a1cdff8 | 153 | ndigits = (Int_t) muondata.Digits(ichamber)->GetEntriesFast(); |
88cb7938 | 154 | |
155 | for(idigit=0; idigit<ndigits; idigit++) { | |
1a1cdff8 | 156 | mDigit = static_cast<AliMUONDigit*>(muondata.Digits(ichamber)->At(idigit)); |
88cb7938 | 157 | Int_t PadX = mDigit->PadX(); // Pad X number |
158 | Int_t PadY = mDigit->PadY(); // Pad Y number | |
159 | Int_t Signal = mDigit->Signal(); // Physics Signal | |
160 | Int_t Hit = mDigit->Hit(); // iHit | |
161 | Int_t Cathode= mDigit->Cathode(); // Cathode | |
162 | Int_t Track0 = mDigit->Track(0); | |
163 | Int_t Track1 = mDigit->Track(1); | |
164 | Int_t Track2 = mDigit->Track(2); | |
165 | ||
166 | printf(">>> Digit %4d cathode %1d hit %4d PadX %3d PadY %3d Signal %4d Track0 %4d Track1 %'d Track2 %4d \n",idigit, Cathode,Hit, PadX, PadY, Signal, Track0, Track1, Track2); | |
167 | } // end digit loop | |
168 | } // end chamber loop | |
ce3f5e87 | 169 | muondata.ResetDigits(); |
88cb7938 | 170 | } // end cathode loop |
171 | } // end event loop | |
172 | MUONLoader->UnloadDigits(); | |
173 | } | |
174 | ||
175 | void MUONrecpoints(char * filename="galice.root") { | |
176 | ||
88cb7938 | 177 | // Creating Run Loader and openning file containing Hits |
178 | AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ"); | |
179 | if (RunLoader ==0x0) { | |
180 | printf(">>> Error : Error Opening %s file \n",filename); | |
181 | return; | |
182 | } | |
ce3f5e87 | 183 | // Getting MUONloader |
88cb7938 | 184 | AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader"); |
185 | MUONLoader->LoadRecPoints("READ"); | |
ce3f5e87 | 186 | // Creating MUON data container |
187 | AliMUONData muondata(MUONLoader,"MUON","MUON"); | |
88cb7938 | 188 | |
189 | Int_t ievent, nevents; | |
190 | nevents = RunLoader->GetNumberOfEvents(); | |
88cb7938 | 191 | AliMUONRawCluster * mRecPoint; |
192 | ||
88cb7938 | 193 | for(ievent=0; ievent<nevents; ievent++) { |
194 | printf(">>> Event %d \n",ievent); | |
195 | RunLoader->GetEvent(ievent); | |
88cb7938 | 196 | // Addressing |
197 | Int_t ichamber, nchambers; | |
198 | nchambers = AliMUONConstants::NTrackingCh(); | |
ce3f5e87 | 199 | muondata.SetTreeAddress("RC"); |
88cb7938 | 200 | char branchname[30]; |
1a1cdff8 | 201 | muondata.GetRawClusters(); |
88cb7938 | 202 | // Loop on chambers |
203 | for( ichamber=0; ichamber<nchambers; ichamber++) { | |
204 | printf(">>> Chamber %d\n",ichamber); | |
205 | sprintf(branchname,"MUONRawClusters%d",ichamber+1); | |
206 | //printf(">>> branchname %s\n",branchname); | |
ce3f5e87 | 207 | |
88cb7938 | 208 | Int_t irecpoint, nrecpoints; |
ce3f5e87 | 209 | nrecpoints = (Int_t) muondata.RawClusters(ichamber)->GetEntriesFast(); |
88cb7938 | 210 | |
211 | for(irecpoint=0; irecpoint<nrecpoints; irecpoint++) { | |
ce3f5e87 | 212 | mRecPoint = static_cast<AliMUONRawCluster*>(muondata.RawClusters(ichamber)->At(irecpoint)); |
88cb7938 | 213 | // Int_t fTracks[3]; //labels of overlapped tracks |
214 | // Int_t fQ[2] ; // Q of cluster (in ADC counts) | |
215 | // Float_t fX[2] ; // X of cluster | |
216 | // Float_t fY[2] ; // Y of cluster | |
217 | // Float_t fZ[2] ; // Z of cluster | |
218 | // Int_t fPeakSignal[2]; // Peak signal | |
219 | // Int_t fIndexMap[50][2]; // indeces of digits | |
220 | // Int_t fOffsetMap[50][2]; // Emmanuel special | |
221 | // Float_t fContMap[50][2]; // Contribution from digit | |
222 | // Int_t fPhysicsMap[50]; // Distinguish signal and background contr. | |
223 | // Int_t fMultiplicity[2]; // Cluster multiplicity | |
224 | // Int_t fNcluster[2]; // Number of clusters | |
225 | // Int_t fClusterType; // Cluster type | |
226 | // Float_t fChi2[2]; // Chi**2 of fit | |
227 | // Int_t fGhost; // 0 if not a ghost or ghost problem solved | |
228 | // // >0 if ghost problem remains because | |
229 | // // 1 both (true and ghost) satify | |
230 | // // charge chi2 compatibility | |
231 | // // 2 none give satisfactory chi2 | |
232 | ||
233 | Int_t Track0 = mRecPoint->fTracks[0]; | |
234 | Int_t Track1 = mRecPoint->fTracks[1]; | |
235 | Int_t Track2 = mRecPoint->fTracks[2]; | |
236 | Int_t Q0 = mRecPoint->fQ[0]; | |
237 | Int_t Q1 = mRecPoint->fQ[1]; | |
238 | Float_t x0 = mRecPoint->fX[0]; | |
239 | Float_t x1 = mRecPoint->fX[1]; | |
240 | Float_t y0 = mRecPoint->fY[0]; | |
241 | Float_t y1 = mRecPoint->fY[1]; | |
242 | Float_t z0 = mRecPoint->fZ[0]; | |
243 | Float_t z1 = mRecPoint->fZ[1]; | |
244 | Float_t chi2_0 = mRecPoint->fChi2[0]; | |
245 | Float_t chi2_1 = mRecPoint->fChi2[1]; | |
246 | ||
247 | printf(">>> RecPoint %4d x %6.3f %6.3f y %6.3f %6.3f z %6.3f %6.3f Q0 %4d Q1 %4d Hit %4d Track1 %4d Track2 %4d Chi2 %6.3f %6.3f \n", | |
248 | irecpoint, x0, x1, y0, y1, z0, z1, Q0, Q1, Track0, Track1, Track2, chi2_0, chi2_1); | |
249 | } // end recpoint loop | |
250 | } // end chamber loop | |
ce3f5e87 | 251 | muondata.ResetRawClusters(); |
88cb7938 | 252 | } // end event loop |
253 | MUONLoader->UnloadRecPoints(); | |
254 | } | |
255 | ||
256 | void MUONTestTrigger (char * filename="galice.root"){ | |
257 | // reads and dumps trigger objects from MUON.RecPoints.root | |
258 | TClonesArray * globalTrigger; | |
259 | TClonesArray * localTrigger; | |
260 | ||
261 | // Creating Run Loader and openning file containing Hits | |
262 | AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ"); | |
263 | if (RunLoader ==0x0) { | |
264 | printf(">>> Error : Error Opening %s file \n",filename); | |
265 | return; | |
266 | } | |
267 | ||
88cb7938 | 268 | AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader"); |
269 | MUONLoader->LoadRecPoints("READ"); | |
ce3f5e87 | 270 | // Creating MUON data container |
271 | AliMUONData muondata(MUONLoader,"MUON","MUON"); | |
88cb7938 | 272 | |
ce3f5e87 | 273 | |
88cb7938 | 274 | Int_t ievent, nevents; |
275 | nevents = RunLoader->GetNumberOfEvents(); | |
276 | ||
277 | AliMUONGlobalTrigger *gloTrg; | |
278 | AliMUONLocalTrigger *locTrg; | |
279 | ||
280 | for (ievent=0; ievent<nevents; ievent++) { | |
281 | RunLoader->GetEvent(ievent); | |
282 | ||
ce3f5e87 | 283 | muondata.SetTreeAddress("GLT"); |
1a1cdff8 | 284 | muondata.GetTrigger(); |
88cb7938 | 285 | |
ce3f5e87 | 286 | globalTrigger = muondata.GlobalTrigger(); |
287 | localTrigger = muondata.LocalTrigger(); | |
88cb7938 | 288 | |
289 | Int_t nglobals = (Int_t) globalTrigger->GetEntriesFast(); // should be 1 | |
290 | Int_t nlocals = (Int_t) localTrigger->GetEntriesFast(); // up to 234 | |
291 | printf("###################################################\n"); | |
292 | cout << " event " << ievent | |
293 | << " nglobals nlocals: " << nglobals << " " << nlocals << "\n"; | |
294 | ||
295 | for (Int_t iglobal=0; iglobal<nglobals; iglobal++) { // Global Trigger | |
296 | gloTrg = static_cast<AliMUONGlobalTrigger*>(globalTrigger->At(iglobal)); | |
297 | ||
298 | printf("===================================================\n"); | |
299 | printf(" Global Trigger output Low pt High pt All\n"); | |
300 | printf(" number of Single Plus :\t"); | |
301 | printf("%i\t%i\t%i\t",gloTrg->SinglePlusLpt(), | |
302 | gloTrg->SinglePlusHpt(),gloTrg->SinglePlusApt()); | |
303 | printf("\n"); | |
304 | printf(" number of Single Minus :\t"); | |
305 | printf("%i\t%i\t%i\t",gloTrg->SingleMinusLpt(), | |
306 | gloTrg->SingleMinusHpt(),gloTrg->SingleMinusApt()); | |
307 | printf("\n"); | |
308 | printf(" number of Single Undefined :\t"); | |
309 | printf("%i\t%i\t%i\t",gloTrg->SingleUndefLpt(), | |
310 | gloTrg->SingleUndefHpt(),gloTrg->SingleUndefApt()); | |
311 | printf("\n"); | |
312 | printf(" number of UnlikeSign pair :\t"); | |
313 | printf("%i\t%i\t%i\t",gloTrg->PairUnlikeLpt(), | |
314 | gloTrg->PairUnlikeHpt(),gloTrg->PairUnlikeApt()); | |
315 | printf("\n"); | |
316 | printf(" number of LikeSign pair :\t"); | |
317 | printf("%i\t%i\t%i\t",gloTrg->PairLikeLpt(), | |
318 | gloTrg->PairLikeHpt(),gloTrg->PairLikeApt()); | |
319 | printf("\n"); | |
320 | printf("===================================================\n"); | |
321 | ||
322 | } // end of loop on Global Trigger | |
323 | ||
324 | for (Int_t ilocal=0; ilocal<nlocals; ilocal++) { // Local Trigger | |
325 | cout << " >>> Output for Local Trigger " << ilocal << "\n"; | |
326 | ||
327 | locTrg = static_cast<AliMUONLocalTrigger*>(localTrigger->At(ilocal)); | |
328 | ||
329 | cout << "Circuit StripX Dev StripY: " | |
330 | << locTrg->LoCircuit() << " " | |
331 | << locTrg->LoStripX() << " " | |
332 | << locTrg->LoDev() << " " | |
333 | << locTrg->LoStripY() | |
334 | << "\n"; | |
335 | cout << "Lpt Hpt Apt: " | |
336 | << locTrg->LoLpt() << " " | |
337 | << locTrg->LoHpt() << " " | |
338 | << locTrg->LoApt() << "\n"; | |
339 | ||
340 | } // end of loop on Local Trigger | |
ce3f5e87 | 341 | muondata.ResetTrigger(); |
88cb7938 | 342 | } // end loop on event |
343 | } | |
344 | ||
345 | ||
346 | ||
347 | ||
348 |