Initial check-in of the model classes
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemto / Cut / AliFemtoBasicTrackCut.cxx
1 /***************************************************************************
2  *
3  * $Id: 
4  *
5  * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
6  ***************************************************************************
7  *
8  * Description: part of STAR HBT Framework: AliFemtoMaker package
9  *    a simple particle cut that selects on phasespace, #hits, DCA, and PID          
10  *
11  ***************************************************************************
12  *
13  * $Log:
14  **************************************************************************/
15
16 #include "Cut/AliFemtoBasicTrackCut.h"
17 #include <cstdio>
18
19 #ifdef __ROOT__ 
20 ClassImp(AliFemtoBasicTrackCut)
21 #endif
22
23 AliFemtoBasicTrackCut::AliFemtoBasicTrackCut():
24   fCharge(0),
25   fNTracksPassed(0),
26   fNTracksFailed(0)
27 {
28   fNTracksPassed = fNTracksFailed = 0;
29   fCharge = 1;  // takes both charges 0
30   fNSigmaPion[0] = -100.0;   fNSigmaPion[1] = 100.0;
31   fNSigmaKaon[0] = -100.0;   fNSigmaKaon[1] = 100.0;
32   fNSigmaProton[0] = -100.0; fNSigmaProton[1] = 100.0;
33   fNHits[0] = 10;          fNHits[1] = 180;
34   fPt[0]=0.0;              fPt[1] = 100.0;//100
35   fRapidity[0]=-2;       fRapidity[1]=2;//-2 2
36   fDCA[0] = -1.0;           fDCA[1] = 20.0;
37
38 }
39 //------------------------------
40 //AliFemtoBasicTrackCut::~AliFemtoBasicTrackCut(){
41 //  /* noop */
42 //}
43 //------------------------------
44 bool AliFemtoBasicTrackCut::Pass(const AliFemtoTrack* track){
45
46
47   //  return true ;  // THIS CUT IS A STHBTDUMMY!!
48
49   /*
50     cout << endl;
51     cout << "#track " << trackCount++;
52     cout << " * pion " << (track->NSigmaPion() > fNSigmaPion[0]) && (track->NSigmaPion() < fNSigmaPion[1]);
53     cout << " * kaon " << (track->NSigmaKaon() > fNSigmaKaon[0]) && (track->NSigmaKaon() < fNSigmaKaon[1]);
54     cout << " * proton " << (track->NSigmaProton() > fNSigmaProton[0]) && (track->NSigmaProton() < fNSigmaProton[1]);
55     cout << " * charge " << (track->Charge() == fCharge);
56   */
57   bool goodPID = 1;  
58   /* ----- NOT DOING PID CUTS !!!! ------
59   bool goodPID = ((track->NSigmaPion()   > fNSigmaPion[0]) &&
60                   (track->NSigmaPion()   < fNSigmaPion[1]) &&
61                   (track->NSigmaKaon()   > fNSigmaKaon[0]) &&
62                   (track->NSigmaKaon()   < fNSigmaKaon[1]) &&
63                   (track->NSigmaProton() > fNSigmaProton[0]) &&
64                   (track->NSigmaProton() < fNSigmaProton[1]));
65   ----- NOT DOING PID CUTS !!!! ------ */
66   if (fCharge !=0){               // if user requests "charge=0" then that means ignore charge
67     goodPID = (goodPID&&(track->Charge() == fCharge));
68   }
69   if (goodPID){
70     float TEnergy = ::sqrt(track->P().mag2()+fMass*fMass);
71     float TRapidity = 0.5*::log((TEnergy+track->P().z())/
72                             (TEnergy-track->P().z()));
73
74     float Pt = ::sqrt((track->P().x())*(track->P().x())+
75                     (track->P().y())*(track->P().y()));
76
77     
78     /*
79       cout << " * DCAxy " << (track->DCAxy()  > fDCA[0]) && (track->DCAxy()  < fDCA[1]);
80       cout << " * fDCA[0] " << fDCA[0];
81       cout << " * fDCA[1] " << fDCA[1];
82       cout << " * track->DCAxy " << track->DCAxy();
83       cout << " * NHits " <<  (track->NHits() > fNHits[0]) && (track->NHits() < fNHits[1]); 
84       cout << " * Pt " << (Pt > fPt[0]) && (Pt < fPt[1]);
85       cout << " * y " << (TRapidity > fRapidity[0]) && (TRapidity < fRapidity[1]);
86       cout << endl;
87     */
88
89     bool goodTrack=
90       (//(track->DCAxy()  > fDCA[0]) &&
91      //  (track->DCAxy()  < fDCA[1]) &&
92   //     (track->NHits() > fNHits[0]) &&
93     //   (track->NHits() < fNHits[1]) &&
94        (Pt             > fPt[0]) &&
95        (Pt             < fPt[1]) &&
96        (TRapidity      > fRapidity[0]) &&
97        (TRapidity      < fRapidity[1]))&&
98        (track->PidProbPion()>0.5)&&//moje
99        (track->PidProbMuon()<0.47)&&//moje
100        (track->Label()>0);//moje
101
102     //    cout << track->DCAxy() << " " << track->NHits() << " " << Pt << " " << TRapidity << " " << TEnergy << endl;
103
104     goodTrack ? fNTracksPassed++ : fNTracksFailed++;
105     return (goodTrack);
106   }
107   else{
108     fNTracksFailed++;
109     return (goodPID);
110   }
111 }
112 //------------------------------
113 AliFemtoString AliFemtoBasicTrackCut::Report(){
114   string Stemp;
115   char Ctemp[100];
116   sprintf(Ctemp,"Particle mass:\t%E\n",this->Mass());
117   Stemp=Ctemp;
118   sprintf(Ctemp,"Particle charge:\t%d\n",fCharge);
119   Stemp=Ctemp;
120   sprintf(Ctemp,"Particle Nsigma from pion:\t%E - %E\n",fNSigmaPion[0],fNSigmaPion[1]);
121   Stemp+=Ctemp;
122   sprintf(Ctemp,"Particle Nsigma from kaon:\t%E - %E\n",fNSigmaKaon[0],fNSigmaKaon[1]);
123   Stemp+=Ctemp;
124   sprintf(Ctemp,"Particle Nsigma from proton:\t%E - %E\n",fNSigmaProton[0],fNSigmaProton[1]);
125   Stemp+=Ctemp;
126   sprintf(Ctemp,"Particle #hits:\t%d - %d\n",fNHits[0],fNHits[1]);
127   Stemp+=Ctemp;
128   sprintf(Ctemp,"Particle pT:\t%E - %E\n",fPt[0],fPt[1]);
129   Stemp+=Ctemp;
130   sprintf(Ctemp,"Particle rapidity:\t%E - %E\n",fRapidity[0],fRapidity[1]);
131   Stemp+=Ctemp;
132   sprintf(Ctemp,"Particle DCA:\t%E - %E\n",fDCA[0],fDCA[1]);
133   Stemp+=Ctemp;
134   sprintf(Ctemp,"Number of tracks which passed:\t%ld  Number which failed:\t%ld\n",fNTracksPassed,fNTracksFailed);
135   Stemp += Ctemp;
136   AliFemtoString returnThis = Stemp;
137   return returnThis;
138 }