2 // This class calculates the inclusive charged particle density
3 // in each for the 5 FMD rings based on the MC truth.
6 // - AliMCEvent MC truth event infromation
15 #include "AliFMDMCDensityCalculator.h"
17 #include "AliForwardCorrectionManager.h"
18 #include "AliFMDStripIndex.h"
19 #include "AliMCEvent.h"
20 #include "AliESDFMD.h"
23 #include <TProfile2D.h>
25 ClassImp(AliFMDMCDensityCalculator)
30 //____________________________________________________________________
31 AliFMDMCDensityCalculator::~AliFMDMCDensityCalculator()
36 if (fComps) fComps->Delete();
39 //____________________________________________________________________
40 AliFMDMCDensityCalculator&
41 AliFMDMCDensityCalculator::operator=(const AliFMDMCDensityCalculator& o)
44 // Assignement operator
47 // o Object to assign from
50 // Reference to this object
52 AliFMDDensityCalculator::operator=(o);
57 //____________________________________________________________________
59 AliFMDMCDensityCalculator::Init(const TAxis& eAxis)
62 // Initialize this object
65 // etaAxis Eta axis to use
67 AliFMDDensityCalculator::Init(eAxis);
68 fFMD1i = Make(1,'I',eAxis);
69 fFMD2i = Make(2,'I',eAxis);
70 fFMD2o = Make(2,'O',eAxis);
71 fFMD3i = Make(3,'I',eAxis);
72 fFMD3o = Make(3,'O',eAxis);
73 fFMD1iC = Make(1,'I');
74 fFMD2iC = Make(2,'I');
75 fFMD2oC = Make(2,'O');
76 fFMD3iC = Make(3,'I');
77 fFMD3oC = Make(3,'O');
78 fFMD1iD = Make(1,'I', 20);
79 fFMD2iD = Make(2,'I', 20);
80 fFMD2oD = Make(2,'O', 20);
81 fFMD3iD = Make(3,'I', 20);
82 fFMD3oD = Make(3,'O', 20);
102 //____________________________________________________________________
104 AliFMDMCDensityCalculator::CalculateMC(const AliESDFMD& fmd,
105 AliForwardUtil::Histos& hists)
108 // Calculate the charged particle density from the MC track references.
111 // fmd Forward MC event
112 // hists Histograms to fill
113 // vz Interaction z coordinate @f$ v_z@f$
114 // vtxBin bin corresponding to @f$ v_z@f$
119 for (UShort_t d=1; d<=3; d++) {
120 UShort_t nr = (d == 1 ? 1 : 2);
121 for (UShort_t q=0; q<nr; q++) {
122 Char_t r = (q == 0 ? 'I' : 'O');
123 UShort_t ns= (q == 0 ? 20 : 40);
124 UShort_t nt= (q == 0 ? 512 : 256);
125 TH2D* h = hists.Get(d,r);
127 for (UShort_t s=0; s<ns; s++) {
128 for (UShort_t t=0; t<nt; t++) {
129 Float_t mult = fmd.Multiplicity(d,r,s,t);
131 if (mult == 0 || mult > 20) continue;
133 Float_t phi = fmd.Phi(d,r,s,t) / 180 * TMath::Pi();
134 Float_t eta = fmd.Eta(d,r,s,t);
136 Float_t corr = Correction(d, r, s, t, 0, eta, false);
137 Float_t sig = (corr <= 0 ? 0 : mult / corr);
138 h->Fill(eta,phi,sig);
146 //____________________________________________________________________
148 AliFMDMCDensityCalculator::Make(UShort_t d, Char_t r,
149 const TAxis& axis) const
152 // MAke comparison profiles
160 // Newly allocated profile object
162 TProfile2D* ret = new TProfile2D(Form("FMD%d%c_esd_vs_mc", d, r),
163 Form("ESD/MC signal for FMD%d%c", d, r),
167 (r == 'I' || r == 'i') ? 20 : 40,
169 ret->GetXaxis()->SetTitle("#eta");
170 ret->GetYaxis()->SetTitle("#varphi [radians]");
171 ret->GetZaxis()->SetTitle("#LT #deltaN_{ch,incl}=N_{ch,incl,ana}-N_{ch,incl,mc}#GT");
172 ret->SetDirectory(0);
175 //____________________________________________________________________
177 AliFMDMCDensityCalculator::Make(UShort_t d, Char_t r) const
180 // MAke comparison profiles
187 // Newly allocated profile object
189 TH2D* ret = new TH2D(Form("FMD%d%c_corr_mc_esd", d, r),
190 Form("ESD-MC correlation for FMD%d%c", d, r),
191 41, -.5, 40.5, 410, -.5, 40.5);
192 ret->GetXaxis()->SetTitle("m_{incl} (MC)");
193 ret->GetYaxis()->SetTitle("m_{incl} from #Delta/#Delta_{mp} (ESD)");
194 ret->GetZaxis()->SetTitle("Correlation");
195 ret->SetDirectory(0);
198 //____________________________________________________________________
200 AliFMDMCDensityCalculator::Make(UShort_t d, Char_t r, Int_t max) const
203 // MAke comparison profiles
210 // Newly allocated profile object
212 TH1D* ret = new TH1D(Form("FMD%d%c_diff_mc_esd", d, r),
213 Form("ESD-MC difference for FMD%d%c", d, r),
215 ret->GetXaxis()->SetTitle("MC - ESD");
216 ret->SetDirectory(0);
219 //____________________________________________________________________
221 AliFMDMCDensityCalculator::Fill(UShort_t d, Char_t r, TH2* esd, TH2* mc)
224 // Fill comparison profiles
232 if (!esd || !mc) return;
243 p = (r == 'I' || r == 'i' ? fFMD2i : fFMD2o);
244 h = (r == 'I' || r == 'i' ? fFMD2iC : fFMD2oC);
245 x = (r == 'I' || r == 'i' ? fFMD2iD : fFMD2oD);
248 p = (r == 'I' || r == 'i' ? fFMD3i : fFMD3o);
249 h = (r == 'I' || r == 'i' ? fFMD3iC : fFMD3oC);
250 x = (r == 'I' || r == 'i' ? fFMD3iD : fFMD3oD);
255 for (Int_t iEta = 1; iEta <= esd->GetNbinsX(); iEta++) {
256 Double_t eta = esd->GetXaxis()->GetBinCenter(iEta);
257 for (Int_t iPhi = 1; iPhi <= esd->GetNbinsY(); iPhi++) {
258 Double_t phi = esd->GetYaxis()->GetBinCenter(iPhi);
259 Double_t mEsd = esd->GetBinContent(iEta,iPhi);
260 Double_t mMc = mc->GetBinContent(iEta,iPhi);
262 if (mMc <= 0 && mEsd <= 0) continue;
264 p->Fill(eta, phi, mEsd - mMc);
270 //____________________________________________________________________
272 AliFMDMCDensityCalculator::CompareResults(AliForwardUtil::Histos& esd,
273 AliForwardUtil::Histos& mc)
276 // Compare the result of analysing the ESD for
277 // the inclusive charged particle density to analysing
287 Fill(1, 'I', esd.Get(1,'I'), mc.Get(1,'I'));
288 Fill(2, 'I', esd.Get(2,'I'), mc.Get(2,'I'));
289 Fill(2, 'O', esd.Get(2,'O'), mc.Get(2,'O'));
290 Fill(3, 'I', esd.Get(3,'I'), mc.Get(3,'I'));
291 Fill(3, 'O', esd.Get(3,'O'), mc.Get(3,'O'));
296 //____________________________________________________________________
298 AliFMDMCDensityCalculator::DefineOutput(TList* dir)
301 // Output diagnostic histograms to directory
304 // dir List to write in
306 AliFMDDensityCalculator::DefineOutput(dir);
307 TList* d = static_cast<TList*>(dir->FindObject(GetName()));
311 fComps->SetName("esd_mc_comparison");
315 //____________________________________________________________________