]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FEMTOSCOPY/AliFemtoUser/AliFemtoPairCutAntiGamma.cxx
Fix Coverity 115811-27, 14756-822 14472
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemtoUser / AliFemtoPairCutAntiGamma.cxx
1 /////////////////////////////////////////////////////////////////////////////
2 //                                                                         //
3 // AliFemtoPairCutAntiGamma - a pair cut which checks     //
4 // for some pair qualities that attempt to identify slit/doubly            //
5 // reconstructed tracks and also selects pairs based on their separation   //
6 // at the entrance to the TPC                                              //
7 //                                                                         //
8 /////////////////////////////////////////////////////////////////////////////
9 /***************************************************************************
10  *
11  * $Id: AliFemtoPairCutAntiGamma.cxx,v 1.1.2.1 2007/10/19 13:35:33 akisiel Exp $
12  *
13  * Author: Adam Kisiel, Ohio State, kisiel@mps.ohio-state.edu
14  ***************************************************************************
15  *
16  * Description: part of STAR HBT Framework: AliFemtoMaker package
17  *   a cut to remove "shared" and "split" pairs
18  *
19  ***************************************************************************
20  *
21  *
22  **************************************************************************/
23
24 #include "AliFemtoPairCutAntiGamma.h"
25 #include <string>
26 #include <cstdio>
27 #include <TMath.h>
28
29 #ifdef __ROOT__
30 ClassImp(AliFemtoPairCutAntiGamma)
31 #endif
32
33 //__________________
34 AliFemtoPairCutAntiGamma::AliFemtoPairCutAntiGamma():
35   AliFemtoShareQualityPairCut(),
36   fMaxEEMinv(0.0),
37   fMaxDTheta(0.0)
38 {
39 }
40 //__________________
41 AliFemtoPairCutAntiGamma::AliFemtoPairCutAntiGamma(const AliFemtoPairCutAntiGamma& c) : 
42   AliFemtoShareQualityPairCut(c),
43   fMaxEEMinv(0.0),
44   fMaxDTheta(0.0)
45
46   fMaxEEMinv = c.fMaxEEMinv;
47   fMaxDTheta = c.fMaxDTheta;
48 }
49
50 //__________________
51 AliFemtoPairCutAntiGamma::~AliFemtoPairCutAntiGamma(){
52   /* no-op */
53 }
54 //__________________
55 bool AliFemtoPairCutAntiGamma::Pass(const AliFemtoPair* pair){
56   // Accept pairs based on their TPC entrance separation and
57   // quality and sharity
58   bool temp = true;
59
60   double me = 0.000511;
61
62   if ((pair->Track1()->Track()->Charge() * pair->Track2()->Track()->Charge()) < 0.0) {
63     double theta1 = pair->Track1()->Track()->P().Theta();
64     double theta2 = pair->Track2()->Track()->P().Theta();
65     double dtheta = TMath::Abs(theta1 - theta2);
66     
67     double e1 = TMath::Sqrt(me*me + pair->Track1()->Track()->P().Mag2());
68     double e2 = TMath::Sqrt(me*me + pair->Track2()->Track()->P().Mag2());
69     
70     double minv = 2*me*me + 2*(e1*e2 - 
71                                pair->Track1()->Track()->P().x()*pair->Track2()->Track()->P().x() -
72                                pair->Track1()->Track()->P().y()*pair->Track2()->Track()->P().y() -
73                                pair->Track1()->Track()->P().z()*pair->Track2()->Track()->P().z());
74     
75     if ((minv < fMaxEEMinv) && (dtheta < fMaxDTheta)) temp = false;
76   }
77
78   if (temp) {
79     temp = AliFemtoShareQualityPairCut::Pass(pair);
80     if (temp) fNPairsPassed++;
81     else fNPairsFailed++;
82   }
83   else
84     fNPairsFailed++;
85
86   return temp;
87 }
88 //__________________
89 AliFemtoString AliFemtoPairCutAntiGamma::Report(){
90   // Prepare a report from the execution
91   string stemp = "AliFemtoPairCutAntiGamma Pair Cut - remove pairs possibly coming from Gamma conversions\n";  
92   char ctemp[100];
93   stemp += ctemp;
94   snprintf(ctemp , 100, "Number of pairs which passed:\t%ld  Number which failed:\t%ld\n",fNPairsPassed,fNPairsFailed);
95   stemp += ctemp;
96   AliFemtoString returnThis = stemp;
97   return returnThis;}
98 //__________________
99
100 TList *AliFemtoPairCutAntiGamma::ListSettings()
101 {
102   // return a list of settings in a writable form
103   TList *tListSetttings =  AliFemtoShareQualityPairCut::ListSettings();
104   char buf[200];
105   snprintf(buf, 200, "AliFemtoPairCutAntiGamma.maxeeminv=%f", fMaxEEMinv);
106   snprintf(buf, 200, "AliFemtoPairCutAntiGamma.maxdtheta=%f", fMaxDTheta);
107   tListSetttings->AddLast(new TObjString(buf));
108
109   return tListSetttings;
110 }
111
112 void AliFemtoPairCutAntiGamma::SetMaxEEMinv(Double_t maxeeminv)
113 {
114   fMaxEEMinv = maxeeminv;
115 }
116
117  
118 void AliFemtoPairCutAntiGamma::SetMaxThetaDiff(Double_t maxdtheta)
119 {
120   fMaxDTheta = maxdtheta;
121 }