Keep e+e- from pair production of primary gammas.
[u/mrichter/AliRoot.git] / PWG3 / muon / AliAODMuonTrack.cxx
1 #include <TObject.h>
2 #include <TDatabasePDG.h>
3 #include <TLorentzVector.h>
4 #include <TClonesArray.h>
5
6 #include "AliAODTrack.h"
7 #include "AliESDMuonTrack.h"
8 #include "AliMCMuonTrack.h"
9 #include "AliAODMuonTrack.h"
10
11 ClassImp(AliAODMuonTrack)
12
13 //-----------------------------------------------------------------------------
14 AliAODMuonTrack::AliAODMuonTrack() :
15 TObject(),
16 fP(),
17 fCharge(0),
18 fTrigger(0),
19 fDca(0.),
20 fChi2(0.),
21 fCentr(0.)
22 {
23   //
24   // default constructor
25   //
26 }
27
28 //-----------------------------------------------------------------------------
29 AliAODMuonTrack::AliAODMuonTrack(AliAODTrack *trk) :
30 TObject(),
31 fP(),
32 fCharge(0),
33 fTrigger(0),
34 fDca(0.),
35 fChi2(0.),
36 fCentr(0.)
37 {
38   //
39   // default constructor
40   //
41  this->FillTrackInfo(trk);
42 }
43
44 //-----------------------------------------------------------------------------
45 AliAODMuonTrack::AliAODMuonTrack(AliESDMuonTrack *trk) :
46 TObject(),
47 fP(),
48 fCharge(0),
49 fTrigger(0),
50 fDca(0.),
51 fChi2(0.),
52 fCentr(0.)
53 {
54   //
55   // default constructor
56   //
57  this->FillTrackInfo(trk);
58 }
59
60 //-----------------------------------------------------------------------------
61 AliAODMuonTrack::~AliAODMuonTrack()
62 {
63   //
64   // destructor
65   //
66 }
67
68 //-----------------------------------------------------------------------------
69 void AliAODMuonTrack::FillTrackInfo(AliAODTrack *trk)
70 {
71   Double_t mMu    = TDatabasePDG::Instance()->GetParticle(13)->Mass();
72   Double_t px     = trk->Px();
73   Double_t py     = trk->Py();
74   Double_t pz     = trk->Pz();
75   Double_t energy = TMath::Sqrt(mMu*mMu + px*px + py*py + pz*pz);
76   fP.SetPxPyPzE(px,py,pz,energy);
77   fCharge = trk->Charge();
78   fTrigger = trk->GetMatchTrigger();
79   fDca = trk->DCA();
80   fChi2 = trk->Chi2perNDF();
81   return;
82 }
83
84 //-----------------------------------------------------------------------------
85 void AliAODMuonTrack::FillTrackInfo(AliESDMuonTrack *trk)
86 {
87   trk->LorentzP(fP);
88   fCharge = trk->Charge();
89   fTrigger = trk->GetMatchTrigger();
90   fDca = trk->GetDCA();
91   fChi2 = trk->GetChi2()/(2.*trk->GetNHit()-5.);
92   return;
93 }
94
95 //-----------------------------------------------------------------------------
96 Bool_t AliAODMuonTrack::SelectSingleMuon(Double_t cuts[10])
97 {
98   TLorentzVector lorentzP = this->GetP();
99   Double_t p = lorentzP.P();
100   if (p<cuts[0] || (p>cuts[1])) return kFALSE;
101
102   Double_t pt = lorentzP.Pt();
103   if (pt<cuts[2] || pt>cuts[3]) return kFALSE;
104
105   Double_t eta = lorentzP.Eta();
106   if (eta<cuts[4] || eta>cuts[5]) return kFALSE;
107
108   Double_t dca = this->GetDCA();
109   if (dca<cuts[6] || dca>cuts[7]) return kFALSE;
110
111   Int_t trigger = this->GetTrigger();
112   if (trigger<cuts[8] || trigger>cuts[9]) return kFALSE;
113
114   return kTRUE;
115 }