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 "AliMUONTrackReconstructor.h"
36 #include "AliMUONTrackReconstructorK.h"
37 #include "AliMUONTrackStoreV1.h"
38 #include "AliMUONTriggerChamberEff.h"
39 #include "AliMUONTriggerTrackStoreV1.h"
40 #include "AliMUONVClusterStore.h"
41 #include "AliMUONVTriggerStore.h"
43 #include "AliESDEvent.h"
44 #include "AliESDMuonTrack.h"
45 #include "AliESDVertex.h"
46 #include "AliLoader.h"
49 #include <Riostream.h>
53 ClassImp(AliMUONTracker)
57 //_____________________________________________________________________________
58 AliMUONTracker::AliMUONTracker(AliLoader* loader,
59 const AliMUONDigitMaker* digitMaker,
60 const AliMUONGeometryTransformer* transformer,
61 const AliMUONTriggerCircuit* triggerCircuit,
62 AliMUONTriggerChamberEff* chamberEff)
65 fDigitMaker(digitMaker), // not owner
66 fTransformer(transformer), // not owner
67 fTriggerCircuit(triggerCircuit), // not owner
68 fTrigChamberEff(chamberEff), // not owner
69 fTrackHitPatternMaker(0x0),
75 if (fTransformer && fDigitMaker)
77 fTrackHitPatternMaker = new AliMUONTrackHitPattern(*fTransformer,*fDigitMaker);
81 //_____________________________________________________________________________
82 AliMUONTracker::~AliMUONTracker()
86 delete fTrackHitPatternMaker;
91 //_____________________________________________________________________________
93 AliMUONTracker::LoadClusters(TTree* clustersTree)
95 /// Load clusterStore and triggerStore from clustersTree
99 fClusterStore = AliMUONVClusterStore::Create(*clustersTree);
100 fTriggerStore = AliMUONVTriggerStore::Create(*clustersTree);
104 AliError("Could not get clusterStore");
109 AliError("Could not get triggerStore");
113 fClusterStore->Connect(*clustersTree,kFALSE);
114 fTriggerStore->Connect(*clustersTree,kFALSE);
116 clustersTree->GetEvent(0);
121 //_____________________________________________________________________________
123 AliMUONTracker::Clusters2Tracks(AliESDEvent* esd)
125 /// Performs the tracking and store the resulting tracks in both
126 /// the TreeT and the ESD
130 TTree* tracksTree = fLoader->TreeT();
134 AliError("Cannot get TreeT");
139 AliError("ClusterStore is NULL");
144 AliError("TriggerStore is NULL");
149 rv = Clusters2Tracks(*tracksTree,esd);
154 //_____________________________________________________________________________
155 Int_t AliMUONTracker::Clusters2Tracks(TTree& tracksTree, AliESDEvent* esd)
157 /// Performs the tracking
161 AliMUONVTrackStore* trackStore(0x0);
162 AliMUONVTriggerTrackStore* triggerTrackStore(0x0);
164 // Make tracker tracks
167 trackStore = new AliMUONTrackStoreV1;
168 Bool_t alone = ( ( fTriggerStore && fTriggerCircuit ) ? kFALSE : kTRUE );
169 trackStore->Connect(tracksTree,alone);
170 fTrackReco->EventReconstruct(*fClusterStore,*trackStore);
173 if ( fTriggerStore && fTriggerCircuit )
175 // Make trigger tracks
176 triggerTrackStore = new AliMUONTriggerTrackStoreV1;
177 Bool_t alone = ( fClusterStore ? kFALSE : kTRUE );
178 triggerTrackStore->Connect(tracksTree,alone);
179 fTrackReco->EventReconstructTrigger(*fTriggerCircuit,*fTriggerStore,*triggerTrackStore);
182 if ( trackStore && triggerTrackStore && fTriggerStore && fTrackHitPatternMaker )
184 fTrackReco->ValidateTracksWithTrigger(*trackStore,*triggerTrackStore,*fTriggerStore,*fTrackHitPatternMaker);
187 // Fills output TreeT
190 if( trackStore && triggerTrackStore && fTriggerStore && fTrigChamberEff){
191 fTrigChamberEff->EventChamberEff(*fTriggerStore,*triggerTrackStore,*trackStore);
194 FillESD(*trackStore,esd);
198 delete triggerTrackStore;
203 //_____________________________________________________________________________
205 AliMUONTracker::FillESD(AliMUONVTrackStore& trackStore, AliESDEvent* esd) const
207 /// Fill the ESD from the trackStore
212 Double_t vertex[3] = {0};
213 const AliESDVertex* esdVert = esd->GetVertex();
214 if (esdVert->GetNContributors())
216 esdVert->GetXYZ(vertex);
217 AliDebug(1,Form("found vertex (%e,%e,%e)",vertex[0],vertex[1],vertex[2]));
220 // setting ESD MUON class
221 AliESDMuonTrack esdTrack;
224 TIter next(trackStore.CreateIterator());
226 while ( ( track = static_cast<AliMUONTrack*>(next()) ) )
228 AliMUONTrackParam* trackParam = static_cast<AliMUONTrackParam*>((track->GetTrackParamAtHit())->First());
229 AliMUONTrackParam trackParamAtVtx(*trackParam);
231 /// Extrapolate to vertex (which is set to (0,0,0) if not available, see above)
232 AliMUONTrackExtrap::ExtrapToVertex(&trackParamAtVtx, vertex[0],vertex[1],vertex[2]);
234 // setting data member of ESD MUON
237 esdTrack.SetInverseBendingMomentumUncorrected(trackParam->GetInverseBendingMomentum());
238 esdTrack.SetThetaXUncorrected(TMath::ATan(trackParam->GetNonBendingSlope()));
239 esdTrack.SetThetaYUncorrected(TMath::ATan(trackParam->GetBendingSlope()));
240 esdTrack.SetZUncorrected(trackParam->GetZ());
241 esdTrack.SetBendingCoorUncorrected(trackParam->GetBendingCoor());
242 esdTrack.SetNonBendingCoorUncorrected(trackParam->GetNonBendingCoor());
244 esdTrack.SetInverseBendingMomentum(trackParamAtVtx.GetInverseBendingMomentum());
245 esdTrack.SetThetaX(TMath::ATan(trackParamAtVtx.GetNonBendingSlope()));
246 esdTrack.SetThetaY(TMath::ATan(trackParamAtVtx.GetBendingSlope()));
247 esdTrack.SetZ(trackParamAtVtx.GetZ());
248 esdTrack.SetBendingCoor(trackParamAtVtx.GetBendingCoor());
249 esdTrack.SetNonBendingCoor(trackParamAtVtx.GetNonBendingCoor());
251 esdTrack.SetChi2(track->GetFitFMin());
252 esdTrack.SetNHit(track->GetNTrackHits());
253 esdTrack.SetLocalTrigger(track->GetLocalTrigger());
254 esdTrack.SetChi2MatchTrigger(track->GetChi2MatchTrigger());
255 esdTrack.SetHitsPatternInTrigCh(track->GetHitsPatternInTrigCh());
257 // storing ESD MUON Track into ESD Event
258 esd->AddMuonTrack(&esdTrack);
259 } // end of loop on tracks
262 //_____________________________________________________________________________
263 void AliMUONTracker::SetOption(Option_t* option)
265 /// set reconstructor class
267 if (strstr(option,"Original"))
269 fTrackReco = new AliMUONTrackReconstructor;
273 fTrackReco = new AliMUONTrackReconstructorK();
277 //_____________________________________________________________________________
279 AliMUONTracker::UnloadClusters()
281 /// Delete internal clusterStore
282 delete fClusterStore;