]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FEMTOSCOPY/AliFemto/AliFemtoKTPairCut.cxx
Migration of PWG2/FEMTOSCOPY to PWGCF/FEMTOSCOPY
[u/mrichter/AliRoot.git] / PWGCF / 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 AliFemtoKTPairCut& AliFemtoKTPairCut::operator=(const AliFemtoKTPairCut& c)
77 {
78   if (this != &c) {
79     fKTMin = c.fKTMin;
80     fKTMax = c.fKTMax;
81     fPhiMin = c.fPhiMin;
82     fPhiMax = c.fPhiMax;
83     fPtMin = c.fPtMin;
84     fPtMax = c.fPtMax;
85   }
86
87   return *this;
88 }
89 //__________________
90 /*bool AliFemtoKTPairCut::Pass(const AliFemtoPair* pair){
91   bool temp = true;
92   
93   if (pair->KT() < fKTMin)
94     temp = false;
95
96   if (pair->KT() > fKTMax)
97     temp = false;
98
99   return temp;
100 }*/
101 //__________________
102 AliFemtoString AliFemtoKTPairCut::Report(){
103   // Prepare a report from the execution
104   string stemp = "AliFemtoKT Pair Cut \n";  char ctemp[100];
105   snprintf(ctemp , 100, "Accept pair with kT in range %f , %f",fKTMin,fKTMax);
106   snprintf(ctemp , 100, "Accept pair with angle in range %f , %f",fPhiMin,fPhiMax);
107   stemp += ctemp;
108   AliFemtoString returnThis = stemp;
109   return returnThis;}
110 //__________________
111
112 TList *AliFemtoKTPairCut::ListSettings()
113 {
114   // return a list of settings in a writable form
115   TList *tListSetttings =  new TList();
116   char buf[200];
117   snprintf(buf, 200, "AliFemtoKTPairCut.ktmax=%f", fKTMax);
118   tListSetttings->AddLast(new TObjString(buf));
119   snprintf(buf, 200, "AliFemtoKTPairCut.ktmin=%f", fKTMin);
120   tListSetttings->AddLast(new TObjString(buf));
121   snprintf(buf, 200, "AliFemtoKTPairCut.phimax=%f", fPhiMax);
122   tListSetttings->AddLast(new TObjString(buf));
123   snprintf(buf, 200, "AliFemtoKTPairCut.phimin=%f", fPhiMin);
124   tListSetttings->AddLast(new TObjString(buf));
125   snprintf(buf, 200, "AliFemtoKTPairCut.ptmin=%f", fPtMin);
126   tListSetttings->AddLast(new TObjString(buf));
127   snprintf(buf, 200, "AliFemtoKTPairCut.ptmax=%f", fPtMax);
128   tListSetttings->AddLast(new TObjString(buf));
129
130   return tListSetttings;
131 }
132
133 void AliFemtoKTPairCut::SetKTRange(double ktmin, double ktmax)
134 {
135   fKTMin = ktmin;
136   fKTMax = ktmax;
137 }
138
139 void AliFemtoKTPairCut::SetPhiRange(double phimin, double phimax)
140 {
141   fPhiMin = phimin;
142   fPhiMax = phimax;
143 }
144
145 void AliFemtoKTPairCut::SetPTMin(double ptmin, double ptmax)
146 {
147   fPtMin = ptmin;
148   fPtMax = ptmax;
149 }
150
151 //______________________________________________________
152 bool AliFemtoKTPairCut::Pass(const AliFemtoPair* pair)
153 {
154   bool temp = true;
155
156 //Taking care of the Kt cut
157   if (pair->KT() < fKTMin)
158     temp = false;
159
160   if (pair->KT() > fKTMax)
161     temp = false;
162
163   if (!temp) return temp;
164
165   if ((fPtMin > 0.0) || (fPtMax<1000.0)) {
166 //     double px1 = pair->Track1()->Track()->P().x();
167 //     double py1 = pair->Track1()->Track()->P().y();
168
169 //     double px2 = pair->Track2()->Track()->P().x();
170 //     double py2 = pair->Track2()->Track()->P().y();
171     
172 //     double pt1 = TMath::Hypot(px1, py1);
173 //     double pt2 = TMath::Hypot(px2, py2);
174     
175 //     if ((pt1<fPtMin) || (pt1>fPtMax)) return false;
176 //     if ((pt2<fPtMin) || (pt2>fPtMax)) return false;
177     if ((pair->Track1()->Track()->Pt()<fPtMin) || (pair->Track1()->Track()->Pt()>fPtMax)) return false;
178     if ((pair->Track2()->Track()->Pt()<fPtMin) || (pair->Track2()->Track()->Pt()>fPtMax)) return false;
179   }
180
181 //Taking care of the Phi cut
182 //   double rpangle = (pair->GetPairAngleEP())*180/TMath::Pi();
183   double rpangle = pair->GetPairAngleEP();
184
185   if (rpangle > 180.0) rpangle -= 180.0;
186   if (rpangle < 0.0) rpangle += 180.0;
187   
188   if (fPhiMin < 0) {
189     if ((rpangle > fPhiMax) && (rpangle < 180.0+fPhiMin)) 
190       temp = false;
191   }
192   else {
193     if ((rpangle < fPhiMin) || (rpangle > fPhiMax))
194       temp = false;
195   }
196   return temp;
197 }
198
199 //_____________________________________
200 bool AliFemtoKTPairCut::Pass(const AliFemtoPair* pair, double aRPAngle)
201 {
202 //The same as above, but it is defined with RP Angle as input in all the Correlatin function classes.
203
204   bool temp = (aRPAngle > 0.);
205   aRPAngle = true;
206    
207   if (!Pass(pair))
208         temp = false;
209
210   return temp;
211 }