]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FEMTOSCOPY/AliFemto/AliFemtoCutMonitorParticleVertPos.cxx
Migration of PWG2/FEMTOSCOPY to PWGCF/FEMTOSCOPY
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / AliFemto / AliFemtoCutMonitorParticleVertPos.cxx
1 ////////////////////////////////////////////////////////////////////////////////
2 //                                                                            //
3 // AliFemtoCutMonitorParticleVertPos - the cut monitor for particles to study    //
4 // the difference between reconstructed and true momentum                     //
5 //                                                                            //
6 ////////////////////////////////////////////////////////////////////////////////
7 #include "AliFemtoCutMonitorParticleVertPos.h"
8 #include "AliFemtoModelHiddenInfo.h"
9 #include "AliFemtoModelGlobalHiddenInfo.h"
10 #include <TH1D.h>
11 #include <TH2D.h>
12 #include <TList.h>
13 #include <TMath.h>
14
15 AliFemtoCutMonitorParticleVertPos::AliFemtoCutMonitorParticleVertPos():
16   fVertPos(0),
17   fEtaZ(0),
18   fRadPos(0),
19   fEmPointX(0),
20   fEmPointY(0),
21   fEmPointZ(0),
22   fEmPointT(0)
23 {
24   // Default constructor
25   fVertPos = new TH2D("VertPos", "Vertex position", 200, -20.0, 20.0, 200, -20.0, 20.0);
26   fEtaZ    = new TH2D("EtaZPos", "Z vs. Eta", 200, -100.0, 100.0, 100, -1.5, 1.5);
27   fRadPos  = new TH1D("RadPos",  "Radial position", 200, 0.0, 1.0);
28   fEmPointX = new TH1D("EmPointX","Emission point x", 400, -200.0, 200.0);
29   fEmPointY = new TH1D("EmPointY","Emission point y", 400, -200.0, 200.0);
30   fEmPointZ = new TH1D("EmPointZ","Emission point z", 400, -200.0, 200.0);
31   fEmPointT = new TH1D("EmPointT","Emission point t", 400, -200.0, 200.0);
32
33 }
34
35 AliFemtoCutMonitorParticleVertPos::AliFemtoCutMonitorParticleVertPos(const char *aName):
36   AliFemtoCutMonitor(),
37   fVertPos(0),
38   fEtaZ(0),
39   fRadPos(0),
40   fEmPointX(0),
41   fEmPointY(0),
42   fEmPointZ(0),
43   fEmPointT(0)
44 {
45   // Normal constructor
46   char name[200];
47   snprintf(name, 200, "VertPos%s", aName);
48   fVertPos = new TH2D(name, "Rapdity vs Pt", 200, -20.0, 20.0, 200, -20.0, 20.0);
49   snprintf(name, 200, "EtaZPos%s", aName);
50   fEtaZ    = new TH2D(name, "Z vs. Eta", 200, -100.0, 100.0, 100, -1.5, 1.5);
51   snprintf(name, 200, "RadPos%s", aName);
52   fRadPos  = new TH1D(name,  "Radial position", 200, 0.0, 1.0);
53   snprintf(name, 200, "EmPosX%s", aName);
54   fEmPointX = new TH1D(name,"Emission point x", 400, -200.0, 200.0);
55   snprintf(name, 200, "EmPosY%s", aName);
56   fEmPointY = new TH1D(name,"Emission point y", 400, -200.0, 200.0);
57   snprintf(name, 200, "EmPosZ%s", aName);
58   fEmPointZ = new TH1D(name,"Emission point z", 400, -200.0, 200.0);
59   snprintf(name, 200, "EmPosT%s", aName);
60   fEmPointT = new TH1D(name,"Emission point t", 400, -200.0, 200.0);
61 }
62
63 AliFemtoCutMonitorParticleVertPos::AliFemtoCutMonitorParticleVertPos(const AliFemtoCutMonitorParticleVertPos &aCut):
64   AliFemtoCutMonitor(),
65   fVertPos(0),
66   fEtaZ(0),
67   fRadPos(0),
68   fEmPointX(0),
69   fEmPointY(0),
70   fEmPointZ(0),
71   fEmPointT(0)
72 {
73   // copy constructor
74   if (fVertPos) delete fVertPos;
75   fVertPos = new TH2D(*aCut.fVertPos);
76   if (fEtaZ) delete fEtaZ;
77   fEtaZ = new TH2D(*aCut.fEtaZ);
78   if (fRadPos) delete fRadPos;
79   fRadPos = new TH1D(*aCut.fRadPos);
80   if (fEmPointX) delete fEmPointX;
81   fEmPointX = new TH1D(*aCut.fEmPointX);
82   if (fEmPointY) delete fEmPointY;
83   fEmPointY = new TH1D(*aCut.fEmPointY);
84   if (fEmPointZ) delete fEmPointZ;
85   fEmPointZ = new TH1D(*aCut.fEmPointZ);
86   if (fEmPointT) delete fEmPointT;
87   fEmPointT = new TH1D(*aCut.fEmPointT);
88 }
89
90 AliFemtoCutMonitorParticleVertPos::~AliFemtoCutMonitorParticleVertPos()
91 {
92   // Destructor
93   delete fVertPos;
94   delete fEtaZ;
95   delete fRadPos;
96   delete fEmPointX;
97   delete fEmPointY;
98   delete fEmPointZ;
99   delete fEmPointT;
100 }
101
102 AliFemtoCutMonitorParticleVertPos& AliFemtoCutMonitorParticleVertPos::operator=(const AliFemtoCutMonitorParticleVertPos& aCut)
103 {
104   // assignment operator
105   if (this == &aCut) 
106     return *this;
107
108   if (fVertPos) delete fVertPos;
109   fVertPos = new TH2D(*aCut.fVertPos);
110   if (fEtaZ) delete fEtaZ;
111   fEtaZ = new TH2D(*aCut.fEtaZ);
112   if (fRadPos) delete fRadPos;
113   fRadPos = new TH1D(*aCut.fRadPos);
114   if (fEmPointX) delete fEmPointX;
115   fEmPointX = new TH1D(*aCut.fEmPointX);
116   if (fEmPointY) delete fEmPointY;
117   fEmPointY = new TH1D(*aCut.fEmPointY);
118   if (fEmPointZ) delete fEmPointZ;
119   fEmPointZ = new TH1D(*aCut.fEmPointZ);
120   if (fEmPointT) delete fEmPointT;
121   fEmPointT = new TH1D(*aCut.fEmPointT);
122   
123   return *this;
124 }
125
126 AliFemtoString AliFemtoCutMonitorParticleVertPos::Report(){ 
127   // Prepare report from the execution
128   string stemp = "*** AliFemtoCutMonitorParticleVertPos report"; 
129   AliFemtoString returnThis = stemp;
130   return returnThis; 
131 }
132
133 void AliFemtoCutMonitorParticleVertPos::Fill(const AliFemtoTrack* aTrack)
134 {
135   // Fill in the monitor histograms with the values from the current track
136   AliFemtoModelGlobalHiddenInfo *hinfo = dynamic_cast<AliFemtoModelGlobalHiddenInfo *>(aTrack->GetHiddenInfo());
137   if (hinfo) {
138     float tEta = -TMath::Log(TMath::Tan(hinfo->GetTrueMomentum()->Theta()/2.0));
139
140     fVertPos->Fill(hinfo->GetGlobalEmissionPoint()->x(), hinfo->GetGlobalEmissionPoint()->y());
141     fEtaZ->Fill(hinfo->GetGlobalEmissionPoint()->z(), tEta);
142     fRadPos->Fill(hinfo->GetGlobalEmissionPoint()->Perp());
143   }
144   
145   AliFemtoModelHiddenInfo *hminfo = dynamic_cast<AliFemtoModelHiddenInfo *>(aTrack->GetHiddenInfo());
146   if (hminfo) {
147     fEmPointX->Fill(hminfo->GetEmissionPoint()->x());
148     fEmPointY->Fill(hminfo->GetEmissionPoint()->y());
149     fEmPointZ->Fill(hminfo->GetEmissionPoint()->z());
150     fEmPointT->Fill(hminfo->GetEmissionPoint()->t());
151   }
152 }
153
154 void AliFemtoCutMonitorParticleVertPos::Write()
155 {
156   // Write out the relevant histograms
157   fVertPos->Write();
158   fEtaZ->Write();
159   fRadPos->Write();
160   fEmPointX->Write();
161   fEmPointY->Write();
162   fEmPointZ->Write();
163   fEmPointT->Write();
164 }
165
166 TList *AliFemtoCutMonitorParticleVertPos::GetOutputList()
167 {
168   TList *tOutputList = new TList();
169   tOutputList->Add(fVertPos);
170   tOutputList->Add(fEtaZ);
171   tOutputList->Add(fRadPos);
172   tOutputList->Add(fEmPointX);
173   tOutputList->Add(fEmPointY);
174   tOutputList->Add(fEmPointZ);
175   tOutputList->Add(fEmPointT);
176
177   return tOutputList;
178 }