AliPhysics  c0be15e (c0be15e)
AliForwardTriggerBiasCorrection.cxx
Go to the documentation of this file.
1  /*
2  * @file AliForwardTriggerBiasCorrection.cxx
3  * @author Valentina Zaccolo
4  * @date Mon Feb 3 11:30:24 2014
5  **
6  * @brief
7  *
8  *
9  * @ingroup pwglf_forward_multdist
10  */
11 
12 #include <TH1D.h>
15 #include "AliAODForwardMult.h"
16 #include "AliAODCentralMult.h"
17 #include "AliAODEvent.h"
18 #include "AliFMDMCEventInspector.h"
19 #include "AliAODMCHeader.h"
20 #include "AliAODMCParticle.h"
21 
22 
24 #if 0
25 ; // This is for Emacs - do not delete
26 #endif
27 //_____________________________________________________________________
30 {
31  return new Bin(l,h);
32 }
33 //_____________________________________________________________________
35 {
38 }
39 
40 //=====================================================================
42  Int_t max)
43 {
44  //
45  // Define eta bin output histos
46  //
48  TList* out = static_cast<TList*>(cont->FindObject(GetName()));
49  if (!out) return;
50 
51  fMCClass = new TH1D("fMCClass","fMCClass", max,-0.5,max-.5);
52  fESDClass = new TH1D("fESDClass","fESDClass", max,-0.5,max-.5);
53  fMCESDClass = new TH1D("fMCESDClass","fMCESDClass", max,-0.5,max-.5);
54 
55  out->Add(fMCClass);
56  out->Add(fESDClass);
57  out->Add(fMCESDClass);
58 }
59 
60 
61 //_____________________________________________________________________
62 void
64 Bin::Process(TH1D* dndetaForward,
65  TH1D* dndetaCentral,
66  TH1D* normForward,
67  TH1D* normCentral,
68  TH1D* mc,
69  Double_t ipZ,
70  Bool_t pileup,
71  Bool_t selectedTrigger,
72  Bool_t isMCClass,
73  Bool_t isESDClass,
74  const AliAODEvent& aodevent,
75  Double_t minIPz,
76  Double_t maxIPz)
77 {
78  //
79  // Process a single eta bin
80  //
81  Double_t mcMult, mcErr, statErr, sysErr;
82  Double_t mult = CalcMult(dndetaForward,
83  dndetaCentral,
84  normForward,
85  normCentral,
86  mc,
87  ipZ,
88  statErr,
89  sysErr,
90  mcMult,
91  mcErr);
92  Double_t trMult = mcMult;
93  Double_t mcIPz = mc->GetBinContent(0,0); // IP from MC stored here
94  // The stuff below is redundant. We've already filled the MC
95  // histogram with the exact same information, and we have the IPz
96  // from MC in the under-flow bin 0,0 of the MC histogram.
97  // Furthermore, we use the information stored in the MC histogram to
98  // form the response matrix, so we should also use the same
99  // information to build the trigger bias correction.
100  //
101  // In fact, this class is really not very useful, since we could
102  // have the same code in the MC class for doing the response matrix.
103  // That would ensure that we have the same number in.
104 #if 0
105  // MC particles from event
106  TClonesArray* mcArray =
107  static_cast<TClonesArray*>(aodevent.
108  FindListObject(AliAODMCParticle::
109  StdBranchName()));
110  if(!mcArray){
111  AliWarning("No MC array found in AOD. Try making it again.");
112  return;
113  }
114  AliAODMCHeader* header =
115  static_cast<AliAODMCHeader*>(aodevent.
116  FindListObject(AliAODMCHeader::
117  StdBranchName()));
118  if (!header) {
119  AliWarning("No header found.");
120  return;
121  }
122  // Track loop: find MC truth multiplicity in selected eta bin - this
123  // is probably redundant
124  trMult = 0;
125  mcIPz = header->GetVtxZ();
126  Int_t ntracks = mcArray->GetEntriesFast();
127  for (Int_t it = 0; it < ntracks; it++) {
128  AliAODMCParticle* particle = (AliAODMCParticle*)mcArray->At(it);
129  if (!particle) {
130  AliError(Form("Could not receive track %d", it));
131  continue;
132  }
133  if (!particle->IsPhysicalPrimary()) continue;
134  if (particle->Charge() == 0) continue;
135  if (particle->Eta() > fEtaLow && particle->Eta() < fEtaHigh-0.0001)
136  trMult++;
137  }
138 #endif
139 
140  // fill fMCClass with multiplicity of MC truth NSD events with MC
141  // truth |vtxz|<4
142  if (mcIPz > minIPz && mcIPz < maxIPz) {
143  if(isMCClass){
144  fMCClass->Fill(trMult);
145  }
146  }
147  // fill fESDClass with multiplicity from events with a reconstructed
148  // NSD trigger and reconstructed |vtxz|<4
149  if (ipZ > minIPz && ipZ < maxIPz){
150  if(isESDClass){
151  fESDClass->Fill(trMult);
152  }
153  }
154  // fullfilling both requirements of fMCClass and fESDClass
155  if(/* mcIPz > minIPz &&
156  mcIPz < maxIPz && */
157  ipZ > minIPz &&
158  ipZ < maxIPz &&
159  isMCClass && isESDClass){
160  fMCESDClass->Fill(trMult);
161  }
162 
163  if (!selectedTrigger) return;
164  fHist->Fill(mult);
165  fHistMC->Fill(mcMult);
166 }
167 
168 
169 
170 
171 //_____________________________________________________________________
172 //
173 //
174 // EOF
Bool_t IsESDClass(AliAODForwardMult *) const
double Double_t
Definition: External.C:58
virtual void CreateOutputObjects(TList *cont, Int_t max)
Per-event per bin.
int Int_t
Definition: External.C:63
static Bool_t IsTriggerBits(UInt_t bits, UInt_t trg)
virtual void CreateOutputObjects(TList *cont, Int_t max)
Definition: External.C:212
Task to do the multiplicity distibution.
virtual void Process(TH1D *dndetaForward, TH1D *dndetaCentral, TH1D *normForward, TH1D *normCentral, TH1D *dndetaMC, Double_t ipZ, Bool_t pileup, Bool_t selectedTrigger, Bool_t isMCClass, Bool_t isESDClass, const AliAODEvent &aodevent, Double_t minIPz, Double_t maxIPz)
bool Bool_t
Definition: External.C:53
AliBaseMultTask::Bin * MakeBin(Double_t etaLow, Double_t etaHigh)