]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FEMTOSCOPY/AliFemto/AliFemtoCutMonitorEventVertex.cxx
Migration of PWG2/FEMTOSCOPY to PWGCF/FEMTOSCOPY
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / AliFemto / AliFemtoCutMonitorEventVertex.cxx
1 ////////////////////////////////////////////////////////////////////////////////
2 //                                                                            //
3 // AliFemtoCutMonitorEventVertex - the cut monitor for events to study        //
4 // the distribution and error of the primary vertex                           //
5 //                                                                            //
6 ////////////////////////////////////////////////////////////////////////////////
7 #include "AliFemtoCutMonitorEventVertex.h"
8 #include "AliFemtoModelHiddenInfo.h"
9 #include "AliFemtoEvent.h"
10 #include <TH1D.h>
11 #include <TH2D.h>
12 #include <TList.h>
13 #include <TMath.h>
14
15 AliFemtoCutMonitorEventVertex::AliFemtoCutMonitorEventVertex():
16   AliFemtoCutMonitor(),
17   fEvVertRad(0),
18   fEvVertXY(0),
19   fEvVertSigXY(0),
20   fEvVertZ(0),
21   fEvVertSigZ(0)
22 {
23   // Default constructor
24   fEvVertRad   = new TH1D("EvVertRad",   "Vertex position radial", 200, 0.0, 0.2);
25   fEvVertXY    = new TH2D("EvVertXY",    "Vertex position xy plane", 200, -0.2, 0.2, 200, -0.2, 0.2);
26   fEvVertSigXY = new TH1D("EvVertSigXY", "Vertex error in xy plane", 200, 0.0, 0.2);
27   fEvVertZ     = new TH1D("EvVertZ",     "Vertex position in z", 500, -50.0, 50.0);
28   fEvVertSigZ  = new TH1D("EvVertSigZ",  "Vertex error in z", 100, 0.0, 0.2);
29 }
30
31 AliFemtoCutMonitorEventVertex::AliFemtoCutMonitorEventVertex(const char *aName):
32   AliFemtoCutMonitor(),
33   fEvVertRad(0),
34   fEvVertXY(0),
35   fEvVertSigXY(0),
36   fEvVertZ(0),
37   fEvVertSigZ(0)
38 {
39   // Normal constructor
40   char name[200];
41   snprintf(name, 200, "EvVertRad%s", aName);
42   fEvVertRad   = new TH1D(name,   "Vertex position radial", 200, 0.0, 0.2);
43   snprintf(name, 200, "EvVertXY%s", aName);
44   fEvVertXY    = new TH2D(name,    "Vertex position xy plane", 200, -0.2, 0.2, 200, -0.2, 0.2);
45   snprintf(name, 200, "EvVertSigXY%s", aName);
46   fEvVertSigXY = new TH1D(name, "Vertex error in xy plane", 200, 0.0, 0.2);
47   snprintf(name, 200, "EvVertZ%s", aName);
48   fEvVertZ     = new TH1D(name,     "Vertex position in z", 500, -50.0, 50.0);
49   snprintf(name, 200, "EvVertSigZ%s", aName);
50   fEvVertSigZ  = new TH1D(name,  "Vertex error in z", 100, 0.0, 0.2);
51 }
52
53 AliFemtoCutMonitorEventVertex::AliFemtoCutMonitorEventVertex(const AliFemtoCutMonitorEventVertex &aCut):
54   AliFemtoCutMonitor(),
55   fEvVertRad(0),
56   fEvVertXY(0),
57   fEvVertSigXY(0),
58   fEvVertZ(0),
59   fEvVertSigZ(0)
60 {
61   // copy constructor
62   if (fEvVertRad) delete fEvVertRad;
63   fEvVertRad = new TH1D(*aCut.fEvVertRad);
64   if (fEvVertXY) delete fEvVertXY;
65   fEvVertXY = new TH2D(*aCut.fEvVertXY);
66   if (fEvVertSigXY) delete fEvVertSigXY;
67   fEvVertSigXY = new TH1D(*aCut.fEvVertSigXY);
68   if (fEvVertZ) delete fEvVertZ;
69   fEvVertZ = new TH1D(*aCut.fEvVertZ);
70   if (fEvVertSigZ) delete fEvVertSigZ;
71   fEvVertSigZ = new TH1D(*aCut.fEvVertSigZ);
72 }
73
74 AliFemtoCutMonitorEventVertex::~AliFemtoCutMonitorEventVertex()
75 {
76   // Destructor
77   delete fEvVertRad;
78   delete fEvVertXY;
79   delete fEvVertSigXY;
80   delete fEvVertZ;
81   delete fEvVertSigZ;
82 }
83
84 AliFemtoCutMonitorEventVertex& AliFemtoCutMonitorEventVertex::operator=(const AliFemtoCutMonitorEventVertex& aCut)
85 {
86   // assignment operator
87   if (this == &aCut) 
88     return *this;
89
90   if (fEvVertRad) delete fEvVertRad;
91   fEvVertRad = new TH1D(*aCut.fEvVertRad);
92   if (fEvVertXY) delete fEvVertXY;
93   fEvVertXY = new TH2D(*aCut.fEvVertXY);
94   if (fEvVertSigXY) delete fEvVertSigXY;
95   fEvVertSigXY = new TH1D(*aCut.fEvVertSigXY);
96   if (fEvVertZ) delete fEvVertZ;
97   fEvVertZ = new TH1D(*aCut.fEvVertZ);
98   if (fEvVertSigZ) delete fEvVertSigZ;
99   fEvVertSigZ = new TH1D(*aCut.fEvVertSigZ);
100   
101   return *this;
102 }
103
104 AliFemtoString AliFemtoCutMonitorEventVertex::Report(){ 
105   // Prepare report from the execution
106   string stemp = "*** AliFemtoCutMonitorEventVertex report"; 
107   AliFemtoString returnThis = stemp;
108   return returnThis; 
109 }
110
111 void AliFemtoCutMonitorEventVertex::Fill(const AliFemtoEvent* aEvent)
112 {
113   // Fill in the monitor histograms with the values from the current track
114   fEvVertRad->Fill(TMath::Hypot(aEvent->PrimVertPos().x(), aEvent->PrimVertPos().y()));
115   fEvVertXY->Fill(aEvent->PrimVertPos().x(), aEvent->PrimVertPos().y());
116   fEvVertSigXY->Fill(TMath::Sqrt(aEvent->PrimVertCov()[0]+aEvent->PrimVertCov()[2]));
117   fEvVertZ->Fill(aEvent->PrimVertPos().z());
118   fEvVertSigZ->Fill(TMath::Sqrt(aEvent->PrimVertCov()[5]));
119 }
120
121 void AliFemtoCutMonitorEventVertex::Write()
122 {
123   // Write out the relevant histograms
124   fEvVertRad->Write();
125   fEvVertXY->Write();
126   fEvVertSigXY->Write();
127   fEvVertZ->Write();
128   fEvVertSigZ->Write();
129 }
130
131 TList *AliFemtoCutMonitorEventVertex::GetOutputList()
132 {
133   TList *tOutputList = new TList();
134   tOutputList->Add(fEvVertRad);
135   tOutputList->Add(fEvVertXY);
136   tOutputList->Add(fEvVertSigXY);
137   tOutputList->Add(fEvVertZ);
138   tOutputList->Add(fEvVertSigZ);
139
140   return tOutputList;
141 }