Skip to content

Commit

Permalink
adding tables and columns to the JMCCollision Tables to access Genera…
Browse files Browse the repository at this point in the history
…torsID from AO2Ds
  • Loading branch information
Archita-Dash committed Dec 11, 2024
1 parent f779e86 commit dea9ac7
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
20 changes: 19 additions & 1 deletion PWGJE/DataModel/JetReducedData.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,32 @@ DECLARE_SOA_INDEX_COLUMN(McCollision, mcCollision);
DECLARE_SOA_COLUMN(PosX, posX, float);
DECLARE_SOA_COLUMN(PosY, posY, float);
DECLARE_SOA_COLUMN(PosZ, posZ, float);
DECLARE_SOA_COLUMN(GeneratorsID, generatorsID, short);
DECLARE_SOA_COLUMN(Weight, weight, float);
DECLARE_SOA_COLUMN(Accepted, accepted, uint64_t);
DECLARE_SOA_COLUMN(Attempted, attempted, uint64_t);
DECLARE_SOA_COLUMN(XsectGen, xsectGen, float);
DECLARE_SOA_COLUMN(XsectErr, xsectErr, float);
DECLARE_SOA_COLUMN(PtHard, ptHard, float);
DECLARE_SOA_COLUMN(NMPI, nMPI, int);
DECLARE_SOA_DYNAMIC_COLUMN(GetGeneratorId, getGeneratorId,
[](short generatorsID) -> int { return o2::mcgenid::getGeneratorId(generatorsID); });
} // namespace jmccollision
DECLARE_SOA_TABLE_STAGED(JMcCollisions, "JMCCOLLISION",
o2::soa::Index<>,
jmccollision::PosX,
jmccollision::PosY,
jmccollision::PosZ,
jmccollision::Weight);
jmccollision::GeneratorsID,
jmccollision::Weight,
jmccollision::Accepted,
jmccollision::Attempted,
jmccollision::XsectGen,
jmccollision::XsectErr,
jmccollision::PtHard,
jmccollision::NMPI,
jmccollision::GetGeneratorId<jmccollision::GeneratorsID>);


using JMcCollision = JMcCollisions::iterator;
using StoredJMcCollision = StoredJMcCollisions::iterator;
Expand Down
4 changes: 2 additions & 2 deletions PWGJE/TableProducer/derivedDataProducer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ struct JetDerivedDataProducerTask {
}
PROCESS_SWITCH(JetDerivedDataProducerTask, processMcCollisionLabels, "produces derived MC collision labels table", false);

void processMcCollisions(aod::McCollision const& McCollision)
void processMcCollisions(soa::Join<aod::McCollisions, aod::HepMCXSections>::iterator const& McCollision)
{
jMcCollisionsTable(McCollision.posX(), McCollision.posY(), McCollision.posZ(), McCollision.weight());
jMcCollisionsTable(McCollision.posX(), McCollision.posY(), McCollision.posZ(), McCollision.getGeneratorId(), McCollision.weight(), McCollision.accepted(), McCollision.attempted(), McCollision.xsectGen(), McCollision.xsectErr(), McCollision.ptHard(), McCollision.nMPI());
jMcCollisionsParentIndexTable(McCollision.globalIndex());
}
PROCESS_SWITCH(JetDerivedDataProducerTask, processMcCollisions, "produces derived MC collision table", false);
Expand Down
4 changes: 2 additions & 2 deletions PWGJE/TableProducer/derivedDataWriter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ struct JetDerivedDataWriter {

const auto particlesPerMcCollision = particles.sliceBy(ParticlesPerMcCollision, mcCollision.globalIndex());

products.storedJMcCollisionsTable(mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), mcCollision.weight());
products.storedJMcCollisionsTable(mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), mcCollision.generatorsID(), mcCollision.weight(), mcCollision.accepted(), mcCollision.attempted(), mcCollision.xsectGen(), mcCollision.xsectErr(), mcCollision.ptHard(), mcCollision.nMPI());
products.storedJMcCollisionsParentIndexTable(mcCollision.mcCollisionId());
mcCollisionMapping.insert(std::make_pair(mcCollision.globalIndex(), products.storedJMcCollisionsTable.lastIndex()));

