AliPhysics  d565ceb (d565ceb)
AliForwardMCCorrectionsTask.cxx
Go to the documentation of this file.
1 //
2 // Calculate the corrections in the forward regions
3 //
4 // Inputs:
5 // - AliESDEvent
6 //
7 // Outputs:
8 // - AliAODForwardMult
9 //
10 // Histograms
11 //
12 // Corrections used
13 //
16 #include "AliTriggerAnalysis.h"
17 #include "AliPhysicsSelection.h"
18 #include "AliLog.h"
19 #include "AliHeader.h"
20 #include "AliGenEventHeader.h"
21 #include "AliESDEvent.h"
22 #include "AliAODHandler.h"
23 #include "AliMultiplicity.h"
24 #include "AliInputEventHandler.h"
25 #include "AliStack.h"
26 #include "AliMCEvent.h"
27 #include "AliAODForwardMult.h"
28 #include "AliFMDStripIndex.h"
29 #include "AliFMDCorrSecondaryMap.h"
30 #include <TH1.h>
31 #include <TH2D.h>
32 #include <TDirectory.h>
33 #include <TTree.h>
34 #include <TList.h>
35 #include <TROOT.h>
36 #include <TVector3.h>
37 #include <iostream>
38 
39 //====================================================================
42  fTrackDensity(),
43  fESDFMD(),
44  fSecCorr(0)
45 {
46  //
47  // Constructor
48  //
49  // Parameters:
50  // name Name of task
51  //
52 }
53 
54 //____________________________________________________________________
57  fTrackDensity("trackDensity"),
58  fESDFMD(),
59  fSecCorr(0)
60 {
61  //
62  // Constructor
63  //
64  // Parameters:
65  // name Name of task
66 }
67 
68 
69 //____________________________________________________________________
72 {
73  return new AliForwardMCCorrectionsTask::VtxBin(low,high, fEtaAxis);
74 }
75 
76 //____________________________________________________________________
77 Bool_t
79 {
80  // Clear our ESD object
81  fESDFMD.Clear();
82  return true;
83 }
84 
85 //____________________________________________________________________
86 Bool_t
88  const AliMCEvent& mc,
90  const TVector3& ip)
91 {
92  AliESDFMD* esdFMD = esd.GetFMDData();
93  const Float_t maxMult = 100;
94  fTrackDensity.Calculate(*esdFMD, mc, ip, fESDFMD, bin.fPrimary);
95  bin.fCounts->Fill(0.5);
96 
98  static_cast<AliForwardMCCorrectionsTask::VtxBin&>(bin);
99 
100  // And then bin the data in our vtxbin
101  for (UShort_t d=1; d<=3; d++) {
102  UShort_t nr = (d == 1 ? 1 : 2);
103  for (UShort_t q=0; q<nr; q++) {
104  Char_t r = (q == 0 ? 'I' : 'O');
105  UShort_t ns= (q == 0 ? 20 : 40);
106  UShort_t nt= (q == 0 ? 512 : 256);
107  TH2D* h = vb.fHists.Get(d,r);
108 
109  for (UShort_t s=0; s<ns; s++) {
110  for (UShort_t t=0; t<nt; t++) {
111  Float_t mult = fESDFMD.Multiplicity(d,r,s,t);
112 
113  if (mult == 0 || mult > maxMult) continue;
114 
115  Float_t phi = fESDFMD.Phi(d,r,s,t) / 180 * TMath::Pi();
116  Float_t eta = fESDFMD.Eta(d,r,s,t);
117  h->Fill(eta,phi,mult);
118  } // for t
119  } // for s
120  } // for q
121  } // for d
122  return true;
123 }
124 //____________________________________________________________________
125 void
127 {
131  results->Add(fSecCorr);
132 }
133 
134 //____________________________________________________________________
135 Bool_t
137  bin, UShort_t iVz)
138 {
139 
141  static_cast<AliForwardMCCorrectionsTask::VtxBin*>(bin);
142  vb->Terminate(fList, fResults, iVz, fSecCorr);
143  return true;
144 }
145 
146 
147 //____________________________________________________________________
148 void
150 {
152  gROOT->IncreaseDirLevel();
153  fTrackDensity.Print(option);
154  gROOT->DecreaseDirLevel();
155 }
156 
157 //====================================================================
160  fHists()
161 {
162 }
163 //____________________________________________________________________
165  Double_t high,
166  const TAxis& axis)
167  : AliBaseMCCorrectionsTask::VtxBin(low, high, axis, 40),
168  fHists()
169 {
170  fHists.Init(axis);
171 }
172 
173 
174 //____________________________________________________________________
175 TList*
177 {
179 
180  d->Add(fHists.fFMD1i);
181  d->Add(fHists.fFMD2i);
182  d->Add(fHists.fFMD2o);
183  d->Add(fHists.fFMD3i);
184  d->Add(fHists.fFMD3o);
185 
186  return d;
187 }
188 
189 //____________________________________________________________________
190 TH2D*
192  const TH2D* primary) const
193 {
194  TH2D* h = static_cast<TH2D*>(hits->Clone());
195  h->SetDirectory(0);
196  TString n(h->GetName());
197  n.ReplaceAll("_cache", "");
198  h->SetName(n);
199  h->Divide(primary);
200 
201  return h;
202 }
203 
204 //____________________________________________________________________
205 void
207  TList* output,
208  UShort_t iVz,
210 {
211  TList* out = new TList;
212  out->SetName(GetName());
213  out->SetOwner();
214  output->Add(out);
215 
216  TList* l = static_cast<TList*>(input->FindObject(GetName()));
217  if (!l) {
218  AliError(Form("List %s not found in %s", GetName(), input->GetName()));
219  return;
220  }
221 
222  TH2D* fmd1i = static_cast<TH2D*>(l->FindObject("FMD1I_cache"));
223  TH2D* fmd2i = static_cast<TH2D*>(l->FindObject("FMD2I_cache"));
224  TH2D* fmd2o = static_cast<TH2D*>(l->FindObject("FMD2O_cache"));
225  TH2D* fmd3i = static_cast<TH2D*>(l->FindObject("FMD3I_cache"));
226  TH2D* fmd3o = static_cast<TH2D*>(l->FindObject("FMD3O_cache"));
227  TH2D* primO = static_cast<TH2D*>(l->FindObject("primary"));
228  if (!fmd1i || !fmd2i || !fmd2o || !fmd3i || !fmd3o || !primO) {
229  AliError(Form("Missing histogram(s): %p,%p,%p,%p,%p,%p",
230  fmd1i, fmd2i, fmd2o, fmd3i, fmd3o, primO));
231  return;
232  }
233 
234  // Half coverage in phi for inners
235  TH2D* primI = static_cast<TH2D*>(primO->Clone());
236  primI->SetDirectory(0);
237  primI->RebinY(2);
238 
239  TH2D* bg1i = MakeBg(fmd1i, primI);
240  TH2D* bg2i = MakeBg(fmd2i, primI);
241  TH2D* bg2o = MakeBg(fmd2o, primO);
242  TH2D* bg3i = MakeBg(fmd3i, primI);
243  TH2D* bg3o = MakeBg(fmd3o, primO);
244  map->SetCorrection(1, 'I', iVz, bg1i);
245  map->SetCorrection(2, 'I', iVz, bg2i);
246  map->SetCorrection(2, 'O', iVz, bg2o);
247  map->SetCorrection(3, 'I', iVz, bg3i);
248  map->SetCorrection(3, 'O', iVz, bg3o);
249  out->Add(bg1i);
250  out->Add(bg2i);
251  out->Add(bg2o);
252  out->Add(bg3i);
253  out->Add(bg3o);
254 
255 }
256 
257 //
258 // EOF
259 //
virtual void CreateCorrections(TList *results)
Bool_t SetCorrection(UShort_t d, Char_t r, Double_t v, TH2D *h)
double Double_t
Definition: External.C:58
char Char_t
Definition: External.C:18
Bool_t Calculate(const AliESDFMD &esd, const AliMCEvent &event, const TVector3 &ip, AliESDFMD &output, TH2D *primary)
TH2D * MakeBg(const TH2D *hits, const TH2D *primary) const
void Print(Option_t *option="") const
Per-event per bin.
float Float_t
Definition: External.C:68
AliBaseMCCorrectionsTask::VtxBin * CreateVtxBin(Double_t low, Double_t high)
void SetVertexAxis(const TAxis &axis)
Definition: External.C:228
virtual TList * CreateOutputObjects(TList *list)
virtual Bool_t FinalizeVtxBin(AliBaseMCCorrectionsTask::VtxBin *bin, UShort_t iVz)
void Print(Option_t *option="") const
TH2D * Get(UShort_t d, Char_t r) const
void Init(const TAxis &etaAxis)
void Print(Option_t *option="") const
unsigned short UShort_t
Definition: External.C:28
void Terminate(const TList *i, TList *o, UShort_t iVz, AliFMDCorrSecondaryMap *map)
const char Option_t
Definition: External.C:48
void SetEtaAxis(const TAxis &axis)
bool Bool_t
Definition: External.C:53
Double_t maxMult
Bool_t ProcessESD(const AliESDEvent &esd, const AliMCEvent &mc, AliBaseMCCorrectionsTask::VtxBin &bin, const TVector3 &ip)