forked from AliceO2Group/O2Physics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlmeeMLTables.h
More file actions
294 lines (250 loc) · 15.9 KB
/
Copy pathlmeeMLTables.h
File metadata and controls
294 lines (250 loc) · 15.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#include "Common/DataModel/EventSelection.h"
#include "Common/DataModel/Multiplicity.h"
#include "Common/DataModel/PIDResponseTOF.h"
#include "Common/DataModel/PIDResponseTPC.h"
#include "Common/DataModel/TrackSelectionTables.h"
#include <Framework/AnalysisDataModel.h>
#include <cstdint>
#ifndef PWGEM_DILEPTON_DATAMODEL_LMEEMLTABLES_H_
#define PWGEM_DILEPTON_DATAMODEL_LMEEMLTABLES_H_
namespace o2::aod
{
namespace pwgem::dilepton::ml
{
enum class PID_Label : uint8_t {
kElectron = 0,
kMuon = 1,
kPion = 2,
kKaon = 3,
kProton = 4,
}; // this can be used for eID.
enum class Track_Type : uint8_t {
kPrimary = 0,
kSecondary = 1,
}; // this can be used for selecting electron from primary or photon conversion.
} // namespace pwgem::dilepton::ml
namespace emmltrack
{
DECLARE_SOA_COLUMN(CollisionId, collisionId, int); //!
DECLARE_SOA_COLUMN(HadronicRate, hadronicRate, float); //!
DECLARE_SOA_COLUMN(PIDLabel, pidlabel, uint8_t); //!
DECLARE_SOA_COLUMN(TrackType, tracktype, uint8_t); //!
DECLARE_SOA_COLUMN(TPCNClsFound, tpcNClsFound, uint8_t); //!
DECLARE_SOA_COLUMN(TPCNClsCrossedRows, tpcNClsCrossedRows, uint8_t); //!
DECLARE_SOA_COLUMN(TPCNClsPID, tpcNClsPID, uint8_t); //!
DECLARE_SOA_COLUMN(IsForValidation, isForValidation, bool); //!
DECLARE_SOA_COLUMN(Sign, sign, short); //!
DECLARE_SOA_COLUMN(P, p, float); //!
DECLARE_SOA_COLUMN(PtGen, ptGen, float); //!
DECLARE_SOA_COLUMN(EtaGen, etaGen, float); //!
DECLARE_SOA_COLUMN(PhiGen, phiGen, float); //!
// DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float pt, float eta) -> float { return pt * std::cosh(eta); });
DECLARE_SOA_DYNAMIC_COLUMN(MeanClusterSizeITS, meanClusterSizeITS, [](uint32_t itsClusterSizes) -> float {
int total_cluster_size = 0, nl = 0;
for (unsigned int layer = 0; layer < 7; layer++) {
int cluster_size_per_layer = (itsClusterSizes >> (layer * 4)) & 0xf;
if (cluster_size_per_layer > 0) {
nl++;
}
total_cluster_size += cluster_size_per_layer;
}
if (nl > 0) {
return static_cast<float>(total_cluster_size) / static_cast<float>(nl);
} else {
return 0;
}
});
DECLARE_SOA_DYNAMIC_COLUMN(MeanClusterSizeITSob, meanClusterSizeITSob, [](uint32_t itsClusterSizes) -> float {
int total_cluster_size = 0, nl = 0;
for (unsigned int layer = 3; layer < 7; layer++) {
int cluster_size_per_layer = (itsClusterSizes >> (layer * 4)) & 0xf;
if (cluster_size_per_layer > 0) {
nl++;
}
total_cluster_size += cluster_size_per_layer;
}
if (nl > 0) {
return static_cast<float>(total_cluster_size) / static_cast<float>(nl);
} else {
return 0;
}
});
} // namespace emmltrack
// reconstructed track information
DECLARE_SOA_TABLE(EMTracksForMLPID, "AOD", "EMTRACKMLPID", //!
o2::soa::Index<>, collision::NumContrib, evsel::NumTracksInTimeRange, evsel::SumAmpFT0CInTimeRange, emmltrack::HadronicRate,
emmltrack::P, track::Tgl, emmltrack::Sign,
track::TPCNClsFindable, emmltrack::TPCNClsFound, emmltrack::TPCNClsCrossedRows, emmltrack::TPCNClsPID,
track::TPCChi2NCl, track::TPCInnerParam,
track::TPCSignal,
pidtofbeta::Beta,
track::ITSClusterSizes, track::ITSChi2NCl, track::TOFChi2, track::DetectorMap, emmltrack::PIDLabel,
// dynamic column
emmltrack::MeanClusterSizeITS<track::ITSClusterSizes>,
emmltrack::MeanClusterSizeITSob<track::ITSClusterSizes>);
DECLARE_SOA_TABLE(EMPIDsEl, "AOD", "EMPIDEL", pidtpc::TPCNSigmaEl, pidtof::TOFNSigmaEl); // Joinable with EMTracksForMLPID
DECLARE_SOA_TABLE(EMPIDsPi, "AOD", "EMPIDPI", pidtpc::TPCNSigmaPi, pidtof::TOFNSigmaPi); // Joinable with EMTracksForMLPID
DECLARE_SOA_TABLE(EMPIDsKa, "AOD", "EMPIDKA", pidtpc::TPCNSigmaKa, pidtof::TOFNSigmaKa); // Joinable with EMTracksForMLPID
DECLARE_SOA_TABLE(EMPIDsPr, "AOD", "EMPIDPR", pidtpc::TPCNSigmaPr, pidtof::TOFNSigmaPr); // Joinable with EMTracksForMLPID
// iterators
using EMTrackForMLPID = EMTracksForMLPID::iterator;
using EMPIDEl = EMPIDsEl::iterator;
using EMPIDPi = EMPIDsPi::iterator;
using EMPIDKa = EMPIDsKa::iterator;
using EMPIDPr = EMPIDsPr::iterator;
namespace emmlfwdtrack
{
// DECLARE_SOA_COLUMN(Signed1PtMFTMCHMIDatPV, signed1PtMFTMCHMIDatPV, float); //! pt of MCH-MID track in MFT-MCH-MID track at PV
// DECLARE_SOA_COLUMN(EtaMFTMCHMIDatPV, etaMFTMCHMIDatPV, float); //! eta of MCH-MID track in MFT-MCH-MID track at PV
// DECLARE_SOA_COLUMN(PhiMFTMCHMIDatPV, phiMFTMCHMIDatPV, float); //! phi of MCH-MID track in MFT-MCH-MID track at PV
//
// DECLARE_SOA_COLUMN(Signed1PtMCHMIDatPV, signed1PtMCHMIDatPV, float); //! pt of MCH-MID track in MFT-MCH-MID track at PV
// DECLARE_SOA_COLUMN(EtaMCHMIDatPV, etaMCHMIDatPV, float); //! eta of MCH-MID track in MFT-MCH-MID track at PV
// DECLARE_SOA_COLUMN(PhiMCHMIDatPV, phiMCHMIDatPV, float); //! phi of MCH-MID track in MFT-MCH-MID track at PV
DECLARE_SOA_COLUMN(Signed1PtMCHMIDatMP, signed1PtMCHMIDatMP, float); //! pt of MCH-MID track in MFT-MCH-MID track at MP
DECLARE_SOA_COLUMN(TglMCHMIDatMP, tglMCHMIDatMP, float); //! tgl of MCH-MID track in MFT-MCH-MID track at MP
DECLARE_SOA_COLUMN(PhiMCHMIDatMP, phiMCHMIDatMP, float); //! phi of MCH-MID track in MFT-MCH-MID track at MP
DECLARE_SOA_COLUMN(Signed1PtErrMCHMIDatMP, signed1PtErrMCHMIDatMP, float); //! pt of MCH-MID track in MFT-MCH-MID track at MP
DECLARE_SOA_COLUMN(TglErrMCHMIDatMP, tglErrMCHMIDatMP, float); //! tgl of MCH-MID track in MFT-MCH-MID track at MP
DECLARE_SOA_COLUMN(PhiErrMCHMIDatMP, phiErrMCHMIDatMP, float); //! phi of MCH-MID track in MFT-MCH-MID track at MP
DECLARE_SOA_COLUMN(Signed1PtMFTatMP, signed1PtMFTatMP, float); //! pt of MCH-MID track in MFT-MCH-MID track at MP
DECLARE_SOA_COLUMN(TglMFTatMP, tglMFTatMP, float); //! tgl of MCH-MID track in MFT-MCH-MID track at MP
DECLARE_SOA_COLUMN(PhiMFTatMP, phiMFTatMP, float); //! phi of MCH-MID track in MFT-MCH-MID track at MP
DECLARE_SOA_COLUMN(Signed1PtErrMFTatMP, signed1PtErrMFTatMP, float); //! pt of MCH-MID track in MFT-MCH-MID track at MP
DECLARE_SOA_COLUMN(TglErrMFTatMP, tglErrMFTatMP, float); //! tgl of MCH-MID track in MFT-MCH-MID track at MP
DECLARE_SOA_COLUMN(PhiErrMFTatMP, phiErrMFTatMP, float); //! phi of MCH-MID track in MFT-MCH-MID track at MP
DECLARE_SOA_COLUMN(XMCHMIDatMP, xMCHMIDatMP, float); //! x of MCH-MID track in MFT-MCH-MID track at matching plane
DECLARE_SOA_COLUMN(YMCHMIDatMP, yMCHMIDatMP, float); //! y of MCH-MID track in MFT-MCH-MID track at matching plane
DECLARE_SOA_COLUMN(XErrMCHMIDatMP, xErrMCHMIDatMP, float); //! x error of MCH-MID track in MFT-MCH-MID track at matching plane
DECLARE_SOA_COLUMN(YErrMCHMIDatMP, yErrMCHMIDatMP, float); //! y error of MCH-MID track in MFT-MCH-MID track at matching plane
DECLARE_SOA_COLUMN(XMFTatMP, xMFTatMP, float); //! x of MFT track in MFT-MCH-MID track at matching plane
DECLARE_SOA_COLUMN(YMFTatMP, yMFTatMP, float); //! y of MFT track in MFT-MCH-MID track at matching plane
DECLARE_SOA_COLUMN(XErrMFTatMP, xErrMFTatMP, float); //! x error of MFT track in MFT-MCH-MID track at matching plane
DECLARE_SOA_COLUMN(YErrMFTatMP, yErrMFTatMP, float); //! y error of MFT track in MFT-MCH-MID track at matching plane
DECLARE_SOA_COLUMN(Chi2MFT, chi2MFT, float); //! chi2/ndf of MFT track
DECLARE_SOA_COLUMN(Chi2MCHMID, chi2MCHMID, float); //! chi2/ndf of MCH-MID track
DECLARE_SOA_COLUMN(Chi2MFTMCHMID, chi2MFTMCHMID, float); //! chi2/ndf of MFT-MCH-MID track
DECLARE_SOA_COLUMN(NClustersMFT, nClustersMFT, uint8_t); //!
DECLARE_SOA_COLUMN(IsPrimaryMFT, isPrimaryMFT, bool); //!
DECLARE_SOA_COLUMN(IsPrimaryMCHMID, isPrimaryMCHMID, bool); //!
DECLARE_SOA_COLUMN(IsCorrectMatch, isCorrectMatch, bool); //!
DECLARE_SOA_COLUMN(PdgCodeMFT, pdgCodeMFT, int); //!
DECLARE_SOA_COLUMN(PdgCodeMCHMID, pdgCodeMCHMID, int); //!
DECLARE_SOA_COLUMN(MatchMCHTrackId, mchTrackId, int); //!
DECLARE_SOA_COLUMN(DFId, dfId, uint64_t); //!
DECLARE_SOA_COLUMN(MultMFT, multMFT, uint16_t); //! number of MFTsa tracks per collision
} // namespace emmlfwdtrack
DECLARE_SOA_TABLE(EMFwdTracksForML, "AOD", "EMFWDTRKML", //!
o2::soa::Index<>, collision::PosZ, /*collision::NumContrib,*/ mult::MultFT0C, /*evsel::NumTracksInTimeRange,*/ evsel::SumAmpFT0CInTimeRange, emmltrack::HadronicRate, emmlfwdtrack::MultMFT,
emmlfwdtrack::Signed1PtMFTatMP, emmlfwdtrack::TglMFTatMP, emmlfwdtrack::PhiMFTatMP,
emmlfwdtrack::XMFTatMP, emmlfwdtrack::YMFTatMP,
emmlfwdtrack::Signed1PtMCHMIDatMP, emmlfwdtrack::TglMCHMIDatMP, emmlfwdtrack::PhiMCHMIDatMP,
emmlfwdtrack::XMCHMIDatMP, emmlfwdtrack::YMCHMIDatMP,
fwdtrack::Chi2MatchMCHMFT,
emmlfwdtrack::PdgCodeMFT, emmlfwdtrack::IsPrimaryMFT,
emmlfwdtrack::PdgCodeMCHMID, emmlfwdtrack::IsPrimaryMCHMID,
emmlfwdtrack::IsCorrectMatch, emmlfwdtrack::MatchMCHTrackId, emmlfwdtrack::DFId);
// iterators
using EMFwdTrackForML = EMFwdTracksForML::iterator;
DECLARE_SOA_TABLE(EMFwdTrackErrsForML, "AOD", "EMFWDTRKERRML", //! Joinable with EMFwdTracksForML
/*emmlfwdtrack::Signed1PtErrMFTatMP,*/ emmlfwdtrack::TglErrMFTatMP, emmlfwdtrack::PhiErrMFTatMP,
emmlfwdtrack::XErrMFTatMP, emmlfwdtrack::YErrMFTatMP,
/*emmlfwdtrack::Signed1PtErrMCHMIDatMP,*/ emmlfwdtrack::TglErrMCHMIDatMP, emmlfwdtrack::PhiErrMCHMIDatMP,
emmlfwdtrack::XErrMCHMIDatMP, emmlfwdtrack::YErrMCHMIDatMP);
// iterators
using EMFwdTrackErrForML = EMFwdTrackErrsForML::iterator;
// for SemiCharmTag at midrapidity, only electrons
namespace emmlevent
{
DECLARE_SOA_COLUMN(SubGeneratorId, subGeneratorId, int); //! sub generator Id of mc collision
} // namespace emmlevent
namespace emmltrack
{
DECLARE_SOA_COLUMN(IsMotherFromBeauty, isMotherFromBeauty, bool); //! is b quark included in decay history
DECLARE_SOA_COLUMN(PdgCodeMother, pdgCodeMother, int); //! pdg code of mother of lepton
} // namespace emmltrack
DECLARE_SOA_TABLE(EMMLLeptons, "AOD", "EMMLLEPTON", //!
o2::soa::Index<>, collision::NumContrib, evsel::NumTracksInTimeRange, evsel::SumAmpFT0CInTimeRange, emmlevent::SubGeneratorId,
track::Signed1Pt, track::Eta,
track::DcaXY, track::DcaZ, o2::aod::track::CYY, o2::aod::track::CZY, o2::aod::track::CZZ,
emmltrack::IsMotherFromBeauty, emmltrack::PdgCodeMother);
// iterators
using EMMLLepton = EMMLLeptons::iterator;
namespace emmllhpair
{
DECLARE_SOA_INDEX_COLUMN(EMMLLepton, emmllepton); //! most propable emeventId
DECLARE_SOA_COLUMN(RapidityV0, rapidityV0, float); //! rapidity of associated V0
DECLARE_SOA_COLUMN(RapidityC, rapidityC, float); //! rapidity of associated Cascade
DECLARE_SOA_COLUMN(ImpParXY, impParXY, float); //! impact parameter for V0/Cascade in XY plane
DECLARE_SOA_COLUMN(ImpParZ, impParZ, float); //! impact parameter for V0/Cascade in XY plane
DECLARE_SOA_COLUMN(ImpParCYY, impParCYY, float); //! sigma of impact parameter for V0/Cascade in XY plane
DECLARE_SOA_COLUMN(ImpParCZY, impParCZY, float); //! sigma of impact parameter for V0/Cascade in XY plane
DECLARE_SOA_COLUMN(ImpParCZZ, impParCZZ, float); //! sigma of impact parameter for V0/Cascade in XY plane
DECLARE_SOA_COLUMN(V0CosPA, v0copa, float); //! cosPA of V0
DECLARE_SOA_COLUMN(V0CosPAXY, v0copaXY, float); //! cosPA of V0 in XY plane
DECLARE_SOA_COLUMN(CascCosPA, casccopa, float); //! cosPA of Cascade
DECLARE_SOA_COLUMN(CascCosPAXY, casccopaXY, float); //! cosPA of Cascade in XY plane
DECLARE_SOA_COLUMN(Mass, mass, float); //! invariant mass of LH assuming kaon
DECLARE_SOA_COLUMN(DcaLH, dcalh, float); //! DCA between lepton and hadron
DECLARE_SOA_COLUMN(CosPA, cospa, float); //! flight direction of LH pair
DECLARE_SOA_COLUMN(CosPAXY, cospaXY, float); //! flight direction of LH pair in XY
DECLARE_SOA_COLUMN(Lxyz, lxyz, float); //! decay length of LH pair
DECLARE_SOA_COLUMN(LxyzSigma, lxyzSigma, float); //! decay length resolution of LH pair
DECLARE_SOA_COLUMN(Lxy, lxy, float); //! decay length of LH pair
DECLARE_SOA_COLUMN(LxySigma, lxySigma, float); //! decay length resolution of LH pair
DECLARE_SOA_COLUMN(Lz, lz, float); //! decay length of LH pair
DECLARE_SOA_COLUMN(LzSigma, lzSigma, float); //! decay length resolution of LH pair
DECLARE_SOA_COLUMN(PdgCodeH, pdgCodeH, int); //! pdg code of associated hadron
DECLARE_SOA_COLUMN(PdgCodeIM, pdgCodeIM, int); //! pdg code of intermediate hadron from HF hadrons. e.g K*, D*
DECLARE_SOA_COLUMN(FoundCommonMother, foundCommonMother, bool); //! decay length resolution of LH pair
} // namespace emmllhpair
DECLARE_SOA_TABLE(EMMLLHPairs, "AOD", "EMMLLHPAIR", //!
emmllhpair::EMMLLeptonId,
track::Signed1Pt, track::Eta,
track::DcaXY, track::DcaZ, o2::aod::track::CYY, o2::aod::track::CZY, o2::aod::track::CZZ,
pidtpc::TPCNSigmaPi, pidtof::TOFNSigmaPi,
pidtpc::TPCNSigmaKa, pidtof::TOFNSigmaKa,
pidtpc::TPCNSigmaPr, pidtof::TOFNSigmaPr,
emmllhpair::Mass, emmllhpair::DcaLH, emmllhpair::CosPA, emmllhpair::CosPAXY,
emmllhpair::Lxyz, emmllhpair::LxyzSigma,
emmllhpair::Lxy, emmllhpair::LxySigma,
emmllhpair::Lz, emmllhpair::LzSigma,
emmllhpair::PdgCodeH, emmllhpair::PdgCodeIM, emmllhpair::FoundCommonMother);
// iterators
using EMMLLHPair = EMMLLHPairs::iterator;
DECLARE_SOA_TABLE(EMMLLV0Pairs, "AOD", "EMMLLV0PAIR", //!
emmllhpair::EMMLLeptonId,
track::Pt, emmllhpair::RapidityV0,
emmllhpair::V0CosPA, emmllhpair::V0CosPAXY,
emmllhpair::ImpParXY, emmllhpair::ImpParZ, emmllhpair::ImpParCYY, emmllhpair::ImpParCZY, emmllhpair::ImpParCZZ,
emmllhpair::Mass, emmllhpair::DcaLH, emmllhpair::CosPA, emmllhpair::CosPAXY,
emmllhpair::Lxyz, emmllhpair::LxyzSigma,
emmllhpair::Lxy, emmllhpair::LxySigma,
emmllhpair::Lz, emmllhpair::LzSigma,
emmllhpair::PdgCodeH, emmllhpair::PdgCodeIM, emmllhpair::FoundCommonMother);
// iterators
using EMMLLV0Pair = EMMLLV0Pairs::iterator;
DECLARE_SOA_TABLE(EMMLLCascPairs, "AOD", "EMMLLCAPAIR", //!
emmllhpair::EMMLLeptonId,
track::Pt, emmllhpair::RapidityC,
emmllhpair::CascCosPA, emmllhpair::CascCosPAXY,
emmllhpair::ImpParXY, emmllhpair::ImpParZ, emmllhpair::ImpParCYY, emmllhpair::ImpParCZY, emmllhpair::ImpParCZZ,
emmllhpair::Mass, emmllhpair::DcaLH, emmllhpair::CosPA, emmllhpair::CosPAXY,
emmllhpair::Lxyz, emmllhpair::LxyzSigma,
emmllhpair::Lxy, emmllhpair::LxySigma,
emmllhpair::Lz, emmllhpair::LzSigma,
emmllhpair::PdgCodeH, emmllhpair::PdgCodeIM, emmllhpair::FoundCommonMother);
// iterators
using EMMLLCascPair = EMMLLCascPairs::iterator;
} // namespace o2::aod
#endif // PWGEM_DILEPTON_DATAMODEL_LMEEMLTABLES_H_