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