AliPhysics  aaf9c62 (aaf9c62)
AliCentralMCMultiplicityTask.cxx
Go to the documentation of this file.
1 //====================================================================
2 //
3 // Base class for classes that calculate the multiplicity in the
4 // central region event-by-event
5 //
6 // Inputs:
7 // - AliESDEvent
8 //
9 // Outputs:
10 // - AliAODCentralMult
11 //
12 // Histograms
13 //
14 // Corrections used
19 #include "AliForwardUtil.h"
20 #include "AliAODForwardMult.h"
21 #include "AliLog.h"
22 #include "AliAODHandler.h"
23 #include "AliInputEventHandler.h"
24 #include "AliESDInputHandler.h"
25 #include "AliAnalysisManager.h"
26 #include "AliESDEvent.h"
27 #include "AliMultiplicity.h"
28 #include "AliFMDEventInspector.h"
29 #include <AliMCEvent.h>
30 #include <AliTrackReference.h>
31 #include <AliStack.h>
32 #include <TROOT.h>
33 #include <TH1D.h>
34 #include <TH2D.h>
35 #include <TH3D.h>
36 #include <TFile.h>
37 #include <TError.h>
38 #include <iostream>
39 #include <iomanip>
40 
41 //====================================================================
44  fTrackDensity(name),
45  fAODMCCentral(kTRUE)
46 {
47  //
48  // Constructor
49  //
50  DGUARD(fDebug,3,"Named CTOR of AliCentralMCMultiplicityTask: %s",
51  name);
52  fBranchNames =
53  "ESD:AliESDRun.,AliESDHeader.,AliMultiplicity.,"
54  "SPDVertex.,PrimaryVertex.";
55 }
56 //____________________________________________________________________
59  fTrackDensity(),
60  fAODMCCentral(kTRUE)
61 {
62  //
63  // Constructor
64  //
65  DGUARD(fDebug, 3,"Default CTOR of AliCentralMCMultiplicityTask");
66 }
67 //____________________________________________________________________
68 void
70 {
71  //
72  // Create output objects
73  //
74  //
75  DGUARD(fDebug,1,"Create user output in AliCentralMCMultiplicityTask");
77 
78  if (!ah)
79  // AliFatal("No AOD output handler set in analysis manager");
80  return;
81 
82 
83  TObject* obj = &fAODMCCentral;
84  ah->AddBranch("AliAODCentralMult", &obj);
85 }
86 //____________________________________________________________________
87 Bool_t
89 {
92  return true;
93 }
94 //____________________________________________________________________
96 {
98  fAODMCCentral.Init(e);
99  return true;
100 }
101 
102 //____________________________________________________________________
104 {
106  fAODMCCentral.Clear("");
107  return true;
108 }
109 //____________________________________________________________________
111 {
112  //
113  // Process each event
114  //
115  // Parameters:
116  // option Not used
117  //
118  DGUARD(fDebug,1,"Process event in AliCentralMCMultiplicityTask");
119 
120  fIvz = 0;
121  Bool_t lowFlux = kFALSE;
122  UInt_t triggers = 0;
123  UShort_t ivz = 0;
124  TVector3 ip;
125  Double_t cent = -1;
126  UShort_t nClusters = 0;
127  UInt_t found = fInspector.Process(&esd, triggers, lowFlux,
128  ivz, ip, cent, nClusters);
129 
130  // Make sure AOD is filled
132 
133  // Is this accepted for analysis?
134  Bool_t isAccepted = true;
135 
136  // No event or no trigger
137  if (found & AliFMDEventInspector::kNoEvent) isAccepted = false;
138  if (found & AliFMDEventInspector::kNoTriggers) isAccepted = false;
139  if (found & AliFMDEventInspector::kNoSPD) isAccepted = false;
140  if (found & AliFMDEventInspector::kNoVertex) isAccepted = false;
141  if (triggers & AliAODForwardMult::kPileUp) isAccepted = false;
142  if (found & AliFMDEventInspector::kBadVertex) isAccepted = false;
143 
144  VtxBin* bin = static_cast<VtxBin*>(fVtxList->At(ivz));
145  if (!bin) return false;
146 
147  //Doing analysis
148  if (isAccepted) {
149  const AliMultiplicity* spdmult = esd.GetMultiplicity();
150  TH2D& aodHist = fAODCentral.GetHistogram();
151 
152  ProcessESD(aodHist, spdmult);
153  bin->Correct(aodHist, fUseSecondary, fUseAcceptance);
154 
155  if (triggers & AliAODForwardMult::kInel)
156  fHData->Add(&(fAODCentral.GetHistogram()));
157  }
158 
159  const AliMCEvent* mcEvent = MCEvent();
160  if (!mcEvent) return false;
161  TH2D& hist = fAODMCCentral.GetHistogram();
162 
163 
164  fTrackDensity.Calculate(*mcEvent, ip, hist, NULL);
165  bin->Correct(hist, fUseSecondary, fUseAcceptance, false);
166 
167  return true;
168 }
169 
170 //____________________________________________________________________
171 void
173 {
174  //
175  // Print information
176  //
177  // Parameters:
178  // option Not used
179  //
181  gROOT->IncreaseDirLevel();
182  fTrackDensity.Print(option);
183  gROOT->DecreaseDirLevel();
184 }
185 //
186 // EOF
187 //
virtual void Print(Option_t *option="") const
virtual void ProcessESD(TH2D &hist, const AliMultiplicity *spdmult) const
double Double_t
Definition: External.C:58
void Print(Option_t *option="") const
virtual void CreateBranches(AliAODHandler *ah)
virtual Bool_t Event(AliESDEvent &esd)
virtual void CreateOutputObjects(TList *list)
virtual void MarkEventForStore() const
virtual Bool_t PreData(const TAxis &v, const TAxis &e)
Bool_t Calculate(const AliMCEvent &event, const TVector3 &ip, TH2D &output, TH2D *primary)
void Correct(TH2D &aodHist, Bool_t useSecondary, Bool_t useAcceptance, Bool_t sum=true) const
UInt_t Process(const AliESDEvent *event, UInt_t &triggers, Bool_t &lowFlux, UShort_t &ivz, TVector3 &ip, Double_t &cent, UShort_t &nClusters)
Per-event per bin.
unsigned int UInt_t
Definition: External.C:33
virtual void Print(Option_t *option="") const
Various utilities used in PWGLF/FORWARD.
void Init(const TAxis &etaAxis)
Definition: External.C:228
#define DGUARD(L, N, F,...)
const TH2D & GetHistogram() const
virtual Bool_t PreData(const TAxis &v, const TAxis &e)
virtual void CreateBranches(AliAODHandler *ah)
unsigned short UShort_t
Definition: External.C:28
void Clear(Option_t *opt)
const char Option_t
Definition: External.C:48
TObjArray * fVtxList
number of tracklets
bool Bool_t
Definition: External.C:53