Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 21 additions & 22 deletions PWGEM/PhotonMeson/DataModel/bcWiseTables.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in PWGEM/PhotonMeson/DataModel/bcWiseTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/file-cpp]

Use lowerCamelCase or UpperCamelCase for names of C++ files. See the O2 naming conventions for details.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand Down Expand Up @@ -36,7 +36,7 @@
kNCells,
kM02,
kTime,
kFT0MCent,
kCent,
kZVtx,
kFT0Amp,
kpT,
Expand All @@ -54,7 +54,7 @@
1E0, // Number of cells
1E4, // M02
1E2, // Cluster time
2E0, // FT0M centrality
2E0, // FT0 centrality
1E3, // Z-vertex position
1E-1, // FT0M amplitude
1E3, // MC pi0 pt
Expand All @@ -64,37 +64,36 @@

namespace bcwisebc
{
DECLARE_SOA_COLUMN(HasFT0, hasFT0, bool); //! has_foundFT0()
DECLARE_SOA_COLUMN(HasTVX, hasTVX, bool); //! has the TVX trigger flag
DECLARE_SOA_COLUMN(HaskTVXinEMC, haskTVXinEMC, bool); //! kTVXinEMC
DECLARE_SOA_COLUMN(HasEMCCell, hasEMCCell, bool); //! at least one EMCal cell in the BC
DECLARE_SOA_COLUMN(StoredCentrality, storedCentrality, uint8_t); //! FT0M centrality (0-100) (x2)
DECLARE_SOA_COLUMN(StoredFT0MAmplitude, storedFT0MAmplitude, uint16_t); //! ft0a+c amplitude
DECLARE_SOA_COLUMN(StoredMu, storedMu, uint16_t); //! probability of TVX collision per BC (x1000)
DECLARE_SOA_COLUMN(StoredTimeSinceSOF, storedTimeSinceSOF, uint16_t); //! time since decreation of ADJUST in seconds (x2)

DECLARE_SOA_DYNAMIC_COLUMN(Centrality, centrality, [](uint8_t storedcentrality) -> float { return std::nextafter(storedcentrality / emdownscaling::downscalingFactors[emdownscaling::kFT0MCent], std::numeric_limits<float>::infinity()); }); //! Centrality (0-100)
DECLARE_SOA_DYNAMIC_COLUMN(FT0MAmplitude, ft0Amplitude, [](uint16_t storedFT0MAmplitude) -> float { return std::nextafter(storedFT0MAmplitude / emdownscaling::downscalingFactors[emdownscaling::kFT0Amp], std::numeric_limits<float>::infinity()); }); //! FT0M amplitude
DECLARE_SOA_DYNAMIC_COLUMN(Mu, mu, [](uint16_t storedMu) -> float { return std::nextafter(storedMu / emdownscaling::downscalingFactors[emdownscaling::kMu], std::numeric_limits<float>::infinity()); }); //! probability of TVX collision per BC
DECLARE_SOA_COLUMN(HasFT0, hasFT0, bool); //! has_foundFT0()
DECLARE_SOA_COLUMN(HasTVX, hasTVX, bool); //! has the TVX trigger flag
DECLARE_SOA_COLUMN(HaskTVXinEMC, haskTVXinEMC, bool); //! kTVXinEMC
DECLARE_SOA_COLUMN(HasEMCCell, hasEMCCell, bool); //! at least one EMCal cell in the BC
DECLARE_SOA_COLUMN(StoredFT0CCentrality, storedFt0CCentrality, uint8_t); //! FT0C centrality (0-100) (x2)

Check failure on line 71 in PWGEM/PhotonMeson/DataModel/bcWiseTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(StoredFT0MCentrality, storedFT0MCentrality, uint8_t); //! FT0M centrality (0-100) (x2)
DECLARE_SOA_COLUMN(StoredFT0MAmplitude, storedFT0MAmplitude, uint16_t); //! ft0a+c amplitude
DECLARE_SOA_COLUMN(StoredMu, storedMu, uint16_t); //! probability of TVX collision per BC (x1000)
DECLARE_SOA_COLUMN(StoredTimeSinceSOF, storedTimeSinceSOF, uint16_t); //! time since decreation of ADJUST in seconds (x2)

DECLARE_SOA_DYNAMIC_COLUMN(FT0CCentrality, ft0cCentrality, [](uint8_t storedft0ccentrality) -> float { return std::nextafter(storedft0ccentrality / emdownscaling::downscalingFactors[emdownscaling::kCent], std::numeric_limits<float>::infinity()); }); //! Centrality (0-100)

Check failure on line 77 in PWGEM/PhotonMeson/DataModel/bcWiseTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_DYNAMIC_COLUMN(FT0MCentrality, ft0mCentrality, [](uint8_t storedft0mcentrality) -> float { return std::nextafter(storedft0mcentrality / emdownscaling::downscalingFactors[emdownscaling::kCent], std::numeric_limits<float>::infinity()); }); //! Centrality (0-100)

Check failure on line 78 in PWGEM/PhotonMeson/DataModel/bcWiseTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_DYNAMIC_COLUMN(FT0MAmplitude, ft0Amplitude, [](uint16_t storedFT0MAmplitude) -> float { return std::nextafter(storedFT0MAmplitude / emdownscaling::downscalingFactors[emdownscaling::kFT0Amp], std::numeric_limits<float>::infinity()); }); //! FT0M amplitude

Check failure on line 79 in PWGEM/PhotonMeson/DataModel/bcWiseTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_DYNAMIC_COLUMN(Mu, mu, [](uint16_t storedMu) -> float { return std::nextafter(storedMu / emdownscaling::downscalingFactors[emdownscaling::kMu], std::numeric_limits<float>::infinity()); }); //! probability of TVX collision per BC
DECLARE_SOA_DYNAMIC_COLUMN(TimeSinceSOF, timeSinceSOF, [](uint16_t storedTimeSinceSOF) -> float { return std::nextafter(storedTimeSinceSOF / emdownscaling::downscalingFactors[emdownscaling::kTimeSinceSOF], std::numeric_limits<float>::infinity()); }); //! probability of TVX collision per BC
} // namespace bcwisebc
DECLARE_SOA_TABLE(BCWiseBCs, "AOD", "BCWISEBC", //! table of bc wise centrality estimation and event selection input
o2::soa::Index<>, bcwisebc::HasFT0, bcwisebc::HasTVX, bcwisebc::HaskTVXinEMC, bcwisebc::HasEMCCell, bcwisebc::StoredCentrality,
bcwisebc::StoredFT0MAmplitude, bcwisebc::StoredMu, bcwisebc::StoredTimeSinceSOF, bcwisebc::Centrality<bcwisebc::StoredCentrality>, bcwisebc::FT0MAmplitude<bcwisebc::StoredFT0MAmplitude>, bcwisebc::Mu<bcwisebc::StoredMu>, bcwisebc::TimeSinceSOF<bcwisebc::StoredTimeSinceSOF>);
o2::soa::Index<>, bcwisebc::HasFT0, bcwisebc::HasTVX, bcwisebc::HaskTVXinEMC, bcwisebc::HasEMCCell, bcwisebc::StoredFT0CCentrality, bcwisebc::StoredFT0MCentrality,
bcwisebc::StoredFT0MAmplitude, bcwisebc::StoredMu, bcwisebc::StoredTimeSinceSOF, bcwisebc::FT0CCentrality<bcwisebc::StoredFT0CCentrality>, bcwisebc::FT0MCentrality<bcwisebc::StoredFT0MCentrality>, bcwisebc::FT0MAmplitude<bcwisebc::StoredFT0MAmplitude>, bcwisebc::Mu<bcwisebc::StoredMu>, bcwisebc::TimeSinceSOF<bcwisebc::StoredTimeSinceSOF>);

