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