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 /// \class AliMUONTracker
20 /// Steering class for use in global tracking framework;
21 /// reconstruct tracks from recpoints
23 /// Actual tracking is performed by some AliMUONVTrackReconstructor children
25 /// \author Christian Finck and Laurent Aphecetche, SUBATECH Nantes
27 #include "AliMUONTracker.h"
29 #include "AliMUONTrack.h"
30 #include "AliMUONTrackExtrap.h"
31 #include "AliMUONTrackHitPattern.h"
32 #include "AliMUONTrackParam.h"
33 #include "AliMUONTrackReconstructor.h"
34 #include "AliMUONTrackReconstructorK.h"
35 #include "AliMUONTrackStoreV1.h"
36 #include "AliMUONTriggerChamberEff.h"
37 #include "AliMUONTriggerTrackStoreV1.h"
38 #include "AliMUONVClusterStore.h"
39 #include "AliMUONVTriggerStore.h"
41 #include "AliESDEvent.h"
42 #include "AliESDMuonTrack.h"
43 #include "AliESDVertex.h"
44 #include "AliLoader.h"
47 #include <Riostream.h>
50 //_____________________________________________________________________________
51 AliMUONTracker::AliMUONTracker(AliLoader* loader,
52 const AliMUONDigitMaker* digitMaker,
53 const AliMUONGeometryTransformer* transformer,
54 const AliMUONTriggerCircuit* triggerCircuit,
55 AliMUONTriggerChamberEff* chamberEff)
58 fDigitMaker(digitMaker), // not owner
59 fTransformer(transformer), // not owner
60 fTriggerCircuit(triggerCircuit), // not owner
61 fTrigChamberEff(chamberEff), // not owner
62 fTrackHitPatternMaker(0x0),
68 if (fTransformer && fDigitMaker)
70 fTrackHitPatternMaker = new AliMUONTrackHitPattern(*fTransformer,*fDigitMaker);
74 //_____________________________________________________________________________
75 AliMUONTracker::~AliMUONTracker()
79 delete fTrackHitPatternMaker;
84 //_____________________________________________________________________________
86 AliMUONTracker::LoadClusters(TTree* clustersTree)
88 /// Load clusterStore and triggerStore from clustersTree
92 fClusterStore = AliMUONVClusterStore::Create(*clustersTree);
93 fTriggerStore = AliMUONVTriggerStore::Create(*clustersTree);
97 AliError("Could not get clusterStore");
102 AliError("Could not get triggerStore");
106 fClusterStore->Connect(*clustersTree,kFALSE);
107 fTriggerStore->Connect(*clustersTree,kFALSE);
109 clustersTree->GetEvent(0);
114 //_____________________________________________________________________________
116 AliMUONTracker::Clusters2Tracks(AliESDEvent* esd)
118 /// Performs the tracking and store the resulting tracks in both
119 /// the TreeT and the ESD
123 TTree* tracksTree = fLoader->TreeT();
127 AliError("Cannot get TreeT");
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 esdTrack.SetInverseBendingMomentumUncorrected(trackParam->GetInverseBendingMomentum());
231 esdTrack.SetThetaXUncorrected(TMath::ATan(trackParam->GetNonBendingSlope()));
232 esdTrack.SetThetaYUncorrected(TMath::ATan(trackParam->GetBendingSlope()));
233 esdTrack.SetZUncorrected(trackParam->GetZ());
234 esdTrack.SetBendingCoorUncorrected(trackParam->GetBendingCoor());
235 esdTrack.SetNonBendingCoorUncorrected(trackParam->GetNonBendingCoor());
237 esdTrack.SetInverseBendingMomentum(trackParamAtVtx.GetInverseBendingMomentum());
238 esdTrack.SetThetaX(TMath::ATan(trackParamAtVtx.GetNonBendingSlope()));
239 esdTrack.SetThetaY(TMath::ATan(trackParamAtVtx.GetBendingSlope()));
240 esdTrack.SetZ(trackParamAtVtx.GetZ());
241 esdTrack.SetBendingCoor(trackParamAtVtx.GetBendingCoor());
242 esdTrack.SetNonBendingCoor(trackParamAtVtx.GetNonBendingCoor());
244 esdTrack.SetChi2(track->GetFitFMin());
245 esdTrack.SetNHit(track->GetNTrackHits());
246 esdTrack.SetLocalTrigger(track->GetLocalTrigger());
247 esdTrack.SetChi2MatchTrigger(track->GetChi2MatchTrigger());
248 esdTrack.SetHitsPatternInTrigCh(track->GetHitsPatternInTrigCh());
250 // storing ESD MUON Track into ESD Event
251 esd->AddMuonTrack(&esdTrack);
252 } // end of loop on tracks
255 //_____________________________________________________________________________
256 void AliMUONTracker::SetOption(Option_t* option)
258 /// set reconstructor class
260 if (strstr(option,"Original"))
262 fTrackReco = new AliMUONTrackReconstructor;
266 fTrackReco = new AliMUONTrackReconstructorK();
270 //_____________________________________________________________________________
272 AliMUONTracker::UnloadClusters()
274 /// Delete internal clusterStore
275 delete fClusterStore;