DECLARE_SOA_INDEX_COLUMN(BCWiseBC, bcWiseBC); //! bunch crossing ID used as index

Check failure on line 87 in PWGEM/PhotonMeson/DataModel/bcWiseTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.

namespace bcwisecollision
{
DECLARE_SOA_COLUMN(StoredCentrality, storedCentrality, uint8_t); //! FT0M centrality (0-100) (x2)
DECLARE_SOA_COLUMN(StoredZVtx, storedZVtx, int16_t); //! Z-vertex position (x1000)
DECLARE_SOA_COLUMN(StoredZVtx, storedZVtx, int16_t); //! Z-vertex position (x1000)

DECLARE_SOA_DYNAMIC_COLUMN(Centrality, centrality, [](uint8_t storedcentrality) -> float { return std::nextafter(storedcentrality / emdownscaling::downscalingFactors[emdownscaling::kFT0MCent], std::numeric_limits<float>::infinity()); }); //! Centrality (0-100)
DECLARE_SOA_DYNAMIC_COLUMN(ZVtx, zVtx, [](int16_t storedzvtx) -> float { return storedzvtx / emdownscaling::downscalingFactors[emdownscaling::kZVtx]; }); //! Centrality (0-100)
DECLARE_SOA_DYNAMIC_COLUMN(ZVtx, zVtx, [](int16_t storedzvtx) -> float { return storedzvtx / emdownscaling::downscalingFactors[emdownscaling::kZVtx]; }); //! Z-Vertex
} // namespace bcwisecollision
DECLARE_SOA_TABLE(BCWiseCollisions, "AOD", "BCWISECOLL", //! table of skimmed EMCal clusters
o2::soa::Index<>, BCWiseBCId, bcwisecollision::StoredCentrality, bcwisecollision::StoredZVtx,
bcwisecollision::Centrality<bcwisecollision::StoredCentrality>, bcwisecollision::ZVtx<bcwisecollision::StoredZVtx>);
o2::soa::Index<>, BCWiseBCId, bcwisecollision::StoredZVtx, bcwisecollision::ZVtx<bcwisecollision::StoredZVtx>);

