]>
Commit | Line | Data |
---|---|---|
2c0075de | 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 | ||
16 | /* | |
17 | $Log$ | |
70479d0e | 18 | Revision 1.6 2001/05/16 14:57:17 alibrary |
19 | New files for folders and Stack | |
20 | ||
9e1a0ddb | 21 | Revision 1.5 2001/05/11 07:59:03 hristov |
22 | Index corrected | |
23 | ||
b1ed2294 | 24 | Revision 1.4 2001/01/26 20:00:53 hristov |
25 | Major upgrade of AliRoot code | |
26 | ||
2ab0c725 | 27 | Revision 1.3 2000/12/21 17:51:54 morsch |
28 | RN3 violations corrected | |
29 | ||
7c85b268 | 30 | Revision 1.2 2000/11/23 10:09:38 gosset |
31 | Bug correction in AliMUONRecoDisplay. | |
2ab0c725 | 32 | Copyright, $Log$ |
70479d0e | 33 | Copyright, Revision 1.6 2001/05/16 14:57:17 alibrary |
34 | Copyright, New files for folders and Stack | |
35 | Copyright, | |
9e1a0ddb | 36 | Copyright, Revision 1.5 2001/05/11 07:59:03 hristov |
37 | Copyright, Index corrected | |
38 | Copyright, | |
b1ed2294 | 39 | Copyright, Revision 1.4 2001/01/26 20:00:53 hristov |
40 | Copyright, Major upgrade of AliRoot code | |
41 | Copyright, | |
2ab0c725 | 42 | Copyright, Revision 1.3 2000/12/21 17:51:54 morsch |
43 | Copyright, RN3 violations corrected | |
44 | Copyright,, $Id$, comments at the right place for automatic documentation, | |
7c85b268 | 45 | in AliMUONRecoEvent and AliMUONRecoDisplay |
46 | ||
2c0075de | 47 | */ |
c7ba256d | 48 | |
2c0075de | 49 | //Authors: Mihaela Gheata, Andrei Gheata 09/10/00 |
50 | //////////////////////////////////////////////////////////////////// | |
51 | // // | |
52 | // AliMUONRecoEvent, AliMUONRecoTrack (and AliMUONRecoDisplay) // | |
53 | // // | |
54 | // Theses classes are used to store and retrieve // | |
55 | // MUON reconstructed events. // | |
56 | // The corresponding tree is constructed and filled // | |
57 | // during the FillEvent() method of AliMUONEventReconstructor, // | |
58 | // when all reconstruction information is available. // | |
59 | // // | |
60 | //////////////////////////////////////////////////////////////////// | |
61 | //////////////////////////////////////////////////////////////////// | |
62 | // // | |
63 | // AliMUONRecoEvent // | |
64 | // // | |
65 | // This class handles an array of reconstructed tracks. // | |
66 | // It provides : // | |
67 | // - filling the tracks array according to the information // | |
68 | // stored in AliMUONEventReconstructor class ; // | |
69 | // - printing event and track informations : event numer, // | |
70 | // number of tracks, hits positions, reconstr. mometum. // | |
71 | // // | |
72 | //////////////////////////////////////////////////////////////////// | |
c7ba256d | 73 | //////////////////////////////////////////////////////////////////// |
74 | // // | |
2c0075de | 75 | // AliMUONRecoTrack // |
c7ba256d | 76 | // // |
2c0075de | 77 | // This class represents a reconstructed muon track // |
78 | // in the tree of reconstructed events. // | |
c7ba256d | 79 | // // |
80 | //////////////////////////////////////////////////////////////////// | |
81 | ||
70479d0e | 82 | #include <Riostream.h> |
c7ba256d | 83 | #include <AliRun.h> |
84 | #include <TClonesArray.h> | |
2ab0c725 | 85 | #include <TClass.h> |
c7ba256d | 86 | #include "AliMUONRecoEvent.h" |
87 | #include "AliMUONTrack.h" | |
88 | #include "AliMUONTrackParam.h" | |
89 | #include "AliMUONHitForRec.h" | |
90 | #include "AliMUONTrackHit.h" | |
9e1a0ddb | 91 | #include "AliHeader.h" |
c7ba256d | 92 | |
93 | ClassImp(AliMUONRecoTrack) | |
94 | ClassImp(AliMUONRecoEvent) | |
95 | ||
96 | //------------------------------------------------------------------- | |
97 | AliMUONRecoEvent::AliMUONRecoEvent(Int_t eventNo) | |
98 | { | |
99 | // Reconstructed event constructor | |
100 | fTracks = new TClonesArray("AliMUONRecoTrack",200); | |
101 | fNevr = eventNo; | |
102 | fNtracks = 0; | |
103 | } | |
104 | ||
105 | //------------------------------------------------------------------- | |
106 | AliMUONRecoEvent::~AliMUONRecoEvent() | |
107 | { | |
108 | // Destructor of AliMUONRecoEvent | |
109 | fTracks->Delete(); | |
110 | delete fTracks; | |
111 | fTracks = 0; | |
112 | } | |
113 | ||
114 | //------------------------------------------------------------------- | |
115 | AliMUONRecoTrack* AliMUONRecoEvent::AddEmptyTrack() | |
116 | { | |
117 | // Add a empty AliMUONRecoTrackObject to the track list | |
118 | TClonesArray &dumptracks = *fTracks; | |
119 | return (new(dumptracks[fNtracks++])AliMUONRecoTrack(kTRUE)); | |
120 | } | |
121 | ||
122 | //------------------------------------------------------------------- | |
123 | void AliMUONRecoEvent::Clear(Option_t *option) | |
124 | { | |
125 | // Clears all track pointers from the list | |
126 | // fTracks->Clear(option); | |
127 | fTracks->Delete(); | |
128 | fNtracks=0; | |
129 | } | |
130 | ||
131 | //------------------------------------------------------------------- | |
132 | void AliMUONRecoEvent::EventInfo() | |
133 | { | |
134 | // Prints reconstructed event information | |
135 | cout << "*********************Reco Dumper**************************" << endl; | |
136 | cout << "Event number : " << fNevr << endl; | |
137 | cout << " Number of tracks : " << fNtracks << endl; | |
138 | AliMUONRecoTrack *currentTrack =0; | |
139 | Int_t trackIndex = 0; | |
140 | for(trackIndex=0; trackIndex<fNtracks; trackIndex++) { | |
141 | currentTrack = (AliMUONRecoTrack*)fTracks->UncheckedAt(trackIndex); | |
142 | cout << "Track : " << trackIndex << endl; | |
143 | cout << " Sign : " << currentTrack->GetSign() << endl; | |
144 | cout << " Vertex position : " << currentTrack->GetVertexPos() << endl; | |
145 | Double_t momreco[3]; | |
146 | for (Int_t axis=0; axis<3; axis++) { | |
147 | momreco[axis] = currentTrack->GetMomReconstr(axis); | |
148 | } | |
149 | cout << " Reconstructed mom. : " << "Px=" << momreco[0] << "Py=" << momreco[1] << "Pz=" << momreco[2] << endl; | |
150 | cout << " Chi squared : " << currentTrack->GetChi2r() << endl; | |
151 | cout << " Hits positions : " << endl; | |
152 | Double_t xhit, yhit, zhit; | |
153 | for (Int_t chamber=0; chamber<10; chamber++) { | |
154 | xhit = currentTrack->GetPosX(chamber); | |
155 | yhit = currentTrack->GetPosY(chamber); | |
156 | zhit = currentTrack->GetPosZ(chamber); | |
157 | // cout <<" chamber" << chamber << " X=" << xhit << " Y=" << yhit << " Z=" << zhit << endl; | |
158 | } | |
159 | } | |
160 | cout << "**********************************************************" << endl; | |
161 | } | |
162 | ||
163 | //------------------------------------------------------------------- | |
164 | Bool_t AliMUONRecoEvent::MakeDumpTracks(TClonesArray *tracksPtr) | |
165 | { | |
166 | // This method takes the pointer of the list of reconstructed tracks from | |
167 | // AliMUONEventReconstructor and fill the reconstructed AliMUONRecoEvent | |
168 | // fields. | |
169 | cout << "Enter MakeDumpTracks..." << endl; | |
170 | Int_t nTracks = tracksPtr->GetEntriesFast(); | |
171 | if (nTracks == 0) { | |
172 | cout << "AliMUONRecoEvent::MakeDumpTracks: Number of tracks is zero !" << endl; | |
173 | return kFALSE; | |
174 | } | |
175 | cout << tracksPtr << endl; | |
176 | if (!tracksPtr) { | |
177 | cout << "AliMUONRecoEvent::MakeDumpTracks() : You should call SetRecoTracksPtr() first..." << endl; | |
178 | return kFALSE; | |
179 | } | |
180 | // Get event number | |
7c85b268 | 181 | Int_t noEvent = gAlice->GetHeader()->GetEvent(); |
c7ba256d | 182 | tracksPtr->Compress(); // simple loop |
183 | AliMUONRecoTrack *currentTrack; | |
184 | Int_t trackIndex = 0, nTrackHits = 0; | |
185 | Double_t z,bendingSlope, nonBendingSlope, pYZ; | |
186 | Double_t pX, pY, pZ; // reconstructed momentum components | |
187 | Int_t isign; // charge sign | |
188 | AliMUONTrack *track = 0; | |
189 | AliMUONTrackParam *trackParam = 0; | |
190 | // Fill event number and number of tracks | |
7c85b268 | 191 | fNevr = noEvent; |
c7ba256d | 192 | // Loop over reconstructed tracks |
193 | for (trackIndex=0; trackIndex<nTracks; trackIndex++) { | |
194 | currentTrack = AddEmptyTrack(); | |
195 | track = (AliMUONTrack*) ((*tracksPtr)[trackIndex]); | |
196 | nTrackHits = track->GetNTrackHits(); | |
197 | trackParam = track->GetTrackParamAtVertex(); | |
198 | bendingSlope = trackParam->GetBendingSlope(); | |
199 | nonBendingSlope = trackParam->GetNonBendingSlope(); | |
200 | z = trackParam->GetZ(); | |
201 | pYZ = 1/TMath::Abs(trackParam->GetInverseBendingMomentum()); | |
202 | pZ = pYZ/TMath::Sqrt(1+bendingSlope*bendingSlope); | |
203 | pX = pZ * nonBendingSlope; | |
204 | pY = pZ * bendingSlope; | |
205 | if (trackParam->GetInverseBendingMomentum()<0) isign=-1; else isign=1; | |
206 | currentTrack->SetVertexPos(z); | |
207 | currentTrack->SetMomReconstr(pX,pY,pZ); | |
208 | currentTrack->SetSign(isign); | |
209 | // currentTrack->SetChi2r(trackParam->GetChi2()); | |
210 | currentTrack->SetChi2r(0); | |
211 | AliMUONTrackHit *trackHit; | |
212 | Double_t xhit,yhit,zhit; | |
213 | // Loop over track hits | |
214 | for (Int_t trackHitIndex = 0; trackHitIndex < nTrackHits; trackHitIndex++) { | |
215 | trackHit = (AliMUONTrackHit*) (*(track->GetTrackHitsPtr()))[trackHitIndex]; | |
216 | xhit = trackHit->GetHitForRecPtr()->GetNonBendingCoor(); | |
217 | yhit = trackHit->GetHitForRecPtr()->GetBendingCoor(); | |
218 | zhit = trackHit->GetHitForRecPtr()->GetZ(); | |
219 | if (trackHitIndex >= 0 && trackHitIndex < 10) { | |
220 | currentTrack->SetHitPosition(trackHitIndex,xhit,yhit,zhit); | |
221 | } else { cout << "track " << trackIndex << " hit out of range" << endl;} | |
222 | } | |
223 | } | |
224 | cout << "Leave MakeDumpTracks..." << endl; | |
225 | return kTRUE; | |
226 | } | |
227 | ||
228 | //------------------------------------------------------------------- | |
229 | void AliMUONRecoEvent::Streamer(TBuffer &R__b) | |
230 | { | |
231 | // Streams an object of class AliMUONRecoEvent | |
232 | if (R__b.IsReading()) { | |
c7ba256d | 233 | fTracks->Clear(); |
2ab0c725 | 234 | AliMUONRecoEvent::Class()->ReadBuffer(R__b, this); |
c7ba256d | 235 | } else { |
236 | cout << "...writing event to file...\n"; | |
2ab0c725 | 237 | AliMUONRecoEvent::Class()->WriteBuffer(R__b, this); |
c7ba256d | 238 | } |
239 | } | |
240 | ||
241 | //------------------------------------------------------------------- | |
242 | AliMUONRecoTrack::AliMUONRecoTrack(Bool_t active) | |
243 | { | |
244 | //Constructor of AliMUONRecoTrack | |
245 | fSign = 0; | |
246 | fZvr = 0.0; | |
247 | fChi2r = 0.0; | |
248 | if (active) { | |
249 | for (Int_t axis=0; axis<3; axis++) { | |
250 | fPr[axis] = 0.0; | |
251 | } | |
252 | for (Int_t chamber=0; chamber<10; chamber++) { | |
253 | fPosX[chamber] = 0.0; | |
254 | fPosY[chamber] = 0.0; | |
255 | fPosZ[chamber] = 0.0; | |
256 | } | |
257 | } | |
258 | } | |
259 | ||
260 | //------------------------------------------------------------------- | |
261 | const Double_t AliMUONRecoTrack::Phi() | |
262 | { | |
263 | // Return trach phi angle | |
264 | return TMath::ATan2(fPr[2], fPr[1]); | |
265 | } | |
266 | ||
267 | //------------------------------------------------------------------- | |
268 | const Double_t AliMUONRecoTrack::Theta() | |
269 | { | |
270 | // Return trach theta angle | |
b1ed2294 | 271 | return TMath::ACos(fPr[2] / P()); |
c7ba256d | 272 | } |
273 | ||
274 | //------------------------------------------------------------------- | |
275 | void AliMUONRecoTrack::SetMomReconstr(Double_t px, Double_t py, Double_t pz) | |
276 | { | |
277 | // Set the track reconstructed momentum | |
278 | fPr[0] = px; | |
279 | fPr[1] = py; | |
280 | fPr[2] = pz; | |
281 | } | |
282 | ||
283 | //------------------------------------------------------------------- | |
284 | void AliMUONRecoTrack::SetHitPosition(Int_t chamber, Double_t x, Double_t y, Double_t z) | |
285 | { | |
286 | // Set hit coordinates in chamber[0..9] | |
287 | fPosX[chamber] = x; | |
288 | fPosY[chamber] = y; | |
289 | fPosZ[chamber] = z; | |
290 | } | |
291 | //------------------------------------------------------------------- | |
292 | void AliMUONRecoTrack::TrackInfo() | |
293 | { | |
294 | // Prints momentum info for this track | |
295 | cout << "Px=" << GetMomReconstr(0) << " Py=" << GetMomReconstr(1) << | |
296 | " Pz=" << GetMomReconstr(2) << " P=" << P() << endl; | |
297 | } |