]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/RESONANCES/AliRsnCutPhi.cxx
Updated macros for lego_train phi analysis (mvala)
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / AliRsnCutPhi.cxx
CommitLineData
1ce2618c 1#include "AliRsnCutPhi.h"
2
3ClassImp(AliRsnCutPhi)
4
5AliRsnCutPhi::AliRsnCutPhi() :
6 AliRsnCut("cut", AliRsnTarget::kDaughter),
7 fOption("")
8{
9 //Default constructor
10 SetPhiRange(0.0, 360.0);
11}
12
13//_________________________________________________________________________________________________
14AliRsnCutPhi::AliRsnCutPhi(const char *name, TString opt) :
15 AliRsnCut(name, AliRsnTarget::kDaughter),
16 fOption(opt.Data())
17{
18 //main constructor
19 SetPhiRange(0.0, 360.0);
20}
21
22//_________________________________________________________________________________________________
23AliRsnCutPhi::AliRsnCutPhi(const AliRsnCutPhi &copy) :
24 AliRsnCut(copy),
25 fOption(copy.fOption)
26{
27 //copy constructor
28 SetPhiRange(copy.fPhiRange[0], copy.fPhiRange[1]);
29}
30//_________________________________________________________________________________________________
31AliRsnCutPhi &AliRsnCutPhi::operator=(const AliRsnCutPhi &copy)
32{
33 //
34 // operator =
35 //
36 AliRsnCut::operator=(copy);
37 if (this == &copy)
38 return *this;
39
40 fOption=copy.fOption;
41 SetPhiRange(copy.fPhiRange[0], copy.fPhiRange[1]);
42 return (*this);
43}
44//_________________________________________________________________________________________________
45Bool_t AliRsnCutPhi::IsSelected(TObject *object)
46{
47 //
48 // Checks if the track passes the phi cut
49 //
50 Bool_t accept = kFALSE;
51 if (!TargetOK(object)) return accept;
52
53 AliVTrack *vtrack = fDaughter->Ref2Vtrack();
54 if (!vtrack) {
55 AliError("Referenced daughter is not a track");
56 return accept;
57 }
58
59 if (fOption.Contains("InTRD")) return IsInsideTRD(vtrack);
60 if (fOption.Contains("OutTRD")) return IsOutsideTRD(vtrack);
61
62 Double_t value = 90.0;
63 if (fOption.Contains("OuterTPC")) value = GetTrackPhi(vtrack, 278.0);
64 if (fOption.Contains("InnerTOF")) value = GetTrackPhi(vtrack, 378.0);
65
66 if ( (value>=fPhiRange[0]) && (value<=fPhiRange[1]) )
67 accept = kTRUE;
68 else
69 accept = kFALSE;
70
71 return accept;
72}
73
74//_________________________________________________________________________________________________
75Bool_t AliRsnCutPhi::IsInsideTRD(AliVTrack *vtrack)
76{
77 //
78 // Checks if track falls inside the TRD sectors
79 // implemented for 2010 configuration only
80 // edge effects removed by tightening the phi cut by 5 deg
81 //
82 Bool_t accept = kFALSE;
83 if (!vtrack) {
84 AliError("Referenced daughter is not a track");
85 return accept;
86 }
87 Double_t value = GetTrackPhi(vtrack, 278.0);
88 if ( ((value>=0.0) && (value<=35.0)) ||
89 ((value>=135.0) && (value<=215.0)) ||
90 ((value>=345.0) && (value<=360.0)) )
91 accept = kTRUE;
92 else
93 accept = kFALSE;
94 return accept;
95}
96//_________________________________________________________________________________________________
97Bool_t AliRsnCutPhi::IsOutsideTRD(AliVTrack *vtrack)
98{
99 //
100 // Checks if track falls inside the TRD sectors
101 // implemented for 2010 configuration only
102 // edge effects removed by tightening the phi cut by 5 deg
103 //
104 Bool_t accept = kFALSE;
105 if (!vtrack) {
106 AliError("Referenced daughter is not a track");
107 return accept;
108 }
109 Double_t value = GetTrackPhi(vtrack, 278.0);
110 if ( ((value>=45.0) && (value<=125.0)) ||
111 ((value>=225.0) && (value<=335.0)) )
112 accept = kTRUE;
113 else
114 accept = kFALSE;
115 return accept;
116}
117
118//----------------------------------------------------------------------------
119Double_t AliRsnCutPhi::GetTrackPhi(AliVTrack * vtrack, Double_t radius = 0.0)
120{
121 //
122 // Extract phi from vtrack object at radius r
123 // If r==0 (default), provides phi at vertex
124 //
125 Double_t pos[3]={0.,0.,0.};
126 Double_t phiOut = -999.0;
127
128 if (!vtrack) {
129 AliError("Invalid VTrack object");
130 return phiOut;
131 }
132 if (radius==0.0){
133 phiOut=vtrack->Phi()*TMath::RadToDeg();
134 } else {
135 AliExternalTrackParam etp;
136 etp.CopyFromVTrack(vtrack);
137 if(etp.GetXYZAt(radius, 5., pos)){
138 phiOut=TMath::ATan2(pos[1],pos[0])*TMath::RadToDeg();
139 if (phiOut<0) phiOut+= (2*TMath::Pi()*TMath::RadToDeg());
140 }
141 }
142 return phiOut;
143}