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