1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
19 // Macro for checking aliroot output and associated files contents
20 // Gines Martinez, Subatech June 2003
24 #if !defined(__CINT__) || defined(__MAKECINT__)
26 #include "TClonesArray.h"
29 #include "TParticle.h"
34 #include "AliRunLoader.h"
35 #include "AliHeader.h"
36 #include "AliLoader.h"
41 #include "AliMUONData.h"
42 #include "AliMUONHit.h"
43 #include "AliMUONConstants.h"
44 #include "AliMUONDigit.h"
45 #include "AliMUONRawCluster.h"
46 #include "AliMUONGlobalTrigger.h"
47 #include "AliMUONLocalTrigger.h"
48 #include "AliMUONTrack.h"
51 void MUONkine(char * filename="galice.root")
53 TClonesArray * ListOfParticles = new TClonesArray("TParticle",1000);
54 TParticle * particle = new TParticle();
55 // Creating Run Loader and openning file containing Hits
56 AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ");
57 if (RunLoader ==0x0) {
58 printf(">>> Error : Error Opening %s file \n",filename);
61 RunLoader->LoadKinematics("READ");
62 Int_t ievent, nevents;
63 nevents = RunLoader->GetNumberOfEvents();
65 for(ievent=0; ievent<nevents; ievent++) { // Event loop
66 Int_t iparticle, nparticles;
67 // Getting event ievent
68 RunLoader->GetEvent(ievent);
69 RunLoader->TreeK()->GetBranch("Particles")->SetAddress(&particle);
70 nparticles = RunLoader->TreeK()->GetEntries();
71 printf(">>> Event %d, Number of particles is %d \n",ievent, nparticles);
72 for(iparticle=0; iparticle<nparticles; iparticle++) {
73 RunLoader->TreeK()->GetEvent(iparticle);
77 RunLoader->UnloadKinematics();
81 void MUONhits(char * filename="galice.root")
83 // Creating Run Loader and openning file containing Hits
84 AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ");
85 if (RunLoader ==0x0) {
86 printf(">>> Error : Error Opening %s file \n",filename);
89 // Loading MUON subsystem
90 AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
91 MUONLoader->LoadHits("READ"); // Loading Tree of hits for MUON
92 AliMUONData muondata(MUONLoader,"MUON","MUON"); // Creating MUON data container
93 Int_t ievent, nevents;
94 nevents = RunLoader->GetNumberOfEvents();
96 for(ievent=0; ievent<nevents; ievent++) { // Event loop
97 printf(">>> Event %d \n",ievent);
98 // Getting event ievent
99 RunLoader->GetEvent(ievent);
100 muondata.SetTreeAddress("H");
101 Int_t itrack, ntracks;
102 ntracks = (Int_t) muondata.GetNtracks();
103 for (itrack=0; itrack<ntracks; itrack++) { // Track loop
104 printf(">>> Track %d \n",itrack);
106 //Getting List of Hits of Track itrack
107 muondata.GetTrack(itrack);
110 nhits = (Int_t) muondata.Hits()->GetEntriesFast();
111 printf(">>> Number of hits %d \n",nhits);
113 for(ihit=0; ihit<nhits; ihit++) {
114 mHit = static_cast<AliMUONHit*>(muondata.Hits()->At(ihit));
115 Int_t Nch = mHit->Chamber(); // chamber number
116 Int_t hittrack = mHit->Track();
117 Float_t x = mHit->X();
118 Float_t y = mHit->Y();
119 Float_t z = mHit->Z();
120 Float_t elos = mHit->Eloss();
121 Float_t theta = mHit->Theta();
122 Float_t phi = mHit->Phi();
123 Float_t momentum = mHit->Momentum();
124 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",
125 ihit, Nch,hittrack,x,y,z,elos,theta,phi, momentum);
127 muondata.ResetHits();
130 MUONLoader->UnloadHits();
134 void MUONdigits(char * filename="galice.root")
136 // Creating Run Loader and openning file containing Hits
137 AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ");
138 if (RunLoader ==0x0) {
139 printf(">>> Error : Error Opening %s file \n",filename);
142 // Loading MUON subsystem
143 AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
144 MUONLoader->LoadDigits("READ");
145 // Creating MUON data container
146 AliMUONData muondata(MUONLoader,"MUON","MUON");
148 Int_t ievent, nevents;
149 nevents = RunLoader->GetNumberOfEvents();
150 AliMUONDigit * mDigit;
152 for(ievent=0; ievent<nevents; ievent++) {
153 printf(">>> Event %d \n",ievent);
154 RunLoader->GetEvent(ievent);
157 Int_t ichamber, nchambers;
158 nchambers = AliMUONConstants::NCh(); ;
159 muondata.SetTreeAddress("D");
162 Int_t icathode, ncathodes;
165 for(icathode=0; icathode<ncathodes; icathode++) {
166 printf(">>> Cathode %d\n",icathode);
167 muondata.GetCathode(icathode);
169 for( ichamber=0; ichamber<nchambers; ichamber++) {
170 printf(">>> Chamber %d\n",ichamber);
172 Int_t idigit, ndigits;
173 ndigits = (Int_t) muondata.Digits(ichamber)->GetEntriesFast();
175 for(idigit=0; idigit<ndigits; idigit++) {
176 mDigit = static_cast<AliMUONDigit*>(muondata.Digits(ichamber)->At(idigit));
177 Int_t PadX = mDigit->PadX(); // Pad X number
178 Int_t PadY = mDigit->PadY(); // Pad Y number
179 Int_t Signal = mDigit->Signal(); // Physics Signal
180 Int_t Physics= mDigit->Physics(); // Physics contribution to signal
181 Int_t Hit = mDigit->Hit(); // iHit
182 Int_t Cathode= mDigit->Cathode(); // Cathode
183 Int_t Track0 = mDigit->Track(0);
184 Int_t Track1 = mDigit->Track(1);
185 Int_t Track2 = mDigit->Track(2);
186 Int_t TCharges0 = mDigit->TrackCharge(0); //charge per track making this digit (up to 10)
187 Int_t TCharges1 = mDigit->TrackCharge(1);
188 Int_t TCharges2 = mDigit->TrackCharge(2);
190 printf(">>> Digit %4d cathode %1d hit %4d PadX %3d PadY %3d Signal %4d Physics %4d Track0 %4d TrackCharge0 %4d Track1 %'d
191 TrackCharge1 %4d Track2 %4d TrackCharge2 %4d \n",idigit, Cathode,Hit, PadX, PadY, Signal, Physics,
192 Track0, TCharges0, Track1, TCharges1, Track2, TCharges2);
194 } // end chamber loop
195 muondata.ResetDigits();
196 } // end cathode loop
198 MUONLoader->UnloadDigits();
201 void MUONrecpoints(char * filename="galice.root") {
203 // Creating Run Loader and openning file containing Hits
204 AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ");
205 if (RunLoader ==0x0) {
206 printf(">>> Error : Error Opening %s file \n",filename);
209 // Getting MUONloader
210 AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
211 MUONLoader->LoadRecPoints("READ");
212 // Creating MUON data container
213 AliMUONData muondata(MUONLoader,"MUON","MUON");
215 Int_t ievent, nevents;
216 nevents = RunLoader->GetNumberOfEvents();
217 AliMUONRawCluster * mRecPoint;
219 for(ievent=0; ievent<nevents; ievent++) {
220 printf(">>> Event %d \n",ievent);
221 RunLoader->GetEvent(ievent);
223 Int_t ichamber, nchambers;
224 nchambers = AliMUONConstants::NTrackingCh();
225 muondata.SetTreeAddress("RC");
227 muondata.GetRawClusters();
229 for( ichamber=0; ichamber<nchambers; ichamber++) {
230 printf(">>> Chamber %d\n",ichamber);
231 sprintf(branchname,"MUONRawClusters%d",ichamber+1);
232 //printf(">>> branchname %s\n",branchname);
234 Int_t irecpoint, nrecpoints;
235 nrecpoints = (Int_t) muondata.RawClusters(ichamber)->GetEntriesFast();
237 for(irecpoint=0; irecpoint<nrecpoints; irecpoint++) {
238 mRecPoint = static_cast<AliMUONRawCluster*>(muondata.RawClusters(ichamber)->At(irecpoint));
239 // Int_t fTracks[3]; //labels of overlapped tracks
240 // Int_t fQ[2] ; // Q of cluster (in ADC counts)
241 // Float_t fX[2] ; // X of cluster
242 // Float_t fY[2] ; // Y of cluster
243 // Float_t fZ[2] ; // Z of cluster
244 // Int_t fPeakSignal[2]; // Peak signal
245 // Int_t fIndexMap[50][2]; // indeces of digits
246 // Int_t fOffsetMap[50][2]; // Emmanuel special
247 // Float_t fContMap[50][2]; // Contribution from digit
248 // Int_t fPhysicsMap[50]; // Distinguish signal and background contr.
249 // Int_t fMultiplicity[2]; // Cluster multiplicity
250 // Int_t fNcluster[2]; // Number of clusters
251 // Int_t fClusterType; // Cluster type
252 // Float_t fChi2[2]; // Chi**2 of fit
253 // Int_t fGhost; // 0 if not a ghost or ghost problem solved
254 // // >0 if ghost problem remains because
255 // // 1 both (true and ghost) satify
256 // // charge chi2 compatibility
257 // // 2 none give satisfactory chi2
259 Int_t Track0 = mRecPoint->fTracks[0];
260 Int_t Track1 = mRecPoint->fTracks[1];
261 Int_t Track2 = mRecPoint->fTracks[2];
262 Int_t Q0 = mRecPoint->fQ[0];
263 Int_t Q1 = mRecPoint->fQ[1];
264 Float_t x0 = mRecPoint->fX[0];
265 Float_t x1 = mRecPoint->fX[1];
266 Float_t y0 = mRecPoint->fY[0];
267 Float_t y1 = mRecPoint->fY[1];
268 Float_t z0 = mRecPoint->fZ[0];
269 Float_t z1 = mRecPoint->fZ[1];
270 Float_t chi2_0 = mRecPoint->fChi2[0];
271 Float_t chi2_1 = mRecPoint->fChi2[1];
273 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",
274 irecpoint, x0, x1, y0, y1, z0, z1, Q0, Q1, Track0, Track1, Track2, chi2_0, chi2_1);
275 } // end recpoint loop
276 } // end chamber loop
277 muondata.ResetRawClusters();
279 MUONLoader->UnloadRecPoints();
282 void MUONTestTrigger (char * filename="galice.root"){
283 // reads and dumps trigger objects from MUON.RecPoints.root
284 TClonesArray * globalTrigger;
285 TClonesArray * localTrigger;
287 // Creating Run Loader and openning file containing Hits
288 AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ");
289 if (RunLoader ==0x0) {
290 printf(">>> Error : Error Opening %s file \n",filename);
294 AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
295 MUONLoader->LoadRecPoints("READ");
296 // Creating MUON data container
297 AliMUONData muondata(MUONLoader,"MUON","MUON");
300 Int_t ievent, nevents;
301 nevents = RunLoader->GetNumberOfEvents();
303 AliMUONGlobalTrigger *gloTrg;
304 AliMUONLocalTrigger *locTrg;
306 for (ievent=0; ievent<nevents; ievent++) {
307 RunLoader->GetEvent(ievent);
309 muondata.SetTreeAddress("GLT");
310 muondata.GetTrigger();
312 globalTrigger = muondata.GlobalTrigger();
313 localTrigger = muondata.LocalTrigger();
315 Int_t nglobals = (Int_t) globalTrigger->GetEntriesFast(); // should be 1
316 Int_t nlocals = (Int_t) localTrigger->GetEntriesFast(); // up to 234
317 printf("###################################################\n");
318 cout << " event " << ievent
319 << " nglobals nlocals: " << nglobals << " " << nlocals << "\n";
321 for (Int_t iglobal=0; iglobal<nglobals; iglobal++) { // Global Trigger
322 gloTrg = static_cast<AliMUONGlobalTrigger*>(globalTrigger->At(iglobal));
324 printf("===================================================\n");
325 printf(" Global Trigger output Low pt High pt All\n");
326 printf(" number of Single Plus :\t");
327 printf("%i\t%i\t%i\t",gloTrg->SinglePlusLpt(),
328 gloTrg->SinglePlusHpt(),gloTrg->SinglePlusApt());
330 printf(" number of Single Minus :\t");
331 printf("%i\t%i\t%i\t",gloTrg->SingleMinusLpt(),
332 gloTrg->SingleMinusHpt(),gloTrg->SingleMinusApt());
334 printf(" number of Single Undefined :\t");
335 printf("%i\t%i\t%i\t",gloTrg->SingleUndefLpt(),
336 gloTrg->SingleUndefHpt(),gloTrg->SingleUndefApt());
338 printf(" number of UnlikeSign pair :\t");
339 printf("%i\t%i\t%i\t",gloTrg->PairUnlikeLpt(),
340 gloTrg->PairUnlikeHpt(),gloTrg->PairUnlikeApt());
342 printf(" number of LikeSign pair :\t");
343 printf("%i\t%i\t%i\t",gloTrg->PairLikeLpt(),
344 gloTrg->PairLikeHpt(),gloTrg->PairLikeApt());
346 printf("===================================================\n");
348 } // end of loop on Global Trigger
350 for (Int_t ilocal=0; ilocal<nlocals; ilocal++) { // Local Trigger
351 cout << " >>> Output for Local Trigger " << ilocal << "\n";
353 locTrg = static_cast<AliMUONLocalTrigger*>(localTrigger->At(ilocal));
355 cout << "Circuit StripX Dev StripY: "
356 << locTrg->LoCircuit() << " "
357 << locTrg->LoStripX() << " "
358 << locTrg->LoDev() << " "
359 << locTrg->LoStripY()
361 cout << "Lpt Hpt Apt: "
362 << locTrg->LoLpt() << " "
363 << locTrg->LoHpt() << " "
364 << locTrg->LoApt() << "\n";
366 } // end of loop on Local Trigger
367 muondata.ResetTrigger();
368 } // end loop on event
369 MUONLoader->UnloadRecPoints();
374 void MUONRecTracks (char * filename="galice.root"){
375 // reads and dumps trigger objects from MUON.RecPoints.root
376 TClonesArray * RecTracks;
378 // Creating Run Loader and openning file containing Hits
379 AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ");
380 if (RunLoader ==0x0) {
381 printf(">>> Error : Error Opening %s file \n",filename);
385 AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
386 MUONLoader->LoadTracks("READ");
387 // Creating MUON data container
388 AliMUONData muondata(MUONLoader,"MUON","MUON");
390 Int_t ievent, nevents;
391 nevents = RunLoader->GetNumberOfEvents();
393 AliMUONTrack * rectrack;
395 for (ievent=0; ievent<nevents; ievent++) {
396 RunLoader->GetEvent(ievent);
398 muondata.SetTreeAddress("RT");
399 muondata.GetRecTracks();
400 RecTracks = muondata.RecTracks();
403 Int_t nrectracks = (Int_t) RecTracks->GetEntriesFast(); //
405 printf(">>> Event %d Number of Recconstructed tracks %d \n",ievent, nrectracks);
407 muondata.ResetRecTracks();
408 } // end loop on event
409 MUONLoader->UnloadTracks();