]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/muon/AliMuonInfoStoreRD.cxx
Add the line to support the output tree; Change the type of the output histogram...
[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[12] = {-999999., 999999.,
34                                                 -999999., 999999.,
35                                                 -999999., 999999.,
36                                                 -999999., 999999.,
37                                                 -999999., 999999.,
38                                                 -999999., 999999.};
39
40 //-----------------------------------------------------------------------------
41 AliMuonInfoStoreRD::AliMuonInfoStoreRD() :
42 TObject(),
43 fMomentum(),
44 fCharge(0),
45 fMatchTrigger(-1),
46 fChi2FitMomentum(0.),
47 fChi2MatchTrigger(0.),
48 fRabsEnd(0.)
49 {
50   //
51   // default constructor
52   //
53   for (Int_t i=3; i--;) fDCA[i]=0.;
54 }
55
56 //-----------------------------------------------------------------------------
57 AliMuonInfoStoreRD::AliMuonInfoStoreRD(AliAODTrack *trk) :
58 TObject(),
59 fMomentum(),
60 fCharge(0),
61 fMatchTrigger(-1),
62 fChi2FitMomentum(0.),
63 fChi2MatchTrigger(0.),
64 fRabsEnd(0.)
65 {
66   //
67   // AOD-base constructor
68   //
69   for (Int_t i=3; i--;) fDCA[i]=0.;
70   this->FillMuonInfo(trk);
71 }
72
73 //-----------------------------------------------------------------------------
74 AliMuonInfoStoreRD::AliMuonInfoStoreRD(AliESDMuonTrack *trk) :
75 TObject(),
76 fMomentum(),
77 fCharge(0),
78 fMatchTrigger(-1),
79 fChi2FitMomentum(0.),
80 fChi2MatchTrigger(0.),
81 fRabsEnd(0.)
82 {
83   //
84   // ESD-base constructor
85   //
86   for (Int_t i=3; i--;) fDCA[i]=0.;
87   this->FillMuonInfo(trk);
88 }
89
90 //-----------------------------------------------------------------------------
91 AliMuonInfoStoreRD::AliMuonInfoStoreRD(const AliMuonInfoStoreRD &src) :
92 TObject(src),
93 fMomentum(src.fMomentum),
94 fCharge(src.fCharge),
95 fMatchTrigger(src.fMatchTrigger),
96 fChi2FitMomentum(src.fChi2FitMomentum),
97 fChi2MatchTrigger(src.fChi2MatchTrigger),
98 fRabsEnd(src.fRabsEnd)
99 {
100   //
101   // copy constructor
102   //
103   for (Int_t i=3; i--;) fDCA[i]=src.fDCA[i];
104 }
105
106 //-----------------------------------------------------------------------------
107 AliMuonInfoStoreRD& AliMuonInfoStoreRD::operator=(const AliMuonInfoStoreRD &src)
108 {
109   //
110   // assignment constructor
111   //
112   if(&src==this) return *this;
113
114   fMomentum         = src.fMomentum;
115   fCharge           = src.fCharge;
116   fMatchTrigger     = src.fMatchTrigger;
117   fChi2FitMomentum  = src.fChi2FitMomentum;
118   fChi2MatchTrigger = src.fChi2MatchTrigger;
119   fRabsEnd          = src.fRabsEnd;
120
121   for (Int_t i=3; i--;) fDCA[i]=src.fDCA[i];
122
123   return *this;
124 }
125
126 //-----------------------------------------------------------------------------
127 AliMuonInfoStoreRD::~AliMuonInfoStoreRD()
128 {
129   //
130   // destructor
131   //
132 }
133
134 //-----------------------------------------------------------------------------
135 void 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
143   trk->XYZAtDCA(arr);
144   this->SetDCA(arr);
145
146   this->SetCharge(trk->Charge());
147   this->SetMatchTrigger(trk->GetMatchTrigger());
148   this->SetChi2FitMomentum(trk->Chi2perNDF());
149   this->SetChi2MatchTrigger(trk->GetChi2MatchTrigger());
150   this->SetRabsEnd(trk->GetRAtAbsorberEnd());
151
152   return;
153 }
154
155
156 //-----------------------------------------------------------------------------
157 void AliMuonInfoStoreRD::FillMuonInfo(AliESDMuonTrack *trk)
158 {
159   // extract reco info of muon track from ESD
160
161   Double_t arr[3];
162   trk->PxPyPz(arr);
163   this->SetMomentum(arr);
164
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());
172   this->SetChi2FitMomentum(trk->GetChi2()/(2.*trk->GetNHit()-5.));
173   this->SetChi2MatchTrigger(trk->GetChi2MatchTrigger());
174   this->SetRabsEnd(trk->GetRAtAbsorberEnd());
175
176   return;
177 }
178
179 //-----------------------------------------------------------------------------
180 Bool_t AliMuonInfoStoreRD::IsSelected()
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
199   Double_t theta = 180.*(1.-TMath::ATan(this->RabsEnd()/505.)/TMath::Pi());
200   if (theta<AliMuonInfoStoreRD::fgCuts[10] || theta>AliMuonInfoStoreRD::fgCuts[11])   return kFALSE;
201
202   return kTRUE;
203 }