]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FEMTOSCOPY/AliFemto/AliFemtoCutMonitorParticlePID.cxx
Add PID code
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemto / AliFemtoCutMonitorParticlePID.cxx
1 ////////////////////////////////////////////////////////////////////////////////
2 //                                                                            //
3 // AliFemtoCutMonitorParticlePID - the cut monitor for particles to study     //
4 // various aspects of the PID determination                                   //
5 //                                                                            //
6 ////////////////////////////////////////////////////////////////////////////////
7 #include "AliFemtoCutMonitorParticlePID.h"
8 #include "AliFemtoModelHiddenInfo.h"
9 #include <TH1D.h>
10 #include <TH2D.h>
11 #include <TList.h>
12 #include <TMath.h>
13
14 AliFemtoCutMonitorParticlePID::AliFemtoCutMonitorParticlePID():
15   fTPCdEdx(0),
16   fTOFParticle(0),
17   fTOFTime(0x0),
18   ftofHist(0)
19 {
20   // Default constructor
21   fTPCdEdx =  new TH2D("TPCdEdx", "TPC dEdx vs. momentum", 200, 0.1, 4.0, 250, 0.0, 500.0);
22   fTOFTime = new TH2D("TOFTime", "TOF Time vs. momentum", 190, 0.1, 2.0, 400, -4000.0, 4000.0);
23   ftofHist=new TH2D("TOFHist","TOF momentum vs v",100,0.,1.1,100,0.,3.0);
24 }
25
26 AliFemtoCutMonitorParticlePID::AliFemtoCutMonitorParticlePID(const char *aName, Int_t aTOFParticle):
27   AliFemtoCutMonitor(),
28   fTPCdEdx(0),
29   fTOFParticle(aTOFParticle),
30   fTOFTime(0x0),
31   ftofHist(0)
32 {
33   // Normal constructor
34   char name[200];
35   snprintf(name, 200, "TPCdEdx%s", aName);
36   fTPCdEdx = new TH2D(name, "TPC dEdx vs. momentum", 200, 0.1, 4.0, 250, 0.0, 500.0);
37
38   snprintf(name, 200, "TOFTime%s", aName);
39   fTOFTime = new TH2D(name, "TOF Time vs. momentum", 190, 0.1, 2.0, 400, -4000.0, 4000.0);
40
41   snprintf(name, 200, "TOFHist%s", aName);
42   ftofHist=new TH2D(name,"TOF momentum vs v",100,0.,1.1,100,0.,3.0);
43 }
44
45 AliFemtoCutMonitorParticlePID::AliFemtoCutMonitorParticlePID(const AliFemtoCutMonitorParticlePID &aCut):
46   AliFemtoCutMonitor(),
47   fTPCdEdx(0),
48   fTOFParticle(0),
49   ftofHist(0),
50   fTOFTime(0x0)
51 {
52   // copy constructor
53   if (fTPCdEdx) delete fTPCdEdx;
54   fTPCdEdx = new TH2D(*aCut.fTPCdEdx);
55
56   if (fTOFTime) delete fTOFTime;
57   fTOFTime = new TH2D(*aCut.fTOFTime);
58
59   if (ftofHist) delete ftofHist; 
60   ftofHist= new TH2D(*aCut.ftofHist);
61 }
62
63 AliFemtoCutMonitorParticlePID::~AliFemtoCutMonitorParticlePID()
64 {
65   // Destructor
66   delete fTPCdEdx;
67   delete fTOFTime;
68   delete ftofHist;
69 }
70
71 AliFemtoCutMonitorParticlePID& AliFemtoCutMonitorParticlePID::operator=(const AliFemtoCutMonitorParticlePID& aCut)
72 {
73   // assignment operator
74   if (this == &aCut) 
75     return *this;
76
77   if (fTPCdEdx) delete fTPCdEdx;
78   fTPCdEdx = new TH2D(*aCut.fTPCdEdx);
79
80   if (fTOFTime) delete fTOFTime;
81   fTOFTime = new TH2D(*aCut.fTOFTime);
82   
83   if(ftofHist) delete ftofHist;
84   ftofHist = new TH2D(*aCut.ftofHist);
85   return *this;
86 }
87
88 AliFemtoString AliFemtoCutMonitorParticlePID::Report(){ 
89   // Prepare report from the execution
90   string stemp = "*** AliFemtoCutMonitorParticlePID report"; 
91   AliFemtoString returnThis = stemp;
92   return returnThis; 
93 }
94
95 void AliFemtoCutMonitorParticlePID::Fill(const AliFemtoTrack* aTrack)
96 {
97   // Fill in the monitor histograms with the values from the current track
98   float tMom = aTrack->P().Mag();
99   float tdEdx = aTrack->TPCsignal();
100   float tTOF = 0.0;
101   short tchg = aTrack->Charge();
102   if (fTOFParticle == 0) tTOF = aTrack->TOFpionTime();
103   if (fTOFParticle == 1) tTOF = aTrack->TOFkaonTime();
104   if (fTOFParticle == 2) tTOF = aTrack->TOFprotonTime();
105
106   fTPCdEdx->Fill(tMom, tdEdx);
107   fTOFTime->Fill(tMom, tTOF);
108
109   float vp= aTrack->VTOF();
110   ftofHist->Fill(vp,tMom);
111 }
112
113 void AliFemtoCutMonitorParticlePID::Write()
114 {
115   // Write out the relevant histograms
116   fTPCdEdx->Write();
117   fTOFTime->Write();
118   ftofHist->Write();
119 }
120
121 TList *AliFemtoCutMonitorParticlePID::GetOutputList()
122 {
123   TList *tOutputList = new TList();
124   tOutputList->Add(fTPCdEdx);
125   tOutputList->Add(fTOFTime);
126   tOutputList->Add(ftofHist);
127   return tOutputList;
128 }