]>
Commit | Line | Data |
---|---|---|
196471e9 | 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 | ||
ea94c18b | 16 | /* $Id$ */ |
17 | ||
ee8a8d65 | 18 | //----------------------------------------------------------------------------- |
27bf410b | 19 | /// \class AliMUONTracker |
e64fdf8a | 20 | /// |
21 | /// Steering class for use in global tracking framework; | |
27bf410b | 22 | /// reconstruct tracks from recpoints |
23 | /// | |
e64fdf8a | 24 | /// Actual tracking is performed by some AliMUONVTrackReconstructor children |
25 | /// | |
26 | /// \author Christian Finck and Laurent Aphecetche, SUBATECH Nantes | |
ee8a8d65 | 27 | //----------------------------------------------------------------------------- |
196471e9 | 28 | |
29 | #include "AliMUONTracker.h" | |
e64fdf8a | 30 | |
e64fdf8a | 31 | #include "AliMUONTrack.h" |
32 | #include "AliMUONTrackExtrap.h" | |
33 | #include "AliMUONTrackHitPattern.h" | |
34 | #include "AliMUONTrackParam.h" | |
196471e9 | 35 | #include "AliMUONTrackReconstructor.h" |
e64fdf8a | 36 | #include "AliMUONTrackReconstructorK.h" |
37 | #include "AliMUONTrackStoreV1.h" | |
8c0b5e70 | 38 | #include "AliMUONTriggerChamberEff.h" |
e64fdf8a | 39 | #include "AliMUONTriggerTrackStoreV1.h" |
40 | #include "AliMUONVClusterStore.h" | |
41 | #include "AliMUONVTriggerStore.h" | |
ea94c18b | 42 | |
af885e0f | 43 | #include "AliESDEvent.h" |
ea94c18b | 44 | #include "AliESDMuonTrack.h" |
45 | #include "AliESDVertex.h" | |
46 | #include "AliLoader.h" | |
47 | #include "AliLog.h" | |
48 | ||
e64fdf8a | 49 | #include <Riostream.h> |
50 | #include <TTree.h> | |
196471e9 | 51 | |
ee8a8d65 | 52 | /// \cond CLASSIMP |
53 | ClassImp(AliMUONTracker) | |
54 | /// \endcond | |
55 | ||
56 | ||
196471e9 | 57 | //_____________________________________________________________________________ |
e64fdf8a | 58 | AliMUONTracker::AliMUONTracker(AliLoader* loader, |
59 | const AliMUONDigitMaker* digitMaker, | |
60 | const AliMUONGeometryTransformer* transformer, | |
8c0b5e70 | 61 | const AliMUONTriggerCircuit* triggerCircuit, |
62 | AliMUONTriggerChamberEff* chamberEff) | |
e64fdf8a | 63 | : AliTracker(), |
64 | fLoader(loader), | |
65 | fDigitMaker(digitMaker), // not owner | |
66 | fTransformer(transformer), // not owner | |
67 | fTriggerCircuit(triggerCircuit), // not owner | |
8c0b5e70 | 68 | fTrigChamberEff(chamberEff), // not owner |
e64fdf8a | 69 | fTrackHitPatternMaker(0x0), |
70 | fTrackReco(0x0), | |
71 | fClusterStore(0x0), | |
72 | fTriggerStore(0x0) | |
196471e9 | 73 | { |
74 | /// constructor | |
e64fdf8a | 75 | if (fTransformer && fDigitMaker) |
76 | { | |
77 | fTrackHitPatternMaker = new AliMUONTrackHitPattern(*fTransformer,*fDigitMaker); | |
78 | } | |
196471e9 | 79 | } |
e64fdf8a | 80 | |
196471e9 | 81 | //_____________________________________________________________________________ |
82 | AliMUONTracker::~AliMUONTracker() | |
83 | { | |
e64fdf8a | 84 | /// dtor |
196471e9 | 85 | delete fTrackReco; |
e64fdf8a | 86 | delete fTrackHitPatternMaker; |
87 | delete fClusterStore; | |
88 | delete fTriggerStore; | |
196471e9 | 89 | } |
90 | ||
91 | //_____________________________________________________________________________ | |
e64fdf8a | 92 | Int_t |
93 | AliMUONTracker::LoadClusters(TTree* clustersTree) | |
196471e9 | 94 | { |
e64fdf8a | 95 | /// Load clusterStore and triggerStore from clustersTree |
96 | delete fClusterStore; | |
97 | delete fTriggerStore; | |
196471e9 | 98 | |
e64fdf8a | 99 | fClusterStore = AliMUONVClusterStore::Create(*clustersTree); |
100 | fTriggerStore = AliMUONVTriggerStore::Create(*clustersTree); | |
101 | ||
102 | if (!fClusterStore) | |
103 | { | |
104 | AliError("Could not get clusterStore"); | |
105 | return 1; | |
106 | } | |
107 | if (!fTriggerStore) | |
108 | { | |
109 | AliError("Could not get triggerStore"); | |
110 | return 2; | |
111 | } | |
112 | ||
113 | fClusterStore->Connect(*clustersTree,kFALSE); | |
114 | fTriggerStore->Connect(*clustersTree,kFALSE); | |
115 | ||
116 | clustersTree->GetEvent(0); | |
196471e9 | 117 | |
e64fdf8a | 118 | return 0; |
119 | } | |
196471e9 | 120 | |
e64fdf8a | 121 | //_____________________________________________________________________________ |
122 | Int_t | |
af885e0f | 123 | AliMUONTracker::Clusters2Tracks(AliESDEvent* esd) |
e64fdf8a | 124 | { |
125 | /// Performs the tracking and store the resulting tracks in both | |
126 | /// the TreeT and the ESD | |
127 | ||
128 | Int_t rv(0); | |
129 | ||
130 | TTree* tracksTree = fLoader->TreeT(); | |
131 | ||
132 | if (!tracksTree) | |
133 | { | |
134 | AliError("Cannot get TreeT"); | |
135 | rv=1; | |
136 | } | |
137 | if (!fClusterStore) | |
138 | { | |
139 | AliError("ClusterStore is NULL"); | |
140 | rv=2; | |
141 | } | |
142 | if (!fTriggerStore) | |
143 | { | |
144 | AliError("TriggerStore is NULL"); | |
145 | rv=3; | |
146 | } | |
147 | if (!rv) | |
148 | { | |
149 | rv = Clusters2Tracks(*tracksTree,esd); | |
150 | } | |
151 | return rv; | |
152 | } | |
196471e9 | 153 | |
e64fdf8a | 154 | //_____________________________________________________________________________ |
af885e0f | 155 | Int_t AliMUONTracker::Clusters2Tracks(TTree& tracksTree, AliESDEvent* esd) |
e64fdf8a | 156 | { |
157 | /// Performs the tracking | |
158 | ||
159 | AliDebug(1,""); | |
160 | ||
161 | AliMUONVTrackStore* trackStore(0x0); | |
162 | AliMUONVTriggerTrackStore* triggerTrackStore(0x0); | |
163 | ||
164 | // Make tracker tracks | |
165 | if ( fClusterStore ) | |
166 | { | |
167 | trackStore = new AliMUONTrackStoreV1; | |
168 | Bool_t alone = ( ( fTriggerStore && fTriggerCircuit ) ? kFALSE : kTRUE ); | |
169 | trackStore->Connect(tracksTree,alone); | |
170 | fTrackReco->EventReconstruct(*fClusterStore,*trackStore); | |
171 | } | |
172 | ||
173 | if ( fTriggerStore && fTriggerCircuit ) | |
174 | { | |
175 | // Make trigger tracks | |
176 | triggerTrackStore = new AliMUONTriggerTrackStoreV1; | |
177 | Bool_t alone = ( fClusterStore ? kFALSE : kTRUE ); | |
178 | triggerTrackStore->Connect(tracksTree,alone); | |
179 | fTrackReco->EventReconstructTrigger(*fTriggerCircuit,*fTriggerStore,*triggerTrackStore); | |
180 | } | |
181 | ||
182 | if ( trackStore && triggerTrackStore && fTriggerStore && fTrackHitPatternMaker ) | |
183 | { | |
184 | fTrackReco->ValidateTracksWithTrigger(*trackStore,*triggerTrackStore,*fTriggerStore,*fTrackHitPatternMaker); | |
185 | } | |
186 | ||
187 | // Fills output TreeT | |
188 | tracksTree.Fill(); | |
189 | ||
8c0b5e70 | 190 | if( trackStore && triggerTrackStore && fTriggerStore && fTrigChamberEff){ |
191 | fTrigChamberEff->EventChamberEff(*fTriggerStore,*triggerTrackStore,*trackStore); | |
8c0b5e70 | 192 | } |
193 | ||
e64fdf8a | 194 | FillESD(*trackStore,esd); |
195 | ||
196 | // cleanup | |
197 | delete trackStore; | |
198 | delete triggerTrackStore; | |
199 | ||
200 | return 0; | |
201 | } | |
196471e9 | 202 | |
e64fdf8a | 203 | //_____________________________________________________________________________ |
204 | void | |
af885e0f | 205 | AliMUONTracker::FillESD(AliMUONVTrackStore& trackStore, AliESDEvent* esd) const |
e64fdf8a | 206 | { |
207 | /// Fill the ESD from the trackStore | |
208 | ||
209 | AliDebug(1,""); | |
210 | ||
211 | // Get vertex | |
212 | Double_t vertex[3] = {0}; | |
213 | const AliESDVertex* esdVert = esd->GetVertex(); | |
214 | if (esdVert->GetNContributors()) | |
215 | { | |
216 | esdVert->GetXYZ(vertex); | |
217 | AliDebug(1,Form("found vertex (%e,%e,%e)",vertex[0],vertex[1],vertex[2])); | |
218 | } | |
219 | ||
220 | // setting ESD MUON class | |
221 | AliESDMuonTrack esdTrack; | |
222 | ||
223 | AliMUONTrack* track; | |
224 | TIter next(trackStore.CreateIterator()); | |
225 | ||
226 | while ( ( track = static_cast<AliMUONTrack*>(next()) ) ) | |
227 | { | |
228 | AliMUONTrackParam* trackParam = static_cast<AliMUONTrackParam*>((track->GetTrackParamAtHit())->First()); | |
229 | AliMUONTrackParam trackParamAtVtx(*trackParam); | |
230 | ||
231 | /// Extrapolate to vertex (which is set to (0,0,0) if not available, see above) | |
232 | AliMUONTrackExtrap::ExtrapToVertex(&trackParamAtVtx, vertex[0],vertex[1],vertex[2]); | |
233 | ||
234 | // setting data member of ESD MUON | |
235 | ||
236 | // at first station | |
237 | esdTrack.SetInverseBendingMomentumUncorrected(trackParam->GetInverseBendingMomentum()); | |
238 | esdTrack.SetThetaXUncorrected(TMath::ATan(trackParam->GetNonBendingSlope())); | |
239 | esdTrack.SetThetaYUncorrected(TMath::ATan(trackParam->GetBendingSlope())); | |
240 | esdTrack.SetZUncorrected(trackParam->GetZ()); | |
241 | esdTrack.SetBendingCoorUncorrected(trackParam->GetBendingCoor()); | |
242 | esdTrack.SetNonBendingCoorUncorrected(trackParam->GetNonBendingCoor()); | |
243 | // at vertex | |
244 | esdTrack.SetInverseBendingMomentum(trackParamAtVtx.GetInverseBendingMomentum()); | |
245 | esdTrack.SetThetaX(TMath::ATan(trackParamAtVtx.GetNonBendingSlope())); | |
246 | esdTrack.SetThetaY(TMath::ATan(trackParamAtVtx.GetBendingSlope())); | |
247 | esdTrack.SetZ(trackParamAtVtx.GetZ()); | |
248 | esdTrack.SetBendingCoor(trackParamAtVtx.GetBendingCoor()); | |
249 | esdTrack.SetNonBendingCoor(trackParamAtVtx.GetNonBendingCoor()); | |
250 | // global info | |
251 | esdTrack.SetChi2(track->GetFitFMin()); | |
252 | esdTrack.SetNHit(track->GetNTrackHits()); | |
253 | esdTrack.SetLocalTrigger(track->GetLocalTrigger()); | |
254 | esdTrack.SetChi2MatchTrigger(track->GetChi2MatchTrigger()); | |
255 | esdTrack.SetHitsPatternInTrigCh(track->GetHitsPatternInTrigCh()); | |
256 | ||
257 | // storing ESD MUON Track into ESD Event | |
258 | esd->AddMuonTrack(&esdTrack); | |
259 | } // end of loop on tracks | |
196471e9 | 260 | } |
261 | ||
262 | //_____________________________________________________________________________ | |
e64fdf8a | 263 | void AliMUONTracker::SetOption(Option_t* option) |
196471e9 | 264 | { |
e64fdf8a | 265 | /// set reconstructor class |
266 | ||
267 | if (strstr(option,"Original")) | |
268 | { | |
269 | fTrackReco = new AliMUONTrackReconstructor; | |
270 | } | |
e64fdf8a | 271 | else |
272 | { | |
ea94c18b | 273 | fTrackReco = new AliMUONTrackReconstructorK(); |
e64fdf8a | 274 | } |
275 | } | |
196471e9 | 276 | |
e64fdf8a | 277 | //_____________________________________________________________________________ |
278 | void | |
279 | AliMUONTracker::UnloadClusters() | |
280 | { | |
281 | /// Delete internal clusterStore | |
282 | delete fClusterStore; | |
283 | fClusterStore = 0x0; | |
196471e9 | 284 | } |
e64fdf8a | 285 |