]>
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 |
96ebe67e | 25 | /// Tracking modes (ORIGINAL, KALMAN) and associated options and parameters |
26 | /// can be changed by using: | |
27 | /// AliMUONRecoParam *muonRecoParam = AliMUONRecoParam::GetLow(High)FluxParam(); | |
28 | /// muonRecoParam->Set...(); // see methods in AliMUONRecoParam.h for details | |
29 | /// AliMUONReconstructor::SetRecoParam(muonRecoParam); | |
e64fdf8a | 30 | /// |
31 | /// \author Christian Finck and Laurent Aphecetche, SUBATECH Nantes | |
ee8a8d65 | 32 | //----------------------------------------------------------------------------- |
196471e9 | 33 | |
34 | #include "AliMUONTracker.h" | |
e64fdf8a | 35 | |
3304fa09 | 36 | #include "AliMUONReconstructor.h" |
37 | #include "AliMUONRecoParam.h" | |
e64fdf8a | 38 | #include "AliMUONTrack.h" |
39 | #include "AliMUONTrackExtrap.h" | |
40 | #include "AliMUONTrackHitPattern.h" | |
41 | #include "AliMUONTrackParam.h" | |
96ebe67e | 42 | #include "AliMUONVCluster.h" |
1fef78c8 | 43 | #include "AliMUONVClusterServer.h" |
196471e9 | 44 | #include "AliMUONTrackReconstructor.h" |
e64fdf8a | 45 | #include "AliMUONTrackReconstructorK.h" |
46 | #include "AliMUONTrackStoreV1.h" | |
8c0b5e70 | 47 | #include "AliMUONTriggerChamberEff.h" |
e64fdf8a | 48 | #include "AliMUONTriggerTrackStoreV1.h" |
1fef78c8 | 49 | #include "AliMUONClusterStoreV2.h" |
e64fdf8a | 50 | #include "AliMUONVTriggerStore.h" |
ea94c18b | 51 | |
af885e0f | 52 | #include "AliESDEvent.h" |
ea94c18b | 53 | #include "AliESDMuonTrack.h" |
61fed964 | 54 | #include "AliESDMuonCluster.h" |
ea94c18b | 55 | #include "AliESDVertex.h" |
ea94c18b | 56 | #include "AliLog.h" |
2060b217 | 57 | #include "AliCodeTimer.h" |
ea94c18b | 58 | |
e64fdf8a | 59 | #include <Riostream.h> |
60 | #include <TTree.h> | |
196471e9 | 61 | |
ee8a8d65 | 62 | /// \cond CLASSIMP |
63 | ClassImp(AliMUONTracker) | |
64 | /// \endcond | |
65 | ||
66 | ||
196471e9 | 67 | //_____________________________________________________________________________ |
1fef78c8 | 68 | AliMUONTracker::AliMUONTracker(AliMUONVClusterServer& clusterServer, |
69 | const AliMUONDigitMaker* digitMaker, | |
e64fdf8a | 70 | const AliMUONGeometryTransformer* transformer, |
8c0b5e70 | 71 | const AliMUONTriggerCircuit* triggerCircuit, |
6cfc11c3 | 72 | AliMUONTriggerChamberEff* chamberEff) |
e64fdf8a | 73 | : AliTracker(), |
e64fdf8a | 74 | fDigitMaker(digitMaker), // not owner |
75 | fTransformer(transformer), // not owner | |
76 | fTriggerCircuit(triggerCircuit), // not owner | |
8c0b5e70 | 77 | fTrigChamberEff(chamberEff), // not owner |
e64fdf8a | 78 | fTrackHitPatternMaker(0x0), |
79 | fTrackReco(0x0), | |
80 | fClusterStore(0x0), | |
1fef78c8 | 81 | fTriggerStore(0x0), |
82 | fClusterServer(clusterServer) | |
196471e9 | 83 | { |
84 | /// constructor | |
e64fdf8a | 85 | if (fTransformer && fDigitMaker) |
e64fdf8a | 86 | fTrackHitPatternMaker = new AliMUONTrackHitPattern(*fTransformer,*fDigitMaker); |
196471e9 | 87 | } |
e64fdf8a | 88 | |
196471e9 | 89 | //_____________________________________________________________________________ |
90 | AliMUONTracker::~AliMUONTracker() | |
91 | { | |
e64fdf8a | 92 | /// dtor |
196471e9 | 93 | delete fTrackReco; |
e64fdf8a | 94 | delete fTrackHitPatternMaker; |
95 | delete fClusterStore; | |
96 | delete fTriggerStore; | |
196471e9 | 97 | } |
98 | ||
1fef78c8 | 99 | //_____________________________________________________________________________ |
100 | AliMUONVClusterStore* | |
101 | AliMUONTracker::ClusterStore() const | |
102 | { | |
103 | /// Return (and create if necessary) the cluster container | |
104 | if (!fClusterStore) | |
105 | { | |
106 | fClusterStore = new AliMUONClusterStoreV2; | |
107 | } | |
108 | return fClusterStore; | |
109 | } | |
110 | ||
196471e9 | 111 | //_____________________________________________________________________________ |
3304fa09 | 112 | Int_t AliMUONTracker::LoadClusters(TTree* clustersTree) |
196471e9 | 113 | { |
1fef78c8 | 114 | /// Load triggerStore from clustersTree |
115 | ||
116 | ClusterStore()->Clear(); | |
117 | ||
e64fdf8a | 118 | delete fTriggerStore; |
196471e9 | 119 | |
6cfc11c3 | 120 | if ( ! clustersTree ) { |
121 | AliFatal("No clustersTree"); | |
122 | return 1; | |
123 | } | |
124 | ||
e64fdf8a | 125 | fTriggerStore = AliMUONVTriggerStore::Create(*clustersTree); |
126 | ||
e64fdf8a | 127 | if (!fTriggerStore) |
128 | { | |
129 | AliError("Could not get triggerStore"); | |
130 | return 2; | |
131 | } | |
132 | ||
1fef78c8 | 133 | ClusterStore()->Connect(*clustersTree,kFALSE); |
e64fdf8a | 134 | fTriggerStore->Connect(*clustersTree,kFALSE); |
135 | ||
136 | clustersTree->GetEvent(0); | |
196471e9 | 137 | |
e64fdf8a | 138 | return 0; |
139 | } | |
196471e9 | 140 | |
e64fdf8a | 141 | //_____________________________________________________________________________ |
3304fa09 | 142 | Int_t AliMUONTracker::Clusters2Tracks(AliESDEvent* esd) |
e64fdf8a | 143 | { |
3304fa09 | 144 | /// Performs the tracking and store the resulting tracks in the ESD |
145 | AliDebug(1,""); | |
146 | AliCodeTimerAuto("") | |
e64fdf8a | 147 | |
3304fa09 | 148 | if (!fTrackReco) CreateTrackReconstructor(); |
149 | ||
150 | // if the required tracking mode does not exist | |
151 | if (!fTrackReco) return 1; | |
152 | ||
1fef78c8 | 153 | if ( ! ClusterStore() ) |
154 | { | |
e64fdf8a | 155 | AliError("ClusterStore is NULL"); |
6cfc11c3 | 156 | return 2; |
e64fdf8a | 157 | } |
6cfc11c3 | 158 | |
3304fa09 | 159 | if (!fTriggerStore) { |
e64fdf8a | 160 | AliError("TriggerStore is NULL"); |
6cfc11c3 | 161 | return 3; |
e64fdf8a | 162 | } |
1fef78c8 | 163 | |
e64fdf8a | 164 | // Make tracker tracks |
3304fa09 | 165 | AliMUONVTrackStore* trackStore = new AliMUONTrackStoreV1; |
1fef78c8 | 166 | fTrackReco->EventReconstruct(*(ClusterStore()),*trackStore); |
e64fdf8a | 167 | |
3304fa09 | 168 | // Make trigger tracks |
169 | AliMUONVTriggerTrackStore* triggerTrackStore(0x0); | |
170 | if ( fTriggerCircuit ) { | |
e64fdf8a | 171 | triggerTrackStore = new AliMUONTriggerTrackStoreV1; |
e64fdf8a | 172 | fTrackReco->EventReconstructTrigger(*fTriggerCircuit,*fTriggerStore,*triggerTrackStore); |
173 | } | |
174 | ||
3304fa09 | 175 | // Match tracker/trigger tracks |
176 | if ( triggerTrackStore && fTrackHitPatternMaker ) { | |
e64fdf8a | 177 | fTrackReco->ValidateTracksWithTrigger(*trackStore,*triggerTrackStore,*fTriggerStore,*fTrackHitPatternMaker); |
178 | } | |
179 | ||
3304fa09 | 180 | // Compute trigger chamber efficiency |
181 | if( triggerTrackStore && fTrigChamberEff){ | |
2060b217 | 182 | AliCodeTimerStart("EventChamberEff"); |
8c0b5e70 | 183 | fTrigChamberEff->EventChamberEff(*fTriggerStore,*triggerTrackStore,*trackStore); |
2060b217 | 184 | AliCodeTimerStop("EventChamberEff"); |
8c0b5e70 | 185 | } |
3304fa09 | 186 | |
187 | // Fill ESD | |
e64fdf8a | 188 | FillESD(*trackStore,esd); |
189 | ||
190 | // cleanup | |
191 | delete trackStore; | |
192 | delete triggerTrackStore; | |
193 | ||
194 | return 0; | |
195 | } | |
196471e9 | 196 | |
e64fdf8a | 197 | //_____________________________________________________________________________ |
3304fa09 | 198 | void AliMUONTracker::FillESD(AliMUONVTrackStore& trackStore, AliESDEvent* esd) const |
e64fdf8a | 199 | { |
200 | /// Fill the ESD from the trackStore | |
e64fdf8a | 201 | AliDebug(1,""); |
2060b217 | 202 | AliCodeTimerAuto("") |
e64fdf8a | 203 | |
204 | // Get vertex | |
205 | Double_t vertex[3] = {0}; | |
690d2205 | 206 | Double_t errXVtx = 0., errYVtx = 0.; |
e64fdf8a | 207 | const AliESDVertex* esdVert = esd->GetVertex(); |
208 | if (esdVert->GetNContributors()) | |
209 | { | |
210 | esdVert->GetXYZ(vertex); | |
690d2205 | 211 | errXVtx = esdVert->GetXRes(); |
212 | errYVtx = esdVert->GetYRes(); | |
e64fdf8a | 213 | AliDebug(1,Form("found vertex (%e,%e,%e)",vertex[0],vertex[1],vertex[2])); |
214 | } | |
215 | ||
216 | // setting ESD MUON class | |
217 | AliESDMuonTrack esdTrack; | |
61fed964 | 218 | AliESDMuonCluster esdCluster; |
e64fdf8a | 219 | |
220 | AliMUONTrack* track; | |
61fed964 | 221 | AliMUONVCluster* cluster; |
e64fdf8a | 222 | TIter next(trackStore.CreateIterator()); |
223 | ||
224 | while ( ( track = static_cast<AliMUONTrack*>(next()) ) ) | |
225 | { | |
96ebe67e | 226 | AliMUONTrackParam* trackParam = static_cast<AliMUONTrackParam*>((track->GetTrackParamAtCluster())->First()); |
e64fdf8a | 227 | |
228 | /// Extrapolate to vertex (which is set to (0,0,0) if not available, see above) | |
61fed964 | 229 | AliMUONTrackParam trackParamAtVtx(*trackParam); |
230 | AliMUONTrackExtrap::ExtrapToVertex(&trackParamAtVtx, vertex[0], vertex[1], vertex[2], errXVtx, errYVtx); | |
231 | ||
232 | /// Extrapolate to vertex plan (which is set to z=0 if not available, see above) | |
233 | AliMUONTrackParam trackParamAtDCA(*trackParam); | |
234 | AliMUONTrackExtrap::ExtrapToVertexWithoutBranson(&trackParamAtDCA, vertex[2]); | |
e64fdf8a | 235 | |
236 | // setting data member of ESD MUON | |
61fed964 | 237 | esdTrack.Clear("C"); // remove already attached clusters |
238 | esdTrack.SetMuonClusterMap(0); // important to use the Add..() methods | |
e64fdf8a | 239 | |
240 | // at first station | |
60765b06 | 241 | trackParam->SetParamForUncorrected(esdTrack); |
242 | trackParam->SetCovFor(esdTrack); | |
e64fdf8a | 243 | // at vertex |
60765b06 | 244 | trackParamAtVtx.SetParamFor(esdTrack); |
61fed964 | 245 | // at Distance of Closest Approach |
246 | trackParamAtDCA.SetParamForDCA(esdTrack); | |
e64fdf8a | 247 | // global info |
96ebe67e | 248 | esdTrack.SetChi2(track->GetGlobalChi2()); |
249 | esdTrack.SetNHit(track->GetNClusters()); | |
e64fdf8a | 250 | esdTrack.SetLocalTrigger(track->GetLocalTrigger()); |
251 | esdTrack.SetChi2MatchTrigger(track->GetChi2MatchTrigger()); | |
252 | esdTrack.SetHitsPatternInTrigCh(track->GetHitsPatternInTrigCh()); | |
61fed964 | 253 | // muon cluster info |
96ebe67e | 254 | while (trackParam) { |
61fed964 | 255 | cluster = trackParam->GetClusterPtr(); |
256 | esdCluster.SetUniqueID(cluster->GetUniqueID()); | |
257 | esdCluster.SetXYZ(cluster->GetX(), cluster->GetY(), cluster->GetZ()); | |
258 | esdCluster.SetErrXY(cluster->GetErrX(), cluster->GetErrY()); | |
259 | esdTrack.AddCluster(esdCluster); | |
260 | esdTrack.AddInMuonClusterMap(cluster->GetChamberId()); | |
96ebe67e | 261 | trackParam = static_cast<AliMUONTrackParam*>(track->GetTrackParamAtCluster()->After(trackParam)); |
60765b06 | 262 | } |
e64fdf8a | 263 | |
264 | // storing ESD MUON Track into ESD Event | |
265 | esd->AddMuonTrack(&esdTrack); | |
266 | } // end of loop on tracks | |
196471e9 | 267 | } |
268 | ||
269 | //_____________________________________________________________________________ | |
3304fa09 | 270 | void AliMUONTracker::CreateTrackReconstructor() |
196471e9 | 271 | { |
3304fa09 | 272 | /// Create track reconstructor, depending on tracking mode set in RecoParam |
273 | ||
274 | TString opt(AliMUONReconstructor::GetRecoParam()->GetTrackingMode()); | |
275 | opt.ToUpper(); | |
e64fdf8a | 276 | |
3304fa09 | 277 | if (strstr(opt,"ORIGINAL")) |
e64fdf8a | 278 | { |
1fef78c8 | 279 | fTrackReco = new AliMUONTrackReconstructor(fClusterServer); |
e64fdf8a | 280 | } |
3304fa09 | 281 | else if (strstr(opt,"KALMAN")) |
e64fdf8a | 282 | { |
1fef78c8 | 283 | fTrackReco = new AliMUONTrackReconstructorK(fClusterServer); |
e64fdf8a | 284 | } |
3304fa09 | 285 | else |
286 | { | |
287 | AliError(Form("tracking mode \"%s\" does not exist",opt.Data())); | |
288 | return; | |
289 | } | |
290 | ||
291 | AliInfo(Form("Will use %s for tracking",fTrackReco->ClassName())); | |
e64fdf8a | 292 | } |
196471e9 | 293 | |
e64fdf8a | 294 | //_____________________________________________________________________________ |
3304fa09 | 295 | void AliMUONTracker::UnloadClusters() |
e64fdf8a | 296 | { |
1fef78c8 | 297 | /// Clear internal clusterStore |
298 | ||
299 | ClusterStore()->Clear(); | |
196471e9 | 300 | } |