]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FEMTOSCOPY/AliFemto/AliFemtoKTPairCut.cxx
AliCentrality for ESD and AOD analysis
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemto / AliFemtoKTPairCut.cxx
1 /////////////////////////////////////////////////////////////////////////////
2 //                                                                         //
3 // AliFemtoKTPairCut - a pair cut which selects pairs based on their       //
4 // transverse momentum kT                                                  //
5 //                                                                         //
6 /////////////////////////////////////////////////////////////////////////////
7 /***************************************************************************
8  *
9  * $Id: AliFemtoKTPairCut.cxx,v 1.1.2.2 2007/11/09 11:20:35 akisiel Exp $
10  *
11  * Author: Adam Kisiel, Ohio State, kisiel@mps.ohio-state.edu
12  ***************************************************************************
13  *
14  * Description: part of STAR HBT Framework: AliFemtoMaker package
15  *   a cut to remove "shared" and "split" pairs
16  *
17  ***************************************************************************
18  *
19  *
20  **************************************************************************/
21 #include "AliFemtoKTPairCut.h"
22 #include <string>
23 #include <cstdio>
24 #include <TMath.h>
25
26 #ifdef __ROOT__
27 ClassImp(AliFemtoKTPairCut)
28 #endif
29
30 //__________________
31 AliFemtoKTPairCut::AliFemtoKTPairCut():
32   AliFemtoPairCut(),
33   fKTMin(0),
34   fKTMax(1.0e6),
35   fPhiMin(0),
36   fPhiMax(360.0),
37   fPtMin(0.0),
38   fPtMax(1000.0)
39 {
40   fKTMin = 0;
41    fKTMax = 1.0e6;
42 }
43 //__________________
44 AliFemtoKTPairCut::AliFemtoKTPairCut(double lo, double hi) :
45   AliFemtoPairCut(),
46   fKTMin(lo),
47   fKTMax(hi),
48   fPhiMin(0),
49   fPhiMax(360),
50   fPtMin(0.0),
51   fPtMax(1000.0)
52 {
53 }
54 //__________________
55 AliFemtoKTPairCut::AliFemtoKTPairCut(const AliFemtoKTPairCut& c) : 
56   AliFemtoPairCut(c),
57   fKTMin(0),
58   fKTMax(1.0e6),
59   fPhiMin(0),
60   fPhiMax(360),
61   fPtMin(0.0),
62   fPtMax(1000.0)
63
64   fKTMin = c.fKTMin;
65   fKTMax = c.fKTMax;
66   fPhiMin = c.fPhiMin;
67   fPhiMax = c.fPhiMax;
68   fPtMin = c.fPtMin;
69   fPtMax = c.fPtMax;
70 }
71
72 //__________________
73 AliFemtoKTPairCut::~AliFemtoKTPairCut(){
74   /* no-op */
75 }
76 //__________________
77 /*bool AliFemtoKTPairCut::Pass(const AliFemtoPair* pair){
78   bool temp = true;
79   
80   if (pair->KT() < fKTMin)
81     temp = false;
82
83   if (pair->KT() > fKTMax)
84     temp = false;
85
86   return temp;
87 }*/
88 //__________________
89 AliFemtoString AliFemtoKTPairCut::Report(){
90   // Prepare a report from the execution
91   string stemp = "AliFemtoKT Pair Cut \n";  char ctemp[100];
92   sprintf(ctemp,"Accept pair with kT in range %f , %f",fKTMin,fKTMax);
93   sprintf(ctemp,"Accept pair with angle in range %f , %f",fPhiMin,fPhiMax);
94   stemp += ctemp;
95   AliFemtoString returnThis = stemp;
96   return returnThis;}
97 //__________________
98
99 TList *AliFemtoKTPairCut::ListSettings()
100 {
101   // return a list of settings in a writable form
102   TList *tListSetttings =  new TList();
103   char buf[200];
104   snprintf(buf, 200, "AliFemtoKTPairCut.ktmax=%f", fKTMax);
105   tListSetttings->AddLast(new TObjString(buf));
106   snprintf(buf, 200, "AliFemtoKTPairCut.ktmin=%f", fKTMin);
107   tListSetttings->AddLast(new TObjString(buf));
108   snprintf(buf, 200, "AliFemtoKTPairCut.phimax=%f", fPhiMax);
109   tListSetttings->AddLast(new TObjString(buf));
110   snprintf(buf, 200, "AliFemtoKTPairCut.phimin=%f", fPhiMin);
111   tListSetttings->AddLast(new TObjString(buf));
112   snprintf(buf, 200, "AliFemtoKTPairCut.ptmin=%f", fPtMin);
113   tListSetttings->AddLast(new TObjString(buf));
114   snprintf(buf, 200, "AliFemtoKTPairCut.ptmax=%f", fPtMax);
115   tListSetttings->AddLast(new TObjString(buf));
116
117   return tListSetttings;
118 }
119
120 void AliFemtoKTPairCut::SetKTRange(double ktmin, double ktmax)
121 {
122   fKTMin = ktmin;
123   fKTMax = ktmax;
124 }
125
126 void AliFemtoKTPairCut::SetPhiRange(double phimin, double phimax)
127 {
128   fPhiMin = phimin;
129   fPhiMax = phimax;
130 }
131
132 void AliFemtoKTPairCut::SetPTMin(double ptmin, double ptmax)
133 {
134   fPtMin = ptmin;
135   fPtMax = ptmax;
136 }
137
138 //______________________________________________________
139 bool AliFemtoKTPairCut::Pass(const AliFemtoPair* pair)
140 {
141   bool temp = true;
142
143 //Taking care of the Kt cut
144   if (pair->KT() < fKTMin)
145     temp = false;
146
147   if (pair->KT() > fKTMax)
148     temp = false;
149
150   if (!temp) return temp;
151
152   if ((fPtMin > 0.0) && (fPtMax<1000.0)) {
153     double px1 = pair->Track1()->Track()->P().x();
154     double py1 = pair->Track1()->Track()->P().y();
155
156     double px2 = pair->Track2()->Track()->P().x();
157     double py2 = pair->Track2()->Track()->P().y();
158     
159     double pt1 = TMath::Hypot(px1, py1);
160     double pt2 = TMath::Hypot(px2, py2);
161     
162     if ((pt1<fPtMin) || (pt1>fPtMax)) return false;
163     if ((pt2<fPtMin) || (pt2>fPtMax)) return false;
164   }
165
166 //Taking care of the Phi cut
167   double rpangle = (pair->GetPairAngleEP())*180/TMath::Pi();
168
169   if (rpangle > 180.0) rpangle -= 180.0;
170   if (rpangle < 0.0) rpangle += 180.0;
171
172   if (fPhiMin < 0) {
173     if ((rpangle > fPhiMax) && (rpangle < 180.0+fPhiMin)) 
174       temp = false;
175   }
176   else {
177     if ((rpangle < fPhiMin) || (rpangle > fPhiMax))
178       temp = false;
179   }
180   return temp;
181 }
182
183 //_____________________________________
184 bool AliFemtoKTPairCut::Pass(const AliFemtoPair* pair, double aRPAngle)
185 {
186 //The same as above, but it is defined with RP Angle as input in all the Correlatin function classes.
187
188   bool temp = (aRPAngle > 0.);
189   aRPAngle = true;
190    
191   if (!Pass(pair))
192         temp = false;
193
194   return temp;
195 }