]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/muon/AliMuonInfoStoreRD.cxx
Adding centrality selection and additional muon track cuts for PbPb (Xiaoming)
[u/mrichter/AliRoot.git] / PWG3 / muon / AliMuonInfoStoreRD.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2006, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
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  **************************************************************************/
15
16 /////////////////////////////////////////////////////////////
17 //
18 // class used to extract and store reco info of muon track
19 //
20 // Author: X-M. Zhang, zhang@clermont.in2p3.fr
21 //                     zhangxm@iopp.ccnu.edu.cn
22 /////////////////////////////////////////////////////////////
23
24 #include "AliAODTrack.h"
25 #include "AliESDMuonTrack.h"
26 #include "AliMuonInfoStoreRD.h"
27
28 class TObject;
29
30 ClassImp(AliMuonInfoStoreRD)
31
32 const TString AliMuonInfoStoreRD::fgkStdBranchName("MuonRD");
33 Double_t      AliMuonInfoStoreRD::fgCuts[16] = {-999999., 999999.,
34                                                 -999999., 999999.,
35                                                 -999999., 999999.,
36                                                 -999999., 999999.,
37                                                 -999999., 999999.,
38                                                 -999999., 999999.,
39                                                 -999999., 999999.,
40                                                 -999999., 999999.};
41
42 //-----------------------------------------------------------------------------
43 AliMuonInfoStoreRD::AliMuonInfoStoreRD() :
44 TObject(),
45 fMomentum(),
46 fCharge(0),
47 fMatchTrigger(-1),
48 fChi2FitMomentum(0.),
49 fChi2MatchTrigger(0.),
50 fRabsEnd(0.)
51 {
52   //
53   // default constructor
54   //
55   for (Int_t i=3; i--;) fDCA[i]=0.;
56 }
57
58 //-----------------------------------------------------------------------------
59 AliMuonInfoStoreRD::AliMuonInfoStoreRD(AliAODTrack *trk) :
60 TObject(),
61 fMomentum(),
62 fCharge(0),
63 fMatchTrigger(-1),
64 fChi2FitMomentum(0.),
65 fChi2MatchTrigger(0.),
66 fRabsEnd(0.)
67 {
68   //
69   // AOD-base constructor
70   //
71   for (Int_t i=3; i--;) fDCA[i]=0.;
72   this->FillMuonInfo(trk);
73 }
74
75 //-----------------------------------------------------------------------------
76 AliMuonInfoStoreRD::AliMuonInfoStoreRD(AliESDMuonTrack *trk) :
77 TObject(),
78 fMomentum(),
79 fCharge(0),
80 fMatchTrigger(-1),
81 fChi2FitMomentum(0.),
82 fChi2MatchTrigger(0.),
83 fRabsEnd(0.)
84 {
85   //
86   // ESD-base constructor
87   //
88   for (Int_t i=3; i--;) fDCA[i]=0.;
89   this->FillMuonInfo(trk);
90 }
91
92 //-----------------------------------------------------------------------------
93 AliMuonInfoStoreRD::AliMuonInfoStoreRD(const AliMuonInfoStoreRD &src) :
94 TObject(src),
95 fMomentum(src.fMomentum),
96 fCharge(src.fCharge),
97 fMatchTrigger(src.fMatchTrigger),
98 fChi2FitMomentum(src.fChi2FitMomentum),
99 fChi2MatchTrigger(src.fChi2MatchTrigger),
100 fRabsEnd(src.fRabsEnd)
101 {
102   //
103   // copy constructor
104   //
105   for (Int_t i=3; i--;) fDCA[i]=src.fDCA[i];
106 }
107
108 //-----------------------------------------------------------------------------
109 AliMuonInfoStoreRD& AliMuonInfoStoreRD::operator=(const AliMuonInfoStoreRD &src)
110 {
111   //
112   // assignment constructor
113   //
114   if(&src==this) return *this;
115
116   fMomentum         = src.fMomentum;
117   fCharge           = src.fCharge;
118   fMatchTrigger     = src.fMatchTrigger;
119   fChi2FitMomentum  = src.fChi2FitMomentum;
120   fChi2MatchTrigger = src.fChi2MatchTrigger;
121   fRabsEnd          = src.fRabsEnd;
122
123   for (Int_t i=3; i--;) fDCA[i]=src.fDCA[i];
124
125   return *this;
126 }
127
128 //-----------------------------------------------------------------------------
129 AliMuonInfoStoreRD::~AliMuonInfoStoreRD()
130 {
131   //
132   // destructor
133   //
134 }
135
136 //-----------------------------------------------------------------------------
137 void AliMuonInfoStoreRD::FillMuonInfo(AliAODTrack *trk)
138 {
139   // extract reco info of muon track from AOD
140
141   Double_t arr[3];
142   trk->PxPyPz(arr);
143   this->SetMomentum(arr);
144
145   trk->XYZAtDCA(arr);
146   this->SetDCA(arr);
147
148   this->SetCharge(trk->Charge());
149   this->SetMatchTrigger(trk->GetMatchTrigger());
150   this->SetChi2FitMomentum(trk->Chi2perNDF());
151   this->SetChi2MatchTrigger(trk->GetChi2MatchTrigger());
152   this->SetRabsEnd(trk->GetRAtAbsorberEnd());
153
154   return;
155 }
156
157
158 //-----------------------------------------------------------------------------
159 void AliMuonInfoStoreRD::FillMuonInfo(AliESDMuonTrack *trk)
160 {
161   // extract reco info of muon track from ESD
162
163   Double_t arr[3];
164   trk->PxPyPz(arr);
165   this->SetMomentum(arr);
166
167   arr[0] = trk->GetNonBendingCoorAtDCA();
168   arr[1] = trk->GetBendingCoorAtDCA();
169   arr[2] = trk->GetZ();
170   this->SetDCA(arr);
171
172   this->SetCharge(trk->Charge());
173   this->SetMatchTrigger(trk->GetMatchTrigger());
174   this->SetChi2FitMomentum(trk->GetChi2()/(2.*trk->GetNHit()-5.));
175   this->SetChi2MatchTrigger(trk->GetChi2MatchTrigger());
176   this->SetRabsEnd(trk->GetRAtAbsorberEnd());
177
178   return;
179 }
180
181 //-----------------------------------------------------------------------------
182 Bool_t AliMuonInfoStoreRD::IsSelected()
183 {
184   // select muon tracks according to the selection cuts
185
186   Double_t p = Momentum().Mag();
187   if (p<AliMuonInfoStoreRD::fgCuts[0] || p>AliMuonInfoStoreRD::fgCuts[1])               return kFALSE;
188
189   Double_t pt = Momentum().Pt();
190   if (pt<AliMuonInfoStoreRD::fgCuts[2] || pt>AliMuonInfoStoreRD::fgCuts[3])             return kFALSE;
191
192   Double_t eta = Momentum().Eta();
193   if (eta<AliMuonInfoStoreRD::fgCuts[4] || eta>AliMuonInfoStoreRD::fgCuts[5])           return kFALSE;
194
195   Double_t dca = this->DCA();
196   if (dca<AliMuonInfoStoreRD::fgCuts[6] || dca>AliMuonInfoStoreRD::fgCuts[7])           return kFALSE;
197
198   Int_t trigger = this->MatchTrigger();
199   if (trigger<AliMuonInfoStoreRD::fgCuts[8] || trigger>AliMuonInfoStoreRD::fgCuts[9])   return kFALSE;
200
201   Double_t theta = 180.*(1.-TMath::ATan(this->RabsEnd()/505.)/TMath::Pi());
202   if (theta<AliMuonInfoStoreRD::fgCuts[10] || theta>AliMuonInfoStoreRD::fgCuts[11])     return kFALSE;
203
204   Double_t chi2Trk = this->Chi2Tracker();
205   if (chi2Trk<AliMuonInfoStoreRD::fgCuts[12] || chi2Trk>AliMuonInfoStoreRD::fgCuts[13]) return kFALSE;
206
207   Double_t chi2Trg = this->Chi2Trigger();
208   if (chi2Trg<AliMuonInfoStoreRD::fgCuts[14] || chi2Trg>AliMuonInfoStoreRD::fgCuts[15]) return kFALSE;
209
210   return kTRUE;
211 }