]>
Commit | Line | Data |
---|---|---|
7984e5f7 | 1 | // |
2 | // Histogram and fit the energy loss distributions for the FMD | |
3 | // | |
4 | // Inputs: | |
5 | // - AliESDEvent | |
6 | // | |
7 | // Outputs: | |
8 | // - None | |
9 | // | |
10 | // Histograms: | |
11 | // | |
12 | // Corrections used: | |
13 | // - None | |
14 | // | |
15 | // | |
16 | // | |
0bd4b00f | 17 | #include "AliFMDEnergyFitterTask.h" |
18 | #include "AliLog.h" | |
0bd4b00f | 19 | #include "AliESDEvent.h" |
c8b1a7db | 20 | #include "AliESDFMD.h" |
21 | #include "AliMCEvent.h" | |
0bd4b00f | 22 | #include "AliAODForwardMult.h" |
0bd4b00f | 23 | #include "AliAnalysisManager.h" |
c8b1a7db | 24 | #include "AliForwardCorrectionManager.h" |
0bd4b00f | 25 | #include <TH1.h> |
26 | #include <TDirectory.h> | |
27 | #include <TTree.h> | |
72cc12cd | 28 | #include <TFile.h> |
e65b8b56 | 29 | #include <TROOT.h> |
e58000b7 | 30 | #include <iostream> |
0bd4b00f | 31 | |
32 | //==================================================================== | |
33 | AliFMDEnergyFitterTask::AliFMDEnergyFitterTask() | |
c8b1a7db | 34 | : AliBaseESDTask(), |
0bd4b00f | 35 | fEventInspector(), |
36 | fEnergyFitter(), | |
a03f01f7 | 37 | fOnlyMB(false) |
0bd4b00f | 38 | { |
7984e5f7 | 39 | // |
40 | // Constructor | |
41 | // | |
5ca83fee | 42 | DGUARD(fDebug, 3,"Default CTOR of AliFMDEnergyFitterTask"); |
c8b1a7db | 43 | fCloneList = true; |
0bd4b00f | 44 | } |
45 | ||
46 | //____________________________________________________________________ | |
47 | AliFMDEnergyFitterTask::AliFMDEnergyFitterTask(const char* name) | |
c8b1a7db | 48 | : AliBaseESDTask(name, "", &(AliForwardCorrectionManager::Instance())), |
0bd4b00f | 49 | fEventInspector("event"), |
50 | fEnergyFitter("energy"), | |
a03f01f7 | 51 | fOnlyMB(false) |
0bd4b00f | 52 | { |
7984e5f7 | 53 | // |
54 | // Constructor | |
55 | // | |
56 | // Parameters: | |
57 | // name Name of task | |
58 | // | |
5ca83fee | 59 | DGUARD(fDebug, 3,"Named CTOR of AliFMDEnergyFitterTask: %s", name); |
c8b1a7db | 60 | fCloneList = true; |
0bd4b00f | 61 | } |
62 | ||
0bd4b00f | 63 | |
64 | //____________________________________________________________________ | |
65 | void | |
66 | AliFMDEnergyFitterTask::SetDebug(Int_t dbg) | |
67 | { | |
7984e5f7 | 68 | // |
69 | // Set the debug level | |
70 | // | |
71 | // Parameters: | |
72 | // dbg Debug level | |
73 | // | |
c8b1a7db | 74 | AliBaseESDTask::SetDebug(dbg); |
0bd4b00f | 75 | fEnergyFitter.SetDebug(dbg); |
76 | } | |
0bd4b00f | 77 | //____________________________________________________________________ |
c8b1a7db | 78 | TAxis* |
79 | AliFMDEnergyFitterTask::DefaultEtaAxis() const | |
0bd4b00f | 80 | { |
c8b1a7db | 81 | static TAxis* a = new TAxis(0, 0, 0); |
82 | return a; | |
0bd4b00f | 83 | } |
0bd4b00f | 84 | //____________________________________________________________________ |
c8b1a7db | 85 | TAxis* |
86 | AliFMDEnergyFitterTask::DefaultVertexAxis() const | |
0bd4b00f | 87 | { |
c8b1a7db | 88 | static TAxis* a = new TAxis(10, -10, 10); |
89 | return a; | |
0bd4b00f | 90 | } |
91 | ||
0b7de667 | 92 | //____________________________________________________________________ |
93 | Bool_t | |
94 | AliFMDEnergyFitterTask::Setup() | |
95 | { | |
96 | fEnergyFitter.Init(); | |
97 | return true; | |
98 | } | |
99 | ||
0bd4b00f | 100 | //____________________________________________________________________ |
c8b1a7db | 101 | Bool_t |
102 | AliFMDEnergyFitterTask::Book() | |
0bd4b00f | 103 | { |
7984e5f7 | 104 | // |
105 | // Create output objects | |
106 | // | |
107 | // | |
6ab100ec | 108 | DGUARD(fDebug,1,"Create output objects of AliFMDEnergyFitterTask"); |
0bd4b00f | 109 | |
c8b1a7db | 110 | // We don't need any corrections for this task |
111 | fNeededCorrections = 0; | |
112 | fExtraCorrections = 0; | |
113 | ||
5934a3e3 | 114 | fEnergyFitter.CreateOutputObjects(fList); |
0bd4b00f | 115 | |
a03f01f7 | 116 | fList->Add(AliForwardUtil::MakeParameter("onlyMB", fOnlyMB)); |
c8b1a7db | 117 | return true; |
0bd4b00f | 118 | } |
119 | //____________________________________________________________________ | |
c8b1a7db | 120 | Bool_t |
121 | AliFMDEnergyFitterTask::PreData(const TAxis& /*vertex*/, const TAxis& eta) | |
122 | { | |
123 | // | |
124 | // Initialise the sub objects and stuff. Called on first event | |
125 | // | |
126 | // | |
127 | DGUARD(fDebug,1,"Initialize subs of AliFMDEnergyFitterTask"); | |
128 | ||
129 | fEnergyFitter.SetupForData(eta); | |
130 | ||
131 | return true; | |
132 | } | |
133 | ||
134 | //____________________________________________________________________ | |
135 | Bool_t | |
136 | AliFMDEnergyFitterTask::Event(AliESDEvent& esd) | |
0bd4b00f | 137 | { |
7984e5f7 | 138 | // |
139 | // Process each event | |
140 | // | |
141 | // Parameters: | |
142 | // option Not used | |
143 | // | |
144 | ||
0bd4b00f | 145 | // static Int_t cnt = 0; |
146 | // cnt++; | |
147 | // Get the input data | |
db298fc6 | 148 | DGUARD(fDebug,3,"Analyse event of AliFMDEnergyFitterTask"); |
5934a3e3 | 149 | // --- Read in the data -------------------------------------------- |
150 | LoadBranches(); | |
151 | ||
5bb5d1f6 | 152 | Bool_t lowFlux = kFALSE; |
153 | UInt_t triggers = 0; | |
154 | UShort_t ivz = 0; | |
5ca83fee | 155 | TVector3 ip; |
5bb5d1f6 | 156 | Double_t cent = 0; |
157 | UShort_t nClusters = 0; | |
c8b1a7db | 158 | UInt_t found = fEventInspector.Process(&esd, triggers, lowFlux, |
5ca83fee | 159 | ivz, ip, cent, nClusters); |
c8b1a7db | 160 | if (found & AliFMDEventInspector::kNoEvent) return false; |
161 | if (found & AliFMDEventInspector::kNoTriggers) return false; | |
162 | if (found & AliFMDEventInspector::kNoSPD) return false; | |
163 | if (found & AliFMDEventInspector::kNoFMD) return false; | |
164 | if (found & AliFMDEventInspector::kNoVertex) return false; | |
165 | if (found & AliFMDEventInspector::kBadVertex) return false; | |
81775aba | 166 | |
167 | // do not process pile-up, A, C, and E events | |
c8b1a7db | 168 | if (triggers & AliAODForwardMult::kPileUp) return false; |
169 | if (triggers & AliAODForwardMult::kA) return false; | |
170 | if (triggers & AliAODForwardMult::kC) return false; | |
171 | if (triggers & AliAODForwardMult::kE) return false; | |
12fffad7 | 172 | |
81775aba | 173 | // We want only the events found by off-line |
c8b1a7db | 174 | if (!(triggers & AliAODForwardMult::kOffline)) return false; |
81775aba | 175 | |
a03f01f7 | 176 | // Perhaps we should also insist on MB only |
177 | if (fOnlyMB && (!(triggers & AliAODForwardMult::kInel))) return false; | |
178 | ||
12fffad7 | 179 | // if(cent > 0) { |
180 | // if( cent < 40 || cent >50 ) return; | |
181 | // else std::cout<<"selecting event with cent "<<cent<<std::endl; | |
182 | // } | |
183 | ||
0bd4b00f | 184 | // Get FMD data |
c8b1a7db | 185 | AliESDFMD* esdFMD = esd.GetFMDData(); |
0bd4b00f | 186 | // Do the energy stuff |
5e4d905e | 187 | if (!fEnergyFitter.Accumulate(*esdFMD, cent, |
188 | triggers & AliAODForwardMult::kEmpty)){ | |
0bd4b00f | 189 | AliWarning("Energy fitter failed"); |
c8b1a7db | 190 | return false; |
0bd4b00f | 191 | } |
0bd4b00f | 192 | |
c8b1a7db | 193 | return true; |
db298fc6 | 194 | } |
195 | ||
0bd4b00f | 196 | //____________________________________________________________________ |
c8b1a7db | 197 | Bool_t |
198 | AliFMDEnergyFitterTask::Finalize() | |
0bd4b00f | 199 | { |
7984e5f7 | 200 | // |
201 | // End of job | |
202 | // | |
203 | // Parameters: | |
204 | // option Not used | |
205 | // | |
6ab100ec | 206 | DGUARD(fDebug,1,"Processing merged output of AliFMDEnergyFitterTask"); |
207 | ||
1c762251 | 208 | AliInfo("Fitting energy loss spectra"); |
c8b1a7db | 209 | fEnergyFitter.Fit(fResults); |
72cc12cd | 210 | |
c8b1a7db | 211 | return true; |
0bd4b00f | 212 | } |
213 | ||
a03f01f7 | 214 | #define PFB(N,FLAG) \ |
215 | do { \ | |
216 | AliForwardUtil::PrintName(N); \ | |
217 | std::cout << std::boolalpha << (FLAG) << std::noboolalpha << std::endl; \ | |
218 | } while(false) | |
0bd4b00f | 219 | //____________________________________________________________________ |
220 | void | |
e65b8b56 | 221 | AliFMDEnergyFitterTask::Print(Option_t* option) const |
0bd4b00f | 222 | { |
7984e5f7 | 223 | // |
224 | // Print information | |
225 | // | |
226 | // Parameters: | |
227 | // option Not used | |
228 | // | |
c8b1a7db | 229 | AliBaseESDTask::Print(option); |
e65b8b56 | 230 | gROOT->IncreaseDirLevel(); |
a03f01f7 | 231 | PFB("Only MB", fOnlyMB); |
e65b8b56 | 232 | fEnergyFitter.Print(option); |
e65b8b56 | 233 | gROOT->DecreaseDirLevel(); |
0bd4b00f | 234 | } |
235 | ||
236 | // | |
237 | // EOF | |
238 | // |