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