Skip to content

Commit bd636ac

Browse files
nstrangmNicolas Strangmann
andauthored
[PWGEM/PhotonMeson] Add FT0 QC and FT0C centrality estimator to BC wise GG (#13104)
Co-authored-by: Nicolas Strangmann <nicolas.strangmann@.cern.ch>
1 parent 27a41da commit bd636ac

File tree

3 files changed

+115
-75
lines changed

3 files changed

+115
-75
lines changed

PWGEM/PhotonMeson/DataModel/bcWiseTables.h

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ enum Observable {
3636
kNCells,
3737
kM02,
3838
kTime,
39-
kFT0MCent,
39+
kCent,
4040
kZVtx,
4141
kFT0Amp,
4242
kpT,
@@ -54,7 +54,7 @@ const float downscalingFactors[nObservables]{
5454
1E0, // Number of cells
5555
1E4, // M02
5656
1E2, // Cluster time
57-
2E0, // FT0M centrality
57+
2E0, // FT0 centrality
5858
1E3, // Z-vertex position
5959
1E-1, // FT0M amplitude
6060
1E3, // MC pi0 pt
@@ -64,37 +64,36 @@ const float downscalingFactors[nObservables]{
6464

6565
namespace bcwisebc
6666
{
67-
DECLARE_SOA_COLUMN(HasFT0, hasFT0, bool); //! has_foundFT0()
68-
DECLARE_SOA_COLUMN(HasTVX, hasTVX, bool); //! has the TVX trigger flag
69-
DECLARE_SOA_COLUMN(HaskTVXinEMC, haskTVXinEMC, bool); //! kTVXinEMC
70-
DECLARE_SOA_COLUMN(HasEMCCell, hasEMCCell, bool); //! at least one EMCal cell in the BC
71-
DECLARE_SOA_COLUMN(StoredCentrality, storedCentrality, uint8_t); //! FT0M centrality (0-100) (x2)
72-
DECLARE_SOA_COLUMN(StoredFT0MAmplitude, storedFT0MAmplitude, uint16_t); //! ft0a+c amplitude
73-
DECLARE_SOA_COLUMN(StoredMu, storedMu, uint16_t); //! probability of TVX collision per BC (x1000)
74-
DECLARE_SOA_COLUMN(StoredTimeSinceSOF, storedTimeSinceSOF, uint16_t); //! time since decreation of ADJUST in seconds (x2)
75-
76-
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)
77-
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
78-
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
67+
DECLARE_SOA_COLUMN(HasFT0, hasFT0, bool); //! has_foundFT0()
68+
DECLARE_SOA_COLUMN(HasTVX, hasTVX, bool); //! has the TVX trigger flag
69+
DECLARE_SOA_COLUMN(HaskTVXinEMC, haskTVXinEMC, bool); //! kTVXinEMC
70+
DECLARE_SOA_COLUMN(HasEMCCell, hasEMCCell, bool); //! at least one EMCal cell in the BC
71+
DECLARE_SOA_COLUMN(StoredFT0CCentrality, storedFt0CCentrality, uint8_t); //! FT0C centrality (0-100) (x2)
72+
DECLARE_SOA_COLUMN(StoredFT0MCentrality, storedFT0MCentrality, uint8_t); //! FT0M centrality (0-100) (x2)
73+
DECLARE_SOA_COLUMN(StoredFT0MAmplitude, storedFT0MAmplitude, uint16_t); //! ft0a+c amplitude
74+
DECLARE_SOA_COLUMN(StoredMu, storedMu, uint16_t); //! probability of TVX collision per BC (x1000)
75+
DECLARE_SOA_COLUMN(StoredTimeSinceSOF, storedTimeSinceSOF, uint16_t); //! time since decreation of ADJUST in seconds (x2)
76+
77+
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)
78+
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)
79+
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
80+
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
7981
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
8082
} // namespace bcwisebc
8183
DECLARE_SOA_TABLE(BCWiseBCs, "AOD", "BCWISEBC", //! table of bc wise centrality estimation and event selection input
82-
o2::soa::Index<>, bcwisebc::HasFT0, bcwisebc::HasTVX, bcwisebc::HaskTVXinEMC, bcwisebc::HasEMCCell, bcwisebc::StoredCentrality,
83-
bcwisebc::StoredFT0MAmplitude, bcwisebc::StoredMu, bcwisebc::StoredTimeSinceSOF, bcwisebc::Centrality<bcwisebc::StoredCentrality>, bcwisebc::FT0MAmplitude<bcwisebc::StoredFT0MAmplitude>, bcwisebc::Mu<bcwisebc::StoredMu>, bcwisebc::TimeSinceSOF<bcwisebc::StoredTimeSinceSOF>);
84+
o2::soa::Index<>, bcwisebc::HasFT0, bcwisebc::HasTVX, bcwisebc::HaskTVXinEMC, bcwisebc::HasEMCCell, bcwisebc::StoredFT0CCentrality, bcwisebc::StoredFT0MCentrality,
85+
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>);
8486

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

