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 // with using AliMUONDataInterface
21 // By Bruce Becker, DAPNIA/SPhN/CEA Saclay
22 // According to MUONCheck.C
24 #if !defined(__CINT__) || defined(__MAKECINT__)
27 #include "TClonesArray.h"
30 #include "TParticle.h"
35 #include "AliRunLoader.h"
36 #include "AliHeader.h"
37 #include "AliLoader.h"
42 #include "AliMUONData.h"
43 #include "AliMUONHit.h"
44 #include "AliMUONConstants.h"
45 #include "AliMUONDigit.h"
46 #include "AliMUONRawCluster.h"
47 #include "AliMUONGlobalTrigger.h"
48 #include "AliMUONLocalTrigger.h"
49 #include "AliMUONTrack.h"
50 #include "AliMUONDataInterface.h"
54 void MUONkine(char * filename="galice.root")
56 AliMUONDataInterface amdi;
57 amdi.SetFile(filename);
58 Int_t nevents = amdi.NumberOfEvents();
60 for(Int_t ievent=0; ievent<nevents; ievent++)
62 Int_t iparticle, nparticles;
63 // Getting event ievent
64 amdi.GetEvent(ievent);
65 nparticles = amdi.NumberOfParticles();
66 printf(">>> Event %d, Number of particles is %d \n",ievent, nparticles);
67 for(iparticle=0; iparticle<nparticles; iparticle++)
69 amdi.Particle(iparticle)->Print("");
75 void MUONhits(char * filename="galice.root")
78 AliMUONDataInterface amdi;
79 amdi.SetFile(filename);
80 Int_t nevents = amdi.NumberOfEvents();
82 for(Int_t ievent=0; ievent<nevents; ievent++)
84 printf(">>> Event %d \n",ievent);
85 // Getting event ievent
86 amdi.GetEvent(ievent);
87 Int_t ntracks = amdi.NumberOfTracks();
88 for (Int_t itrack=0; itrack<ntracks; itrack++)
90 printf(">>> Track %d \n",itrack);
91 //Getting List of Hits of Track itrack
92 // amdi.GetTrack(itrack);
95 nhits = amdi.NumberOfHits(itrack);
96 printf(">>> Number of hits %d \n",nhits);
98 for(ihit=0; ihit<nhits; ihit++)
100 mHit = amdi.Hit(itrack,ihit);
101 Int_t Nch = mHit->Chamber(); // chamber number
102 Int_t detele = mHit-> DetElemId(); // Detection element if defined
103 Int_t hittrack = mHit->Track();
104 Float_t x = mHit->X();
105 Float_t y = mHit->Y();
106 Float_t z = mHit->Z();
107 Float_t elos = mHit->Eloss();
108 // Float_t theta = mHit->Theta();
109 // Float_t phi = mHit->Phi();
110 Float_t momentum = mHit->Momentum();
111 printf(">>> Hit %2d Chamber %2d DetEle %4d Track %4d x %6.3f y %6.3f z %7.3f elos %g momentum %5.3f\n",
112 ihit, Nch, detele, hittrack,x,y,z,elos,momentum);
119 void MUONdigits(char * filename="galice.root")
122 AliMUONDataInterface amdi;
123 amdi.SetFile(filename);
124 Int_t ievent, nevents;
125 nevents = amdi.NumberOfEvents();
126 AliMUONDigit * mDigit;
128 for(ievent=0; ievent<nevents; ievent++)
130 printf(">>> Event %d \n",ievent);
131 amdi.GetEvent(ievent);
134 Int_t ichamber, nchambers;
135 nchambers = AliMUONConstants::NCh(); ;
137 // Int_t icathode, ncathodes;
139 for( ichamber=0; ichamber<nchambers; ichamber++)
141 printf(">>> Chamber %d\n",ichamber+1);
143 Int_t idigit, ndigits;
144 ndigits = amdi.NumberOfDigits(ichamber,0); // second parameter here is cathode...
146 for(idigit=0; idigit<ndigits; idigit++)
148 mDigit = amdi.Digit(ichamber,0,idigit);
149 Int_t PadX = mDigit->PadX(); // Pad X number
150 Int_t PadY = mDigit->PadY(); // Pad Y number
151 Int_t Signal = mDigit->Charge(); // Physics Signal
152 Int_t Physics= mDigit->Physics(); // Physics contribution to signal
153 Int_t Hit = mDigit->Hit(); // iHit
154 Int_t Cathode= mDigit->Cathode(); // Cathode
155 Int_t Track0 = mDigit->Track(0);
156 Int_t Track1 = mDigit->Track(1);
157 Int_t Track2 = mDigit->Track(2);
158 Int_t TCharges0 = mDigit->TrackCharge(0); //charge per track making this digit (up to 10)
159 Int_t TCharges1 = mDigit->TrackCharge(1);
160 Int_t TCharges2 = mDigit->TrackCharge(2);
161 Int_t idDE = mDigit->DetElemId();
162 // printf(">>> Cathode %d\n",Cathode);
164 printf(">>>IdDE %d Digit %4d cathode %1d hit %4d PadX %3d PadY %3d Signal %4d Physics %4d Track0 %4d TrackCharge0 %4d Track1 %4d TrackCharge1 %4d Track2 %4d TrackCharge2 %4d \n",
165 idDE, idigit, Cathode,Hit, PadX, PadY, Signal, Physics, Track0,
166 TCharges0, Track1, TCharges1, Track2, TCharges2);
168 } // end chamber loop
172 void MUONrecpoints(char * filename="galice.root")
174 AliMUONDataInterface amdi;
175 amdi.SetFile(filename);
177 Int_t ievent, nevents;
178 nevents = amdi.NumberOfEvents();
179 AliMUONRawCluster * mRecPoint = 0;
181 for(ievent=0; ievent<nevents; ievent++)
183 printf(">>> Event %d \n",ievent);
184 amdi.GetEvent(ievent);
185 Int_t ichamber, nchambers;
186 nchambers = AliMUONConstants::NTrackingCh();
188 for( ichamber=0; ichamber<nchambers; ichamber++)
190 printf(">>> Chamber %d\n",ichamber);
191 Int_t irecpoint, nrecpoints;
192 nrecpoints = amdi.NumberOfRawClusters(ichamber);
193 printf("number of recpoints = %6d \n",nrecpoints);
194 for(irecpoint=0; irecpoint<nrecpoints; irecpoint++)
196 mRecPoint = amdi.RawCluster(ichamber,irecpoint);
197 // Int_t fTracks[3]; //labels of overlapped tracks
198 // Int_t fQ[2] ; // Q of cluster (in ADC counts)
199 // Float_t fX[2] ; // X of cluster
200 // Float_t fY[2] ; // Y of cluster
201 // Float_t fZ[2] ; // Z of cluster
202 // Int_t fPeakSignal[2]; // Peak signal
203 // Int_t fIndexMap[50][2]; // indeces of digits
204 // Int_t fOffsetMap[50][2]; // Emmanuel special
205 // Float_t fContMap[50][2]; // Contribution from digit
206 // Int_t fPhysicsMap[50]; // Distinguish signal and background contr.
207 // Int_t fMultiplicity[2]; // Cluster multiplicity
208 // Int_t fNcluster[2]; // Number of clusters
209 // Int_t fClusterType; // Cluster type
210 // Float_t fChi2[2]; // Chi**2 of fit
211 // Int_t fGhost; // 0 if not a ghost or ghost problem solved
212 // // >0 if ghost problem remains because
213 // // 1 both (true and ghost) satify
214 // // charge chi2 compatibility
215 // // 2 none give satisfactory chi2
217 Int_t Track0 = mRecPoint->GetTrack(0);
218 Int_t Track1 = mRecPoint->GetTrack(1);
219 Int_t Track2 = mRecPoint->GetTrack(2);
220 Int_t Q0 = mRecPoint->GetCharge(0);
221 Int_t Q1 = mRecPoint->GetCharge(1);
222 Float_t x0 = mRecPoint->GetX(0);
223 Float_t x1 = mRecPoint->GetX(1);
224 Float_t y0 = mRecPoint->GetY(0);
225 Float_t y1 = mRecPoint->GetY(1);
226 Float_t z0 = mRecPoint->GetZ(0);
227 Float_t z1 = mRecPoint->GetZ(1);
228 Float_t chi2_0 = mRecPoint->GetChi2(0);
229 Float_t chi2_1 = mRecPoint->GetChi2(1);
230 Int_t de = mRecPoint->GetDetElemId();
231 printf(">>> RecPoint %4d DetElem %2d 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",
232 irecpoint,de,x0,x1,y0,y1,z0,z1,Q0,Q1,Track0, Track1, Track2, chi2_0, chi2_1);
233 } // end recpoint loop
234 } // end chamber loop
238 void MUONTestTrigger (char * filename="galice.root")
240 // reads and dumps trigger objects from MUON.RecPoints.root
242 AliMUONDataInterface amdi;
243 amdi.SetFile(filename);
245 Int_t ievent, nevents;
246 nevents = amdi.NumberOfEvents();
248 AliMUONGlobalTrigger *gloTrg;
249 AliMUONLocalTrigger *locTrg;
251 for (ievent=0; ievent<nevents; ievent++)
253 amdi.GetEvent(ievent);
254 Int_t nglobals = amdi.NumberOfGlobalTriggers(); // should be 1
255 Int_t nlocals = amdi.NumberOfLocalTriggers(); // up to 234
256 printf("###################################################\n");
257 cout << " event " << ievent
258 << " nglobals nlocals: " << nglobals << " " << nlocals << "\n";
260 for (Int_t iglobal=0; iglobal<nglobals; iglobal++)
262 gloTrg = amdi.GlobalTrigger(iglobal);
264 printf("===================================================\n");
265 printf(" Global Trigger output Low pt High pt All\n");
266 printf(" number of Single Plus :\t");
267 printf("%i\t%i\t%i\t",gloTrg->SinglePlusLpt(),
268 gloTrg->SinglePlusHpt(),gloTrg->SinglePlusApt());
270 printf(" number of Single Minus :\t");
271 printf("%i\t%i\t%i\t",gloTrg->SingleMinusLpt(),
272 gloTrg->SingleMinusHpt(),gloTrg->SingleMinusApt());
274 printf(" number of Single Undefined :\t");
275 printf("%i\t%i\t%i\t",gloTrg->SingleUndefLpt(),
276 gloTrg->SingleUndefHpt(),gloTrg->SingleUndefApt());
278 printf(" number of UnlikeSign pair :\t");
279 printf("%i\t%i\t%i\t",gloTrg->PairUnlikeLpt(),
280 gloTrg->PairUnlikeHpt(),gloTrg->PairUnlikeApt());
282 printf(" number of LikeSign pair :\t");
283 printf("%i\t%i\t%i\t",gloTrg->PairLikeLpt(),
284 gloTrg->PairLikeHpt(),gloTrg->PairLikeApt());
286 printf("===================================================\n");
288 } // end of loop on Global Trigger
290 for (Int_t ilocal=0; ilocal<nlocals; ilocal++)
292 cout << " >>> Output for Local Trigger " << ilocal << "\n";
293 locTrg = amdi.LocalTrigger(ilocal);
294 cout << "Circuit StripX Dev StripY: "
295 << locTrg->LoCircuit() << " "
296 << locTrg->LoStripX() << " "
297 << locTrg->LoDev() << " "
298 << locTrg->LoStripY()
300 cout << "Lpt Hpt Apt: "
301 << locTrg->LoLpt() << " "
302 << locTrg->LoHpt() << " "
303 << locTrg->LoApt() << "\n";
305 } // end of loop on Local Trigger
306 } // end loop on event
309 void MUONRecTracks (char * filename="galice.root")
312 // reads and dumps trigger objects from MUON.RecPoints.root
313 AliMUONDataInterface amdi;
314 amdi.SetFile(filename);
315 AliMUONTrack* rectrack;
316 AliMUONTrackParam* trackparam;
318 Int_t ievent, nevents;
319 nevents = amdi.NumberOfEvents();
322 for (ievent=0; ievent<nevents; ievent++)
324 amdi.GetEvent(ievent);
325 Int_t nrectracks = amdi.NumberOfRecTracks();
326 printf(">>> Event %d Number of Recconstructed tracks %d \n",ievent, nrectracks);
327 // loop over rec tracks and print vertex parameters
328 for(Int_t rectracki=0; rectracki < nrectracks;rectracki++)
330 rectrack = amdi.RecTrack(rectracki);
331 trackparam = rectrack->GetTrackParamAtVertex(); // meaningless since the vertex is not known at the tracking level
332 x = trackparam->GetNonBendingCoor();
333 y = trackparam->GetBendingCoor();
334 z = trackparam->GetZ();
335 printf("Track Vertex : (x,y,z) = (%f,%f,%f \n",x,y,z);
336 } // end of loop over tracks
337 } // end loop on event