]>
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" |
89b4e052 | 44 | #include "AliMUONVDigitStore.h" |
196471e9 | 45 | #include "AliMUONTrackReconstructor.h" |
e64fdf8a | 46 | #include "AliMUONTrackReconstructorK.h" |
47 | #include "AliMUONTrackStoreV1.h" | |
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" |
89b4e052 | 55 | #include "AliESDMuonPad.h" |
ea94c18b | 56 | #include "AliESDVertex.h" |
ea94c18b | 57 | #include "AliLog.h" |
2060b217 | 58 | #include "AliCodeTimer.h" |
ea94c18b | 59 | |
e64fdf8a | 60 | #include <Riostream.h> |
61 | #include <TTree.h> | |
89b4e052 | 62 | #include <TRandom.h> |
196471e9 | 63 | |
ee8a8d65 | 64 | /// \cond CLASSIMP |
65 | ClassImp(AliMUONTracker) | |
66 | /// \endcond | |
67 | ||
68 | ||
196471e9 | 69 | //_____________________________________________________________________________ |
1fef78c8 | 70 | AliMUONTracker::AliMUONTracker(AliMUONVClusterServer& clusterServer, |
89b4e052 | 71 | const AliMUONVDigitStore& digitStore, |
1fef78c8 | 72 | const AliMUONDigitMaker* digitMaker, |
e64fdf8a | 73 | const AliMUONGeometryTransformer* transformer, |
683cb6c5 | 74 | const AliMUONTriggerCircuit* triggerCircuit) |
e64fdf8a | 75 | : AliTracker(), |
e64fdf8a | 76 | fDigitMaker(digitMaker), // not owner |
77 | fTransformer(transformer), // not owner | |
78 | fTriggerCircuit(triggerCircuit), // not owner | |
79 | fTrackHitPatternMaker(0x0), | |
80 | fTrackReco(0x0), | |
81 | fClusterStore(0x0), | |
1fef78c8 | 82 | fTriggerStore(0x0), |
89b4e052 | 83 | fClusterServer(clusterServer), // not owner |
84 | fDigitStore(digitStore) // not owner | |
196471e9 | 85 | { |
86 | /// constructor | |
e64fdf8a | 87 | if (fTransformer && fDigitMaker) |
e64fdf8a | 88 | fTrackHitPatternMaker = new AliMUONTrackHitPattern(*fTransformer,*fDigitMaker); |
89b4e052 | 89 | |
90 | fClusterServer.UseDigitStore(fDigitStore); | |
196471e9 | 91 | } |
e64fdf8a | 92 | |
196471e9 | 93 | //_____________________________________________________________________________ |
94 | AliMUONTracker::~AliMUONTracker() | |
95 | { | |
e64fdf8a | 96 | /// dtor |
196471e9 | 97 | delete fTrackReco; |
e64fdf8a | 98 | delete fTrackHitPatternMaker; |
99 | delete fClusterStore; | |
100 | delete fTriggerStore; | |
196471e9 | 101 | } |
102 | ||
1fef78c8 | 103 | //_____________________________________________________________________________ |
104 | AliMUONVClusterStore* | |
105 | AliMUONTracker::ClusterStore() const | |
106 | { | |
107 | /// Return (and create if necessary) the cluster container | |
108 | if (!fClusterStore) | |
109 | { | |
110 | fClusterStore = new AliMUONClusterStoreV2; | |
111 | } | |
112 | return fClusterStore; | |
113 | } | |
114 | ||
196471e9 | 115 | //_____________________________________________________________________________ |
3304fa09 | 116 | Int_t AliMUONTracker::LoadClusters(TTree* clustersTree) |
196471e9 | 117 | { |
1fef78c8 | 118 | /// Load triggerStore from clustersTree |
119 | ||
120 | ClusterStore()->Clear(); | |
121 | ||
e64fdf8a | 122 | delete fTriggerStore; |
196471e9 | 123 | |
6cfc11c3 | 124 | if ( ! clustersTree ) { |
125 | AliFatal("No clustersTree"); | |
126 | return 1; | |
127 | } | |
128 | ||
e64fdf8a | 129 | fTriggerStore = AliMUONVTriggerStore::Create(*clustersTree); |
130 | ||
e64fdf8a | 131 | if (!fTriggerStore) |
132 | { | |
133 | AliError("Could not get triggerStore"); | |
134 | return 2; | |
135 | } | |
136 | ||
1fef78c8 | 137 | ClusterStore()->Connect(*clustersTree,kFALSE); |
e64fdf8a | 138 | fTriggerStore->Connect(*clustersTree,kFALSE); |
139 | ||
140 | clustersTree->GetEvent(0); | |
196471e9 | 141 | |
e64fdf8a | 142 | return 0; |
143 | } | |
196471e9 | 144 | |
e64fdf8a | 145 | //_____________________________________________________________________________ |
3304fa09 | 146 | Int_t AliMUONTracker::Clusters2Tracks(AliESDEvent* esd) |
e64fdf8a | 147 | { |
3304fa09 | 148 | /// Performs the tracking and store the resulting tracks in the ESD |
149 | AliDebug(1,""); | |
150 | AliCodeTimerAuto("") | |
e64fdf8a | 151 | |
3304fa09 | 152 | if (!fTrackReco) CreateTrackReconstructor(); |
153 | ||
154 | // if the required tracking mode does not exist | |
155 | if (!fTrackReco) return 1; | |
156 | ||
1fef78c8 | 157 | if ( ! ClusterStore() ) |
158 | { | |
e64fdf8a | 159 | AliError("ClusterStore is NULL"); |
6cfc11c3 | 160 | return 2; |
e64fdf8a | 161 | } |
6cfc11c3 | 162 | |
3304fa09 | 163 | if (!fTriggerStore) { |
e64fdf8a | 164 | AliError("TriggerStore is NULL"); |
6cfc11c3 | 165 | return 3; |
e64fdf8a | 166 | } |
1fef78c8 | 167 | |
e64fdf8a | 168 | // Make tracker tracks |
3304fa09 | 169 | AliMUONVTrackStore* trackStore = new AliMUONTrackStoreV1; |
1fef78c8 | 170 | fTrackReco->EventReconstruct(*(ClusterStore()),*trackStore); |
e64fdf8a | 171 | |
3304fa09 | 172 | // Make trigger tracks |
173 | AliMUONVTriggerTrackStore* triggerTrackStore(0x0); | |
174 | if ( fTriggerCircuit ) { | |
e64fdf8a | 175 | triggerTrackStore = new AliMUONTriggerTrackStoreV1; |
e64fdf8a | 176 | fTrackReco->EventReconstructTrigger(*fTriggerCircuit,*fTriggerStore,*triggerTrackStore); |
177 | } | |
178 | ||
3304fa09 | 179 | // Match tracker/trigger tracks |
180 | if ( triggerTrackStore && fTrackHitPatternMaker ) { | |
e64fdf8a | 181 | fTrackReco->ValidateTracksWithTrigger(*trackStore,*triggerTrackStore,*fTriggerStore,*fTrackHitPatternMaker); |
182 | } | |
183 | ||
3304fa09 | 184 | // Fill ESD |
e64fdf8a | 185 | FillESD(*trackStore,esd); |
186 | ||
187 | // cleanup | |
188 | delete trackStore; | |
189 | delete triggerTrackStore; | |
190 | ||
191 | return 0; | |
192 | } | |
196471e9 | 193 | |
e64fdf8a | 194 | //_____________________________________________________________________________ |
3304fa09 | 195 | void AliMUONTracker::FillESD(AliMUONVTrackStore& trackStore, AliESDEvent* esd) const |
e64fdf8a | 196 | { |
197 | /// Fill the ESD from the trackStore | |
e64fdf8a | 198 | AliDebug(1,""); |
2060b217 | 199 | AliCodeTimerAuto("") |
e64fdf8a | 200 | |
89b4e052 | 201 | // Random number to decide whether to save additional cluster info or not for the current event |
202 | Double_t rand = 0.; | |
203 | if (AliMUONReconstructor::GetRecoParam()->SaveFullClusterInESD()) rand = gRandom->Uniform(0.,100.); | |
204 | ||
e64fdf8a | 205 | // Get vertex |
206 | Double_t vertex[3] = {0}; | |
690d2205 | 207 | Double_t errXVtx = 0., errYVtx = 0.; |
e64fdf8a | 208 | const AliESDVertex* esdVert = esd->GetVertex(); |
209 | if (esdVert->GetNContributors()) | |
210 | { | |
211 | esdVert->GetXYZ(vertex); | |
690d2205 | 212 | errXVtx = esdVert->GetXRes(); |
213 | errYVtx = esdVert->GetYRes(); | |
e64fdf8a | 214 | AliDebug(1,Form("found vertex (%e,%e,%e)",vertex[0],vertex[1],vertex[2])); |
215 | } | |
216 | ||
e64fdf8a | 217 | AliMUONTrack* track; |
61fed964 | 218 | AliMUONVCluster* cluster; |
89b4e052 | 219 | AliMUONVDigit* digit; |
e64fdf8a | 220 | TIter next(trackStore.CreateIterator()); |
221 | ||
222 | while ( ( track = static_cast<AliMUONTrack*>(next()) ) ) | |
223 | { | |
96ebe67e | 224 | AliMUONTrackParam* trackParam = static_cast<AliMUONTrackParam*>((track->GetTrackParamAtCluster())->First()); |
e64fdf8a | 225 | |
89b4e052 | 226 | // new ESD muon track |
227 | AliESDMuonTrack esdTrack; | |
228 | ||
e64fdf8a | 229 | /// Extrapolate to vertex (which is set to (0,0,0) if not available, see above) |
61fed964 | 230 | AliMUONTrackParam trackParamAtVtx(*trackParam); |
231 | AliMUONTrackExtrap::ExtrapToVertex(&trackParamAtVtx, vertex[0], vertex[1], vertex[2], errXVtx, errYVtx); | |
232 | ||
233 | /// Extrapolate to vertex plan (which is set to z=0 if not available, see above) | |
234 | AliMUONTrackParam trackParamAtDCA(*trackParam); | |
235 | AliMUONTrackExtrap::ExtrapToVertexWithoutBranson(&trackParamAtDCA, vertex[2]); | |
e64fdf8a | 236 | |
e64fdf8a | 237 | // at first station |
60765b06 | 238 | trackParam->SetParamForUncorrected(esdTrack); |
239 | trackParam->SetCovFor(esdTrack); | |
89b4e052 | 240 | |
e64fdf8a | 241 | // at vertex |
60765b06 | 242 | trackParamAtVtx.SetParamFor(esdTrack); |
89b4e052 | 243 | |
61fed964 | 244 | // at Distance of Closest Approach |
245 | trackParamAtDCA.SetParamForDCA(esdTrack); | |
89b4e052 | 246 | |
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()); | |
89b4e052 | 253 | |
61fed964 | 254 | // muon cluster info |
96ebe67e | 255 | while (trackParam) { |
61fed964 | 256 | cluster = trackParam->GetClusterPtr(); |
89b4e052 | 257 | |
258 | // new ESD muon cluster | |
259 | AliESDMuonCluster esdCluster; | |
260 | ||
261 | // fill minimum info in ESD cluster | |
61fed964 | 262 | esdCluster.SetUniqueID(cluster->GetUniqueID()); |
263 | esdCluster.SetXYZ(cluster->GetX(), cluster->GetY(), cluster->GetZ()); | |
264 | esdCluster.SetErrXY(cluster->GetErrX(), cluster->GetErrY()); | |
89b4e052 | 265 | |
266 | // fill additional info in ESD cluster if required and only for a fraction of events | |
267 | if (AliMUONReconstructor::GetRecoParam()->SaveFullClusterInESD() && | |
268 | rand <= AliMUONReconstructor::GetRecoParam()->GetPercentOfFullClusterInESD()) { | |
269 | ||
270 | esdCluster.SetCharge(cluster->GetCharge()); | |
271 | esdCluster.SetChi2(cluster->GetChi2()); | |
272 | ||
273 | // fill ESD pad with digit info | |
274 | for (Int_t i=0; i<cluster->GetNDigits(); i++) { | |
275 | digit = fDigitStore.FindObject(cluster->GetDigitId(i)); | |
276 | ||
277 | // new ESD muon pad | |
278 | AliESDMuonPad esdPad; | |
279 | ||
280 | esdPad.SetUniqueID(digit->GetUniqueID()); | |
281 | esdPad.SetADC(digit->ADC()); | |
282 | esdPad.SetCharge(digit->Charge()); | |
283 | ||
284 | // add pad info in ESD cluster | |
285 | esdCluster.AddPad(esdPad); | |
286 | } | |
287 | ||
288 | } | |
289 | ||
290 | // add cluster info in ESD track | |
61fed964 | 291 | esdTrack.AddCluster(esdCluster); |
292 | esdTrack.AddInMuonClusterMap(cluster->GetChamberId()); | |
89b4e052 | 293 | |
96ebe67e | 294 | trackParam = static_cast<AliMUONTrackParam*>(track->GetTrackParamAtCluster()->After(trackParam)); |
60765b06 | 295 | } |
e64fdf8a | 296 | |
297 | // storing ESD MUON Track into ESD Event | |
298 | esd->AddMuonTrack(&esdTrack); | |
299 | } // end of loop on tracks | |
196471e9 | 300 | } |
301 | ||
302 | //_____________________________________________________________________________ | |
3304fa09 | 303 | void AliMUONTracker::CreateTrackReconstructor() |
196471e9 | 304 | { |
3304fa09 | 305 | /// Create track reconstructor, depending on tracking mode set in RecoParam |
306 | ||
307 | TString opt(AliMUONReconstructor::GetRecoParam()->GetTrackingMode()); | |
308 | opt.ToUpper(); | |
e64fdf8a | 309 | |
3304fa09 | 310 | if (strstr(opt,"ORIGINAL")) |
e64fdf8a | 311 | { |
1fef78c8 | 312 | fTrackReco = new AliMUONTrackReconstructor(fClusterServer); |
e64fdf8a | 313 | } |
3304fa09 | 314 | else if (strstr(opt,"KALMAN")) |
e64fdf8a | 315 | { |
1fef78c8 | 316 | fTrackReco = new AliMUONTrackReconstructorK(fClusterServer); |
e64fdf8a | 317 | } |
3304fa09 | 318 | else |
319 | { | |
320 | AliError(Form("tracking mode \"%s\" does not exist",opt.Data())); | |
321 | return; | |
322 | } | |
323 | ||
324 | AliInfo(Form("Will use %s for tracking",fTrackReco->ClassName())); | |
e64fdf8a | 325 | } |
196471e9 | 326 | |
e64fdf8a | 327 | //_____________________________________________________________________________ |
3304fa09 | 328 | void AliMUONTracker::UnloadClusters() |
e64fdf8a | 329 | { |
1fef78c8 | 330 | /// Clear internal clusterStore |
331 | ||
332 | ClusterStore()->Clear(); | |
196471e9 | 333 | } |