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 **************************************************************************/
16 /// \class AliMUONTracker
18 /// Steering class for use in global tracking framework;
19 /// reconstruct tracks from recpoints
21 /// Actual tracking is performed by some AliMUONVTrackReconstructor children
23 /// \author Christian Finck and Laurent Aphecetche, SUBATECH Nantes
25 #include "AliMUONTracker.h"
28 #include "AliESDMuonTrack.h"
29 #include "AliESDVertex.h"
30 #include "AliLoader.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 "AliMUONTriggerTrackStoreV1.h"
39 #include "AliMUONVClusterStore.h"
40 #include "AliMUONVTriggerStore.h"
41 #include <Riostream.h>
45 //_____________________________________________________________________________
46 AliMUONTracker::AliMUONTracker(AliLoader* loader,
47 const AliMUONDigitMaker* digitMaker,
48 const AliMUONGeometryTransformer* transformer,
49 const AliMUONTriggerCircuit* triggerCircuit)
52 fDigitMaker(digitMaker), // not owner
53 fTransformer(transformer), // not owner
54 fTriggerCircuit(triggerCircuit), // not owner
55 fTrackHitPatternMaker(0x0),
61 if (fTransformer && fDigitMaker)
63 fTrackHitPatternMaker = new AliMUONTrackHitPattern(*fTransformer,*fDigitMaker);
67 //_____________________________________________________________________________
68 AliMUONTracker::~AliMUONTracker()
72 delete fTrackHitPatternMaker;
77 //_____________________________________________________________________________
79 AliMUONTracker::LoadClusters(TTree* clustersTree)
81 /// Load clusterStore and triggerStore from clustersTree
85 fClusterStore = AliMUONVClusterStore::Create(*clustersTree);
86 fTriggerStore = AliMUONVTriggerStore::Create(*clustersTree);
90 AliError("Could not get clusterStore");
95 AliError("Could not get triggerStore");
99 fClusterStore->Connect(*clustersTree,kFALSE);
100 fTriggerStore->Connect(*clustersTree,kFALSE);
102 clustersTree->GetEvent(0);
107 //_____________________________________________________________________________
109 AliMUONTracker::Clusters2Tracks(AliESD* esd)
111 /// Performs the tracking and store the resulting tracks in both
112 /// the TreeT and the ESD
116 TTree* tracksTree = fLoader->TreeT();
120 AliError("Cannot get TreeT");
125 AliError("ClusterStore is NULL");
130 AliError("TriggerStore is NULL");
135 rv = Clusters2Tracks(*tracksTree,esd);
140 //_____________________________________________________________________________
141 Int_t AliMUONTracker::Clusters2Tracks(TTree& tracksTree, AliESD* esd)
143 /// Performs the tracking
147 AliMUONVTrackStore* trackStore(0x0);
148 AliMUONVTriggerTrackStore* triggerTrackStore(0x0);
150 // Make tracker tracks
153 trackStore = new AliMUONTrackStoreV1;
154 Bool_t alone = ( ( fTriggerStore && fTriggerCircuit ) ? kFALSE : kTRUE );
155 trackStore->Connect(tracksTree,alone);
156 fTrackReco->EventReconstruct(*fClusterStore,*trackStore);
159 if ( fTriggerStore && fTriggerCircuit )
161 // Make trigger tracks
162 triggerTrackStore = new AliMUONTriggerTrackStoreV1;
163 Bool_t alone = ( fClusterStore ? kFALSE : kTRUE );
164 triggerTrackStore->Connect(tracksTree,alone);
165 fTrackReco->EventReconstructTrigger(*fTriggerCircuit,*fTriggerStore,*triggerTrackStore);
168 if ( trackStore && triggerTrackStore && fTriggerStore && fTrackHitPatternMaker )
170 fTrackReco->ValidateTracksWithTrigger(*trackStore,*triggerTrackStore,*fTriggerStore,*fTrackHitPatternMaker);
173 // Fills output TreeT
176 FillESD(*trackStore,esd);
180 delete triggerTrackStore;
185 //_____________________________________________________________________________
187 AliMUONTracker::FillESD(AliMUONVTrackStore& trackStore, AliESD* esd) const
189 /// Fill the ESD from the trackStore
194 Double_t vertex[3] = {0};
195 const AliESDVertex* esdVert = esd->GetVertex();
196 if (esdVert->GetNContributors())
198 esdVert->GetXYZ(vertex);
199 AliDebug(1,Form("found vertex (%e,%e,%e)",vertex[0],vertex[1],vertex[2]));
202 // setting ESD MUON class
203 AliESDMuonTrack esdTrack;
206 TIter next(trackStore.CreateIterator());
208 while ( ( track = static_cast<AliMUONTrack*>(next()) ) )
210 AliMUONTrackParam* trackParam = static_cast<AliMUONTrackParam*>((track->GetTrackParamAtHit())->First());
211 AliMUONTrackParam trackParamAtVtx(*trackParam);
213 /// Extrapolate to vertex (which is set to (0,0,0) if not available, see above)
214 AliMUONTrackExtrap::ExtrapToVertex(&trackParamAtVtx, vertex[0],vertex[1],vertex[2]);
216 // setting data member of ESD MUON
219 esdTrack.SetInverseBendingMomentumUncorrected(trackParam->GetInverseBendingMomentum());
220 esdTrack.SetThetaXUncorrected(TMath::ATan(trackParam->GetNonBendingSlope()));
221 esdTrack.SetThetaYUncorrected(TMath::ATan(trackParam->GetBendingSlope()));
222 esdTrack.SetZUncorrected(trackParam->GetZ());
223 esdTrack.SetBendingCoorUncorrected(trackParam->GetBendingCoor());
224 esdTrack.SetNonBendingCoorUncorrected(trackParam->GetNonBendingCoor());
226 esdTrack.SetInverseBendingMomentum(trackParamAtVtx.GetInverseBendingMomentum());
227 esdTrack.SetThetaX(TMath::ATan(trackParamAtVtx.GetNonBendingSlope()));
228 esdTrack.SetThetaY(TMath::ATan(trackParamAtVtx.GetBendingSlope()));
229 esdTrack.SetZ(trackParamAtVtx.GetZ());
230 esdTrack.SetBendingCoor(trackParamAtVtx.GetBendingCoor());
231 esdTrack.SetNonBendingCoor(trackParamAtVtx.GetNonBendingCoor());
233 esdTrack.SetChi2(track->GetFitFMin());
234 esdTrack.SetNHit(track->GetNTrackHits());
235 esdTrack.SetLocalTrigger(track->GetLocalTrigger());
236 esdTrack.SetChi2MatchTrigger(track->GetChi2MatchTrigger());
237 esdTrack.SetHitsPatternInTrigCh(track->GetHitsPatternInTrigCh());
239 // storing ESD MUON Track into ESD Event
240 esd->AddMuonTrack(&esdTrack);
241 } // end of loop on tracks
244 //_____________________________________________________________________________
245 void AliMUONTracker::SetOption(Option_t* option)
247 /// set reconstructor class
249 if (strstr(option,"Original"))
251 fTrackReco = new AliMUONTrackReconstructor;
253 else if (strstr(option,"Combi"))
255 fTrackReco = new AliMUONTrackReconstructorK("Combi");
259 fTrackReco = new AliMUONTrackReconstructorK("Kalman");
263 //_____________________________________________________________________________
265 AliMUONTracker::UnloadClusters()
267 /// Delete internal clusterStore
268 delete fClusterStore;