]>
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 | |
9bf6860b | 36 | #include "AliCodeTimer.h" |
37 | #include "AliESDEvent.h" | |
38 | #include "AliESDMuonTrack.h" | |
39 | #include "AliESDVertex.h" | |
40 | #include "AliLog.h" | |
41 | #include "AliMUONClusterStoreV2.h" | |
42 | #include "AliMUONESDInterface.h" | |
43 | #include "AliMUONLegacyClusterServer.h" | |
3304fa09 | 44 | #include "AliMUONRecoParam.h" |
9bf6860b | 45 | #include "AliMUONReconstructor.h" |
e64fdf8a | 46 | #include "AliMUONTrack.h" |
47 | #include "AliMUONTrackExtrap.h" | |
48 | #include "AliMUONTrackHitPattern.h" | |
49 | #include "AliMUONTrackParam.h" | |
196471e9 | 50 | #include "AliMUONTrackReconstructor.h" |
e64fdf8a | 51 | #include "AliMUONTrackReconstructorK.h" |
52 | #include "AliMUONTrackStoreV1.h" | |
53 | #include "AliMUONTriggerTrackStoreV1.h" | |
94e2086e | 54 | #include "AliMUONTriggerTrack.h" |
55 | #include "AliMUONLocalTrigger.h" | |
9bf6860b | 56 | #include "AliMUONVCluster.h" |
57 | #include "AliMUONVClusterServer.h" | |
58 | #include "AliMUONVDigitStore.h" | |
e64fdf8a | 59 | #include "AliMUONVTriggerStore.h" |
60 | #include <Riostream.h> | |
89b4e052 | 61 | #include <TRandom.h> |
9bf6860b | 62 | #include <TTree.h> |
196471e9 | 63 | |
ee8a8d65 | 64 | /// \cond CLASSIMP |
65 | ClassImp(AliMUONTracker) | |
66 | /// \endcond | |
67 | ||
68 | ||
196471e9 | 69 | //_____________________________________________________________________________ |
9bf6860b | 70 | AliMUONTracker::AliMUONTracker(AliMUONVClusterServer* clusterServer, |
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), |
9bf6860b | 83 | fClusterServer(clusterServer), |
84 | fIsOwnerOfClusterServer(kFALSE), | |
85 | fDigitStore(digitStore), // not owner | |
86 | fInputClusterStore(0x0), | |
87 | fTriggerTrackStore(0x0) | |
196471e9 | 88 | { |
89 | /// constructor | |
e64fdf8a | 90 | if (fTransformer && fDigitMaker) |
e64fdf8a | 91 | fTrackHitPatternMaker = new AliMUONTrackHitPattern(*fTransformer,*fDigitMaker); |
89b4e052 | 92 | |
9bf6860b | 93 | if (!fClusterServer) |
94 | { | |
95 | AliInfo("No cluster server given. Will use AliMUONLegacyClusterServer"); | |
96 | fIsOwnerOfClusterServer = kTRUE; | |
97 | } | |
98 | else | |
99 | { | |
100 | TIter next(fDigitStore.CreateIterator()); | |
101 | fClusterServer->UseDigits(next); | |
102 | ||
103 | SetupClusterServer(*fClusterServer); | |
104 | } | |
196471e9 | 105 | } |
e64fdf8a | 106 | |
196471e9 | 107 | //_____________________________________________________________________________ |
108 | AliMUONTracker::~AliMUONTracker() | |
109 | { | |
e64fdf8a | 110 | /// dtor |
196471e9 | 111 | delete fTrackReco; |
e64fdf8a | 112 | delete fTrackHitPatternMaker; |
113 | delete fClusterStore; | |
114 | delete fTriggerStore; | |
9bf6860b | 115 | if ( fIsOwnerOfClusterServer ) delete fClusterServer; |
116 | delete fInputClusterStore; | |
117 | delete fTriggerTrackStore; | |
196471e9 | 118 | } |
119 | ||
1fef78c8 | 120 | //_____________________________________________________________________________ |
121 | AliMUONVClusterStore* | |
122 | AliMUONTracker::ClusterStore() const | |
123 | { | |
124 | /// Return (and create if necessary) the cluster container | |
125 | if (!fClusterStore) | |
126 | { | |
127 | fClusterStore = new AliMUONClusterStoreV2; | |
128 | } | |
129 | return fClusterStore; | |
130 | } | |
131 | ||
9bf6860b | 132 | //_____________________________________________________________________________ |
133 | AliMUONVTriggerTrackStore* | |
134 | AliMUONTracker::TriggerTrackStore() const | |
135 | { | |
136 | /// Return (and create if necessary) the trigger track container | |
137 | if (!fTriggerTrackStore) | |
138 | { | |
139 | fTriggerTrackStore = new AliMUONTriggerTrackStoreV1; | |
140 | } | |
141 | return fTriggerTrackStore; | |
142 | } | |
143 | ||
196471e9 | 144 | //_____________________________________________________________________________ |
3304fa09 | 145 | Int_t AliMUONTracker::LoadClusters(TTree* clustersTree) |
196471e9 | 146 | { |
1fef78c8 | 147 | /// Load triggerStore from clustersTree |
148 | ||
e64fdf8a | 149 | delete fTriggerStore; |
9bf6860b | 150 | delete fInputClusterStore; |
151 | fInputClusterStore=0x0; | |
196471e9 | 152 | |
6cfc11c3 | 153 | if ( ! clustersTree ) { |
154 | AliFatal("No clustersTree"); | |
155 | return 1; | |
156 | } | |
157 | ||
e64fdf8a | 158 | fTriggerStore = AliMUONVTriggerStore::Create(*clustersTree); |
159 | ||
e64fdf8a | 160 | if (!fTriggerStore) |
161 | { | |
162 | AliError("Could not get triggerStore"); | |
163 | return 2; | |
164 | } | |
165 | ||
9bf6860b | 166 | if ( fIsOwnerOfClusterServer ) |
167 | { | |
168 | fInputClusterStore = AliMUONVClusterStore::Create(*clustersTree); | |
169 | if ( fInputClusterStore ) | |
170 | { | |
171 | AliInfo(Form("Created %s from cluster tree",fInputClusterStore->ClassName())); | |
172 | fInputClusterStore->Clear(); | |
173 | fInputClusterStore->Connect(*clustersTree,kFALSE); | |
174 | } | |
175 | delete fClusterServer; | |
de487b6e | 176 | fClusterServer = new AliMUONLegacyClusterServer(*fTransformer,fInputClusterStore, |
177 | AliMUONReconstructor::GetRecoParam()->BypassSt4(), | |
178 | AliMUONReconstructor::GetRecoParam()->BypassSt5()); | |
9bf6860b | 179 | SetupClusterServer(*fClusterServer); |
180 | } | |
181 | ||
e64fdf8a | 182 | fTriggerStore->Connect(*clustersTree,kFALSE); |
183 | ||
184 | clustersTree->GetEvent(0); | |
196471e9 | 185 | |
e64fdf8a | 186 | return 0; |
187 | } | |
196471e9 | 188 | |
e64fdf8a | 189 | //_____________________________________________________________________________ |
3304fa09 | 190 | Int_t AliMUONTracker::Clusters2Tracks(AliESDEvent* esd) |
e64fdf8a | 191 | { |
3304fa09 | 192 | /// Performs the tracking and store the resulting tracks in the ESD |
193 | AliDebug(1,""); | |
194 | AliCodeTimerAuto("") | |
e64fdf8a | 195 | |
9bf6860b | 196 | if (!fTrackReco) |
197 | { | |
198 | fTrackReco = CreateTrackReconstructor(AliMUONReconstructor::GetRecoParam()->GetTrackingMode(),fClusterServer); | |
199 | } | |
3304fa09 | 200 | |
201 | // if the required tracking mode does not exist | |
202 | if (!fTrackReco) return 1; | |
203 | ||
1fef78c8 | 204 | if ( ! ClusterStore() ) |
205 | { | |
e64fdf8a | 206 | AliError("ClusterStore is NULL"); |
6cfc11c3 | 207 | return 2; |
e64fdf8a | 208 | } |
6cfc11c3 | 209 | |
3304fa09 | 210 | if (!fTriggerStore) { |
e64fdf8a | 211 | AliError("TriggerStore is NULL"); |
6cfc11c3 | 212 | return 3; |
e64fdf8a | 213 | } |
1fef78c8 | 214 | |
9bf6860b | 215 | // Make trigger tracks |
216 | if ( fTriggerCircuit ) | |
217 | { | |
218 | TriggerTrackStore()->Clear(); | |
219 | fTrackReco->EventReconstructTrigger(*fTriggerCircuit,*fTriggerStore,*(TriggerTrackStore())); | |
220 | } | |
221 | ||
de487b6e | 222 | if ( ( AliMUONReconstructor::GetRecoParam()->BypassSt4() || |
223 | AliMUONReconstructor::GetRecoParam()->BypassSt5() ) && | |
224 | TriggerTrackStore()->GetSize() > 5 ) | |
d7820279 | 225 | { |
226 | // Hard cut to reject shower events | |
227 | ||
228 | AliCodeTimerAuto("MUON Shower events"); | |
229 | ||
230 | AliWarning(Form("Probably got a shower event (%d trigger tracks). Will not reconstruct tracks.", | |
231 | TriggerTrackStore()->GetSize())); | |
232 | ||
233 | return 0; | |
234 | } | |
235 | ||
e64fdf8a | 236 | // Make tracker tracks |
3304fa09 | 237 | AliMUONVTrackStore* trackStore = new AliMUONTrackStoreV1; |
1fef78c8 | 238 | fTrackReco->EventReconstruct(*(ClusterStore()),*trackStore); |
e64fdf8a | 239 | |
3304fa09 | 240 | // Match tracker/trigger tracks |
9bf6860b | 241 | if ( fTrackHitPatternMaker ) |
242 | { | |
243 | fTrackReco->ValidateTracksWithTrigger(*trackStore,*(TriggerTrackStore()),*fTriggerStore,*fTrackHitPatternMaker); | |
e64fdf8a | 244 | } |
245 | ||
3304fa09 | 246 | // Fill ESD |
e64fdf8a | 247 | FillESD(*trackStore,esd); |
248 | ||
249 | // cleanup | |
250 | delete trackStore; | |
e64fdf8a | 251 | |
252 | return 0; | |
253 | } | |
196471e9 | 254 | |
e64fdf8a | 255 | //_____________________________________________________________________________ |
3304fa09 | 256 | void AliMUONTracker::FillESD(AliMUONVTrackStore& trackStore, AliESDEvent* esd) const |
e64fdf8a | 257 | { |
258 | /// Fill the ESD from the trackStore | |
e64fdf8a | 259 | AliDebug(1,""); |
2060b217 | 260 | AliCodeTimerAuto("") |
e64fdf8a | 261 | |
103e6575 | 262 | // get ITS vertex |
b1fea02e | 263 | Double_t vertex[3] = {0., 0., 0.}; |
e64fdf8a | 264 | const AliESDVertex* esdVert = esd->GetVertex(); |
103e6575 | 265 | if (esdVert->GetNContributors()) { |
e64fdf8a | 266 | esdVert->GetXYZ(vertex); |
267 | AliDebug(1,Form("found vertex (%e,%e,%e)",vertex[0],vertex[1],vertex[2])); | |
268 | } | |
269 | ||
103e6575 | 270 | // fill ESD event including all info in ESD cluster if required and only for the given fraction of events |
b1fea02e | 271 | AliMUONTrack* track; |
272 | AliMUONLocalTrigger* locTrg; | |
273 | AliESDMuonTrack esdTrack; | |
274 | TIter next(trackStore.CreateIterator()); | |
103e6575 | 275 | if (AliMUONReconstructor::GetRecoParam()->SaveFullClusterInESD() && |
276 | gRandom->Uniform(100.) <= AliMUONReconstructor::GetRecoParam()->GetPercentOfFullClusterInESD()) { | |
e64fdf8a | 277 | |
103e6575 | 278 | while ( ( track = static_cast<AliMUONTrack*>(next()) ) ) { |
b1fea02e | 279 | |
280 | if (track->GetMatchTrigger() > 0) { | |
281 | locTrg = static_cast<AliMUONLocalTrigger*>(fTriggerStore->FindLocal(track->LoCircuit())); | |
282 | AliMUONESDInterface::MUONToESD(*track, esdTrack, vertex, &fDigitStore, locTrg); | |
283 | } else AliMUONESDInterface::MUONToESD(*track, esdTrack, vertex, &fDigitStore); | |
284 | ||
103e6575 | 285 | esd->AddMuonTrack(&esdTrack); |
286 | } | |
89b4e052 | 287 | |
103e6575 | 288 | } else { |
89b4e052 | 289 | |
103e6575 | 290 | while ( ( track = static_cast<AliMUONTrack*>(next()) ) ) { |
b1fea02e | 291 | |
292 | if (track->GetMatchTrigger() > 0) { | |
293 | locTrg = static_cast<AliMUONLocalTrigger*>(fTriggerStore->FindLocal(track->LoCircuit())); | |
294 | AliMUONESDInterface::MUONToESD(*track, esdTrack, vertex, 0x0, locTrg); | |
295 | } else AliMUONESDInterface::MUONToESD(*track, esdTrack, vertex); | |
296 | ||
103e6575 | 297 | esd->AddMuonTrack(&esdTrack); |
60765b06 | 298 | } |
e64fdf8a | 299 | |
103e6575 | 300 | } |
b1fea02e | 301 | |
302 | // fill the local trigger decisions not matched with tracks (associate them to "ghost" tracks) | |
303 | UInt_t ghostId = 0xFFFFFFFF - 1; | |
94e2086e | 304 | Bool_t matched = kFALSE; |
94e2086e | 305 | AliMUONTriggerTrack *triggerTrack; |
94e2086e | 306 | TIter itTriggerTrack(fTriggerTrackStore->CreateIterator()); |
b1fea02e | 307 | while ( ( triggerTrack = static_cast<AliMUONTriggerTrack*>(itTriggerTrack()) ) ) { |
308 | ||
309 | locTrg = static_cast<AliMUONLocalTrigger*>(fTriggerStore->FindLocal(triggerTrack->GetLoTrgNum())); | |
310 | ||
311 | // check if this local trigger has already been matched | |
312 | TIter itTrack(trackStore.CreateIterator()); | |
313 | while ( ( track = static_cast<AliMUONTrack*>(itTrack()) ) ) { | |
314 | matched = (track->LoCircuit() == locTrg->LoCircuit()); | |
315 | if (matched) break; | |
94e2086e | 316 | } |
b1fea02e | 317 | if (matched) continue; |
318 | ||
319 | AliMUONESDInterface::MUONToESD(*locTrg, esdTrack, ghostId); | |
320 | ||
321 | esd->AddMuonTrack(&esdTrack); | |
322 | ghostId -= 1; | |
323 | } | |
103e6575 | 324 | |
196471e9 | 325 | } |
326 | ||
327 | //_____________________________________________________________________________ | |
9bf6860b | 328 | AliMUONVTrackReconstructor* AliMUONTracker::CreateTrackReconstructor(const char* trackingMode, AliMUONVClusterServer* clusterServer) |
196471e9 | 329 | { |
3304fa09 | 330 | /// Create track reconstructor, depending on tracking mode set in RecoParam |
331 | ||
9bf6860b | 332 | AliMUONVTrackReconstructor* trackReco(0x0); |
333 | ||
334 | TString opt(trackingMode); | |
3304fa09 | 335 | opt.ToUpper(); |
e64fdf8a | 336 | |
3304fa09 | 337 | if (strstr(opt,"ORIGINAL")) |
e64fdf8a | 338 | { |
b1fea02e | 339 | trackReco = new AliMUONTrackReconstructor(clusterServer); |
e64fdf8a | 340 | } |
3304fa09 | 341 | else if (strstr(opt,"KALMAN")) |
e64fdf8a | 342 | { |
b1fea02e | 343 | trackReco = new AliMUONTrackReconstructorK(clusterServer); |
e64fdf8a | 344 | } |
3304fa09 | 345 | else |
346 | { | |
9bf6860b | 347 | AliErrorClass(Form("tracking mode \"%s\" does not exist",opt.Data())); |
348 | return 0x0; | |
3304fa09 | 349 | } |
350 | ||
9bf6860b | 351 | AliInfoClass(Form("Will use %s for tracking",trackReco->ClassName())); |
352 | ||
353 | return trackReco; | |
e64fdf8a | 354 | } |
196471e9 | 355 | |
e64fdf8a | 356 | //_____________________________________________________________________________ |
3304fa09 | 357 | void AliMUONTracker::UnloadClusters() |
e64fdf8a | 358 | { |
1fef78c8 | 359 | /// Clear internal clusterStore |
360 | ||
9bf6860b | 361 | delete fInputClusterStore; |
362 | fInputClusterStore = 0x0; | |
196471e9 | 363 | } |
9bf6860b | 364 | |
365 | ||
366 | //_____________________________________________________________________________ | |
367 | void | |
368 | AliMUONTracker::SetupClusterServer(AliMUONVClusterServer& clusterServer) | |
369 | { | |
370 | /// Setup the cluster server | |
371 | ||
de487b6e | 372 | if ( AliMUONReconstructor::GetRecoParam()->BypassSt4() || |
373 | AliMUONReconstructor::GetRecoParam()->BypassSt5() ) | |
9bf6860b | 374 | { |
375 | Bool_t ok = clusterServer.UseTriggerTrackStore(TriggerTrackStore()); | |
376 | ||
de487b6e | 377 | TString msg1; |
378 | TString msg2; | |
379 | ||
380 | if ( AliMUONReconstructor::GetRecoParam()->BypassSt45() ) | |
381 | { | |
382 | msg1 = "STATIONS 4 AND 5"; | |
383 | msg2 = "THOSE TWO STATIONS"; | |
384 | } | |
385 | else if ( AliMUONReconstructor::GetRecoParam()->BypassSt4() ) | |
386 | { | |
387 | msg1 = "STATION 4"; | |
388 | msg2 = "THAT STATION"; | |
389 | } | |
390 | else if ( AliMUONReconstructor::GetRecoParam()->BypassSt5() ) | |
391 | { | |
392 | msg1 = "STATION 5"; | |
393 | msg2 = "THAT STATION"; | |
394 | } | |
395 | ||
9bf6860b | 396 | if ( ok ) |
9bf6860b | 397 | { |
de487b6e | 398 | AliWarning(Form("WILL USE TRIGGER TRACKS TO GENERATE CLUSTERS IN %s, " |
399 | "THUS BYPASSING REAL CLUSTERS IN %s!!!",msg1.Data(),msg2.Data())); | |
9bf6860b | 400 | } |
401 | else | |
402 | { | |
de487b6e | 403 | AliWarning("BYPASSING OF ST4 AND/OR 5 REQUESTED, BUT CLUSTERSERVER DOES NOT SEEM TO SUPPORT IT !!!"); |
9bf6860b | 404 | } |
405 | } | |
406 | } | |
407 | ||
408 |