1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //-----------------------------------------------------------------------------
19 /// \class AliMUONTracker
21 /// Steering class for use in global tracking framework;
22 /// reconstruct tracks from recpoints
24 /// Actual tracking is performed by some AliMUONVTrackReconstructor children
26 /// \author Christian Finck and Laurent Aphecetche, SUBATECH Nantes
27 //-----------------------------------------------------------------------------
29 #include "AliMUONTracker.h"
31 #include "AliMUONTrack.h"
32 #include "AliMUONTrackExtrap.h"
33 #include "AliMUONTrackHitPattern.h"
34 #include "AliMUONTrackParam.h"
35 #include "AliMUONHitForRec.h"
36 #include "AliMUONTrackReconstructor.h"
37 #include "AliMUONTrackReconstructorK.h"
38 #include "AliMUONTrackStoreV1.h"
39 #include "AliMUONTriggerChamberEff.h"
40 #include "AliMUONTriggerTrackStoreV1.h"
41 #include "AliMUONVClusterStore.h"
42 #include "AliMUONVTriggerStore.h"
44 #include "AliESDEvent.h"
45 #include "AliESDMuonTrack.h"
46 #include "AliESDVertex.h"
49 #include <Riostream.h>
53 ClassImp(AliMUONTracker)
57 //_____________________________________________________________________________
58 AliMUONTracker::AliMUONTracker(const AliMUONDigitMaker* digitMaker,
59 const AliMUONGeometryTransformer* transformer,
60 const AliMUONTriggerCircuit* triggerCircuit,
61 AliMUONTriggerChamberEff* chamberEff)
63 fDigitMaker(digitMaker), // not owner
64 fTransformer(transformer), // not owner
65 fTriggerCircuit(triggerCircuit), // not owner
66 fTrigChamberEff(chamberEff), // not owner
67 fTrackHitPatternMaker(0x0),
73 if (fTransformer && fDigitMaker)
75 fTrackHitPatternMaker = new AliMUONTrackHitPattern(*fTransformer,*fDigitMaker);
79 //_____________________________________________________________________________
80 AliMUONTracker::~AliMUONTracker()
84 delete fTrackHitPatternMaker;
89 //_____________________________________________________________________________
91 AliMUONTracker::LoadClusters(TTree* clustersTree)
93 /// Load clusterStore and triggerStore from clustersTree
97 fClusterStore = AliMUONVClusterStore::Create(*clustersTree);
98 fTriggerStore = AliMUONVTriggerStore::Create(*clustersTree);
102 AliError("Could not get clusterStore");
107 AliError("Could not get triggerStore");
111 fClusterStore->Connect(*clustersTree,kFALSE);
112 fTriggerStore->Connect(*clustersTree,kFALSE);
114 clustersTree->GetEvent(0);
119 //_____________________________________________________________________________
121 AliMUONTracker::Clusters2Tracks(AliESDEvent* esd)
123 /// Performs the tracking and store the resulting tracks in both
124 /// the TreeT and the ESD
128 TTree *tracksTree = new TTree;
132 AliError("ClusterStore is NULL");
137 AliError("TriggerStore is NULL");
142 rv = Clusters2Tracks(*tracksTree,esd);
147 //_____________________________________________________________________________
148 Int_t AliMUONTracker::Clusters2Tracks(TTree& tracksTree, AliESDEvent* esd)
150 /// Performs the tracking
154 AliMUONVTrackStore* trackStore(0x0);
155 AliMUONVTriggerTrackStore* triggerTrackStore(0x0);
157 // Make tracker tracks
160 trackStore = new AliMUONTrackStoreV1;
161 Bool_t alone = ( ( fTriggerStore && fTriggerCircuit ) ? kFALSE : kTRUE );
162 trackStore->Connect(tracksTree,alone);
163 fTrackReco->EventReconstruct(*fClusterStore,*trackStore);
166 if ( fTriggerStore && fTriggerCircuit )
168 // Make trigger tracks
169 triggerTrackStore = new AliMUONTriggerTrackStoreV1;
170 Bool_t alone = ( fClusterStore ? kFALSE : kTRUE );
171 triggerTrackStore->Connect(tracksTree,alone);
172 fTrackReco->EventReconstructTrigger(*fTriggerCircuit,*fTriggerStore,*triggerTrackStore);
175 if ( trackStore && triggerTrackStore && fTriggerStore && fTrackHitPatternMaker )
177 fTrackReco->ValidateTracksWithTrigger(*trackStore,*triggerTrackStore,*fTriggerStore,*fTrackHitPatternMaker);
180 // Fills output TreeT
183 if( trackStore && triggerTrackStore && fTriggerStore && fTrigChamberEff){
184 fTrigChamberEff->EventChamberEff(*fTriggerStore,*triggerTrackStore,*trackStore);
187 FillESD(*trackStore,esd);
191 delete triggerTrackStore;
196 //_____________________________________________________________________________
198 AliMUONTracker::FillESD(AliMUONVTrackStore& trackStore, AliESDEvent* esd) const
200 /// Fill the ESD from the trackStore
205 Double_t vertex[3] = {0};
206 const AliESDVertex* esdVert = esd->GetVertex();
207 if (esdVert->GetNContributors())
209 esdVert->GetXYZ(vertex);
210 AliDebug(1,Form("found vertex (%e,%e,%e)",vertex[0],vertex[1],vertex[2]));
213 // setting ESD MUON class
214 AliESDMuonTrack esdTrack;
217 TIter next(trackStore.CreateIterator());
219 while ( ( track = static_cast<AliMUONTrack*>(next()) ) )
221 AliMUONTrackParam* trackParam = static_cast<AliMUONTrackParam*>((track->GetTrackParamAtHit())->First());
222 AliMUONTrackParam trackParamAtVtx(*trackParam);
224 /// Extrapolate to vertex (which is set to (0,0,0) if not available, see above)
225 AliMUONTrackExtrap::ExtrapToVertex(&trackParamAtVtx, vertex[0],vertex[1],vertex[2]);
227 // setting data member of ESD MUON
230 trackParam->SetParamForUncorrected(esdTrack);
231 trackParam->SetCovFor(esdTrack);
233 trackParamAtVtx.SetParamFor(esdTrack);
235 esdTrack.SetChi2(track->GetFitFMin());
236 esdTrack.SetNHit(track->GetNTrackHits());
237 esdTrack.SetLocalTrigger(track->GetLocalTrigger());
238 esdTrack.SetChi2MatchTrigger(track->GetChi2MatchTrigger());
239 esdTrack.SetHitsPatternInTrigCh(track->GetHitsPatternInTrigCh());
241 AliMUONHitForRec* cluster = static_cast<AliMUONHitForRec*>((track->GetHitForRecAtHit())->First());
243 esdTrack.AddInMuonClusterMap(cluster->GetChamberNumber());
244 cluster = static_cast<AliMUONHitForRec*>((track->GetHitForRecAtHit())->After(cluster));
247 // storing ESD MUON Track into ESD Event
248 esd->AddMuonTrack(&esdTrack);
249 } // end of loop on tracks
252 //_____________________________________________________________________________
253 void AliMUONTracker::SetOption(Option_t* option)
255 /// set reconstructor class
257 if (strstr(option,"Original"))
259 fTrackReco = new AliMUONTrackReconstructor;
263 fTrackReco = new AliMUONTrackReconstructorK();
267 //_____________________________________________________________________________
269 AliMUONTracker::UnloadClusters()
271 /// Delete internal clusterStore
272 delete fClusterStore;