]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/muon/AliMuonInfoStoreRD.cxx
Adding Id to PWG3 classes for better tracking of the coverity defect fixes (Ivana)
[u/mrichter/AliRoot.git] / PWG3 / muon / AliMuonInfoStoreRD.cxx
CommitLineData
fd1d0cb9 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
27de2dfb 16/* $Id$ */
17
fd1d0cb9 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
30class TObject;
31
32ClassImp(AliMuonInfoStoreRD)
33
34const TString AliMuonInfoStoreRD::fgkStdBranchName("MuonRD");
9bcac085 35Double_t AliMuonInfoStoreRD::fgCuts[16] = {-999999., 999999.,
36 -999999., 999999.,
37 -999999., 999999.,
1195bb6f 38 -999999., 999999.,
fd1d0cb9 39 -999999., 999999.,
40 -999999., 999999.,
41 -999999., 999999.,
42 -999999., 999999.};
43
44//-----------------------------------------------------------------------------
45AliMuonInfoStoreRD::AliMuonInfoStoreRD() :
46TObject(),
47fMomentum(),
fd1d0cb9 48fCharge(0),
49fMatchTrigger(-1),
fd1d0cb9 50fChi2FitMomentum(0.),
1195bb6f 51fChi2MatchTrigger(0.),
52fRabsEnd(0.)
fd1d0cb9 53{
54 //
55 // default constructor
56 //
1195bb6f 57 for (Int_t i=3; i--;) fDCA[i]=0.;
fd1d0cb9 58}
59
60//-----------------------------------------------------------------------------
61AliMuonInfoStoreRD::AliMuonInfoStoreRD(AliAODTrack *trk) :
62TObject(),
63fMomentum(),
fd1d0cb9 64fCharge(0),
65fMatchTrigger(-1),
fd1d0cb9 66fChi2FitMomentum(0.),
1195bb6f 67fChi2MatchTrigger(0.),
68fRabsEnd(0.)
fd1d0cb9 69{
70 //
71 // AOD-base constructor
72 //
1195bb6f 73 for (Int_t i=3; i--;) fDCA[i]=0.;
fd1d0cb9 74 this->FillMuonInfo(trk);
75}
76
77//-----------------------------------------------------------------------------
78AliMuonInfoStoreRD::AliMuonInfoStoreRD(AliESDMuonTrack *trk) :
79TObject(),
80fMomentum(),
fd1d0cb9 81fCharge(0),
82fMatchTrigger(-1),
fd1d0cb9 83fChi2FitMomentum(0.),
1195bb6f 84fChi2MatchTrigger(0.),
85fRabsEnd(0.)
fd1d0cb9 86{
87 //
88 // ESD-base constructor
89 //
1195bb6f 90 for (Int_t i=3; i--;) fDCA[i]=0.;
fd1d0cb9 91 this->FillMuonInfo(trk);
92}
93
94//-----------------------------------------------------------------------------
95AliMuonInfoStoreRD::AliMuonInfoStoreRD(const AliMuonInfoStoreRD &src) :
96TObject(src),
97fMomentum(src.fMomentum),
fd1d0cb9 98fCharge(src.fCharge),
99fMatchTrigger(src.fMatchTrigger),
fd1d0cb9 100fChi2FitMomentum(src.fChi2FitMomentum),
1195bb6f 101fChi2MatchTrigger(src.fChi2MatchTrigger),
102fRabsEnd(src.fRabsEnd)
fd1d0cb9 103{
104 //
105 // copy constructor
106 //
1195bb6f 107 for (Int_t i=3; i--;) fDCA[i]=src.fDCA[i];
fd1d0cb9 108}
109
110//-----------------------------------------------------------------------------
111AliMuonInfoStoreRD& AliMuonInfoStoreRD::operator=(const AliMuonInfoStoreRD &src)
112{
113 //
114 // assignment constructor
115 //
116 if(&src==this) return *this;
117
118 fMomentum = src.fMomentum;
fd1d0cb9 119 fCharge = src.fCharge;
120 fMatchTrigger = src.fMatchTrigger;
fd1d0cb9 121 fChi2FitMomentum = src.fChi2FitMomentum;
122 fChi2MatchTrigger = src.fChi2MatchTrigger;
1195bb6f 123 fRabsEnd = src.fRabsEnd;
fd1d0cb9 124
1195bb6f 125 for (Int_t i=3; i--;) fDCA[i]=src.fDCA[i];
fd1d0cb9 126
127 return *this;
128}
129
130//-----------------------------------------------------------------------------
131AliMuonInfoStoreRD::~AliMuonInfoStoreRD()
132{
133 //
134 // destructor
135 //
136}
137
138//-----------------------------------------------------------------------------
139void 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
fd1d0cb9 147 trk->XYZAtDCA(arr);
148 this->SetDCA(arr);
149
150 this->SetCharge(trk->Charge());
151 this->SetMatchTrigger(trk->GetMatchTrigger());
fd1d0cb9 152 this->SetChi2FitMomentum(trk->Chi2perNDF());
153 this->SetChi2MatchTrigger(trk->GetChi2MatchTrigger());
1195bb6f 154 this->SetRabsEnd(trk->GetRAtAbsorberEnd());
fd1d0cb9 155
156 return;
157}
158
159
160//-----------------------------------------------------------------------------
161void AliMuonInfoStoreRD::FillMuonInfo(AliESDMuonTrack *trk)
162{
163 // extract reco info of muon track from ESD
fd1d0cb9 164
165 Double_t arr[3];
166 trk->PxPyPz(arr);
167 this->SetMomentum(arr);
168
fd1d0cb9 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());
fd1d0cb9 176 this->SetChi2FitMomentum(trk->GetChi2()/(2.*trk->GetNHit()-5.));
177 this->SetChi2MatchTrigger(trk->GetChi2MatchTrigger());
1195bb6f 178 this->SetRabsEnd(trk->GetRAtAbsorberEnd());
fd1d0cb9 179
fd1d0cb9 180 return;
181}
182
183//-----------------------------------------------------------------------------
6709e09d 184Bool_t AliMuonInfoStoreRD::IsSelected()
fd1d0cb9 185{
186 // select muon tracks according to the selection cuts
187
188 Double_t p = Momentum().Mag();
9bcac085 189 if (p<AliMuonInfoStoreRD::fgCuts[0] || p>AliMuonInfoStoreRD::fgCuts[1]) return kFALSE;
fd1d0cb9 190
191 Double_t pt = Momentum().Pt();
9bcac085 192 if (pt<AliMuonInfoStoreRD::fgCuts[2] || pt>AliMuonInfoStoreRD::fgCuts[3]) return kFALSE;
fd1d0cb9 193
194 Double_t eta = Momentum().Eta();
9bcac085 195 if (eta<AliMuonInfoStoreRD::fgCuts[4] || eta>AliMuonInfoStoreRD::fgCuts[5]) return kFALSE;
fd1d0cb9 196
197 Double_t dca = this->DCA();
9bcac085 198 if (dca<AliMuonInfoStoreRD::fgCuts[6] || dca>AliMuonInfoStoreRD::fgCuts[7]) return kFALSE;
fd1d0cb9 199
200 Int_t trigger = this->MatchTrigger();
9bcac085 201 if (trigger<AliMuonInfoStoreRD::fgCuts[8] || trigger>AliMuonInfoStoreRD::fgCuts[9]) return kFALSE;
fd1d0cb9 202
6709e09d 203 Double_t theta = 180.*(1.-TMath::ATan(this->RabsEnd()/505.)/TMath::Pi());
9bcac085 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;
1195bb6f 211
fd1d0cb9 212 return kTRUE;
213}