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