]>
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 | |
3304fa09 | 31 | #include "AliMUONReconstructor.h" |
32 | #include "AliMUONRecoParam.h" | |
e64fdf8a | 33 | #include "AliMUONTrack.h" |
34 | #include "AliMUONTrackExtrap.h" | |
35 | #include "AliMUONTrackHitPattern.h" | |
36 | #include "AliMUONTrackParam.h" | |
60765b06 | 37 | #include "AliMUONHitForRec.h" |
196471e9 | 38 | #include "AliMUONTrackReconstructor.h" |
e64fdf8a | 39 | #include "AliMUONTrackReconstructorK.h" |
40 | #include "AliMUONTrackStoreV1.h" | |
8c0b5e70 | 41 | #include "AliMUONTriggerChamberEff.h" |
e64fdf8a | 42 | #include "AliMUONTriggerTrackStoreV1.h" |
43 | #include "AliMUONVClusterStore.h" | |
44 | #include "AliMUONVTriggerStore.h" | |
ea94c18b | 45 | |
af885e0f | 46 | #include "AliESDEvent.h" |
ea94c18b | 47 | #include "AliESDMuonTrack.h" |
48 | #include "AliESDVertex.h" | |
ea94c18b | 49 | #include "AliLog.h" |
2060b217 | 50 | #include "AliCodeTimer.h" |
ea94c18b | 51 | |
e64fdf8a | 52 | #include <Riostream.h> |
53 | #include <TTree.h> | |
196471e9 | 54 | |
ee8a8d65 | 55 | /// \cond CLASSIMP |
56 | ClassImp(AliMUONTracker) | |
57 | /// \endcond | |
58 | ||
59 | ||
196471e9 | 60 | //_____________________________________________________________________________ |
d76c31f4 | 61 | AliMUONTracker::AliMUONTracker(const AliMUONDigitMaker* digitMaker, |
e64fdf8a | 62 | const AliMUONGeometryTransformer* transformer, |
8c0b5e70 | 63 | const AliMUONTriggerCircuit* triggerCircuit, |
6cfc11c3 | 64 | AliMUONTriggerChamberEff* chamberEff) |
e64fdf8a | 65 | : AliTracker(), |
e64fdf8a | 66 | fDigitMaker(digitMaker), // not owner |
67 | fTransformer(transformer), // not owner | |
68 | fTriggerCircuit(triggerCircuit), // not owner | |
8c0b5e70 | 69 | fTrigChamberEff(chamberEff), // not owner |
e64fdf8a | 70 | fTrackHitPatternMaker(0x0), |
71 | fTrackReco(0x0), | |
72 | fClusterStore(0x0), | |
73 | fTriggerStore(0x0) | |
196471e9 | 74 | { |
75 | /// constructor | |
e64fdf8a | 76 | if (fTransformer && fDigitMaker) |
e64fdf8a | 77 | fTrackHitPatternMaker = new AliMUONTrackHitPattern(*fTransformer,*fDigitMaker); |
196471e9 | 78 | } |
e64fdf8a | 79 | |
196471e9 | 80 | //_____________________________________________________________________________ |
81 | AliMUONTracker::~AliMUONTracker() | |
82 | { | |
e64fdf8a | 83 | /// dtor |
196471e9 | 84 | delete fTrackReco; |
e64fdf8a | 85 | delete fTrackHitPatternMaker; |
86 | delete fClusterStore; | |
87 | delete fTriggerStore; | |
196471e9 | 88 | } |
89 | ||
90 | //_____________________________________________________________________________ | |
3304fa09 | 91 | Int_t AliMUONTracker::LoadClusters(TTree* clustersTree) |
196471e9 | 92 | { |
e64fdf8a | 93 | /// Load clusterStore and triggerStore from clustersTree |
94 | delete fClusterStore; | |
95 | delete fTriggerStore; | |
196471e9 | 96 | |
6cfc11c3 | 97 | if ( ! clustersTree ) { |
98 | AliFatal("No clustersTree"); | |
99 | return 1; | |
100 | } | |
101 | ||
e64fdf8a | 102 | fClusterStore = AliMUONVClusterStore::Create(*clustersTree); |
103 | fTriggerStore = AliMUONVTriggerStore::Create(*clustersTree); | |
104 | ||
105 | if (!fClusterStore) | |
106 | { | |
107 | AliError("Could not get clusterStore"); | |
108 | return 1; | |
109 | } | |
110 | if (!fTriggerStore) | |
111 | { | |
112 | AliError("Could not get triggerStore"); | |
113 | return 2; | |
114 | } | |
115 | ||
116 | fClusterStore->Connect(*clustersTree,kFALSE); | |
117 | fTriggerStore->Connect(*clustersTree,kFALSE); | |
118 | ||
119 | clustersTree->GetEvent(0); | |
196471e9 | 120 | |
e64fdf8a | 121 | return 0; |
122 | } | |
196471e9 | 123 | |
e64fdf8a | 124 | //_____________________________________________________________________________ |
3304fa09 | 125 | Int_t AliMUONTracker::Clusters2Tracks(AliESDEvent* esd) |
e64fdf8a | 126 | { |
3304fa09 | 127 | /// Performs the tracking and store the resulting tracks in the ESD |
128 | AliDebug(1,""); | |
129 | AliCodeTimerAuto("") | |
e64fdf8a | 130 | |
3304fa09 | 131 | if (!fTrackReco) CreateTrackReconstructor(); |
132 | ||
133 | // if the required tracking mode does not exist | |
134 | if (!fTrackReco) return 1; | |
135 | ||
136 | if (!fClusterStore) { | |
e64fdf8a | 137 | AliError("ClusterStore is NULL"); |
6cfc11c3 | 138 | return 2; |
e64fdf8a | 139 | } |
6cfc11c3 | 140 | |
3304fa09 | 141 | if (!fTriggerStore) { |
e64fdf8a | 142 | AliError("TriggerStore is NULL"); |
6cfc11c3 | 143 | return 3; |
e64fdf8a | 144 | } |
e64fdf8a | 145 | |
e64fdf8a | 146 | // Make tracker tracks |
3304fa09 | 147 | AliMUONVTrackStore* trackStore = new AliMUONTrackStoreV1; |
148 | fTrackReco->EventReconstruct(*fClusterStore,*trackStore); | |
e64fdf8a | 149 | |
3304fa09 | 150 | // Make trigger tracks |
151 | AliMUONVTriggerTrackStore* triggerTrackStore(0x0); | |
152 | if ( fTriggerCircuit ) { | |
e64fdf8a | 153 | triggerTrackStore = new AliMUONTriggerTrackStoreV1; |
e64fdf8a | 154 | fTrackReco->EventReconstructTrigger(*fTriggerCircuit,*fTriggerStore,*triggerTrackStore); |
155 | } | |
156 | ||
3304fa09 | 157 | // Match tracker/trigger tracks |
158 | if ( triggerTrackStore && fTrackHitPatternMaker ) { | |
e64fdf8a | 159 | fTrackReco->ValidateTracksWithTrigger(*trackStore,*triggerTrackStore,*fTriggerStore,*fTrackHitPatternMaker); |
160 | } | |
161 | ||
3304fa09 | 162 | // Compute trigger chamber efficiency |
163 | if( triggerTrackStore && fTrigChamberEff){ | |
2060b217 | 164 | AliCodeTimerStart("EventChamberEff"); |
8c0b5e70 | 165 | fTrigChamberEff->EventChamberEff(*fTriggerStore,*triggerTrackStore,*trackStore); |
2060b217 | 166 | AliCodeTimerStop("EventChamberEff"); |
8c0b5e70 | 167 | } |
3304fa09 | 168 | |
169 | // Fill ESD | |
e64fdf8a | 170 | FillESD(*trackStore,esd); |
171 | ||
172 | // cleanup | |
173 | delete trackStore; | |
174 | delete triggerTrackStore; | |
175 | ||
176 | return 0; | |
177 | } | |
196471e9 | 178 | |
e64fdf8a | 179 | //_____________________________________________________________________________ |
3304fa09 | 180 | void AliMUONTracker::FillESD(AliMUONVTrackStore& trackStore, AliESDEvent* esd) const |
e64fdf8a | 181 | { |
182 | /// Fill the ESD from the trackStore | |
e64fdf8a | 183 | AliDebug(1,""); |
2060b217 | 184 | AliCodeTimerAuto("") |
e64fdf8a | 185 | |
186 | // Get vertex | |
187 | Double_t vertex[3] = {0}; | |
188 | const AliESDVertex* esdVert = esd->GetVertex(); | |
189 | if (esdVert->GetNContributors()) | |
190 | { | |
191 | esdVert->GetXYZ(vertex); | |
192 | AliDebug(1,Form("found vertex (%e,%e,%e)",vertex[0],vertex[1],vertex[2])); | |
193 | } | |
194 | ||
195 | // setting ESD MUON class | |
196 | AliESDMuonTrack esdTrack; | |
197 | ||
198 | AliMUONTrack* track; | |
199 | TIter next(trackStore.CreateIterator()); | |
200 | ||
201 | while ( ( track = static_cast<AliMUONTrack*>(next()) ) ) | |
202 | { | |
203 | AliMUONTrackParam* trackParam = static_cast<AliMUONTrackParam*>((track->GetTrackParamAtHit())->First()); | |
204 | AliMUONTrackParam trackParamAtVtx(*trackParam); | |
205 | ||
206 | /// Extrapolate to vertex (which is set to (0,0,0) if not available, see above) | |
207 | AliMUONTrackExtrap::ExtrapToVertex(&trackParamAtVtx, vertex[0],vertex[1],vertex[2]); | |
208 | ||
209 | // setting data member of ESD MUON | |
210 | ||
211 | // at first station | |
60765b06 | 212 | trackParam->SetParamForUncorrected(esdTrack); |
213 | trackParam->SetCovFor(esdTrack); | |
e64fdf8a | 214 | // at vertex |
60765b06 | 215 | trackParamAtVtx.SetParamFor(esdTrack); |
e64fdf8a | 216 | // global info |
217 | esdTrack.SetChi2(track->GetFitFMin()); | |
218 | esdTrack.SetNHit(track->GetNTrackHits()); | |
219 | esdTrack.SetLocalTrigger(track->GetLocalTrigger()); | |
220 | esdTrack.SetChi2MatchTrigger(track->GetChi2MatchTrigger()); | |
221 | esdTrack.SetHitsPatternInTrigCh(track->GetHitsPatternInTrigCh()); | |
60765b06 | 222 | // muon cluster map |
223 | AliMUONHitForRec* cluster = static_cast<AliMUONHitForRec*>((track->GetHitForRecAtHit())->First()); | |
224 | while (cluster) { | |
225 | esdTrack.AddInMuonClusterMap(cluster->GetChamberNumber()); | |
226 | cluster = static_cast<AliMUONHitForRec*>((track->GetHitForRecAtHit())->After(cluster)); | |
227 | } | |
e64fdf8a | 228 | |
229 | // storing ESD MUON Track into ESD Event | |
230 | esd->AddMuonTrack(&esdTrack); | |
231 | } // end of loop on tracks | |
196471e9 | 232 | } |
233 | ||
234 | //_____________________________________________________________________________ | |
3304fa09 | 235 | void AliMUONTracker::CreateTrackReconstructor() |
196471e9 | 236 | { |
3304fa09 | 237 | /// Create track reconstructor, depending on tracking mode set in RecoParam |
238 | ||
239 | TString opt(AliMUONReconstructor::GetRecoParam()->GetTrackingMode()); | |
240 | opt.ToUpper(); | |
e64fdf8a | 241 | |
3304fa09 | 242 | if (strstr(opt,"ORIGINAL")) |
e64fdf8a | 243 | { |
3304fa09 | 244 | fTrackReco = new AliMUONTrackReconstructor(); |
e64fdf8a | 245 | } |
3304fa09 | 246 | else if (strstr(opt,"KALMAN")) |
e64fdf8a | 247 | { |
ea94c18b | 248 | fTrackReco = new AliMUONTrackReconstructorK(); |
e64fdf8a | 249 | } |
3304fa09 | 250 | else |
251 | { | |
252 | AliError(Form("tracking mode \"%s\" does not exist",opt.Data())); | |
253 | return; | |
254 | } | |
255 | ||
256 | AliInfo(Form("Will use %s for tracking",fTrackReco->ClassName())); | |
e64fdf8a | 257 | } |
196471e9 | 258 | |
e64fdf8a | 259 | //_____________________________________________________________________________ |
3304fa09 | 260 | void AliMUONTracker::UnloadClusters() |
e64fdf8a | 261 | { |
262 | /// Delete internal clusterStore | |
263 | delete fClusterStore; | |
264 | fClusterStore = 0x0; | |
196471e9 | 265 | } |
e64fdf8a | 266 |