Fixed warnings [-Wunused-but-set-variable] from GCC 4.6 -
[u/mrichter/AliRoot.git] / PWG2 / 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
42
dc0b1641 43//____________________________________________________________________
44AliFMDMCSharingFilter::AliFMDMCSharingFilter(const char* title)
45 : AliFMDSharingFilter(title),
8d44bcdb 46 fTrackDensity(title),
dc0b1641 47 fFMD1i(0),
48 fFMD2i(0),
49 fFMD2o(0),
50 fFMD3i(0),
51 fFMD3o(0),
8d44bcdb 52 fOperComp(0)
dc0b1641 53{
7984e5f7 54 //
55 // Constructor
56 //
57 // Parameters:
58 // title Title of object - not significant
59 //
1174780f 60 fFMD1i = new TH2D("FMD1i_corr", "Merged vs MC", 21, -.5, 20.5, 300, 0, 15);
61 fFMD2i = new TH2D("FMD2i_corr", "Merged vs MC", 21, -.5, 20.5, 300, 0, 15);
62 fFMD2o = new TH2D("FMD2o_corr", "Merged vs MC", 21, -.5, 20.5, 300, 0, 15);
63 fFMD3i = new TH2D("FMD3i_corr", "Merged vs MC", 21, -.5, 20.5, 300, 0, 15);
64 fFMD3o = new TH2D("FMD3o_corr", "Merged vs MC", 21, -.5, 20.5, 300, 0, 15);
dc0b1641 65 fFMD1i->SetYTitle("#Delta E/#Delta_{mip} (ESD)");
66 fFMD1i->SetXTitle("Hits (MC)");
67 fFMD2i->SetYTitle("#Delta E/#Delta_{mip} (ESD)");
68 fFMD2i->SetXTitle("Hits (MC)");
69 fFMD2o->SetYTitle("#Delta E/#Delta_{mip} (ESD)");
70 fFMD2o->SetXTitle("Hits (MC)");
71 fFMD3i->SetYTitle("#Delta E/#Delta_{mip} (ESD)");
72 fFMD3i->SetXTitle("Hits (MC)");
73 fFMD3o->SetYTitle("#Delta E/#Delta_{mip} (ESD)");
74 fFMD3o->SetXTitle("Hits (MC)");
75 fFMD1i->SetDirectory(0);
76 fFMD2i->SetDirectory(0);
77 fFMD2o->SetDirectory(0);
78 fFMD3i->SetDirectory(0);
79 fFMD3o->SetDirectory(0);
5bb5d1f6 80
81 fOper = new AliFMDFloatMap(0,0,0,0);
82 fOperComp = new TH2I("operComp", "Operation vs # track refs",
83 kMergedInto, kNone-.5, kMergedInto+.5,
84 20, -.5, 19.5);
85 fOperComp->SetXTitle("Operation");
86 fOperComp->SetYTitle("# of track refs in sector");
87 fOperComp->SetZTitle("Observations");
88 fOperComp->GetXaxis()->SetBinLabel(kNone, "None");
89 fOperComp->GetXaxis()->SetBinLabel(kCandidate, "Candidate");
90 fOperComp->GetXaxis()->SetBinLabel(kMergedWithOther, "Merged w/other");
91 fOperComp->GetXaxis()->SetBinLabel(kMergedInto, "Merged into");
92 fOperComp->SetDirectory(0);
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),
103 fFMD3o(o.fFMD3o),
8d44bcdb 104 fOperComp(o.fOperComp)
dc0b1641 105{
7984e5f7 106 //
107 // Copy constructor
108 //
109 // Parameters:
110 // o Object to copy from
111 //
dc0b1641 112}
113
114//____________________________________________________________________
115AliFMDMCSharingFilter::~AliFMDMCSharingFilter()
116{
7984e5f7 117 //
118 // Destructor
119 //
dc0b1641 120}
121
122//____________________________________________________________________
123AliFMDMCSharingFilter&
124AliFMDMCSharingFilter::operator=(const AliFMDMCSharingFilter& o)
125{
7984e5f7 126 //
127 // Assignment operator
128 //
129 // Parameters:
130 // o Object to assign from
131 //
132 // Return:
133 // Reference to this
134 //
dc0b1641 135 AliFMDSharingFilter::operator=(o);
8d44bcdb 136 fTrackDensity = o.fTrackDensity;
dc0b1641 137 return *this;
138}
139
dc0b1641 140
141//____________________________________________________________________
142Bool_t
143AliFMDMCSharingFilter::FilterMC(const AliESDFMD& input,
144 const AliMCEvent& event,
145 Double_t vz,
4cbdf467 146 AliESDFMD& output,
147 TH2D* primary)
dc0b1641 148{
7984e5f7 149 //
4cbdf467 150 // Filter the input kinematics and track references, using
151 // some of the ESD information
7984e5f7 152 //
153 // Parameters:
4cbdf467 154 // input Input ESD event
155 // event Input MC event
156 // vz Vertex position
157 // output Output ESD-like object
158 // primary Per-event histogram of primaries
159 //
7984e5f7 160 // Return:
4cbdf467 161 // True on succes, false otherwise
7984e5f7 162 //
dc0b1641 163 output.Clear();
164
dc0b1641 165
8d44bcdb 166 fTrackDensity.Calculate(input, event, vz, output, primary);
dc0b1641 167
dc0b1641 168 return kTRUE;
169}
170
171//____________________________________________________________________
172void
173AliFMDMCSharingFilter::CompareResults(const AliESDFMD& esd,
174 const AliESDFMD& mc)
175{
7984e5f7 176 //
177 // Compare the result of merging to the monte-carlo truth. This
178 // fills the correlation histograms
179 //
180 // Parameters:
181 // esd ESD after sharing correction
182 // mc MC ESD
183 //
184
dc0b1641 185 // Copy eta values to output
186 for (UShort_t d = 1; d <= 3; d++) {
187 UShort_t nq = (d == 1 ? 1 : 2);
188 for (UShort_t q = 0; q < nq; q++) {
189 Char_t r = (q == 0 ? 'I' : 'O');
190 UShort_t ns = (q == 0 ? 20 : 40);
191 UShort_t nt = (q == 0 ? 512 : 256);
192 TH2* co = 0;
193 switch (d) {
194 case 1: co = fFMD1i; break;
195 case 2: co = (q == 0 ? fFMD2i : fFMD2o); break;
196 case 3: co = (q == 0 ? fFMD3i : fFMD3o); break;
197 }
198
199 for (UShort_t s = 0; s < ns; s++) {
200 for (UShort_t t = 0; t < nt; t++) {
201 Float_t mEsd = esd.Multiplicity(d, r, s, t);
202 Float_t mMc = mc.Multiplicity(d, r, s, t);
203
204 co->Fill(mMc, mEsd);
205 }
206 }
207 }
208 }
209}
210
211//____________________________________________________________________
212void
213AliFMDMCSharingFilter::DefineOutput(TList* dir)
214{
7984e5f7 215 //
216 // Define the output histograms. These are put in a sub list of the
217 // passed list. The histograms are merged before the parent task calls
218 // AliAnalysisTaskSE::Terminate
219 //
220 // Parameters:
221 // dir Directory to add to
222 //
dc0b1641 223 AliFMDSharingFilter::DefineOutput(dir);
224 TList* d = static_cast<TList*>(dir->FindObject(GetName()));
225 TList* cd = new TList;
8d44bcdb 226 cd->SetOwner();
dc0b1641 227 cd->SetName("esd_mc_comparion");
228 d->Add(cd);
229 cd->Add(fFMD1i);
230 cd->Add(fFMD2i);
231 cd->Add(fFMD2o);
232 cd->Add(fFMD3i);
233 cd->Add(fFMD3o);
5bb5d1f6 234 cd->Add(fOperComp);
8d44bcdb 235 fTrackDensity.DefineOutput(d);
dc0b1641 236}
237
238//____________________________________________________________________
239void
fb3430ac 240AliFMDMCSharingFilter::ScaleHistograms(const TList* dir, Int_t nEvents)
dc0b1641 241{
7984e5f7 242 //
243 // Scale the histograms to the total number of events
244 //
245 // Parameters:
246 // dir Where the output is
247 // nEvents Number of events
248 //
dc0b1641 249 AliFMDSharingFilter::ScaleHistograms(dir, nEvents);
dc0b1641 250}
251
252//____________________________________________________________________
253void
254AliFMDMCSharingFilter::Print(Option_t* option) const
255{
7984e5f7 256 //
257 // Print information
258 //
259 // Parameters:
260 // option Not used
261 //
dc0b1641 262 AliFMDSharingFilter::Print(option);
8d44bcdb 263 gROOT->IncreaseDirLevel();
264 fTrackDensity.Print(option);
265 gROOT->DecreaseDirLevel();
266
dc0b1641 267}
268
269//____________________________________________________________________
270//
271// EOF
272//