8789
namespace bcwisecollision
8890
{
89-
DECLARE_SOA_COLUMN(StoredCentrality, storedCentrality, uint8_t); //! FT0M centrality (0-100) (x2)
90-
DECLARE_SOA_COLUMN(StoredZVtx, storedZVtx, int16_t); //! Z-vertex position (x1000)
91+
DECLARE_SOA_COLUMN(StoredZVtx, storedZVtx, int16_t); //! Z-vertex position (x1000)
9192

92-
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)
93-
DECLARE_SOA_DYNAMIC_COLUMN(ZVtx, zVtx, [](int16_t storedzvtx) -> float { return storedzvtx / emdownscaling::downscalingFactors[emdownscaling::kZVtx]; }); //! Centrality (0-100)
93+
DECLARE_SOA_DYNAMIC_COLUMN(ZVtx, zVtx, [](int16_t storedzvtx) -> float { return storedzvtx / emdownscaling::downscalingFactors[emdownscaling::kZVtx]; }); //! Z-Vertex
9494
} // namespace bcwisecollision
9595
DECLARE_SOA_TABLE(BCWiseCollisions, "AOD", "BCWISECOLL", //! table of skimmed EMCal clusters
96-
o2::soa::Index<>, BCWiseBCId, bcwisecollision::StoredCentrality, bcwisecollision::StoredZVtx,
97-
bcwisecollision::Centrality<bcwisecollision::StoredCentrality>, bcwisecollision::ZVtx<bcwisecollision::StoredZVtx>);
96+
o2::soa::Index<>, BCWiseBCId, bcwisecollision::StoredZVtx, bcwisecollision::ZVtx<bcwisecollision::StoredZVtx>);
9897

