]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FEMTOSCOPY/AliFemtoUser/AliFemtoCutMonitorParticleMomRes.cxx
Bring AliFemto up to date with latest code developements
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemtoUser / AliFemtoCutMonitorParticleMomRes.cxx
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
14 AliFemtoCutMonitorParticleMomRes::AliFemtoCutMonitorParticleMomRes():
15   fMomRes3D(0),
16   fMomResXvsP(0),
17   fMomResYvsP(0),
18   fMomResZvsP(0),
19   fImpactXY(0),
20   fImpactZ(0),
21   fSigma(0),
22   fMass(0.13957)
23 {
24   // Default constructor
25   fMomRes3D = new TH3D("MomRes3D", "Momentum resolution", 100, -0.05, 0.05, 100, -0.05, 0.05, 100, -0.05, 0.05);
26   fMomResXvsP = new TH2D("MomResXvsP", "X momentum resolution vs P", 100, 0.1, 2.0, 100, -0.05, 0.05);
27   fMomResYvsP = new TH2D("MomResYvsP", "Y momentum resolution vs P", 100, 0.1, 2.0, 100, -0.05, 0.05);
28   fMomResZvsP = new TH2D("MomResZvsP", "Z momentum resolution vs P", 100, 0.1, 2.0, 100, -0.05, 0.05);
29   fImpactXY   = new TH2D("ImpactXY", "XY impact parameter vs P", 100, 0.1, 2.0, 200, -1.0, 1.0);
30   fImpactZ    = new TH2D("ImpactZ",  "Z impact parameter vs P" , 100, 0.1, 2.0, 200, -1.0, 1.0);
31   fSigma      = new TH2D("Sigma",     "Sigma to vertex vs P" , 100, 0.1, 2.0, 200, -5.0, 5.0);
32 }
33
34 AliFemtoCutMonitorParticleMomRes::AliFemtoCutMonitorParticleMomRes(const char *aName, float aMass):
35   fMomRes3D(0),
36   fMomResXvsP(0),
37   fMomResYvsP(0),
38   fMomResZvsP(0),
39   fImpactXY(0),
40   fImpactZ(0),
41   fSigma(0),
42   fMass(aMass)
43 {
44   // Normal constructor
45   char name[200];
46   snprintf(name, 200, "MomRes3D%s", aName);
47   fMomRes3D = new TH3D(name, "Momentum resolution", 100, -0.05, 0.05, 100, -0.05, 0.05, 100, -0.05, 0.05);
48   snprintf(name, 200, "MomResXvsP%s", aName);
49   fMomResXvsP = new TH2D(name, "X momentum resolution vs P", 100, 0.1, 2.0, 100, -0.05, 0.05);
50   snprintf(name, 200, "MomResYvsP%s", aName);
51   fMomResYvsP = new TH2D(name, "Y momentum resolution vs P", 100, 0.1, 2.0, 100, -0.05, 0.05);
52   snprintf(name, 200, "MomResZvsP%s", aName);
53   fMomResZvsP = new TH2D(name, "Z momentum resolution vs P", 100, 0.1, 2.0, 100, -0.05, 0.05);
54   snprintf(name, 200, "ImpactXY%s", aName);
55   fImpactXY   = new TH2D(name, "XY impact parameter vs P", 100, 0.1, 2.0, 200, -1.0, 1.0);
56   snprintf(name, 200, "ImpactZ%s", aName);
57   fImpactZ    = new TH2D(name,  "Z impact parameter vs P" , 100, 0.1, 2.0, 200, -1.0, 1.0);
58   snprintf(name, 200, "Sigma%s", aName);
59   fSigma    = new TH2D(name,  "Z impact parameter vs P" , 100, 0.1, 2.0, 200, -5.0, 5.0);
60 }
61
62 AliFemtoCutMonitorParticleMomRes::AliFemtoCutMonitorParticleMomRes(const AliFemtoCutMonitorParticleMomRes &aCut):
63   fMomRes3D(0),
64   fMomResXvsP(0),
65   fMomResYvsP(0),
66   fMomResZvsP(0),
67   fImpactXY(0),
68   fImpactZ(0),
69   fSigma(0),
70   fMass(0.13957)
71 {
72   // copy constructor
73   if (fMomRes3D) delete fMomRes3D;
74   fMomRes3D = new TH3D(*aCut.fMomRes3D);
75   if (fMomResXvsP) delete fMomResXvsP;
76   fMomResXvsP = new TH2D(*aCut.fMomResXvsP);
77   if (fMomResYvsP) delete fMomResYvsP;
78   fMomResYvsP = new TH2D(*aCut.fMomResYvsP);
79   if (fMomResZvsP) delete fMomResZvsP;
80   fMomResZvsP = new TH2D(*aCut.fMomResZvsP);
81   if (fImpactXY) delete fImpactXY;
82   fImpactXY = new TH2D(*aCut.fImpactXY);
83   if (fImpactZ) delete fImpactZ;
84   fImpactZ = new TH2D(*aCut.fImpactZ);
85   if (fSigma) delete fSigma;
86   fSigma = new TH2D(*aCut.fSigma);
87   fMass = aCut.fMass; 
88 }
89
90 AliFemtoCutMonitorParticleMomRes::~AliFemtoCutMonitorParticleMomRes()
91 {
92   // Destructor
93   delete fMomRes3D;
94   delete fMomResXvsP;
95   delete fMomResYvsP;
96   delete fMomResZvsP;
97   delete fImpactXY;
98   delete fImpactZ;
99   delete fSigma;
100 }
101
102 AliFemtoCutMonitorParticleMomRes& AliFemtoCutMonitorParticleMomRes::operator=(const AliFemtoCutMonitorParticleMomRes& aCut)
103 {
104   // assignment operator
105   if (this == &aCut) 
106     return *this;
107
108   if (fMomRes3D) delete fMomRes3D;
109   fMomRes3D = new TH3D(*aCut.fMomRes3D);
110   if (fMomResXvsP) delete fMomResXvsP;
111   fMomResXvsP = new TH2D(*aCut.fMomResXvsP);
112   if (fMomResYvsP) delete fMomResYvsP;
113   fMomResYvsP = new TH2D(*aCut.fMomResYvsP);
114   if (fMomResZvsP) delete fMomResZvsP;
115   fMomResZvsP = new TH2D(*aCut.fMomResZvsP);
116   if (fImpactXY) delete fImpactXY;
117   fImpactXY = new TH2D(*aCut.fImpactXY);
118   if (fImpactZ) delete fImpactZ;
119   fImpactZ = new TH2D(*aCut.fImpactZ);
120   if (fSigma) delete fSigma;
121   fSigma = new TH2D(*aCut.fSigma);
122   
123   return *this;
124 }
125
126 AliFemtoString AliFemtoCutMonitorParticleMomRes::Report(){ 
127   // Prepare report from the execution
128   string stemp = "*** AliFemtoCutMonitorParticleMomRes report"; 
129   AliFemtoString returnThis = stemp;
130   return returnThis; 
131 }
132
133 void AliFemtoCutMonitorParticleMomRes::Fill(const AliFemtoTrack* aTrack)
134 {
135   AliFemtoModelHiddenInfo *tInf = ( AliFemtoModelHiddenInfo *) aTrack->GetHiddenInfo();
136   fMomRes3D->Fill(tInf->GetTrueMomentum()->x() - aTrack->P().x(),
137                   tInf->GetTrueMomentum()->y() - aTrack->P().y(),
138                   tInf->GetTrueMomentum()->z() - aTrack->P().z());
139
140   fMomResXvsP->Fill(aTrack->P().mag(),
141                     tInf->GetTrueMomentum()->x() - aTrack->P().x());
142   fMomResYvsP->Fill(aTrack->P().mag(),
143                     tInf->GetTrueMomentum()->y() - aTrack->P().y());
144   fMomResZvsP->Fill(aTrack->P().mag(),
145                     tInf->GetTrueMomentum()->z() - aTrack->P().z());
146   fImpactXY->Fill(aTrack->P().mag(),
147                   aTrack->ImpactD());
148   fImpactZ->Fill(aTrack->P().mag(),
149                  aTrack->ImpactZ());
150   fSigma->Fill(aTrack->P().mag(),
151                aTrack->SigmaToVertex());
152 }
153
154 void 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
166 TList *AliFemtoCutMonitorParticleMomRes::GetOutputList()
167 {
168   TList *tOutputList = new TList();
169   tOutputList->Add(fMomRes3D);
170   tOutputList->Add(fMomResXvsP);
171   tOutputList->Add(fMomResYvsP);
172   tOutputList->Add(fMomResZvsP);
173   tOutputList->Add(fImpactXY);
174   tOutputList->Add(fImpactZ);
175   tOutputList->Add(fSigma);
176
177   return tOutputList;
178 }