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