]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/AliFMDMCHitEnergyFitterTask.cxx
Added tasks and trains to investigate time-to-previous event.
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliFMDMCHitEnergyFitterTask.cxx
CommitLineData
0b7de667 1#include "AliFMDMCHitEnergyFitterTask.h"
2#include "AliForwardCorrectionManager.h"
3#include "AliAODForwardMult.h"
4#include "AliMCAuxHandler.h"
5#include <TROOT.h>
6#include <TNtuple.h>
7
8//____________________________________________________________________
9AliFMDMCHitEnergyFitterTask::AliFMDMCHitEnergyFitterTask(const char* name,
10 Bool_t useTuple)
11 : AliBaseESDTask(name, "", &(AliForwardCorrectionManager::Instance())),
12 fEventInspector("event"),
13 fEnergyFitter("fitter", useTuple),
14 fHitHandler(0)
15{
16 fCloneList = true;
17 if (useTuple) DefineOutput(3, TNtuple::Class());
18}
19
20//____________________________________________________________________
21TAxis*
22AliFMDMCHitEnergyFitterTask::DefaultEtaAxis() const
23{
24 static TAxis* a = new TAxis(0, 0, 0);
25 return a;
26}
27//____________________________________________________________________
28TAxis*
29AliFMDMCHitEnergyFitterTask::DefaultVertexAxis() const
30{
31 static TAxis* a = new TAxis(10, -10, 10);
32 return a;
33}
34
35//____________________________________________________________________
36Bool_t
37AliFMDMCHitEnergyFitterTask::Setup()
38{
39 DGUARD(fDebug,1,"Setting up the MC hit energy loss task");
40 fEnergyFitter.Init();
41 return true;
42}
43
44//____________________________________________________________________
45Bool_t
46AliFMDMCHitEnergyFitterTask::Book()
47{
48 DGUARD(fDebug,1,"Booking histograms for the MC hit energy loss task");
49 fNeededCorrections = 0;
50 fExtraCorrections = 0;
51
52 fEnergyFitter.CreateOutputObjects(fList);
53 // We have to add the handler here, since the subsiduary handlers of
54 // AliMCEventHandler are not streamed with the parent object - sigh!
55 // Hence, we add it at init time of the slaves.
56 fHitHandler = AliMCAuxHandler::Create("FMD", "AliFMDHit");
57 return true;
58}
59
60//____________________________________________________________________
61Bool_t
62AliFMDMCHitEnergyFitterTask::PreData(const TAxis& /*ipz*/, const TAxis& eta)
63{
64 DGUARD(fDebug,2,"Final setup of the MC hit energy loss task");
65 fEnergyFitter.SetupForData(eta);
66 if (fEnergyFitter.GetTuple())
67 PostData(3, fEnergyFitter.GetTuple());
68 return true;
69}
70//____________________________________________________________________
71Bool_t
72AliFMDMCHitEnergyFitterTask::Event(AliESDEvent& esd)
73{
74 // --- Read in the data --------------------------------------------
75 LoadBranches();
76
77 Bool_t lowFlux = kFALSE;
78 UInt_t triggers = 0;
79 UShort_t ivz = 0;
80 TVector3 ip;
81 Double_t cent = 0;
82 UShort_t nClusters = 0;
83 UInt_t found = fEventInspector.Process(&esd, triggers, lowFlux,
84 ivz, ip, cent, nClusters);
85 if (found & AliFMDEventInspector::kNoEvent) return false;
86 if (found & AliFMDEventInspector::kNoTriggers) return false;
87 if (found & AliFMDEventInspector::kNoSPD) return false;
88 if (found & AliFMDEventInspector::kNoFMD) return false;
89 if (found & AliFMDEventInspector::kNoVertex) return false;
90 if (found & AliFMDEventInspector::kBadVertex) return false;
91
92 // do not process pile-up, A, C, and E events
93 if (triggers & AliAODForwardMult::kPileUp) return false;
94 if (triggers & AliAODForwardMult::kA) return false;
95 if (triggers & AliAODForwardMult::kC) return false;
96 if (triggers & AliAODForwardMult::kE) return false;
97
98 // We want only the events found by off-line
99 if (!(triggers & AliAODForwardMult::kOffline)) return false;
100
101 // Perhaps we should also insist on MB only
102 // if (fOnlyMB && (!(triggers & AliAODForwardMult::kInel))) return false;
103
104 AliMCEvent* mc = MCEvent();
105 if (!mc) return false;
106
107 Bool_t ret = fEnergyFitter.Event(esd, *mc, *fHitHandler);
108
109 if (fEnergyFitter.GetTuple())
110 PostData(3, fEnergyFitter.GetTuple());
111
112 return ret;
113}
114#define PFB(N,FLAG) \
115 do { \
116 AliForwardUtil::PrintName(N); \
117 std::cout << std::boolalpha << (FLAG) << std::noboolalpha << std::endl; \
118 } while(false)
119
120//____________________________________________________________________
121void
122AliFMDMCHitEnergyFitterTask::Print(Option_t* option) const
123{
124 AliBaseESDTask::Print(option);
125 gROOT->IncreaseDirLevel();
126 fEnergyFitter.Print(option);
127 gROOT->DecreaseDirLevel();
128}
129
130//
131// EOF
132//
133
134