Skip to content

Commit 6908c33

Browse files
nstrangmNicolas Strangmannalibuild
authored
[PWGEM/PhotonMeson] Enable cut on time since start of fill for EMC pi0 (#11852)
Co-authored-by: Nicolas Strangmann <nicolas.strangmann@.cern.ch> Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 966e7c4 commit 6908c33

File tree

3 files changed

+47
-30
lines changed

3 files changed

+47
-30
lines changed

PWGEM/PhotonMeson/DataModel/bcWiseTables.h

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,25 @@ enum Observable {
4141
kFT0Amp,
4242
kpT,
4343
kMu,
44+
kTimeSinceSOF,
4445
nObservables
4546
};
4647

4748
// Values in tables are stored in downscaled format to save disk space
4849
const float downscalingFactors[nObservables]{
49-
1E0, // Cluster definition
50-
1E3, // Cluster energy
51-
1E4, // Cluster eta
52-
1E4, // Cluster phi
53-
1E0, // Number of cells
54-
1E4, // M02
55-
1E2, // Cluster time
56-
2E0, // FT0M centrality
57-
1E3, // Z-vertex position
58-
1E-1, // FT0M amplitude
59-
1E3, // MC pi0 pt
60-
1E5}; // Mu
50+
1E0, // Cluster definition
51+
1E3, // Cluster energy
52+
1E4, // Cluster eta
53+
1E4, // Cluster phi
54+
1E0, // Number of cells
55+
1E4, // M02
56+
1E2, // Cluster time
57+
2E0, // FT0M centrality
58+
1E3, // Z-vertex position
59+
1E-1, // FT0M amplitude
60+
1E3, // MC pi0 pt
61+
1E5, // Mu
62+
5E-1}; // Time since start of fill (since ADJUST decleration)
6163
} // namespace emdownscaling
6264

6365
namespace bcwisebc
@@ -66,18 +68,19 @@ DECLARE_SOA_COLUMN(HasFT0, hasFT0, bool); //! has_
6668
DECLARE_SOA_COLUMN(HasTVX, hasTVX, bool); //! has the TVX trigger flag
6769
DECLARE_SOA_COLUMN(HaskTVXinEMC, haskTVXinEMC, bool); //! kTVXinEMC
6870
DECLARE_SOA_COLUMN(HasEMCCell, hasEMCCell, bool); //! at least one EMCal cell in the BC
69-
DECLARE_SOA_COLUMN(HasNoTFROFBorder, hasNoTFROFBorder, bool); //! not in the TF border or ITS ROF border region
7071
DECLARE_SOA_COLUMN(StoredCentrality, storedCentrality, uint8_t); //! FT0M centrality (0-100) (x2)
7172
DECLARE_SOA_COLUMN(StoredFT0MAmplitude, storedFT0MAmplitude, uint16_t); //! ft0a+c amplitude
7273
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)
7375

7476
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)
7577
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
7678
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
79+
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
7780
} // namespace bcwisebc
7881
DECLARE_SOA_TABLE(BCWiseBCs, "AOD", "BCWISEBC", //! table of bc wise centrality estimation and event selection input
79-
o2::soa::Index<>, bcwisebc::HasFT0, bcwisebc::HasTVX, bcwisebc::HaskTVXinEMC, bcwisebc::HasEMCCell, bcwisebc::HasNoTFROFBorder, bcwisebc::StoredCentrality,
80-
bcwisebc::StoredFT0MAmplitude, bcwisebc::StoredMu, bcwisebc::Centrality<bcwisebc::StoredCentrality>, bcwisebc::FT0MAmplitude<bcwisebc::StoredFT0MAmplitude>, bcwisebc::Mu<bcwisebc::StoredMu>);
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>);
8184

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

