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