Expand Down Expand Up @@ -1009,7 +1009,7 @@ struct JetDerivedDataWriter {
if (McCollisionFlag[mcCollision.globalIndex()]) { // you can also check if any of its detector level counterparts are correct
std::map<int32_t, int32_t> paticleMapping;

products.storedJMcCollisionsTable(mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), mcCollision.weight());
products.storedJMcCollisionsTable(mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), mcCollision.getGeneratorId(), mcCollision.weight(), mcCollision.accepted(), mcCollision.attempted(), mcCollision.xsectGen(), mcCollision.xsectErr(), mcCollision.ptHard(), mcCollision.nMPI());
products.storedJMcCollisionsParentIndexTable(mcCollision.mcCollisionId());

const auto particlesPerMcCollision = particles.sliceBy(ParticlesPerMcCollision, mcCollision.globalIndex());
Expand Down
21 changes: 21 additions & 0 deletions PWGJE/Tasks/jetFinderQA.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,14 @@ struct JetFinderQATask {
if (doprocessMCCollisionsWeighted) {
AxisSpec weightAxis = {{VARIABLE_WIDTH, 1e-13, 1e-12, 1e-11, 1e-10, 1e-9, 1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1.0, 10.0}, "weights"};
registry.add("h_collision_eventweight_part", "event weight;event weight;entries", {HistType::kTH1F, {weightAxis}});
registry.add("h_generatorsID", "GeneratorsID;GeneratorsID;entries", {HistType::kTH1F, {{200000, 1.,200000.}}});
registry.add("h_accepted", "No. of Generated Events;No. of Generated Events;entries", {HistType::kTH1F, {{100, -2.,2.}}});
registry.add("h_attempted","No. of Attempted Events;No. of Attempted Events;entries", {HistType::kTH1F, {{100, -2.,2.}}});
registry.add("h_xsecGen", "Cross section in pb; Cross section in pb; entries", {HistType::kTH1F, {{200000, -0.5,200000.}}});
registry.add("h_xsecErr", "Error associated with the cross section", {HistType::kTH1F, {{200000, -0.5,200000.}}});
registry.add("h_ptHard", "ptHard; ptHard; entries", {HistType::kTH1F, {{1000, 0.,1000.}}});
registry.add("h_nMPI", "nMPI; nMPI; entries", {HistType::kTH1F, {{1000, 0.,1000}}});
registry.add("h_xsecGenSum", "Summed Cross section per collision in pb; Summed Cross section per collision in pb; entries", {HistType::kTH1F, {{100, 0.,1.}}});
}
}

Expand Down Expand Up @@ -924,7 +932,20 @@ struct JetFinderQATask {

void processMCCollisionsWeighted(aod::JetMcCollision const& collision)
{
// auto xsecGenSum = 0.0;
// xsecGenSum += collision.xsectGen();
// std::cout << collision.xsectGen() << std::endl;
// std::cout << collision.generatorsID() << std::endl;
// std::cout << collision.getGeneratorId() << std::endl;
registry.fill(HIST("h_collision_eventweight_part"), collision.weight());
registry.fill(HIST("h_generatorsID"), collision.getGeneratorId());
registry.fill(HIST("h_accepted"), collision.accepted());
registry.fill(HIST("h_attempted"), collision.attempted());
registry.fill(HIST("h_xsecGen"), collision.xsectGen());
registry.fill(HIST("h_xsecErr"), collision.xsectErr());
registry.fill(HIST("h_ptHard"), collision.ptHard());
registry.fill(HIST("h_nMPI"), collision.nMPI());
registry.fill(HIST("h_xsecGenSum"),0.5, collision.xsectGen());
}
PROCESS_SWITCH(JetFinderQATask, processMCCollisionsWeighted, "collision QA for weighted events", false);

Expand Down

0 comments on commit dea9ac7

Please sign in to comment.