]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/AliFMDMCSharingFilter.cxx
A better way to specify the Nch axis for the MultDists task.
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliFMDMCSharingFilter.cxx
CommitLineData
dc0b1641 1//
7984e5f7 2// Class to do the sharing correction for MC data.
dc0b1641 3//
7984e5f7 4// Input:
5// - AliESDFMD object - from reconstruction
6// - Kinematics
7// - Track-References
8//
9// Output:
10// - AliESDFMD object - copy of input, but with signals merged
11//
12// Corrections used:
5bb5d1f6 13// - ELoss fits
7984e5f7 14//
15// Histograms:
16// - For each ring (FMD1i, FMD2i, FMD2o, FMD3i, FMD3o) the distribution of
17// signals before and after the filter.
18// - For each ring (see above), an array of distributions of number of
19// hit strips for each vertex bin (if enabled - see Init method)
20//
dc0b1641 21#include "AliFMDMCSharingFilter.h"
22#include <AliESDFMD.h>
23#include <AliMCEvent.h>
24#include <AliTrackReference.h>
25#include <AliStack.h>
26#include <TAxis.h>
27#include <TList.h>
28#include <TH1.h>
29#include <TMath.h>
dc0b1641 30#include "AliFMDStripIndex.h"
5bb5d1f6 31#include "AliFMDFloatMap.h"
dc0b1641 32#include <AliLog.h>
33#include <TROOT.h>
34#include <iostream>
35#include <iomanip>
36
37ClassImp(AliFMDMCSharingFilter)
38#if 0
39; // This is for Emacs
40#endif
41
dc0b1641 42//____________________________________________________________________
43AliFMDMCSharingFilter::AliFMDMCSharingFilter(const char* title)
44 : AliFMDSharingFilter(title),
8d44bcdb 45 fTrackDensity(title),
dc0b1641 46 fFMD1i(0),
47 fFMD2i(0),
48 fFMD2o(0),
49 fFMD3i(0),
8449e3e0 50 fFMD3o(0)// , fOperComp(0)
dc0b1641 51{
7984e5f7 52 //
53 // Constructor
54 //
55 // Parameters:
56 // title Title of object - not significant
57 //
1174780f 58 fFMD1i = new TH2D("FMD1i_corr", "Merged vs MC", 21, -.5, 20.5, 300, 0, 15);
59 fFMD2i = new TH2D("FMD2i_corr", "Merged vs MC", 21, -.5, 20.5, 300, 0, 15);
60 fFMD2o = new TH2D("FMD2o_corr", "Merged vs MC", 21, -.5, 20.5, 300, 0, 15);
61 fFMD3i = new TH2D("FMD3i_corr", "Merged vs MC", 21, -.5, 20.5, 300, 0, 15);
62 fFMD3o = new TH2D("FMD3o_corr", "Merged vs MC", 21, -.5, 20.5, 300, 0, 15);
dc0b1641 63 fFMD1i->SetYTitle("#Delta E/#Delta_{mip} (ESD)");
64 fFMD1i->SetXTitle("Hits (MC)");
65 fFMD2i->SetYTitle("#Delta E/#Delta_{mip} (ESD)");
66 fFMD2i->SetXTitle("Hits (MC)");
67 fFMD2o->SetYTitle("#Delta E/#Delta_{mip} (ESD)");
68 fFMD2o->SetXTitle("Hits (MC)");
69 fFMD3i->SetYTitle("#Delta E/#Delta_{mip} (ESD)");
70 fFMD3i->SetXTitle("Hits (MC)");
71 fFMD3o->SetYTitle("#Delta E/#Delta_{mip} (ESD)");
72 fFMD3o->SetXTitle("Hits (MC)");
73 fFMD1i->SetDirectory(0);
74 fFMD2i->SetDirectory(0);
75 fFMD2o->SetDirectory(0);
76 fFMD3i->SetDirectory(0);
77 fFMD3o->SetDirectory(0);
5bb5d1f6 78
8449e3e0 79#if 0
5bb5d1f6 80 fOper = new AliFMDFloatMap(0,0,0,0);
81 fOperComp = new TH2I("operComp", "Operation vs # track refs",
82 kMergedInto, kNone-.5, kMergedInto+.5,
83 20, -.5, 19.5);
84 fOperComp->SetXTitle("Operation");
85 fOperComp->SetYTitle("# of track refs in sector");
86 fOperComp->SetZTitle("Observations");
87 fOperComp->GetXaxis()->SetBinLabel(kNone, "None");
88 fOperComp->GetXaxis()->SetBinLabel(kCandidate, "Candidate");
89 fOperComp->GetXaxis()->SetBinLabel(kMergedWithOther, "Merged w/other");
90 fOperComp->GetXaxis()->SetBinLabel(kMergedInto, "Merged into");
91 fOperComp->SetDirectory(0);
8449e3e0 92#endif
dc0b1641 93}
94
95//____________________________________________________________________
96AliFMDMCSharingFilter::AliFMDMCSharingFilter(const AliFMDMCSharingFilter& o)
97 : AliFMDSharingFilter(o),
8d44bcdb 98 fTrackDensity(o.fTrackDensity),
dc0b1641 99 fFMD1i(o.fFMD1i),
100 fFMD2i(o.fFMD2i),
101 fFMD2o(o.fFMD2o),
102 fFMD3i(o.fFMD3i),
8449e3e0 103 fFMD3o(o.fFMD3o) // , fOperComp(o.fOperComp)
dc0b1641 104{
7984e5f7 105 //
106 // Copy constructor
107 //
108 // Parameters:
109 // o Object to copy from
110 //
dc0b1641 111}
112
113//____________________________________________________________________
114AliFMDMCSharingFilter::~AliFMDMCSharingFilter()
115{
7984e5f7 116 //
117 // Destructor
118 //
dc0b1641 119}
120
121//____________________________________________________________________
122AliFMDMCSharingFilter&
123AliFMDMCSharingFilter::operator=(const AliFMDMCSharingFilter& o)
124{
7984e5f7 125 //
126 // Assignment operator
127 //
128 // Parameters:
129 // o Object to assign from
130 //
131 // Return:
132 // Reference to this
133 //
dc0b1641 134 AliFMDSharingFilter::operator=(o);
8d44bcdb 135 fTrackDensity = o.fTrackDensity;
dc0b1641 136 return *this;
137}
138
dc0b1641 139
140//____________________________________________________________________
141Bool_t
142AliFMDMCSharingFilter::FilterMC(const AliESDFMD& input,
143 const AliMCEvent& event,
144 Double_t vz,
4cbdf467 145 AliESDFMD& output,
146 TH2D* primary)
dc0b1641 147{
7984e5f7 148 //
4cbdf467 149 // Filter the input kinematics and track references, using
150 // some of the ESD information
7984e5f7 151 //
152 // Parameters:
4cbdf467 153 // input Input ESD event
154 // event Input MC event
155 // vz Vertex position
156 // output Output ESD-like object
157 // primary Per-event histogram of primaries
158 //
7984e5f7 159 // Return:
4cbdf467 160 // True on succes, false otherwise
7984e5f7 161 //
dc0b1641 162 output.Clear();
163
dc0b1641 164
8d44bcdb 165 fTrackDensity.Calculate(input, event, vz, output, primary);
dc0b1641 166
dc0b1641 167 return kTRUE;
168}
169
170//____________________________________________________________________
171void
172AliFMDMCSharingFilter::CompareResults(const AliESDFMD& esd,
173 const AliESDFMD& mc)
174{
7984e5f7 175 //
176 // Compare the result of merging to the monte-carlo truth. This
177 // fills the correlation histograms
178 //
179 // Parameters:
180 // esd ESD after sharing correction
181 // mc MC ESD
182 //
183
dc0b1641 184 // Copy eta values to output
185 for (UShort_t d = 1; d <= 3; d++) {
186 UShort_t nq = (d == 1 ? 1 : 2);
187 for (UShort_t q = 0; q < nq; q++) {
188 Char_t r = (q == 0 ? 'I' : 'O');
189 UShort_t ns = (q == 0 ? 20 : 40);
190 UShort_t nt = (q == 0 ? 512 : 256);
191 TH2* co = 0;
192 switch (d) {
193 case 1: co = fFMD1i; break;
194 case 2: co = (q == 0 ? fFMD2i : fFMD2o); break;
195 case 3: co = (q == 0 ? fFMD3i : fFMD3o); break;
196 }
197
198 for (UShort_t s = 0; s < ns; s++) {
199 for (UShort_t t = 0; t < nt; t++) {
200 Float_t mEsd = esd.Multiplicity(d, r, s, t);
201 Float_t mMc = mc.Multiplicity(d, r, s, t);
202
203 co->Fill(mMc, mEsd);
204 }
205 }
206 }
207 }
208}
209
210//____________________________________________________________________
211void
5934a3e3 212AliFMDMCSharingFilter::CreateOutputObjects(TList* dir)
dc0b1641 213{
7984e5f7 214 //
215 // Define the output histograms. These are put in a sub list of the
216 // passed list. The histograms are merged before the parent task calls
217 // AliAnalysisTaskSE::Terminate
218 //
219 // Parameters:
220 // dir Directory to add to
221 //
5934a3e3 222 AliFMDSharingFilter::CreateOutputObjects(dir);
dc0b1641 223 TList* d = static_cast<TList*>(dir->FindObject(GetName()));
224 TList* cd = new TList;
8d44bcdb 225 cd->SetOwner();
dc0b1641 226 cd->SetName("esd_mc_comparion");
227 d->Add(cd);
228 cd->Add(fFMD1i);
229 cd->Add(fFMD2i);
230 cd->Add(fFMD2o);
231 cd->Add(fFMD3i);
232 cd->Add(fFMD3o);
8449e3e0 233 // cd->Add(fOperComp);
5934a3e3 234 fTrackDensity.CreateOutputObjects(d);
dc0b1641 235}
236
237//____________________________________________________________________
238void
5934a3e3 239AliFMDMCSharingFilter::Terminate(const TList* dir, TList* output, Int_t nEvents)
dc0b1641 240{
7984e5f7 241 //
242 // Scale the histograms to the total number of events
243 //
244 // Parameters:
245 // dir Where the output is
246 // nEvents Number of events
247 //
5934a3e3 248 AliFMDSharingFilter::Terminate(dir, output, nEvents);
dc0b1641 249}
250
4bcdcbc1 251//____________________________________________________________________
252void
253AliFMDMCSharingFilter::SetDebug(Int_t dbg)
254{
255 AliFMDSharingFilter::SetDebug(dbg);
256 fTrackDensity.SetDebug(dbg > 2);
257}
258
dc0b1641 259//____________________________________________________________________
260void
261AliFMDMCSharingFilter::Print(Option_t* option) const
262{
7984e5f7 263 //
264 // Print information
265 //
266 // Parameters:
267 // option Not used
268 //
dc0b1641 269 AliFMDSharingFilter::Print(option);
8d44bcdb 270 gROOT->IncreaseDirLevel();
271 fTrackDensity.Print(option);
272 gROOT->DecreaseDirLevel();
273
dc0b1641 274}
275
276//____________________________________________________________________
277//
278// EOF
279//