]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FEMTOSCOPY/AliFemtoUser/AliFemtoCutMonitorParticleMomRes.cxx
Fix Coverity 10974-82
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemtoUser / AliFemtoCutMonitorParticleMomRes.cxx
CommitLineData
0b3bd1ac 1////////////////////////////////////////////////////////////////////////////////
2// //
3// AliFemtoCutMonitorParticleMomRes - the cut monitor for particles to study //
4// the difference between reconstructed and true momentum //
5// //
6////////////////////////////////////////////////////////////////////////////////
7#include "AliFemtoCutMonitorParticleMomRes.h"
8#include <TH1D.h>
9#include <TH2D.h>
10#include <TH3D.h>
11#include <TList.h>
12#include "AliFemtoModelHiddenInfo.h"
13
14AliFemtoCutMonitorParticleMomRes::AliFemtoCutMonitorParticleMomRes():
15 fMomRes3D(0),
16 fMomResXvsP(0),
17 fMomResYvsP(0),
18 fMomResZvsP(0),
19 fImpactXY(0),
20 fImpactZ(0),
2a4f5a7b 21 fSigma(0)
0b3bd1ac 22{
23 // Default constructor
24 fMomRes3D = new TH3D("MomRes3D", "Momentum resolution", 100, -0.05, 0.05, 100, -0.05, 0.05, 100, -0.05, 0.05);
25 fMomResXvsP = new TH2D("MomResXvsP", "X momentum resolution vs P", 100, 0.1, 2.0, 100, -0.05, 0.05);
26 fMomResYvsP = new TH2D("MomResYvsP", "Y momentum resolution vs P", 100, 0.1, 2.0, 100, -0.05, 0.05);
27 fMomResZvsP = new TH2D("MomResZvsP", "Z momentum resolution vs P", 100, 0.1, 2.0, 100, -0.05, 0.05);
28 fImpactXY = new TH2D("ImpactXY", "XY impact parameter vs P", 100, 0.1, 2.0, 200, -1.0, 1.0);
29 fImpactZ = new TH2D("ImpactZ", "Z impact parameter vs P" , 100, 0.1, 2.0, 200, -1.0, 1.0);
30 fSigma = new TH2D("Sigma", "Sigma to vertex vs P" , 100, 0.1, 2.0, 200, -5.0, 5.0);
31}
32
2a4f5a7b 33AliFemtoCutMonitorParticleMomRes::AliFemtoCutMonitorParticleMomRes(const char *aName):
0b3bd1ac 34 fMomRes3D(0),
35 fMomResXvsP(0),
36 fMomResYvsP(0),
37 fMomResZvsP(0),
38 fImpactXY(0),
39 fImpactZ(0),
2a4f5a7b 40 fSigma(0)
0b3bd1ac 41{
42 // Normal constructor
43 char name[200];
44 snprintf(name, 200, "MomRes3D%s", aName);
45 fMomRes3D = new TH3D(name, "Momentum resolution", 100, -0.05, 0.05, 100, -0.05, 0.05, 100, -0.05, 0.05);
46 snprintf(name, 200, "MomResXvsP%s", aName);
47 fMomResXvsP = new TH2D(name, "X momentum resolution vs P", 100, 0.1, 2.0, 100, -0.05, 0.05);
48 snprintf(name, 200, "MomResYvsP%s", aName);
49 fMomResYvsP = new TH2D(name, "Y momentum resolution vs P", 100, 0.1, 2.0, 100, -0.05, 0.05);
50 snprintf(name, 200, "MomResZvsP%s", aName);
51 fMomResZvsP = new TH2D(name, "Z momentum resolution vs P", 100, 0.1, 2.0, 100, -0.05, 0.05);
52 snprintf(name, 200, "ImpactXY%s", aName);
53 fImpactXY = new TH2D(name, "XY impact parameter vs P", 100, 0.1, 2.0, 200, -1.0, 1.0);
54 snprintf(name, 200, "ImpactZ%s", aName);
55 fImpactZ = new TH2D(name, "Z impact parameter vs P" , 100, 0.1, 2.0, 200, -1.0, 1.0);
56 snprintf(name, 200, "Sigma%s", aName);
57 fSigma = new TH2D(name, "Z impact parameter vs P" , 100, 0.1, 2.0, 200, -5.0, 5.0);
58}
59
60AliFemtoCutMonitorParticleMomRes::AliFemtoCutMonitorParticleMomRes(const AliFemtoCutMonitorParticleMomRes &aCut):
db2d5b4b 61 AliFemtoCutMonitor(),
0b3bd1ac 62 fMomRes3D(0),
63 fMomResXvsP(0),
64 fMomResYvsP(0),
65 fMomResZvsP(0),
66 fImpactXY(0),
67 fImpactZ(0),
2a4f5a7b 68 fSigma(0)
0b3bd1ac 69{
70 // copy constructor
71 if (fMomRes3D) delete fMomRes3D;
72 fMomRes3D = new TH3D(*aCut.fMomRes3D);
73 if (fMomResXvsP) delete fMomResXvsP;
74 fMomResXvsP = new TH2D(*aCut.fMomResXvsP);
75 if (fMomResYvsP) delete fMomResYvsP;
76 fMomResYvsP = new TH2D(*aCut.fMomResYvsP);
77 if (fMomResZvsP) delete fMomResZvsP;
78 fMomResZvsP = new TH2D(*aCut.fMomResZvsP);
79 if (fImpactXY) delete fImpactXY;
80 fImpactXY = new TH2D(*aCut.fImpactXY);
81 if (fImpactZ) delete fImpactZ;
82 fImpactZ = new TH2D(*aCut.fImpactZ);
83 if (fSigma) delete fSigma;
84 fSigma = new TH2D(*aCut.fSigma);
0b3bd1ac 85}
86
87AliFemtoCutMonitorParticleMomRes::~AliFemtoCutMonitorParticleMomRes()
88{
89 // Destructor
90 delete fMomRes3D;
91 delete fMomResXvsP;
92 delete fMomResYvsP;
93 delete fMomResZvsP;
94 delete fImpactXY;
95 delete fImpactZ;
96 delete fSigma;
97}
98
99AliFemtoCutMonitorParticleMomRes& AliFemtoCutMonitorParticleMomRes::operator=(const AliFemtoCutMonitorParticleMomRes& aCut)
100{
101 // assignment operator
102 if (this == &aCut)
103 return *this;
104
105 if (fMomRes3D) delete fMomRes3D;
106 fMomRes3D = new TH3D(*aCut.fMomRes3D);
107 if (fMomResXvsP) delete fMomResXvsP;
108 fMomResXvsP = new TH2D(*aCut.fMomResXvsP);
109 if (fMomResYvsP) delete fMomResYvsP;
110 fMomResYvsP = new TH2D(*aCut.fMomResYvsP);
111 if (fMomResZvsP) delete fMomResZvsP;
112 fMomResZvsP = new TH2D(*aCut.fMomResZvsP);
113 if (fImpactXY) delete fImpactXY;
114 fImpactXY = new TH2D(*aCut.fImpactXY);
115 if (fImpactZ) delete fImpactZ;
116 fImpactZ = new TH2D(*aCut.fImpactZ);
117 if (fSigma) delete fSigma;
118 fSigma = new TH2D(*aCut.fSigma);
119
120 return *this;
121}
122
123AliFemtoString AliFemtoCutMonitorParticleMomRes::Report(){
124 // Prepare report from the execution
125 string stemp = "*** AliFemtoCutMonitorParticleMomRes report";
126 AliFemtoString returnThis = stemp;
127 return returnThis;
128}
129
130void AliFemtoCutMonitorParticleMomRes::Fill(const AliFemtoTrack* aTrack)
131{
db2d5b4b 132 // Fill momentum resolution histograms for the particle
0b3bd1ac 133 AliFemtoModelHiddenInfo *tInf = ( AliFemtoModelHiddenInfo *) aTrack->GetHiddenInfo();
2a4f5a7b 134 if (tInf) {
135 fMomRes3D->Fill(tInf->GetTrueMomentum()->x() - aTrack->P().x(),
136 tInf->GetTrueMomentum()->y() - aTrack->P().y(),
0b3bd1ac 137 tInf->GetTrueMomentum()->z() - aTrack->P().z());
2a4f5a7b 138
f6944668 139 fMomResXvsP->Fill(aTrack->P().Mag(),
2a4f5a7b 140 tInf->GetTrueMomentum()->x() - aTrack->P().x());
f6944668 141 fMomResYvsP->Fill(aTrack->P().Mag(),
2a4f5a7b 142 tInf->GetTrueMomentum()->y() - aTrack->P().y());
f6944668 143 fMomResZvsP->Fill(aTrack->P().Mag(),
2a4f5a7b 144 tInf->GetTrueMomentum()->z() - aTrack->P().z());
f6944668 145 fImpactXY->Fill(aTrack->P().Mag(),
2a4f5a7b 146 aTrack->ImpactD());
f6944668 147 fImpactZ->Fill(aTrack->P().Mag(),
2a4f5a7b 148 aTrack->ImpactZ());
f6944668 149 fSigma->Fill(aTrack->P().Mag(),
2a4f5a7b 150 aTrack->SigmaToVertex());
151 }
0b3bd1ac 152}
153
154void AliFemtoCutMonitorParticleMomRes::Write()
155{
156 // Write out the relevant histograms
157 fMomRes3D->Write();
158 fMomResXvsP->Write();
159 fMomResYvsP->Write();
160 fMomResZvsP->Write();
161 fImpactXY->Write();
162 fImpactZ->Write();
163 fSigma->Write();
164}
165
166TList *AliFemtoCutMonitorParticleMomRes::GetOutputList()
167{
db2d5b4b 168 // Get the list of histograms to write
0b3bd1ac 169 TList *tOutputList = new TList();
170 tOutputList->Add(fMomRes3D);
171 tOutputList->Add(fMomResXvsP);
172 tOutputList->Add(fMomResYvsP);
173 tOutputList->Add(fMomResZvsP);
174 tOutputList->Add(fImpactXY);
175 tOutputList->Add(fImpactZ);
176 tOutputList->Add(fSigma);
177
178 return tOutputList;
179}