9998
namespace bcwisecluster
10099
{

PWGEM/PhotonMeson/TableProducer/bcWiseClusterSkimmer.cxx

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ using namespace o2::aod::emdownscaling;
4141
using namespace o2::framework;
4242
using namespace o2::framework::expressions;
4343

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

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

105105
mHistManager.add("CentralityVsGenMultiplicity", "Centrality vs number of generated MC particles;Centrality;#bf{#it{N}_{gen}}", HistType::kTH2F, {{102, 0., 102}, cfgMultiplicityBinning});
106+
mHistManager.add("CentralityFT0CVsM", "Centrality of FT0C vs FT0M;FT0C Cent;FT0M Cent", HistType::kTH2F, {{102, 0., 102}, {102, 0., 102}});
106107
mHistManager.add("BCCentVsCollCent", "Centrality of the BC vs Centrality of the collision;BC Centrality;Collision Centrality", HistType::kTH2F, {{102, 0., 102}, {102, 0., 102}});
108+
mHistManager.add("BCHasFT0FoundFT0", "BCHasFT0FoundFT0;BC has FT0;BC has found FT0", HistType::kTH2F, {{1000, -2., 50000}, {1000, -2., 50000}});
109+
mHistManager.add("BCFoundFT0Diff", "BCFoundFT0Diff;BC_{ID}^{found FT0} - BC_{ID}^{FT0}", HistType::kTH1F, {{200001, -100000.5, 100000.5}});
110+
mHistManager.add("BCIDOfMCColl", "BCIDOfMCColl;BCID", HistType::kTH1F, {{4001, -0.5, 4000.5}});
111+
mHistManager.add("BCIDOfMCCollButNoFT0", "BCIDOfMCCollButNoFT0;BCID", HistType::kTH1F, {{4001, -0.5, 4000.5}});
112+
113+
mHistManager.add("MCZVtx", "Vertex position of MC collision;#bf{z_{vtx}^{MC} (cm)};#bf{#it{N}_{BCs}}", HistType::kTH1F, {{2000, -100, 100}});
114+
mHistManager.add("MCZVtx_TVX", "Vertex position of MC collision;#bf{z_{vtx}^{MC} (cm)};#bf{#it{N}_{BCs}}", HistType::kTH1F, {{2000, -100, 100}});
107115

108116
LOG(info) << "BC wise cluster skimmer cuts:";
109117
LOG(info) << "------------------------------------";
@@ -233,38 +241,56 @@ struct bcWiseClusterSkimmer {
233241
return mu;
234242
}
235243

236-
void processEventProperties(const auto& bc, const auto& collisionsInBC, const auto& cellsInBC)
244+
void processEventProperties(const auto& bc, const auto& collisionsInBC, const auto& cellsInBC, const bool hasMCCollision = false)
237245
{
238-
bool hasFT0 = bc.has_foundFT0();
246+
bool hasFT0 = bc.has_ft0();
247+
bool hasFoundFT0 = bc.has_foundFT0();
248+
int foundFT0ID = hasFoundFT0 ? bc.foundFT0().bcId() : -1;
249+
int FT0ID = hasFT0 ? bc.ft0().bcId() : -1;
250+
mHistManager.fill(HIST("BCHasFT0FoundFT0"), static_cast<float>(FT0ID), static_cast<float>(foundFT0ID));
251+
mHistManager.fill(HIST("BCFoundFT0Diff"), static_cast<float>(foundFT0ID - FT0ID));
252+
253+
auto bcIDInOrbit = bc.globalBC() % 3564;
254+
255+
if (hasMCCollision) {
256+
mHistManager.fill(HIST("BCIDOfMCColl"), static_cast<float>(bcIDInOrbit));
257+
if (!hasFoundFT0) {
258+
mHistManager.fill(HIST("BCIDOfMCCollButNoFT0"), static_cast<float>(bcIDInOrbit));
259+
}
260+
}
261+
239262
bool hasTVX = bc.selection_bit(aod::evsel::kIsTriggerTVX);
240263
bool haskTVXinEMC = bc.alias_bit(kTVXinEMC);
241264
bool hasEMCCell = cellsInBC.size() > 0;
242265
mHistManager.fill(HIST("nBCs"), 0);
243-
if (hasFT0)
266+
if (hasFoundFT0)
244267
mHistManager.fill(HIST("nBCs"), 1);
245268
if (hasTVX)
246269
mHistManager.fill(HIST("nBCs"), 2);
247270
if (haskTVXinEMC)
248271
mHistManager.fill(HIST("nBCs"), 3);
249272
if (hasEMCCell)
250273
mHistManager.fill(HIST("nBCs"), 4);
274+
if (hasMCCollision)
275+
mHistManager.fill(HIST("nBCs"), 5);
251276

252277
if (cfgStoreMu || cfgStoreTime)
253278
setLHCIFData(bc);
254279
double mu = cfgStoreMu ? calculateMu(bc) : 0.;
255280
float timeSinceSOF = cfgStoreTime ? (bc.timestamp() - mLHCIFdata->getFillNumberTime()) / 1e3 : 0.; // Convert to seconds
256-
float ft0Amp = hasFT0 ? bc.foundFT0().sumAmpA() + bc.foundFT0().sumAmpC() : 0.;
281+
float ft0Amp = hasFoundFT0 ? bc.foundFT0().sumAmpA() + bc.foundFT0().sumAmpC() : 0.;
257282
double centralityOfCollision = 101.5;
258283
if (collisionsInBC.size() > 0)
259-
centralityOfCollision = collisionsInBC.iteratorAt(0).centFT0M();
260-
double centralityOfBC = bc.centFT0M();
284+
centralityOfCollision = collisionsInBC.iteratorAt(0).centFT0C();
285+
double centralityOfBC = bc.centFT0C();
261286

262287
mHistManager.fill(HIST("BCCentVsCollCent"), centralityOfBC, centralityOfCollision);
288+
mHistManager.fill(HIST("CentralityFT0CVsM"), centralityOfBC, bc.centFT0M());
263289

264-
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));
290+
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));
265291

