]>
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" | |
9bf6860b | 54 | #include "AliMUONVCluster.h" |
55 | #include "AliMUONVClusterServer.h" | |
56 | #include "AliMUONVDigitStore.h" | |
e64fdf8a | 57 | #include "AliMUONVTriggerStore.h" |
58 | #include <Riostream.h> | |
89b4e052 | 59 | #include <TRandom.h> |
9bf6860b | 60 | #include <TTree.h> |
196471e9 | 61 | |
ee8a8d65 | 62 | /// \cond CLASSIMP |
63 | ClassImp(AliMUONTracker) | |
64 | /// \endcond | |
65 | ||
66 | ||
196471e9 | 67 | //_____________________________________________________________________________ |
9bf6860b | 68 | AliMUONTracker::AliMUONTracker(AliMUONVClusterServer* clusterServer, |
69 | const AliMUONVDigitStore& digitStore, | |
1fef78c8 | 70 | const AliMUONDigitMaker* digitMaker, |
e64fdf8a | 71 | const AliMUONGeometryTransformer* transformer, |
683cb6c5 | 72 | const AliMUONTriggerCircuit* triggerCircuit) |
e64fdf8a | 73 | : AliTracker(), |
e64fdf8a | 74 | fDigitMaker(digitMaker), // not owner |
75 | fTransformer(transformer), // not owner | |
76 | fTriggerCircuit(triggerCircuit), // not owner | |
77 | fTrackHitPatternMaker(0x0), | |
78 | fTrackReco(0x0), | |
79 | fClusterStore(0x0), | |
1fef78c8 | 80 | fTriggerStore(0x0), |
9bf6860b | 81 | fClusterServer(clusterServer), |
82 | fIsOwnerOfClusterServer(kFALSE), | |
83 | fDigitStore(digitStore), // not owner | |
84 | fInputClusterStore(0x0), | |
85 | fTriggerTrackStore(0x0) | |
196471e9 | 86 | { |
87 | /// constructor | |
e64fdf8a | 88 | if (fTransformer && fDigitMaker) |
e64fdf8a | 89 | fTrackHitPatternMaker = new AliMUONTrackHitPattern(*fTransformer,*fDigitMaker); |
89b4e052 | 90 | |
9bf6860b | 91 | if (!fClusterServer) |
92 | { | |
93 | AliInfo("No cluster server given. Will use AliMUONLegacyClusterServer"); | |
94 | fIsOwnerOfClusterServer = kTRUE; | |
95 | } | |
96 | else | |
97 | { | |
98 | TIter next(fDigitStore.CreateIterator()); | |
99 | fClusterServer->UseDigits(next); | |
100 | ||
101 | SetupClusterServer(*fClusterServer); | |
102 | } | |
196471e9 | 103 | } |
e64fdf8a | 104 | |
196471e9 | 105 | //_____________________________________________________________________________ |
106 | AliMUONTracker::~AliMUONTracker() | |
107 | { | |
e64fdf8a | 108 | /// dtor |
196471e9 | 109 | delete fTrackReco; |
e64fdf8a | 110 | delete fTrackHitPatternMaker; |
111 | delete fClusterStore; | |
112 | delete fTriggerStore; | |
9bf6860b | 113 | if ( fIsOwnerOfClusterServer ) delete fClusterServer; |
114 | delete fInputClusterStore; | |
115 | delete fTriggerTrackStore; | |
196471e9 | 116 | } |
117 | ||
1fef78c8 | 118 | //_____________________________________________________________________________ |
119 | AliMUONVClusterStore* | |
120 | AliMUONTracker::ClusterStore() const | |
121 | { | |
122 | /// Return (and create if necessary) the cluster container | |
123 | if (!fClusterStore) | |
124 | { | |
125 | fClusterStore = new AliMUONClusterStoreV2; | |
126 | } | |
127 | return fClusterStore; | |
128 | } | |
129 | ||
9bf6860b | 130 | //_____________________________________________________________________________ |
131 | AliMUONVTriggerTrackStore* | |
132 | AliMUONTracker::TriggerTrackStore() const | |
133 | { | |
134 | /// Return (and create if necessary) the trigger track container | |
135 | if (!fTriggerTrackStore) | |
136 | { | |
137 | fTriggerTrackStore = new AliMUONTriggerTrackStoreV1; | |
138 | } | |
139 | return fTriggerTrackStore; | |
140 | } | |
141 | ||
196471e9 | 142 | //_____________________________________________________________________________ |
3304fa09 | 143 | Int_t AliMUONTracker::LoadClusters(TTree* clustersTree) |
196471e9 | 144 | { |
1fef78c8 | 145 | /// Load triggerStore from clustersTree |
146 | ||
e64fdf8a | 147 | delete fTriggerStore; |
9bf6860b | 148 | delete fInputClusterStore; |
149 | fInputClusterStore=0x0; | |
196471e9 | 150 | |
6cfc11c3 | 151 | if ( ! clustersTree ) { |
152 | AliFatal("No clustersTree"); | |
153 | return 1; | |
154 | } | |
155 | ||
e64fdf8a | 156 | fTriggerStore = AliMUONVTriggerStore::Create(*clustersTree); |
157 | ||
e64fdf8a | 158 | if (!fTriggerStore) |
159 | { | |
160 | AliError("Could not get triggerStore"); | |
161 | return 2; | |
162 | } | |
163 | ||
9bf6860b | 164 | if ( fIsOwnerOfClusterServer ) |
165 | { | |
166 | fInputClusterStore = AliMUONVClusterStore::Create(*clustersTree); | |
167 | if ( fInputClusterStore ) | |
168 | { | |
169 | AliInfo(Form("Created %s from cluster tree",fInputClusterStore->ClassName())); | |
170 | fInputClusterStore->Clear(); | |
171 | fInputClusterStore->Connect(*clustersTree,kFALSE); | |
172 | } | |
173 | delete fClusterServer; | |
174 | fClusterServer = new AliMUONLegacyClusterServer(*fTransformer,fInputClusterStore); | |
175 | SetupClusterServer(*fClusterServer); | |
176 | } | |
177 | ||
e64fdf8a | 178 | fTriggerStore->Connect(*clustersTree,kFALSE); |
179 | ||
180 | clustersTree->GetEvent(0); | |
196471e9 | 181 | |
e64fdf8a | 182 | return 0; |
183 | } | |
196471e9 | 184 | |
e64fdf8a | 185 | //_____________________________________________________________________________ |
3304fa09 | 186 | Int_t AliMUONTracker::Clusters2Tracks(AliESDEvent* esd) |
e64fdf8a | 187 | { |
3304fa09 | 188 | /// Performs the tracking and store the resulting tracks in the ESD |
189 | AliDebug(1,""); | |
190 | AliCodeTimerAuto("") | |
e64fdf8a | 191 | |
9bf6860b | 192 | if (!fTrackReco) |
193 | { | |
194 | fTrackReco = CreateTrackReconstructor(AliMUONReconstructor::GetRecoParam()->GetTrackingMode(),fClusterServer); | |
195 | } | |
3304fa09 | 196 | |
197 | // if the required tracking mode does not exist | |
198 | if (!fTrackReco) return 1; | |
199 | ||
1fef78c8 | 200 | if ( ! ClusterStore() ) |
201 | { | |
e64fdf8a | 202 | AliError("ClusterStore is NULL"); |
6cfc11c3 | 203 | return 2; |
e64fdf8a | 204 | } |
6cfc11c3 | 205 | |
3304fa09 | 206 | if (!fTriggerStore) { |
e64fdf8a | 207 | AliError("TriggerStore is NULL"); |
6cfc11c3 | 208 | return 3; |
e64fdf8a | 209 | } |
1fef78c8 | 210 | |
9bf6860b | 211 | // Make trigger tracks |
212 | if ( fTriggerCircuit ) | |
213 | { | |
214 | TriggerTrackStore()->Clear(); | |
215 | fTrackReco->EventReconstructTrigger(*fTriggerCircuit,*fTriggerStore,*(TriggerTrackStore())); | |
216 | } | |
217 | ||
e64fdf8a | 218 | // Make tracker tracks |
3304fa09 | 219 | AliMUONVTrackStore* trackStore = new AliMUONTrackStoreV1; |
1fef78c8 | 220 | fTrackReco->EventReconstruct(*(ClusterStore()),*trackStore); |
e64fdf8a | 221 | |
3304fa09 | 222 | // Match tracker/trigger tracks |
9bf6860b | 223 | if ( fTrackHitPatternMaker ) |
224 | { | |
225 | fTrackReco->ValidateTracksWithTrigger(*trackStore,*(TriggerTrackStore()),*fTriggerStore,*fTrackHitPatternMaker); | |
e64fdf8a | 226 | } |
227 | ||
3304fa09 | 228 | // Fill ESD |
e64fdf8a | 229 | FillESD(*trackStore,esd); |
230 | ||
231 | // cleanup | |
232 | delete trackStore; | |
e64fdf8a | 233 | |
234 | return 0; | |
235 | } | |
196471e9 | 236 | |
e64fdf8a | 237 | //_____________________________________________________________________________ |
3304fa09 | 238 | void AliMUONTracker::FillESD(AliMUONVTrackStore& trackStore, AliESDEvent* esd) const |
e64fdf8a | 239 | { |
240 | /// Fill the ESD from the trackStore | |
e64fdf8a | 241 | AliDebug(1,""); |
2060b217 | 242 | AliCodeTimerAuto("") |
e64fdf8a | 243 | |
103e6575 | 244 | AliMUONTrack* track; |
245 | AliESDMuonTrack esdTrack; | |
246 | Double_t vertex[3] = {0., 0., 0.}; | |
247 | TIter next(trackStore.CreateIterator()); | |
89b4e052 | 248 | |
103e6575 | 249 | // get ITS vertex |
e64fdf8a | 250 | const AliESDVertex* esdVert = esd->GetVertex(); |
103e6575 | 251 | if (esdVert->GetNContributors()) { |
e64fdf8a | 252 | esdVert->GetXYZ(vertex); |
253 | AliDebug(1,Form("found vertex (%e,%e,%e)",vertex[0],vertex[1],vertex[2])); | |
254 | } | |
255 | ||
103e6575 | 256 | // fill ESD event including all info in ESD cluster if required and only for the given fraction of events |
257 | if (AliMUONReconstructor::GetRecoParam()->SaveFullClusterInESD() && | |
258 | gRandom->Uniform(100.) <= AliMUONReconstructor::GetRecoParam()->GetPercentOfFullClusterInESD()) { | |
e64fdf8a | 259 | |
103e6575 | 260 | while ( ( track = static_cast<AliMUONTrack*>(next()) ) ) { |
261 | AliMUONESDInterface::MUONToESD(*track, esdTrack, vertex, &fDigitStore); | |
262 | esd->AddMuonTrack(&esdTrack); | |
263 | } | |
89b4e052 | 264 | |
103e6575 | 265 | } else { |
89b4e052 | 266 | |
103e6575 | 267 | while ( ( track = static_cast<AliMUONTrack*>(next()) ) ) { |
268 | AliMUONESDInterface::MUONToESD(*track, esdTrack, vertex); | |
269 | esd->AddMuonTrack(&esdTrack); | |
60765b06 | 270 | } |
e64fdf8a | 271 | |
103e6575 | 272 | } |
273 | ||
196471e9 | 274 | } |
275 | ||
276 | //_____________________________________________________________________________ | |
9bf6860b | 277 | AliMUONVTrackReconstructor* AliMUONTracker::CreateTrackReconstructor(const char* trackingMode, AliMUONVClusterServer* clusterServer) |
196471e9 | 278 | { |
3304fa09 | 279 | /// Create track reconstructor, depending on tracking mode set in RecoParam |
280 | ||
9bf6860b | 281 | AliMUONVTrackReconstructor* trackReco(0x0); |
282 | ||
283 | TString opt(trackingMode); | |
3304fa09 | 284 | opt.ToUpper(); |
e64fdf8a | 285 | |
3304fa09 | 286 | if (strstr(opt,"ORIGINAL")) |
e64fdf8a | 287 | { |
9bf6860b | 288 | trackReco = new AliMUONTrackReconstructor(*clusterServer); |
e64fdf8a | 289 | } |
3304fa09 | 290 | else if (strstr(opt,"KALMAN")) |
e64fdf8a | 291 | { |
9bf6860b | 292 | trackReco = new AliMUONTrackReconstructorK(*clusterServer); |
e64fdf8a | 293 | } |
3304fa09 | 294 | else |
295 | { | |
9bf6860b | 296 | AliErrorClass(Form("tracking mode \"%s\" does not exist",opt.Data())); |
297 | return 0x0; | |
3304fa09 | 298 | } |
299 | ||
9bf6860b | 300 | AliInfoClass(Form("Will use %s for tracking",trackReco->ClassName())); |
301 | ||
302 | return trackReco; | |
e64fdf8a | 303 | } |
196471e9 | 304 | |
e64fdf8a | 305 | //_____________________________________________________________________________ |
3304fa09 | 306 | void AliMUONTracker::UnloadClusters() |
e64fdf8a | 307 | { |
1fef78c8 | 308 | /// Clear internal clusterStore |
309 | ||
9bf6860b | 310 | delete fInputClusterStore; |
311 | fInputClusterStore = 0x0; | |
196471e9 | 312 | } |
9bf6860b | 313 | |
314 | ||
315 | //_____________________________________________________________________________ | |
316 | void | |
317 | AliMUONTracker::SetupClusterServer(AliMUONVClusterServer& clusterServer) | |
318 | { | |
319 | /// Setup the cluster server | |
320 | ||
321 | if ( AliMUONReconstructor::GetRecoParam()->BypassSt45() ) | |
322 | { | |
323 | Bool_t ok = clusterServer.UseTriggerTrackStore(TriggerTrackStore()); | |
324 | ||
325 | if ( ok ) | |
326 | ||
327 | { | |
328 | AliWarning("WILL USE TRIGGER TRACKS TO GENERATE CLUSTERS IN STATIONS 4 AND 5, THUS BYPASSING REAL CLUSTERS IN THOSE TWO STATIONS !!!"); | |
329 | } | |
330 | else | |
331 | { | |
332 | AliWarning("BYPASSING OF ST45 REQUESTED, BUT CLUSTERSERVER DOES NOT SEEM TO SUPPORT IT !!!"); | |
333 | } | |
334 | } | |
335 | } | |
336 | ||
337 |