1 #ifndef AliMuonForwardTrackFinder_H
2 #define AliMuonForwardTrackFinder_H
6 #include "TClonesArray.h"
10 #include "TGeoManager.h"
12 #include "TParticle.h"
22 #include "TIterator.h"
27 #include "AliRunLoader.h"
28 #include "AliLoader.h"
29 #include "AliHeader.h"
33 #include "AliTracker.h"
34 #include "AliGRPObject.h"
35 #include "AliRunInfo.h"
38 #include "AliMUONConstants.h"
39 #include "AliMUONTrack.h"
40 #include "AliMUONRecoCheck.h"
41 #include "AliMUONTrackParam.h"
42 #include "AliMUONTrackExtrap.h"
43 #include "AliMUONVTrackStore.h"
44 #include "AliMUONVCluster.h"
47 #include "AliMuonForwardTrack.h"
48 #include "AliMFTCluster.h"
50 #include "AliMFTSegmentation.h"
51 #include "AliMFTConstants.h"
53 //====================================================================================================================================================
55 // Class for the creation of the "global muon tracks" built from the clusters in the
56 // muon spectrometer and the clusters of the Muon Forward Tracker. QA histograms are also created
58 // Contact author: antonio.uras@cern.ch
60 //====================================================================================================================================================
62 class AliMuonForwardTrackFinder : public TObject {
66 enum matchingOption {kRealMatching, kIdealMatching};
68 AliMuonForwardTrackFinder();
70 virtual ~AliMuonForwardTrackFinder();
72 enum {kAllClusters, kClustersGoodChi2, kClusterOfTrack, kClusterCorrectMC};
74 void Init(Int_t nRun, Char_t *readDir, Char_t *outDir, Int_t nEventsToAnalyze = -1);
75 Bool_t LoadNextEvent();
76 Int_t LoadNextTrack();
77 Int_t GetNDF(Int_t nClusters);
78 void PDGNameConverter(const Char_t *nameIn, Char_t *nameOut);
83 void SetRun(Int_t nRun) { fRun = nRun; }
84 void SetNEventsToAnalyze(Int_t nEventsToAnalyze) { fNEventsToAnalyze = nEventsToAnalyze; }
85 void SetSigmaSpectrometerCut(Double_t sigmaSpectrometerCut) { fSigmaSpectrometerCut = sigmaSpectrometerCut; }
86 void SetSigmaClusterCut(Double_t sigmaClusterCut) { fSigmaClusterCut = sigmaClusterCut; }
87 void SetChi2GlobalCut(Double_t chi2GlobalCut) { fChi2GlobalCut = chi2GlobalCut; }
88 void SetReadDir(Char_t *dirName) { fReadDir = dirName; }
89 void SetOutDir(Char_t *dirName) { fOutDir = dirName; }
90 void SetDraw(Bool_t drawOption);
91 void SetRAbsorberCut(Double_t rAbsorberCut) { fRAbsorberCut = rAbsorberCut; }
92 void SetLowPtCut(Double_t lowPtCut) { fLowPtCut = lowPtCut; }
93 void SetNFinalCandidatesCut(Int_t nFinalCandidatesCut) { fNFinalCandidatesCut = nFinalCandidatesCut; }
94 void SetExtrapOriginTransvError(Double_t extrapOriginTransvError) { fExtrapOriginTransvError = extrapOriginTransvError; }
95 void SetGaussianBlurZVert(Double_t gaussianBlurZVert) { fGaussianBlurZVert = gaussianBlurZVert; }
97 Int_t GetRun() { return fRun; }
98 Int_t GetNEvents() { return fNEventsToAnalyze; }
99 Double_t GetSigmaSpectrometerCut() { return fSigmaSpectrometerCut; }
100 Double_t GetSigmaClusterCut() { return fSigmaClusterCut; }
101 Double_t GetChi2GlobalCut() { return fChi2GlobalCut; }
102 Double_t GetRAbsorberCut() { return fRAbsorberCut; }
103 Double_t GetLowPtCut() { return fLowPtCut; }
104 Double_t GetExtrapOriginTransvError() { return fExtrapOriginTransvError; }
105 Int_t GetNPlanesMFT() { return fNPlanesMFT; }
106 Int_t GetNFinalCandidatesCut() { return fNFinalCandidatesCut; }
107 Int_t GetCurrentEvent() { return fEv; }
109 Int_t GetNRealTracksAnalyzed() const { return fCountRealTracksAnalyzed; }
110 Int_t GetNRealTracksAnalyzedOfEvent() const { return fCountRealTracksAnalyzedOfEvent; }
111 Int_t GetNRealTracksWithRefMC() const { return fCountRealTracksWithRefMC; }
112 Int_t GetNRealTracksWithRefMC_andTrigger() const { return fCountRealTracksWithRefMC_andTrigger; }
113 Int_t GetNRealTracksWithRefMC_andTrigger_andGoodPt() const { return fCountRealTracksWithRefMC_andTrigger_andGoodPt; }
114 Int_t GetNRealTracksWithRefMC_andTrigger_andGoodPt_andGoodTheta() const { return fCountRealTracksWithRefMC_andTrigger_andGoodPt_andGoodTheta; }
116 void SetNPlanesMFT(Int_t nPlanesMFT) { fNPlanesMFT = nPlanesMFT; }
117 void SeparateFrontBackClusters();
118 void SetNMaxMissingMFTClusters(Int_t nMaxMissingMFTClusters) { fNMaxMissingMFTClusters = nMaxMissingMFTClusters; }
119 void SetMandatoryPlane(Int_t iPlane) { if (0<=iPlane && iPlane<AliMFTConstants::fNMaxPlanes) fIsPlaneMandatory[iPlane] = kTRUE; }
121 void FindClusterInPlane(Int_t planeId);
122 void AttachGoodClusterInPlane(Int_t planeId);
123 void FillPlanesWithTrackHistory();
124 Double_t TryOneCluster(const AliMUONTrackParam &trackParam, AliMFTCluster *cluster);
126 void SetTitleHistos();
129 void PrintParticleHistory();
131 Bool_t IsCorrectMatch(AliMFTCluster *cluster);
132 void CheckCurrentMuonTrackable();
133 Bool_t IsMother(Char_t *nameMother);
135 void SetMatchingMode(Int_t matchingMode) { fMatchingMode = matchingMode; }
136 void SetMinResearchRadiusAtLastPlane(Double_t minResearchRadius) { fMinResearchRadiusAtLastPlane = minResearchRadius; }
138 void FillOutputTree();
139 void WriteOutputTree();
142 Bool_t SetRunNumber();
144 void SetMaxNTracksToBeAnalyzed(Int_t nTracks) { fMaxNTracksToBeAnalyzed = nTracks; }
148 AliMuonForwardTrackFinder(const AliMuonForwardTrackFinder& obj);
149 AliMuonForwardTrackFinder& operator=(const AliMuonForwardTrackFinder& other);
153 static const Int_t fNMaxPlanes = AliMFTConstants::fNMaxPlanes; // max number of MFT planes
154 static const Double_t fRadLengthSi;
157 Int_t fNEventsToAnalyze; // events to analyze
158 Double_t fSigmaClusterCut; // to select the clusters in the MFT planes which are compatible with the extrapolated muon track
159 Double_t fChi2GlobalCut; // cut on the final chi2 of the global muon track
160 Double_t fSigmaSpectrometerCut; // for the selection of the tracks in the muon spectrometer
161 Double_t fExtrapOriginTransvError; // uncertainty on the x and y position of the muon's origin
162 Double_t fGaussianBlurZVert; // smearing of the z position of the vertex, to simulate real case when the simulation was performed at fixed zVert=0.
163 Int_t fNFinalCandidatesCut; // cut on the number of the final candidates for the muon track
168 Double_t fDistanceFromGoodClusterAndTrackAtLastPlane;
169 Double_t fDistanceFromBestClusterAndTrackAtLastPlane;
171 TClonesArray *fMFTClusterArray[fNMaxPlanes]; //! array of clusters for the planes of the MFT
172 TClonesArray *fMFTClusterArrayFront[fNMaxPlanes]; //! array of front clusters for the planes of the MFT
173 TClonesArray *fMFTClusterArrayBack[fNMaxPlanes]; //! array of back clusters for the planes of the MFT
175 Double_t fRAbsorberCut; // in cm, corresponds to the radial position of a 3 degrees track at the end of the absorber (-503 cm)
176 Double_t fLowPtCut; // in GeV/c, the lower limit for the pt of a track in the muon spectrometer
177 Int_t fNPlanesMFT; // number of planes of the Vertex Telescope (Muon Internal Tracker) -> This should be taken from the new version of AliVZERO2
178 Int_t fNPlanesMFTAnalyzed;
179 Int_t fNMaxMissingMFTClusters; // max. number of MFT clusters which can be missed in the global fit procedure
180 Bool_t fIsPlaneMandatory[fNMaxPlanes]; // specifies which MFT planes cannot be missed in the global fit procedure
182 Int_t fEv; // current event being analyzed
183 Int_t fLabelMC; // MC label of the muon track reconstructed in the spectrometer
185 Bool_t fIsClusterCompatible[10]; // here the clusters in the Muon Spectrometer are concerned
187 Double_t fZPlane[fNMaxPlanes]; // z-position of the MFT planes (center of the support)
188 Double_t fRPlaneMax[fNMaxPlanes]; // max radius of the MFT planes (the support)
189 Double_t fRPlaneMin[fNMaxPlanes]; // min radius of the MFT planes (the support)
191 TH1D *fHistPtSpectrometer, *fHistPtMuonTrackWithGoodMatch, *fHistPtMuonTrackWithBadMatch; //
192 TH1D *fHistRadiusEndOfAbsorber, *fHistNTracksAfterExtrapolation[fNMaxPlanes]; //
193 TH1D *fHistNGoodClustersForFinalTracks, *fHistResearchRadius[fNMaxPlanes]; //
194 TH1D *fHistDistanceGoodClusterFromTrackMinusDistanceBestClusterFromTrackAtLastPlane; //
195 TH1D *fHistDistanceGoodClusterFromTrackAtLastPlane; //
196 TH1D *fHistChi2Cluster_GoodCluster[fNMaxPlanes], *fHistChi2Cluster_BadCluster[fNMaxPlanes]; //
197 TH1D *fHistGlobalChi2AtPlaneFor_GOOD_CandidatesOfTrackableMuons[fNMaxPlanes]; //
198 TH1D *fHistGlobalChi2AtPlaneFor_BAD_CandidatesOfTrackableMuons[fNMaxPlanes]; //
200 TNtuple *fNtuFinalCandidates;
201 TNtuple *fNtuFinalBestCandidates;
203 TGraph *fGrMFTPlane[4][20]; //!
204 TEllipse *fCircleExt[fNMaxPlanes], *fCircleInt[fNMaxPlanes]; //!
205 TCanvas *fCanvas; //!
207 TLatex *fTxtMuonHistory, *fTxtTrackGoodClusters, *fTxtTrackChi2[fNMaxPlanes]; //!
208 TLatex *fTxtTrackFinalChi2, *fTxtTrackMomentum, *fTxtFinalCandidates, *fTxtDummy; //!
209 TLatex *fTxtAllClust, *fTxtClustGoodChi2, *fTxtClustMC, *fTxtClustOfTrack; //!
210 TMarker *fMrkAllClust, *fMrkClustGoodChi2, *fMrkClustMC, *fMrkClustOfTrack; //!
212 Int_t fCountRealTracksAnalyzed;
213 Int_t fMaxNTracksToBeAnalyzed;
214 Int_t fCountRealTracksWithRefMC;
215 Int_t fCountRealTracksWithRefMC_andTrigger;
216 Int_t fCountRealTracksWithRefMC_andTrigger_andGoodPt;
217 Int_t fCountRealTracksWithRefMC_andTrigger_andGoodPt_andGoodTheta;
218 Int_t fCountRealTracksAnalyzedOfEvent;
219 Int_t fCountRealTracksAnalyzedWithFinalCandidates;
221 Int_t fNClustersGlobalTrack[fNMaxPlanes], fNDFGlobalTrack[fNMaxPlanes];
223 TFile *fFileCluster; //!
225 TFile *fFile_gAlice; //!
227 AliRunLoader *fRunLoader; //!
228 AliLoader *fMFTLoader; //!
229 AliMUONRecoCheck *fMuonRecoCheck; //!
231 TTree *fMFTClusterTree; //!
233 AliMUONTrack *fMuonTrackReco; //! muon track being analyzed
234 AliMuonForwardTrack *fCurrentTrack; //! muon extrapolated track being tested
235 AliMuonForwardTrack *fFinalBestCandidate; //! best final candidate (if any)
236 Bool_t fIsCurrentMuonTrackable;
237 Bool_t fIsGoodClusterInPlane[fNMaxPlanes];
239 TClonesArray *fCandidateTracks; //! array of track we are going to build (starting from fMuonTrackReco)
241 AliMUONVTrackStore *fTrackStore; //! list of reconstructed MUON tracks
242 AliMUONVTrackStore *fTrackRefStore; //! list of reconstructible MUON tracks
244 TIterator *fNextTrack; //! Iterator for reading the MUON tracks
246 AliStack *fStack; //!
249 AliMFTSegmentation *fSegmentation; //!
251 TFile *fOutputTreeFile, *fOutputQAFile; //
252 TTree *fOutputEventTree; //!
254 TClonesArray *fMuonForwardTracks; //! array of AliMuonForwardTrack
257 Double_t fMinResearchRadiusAtLastPlane;
259 AliGRPObject *fGRPData; //! Data from the GRP/GRP/Data CDB folder
260 AliRunInfo *fRunInfo; //!
262 ClassDef(AliMuonForwardTrackFinder, 1);
266 //======================================================================================================