266292
for (const auto& collision : collisionsInBC)
267-
collisionTable(bcTable.lastIndex(), convertForStorage<uint8_t>(collision.centFT0M(), kFT0MCent), convertForStorage<int16_t>(collision.posZ(), kZVtx));
293+
collisionTable(bcTable.lastIndex(), convertForStorage<int16_t>(collision.posZ(), kZVtx));
268294
}
269295

270296
template <typename TMCParticle, typename TMCParticles>
@@ -333,10 +359,14 @@ struct bcWiseClusterSkimmer {
333359
auto collisionsInBC = collisions.sliceBy(perFoundBC, bc.globalIndex());
334360
auto cellsInBC = cells.sliceBy(cellsPerBC, bc.globalIndex());
335361

336-
processEventProperties(bc, collisionsInBC, cellsInBC);
337-
338362
auto mcCollisionsBC = mcCollisions.sliceBy(mcCollperBC, bc.globalIndex());
363+
364+
processEventProperties(bc, collisionsInBC, cellsInBC, mcCollisionsBC.size() > 0);
365+
339366
for (const auto& mcCollision : mcCollisionsBC) {
367+
mHistManager.fill(HIST("MCZVtx"), mcCollision.posZ());
368+
if (bc.selection_bit(aod::evsel::kIsTriggerTVX))
369+
mHistManager.fill(HIST("MCZVtx_TVX"), mcCollision.posZ());
340370
auto mcParticlesInColl = mcParticles.sliceBy(perMcCollision, mcCollision.globalIndex());
341371
mHistManager.fill(HIST("CentralityVsGenMultiplicity"), bc.centFT0M(), mcParticlesInColl.size());
342372
for (const auto& mcParticle : mcParticlesInColl) {
@@ -358,11 +388,11 @@ struct bcWiseClusterSkimmer {
358388
if (collisionsInBC.size() == 1) {
359389
auto clustersInBC = uClusters.sliceBy(perCol, collisionsInBC.begin().globalIndex());
360390
processClusters(clustersInBC, bcTable.lastIndex());
361-
processClusterMCInfo(clustersInBC, bc.globalIndex(), mcParticles);
391+
processClusterMCInfo(clustersInBC, bcTable.lastIndex(), mcParticles);
362392
} else {
363393
auto clustersInBC = aClusters.sliceBy(perBC, bc.globalIndex());
364394
processClusters(clustersInBC, bcTable.lastIndex());
365-
processClusterMCInfo(clustersInBC, bc.globalIndex(), mcParticles);
395+
processClusterMCInfo(clustersInBC, bcTable.lastIndex(), mcParticles);
366396
}
367397
fMapPi0Index.clear();
368398
fMapEtaIndex.clear();

0 commit comments

Comments
 (0)