namespace bcwisecluster
{
Expand Down
62 changes: 46 additions & 16 deletions PWGEM/PhotonMeson/TableProducer/bcWiseClusterSkimmer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
using namespace o2::framework;
using namespace o2::framework::expressions;

using MyCollisions = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Ms>;
using MyMCCollisions = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Ms, aod::McCollisionLabels>;
using MyBCs = soa::Join<aod::BCs, aod::BcSels, aod::Timestamps, aod::BCCentFT0Ms>;
using MyCollisions = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::CentFT0Ms>;
using MyMCCollisions = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::CentFT0Ms, aod::McCollisionLabels>;
using MyBCs = soa::Join<aod::BCs, aod::BcSels, aod::Timestamps, aod::BCCentFT0Cs, aod::BCCentFT0Ms, aod::Run3MatchedToBCSparse>;

using SelectedUniqueClusters = soa::Filtered<aod::EMCALClusters>; // Clusters from collisions with only one collision in the BC
using SelectedUniqueMCClusters = soa::Filtered<soa::Join<aod::EMCALClusters, aod::EMCALMCClusters>>; // Clusters from collisions with only one collision in the BC
Expand Down Expand Up @@ -98,12 +98,20 @@
{
const int nEventBins = 6;
mHistManager.add("nBCs", "Number of BCs;;#bf{#it{N}_{BCs}}", HistType::kTH1F, {{nEventBins, -0.5, 5.5}});
const TString binLabels[nEventBins] = {"All", "FT0", "TVX", "kTVXinEMC", "Cell", "NoBorder"};
const TString binLabels[nEventBins] = {"All", "FT0", "TVX", "kTVXinEMC", "Cell", "HasMCColl"};
for (int iBin = 0; iBin < nEventBins; iBin++)
mHistManager.get<TH1>(HIST("nBCs"))->GetXaxis()->SetBinLabel(iBin + 1, binLabels[iBin]);

mHistManager.add("CentralityVsGenMultiplicity", "Centrality vs number of generated MC particles;Centrality;#bf{#it{N}_{gen}}", HistType::kTH2F, {{102, 0., 102}, cfgMultiplicityBinning});
mHistManager.add("CentralityFT0CVsM", "Centrality of FT0C vs FT0M;FT0C Cent;FT0M Cent", HistType::kTH2F, {{102, 0., 102}, {102, 0., 102}});
mHistManager.add("BCCentVsCollCent", "Centrality of the BC vs Centrality of the collision;BC Centrality;Collision Centrality", HistType::kTH2F, {{102, 0., 102}, {102, 0., 102}});
mHistManager.add("BCHasFT0FoundFT0", "BCHasFT0FoundFT0;BC has FT0;BC has found FT0", HistType::kTH2F, {{1000, -2., 50000}, {1000, -2., 50000}});
mHistManager.add("BCFoundFT0Diff", "BCFoundFT0Diff;BC_{ID}^{found FT0} - BC_{ID}^{FT0}", HistType::kTH1F, {{200001, -100000.5, 100000.5}});
mHistManager.add("BCIDOfMCColl", "BCIDOfMCColl;BCID", HistType::kTH1F, {{4001, -0.5, 4000.5}});
mHistManager.add("BCIDOfMCCollButNoFT0", "BCIDOfMCCollButNoFT0;BCID", HistType::kTH1F, {{4001, -0.5, 4000.5}});

mHistManager.add("MCZVtx", "Vertex position of MC collision;#bf{z_{vtx}^{MC} (cm)};#bf{#it{N}_{BCs}}", HistType::kTH1F, {{2000, -100, 100}});
mHistManager.add("MCZVtx_TVX", "Vertex position of MC collision;#bf{z_{vtx}^{MC} (cm)};#bf{#it{N}_{BCs}}", HistType::kTH1F, {{2000, -100, 100}});

LOG(info) << "BC wise cluster skimmer cuts:";
LOG(info) << "------------------------------------";
Expand Down Expand Up @@ -171,12 +179,12 @@
}
bool isEta = false;
if (mesonMCIndex >= 0) {
if (mcParticles.iteratorAt(mesonMCIndex).pdgCode() == 111) {

Check failure on line 182 in PWGEM/PhotonMeson/TableProducer/bcWiseClusterSkimmer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
if (fMapPi0Index.find(mesonMCIndex) != fMapPi0Index.end()) // Some pi0s might not be found (not gg decay or too large y)
mesonMCIndex = fMapPi0Index[mesonMCIndex]; // If pi0 was stored in table, change index from the MC index to the pi0 index from this task
else // If pi0 was not stored, treat photon as if not from pi0
mesonMCIndex = -1;
} else if (mcParticles.iteratorAt(mesonMCIndex).pdgCode() == 221) {

Check failure on line 187 in PWGEM/PhotonMeson/TableProducer/bcWiseClusterSkimmer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
isEta = true;
if (fMapEtaIndex.find(mesonMCIndex) != fMapEtaIndex.end()) // Some etas might not be found (not gg decay or too large y)
mesonMCIndex = fMapEtaIndex[mesonMCIndex]; // If eta was stored in table, change index from the MC index to the eta index from this task
Expand Down Expand Up @@ -233,38 +241,56 @@
return mu;
}

void processEventProperties(const auto& bc, const auto& collisionsInBC, const auto& cellsInBC)
void processEventProperties(const auto& bc, const auto& collisionsInBC, const auto& cellsInBC, const bool hasMCCollision = false)
{
bool hasFT0 = bc.has_foundFT0();
bool hasFT0 = bc.has_ft0();
bool hasFoundFT0 = bc.has_foundFT0();
int foundFT0ID = hasFoundFT0 ? bc.foundFT0().bcId() : -1;
int FT0ID = hasFT0 ? bc.ft0().bcId() : -1;
mHistManager.fill(HIST("BCHasFT0FoundFT0"), static_cast<float>(FT0ID), static_cast<float>(foundFT0ID));
mHistManager.fill(HIST("BCFoundFT0Diff"), static_cast<float>(foundFT0ID - FT0ID));

auto bcIDInOrbit = bc.globalBC() % 3564;

if (hasMCCollision) {
mHistManager.fill(HIST("BCIDOfMCColl"), static_cast<float>(bcIDInOrbit));
if (!hasFoundFT0) {
mHistManager.fill(HIST("BCIDOfMCCollButNoFT0"), static_cast<float>(bcIDInOrbit));
}
}

bool hasTVX = bc.selection_bit(aod::evsel::kIsTriggerTVX);
bool haskTVXinEMC = bc.alias_bit(kTVXinEMC);
bool hasEMCCell = cellsInBC.size() > 0;
mHistManager.fill(HIST("nBCs"), 0);
if (hasFT0)
if (hasFoundFT0)
mHistManager.fill(HIST("nBCs"), 1);
if (hasTVX)
mHistManager.fill(HIST("nBCs"), 2);
if (haskTVXinEMC)
mHistManager.fill(HIST("nBCs"), 3);
if (hasEMCCell)
mHistManager.fill(HIST("nBCs"), 4);
if (hasMCCollision)
mHistManager.fill(HIST("nBCs"), 5);

if (cfgStoreMu || cfgStoreTime)
setLHCIFData(bc);
double mu = cfgStoreMu ? calculateMu(bc) : 0.;
float timeSinceSOF = cfgStoreTime ? (bc.timestamp() - mLHCIFdata->getFillNumberTime()) / 1e3 : 0.; // Convert to seconds
float ft0Amp = hasFT0 ? bc.foundFT0().sumAmpA() + bc.foundFT0().sumAmpC() : 0.;
float ft0Amp = hasFoundFT0 ? bc.foundFT0().sumAmpA() + bc.foundFT0().sumAmpC() : 0.;
double centralityOfCollision = 101.5;
if (collisionsInBC.size() > 0)
centralityOfCollision = collisionsInBC.iteratorAt(0).centFT0M();
double centralityOfBC = bc.centFT0M();
centralityOfCollision = collisionsInBC.iteratorAt(0).centFT0C();
double centralityOfBC = bc.centFT0C();

mHistManager.fill(HIST("BCCentVsCollCent"), centralityOfBC, centralityOfCollision);
mHistManager.fill(HIST("CentralityFT0CVsM"), centralityOfBC, bc.centFT0M());

bcTable(hasFT0, hasTVX, haskTVXinEMC, hasEMCCell, convertForStorage<uint8_t>(centralityOfBC, kFT0MCent), convertForStorage<uint16_t>(ft0Amp, kFT0Amp), convertForStorage<uint16_t>(mu, kMu), convertForStorage<uint16_t>(timeSinceSOF, kTimeSinceSOF));
bcTable(hasFoundFT0, hasTVX, haskTVXinEMC, hasEMCCell, convertForStorage<uint8_t>(centralityOfBC, kCent), convertForStorage<uint8_t>(bc.centFT0M(), kCent), convertForStorage<uint16_t>(ft0Amp, kFT0Amp), convertForStorage<uint16_t>(mu, kMu), convertForStorage<uint16_t>(timeSinceSOF, kTimeSinceSOF));

for (const auto& collision : collisionsInBC)
collisionTable(bcTable.lastIndex(), convertForStorage<uint8_t>(collision.centFT0M(), kFT0MCent), convertForStorage<int16_t>(collision.posZ(), kZVtx));
collisionTable(bcTable.lastIndex(), convertForStorage<int16_t>(collision.posZ(), kZVtx));
}

template <typename TMCParticle, typename TMCParticles>
Expand All @@ -274,7 +300,7 @@
if (daughtersIds.size() != 2)
return false;
for (const auto& daughterId : daughtersIds) {
if (mcParticles.iteratorAt(daughterId).pdgCode() != 22)

Check failure on line 303 in PWGEM/PhotonMeson/TableProducer/bcWiseClusterSkimmer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
return false;
}
return true;
Expand All @@ -287,7 +313,7 @@
if (daughtersIds.size() != 2)
return false;
for (const auto& daughterId : daughtersIds) {
if (mcParticles.iteratorAt(daughterId).pdgCode() != 22)

Check failure on line 316 in PWGEM/PhotonMeson/TableProducer/bcWiseClusterSkimmer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
return false;
int iCellID = -1;
try {
Expand Down Expand Up @@ -333,10 +359,14 @@
auto collisionsInBC = collisions.sliceBy(perFoundBC, bc.globalIndex());
auto cellsInBC = cells.sliceBy(cellsPerBC, bc.globalIndex());

processEventProperties(bc, collisionsInBC, cellsInBC);

auto mcCollisionsBC = mcCollisions.sliceBy(mcCollperBC, bc.globalIndex());

processEventProperties(bc, collisionsInBC, cellsInBC, mcCollisionsBC.size() > 0);

for (const auto& mcCollision : mcCollisionsBC) {
mHistManager.fill(HIST("MCZVtx"), mcCollision.posZ());
if (bc.selection_bit(aod::evsel::kIsTriggerTVX))
mHistManager.fill(HIST("MCZVtx_TVX"), mcCollision.posZ());
auto mcParticlesInColl = mcParticles.sliceBy(perMcCollision, mcCollision.globalIndex());
mHistManager.fill(HIST("CentralityVsGenMultiplicity"), bc.centFT0M(), mcParticlesInColl.size());
for (const auto& mcParticle : mcParticlesInColl) {
Expand All @@ -358,11 +388,11 @@
if (collisionsInBC.size() == 1) {
auto clustersInBC = uClusters.sliceBy(perCol, collisionsInBC.begin().globalIndex());
processClusters(clustersInBC, bcTable.lastIndex());
processClusterMCInfo(clustersInBC, bc.globalIndex(), mcParticles);
processClusterMCInfo(clustersInBC, bcTable.lastIndex(), mcParticles);
} else {
auto clustersInBC = aClusters.sliceBy(perBC, bc.globalIndex());
processClusters(clustersInBC, bcTable.lastIndex());
processClusterMCInfo(clustersInBC, bc.globalIndex(), mcParticles);
processClusterMCInfo(clustersInBC, bcTable.lastIndex(), mcParticles);
}
fMapPi0Index.clear();
fMapEtaIndex.clear();
Expand Down
Loading
Loading