]>
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 | ||
92 | //____________________________________________________________________ | |
c8b1a7db | 93 | Bool_t |
94 | AliFMDEnergyFitterTask::Book() | |
0bd4b00f | 95 | { |
7984e5f7 | 96 | // |
97 | // Create output objects | |
98 | // | |
99 | // | |
6ab100ec | 100 | DGUARD(fDebug,1,"Create output objects of AliFMDEnergyFitterTask"); |
0bd4b00f | 101 | |
c8b1a7db | 102 | // We don't need any corrections for this task |
103 | fNeededCorrections = 0; | |
104 | fExtraCorrections = 0; | |
105 | ||
5934a3e3 | 106 | fEnergyFitter.CreateOutputObjects(fList); |
0bd4b00f | 107 | |
a03f01f7 | 108 | fList->Add(AliForwardUtil::MakeParameter("onlyMB", fOnlyMB)); |
c8b1a7db | 109 | return true; |
0bd4b00f | 110 | } |
111 | //____________________________________________________________________ | |
c8b1a7db | 112 | Bool_t |
113 | AliFMDEnergyFitterTask::PreData(const TAxis& /*vertex*/, const TAxis& eta) | |
114 | { | |
115 | // | |
116 | // Initialise the sub objects and stuff. Called on first event | |
117 | // | |
118 | // | |
119 | DGUARD(fDebug,1,"Initialize subs of AliFMDEnergyFitterTask"); | |
120 | ||
121 | fEnergyFitter.SetupForData(eta); | |
122 | ||
123 | return true; | |
124 | } | |
125 | ||
126 | //____________________________________________________________________ | |
127 | Bool_t | |
128 | AliFMDEnergyFitterTask::Event(AliESDEvent& esd) | |
0bd4b00f | 129 | { |
7984e5f7 | 130 | // |
131 | // Process each event | |
132 | // | |
133 | // Parameters: | |
134 | // option Not used | |
135 | // | |
136 | ||
0bd4b00f | 137 | // static Int_t cnt = 0; |
138 | // cnt++; | |
139 | // Get the input data | |
db298fc6 | 140 | DGUARD(fDebug,3,"Analyse event of AliFMDEnergyFitterTask"); |
5934a3e3 | 141 | // --- Read in the data -------------------------------------------- |
142 | LoadBranches(); | |
143 | ||
5bb5d1f6 | 144 | Bool_t lowFlux = kFALSE; |
145 | UInt_t triggers = 0; | |
146 | UShort_t ivz = 0; | |
5ca83fee | 147 | TVector3 ip; |
5bb5d1f6 | 148 | Double_t cent = 0; |
149 | UShort_t nClusters = 0; | |
c8b1a7db | 150 | UInt_t found = fEventInspector.Process(&esd, triggers, lowFlux, |
5ca83fee | 151 | ivz, ip, cent, nClusters); |
c8b1a7db | 152 | if (found & AliFMDEventInspector::kNoEvent) return false; |
153 | if (found & AliFMDEventInspector::kNoTriggers) return false; | |
154 | if (found & AliFMDEventInspector::kNoSPD) return false; | |
155 | if (found & AliFMDEventInspector::kNoFMD) return false; | |
156 | if (found & AliFMDEventInspector::kNoVertex) return false; | |
157 | if (found & AliFMDEventInspector::kBadVertex) return false; | |
81775aba | 158 | |
159 | // do not process pile-up, A, C, and E events | |
c8b1a7db | 160 | if (triggers & AliAODForwardMult::kPileUp) return false; |
161 | if (triggers & AliAODForwardMult::kA) return false; | |
162 | if (triggers & AliAODForwardMult::kC) return false; | |
163 | if (triggers & AliAODForwardMult::kE) return false; | |
12fffad7 | 164 | |
81775aba | 165 | // We want only the events found by off-line |
c8b1a7db | 166 | if (!(triggers & AliAODForwardMult::kOffline)) return false; |
81775aba | 167 | |
a03f01f7 | 168 | // Perhaps we should also insist on MB only |
169 | if (fOnlyMB && (!(triggers & AliAODForwardMult::kInel))) return false; | |
170 | ||
12fffad7 | 171 | // if(cent > 0) { |
172 | // if( cent < 40 || cent >50 ) return; | |
173 | // else std::cout<<"selecting event with cent "<<cent<<std::endl; | |
174 | // } | |
175 | ||
0bd4b00f | 176 | // Get FMD data |
c8b1a7db | 177 | AliESDFMD* esdFMD = esd.GetFMDData(); |
0bd4b00f | 178 | // Do the energy stuff |
5e4d905e | 179 | if (!fEnergyFitter.Accumulate(*esdFMD, cent, |
180 | triggers & AliAODForwardMult::kEmpty)){ | |
0bd4b00f | 181 | AliWarning("Energy fitter failed"); |
c8b1a7db | 182 | return false; |
0bd4b00f | 183 | } |
0bd4b00f | 184 | |
c8b1a7db | 185 | return true; |
db298fc6 | 186 | } |
187 | ||
0bd4b00f | 188 | //____________________________________________________________________ |
c8b1a7db | 189 | Bool_t |
190 | AliFMDEnergyFitterTask::Finalize() | |
0bd4b00f | 191 | { |
7984e5f7 | 192 | // |
193 | // End of job | |
194 | // | |
195 | // Parameters: | |
196 | // option Not used | |
197 | // | |
6ab100ec | 198 | DGUARD(fDebug,1,"Processing merged output of AliFMDEnergyFitterTask"); |
199 | ||
1c762251 | 200 | AliInfo("Fitting energy loss spectra"); |
c8b1a7db | 201 | fEnergyFitter.Fit(fResults); |
72cc12cd | 202 | |
c8b1a7db | 203 | return true; |
0bd4b00f | 204 | } |
205 | ||
a03f01f7 | 206 | #define PFB(N,FLAG) \ |
207 | do { \ | |
208 | AliForwardUtil::PrintName(N); \ | |
209 | std::cout << std::boolalpha << (FLAG) << std::noboolalpha << std::endl; \ | |
210 | } while(false) | |
0bd4b00f | 211 | //____________________________________________________________________ |
212 | void | |
e65b8b56 | 213 | AliFMDEnergyFitterTask::Print(Option_t* option) const |
0bd4b00f | 214 | { |
7984e5f7 | 215 | // |
216 | // Print information | |
217 | // | |
218 | // Parameters: | |
219 | // option Not used | |
220 | // | |
c8b1a7db | 221 | AliBaseESDTask::Print(option); |
e65b8b56 | 222 | gROOT->IncreaseDirLevel(); |
a03f01f7 | 223 | PFB("Only MB", fOnlyMB); |
e65b8b56 | 224 | fEnergyFitter.Print(option); |
e65b8b56 | 225 | gROOT->DecreaseDirLevel(); |
0bd4b00f | 226 | } |
227 | ||
228 | // | |
229 | // EOF | |
230 | // |