diff --git a/PWGJE/DataModel/JetReducedData.h b/PWGJE/DataModel/JetReducedData.h index 48436e8fb75..5d3072608e3 100644 --- a/PWGJE/DataModel/JetReducedData.h +++ b/PWGJE/DataModel/JetReducedData.h @@ -73,6 +73,7 @@ DECLARE_SOA_COLUMN(ChargedTriggerSel, chargedTriggerSel, uint8_t); DECLARE_SOA_COLUMN(FullTriggerSel, fullTriggerSel, uint32_t); DECLARE_SOA_COLUMN(ChargedHFTriggerSel, chargedHFTriggerSel, uint8_t); DECLARE_SOA_COLUMN(ReadCounts, readCounts, std::vector); +DECLARE_SOA_COLUMN(ReadSelectedCounts, readSelectedCounts, std::vector); DECLARE_SOA_COLUMN(WrittenCounts, writtenCounts, std::vector); } // namespace jcollision @@ -138,10 +139,12 @@ DECLARE_SOA_TABLE(StoredJCollisionBCs, "AOD1", "JCOLLISIONBC", DECLARE_SOA_TABLE(CollisionCounts, "AOD", "COLLCOUNT", jcollision::ReadCounts, + jcollision::ReadSelectedCounts, jcollision::WrittenCounts); DECLARE_SOA_TABLE(StoredCollisionCounts, "AOD1", "COLLCOUNT", jcollision::ReadCounts, + jcollision::ReadSelectedCounts, jcollision::WrittenCounts, o2::soa::Marker<1>); diff --git a/PWGJE/DataModel/JetReducedDataHF.h b/PWGJE/DataModel/JetReducedDataHF.h index c079e897ee1..e094e915ea4 100644 --- a/PWGJE/DataModel/JetReducedDataHF.h +++ b/PWGJE/DataModel/JetReducedDataHF.h @@ -38,6 +38,7 @@ DECLARE_SOA_INDEX_COLUMN(JMcParticle, mcParticle); namespace d0collisioncounter { DECLARE_SOA_COLUMN(ReadCounts, readCounts, std::vector); +DECLARE_SOA_COLUMN(ReadSelectedCounts, readSelectedCounts, std::vector); DECLARE_SOA_COLUMN(WrittenCounts, writtenCounts, std::vector); } // namespace d0collisioncounter @@ -63,6 +64,7 @@ DECLARE_SOA_TABLE(StoredJD0PIds, "AOD1", "JD0PID", DECLARE_SOA_TABLE(D0CollisionCounts, "AOD", "D0COLLCOUNT", d0collisioncounter::ReadCounts, + d0collisioncounter::ReadSelectedCounts, d0collisioncounter::WrittenCounts); namespace jlcindices @@ -78,6 +80,7 @@ DECLARE_SOA_INDEX_COLUMN(JMcParticle, mcParticle); namespace lccollisioncounter { DECLARE_SOA_COLUMN(ReadCounts, readCounts, std::vector); +DECLARE_SOA_COLUMN(ReadSelectedCounts, readSelectedCounts, std::vector); DECLARE_SOA_COLUMN(WrittenCounts, writtenCounts, std::vector); } // namespace lccollisioncounter @@ -105,6 +108,7 @@ DECLARE_SOA_TABLE(StoredJLcPIds, "AOD1", "JLCPID", DECLARE_SOA_TABLE(LcCollisionCounts, "AOD", "LcCOLLCOUNT", lccollisioncounter::ReadCounts, + lccollisioncounter::ReadSelectedCounts, lccollisioncounter::WrittenCounts); } // namespace o2::aod diff --git a/PWGJE/TableProducer/jetderiveddataproducer.cxx b/PWGJE/TableProducer/jetderiveddataproducer.cxx index 4d4cd0d2d22..12c10a04e74 100644 --- a/PWGJE/TableProducer/jetderiveddataproducer.cxx +++ b/PWGJE/TableProducer/jetderiveddataproducer.cxx @@ -79,14 +79,6 @@ struct JetDerivedDataProducerTask { { } - void processCollisionCounts(aod::Collisions const&) - { - std::vector readCounts = {0}; - std::vector writtenCounts = {0}; - collisionCountsTable(readCounts, writtenCounts); - } - PROCESS_SWITCH(JetDerivedDataProducerTask, processCollisionCounts, "produces collision counting table", false); - void processBunchCrossings(soa::Join::iterator const& bc) { jBCsTable(bc.runNumber(), bc.globalBC(), bc.timestamp()); diff --git a/PWGJE/TableProducer/jetderiveddatawriter.cxx b/PWGJE/TableProducer/jetderiveddatawriter.cxx index 862ef28b158..083b383adcb 100644 --- a/PWGJE/TableProducer/jetderiveddatawriter.cxx +++ b/PWGJE/TableProducer/jetderiveddatawriter.cxx @@ -50,6 +50,8 @@ struct JetDerivedDataWriter { Configurable saveD0Table{"saveD0Table", false, "save the D0 table to the output"}; Configurable saveLcTable{"saveLcTable", false, "save the Lc table to the output"}; + Configurable eventSelectionForCounting{"eventSelectionForCounting", "sel8", "choose event selection for collision counter"}; + Produces storedCollisionCountsTable; Produces storedJDummysTable; Produces storedJBCsTable; @@ -109,10 +111,12 @@ struct JetDerivedDataWriter { uint32_t precisionPositionMask; uint32_t precisionMomentumMask; + int eventSelection = -1; void init(InitContext&) { precisionPositionMask = 0xFFFFFC00; // 13 bits precisionMomentumMask = 0xFFFFFC00; // 13 bits this is currently keept at 13 bits wihich gives roughly a resolution of 1/8000. This can be increased to 15 bits if really needed + eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast(eventSelectionForCounting)); } bool acceptCollision(aod::JCollision const&) @@ -189,33 +193,42 @@ struct JetDerivedDataWriter { void processCollisionCounting(aod::JCollisions const& collisions, aod::CollisionCounts const& collisionCounts) { int readCollisionCounter = 0; + int readSelectedCollisionCounter = 0; int writtenCollisionCounter = 0; for (const auto& collision : collisions) { readCollisionCounter++; + if (jetderiveddatautilities::selectCollision(collision, eventSelection)) { + readSelectedCollisionCounter++; + } if (collisionFlag[collision.globalIndex()]) { writtenCollisionCounter++; } } std::vector previousReadCounts; + std::vector previousReadSelectedCounts; std::vector previousWrittenCounts; int iPreviousDataFrame = 0; for (const auto& collisionCount : collisionCounts) { auto readCollisionCounterSpan = collisionCount.readCounts(); + auto readSelectedCollisionCounterSpan = collisionCount.readSelectedCounts(); auto writtenCollisionCounterSpan = collisionCount.writtenCounts(); if (iPreviousDataFrame == 0) { std::copy(readCollisionCounterSpan.begin(), readCollisionCounterSpan.end(), std::back_inserter(previousReadCounts)); + std::copy(readSelectedCollisionCounterSpan.begin(), readSelectedCollisionCounterSpan.end(), std::back_inserter(previousReadSelectedCounts)); std::copy(writtenCollisionCounterSpan.begin(), writtenCollisionCounterSpan.end(), std::back_inserter(previousWrittenCounts)); } else { for (unsigned int i = 0; i < previousReadCounts.size(); i++) { previousReadCounts[i] += readCollisionCounterSpan[i]; + previousReadSelectedCounts[i] += readSelectedCollisionCounterSpan[i]; previousWrittenCounts[i] += writtenCollisionCounterSpan[i]; } } iPreviousDataFrame++; } previousReadCounts.push_back(readCollisionCounter); + previousReadCounts.push_back(readSelectedCollisionCounter); previousWrittenCounts.push_back(writtenCollisionCounter); - storedCollisionCountsTable(previousReadCounts, previousWrittenCounts); + storedCollisionCountsTable(previousReadCounts, previousReadSelectedCounts, previousWrittenCounts); } PROCESS_SWITCH(JetDerivedDataWriter, processCollisionCounting, "write out collision counting output table", false); diff --git a/PWGJE/Tasks/jetsubstructurehfoutput.cxx b/PWGJE/Tasks/jetsubstructurehfoutput.cxx index acd25f40656..07bda0671d4 100644 --- a/PWGJE/Tasks/jetsubstructurehfoutput.cxx +++ b/PWGJE/Tasks/jetsubstructurehfoutput.cxx @@ -32,6 +32,7 @@ #include "PWGJE/DataModel/JetSubstructure.h" #include "PWGJE/Core/JetFinder.h" #include "PWGJE/Core/JetFindingUtilities.h" +#include "PWGJE/Core/JetDerivedDataUtilities.h" using namespace o2; using namespace o2::framework; @@ -79,6 +80,8 @@ struct JetSubstructureHFOutputTask { Configurable trackEtaMin{"trackEtaMin", -0.9, "minimum track pseudorapidity"}; Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum track pseudorapidity"}; + Configurable eventSelectionForCounting{"eventSelectionForCounting", "sel8", "choose event selection for collision counter"}; + std::map candidateMapping; std::map candidateCollisionMapping; @@ -91,9 +94,11 @@ struct JetSubstructureHFOutputTask { std::vector jetRadiiValues; + int eventSelection = -1; void init(InitContext const&) { jetRadiiValues = (std::vector)jetRadii; + eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast(eventSelectionForCounting)); } template @@ -262,28 +267,39 @@ struct JetSubstructureHFOutputTask { void processCountCollisions(JetCollisions const& collisions, aod::CollisionCounts const& collisionCounts) { int readCollisionCounter = 0; + int readSelectedCollisionCounter = 0; int writtenCollisionCounter = -1; - readCollisionCounter = collisions.size(); + for (auto const& collision : collisions) { + readCollisionCounter++; + if (jetderiveddatautilities::selectCollision(collision, eventSelection)) { + readSelectedCollisionCounter++; + } + } std::vector previousReadCounts; + std::vector previousReadSelectedCounts; std::vector previousWrittenCounts; int iPreviousDataFrame = 0; for (const auto& collisionCount : collisionCounts) { auto readCollisionCounterSpan = collisionCount.readCounts(); + auto readSelectedCollisionCounterSpan = collisionCount.readSelectedCounts(); auto writtenCollisionCounterSpan = collisionCount.writtenCounts(); if (iPreviousDataFrame == 0) { std::copy(readCollisionCounterSpan.begin(), readCollisionCounterSpan.end(), std::back_inserter(previousReadCounts)); + std::copy(readSelectedCollisionCounterSpan.begin(), readSelectedCollisionCounterSpan.end(), std::back_inserter(previousReadSelectedCounts)); std::copy(writtenCollisionCounterSpan.begin(), writtenCollisionCounterSpan.end(), std::back_inserter(previousWrittenCounts)); } else { for (unsigned int i = 0; i < previousReadCounts.size(); i++) { previousReadCounts[i] += readCollisionCounterSpan[i]; + previousReadSelectedCounts[i] += readSelectedCollisionCounterSpan[i]; previousWrittenCounts[i] += writtenCollisionCounterSpan[i]; } } iPreviousDataFrame++; } previousReadCounts.push_back(readCollisionCounter); + previousReadSelectedCounts.push_back(readSelectedCollisionCounter); previousWrittenCounts.push_back(writtenCollisionCounter); - storedCollisionCountsTable(previousReadCounts, previousWrittenCounts); + storedCollisionCountsTable(previousReadCounts, previousReadSelectedCounts, previousWrittenCounts); } PROCESS_SWITCH(JetSubstructureHFOutputTask, processCountCollisions, "process function that counts read in collisions", false); diff --git a/PWGJE/Tasks/jetsubstructureoutput.cxx b/PWGJE/Tasks/jetsubstructureoutput.cxx index e362bf8abb6..dd7e6b49fb6 100644 --- a/PWGJE/Tasks/jetsubstructureoutput.cxx +++ b/PWGJE/Tasks/jetsubstructureoutput.cxx @@ -29,6 +29,7 @@ #include "PWGJE/Core/JetFindingUtilities.h" #include "PWGJE/DataModel/Jet.h" #include "PWGJE/DataModel/JetSubstructure.h" +#include "PWGJE/Core/JetDerivedDataUtilities.h" using namespace o2; using namespace o2::framework; @@ -68,6 +69,8 @@ struct JetSubstructureOutputTask { Configurable trackEtaMin{"trackEtaMin", -0.9, "minimum track pseudorapidity"}; Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum track pseudorapidity"}; + Configurable eventSelectionForCounting{"eventSelectionForCounting", "sel8", "choose event selection for collision counter"}; + std::map jetMappingData; std::map jetMappingDataSub; std::map jetMappingMCD; @@ -75,9 +78,11 @@ struct JetSubstructureOutputTask { std::vector jetRadiiValues; + int eventSelection = -1; void init(InitContext const&) { jetRadiiValues = (std::vector)jetRadii; + eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast(eventSelectionForCounting)); } template @@ -181,28 +186,39 @@ struct JetSubstructureOutputTask { void processCountCollisions(JetCollisions const& collisions, aod::CollisionCounts const& collisionCounts) { int readCollisionCounter = 0; + int readSelectedCollisionCounter = 0; int writtenCollisionCounter = -1; - readCollisionCounter = collisions.size(); + for (auto const& collision : collisions) { + readCollisionCounter++; + if (jetderiveddatautilities::selectCollision(collision, eventSelection)) { + readSelectedCollisionCounter++; + } + } std::vector previousReadCounts; + std::vector previousReadSelectedCounts; std::vector previousWrittenCounts; int iPreviousDataFrame = 0; for (const auto& collisionCount : collisionCounts) { auto readCollisionCounterSpan = collisionCount.readCounts(); + auto readSelectedCollisionCounterSpan = collisionCount.readSelectedCounts(); auto writtenCollisionCounterSpan = collisionCount.writtenCounts(); if (iPreviousDataFrame == 0) { std::copy(readCollisionCounterSpan.begin(), readCollisionCounterSpan.end(), std::back_inserter(previousReadCounts)); + std::copy(readSelectedCollisionCounterSpan.begin(), readSelectedCollisionCounterSpan.end(), std::back_inserter(previousReadSelectedCounts)); std::copy(writtenCollisionCounterSpan.begin(), writtenCollisionCounterSpan.end(), std::back_inserter(previousWrittenCounts)); } else { for (unsigned int i = 0; i < previousReadCounts.size(); i++) { previousReadCounts[i] += readCollisionCounterSpan[i]; + previousReadSelectedCounts[i] += readSelectedCollisionCounterSpan[i]; previousWrittenCounts[i] += writtenCollisionCounterSpan[i]; } } iPreviousDataFrame++; } previousReadCounts.push_back(readCollisionCounter); + previousReadSelectedCounts.push_back(readSelectedCollisionCounter); previousWrittenCounts.push_back(writtenCollisionCounter); - storedCollisionCountsTable(previousReadCounts, previousWrittenCounts); + storedCollisionCountsTable(previousReadCounts, previousReadSelectedCounts, previousWrittenCounts); } PROCESS_SWITCH(JetSubstructureOutputTask, processCountCollisions, "process function that counts read in collisions", false);