add proptections (marcel), add GEANT process for MC
[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>
36a1e727 26#include <TProfile3D.h>
5720c765 27#include <TH3D.h>
833da63d 28#include <THnBase.h>
746e66a9 29#include <TSpline.h>
5720c765 30#include <TFile.h>
31#include <TDatabasePDG.h>
32#include <TKey.h>
29091f0d 33#include <TBits.h>
88db3193 34#include <TRandom3.h>
b2a297fa 35
36#include <AliVEvent.h>
37#include <AliESDEvent.h>
6551594b 38#include <AliAODEvent.h>
39#include <AliMCEvent.h>
40#include <AliVVertex.h>
41#include <AliESDVertex.h>
99345a64 42#include <AliAODVertex.h>
5720c765 43#include <AliEventplane.h>
44
45#include <AliESDVZERO.h>
46#include <AliAODVZERO.h>
b2a297fa 47
48#include <AliVParticle.h>
b2a297fa 49#include <AliESDtrack.h>
50#include <AliAODTrack.h>
572b0139 51#include <AliAODPid.h>
b2a297fa 52#include <AliKFParticle.h>
572b0139 53#include <AliKFVertex.h>
b2a297fa 54#include <AliMCParticle.h>
55#include <AliAODMCParticle.h>
56#include <AliVTrack.h> // ?
57
6551594b 58#include <AliExternalTrackParam.h>
59#include <AliESDpid.h>
4649c75b 60#include <AliCentrality.h>
2a14a7b1 61#include <AliAODpidUtil.h>
8df8e382 62#include <AliPID.h>
ba15fdfb 63#include <AliPIDResponse.h>
a94c2e7e 64#include <AliESDtrackCuts.h>
6551594b 65
b2a297fa 66#include "AliDielectronPair.h"
8df8e382 67#include "AliDielectronMC.h"
48609e3d 68#include "AliDielectronPID.h"
ba15fdfb 69#include "AliDielectronHelper.h"
b2a297fa 70
8d42b5b9 71#include "AliAnalysisManager.h"
42e1ec3d 72#include "AliInputEventHandler.h"
8d42b5b9 73#include "AliVZEROEPSelectionTask.h"
74
4876eb8a 75#include "AliAODMCHeader.h"
1a3d9eb7 76
b2a297fa 77class AliVEvent;
78
79//________________________________________________________________
80class AliDielectronVarManager : public TNamed {
81
82public:
8df8e382 83
b2a297fa 84 // Particle specific variables
85 enum ValueTypes {
86 kPx = 0, // px
87 kPy, // py
88 kPz, // pz
89 kPt, // transverse momentum
87a7c4b0 90 kPtSq, // transverse momentum squared
b2a297fa 91 kP, // momentum
92 kXv, // vertex position in x
93 kYv, // vertex position in y
94 kZv, // vertex position in z
95 kOneOverPt, // 1/pt
96 kPhi, // phi angle
97 kTheta, // theta angle
98 kEta, // pseudo-rapidity
99 kY, // rapidity
100 kE, // energy
101 kM, // mass
102 kCharge, // charge
103 kNclsITS, // number of clusters assigned in the ITS
5720c765 104 kITSchi2Cl, // chi2/cl in the ITS
b2a297fa 105 kNclsTPC, // number of clusters assigned in the TPC
5720c765 106 kNclsSTPC, // number of shared clusters assigned in the TPC
107 kNclsSFracTPC, // fraction of shared clusters assigned in the TPC
554e40f8 108 kNclsTPCiter1, // number of clusters assigned in the TPC after first iteration
b2a297fa 109 kNFclsTPC, // number of findable clusters in the TPC
09835c8f 110 kNFclsTPCr, // number of findable clusters(crossed rows) in the TPC with more robust definition
fb7d2d99 111 kNFclsTPCrFrac, // number of found/findable clusters in the TPC with more robust definition
fdda39b6 112 kNFclsTPCfCross, // fraction crossed rows/findable clusters in the TPC, as done in AliESDtrackCuts
b2a297fa 113 kTPCsignalN, // number of points used for dEdx
ba15fdfb 114 kTPCsignalNfrac, // fraction of points used for dEdx / cluster used for tracking
61d106d3 115 kTPCchi2Cl, // chi2/cl in TPC
5720c765 116 kTPCclsDiff, // TPC cluster difference
29091f0d 117 kTPCclsSegments, // TPC cluster segments
d05d1dfc 118 kTPCclsIRO, // TPC clusters inner read out
119 kTPCclsORO, // TPC clusters outer read out
61d106d3 120 kTrackStatus, // track status bits
07480df6 121 kFilterBit, // AOD filter bits
122
b2a297fa 123 kNclsTRD, // number of clusters assigned in the TRD
124 kTRDntracklets, // number of TRD tracklets used for tracking/PID TODO: correct getter
125 kTRDpidQuality, // number of TRD tracklets used for PID
67fd1119 126 kTRDchi2, // chi2 in TRD
8df8e382 127 kTRDprobEle, // TRD electron pid probability
128 kTRDprobPio, // TRD electron pid probability
07480df6 129 kTRDprob2DEle, // TRD electron pid probability 2D LQ
130 kTRDprob2DPio, // TRD electron pid probability 2D LQ
5720c765 131 kTRDphi, // Phi angle of the track at the entrance of the TRD
132 kTRDpidEffLeg, // TRD pid efficiency from conversion electrons
35363fb9 133 kTRDsignal, // TRD signal
8df8e382 134
b2a297fa 135 kImpactParXY, // Impact parameter in XY plane
136 kImpactParZ, // Impact parameter in Z
137 kTrackLength, // Track length
8df8e382 138
b2ad74d0 139
5720c765 140 kPdgCode, // PDG code
fdda39b6 141 kPdgCodeMother,
5720c765 142 kPdgCodeGrandMother, // PDG code of the grandmother
1bb1fef1 143 kHasCocktailMother, // true if particle is added via MC generator cocktail (AliDielectronSignal::kDirect)
144 kHasCocktailGrandMother, // true if particle is added via MC generator cocktail (AliDielectronSignal::kDirect)
8df8e382 145 kNumberOfDaughters, // number of daughters
146 kHaveSameMother, // check that particles have the same mother (MC)
fb7d2d99 147 kIsJpsiPrimary, // check if the particle is primary (MC)
5720c765 148 kNumberOfJPsis, // number of generated inclusive jpsis per event (MC)
149 kNumberOfJPsisPrompt, // number of generated prompt jpsis per event (MC)
150 kNumberOfJPsisNPrompt, // number of generated non-prompt jpsis per event (MC)
151
152 kITSsignal, // ITS dE/dx signal
153 kITSsignalSSD1, // SSD1 dE/dx signal
154 kITSsignalSSD2, // SSD2 dE/dx signal
155 kITSsignalSDD1, // SDD1 dE/dx signal
156 kITSsignalSDD2, // SDD2 dE/dx signal
157 kITSclusterMap, // ITS cluster map
158 kITSLayerFirstCls, // No of innermost ITS layer with a cluster of a track
9143d69f 159 kITSnSigmaEle, // number of sigmas to the dE/dx electron line in the ITS
160 kITSnSigmaPio, // number of sigmas to the dE/dx pion line in the ITS
161 kITSnSigmaMuo, // number of sigmas to the dE/dx muon line in the ITS
162 kITSnSigmaKao, // number of sigmas to the dE/dx kaon line in the ITS
163 kITSnSigmaPro, // number of sigmas to the dE/dx proton line in the ITS
8df8e382 164
b2a297fa 165 kPIn, // momentum at inner wall of TPC (if available), used for PID
5720c765 166 kPOut, // momentum at outer wall of TPC, used for TRD studies
167 kYsignedIn, // signed local y at inner wall of TPC
b2a297fa 168 kTPCsignal, // TPC dE/dx signal
ba15fdfb 169
5720c765 170 kTOFsignal, // TOF signal
171 kTOFbeta, // TOF beta
b2ad74d0 172 kTOFPIDBit, // TOF PID bit (1:set, 0:TOF not available)a
35363fb9 173 kTOFmismProb, // and mismatchPorbability as explain in TOF-twiki
ba15fdfb 174
2d00c7d3 175 kTPCnSigmaEleRaw, // raw number of sigmas to the dE/dx electron line in the TPC
6551594b 176 kTPCnSigmaEle, // number of sigmas to the dE/dx electron line in the TPC
572b0139 177 kTPCnSigmaPio, // number of sigmas to the dE/dx pion line in the TPC
178 kTPCnSigmaMuo, // number of sigmas to the dE/dx muon line in the TPC
179 kTPCnSigmaKao, // number of sigmas to the dE/dx kaon line in the TPC
180 kTPCnSigmaPro, // number of sigmas to the dE/dx proton line in the TPC
181
5720c765 182 kTOFnSigmaEle, // number of sigmas to the electron line in the TOF
572b0139 183 kTOFnSigmaPio, // number of sigmas to the pion line in the TOF
184 kTOFnSigmaMuo, // number of sigmas to the muon line in the TOF
185 kTOFnSigmaKao, // number of sigmas to the kaon line in the TOF
186 kTOFnSigmaPro, // number of sigmas to the proton line in the TOF
8df8e382 187
5720c765 188 kEMCALnSigmaEle, // number of sigmas to the proton line in the TOF
a823f01b 189 kEMCALEoverP, // E over P from EMCAL
88204efa 190 kEMCALE, // E from EMCAL
a823f01b 191 kEMCALNCells, // NCells from EMCAL
192 kEMCALM02, // M02 showershape parameter
193 kEMCALM20, // M20 showershape parameter
194 kEMCALDispersion, // Dispersion paramter
5720c765 195
833da63d 196 kLegEff, // single electron efficiency
d4619886 197 kOneOverLegEff, // 1 / single electron efficiency (correction factor)
88e9bae6 198 kV0Index0, // v0 index 0
ffbede40 199 kKinkIndex0, // kink index 0
200
b2a297fa 201 kParticleMax, //
202 // TODO: kRNClusters ??
5720c765 203 // AliDielectronPair specific variables
b2a297fa 204 kChi2NDF = kParticleMax, // Chi^2/NDF
205 kDecayLength, // decay length
206 kR, // distance to the origin
207 kOpeningAngle, // opening angle
2e02dba4 208 kCosPointingAngle, // cosine of the pointing angle
99345a64 209 kArmAlpha, // Armenteros-Podolanski alpha
210 kArmPt, // Armenteros-Podolanski pt
8df8e382 211 // helicity picture: Z-axis is considered the direction of the mother's 3-momentum vector
212 kThetaHE, // theta in mother's rest frame in the helicity picture
213 kPhiHE, // phi in mother's rest frame in the helicity picture
1762f182 214 kThetaSqHE, // squared value of kThetaHE
5720c765 215 kCos2PhiHE, // Cosine of 2*phi in mother's rest frame in the helicity picture
8d7a07b9 216 kCosTilPhiHE, // Shifted phi depending on kThetaHE
8df8e382 217 // Collins-Soper picture: Z-axis is considered the direction of the vectorial difference between
218 // the 3-mom vectors of target and projectile beams
219 kThetaCS, // theta in mother's rest frame in Collins-Soper picture
220 kPhiCS, // phi in mother's rest frame in Collins-Soper picture
1762f182 221 kThetaSqCS, // squared value of kThetaCS
236e1bda 222 kPsiPair, // phi in mother's rest frame in Collins-Soper picture
b2ad74d0 223 kPhivPair, // angle between ee plane and the magnetic field (can be useful for conversion rejection)
ad89b5bf
JB
224
225 kPairPlaneAngle1A, // angle between ee decay plane and x'-z reaction plane by using V0-A
226 kPairPlaneAngle2A, // angle between ee decay plane and (p1+p2) rot ez
227 kPairPlaneAngle3A, // angle between ee decay plane and (p1+p2) rot (p1+p2)x'z
228 kPairPlaneAngle4A, // angle between ee decay plane and x'-y' plane
229 kPairPlaneAngle1C, // using v0-C
230 kPairPlaneAngle2C,
231 kPairPlaneAngle3C,
232 kPairPlaneAngle4C,
233 kPairPlaneAngle1AC, // using v0-AC
234 kPairPlaneAngle2AC,
235 kPairPlaneAngle3AC,
236 kPairPlaneAngle4AC,
237 kPairPlaneAngle1Ran, // using random reaction plane
238 kPairPlaneAngle2Ran,
239 kPairPlaneAngle3Ran,
240 kPairPlaneAngle4Ran,
241 kRandomRP, //Random reaction plane
242 kDeltaPhiRandomRP, //delta phi of the pair
243
36a1e727 244 kPairPlaneMagInPro, // Inner Product of strong magnetic field and ee plane
151ddcbc 245 kCos2PhiCS, // Cosine of 2*phi in mother's rest frame in the Collins-Soper picture
8d7a07b9 246 kCosTilPhiCS, // Shifted phi depending on kThetaCS
c081415a 247 kCosPhiH2, // cosine of pair phi for 2nd harmonic
248 kSinPhiH2, // sinus of pair phi for 2nd harmonic
5720c765 249 kDeltaPhiV0ArpH2, // Delta phi of the pair with respect to the 2nd order harmonic reaction plane from V0-A
250 kDeltaPhiV0CrpH2, // Delta phi of the pair with respect to the 2nd order harmonic reaction plane from V0-C
251 kDeltaPhiV0ACrpH2, // Delta phi of the pair with respect to the 2nd order harmonic reaction plane from V0-A + V0-C
252 kV0ArpH2FlowV2, // v2 coefficient with respect to the 2nd order reaction plane from V0-A
253 kV0CrpH2FlowV2, // v2 coefficient with respect to the 2nd order reaction plane from V0-C
254 kV0ACrpH2FlowV2, // v2 coefficient with respect to the 2nd order reaction plane from V0-A + V0-C
07bc5543 255 kDeltaPhiv0ArpH2, // Delta phi of the pair with respect to the 2nd order harmonic reaction plane from V0-A (EPtask)
256 kDeltaPhiv0CrpH2, // Delta phi of the pair with respect to the 2nd order harmonic reaction plane from V0-C
257 kDeltaPhiv0ACrpH2, // Delta phi of the pair with respect to the 2nd order harmonic reaction plane from V0-AC
258 kDeltaPhiTPCrpH2, // Delta phi of the pair with respect to the 2nd order harmonic reaction plane from TPC
c315310a 259 kv0ArpH2FlowV2, // v2 coefficient with respect to the 2nd order reaction plane from V0-A (EPtask)
260 kv0CrpH2FlowV2, // v2 coefficient with respect to the 2nd order reaction plane from V0-C
261 kv0ACrpH2FlowV2, // v2 coefficient with respect to the 2nd order reaction plane from V0-A + V0-C
07bc5543 262 kTPCrpH2FlowV2, // v2 coefficient with respect to the 2nd order reaction plane from TPC
c081415a 263 kTPCrpH2FlowV2Sin, // sinus of v2 coefficient with respect to the 2nd order reaction plane from TPC
c315310a 264
572b0139 265 kLegDist, // distance of the legs
266 kLegDistXY, // distance of the legs in XY
61d106d3 267 kDeltaEta, // Absolute value of Delta Eta for the legs
268 kDeltaPhi, // Absolute value of Delta Phi for the legs
b2a297fa 269 kMerr, // error of mass calculation
270 kDCA, // distance of closest approach TODO: not implemented yet
271 kPairType, // type of the pair, like like sign ++ unlikesign ...
ba15fdfb 272 kPseudoProperTime, // pseudo proper time
e4339752 273 kPseudoProperTimeErr, // pseudo proper time error
5720c765 274 kPseudoProperTimeResolution, // resolution for pseudo proper decay time (reconstructed - MC truth)
275 kPseudoProperTimePull, // normalizd resolution for pseudo proper time = (reco - MC truth)/dReco
276 kTRDpidEffPair, // TRD pid efficieny from conversion electrons
36d19280 277 kMomAsymDau1, // momentum fraction of daughter1
278 kMomAsymDau2, // momentum fraction of daughter2
d4619886 279 kPairEff, // pair efficiency
280 kOneOverPairEff, // 1 / pair efficiency (correction factor)
a94c2e7e 281 kOneOverPairEffSq, // 1 / pair efficiency squared (correction factor)
88db3193 282 kRndmPair, // radomly created number (used to apply special signal reduction cuts)
b829fbd2 283 kPairs, // number of Ev1PM pair candidates after all cuts
b2a297fa 284 kPairMax, //
285 // Event specific variables
6551594b 286 kXvPrim=kPairMax, // prim vertex
287 kYvPrim, // prim vertex
288 kZvPrim, // prim vertex
289 kXRes, // primary vertex x-resolution
290 kYRes, // primary vertex y-resolution
291 kZRes, // primary vertex z-resolution
20b6b7d4 292 kPhiMaxPt, // phi angle of the track with maximum pt
293 kMaxPt, // track with maximum pt
5720c765 294
07bc5543 295 //// v0 reaction plane quantities from AliEPSelectionTaks, angles interval [-pi/2,+pi/2]
fd6ebd85 296 kv0ArpH2, // VZERO-A reaction plane of the Q vector for 2nd harmonic
297 kv0CrpH2, // reaction plane
298 kv0ACrpH2, // VZERO-AC reaction plane of the Q vector for 2nd harmonic
299 kv0AxH2, // VZERO-A x-component of the Q vector for 2nd harmonic
300 kv0AyH2, // VZERO-A y-component of the Q vector for 2nd harmonic
301 kv0CxH2, // VZERO-C x-component of the Q vector for 2nd harmonic
302 kv0CyH2, // VZERO-C y-component of the Q vector for 2nd harmonic
303 kv0ACxH2, // VZERO-AC x-component of the Q vector for 2nd harmonic
304 kv0ACyH2, // VZERO-AC y-component of the Q vector for 2nd harmonic
20b6b7d4 305 kv0AmagH2, // VZERO-A the Q vectors magnitude for 2nd harmonic
306 kv0CmagH2, // VZERO-A the Q vectors magnitude for 2nd harmonic
307 kv0ACmagH2, // VZERO-A the Q vectors magnitude for 2nd harmonic
fd6ebd85 308 kv0A0rpH2, // VZERO-A 1st ring reaction plane of the Q vector for 2nd harmonic
309 kv0A3rpH2, // VZERO-A last ring reaction plane of the Q vector for 2nd harmonic
310 kv0C0rpH2, // VZERO-C 1st ring reaction plane of the Q vector for 2nd harmonic
311 kv0C3rpH2, // VZERO-C last ring reaction plane of the Q vector for 2nd harmonic
5720c765 312 kv0ATPCDiffH2, // V0A-TPC reaction plane difference for 2nd harmonic
313 kv0CTPCDiffH2, // V0C-TPC reaction plane difference for 2nd harmonic
314 kv0Av0CDiffH2, // V0A-V0C reaction plane difference for 2nd harmonic
1d2d723c 315 kv0Av0C0DiffH2, // V0A-ring 0 ofV0C reaction plane difference for 2nd harmonic
316 kv0Av0C3DiffH2, // V0A-ring 3 ofV0C reaction plane difference for 2nd harmonic
317 kv0Cv0A0DiffH2, // V0C-ring 0 ofV0A reaction plane difference for 2nd harmonic
318 kv0Cv0A3DiffH2, // V0C-ring 3 ofV0A reaction plane difference for 2nd harmonic
319 kv0A0v0A3DiffH2, // V0C-ring 0 ofV0A reaction plane difference for 2nd harmonic
320 kv0C0v0C3DiffH2, // V0C-ring 0 ofV0A reaction plane difference for 2nd harmonic
5720c765 321
322 kMultV0A, // VZERO multiplicity and ADC amplitudes
323 kMultV0C,
324 kMultV0,
6a614fc0
JB
325 kEqMultV0A, // equalized VZERO multiplicity
326 kEqMultV0C,
d05d1dfc 327 kEqMultV0,
5720c765 328 kAdcV0A,
329 kAdcV0C,
330 kAdcV0,
331 kVZEROchMult,
332 // VZERO reaction plane quantities
333 kV0AxH2=kVZEROchMult+64, // VZERO-A x-component of the Q vector for 2nd harmonic
334 kV0AyH2, // VZERO-A y-component of the Q vector for 2nd harmonic
335 kV0ArpH2, // VZERO-A reaction plane of the Q vector for 2nd harmonic
336 kV0CxH2, // VZERO-C x-component of the Q vector for 2nd harmonic
337 kV0CyH2, // y-component
338 kV0CrpH2, // reaction plane
339 kV0ACxH2, // VZERO-AC x-component of the Q vector for 2nd harmonic
340 kV0ACyH2, // VZERO-AC y-component of the Q vector for 2nd harmonic
341 kV0ACrpH2, // VZERO-AC reaction plane of the Q vector for 2nd harmonic
342 kV0ArpResH2, // 2nd harmonic reaction plane resolution for V0A
343 kV0CrpResH2, // V0C
344 kV0ACrpResH2, // V0A+V0C
345 kV0XaXcH2, // Correlation quantities to check V0 reaction plane quality
346 kV0XaYaH2,
347 kV0XaYcH2,
348 kV0YaXcH2,
349 kV0YaYcH2,
350 kV0XcYcH2,
351 kV0ATPCDiffH2, // V0A-TPC reaction plane difference for 2nd harmonic
352 kV0CTPCDiffH2, // V0C-TPC reaction plane difference for 2nd harmonic
353 kV0AV0CDiffH2, // V0A-V0C reaction plane difference for 2nd harmonic
07bc5543 354 // TPC reaction plane quantities, angle interval [-pi/2,+pi/2]
5720c765 355 kTPCxH2, // TPC x-component of the Q vector for 2nd harmonic (corrected)
356 kTPCyH2, // TPC y-component of the Q vector for 2nd harmonic (corrected)
20b6b7d4 357 kTPCmagH2, // TPC reaction plane the Q vectors magnitude for 2nd harmonic (corrected)
358 kTPCrpH2, // TPC reaction plane angle of the Q vector for 2nd harmonic (corrected)
c081415a 359 kCosTPCrpH2, // cosine of TPC reaction plane angle of the Q vector for 2nd harmonic (corrected)
360 kSinTPCrpH2, // sinus of TPC reaction plane angle of the Q vector for 2nd harmonic (corrected)
5720c765 361 kTPCsub1xH2, // TPC x-component of the Q vector for 2nd harmonic (corrected, sub event 1)
362 kTPCsub1yH2, // TPC y-component of the Q vector for 2nd harmonic (corrected, sub event 1)
363 kTPCsub1rpH2, // TPC reaction plane of the Q vector for 2nd harmonic (corrected, sub event 1)
364 kTPCsub2xH2, // TPC x-component of the Q vector for 2nd harmonic (corrected, sub event 2)
365 kTPCsub2yH2, // TPC y-component of the Q vector for 2nd harmonic (corrected, sub event 2)
366 kTPCsub2rpH2, // TPC reaction plane of the Q vector for 2nd harmonic (corrected, sub event 2)
367 kTPCsub12DiffH2, // TPC reaction plane difference of sub event 1,2 for 2nd harmonic
368 kTPCsub12DiffH2Sin, // TPC reaction plane difference of sub event 1,2 for 2nd harmonic, sinus term
369
370 kTPCxH2uc, // TPC x-component of the Q vector for 2nd harmonic (uncorrected)
371 kTPCyH2uc, // TPC y-component of the Q vector for 2nd harmonic (uncorrected)
20b6b7d4 372 kTPCmagH2uc, // TPC reaction plane the Q vectors magnitude for 2nd harmonic (uncorrected)
373 kTPCrpH2uc, // TPC reaction plane angle of the Q vector for 2nd harmonic (uncorrected)
5720c765 374 kTPCsub1xH2uc, // TPC x-component of the Q vector for 2nd harmonic (uncorrected, sub event 1)
375 kTPCsub1yH2uc, // TPC y-component of the Q vector for 2nd harmonic (uncorrected, sub event 1)
376 kTPCsub1rpH2uc, // TPC reaction plane of the Q vector for 2nd harmonic (uncorrected, sub event 1)
377 kTPCsub2xH2uc, // TPC x-component of the Q vector for 2nd harmonic (uncorrected, sub event 2)
378 kTPCsub2yH2uc, // TPC y-component of the Q vector for 2nd harmonic (uncorrected, sub event 2)
379 kTPCsub2rpH2uc, // TPC reaction plane of the Q vector for 2nd harmonic (uncorrected, sub event 2)
380 kTPCsub12DiffH2uc, // TPC reaction plane difference of sub event 1,2 for 2nd harmonic (uncorrected)
381
36a1e727
JW
382 //ZDC reaction plane(v1 plane) quantities
383
384 kZDCArpH1, // ZDC-A reaction plane of the Q vector for 1st harmonic
385 kZDCCrpH1, // ZDC-C reaction plane of the Q vector for 1st harmonic
386 kZDCACrpH1, // ZDC-AC reaction plane of the Q vector for 1st harmonic
387 kZDCrpResH1, // 1st harmonic reaction plane resolution for ZDC
388 kv0ZDCrpRes, //ZDC reaction plane for 1st harmonic and VZERO reaction plane for 2nd harmonic correlation
389
390
ba15fdfb 391 kNTrk, // number of tracks (or tracklets) TODO: ambiguous
b829fbd2 392 kTracks, // track after all cuts
a823f01b 393 kNVtxContrib, // number of primary vertex contibutors
6bd73568 394 kNVtxContribTPC, // number of TPC vertex contibutors
ba15fdfb 395 kNacc, // Number of accepted tracks
41a64bfb 396 kMatchEffITSTPC, // ruff estimate on the ITS-TPC matching efficiceny
5720c765 397 kNaccTrcklts, // number of accepted SPD tracklets in |eta|<1.6
398 kNaccTrcklts0916, // number of accepted SPD tracklets in 0.9<|eta|<1.6
399
400 kNaccTrckltsEsd05, // number of accepted SPD tracklets in |eta|<0.5 (AliESDEvent::EstimateMultiplicity())
401 kNaccTrckltsEsd10, // number of accepted SPD tracklets in |eta|<1.0 (AliESDEvent::EstimateMultiplicity())
402 kNaccTrckltsEsd16, // number of accepted SPD tracklets in |eta|<1.6 (AliESDEvent::EstimateMultiplicity())
403 kNaccTrckltsEsd05Corr, //
404 kNaccTrckltsEsd10Corr, //
405 kNaccTrckltsEsd16Corr, //
406 kNaccItsTpcEsd05, // ITS-TPC tracks + ITS SA complementary tracks + tracklets from unassigned tracklets in |eta|<0.5 (AliESDEvent::EstimateMultiplicity())
407 kNaccItsTpcEsd10, // ITS-TPC tracks + ITS SA complementary tracks + tracklets from unassigned tracklets in |eta|<1.0 (AliESDEvent::EstimateMultiplicity())
408 kNaccItsTpcEsd16, // ITS-TPC tracks + ITS SA complementary tracks + tracklets from unassigned tracklets in |eta|<1.6 (AliESDEvent::EstimateMultiplicity())
409 kNaccItsTpcEsd05Corr, //
410 kNaccItsTpcEsd10Corr, //
411 kNaccItsTpcEsd16Corr, //
412
413 kNaccItsPureEsd05, // ITS SA tracks + tracklets from unassigned tracklets in |eta|<0.5 (AliESDEvent::EstimateMultiplicity())
414 kNaccItsPureEsd10, // ITS SA tracks + tracklets from unassigned tracklets in |eta|<1.0 (AliESDEvent::EstimateMultiplicity())
415 kNaccItsPureEsd16, // ITS SA tracks + tracklets from unassigned tracklets in |eta|<1.6 (AliESDEvent::EstimateMultiplicity())
416 kNaccItsPureEsd05Corr, //
417 kNaccItsPureEsd10Corr, //
418 kNaccItsPureEsd16Corr, //
7a1ddc4b 419 kRefMult, // reference multiplicity (only in AODs) should be Ntrk w/o double counts
420 kRefMultTPConly, // TPC only Reference Multiplicty (AliESDtrackCuts::GetReferenceMultiplicity(&esd, kTRUE))
5720c765 421
422 kNch, // MC true number of charged particles in |eta|<1.6
423 kNch05, // MC true number of charged particles in |eta|<0.5
424 kNch10, // MC true number of charged particles in |eta|<1.0
425
ffbede40 426 kCentrality, // event centrality fraction
a823f01b 427 kCentralitySPD, // centrality using SPD
42e1ec3d 428 kTriggerInclONL, // online trigger bits fired (inclusive)
429 kTriggerInclOFF, // offline trigger bits fired (inclusive)
430 kTriggerExclOFF, // offline only this trigger bit fired (exclusive)
6551594b 431 kNevents, // event counter
5720c765 432 kRunNumber, // run number
d327d9cd 433 kMixingBin,
b2a297fa 434 kNMaxValues //
435 // TODO: (for A+A) ZDCEnergy, impact parameter, Iflag??
436 };
437
438
439 AliDielectronVarManager();
440 AliDielectronVarManager(const char* name, const char* title);
441 virtual ~AliDielectronVarManager();
442 static void Fill(const TObject* particle, Double_t * const values);
ba15fdfb 443 static void FillVarMCParticle2(const AliVParticle *p1, const AliVParticle *p2, Double_t * const values);
61749cc7 444 static void FillVarVParticle(const AliVParticle *particle, Double_t * const values);
b2a297fa 445
6551594b 446 static void InitESDpid(Int_t type=0);
2a14a7b1 447 static void InitAODpidUtil(Int_t type=0);
5720c765 448 static void InitEstimatorAvg(const Char_t* filename);
449 static void InitTRDpidEffHistograms(const Char_t* filename);
746e66a9 450 static void SetLegEffMap( TObject *map) { fgLegEffMap=map; }
451 static void SetPairEffMap(TObject *map) { fgPairEffMap=map; }
a94c2e7e 452 static void SetFillMap( TBits *map) { fgFillMap=map; }
a823f01b 453 static void SetVZEROCalibrationFile(const Char_t* filename) {fgVZEROCalibrationFile = filename;}
454
455 static void SetVZERORecenteringFile(const Char_t* filename) {fgVZERORecenteringFile = filename;}
36a1e727 456 static void SetZDCRecenteringFile(const Char_t* filename) {fgZDCRecenteringFile = filename;}
ba15fdfb 457 static void SetPIDResponse(AliPIDResponse *pidResponse) {fgPIDResponse=pidResponse;}
5720c765 458 static AliPIDResponse* GetPIDResponse() { return fgPIDResponse; }
572b0139 459 static void SetEvent(AliVEvent * const ev);
5720c765 460 static void SetEventData(const Double_t data[AliDielectronVarManager::kNMaxValues]);
2a14a7b1 461 static Bool_t GetDCA(const AliAODTrack *track, Double_t d0z0[2]);
5720c765 462 static void SetTPCEventPlane(AliEventplane *const evplane);
a823f01b 463 static void GetVzeroRP(const AliVEvent* event, Double_t* qvec, Int_t sideOption); // 0- V0A; 1- V0C; 2- V0A+V0C
36a1e727 464 static void GetZDCRP(const AliVEvent* event, Double_t qvec[][2]);
99345a64 465 static AliAODVertex* GetVertex(const AliAODEvent *event, AliAODVertex::AODVtx_t vtype);
5720c765 466
467 static TProfile* GetEstimatorHistogram(Int_t period, Int_t type) {return fgMultEstimatorAvg[period][type];}
468 static Double_t GetTRDpidEfficiency(Int_t runNo, Double_t centrality, Double_t eta, Double_t trdPhi, Double_t pout, Double_t& effErr);
833da63d 469 static Double_t GetSingleLegEff(Double_t * const values);
0b369e55 470 static Double_t GetPairEff(Double_t * const values);
ba15fdfb 471
472 static const AliKFVertex* GetKFVertex() {return fgKFVertex;}
473
90c1ae2d 474 static const char* GetValueName(Int_t i) { return (i>=0&&i<kNMaxValues)?fgkParticleNames[i][0]:""; }
475 static const char* GetValueLabel(Int_t i) { return (i>=0&&i<kNMaxValues)?fgkParticleNames[i][1]:""; }
476 static const char* GetValueUnit(Int_t i) { return (i>=0&&i<kNMaxValues)?fgkParticleNames[i][2]:""; }
07480df6 477 static UInt_t GetValueType(const char* valname);
ba15fdfb 478 static const Double_t* GetData() {return fgData;}
99345a64 479 static AliVEvent* GetCurrentEvent() {return fgEvent;}
ba15fdfb 480
d327d9cd 481 static Double_t GetValue(ValueTypes var) {return fgData[var];}
482 static void SetValue(ValueTypes var, Double_t val) { fgData[var]=val; }
483
b2a297fa 484private:
485
90c1ae2d 486 static const char* fgkParticleNames[kNMaxValues][3]; //variable names
b2a297fa 487
a94c2e7e 488 static Bool_t Req(ValueTypes var) { return (fgFillMap ? fgFillMap->TestBitNumber(var) : kTRUE); }
b2a297fa 489 static void FillVarESDtrack(const AliESDtrack *particle, Double_t * const values);
490 static void FillVarAODTrack(const AliAODTrack *particle, Double_t * const values);
8df8e382 491 static void FillVarMCParticle(const AliMCParticle *particle, Double_t * const values);
b2a297fa 492 static void FillVarAODMCParticle(const AliAODMCParticle *particle, Double_t * const values);
493 static void FillVarDielectronPair(const AliDielectronPair *pair, Double_t * const values);
1201a1a9 494 static void FillVarKFParticle(const AliKFParticle *pair, Double_t * const values);
495
6551594b 496 static void FillVarVEvent(const AliVEvent *event, Double_t * const values);
497 static void FillVarESDEvent(const AliESDEvent *event, Double_t * const values);
498 static void FillVarAODEvent(const AliAODEvent *event, Double_t * const values);
499 static void FillVarMCEvent(const AliMCEvent *event, Double_t * const values);
5720c765 500 static void FillVarTPCEventPlane(const AliEventplane *evplane, Double_t * const values);
501
a823f01b 502 static void InitVZEROCalibrationHistograms(Int_t runNo);
503 static void InitVZERORecenteringHistograms(Int_t runNo);
36a1e727
JW
504 static void InitZDCRecenteringHistograms(Int_t runNo);
505
ba15fdfb 506 static AliPIDResponse *fgPIDResponse; // PID response object
507 static AliVEvent *fgEvent; // current event pointer
8d42b5b9 508 static AliEventplane *fgTPCEventPlane; // current event tpc plane pointer
ba15fdfb 509 static AliKFVertex *fgKFVertex; // kf vertex
5720c765 510 static TProfile *fgMultEstimatorAvg[4][9]; // multiplicity estimator averages (4 periods x 9 estimators)
511 static Double_t fgTRDpidEffCentRanges[10][4]; // centrality ranges for the TRD pid efficiency histograms
512 static TH3D *fgTRDpidEff[10][4]; // TRD pid efficiencies from conversion electrons
746e66a9 513 static TObject *fgLegEffMap; // single electron efficiencies
514 static TObject *fgPairEffMap; // pair efficiencies
a94c2e7e 515 static TBits *fgFillMap; // map for requested variable filling
a823f01b 516 static TString fgVZEROCalibrationFile; // file with VZERO channel-by-channel calibrations
517 static TString fgVZERORecenteringFile; // file with VZERO Q-vector averages needed for event plane recentering
518 static TProfile2D *fgVZEROCalib[64]; // 1 histogram per VZERO channel
519 static TProfile2D *fgVZERORecentering[2][2]; // 2 VZERO sides x 2 Q-vector components
2e02dba4 520 static Int_t fgCurrentRun; // current run number
a823f01b 521
36a1e727
JW
522 static TString fgZDCRecenteringFile; // file with ZDC Q-vector averages needed for event plane recentering
523 static TProfile3D *fgZDCRecentering[3][2]; // 2 VZERO sides x 2 Q-vector components
524
ba15fdfb 525 static Double_t fgData[kNMaxValues]; //! data
572b0139 526
b2a297fa 527 AliDielectronVarManager(const AliDielectronVarManager &c);
528 AliDielectronVarManager &operator=(const AliDielectronVarManager &c);
529
530 ClassDef(AliDielectronVarManager,1);
531};
532
533
534//Inline functions
6551594b 535inline void AliDielectronVarManager::Fill(const TObject* object, Double_t * const values)
b2a297fa 536{
537 //
538 // Main function to fill all available variables according to the type of particle
539 //
40875e45 540 if (!object) return;
6551594b 541 if (object->IsA() == AliESDtrack::Class()) FillVarESDtrack(static_cast<const AliESDtrack*>(object), values);
542 else if (object->IsA() == AliAODTrack::Class()) FillVarAODTrack(static_cast<const AliAODTrack*>(object), values);
543 else if (object->IsA() == AliMCParticle::Class()) FillVarMCParticle(static_cast<const AliMCParticle*>(object), values);
544 else if (object->IsA() == AliAODMCParticle::Class()) FillVarAODMCParticle(static_cast<const AliAODMCParticle*>(object), values);
545 else if (object->IsA() == AliDielectronPair::Class()) FillVarDielectronPair(static_cast<const AliDielectronPair*>(object), values);
1201a1a9 546 else if (object->IsA() == AliKFParticle::Class()) FillVarKFParticle(static_cast<const AliKFParticle*>(object),values);
6551594b 547 // Main function to fill all available variables according to the type of event
548
549 else if (object->IsA() == AliVEvent::Class()) FillVarVEvent(static_cast<const AliVEvent*>(object), values);
550 else if (object->IsA() == AliESDEvent::Class()) FillVarESDEvent(static_cast<const AliESDEvent*>(object), values);
551 else if (object->IsA() == AliAODEvent::Class()) FillVarAODEvent(static_cast<const AliAODEvent*>(object), values);
552 else if (object->IsA() == AliMCEvent::Class()) FillVarMCEvent(static_cast<const AliMCEvent*>(object), values);
5720c765 553 else if (object->IsA() == AliEventplane::Class()) FillVarTPCEventPlane(static_cast<const AliEventplane*>(object), values);
1201a1a9 554// else printf(Form("AliDielectronVarManager::Fill: Type %s is not supported by AliDielectronVarManager!", object->ClassName())); //TODO: implement without object needed
b2a297fa 555}
556
557inline void AliDielectronVarManager::FillVarVParticle(const AliVParticle *particle, Double_t * const values)
558{
559 //
560 // Fill track information available in AliVParticle into an array
561 //
562 values[AliDielectronVarManager::kPx] = particle->Px();
563 values[AliDielectronVarManager::kPy] = particle->Py();
564 values[AliDielectronVarManager::kPz] = particle->Pz();
565 values[AliDielectronVarManager::kPt] = particle->Pt();
87a7c4b0 566 values[AliDielectronVarManager::kPtSq] = particle->Pt()*particle->Pt();
b2a297fa 567 values[AliDielectronVarManager::kP] = particle->P();
568
569 values[AliDielectronVarManager::kXv] = particle->Xv();
570 values[AliDielectronVarManager::kYv] = particle->Yv();
571 values[AliDielectronVarManager::kZv] = particle->Zv();
572
ba15fdfb 573 values[AliDielectronVarManager::kOneOverPt] = (particle->Pt()>1.0e-3 ? particle->OneOverPt() : 0.0);
b2a297fa 574 values[AliDielectronVarManager::kPhi] = particle->Phi();
575 values[AliDielectronVarManager::kTheta] = particle->Theta();
576 values[AliDielectronVarManager::kEta] = particle->Eta();
577 values[AliDielectronVarManager::kY] = particle->Y();
8df8e382 578
b2a297fa 579 values[AliDielectronVarManager::kE] = particle->E();
580 values[AliDielectronVarManager::kM] = particle->M();
581 values[AliDielectronVarManager::kCharge] = particle->Charge();
2a14a7b1 582
583 values[AliDielectronVarManager::kPdgCode] = particle->PdgCode();
584
ba15fdfb 585// if ( fgEvent ) AliDielectronVarManager::Fill(fgEvent, values);
586 for (Int_t i=AliDielectronVarManager::kPairMax; i<AliDielectronVarManager::kNMaxValues; ++i)
587 values[i]=fgData[i];
b2a297fa 588}
589
590inline void AliDielectronVarManager::FillVarESDtrack(const AliESDtrack *particle, Double_t * const values)
591{
592 //
593 // Fill track information available for histogramming into an array
594 //
595
596 // Fill common AliVParticle interface information
597 FillVarVParticle(particle, values);
598
5720c765 599 AliESDtrack *esdTrack=0x0;
600 Double_t origdEdx=particle->GetTPCsignal();
601
602 // apply ETa correction, remove once this is in the tender
d327d9cd 603 esdTrack=const_cast<AliESDtrack*>(particle);
9395992d 604 if (!esdTrack) return;
d327d9cd 605 esdTrack->SetTPCsignal(origdEdx/AliDielectronPID::GetEtaCorr(esdTrack)/AliDielectronPID::GetCorrValdEdx(),esdTrack->GetTPCsignalSigma(),esdTrack->GetTPCsignalN());
5720c765 606
8df8e382 607 Double_t pidProbs[AliPID::kSPECIES];
b2a297fa 608 // Fill AliESDtrack interface specific information
164bfb53 609 Double_t tpcNcls=particle->GetTPCNcls();
5720c765 610 Double_t tpcNclsS = particle->GetTPCnclsS();
611 Double_t itsNcls=particle->GetNcls(0);
ba15fdfb 612 Double_t tpcSignalN=particle->GetTPCsignalN();
9afa0f7e 613 Double_t tpcClusFindable=particle->GetTPCNclsF();
5720c765 614 values[AliDielectronVarManager::kNclsITS] = itsNcls; // TODO: get rid of the plain numbers
61d106d3 615 values[AliDielectronVarManager::kNclsTPC] = tpcNcls; // TODO: get rid of the plain numbers
5720c765 616 values[AliDielectronVarManager::kNclsSTPC] = tpcNclsS;
617 values[AliDielectronVarManager::kNclsSFracTPC] = tpcNcls>0?tpcNclsS/tpcNcls:0;
ffbede40 618 values[AliDielectronVarManager::kNclsTPCiter1] = particle->GetTPCNclsIter1(); // TODO: get rid of the plain numbers
9afa0f7e 619 values[AliDielectronVarManager::kNFclsTPC] = tpcClusFindable;
620 values[AliDielectronVarManager::kNFclsTPCr] = particle->GetTPCClusterInfo(2,1);
621 values[AliDielectronVarManager::kNFclsTPCrFrac] = particle->GetTPCClusterInfo(2);
622 values[AliDielectronVarManager::kNFclsTPCfCross]= (tpcClusFindable>0)?(particle->GetTPCClusterInfo(2,1)/tpcClusFindable):0;
ba15fdfb 623 values[AliDielectronVarManager::kTPCsignalN] = tpcSignalN;
624 values[AliDielectronVarManager::kTPCsignalNfrac]= tpcNcls>0?tpcSignalN/tpcNcls:0;
b2a297fa 625 values[AliDielectronVarManager::kNclsTRD] = particle->GetNcls(2); // TODO: get rid of the plain numbers
626 values[AliDielectronVarManager::kTRDntracklets] = particle->GetTRDntracklets(); // TODO: GetTRDtracklets/GetTRDntracklets?
e4339752 627 values[AliDielectronVarManager::kTRDpidQuality] = particle->GetTRDntrackletsPID();
67fd1119 628 values[AliDielectronVarManager::kTRDchi2] = particle->GetTRDchi2();
35363fb9 629 values[AliDielectronVarManager::kTRDsignal] = particle->GetTRDsignal();
5720c765 630 values[AliDielectronVarManager::kTPCclsDiff] = tpcSignalN-tpcNcls;
29091f0d 631 values[AliDielectronVarManager::kTPCclsSegments] = 0.0;
d05d1dfc 632 UChar_t threshold = 5;
29091f0d 633 TBits tpcClusterMap = particle->GetTPCClusterMap();
634 UChar_t n=0; UChar_t j=0;
635 for(UChar_t i=0; i<8; ++i) {
636 n=0;
637 for(j=i*20; j<(i+1)*20 && j<159; ++j) n+=tpcClusterMap.TestBitNumber(j);
638 if(n>=threshold) values[AliDielectronVarManager::kTPCclsSegments] += 1.0;
639 }
d05d1dfc 640
641 n=0;
642 threshold=0;
643 values[AliDielectronVarManager::kTPCclsIRO]=0.;
644 for(j=0; j<63; ++j) n+=tpcClusterMap.TestBitNumber(j);
645 if(n>=threshold) values[AliDielectronVarManager::kTPCclsIRO] = n;
646 n=0;
647 threshold=0;
648 values[AliDielectronVarManager::kTPCclsORO]=0.;
649 for(j=63; j<159; ++j) n+=tpcClusterMap.TestBitNumber(j);
650 if(n>=threshold) values[AliDielectronVarManager::kTPCclsORO] = n;
651
652
61d106d3 653 values[AliDielectronVarManager::kTrackStatus] = (Double_t)particle->GetStatus();
07480df6 654 values[AliDielectronVarManager::kFilterBit] = 0;
61d106d3 655
656 values[AliDielectronVarManager::kTPCchi2Cl] = -1;
657 if (tpcNcls>0) values[AliDielectronVarManager::kTPCchi2Cl] = particle->GetTPCchi2() / tpcNcls;
5720c765 658 values[AliDielectronVarManager::kITSchi2Cl] = -1;
659 if (itsNcls>0) values[AliDielectronVarManager::kITSchi2Cl] = particle->GetITSchi2() / itsNcls;
8df8e382 660 //TRD pidProbs
661 particle->GetTRDpid(pidProbs);
662 values[AliDielectronVarManager::kTRDprobEle] = pidProbs[AliPID::kElectron];
663 values[AliDielectronVarManager::kTRDprobPio] = pidProbs[AliPID::kPion];
ffbede40 664
88e9bae6 665 values[AliDielectronVarManager::kV0Index0] = particle->GetV0Index(0);
ffbede40 666 values[AliDielectronVarManager::kKinkIndex0] = particle->GetKinkIndex(0);
8df8e382 667
b2a297fa 668 Float_t impactParXY, impactParZ;
669 particle->GetImpactParameters(impactParXY, impactParZ);
670 values[AliDielectronVarManager::kImpactParXY] = impactParXY;
671 values[AliDielectronVarManager::kImpactParZ] = impactParZ;
672
8df8e382 673
ba15fdfb 674 values[AliDielectronVarManager::kPdgCode]=-1;
675 values[AliDielectronVarManager::kPdgCodeMother]=-1;
676 values[AliDielectronVarManager::kPdgCodeGrandMother]=-1;
1bb1fef1 677 values[AliDielectronVarManager::kHasCocktailMother]=0;
678 values[AliDielectronVarManager::kHasCocktailGrandMother]=0;
ba15fdfb 679
8df8e382 680 values[AliDielectronVarManager::kNumberOfDaughters]=-999;
681
682 AliDielectronMC *mc=AliDielectronMC::Instance();
8df8e382 683 if (mc->HasMC()){
1bb1fef1 684 if (mc->GetMCTrack(particle)) {
d191916c 685 Int_t trkLbl = TMath::Abs(mc->GetMCTrack(particle)->GetLabel());
686 values[AliDielectronVarManager::kPdgCode] =mc->GetMCTrack(particle)->PdgCode();
687 values[AliDielectronVarManager::kHasCocktailMother] =mc->CheckParticleSource(trkLbl, AliDielectronSignalMC::kDirect);
688 values[AliDielectronVarManager::kPdgCodeMother] =mc->GetMotherPDG(particle);
69050fc7 689 AliMCParticle *motherMC=mc->GetMCTrackMother(particle); //mother
690 if(motherMC) values[AliDielectronVarManager::kPdgCodeGrandMother]=mc->GetMotherPDG(motherMC);
ba15fdfb 691 }
8df8e382 692 values[AliDielectronVarManager::kNumberOfDaughters]=mc->NumberOfDaughters(particle);
693 } //if(mc->HasMC())
694
695
8df8e382 696 values[AliDielectronVarManager::kITSsignal] = particle->GetITSsignal();
697
698 Double_t itsdEdx[4];
699 particle->GetITSdEdxSamples(itsdEdx);
700
701 values[AliDielectronVarManager::kITSsignalSSD1] = itsdEdx[0];
702 values[AliDielectronVarManager::kITSsignalSSD2] = itsdEdx[1];
703 values[AliDielectronVarManager::kITSsignalSDD1] = itsdEdx[2];
704 values[AliDielectronVarManager::kITSsignalSDD2] = itsdEdx[3];
3505bfad 705 values[AliDielectronVarManager::kITSclusterMap] = particle->GetITSClusterMap();
5720c765 706 values[AliDielectronVarManager::kITSLayerFirstCls] = -1.;
707
708 for (Int_t iC=0; iC<6; iC++) {
709 if (((particle->GetITSClusterMap()) & (1<<(iC))) > 0) {
710 values[AliDielectronVarManager::kITSLayerFirstCls] = iC;
711 break;
712 }
713 }
714
3505bfad 715
b2a297fa 716 values[AliDielectronVarManager::kTrackLength] = particle->GetIntegratedLength();
b2a297fa 717 //dEdx information
718 Double_t mom = particle->GetP();
719 const AliExternalTrackParam *in=particle->GetInnerParam();
5720c765 720 Double_t ysignedIn=-100;
721 if (in) {
722 mom = in->GetP();
723 ysignedIn=particle->Charge()*in->GetY();
724 }
b2a297fa 725 values[AliDielectronVarManager::kPIn]=mom;
5720c765 726 values[AliDielectronVarManager::kYsignedIn]=ysignedIn;
727 const AliExternalTrackParam *out=particle->GetOuterParam();
728 if(out) values[AliDielectronVarManager::kPOut] = out->GetP();
729 else values[AliDielectronVarManager::kPOut] = mom;
730 if(out && fgEvent) {
731 Double_t localCoord[3]={0.0};
732 Bool_t localCoordGood = out->GetXYZAt(298.0, ((AliESDEvent*)fgEvent)->GetMagneticField(), localCoord);
733 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.);
734 }
735 if(mc->HasMC() && fgTRDpidEff[0][0]) {
736 Int_t runNo = (fgEvent ? fgEvent->GetRunNumber() : -1);
737 Float_t centrality=-1.0;
738 AliCentrality *esdCentrality = (fgEvent ? fgEvent->GetCentrality() : 0x0);
739 if(esdCentrality) centrality = esdCentrality->GetCentralityPercentile("V0M");
740 Double_t effErr=0.0;
741 values[kTRDpidEffLeg] = GetTRDpidEfficiency(runNo, centrality, values[AliDielectronVarManager::kEta],
742 values[AliDielectronVarManager::kTRDphi],
743 values[AliDielectronVarManager::kPOut], effErr);
744 }
b2a297fa 745 values[AliDielectronVarManager::kTPCsignal]=particle->GetTPCsignal();
ba15fdfb 746
747 values[AliDielectronVarManager::kTOFsignal]=particle->GetTOFsignal();
748
749 Double_t l = particle->GetIntegratedLength(); // cm
750 Double_t t = particle->GetTOFsignal();
751 Double_t t0 = fgPIDResponse->GetTOFResponse().GetTimeZero(); // ps
752
753 if( (l < 360. || l > 800.) || (t <= 0.) || (t0 >999990.0) ) {
754 values[AliDielectronVarManager::kTOFbeta]=0.0;
755 }
756 else {
757 t -= t0; // subtract the T0
758 l *= 0.01; // cm ->m
759 t *= 1e-12; //ps -> s
760
761 Double_t v = l / t;
762 Float_t beta = v / TMath::C();
763 values[AliDielectronVarManager::kTOFbeta]=beta;
764 }
5720c765 765 values[AliDielectronVarManager::kTOFPIDBit]=(particle->GetStatus()&AliESDtrack::kTOFpid? 1: 0);
b2ad74d0 766
767 values[AliDielectronVarManager::kTOFmismProb] = fgPIDResponse->GetTOFMismatchProbability(particle);
ba15fdfb 768
6551594b 769 // nsigma to Electron band
770 // TODO: for the moment we set the bethe bloch parameters manually
771 // this should be changed in future!
2d00c7d3 772 values[AliDielectronVarManager::kTPCnSigmaEleRaw]=fgPIDResponse->NumberOfSigmasTPC(particle,AliPID::kElectron);
61749cc7 773 values[AliDielectronVarManager::kTPCnSigmaEle]=(fgPIDResponse->NumberOfSigmasTPC(particle,AliPID::kElectron)-AliDielectronPID::GetCorrVal()-AliDielectronPID::GetCntrdCorr(particle)) / AliDielectronPID::GetWdthCorr(particle);
2d00c7d3 774
ba15fdfb 775 values[AliDielectronVarManager::kTPCnSigmaPio]=fgPIDResponse->NumberOfSigmasTPC(particle,AliPID::kPion);
776 values[AliDielectronVarManager::kTPCnSigmaMuo]=fgPIDResponse->NumberOfSigmasTPC(particle,AliPID::kMuon);
777 values[AliDielectronVarManager::kTPCnSigmaKao]=fgPIDResponse->NumberOfSigmasTPC(particle,AliPID::kKaon);
778 values[AliDielectronVarManager::kTPCnSigmaPro]=fgPIDResponse->NumberOfSigmasTPC(particle,AliPID::kProton);
779
780 values[AliDielectronVarManager::kITSnSigmaEle]=fgPIDResponse->NumberOfSigmasITS(particle,AliPID::kElectron);
781 values[AliDielectronVarManager::kITSnSigmaPio]=fgPIDResponse->NumberOfSigmasITS(particle,AliPID::kPion);
782 values[AliDielectronVarManager::kITSnSigmaMuo]=fgPIDResponse->NumberOfSigmasITS(particle,AliPID::kMuon);
783 values[AliDielectronVarManager::kITSnSigmaKao]=fgPIDResponse->NumberOfSigmasITS(particle,AliPID::kKaon);
784 values[AliDielectronVarManager::kITSnSigmaPro]=fgPIDResponse->NumberOfSigmasITS(particle,AliPID::kProton);
785
786 values[AliDielectronVarManager::kTOFnSigmaEle]=fgPIDResponse->NumberOfSigmasTOF(particle,AliPID::kElectron);
787 values[AliDielectronVarManager::kTOFnSigmaPio]=fgPIDResponse->NumberOfSigmasTOF(particle,AliPID::kPion);
788 values[AliDielectronVarManager::kTOFnSigmaMuo]=fgPIDResponse->NumberOfSigmasTOF(particle,AliPID::kMuon);
789 values[AliDielectronVarManager::kTOFnSigmaKao]=fgPIDResponse->NumberOfSigmasTOF(particle,AliPID::kKaon);
790 values[AliDielectronVarManager::kTOFnSigmaPro]=fgPIDResponse->NumberOfSigmasTOF(particle,AliPID::kProton);
5720c765 791
a823f01b 792 //EMCAL PID information
793 Double_t eop=0;
794 Double_t showershape[4]={0.,0.,0.,0.};
795// values[AliDielectronVarManager::kEMCALnSigmaEle] = fgPIDResponse->NumberOfSigmasEMCAL(particle,AliPID::kElectron);
796 values[AliDielectronVarManager::kEMCALnSigmaEle] = fgPIDResponse->NumberOfSigmasEMCAL(particle,AliPID::kElectron,eop,showershape);
797 values[AliDielectronVarManager::kEMCALEoverP] = eop;
88204efa 798 values[AliDielectronVarManager::kEMCALE] = eop*values[AliDielectronVarManager::kP];
a823f01b 799 values[AliDielectronVarManager::kEMCALNCells] = showershape[0];
800 values[AliDielectronVarManager::kEMCALM02] = showershape[1];
801 values[AliDielectronVarManager::kEMCALM20] = showershape[2];
802 values[AliDielectronVarManager::kEMCALDispersion] = showershape[3];
833da63d 803
d4619886 804 values[AliDielectronVarManager::kLegEff] = GetSingleLegEff(values);
805 values[AliDielectronVarManager::kOneOverLegEff] = (values[AliDielectronVarManager::kLegEff]>0.0 ? 1./values[AliDielectronVarManager::kLegEff] : 0.0);
5720c765 806 //restore TPC signal if it was changed
807 if (esdTrack) esdTrack->SetTPCsignal(origdEdx,esdTrack->GetTPCsignalSigma(),esdTrack->GetTPCsignalN());
b2a297fa 808}
809
810inline void AliDielectronVarManager::FillVarAODTrack(const AliAODTrack *particle, Double_t * const values)
811{
812 //
813 // Fill track information available for histogramming into an array
814 //
815
816 // Fill common AliVParticle interface information
817 FillVarVParticle(particle, values);
ba15fdfb 818 Double_t tpcNcls=particle->GetTPCNcls();
5720c765 819
820 //GetNclsS not present in AODtrack
821 //Replace with method as soon as available
822 TBits tpcSharedMap = particle->GetTPCSharedMap();
823 Double_t tpcNclsS= tpcSharedMap.CountBits(0)-tpcSharedMap.CountBits(159);
9afa0f7e 824
572b0139 825 // Reset AliESDtrack interface specific information
a94c2e7e 826 if(Req(kNclsITS)) values[AliDielectronVarManager::kNclsITS] = particle->GetITSNcls();
827 if(Req(kITSchi2Cl)) values[AliDielectronVarManager::kITSchi2Cl] = -1;
828 if(Req(kNclsTPC)) values[AliDielectronVarManager::kNclsTPC] = tpcNcls;
829 if(Req(kNclsSTPC)) values[AliDielectronVarManager::kNclsSTPC] = tpcNclsS;
830 if(Req(kNclsSFracTPC)) values[AliDielectronVarManager::kNclsSFracTPC] = tpcNcls>0?tpcNclsS/tpcNcls:0;
831 if(Req(kNclsTPCiter1)) values[AliDielectronVarManager::kNclsTPCiter1] = tpcNcls; // not really available in AOD
832 if(Req(kNFclsTPC) || Req(kNFclsTPCfCross)) values[AliDielectronVarManager::kNFclsTPC] = particle->GetTPCNclsF();
833 if(Req(kNFclsTPCr) || Req(kNFclsTPCfCross)) values[AliDielectronVarManager::kNFclsTPCr] = particle->GetTPCClusterInfo(2,1);
834 if(Req(kNFclsTPCrFrac)) values[AliDielectronVarManager::kNFclsTPCrFrac] = particle->GetTPCClusterInfo(2);
835 if(Req(kNFclsTPCfCross)) values[AliDielectronVarManager::kNFclsTPCfCross]= (values[kNFclsTPC]>0)?(values[kNFclsTPCr]/values[kNFclsTPC]):0;
836 if(Req(kNclsTRD)) values[AliDielectronVarManager::kNclsTRD] = 0;
837 if(Req(kTRDntracklets)) values[AliDielectronVarManager::kTRDntracklets] = 0;
838 if(Req(kTRDpidQuality)) values[AliDielectronVarManager::kTRDpidQuality] = particle->GetTRDntrackletsPID();
839 if(Req(kTRDchi2)) values[AliDielectronVarManager::kTRDchi2] = (particle->GetTRDntrackletsPID()!=0.?particle->GetTRDchi2():-1);
840 if(Req(kTRDsignal)) values[AliDielectronVarManager::kTRDsignal] = particle->GetTRDsignal();
841
842
1ca9f651 843 TBits tpcClusterMap = particle->GetTPCClusterMap();
844 UChar_t n=0; UChar_t j=0;
a94c2e7e 845 UChar_t threshold = 5;
846
847 values[AliDielectronVarManager::kTPCclsSegments] = 0.0;
848 if(Req(kTPCclsSegments)) {
849 for(UChar_t i=0; i<8; ++i) {
850 n=0;
851 for(j=i*20; j<(i+1)*20 && j<159; ++j) n+=tpcClusterMap.TestBitNumber(j);
852 if(n>=threshold) values[AliDielectronVarManager::kTPCclsSegments] += 1.0;
853 }
1ca9f651 854 }
855
d05d1dfc 856 values[AliDielectronVarManager::kTPCclsIRO]=0.;
a94c2e7e 857 if(Req(kTPCclsIRO)) {
858 n=0;
859 threshold=0;
860 for(j=0; j<63; ++j) n+=tpcClusterMap.TestBitNumber(j);
861 if(n>=threshold) values[AliDielectronVarManager::kTPCclsIRO] = n;
862 }
d05d1dfc 863
a94c2e7e 864 values[AliDielectronVarManager::kTPCclsORO]=0.;
865 if(Req(kTPCclsORO)) {
866 n=0;
867 threshold=0;
868 for(j=63; j<159; ++j) n+=tpcClusterMap.TestBitNumber(j);
869 if(n>=threshold) values[AliDielectronVarManager::kTPCclsORO] = n;
870 }
d05d1dfc 871
a94c2e7e 872 // it is stored as normalized to tpcNcls-5 (see AliAnalysisTaskESDfilter)
873 if(Req(kTPCchi2Cl)) values[AliDielectronVarManager::kTPCchi2Cl] = (tpcNcls>0)?particle->Chi2perNDF()*(tpcNcls-5)/tpcNcls:-1.;
874 if(Req(kTrackStatus)) values[AliDielectronVarManager::kTrackStatus] = (Double_t)particle->GetStatus();
875 if(Req(kFilterBit)) values[AliDielectronVarManager::kFilterBit] = (Double_t)particle->GetFilterMap();
07480df6 876
8df8e382 877 //TRD pidProbs
8df8e382 878 values[AliDielectronVarManager::kTRDprobEle] = 0;
879 values[AliDielectronVarManager::kTRDprobPio] = 0;
67fd1119 880
2a14a7b1 881 values[AliDielectronVarManager::kTPCsignalN] = 0;
ba15fdfb 882 values[AliDielectronVarManager::kTPCsignalNfrac]= 0;
b863bc83 883
2a14a7b1 884 // Fill AliAODTrack interface information
885 //
0c09cae4 886 Int_t v0Index=-1;
887 Int_t kinkIndex=-1;
a94c2e7e 888 if( (Req(kV0Index0) || Req(kKinkIndex0)) && particle->GetProdVertex()) {
0c09cae4 889 v0Index = particle->GetProdVertex()->GetType()==AliAODVertex::kV0 ? 1 : 0;
890 kinkIndex = particle->GetProdVertex()->GetType()==AliAODVertex::kKink ? 1 : 0;
891 }
892 values[AliDielectronVarManager::kV0Index0] = v0Index;
893 values[AliDielectronVarManager::kKinkIndex0] = kinkIndex;
a823f01b 894
a94c2e7e 895 Double_t d0z0[2]={-999.0,-999.0};
896 if(Req(kImpactParXY) || Req(kImpactParZ)) GetDCA(particle, d0z0);
2a14a7b1 897 values[AliDielectronVarManager::kImpactParXY] = d0z0[0];
898 values[AliDielectronVarManager::kImpactParZ] = d0z0[1];
572b0139 899
0c09cae4 900 values[AliDielectronVarManager::kPIn] = 0.;
901 values[AliDielectronVarManager::kTPCsignal] = 0.;
902 values[AliDielectronVarManager::kTPCsignalN] = -1.;
903 values[AliDielectronVarManager::kTPCsignalNfrac] = -1.;
904 values[AliDielectronVarManager::kTPCclsDiff] = -999.;
ba15fdfb 905
906 values[AliDielectronVarManager::kTOFsignal]=0;
a94c2e7e 907 values[AliDielectronVarManager::kTOFbeta]=0;
572b0139 908
2d00c7d3 909 values[AliDielectronVarManager::kTPCnSigmaEleRaw]=0;
572b0139 910 values[AliDielectronVarManager::kTPCnSigmaEle]=0;
911 values[AliDielectronVarManager::kTPCnSigmaPio]=0;
912 values[AliDielectronVarManager::kTPCnSigmaMuo]=0;
913 values[AliDielectronVarManager::kTPCnSigmaKao]=0;
914 values[AliDielectronVarManager::kTPCnSigmaPro]=0;
b2a297fa 915
0c09cae4 916 values[AliDielectronVarManager::kTOFnSigmaEle]=0;
917 values[AliDielectronVarManager::kTOFnSigmaPio]=0;
918 values[AliDielectronVarManager::kTOFnSigmaMuo]=0;
919 values[AliDielectronVarManager::kTOFnSigmaKao]=0;
920 values[AliDielectronVarManager::kTOFnSigmaPro]=0;
921
a94c2e7e 922 if(Req(kITSsignal)) values[AliDielectronVarManager::kITSsignal] = particle->GetITSsignal();
923 if(Req(kITSclusterMap)) values[AliDielectronVarManager::kITSclusterMap] = particle->GetITSClusterMap();
924 if(Req(kITSLayerFirstCls)) values[AliDielectronVarManager::kITSLayerFirstCls] = -1.;
e4339752 925 for (Int_t iC=0; iC<6; iC++) {
926 if (((particle->GetITSClusterMap()) & (1<<(iC))) > 0) {
a94c2e7e 927 if(Req(kITSLayerFirstCls)) values[AliDielectronVarManager::kITSLayerFirstCls] = iC;
e4339752 928 break;
929 }
930 }
931
0c09cae4 932 AliAODPid *pid=const_cast<AliAODPid*>(particle->GetDetPid());
b863bc83 933 if (pid) {
0c09cae4 934 Double_t origdEdx=pid->GetTPCsignal();
935 //overwrite signal
936 pid->SetTPCsignal(origdEdx/AliDielectronPID::GetEtaCorr(particle)/AliDielectronPID::GetCorrValdEdx());
a94c2e7e 937
938 Double_t tpcSignalN=0.0;
939 if(Req(kTPCsignalN) || Req(kTPCsignalNfrac) || Req(kTPCclsDiff)) tpcSignalN = pid->GetTPCsignalN();
0c09cae4 940 values[AliDielectronVarManager::kTPCsignalN] = tpcSignalN;
941 values[AliDielectronVarManager::kTPCsignalNfrac] = tpcNcls>0?tpcSignalN/tpcNcls:0;
942 values[AliDielectronVarManager::kTPCclsDiff] = tpcSignalN-tpcNcls;
790b92d8 943
2ef1eb25 944 values[AliDielectronVarManager::kPIn] = pid->GetTPCmomentum();
a94c2e7e 945 if(Req(kTPCsignal)) values[AliDielectronVarManager::kTPCsignal] = pid->GetTPCsignal();
946 if(Req(kTOFsignal)) values[AliDielectronVarManager::kTOFsignal] = pid->GetTOFsignal();
947 if(Req(kTOFmismProb)) values[AliDielectronVarManager::kTOFmismProb] = fgPIDResponse->GetTOFMismatchProbability(particle);
e4339752 948
950294b0 949 // TOF beta calculation
a94c2e7e 950 if(Req(kTOFbeta)) {
951 Double32_t expt[5];
952 particle->GetIntegratedTimes(expt); // ps
953 Double_t l = TMath::C()* expt[0]*1e-12; // m
954 Double_t t = pid->GetTOFsignal(); // ps start time subtracted (until v5-02-Rev09)
955 AliTOFHeader* tofH=0x0; // from v5-02-Rev10 on subtract the start time
956 if(fgEvent) tofH = (AliTOFHeader*)fgEvent->GetTOFHeader();
957 if(tofH) t -= fgPIDResponse->GetTOFResponse().GetStartTime(particle->P()); // ps
29091f0d 958
959 if( (l < 360.e-2 || l > 800.e-2) || (t <= 0.) ) {
960 values[AliDielectronVarManager::kTOFbeta] =0;
961 }
962 else {
963 t *= 1e-12; //ps -> s
790b92d8 964
a94c2e7e 965 Double_t v = l / t;
966 Float_t beta = v / TMath::C();
967 values[AliDielectronVarManager::kTOFbeta]=beta;
968 }
29091f0d 969 }
5720c765 970
950294b0 971 // nsigma for various detectors
a94c2e7e 972 if(Req(kTPCnSigmaEleRaw)) values[kTPCnSigmaEleRaw]= fgPIDResponse->NumberOfSigmasTPC(particle,AliPID::kElectron);
973 if(Req(kTPCnSigmaEle)) values[kTPCnSigmaEle] =(fgPIDResponse->NumberOfSigmasTPC(particle,AliPID::kElectron)
974 -AliDielectronPID::GetCorrVal()-
975 AliDielectronPID::GetCntrdCorr(particle)) / AliDielectronPID::GetWdthCorr(particle);
976
977 if(Req(kTPCnSigmaPio)) values[kTPCnSigmaPio]=fgPIDResponse->NumberOfSigmasTPC(particle,AliPID::kPion);
978 if(Req(kTPCnSigmaMuo)) values[kTPCnSigmaMuo]=fgPIDResponse->NumberOfSigmasTPC(particle,AliPID::kMuon);
979 if(Req(kTPCnSigmaKao)) values[kTPCnSigmaKao]=fgPIDResponse->NumberOfSigmasTPC(particle,AliPID::kKaon);
980 if(Req(kTPCnSigmaPro)) values[kTPCnSigmaPro]=fgPIDResponse->NumberOfSigmasTPC(particle,AliPID::kProton);
981
982 if(Req(kITSnSigmaEle)) values[kITSnSigmaEle]=fgPIDResponse->NumberOfSigmasITS(particle,AliPID::kElectron);
983 if(Req(kITSnSigmaPio)) values[kITSnSigmaPio]=fgPIDResponse->NumberOfSigmasITS(particle,AliPID::kPion);
984 if(Req(kITSnSigmaMuo)) values[kITSnSigmaMuo]=fgPIDResponse->NumberOfSigmasITS(particle,AliPID::kMuon);
985 if(Req(kITSnSigmaKao)) values[kITSnSigmaKao]=fgPIDResponse->NumberOfSigmasITS(particle,AliPID::kKaon);
986 if(Req(kITSnSigmaPro)) values[kITSnSigmaPro]=fgPIDResponse->NumberOfSigmasITS(particle,AliPID::kProton);
987
988 if(Req(kTOFnSigmaEle)) values[kTOFnSigmaEle]=fgPIDResponse->NumberOfSigmasTOF(particle,AliPID::kElectron);
989 if(Req(kTOFnSigmaPio)) values[kTOFnSigmaPio]=fgPIDResponse->NumberOfSigmasTOF(particle,AliPID::kPion);
990 if(Req(kTOFnSigmaMuo)) values[kTOFnSigmaMuo]=fgPIDResponse->NumberOfSigmasTOF(particle,AliPID::kMuon);
991 if(Req(kTOFnSigmaKao)) values[kTOFnSigmaKao]=fgPIDResponse->NumberOfSigmasTOF(particle,AliPID::kKaon);
992 if(Req(kTOFnSigmaPro)) values[kTOFnSigmaPro]=fgPIDResponse->NumberOfSigmasTOF(particle,AliPID::kProton);
993
994 Double_t prob[AliPID::kSPECIES]={0.0};
995 // switch computation off since it takes 70% of the CPU time for filling all AODtrack variables
996 // TODO: find a solution when this is needed (maybe at fill time in histos, CFcontainer and cut selection)
997 if( Req(kTRDprobEle) || Req(kTRDprobPio) ) fgPIDResponse->ComputeTRDProbability(particle,AliPID::kSPECIES,prob);
950294b0
JB
998 values[AliDielectronVarManager::kTRDprobEle] = prob[AliPID::kElectron];
999 values[AliDielectronVarManager::kTRDprobPio] = prob[AliPID::kPion];
a94c2e7e 1000 // if( Req(kTRDprob2DEle) || Req(kTRDprob2DPio) )
950294b0
JB
1001 // fgPIDResponse->ComputeTRDProbability(particle,AliPID::kSPECIES,prob, AliTRDPIDResponse::kLQ2D);
1002 values[AliDielectronVarManager::kTRDprob2DEle] = prob[AliPID::kElectron];
1003 values[AliDielectronVarManager::kTRDprob2DPio] = prob[AliPID::kPion];
790b92d8 1004
950294b0 1005 //restore TPC signal if it was changed
61749cc7 1006 pid->SetTPCsignal(origdEdx);
572b0139 1007 }
ba15fdfb 1008
a823f01b 1009 //EMCAL PID information
1010 Double_t eop=0;
1011 Double_t showershape[4]={0.,0.,0.,0.};
a94c2e7e 1012// if(Req()) values[AliDielectronVarManager::kEMCALnSigmaEle] = fgPIDResponse->NumberOfSigmasEMCAL(particle,AliPID::kElectron);
1013 if(Req(kEMCALnSigmaEle) || Req(kEMCALE) || Req(kEMCALEoverP) ||
1014 Req(kEMCALNCells) || Req(kEMCALM02) || Req(kEMCALM20) || Req(kEMCALDispersion))
1015 values[AliDielectronVarManager::kEMCALnSigmaEle] = fgPIDResponse->NumberOfSigmasEMCAL(particle,AliPID::kElectron,eop,showershape);
a823f01b 1016 values[AliDielectronVarManager::kEMCALEoverP] = eop;
88204efa 1017 values[AliDielectronVarManager::kEMCALE] = eop*values[AliDielectronVarManager::kP];
a823f01b 1018 values[AliDielectronVarManager::kEMCALNCells] = showershape[0];
1019 values[AliDielectronVarManager::kEMCALM02] = showershape[1];
1020 values[AliDielectronVarManager::kEMCALM20] = showershape[2];
1021 values[AliDielectronVarManager::kEMCALDispersion] = showershape[3];
1022
ba15fdfb 1023 values[AliDielectronVarManager::kPdgCode]=-1;
1024 values[AliDielectronVarManager::kPdgCodeMother]=-1;
1025 values[AliDielectronVarManager::kPdgCodeGrandMother]=-1;
1bb1fef1 1026 values[AliDielectronVarManager::kHasCocktailMother]=0;
1027 values[AliDielectronVarManager::kHasCocktailGrandMother]=0;
1028
07480df6 1029 values[AliDielectronVarManager::kNumberOfDaughters]=-1;
d191916c 1030
ba15fdfb 1031 AliDielectronMC *mc=AliDielectronMC::Instance();
ba15fdfb 1032 if (mc->HasMC()){
1bb1fef1 1033 if (mc->GetMCTrack(particle)) {
d191916c 1034 Int_t trkLbl = TMath::Abs(mc->GetMCTrack(particle)->GetLabel());
1035 values[AliDielectronVarManager::kPdgCode] =mc->GetMCTrack(particle)->PdgCode();
1036 values[AliDielectronVarManager::kHasCocktailMother] =mc->CheckParticleSource(trkLbl, AliDielectronSignalMC::kDirect);
1037 values[AliDielectronVarManager::kPdgCodeMother] =mc->GetMotherPDG(particle);
69050fc7 1038 AliAODMCParticle *motherMC=mc->GetMCTrackMother(particle); //mother
1039 if(motherMC) values[AliDielectronVarManager::kPdgCodeGrandMother]=mc->GetMotherPDG(motherMC);
ba15fdfb 1040 }
ba15fdfb 1041 values[AliDielectronVarManager::kNumberOfDaughters]=mc->NumberOfDaughters(particle);
1042 } //if(mc->HasMC())
d191916c 1043
a94c2e7e 1044 if(Req(kTOFPIDBit)) values[AliDielectronVarManager::kTOFPIDBit]=(particle->GetStatus()&AliESDtrack::kTOFpid? 1: 0);
ffcd7c9e 1045 values[AliDielectronVarManager::kLegEff]=0.0;
1046 values[AliDielectronVarManager::kOneOverLegEff]=0.0;
a94c2e7e 1047 if(Req(kLegEff) || Req(kOneOverLegEff)) {
ffcd7c9e 1048 values[AliDielectronVarManager::kLegEff] = GetSingleLegEff(values);
1049 values[AliDielectronVarManager::kOneOverLegEff] = (values[AliDielectronVarManager::kLegEff]>0.0 ? 1./values[AliDielectronVarManager::kLegEff] : 0.0);
1050 }
d4619886 1051
b2a297fa 1052}
1053
1054inline void AliDielectronVarManager::FillVarMCParticle(const AliMCParticle *particle, Double_t * const values)
1055{
1056 //
1057 // Fill track information available for histogramming into an array
1058 //
1059
554e40f8 1060 values[AliDielectronVarManager::kNclsITS] = 0;
5720c765 1061 values[AliDielectronVarManager::kITSchi2Cl] = 0;
554e40f8 1062 values[AliDielectronVarManager::kNclsTPC] = 0;
07480df6 1063 values[AliDielectronVarManager::kNclsSTPC] = 0;
1064 values[AliDielectronVarManager::kNclsSFracTPC] = 0;
554e40f8 1065 values[AliDielectronVarManager::kNclsTPCiter1] = 0;
1066 values[AliDielectronVarManager::kNFclsTPC] = 0;
fb7d2d99 1067 values[AliDielectronVarManager::kNFclsTPCr] = 0;
1068 values[AliDielectronVarManager::kNFclsTPCrFrac] = 0;
554e40f8 1069 values[AliDielectronVarManager::kNclsTRD] = 0;
1070 values[AliDielectronVarManager::kTRDntracklets] = 0;
1071 values[AliDielectronVarManager::kTRDpidQuality] = 0;
1072 values[AliDielectronVarManager::kTPCchi2Cl] = 0;
1073 values[AliDielectronVarManager::kTrackStatus] = 0;
07480df6 1074 values[AliDielectronVarManager::kFilterBit] = 0;
554e40f8 1075 values[AliDielectronVarManager::kTRDprobEle] = 0;
1076 values[AliDielectronVarManager::kTRDprobPio] = 0;
1077 values[AliDielectronVarManager::kTPCsignalN] = 0;
5720c765 1078 values[AliDielectronVarManager::kTPCclsDiff] = 0;
ba15fdfb 1079 values[AliDielectronVarManager::kTPCsignalNfrac] = 0;
554e40f8 1080 values[AliDielectronVarManager::kImpactParXY] = 0;
1081 values[AliDielectronVarManager::kImpactParZ] = 0;
1082 values[AliDielectronVarManager::kPIn] = 0;
5720c765 1083 values[AliDielectronVarManager::kYsignedIn] = 0;
554e40f8 1084 values[AliDielectronVarManager::kTPCsignal] = 0;
ba15fdfb 1085 values[AliDielectronVarManager::kTOFsignal] = 0;
1086 values[AliDielectronVarManager::kTOFbeta] = 0;
2d00c7d3 1087 values[AliDielectronVarManager::kTPCnSigmaEleRaw] = 0;
554e40f8 1088 values[AliDielectronVarManager::kTPCnSigmaEle] = 0;
1089 values[AliDielectronVarManager::kTPCnSigmaPio] = 0;
1090 values[AliDielectronVarManager::kTPCnSigmaMuo] = 0;
1091 values[AliDielectronVarManager::kTPCnSigmaKao] = 0;
1092 values[AliDielectronVarManager::kTPCnSigmaPro] = 0;
1093 values[AliDielectronVarManager::kITSclusterMap] = 0;
1094
ba15fdfb 1095 values[AliDielectronVarManager::kPdgCode] = -1;
1096 values[AliDielectronVarManager::kPdgCodeMother] = -1;
1097 values[AliDielectronVarManager::kPdgCodeGrandMother] = -1;
1bb1fef1 1098 values[AliDielectronVarManager::kHasCocktailMother]=0;
1099 values[AliDielectronVarManager::kHasCocktailGrandMother]=0;
1100
b2a297fa 1101 // Fill common AliVParticle interface information
1102 FillVarVParticle(particle, values);
1a3d9eb7 1103
d191916c 1104 // Fill AliMCParticle interface specific information
8df8e382 1105 AliDielectronMC *mc=AliDielectronMC::Instance();
d191916c 1106 Int_t trkLbl = TMath::Abs(particle->GetLabel());
1107 values[AliDielectronVarManager::kPdgCode] = particle->PdgCode();
1108 values[AliDielectronVarManager::kHasCocktailMother] = mc->CheckParticleSource(trkLbl, AliDielectronSignalMC::kDirect);
1109 values[AliDielectronVarManager::kPdgCodeMother] = mc->GetMotherPDG(particle);
69050fc7 1110 AliMCParticle *motherMC=mc->GetMCTrackMother(particle); //mother
1111 if(motherMC) values[AliDielectronVarManager::kPdgCodeGrandMother]=mc->GetMotherPDG(motherMC);
1112
8df8e382 1113
fb7d2d99 1114 values[AliDielectronVarManager::kIsJpsiPrimary] = mc->IsJpsiPrimary(particle);
8df8e382 1115 values[AliDielectronVarManager::kNumberOfDaughters]=mc->NumberOfDaughters(particle);
b2a297fa 1116}
1117
ba15fdfb 1118
1119inline void AliDielectronVarManager::FillVarMCParticle2(const AliVParticle *p1, const AliVParticle *p2, Double_t * const values) {
1120 //
1121 // fill 2 track information starting from MC legs
1122 //
1123
1124 values[AliDielectronVarManager::kNclsITS] = 0;
5720c765 1125 values[AliDielectronVarManager::kITSchi2Cl] = -1;
ba15fdfb 1126 values[AliDielectronVarManager::kNclsTPC] = 0;
5720c765 1127 values[AliDielectronVarManager::kNclsSTPC] = 0;
1128 values[AliDielectronVarManager::kNclsSFracTPC] = 0;
ba15fdfb 1129 values[AliDielectronVarManager::kNclsTPCiter1] = 0;
1130 values[AliDielectronVarManager::kNFclsTPC] = 0;
1131 values[AliDielectronVarManager::kNFclsTPCr] = 0;
1132 values[AliDielectronVarManager::kNFclsTPCrFrac] = 0;
1133 values[AliDielectronVarManager::kNclsTRD] = 0;
1134 values[AliDielectronVarManager::kTRDntracklets] = 0;
1135 values[AliDielectronVarManager::kTRDpidQuality] = 0;
1136 values[AliDielectronVarManager::kTPCchi2Cl] = 0;
1137 values[AliDielectronVarManager::kTrackStatus] = 0;
07480df6 1138 values[AliDielectronVarManager::kFilterBit] = 0;
ba15fdfb 1139 values[AliDielectronVarManager::kTRDprobEle] = 0;
1140 values[AliDielectronVarManager::kTRDprobPio] = 0;
1141 values[AliDielectronVarManager::kTPCsignalN] = 0;
5720c765 1142 values[AliDielectronVarManager::kTPCclsDiff] = 0;
ba15fdfb 1143 values[AliDielectronVarManager::kTPCsignalNfrac] = 0;
1144 values[AliDielectronVarManager::kImpactParXY] = 0;
1145 values[AliDielectronVarManager::kImpactParZ] = 0;
1146 values[AliDielectronVarManager::kPIn] = 0;
5720c765 1147 values[AliDielectronVarManager::kYsignedIn] = 0;
ba15fdfb 1148 values[AliDielectronVarManager::kTPCsignal] = 0;
2d00c7d3 1149 values[AliDielectronVarManager::kTPCnSigmaEleRaw] = 0;
ba15fdfb 1150 values[AliDielectronVarManager::kTPCnSigmaEle] = 0;
1151 values[AliDielectronVarManager::kTPCnSigmaPio] = 0;
1152 values[AliDielectronVarManager::kTPCnSigmaMuo] = 0;
1153 values[AliDielectronVarManager::kTPCnSigmaKao] = 0;
1154 values[AliDielectronVarManager::kTPCnSigmaPro] = 0;
1155 values[AliDielectronVarManager::kITSclusterMap] = 0;
1156
d191916c 1157 values[AliDielectronVarManager::kPdgCode] = -1;
1158 values[AliDielectronVarManager::kPdgCodeMother] = -1;
1bb1fef1 1159 values[AliDielectronVarManager::kHasCocktailMother]=0;
ba15fdfb 1160
1161 AliDielectronMC *mc=AliDielectronMC::Instance();
1162 AliVParticle* mother=0x0;
1163 Int_t mLabel1 = mc->GetMothersLabel(p1->GetLabel());
1164 Int_t mLabel2 = mc->GetMothersLabel(p2->GetLabel());
1165 if(mLabel1==mLabel2)
1166 mother = mc->GetMCTrackFromMCEvent(mLabel1);
5720c765 1167
1168 values[AliDielectronVarManager::kPseudoProperTime] = -2e10;
1169 if(mother) { // same mother
ba15fdfb 1170 FillVarVParticle(mother, values);
4533e78e 1171 Double_t vtxX, vtxY, vtxZ;
1172 mc->GetPrimaryVertex(vtxX,vtxY,vtxZ);
1173 Double_t lxy = ((mother->Xv()- vtxX) * mother->Px() +
1174 (mother->Yv()- vtxY) * mother->Py() )/mother->Pt();
5720c765 1175 values[AliDielectronVarManager::kPseudoProperTime] = lxy*(TDatabasePDG::Instance()->GetParticle(443)->Mass())/mother->Pt();
1176 }
213ceb97 1177 // AliVParticle part
1178 values[AliDielectronVarManager::kPx] = p1->Px()+p2->Px();
1179 values[AliDielectronVarManager::kPy] = p1->Py()+p2->Py();
1180 values[AliDielectronVarManager::kPz] = p1->Pz()+p2->Pz();
1181 values[AliDielectronVarManager::kPt] = TMath::Sqrt(values[AliDielectronVarManager::kPx]*
1182 values[AliDielectronVarManager::kPx]+
1183 values[AliDielectronVarManager::kPy]*
1184 values[AliDielectronVarManager::kPy]);
87a7c4b0 1185 values[AliDielectronVarManager::kPtSq] = values[AliDielectronVarManager::kPt] * values[AliDielectronVarManager::kPt];
213ceb97 1186 values[AliDielectronVarManager::kP] = TMath::Sqrt(values[AliDielectronVarManager::kPt]*
1187 values[AliDielectronVarManager::kPt]+
1188 values[AliDielectronVarManager::kPz]*
1189 values[AliDielectronVarManager::kPz]);
ba15fdfb 1190
213ceb97 1191 values[AliDielectronVarManager::kXv] = 0;
1192 values[AliDielectronVarManager::kYv] = 0;
1193 values[AliDielectronVarManager::kZv] = 0;
ba15fdfb 1194
213ceb97 1195 values[AliDielectronVarManager::kOneOverPt] = (values[AliDielectronVarManager::kPt]>1.0e-6 ? 1.0/values[AliDielectronVarManager::kPt] : 0.0);
1196 values[AliDielectronVarManager::kPhi] = TMath::ATan2(values[AliDielectronVarManager::kPy],values[AliDielectronVarManager::kPx]);
1197 values[AliDielectronVarManager::kTheta] = TMath::ATan2(values[AliDielectronVarManager::kPt],values[AliDielectronVarManager::kPz]);
1198 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.);
1199 values[AliDielectronVarManager::kE] = p1->E()+p2->E();
1200 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.);
1201 values[AliDielectronVarManager::kCharge] = p1->Charge()+p2->Charge();
1202
88e9bae6 1203 values[AliDielectronVarManager::kM] = p1->M()*p1->M()+p2->M()*p2->M()+
1204 2.0*(p1->E()*p2->E()-p1->Px()*p2->Px()-p1->Py()*p2->Py()-p1->Pz()*p2->Pz());
1205 values[AliDielectronVarManager::kM] = (values[AliDielectronVarManager::kM]>1.0e-8 ? TMath::Sqrt(values[AliDielectronVarManager::kM]) : -1.0);
ba15fdfb 1206
213ceb97 1207 if ( fgEvent ) AliDielectronVarManager::Fill(fgEvent, values);
a823f01b 1208
5720c765 1209 values[AliDielectronVarManager::kThetaHE] = AliDielectronPair::ThetaPhiCM(p1,p2,kTRUE, kTRUE);
1210 values[AliDielectronVarManager::kPhiHE] = AliDielectronPair::ThetaPhiCM(p1,p2,kTRUE, kFALSE);
1762f182 1211 values[AliDielectronVarManager::kThetaSqHE] = values[AliDielectronVarManager::kThetaHE] * values[AliDielectronVarManager::kThetaHE];
5720c765 1212 values[AliDielectronVarManager::kCos2PhiHE] = TMath::Cos(2*values[AliDielectronVarManager::kPhiHE]);
1213 values[AliDielectronVarManager::kThetaCS] = AliDielectronPair::ThetaPhiCM(p1,p2,kFALSE, kTRUE);
1214 values[AliDielectronVarManager::kPhiCS] = AliDielectronPair::ThetaPhiCM(p1,p2,kFALSE, kFALSE);
1762f182 1215 values[AliDielectronVarManager::kThetaSqCS] = values[AliDielectronVarManager::kThetaCS] * values[AliDielectronVarManager::kThetaCS];
5720c765 1216 values[AliDielectronVarManager::kCos2PhiCS] = TMath::Cos(2*values[AliDielectronVarManager::kPhiCS]);
8d7a07b9 1217 values[AliDielectronVarManager::kCosTilPhiHE] = (values[AliDielectronVarManager::kThetaHE]>0)?(TMath::Cos(values[AliDielectronVarManager::kPhiHE]-TMath::Pi()/4.)):(TMath::Cos(values[AliDielectronVarManager::kPhiHE]-3*TMath::Pi()/4.));
1218 values[AliDielectronVarManager::kCosTilPhiCS] = (values[AliDielectronVarManager::kThetaCS]>0)?(TMath::Cos(values[AliDielectronVarManager::kPhiCS]-TMath::Pi()/4.)):(TMath::Cos(values[AliDielectronVarManager::kPhiCS]-3*TMath::Pi()/4.));
ba15fdfb 1219}
1220
1221
b2a297fa 1222inline void AliDielectronVarManager::FillVarAODMCParticle(const AliAODMCParticle *particle, Double_t * const values)
1223{
1224 //
1225 // Fill track information available for histogramming into an array
1226 //
1227
554e40f8 1228 values[AliDielectronVarManager::kNclsITS] = 0;
5720c765 1229 values[AliDielectronVarManager::kITSchi2Cl] = -1;
554e40f8 1230 values[AliDielectronVarManager::kNclsTPC] = 0;
5720c765 1231 values[AliDielectronVarManager::kNclsSTPC] = 0;
1232 values[AliDielectronVarManager::kNclsSFracTPC] = 0;
554e40f8 1233 values[AliDielectronVarManager::kNclsTPCiter1] = 0;
1234 values[AliDielectronVarManager::kNFclsTPC] = 0;
1235 values[AliDielectronVarManager::kNclsTRD] = 0;
1236 values[AliDielectronVarManager::kTRDntracklets] = 0;
1237 values[AliDielectronVarManager::kTRDpidQuality] = 0;
1238 values[AliDielectronVarManager::kTPCchi2Cl] = 0;
1239 values[AliDielectronVarManager::kTrackStatus] = 0;
07480df6 1240 values[AliDielectronVarManager::kFilterBit] = 0;
554e40f8 1241 values[AliDielectronVarManager::kTRDprobEle] = 0;
1242 values[AliDielectronVarManager::kTRDprobPio] = 0;
1243 values[AliDielectronVarManager::kTPCsignalN] = 0;
5720c765 1244 values[AliDielectronVarManager::kTPCclsDiff] = 0;
ba15fdfb 1245 values[AliDielectronVarManager::kTPCsignalNfrac]= 0;
554e40f8 1246 values[AliDielectronVarManager::kImpactParXY] = 0;
1247 values[AliDielectronVarManager::kImpactParZ] = 0;
1248 values[AliDielectronVarManager::kPIn] = 0;
5720c765 1249 values[AliDielectronVarManager::kYsignedIn] = 0;
554e40f8 1250 values[AliDielectronVarManager::kTPCsignal] = 0;
2d00c7d3 1251 values[AliDielectronVarManager::kTPCnSigmaEleRaw] = 0;
554e40f8 1252 values[AliDielectronVarManager::kTPCnSigmaEle] = 0;
1253 values[AliDielectronVarManager::kTPCnSigmaPio] = 0;
1254 values[AliDielectronVarManager::kTPCnSigmaMuo] = 0;
1255 values[AliDielectronVarManager::kTPCnSigmaKao] = 0;
1256 values[AliDielectronVarManager::kTPCnSigmaPro] = 0;
1257 values[AliDielectronVarManager::kITSclusterMap] = 0;
1258
ba15fdfb 1259 values[AliDielectronVarManager::kPdgCode] = -1;
1260 values[AliDielectronVarManager::kPdgCodeMother] = -1;
1261 values[AliDielectronVarManager::kPdgCodeGrandMother] = -1;
1bb1fef1 1262 values[AliDielectronVarManager::kHasCocktailMother]=0;
1263 values[AliDielectronVarManager::kHasCocktailGrandMother]=0;
1264
b2a297fa 1265 // Fill common AliVParticle interface information
1266 FillVarVParticle(particle, values);
8df8e382 1267
b2a297fa 1268 // Fill AliAODMCParticle interface specific information
d191916c 1269 AliDielectronMC *mc=AliDielectronMC::Instance();
1270 Int_t trkLbl = TMath::Abs(particle->GetLabel());
1271 values[AliDielectronVarManager::kPdgCode] = particle->PdgCode();
1272 values[AliDielectronVarManager::kHasCocktailMother] = mc->CheckParticleSource(trkLbl, AliDielectronSignalMC::kDirect);
1273 values[AliDielectronVarManager::kPdgCodeMother] = mc->GetMotherPDG(particle);
69050fc7 1274 AliAODMCParticle *motherMC=mc->GetMCTrackMother(particle); //mother
1275 if(motherMC) values[AliDielectronVarManager::kPdgCodeGrandMother]=mc->GetMotherPDG(motherMC);
1276
d191916c 1277 values[AliDielectronVarManager::kIsJpsiPrimary] = mc->IsJpsiPrimary(particle);
8df8e382 1278 values[AliDielectronVarManager::kNumberOfDaughters]=mc->NumberOfDaughters(particle);
1a3d9eb7 1279
1280 // using AODMCHEader information
1281 AliAODMCHeader *mcHeader = (AliAODMCHeader*)fgEvent->FindListObject(AliAODMCHeader::StdBranchName());
1282 if(mcHeader) {
1283 values[AliDielectronVarManager::kImpactParZ] = mcHeader->GetVtxZ()-particle->Zv();
1284 values[AliDielectronVarManager::kImpactParXY] = TMath::Sqrt(TMath::Power(mcHeader->GetVtxX()-particle->Xv(),2) +
1285 TMath::Power(mcHeader->GetVtxY()-particle->Yv(),2));
1286 }
1287
b2a297fa 1288}
1289
1290inline void AliDielectronVarManager::FillVarDielectronPair(const AliDielectronPair *pair, Double_t * const values)
1291{
1292 //
1293 // Fill pair information available for histogramming into an array
1294 //
2a14a7b1 1295
ba15fdfb 1296 values[AliDielectronVarManager::kPdgCode]=-1;
1297 values[AliDielectronVarManager::kPdgCodeMother]=-1;
1298 values[AliDielectronVarManager::kPdgCodeGrandMother]=-1;
1bb1fef1 1299 values[AliDielectronVarManager::kHasCocktailMother]=0;
1300 values[AliDielectronVarManager::kHasCocktailGrandMother]=0;
08b801a6 1301
1302 Double_t errPseudoProperTime2 = -1;
b2a297fa 1303 // Fill common AliVParticle interface information
1304 FillVarVParticle(pair, values);
1305
1306 // Fill AliDielectronPair specific information
1307 const AliKFParticle &kfPair = pair->GetKFParticle();
61d106d3 1308
a94c2e7e 1309
1310 values[AliDielectronVarManager::kThetaHE] = 0.0;
1311 values[AliDielectronVarManager::kPhiHE] = 0.0;
1312 values[AliDielectronVarManager::kThetaSqHE] = 0.0;
1313 values[AliDielectronVarManager::kCos2PhiHE] = 0.0;
1314 values[AliDielectronVarManager::kCosTilPhiHE] = 0.0;
1315
1316 values[AliDielectronVarManager::kThetaCS] = 0.0;
1317 values[AliDielectronVarManager::kPhiCS] = 0.0;
1318 values[AliDielectronVarManager::kThetaSqCS] = 0.0;
1319 values[AliDielectronVarManager::kCos2PhiCS] = 0.0;
1320 values[AliDielectronVarManager::kCosTilPhiCS] = 0.0;
1321
61d106d3 1322 Double_t thetaHE=0;
1323 Double_t phiHE=0;
1324 Double_t thetaCS=0;
1325 Double_t phiCS=0;
a94c2e7e 1326 if(Req(kThetaHE) || Req(kPhiHE) || Req(kThetaCS) || Req(kPhiCS)) {
1327 pair->GetThetaPhiCM(thetaHE,phiHE,thetaCS,phiCS);
1328
1329 values[AliDielectronVarManager::kThetaHE] = thetaHE;
1330 values[AliDielectronVarManager::kPhiHE] = phiHE;
1331 values[AliDielectronVarManager::kThetaSqHE] = thetaHE * thetaHE;
1332 values[AliDielectronVarManager::kCos2PhiHE] = TMath::Cos(2.0*phiHE);
1333 values[AliDielectronVarManager::kCosTilPhiHE] = (thetaHE>0)?(TMath::Cos(phiHE-TMath::Pi()/4.)):(TMath::Cos(phiHE-3*TMath::Pi()/4.));
1334 values[AliDielectronVarManager::kThetaCS] = thetaCS;
1335 values[AliDielectronVarManager::kPhiCS] = phiCS;
1336 values[AliDielectronVarManager::kThetaSqCS] = thetaCS * thetaCS;
1337 values[AliDielectronVarManager::kCos2PhiCS] = TMath::Cos(2.0*phiCS);
1338 values[AliDielectronVarManager::kCosTilPhiCS] = (thetaCS>0)?(TMath::Cos(phiCS-TMath::Pi()/4.)):(TMath::Cos(phiCS-3*TMath::Pi()/4.));
1339 }
1340
1341 if(Req(kChi2NDF)) values[AliDielectronVarManager::kChi2NDF] = kfPair.GetChi2()/kfPair.GetNDF();
1342 if(Req(kDecayLength)) values[AliDielectronVarManager::kDecayLength] = kfPair.GetDecayLength();
1343 if(Req(kR)) values[AliDielectronVarManager::kR] = kfPair.GetR();
1344 if(Req(kOpeningAngle)) values[AliDielectronVarManager::kOpeningAngle] = pair->OpeningAngle();
1345 if(Req(kCosPointingAngle)) values[AliDielectronVarManager::kCosPointingAngle] = fgEvent ? pair->GetCosPointingAngle(fgEvent->GetPrimaryVertex()) : -1;
1346
1347 if(Req(kLegDist)) values[AliDielectronVarManager::kLegDist] = pair->DistanceDaughters();
1348 if(Req(kLegDistXY)) values[AliDielectronVarManager::kLegDistXY] = pair->DistanceDaughtersXY();
1349 if(Req(kDeltaEta)) values[AliDielectronVarManager::kDeltaEta] = pair->DeltaEta();
1350 if(Req(kDeltaPhi)) values[AliDielectronVarManager::kDeltaPhi] = pair->DeltaPhi();
1351 if(Req(kMerr)) values[AliDielectronVarManager::kMerr] = kfPair.GetErrMass()>1e-30&&kfPair.GetMass()>1e-30?kfPair.GetErrMass()/kfPair.GetMass():1000000;
61d106d3 1352
b2a297fa 1353 values[AliDielectronVarManager::kPairType] = pair->GetType();
99345a64 1354 // Armenteros-Podolanski quantities
a94c2e7e 1355 if(Req(kArmAlpha)) values[AliDielectronVarManager::kArmAlpha] = pair->GetArmAlpha();
1356 if(Req(kArmPt)) values[AliDielectronVarManager::kArmPt] = pair->GetArmPt();
1357
1358 if(Req(kPsiPair)) values[AliDielectronVarManager::kPsiPair] = fgEvent ? pair->PsiPair(fgEvent->GetMagneticField()) : -5;
1359 if(Req(kPhivPair)) values[AliDielectronVarManager::kPhivPair] = fgEvent ? pair->PhivPair(fgEvent->GetMagneticField()) : -5;
1360 if(Req(kPseudoProperTime) || Req(kPseudoProperTimeErr)) {
1361 values[AliDielectronVarManager::kPseudoProperTime] =
1362 fgEvent ? kfPair.GetPseudoProperDecayTime(*(fgEvent->GetPrimaryVertex()), TDatabasePDG::Instance()->GetParticle(443)->Mass(), &errPseudoProperTime2 ) : -1e10;
5720c765 1363 // values[AliDielectronVarManager::kPseudoProperTime] = fgEvent ? pair->GetPseudoProperTime(fgEvent->GetPrimaryVertex()): -1e10;
a94c2e7e 1364 values[AliDielectronVarManager::kPseudoProperTimeErr] = (errPseudoProperTime2 > 0) ? TMath::Sqrt(errPseudoProperTime2) : -1e10;
1365 }
5720c765 1366
1598d580 1367 // impact parameter
a94c2e7e 1368 Double_t d0z0[2]={-999., -999.};
1369 if( (Req(kImpactParXY) || Req(kImpactParZ)) && fgEvent) pair->GetDCA(fgEvent->GetPrimaryVertex(), d0z0);
1598d580
JB
1370 values[AliDielectronVarManager::kImpactParXY] = d0z0[0];
1371 values[AliDielectronVarManager::kImpactParZ] = d0z0[1];
1372
08b801a6 1373
1374 if (!(pair->GetKFUsage())) {
1375 //if KF Pairing is not enabled, overwrite values that can be easily derived from legs
1376 //use the INDIVIDUAL KF particles as source, which should be a copy of the corresponding properties
1377 //the ESDtrack, the reference to the ESDtrack is not (always) accessible in Mixing, while KF
1378 //particles are copied in the Pair-Object
1379 static const Double_t mElectron = AliPID::ParticleMass(AliPID::kElectron); // MeV
1380
1381 const AliKFParticle& fD1 = pair->GetKFFirstDaughter();
1382 const AliKFParticle& fD2 = pair->GetKFSecondDaughter();
1383
1384 //Define local buffer variables for leg properties
1385 Double_t px1=-9999.,py1=-9999.,pz1=-9999.;
1386 Double_t px2=-9999.,py2=-9999.,pz2=-9999.;
1387 Double_t e1 =-9999.,e2 =-9999.;
20b6b7d4 1388 Double_t feta1=-9999.;//,fphi1=-9999.;
1389 Double_t feta2=-9999.;//,fphi2=-9999.;
08b801a6 1390
1391 px1 = fD1.GetPx();
1392 py1 = fD1.GetPy();
1393 pz1 = fD1.GetPz();
1394 feta1 = fD1.GetEta();
20b6b7d4 1395 // fphi1 = fD1.GetPhi();
08b801a6 1396
1397 px2 = fD2.GetPx();
1398 py2 = fD2.GetPy();
1399 pz2 = fD2.GetPz();
1400 feta2 = fD2.GetEta();
20b6b7d4 1401 // fphi2 = fD2.GetPhi();
08b801a6 1402
1403 //Calculate Energy per particle by hand
1404 e1 = TMath::Sqrt(mElectron*mElectron+px1*px1+py1*py1+pz1*pz1);
1405 e2 = TMath::Sqrt(mElectron*mElectron+px2*px2+py2*py2+pz2*pz2);
1406
1407 //Now Create TLorentzVector:
1408 TLorentzVector lv1,lv2;
1409 lv1.SetPxPyPzE(px1,py1,pz1,e1);
1410 lv2.SetPxPyPzE(px2,py2,pz2,e2);
1411
1412 values[AliDielectronVarManager::kPx] = (lv1+lv2).Px();
1413 values[AliDielectronVarManager::kPy] = (lv1+lv2).Py();
1414 values[AliDielectronVarManager::kPz] = (lv1+lv2).Pz();
1415
1416 values[AliDielectronVarManager::kPt] = (lv1+lv2).Pt();
87a7c4b0 1417 values[AliDielectronVarManager::kPtSq] = values[AliDielectronVarManager::kPt] * values[AliDielectronVarManager::kPt];
08b801a6 1418
1419 values[AliDielectronVarManager::kP] = (lv1+lv2).P();
1420
1421 //Not overwritten, could take event vertex in next iteration
1422 values[AliDielectronVarManager::kXv] = (lv1+lv2).X();
1423 values[AliDielectronVarManager::kYv] = (lv1+lv2).Y();
1424 values[AliDielectronVarManager::kZv] = (lv1+lv2).Z();
1425
1426 values[AliDielectronVarManager::kE] = (lv1+lv2).E();
1427
1428
1429 values[AliDielectronVarManager::kM] = (lv1+lv2).M();
1430
1431 values[AliDielectronVarManager::kOpeningAngle] = lv1.Angle(lv2.Vect());
1432
1433 values[AliDielectronVarManager::kOneOverPt] = (values[AliDielectronVarManager::kPt]>0. ? 1./values[AliDielectronVarManager::kPt] : -9999.);
d4619886 1434 values[AliDielectronVarManager::kPhi] = (lv1+lv2).Phi()+TMath::Pi(); // change interval to [0,+2pi]
08b801a6 1435 values[AliDielectronVarManager::kEta] = (lv1+lv2).Eta();
1436
1437 values[AliDielectronVarManager::kY] = (lv1+lv2).Rapidity();
1438
1439 for (Int_t i=AliDielectronVarManager::kPairMax; i<AliDielectronVarManager::kNMaxValues; ++i)
1440 values[i]=fgData[i];
1441
1442 // Fill AliDielectronPair specific information
1443 values[AliDielectronVarManager::kDeltaEta] = TMath::Abs(feta1 -feta2 );
1444 values[AliDielectronVarManager::kDeltaPhi] = lv1.DeltaPhi(lv2);
1445 values[AliDielectronVarManager::kPairType] = pair->GetType();
1446
1447 /*
1448 //Also not overwritten, still coming from KF particle
1449 //where needed to be replaced by independent determination
1450 values[AliDielectronVarManager::kCharge] = 0.;
1451 values[AliDielectronVarManager::kPdgCode] = 0.;
1452 values[AliDielectronVarManager::kChi2NDF] = 0.;
1453 values[AliDielectronVarManager::kDecayLength] = 0.;
1454 values[AliDielectronVarManager::kR] = 0.;
1455 values[AliDielectronVarManager::kCosPointingAngle] = 0.;
1456 values[AliDielectronVarManager::kThetaHE] = 0.;
1457 values[AliDielectronVarManager::kPhiHE] = 0.;
1458 values[AliDielectronVarManager::kThetaSqHE] = 0.;
1459 values[AliDielectronVarManager::kCos2PhiHE] = 0.;
1460 values[AliDielectronVarManager::kCosTilPhiHE] = 0.;
1461 values[AliDielectronVarManager::kThetaCS] = 0.;
1462 values[AliDielectronVarManager::kPhiCS] = 0.;
1463 values[AliDielectronVarManager::kThetaSqCS] = 0.;
1464 values[AliDielectronVarManager::kCos2PhiCS] = 0.;
1465 values[AliDielectronVarManager::kCosTilPhiCS] = 0.;
1466 values[AliDielectronVarManager::kLegDist] = 0.;
1467 values[AliDielectronVarManager::kLegDistXY] = 0.;
1468 values[AliDielectronVarManager::kMerr] = 0.;
1469 values[AliDielectronVarManager::kPseudoProperTime] = 0.;
1470 values[AliDielectronVarManager::kPseudoProperTimeErr] = 0.;
1471 //Fill in Taku's PhiV?
1472 values[AliDielectronVarManager::kPsiPair] = 0.;
1473
1474 */
08b801a6 1475 }
1476 //common, regardless of calculation method
c081415a 1477
1478 // Flow quantities
a94c2e7e 1479 Double_t phi=values[AliDielectronVarManager::kPhi];
1480 if(Req(kCosPhiH2)) values[AliDielectronVarManager::kCosPhiH2] = TMath::Cos(2*phi);
1481 if(Req(kSinPhiH2)) values[AliDielectronVarManager::kSinPhiH2] = TMath::Sin(2*phi);
5720c765 1482 Double_t delta=0.0;
1483 // v2 with respect to VZERO-A event plane
a94c2e7e 1484 delta = phi - fgData[AliDielectronVarManager::kV0ArpH2];
5720c765 1485 if(delta>TMath::Pi()) delta -= 2.0*TMath::Pi(); // keep the [-pi,+pi] interval
1486 if(delta<-1.0*TMath::Pi()) delta += 2.0*TMath::Pi();
a94c2e7e 1487 if(Req(kV0ArpH2FlowV2)) values[AliDielectronVarManager::kV0ArpH2FlowV2] = TMath::Cos(2.0*delta); // 2nd harmonic flow coefficient
1488 if(Req(kDeltaPhiV0ArpH2)) values[AliDielectronVarManager::kDeltaPhiV0ArpH2] = delta;
5720c765 1489 // v2 with respect to VZERO-C event plane
a94c2e7e 1490 delta = phi - fgData[AliDielectronVarManager::kV0CrpH2];
5720c765 1491 if(delta>TMath::Pi()) delta -= 2.0*TMath::Pi(); // keep the [-pi,+pi] interval
1492 if(delta<-1.0*TMath::Pi()) delta += 2.0*TMath::Pi();
a94c2e7e 1493 if(Req(kV0CrpH2FlowV2)) values[AliDielectronVarManager::kV0CrpH2FlowV2] = TMath::Cos(2.0*delta); // 2nd harmonic flow coefficient
1494 if(Req(kDeltaPhiV0CrpH2)) values[AliDielectronVarManager::kDeltaPhiV0CrpH2] = delta;
5720c765 1495 // v2 with respect to the combined VZERO-A and VZERO-C event plane
a94c2e7e 1496 delta = phi - fgData[AliDielectronVarManager::kV0ACrpH2];
5720c765 1497 if(delta>TMath::Pi()) delta -= 2.0*TMath::Pi(); // keep the [-pi,+pi] interval
1498 if(delta<-1.0*TMath::Pi()) delta += 2.0*TMath::Pi();
a94c2e7e 1499 if(Req(kV0ACrpH2FlowV2)) values[AliDielectronVarManager::kV0ACrpH2FlowV2] = TMath::Cos(2.0*delta); // 2nd harmonic flow coefficient
1500 if(Req(kDeltaPhiV0ACrpH2)) values[AliDielectronVarManager::kDeltaPhiV0ACrpH2] = delta;
5720c765 1501
a3cde8ca 1502
1503 // quantities using the values of AliEPSelectionTask
a94c2e7e 1504 values[AliDielectronVarManager::kDeltaPhiv0ArpH2] = phi - values[AliDielectronVarManager::kv0ArpH2];
1505 values[AliDielectronVarManager::kDeltaPhiv0CrpH2] = phi - values[AliDielectronVarManager::kv0CrpH2];
1506 values[AliDielectronVarManager::kDeltaPhiv0ACrpH2] = phi - values[AliDielectronVarManager::kv0ACrpH2];
1507 values[AliDielectronVarManager::kDeltaPhiTPCrpH2] = phi - values[AliDielectronVarManager::kTPCrpH2];
1508 values[AliDielectronVarManager::kv0ACrpH2FlowV2] = TMath::Cos( 2*(phi - values[AliDielectronVarManager::kv0ACrpH2]) );
1509 values[AliDielectronVarManager::kv0ArpH2FlowV2] = TMath::Cos( 2*(phi - values[AliDielectronVarManager::kv0ArpH2]) );
1510 values[AliDielectronVarManager::kv0CrpH2FlowV2] = TMath::Cos( 2*(phi - values[AliDielectronVarManager::kv0CrpH2]) );
1511 values[AliDielectronVarManager::kTPCrpH2FlowV2] = TMath::Cos( 2*(phi - values[AliDielectronVarManager::kTPCrpH2]) );
1512 values[AliDielectronVarManager::kTPCrpH2FlowV2Sin] = TMath::Sin( 2*(phi - values[AliDielectronVarManager::kTPCrpH2]) );
c081415a 1513
c315310a 1514
1515 // keep the interval [-pi,+pi]
a94c2e7e 1516 if ( values[kDeltaPhiv0ArpH2] > TMath::Pi() ) values[kDeltaPhiv0ArpH2] -= TMath::TwoPi();
1517 if ( values[kDeltaPhiv0CrpH2] > TMath::Pi() ) values[kDeltaPhiv0CrpH2] -= TMath::TwoPi();
1518 if ( values[kDeltaPhiv0ACrpH2] > TMath::Pi() ) values[kDeltaPhiv0ACrpH2] -= TMath::TwoPi();
1519 if ( values[kDeltaPhiTPCrpH2] > TMath::Pi() ) values[kDeltaPhiTPCrpH2] -= TMath::TwoPi();
1520
1521 if ( values[kDeltaPhiv0ArpH2] < -1.*TMath::Pi() ) values[kDeltaPhiv0ArpH2] += TMath::TwoPi();
1522 if ( values[kDeltaPhiv0CrpH2] < -1.*TMath::Pi() ) values[kDeltaPhiv0CrpH2] += TMath::TwoPi();
1523 if ( values[kDeltaPhiv0ACrpH2] < -1.*TMath::Pi() ) values[kDeltaPhiv0ACrpH2] += TMath::TwoPi();
1524 if ( values[kDeltaPhiTPCrpH2] < -1.*TMath::Pi() ) values[kDeltaPhiTPCrpH2] += TMath::TwoPi();
a3cde8ca 1525
36a1e727 1526 //calculate inner product of strong Mag and ee plane
a94c2e7e 1527 if(Req(kPairPlaneMagInPro)) values[AliDielectronVarManager::kPairPlaneMagInPro] = pair->PairPlaneMagInnerProduct(values[AliDielectronVarManager::kZDCACrpH1]);
36a1e727 1528
ad89b5bf 1529 //Calculate the angle between electrons decay plane and variables 1-4
a94c2e7e 1530 if(Req(kPairPlaneAngle1A)) values[AliDielectronVarManager::kPairPlaneAngle1A] = pair->GetPairPlaneAngle(values[kv0ArpH2],1);
1531 if(Req(kPairPlaneAngle2A)) values[AliDielectronVarManager::kPairPlaneAngle2A] = pair->GetPairPlaneAngle(values[kv0ArpH2],2);
1532 if(Req(kPairPlaneAngle3A)) values[AliDielectronVarManager::kPairPlaneAngle3A] = pair->GetPairPlaneAngle(values[kv0ArpH2],3);
1533 if(Req(kPairPlaneAngle4A)) values[AliDielectronVarManager::kPairPlaneAngle4A] = pair->GetPairPlaneAngle(values[kv0ArpH2],4);
ad89b5bf 1534
a94c2e7e 1535 if(Req(kPairPlaneAngle1C)) values[AliDielectronVarManager::kPairPlaneAngle1C] = pair->GetPairPlaneAngle(values[kv0CrpH2],1);
1536 if(Req(kPairPlaneAngle2C)) values[AliDielectronVarManager::kPairPlaneAngle2C] = pair->GetPairPlaneAngle(values[kv0CrpH2],2);
1537 if(Req(kPairPlaneAngle3C)) values[AliDielectronVarManager::kPairPlaneAngle3C] = pair->GetPairPlaneAngle(values[kv0CrpH2],3);
1538 if(Req(kPairPlaneAngle4C)) values[AliDielectronVarManager::kPairPlaneAngle4C] = pair->GetPairPlaneAngle(values[kv0CrpH2],4);
ad89b5bf 1539
a94c2e7e 1540 if(Req(kPairPlaneAngle1AC)) values[AliDielectronVarManager::kPairPlaneAngle1AC] = pair->GetPairPlaneAngle(values[kv0ACrpH2],1);
1541 if(Req(kPairPlaneAngle2AC)) values[AliDielectronVarManager::kPairPlaneAngle2AC] = pair->GetPairPlaneAngle(values[kv0ACrpH2],2);
1542 if(Req(kPairPlaneAngle3AC)) values[AliDielectronVarManager::kPairPlaneAngle3AC] = pair->GetPairPlaneAngle(values[kv0ACrpH2],3);
1543 if(Req(kPairPlaneAngle4AC)) values[AliDielectronVarManager::kPairPlaneAngle4AC] = pair->GetPairPlaneAngle(values[kv0ACrpH2],4);
ad89b5bf
JB
1544
1545 //Random reaction plane
1546 values[AliDielectronVarManager::kRandomRP] = gRandom->Uniform(-TMath::Pi()/2.0,TMath::Pi()/2.0);
1547 //delta phi of pair fron random reaction plane
a94c2e7e 1548 values[AliDielectronVarManager::kDeltaPhiRandomRP] = phi - values[kRandomRP];
ad89b5bf
JB
1549 // keep the interval [-pi,+pi]
1550 if ( values[AliDielectronVarManager::kDeltaPhiRandomRP] > TMath::Pi() )
1551 values[AliDielectronVarManager::kDeltaPhiRandomRP] -= TMath::TwoPi();
1552
a94c2e7e 1553 if(Req(kPairPlaneAngle1Ran)) values[AliDielectronVarManager::kPairPlaneAngle1Ran]= pair->GetPairPlaneAngle(values[kRandomRP],1);
1554 if(Req(kPairPlaneAngle2Ran)) values[AliDielectronVarManager::kPairPlaneAngle2Ran]= pair->GetPairPlaneAngle(values[kRandomRP],2);
1555 if(Req(kPairPlaneAngle3Ran)) values[AliDielectronVarManager::kPairPlaneAngle3Ran]= pair->GetPairPlaneAngle(values[kRandomRP],3);
1556 if(Req(kPairPlaneAngle4Ran)) values[AliDielectronVarManager::kPairPlaneAngle4Ran]= pair->GetPairPlaneAngle(values[kRandomRP],4);
ad89b5bf 1557
b2ad74d0 1558
c315310a 1559
8df8e382 1560 AliDielectronMC *mc=AliDielectronMC::Instance();
1561
1562 if (mc->HasMC()){
5720c765 1563 values[AliDielectronVarManager::kPseudoProperTimeResolution] = -10.0e+10;
ba15fdfb 1564 Bool_t samemother = mc->HaveSameMother(pair);
1565 values[AliDielectronVarManager::kIsJpsiPrimary] = mc->IsJpsiPrimary(pair);
1566 values[AliDielectronVarManager::kHaveSameMother] = samemother ;
5720c765 1567
1bb1fef1 1568 // fill kPseudoProperTimeResolution
5720c765 1569 values[AliDielectronVarManager::kPseudoProperTimeResolution] = -1e10;
1570 // values[AliDielectronVarManager::kPseudoProperTimePull] = -1e10;
1571 if(samemother && fgEvent) {
54ce9dc4 1572 if(pair->GetFirstDaughterP()->GetLabel() > 0) {
4533e78e 1573 const AliVParticle *motherMC = 0x0;
54ce9dc4 1574 if(fgEvent->IsA() == AliESDEvent::Class()) motherMC = (AliMCParticle*)mc->GetMCTrackMother((AliESDtrack*)pair->GetFirstDaughterP());
1575 else if(fgEvent->IsA() == AliAODEvent::Class()) motherMC = (AliAODMCParticle*)mc->GetMCTrackMother((AliAODTrack*)pair->GetFirstDaughterP());
4533e78e 1576 Double_t vtxX, vtxY, vtxZ;
1577 if(motherMC && mc->GetPrimaryVertex(vtxX,vtxY,vtxZ)) {
1bb1fef1 1578 Int_t motherLbl = motherMC->GetLabel();
1579 values[AliDielectronVarManager::kHasCocktailMother]=mc->CheckParticleSource(motherLbl, AliDielectronSignalMC::kDirect);
4533e78e 1580 const Double_t lxyMC = ( (motherMC->Xv() - vtxX) * motherMC->Px() +
1581 (motherMC->Yv() - vtxY) * motherMC->Py() ) / motherMC->Pt();
5720c765 1582 const Double_t pseudoMC = lxyMC * (TDatabasePDG::Instance()->GetParticle(443)->Mass())/motherMC->Pt();
1583 values[AliDielectronVarManager::kPseudoProperTimeResolution] = values[AliDielectronVarManager::kPseudoProperTime] - pseudoMC;
1584 if (errPseudoProperTime2 > 0)
1585 values[AliDielectronVarManager::kPseudoProperTimePull] = values[AliDielectronVarManager::kPseudoProperTimeResolution]/sqrt(errPseudoProperTime2);
1bb1fef1 1586 }
5720c765 1587 }
1588 }
2e02dba4 1589
696b423a 1590 values[AliDielectronVarManager::kTRDpidEffPair] = 0.;
1591 if (fgTRDpidEff[0][0]){
1592 Double_t valuesLeg1[AliDielectronVarManager::kNMaxValues];
1593 Double_t valuesLeg2[AliDielectronVarManager::kNMaxValues];
54ce9dc4 1594 AliVParticle* leg1 = pair->GetFirstDaughterP();
1595 AliVParticle* leg2 = pair->GetSecondDaughterP();
696b423a 1596 if (leg1 && leg2){
1597 Fill(leg1, valuesLeg1);
1598 Fill(leg2, valuesLeg2);
1599 values[AliDielectronVarManager::kTRDpidEffPair] = valuesLeg1[AliDielectronVarManager::kTRDpidEffLeg]*valuesLeg2[AliDielectronVarManager::kTRDpidEffLeg];
1600 }
1601 }
b2ad74d0 1602
1603
8df8e382 1604 }//if (mc->HasMC())
1605
54ce9dc4 1606 AliVParticle* leg1 = pair->GetFirstDaughterP();
1607 AliVParticle* leg2 = pair->GetSecondDaughterP();
696b423a 1608 if (leg1)
833da63d 1609 values[AliDielectronVarManager::kMomAsymDau1] = (values[AliDielectronVarManager::kP] != 0)? leg1->P() / values[AliDielectronVarManager::kP]: 0;
696b423a 1610 else
833da63d 1611 values[AliDielectronVarManager::kMomAsymDau1] = -9999.;
696b423a 1612 if (leg2)
833da63d 1613 values[AliDielectronVarManager::kMomAsymDau2] = (values[AliDielectronVarManager::kP] != 0)? leg2->P() / values[AliDielectronVarManager::kP]: 0;
696b423a 1614 else
833da63d 1615 values[AliDielectronVarManager::kMomAsymDau2] = -9999.;
1616
1617 Double_t valuesLeg1[AliDielectronVarManager::kNMaxValues];
1618 Double_t valuesLeg2[AliDielectronVarManager::kNMaxValues];
ffcd7c9e 1619 values[AliDielectronVarManager::kPairEff]=0.0;
1620 values[AliDielectronVarManager::kOneOverPairEff]=0.0;
1621 values[AliDielectronVarManager::kOneOverPairEffSq]=0.0;
0b369e55 1622 if (leg1 && leg2 && fgLegEffMap) {
833da63d 1623 Fill(leg1, valuesLeg1);
1624 Fill(leg2, valuesLeg2);
1625 values[AliDielectronVarManager::kPairEff] = valuesLeg1[AliDielectronVarManager::kLegEff] *valuesLeg2[AliDielectronVarManager::kLegEff];
1626 }
0b369e55
JB
1627 else if(fgPairEffMap) {
1628 values[AliDielectronVarManager::kPairEff] = GetPairEff(values);
1629 }
ffcd7c9e 1630 if(fgLegEffMap || fgPairEffMap) {
1631 values[AliDielectronVarManager::kOneOverPairEff] = (values[AliDielectronVarManager::kPairEff]>0.0 ? 1./values[AliDielectronVarManager::kPairEff] : 1.0);
1632 values[AliDielectronVarManager::kOneOverPairEffSq] = (values[AliDielectronVarManager::kPairEff]>0.0 ? 1./values[AliDielectronVarManager::kPairEff]/values[AliDielectronVarManager::kPairEff] : 1.0);
1633 }
0b369e55 1634
a94c2e7e 1635 if(kRndmPair) values[AliDielectronVarManager::kRndmPair] = gRandom->Rndm();
b2a297fa 1636}
1637
1201a1a9 1638inline void AliDielectronVarManager::FillVarKFParticle(const AliKFParticle *particle, Double_t * const values)
1639{
1640 //
1641 // Fill track information available in AliVParticle into an array
1642 //
1643 values[AliDielectronVarManager::kPx] = particle->GetPx();
1644 values[AliDielectronVarManager::kPy] = particle->GetPy();
1645 values[AliDielectronVarManager::kPz] = particle->GetPz();
1646 values[AliDielectronVarManager::kPt] = particle->GetPt();
87a7c4b0 1647 values[AliDielectronVarManager::kPtSq] = particle->GetPt() * particle->GetPt();
1201a1a9 1648 values[AliDielectronVarManager::kP] = particle->GetP();
1649
1650 values[AliDielectronVarManager::kXv] = particle->GetX();
1651 values[AliDielectronVarManager::kYv] = particle->GetY();
1652 values[AliDielectronVarManager::kZv] = particle->GetZ();
1653
1654 values[AliDielectronVarManager::kOneOverPt] = 0;
1655 values[AliDielectronVarManager::kPhi] = particle->GetPhi();
1656 values[AliDielectronVarManager::kTheta] = 0.;
1657 values[AliDielectronVarManager::kEta] = particle->GetEta();
1658 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.;
1659
1660 values[AliDielectronVarManager::kE] = particle->GetE();
1661 values[AliDielectronVarManager::kM] = particle->GetMass();
1662 values[AliDielectronVarManager::kCharge] = particle->GetQ();
1663
1664 values[AliDielectronVarManager::kNclsITS] = 0;
5720c765 1665 values[AliDielectronVarManager::kITSchi2Cl] = -1;
1201a1a9 1666 values[AliDielectronVarManager::kNclsTPC] = 0;
5720c765 1667 values[AliDielectronVarManager::kNclsSTPC] = 0;
1668 values[AliDielectronVarManager::kNclsSFracTPC] = 0;
1201a1a9 1669 values[AliDielectronVarManager::kNclsTPCiter1] = 0;
1670 values[AliDielectronVarManager::kNFclsTPC] = 0;
1671 values[AliDielectronVarManager::kNclsTRD] = 0;
1672 values[AliDielectronVarManager::kTRDntracklets] = 0;
1673 values[AliDielectronVarManager::kTRDpidQuality] = 0;
1674 values[AliDielectronVarManager::kTPCchi2Cl] = 0;
1675 values[AliDielectronVarManager::kTrackStatus] = 0;
07480df6 1676 values[AliDielectronVarManager::kFilterBit] = 0;
1201a1a9 1677 values[AliDielectronVarManager::kTRDprobEle] = 0;
1678 values[AliDielectronVarManager::kTRDprobPio] = 0;
1679 values[AliDielectronVarManager::kTPCsignalN] = 0;
5720c765 1680 values[AliDielectronVarManager::kTPCclsDiff] = 0;
ba15fdfb 1681 values[AliDielectronVarManager::kTPCsignalNfrac]= 0;
1201a1a9 1682 values[AliDielectronVarManager::kImpactParXY] = 0;
1683 values[AliDielectronVarManager::kImpactParZ] = 0;
1684 values[AliDielectronVarManager::kPIn] = 0;
5720c765 1685 values[AliDielectronVarManager::kYsignedIn] = 0;
1201a1a9 1686 values[AliDielectronVarManager::kTPCsignal] = 0;
ba15fdfb 1687 values[AliDielectronVarManager::kTOFsignal] = 0;
1688 values[AliDielectronVarManager::kTOFbeta] = 0;
2d00c7d3 1689 values[AliDielectronVarManager::kTPCnSigmaEleRaw] = 0;
1201a1a9 1690 values[AliDielectronVarManager::kTPCnSigmaEle] = 0;
1691 values[AliDielectronVarManager::kTPCnSigmaPio] = 0;
1692 values[AliDielectronVarManager::kTPCnSigmaMuo] = 0;
1693 values[AliDielectronVarManager::kTPCnSigmaKao] = 0;
1694 values[AliDielectronVarManager::kTPCnSigmaPro] = 0;
1695 values[AliDielectronVarManager::kITSclusterMap] = 0;
1696
ba15fdfb 1697 values[AliDielectronVarManager::kPdgCode] = -1;
1698 values[AliDielectronVarManager::kPdgCodeMother] = -1;
1699 values[AliDielectronVarManager::kPdgCodeGrandMother] = -1;
1bb1fef1 1700 values[AliDielectronVarManager::kHasCocktailMother]=0;
1701 values[AliDielectronVarManager::kHasCocktailGrandMother]=0;
1201a1a9 1702
5720c765 1703// if ( fgEvent ) AliDielectronVarManager::Fill(fgEvent, values);
1704 for (Int_t i=AliDielectronVarManager::kPairMax; i<AliDielectronVarManager::kNMaxValues; ++i)
1705 values[i]=fgData[i];
1706
1201a1a9 1707}
6551594b 1708
1709inline void AliDielectronVarManager::FillVarVEvent(const AliVEvent *event, Double_t * const values)
1710{
1711 //
1712 // Fill event information available for histogramming into an array
1713 //
5720c765 1714 values[AliDielectronVarManager::kRunNumber] = event->GetRunNumber();
a823f01b 1715 if(fgCurrentRun!=event->GetRunNumber()) {
1716 if(fgVZEROCalibrationFile.Contains(".root")) InitVZEROCalibrationHistograms(event->GetRunNumber());
1717 if(fgVZERORecenteringFile.Contains(".root")) InitVZERORecenteringHistograms(event->GetRunNumber());
36a1e727 1718 if(fgZDCRecenteringFile.Contains(".root")) InitZDCRecenteringHistograms(event->GetRunNumber());
a823f01b 1719 fgCurrentRun=event->GetRunNumber();
1720 }
0c09cae4 1721 values[AliDielectronVarManager::kMixingBin]=0;
1722
6551594b 1723 const AliVVertex *primVtx = event->GetPrimaryVertex();
8df8e382 1724
1725 values[AliDielectronVarManager::kXvPrim] = 0;
1726 values[AliDielectronVarManager::kYvPrim] = 0;
1727 values[AliDielectronVarManager::kZvPrim] = 0;
0c09cae4 1728 values[AliDielectronVarManager::kNVtxContrib] = 0;
ba15fdfb 1729// values[AliDielectronVarManager::kChi2NDF] = 0; //This is the pair value!!!
5720c765 1730
0c09cae4 1731 values[AliDielectronVarManager::kNTrk] = 0;
1732 values[AliDielectronVarManager::kNVtxContrib] = 0;
1733 values[AliDielectronVarManager::kNacc] = 0;
1734 values[AliDielectronVarManager::kNaccTrcklts] = 0;
5720c765 1735 values[AliDielectronVarManager::kNaccTrcklts0916] = 0;
0c09cae4 1736 values[AliDielectronVarManager::kNevents] = 0; //always fill bin 0;
7a1ddc4b 1737 values[AliDielectronVarManager::kRefMult] = 0;
1738 values[AliDielectronVarManager::kRefMultTPConly] = 0;
8df8e382 1739
0c09cae4 1740 if (primVtx){
1a3d9eb7 1741 // printf("prim vertex reco: %f \n",primVtx->GetX());
0c09cae4 1742 values[AliDielectronVarManager::kXvPrim] = primVtx->GetX();
1743 values[AliDielectronVarManager::kYvPrim] = primVtx->GetY();
1744 values[AliDielectronVarManager::kZvPrim] = primVtx->GetZ();
1745 values[AliDielectronVarManager::kNVtxContrib] = primVtx->GetNContributors();
1746 }
1747 // values[AliDielectronVarManager::kChi2NDF] = primVtx->GetChi2perNDF(); //this is the pair value
42e1ec3d 1748
1749 // online and offline trigger maps
1750 values[AliDielectronVarManager::kTriggerInclONL] = event->GetTriggerMask();
1751 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
1752 UInt_t maskOff = ((AliInputEventHandler*)man->GetInputEventHandler())->IsEventSelected();
1753 values[AliDielectronVarManager::kTriggerInclOFF] = maskOff;
1754 values[AliDielectronVarManager::kTriggerExclOFF] = -1;
1755 for(Int_t i=0; i<30; i++) { if(maskOff==BIT(i)) values[AliDielectronVarManager::kTriggerExclOFF]=i; }
1756
5720c765 1757 values[AliDielectronVarManager::kNTrk] = event->GetNumberOfTracks();
a94c2e7e 1758 if(Req(kNacc)) values[AliDielectronVarManager::kNacc] = AliDielectronHelper::GetNacc(event);
1759 if(Req(kMatchEffITSTPC)) values[AliDielectronVarManager::kMatchEffITSTPC] = AliDielectronHelper::GetITSTPCMatchEff(event);
1760 if(Req(kNaccTrcklts)) values[AliDielectronVarManager::kNaccTrcklts] = AliDielectronHelper::GetNaccTrcklts(event); // etaRange = 1.6 (default)
1761 if(Req(kNaccTrcklts0916)) values[AliDielectronVarManager::kNaccTrcklts0916] = AliDielectronHelper::GetNaccTrcklts(event,1.6)-AliDielectronHelper::GetNaccTrcklts(event,.9);
1762 // values[AliDielectronVarManager::kNaccTrcklts05] = AliDielectronHelper::GetNaccTrcklts(event, 0.5); // AODHeader::fRefMultComb05
5720c765 1763 // values[AliDielectronVarManager::kNaccTrcklts10] = AliDielectronHelper::GetNaccTrcklts(event, 1.0);
1764 // values[AliDielectronVarManager::kNaccTrckltsCorr] = AliDielectronHelper::GetNaccTrckltsCorrected(event, values[AliDielectronVarManager::kNaccTrcklts], values[AliDielectronVarManager::kZvPrim]);
1765
a94c2e7e 1766
20b6b7d4 1767 Double_t ptMaxEv = -1., phiptMaxEv= -1.;
a94c2e7e 1768 if(Req(kMaxPt) || Req(kPhiMaxPt)) AliDielectronHelper::GetMaxPtAndPhi(event, ptMaxEv, phiptMaxEv);
20b6b7d4 1769 values[AliDielectronVarManager::kPhiMaxPt] = phiptMaxEv;
1770 values[AliDielectronVarManager::kMaxPt] = ptMaxEv;
1771
5720c765 1772
07480df6 1773 // event plane quantities from the AliEPSelectionTask
882407d7 1774 for(Int_t ivar=AliDielectronVarManager::kv0ArpH2; ivar<=kv0C0v0C3DiffH2; ivar++) values[ivar] = 0.0; // v0 variables
07480df6 1775 for(Int_t ivar=AliDielectronVarManager::kTPCxH2; ivar<=kTPCsub12DiffH2uc; ivar++) values[ivar] = 0.0; // tpc variables
8d42b5b9 1776
1777 // ep angle interval [todo, fill]
99345a64 1778 AliEventplane *ep = const_cast<AliVEvent*>(event)->GetEventplane();
07480df6 1779 if(ep) {
8d42b5b9 1780
1781 // TPC event plane quantities (uncorrected)
07480df6 1782 TVector2 *qstd = ep->GetQVector(); // This is the "standard" Q-Vector for TPC
1783 TVector2 *qsub1 = ep->GetQsub1(); // random subevent plane
1784 TVector2 *qsub2 = ep->GetQsub2();
1785 if(qstd && qsub1 && qsub2) {
8d42b5b9 1786 values[AliDielectronVarManager::kTPCxH2uc] = qstd->X();
1787 values[AliDielectronVarManager::kTPCyH2uc] = qstd->Y();
1788 values[AliDielectronVarManager::kTPCmagH2uc] = qstd->Mod();
1789 values[AliDielectronVarManager::kTPCrpH2uc] = ((TMath::Abs(qstd->X())>1.0e-10) ? TMath::ATan2(qstd->Y(),qstd->X())/2.0 : 0.0);
07480df6 1790 values[AliDielectronVarManager::kTPCsub1xH2uc] = qsub1->X();
1791 values[AliDielectronVarManager::kTPCsub1yH2uc] = qsub1->Y();
5c2b3da2 1792 values[AliDielectronVarManager::kTPCsub1rpH2uc] = ((TMath::Abs(qsub1->X())>1.0e-10) ? TMath::ATan2(qsub1->Y(),qsub1->X())/2.0 : 0.0);
07480df6 1793 values[AliDielectronVarManager::kTPCsub2xH2uc] = qsub2->X();
1794 values[AliDielectronVarManager::kTPCsub2yH2uc] = qsub2->Y();
5c2b3da2 1795 values[AliDielectronVarManager::kTPCsub2rpH2uc] = ((TMath::Abs(qsub2->X())>1.0e-10) ? TMath::ATan2(qsub2->Y(),qsub2->X())/2.0 : 0.0);
07480df6 1796
1797 values[AliDielectronVarManager::kTPCsub12DiffH2uc] = TMath::Cos( 2.*(values[AliDielectronVarManager::kTPCsub1rpH2uc] -
1798 values[AliDielectronVarManager::kTPCsub2rpH2uc]) );
1799 }
20b6b7d4 1800
8d42b5b9 1801 // VZERO event plane
1802 TVector2 qvec;
1803 Double_t qx = 0, qy = 0;
1804 ep->CalculateVZEROEventPlane(event,10, 2, qx, qy); qvec.Set(qx,qy);
1805 values[AliDielectronVarManager::kv0ACrpH2] = ((TMath::Abs(qvec.X())>1.0e-10) ? TMath::ATan2(qvec.Y(),qvec.X())/2.0 : 0.0);
1806 values[AliDielectronVarManager::kv0ACxH2] = qvec.X();
1807 values[AliDielectronVarManager::kv0ACyH2] = qvec.Y();
1808 values[AliDielectronVarManager::kv0ACmagH2] = qvec.Mod();
1809 ep->CalculateVZEROEventPlane(event, 8, 2, qx, qy); qvec.Set(qx,qy);
1810 values[AliDielectronVarManager::kv0ArpH2] = ((TMath::Abs(qvec.X())>1.0e-10) ? TMath::ATan2(qvec.Y(),qvec.X())/2.0 : 0.0);
1811 values[AliDielectronVarManager::kv0AxH2] = qvec.X();
1812 values[AliDielectronVarManager::kv0AyH2] = qvec.Y();
1813 values[AliDielectronVarManager::kv0AmagH2] = qvec.Mod();
1814 ep->CalculateVZEROEventPlane(event, 9, 2, qx, qy); qvec.Set(qx,qy);
1815 values[AliDielectronVarManager::kv0CrpH2] = ((TMath::Abs(qvec.X())>1.0e-10) ? TMath::ATan2(qvec.Y(),qvec.X())/2.0 : 0.0);
1816 values[AliDielectronVarManager::kv0CxH2] = qvec.X();
1817 values[AliDielectronVarManager::kv0CyH2] = qvec.Y();
1818 values[AliDielectronVarManager::kv0CmagH2] = qvec.Mod();
1819 ep->CalculateVZEROEventPlane(event, 0, 0, 2, qx, qy); qvec.Set(qx,qy);
1820 values[AliDielectronVarManager::kv0C0rpH2] = ((TMath::Abs(qvec.X())>1.0e-10) ? TMath::ATan2(qvec.Y(),qvec.X())/2.0 : 0.0);
1821 ep->CalculateVZEROEventPlane(event, 3, 3, 2, qx, qy); qvec.Set(qx,qy);
1822 values[AliDielectronVarManager::kv0C3rpH2] = ((TMath::Abs(qvec.X())>1.0e-10) ? TMath::ATan2(qvec.Y(),qvec.X())/2.0 : 0.0);
1823 ep->CalculateVZEROEventPlane(event, 4, 4, 2, qx, qy); qvec.Set(qx,qy);
1824 values[AliDielectronVarManager::kv0A0rpH2] = ((TMath::Abs(qvec.X())>1.0e-10) ? TMath::ATan2(qvec.Y(),qvec.X())/2.0 : 0.0);
1825 ep->CalculateVZEROEventPlane(event, 7, 7, 2, qx, qy); qvec.Set(qx,qy);
1826 values[AliDielectronVarManager::kv0A3rpH2] = ((TMath::Abs(qvec.X())>1.0e-10) ? TMath::ATan2(qvec.Y(),qvec.X())/2.0 : 0.0);
07480df6 1827 } //if: eventplane
1828
5720c765 1829 // ESD VZERO information
1830 AliVVZERO* vzeroData = event->GetVZEROData();
1831 values[AliDielectronVarManager::kMultV0A] = 0.0;
1832 values[AliDielectronVarManager::kMultV0C] = 0.0;
6a614fc0
JB
1833 values[AliDielectronVarManager::kEqMultV0A] = 0.0;
1834 values[AliDielectronVarManager::kEqMultV0C] = 0.0;
5720c765 1835 values[AliDielectronVarManager::kAdcV0A] = 0.0;
1836 values[AliDielectronVarManager::kAdcV0C] = 0.0;
1837 for(Int_t i=0; i<32; ++i) {
a823f01b 1838 values[AliDielectronVarManager::kVZEROchMult+i] = vzeroData->GetMultiplicity(i);
1839 values[AliDielectronVarManager::kVZEROchMult+32+i] = vzeroData->GetMultiplicity(i+32);
1840 //values[AliDielectronVarManager::kVZEROchMult+i] = event->GetVZEROEqMultiplicity(i);
1841 //values[AliDielectronVarManager::kVZEROchMult+32+i] = event->GetVZEROEqMultiplicity(i+32);
5720c765 1842 values[AliDielectronVarManager::kMultV0A] += vzeroData->GetMultiplicityV0A(i);
1843 values[AliDielectronVarManager::kMultV0C] += vzeroData->GetMultiplicityV0C(i);
6a614fc0
JB
1844 values[AliDielectronVarManager::kEqMultV0A] += event->GetVZEROEqMultiplicity(i);
1845 values[AliDielectronVarManager::kEqMultV0C] += event->GetVZEROEqMultiplicity(i+32);
5720c765 1846 //values[AliDielectronVarManager::kAdcV0A] += vzeroData->GetAdcV0A(i);
1847 //values[AliDielectronVarManager::kAdcV0C] += vzeroData->GetAdcV0C(i);
1848 }
1849 values[AliDielectronVarManager::kMultV0] = values[AliDielectronVarManager::kMultV0A] + values[AliDielectronVarManager::kMultV0C];
d05d1dfc 1850 values[AliDielectronVarManager::kEqMultV0] = values[AliDielectronVarManager::kEqMultV0A] + values[AliDielectronVarManager::kEqMultV0C];
5720c765 1851 values[AliDielectronVarManager::kAdcV0] = values[AliDielectronVarManager::kAdcV0A] + values[AliDielectronVarManager::kAdcV0C];
1852 // VZERO event plane quantities
1853 Double_t qvec[3]={0.0};
1854 GetVzeroRP(event, qvec,0); // V0-A
1855 values[AliDielectronVarManager::kV0AxH2] = qvec[0]; values[AliDielectronVarManager::kV0AyH2] = qvec[1];
1856 values[AliDielectronVarManager::kV0ArpH2] = qvec[2];
1857 qvec[0]=0.0; qvec[1]=0.0; qvec[2]=0.0;
1858 GetVzeroRP(event, qvec,1); // V0-C
1859 values[AliDielectronVarManager::kV0CxH2] = qvec[0]; values[AliDielectronVarManager::kV0CyH2] = qvec[1];
1860 values[AliDielectronVarManager::kV0CrpH2] = qvec[2];
1861 qvec[0]=0.0; qvec[1]=0.0; qvec[2]=0.0;
1862 GetVzeroRP(event, qvec,2); // V0-A and V0-C combined
1863 values[AliDielectronVarManager::kV0ACxH2] = qvec[0]; values[AliDielectronVarManager::kV0ACyH2] = qvec[1];
1864 values[AliDielectronVarManager::kV0ACrpH2] = qvec[2];
1865 // VZERO event plane resolution
1866 values[AliDielectronVarManager::kV0ArpResH2] = 1.0;
1867 values[AliDielectronVarManager::kV0CrpResH2] = 1.0;
1868 values[AliDielectronVarManager::kV0ACrpResH2] = 1.0;
1869 // Q vector components correlations
1870 values[AliDielectronVarManager::kV0XaXcH2] = values[AliDielectronVarManager::kV0AxH2]*values[AliDielectronVarManager::kV0CxH2];
1871 values[AliDielectronVarManager::kV0XaYaH2] = values[AliDielectronVarManager::kV0AxH2]*values[AliDielectronVarManager::kV0AyH2];
1872 values[AliDielectronVarManager::kV0XaYcH2] = values[AliDielectronVarManager::kV0AxH2]*values[AliDielectronVarManager::kV0CyH2];
1873 values[AliDielectronVarManager::kV0YaXcH2] = values[AliDielectronVarManager::kV0AyH2]*values[AliDielectronVarManager::kV0CxH2];
1874 values[AliDielectronVarManager::kV0YaYcH2] = values[AliDielectronVarManager::kV0AyH2]*values[AliDielectronVarManager::kV0CyH2];
1875 values[AliDielectronVarManager::kV0XcYcH2] = values[AliDielectronVarManager::kV0CxH2]*values[AliDielectronVarManager::kV0CyH2];
1876
07480df6 1877
1878 // event plane differences used for EP resolution calculation
5720c765 1879 values[AliDielectronVarManager::kV0ATPCDiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kV0ArpH2] -
1880 values[AliDielectronVarManager::kTPCrpH2]) );
1881
1882 values[AliDielectronVarManager::kV0CTPCDiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kV0CrpH2] -
1883 values[AliDielectronVarManager::kTPCrpH2]) );
1884
1885 values[AliDielectronVarManager::kV0AV0CDiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kV0ArpH2] -
1886 values[AliDielectronVarManager::kV0CrpH2]) );
1887
1888 values[AliDielectronVarManager::kv0ATPCDiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kv0ArpH2] -
1889 values[AliDielectronVarManager::kTPCrpH2]) );
07bc5543 1890
5720c765 1891 values[AliDielectronVarManager::kv0CTPCDiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kv0CrpH2] -
1892 values[AliDielectronVarManager::kTPCrpH2]) );
1893
1894 values[AliDielectronVarManager::kv0Av0CDiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kv0ArpH2] -
1895 values[AliDielectronVarManager::kv0CrpH2]) );
d327d9cd 1896
1d2d723c 1897 values[AliDielectronVarManager::kv0Av0C0DiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kv0ArpH2] -
1898 values[AliDielectronVarManager::kv0C0rpH2]) );
1899
1900 values[AliDielectronVarManager::kv0Av0C3DiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kv0ArpH2] -
1901 values[AliDielectronVarManager::kv0C3rpH2]) );
1902
1903 values[AliDielectronVarManager::kv0Cv0A0DiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kv0CrpH2] -
1904 values[AliDielectronVarManager::kv0A0rpH2]) );
1905
1906 values[AliDielectronVarManager::kv0Cv0A3DiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kv0CrpH2] -
1907 values[AliDielectronVarManager::kv0A3rpH2]) );
1908
1909 values[AliDielectronVarManager::kv0A0v0A3DiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kv0A0rpH2] -
1910 values[AliDielectronVarManager::kv0A3rpH2]) );
1911
1912 values[AliDielectronVarManager::kv0C0v0C3DiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kv0C0rpH2] -
1913 values[AliDielectronVarManager::kv0C3rpH2]) );
1914
290227df 1915 Double_t ZDCqvec[3][2] = {{999., 999.}, {999., 999.}, {999., 999.} };
36a1e727
JW
1916 GetZDCRP(event, ZDCqvec);
1917
1918 values[AliDielectronVarManager::kZDCArpH1] = TMath::ATan2(ZDCqvec[0][1], ZDCqvec[0][0]);
1919 values[AliDielectronVarManager::kZDCCrpH1] = TMath::ATan2(ZDCqvec[1][1], ZDCqvec[1][0]);
1920 values[AliDielectronVarManager::kZDCACrpH1] = TMath::ATan2(ZDCqvec[2][1], ZDCqvec[2][0]);
1921
290227df 1922 if(TMath::Abs(ZDCqvec[0][0] - 999.) < 1e-10 || TMath::Abs(ZDCqvec[0][1] - 999.) < 1e-10 || TMath::Abs(ZDCqvec[1][0] - 999.) < 1e-10 || TMath::Abs(ZDCqvec[1][1] - 999.) < 1e-10){
1923 values[AliDielectronVarManager::kZDCArpH1] = 999;
1924 values[AliDielectronVarManager::kZDCCrpH1] = 999;
1925 values[AliDielectronVarManager::kZDCACrpH1] = 999;
1926 }
1927
1928
36a1e727
JW
1929
1930 values[AliDielectronVarManager::kv0ZDCrpRes] = cos(2*(values[AliDielectronVarManager::kZDCArpH1] - values[AliDielectronVarManager::kv0ArpH2]));
1931 values[AliDielectronVarManager::kZDCrpResH1] = cos(values[AliDielectronVarManager::kZDCArpH1] - values[AliDielectronVarManager::kZDCCrpH1]);
1932
1d2d723c 1933
6551594b 1934}
1935
1936inline void AliDielectronVarManager::FillVarESDEvent(const AliESDEvent *event, Double_t * const values)
1937{
1938 //
1939 // Fill event information available for histogramming into an array
1940 //
1941
1942 // Fill common AliVEvent interface information
1943 FillVarVEvent(event, values);
ffbede40 1944
a823f01b 1945 Double_t centralityF=-1; Double_t centralitySPD=-1;
4649c75b 1946 AliCentrality *esdCentrality = const_cast<AliESDEvent*>(event)->GetCentrality();
ffbede40 1947 if (esdCentrality) centralityF = esdCentrality->GetCentralityPercentile("V0M");
a823f01b 1948 if (esdCentrality) centralitySPD = esdCentrality->GetCentralityPercentile("CL1");
ffbede40 1949
6551594b 1950 // Fill AliESDEvent interface specific information
1951 const AliESDVertex *primVtx = event->GetPrimaryVertex();
1952 values[AliDielectronVarManager::kXRes] = primVtx->GetXRes();
1953 values[AliDielectronVarManager::kYRes] = primVtx->GetYRes();
1954 values[AliDielectronVarManager::kZRes] = primVtx->GetZRes();
ffbede40 1955 values[AliDielectronVarManager::kCentrality] = centralityF;
a823f01b 1956 values[AliDielectronVarManager::kCentralitySPD] = centralitySPD;
6bd73568 1957
1958 const AliESDVertex *vtxTPC = event->GetPrimaryVertexTPC();
1959 values[AliDielectronVarManager::kNVtxContribTPC] = (vtxTPC ? vtxTPC->GetNContributors() : 0);
1960
5720c765 1961 // Event multiplicity estimators
1962 Int_t nTrSPD05=0; Int_t nTrITSTPC05=0; Int_t nTrITSSA05=0;
a94c2e7e 1963 nTrSPD05 = AliESDtrackCuts::GetReferenceMultiplicity(event, AliESDtrackCuts::kTracklets, 0.5);
1964 nTrITSTPC05 = AliESDtrackCuts::GetReferenceMultiplicity(event, AliESDtrackCuts::kTrackletsITSTPC, 0.5);
1965 nTrITSSA05 = AliESDtrackCuts::GetReferenceMultiplicity(event, AliESDtrackCuts::kTrackletsITSSA, 0.5);
5720c765 1966 values[AliDielectronVarManager::kNaccTrckltsEsd05] = nTrSPD05;
1967 values[AliDielectronVarManager::kNaccItsTpcEsd05] = nTrITSTPC05;
1968 values[AliDielectronVarManager::kNaccItsPureEsd05] = nTrITSSA05;
1969 values[AliDielectronVarManager::kNaccTrckltsEsd05Corr] =
1970 AliDielectronHelper::GetNaccTrckltsCorrected(event,Double_t(nTrSPD05),values[AliDielectronVarManager::kZvPrim],0);
1971 values[AliDielectronVarManager::kNaccItsTpcEsd05Corr] =
1972 AliDielectronHelper::GetNaccTrckltsCorrected(event,Double_t(nTrITSTPC05),values[AliDielectronVarManager::kZvPrim],3);
1973 values[AliDielectronVarManager::kNaccItsPureEsd05Corr] =
1974 AliDielectronHelper::GetNaccTrckltsCorrected(event,Double_t(nTrITSSA05),values[AliDielectronVarManager::kZvPrim],6);
1975
1976 Int_t nTrSPD10=0; Int_t nTrITSTPC10=0; Int_t nTrITSSA10=0;
a94c2e7e 1977 nTrSPD10 = AliESDtrackCuts::GetReferenceMultiplicity(event, AliESDtrackCuts::kTracklets, 1.0);
1978 nTrITSTPC10 = AliESDtrackCuts::GetReferenceMultiplicity(event, AliESDtrackCuts::kTrackletsITSTPC, 1.0);
1979 nTrITSSA10 = AliESDtrackCuts::GetReferenceMultiplicity(event, AliESDtrackCuts::kTrackletsITSSA, 1.0);
5720c765 1980 values[AliDielectronVarManager::kNaccTrckltsEsd10] = nTrSPD10;
1981 values[AliDielectronVarManager::kNaccItsTpcEsd10] = nTrITSTPC10;
1982 values[AliDielectronVarManager::kNaccItsPureEsd10] = nTrITSSA10;
1983 values[AliDielectronVarManager::kNaccTrckltsEsd10Corr] =
1984 AliDielectronHelper::GetNaccTrckltsCorrected(event,Double_t(nTrSPD10),values[AliDielectronVarManager::kZvPrim],1);
1985 values[AliDielectronVarManager::kNaccItsTpcEsd10Corr] =
1986 AliDielectronHelper::GetNaccTrckltsCorrected(event,Double_t(nTrITSTPC10),values[AliDielectronVarManager::kZvPrim],4);
1987 values[AliDielectronVarManager::kNaccItsPureEsd10Corr] =
1988 AliDielectronHelper::GetNaccTrckltsCorrected(event,Double_t(nTrITSSA10),values[AliDielectronVarManager::kZvPrim],7);
1989
1990 Int_t nTrSPD16=0; Int_t nTrITSTPC16=0; Int_t nTrITSSA16=0;
a94c2e7e 1991 nTrSPD16 = AliESDtrackCuts::GetReferenceMultiplicity(event, AliESDtrackCuts::kTracklets, 1.6);
1992 nTrITSTPC16 = AliESDtrackCuts::GetReferenceMultiplicity(event, AliESDtrackCuts::kTrackletsITSTPC, 1.6);
1993 nTrITSSA16 = AliESDtrackCuts::GetReferenceMultiplicity(event, AliESDtrackCuts::kTrackletsITSSA, 1.6);
5720c765 1994 values[AliDielectronVarManager::kNaccTrckltsEsd16] = nTrSPD16;
1995 values[AliDielectronVarManager::kNaccItsTpcEsd16] = nTrITSTPC16;
1996 values[AliDielectronVarManager::kNaccItsPureEsd16] = nTrITSSA16;
1997 values[AliDielectronVarManager::kNaccTrckltsEsd16Corr] =
1998 AliDielectronHelper::GetNaccTrckltsCorrected(event,Double_t(nTrSPD16),values[AliDielectronVarManager::kZvPrim],2);
1999 values[AliDielectronVarManager::kNaccItsTpcEsd16Corr] =
2000 AliDielectronHelper::GetNaccTrckltsCorrected(event,Double_t(nTrITSTPC16),values[AliDielectronVarManager::kZvPrim],5);
2001 values[AliDielectronVarManager::kNaccItsPureEsd16Corr] =
2002 AliDielectronHelper::GetNaccTrckltsCorrected(event,Double_t(nTrITSSA16),values[AliDielectronVarManager::kZvPrim],8);
2003
6551594b 2004}
8d42b5b9 2005
6551594b 2006inline void AliDielectronVarManager::FillVarAODEvent(const AliAODEvent *event, Double_t * const values)
2007{
2008 //
2009 // Fill event information available for histogramming into an array
20b6b7d4 2010 //
6551594b 2011
2012 // Fill common AliVEvent interface information
2013 FillVarVEvent(event, values);
2014
2015 // Fill AliAODEvent interface specific information
d327d9cd 2016 AliAODHeader *header = event->GetHeader();
20b6b7d4 2017
a823f01b 2018 Double_t centralityF=-1; Double_t centralitySPD=-1;
d327d9cd 2019 AliCentrality *aodCentrality = header->GetCentralityP();
2020 if (aodCentrality) centralityF = aodCentrality->GetCentralityPercentile("V0M");
a823f01b 2021 if (aodCentrality) centralitySPD = aodCentrality->GetCentralityPercentile("CL1");
d327d9cd 2022 values[AliDielectronVarManager::kCentrality] = centralityF;
a823f01b 2023 values[AliDielectronVarManager::kCentralitySPD] = centralitySPD;
20b6b7d4 2024
7a1ddc4b 2025 values[AliDielectronVarManager::kRefMult] = header->GetRefMultiplicity(); // similar to Ntrk
2026 values[AliDielectronVarManager::kRefMultTPConly] = header->GetTPConlyRefMultiplicity(); // similar to Nacc
2027
07bc5543 2028 ///////////////////////////////////////////
2029 //////////// NANO AODs ////////////////////
2030 ///////////////////////////////////////////
2031
2032 // (w/o AliCentrality branch), VOM centrality should be stored in the header
20b6b7d4 2033 if(!header->GetCentralityP())
2034 values[AliDielectronVarManager::kCentrality] = header->GetCentrality();
07bc5543 2035 // (w/o AliEventPlane branch) tpc event plane stuff stored in the header
7a1ddc4b 2036 if(!header->GetEventplaneP()) {
61749cc7 2037
8d42b5b9 2038 // values[AliDielectronVarManager::kNTrk] = header->GetRefMultiplicity(); // overwritten datamembers in "our" nanoAODs
2039 // values[AliDielectronVarManager::kNacc] = header->GetRefMultiplicityPos(); // overwritten datamembers in "our" nanoAODs
61749cc7 2040
8d42b5b9 2041 TVector2 qvec;
123e7cdf 2042 // TPC
8d42b5b9 2043 qvec.Set(header->GetEventplaneQx(), header->GetEventplaneQy());
2044 values[AliDielectronVarManager::kTPCxH2uc] = qvec.X();
2045 values[AliDielectronVarManager::kTPCyH2uc] = qvec.Y();
2046 values[AliDielectronVarManager::kTPCmagH2uc] = qvec.Mod();
2047 values[AliDielectronVarManager::kTPCrpH2uc] = ((TMath::Abs(qvec.X())>1.0e-10) ? TMath::ATan2(qvec.Y(),qvec.X())/2.0 : 0.0);
2048
2049 // VZERO
2050 AliEventplane ep2;
2051 // get event plane corrections from the VZERO EP selection task
2052 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
2053 AliVZEROEPSelectionTask *eptask = dynamic_cast<AliVZEROEPSelectionTask *>(man->GetTask("AliVZEROEPSelectionTask"));
2054 if(eptask) eptask->SetEventplaneParams(&ep2,centralityF);
2055 else printf("no VZERO event plane selection task added! \n");
2056
2057 Double_t qx = 0, qy = 0;
2058 ep2.CalculateVZEROEventPlane(event,10, 2, qx, qy); qvec.Set(qx,qy);
2059 values[AliDielectronVarManager::kv0ACrpH2] = ((TMath::Abs(qvec.X())>1.0e-10) ? TMath::ATan2(qvec.Y(),qvec.X())/2.0 : 0.0);
2060 values[AliDielectronVarManager::kv0ACxH2] = qvec.X();
2061 values[AliDielectronVarManager::kv0ACyH2] = qvec.Y();
2062 values[AliDielectronVarManager::kv0ACmagH2] = qvec.Mod();
2063 ep2.CalculateVZEROEventPlane(event, 8, 2, qx, qy); qvec.Set(qx,qy);
2064 values[AliDielectronVarManager::kv0ArpH2] = ((TMath::Abs(qvec.X())>1.0e-10) ? TMath::ATan2(qvec.Y(),qvec.X())/2.0 : 0.0);
2065 values[AliDielectronVarManager::kv0AxH2] = qvec.X();
2066 values[AliDielectronVarManager::kv0AyH2] = qvec.Y();
2067 values[AliDielectronVarManager::kv0AmagH2] = qvec.Mod();
2068 ep2.CalculateVZEROEventPlane(event, 9, 2, qx, qy); qvec.Set(qx,qy);
2069 values[AliDielectronVarManager::kv0CrpH2] = ((TMath::Abs(qvec.X())>1.0e-10) ? TMath::ATan2(qvec.Y(),qvec.X())/2.0 : 0.0);
2070 values[AliDielectronVarManager::kv0CxH2] = qvec.X();
2071 values[AliDielectronVarManager::kv0CyH2] = qvec.Y();
2072 values[AliDielectronVarManager::kv0CmagH2] = qvec.Mod();
2073 ep2.CalculateVZEROEventPlane(event, 0, 0, 2, qx, qy); qvec.Set(qx,qy);
2074 values[AliDielectronVarManager::kv0C0rpH2] = ((TMath::Abs(qvec.X())>1.0e-10) ? TMath::ATan2(qvec.Y(),qvec.X())/2.0 : 0.0);
2075 ep2.CalculateVZEROEventPlane(event, 3, 3, 2, qx, qy); qvec.Set(qx,qy);
2076 values[AliDielectronVarManager::kv0C3rpH2] = ((TMath::Abs(qvec.X())>1.0e-10) ? TMath::ATan2(qvec.Y(),qvec.X())/2.0 : 0.0);
2077 ep2.CalculateVZEROEventPlane(event, 4, 4, 2, qx, qy); qvec.Set(qx,qy);
2078 values[AliDielectronVarManager::kv0A0rpH2] = ((TMath::Abs(qvec.X())>1.0e-10) ? TMath::ATan2(qvec.Y(),qvec.X())/2.0 : 0.0);
2079 ep2.CalculateVZEROEventPlane(event, 7, 7, 2, qx, qy); qvec.Set(qx,qy);
2080 values[AliDielectronVarManager::kv0A3rpH2] = ((TMath::Abs(qvec.X())>1.0e-10) ? TMath::ATan2(qvec.Y(),qvec.X())/2.0 : 0.0);
07bc5543 2081
7a1ddc4b 2082 }
20b6b7d4 2083
99345a64 2084 const AliAODVertex *vtxtpc = GetVertex(event, AliAODVertex::kMainTPC);
2085 values[AliDielectronVarManager::kNVtxContribTPC] = (vtxtpc ? vtxtpc->GetNContributors() : 0);
35363fb9 2086
6551594b 2087}
2088
2089inline void AliDielectronVarManager::FillVarMCEvent(const AliMCEvent *event, Double_t * const values)
35363fb9 2090{
6551594b 2091 //
2092 // Fill event information available for histogramming into an array
35363fb9 2093 //
2094
6551594b 2095 // Fill common AliVEvent interface information
5720c765 2096 // FillVarVEvent(event, values);
2097 const AliVVertex* vtx = event->GetPrimaryVertex();
2098 values[AliDielectronVarManager::kXvPrim] = (vtx ? vtx->GetX() : 0.0);
2099 values[AliDielectronVarManager::kYvPrim] = (vtx ? vtx->GetY() : 0.0);
2100 values[AliDielectronVarManager::kZvPrim] = (vtx ? vtx->GetZ() : 0.0);
6551594b 2101 // Fill AliMCEvent interface specific information
5720c765 2102 values[AliDielectronVarManager::kNch] = AliDielectronHelper::GetNch(event, 1.6);
2103 values[AliDielectronVarManager::kNch05] = AliDielectronHelper::GetNch(event, 0.5);
2104 values[AliDielectronVarManager::kNch10] = AliDielectronHelper::GetNch(event, 1.0);
2105
2106 values[AliDielectronVarManager::kNumberOfJPsis] = AliDielectronHelper::GetNMothers(event, 0.9, 443, 11);
2107 values[AliDielectronVarManager::kNumberOfJPsisPrompt] = AliDielectronHelper::GetNMothers(event, 0.9, 443, 11, 1);
2108 values[AliDielectronVarManager::kNumberOfJPsisNPrompt] = AliDielectronHelper::GetNMothers(event, 0.9, 443, 11, 0);
2109}
2110
2111inline void AliDielectronVarManager::FillVarTPCEventPlane(const AliEventplane *evplane, Double_t * const values)
2112{
2113 //
2114 // Fill TPC event plane information after correction
2115 //
07480df6 2116 if(evplane) {
2117 TVector2 *qcorr = const_cast<AliEventplane *>(evplane)->GetQVector(); // This is the "corrected" Q-Vector
2118 TVector2 *qcsub1 = const_cast<AliEventplane *>(evplane)->GetQsub1();
2119 TVector2 *qcsub2 = const_cast<AliEventplane *>(evplane)->GetQsub2();
4533e78e 2120 if(qcorr) {
07480df6 2121 values[AliDielectronVarManager::kTPCxH2] = qcorr->X();
2122 values[AliDielectronVarManager::kTPCyH2] = qcorr->Y();
6bd73568 2123 values[AliDielectronVarManager::kTPCmagH2] = qcorr->Mod();
5c2b3da2 2124 values[AliDielectronVarManager::kTPCrpH2] = ((TMath::Abs(qcorr->X())>1.0e-10) ? TMath::ATan2(qcorr->Y(),qcorr->X())/2.0 : 0.0);
c081415a 2125 // detector effects
2126 values[AliDielectronVarManager::kCosTPCrpH2] = TMath::Cos( 2.* values[AliDielectronVarManager::kTPCrpH2] );
2127 values[AliDielectronVarManager::kSinTPCrpH2] = TMath::Sin( 2.* values[AliDielectronVarManager::kTPCrpH2] );
2128
07bc5543 2129 // correlations for event plane resoultion
2130 values[AliDielectronVarManager::kv0ATPCDiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kv0ArpH2] -
2131 values[AliDielectronVarManager::kTPCrpH2]) );
2132 values[AliDielectronVarManager::kv0CTPCDiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kv0CrpH2] -
2133 values[AliDielectronVarManager::kTPCrpH2]) );
2134 values[AliDielectronVarManager::kv0Av0CDiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kv0ArpH2] -
2135 values[AliDielectronVarManager::kv0CrpH2]) );
2136 values[AliDielectronVarManager::kv0Av0C0DiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kv0ArpH2] -
2137 values[AliDielectronVarManager::kv0C0rpH2]) );
2138 values[AliDielectronVarManager::kv0Av0C3DiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kv0ArpH2] -
2139 values[AliDielectronVarManager::kv0C3rpH2]) );
2140 values[AliDielectronVarManager::kv0Cv0A0DiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kv0CrpH2] -
2141 values[AliDielectronVarManager::kv0A0rpH2]) );
2142 values[AliDielectronVarManager::kv0Cv0A3DiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kv0CrpH2] -
2143 values[AliDielectronVarManager::kv0A3rpH2]) );
2144 values[AliDielectronVarManager::kv0A0v0A3DiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kv0A0rpH2] -
2145 values[AliDielectronVarManager::kv0A3rpH2]) );
2146 values[AliDielectronVarManager::kv0C0v0C3DiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kv0C0rpH2] -
2147 values[AliDielectronVarManager::kv0C3rpH2]) );
4533e78e 2148 }
2149 if(qcsub1 && qcsub2) {
07480df6 2150 values[AliDielectronVarManager::kTPCsub1xH2] = qcsub1->X();
2151 values[AliDielectronVarManager::kTPCsub1yH2] = qcsub1->Y();
5c2b3da2 2152 values[AliDielectronVarManager::kTPCsub1rpH2] = ((TMath::Abs(qcsub1->X())>1.0e-10) ? TMath::ATan2(qcsub1->Y(),qcsub1->X())/2.0 : 0.0);
07480df6 2153
2154 values[AliDielectronVarManager::kTPCsub2xH2] = qcsub2->X();
2155 values[AliDielectronVarManager::kTPCsub2yH2] = qcsub2->Y();
5c2b3da2 2156 values[AliDielectronVarManager::kTPCsub2rpH2] = ((TMath::Abs(qcsub2->X())>1.0e-10) ? TMath::ATan2(qcsub2->Y(),qcsub2->X())/2.0 : 0.0);
07480df6 2157
2158 values[AliDielectronVarManager::kTPCsub12DiffH2] = TMath::Cos( 2.*(values[AliDielectronVarManager::kTPCsub1rpH2] -
2159 values[AliDielectronVarManager::kTPCsub2rpH2]) );
2160 values[AliDielectronVarManager::kTPCsub12DiffH2Sin] = TMath::Sin( 2.*(values[AliDielectronVarManager::kTPCsub1rpH2] -
2161 values[AliDielectronVarManager::kTPCsub2rpH2]) );
2162 }
2163 }
5720c765 2164}
a823f01b 2165
6551594b 2166inline void AliDielectronVarManager::InitESDpid(Int_t type)
2167{
2168 //
2169 // initialize PID parameters
2170 // type=0 is simulation
2171 // type=1 is data
2172
ba15fdfb 2173 if (!fgPIDResponse) fgPIDResponse=new AliESDpid((Bool_t)(type==0));
6551594b 2174 Double_t alephParameters[5];
2175 // simulation
2176 alephParameters[0] = 2.15898e+00/50.;
2177 alephParameters[1] = 1.75295e+01;
2178 alephParameters[2] = 3.40030e-09;
2179 alephParameters[3] = 1.96178e+00;
2180 alephParameters[4] = 3.91720e+00;
ba15fdfb 2181 fgPIDResponse->GetTOFResponse().SetTimeResolution(80.);
6551594b 2182
2183 // data
83e37742 2184 if (type==1){
2185 alephParameters[0] = 0.0283086/0.97;
6551594b 2186 alephParameters[1] = 2.63394e+01;
2187 alephParameters[2] = 5.04114e-11;
2188 alephParameters[3] = 2.12543e+00;
2189 alephParameters[4] = 4.88663e+00;
ba15fdfb 2190 fgPIDResponse->GetTOFResponse().SetTimeResolution(130.);
2191 fgPIDResponse->GetTPCResponse().SetMip(50.);
6551594b 2192 }
2193
ba15fdfb 2194 fgPIDResponse->GetTPCResponse().SetBetheBlochParameters(
6551594b 2195 alephParameters[0],alephParameters[1],alephParameters[2],
2196 alephParameters[3],alephParameters[4]);
2197
ba15fdfb 2198 fgPIDResponse->GetTPCResponse().SetSigma(3.79301e-03, 2.21280e+04);
6551594b 2199}
2200
2a14a7b1 2201inline void AliDielectronVarManager::InitAODpidUtil(Int_t type)
2202{
ba15fdfb 2203 if (!fgPIDResponse) fgPIDResponse=new AliAODpidUtil;
2a14a7b1 2204 Double_t alephParameters[5];
2205 // simulation
2206 alephParameters[0] = 2.15898e+00/50.;
2207 alephParameters[1] = 1.75295e+01;
2208 alephParameters[2] = 3.40030e-09;
2209 alephParameters[3] = 1.96178e+00;
2210 alephParameters[4] = 3.91720e+00;
ba15fdfb 2211 fgPIDResponse->GetTOFResponse().SetTimeResolution(80.);
2a14a7b1 2212
2213 // data
2214 if (type==1){
2215 alephParameters[0] = 0.0283086/0.97;
2216 alephParameters[1] = 2.63394e+01;
2217 alephParameters[2] = 5.04114e-11;
2218 alephParameters[3] = 2.12543e+00;
2219 alephParameters[4] = 4.88663e+00;
ba15fdfb 2220 fgPIDResponse->GetTOFResponse().SetTimeResolution(130.);
2221 fgPIDResponse->GetTPCResponse().SetMip(50.);
2a14a7b1 2222 }
2223
ba15fdfb 2224 fgPIDResponse->GetTPCResponse().SetBetheBlochParameters(
2a14a7b1 2225 alephParameters[0],alephParameters[1],alephParameters[2],
2226 alephParameters[3],alephParameters[4]);
2227
ba15fdfb 2228 fgPIDResponse->GetTPCResponse().SetSigma(3.79301e-03, 2.21280e+04);
2a14a7b1 2229}
2230
572b0139 2231
5720c765 2232inline void AliDielectronVarManager::InitEstimatorAvg(const Char_t* filename)
2233{
2234 //
2235 // initialize the profile histograms neccessary for the correction of the multiplicity estimators in pp collisions
2236 //
2237
2238 const Char_t* estimatorNames[9] = {"SPDmult05","SPDmult10","SPDmult16",
2239 "ITSTPC05", "ITSTPC10", "ITSTPC16",
2240 "ITSSA05", "ITSSA10", "ITSSA16"};
2241 const Char_t* periodNames[4] = {"LHC10b", "LHC10c", "LHC10d", "LHC10e"};
2242 TFile* file=TFile::Open(filename);
2243 if(!file) return;
2244
2245 for(Int_t ip=0; ip<4; ++ip) {
2246 for(Int_t ie=0; ie<9; ++ie) {
2247 fgMultEstimatorAvg[ip][ie] = (TProfile*)(file->Get(Form("%s_%s",estimatorNames[ie],periodNames[ip]))->Clone(Form("%s_%s_clone",estimatorNames[ie],periodNames[ip])));
2248 }
2249 }
2250}
2251
2252
2253inline void AliDielectronVarManager::InitTRDpidEffHistograms(const Char_t* filename)
2254{
2255 //
2256 // initialize the 3D histograms with the TRD pid efficiency histograms
2257 //
2258
2259 // reset the centrality ranges and the efficiency histograms
2260 for(Int_t i=0; i<10; ++i) { // centrality ranges
2261 for(Int_t j=0; j<4; ++j) fgTRDpidEffCentRanges[i][j] = -1.;
2262 if(fgTRDpidEff[i][0]) {
2263 delete fgTRDpidEff[i][0];
2264 fgTRDpidEff[i][0] = 0x0;
2265 }
2266 if(fgTRDpidEff[i][1]) {
2267 delete fgTRDpidEff[i][1];
2268 fgTRDpidEff[i][1] = 0x0;
2269 }
2270 }
2271
2272 TFile* file=TFile::Open(filename);
2273 TList* keys=file->GetListOfKeys();
2274 Int_t idxp=0; Int_t idxn=0;
2275 for(Int_t i=0; i<keys->GetEntries(); ++i) {
2276 if(idxp>=10) continue;
2277 if(idxn>=10) continue;
2278 TString name=((TKey*)keys->At(i))->ReadObj()->GetName();
2279 // Name of histograms should be in the format:
2280 // TRDeff<field>_cent_<centLow>_<centHigh>
2281 // <field> is either "BPLUS" or "BMINUS"
2282 if(!(name.Contains("BPLUS") || name.Contains("BMINUS"))) continue;
2283 TObjArray* arr = name.Tokenize("_");
2284 Bool_t isBplus = kTRUE;
2285 if(name.Contains("BMINUS")) isBplus = kFALSE;
99345a64 2286 TString centMinStr = arr->At(2)->GetName();
09d5920f 2287 TString centMaxStr = arr->At(3)->GetName();
2288 delete arr;
5720c765 2289 if(isBplus) {
2290 fgTRDpidEffCentRanges[idxp][2] = centMinStr.Atof();
2291 fgTRDpidEffCentRanges[idxp][3] = centMaxStr.Atof();
2292 fgTRDpidEff[idxp][1] = (TH3D*)(file->Get(name.Data())->Clone(Form("%s_clone",name.Data())));
2293 ++idxp;
2294 }
2295 else {
2296 fgTRDpidEffCentRanges[idxn][0] = centMinStr.Atof();
2297 fgTRDpidEffCentRanges[idxn][1] = centMaxStr.Atof();
2298 fgTRDpidEff[idxn][0] = (TH3D*)(file->Get(name.Data())->Clone(Form("%s_clone",name.Data())));
2299 ++idxn;
2300 }
2301 }
2302}
2303
833da63d 2304inline Double_t AliDielectronVarManager::GetSingleLegEff(Double_t * const values) {
2305 //
2306 // get the single leg efficiency for a given particle
2307 //
2140c014 2308 if(!fgLegEffMap) return -1.;
833da63d 2309
746e66a9 2310 if(fgLegEffMap->IsA()== THnBase::Class()) {
2311 THnBase *eff = static_cast<THnBase*>(fgLegEffMap);
2312 Int_t dim=eff->GetNdimensions();
2313 Int_t idx[dim];
2314 for(Int_t idim=0; idim<dim; idim++) {
2315 UInt_t var = GetValueType(eff->GetAxis(idim)->GetName());
2316 idx[idim] = eff->GetAxis(idim)->FindBin(values[var]);
2317 if(idx[idim] < 0 || idx[idim]>eff->GetAxis(idim)->GetNbins()) return 0.0;
2318 }
2319 // printf(" bin content %f+-%f \n",eff->GetBinContent(idx), eff->GetBinError(idx));
2320 return (eff->GetBinContent(idx));
0b369e55 2321 }
746e66a9 2322 return -1.;
0b369e55
JB
2323}
2324
2325inline Double_t AliDielectronVarManager::GetPairEff(Double_t * const values) {
2326 //
2327 // get the pair efficiency for given pair kinematics
2328 //
2329 if(!fgPairEffMap) return -1.;
2330
746e66a9 2331 if(fgPairEffMap->IsA()== THnBase::Class()) {
2332 THnBase *eff = static_cast<THnBase*>(fgPairEffMap);
2333 Int_t dim=eff->GetNdimensions();
2334 Int_t idx[dim];
2335 for(Int_t idim=0; idim<dim; idim++) {
2336 UInt_t var = GetValueType(eff->GetAxis(idim)->GetName());
2337 idx[idim] = eff->GetAxis(idim)->FindBin(values[var]);
2338 if(idx[idim] < 0 || idx[idim]>eff->GetAxis(idim)->GetNbins()) return 0.0;
2339 }
2340 // printf(" bin content %f+-%f \n",eff->GetBinContent(idx), eff->GetBinError(idx));
2341 return (eff->GetBinContent(idx));
833da63d 2342 }
746e66a9 2343 if(fgPairEffMap->IsA()== TSpline3::Class()) {
2344 TSpline3 *eff = static_cast<TSpline3*>(fgPairEffMap);
2345 if(!eff->GetHistogram()) { printf("no histogram added to the spline\n"); return -1.;}
2346 UInt_t var = GetValueType(eff->GetHistogram()->GetXaxis()->GetName());
2347 //printf(" bin content %f \n",eff->Eval(values[var]) );
2348 return (eff->Eval(values[var]));
2349 }
2350
2351 return -1.;
833da63d 2352}
2353
5720c765 2354
a823f01b 2355inline void AliDielectronVarManager::InitVZEROCalibrationHistograms(Int_t runNo) {
2356 //
2357 // Initialize the VZERO channel-by-channel calibration histograms
2358 //
2359
2360 //initialize only once
2361 if(fgVZEROCalib[0]) return;
2362
2363 for(Int_t i=0; i<64; ++i)
2364 if(fgVZEROCalib[i]) {
2365 delete fgVZEROCalib[i];
2366 fgVZEROCalib[i] = 0x0;
2367 }
2368
2369 TFile file(fgVZEROCalibrationFile.Data());
2370
2371 for(Int_t i=0; i<64; ++i){
2372 fgVZEROCalib[i] = (TProfile2D*)(file.Get(Form("RUN%d_ch%d_VtxCent", runNo, i)));
2373 if (fgVZEROCalib[i]) fgVZEROCalib[i]->SetDirectory(0x0);
2374 }
2375}
2376
2377
2378inline void AliDielectronVarManager::InitVZERORecenteringHistograms(Int_t runNo) {
2379 //
2380 // Initialize the VZERO event plane recentering histograms
2381 //
2382
2383 //initialize only once
2384 if(fgVZERORecentering[0][0]) return;
2385
2386 for(Int_t i=0; i<2; ++i)
2387 for(Int_t j=0; j<2; ++j)
2388 if(fgVZERORecentering[i][j]) {
2389 delete fgVZERORecentering[i][j];
2390 fgVZERORecentering[i][j] = 0x0;
2391 }
2392
2393 TFile file(fgVZERORecenteringFile.Data());
2394 if (!file.IsOpen()) return;
2395
2396 fgVZERORecentering[0][0] = (TProfile2D*)(file.Get(Form("RUN%d_QxA_CentVtx", runNo)));
2397 fgVZERORecentering[0][1] = (TProfile2D*)(file.Get(Form("RUN%d_QyA_CentVtx", runNo)));
2398 fgVZERORecentering[1][0] = (TProfile2D*)(file.Get(Form("RUN%d_QxC_CentVtx", runNo)));
2399 fgVZERORecentering[1][1] = (TProfile2D*)(file.Get(Form("RUN%d_QyC_CentVtx", runNo)));
2400
2401 if (fgVZERORecentering[0][0]) fgVZERORecentering[0][0]->SetDirectory(0x0);
2402 if (fgVZERORecentering[0][1]) fgVZERORecentering[0][1]->SetDirectory(0x0);
2403 if (fgVZERORecentering[1][0]) fgVZERORecentering[1][0]->SetDirectory(0x0);
2404 if (fgVZERORecentering[1][1]) fgVZERORecentering[1][1]->SetDirectory(0x0);
2405
2406}
2407
36a1e727
JW
2408inline void AliDielectronVarManager::InitZDCRecenteringHistograms(Int_t runNo) {
2409
2410 //initialize only once
2411 if(fgZDCRecentering[0][0]) return;
2412
2413 for(Int_t i=0; i<2; ++i)
2414 for(Int_t j=0; j<2; ++j)
2415 if(fgZDCRecentering[i][j]) {
2416 delete fgZDCRecentering[i][j];
2417 fgZDCRecentering[i][j] = 0x0;
2418 }
2419
290227df 2420 TFile* file=TFile::Open(fgZDCRecenteringFile.Data());
2421 if(!file) return;
2422
7a86291c 2423
290227df 2424 fgZDCRecentering[0][0] = (TProfile3D*)file->Get(Form("RUN%06d_QxA_Recent", runNo));
2425 fgZDCRecentering[0][1] = (TProfile3D*)file->Get(Form("RUN%06d_QyA_Recent", runNo));
2426 fgZDCRecentering[1][0] = (TProfile3D*)file->Get(Form("RUN%06d_QxC_Recent", runNo));
2427 fgZDCRecentering[1][1] = (TProfile3D*)file->Get(Form("RUN%06d_QyC_Recent", runNo));
2428 fgZDCRecentering[2][0] = (TProfile3D*)file->Get(Form("RUN%06d_QxAC_Recent", runNo));
2429 fgZDCRecentering[2][1] = (TProfile3D*)file->Get(Form("RUN%06d_QyAC_Recent", runNo));
36a1e727
JW
2430
2431
2432 if (fgZDCRecentering[0][0]) fgZDCRecentering[0][0]->SetDirectory(0x0);
2433 if (fgZDCRecentering[0][1]) fgZDCRecentering[0][1]->SetDirectory(0x0);
2434 if (fgZDCRecentering[1][0]) fgZDCRecentering[1][0]->SetDirectory(0x0);
2435 if (fgZDCRecentering[1][1]) fgZDCRecentering[1][1]->SetDirectory(0x0);
2436 if (fgZDCRecentering[2][0]) fgZDCRecentering[2][0]->SetDirectory(0x0);
2437 if (fgZDCRecentering[2][1]) fgZDCRecentering[2][1]->SetDirectory(0x0);
2438
290227df 2439 delete file;
2440
36a1e727
JW
2441}
2442
a823f01b 2443
5720c765 2444inline Double_t AliDielectronVarManager::GetTRDpidEfficiency(Int_t runNo, Double_t centrality,
2445 Double_t eta, Double_t trdPhi, Double_t pout,
2446 Double_t& effErr) {
2447 //
2448 // return the efficiency in the given phase space cell
2449 //
2450 // LHC10h data----------------------------------------------
2451 Bool_t isBplus = kTRUE;
2452 if(runNo<=138275) isBplus = kFALSE;
2453 // TODO: check magnetic polarity for runs in 2011 data
2454 // ---------------------------------------------------------
2455 Int_t centIdx = -1;
2456 for(Int_t icent=0; icent<10; ++icent) {
2457 if(isBplus) {
2458 if(centrality>=fgTRDpidEffCentRanges[icent][2] && centrality<fgTRDpidEffCentRanges[icent][3]) {
2459 centIdx = icent;
2460 break;
2461 }
2462 }
2463 else {
2464 if(centrality>=fgTRDpidEffCentRanges[icent][0] && centrality<fgTRDpidEffCentRanges[icent][1]) {
2465 centIdx = icent;
2466 break;
2467 }
2468 }
2469 }
ac390e40 2470 //TODO: chek logick
2471 if (centIdx<0) return 1;
2472
5720c765 2473 TH3D* effH = fgTRDpidEff[centIdx][(isBplus ? 1 : 0)];
2474 if(!effH) {effErr=0x0; return 1.0;}
2475 Int_t etaBin = effH->GetXaxis()->FindBin(eta);
2476 if(eta<effH->GetXaxis()->GetXmin()) etaBin=1;
2477 if(eta>effH->GetXaxis()->GetXmax()) etaBin=effH->GetXaxis()->GetNbins();
2478 Int_t phiBin = effH->GetYaxis()->FindBin(trdPhi);
2479 if(trdPhi<effH->GetYaxis()->GetXmin()) phiBin=1;
2480 if(trdPhi>effH->GetYaxis()->GetXmax()) phiBin=effH->GetYaxis()->GetNbins();
2481 Int_t poutBin = effH->GetZaxis()->FindBin(pout);
2482 if(pout<effH->GetZaxis()->GetXmin()) poutBin=1;
2483 if(pout>effH->GetZaxis()->GetXmax()) poutBin=effH->GetZaxis()->GetNbins();
2484 Double_t eff = effH->GetBinContent(etaBin, phiBin, poutBin);
2485 effErr = effH->GetBinError(etaBin, phiBin, poutBin);
2486 if(eff<-0.0001) {
2487 effErr = 0.0;
2488 eff = 1.0;
2489 }
2490 return eff;
2491}
2492
2493
572b0139 2494inline void AliDielectronVarManager::SetEvent(AliVEvent * const ev)
2495{
2496
2497 fgEvent = ev;
2498 if (fgKFVertex) delete fgKFVertex;
2499 fgKFVertex=0x0;
2e02dba4 2500 if (!ev) return;
2501 if (ev->GetPrimaryVertex()) fgKFVertex=new AliKFVertex(*ev->GetPrimaryVertex());
ba15fdfb 2502
2503 for (Int_t i=0; i<AliDielectronVarManager::kNMaxValues;++i) fgData[i]=0.;
2504 AliDielectronVarManager::Fill(fgEvent, fgData);
572b0139 2505}
2a14a7b1 2506
5720c765 2507inline void AliDielectronVarManager::SetEventData(const Double_t data[AliDielectronVarManager::kNMaxValues])
2508{
2509 for (Int_t i=0; i<kNMaxValues;++i) fgData[i]=0.;
2510 for (Int_t i=kPairMax; i<kNMaxValues;++i) fgData[i]=data[i];
2511}
2512
2a14a7b1 2513
2514inline Bool_t AliDielectronVarManager::GetDCA(const AliAODTrack *track, Double_t d0z0[2])
2515{
2516 if(track->TestBit(AliAODTrack::kIsDCA)){
2517 d0z0[0]=track->DCA();
2518 d0z0[1]=track->ZAtDCA();
2519 return kTRUE;
2520 }
2521
67fd1119 2522 Bool_t ok=kFALSE;
2523 if(fgEvent) {
2524 Double_t covd0z0[3];
31b0e8c5 2525 //AliAODTrack copy(*track);
2526 AliExternalTrackParam etp; etp.CopyFromVTrack(track);
2527
2528 Float_t xstart = etp.GetX();
2529 if(xstart>3.) {
2530 d0z0[0]=-999.;
2531 d0z0[1]=-999.;
2532 //printf("This method can be used only for propagation inside the beam pipe \n");
2533 return kFALSE;
2534 }
2535
2536
67fd1119 2537 AliAODVertex *vtx =(AliAODVertex*)(fgEvent->GetPrimaryVertex());
2538 Double_t fBzkG = fgEvent->GetMagneticField(); // z componenent of field in kG
31b0e8c5 2539 ok = etp.PropagateToDCA(vtx,fBzkG,kVeryBig,d0z0,covd0z0);
2540 //ok = copy.PropagateToDCA(vtx,fBzkG,kVeryBig,d0z0,covd0z0);
67fd1119 2541 }
2a14a7b1 2542 if(!ok){
2543 d0z0[0]=-999.;
2544 d0z0[1]=-999.;
2545 }
2546 return ok;
2547}
2548
5720c765 2549inline void AliDielectronVarManager::SetTPCEventPlane(AliEventplane *const evplane)
2550{
2551
2552 fgTPCEventPlane = evplane;
c315310a 2553 FillVarTPCEventPlane(evplane,fgData);
5720c765 2554 // for (Int_t i=0; i<AliDielectronVarManager::kNMaxValues;++i) fgData[i]=0.;
2555 // AliDielectronVarManager::Fill(fgEvent, fgData);
2556}
2557
2558
2559//_________________________________________________________________
2560inline void AliDielectronVarManager::GetVzeroRP(const AliVEvent* event, Double_t* qvec, Int_t sideOption) {
2561 //
2562 // Get the reaction plane from the VZERO detector for a given harmonic
2563 //
2564 // sideOption = 0- V0A, 1- V0C, 2-both
2565 // Q{x,y} = SUM_i mult(i) * {cos(n*phi_i), sin(n*phi_i)}
2566 // phi_i - phi angle of the VZERO sector i
2567 // Each sector covers 45 degrees(8 sectors per ring). Middle of sector 0 is at 45/2
2568 // channel 0: 22.5
2569 // 1: 22.5+45
2570 // 2: 22.5+45*2
2571 // ...
2572 // at the next ring continues the same
2573 // channel 8: 22.5
2574 // channel 9: 22.5 + 45
2575 // ...
2576 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)
2577 const Double_t kY[8] = {0.38268, 0.92388, 0.92388, 0.38268, -0.38268, -0.92388, -0.92388, -0.38268}; // sines -- " --
2578 Int_t phi;
2579 Float_t mult;
5720c765 2580
a823f01b 2581 // get centrality and vertex for this event
2582 Double_t centralitySPD = -1; Double_t vtxZ = -999.;
2583 if(event->IsA() == AliESDEvent::Class()) {
2584 const AliESDEvent* esdEv = static_cast<const AliESDEvent*>(event);
2585 AliCentrality *esdCentrality = const_cast<AliESDEvent*>(esdEv)->GetCentrality();
2586 if(esdCentrality) centralitySPD = esdCentrality->GetCentralityPercentile("CL1");
2587 }
2588 if(event->IsA() == AliAODEvent::Class()) {
2589 const AliAODEvent* aodEv = static_cast<const AliAODEvent*>(event);
2590 AliAODHeader *header = aodEv->GetHeader();
2591 AliCentrality *aodCentrality = header->GetCentralityP();
2592 if(aodCentrality) centralitySPD = aodCentrality->GetCentralityPercentile("CL1");
2593 }
2594 const AliVVertex *primVtx = event->GetPrimaryVertex();
2595 if(!primVtx) return;
2596 vtxZ = primVtx->GetZ();
2597 if(TMath::Abs(vtxZ)>10.) return;
2598 if(centralitySPD<0. || centralitySPD>80.) return;
2599
2600 Int_t binCent = -1; Int_t binVtx = -1;
2601 if(fgVZEROCalib[0]) {
2602 binVtx = fgVZEROCalib[0]->GetXaxis()->FindBin(vtxZ);
2603 binCent = fgVZEROCalib[0]->GetYaxis()->FindBin(centralitySPD);
2604 }
2605
2606 AliVVZERO* vzero = event->GetVZEROData();
2607 Double_t average = 0.0;
5720c765 2608 for(Int_t iChannel=0; iChannel<64; ++iChannel) {
2609 if(iChannel<32 && sideOption==0) continue;
2610 if(iChannel>=32 && sideOption==1) continue;
2611 phi=iChannel%8;
a823f01b 2612 mult = vzero->GetMultiplicity(iChannel);
2613 if(fgVZEROCalib[iChannel])
2614 average = fgVZEROCalib[iChannel]->GetBinContent(binVtx, binCent);
2615 if(average>1.0e-10 && mult>0.5)
2616 mult /= average;
2617 else
2618 mult = 0.0;
5720c765 2619 // 2nd harmonic
2620 qvec[0] += mult*(2.0*TMath::Power(kX[phi],2.0)-1);
2621 qvec[1] += mult*(2.0*kX[phi]*kY[phi]);
2622 } // end loop over channels
a823f01b 2623
2624 // do recentering
2625 if(fgVZERORecentering[0][0]) {
2626// printf("vzero: %p\n",fgVZERORecentering[0][0]);
2627 Int_t binCentRecenter = -1; Int_t binVtxRecenter = -1;
2628 binCentRecenter = fgVZERORecentering[0][0]->GetXaxis()->FindBin(centralitySPD);
2629 binVtxRecenter = fgVZERORecentering[0][0]->GetYaxis()->FindBin(vtxZ);
2630 if(sideOption==0) { // side A
2631 qvec[0] -= fgVZERORecentering[0][0]->GetBinContent(binCentRecenter, binVtxRecenter);
2632 qvec[1] -= fgVZERORecentering[0][1]->GetBinContent(binCentRecenter, binVtxRecenter);
2633 }
2634 if(sideOption==1) { // side C
2635 qvec[0] -= fgVZERORecentering[1][0]->GetBinContent(binCentRecenter, binVtxRecenter);
2636 qvec[1] -= fgVZERORecentering[1][1]->GetBinContent(binCentRecenter, binVtxRecenter);
2637 }
2638 if(sideOption==2) { // side A and C together
2639 qvec[0] -= fgVZERORecentering[0][0]->GetBinContent(binCentRecenter, binVtxRecenter);
2640 qvec[0] -= fgVZERORecentering[1][0]->GetBinContent(binCentRecenter, binVtxRecenter);
2641 qvec[1] -= fgVZERORecentering[0][1]->GetBinContent(binCentRecenter, binVtxRecenter);
2642 qvec[1] -= fgVZERORecentering[1][1]->GetBinContent(binCentRecenter, binVtxRecenter);
2643 }
2644 }
2645
2646 // calculate the reaction plane
5720c765 2647 if(TMath::Abs(qvec[0])>1.0e-10)
2648 qvec[2] = TMath::ATan2(qvec[1],qvec[0])/2.0;
2649}
36a1e727
JW
2650inline void AliDielectronVarManager::GetZDCRP(const AliVEvent* event, Double_t qvec[][2]) {
2651
2652 //
2653 // Get the reaction plane from the ZDC detector for first harmonic
2654 //
2655 // Q{x,y} = SUM{ri(x,y)*Ei} / SUM{Ei}
2656 //
2657
2658 const Int_t nZDCSides = 2;
2659 const Int_t nZDCplanes = 3;
2660 const Int_t Aside = 0, Cside = 1, ACside = 2;
2661 const Int_t nZDCTowers = 4;// number of ZDCtowers
2662 const Double_t ZDCTowerCenters[nZDCTowers][2] = { {-1.75, -1.75}, { 1.75, -1.75},
2663 {-1.75, 1.75}, { 1.75, 1.75} };
2664
2665 Double_t *ZDCTEnergy[nZDCSides]; //reco E in 5 ZDC sectors - high gain chain
2666 Double_t qvecNUM[nZDCplanes][2];
2667 Double_t qvecDEN[nZDCplanes];
2668 memset( qvecNUM, 0, sizeof(qvecNUM)); //format
2669 memset(qvecDEN, 0, sizeof(qvecDEN)); //format
2670
2671 Double_t TPCRefMulti = 999, vtxX = 999, vtxY = 999;
2672 Int_t multiBin = 0, vtxXBin = 0, vtxYBin = 0;
2673 Double_t recentdim[3][3] = { { 50, 0, 2500}, //multiplicity nbin, min, max
2674 { 20, 0.04, 0.08}, // vertex x nbin, min, max
2675 { 20, 0.25, 0.29} }; // vertex y nbin, min, max
2676
7965afb6 2677 if(!event->GetZDCData()) return;
36a1e727
JW
2678 AliVZDC* aliZDC = event->GetZDCData();
2679 ZDCTEnergy[Aside] = (Double_t *)aliZDC -> GetZNATowerEnergy();
2680 ZDCTEnergy[Cside] = (Double_t *)aliZDC -> GetZNCTowerEnergy();
2681
2682 for(int j = 0; j < nZDCSides ; j++){
2683 for(int k = 0; k < nZDCTowers ; k++){
2684 qvecNUM[j][0] += ZDCTowerCenters[k][0]*ZDCTEnergy[j][k+1]; // zdcQ += xE
2685 qvecNUM[j][1] += ZDCTowerCenters[k][1]*ZDCTEnergy[j][k+1]; // zdcQ += yE
2686 qvecDEN[j] += ZDCTEnergy[j][k+1]; // zdcQsum += E
2687
2688 }
2689 if(j == Aside){
2690 qvecNUM[j][0] = -qvecNUM[j][0];
2691 }
2692
2693 if(j == Cside){
2694 qvecNUM[j][0] = -qvecNUM[j][0];
2695 qvecNUM[j][1] = -qvecNUM[j][1];
2696 }
2697
2698
2699 qvecNUM[ACside][0] += qvecNUM[j][0];
2700 qvecNUM[ACside][1] += qvecNUM[j][1];
2701 qvecDEN[ACside] += qvecDEN[j];
2702
2703 }
2704
2705 for(int j = 0; j < nZDCplanes; j++){
2706 if(qvecDEN[j] != 0){
2707 qvec[j][0] = (qvecNUM[j][0] / qvecDEN[j]);
2708 qvec[j][1] = (qvecNUM[j][1] / qvecDEN[j]);
2709 }
2710 else if(qvecDEN[j] == 0) {
2711 qvec[j][0] = 999;
2712 qvec[j][1] = 999;
2713 }
2714
2715 }
2716
2717 if(fgZDCRecentering[0][0]){
2718 const AliAODEvent* aodEv = static_cast<const AliAODEvent*>(event);
2719 AliAODHeader *header = aodEv->GetHeader();
2720 if(!header) return;
2721 TPCRefMulti = header -> GetTPConlyRefMultiplicity();
2722
2723 const AliVVertex *primVtx = event->GetPrimaryVertex();
2724 if(!primVtx) return;
2725 vtxX = primVtx->GetX();
2726 vtxY = primVtx->GetY();
2727
2728 multiBin = (Int_t)((TPCRefMulti-recentdim[0][1])*recentdim[0][0] / (recentdim[0][2] - recentdim[0][1])) + 1;
2729 vtxXBin = (Int_t)((vtxX-recentdim[1][1])*recentdim[1][0] / (recentdim[1][2] - recentdim[1][1])) + 1;
2730 vtxYBin = (Int_t)((vtxY-recentdim[2][1])*recentdim[2][0] / (recentdim[2][2] - recentdim[2][1])) + 1;
2731
2732 for(int j = 0; j < nZDCplanes; j++)
2733 if(qvecDEN[j] != 0){
2734 qvec[j][0] -= fgZDCRecentering[j][0] -> GetBinContent(multiBin, vtxXBin, vtxYBin);
2735 qvec[j][1] -= fgZDCRecentering[j][1] -> GetBinContent(multiBin, vtxXBin, vtxYBin);
2736 }
2737 }
2738
2739}
2740
2741
5720c765 2742
99345a64 2743//______________________________________________________________________________
2744inline AliAODVertex* AliDielectronVarManager::GetVertex(const AliAODEvent* event, AliAODVertex::AODVtx_t vtype) {
2745 // Get vertex
2746 Int_t nVertices=event->GetNumberOfVertices();
2747 for(Int_t iVert=0; iVert<nVertices; iVert++){
2748 AliAODVertex *v=event->GetVertex(iVert);
2749 // printf(" vtx %d contrib %d daughters %d \n ",v->GetType(),v->GetNContributors(), v->GetNDaughters());
2750 if(v->GetType()==vtype) return v;
2751 }
2752 return 0;
2753}
5720c765 2754
b2a297fa 2755/*
2756inline void AliDielectronVarManager::FillValues(const TParticle *particle, Double_t *values)
2757{
2758 //
2759 // Fill track information available for histogramming into an array
2760 //
2761
2762 // Fill TParticle interface information
2763 values[AliDielectronVarManager::kPx] = particle->Px();
2764 values[AliDielectronVarManager::kPy] = particle->Py();
2765 values[AliDielectronVarManager::kPz] = particle->Pz();
2766 values[AliDielectronVarManager::kPt] = particle->Pt();
2767 values[AliDielectronVarManager::kP] = particle->P();
2768
2769 values[AliDielectronVarManager::kXv] = particle->Vx();
2770 values[AliDielectronVarManager::kYv] = particle->Vy();
2771 values[AliDielectronVarManager::kZv] = particle->Vz();
2772
2773 values[AliDielectronVarManager::kOneOverPt] = 1./particle->Pt();
2774 values[AliDielectronVarManager::kPhi] = particle->Phi();
2775 values[AliDielectronVarManager::kTheta] =
2776 values[AliDielectronVarManager::kEta] = particle->Eta();
2777 values[AliDielectronVarManager::kY] =
2778
2779 values[AliDielectronVarManager::kE] = particle->Energy();
2780 values[AliDielectronVarManager::kM] = particle->GetMass();
2781
2782 values[AliDielectronVarManager::kCharge] = particle->GetPDG()->Charge()/3; // uggly
2783
2784}*/
2785
2786#endif
fb7d2d99 2787