]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/muon/AliMuonInfoStoreRD.cxx
Fixed addition of FIT (clashed with HLT)
[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
36 //-----------------------------------------------------------------------------
37 AliMuonInfoStoreRD::AliMuonInfoStoreRD() :
38 TObject(),
39 fMomentumAtVtx(),
40 fMomentumAtDCA(),
41 fMomentumUncor(),
42 fCharge(0),
43 fMatchTrigger(-1),
44 fChi2FitMomentum(0.),
45 fChi2MatchTrigger(0.),
46 fRabsEnd(0.),
47 fSelMask(0)
48 {
49   //
50   // default constructor
51   //
52   for (Int_t i=3; i--;) fDCA[i]=0.;
53 }
54
55 //-----------------------------------------------------------------------------
56 AliMuonInfoStoreRD::AliMuonInfoStoreRD(AliAODTrack *trk, UInt_t selMask) :
57 TObject(),
58 fMomentumAtVtx(),
59 fMomentumAtDCA(),
60 fMomentumUncor(),
61 fCharge(0),
62 fMatchTrigger(-1),
63 fChi2FitMomentum(0.),
64 fChi2MatchTrigger(0.),
65 fRabsEnd(0.),
66 fSelMask(selMask)
67 {
68   //
69   // AOD-base constructor
70   //
71   for (Int_t i=3; i--;) fDCA[i]=0.;
72   this->FillMuonInfo(trk);
73 }
74
75 //-----------------------------------------------------------------------------
76 AliMuonInfoStoreRD::AliMuonInfoStoreRD(AliESDMuonTrack *trk, UInt_t selMask) :
77 TObject(),
78 fMomentumAtVtx(),
79 fMomentumAtDCA(),
80 fMomentumUncor(),
81 fCharge(0),
82 fMatchTrigger(-1),
83 fChi2FitMomentum(0.),
84 fChi2MatchTrigger(0.),
85 fRabsEnd(0.),
86 fSelMask(selMask)
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 fMomentumAtVtx(src.fMomentumAtVtx),
99 fMomentumAtDCA(src.fMomentumAtDCA),
100 fMomentumUncor(src.fMomentumUncor),
101 fCharge(src.fCharge),
102 fMatchTrigger(src.fMatchTrigger),
103 fChi2FitMomentum(src.fChi2FitMomentum),
104 fChi2MatchTrigger(src.fChi2MatchTrigger),
105 fRabsEnd(src.fRabsEnd),
106 fSelMask(src.fSelMask)
107 {
108   //
109   // copy constructor
110   //
111   for (Int_t i=3; i--;) fDCA[i]=src.fDCA[i];
112 }
113
114 //-----------------------------------------------------------------------------
115 AliMuonInfoStoreRD& AliMuonInfoStoreRD::operator=(const AliMuonInfoStoreRD &src)
116 {
117   //
118   // assignment constructor
119   //
120   if(&src==this) return *this;
121
122   fMomentumAtVtx    = src.fMomentumAtVtx;
123   fMomentumAtDCA    = src.fMomentumAtDCA;
124   fMomentumUncor    = src.fMomentumUncor;
125   fCharge           = src.fCharge;
126   fMatchTrigger     = src.fMatchTrigger;
127   fChi2FitMomentum  = src.fChi2FitMomentum;
128   fChi2MatchTrigger = src.fChi2MatchTrigger;
129   fRabsEnd          = src.fRabsEnd;
130   fSelMask          = src.fSelMask;
131
132   for (Int_t i=3; i--;) fDCA[i]=src.fDCA[i];
133
134   return *this;
135 }
136
137 //-----------------------------------------------------------------------------
138 AliMuonInfoStoreRD::~AliMuonInfoStoreRD()
139 {
140   //
141   // destructor
142   //
143 }
144
145 //-----------------------------------------------------------------------------
146 void AliMuonInfoStoreRD::FillMuonInfo(AliAODTrack *trk)
147 {
148   // extract reco info of muon track from AOD
149
150   Double_t arr[3];
151   trk->PxPyPz(arr);      this->SetMomentumAtVtx(arr);
152   trk->PxPyPzAtDCA(arr); this->SetMomentumAtDCA(arr);
153   trk->XYZAtDCA(arr);    this->SetDCA(arr);
154   this->SetCharge(trk->Charge());
155   this->SetMatchTrigger(trk->GetMatchTrigger());
156   this->SetChi2FitMomentum(trk->Chi2perNDF());
157   this->SetChi2MatchTrigger(trk->GetChi2MatchTrigger());
158   this->SetRabsEnd(trk->GetRAtAbsorberEnd());
159   return;
160 }
161
162
163 //-----------------------------------------------------------------------------
164 void AliMuonInfoStoreRD::FillMuonInfo(AliESDMuonTrack *trk)
165 {
166   // extract reco info of muon track from ESD
167
168   Double_t arr[3];
169   arr[0]=trk->Px();                     arr[1]=trk->Py();                  arr[2]=trk->Pz();            this->SetMomentumAtVtx(arr);
170   arr[0]=trk->PxAtDCA();                arr[1]=trk->PyAtDCA();             arr[2]=trk->PzAtDCA();       this->SetMomentumAtDCA(arr);
171   arr[0]=trk->PxUncorrected();          arr[1]=trk->PyUncorrected();       arr[2]=trk->PzUncorrected(); this->SetMomentumUncor(arr);
172   arr[0]=trk->GetNonBendingCoorAtDCA(); arr[1]=trk->GetBendingCoorAtDCA(); arr[2]=trk->GetZ();          this->SetDCA(arr);
173   this->SetCharge(trk->Charge());
174   this->SetMatchTrigger(trk->GetMatchTrigger());
175   this->SetChi2FitMomentum(trk->GetChi2()/(2.*trk->GetNHit()-5.));
176   this->SetChi2MatchTrigger(trk->GetChi2MatchTrigger());
177   this->SetRabsEnd(trk->GetRAtAbsorberEnd());
178   return;
179 }