PWGEM/PhotonMeson/TableProducer/bcWiseClusterSkimmer.cxx

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ struct bcWiseClusterSkimmer {
7676
Configurable<bool> cfgRequirekTVXinEMC{"cfgRequirekTVXinEMC", false, "Only store kTVXinEMC triggered BCs"};
7777
Configurable<bool> cfgRequireGoodRCTQuality{"cfgRequireGoodRCTQuality", false, "Only store BCs with good quality of T0 and EMC in RCT"};
7878
Configurable<bool> cfgStoreMu{"cfgStoreMu", false, "Calculate and store mu (probablity of a TVX collision in the BC) per BC. Otherwise fill with 0"};
79+
Configurable<bool> cfgStoreTime{"cfgStoreTime", false, "Calculate and store time since the start of fill. Otherwise fill with 0"};
7980
ConfigurableAxis cfgMultiplicityBinning{"cfgMultiplicityBinning", {1000, 0, 10000}, "Binning used for the binning of the number of particles in the event"};
8081

8182
aod::rctsel::RCTFlagsChecker isFT0EMCGoodRCTChecker{aod::rctsel::kFT0Bad, aod::rctsel::kEMCBad};
@@ -198,25 +199,32 @@ struct bcWiseClusterSkimmer {
198199
return true;
199200
}
200201

201-
double calculateMu(const auto& bc)
202+
void setLHCIFData(const auto& bc)
202203
{
204+
if (mRunNumber == bc.runNumber())
205+
return;
206+
203207
auto& ccdbMgr = o2::ccdb::BasicCCDBManager::instance();
204208
uint64_t timeStamp = bc.timestamp();
205209

206-
if (mRunNumber != bc.runNumber()) {
207-
std::map<std::string, std::string> metadata;
208-
mLHCIFdata = ccdbMgr.getSpecific<o2::parameters::GRPLHCIFData>("GLO/Config/GRPLHCIF", timeStamp, metadata);
209-
if (mLHCIFdata == nullptr)
210-
LOG(fatal) << "GRPLHCIFData not in database, timestamp:" << timeStamp;
211-
mRunNumber = bc.runNumber();
212-
LOG(info) << "LHCIF data fetched for run " << mRunNumber << " and timestamp " << timeStamp;
213-
}
210+
std::map<std::string, std::string> metadata;
211+
mLHCIFdata = ccdbMgr.getSpecific<o2::parameters::GRPLHCIFData>("GLO/Config/GRPLHCIF", timeStamp, metadata);
212+
if (mLHCIFdata == nullptr)
213+
LOG(fatal) << "GRPLHCIFData not in database, timestamp:" << timeStamp;
214+
mRunNumber = bc.runNumber();
215+
LOG(info) << "LHCIF data fetched for run " << mRunNumber << " and timestamp " << timeStamp;
216+
217+
return;
218+
}
219+
220+
double calculateMu(const auto& bc)
221+
{
222+
auto& ccdbMgr = o2::ccdb::BasicCCDBManager::instance();
223+
uint64_t timeStamp = bc.timestamp();
214224

215225
auto bfilling = mLHCIFdata->getBunchFilling();
216226
double nbc = bfilling.getFilledBCs().size();
217-
218227
double tvxRate = mRateFetcher.fetch(&ccdbMgr, timeStamp, bc.runNumber(), "T0VTX");
219-
220228
double nTriggersPerFilledBC = tvxRate / nbc / o2::constants::lhc::LHCRevFreq;
221229
double mu = -std::log(1 - nTriggersPerFilledBC);
222230

@@ -231,7 +239,6 @@ struct bcWiseClusterSkimmer {
231239
bool hasTVX = bc.selection_bit(aod::evsel::kIsTriggerTVX);
232240
bool haskTVXinEMC = bc.alias_bit(kTVXinEMC);
233241
bool hasEMCCell = cellsInBC.size() > 0;
234-
bool hasNoTFROFBorder = bc.selection_bit(aod::evsel::kNoTimeFrameBorder) && bc.selection_bit(aod::evsel::kNoITSROFrameBorder);
235242
mHistManager.fill(HIST("nBCs"), 0);
236243
if (hasFT0)
237244
mHistManager.fill(HIST("nBCs"), 1);
@@ -241,10 +248,11 @@ struct bcWiseClusterSkimmer {
241248
mHistManager.fill(HIST("nBCs"), 3);
242249
if (hasEMCCell)
243250
mHistManager.fill(HIST("nBCs"), 4);
244-
if (hasNoTFROFBorder)
245-
mHistManager.fill(HIST("nBCs"), 5);
246251

252+
if (cfgStoreMu || cfgStoreTime)
253+
setLHCIFData(bc);
247254
double mu = cfgStoreMu ? calculateMu(bc) : 0.;
255+
float timeSinceSOF = cfgStoreTime ? (bc.timestamp() - mLHCIFdata->getFillNumberTime()) / 1e3 : 0.; // Convert to seconds
248256
float ft0Amp = hasFT0 ? bc.foundFT0().sumAmpA() + bc.foundFT0().sumAmpC() : 0.;
249257
double centralityOfCollision = 101.5;
250258
if (collisionsInBC.size() > 0)
@@ -253,7 +261,7 @@ struct bcWiseClusterSkimmer {
253261

254262
mHistManager.fill(HIST("BCCentVsCollCent"), centralityOfBC, centralityOfCollision);
255263

256-
bcTable(hasFT0, hasTVX, haskTVXinEMC, hasEMCCell, hasNoTFROFBorder, convertForStorage<uint8_t>(centralityOfBC, kFT0MCent), convertForStorage<uint16_t>(ft0Amp, kFT0Amp), convertForStorage<uint16_t>(mu, kMu));
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));
257265

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

PWGEM/PhotonMeson/Tasks/emcalBcWiseGammaGamma.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ struct EmcalBcWiseGammaGamma {
5555
Configurable<float> cfgMinOpenAngle{"cfgMinOpenAngle", 0.0202, "Minimum opening angle between photons"};
5656
Configurable<int> cfgDistanceToEdge{"cfgDistanceToEdge", 1, "Distance to edge in cells required for rotated cluster to be accepted"};
5757
Configurable<int> cfgBGEventDownsampling{"cfgBGEventDownsampling", 1, "Only calculate background for every n-th event (performance reasons in PbPb)"};
58+
Configurable<int> cfgMinTimeSinceSOF{"cfgMinTimeSinceSOF", -1, "Only analyze events with a time since start of fill larger than this value (in minutes)"};
59+
Configurable<int> cfgMaxTimeSinceSOF{"cfgMaxTimeSinceSOF", 100000, "Only analyze events with a time since start of fill smaller than this value (in minutes)"};
5860

5961
ConfigurableAxis cfgCentralityBinning{"cfgCentralityBinning", {VARIABLE_WIDTH, 0.f, 5.f, 10.f, 20.f, 30.f, 40.f, 50.f, 60.f, 70.f, 80.f, 90.f, 100.f, 101.f, 102.f}, "FT0M centrality (%)"};
6062

@@ -83,6 +85,7 @@ struct EmcalBcWiseGammaGamma {
8385
mHistManager.add("Event/Z1VsZ2", "Z vertex positions for BCs with two collisions;#bf{#it{z}_{vtx}^{1} (cm)};#bf{#it{z}_{vtx}^{2} (cm)}", HistType::kTH2F, {{150, -15, 15}, {150, -15, 15}});
8486
mHistManager.add("Event/dZ", "Distance between vertices for BCs with two collisions;#bf{#Delta #it{z}_{vtx} (cm)};#bf{#it{N}_{BC}}", HistType::kTH1F, {{600, -30, 30}});
8587
mHistManager.add("Event/Mu", "Probablity of a collision in the BC;#bf{#mu};#bf{#it{N}_{BC}}", HistType::kTH1F, {{1000, 0., 0.1}});
88+
mHistManager.add("Event/TimeSinceSOF", "Time of BC since the start of fill;#bf{t-t_{SOF} (min)};#bf{#it{N}_{BC}}", HistType::kTH1F, {{1200, 0., 600}});
8689

8790
mHistManager.add("Event/Centrality", "FT0M centrality;FT0M centrality (%);#bf{#it{N}_{BC}}", HistType::kTH1F, {cfgCentralityBinning});
8891
mHistManager.add("Event/CentralityVsAmplitude", "FT0M AmplitudeVsCentrality;FT0M Centrality;FT0M Amplitude", HistType::kTH2F, {cfgCentralityBinning, {600, 0, 300000}});
@@ -140,6 +143,7 @@ struct EmcalBcWiseGammaGamma {
140143
mHistManager.fill(HIST("Event/nBCs"), 0, bc.centrality());
141144
float mu = bc.mu();
142145
mHistManager.fill(HIST("Event/Mu"), mu);
146+
mHistManager.fill(HIST("Event/TimeSinceSOF"), bc.timeSinceSOF() / 60.);
143147
double p = mu > 0.001 ? mu / (1 - std::exp(-mu)) : 1.; // No pile-up for small mu (protection against division by zero)
144148
mHistManager.fill(HIST("Event/nCollisions"), 0, bc.centrality(), p);
145149
if (bc.hasFT0()) {
@@ -289,6 +293,8 @@ struct EmcalBcWiseGammaGamma {
289293
return false;
290294
if (cfgSelectOnlyUniqueAmbiguous == 2 && collisions.size() == 1)
291295
return false;
296+
if (cfgMinTimeSinceSOF > bc.timeSinceSOF() / 60 || cfgMaxTimeSinceSOF < bc.timeSinceSOF() / 60)
297+
return false;
292298
return true;
293299
}
294300

0 commit comments

Comments
 (0)