o updates for AOD MC (Julian)
[u/mrichter/AliRoot.git] / PWGDQ / dielectron / AliDielectronVarManager.h
CommitLineData
b2a297fa 1#ifndef ALIDIELECTRONVARMANAGER_H
2#define ALIDIELECTRONVARMANAGER_H
3/* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6//#############################################################
7//# #
8//# Class AliDielectronVarManager #
9//# Class for management of available variables #
10//# #
11//# Authors: #
12//# Anton Andronic, GSI / A.Andronic@gsi.de #
13//# Ionut C. Arsene, GSI / I.C.Arsene@gsi.de #
14//# Julian Book, Uni Ffm / Julian.Book@cern.ch #
572b0139 15//# Markus Köhler, GSI / M.Koehler@gsi.de #
6551594b 16//# Frederick Kramer, Uni Ffm / Frederick.Kramer@cern.ch #
b2a297fa 17//# Magnus Mager, CERN / Magnus.Mager@cern.ch #
18//# WooJin J. Park, GSI / W.J.Park@gsi.de #
19//# Jens Wiechula, Uni HD / Jens.Wiechula@cern.ch #
20//# #
21//#############################################################
22
b2a297fa 23#include <TNamed.h>
5720c765 24#include <TProfile.h>
a823f01b 25#include <TProfile2D.h>
5720c765 26#include <TH3D.h>
27#include <TFile.h>
28#include <TDatabasePDG.h>
29#include <TKey.h>
b2a297fa 30
31#include <AliVEvent.h>
32#include <AliESDEvent.h>
6551594b 33#include <AliAODEvent.h>
34#include <AliMCEvent.h>
35#include <AliVVertex.h>
36#include <AliESDVertex.h>
5720c765 37#include <AliEventplane.h>
38
39#include <AliESDVZERO.h>
40#include <AliAODVZERO.h>
b2a297fa 41
42#include <AliVParticle.h>
b2a297fa 43#include <AliESDtrack.h>
44#include <AliAODTrack.h>
572b0139 45#include <AliAODPid.h>
b2a297fa 46#include <AliKFParticle.h>
572b0139 47#include <AliKFVertex.h>
b2a297fa 48#include <AliMCParticle.h>
49#include <AliAODMCParticle.h>
50#include <AliVTrack.h> // ?
51
6551594b 52#include <AliExternalTrackParam.h>
53#include <AliESDpid.h>
4649c75b 54#include <AliCentrality.h>
2a14a7b1 55#include <AliAODpidUtil.h>
8df8e382 56#include <AliPID.h>
ba15fdfb 57#include <AliPIDResponse.h>
6551594b 58
b2a297fa 59#include "AliDielectronPair.h"
8df8e382 60#include "AliDielectronMC.h"
48609e3d 61#include "AliDielectronPID.h"
ba15fdfb 62#include "AliDielectronHelper.h"
b2a297fa 63
64class AliVEvent;
65
66//________________________________________________________________
67class AliDielectronVarManager : public TNamed {
68
69public:
8df8e382 70
b2a297fa 71 // Particle specific variables
72 enum ValueTypes {
73 kPx = 0, // px
74 kPy, // py
75 kPz, // pz
76 kPt, // transverse momentum
77 kP, // momentum
78 kXv, // vertex position in x
79 kYv, // vertex position in y
80 kZv, // vertex position in z
81 kOneOverPt, // 1/pt
82 kPhi, // phi angle
83 kTheta, // theta angle
84 kEta, // pseudo-rapidity
85 kY, // rapidity
86 kE, // energy
87 kM, // mass
88 kCharge, // charge
89 kNclsITS, // number of clusters assigned in the ITS
5720c765 90 kITSchi2Cl, // chi2/cl in the ITS
b2a297fa 91 kNclsTPC, // number of clusters assigned in the TPC
5720c765 92 kNclsSTPC, // number of shared clusters assigned in the TPC
93 kNclsSFracTPC, // fraction of shared clusters assigned in the TPC
554e40f8 94 kNclsTPCiter1, // number of clusters assigned in the TPC after first iteration
b2a297fa 95 kNFclsTPC, // number of findable clusters in the TPC
45b2b1b8 96 kNFclsTPCr, // number of findable clusters in the TPC with more robust definition
fb7d2d99 97 kNFclsTPCrFrac, // number of found/findable clusters in the TPC with more robust definition
b2a297fa 98 kTPCsignalN, // number of points used for dEdx
ba15fdfb 99 kTPCsignalNfrac, // fraction of points used for dEdx / cluster used for tracking
61d106d3 100 kTPCchi2Cl, // chi2/cl in TPC
5720c765 101 kTPCclsDiff, // TPC cluster difference
61d106d3 102 kTrackStatus, // track status bits
8df8e382 103
b2a297fa 104 kNclsTRD, // number of clusters assigned in the TRD
105 kTRDntracklets, // number of TRD tracklets used for tracking/PID TODO: correct getter
106 kTRDpidQuality, // number of TRD tracklets used for PID
8df8e382 107 kTRDprobEle, // TRD electron pid probability
108 kTRDprobPio, // TRD electron pid probability
5720c765 109 kTRDphi, // Phi angle of the track at the entrance of the TRD
110 kTRDpidEffLeg, // TRD pid efficiency from conversion electrons
8df8e382 111
b2a297fa 112 kImpactParXY, // Impact parameter in XY plane
113 kImpactParZ, // Impact parameter in Z
114 kTrackLength, // Track length
8df8e382 115
5720c765 116 kPdgCode, // PDG code
8df8e382 117 kPdgCodeMother, // PDG code of the mother
5720c765 118 kPdgCodeGrandMother, // PDG code of the grandmother
8df8e382 119 kNumberOfDaughters, // number of daughters
120 kHaveSameMother, // check that particles have the same mother (MC)
fb7d2d99 121 kIsJpsiPrimary, // check if the particle is primary (MC)
5720c765 122 kNumberOfJPsis, // number of generated inclusive jpsis per event (MC)
123 kNumberOfJPsisPrompt, // number of generated prompt jpsis per event (MC)
124 kNumberOfJPsisNPrompt, // number of generated non-prompt jpsis per event (MC)
125
126 kITSsignal, // ITS dE/dx signal
127 kITSsignalSSD1, // SSD1 dE/dx signal
128 kITSsignalSSD2, // SSD2 dE/dx signal
129 kITSsignalSDD1, // SDD1 dE/dx signal
130 kITSsignalSDD2, // SDD2 dE/dx signal
131 kITSclusterMap, // ITS cluster map
132 kITSLayerFirstCls, // No of innermost ITS layer with a cluster of a track
9143d69f 133 kITSnSigmaEle, // number of sigmas to the dE/dx electron line in the ITS
134 kITSnSigmaPio, // number of sigmas to the dE/dx pion line in the ITS
135 kITSnSigmaMuo, // number of sigmas to the dE/dx muon line in the ITS
136 kITSnSigmaKao, // number of sigmas to the dE/dx kaon line in the ITS
137 kITSnSigmaPro, // number of sigmas to the dE/dx proton line in the ITS
8df8e382 138
b2a297fa 139 kPIn, // momentum at inner wall of TPC (if available), used for PID
5720c765 140 kPOut, // momentum at outer wall of TPC, used for TRD studies
141 kYsignedIn, // signed local y at inner wall of TPC
b2a297fa 142 kTPCsignal, // TPC dE/dx signal
ba15fdfb 143
5720c765 144 kTOFsignal, // TOF signal
145 kTOFbeta, // TOF beta
146 kTOFPIDBit, // TOF PID bit (1:set, 0:TOF not available)
ba15fdfb 147
6551594b 148 kTPCnSigmaEle, // number of sigmas to the dE/dx electron line in the TPC
572b0139 149 kTPCnSigmaPio, // number of sigmas to the dE/dx pion line in the TPC
150 kTPCnSigmaMuo, // number of sigmas to the dE/dx muon line in the TPC
151 kTPCnSigmaKao, // number of sigmas to the dE/dx kaon line in the TPC
152 kTPCnSigmaPro, // number of sigmas to the dE/dx proton line in the TPC
153
5720c765 154 kTOFnSigmaEle, // number of sigmas to the electron line in the TOF
572b0139 155 kTOFnSigmaPio, // number of sigmas to the pion line in the TOF
156 kTOFnSigmaMuo, // number of sigmas to the muon line in the TOF
157 kTOFnSigmaKao, // number of sigmas to the kaon line in the TOF
158 kTOFnSigmaPro, // number of sigmas to the proton line in the TOF
8df8e382 159
5720c765 160 kEMCALnSigmaEle, // number of sigmas to the proton line in the TOF
a823f01b 161 kEMCALEoverP, // E over P from EMCAL
162 kEMCALNCells, // NCells from EMCAL
163 kEMCALM02, // M02 showershape parameter
164 kEMCALM20, // M20 showershape parameter
165 kEMCALDispersion, // Dispersion paramter
5720c765 166
ffbede40 167 kKinkIndex0, // kink index 0
168
b2a297fa 169 kParticleMax, //
170 // TODO: kRNClusters ??
5720c765 171 // AliDielectronPair specific variables
b2a297fa 172 kChi2NDF = kParticleMax, // Chi^2/NDF
173 kDecayLength, // decay length
174 kR, // distance to the origin
175 kOpeningAngle, // opening angle
2e02dba4 176 kCosPointingAngle, // cosine of the pointing angle
8df8e382 177 // helicity picture: Z-axis is considered the direction of the mother's 3-momentum vector
178 kThetaHE, // theta in mother's rest frame in the helicity picture
179 kPhiHE, // phi in mother's rest frame in the helicity picture
1762f182 180 kThetaSqHE, // squared value of kThetaHE
5720c765 181 kCos2PhiHE, // Cosine of 2*phi in mother's rest frame in the helicity picture
a823f01b 182 kCosTilPhiHE, // Sin(phi) +/- Cos(phi) in mother's rest frame in the helicity picture; Sign is sign(Cos(phi))
8df8e382 183 // Collins-Soper picture: Z-axis is considered the direction of the vectorial difference between
184 // the 3-mom vectors of target and projectile beams
185 kThetaCS, // theta in mother's rest frame in Collins-Soper picture
186 kPhiCS, // phi in mother's rest frame in Collins-Soper picture
1762f182 187 kThetaSqCS, // squared value of kThetaCS
236e1bda 188 kPsiPair, // phi in mother's rest frame in Collins-Soper picture
5720c765 189 kCos2PhiCS, // Cosine of 2*phi in mother's rest frame in the Collins-Soper picture
a823f01b 190 kCosTilPhiCS, // Sin(phi) +/- Cos(phi) in mother's rest frame in Collins-Soper picture; Sign is sign(Cos(phi))
5720c765 191 kDeltaPhiV0ArpH2, // Delta phi of the pair with respect to the 2nd order harmonic reaction plane from V0-A
192 kDeltaPhiV0CrpH2, // Delta phi of the pair with respect to the 2nd order harmonic reaction plane from V0-C
193 kDeltaPhiV0ACrpH2, // Delta phi of the pair with respect to the 2nd order harmonic reaction plane from V0-A + V0-C
194 kV0ArpH2FlowV2, // v2 coefficient with respect to the 2nd order reaction plane from V0-A
195 kV0CrpH2FlowV2, // v2 coefficient with respect to the 2nd order reaction plane from V0-C
196 kV0ACrpH2FlowV2, // v2 coefficient with respect to the 2nd order reaction plane from V0-A + V0-C
572b0139 197 kLegDist, // distance of the legs
198 kLegDistXY, // distance of the legs in XY
61d106d3 199 kDeltaEta, // Absolute value of Delta Eta for the legs
200 kDeltaPhi, // Absolute value of Delta Phi for the legs
b2a297fa 201 kMerr, // error of mass calculation
202 kDCA, // distance of closest approach TODO: not implemented yet
203 kPairType, // type of the pair, like like sign ++ unlikesign ...
ba15fdfb 204 kPseudoProperTime, // pseudo proper time
e4339752 205 kPseudoProperTimeErr, // pseudo proper time error
5720c765 206 kPseudoProperTimeResolution, // resolution for pseudo proper decay time (reconstructed - MC truth)
207 kPseudoProperTimePull, // normalizd resolution for pseudo proper time = (reco - MC truth)/dReco
208 kTRDpidEffPair, // TRD pid efficieny from conversion electrons
b2a297fa 209 kPairMax, //
210 // Event specific variables
6551594b 211 kXvPrim=kPairMax, // prim vertex
212 kYvPrim, // prim vertex
213 kZvPrim, // prim vertex
214 kXRes, // primary vertex x-resolution
215 kYRes, // primary vertex y-resolution
216 kZRes, // primary vertex z-resolution
5720c765 217
e4339752 218 //// v0 reaction plane quantities from AliEPSelectionTaks
5720c765 219 kv0ArpH2, // VZERO-A reaction plane of the Q vector for 2nd harmonic
220 kv0CrpH2, // reaction plane
221 kv0ACrpH2, // VZERO-AC reaction plane of the Q vector for 2nd harmonic
222 kv0ATPCDiffH2, // V0A-TPC reaction plane difference for 2nd harmonic
223 kv0CTPCDiffH2, // V0C-TPC reaction plane difference for 2nd harmonic
224 kv0Av0CDiffH2, // V0A-V0C reaction plane difference for 2nd harmonic
e4339752 225 kv0ArpH2FlowV2, // v2 coefficient with respect to the 2nd order reaction plane from V0-A
226 kv0CrpH2FlowV2, // v2 coefficient with respect to the 2nd order reaction plane from V0-C
227 kv0ACrpH2FlowV2, // v2 coefficient with respect to the 2nd order reaction plane from V0-A + V0-C
5720c765 228
229 kMultV0A, // VZERO multiplicity and ADC amplitudes
230 kMultV0C,
231 kMultV0,
232 kAdcV0A,
233 kAdcV0C,
234 kAdcV0,
235 kVZEROchMult,
236 // VZERO reaction plane quantities
237 kV0AxH2=kVZEROchMult+64, // VZERO-A x-component of the Q vector for 2nd harmonic
238 kV0AyH2, // VZERO-A y-component of the Q vector for 2nd harmonic
239 kV0ArpH2, // VZERO-A reaction plane of the Q vector for 2nd harmonic
240 kV0CxH2, // VZERO-C x-component of the Q vector for 2nd harmonic
241 kV0CyH2, // y-component
242 kV0CrpH2, // reaction plane
243 kV0ACxH2, // VZERO-AC x-component of the Q vector for 2nd harmonic
244 kV0ACyH2, // VZERO-AC y-component of the Q vector for 2nd harmonic
245 kV0ACrpH2, // VZERO-AC reaction plane of the Q vector for 2nd harmonic
246 kV0ArpResH2, // 2nd harmonic reaction plane resolution for V0A
247 kV0CrpResH2, // V0C
248 kV0ACrpResH2, // V0A+V0C
249 kV0XaXcH2, // Correlation quantities to check V0 reaction plane quality
250 kV0XaYaH2,
251 kV0XaYcH2,
252 kV0YaXcH2,
253 kV0YaYcH2,
254 kV0XcYcH2,
255 kV0ATPCDiffH2, // V0A-TPC reaction plane difference for 2nd harmonic
256 kV0CTPCDiffH2, // V0C-TPC reaction plane difference for 2nd harmonic
257 kV0AV0CDiffH2, // V0A-V0C reaction plane difference for 2nd harmonic
258 // TPC reaction plane quantities
259 kTPCxH2, // TPC x-component of the Q vector for 2nd harmonic (corrected)
260 kTPCyH2, // TPC y-component of the Q vector for 2nd harmonic (corrected)
261 kTPCrpH2, // TPC reaction plane of the Q vector for 2nd harmonic (corrected)
262 kTPCsub1xH2, // TPC x-component of the Q vector for 2nd harmonic (corrected, sub event 1)
263 kTPCsub1yH2, // TPC y-component of the Q vector for 2nd harmonic (corrected, sub event 1)
264 kTPCsub1rpH2, // TPC reaction plane of the Q vector for 2nd harmonic (corrected, sub event 1)
265 kTPCsub2xH2, // TPC x-component of the Q vector for 2nd harmonic (corrected, sub event 2)
266 kTPCsub2yH2, // TPC y-component of the Q vector for 2nd harmonic (corrected, sub event 2)
267 kTPCsub2rpH2, // TPC reaction plane of the Q vector for 2nd harmonic (corrected, sub event 2)
268 kTPCsub12DiffH2, // TPC reaction plane difference of sub event 1,2 for 2nd harmonic
269 kTPCsub12DiffH2Sin, // TPC reaction plane difference of sub event 1,2 for 2nd harmonic, sinus term
270
271 kTPCxH2uc, // TPC x-component of the Q vector for 2nd harmonic (uncorrected)
272 kTPCyH2uc, // TPC y-component of the Q vector for 2nd harmonic (uncorrected)
273 kTPCrpH2uc, // TPC reaction plane of the Q vector for 2nd harmonic (uncorrected)
274 kTPCsub1xH2uc, // TPC x-component of the Q vector for 2nd harmonic (uncorrected, sub event 1)
275 kTPCsub1yH2uc, // TPC y-component of the Q vector for 2nd harmonic (uncorrected, sub event 1)
276 kTPCsub1rpH2uc, // TPC reaction plane of the Q vector for 2nd harmonic (uncorrected, sub event 1)
277 kTPCsub2xH2uc, // TPC x-component of the Q vector for 2nd harmonic (uncorrected, sub event 2)
278 kTPCsub2yH2uc, // TPC y-component of the Q vector for 2nd harmonic (uncorrected, sub event 2)
279 kTPCsub2rpH2uc, // TPC reaction plane of the Q vector for 2nd harmonic (uncorrected, sub event 2)
280 kTPCsub12DiffH2uc, // TPC reaction plane difference of sub event 1,2 for 2nd harmonic (uncorrected)
281
ba15fdfb 282 kNTrk, // number of tracks (or tracklets) TODO: ambiguous
283 kTracks, // ESD tracks TODO: ambiguous
a823f01b 284 kNVtxContrib, // number of primary vertex contibutors
ba15fdfb 285 kNacc, // Number of accepted tracks
5720c765 286 kNaccTrcklts, // number of accepted SPD tracklets in |eta|<1.6
287 kNaccTrcklts0916, // number of accepted SPD tracklets in 0.9<|eta|<1.6
288
289 kNaccTrckltsEsd05, // number of accepted SPD tracklets in |eta|<0.5 (AliESDEvent::EstimateMultiplicity())
290 kNaccTrckltsEsd10, // number of accepted SPD tracklets in |eta|<1.0 (AliESDEvent::EstimateMultiplicity())
291 kNaccTrckltsEsd16, // number of accepted SPD tracklets in |eta|<1.6 (AliESDEvent::EstimateMultiplicity())
292 kNaccTrckltsEsd05Corr, //
293 kNaccTrckltsEsd10Corr, //
294 kNaccTrckltsEsd16Corr, //
295 kNaccItsTpcEsd05, // ITS-TPC tracks + ITS SA complementary tracks + tracklets from unassigned tracklets in |eta|<0.5 (AliESDEvent::EstimateMultiplicity())
296 kNaccItsTpcEsd10, // ITS-TPC tracks + ITS SA complementary tracks + tracklets from unassigned tracklets in |eta|<1.0 (AliESDEvent::EstimateMultiplicity())
297 kNaccItsTpcEsd16, // ITS-TPC tracks + ITS SA complementary tracks + tracklets from unassigned tracklets in |eta|<1.6 (AliESDEvent::EstimateMultiplicity())
298 kNaccItsTpcEsd05Corr, //
299 kNaccItsTpcEsd10Corr, //
300 kNaccItsTpcEsd16Corr, //
301
302 kNaccItsPureEsd05, // ITS SA tracks + tracklets from unassigned tracklets in |eta|<0.5 (AliESDEvent::EstimateMultiplicity())
303 kNaccItsPureEsd10, // ITS SA tracks + tracklets from unassigned tracklets in |eta|<1.0 (AliESDEvent::EstimateMultiplicity())
304 kNaccItsPureEsd16, // ITS SA tracks + tracklets from unassigned tracklets in |eta|<1.6 (AliESDEvent::EstimateMultiplicity())
305 kNaccItsPureEsd05Corr, //
306 kNaccItsPureEsd10Corr, //
307 kNaccItsPureEsd16Corr, //
308
309 kNch, // MC true number of charged particles in |eta|<1.6
310 kNch05, // MC true number of charged particles in |eta|<0.5
311 kNch10, // MC true number of charged particles in |eta|<1.0
312
ffbede40 313 kCentrality, // event centrality fraction
a823f01b 314 kCentralitySPD, // centrality using SPD
6551594b 315 kNevents, // event counter
5720c765 316 kRunNumber, // run number
d327d9cd 317 kMixingBin,
b2a297fa 318 kNMaxValues //
319 // TODO: (for A+A) ZDCEnergy, impact parameter, Iflag??
320 };
321
322
323 AliDielectronVarManager();
324 AliDielectronVarManager(const char* name, const char* title);
325 virtual ~AliDielectronVarManager();
326 static void Fill(const TObject* particle, Double_t * const values);
ba15fdfb 327 static void FillVarMCParticle2(const AliVParticle *p1, const AliVParticle *p2, Double_t * const values);
b2a297fa 328
6551594b 329 static void InitESDpid(Int_t type=0);
2a14a7b1 330 static void InitAODpidUtil(Int_t type=0);
5720c765 331 static void InitEstimatorAvg(const Char_t* filename);
332 static void InitTRDpidEffHistograms(const Char_t* filename);
a823f01b 333 static void SetVZEROCalibrationFile(const Char_t* filename) {fgVZEROCalibrationFile = filename;}
334
335 static void SetVZERORecenteringFile(const Char_t* filename) {fgVZERORecenteringFile = filename;}
ba15fdfb 336 static void SetPIDResponse(AliPIDResponse *pidResponse) {fgPIDResponse=pidResponse;}
5720c765 337 static AliPIDResponse* GetPIDResponse() { return fgPIDResponse; }
572b0139 338 static void SetEvent(AliVEvent * const ev);
5720c765 339 static void SetEventData(const Double_t data[AliDielectronVarManager::kNMaxValues]);
2a14a7b1 340 static Bool_t GetDCA(const AliAODTrack *track, Double_t d0z0[2]);
5720c765 341 static void SetTPCEventPlane(AliEventplane *const evplane);
a823f01b 342 static void GetVzeroRP(const AliVEvent* event, Double_t* qvec, Int_t sideOption); // 0- V0A; 1- V0C; 2- V0A+V0C
5720c765 343
344 static TProfile* GetEstimatorHistogram(Int_t period, Int_t type) {return fgMultEstimatorAvg[period][type];}
345 static Double_t GetTRDpidEfficiency(Int_t runNo, Double_t centrality, Double_t eta, Double_t trdPhi, Double_t pout, Double_t& effErr);
ba15fdfb 346
347 static const AliKFVertex* GetKFVertex() {return fgKFVertex;}
348
b2a297fa 349 static const char* GetValueName(Int_t i) { return (i>=0&&i<kNMaxValues)?fgkParticleNames[i]:""; }
ba15fdfb 350
351 static const Double_t* GetData() {return fgData;}
352
d327d9cd 353 static Double_t GetValue(ValueTypes var) {return fgData[var];}
354 static void SetValue(ValueTypes var, Double_t val) { fgData[var]=val; }
355
b2a297fa 356private:
357
358 static const char* fgkParticleNames[kNMaxValues]; //variable names
359
360 static void FillVarVParticle(const AliVParticle *particle, Double_t * const values);
361 static void FillVarESDtrack(const AliESDtrack *particle, Double_t * const values);
362 static void FillVarAODTrack(const AliAODTrack *particle, Double_t * const values);
8df8e382 363 static void FillVarMCParticle(const AliMCParticle *particle, Double_t * const values);
b2a297fa 364 static void FillVarAODMCParticle(const AliAODMCParticle *particle, Double_t * const values);
365 static void FillVarDielectronPair(const AliDielectronPair *pair, Double_t * const values);
1201a1a9 366 static void FillVarKFParticle(const AliKFParticle *pair, Double_t * const values);
367
6551594b 368 static void FillVarVEvent(const AliVEvent *event, Double_t * const values);
369 static void FillVarESDEvent(const AliESDEvent *event, Double_t * const values);
370 static void FillVarAODEvent(const AliAODEvent *event, Double_t * const values);
371 static void FillVarMCEvent(const AliMCEvent *event, Double_t * const values);
5720c765 372 static void FillVarTPCEventPlane(const AliEventplane *evplane, Double_t * const values);
373
a823f01b 374 static void InitVZEROCalibrationHistograms(Int_t runNo);
375 static void InitVZERORecenteringHistograms(Int_t runNo);
376
ba15fdfb 377 static AliPIDResponse *fgPIDResponse; // PID response object
378 static AliVEvent *fgEvent; // current event pointer
5720c765 379 static AliEventplane *fgTPCEventPlane; // current event plane pointer
ba15fdfb 380 static AliKFVertex *fgKFVertex; // kf vertex
5720c765 381 static TProfile *fgMultEstimatorAvg[4][9]; // multiplicity estimator averages (4 periods x 9 estimators)
382 static Double_t fgTRDpidEffCentRanges[10][4]; // centrality ranges for the TRD pid efficiency histograms
383 static TH3D *fgTRDpidEff[10][4]; // TRD pid efficiencies from conversion electrons
a823f01b 384 static TString fgVZEROCalibrationFile; // file with VZERO channel-by-channel calibrations
385 static TString fgVZERORecenteringFile; // file with VZERO Q-vector averages needed for event plane recentering
386 static TProfile2D *fgVZEROCalib[64]; // 1 histogram per VZERO channel
387 static TProfile2D *fgVZERORecentering[2][2]; // 2 VZERO sides x 2 Q-vector components
2e02dba4 388 static Int_t fgCurrentRun; // current run number
a823f01b 389
ba15fdfb 390 static Double_t fgData[kNMaxValues]; //! data
572b0139 391
b2a297fa 392 AliDielectronVarManager(const AliDielectronVarManager &c);
393 AliDielectronVarManager &operator=(const AliDielectronVarManager &c);
394
395 ClassDef(AliDielectronVarManager,1);
396};
397
398
399//Inline functions
6551594b 400inline void AliDielectronVarManager::Fill(const TObject* object, Double_t * const values)
b2a297fa 401{
402 //
403 // Main function to fill all available variables according to the type of particle
404 //
40875e45 405 if (!object) return;
6551594b 406 if (object->IsA() == AliESDtrack::Class()) FillVarESDtrack(static_cast<const AliESDtrack*>(object), values);
407 else if (object->IsA() == AliAODTrack::Class()) FillVarAODTrack(static_cast<const AliAODTrack*>(object), values);
408 else if (object->IsA() == AliMCParticle::Class()) FillVarMCParticle(static_cast<const AliMCParticle*>(object), values);
409 else if (object->IsA() == AliAODMCParticle::Class()) FillVarAODMCParticle(static_cast<const AliAODMCParticle*>(object), values);
410 else if (object->IsA() == AliDielectronPair::Class()) FillVarDielectronPair(static_cast<const AliDielectronPair*>(object), values);
1201a1a9 411 else if (object->IsA() == AliKFParticle::Class()) FillVarKFParticle(static_cast<const AliKFParticle*>(object),values);
6551594b 412 // Main function to fill all available variables according to the type of event
413
414 else if (object->IsA() == AliVEvent::Class()) FillVarVEvent(static_cast<const AliVEvent*>(object), values);
415 else if (object->IsA() == AliESDEvent::Class()) FillVarESDEvent(static_cast<const AliESDEvent*>(object), values);
416 else if (object->IsA() == AliAODEvent::Class()) FillVarAODEvent(static_cast<const AliAODEvent*>(object), values);
417 else if (object->IsA() == AliMCEvent::Class()) FillVarMCEvent(static_cast<const AliMCEvent*>(object), values);
5720c765 418 else if (object->IsA() == AliEventplane::Class()) FillVarTPCEventPlane(static_cast<const AliEventplane*>(object), values);
1201a1a9 419// else printf(Form("AliDielectronVarManager::Fill: Type %s is not supported by AliDielectronVarManager!", object->ClassName())); //TODO: implement without object needed
b2a297fa 420}
421
422inline void AliDielectronVarManager::FillVarVParticle(const AliVParticle *particle, Double_t * const values)
423{
424 //
425 // Fill track information available in AliVParticle into an array
426 //
427 values[AliDielectronVarManager::kPx] = particle->Px();
428 values[AliDielectronVarManager::kPy] = particle->Py();
429 values[AliDielectronVarManager::kPz] = particle->Pz();
430 values[AliDielectronVarManager::kPt] = particle->Pt();
431 values[AliDielectronVarManager::kP] = particle->P();
432
433 values[AliDielectronVarManager::kXv] = particle->Xv();
434 values[AliDielectronVarManager::kYv] = particle->Yv();
435 values[AliDielectronVarManager::kZv] = particle->Zv();
436
ba15fdfb 437 values[AliDielectronVarManager::kOneOverPt] = (particle->Pt()>1.0e-3 ? particle->OneOverPt() : 0.0);
b2a297fa 438 values[AliDielectronVarManager::kPhi] = particle->Phi();
439 values[AliDielectronVarManager::kTheta] = particle->Theta();
440 values[AliDielectronVarManager::kEta] = particle->Eta();
441 values[AliDielectronVarManager::kY] = particle->Y();
8df8e382 442
b2a297fa 443 values[AliDielectronVarManager::kE] = particle->E();
444 values[AliDielectronVarManager::kM] = particle->M();
445 values[AliDielectronVarManager::kCharge] = particle->Charge();
2a14a7b1 446
447 values[AliDielectronVarManager::kPdgCode] = particle->PdgCode();
448
ba15fdfb 449// if ( fgEvent ) AliDielectronVarManager::Fill(fgEvent, values);
450 for (Int_t i=AliDielectronVarManager::kPairMax; i<AliDielectronVarManager::kNMaxValues; ++i)
451 values[i]=fgData[i];
b2a297fa 452}
453
454inline void AliDielectronVarManager::FillVarESDtrack(const AliESDtrack *particle, Double_t * const values)
455{
456 //
457 // Fill track information available for histogramming into an array
458 //
459
460 // Fill common AliVParticle interface information
461 FillVarVParticle(particle, values);
462
5720c765 463 AliESDtrack *esdTrack=0x0;
464 Double_t origdEdx=particle->GetTPCsignal();
465
466 // apply ETa correction, remove once this is in the tender
d327d9cd 467 esdTrack=const_cast<AliESDtrack*>(particle);
9395992d 468 if (!esdTrack) return;
d327d9cd 469 esdTrack->SetTPCsignal(origdEdx/AliDielectronPID::GetEtaCorr(esdTrack)/AliDielectronPID::GetCorrValdEdx(),esdTrack->GetTPCsignalSigma(),esdTrack->GetTPCsignalN());
5720c765 470
8df8e382 471 Double_t pidProbs[AliPID::kSPECIES];
b2a297fa 472 // Fill AliESDtrack interface specific information
164bfb53 473 Double_t tpcNcls=particle->GetTPCNcls();
5720c765 474 Double_t tpcNclsS = particle->GetTPCnclsS();
475 Double_t itsNcls=particle->GetNcls(0);
ba15fdfb 476 Double_t tpcSignalN=particle->GetTPCsignalN();
5720c765 477 values[AliDielectronVarManager::kNclsITS] = itsNcls; // TODO: get rid of the plain numbers
61d106d3 478 values[AliDielectronVarManager::kNclsTPC] = tpcNcls; // TODO: get rid of the plain numbers
5720c765 479 values[AliDielectronVarManager::kNclsSTPC] = tpcNclsS;
480 values[AliDielectronVarManager::kNclsSFracTPC] = tpcNcls>0?tpcNclsS/tpcNcls:0;
ffbede40 481 values[AliDielectronVarManager::kNclsTPCiter1] = particle->GetTPCNclsIter1(); // TODO: get rid of the plain numbers
b2a297fa 482 values[AliDielectronVarManager::kNFclsTPC] = particle->GetTPCNclsF();
45b2b1b8 483 values[AliDielectronVarManager::kNFclsTPCr] = particle->GetTPCClusterInfo(2,1);
fb7d2d99 484 values[AliDielectronVarManager::kNFclsTPCrFrac] = particle->GetTPCClusterInfo(2);
ba15fdfb 485 values[AliDielectronVarManager::kTPCsignalN] = tpcSignalN;
486 values[AliDielectronVarManager::kTPCsignalNfrac]= tpcNcls>0?tpcSignalN/tpcNcls:0;
b2a297fa 487 values[AliDielectronVarManager::kNclsTRD] = particle->GetNcls(2); // TODO: get rid of the plain numbers
488 values[AliDielectronVarManager::kTRDntracklets] = particle->GetTRDntracklets(); // TODO: GetTRDtracklets/GetTRDntracklets?
e4339752 489 values[AliDielectronVarManager::kTRDpidQuality] = particle->GetTRDntrackletsPID();
5720c765 490 values[AliDielectronVarManager::kTPCclsDiff] = tpcSignalN-tpcNcls;
61d106d3 491 values[AliDielectronVarManager::kTrackStatus] = (Double_t)particle->GetStatus();
492
493
494 values[AliDielectronVarManager::kTPCchi2Cl] = -1;
495 if (tpcNcls>0) values[AliDielectronVarManager::kTPCchi2Cl] = particle->GetTPCchi2() / tpcNcls;
5720c765 496 values[AliDielectronVarManager::kITSchi2Cl] = -1;
497 if (itsNcls>0) values[AliDielectronVarManager::kITSchi2Cl] = particle->GetITSchi2() / itsNcls;
8df8e382 498 //TRD pidProbs
499 particle->GetTRDpid(pidProbs);
500 values[AliDielectronVarManager::kTRDprobEle] = pidProbs[AliPID::kElectron];
501 values[AliDielectronVarManager::kTRDprobPio] = pidProbs[AliPID::kPion];
ffbede40 502
503 values[AliDielectronVarManager::kKinkIndex0] = particle->GetKinkIndex(0);
8df8e382 504
b2a297fa 505 Float_t impactParXY, impactParZ;
506 particle->GetImpactParameters(impactParXY, impactParZ);
507 values[AliDielectronVarManager::kImpactParXY] = impactParXY;
508 values[AliDielectronVarManager::kImpactParZ] = impactParZ;
509
8df8e382 510
ba15fdfb 511 values[AliDielectronVarManager::kPdgCode]=-1;
512 values[AliDielectronVarManager::kPdgCodeMother]=-1;
513 values[AliDielectronVarManager::kPdgCodeGrandMother]=-1;
514
8df8e382 515 values[AliDielectronVarManager::kNumberOfDaughters]=-999;
516
517 AliDielectronMC *mc=AliDielectronMC::Instance();
518
519 if (mc->HasMC()){
520 if (mc->GetMCTrack(particle))
ba15fdfb 521 values[AliDielectronVarManager::kPdgCode]=mc->GetMCTrack(particle)->PdgCode();
8df8e382 522
ba15fdfb 523 AliMCParticle *motherMC=mc->GetMCTrackMother(particle); //mother
524 if (motherMC){
525 values[AliDielectronVarManager::kPdgCodeMother]=motherMC->PdgCode();
526
527 motherMC=mc->GetMCTrackMother(motherMC); //grand motherMC
528 if (motherMC) values[AliDielectronVarManager::kPdgCodeGrandMother]=motherMC->PdgCode();;
529 }
530
8df8e382 531 values[AliDielectronVarManager::kNumberOfDaughters]=mc->NumberOfDaughters(particle);
532 } //if(mc->HasMC())
533
534
535
536 values[AliDielectronVarManager::kITSsignal] = particle->GetITSsignal();
537
538 Double_t itsdEdx[4];
539 particle->GetITSdEdxSamples(itsdEdx);
540
541 values[AliDielectronVarManager::kITSsignalSSD1] = itsdEdx[0];
542 values[AliDielectronVarManager::kITSsignalSSD2] = itsdEdx[1];
543 values[AliDielectronVarManager::kITSsignalSDD1] = itsdEdx[2];
544 values[AliDielectronVarManager::kITSsignalSDD2] = itsdEdx[3];
3505bfad 545 values[AliDielectronVarManager::kITSclusterMap] = particle->GetITSClusterMap();
5720c765 546 values[AliDielectronVarManager::kITSLayerFirstCls] = -1.;
547
548 for (Int_t iC=0; iC<6; iC++) {
549 if (((particle->GetITSClusterMap()) & (1<<(iC))) > 0) {
550 values[AliDielectronVarManager::kITSLayerFirstCls] = iC;
551 break;
552 }
553 }
554
3505bfad 555
b2a297fa 556 values[AliDielectronVarManager::kTrackLength] = particle->GetIntegratedLength();
b2a297fa 557 //dEdx information
558 Double_t mom = particle->GetP();
559 const AliExternalTrackParam *in=particle->GetInnerParam();
5720c765 560 Double_t ysignedIn=-100;
561 if (in) {
562 mom = in->GetP();
563 ysignedIn=particle->Charge()*in->GetY();
564 }
b2a297fa 565 values[AliDielectronVarManager::kPIn]=mom;
5720c765 566 values[AliDielectronVarManager::kYsignedIn]=ysignedIn;
567 const AliExternalTrackParam *out=particle->GetOuterParam();
568 if(out) values[AliDielectronVarManager::kPOut] = out->GetP();
569 else values[AliDielectronVarManager::kPOut] = mom;
570 if(out && fgEvent) {
571 Double_t localCoord[3]={0.0};
572 Bool_t localCoordGood = out->GetXYZAt(298.0, ((AliESDEvent*)fgEvent)->GetMagneticField(), localCoord);
573 values[AliDielectronVarManager::kTRDphi] = (localCoordGood && TMath::Abs(localCoord[0])>1.0e-6 && TMath::Abs(localCoord[1])>1.0e-6 ? TMath::ATan2(localCoord[1], localCoord[0]) : -999.);
574 }
575 if(mc->HasMC() && fgTRDpidEff[0][0]) {
576 Int_t runNo = (fgEvent ? fgEvent->GetRunNumber() : -1);
577 Float_t centrality=-1.0;
578 AliCentrality *esdCentrality = (fgEvent ? fgEvent->GetCentrality() : 0x0);
579 if(esdCentrality) centrality = esdCentrality->GetCentralityPercentile("V0M");
580 Double_t effErr=0.0;
581 values[kTRDpidEffLeg] = GetTRDpidEfficiency(runNo, centrality, values[AliDielectronVarManager::kEta],
582 values[AliDielectronVarManager::kTRDphi],
583 values[AliDielectronVarManager::kPOut], effErr);
584 }
b2a297fa 585 values[AliDielectronVarManager::kTPCsignal]=particle->GetTPCsignal();
ba15fdfb 586
587 values[AliDielectronVarManager::kTOFsignal]=particle->GetTOFsignal();
588
589 Double_t l = particle->GetIntegratedLength(); // cm
590 Double_t t = particle->GetTOFsignal();
591 Double_t t0 = fgPIDResponse->GetTOFResponse().GetTimeZero(); // ps
592
593 if( (l < 360. || l > 800.) || (t <= 0.) || (t0 >999990.0) ) {
594 values[AliDielectronVarManager::kTOFbeta]=0.0;
595 }
596 else {
597 t -= t0; // subtract the T0
598 l *= 0.01; // cm ->m
599 t *= 1e-12; //ps -> s
600
601 Double_t v = l / t;
602 Float_t beta = v / TMath::C();
603 values[AliDielectronVarManager::kTOFbeta]=beta;
604 }
5720c765 605 values[AliDielectronVarManager::kTOFPIDBit]=(particle->GetStatus()&AliESDtrack::kTOFpid? 1: 0);
ba15fdfb 606
6551594b 607 // nsigma to Electron band
608 // TODO: for the moment we set the bethe bloch parameters manually
609 // this should be changed in future!
48609e3d 610
ba15fdfb 611 values[AliDielectronVarManager::kTPCnSigmaEle]=fgPIDResponse->NumberOfSigmasTPC(particle,AliPID::kElectron)-AliDielectronPID::GetCorrVal();
612 values[AliDielectronVarManager::kTPCnSigmaPio]=fgPIDResponse->NumberOfSigmasTPC(particle,AliPID::kPion);
613 values[AliDielectronVarManager::kTPCnSigmaMuo]=fgPIDResponse->NumberOfSigmasTPC(particle,AliPID::kMuon);
614 values[AliDielectronVarManager::kTPCnSigmaKao]=fgPIDResponse->NumberOfSigmasTPC(particle,AliPID::kKaon);
615 values[AliDielectronVarManager::kTPCnSigmaPro]=fgPIDResponse->NumberOfSigmasTPC(particle,AliPID::kProton);
616
617 values[AliDielectronVarManager::kITSnSigmaEle]=fgPIDResponse->NumberOfSigmasITS(particle,AliPID::kElectron);
618 values[AliDielectronVarManager::kITSnSigmaPio]=fgPIDResponse->NumberOfSigmasITS(particle,AliPID::kPion);
619 values[AliDielectronVarManager::kITSnSigmaMuo]=fgPIDResponse->NumberOfSigmasITS(particle,AliPID::kMuon);
620 values[AliDielectronVarManager::kITSnSigmaKao]=fgPIDResponse->NumberOfSigmasITS(particle,AliPID::kKaon);
621 values[AliDielectronVarManager::kITSnSigmaPro]=fgPIDResponse->NumberOfSigmasITS(particle,AliPID::kProton);
622
623 values[AliDielectronVarManager::kTOFnSigmaEle]=fgPIDResponse->NumberOfSigmasTOF(particle,AliPID::kElectron);
624 values[AliDielectronVarManager::kTOFnSigmaPio]=fgPIDResponse->NumberOfSigmasTOF(particle,AliPID::kPion);
625 values[AliDielectronVarManager::kTOFnSigmaMuo]=fgPIDResponse->NumberOfSigmasTOF(particle,AliPID::kMuon);
626 values[AliDielectronVarManager::kTOFnSigmaKao]=fgPIDResponse->NumberOfSigmasTOF(particle,AliPID::kKaon);
627 values[AliDielectronVarManager::kTOFnSigmaPro]=fgPIDResponse->NumberOfSigmasTOF(particle,AliPID::kProton);
5720c765 628
a823f01b 629 //EMCAL PID information
630 Double_t eop=0;
631 Double_t showershape[4]={0.,0.,0.,0.};
632// values[AliDielectronVarManager::kEMCALnSigmaEle] = fgPIDResponse->NumberOfSigmasEMCAL(particle,AliPID::kElectron);
633 values[AliDielectronVarManager::kEMCALnSigmaEle] = fgPIDResponse->NumberOfSigmasEMCAL(particle,AliPID::kElectron,eop,showershape);
634 values[AliDielectronVarManager::kEMCALEoverP] = eop;
635 values[AliDielectronVarManager::kEMCALNCells] = showershape[0];
636 values[AliDielectronVarManager::kEMCALM02] = showershape[1];
637 values[AliDielectronVarManager::kEMCALM20] = showershape[2];
638 values[AliDielectronVarManager::kEMCALDispersion] = showershape[3];
639
640
5720c765 641 //restore TPC signal if it was changed
642 if (esdTrack) esdTrack->SetTPCsignal(origdEdx,esdTrack->GetTPCsignalSigma(),esdTrack->GetTPCsignalN());
b2a297fa 643}
644
645inline void AliDielectronVarManager::FillVarAODTrack(const AliAODTrack *particle, Double_t * const values)
646{
647 //
648 // Fill track information available for histogramming into an array
649 //
650
651 // Fill common AliVParticle interface information
652 FillVarVParticle(particle, values);
ba15fdfb 653 Double_t tpcNcls=particle->GetTPCNcls();
5720c765 654
655 //GetNclsS not present in AODtrack
656 //Replace with method as soon as available
657 TBits tpcSharedMap = particle->GetTPCSharedMap();
658 Double_t tpcNclsS= tpcSharedMap.CountBits(0)-tpcSharedMap.CountBits(159);
572b0139 659 // Reset AliESDtrack interface specific information
1762f182 660 values[AliDielectronVarManager::kNclsITS] = particle->GetITSNcls();
5720c765 661 values[AliDielectronVarManager::kITSchi2Cl] = -1;
ba15fdfb 662 values[AliDielectronVarManager::kNclsTPC] = tpcNcls;
e4339752 663 values[AliDielectronVarManager::kNclsSTPC] = tpcNclsS;
664 values[AliDielectronVarManager::kNclsSFracTPC] = tpcNcls>0?tpcNclsS/tpcNcls:0;
ba15fdfb 665 values[AliDielectronVarManager::kNclsTPCiter1] = tpcNcls; // not really available in AOD
572b0139 666 values[AliDielectronVarManager::kNFclsTPC] = 0;
fb7d2d99 667 values[AliDielectronVarManager::kNFclsTPCr] = 0;
668 values[AliDielectronVarManager::kNFclsTPCrFrac] = 0;
572b0139 669 values[AliDielectronVarManager::kNclsTRD] = 0;
670 values[AliDielectronVarManager::kTRDntracklets] = 0;
671 values[AliDielectronVarManager::kTRDpidQuality] = 0;
61d106d3 672
2e02dba4 673 values[AliDielectronVarManager::kTPCchi2Cl] = (tpcNcls>0)?particle->Chi2perNDF()*(tpcNcls-5)/tpcNcls:999.; // it is stored as normalized to tpcNcls-5 (see AliAnalysisTaskESDfilter)
61d106d3 674 values[AliDielectronVarManager::kTrackStatus] = (Double_t)particle->GetStatus();
675
8df8e382 676 //TRD pidProbs
677 //TODO: set correctly
678 values[AliDielectronVarManager::kTRDprobEle] = 0;
679 values[AliDielectronVarManager::kTRDprobPio] = 0;
680
2a14a7b1 681 values[AliDielectronVarManager::kTPCsignalN] = 0;
ba15fdfb 682 values[AliDielectronVarManager::kTPCsignalNfrac]= 0;
572b0139 683
2a14a7b1 684 // Fill AliAODTrack interface information
685 //
a823f01b 686 values[AliDielectronVarManager::kKinkIndex0] = particle->GetProdVertex()->GetType()==AliAODVertex::kKink ? 1 : 0;
687
2a14a7b1 688 Double_t d0z0[2];
689 GetDCA(particle, d0z0);
690 values[AliDielectronVarManager::kImpactParXY] = d0z0[0];
691 values[AliDielectronVarManager::kImpactParZ] = d0z0[1];
572b0139 692
693 values[AliDielectronVarManager::kPIn]=0;
694 values[AliDielectronVarManager::kTPCsignal]=0;
ba15fdfb 695
696 values[AliDielectronVarManager::kTOFsignal]=0;
697 values[AliDielectronVarManager::kTOFbeta]=0;
572b0139 698
699 values[AliDielectronVarManager::kTPCnSigmaEle]=0;
700 values[AliDielectronVarManager::kTPCnSigmaPio]=0;
701 values[AliDielectronVarManager::kTPCnSigmaMuo]=0;
702 values[AliDielectronVarManager::kTPCnSigmaKao]=0;
703 values[AliDielectronVarManager::kTPCnSigmaPro]=0;
b2a297fa 704
3505bfad 705 values[AliDielectronVarManager::kITSclusterMap] = particle->GetITSClusterMap();
e4339752 706 values[AliDielectronVarManager::kITSLayerFirstCls] = -1.;
707 for (Int_t iC=0; iC<6; iC++) {
708 if (((particle->GetITSClusterMap()) & (1<<(iC))) > 0) {
709 values[AliDielectronVarManager::kITSLayerFirstCls] = iC;
710 break;
711 }
712 }
713
572b0139 714 AliAODPid *pid=particle->GetDetPid();
715 if (pid){
716 Double_t mom =pid->GetTPCmomentum();
ba15fdfb 717 Double_t tpcSignalN=pid->GetTPCsignalN();
718 values[AliDielectronVarManager::kTPCsignalN] = tpcSignalN;
719 values[AliDielectronVarManager::kTPCsignalN] = tpcNcls>0?tpcSignalN/tpcNcls:0;
5720c765 720 values[AliDielectronVarManager::kTPCclsDiff] = tpcSignalN-tpcNcls;
ba15fdfb 721 Double_t tpcNsigmaEle=fgPIDResponse->NumberOfSigmasTPC(particle,AliPID::kElectron);
722 Double_t tpcNsigmaPio=fgPIDResponse->NumberOfSigmasTPC(particle,AliPID::kPion);
723 Double_t tpcNsigmaMuo=fgPIDResponse->NumberOfSigmasTPC(particle,AliPID::kMuon);
724 Double_t tpcNsigmaKao=fgPIDResponse->NumberOfSigmasTPC(particle,AliPID::kKaon);
725 Double_t tpcNsigmaPro=fgPIDResponse->NumberOfSigmasTPC(particle,AliPID::kProton);
572b0139 726
164bfb53 727 values[AliDielectronVarManager::kPIn]=mom;
572b0139 728 values[AliDielectronVarManager::kTPCsignal]=pid->GetTPCsignal();
729
730 values[AliDielectronVarManager::kTPCnSigmaEle]=tpcNsigmaEle;
731 values[AliDielectronVarManager::kTPCnSigmaPio]=tpcNsigmaPio;
732 values[AliDielectronVarManager::kTPCnSigmaMuo]=tpcNsigmaMuo;
733 values[AliDielectronVarManager::kTPCnSigmaKao]=tpcNsigmaKao;
734 values[AliDielectronVarManager::kTPCnSigmaPro]=tpcNsigmaPro;
735
736 values[AliDielectronVarManager::kTRDntracklets] = 0;
e4339752 737 values[AliDielectronVarManager::kTRDpidQuality] = particle->GetTRDntrackletsPID();
738 Double_t prob[AliPID::kSPECIES];
739 fgPIDResponse->ComputeTRDProbability(particle,AliPID::kSPECIES,prob);
740 values[AliDielectronVarManager::kTRDprobEle] = prob[AliPID::kElectron];
741 values[AliDielectronVarManager::kTRDprobPio] = prob[AliPID::kPion];
742
743 values[AliDielectronVarManager::kTOFsignal]=pid->GetTOFsignal();
744 values[AliDielectronVarManager::kTOFbeta] =0;
5720c765 745
746 Double_t tofNsigmaEle=fgPIDResponse->NumberOfSigmasTOF(particle,AliPID::kElectron);
747 Double_t tofNsigmaPio=fgPIDResponse->NumberOfSigmasTOF(particle,AliPID::kPion);
748 Double_t tofNsigmaMuo=fgPIDResponse->NumberOfSigmasTOF(particle,AliPID::kMuon);
749 Double_t tofNsigmaKao=fgPIDResponse->NumberOfSigmasTOF(particle,AliPID::kKaon);
750 Double_t tofNsigmaPro=fgPIDResponse->NumberOfSigmasTOF(particle,AliPID::kProton);
751
752 values[AliDielectronVarManager::kTOFnSigmaEle]=tofNsigmaEle;
753 values[AliDielectronVarManager::kTOFnSigmaPio]=tofNsigmaPio;
754 values[AliDielectronVarManager::kTOFnSigmaMuo]=tofNsigmaMuo;
755 values[AliDielectronVarManager::kTOFnSigmaKao]=tofNsigmaKao;
756 values[AliDielectronVarManager::kTOFnSigmaPro]=tofNsigmaPro;
572b0139 757
758 }
ba15fdfb 759
a823f01b 760 //EMCAL PID information
761 Double_t eop=0;
762 Double_t showershape[4]={0.,0.,0.,0.};
763// values[AliDielectronVarManager::kEMCALnSigmaEle] = fgPIDResponse->NumberOfSigmasEMCAL(particle,AliPID::kElectron);
764 values[AliDielectronVarManager::kEMCALnSigmaEle] = fgPIDResponse->NumberOfSigmasEMCAL(particle,AliPID::kElectron,eop,showershape);
765 values[AliDielectronVarManager::kEMCALEoverP] = eop;
766 values[AliDielectronVarManager::kEMCALNCells] = showershape[0];
767 values[AliDielectronVarManager::kEMCALM02] = showershape[1];
768 values[AliDielectronVarManager::kEMCALM20] = showershape[2];
769 values[AliDielectronVarManager::kEMCALDispersion] = showershape[3];
770
ba15fdfb 771 values[AliDielectronVarManager::kPdgCode]=-1;
772 values[AliDielectronVarManager::kPdgCodeMother]=-1;
773 values[AliDielectronVarManager::kPdgCodeGrandMother]=-1;
774
775 values[AliDielectronVarManager::kNumberOfDaughters]=-999;
776
777 AliDielectronMC *mc=AliDielectronMC::Instance();
778
779 if (mc->HasMC()){
780 if (mc->GetMCTrack(particle))
781 values[AliDielectronVarManager::kPdgCode]=mc->GetMCTrack(particle)->PdgCode();
782
783 AliAODMCParticle *motherMC=mc->GetMCTrackMother(particle); //mother
784 if (motherMC){
785 values[AliDielectronVarManager::kPdgCodeMother]=motherMC->PdgCode();
786
787 motherMC=mc->GetMCTrackMother(motherMC); //grand motherMC
788 if (motherMC) values[AliDielectronVarManager::kPdgCodeGrandMother]=motherMC->PdgCode();;
789 }
790
791 values[AliDielectronVarManager::kNumberOfDaughters]=mc->NumberOfDaughters(particle);
792 } //if(mc->HasMC())
793
5720c765 794 values[AliDielectronVarManager::kTOFPIDBit]=(particle->GetStatus()&AliESDtrack::kTOFpid? 1: 0);
b2a297fa 795}
796
797inline void AliDielectronVarManager::FillVarMCParticle(const AliMCParticle *particle, Double_t * const values)
798{
799 //
800 // Fill track information available for histogramming into an array
801 //
802
554e40f8 803 values[AliDielectronVarManager::kNclsITS] = 0;
5720c765 804 values[AliDielectronVarManager::kITSchi2Cl] = 0;
554e40f8 805 values[AliDielectronVarManager::kNclsTPC] = 0;
5720c765 806 values[AliDielectronVarManager::kNclsSTPC] = 0;
807 values[AliDielectronVarManager::kNclsSFracTPC] = 0;
554e40f8 808 values[AliDielectronVarManager::kNclsTPCiter1] = 0;
809 values[AliDielectronVarManager::kNFclsTPC] = 0;
fb7d2d99 810 values[AliDielectronVarManager::kNFclsTPCr] = 0;
811 values[AliDielectronVarManager::kNFclsTPCrFrac] = 0;
554e40f8 812 values[AliDielectronVarManager::kNclsTRD] = 0;
813 values[AliDielectronVarManager::kTRDntracklets] = 0;
814 values[AliDielectronVarManager::kTRDpidQuality] = 0;
815 values[AliDielectronVarManager::kTPCchi2Cl] = 0;
816 values[AliDielectronVarManager::kTrackStatus] = 0;
817 values[AliDielectronVarManager::kTRDprobEle] = 0;
818 values[AliDielectronVarManager::kTRDprobPio] = 0;
819 values[AliDielectronVarManager::kTPCsignalN] = 0;
5720c765 820 values[AliDielectronVarManager::kTPCclsDiff] = 0;
ba15fdfb 821 values[AliDielectronVarManager::kTPCsignalNfrac] = 0;
554e40f8 822 values[AliDielectronVarManager::kImpactParXY] = 0;
823 values[AliDielectronVarManager::kImpactParZ] = 0;
824 values[AliDielectronVarManager::kPIn] = 0;
5720c765 825 values[AliDielectronVarManager::kYsignedIn] = 0;
554e40f8 826 values[AliDielectronVarManager::kTPCsignal] = 0;
ba15fdfb 827 values[AliDielectronVarManager::kTOFsignal] = 0;
828 values[AliDielectronVarManager::kTOFbeta] = 0;
554e40f8 829 values[AliDielectronVarManager::kTPCnSigmaEle] = 0;
830 values[AliDielectronVarManager::kTPCnSigmaPio] = 0;
831 values[AliDielectronVarManager::kTPCnSigmaMuo] = 0;
832 values[AliDielectronVarManager::kTPCnSigmaKao] = 0;
833 values[AliDielectronVarManager::kTPCnSigmaPro] = 0;
834 values[AliDielectronVarManager::kITSclusterMap] = 0;
835
ba15fdfb 836 values[AliDielectronVarManager::kPdgCode] = -1;
837 values[AliDielectronVarManager::kPdgCodeMother] = -1;
838 values[AliDielectronVarManager::kPdgCodeGrandMother] = -1;
554e40f8 839
b2a297fa 840 // Fill common AliVParticle interface information
841 FillVarVParticle(particle, values);
8df8e382 842
843 AliDielectronMC *mc=AliDielectronMC::Instance();
844
b2a297fa 845 // Fill AliMCParticle interface specific information
846 values[AliDielectronVarManager::kPdgCode] = particle->PdgCode();
8df8e382 847
ba15fdfb 848 AliMCParticle *motherMC = mc->GetMCTrackMother(particle);
849 if (motherMC){
850 values[AliDielectronVarManager::kPdgCodeMother]=motherMC->PdgCode();
851 motherMC=mc->GetMCTrackMother(motherMC); //grand mother
852 if (motherMC) values[AliDielectronVarManager::kPdgCodeGrandMother]=motherMC->PdgCode();;
853 }
854
fb7d2d99 855 values[AliDielectronVarManager::kIsJpsiPrimary] = mc->IsJpsiPrimary(particle);
8df8e382 856 values[AliDielectronVarManager::kNumberOfDaughters]=mc->NumberOfDaughters(particle);
b2a297fa 857}
858
ba15fdfb 859
860inline void AliDielectronVarManager::FillVarMCParticle2(const AliVParticle *p1, const AliVParticle *p2, Double_t * const values) {
861 //
862 // fill 2 track information starting from MC legs
863 //
864
865 values[AliDielectronVarManager::kNclsITS] = 0;
5720c765 866 values[AliDielectronVarManager::kITSchi2Cl] = -1;
ba15fdfb 867 values[AliDielectronVarManager::kNclsTPC] = 0;
5720c765 868 values[AliDielectronVarManager::kNclsSTPC] = 0;
869 values[AliDielectronVarManager::kNclsSFracTPC] = 0;
ba15fdfb 870 values[AliDielectronVarManager::kNclsTPCiter1] = 0;
871 values[AliDielectronVarManager::kNFclsTPC] = 0;
872 values[AliDielectronVarManager::kNFclsTPCr] = 0;
873 values[AliDielectronVarManager::kNFclsTPCrFrac] = 0;
874 values[AliDielectronVarManager::kNclsTRD] = 0;
875 values[AliDielectronVarManager::kTRDntracklets] = 0;
876 values[AliDielectronVarManager::kTRDpidQuality] = 0;
877 values[AliDielectronVarManager::kTPCchi2Cl] = 0;
878 values[AliDielectronVarManager::kTrackStatus] = 0;
879 values[AliDielectronVarManager::kTRDprobEle] = 0;
880 values[AliDielectronVarManager::kTRDprobPio] = 0;
881 values[AliDielectronVarManager::kTPCsignalN] = 0;
5720c765 882 values[AliDielectronVarManager::kTPCclsDiff] = 0;
ba15fdfb 883 values[AliDielectronVarManager::kTPCsignalNfrac] = 0;
884 values[AliDielectronVarManager::kImpactParXY] = 0;
885 values[AliDielectronVarManager::kImpactParZ] = 0;
886 values[AliDielectronVarManager::kPIn] = 0;
5720c765 887 values[AliDielectronVarManager::kYsignedIn] = 0;
ba15fdfb 888 values[AliDielectronVarManager::kTPCsignal] = 0;
889 values[AliDielectronVarManager::kTPCnSigmaEle] = 0;
890 values[AliDielectronVarManager::kTPCnSigmaPio] = 0;
891 values[AliDielectronVarManager::kTPCnSigmaMuo] = 0;
892 values[AliDielectronVarManager::kTPCnSigmaKao] = 0;
893 values[AliDielectronVarManager::kTPCnSigmaPro] = 0;
894 values[AliDielectronVarManager::kITSclusterMap] = 0;
895
896 values[AliDielectronVarManager::kPdgCode] = 0;
897 values[AliDielectronVarManager::kPdgCodeMother] = 0;
898
899 AliDielectronMC *mc=AliDielectronMC::Instance();
900 AliVParticle* mother=0x0;
901 Int_t mLabel1 = mc->GetMothersLabel(p1->GetLabel());
902 Int_t mLabel2 = mc->GetMothersLabel(p2->GetLabel());
903 if(mLabel1==mLabel2)
904 mother = mc->GetMCTrackFromMCEvent(mLabel1);
5720c765 905
906 values[AliDielectronVarManager::kPseudoProperTime] = -2e10;
907 if(mother) { // same mother
ba15fdfb 908 FillVarVParticle(mother, values);
5720c765 909 Double_t lxy = ((mother->Xv()- values[AliDielectronVarManager::kXvPrim]) * mother->Px() +
910 (mother->Yv()- values[AliDielectronVarManager::kYvPrim]) * mother->Py() )/mother->Pt();
911 values[AliDielectronVarManager::kPseudoProperTime] = lxy*(TDatabasePDG::Instance()->GetParticle(443)->Mass())/mother->Pt();
912 }
ba15fdfb 913 else { // the 2 particles come from different mothers so 2-particles quantities are calculated here
914 // AliVParticle part
915 values[AliDielectronVarManager::kPx] = p1->Px()+p2->Px();
916 values[AliDielectronVarManager::kPy] = p1->Py()+p2->Py();
917 values[AliDielectronVarManager::kPz] = p1->Pz()+p2->Pz();
918 values[AliDielectronVarManager::kPt] = TMath::Sqrt(values[AliDielectronVarManager::kPx]*
919 values[AliDielectronVarManager::kPx]+
920 values[AliDielectronVarManager::kPy]*
921 values[AliDielectronVarManager::kPy]);
922 values[AliDielectronVarManager::kP] = TMath::Sqrt(values[AliDielectronVarManager::kPt]*
923 values[AliDielectronVarManager::kPt]+
924 values[AliDielectronVarManager::kPz]*
925 values[AliDielectronVarManager::kPz]);
926
927 values[AliDielectronVarManager::kXv] = 0;
928 values[AliDielectronVarManager::kYv] = 0;
929 values[AliDielectronVarManager::kZv] = 0;
930
931 values[AliDielectronVarManager::kOneOverPt] = (values[AliDielectronVarManager::kPt]>1.0e-6 ? 1.0/values[AliDielectronVarManager::kPt] : 0.0);
932 values[AliDielectronVarManager::kPhi] = TMath::ATan2(values[AliDielectronVarManager::kPy],values[AliDielectronVarManager::kPx]);
933 values[AliDielectronVarManager::kTheta] = TMath::ATan2(values[AliDielectronVarManager::kPt],values[AliDielectronVarManager::kPz]);
934 values[AliDielectronVarManager::kEta] = ((values[AliDielectronVarManager::kP]-values[AliDielectronVarManager::kPz])>1.0e-6 && (values[AliDielectronVarManager::kP]+values[AliDielectronVarManager::kPz])>1.0e-6 ? 0.5*TMath::Log((values[AliDielectronVarManager::kP]+values[AliDielectronVarManager::kPz])/(values[AliDielectronVarManager::kP]-values[AliDielectronVarManager::kPz])) : -9999.);
935 values[AliDielectronVarManager::kE] = p1->E()+p2->E();
936 values[AliDielectronVarManager::kY] = ((values[AliDielectronVarManager::kE]-values[AliDielectronVarManager::kPz])>1.0e-6 && (values[AliDielectronVarManager::kE]+values[AliDielectronVarManager::kPz])>1.0e-6 ? 0.5*TMath::Log((values[AliDielectronVarManager::kE]+values[AliDielectronVarManager::kPz])/(values[AliDielectronVarManager::kE]-values[AliDielectronVarManager::kPz])) : -9999.);
937 values[AliDielectronVarManager::kCharge] = p1->Charge()+p2->Charge();
938
5720c765 939 values[AliDielectronVarManager::kM] = TMath::Sqrt(p1->M()*p1->M()+p2->M()*p2->M()+
940 2.0*(p1->E()*p2->E()-p1->Px()*p2->Px()-p1->Py()*p2->Py()-p1->Pz()*p2->Pz()));
ba15fdfb 941
942 if ( fgEvent ) AliDielectronVarManager::Fill(fgEvent, values);
943 }
a823f01b 944
5720c765 945 values[AliDielectronVarManager::kThetaHE] = AliDielectronPair::ThetaPhiCM(p1,p2,kTRUE, kTRUE);
946 values[AliDielectronVarManager::kPhiHE] = AliDielectronPair::ThetaPhiCM(p1,p2,kTRUE, kFALSE);
1762f182 947 values[AliDielectronVarManager::kThetaSqHE] = values[AliDielectronVarManager::kThetaHE] * values[AliDielectronVarManager::kThetaHE];
5720c765 948 values[AliDielectronVarManager::kCos2PhiHE] = TMath::Cos(2*values[AliDielectronVarManager::kPhiHE]);
949 values[AliDielectronVarManager::kThetaCS] = AliDielectronPair::ThetaPhiCM(p1,p2,kFALSE, kTRUE);
950 values[AliDielectronVarManager::kPhiCS] = AliDielectronPair::ThetaPhiCM(p1,p2,kFALSE, kFALSE);
1762f182 951 values[AliDielectronVarManager::kThetaSqCS] = values[AliDielectronVarManager::kThetaCS] * values[AliDielectronVarManager::kThetaCS];
5720c765 952 values[AliDielectronVarManager::kCos2PhiCS] = TMath::Cos(2*values[AliDielectronVarManager::kPhiCS]);
a823f01b 953 values[AliDielectronVarManager::kCosTilPhiHE] = (TMath::Cos(values[AliDielectronVarManager::kPhiHE])>0)?(TMath::Cos(values[AliDielectronVarManager::kPhiHE]-TMath::Pi()/4.)):(TMath::Cos(values[AliDielectronVarManager::kPhiHE]-3*TMath::Pi()/4.));
954 values[AliDielectronVarManager::kCosTilPhiCS] = (TMath::Cos(values[AliDielectronVarManager::kPhiCS])>0)?(TMath::Cos(values[AliDielectronVarManager::kPhiCS]-TMath::Pi()/4.)):(TMath::Cos(values[AliDielectronVarManager::kPhiCS]-3*TMath::Pi()/4.));
ba15fdfb 955}
956
957
b2a297fa 958inline void AliDielectronVarManager::FillVarAODMCParticle(const AliAODMCParticle *particle, Double_t * const values)
959{
960 //
961 // Fill track information available for histogramming into an array
962 //
963
554e40f8 964 values[AliDielectronVarManager::kNclsITS] = 0;
5720c765 965 values[AliDielectronVarManager::kITSchi2Cl] = -1;
554e40f8 966 values[AliDielectronVarManager::kNclsTPC] = 0;
5720c765 967 values[AliDielectronVarManager::kNclsSTPC] = 0;
968 values[AliDielectronVarManager::kNclsSFracTPC] = 0;
554e40f8 969 values[AliDielectronVarManager::kNclsTPCiter1] = 0;
970 values[AliDielectronVarManager::kNFclsTPC] = 0;
971 values[AliDielectronVarManager::kNclsTRD] = 0;
972 values[AliDielectronVarManager::kTRDntracklets] = 0;
973 values[AliDielectronVarManager::kTRDpidQuality] = 0;
974 values[AliDielectronVarManager::kTPCchi2Cl] = 0;
975 values[AliDielectronVarManager::kTrackStatus] = 0;
976 values[AliDielectronVarManager::kTRDprobEle] = 0;
977 values[AliDielectronVarManager::kTRDprobPio] = 0;
978 values[AliDielectronVarManager::kTPCsignalN] = 0;
5720c765 979 values[AliDielectronVarManager::kTPCclsDiff] = 0;
ba15fdfb 980 values[AliDielectronVarManager::kTPCsignalNfrac]= 0;
554e40f8 981 values[AliDielectronVarManager::kImpactParXY] = 0;
982 values[AliDielectronVarManager::kImpactParZ] = 0;
983 values[AliDielectronVarManager::kPIn] = 0;
5720c765 984 values[AliDielectronVarManager::kYsignedIn] = 0;
554e40f8 985 values[AliDielectronVarManager::kTPCsignal] = 0;
986 values[AliDielectronVarManager::kTPCnSigmaEle] = 0;
987 values[AliDielectronVarManager::kTPCnSigmaPio] = 0;
988 values[AliDielectronVarManager::kTPCnSigmaMuo] = 0;
989 values[AliDielectronVarManager::kTPCnSigmaKao] = 0;
990 values[AliDielectronVarManager::kTPCnSigmaPro] = 0;
991 values[AliDielectronVarManager::kITSclusterMap] = 0;
992
ba15fdfb 993 values[AliDielectronVarManager::kPdgCode] = -1;
994 values[AliDielectronVarManager::kPdgCodeMother] = -1;
995 values[AliDielectronVarManager::kPdgCodeGrandMother] = -1;
554e40f8 996
b2a297fa 997 // Fill common AliVParticle interface information
998 FillVarVParticle(particle, values);
554e40f8 999
8df8e382 1000 AliDielectronMC *mc=AliDielectronMC::Instance();
1001
1002
b2a297fa 1003 // Fill AliAODMCParticle interface specific information
8df8e382 1004 values[AliDielectronVarManager::kPdgCode] = particle->PdgCode();
1005
ba15fdfb 1006 AliAODMCParticle *motherMC = mc->GetMCTrackMother(particle);
1007 if (motherMC){
1008 values[AliDielectronVarManager::kPdgCodeMother]=motherMC->PdgCode();
1009 motherMC=mc->GetMCTrackMother(motherMC); //grand mother
1010 if (motherMC) values[AliDielectronVarManager::kPdgCodeGrandMother]=motherMC->PdgCode();;
1011 }
1012
1013
fb7d2d99 1014 values[AliDielectronVarManager::kIsJpsiPrimary] = mc->IsJpsiPrimary(particle);
8df8e382 1015
1016 values[AliDielectronVarManager::kNumberOfDaughters]=mc->NumberOfDaughters(particle);
b2a297fa 1017}
1018
1019inline void AliDielectronVarManager::FillVarDielectronPair(const AliDielectronPair *pair, Double_t * const values)
1020{
1021 //
1022 // Fill pair information available for histogramming into an array
1023 //
2a14a7b1 1024
ba15fdfb 1025 values[AliDielectronVarManager::kPdgCode]=-1;
1026 values[AliDielectronVarManager::kPdgCodeMother]=-1;
1027 values[AliDielectronVarManager::kPdgCodeGrandMother]=-1;
2a14a7b1 1028
b2a297fa 1029 // Fill common AliVParticle interface information
1030 FillVarVParticle(pair, values);
1031
1032 // Fill AliDielectronPair specific information
1033 const AliKFParticle &kfPair = pair->GetKFParticle();
61d106d3 1034
1035 Double_t thetaHE=0;
1036 Double_t phiHE=0;
1037 Double_t thetaCS=0;
1038 Double_t phiCS=0;
1039
1040 pair->GetThetaPhiCM(thetaHE,phiHE,thetaCS,phiCS);
5720c765 1041
b2a297fa 1042 values[AliDielectronVarManager::kChi2NDF] = kfPair.GetChi2()/kfPair.GetNDF();
1043 values[AliDielectronVarManager::kDecayLength] = kfPair.GetDecayLength();
1044 values[AliDielectronVarManager::kR] = kfPair.GetR();
1045 values[AliDielectronVarManager::kOpeningAngle] = pair->OpeningAngle();
2e02dba4 1046 values[AliDielectronVarManager::kCosPointingAngle] = fgEvent ? pair->GetCosPointingAngle(fgEvent->GetPrimaryVertex()) : -1;
61d106d3 1047 values[AliDielectronVarManager::kThetaHE] = thetaHE;
1048 values[AliDielectronVarManager::kPhiHE] = phiHE;
1762f182 1049 values[AliDielectronVarManager::kThetaSqHE] = thetaHE * thetaHE;
5720c765 1050 values[AliDielectronVarManager::kCos2PhiHE] = TMath::Cos(2.0*phiHE);
a823f01b 1051 values[AliDielectronVarManager::kCosTilPhiHE] = (TMath::Cos(phiHE)>0)?(TMath::Cos(phiHE-TMath::Pi()/4.)):(TMath::Cos(phiHE-3*TMath::Pi()/4.));
61d106d3 1052 values[AliDielectronVarManager::kThetaCS] = thetaCS;
1053 values[AliDielectronVarManager::kPhiCS] = phiCS;
1762f182 1054 values[AliDielectronVarManager::kThetaSqCS] = thetaCS * thetaCS;
5720c765 1055 values[AliDielectronVarManager::kCos2PhiCS] = TMath::Cos(2.0*phiCS);
a823f01b 1056 values[AliDielectronVarManager::kCosTilPhiCS] = (TMath::Cos(phiCS)>0)?(TMath::Cos(phiCS-TMath::Pi()/4.)):(TMath::Cos(phiCS-3*TMath::Pi()/4.));
572b0139 1057 values[AliDielectronVarManager::kLegDist] = pair->DistanceDaughters();
1058 values[AliDielectronVarManager::kLegDistXY] = pair->DistanceDaughtersXY();
61d106d3 1059 values[AliDielectronVarManager::kDeltaEta] = pair->DeltaEta();
1060 values[AliDielectronVarManager::kDeltaPhi] = pair->DeltaPhi();
8df8e382 1061 values[AliDielectronVarManager::kMerr] = kfPair.GetErrMass()>1e-30&&kfPair.GetMass()>1e-30?kfPair.GetErrMass()/kfPair.GetMass():1000000;
b2a297fa 1062 values[AliDielectronVarManager::kPairType] = pair->GetType();
8df8e382 1063
5720c765 1064 Double_t errPseudoProperTime2 = -1;
91487037 1065 values[AliDielectronVarManager::kPsiPair] = fgEvent ? pair->PsiPair(fgEvent->GetMagneticField()) : -5;
e4339752 1066 values[AliDielectronVarManager::kPseudoProperTime] = fgEvent ? kfPair.GetPseudoProperDecayTime(*(fgEvent->GetPrimaryVertex()), TDatabasePDG::Instance()->GetParticle(443)->Mass(), &errPseudoProperTime2 ) : -1e10;
5720c765 1067 // values[AliDielectronVarManager::kPseudoProperTime] = fgEvent ? pair->GetPseudoProperTime(fgEvent->GetPrimaryVertex()): -1e10;
e4339752 1068 values[AliDielectronVarManager::kPseudoProperTimeErr] = (errPseudoProperTime2 > 0) ? TMath::Sqrt(errPseudoProperTime2) : -1e10;
5720c765 1069
1070 // Flow quantities
1071 Double_t delta=0.0;
1072 // v2 with respect to VZERO-A event plane
1073 delta = values[AliDielectronVarManager::kPhi] - fgData[AliDielectronVarManager::kV0ArpH2];
1074 if(delta>TMath::Pi()) delta -= 2.0*TMath::Pi(); // keep the [-pi,+pi] interval
1075 if(delta<-1.0*TMath::Pi()) delta += 2.0*TMath::Pi();
1076 values[AliDielectronVarManager::kV0ArpH2FlowV2] = TMath::Cos(2.0*delta); // 2nd harmonic flow coefficient
1077 values[AliDielectronVarManager::kDeltaPhiV0ArpH2] = delta;
1078 // v2 with respect to VZERO-C event plane
1079 delta = values[AliDielectronVarManager::kPhi] - fgData[AliDielectronVarManager::kV0CrpH2];
1080 if(delta>TMath::Pi()) delta -= 2.0*TMath::Pi(); // keep the [-pi,+pi] interval
1081 if(delta<-1.0*TMath::Pi()) delta += 2.0*TMath::Pi();
1082 values[AliDielectronVarManager::kV0CrpH2FlowV2] = TMath::Cos(2.0*delta); // 2nd harmonic flow coefficient
1083 values[AliDielectronVarManager::kDeltaPhiV0CrpH2] = delta;
1084 // v2 with respect to the combined VZERO-A and VZERO-C event plane
1085 delta = values[AliDielectronVarManager::kPhi] - fgData[AliDielectronVarManager::kV0ACrpH2];
1086 if(delta>TMath::Pi()) delta -= 2.0*TMath::Pi(); // keep the [-pi,+pi] interval
1087 if(delta<-1.0*TMath::Pi()) delta += 2.0*TMath::Pi();
1088 values[AliDielectronVarManager::kV0ACrpH2FlowV2] = TMath::Cos(2.0*delta); // 2nd harmonic flow coefficient
1089 values[AliDielectronVarManager::kDeltaPhiV0ACrpH2] = delta;
1090
1091
8df8e382 1092 AliDielectronMC *mc=AliDielectronMC::Instance();
1093
1094 if (mc->HasMC()){
5720c765 1095 values[AliDielectronVarManager::kPseudoProperTimeResolution] = -10.0e+10;
ba15fdfb 1096 Bool_t samemother = mc->HaveSameMother(pair);
1097 values[AliDielectronVarManager::kIsJpsiPrimary] = mc->IsJpsiPrimary(pair);
1098 values[AliDielectronVarManager::kHaveSameMother] = samemother ;
5720c765 1099
1100 // fill kPseudoProperTimeResolution
1101 values[AliDielectronVarManager::kPseudoProperTimeResolution] = -1e10;
1102 // values[AliDielectronVarManager::kPseudoProperTimePull] = -1e10;
1103 if(samemother && fgEvent) {
1104 if(pair->GetFirstDaughter()->GetLabel() > 0) {
1105 const AliVParticle* d1 = mc->GetMCTrackFromMCEvent(pair->GetFirstDaughter()->GetLabel());
1106 const AliVParticle* motherMC = mc->GetMCTrackFromMCEvent(((AliMCParticle*)d1)->GetMother());
40875e45 1107 const AliMCEvent *mcevent = mc->GetMCEvent();
1108 const AliVVertex* mcVtx = mcevent ? mcevent->GetPrimaryVertex() : 0x0;
5720c765 1109 if(motherMC && mcVtx) {
1110 const Double_t lxyMC = ( (motherMC->Xv() - mcVtx->GetX()) * motherMC->Px() +
1111 (motherMC->Yv() - mcVtx->GetY()) * motherMC->Py() ) / motherMC->Pt();
1112 const Double_t pseudoMC = lxyMC * (TDatabasePDG::Instance()->GetParticle(443)->Mass())/motherMC->Pt();
1113 values[AliDielectronVarManager::kPseudoProperTimeResolution] = values[AliDielectronVarManager::kPseudoProperTime] - pseudoMC;
1114 if (errPseudoProperTime2 > 0)
1115 values[AliDielectronVarManager::kPseudoProperTimePull] = values[AliDielectronVarManager::kPseudoProperTimeResolution]/sqrt(errPseudoProperTime2);
1116 }
1117 }
1118 }
2e02dba4 1119
1120 values[AliDielectronVarManager::kTRDpidEffPair] = 0.;
1121 if (fgTRDpidEff[0][0]){
1122 Double_t valuesLeg1[AliDielectronVarManager::kNMaxValues];
1123 Double_t valuesLeg2[AliDielectronVarManager::kNMaxValues];
1124 AliVParticle* leg1 = pair->GetFirstDaughter();
1125 AliVParticle* leg2 = pair->GetSecondDaughter();
1126 if (leg1 && leg2){
1127 Fill(leg1, valuesLeg1);
1128 Fill(leg2, valuesLeg2);
1129 values[AliDielectronVarManager::kTRDpidEffPair] = valuesLeg1[AliDielectronVarManager::kTRDpidEffLeg]*valuesLeg2[AliDielectronVarManager::kTRDpidEffLeg];
1130 }
1131 }
8df8e382 1132 }//if (mc->HasMC())
1133
1134
b2a297fa 1135}
1136
1201a1a9 1137inline void AliDielectronVarManager::FillVarKFParticle(const AliKFParticle *particle, Double_t * const values)
1138{
1139 //
1140 // Fill track information available in AliVParticle into an array
1141 //
1142 values[AliDielectronVarManager::kPx] = particle->GetPx();
1143 values[AliDielectronVarManager::kPy] = particle->GetPy();
1144 values[AliDielectronVarManager::kPz] = particle->GetPz();
1145 values[AliDielectronVarManager::kPt] = particle->GetPt();
1146 values[AliDielectronVarManager::kP] = particle->GetP();
1147
1148 values[AliDielectronVarManager::kXv] = particle->GetX();
1149 values[AliDielectronVarManager::kYv] = particle->GetY();
1150 values[AliDielectronVarManager::kZv] = particle->GetZ();
1151
1152 values[AliDielectronVarManager::kOneOverPt] = 0;
1153 values[AliDielectronVarManager::kPhi] = particle->GetPhi();
1154 values[AliDielectronVarManager::kTheta] = 0.;
1155 values[AliDielectronVarManager::kEta] = particle->GetEta();
1156 values[AliDielectronVarManager::kY] = ((particle->GetE()*particle->GetE()-particle->GetPx()*particle->GetPx()-particle->GetPy()*particle->GetPy()-particle->GetPz()*particle->GetPz())>0.) ? TLorentzVector(particle->GetPx(),particle->GetPy(),particle->GetPz(),particle->GetE()).Rapidity() : -1111.;
1157
1158 values[AliDielectronVarManager::kE] = particle->GetE();
1159 values[AliDielectronVarManager::kM] = particle->GetMass();
1160 values[AliDielectronVarManager::kCharge] = particle->GetQ();
1161
1162 values[AliDielectronVarManager::kNclsITS] = 0;
5720c765 1163 values[AliDielectronVarManager::kITSchi2Cl] = -1;
1201a1a9 1164 values[AliDielectronVarManager::kNclsTPC] = 0;
5720c765 1165 values[AliDielectronVarManager::kNclsSTPC] = 0;
1166 values[AliDielectronVarManager::kNclsSFracTPC] = 0;
1201a1a9 1167 values[AliDielectronVarManager::kNclsTPCiter1] = 0;
1168 values[AliDielectronVarManager::kNFclsTPC] = 0;
1169 values[AliDielectronVarManager::kNclsTRD] = 0;
1170 values[AliDielectronVarManager::kTRDntracklets] = 0;
1171 values[AliDielectronVarManager::kTRDpidQuality] = 0;
1172 values[AliDielectronVarManager::kTPCchi2Cl] = 0;
1173 values[AliDielectronVarManager::kTrackStatus] = 0;
1174 values[AliDielectronVarManager::kTRDprobEle] = 0;
1175 values[AliDielectronVarManager::kTRDprobPio] = 0;
1176 values[AliDielectronVarManager::kTPCsignalN] = 0;
5720c765 1177 values[AliDielectronVarManager::kTPCclsDiff] = 0;
ba15fdfb 1178 values[AliDielectronVarManager::kTPCsignalNfrac]= 0;
1201a1a9 1179 values[AliDielectronVarManager::kImpactParXY] = 0;
1180 values[AliDielectronVarManager::kImpactParZ] = 0;
1181 values[AliDielectronVarManager::kPIn] = 0;
5720c765 1182 values[AliDielectronVarManager::kYsignedIn] = 0;
1201a1a9 1183 values[AliDielectronVarManager::kTPCsignal] = 0;
ba15fdfb 1184 values[AliDielectronVarManager::kTOFsignal] = 0;
1185 values[AliDielectronVarManager::kTOFbeta] = 0;
1201a1a9 1186 values[AliDielectronVarManager::kTPCnSigmaEle] = 0;
1187 values[AliDielectronVarManager::kTPCnSigmaPio] = 0;
1188 values[AliDielectronVarManager::kTPCnSigmaMuo] = 0;
1189 values[AliDielectronVarManager::kTPCnSigmaKao] = 0;
1190 values[AliDielectronVarManager::kTPCnSigmaPro] = 0;
1191 values[AliDielectronVarManager::kITSclusterMap] = 0;
1192
ba15fdfb 1193 values[AliDielectronVarManager::kPdgCode] = -1;
1194 values[AliDielectronVarManager::kPdgCodeMother] = -1;
1195 values[AliDielectronVarManager::kPdgCodeGrandMother] = -1;
1201a1a9 1196
1197
5720c765 1198// if ( fgEvent ) AliDielectronVarManager::Fill(fgEvent, values);
1199 for (Int_t i=AliDielectronVarManager::kPairMax; i<AliDielectronVarManager::kNMaxValues; ++i)
1200 values[i]=fgData[i];
1201
1201a1a9 1202}
6551594b 1203
1204inline void AliDielectronVarManager::FillVarVEvent(const AliVEvent *event, Double_t * const values)
1205{
1206 //
1207 // Fill event information available for histogramming into an array
1208 //
5720c765 1209 values[AliDielectronVarManager::kRunNumber] = event->GetRunNumber();
a823f01b 1210 if(fgCurrentRun!=event->GetRunNumber()) {
1211 if(fgVZEROCalibrationFile.Contains(".root")) InitVZEROCalibrationHistograms(event->GetRunNumber());
1212 if(fgVZERORecenteringFile.Contains(".root")) InitVZERORecenteringHistograms(event->GetRunNumber());
1213 fgCurrentRun=event->GetRunNumber();
1214 }
6551594b 1215 const AliVVertex *primVtx = event->GetPrimaryVertex();
8df8e382 1216
1217 values[AliDielectronVarManager::kXvPrim] = 0;
1218 values[AliDielectronVarManager::kYvPrim] = 0;
1219 values[AliDielectronVarManager::kZvPrim] = 0;
ba15fdfb 1220// values[AliDielectronVarManager::kChi2NDF] = 0; //This is the pair value!!!
5720c765 1221
8df8e382 1222 values[AliDielectronVarManager::kNTrk] = 0;
a823f01b 1223 values[AliDielectronVarManager::kNVtxContrib] = 0;
ba15fdfb 1224 values[AliDielectronVarManager::kNacc] = 0;
1225 values[AliDielectronVarManager::kNaccTrcklts] = 0;
5720c765 1226 values[AliDielectronVarManager::kNaccTrcklts0916] = 0;
8df8e382 1227 values[AliDielectronVarManager::kNevents] = 0; //always fill bin 0;
5720c765 1228
8df8e382 1229 if (!primVtx) return;
1230
6551594b 1231 values[AliDielectronVarManager::kXvPrim] = primVtx->GetX();
1232 values[AliDielectronVarManager::kYvPrim] = primVtx->GetY();
1233 values[AliDielectronVarManager::kZvPrim] = primVtx->GetZ();
ba15fdfb 1234// values[AliDielectronVarManager::kChi2NDF] = primVtx->GetChi2perNDF(); //this is the pair value
6551594b 1235
5720c765 1236 values[AliDielectronVarManager::kNTrk] = event->GetNumberOfTracks();
a823f01b 1237 values[AliDielectronVarManager::kNVtxContrib] = primVtx->GetNContributors();
5720c765 1238 values[AliDielectronVarManager::kNacc] = AliDielectronHelper::GetNacc(event);
1239 values[AliDielectronVarManager::kNaccTrcklts] = AliDielectronHelper::GetNaccTrcklts(event); // etaRange = 1.6 (default)
1240 values[AliDielectronVarManager::kNaccTrcklts0916] = AliDielectronHelper::GetNaccTrcklts(event,1.6)-AliDielectronHelper::GetNaccTrcklts(event,.9);
1241 // values[AliDielectronVarManager::kNaccTrcklts05] = AliDielectronHelper::GetNaccTrcklts(event, 0.5);
1242 // values[AliDielectronVarManager::kNaccTrcklts10] = AliDielectronHelper::GetNaccTrcklts(event, 1.0);
1243 // values[AliDielectronVarManager::kNaccTrckltsCorr] = AliDielectronHelper::GetNaccTrckltsCorrected(event, values[AliDielectronVarManager::kNaccTrcklts], values[AliDielectronVarManager::kZvPrim]);
1244
1245 // TPC event plane (corrected)
5720c765 1246
1247 // VZERO event plane quantities from the AliEPSelectionTask
1248 AliEventplane *ep = const_cast<AliVEvent*>(event)->GetEventplane();
1249 values[AliDielectronVarManager::kv0ACrpH2] = TVector2::Phi_mpi_pi(ep->GetEventplane("V0", event, 2));
1250 values[AliDielectronVarManager::kv0ArpH2] = TVector2::Phi_mpi_pi(ep->GetEventplane("V0A",event, 2));
1251 values[AliDielectronVarManager::kv0CrpH2] = TVector2::Phi_mpi_pi(ep->GetEventplane("V0C",event, 2));
e4339752 1252 values[AliDielectronVarManager::kv0ACrpH2FlowV2] = TMath::Cos( 2*(values[AliDielectronVarManager::kPhi] - values[AliDielectronVarManager::kv0ACrpH2]) );
1253 values[AliDielectronVarManager::kv0ArpH2FlowV2] = TMath::Cos( 2*(values[AliDielectronVarManager::kPhi] - values[AliDielectronVarManager::kv0ArpH2]) );
1254 values[AliDielectronVarManager::kv0CrpH2FlowV2] = TMath::Cos( 2*(values[AliDielectronVarManager::kPhi] - values[AliDielectronVarManager::kv0CrpH2]) );
5720c765 1255
1256 // ESD VZERO information
1257 AliVVZERO* vzeroData = event->GetVZEROData();
1258 values[AliDielectronVarManager::kMultV0A] = 0.0;
1259 values[AliDielectronVarManager::kMultV0C] = 0.0;
1260 values[AliDielectronVarManager::kAdcV0A] = 0.0;
1261 values[AliDielectronVarManager::kAdcV0C] = 0.0;
1262 for(Int_t i=0; i<32; ++i) {
a823f01b 1263 values[AliDielectronVarManager::kVZEROchMult+i] = vzeroData->GetMultiplicity(i);
1264 values[AliDielectronVarManager::kVZEROchMult+32+i] = vzeroData->GetMultiplicity(i+32);
1265 //values[AliDielectronVarManager::kVZEROchMult+i] = event->GetVZEROEqMultiplicity(i);
1266 //values[AliDielectronVarManager::kVZEROchMult+32+i] = event->GetVZEROEqMultiplicity(i+32);
5720c765 1267 values[AliDielectronVarManager::kMultV0A] += vzeroData->GetMultiplicityV0A(i);
1268 values[AliDielectronVarManager::kMultV0C] += vzeroData->GetMultiplicityV0C(i);
1269 //values[AliDielectronVarManager::kAdcV0A] += vzeroData->GetAdcV0A(i);
1270 //values[AliDielectronVarManager::kAdcV0C] += vzeroData->GetAdcV0C(i);
1271 }
1272 values[AliDielectronVarManager::kMultV0] = values[AliDielectronVarManager::kMultV0A] + values[AliDielectronVarManager::kMultV0C];
1273 values[AliDielectronVarManager::kAdcV0] = values[AliDielectronVarManager::kAdcV0A] + values[AliDielectronVarManager::kAdcV0C];
1274 // VZERO event plane quantities
1275 Double_t qvec[3]={0.0};
1276 GetVzeroRP(event, qvec,0); // V0-A
1277 values[AliDielectronVarManager::kV0AxH2] = qvec[0]; values[AliDielectronVarManager::kV0AyH2] = qvec[1];
1278 values[AliDielectronVarManager::kV0ArpH2] = qvec[2];
1279 qvec[0]=0.0; qvec[1]=0.0; qvec[2]=0.0;
1280 GetVzeroRP(event, qvec,1); // V0-C
1281 values[AliDielectronVarManager::kV0CxH2] = qvec[0]; values[AliDielectronVarManager::kV0CyH2] = qvec[1];
1282 values[AliDielectronVarManager::kV0CrpH2] = qvec[2];
1283 qvec[0]=0.0; qvec[1]=0.0; qvec[2]=0.0;
1284 GetVzeroRP(event, qvec,2); // V0-A and V0-C combined
1285 values[AliDielectronVarManager::kV0ACxH2] = qvec[0]; values[AliDielectronVarManager::kV0ACyH2] = qvec[1];
1286 values[AliDielectronVarManager::kV0ACrpH2] = qvec[2];
1287 // VZERO event plane resolution
1288 values[AliDielectronVarManager::kV0ArpResH2] = 1.0;
1289 values[AliDielectronVarManager::kV0CrpResH2] = 1.0;
1290 values[AliDielectronVarManager::kV0ACrpResH2] = 1.0;
1291 // Q vector components correlations
1292 values[AliDielectronVarManager::kV0XaXcH2] = values[AliDielectronVarManager::kV0AxH2]*values[AliDielectronVarManager::kV0CxH2];
1293 values[AliDielectronVarManager::kV0XaYaH2] = values[AliDielectronVarManager::kV0AxH2]*values[AliDielectronVarManager::kV0AyH2];
1294 values[AliDielectronVarManager::kV0XaYcH2] = values[AliDielectronVarManager::kV0AxH2]*values[AliDielectronVarManager::kV0CyH2];
1295 values[AliDielectronVarManager::kV0YaXcH2] = values[AliDielectronVarManager::kV0AyH2]*values[AliDielectronVarManager::kV0CxH2];
1296 values[AliDielectronVarManager::kV0YaYcH2] = values[AliDielectronVarManager::kV0AyH2]*values[AliDielectronVarManager::kV0CyH2];
1297 values[AliDielectronVarManager::kV0XcYcH2] = values[AliDielectronVarManager::kV0CxH2]*values[AliDielectronVarManager::kV0CyH2];
1298
1299 // TPC event plane quantities (uncorrected)
1300 AliEventplane *evplane = const_cast<AliVEvent*>(event)->GetEventplane();
1301 TVector2 *qstd = evplane->GetQVector(); // This is the "standard" Q-Vector
1302 TVector2 *qsub1 = evplane->GetQsub1();
1303 TVector2 *qsub2 = evplane->GetQsub2();
1304 if(!qstd || !qsub1 || !qsub2) return;
1305
1306 values[AliDielectronVarManager::kTPCxH2uc] = qstd->X();
1307 values[AliDielectronVarManager::kTPCyH2uc] = qstd->Y();
1308 values[AliDielectronVarManager::kTPCrpH2uc] = ((TMath::Abs(qstd->X())>1.0e-10) ? TMath::ATan2(qstd->Y(),qstd->X())/2.0 : 0.0);
1309
1310 values[AliDielectronVarManager::kTPCsub1xH2uc] = qsub1->X();
1311 values[AliDielectronVarManager::kTPCsub1yH2uc] = qsub1->Y();
1312 values[AliDielectronVarManager::kTPCsub1rpH2uc] = ((TMath::Abs(qsub1->X())>1.0e-10) ? TMath::ATan2(qsub1->Y(),qsub1->X())/2.0 : 0.0);
1313
1314 values[AliDielectronVarManager::kTPCsub2xH2uc] = qsub2->X();
1315 values[AliDielectronVarManager::kTPCsub2yH2uc] = qsub2->Y();
1316 values[AliDielectronVarManager::kTPCsub2rpH2uc] = ((TMath::Abs(qsub2->X())>1.0e-10) ? TMath::ATan2(qsub2->Y(),qsub2->X())/2.0 : 0.0);
1317
1318 values[AliDielectronVarManager::kTPCsub12DiffH2uc] = TMath::Cos( 2.*(values[AliDielectronVarManager::kTPCsub1rpH2uc] -
1319 values[AliDielectronVarManager::kTPCsub2rpH2uc]) );
1320
1321 // using corrected tpc quantities
1322 values[AliDielectronVarManager::kV0ATPCDiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kV0ArpH2] -
1323 values[AliDielectronVarManager::kTPCrpH2]) );
1324
1325 values[AliDielectronVarManager::kV0CTPCDiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kV0CrpH2] -
1326 values[AliDielectronVarManager::kTPCrpH2]) );
1327
1328 values[AliDielectronVarManager::kV0AV0CDiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kV0ArpH2] -
1329 values[AliDielectronVarManager::kV0CrpH2]) );
1330
1331 values[AliDielectronVarManager::kv0ATPCDiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kv0ArpH2] -
1332 values[AliDielectronVarManager::kTPCrpH2]) );
1333
1334 values[AliDielectronVarManager::kv0CTPCDiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kv0CrpH2] -
1335 values[AliDielectronVarManager::kTPCrpH2]) );
1336
1337 values[AliDielectronVarManager::kv0Av0CDiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kv0ArpH2] -
1338 values[AliDielectronVarManager::kv0CrpH2]) );
d327d9cd 1339
1340 values[AliDielectronVarManager::kMixingBin]=0;
6551594b 1341}
1342
1343inline void AliDielectronVarManager::FillVarESDEvent(const AliESDEvent *event, Double_t * const values)
1344{
1345 //
1346 // Fill event information available for histogramming into an array
1347 //
1348
1349 // Fill common AliVEvent interface information
1350 FillVarVEvent(event, values);
ffbede40 1351
a823f01b 1352 Double_t centralityF=-1; Double_t centralitySPD=-1;
4649c75b 1353 AliCentrality *esdCentrality = const_cast<AliESDEvent*>(event)->GetCentrality();
ffbede40 1354 if (esdCentrality) centralityF = esdCentrality->GetCentralityPercentile("V0M");
a823f01b 1355 if (esdCentrality) centralitySPD = esdCentrality->GetCentralityPercentile("CL1");
ffbede40 1356
6551594b 1357 // Fill AliESDEvent interface specific information
1358 const AliESDVertex *primVtx = event->GetPrimaryVertex();
1359 values[AliDielectronVarManager::kXRes] = primVtx->GetXRes();
1360 values[AliDielectronVarManager::kYRes] = primVtx->GetYRes();
1361 values[AliDielectronVarManager::kZRes] = primVtx->GetZRes();
ffbede40 1362 values[AliDielectronVarManager::kCentrality] = centralityF;
a823f01b 1363 values[AliDielectronVarManager::kCentralitySPD] = centralitySPD;
5720c765 1364
1365 // Event multiplicity estimators
1366 Int_t nTrSPD05=0; Int_t nTrITSTPC05=0; Int_t nTrITSSA05=0;
1367 event->EstimateMultiplicity(nTrSPD05, nTrITSTPC05, nTrITSSA05, 0.5);
1368 values[AliDielectronVarManager::kNaccTrckltsEsd05] = nTrSPD05;
1369 values[AliDielectronVarManager::kNaccItsTpcEsd05] = nTrITSTPC05;
1370 values[AliDielectronVarManager::kNaccItsPureEsd05] = nTrITSSA05;
1371 values[AliDielectronVarManager::kNaccTrckltsEsd05Corr] =
1372 AliDielectronHelper::GetNaccTrckltsCorrected(event,Double_t(nTrSPD05),values[AliDielectronVarManager::kZvPrim],0);
1373 values[AliDielectronVarManager::kNaccItsTpcEsd05Corr] =
1374 AliDielectronHelper::GetNaccTrckltsCorrected(event,Double_t(nTrITSTPC05),values[AliDielectronVarManager::kZvPrim],3);
1375 values[AliDielectronVarManager::kNaccItsPureEsd05Corr] =
1376 AliDielectronHelper::GetNaccTrckltsCorrected(event,Double_t(nTrITSSA05),values[AliDielectronVarManager::kZvPrim],6);
1377
1378 Int_t nTrSPD10=0; Int_t nTrITSTPC10=0; Int_t nTrITSSA10=0;
1379 event->EstimateMultiplicity(nTrSPD10, nTrITSTPC10, nTrITSSA10, 1.0);
1380 values[AliDielectronVarManager::kNaccTrckltsEsd10] = nTrSPD10;
1381 values[AliDielectronVarManager::kNaccItsTpcEsd10] = nTrITSTPC10;
1382 values[AliDielectronVarManager::kNaccItsPureEsd10] = nTrITSSA10;
1383 values[AliDielectronVarManager::kNaccTrckltsEsd10Corr] =
1384 AliDielectronHelper::GetNaccTrckltsCorrected(event,Double_t(nTrSPD10),values[AliDielectronVarManager::kZvPrim],1);
1385 values[AliDielectronVarManager::kNaccItsTpcEsd10Corr] =
1386 AliDielectronHelper::GetNaccTrckltsCorrected(event,Double_t(nTrITSTPC10),values[AliDielectronVarManager::kZvPrim],4);
1387 values[AliDielectronVarManager::kNaccItsPureEsd10Corr] =
1388 AliDielectronHelper::GetNaccTrckltsCorrected(event,Double_t(nTrITSSA10),values[AliDielectronVarManager::kZvPrim],7);
1389
1390 Int_t nTrSPD16=0; Int_t nTrITSTPC16=0; Int_t nTrITSSA16=0;
1391 event->EstimateMultiplicity(nTrSPD16, nTrITSTPC16, nTrITSSA16, 1.6);
1392 values[AliDielectronVarManager::kNaccTrckltsEsd16] = nTrSPD16;
1393 values[AliDielectronVarManager::kNaccItsTpcEsd16] = nTrITSTPC16;
1394 values[AliDielectronVarManager::kNaccItsPureEsd16] = nTrITSSA16;
1395 values[AliDielectronVarManager::kNaccTrckltsEsd16Corr] =
1396 AliDielectronHelper::GetNaccTrckltsCorrected(event,Double_t(nTrSPD16),values[AliDielectronVarManager::kZvPrim],2);
1397 values[AliDielectronVarManager::kNaccItsTpcEsd16Corr] =
1398 AliDielectronHelper::GetNaccTrckltsCorrected(event,Double_t(nTrITSTPC16),values[AliDielectronVarManager::kZvPrim],5);
1399 values[AliDielectronVarManager::kNaccItsPureEsd16Corr] =
1400 AliDielectronHelper::GetNaccTrckltsCorrected(event,Double_t(nTrITSSA16),values[AliDielectronVarManager::kZvPrim],8);
1401
6551594b 1402}
1403
1404inline void AliDielectronVarManager::FillVarAODEvent(const AliAODEvent *event, Double_t * const values)
1405{
1406 //
1407 // Fill event information available for histogramming into an array
1408 //
1409
1410 // Fill common AliVEvent interface information
1411 FillVarVEvent(event, values);
1412
1413 // Fill AliAODEvent interface specific information
d327d9cd 1414 AliAODHeader *header = event->GetHeader();
1415
a823f01b 1416 Double_t centralityF=-1; Double_t centralitySPD=-1;
d327d9cd 1417 AliCentrality *aodCentrality = header->GetCentralityP();
1418 if (aodCentrality) centralityF = aodCentrality->GetCentralityPercentile("V0M");
a823f01b 1419 if (aodCentrality) centralitySPD = aodCentrality->GetCentralityPercentile("CL1");
d327d9cd 1420 values[AliDielectronVarManager::kCentrality] = centralityF;
a823f01b 1421 values[AliDielectronVarManager::kCentralitySPD] = centralitySPD;
d327d9cd 1422
1423 //const AliAODVertex *primVtx = event->GetPrimaryVertex();
6551594b 1424}
1425
1426inline void AliDielectronVarManager::FillVarMCEvent(const AliMCEvent *event, Double_t * const values)
1427{
1428 //
1429 // Fill event information available for histogramming into an array
1430 //
1431
1432 // Fill common AliVEvent interface information
5720c765 1433 // FillVarVEvent(event, values);
1434 const AliVVertex* vtx = event->GetPrimaryVertex();
1435 values[AliDielectronVarManager::kXvPrim] = (vtx ? vtx->GetX() : 0.0);
1436 values[AliDielectronVarManager::kYvPrim] = (vtx ? vtx->GetY() : 0.0);
1437 values[AliDielectronVarManager::kZvPrim] = (vtx ? vtx->GetZ() : 0.0);
6551594b 1438 // Fill AliMCEvent interface specific information
5720c765 1439 values[AliDielectronVarManager::kNch] = AliDielectronHelper::GetNch(event, 1.6);
1440 values[AliDielectronVarManager::kNch05] = AliDielectronHelper::GetNch(event, 0.5);
1441 values[AliDielectronVarManager::kNch10] = AliDielectronHelper::GetNch(event, 1.0);
1442
1443 values[AliDielectronVarManager::kNumberOfJPsis] = AliDielectronHelper::GetNMothers(event, 0.9, 443, 11);
1444 values[AliDielectronVarManager::kNumberOfJPsisPrompt] = AliDielectronHelper::GetNMothers(event, 0.9, 443, 11, 1);
1445 values[AliDielectronVarManager::kNumberOfJPsisNPrompt] = AliDielectronHelper::GetNMothers(event, 0.9, 443, 11, 0);
1446}
1447
1448inline void AliDielectronVarManager::FillVarTPCEventPlane(const AliEventplane *evplane, Double_t * const values)
1449{
1450 //
1451 // Fill TPC event plane information after correction
1452 //
1453 if(!evplane) return;
1454 TVector2 *qcorr = const_cast<AliEventplane *>(evplane)->GetQVector(); // This is the "corrected" Q-Vector
1455 TVector2 *qcsub1 = const_cast<AliEventplane *>(evplane)->GetQsub1();
1456 TVector2 *qcsub2 = const_cast<AliEventplane *>(evplane)->GetQsub2();
1457 if(!qcorr || !qcsub1 || !qcsub2) return;
1458
1459 values[AliDielectronVarManager::kTPCxH2] = qcorr->X();
1460 values[AliDielectronVarManager::kTPCyH2] = qcorr->Y();
1461 values[AliDielectronVarManager::kTPCrpH2] = ((TMath::Abs(qcorr->X())>1.0e-10) ? TMath::ATan2(qcorr->Y(),qcorr->X())/2.0 : 0.0);
1462
1463 values[AliDielectronVarManager::kTPCsub1xH2] = qcsub1->X();
1464 values[AliDielectronVarManager::kTPCsub1yH2] = qcsub1->Y();
1465 values[AliDielectronVarManager::kTPCsub1rpH2] = ((TMath::Abs(qcsub1->X())>1.0e-10) ? TMath::ATan2(qcsub1->Y(),qcsub1->X())/2.0 : 0.0);
1466
1467 values[AliDielectronVarManager::kTPCsub2xH2] = qcsub2->X();
1468 values[AliDielectronVarManager::kTPCsub2yH2] = qcsub2->Y();
1469 values[AliDielectronVarManager::kTPCsub2rpH2] = ((TMath::Abs(qcsub2->X())>1.0e-10) ? TMath::ATan2(qcsub2->Y(),qcsub2->X())/2.0 : 0.0);
1470
1471 values[AliDielectronVarManager::kTPCsub12DiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kTPCsub1rpH2] -
1472 values[AliDielectronVarManager::kTPCsub2rpH2]) );
1473 values[AliDielectronVarManager::kTPCsub12DiffH2Sin] = TMath::Sin( 2.*(values[AliDielectronVarManager::kTPCsub1rpH2] -
1474 values[AliDielectronVarManager::kTPCsub2rpH2]) );
1475}
6551594b 1476
a823f01b 1477
6551594b 1478inline void AliDielectronVarManager::InitESDpid(Int_t type)
1479{
1480 //
1481 // initialize PID parameters
1482 // type=0 is simulation
1483 // type=1 is data
1484
ba15fdfb 1485 if (!fgPIDResponse) fgPIDResponse=new AliESDpid((Bool_t)(type==0));
6551594b 1486 Double_t alephParameters[5];
1487 // simulation
1488 alephParameters[0] = 2.15898e+00/50.;
1489 alephParameters[1] = 1.75295e+01;
1490 alephParameters[2] = 3.40030e-09;
1491 alephParameters[3] = 1.96178e+00;
1492 alephParameters[4] = 3.91720e+00;
ba15fdfb 1493 fgPIDResponse->GetTOFResponse().SetTimeResolution(80.);
6551594b 1494
1495 // data
83e37742 1496 if (type==1){
1497 alephParameters[0] = 0.0283086/0.97;
6551594b 1498 alephParameters[1] = 2.63394e+01;
1499 alephParameters[2] = 5.04114e-11;
1500 alephParameters[3] = 2.12543e+00;
1501 alephParameters[4] = 4.88663e+00;
ba15fdfb 1502 fgPIDResponse->GetTOFResponse().SetTimeResolution(130.);
1503 fgPIDResponse->GetTPCResponse().SetMip(50.);
6551594b 1504 }
1505
ba15fdfb 1506 fgPIDResponse->GetTPCResponse().SetBetheBlochParameters(
6551594b 1507 alephParameters[0],alephParameters[1],alephParameters[2],
1508 alephParameters[3],alephParameters[4]);
1509
ba15fdfb 1510 fgPIDResponse->GetTPCResponse().SetSigma(3.79301e-03, 2.21280e+04);
6551594b 1511}
1512
2a14a7b1 1513inline void AliDielectronVarManager::InitAODpidUtil(Int_t type)
1514{
ba15fdfb 1515 if (!fgPIDResponse) fgPIDResponse=new AliAODpidUtil;
2a14a7b1 1516 Double_t alephParameters[5];
1517 // simulation
1518 alephParameters[0] = 2.15898e+00/50.;
1519 alephParameters[1] = 1.75295e+01;
1520 alephParameters[2] = 3.40030e-09;
1521 alephParameters[3] = 1.96178e+00;
1522 alephParameters[4] = 3.91720e+00;
ba15fdfb 1523 fgPIDResponse->GetTOFResponse().SetTimeResolution(80.);
2a14a7b1 1524
1525 // data
1526 if (type==1){
1527 alephParameters[0] = 0.0283086/0.97;
1528 alephParameters[1] = 2.63394e+01;
1529 alephParameters[2] = 5.04114e-11;
1530 alephParameters[3] = 2.12543e+00;
1531 alephParameters[4] = 4.88663e+00;
ba15fdfb 1532 fgPIDResponse->GetTOFResponse().SetTimeResolution(130.);
1533 fgPIDResponse->GetTPCResponse().SetMip(50.);
2a14a7b1 1534 }
1535
ba15fdfb 1536 fgPIDResponse->GetTPCResponse().SetBetheBlochParameters(
2a14a7b1 1537 alephParameters[0],alephParameters[1],alephParameters[2],
1538 alephParameters[3],alephParameters[4]);
1539
ba15fdfb 1540 fgPIDResponse->GetTPCResponse().SetSigma(3.79301e-03, 2.21280e+04);
2a14a7b1 1541}
1542
572b0139 1543
5720c765 1544inline void AliDielectronVarManager::InitEstimatorAvg(const Char_t* filename)
1545{
1546 //
1547 // initialize the profile histograms neccessary for the correction of the multiplicity estimators in pp collisions
1548 //
1549
1550 const Char_t* estimatorNames[9] = {"SPDmult05","SPDmult10","SPDmult16",
1551 "ITSTPC05", "ITSTPC10", "ITSTPC16",
1552 "ITSSA05", "ITSSA10", "ITSSA16"};
1553 const Char_t* periodNames[4] = {"LHC10b", "LHC10c", "LHC10d", "LHC10e"};
1554 TFile* file=TFile::Open(filename);
1555 if(!file) return;
1556
1557 for(Int_t ip=0; ip<4; ++ip) {
1558 for(Int_t ie=0; ie<9; ++ie) {
1559 fgMultEstimatorAvg[ip][ie] = (TProfile*)(file->Get(Form("%s_%s",estimatorNames[ie],periodNames[ip]))->Clone(Form("%s_%s_clone",estimatorNames[ie],periodNames[ip])));
1560 }
1561 }
1562}
1563
1564
1565inline void AliDielectronVarManager::InitTRDpidEffHistograms(const Char_t* filename)
1566{
1567 //
1568 // initialize the 3D histograms with the TRD pid efficiency histograms
1569 //
1570
1571 // reset the centrality ranges and the efficiency histograms
1572 for(Int_t i=0; i<10; ++i) { // centrality ranges
1573 for(Int_t j=0; j<4; ++j) fgTRDpidEffCentRanges[i][j] = -1.;
1574 if(fgTRDpidEff[i][0]) {
1575 delete fgTRDpidEff[i][0];
1576 fgTRDpidEff[i][0] = 0x0;
1577 }
1578 if(fgTRDpidEff[i][1]) {
1579 delete fgTRDpidEff[i][1];
1580 fgTRDpidEff[i][1] = 0x0;
1581 }
1582 }
1583
1584 TFile* file=TFile::Open(filename);
1585 TList* keys=file->GetListOfKeys();
1586 Int_t idxp=0; Int_t idxn=0;
1587 for(Int_t i=0; i<keys->GetEntries(); ++i) {
1588 if(idxp>=10) continue;
1589 if(idxn>=10) continue;
1590 TString name=((TKey*)keys->At(i))->ReadObj()->GetName();
1591 // Name of histograms should be in the format:
1592 // TRDeff<field>_cent_<centLow>_<centHigh>
1593 // <field> is either "BPLUS" or "BMINUS"
1594 if(!(name.Contains("BPLUS") || name.Contains("BMINUS"))) continue;
1595 TObjArray* arr = name.Tokenize("_");
1596 Bool_t isBplus = kTRUE;
1597 if(name.Contains("BMINUS")) isBplus = kFALSE;
1598 TString centMinStr = arr->At(2)->GetName(); TString centMaxStr = arr->At(3)->GetName();
1599 if(isBplus) {
1600 fgTRDpidEffCentRanges[idxp][2] = centMinStr.Atof();
1601 fgTRDpidEffCentRanges[idxp][3] = centMaxStr.Atof();
1602 fgTRDpidEff[idxp][1] = (TH3D*)(file->Get(name.Data())->Clone(Form("%s_clone",name.Data())));
1603 ++idxp;
1604 }
1605 else {
1606 fgTRDpidEffCentRanges[idxn][0] = centMinStr.Atof();
1607 fgTRDpidEffCentRanges[idxn][1] = centMaxStr.Atof();
1608 fgTRDpidEff[idxn][0] = (TH3D*)(file->Get(name.Data())->Clone(Form("%s_clone",name.Data())));
1609 ++idxn;
1610 }
1611 }
1612}
1613
1614
a823f01b 1615inline void AliDielectronVarManager::InitVZEROCalibrationHistograms(Int_t runNo) {
1616 //
1617 // Initialize the VZERO channel-by-channel calibration histograms
1618 //
1619
1620 //initialize only once
1621 if(fgVZEROCalib[0]) return;
1622
1623 for(Int_t i=0; i<64; ++i)
1624 if(fgVZEROCalib[i]) {
1625 delete fgVZEROCalib[i];
1626 fgVZEROCalib[i] = 0x0;
1627 }
1628
1629 TFile file(fgVZEROCalibrationFile.Data());
1630
1631 for(Int_t i=0; i<64; ++i){
1632 fgVZEROCalib[i] = (TProfile2D*)(file.Get(Form("RUN%d_ch%d_VtxCent", runNo, i)));
1633 if (fgVZEROCalib[i]) fgVZEROCalib[i]->SetDirectory(0x0);
1634 }
1635}
1636
1637
1638inline void AliDielectronVarManager::InitVZERORecenteringHistograms(Int_t runNo) {
1639 //
1640 // Initialize the VZERO event plane recentering histograms
1641 //
1642
1643 //initialize only once
1644 if(fgVZERORecentering[0][0]) return;
1645
1646 for(Int_t i=0; i<2; ++i)
1647 for(Int_t j=0; j<2; ++j)
1648 if(fgVZERORecentering[i][j]) {
1649 delete fgVZERORecentering[i][j];
1650 fgVZERORecentering[i][j] = 0x0;
1651 }
1652
1653 TFile file(fgVZERORecenteringFile.Data());
1654 if (!file.IsOpen()) return;
1655
1656 fgVZERORecentering[0][0] = (TProfile2D*)(file.Get(Form("RUN%d_QxA_CentVtx", runNo)));
1657 fgVZERORecentering[0][1] = (TProfile2D*)(file.Get(Form("RUN%d_QyA_CentVtx", runNo)));
1658 fgVZERORecentering[1][0] = (TProfile2D*)(file.Get(Form("RUN%d_QxC_CentVtx", runNo)));
1659 fgVZERORecentering[1][1] = (TProfile2D*)(file.Get(Form("RUN%d_QyC_CentVtx", runNo)));
1660
1661 if (fgVZERORecentering[0][0]) fgVZERORecentering[0][0]->SetDirectory(0x0);
1662 if (fgVZERORecentering[0][1]) fgVZERORecentering[0][1]->SetDirectory(0x0);
1663 if (fgVZERORecentering[1][0]) fgVZERORecentering[1][0]->SetDirectory(0x0);
1664 if (fgVZERORecentering[1][1]) fgVZERORecentering[1][1]->SetDirectory(0x0);
1665
1666}
1667
1668
5720c765 1669inline Double_t AliDielectronVarManager::GetTRDpidEfficiency(Int_t runNo, Double_t centrality,
1670 Double_t eta, Double_t trdPhi, Double_t pout,
1671 Double_t& effErr) {
1672 //
1673 // return the efficiency in the given phase space cell
1674 //
1675 // LHC10h data----------------------------------------------
1676 Bool_t isBplus = kTRUE;
1677 if(runNo<=138275) isBplus = kFALSE;
1678 // TODO: check magnetic polarity for runs in 2011 data
1679 // ---------------------------------------------------------
1680 Int_t centIdx = -1;
1681 for(Int_t icent=0; icent<10; ++icent) {
1682 if(isBplus) {
1683 if(centrality>=fgTRDpidEffCentRanges[icent][2] && centrality<fgTRDpidEffCentRanges[icent][3]) {
1684 centIdx = icent;
1685 break;
1686 }
1687 }
1688 else {
1689 if(centrality>=fgTRDpidEffCentRanges[icent][0] && centrality<fgTRDpidEffCentRanges[icent][1]) {
1690 centIdx = icent;
1691 break;
1692 }
1693 }
1694 }
ac390e40 1695 //TODO: chek logick
1696 if (centIdx<0) return 1;
1697
5720c765 1698 TH3D* effH = fgTRDpidEff[centIdx][(isBplus ? 1 : 0)];
1699 if(!effH) {effErr=0x0; return 1.0;}
1700 Int_t etaBin = effH->GetXaxis()->FindBin(eta);
1701 if(eta<effH->GetXaxis()->GetXmin()) etaBin=1;
1702 if(eta>effH->GetXaxis()->GetXmax()) etaBin=effH->GetXaxis()->GetNbins();
1703 Int_t phiBin = effH->GetYaxis()->FindBin(trdPhi);
1704 if(trdPhi<effH->GetYaxis()->GetXmin()) phiBin=1;
1705 if(trdPhi>effH->GetYaxis()->GetXmax()) phiBin=effH->GetYaxis()->GetNbins();
1706 Int_t poutBin = effH->GetZaxis()->FindBin(pout);
1707 if(pout<effH->GetZaxis()->GetXmin()) poutBin=1;
1708 if(pout>effH->GetZaxis()->GetXmax()) poutBin=effH->GetZaxis()->GetNbins();
1709 Double_t eff = effH->GetBinContent(etaBin, phiBin, poutBin);
1710 effErr = effH->GetBinError(etaBin, phiBin, poutBin);
1711 if(eff<-0.0001) {
1712 effErr = 0.0;
1713 eff = 1.0;
1714 }
1715 return eff;
1716}
1717
1718
572b0139 1719inline void AliDielectronVarManager::SetEvent(AliVEvent * const ev)
1720{
1721
1722 fgEvent = ev;
1723 if (fgKFVertex) delete fgKFVertex;
1724 fgKFVertex=0x0;
2e02dba4 1725 if (!ev) return;
1726 if (ev->GetPrimaryVertex()) fgKFVertex=new AliKFVertex(*ev->GetPrimaryVertex());
ba15fdfb 1727
1728 for (Int_t i=0; i<AliDielectronVarManager::kNMaxValues;++i) fgData[i]=0.;
1729 AliDielectronVarManager::Fill(fgEvent, fgData);
572b0139 1730}
2a14a7b1 1731
5720c765 1732inline void AliDielectronVarManager::SetEventData(const Double_t data[AliDielectronVarManager::kNMaxValues])
1733{
1734 for (Int_t i=0; i<kNMaxValues;++i) fgData[i]=0.;
1735 for (Int_t i=kPairMax; i<kNMaxValues;++i) fgData[i]=data[i];
1736}
1737
2a14a7b1 1738
1739inline Bool_t AliDielectronVarManager::GetDCA(const AliAODTrack *track, Double_t d0z0[2])
1740{
1741 if(track->TestBit(AliAODTrack::kIsDCA)){
1742 d0z0[0]=track->DCA();
1743 d0z0[1]=track->ZAtDCA();
1744 return kTRUE;
1745 }
1746
1747 Double_t covd0z0[3];
1748 AliAODTrack copy(*track);
1749 AliAODVertex *vtx =(AliAODVertex*)(fgEvent->GetPrimaryVertex());
1750 Double_t fBzkG = fgEvent->GetMagneticField(); // z componenent of field in kG
1751 Bool_t ok = copy.PropagateToDCA(vtx,fBzkG,kVeryBig,d0z0,covd0z0);
1752 if(!ok){
1753 d0z0[0]=-999.;
1754 d0z0[1]=-999.;
1755 }
1756 return ok;
1757}
1758
5720c765 1759inline void AliDielectronVarManager::SetTPCEventPlane(AliEventplane *const evplane)
1760{
1761
1762 fgTPCEventPlane = evplane;
1763 // for (Int_t i=0; i<AliDielectronVarManager::kNMaxValues;++i) fgData[i]=0.;
1764 // AliDielectronVarManager::Fill(fgEvent, fgData);
1765}
1766
1767
1768//_________________________________________________________________
1769inline void AliDielectronVarManager::GetVzeroRP(const AliVEvent* event, Double_t* qvec, Int_t sideOption) {
1770 //
1771 // Get the reaction plane from the VZERO detector for a given harmonic
1772 //
1773 // sideOption = 0- V0A, 1- V0C, 2-both
1774 // Q{x,y} = SUM_i mult(i) * {cos(n*phi_i), sin(n*phi_i)}
1775 // phi_i - phi angle of the VZERO sector i
1776 // Each sector covers 45 degrees(8 sectors per ring). Middle of sector 0 is at 45/2
1777 // channel 0: 22.5
1778 // 1: 22.5+45
1779 // 2: 22.5+45*2
1780 // ...
1781 // at the next ring continues the same
1782 // channel 8: 22.5
1783 // channel 9: 22.5 + 45
1784 // ...
1785 const Double_t kX[8] = {0.92388, 0.38268, -0.38268, -0.92388, -0.92388, -0.38268, 0.38268, 0.92388}; // cosines of the angles of the VZERO sectors (8 per ring)
1786 const Double_t kY[8] = {0.38268, 0.92388, 0.92388, 0.38268, -0.38268, -0.92388, -0.92388, -0.38268}; // sines -- " --
1787 Int_t phi;
1788 Float_t mult;
5720c765 1789
a823f01b 1790 // get centrality and vertex for this event
1791 Double_t centralitySPD = -1; Double_t vtxZ = -999.;
1792 if(event->IsA() == AliESDEvent::Class()) {
1793 const AliESDEvent* esdEv = static_cast<const AliESDEvent*>(event);
1794 AliCentrality *esdCentrality = const_cast<AliESDEvent*>(esdEv)->GetCentrality();
1795 if(esdCentrality) centralitySPD = esdCentrality->GetCentralityPercentile("CL1");
1796 }
1797 if(event->IsA() == AliAODEvent::Class()) {
1798 const AliAODEvent* aodEv = static_cast<const AliAODEvent*>(event);
1799 AliAODHeader *header = aodEv->GetHeader();
1800 AliCentrality *aodCentrality = header->GetCentralityP();
1801 if(aodCentrality) centralitySPD = aodCentrality->GetCentralityPercentile("CL1");
1802 }
1803 const AliVVertex *primVtx = event->GetPrimaryVertex();
1804 if(!primVtx) return;
1805 vtxZ = primVtx->GetZ();
1806 if(TMath::Abs(vtxZ)>10.) return;
1807 if(centralitySPD<0. || centralitySPD>80.) return;
1808
1809 Int_t binCent = -1; Int_t binVtx = -1;
1810 if(fgVZEROCalib[0]) {
1811 binVtx = fgVZEROCalib[0]->GetXaxis()->FindBin(vtxZ);
1812 binCent = fgVZEROCalib[0]->GetYaxis()->FindBin(centralitySPD);
1813 }
1814
1815 AliVVZERO* vzero = event->GetVZEROData();
1816 Double_t average = 0.0;
5720c765 1817 for(Int_t iChannel=0; iChannel<64; ++iChannel) {
1818 if(iChannel<32 && sideOption==0) continue;
1819 if(iChannel>=32 && sideOption==1) continue;
1820 phi=iChannel%8;
a823f01b 1821 mult = vzero->GetMultiplicity(iChannel);
1822 if(fgVZEROCalib[iChannel])
1823 average = fgVZEROCalib[iChannel]->GetBinContent(binVtx, binCent);
1824 if(average>1.0e-10 && mult>0.5)
1825 mult /= average;
1826 else
1827 mult = 0.0;
5720c765 1828 // 2nd harmonic
1829 qvec[0] += mult*(2.0*TMath::Power(kX[phi],2.0)-1);
1830 qvec[1] += mult*(2.0*kX[phi]*kY[phi]);
1831 } // end loop over channels
a823f01b 1832
1833 // do recentering
1834 if(fgVZERORecentering[0][0]) {
1835// printf("vzero: %p\n",fgVZERORecentering[0][0]);
1836 Int_t binCentRecenter = -1; Int_t binVtxRecenter = -1;
1837 binCentRecenter = fgVZERORecentering[0][0]->GetXaxis()->FindBin(centralitySPD);
1838 binVtxRecenter = fgVZERORecentering[0][0]->GetYaxis()->FindBin(vtxZ);
1839 if(sideOption==0) { // side A
1840 qvec[0] -= fgVZERORecentering[0][0]->GetBinContent(binCentRecenter, binVtxRecenter);
1841 qvec[1] -= fgVZERORecentering[0][1]->GetBinContent(binCentRecenter, binVtxRecenter);
1842 }
1843 if(sideOption==1) { // side C
1844 qvec[0] -= fgVZERORecentering[1][0]->GetBinContent(binCentRecenter, binVtxRecenter);
1845 qvec[1] -= fgVZERORecentering[1][1]->GetBinContent(binCentRecenter, binVtxRecenter);
1846 }
1847 if(sideOption==2) { // side A and C together
1848 qvec[0] -= fgVZERORecentering[0][0]->GetBinContent(binCentRecenter, binVtxRecenter);
1849 qvec[0] -= fgVZERORecentering[1][0]->GetBinContent(binCentRecenter, binVtxRecenter);
1850 qvec[1] -= fgVZERORecentering[0][1]->GetBinContent(binCentRecenter, binVtxRecenter);
1851 qvec[1] -= fgVZERORecentering[1][1]->GetBinContent(binCentRecenter, binVtxRecenter);
1852 }
1853 }
1854
1855 // calculate the reaction plane
5720c765 1856 if(TMath::Abs(qvec[0])>1.0e-10)
1857 qvec[2] = TMath::ATan2(qvec[1],qvec[0])/2.0;
1858}
1859
1860
1861
b2a297fa 1862/*
1863inline void AliDielectronVarManager::FillValues(const TParticle *particle, Double_t *values)
1864{
1865 //
1866 // Fill track information available for histogramming into an array
1867 //
1868
1869 // Fill TParticle interface information
1870 values[AliDielectronVarManager::kPx] = particle->Px();
1871 values[AliDielectronVarManager::kPy] = particle->Py();
1872 values[AliDielectronVarManager::kPz] = particle->Pz();
1873 values[AliDielectronVarManager::kPt] = particle->Pt();
1874 values[AliDielectronVarManager::kP] = particle->P();
1875
1876 values[AliDielectronVarManager::kXv] = particle->Vx();
1877 values[AliDielectronVarManager::kYv] = particle->Vy();
1878 values[AliDielectronVarManager::kZv] = particle->Vz();
1879
1880 values[AliDielectronVarManager::kOneOverPt] = 1./particle->Pt();
1881 values[AliDielectronVarManager::kPhi] = particle->Phi();
1882 values[AliDielectronVarManager::kTheta] =
1883 values[AliDielectronVarManager::kEta] = particle->Eta();
1884 values[AliDielectronVarManager::kY] =
1885
1886 values[AliDielectronVarManager::kE] = particle->Energy();
1887 values[AliDielectronVarManager::kM] = particle->GetMass();
1888
1889 values[AliDielectronVarManager::kCharge] = particle->GetPDG()->Charge()/3; // uggly
1890
1891}*/
1892
1893#endif
fb7d2d99 1894