Skip to content

Commit 0c9db5a

Browse files
victor-gonzalezVictor
andauthored
[PWGCF] DptDpt - matching reco <-> gen fed by the filter (#9120)
Co-authored-by: Victor <victor@cern.ch>
1 parent 0d9a1d6 commit 0c9db5a

File tree

1 file changed

+22
-84
lines changed

1 file changed

+22
-84
lines changed

PWGCF/Tasks/matchRecoGen.cxx

Lines changed: 22 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -56,30 +56,10 @@ std::vector<std::vector<int64_t>> mclabelpos[2];
5656
std::vector<std::vector<int64_t>> mclabelneg[2];
5757
} // namespace o2::analysis::recogenmap
5858

59-
namespace o2::analysis::dptdptfilter
60-
{
61-
TpcExcludeTrack tpcExcluder; ///< the TPC excluder object instance
62-
} // namespace o2::analysis::dptdptfilter
63-
6459
/// \brief Checks the correspondence generator level <=> detector level
6560
struct MatchRecoGen {
66-
Configurable<int> cfgTrackType{"cfgTrackType", 1, "Type of selected tracks: 0 = no selection, 1 = global tracks FB96"};
67-
Configurable<std::string> cfgCentMultEstimator{"cfgCentMultEstimator", "V0M", "Centrality/multiplicity estimator detector: V0M, NOCM: none. Default V0M"};
68-
Configurable<std::string> cfgSystem{"cfgSystem", "PbPb", "System: pp, PbPb, Pbp, pPb, XeXe, ppRun3. Default PbPb"};
69-
Configurable<std::string> cfgDataType{"cfgDataType", "data", "Data type: data, datanoevsel, MC, FastMC, OnTheFlyMC. Default data"};
70-
Configurable<std::string> cfgTriggSel{"cfgTriggSel", "MB", "Trigger selection: MB, None. Default MB"};
71-
Configurable<float> cfgOverallMinP{"cfgOverallMinP", 0.0f, "The overall minimum momentum for the analysis. Default: 0.0"};
72-
Configurable<o2::analysis::DptDptBinningCuts> cfgBinning{"cfgBinning",
73-
{28, -7.0, 7.0, 18, 0.2, 2.0, 16, -0.8, 0.8, 72, 0.5},
74-
"triplets - nbins, min, max - for z_vtx, pT, eta and phi, binning plus bin fraction of phi origin shift"};
75-
struct : ConfigurableGroup {
76-
std::string prefix = "cfgTpcExclusion";
77-
Configurable<int> method{"method", 0, "The method for excluding tracks within the TPC. 0: no exclusion; 1: static; 2: dynamic. Default: 0"};
78-
} cfgTpcExclusion;
7961
Configurable<o2::analysis::CheckRangeCfg> cfgTraceDCAOutliers{"cfgTraceDCAOutliers", {false, 0.0, 0.0}, "Track the generator level DCAxy outliers: false/true, low dcaxy, up dcaxy. Default {false,0.0,0.0}"};
8062
Configurable<float> cfgTraceOutOfSpeciesParticles{"cfgTraceOutOfSpeciesParticles", false, "Track the particles which are not e,mu,pi,K,p: false/true. Default false"};
81-
Configurable<int> cfgRecoIdMethod{"cfgRecoIdMethod", 0, "Method for identifying reconstructed tracks: 0 PID, 1 mcparticle. Default 0"};
82-
Configurable<o2::analysis::TrackSelectionTuneCfg> cfgTuneTrackSelection{"cfgTuneTrackSelection", {}, "Track selection: {useit: true/false, tpccls-useit, tpcxrws-useit, tpcxrfc-useit, dcaxy-useit, dcaz-useit}. Default {false,0.70,false,0.8,false,2.4,false,3.2,false}"};
8363
Configurable<bool> cfgTraceCollId0{"cfgTraceCollId0", false, "Trace particles in collisions id 0. Default false"};
8464
Configurable<bool> cfgTrackMultiRec{"cfgTrackMultiRec", false, "Track muli-reconstructed particles: true, false. Default false"};
8565
Configurable<bool> cfgTrackCollAssoc{"cfgTrackCollAssoc", false, "Track collision id association, track-mcparticle-mccollision vs. track-collision-mccollision: true, false. Default false"};
@@ -99,51 +79,20 @@ struct MatchRecoGen {
9979
using namespace o2::analysis::dptdptfilter;
10080

10181
/* update with the configurable values */
102-
overallminp = cfgOverallMinP.value;
103-
/* the binning */
104-
ptbins = cfgBinning->mPTbins;
105-
ptlow = cfgBinning->mPTmin;
106-
ptup = cfgBinning->mPTmax;
107-
etabins = cfgBinning->mEtabins;
108-
etalow = cfgBinning->mEtamin;
109-
etaup = cfgBinning->mEtamax;
110-
zvtxbins = cfgBinning->mZVtxbins;
111-
zvtxlow = cfgBinning->mZVtxmin;
112-
zvtxup = cfgBinning->mZVtxmax;
113-
phibins = cfgBinning->mPhibins;
114-
phibinshift = cfgBinning->mPhibinshift;
115-
116-
/* the TPC excluder object instance */
117-
TpcExclusionMethod tpcExclude = kNOEXCLUSION; ///< exclude tracks within the TPC according to this method
118-
tpcExclude = static_cast<TpcExclusionMethod>(cfgTpcExclusion.method.value);
119-
tpcExcluder = TpcExcludeTrack(tpcExclude);
120-
121-
/* the track types and combinations */
122-
tracktype = cfgTrackType.value;
123-
initializeTrackSelection(cfgTuneTrackSelection.value);
124-
/* the centrality/multiplicity estimation */
125-
fCentMultEstimator = getCentMultEstimator(cfgCentMultEstimator);
126-
/* the trigger selection */
127-
fTriggerSelection = getTriggerSelection(cfgTriggSel);
12882
traceDCAOutliers = cfgTraceDCAOutliers;
12983
traceOutOfSpeciesParticles = cfgTraceOutOfSpeciesParticles;
130-
recoIdMethod = cfgRecoIdMethod;
13184
traceCollId0 = cfgTraceCollId0;
13285

133-
/* if the system type is not known at this time, we have to put the initialization somewhere else */
134-
fSystem = getSystemType(cfgSystem);
135-
fDataType = getDataType(cfgDataType);
136-
13786
AxisSpec deltaEta = {100, -2, 2, "#Delta#eta"};
13887
AxisSpec deltaPhi = {100, 0, constants::math::TwoPI, "#Delta#varphi (rad)"};
13988
AxisSpec deltaPt = {1000, 0, 4, "#Delta#it{p}_{T} (GeV/#it{c})"};
14089
AxisSpec mrectimes = {11, -0.5f, 10.5f, "##/particle"};
14190
AxisSpec detectors = {32, -0.5, 31.5, "Detectors"};
142-
std::vector<std::string> detectorlbls = {"", "ITS", "TPC", "ITS+TPC", "TRD", "ITS+TRD", "TPC+TRD", "ITS+TPC+TRD",
143-
"TOF", "ITS+TOF", "TPC+TOF", "ITS+TPC+TOF", "TRD+TOF", "ITS+TRD+TOF", "TPC+TRD+TOF", "ITS+TPC+TRD+TOF",
144-
"UNKN", "ITS+UNKN", "TPC+UNKN", "ITS+TPC+UNKN", "TRD+UNKN", "ITS+TRD+UNKN", "TPC+TRD+UNKN", "ITS+TPC+TRD+UNKN",
145-
"TOF+UNKN", "ITS+TOF+UNKN", "TPC+TOF+UNKN", "ITS+TPC+TOF+UNKN", "TRD+TOF+UNKN", "ITS+TRD+TOF+UNKN", "TPC+TRD+TOF+UNKN", "ITS+TPC+TRD+TOF+UNKN"};
146-
std::vector<std::string> matchlbs = {"match", "don't match"};
91+
std::vector<std::string> detectorLabels = {"", "ITS", "TPC", "ITS+TPC", "TRD", "ITS+TRD", "TPC+TRD", "ITS+TPC+TRD",
92+
"TOF", "ITS+TOF", "TPC+TOF", "ITS+TPC+TOF", "TRD+TOF", "ITS+TRD+TOF", "TPC+TRD+TOF", "ITS+TPC+TRD+TOF",
93+
"UNKN", "ITS+UNKN", "TPC+UNKN", "ITS+TPC+UNKN", "TRD+UNKN", "ITS+TRD+UNKN", "TPC+TRD+UNKN", "ITS+TPC+TRD+UNKN",
94+
"TOF+UNKN", "ITS+TOF+UNKN", "TPC+TOF+UNKN", "ITS+TPC+TOF+UNKN", "TRD+TOF+UNKN", "ITS+TRD+TOF+UNKN", "TPC+TRD+TOF+UNKN", "ITS+TPC+TRD+TOF+UNKN"};
95+
std::vector<std::string> matchLabels = {"match", "don't match"};
14796

14897
histos.add("before/positivecolid/mrDeltaEta", "#Delta#eta multirec tracks", kTH1F, {deltaEta});
14998
histos.add("before/positivecolid/mrDeltaPhi", "#Delta#varphi multirec tracks", kTH1F, {deltaPhi});
@@ -170,13 +119,13 @@ struct MatchRecoGen {
170119
histos.add("before/positivecolid/dcazmr", "DCA_{z} Reconstructed (mr)", kTH1F, {{1000, -4.0, 4.0, "DCA_{z} (cm)"}});
171120
histos.add("before/positivecolid/finedcaxymr", "DCA_{xy} Reconstructed (mr)", kTH1F, {{2000, -1.0, 1.0, "DCA_{xy} (cm)"}});
172121
histos.add("before/positivecolid/finedcazmr", "DCA_{z} Reconstructed (mr)", kTH1F, {{2000, -1.0, 1.0, "DCA_{z} (cm)"}});
173-
for (unsigned int i = 0; i < detectorlbls.size(); ++i) {
174-
histos.get<TH1>(HIST("before/positivecolid/detectormap"))->GetXaxis()->SetBinLabel(i + 1, detectorlbls[i].c_str());
175-
histos.get<TH1>(HIST("before/positivecolid/detectormapmr"))->GetXaxis()->SetBinLabel(i + 1, detectorlbls[i].c_str());
122+
for (unsigned int i = 0; i < detectorLabels.size(); ++i) {
123+
histos.get<TH1>(HIST("before/positivecolid/detectormap"))->GetXaxis()->SetBinLabel(i + 1, detectorLabels[i].c_str());
124+
histos.get<TH1>(HIST("before/positivecolid/detectormapmr"))->GetXaxis()->SetBinLabel(i + 1, detectorLabels[i].c_str());
176125
}
177-
for (unsigned int i = 0; i < matchlbs.size(); ++i) {
178-
histos.get<TH1>(HIST("before/positivecolid/matchcollid"))->GetXaxis()->SetBinLabel(i + 1, matchlbs[i].c_str());
179-
histos.get<TH1>(HIST("before/positivecolid/matchcollidmr"))->GetXaxis()->SetBinLabel(i + 1, matchlbs[i].c_str());
126+
for (unsigned int i = 0; i < matchLabels.size(); ++i) {
127+
histos.get<TH1>(HIST("before/positivecolid/matchcollid"))->GetXaxis()->SetBinLabel(i + 1, matchLabels[i].c_str());
128+
histos.get<TH1>(HIST("before/positivecolid/matchcollidmr"))->GetXaxis()->SetBinLabel(i + 1, matchLabels[i].c_str());
180129
}
181130

182131
/* clone the set for the other cases */
@@ -260,8 +209,7 @@ struct MatchRecoGen {
260209
"END multi-reconstructed: "
261210
"==================================================================");
262211
}
263-
histos.get<TH1>(HIST(Dir[ba]) + HIST(Colldir[collsign]) + HIST("pdgcodemr"))
264-
->Fill(TString::Format("%d", particle.pdgCode()).Data(), 1.0);
212+
histos.get<TH1>(HIST(Dir[ba]) + HIST(Colldir[collsign]) + HIST("pdgcodemr"))->Fill(TString::Format("%d", particle.pdgCode()).Data(), 1.0);
265213
}
266214
}
267215

@@ -285,10 +233,10 @@ struct MatchRecoGen {
285233
histos.fill(HIST(Dir[ba]) + HIST(Colldir[collsign]) + HIST("detectormapmr"), track1.detectorMap());
286234
histos.fill(HIST(Dir[ba]) + HIST(Colldir[collsign]) + HIST("dcaxymr"), track1.dcaXY());
287235
histos.fill(HIST(Dir[ba]) + HIST(Colldir[collsign]) + HIST("dcazmr"), track1.dcaZ());
288-
if (track1.dcaXY() < 1.0) {
236+
if (std::fabs(track1.dcaXY()) < 1.0) {
289237
histos.fill(HIST(Dir[ba]) + HIST(Colldir[collsign]) + HIST("finedcaxymr"), track1.dcaXY());
290238
}
291-
if (track1.dcaZ() < 1.0) {
239+
if (std::fabs(track1.dcaZ()) < 1.0) {
292240
histos.fill(HIST(Dir[ba]) + HIST(Colldir[collsign]) + HIST("finedcazmr"), track1.dcaZ());
293241
}
294242
histos.fill(HIST(Dir[ba]) + HIST(Colldir[collsign]) + HIST("genrecomreta"), track1.eta(), particle.eta());
@@ -308,10 +256,10 @@ struct MatchRecoGen {
308256
histos.fill(HIST(Dir[ba]) + HIST(Colldir[collsign]) + HIST("detectormap"), track.detectorMap());
309257
histos.fill(HIST(Dir[ba]) + HIST(Colldir[collsign]) + HIST("dcaxy"), track.dcaXY());
310258
histos.fill(HIST(Dir[ba]) + HIST(Colldir[collsign]) + HIST("dcaz"), track.dcaZ());
311-
if (track.dcaXY() < 1.0) {
259+
if (std::fabs(track.dcaXY()) < 1.0) {
312260
histos.fill(HIST(Dir[ba]) + HIST(Colldir[collsign]) + HIST("finedcaxy"), track.dcaXY());
313261
}
314-
if (track.dcaZ() < 1.0) {
262+
if (std::fabs(track.dcaZ()) < 1.0) {
315263
histos.fill(HIST(Dir[ba]) + HIST(Colldir[collsign]) + HIST("finedcaz"), track.dcaZ());
316264
}
317265
if (particle.mcCollisionId() != colls.iteratorAt(track.collisionId()).mcCollisionId()) {
@@ -425,10 +373,9 @@ struct MatchRecoGen {
425373
if (!(label < 0)) {
426374
if (!(track.collisionId() < 0)) {
427375
typename CollisionsObject::iterator coll = collisions.iteratorAt(track.collisionId());
428-
float centormult = -100.0f;
429-
if (isEventSelected(coll, centormult)) {
376+
if (coll.collisionaccepted() == uint8_t(true)) {
430377
/* TODO: AcceptTrack does not consider PID */
431-
if (acceptTrack<CollisionsObject>(track)) {
378+
if (!(track.trackacceptedid() < 0)) {
432379
/* the track has been accepted */
433380
nreco++;
434381
LOGF(MATCHRECGENLOGTRACKS, "Accepted track with global Id %d and collision Id %d has label %d associated to MC collision %d", recix, track.collisionId(), label, track.template mcParticle_as<aod::McParticles>().mcCollisionId());
@@ -443,23 +390,14 @@ struct MatchRecoGen {
443390
collectData<kAFTER, kPOSITIVE>(tracks, mcParticles, collisions);
444391
}
445392

446-
void processMapChecksWithCent(soa::Join<aod::FullTracks, aod::TracksDCA, aod::TrackSelection, aod::McTrackLabels> const& tracks,
447-
soa::Join<aod::CollisionsEvSelCent, aod::McCollisionLabels> const& collisions,
448-
aod::McParticles const& mcParticles)
449-
{
450-
processMapChecksBeforeCuts(tracks, collisions, mcParticles);
451-
processMapChecksAfterCuts(tracks, collisions, mcParticles);
452-
}
453-
PROCESS_SWITCH(MatchRecoGen, processMapChecksWithCent, "Process detector <=> generator levels with centrality/multiplicity information", false);
454-
455-
void processMapChecksWithoutCent(soa::Join<aod::FullTracks, aod::TracksDCA, aod::TrackSelection, aod::McTrackLabels> const& tracks,
456-
soa::Join<aod::CollisionsEvSel, aod::McCollisionLabels> const& collisions,
457-
aod::McParticles const& mcParticles)
393+
void processMapChecks(soa::Join<aod::FullTracks, aod::TracksDCA, aod::DptDptCFTracksInfo, aod::McTrackLabels> const& tracks,
394+
soa::Join<aod::Collisions, aod::DptDptCFCollisionsInfo, aod::McCollisionLabels> const& collisions,
395+
aod::McParticles const& mcParticles)
458396
{
459397
processMapChecksBeforeCuts(tracks, collisions, mcParticles);
460398
processMapChecksAfterCuts(tracks, collisions, mcParticles);
461399
}
462-
PROCESS_SWITCH(MatchRecoGen, processMapChecksWithoutCent, "Process detector <=> generator levels without centrality/multiplicity information", true);
400+
PROCESS_SWITCH(MatchRecoGen, processMapChecks, "Process detector <=> generator levels", false);
463401
};
464402

465403
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

0 commit comments

Comments
 (0)