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"
48 #include "AliCodeTimer.h"
50 #include <Riostream.h>
54 ClassImp(AliMUONTracker)
58 //_____________________________________________________________________________
59 AliMUONTracker::AliMUONTracker(const AliMUONDigitMaker* digitMaker,
60 const AliMUONGeometryTransformer* transformer,
61 const AliMUONTriggerCircuit* triggerCircuit,
62 AliMUONTriggerChamberEff* chamberEff)
64 fDigitMaker(digitMaker), // not owner
65 fTransformer(transformer), // not owner
66 fTriggerCircuit(triggerCircuit), // not owner
67 fTrigChamberEff(chamberEff), // not owner
68 fTrackHitPatternMaker(0x0),
74 if (fTransformer && fDigitMaker)
76 fTrackHitPatternMaker = new AliMUONTrackHitPattern(*fTransformer,*fDigitMaker);
80 //_____________________________________________________________________________
81 AliMUONTracker::~AliMUONTracker()
85 delete fTrackHitPatternMaker;
90 //_____________________________________________________________________________
92 AliMUONTracker::LoadClusters(TTree* clustersTree)
94 /// Load clusterStore and triggerStore from clustersTree
98 if ( ! clustersTree ) {
99 AliFatal("No clustersTree");
103 fClusterStore = AliMUONVClusterStore::Create(*clustersTree);
104 fTriggerStore = AliMUONVTriggerStore::Create(*clustersTree);
108 AliError("Could not get clusterStore");
113 AliError("Could not get triggerStore");
117 fClusterStore->Connect(*clustersTree,kFALSE);
118 fTriggerStore->Connect(*clustersTree,kFALSE);
120 clustersTree->GetEvent(0);
125 //_____________________________________________________________________________
127 AliMUONTracker::Clusters2Tracks(AliESDEvent* esd)
129 /// Performs the tracking and store the resulting tracks in
134 AliError("ClusterStore is NULL");
140 AliError("TriggerStore is NULL");
144 AliMUONVTrackStore* trackStore(0x0);
145 AliMUONVTriggerTrackStore* triggerTrackStore(0x0);
147 // Make tracker tracks
150 trackStore = new AliMUONTrackStoreV1;
151 Bool_t alone = ( ( fTriggerStore && fTriggerCircuit ) ? kFALSE : kTRUE );
152 fTrackReco->EventReconstruct(*fClusterStore,*trackStore);
155 if ( fTriggerStore && fTriggerCircuit )
157 // Make trigger tracks
158 triggerTrackStore = new AliMUONTriggerTrackStoreV1;
159 Bool_t alone = ( fClusterStore ? kFALSE : kTRUE );
160 fTrackReco->EventReconstructTrigger(*fTriggerCircuit,*fTriggerStore,*triggerTrackStore);
163 if ( trackStore && triggerTrackStore && fTriggerStore && fTrackHitPatternMaker )
165 fTrackReco->ValidateTracksWithTrigger(*trackStore,*triggerTrackStore,*fTriggerStore,*fTrackHitPatternMaker);
168 if( trackStore && triggerTrackStore && fTriggerStore && fTrigChamberEff){
169 AliCodeTimerStart("EventChamberEff");
170 fTrigChamberEff->EventChamberEff(*fTriggerStore,*triggerTrackStore,*trackStore);
171 AliCodeTimerStop("EventChamberEff");
174 FillESD(*trackStore,esd);
178 delete triggerTrackStore;
183 //_____________________________________________________________________________
185 AliMUONTracker::FillESD(AliMUONVTrackStore& trackStore, AliESDEvent* esd) const
187 /// Fill the ESD from the trackStore
192 Double_t vertex[3] = {0};
193 const AliESDVertex* esdVert = esd->GetVertex();
194 if (esdVert->GetNContributors())
196 esdVert->GetXYZ(vertex);
197 AliDebug(1,Form("found vertex (%e,%e,%e)",vertex[0],vertex[1],vertex[2]));
200 // setting ESD MUON class
201 AliESDMuonTrack esdTrack;
204 TIter next(trackStore.CreateIterator());
206 while ( ( track = static_cast<AliMUONTrack*>(next()) ) )
208 AliMUONTrackParam* trackParam = static_cast<AliMUONTrackParam*>((track->GetTrackParamAtHit())->First());
209 AliMUONTrackParam trackParamAtVtx(*trackParam);
211 /// Extrapolate to vertex (which is set to (0,0,0) if not available, see above)
212 AliMUONTrackExtrap::ExtrapToVertex(&trackParamAtVtx, vertex[0],vertex[1],vertex[2]);
214 // setting data member of ESD MUON
217 trackParam->SetParamForUncorrected(esdTrack);
218 trackParam->SetCovFor(esdTrack);
220 trackParamAtVtx.SetParamFor(esdTrack);
222 esdTrack.SetChi2(track->GetFitFMin());
223 esdTrack.SetNHit(track->GetNTrackHits());
224 esdTrack.SetLocalTrigger(track->GetLocalTrigger());
225 esdTrack.SetChi2MatchTrigger(track->GetChi2MatchTrigger());
226 esdTrack.SetHitsPatternInTrigCh(track->GetHitsPatternInTrigCh());
228 AliMUONHitForRec* cluster = static_cast<AliMUONHitForRec*>((track->GetHitForRecAtHit())->First());
230 esdTrack.AddInMuonClusterMap(cluster->GetChamberNumber());
231 cluster = static_cast<AliMUONHitForRec*>((track->GetHitForRecAtHit())->After(cluster));
234 // storing ESD MUON Track into ESD Event
235 esd->AddMuonTrack(&esdTrack);
236 } // end of loop on tracks
239 //_____________________________________________________________________________
240 void AliMUONTracker::SetOption(Option_t* option)
242 /// set reconstructor class
244 if (strstr(option,"Original"))
246 fTrackReco = new AliMUONTrackReconstructor;
250 fTrackReco = new AliMUONTrackReconstructorK();
254 //_____________________________________________________________________________
256 AliMUONTracker::UnloadClusters()
258 /// Delete internal clusterStore
259 delete fClusterStore;