Skip to content

Commit 342fd8b

Browse files
authored
[PWGEM/Dilepton] add status code in mc particle table (#13625)
1 parent d3c535e commit 342fd8b

File tree

6 files changed

+102
-12
lines changed

6 files changed

+102
-12
lines changed

PWGEM/Dilepton/DataModel/dileptonTables.h

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(Y, y, //! Particle rapidity
301301
} // namespace emmcparticle
302302

303303
// This table contains all MC truth tracks
304-
DECLARE_SOA_TABLE_FULL(EMMCParticles, "EMMCParticles", "AOD", "EMMCPARTICLE", //! MC track information (on disk)
304+
DECLARE_SOA_TABLE_FULL(EMMCParticles_000, "EMMCParticles", "AOD", "EMMCPARTICLE", //! MC track information (on disk)
305305
o2::soa::Index<>, emmcparticle::EMMCEventId,
306306
mcparticle::PdgCode, mcparticle::Flags,
307307
emmcparticle::MothersIds, emmcparticle::DaughtersIds,
@@ -312,13 +312,33 @@ DECLARE_SOA_TABLE_FULL(EMMCParticles, "EMMCParticles", "AOD", "EMMCPARTICLE", //
312312
emmcparticle::Pt<mcparticle::Px, mcparticle::Py>,
313313
emmcparticle::Eta<mcparticle::Px, mcparticle::Py, mcparticle::Pz>,
314314
emmcparticle::Phi<mcparticle::Px, mcparticle::Py>,
315-
316315
emmcparticle::P<mcparticle::Px, mcparticle::Py, mcparticle::Pz>,
317316
emmcparticle::Y<mcparticle::Pz, mcparticle::E>,
318317
mcparticle::ProducedByGenerator<mcparticle::Flags>,
319318
mcparticle::FromBackgroundEvent<mcparticle::Flags>,
320319
mcparticle::IsPhysicalPrimary<mcparticle::Flags>);
321320

321+
DECLARE_SOA_TABLE_VERSIONED(EMMCParticles_001, "AOD", "EMMCPARTICLE", 1, //! MC track information (on disk)
322+
o2::soa::Index<>, emmcparticle::EMMCEventId,
323+
mcparticle::PdgCode, mcparticle::Flags, mcparticle::StatusCode,
324+
emmcparticle::MothersIds, emmcparticle::DaughtersIds,
325+
mcparticle::Px, mcparticle::Py, mcparticle::Pz, mcparticle::E,
326+
mcparticle::Vx, mcparticle::Vy, mcparticle::Vz,
327+
328+
// dynamic column
329+
emmcparticle::Pt<mcparticle::Px, mcparticle::Py>,
330+
emmcparticle::Eta<mcparticle::Px, mcparticle::Py, mcparticle::Pz>,
331+
emmcparticle::Phi<mcparticle::Px, mcparticle::Py>,
332+
emmcparticle::P<mcparticle::Px, mcparticle::Py, mcparticle::Pz>,
333+
emmcparticle::Y<mcparticle::Pz, mcparticle::E>,
334+
mcparticle::ProducedByGenerator<mcparticle::Flags>,
335+
mcparticle::FromBackgroundEvent<mcparticle::Flags>,
336+
mcparticle::IsPhysicalPrimary<mcparticle::Flags>,
337+
mcparticle::GetGenStatusCode<mcparticle::Flags, mcparticle::StatusCode>,
338+
mcparticle::GetHepMCStatusCode<mcparticle::Flags, mcparticle::StatusCode>,
339+
mcparticle::GetProcess<mcparticle::Flags, mcparticle::StatusCode>);
340+
341+
using EMMCParticles = EMMCParticles_001;
322342
using EMMCParticle = EMMCParticles::iterator;
323343

324344
namespace emmcgenvectormeson

PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ struct AssociateMCInfoDilepton {
625625
}
626626
}
627627

628-
emmcparticles(fEventIdx.find(oldLabel)->second, mctrack.pdgCode(), mctrack.flags(),
628+
emmcparticles(fEventIdx.find(oldLabel)->second, mctrack.pdgCode(), mctrack.flags(), mctrack.statusCode(),
629629
mothers, daughters,
630630
mctrack.px(), mctrack.py(), mctrack.pz(), mctrack.e(),
631631
mctrack.vx(), mctrack.vy(), mctrack.vz());

PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,8 @@ o2physics_add_dpl_workflow(muon-converter1
5050
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
5151
COMPONENT_NAME Analysis)
5252

53+
o2physics_add_dpl_workflow(mcparticle-converter1
54+
SOURCES mcParticleConverter1.cxx
55+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
56+
COMPONENT_NAME Analysis)
57+
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
//
12+
// ========================
13+
//
14+
// This code produces emmctable table 001 from 000.
15+
// Please write to: daiki.sekihata@cern.ch
16+
17+
#include "PWGEM/Dilepton/DataModel/dileptonTables.h"
18+
19+
#include "Framework/ASoAHelpers.h"
20+
#include "Framework/AnalysisTask.h"
21+
#include "Framework/runDataProcessing.h"
22+
23+
#include <vector>
24+
25+
using namespace o2;
26+
using namespace o2::aod;
27+
using namespace o2::framework;
28+
using namespace o2::framework::expressions;
29+
using namespace o2::soa;
30+
31+
struct mcParticleConverter1 {
32+
Produces<aod::EMMCParticles_001> mcParticle_001;
33+
34+
void process(aod::EMMCParticles_000 const& mcParticles)
35+
{
36+
for (const auto& mcParticle : mcParticles) {
37+
// LOGF(info, "mcParticles.emmceventId() = %d, mcParticle.mothersIds().size() = %d, mcParticle.daughtersIds().size() = %d", mcParticle.emmceventId(), mcParticle.mothersIds().size(), mcParticle.daughtersIds().size());
38+
39+
std::vector<int> mothersIds;
40+
for (const auto& id : mcParticle.mothersIds()) {
41+
mothersIds.emplace_back(id);
42+
}
43+
44+
std::vector<int> daughtersIds;
45+
for (const auto& id : mcParticle.daughtersIds()) {
46+
daughtersIds.emplace_back(id);
47+
}
48+
49+
mcParticle_001(
50+
mcParticle.emmceventId(), mcParticle.pdgCode(), mcParticle.flags(), 0,
51+
mothersIds, daughtersIds,
52+
mcParticle.px(), mcParticle.py(), mcParticle.pz(), mcParticle.e(),
53+
mcParticle.vx(), mcParticle.vy(), mcParticle.vz());
54+
} // end of mc particle loop
55+
}
56+
};
57+
58+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
59+
{
60+
return WorkflowSpec{adaptAnalysisTask<mcParticleConverter1>(cfgc, TaskName{"mcparticle-converter1"})};
61+
}

PWGEM/Dilepton/Utils/MCUtilities.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp
317317
auto mp = mcparticles.iteratorAt(motherid1);
318318
mothers_id1.emplace_back(motherid1);
319319
mothers_pdg1.emplace_back(mp.pdgCode());
320-
320+
// LOGF(info, "mp1.globalIndex() = %d, mp1.pdgCode() = %d, mp1.getGenStatusCode() = %d", mp.globalIndex(), mp.pdgCode(), mp.getGenStatusCode());
321321
if (mp.has_mothers()) {
322322
motherid1 = mp.mothersIds()[0];
323323
} else {
@@ -337,6 +337,7 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp
337337
auto mp = mcparticles.iteratorAt(motherid2);
338338
mothers_id2.emplace_back(motherid2);
339339
mothers_pdg2.emplace_back(mp.pdgCode());
340+
// LOGF(info, "mp2.globalIndex() = %d, mp2.pdgCode() = %d, mp2.getGenStatusCode() = %d", mp.globalIndex(), mp.pdgCode(), mp.getGenStatusCode());
340341

341342
if (mp.has_mothers()) {
342343
motherid2 = mp.mothersIds()[0];
@@ -348,6 +349,8 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp
348349
}
349350
}
350351

352+
// require correlation between q-qbar. (not q-q) // need statusCode
353+
351354
bool is_direct_from_b1 = IsFromBeauty(p1, mcparticles) > 0 && IsFromCharm(p1, mcparticles) < 0;
352355
bool is_direct_from_b2 = IsFromBeauty(p2, mcparticles) > 0 && IsFromCharm(p2, mcparticles) < 0;
353356
bool is_prompt_c1 = IsFromBeauty(p1, mcparticles) < 0 && IsFromCharm(p1, mcparticles) > 0;

PWGEM/PhotonMeson/TableProducer/associateMCinfoPhoton.cxx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,17 @@
1616
/// \author Daiki Sekihata (daiki.sekihata@cern.ch)
1717
///
1818

19-
#include <map>
20-
#include <vector>
19+
#include "PWGEM/PhotonMeson/DataModel/gammaTables.h"
20+
#include "PWGEM/PhotonMeson/Utils/MCUtilities.h"
2121

22-
#include "Framework/runDataProcessing.h"
23-
#include "Framework/AnalysisTask.h"
24-
#include "Framework/AnalysisDataModel.h"
2522
#include "Framework/ASoAHelpers.h"
23+
#include "Framework/AnalysisDataModel.h"
24+
#include "Framework/AnalysisTask.h"
25+
#include "Framework/runDataProcessing.h"
2626
#include "ReconstructionDataFormats/Track.h"
27-
#include "PWGEM/PhotonMeson/DataModel/gammaTables.h"
28-
#include "PWGEM/PhotonMeson/Utils/MCUtilities.h"
27+
28+
#include <map>
29+
#include <vector>
2930

3031
using namespace o2;
3132
using namespace o2::framework;
@@ -434,7 +435,7 @@ struct AssociateMCInfoPhoton {
434435
}
435436
}
436437

437-
emmcparticles(fEventIdx.find(oldLabel)->second, mcParticle.pdgCode(), mcParticle.flags(),
438+
emmcparticles(fEventIdx.find(oldLabel)->second, mcParticle.pdgCode(), mcParticle.flags(), mcParticle.statusCode(),
438439
mothers, daughters,
439440
mcParticle.px(), mcParticle.py(), mcParticle.pz(), mcParticle.e(),
440441
mcParticle.vx(), mcParticle.vy(), mcParticle.vz());

0 commit comments

Comments
 (0)