Lines getting the matched track moved to a method in AliCalorimeterUtils. Lines copie...
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemto / AliFemtoBasicTrackCut.cxx
1 ////////////////////////////////////////////////////////////////////////////////
2 //                                                                            //
3 // AliFemtoBasicTrackCut - the basic cut for tracks.                          //
4 // Cuts on particle identification, transverse momentum, rapidity, distance   //
5 // of closest approach to primary vertex and charge                           //
6 //                                                                            //
7 ////////////////////////////////////////////////////////////////////////////////
8
9 #include "AliFemtoBasicTrackCut.h"
10 #include <cstdio>
11
12 #ifdef __ROOT__ 
13 ClassImp(AliFemtoBasicTrackCut)
14 #endif
15
16 AliFemtoBasicTrackCut::AliFemtoBasicTrackCut():
17   fCharge(0),
18   fNTracksPassed(0),
19   fNTracksFailed(0)
20 {
21   // Default constructor
22   fNTracksPassed = fNTracksFailed = 0;
23   fCharge = 1;  // takes both charges 0
24   fNSigmaPion[0] = -100.0;   fNSigmaPion[1] = 100.0;
25   fNSigmaKaon[0] = -100.0;   fNSigmaKaon[1] = 100.0;
26   fNSigmaProton[0] = -100.0; fNSigmaProton[1] = 100.0;
27   fNHits[0] = 10;          fNHits[1] = 180;
28   fPt[0]=0.0;              fPt[1] = 100.0;//100
29   fRapidity[0]=-2;       fRapidity[1]=2;//-2 2
30   fDCA[0] = -1.0;           fDCA[1] = 20.0;
31
32 }
33 //------------------------------
34 //AliFemtoBasicTrackCut::~AliFemtoBasicTrackCut(){
35 //  /* noop */
36 //}
37 //------------------------------
38 bool AliFemtoBasicTrackCut::Pass(const AliFemtoTrack* track){
39   // test the particle and return 
40   // true if it meets all the criteria
41   // false if it doesn't meet at least one of the criteria
42
43   //  return true ;  // THIS CUT IS A STHBTDUMMY!!
44
45   /*
46     cout << endl;
47     cout << "#track " << trackCount++;
48     cout << " * pion " << (track->NSigmaPion() > fNSigmaPion[0]) && (track->NSigmaPion() < fNSigmaPion[1]);
49     cout << " * kaon " << (track->NSigmaKaon() > fNSigmaKaon[0]) && (track->NSigmaKaon() < fNSigmaKaon[1]);
50     cout << " * proton " << (track->NSigmaProton() > fNSigmaProton[0]) && (track->NSigmaProton() < fNSigmaProton[1]);
51     cout << " * charge " << (track->Charge() == fCharge);
52   */
53   bool goodPID = 1;  
54   /* ----- NOT DOING PID CUTS !!!! ------
55   bool goodPID = ((track->NSigmaPion()   > fNSigmaPion[0]) &&
56                   (track->NSigmaPion()   < fNSigmaPion[1]) &&
57                   (track->NSigmaKaon()   > fNSigmaKaon[0]) &&
58                   (track->NSigmaKaon()   < fNSigmaKaon[1]) &&
59                   (track->NSigmaProton() > fNSigmaProton[0]) &&
60                   (track->NSigmaProton() < fNSigmaProton[1]));
61   ----- NOT DOING PID CUTS !!!! ------ */
62   if (fCharge !=0){               // if user requests "charge=0" then that means ignore charge
63     goodPID = (goodPID&&(track->Charge() == fCharge));
64   }
65   if (goodPID){
66     float tEnergy = ::sqrt(track->P().Mag2()+fMass*fMass);
67     float tRapidity = 0.5*::log((tEnergy+track->P().z())/
68                             (tEnergy-track->P().z()));
69
70     float tPt = ::sqrt((track->P().x())*(track->P().x())+
71                     (track->P().y())*(track->P().y()));
72
73     
74     /*
75       cout << " * DCAxy " << (track->DCAxy()  > fDCA[0]) && (track->DCAxy()  < fDCA[1]);
76       cout << " * fDCA[0] " << fDCA[0];
77       cout << " * fDCA[1] " << fDCA[1];
78       cout << " * track->DCAxy " << track->DCAxy();
79       cout << " * NHits " <<  (track->NHits() > fNHits[0]) && (track->NHits() < fNHits[1]); 
80       cout << " * tPt " << (tPt > fPt[0]) && (tPt < fPt[1]);
81       cout << " * y " << (tRapidity > fRapidity[0]) && (tRapidity < fRapidity[1]);
82       cout << endl;
83     */
84
85     bool goodTrack=
86       (//(track->DCAxy()  > fDCA[0]) &&
87      //  (track->DCAxy()  < fDCA[1]) &&
88   //     (track->NHits() > fNHits[0]) &&
89     //   (track->NHits() < fNHits[1]) &&
90        (tPt             > fPt[0]) &&
91        (tPt             < fPt[1]) &&
92        (tRapidity      > fRapidity[0]) &&
93        (tRapidity      < fRapidity[1]));
94     //  &&
95     //       (track->PidProbPion()>0.5)&&//moje
96     //       (track->PidProbMuon()<0.47)&&//moje
97     //       (track->Label()>0);//moje
98
99     //    cout << track->DCAxy() << " " << track->NHits() << " " << Pt << " " << tRapidity << " " << tEnergy << endl;
100
101     goodTrack ? fNTracksPassed++ : fNTracksFailed++;
102     return (goodTrack);
103   }
104   else{
105     fNTracksFailed++;
106     return (goodPID);
107   }
108 }
109 //------------------------------
110 AliFemtoString AliFemtoBasicTrackCut::Report(){
111   // construct report
112   string tStemp;
113   char tCtemp[100];
114   snprintf(tCtemp , 100, "Particle mass:\t%E\n",this->Mass());
115   tStemp=tCtemp;
116   snprintf(tCtemp , 100, "Particle charge:\t%d\n",fCharge);
117   tStemp=tCtemp;
118   snprintf(tCtemp , 100, "Particle Nsigma from pion:\t%E - %E\n",fNSigmaPion[0],fNSigmaPion[1]);
119   tStemp+=tCtemp;
120   snprintf(tCtemp , 100, "Particle Nsigma from kaon:\t%E - %E\n",fNSigmaKaon[0],fNSigmaKaon[1]);
121   tStemp+=tCtemp;
122   snprintf(tCtemp , 100, "Particle Nsigma from proton:\t%E - %E\n",fNSigmaProton[0],fNSigmaProton[1]);
123   tStemp+=tCtemp;
124   snprintf(tCtemp , 100, "Particle #hits:\t%d - %d\n",fNHits[0],fNHits[1]);
125   tStemp+=tCtemp;
126   snprintf(tCtemp , 100, "Particle pT:\t%E - %E\n",fPt[0],fPt[1]);
127   tStemp+=tCtemp;
128   snprintf(tCtemp , 100, "Particle rapidity:\t%E - %E\n",fRapidity[0],fRapidity[1]);
129   tStemp+=tCtemp;
130   snprintf(tCtemp , 100, "Particle DCA:\t%E - %E\n",fDCA[0],fDCA[1]);
131   tStemp+=tCtemp;
132   snprintf(tCtemp , 100, "Number of tracks which passed:\t%ld  Number which failed:\t%ld\n",fNTracksPassed,fNTracksFailed);
133   tStemp += tCtemp;
134   AliFemtoString returnThis = tStemp;
135   return returnThis;
136 }
137
138 TList *AliFemtoBasicTrackCut::ListSettings()
139 {
140   // return a list of settings in a writable form
141   TList *tListSetttings = new TList();
142   char buf[200];
143   snprintf(buf, 200, "AliFemtoBasicTrackCut.mass=%f", this->Mass());
144   tListSetttings->AddLast(new TObjString(buf));
145
146   snprintf(buf, 200, "AliFemtoBasicTrackCut.charge=%i", fCharge);
147   tListSetttings->AddLast(new TObjString(buf));
148   snprintf(buf, 200, "AliFemtoBasicTrackCut.nsigmapion.minimum=%f", fNSigmaPion[0]);
149   tListSetttings->AddLast(new TObjString(buf));
150   snprintf(buf, 200, "AliFemtoBasicTrackCut.nsigmapion.maximum=%f", fNSigmaPion[1]);
151   tListSetttings->AddLast(new TObjString(buf));
152   snprintf(buf, 200, "AliFemtoBasicTrackCut.nsigmakaon.minimum=%f", fNSigmaKaon[0]);
153   tListSetttings->AddLast(new TObjString(buf));
154   snprintf(buf, 200, "AliFemtoBasicTrackCut.nsigmakaon.maximum=%f", fNSigmaKaon[1]);
155   tListSetttings->AddLast(new TObjString(buf));
156   snprintf(buf, 200, "AliFemtoBasicTrackCut.nsigmaproton.minimum=%f", fNSigmaProton[0]);
157   tListSetttings->AddLast(new TObjString(buf));
158   snprintf(buf, 200, "AliFemtoBasicTrackCut.nsigmaproton.maximum=%f", fNSigmaProton[1]);
159   tListSetttings->AddLast(new TObjString(buf));
160   snprintf(buf, 200, "AliFemtoBasicTrackCut.nhits.minimum=%i", fNHits[0]);
161   tListSetttings->AddLast(new TObjString(buf));
162   snprintf(buf, 200, "AliFemtoBasicTrackCut.nhits.maximum=%i", fNHits[1]);
163   tListSetttings->AddLast(new TObjString(buf));
164   snprintf(buf, 200, "AliFemtoBasicTrackCut.pt.minimum=%f", fPt[0]);
165   tListSetttings->AddLast(new TObjString(buf));
166   snprintf(buf, 200, "AliFemtoBasicTrackCut.pt.maximum=%f", fPt[1]);
167   tListSetttings->AddLast(new TObjString(buf));
168   snprintf(buf, 200, "AliFemtoBasicTrackCut.rapidity.minimum=%f", fRapidity[0]);
169   tListSetttings->AddLast(new TObjString(buf));
170   snprintf(buf, 200, "AliFemtoBasicTrackCut.rapidity.maximum=%f", fRapidity[1]);
171   tListSetttings->AddLast(new TObjString(buf));
172   snprintf(buf, 200, "AliFemtoBasicTrackCut.dca.minimum=%f", fDCA[0]);
173   tListSetttings->AddLast(new TObjString(buf));
174   snprintf(buf, 200, "AliFemtoBasicTrackCut.dca.maximum=%f", fDCA[1]);
175   tListSetttings->AddLast(new TObjString(buf));
176
177   return tListSetttings;
178 }