Skip to content

Commit bc59c07

Browse files
committed
Find workaround for missing ZDC table in strained data
1 parent 5b251ac commit bc59c07

File tree

2 files changed

+47
-9
lines changed

2 files changed

+47
-9
lines changed

PWGMM/Lumi/Tasks/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ o2physics_add_dpl_workflow(lumi-stability-light-ions
4646
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCCDB O2Physics::AnalysisCore
4747
COMPONENT_NAME Analysis)
4848

49-
o2physics_add_dpl_workflow(lumi-stability-light-p-p
49+
o2physics_add_dpl_workflow(lumi-stability-p-p
5050
SOURCES lumiStabilityPP.cxx
5151
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCCDB O2Physics::AnalysisCore
5252
COMPONENT_NAME Analysis)

PWGMM/Lumi/Tasks/lumiStabilityPP.cxx

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
#include "Common/Core/MetadataHelper.h"
1919
#include "Common/DataModel/Centrality.h"
2020
#include "Common/DataModel/EventSelection.h"
21+
#include "Common/DataModel/FT0Corrected.h"
2122

2223
#include "CCDB/BasicCCDBManager.h"
24+
#include "DataFormatsFT0/Digit.h"
2325
#include "DataFormatsParameters/AggregatedRunInfo.h"
2426
#include "DataFormatsParameters/GRPLHCIFData.h"
2527
#include "Framework/ASoA.h"
@@ -51,14 +53,48 @@ enum BCCategories { BCA = 0, // A side BCs (bunch-crossings that had beam onl
5153
BCSL = 5, // super-leading BCs (bunch-crossings that did not have FDD/FT0 activity for a configurable number of preceding BCs)
5254
NBCCategories };
5355
} // namespace lumi
56+
namespace aod
57+
{
58+
// Columns to store the information about the presence of FT0 and FDD signals associated to a given BC
59+
DECLARE_SOA_TABLE(BcDetectorInfo, "AOD", "BCDETECTORINFO", //!
60+
indices::FT0Id,
61+
indices::FDDId);
62+
} // namespace aod
5463
} // namespace o2
5564

5665
using namespace o2;
5766
using namespace o2::framework;
5867
using namespace o2::framework::expressions;
5968
using namespace o2::lumi;
6069

61-
using BCsWithTimeStampsAndSels = soa::Join<aod::BCs, aod::BcSels, aod::Timestamps, aod::Run3MatchedToBCSparse>;
70+
using BCsWithTimeStamps = soa::Join<aod::BCs, aod::Timestamps, aod::BcDetectorInfo>;
71+
72+
struct BuildBcFlagTable {
73+
74+
Produces<aod::BcDetectorInfo> bcFlags;
75+
76+
void init(InitContext&) {}
77+
78+
void process(aod::BC const& bc,
79+
aod::FT0s const& ft0s,
80+
aod::FDDs const& fdds)
81+
{
82+
int64_t idxFT0{-1}, idxFDD{-1};
83+
for (const auto& ft0: ft0s) {
84+
if (ft0.bcId() == bc.globalIndex()) {
85+
idxFT0 = ft0.globalIndex();
86+
break;
87+
}
88+
}
89+
for (const auto& fdd: fdds) {
90+
if (fdd.bcId() == bc.globalIndex()) {
91+
idxFDD = fdd.globalIndex();
92+
break;
93+
}
94+
}
95+
bcFlags(idxFT0, idxFDD);
96+
}
97+
};
6298

6399
struct LumiStabilityPP {
64100

@@ -101,7 +137,7 @@ struct LumiStabilityPP {
101137
{"FT0CE/BC_A/nBCsVsBCID", "FT0CE/BC_B/nBCsVsBCID", "FT0CE/BC_C/nBCsVsBCID", "FT0CE/BC_E/nBCsVsBCID", "FT0CE/BC_L/nBCsVsBCID", "FT0CE/BC_SL/nBCsVsBCID"},
102138
{"FDD/BC_A/nBCsVsBCID", "FDD/BC_B/nBCsVsBCID", "FDD/BC_C/nBCsVsBCID", "FDD/BC_E/nBCsVsBCID", "FDD/BC_L/nBCsVsBCID", "FDD/BC_SL/nBCsVsBCID"}};
103139

104-
const AxisSpec timeAxis{1440, 0., 1440., "#bf{t-t_{SOF} (min)}"}, bcIDAxis{3600, 0., 3600., "#bf{BC ID in orbit}"};
140+
const AxisSpec timeAxis{1440, 0., 1440., "#bf{t-t_{SOF} (min)}"}, bcIDAxis{nBCsPerOrbit, -0.5, static_cast<float>(nBCsPerOrbit)-0.5, "#bf{BC ID in orbit}"};
105141

106142
int64_t bcSOR;
107143
int nBCsPerTF;
@@ -146,8 +182,6 @@ struct LumiStabilityPP {
146182
return;
147183
}
148184

149-
createHistograms();
150-
151185
auto& ccdbMgr = o2::ccdb::BasicCCDBManager::instance();
152186
uint64_t timeStamp = bc.timestamp();
153187

@@ -159,6 +193,7 @@ struct LumiStabilityPP {
159193

160194
runNumber = bc.runNumber();
161195
LOG(info) << "LHCIF data fetched for run " << runNumber << " and timestamp " << timeStamp;
196+
createHistograms();
162197

163198
beamPatternA = mLHCIFdata->getBunchFilling().getBeamPattern(0);
164199
beamPatternC = mLHCIFdata->getBunchFilling().getBeamPattern(1);
@@ -212,7 +247,9 @@ struct LumiStabilityPP {
212247
histBcVsBcId[iTrigger][iBCCategory][runNumber]->Fill(localBC);
213248
}
214249

215-
void process(BCsWithTimeStampsAndSels const& bcs, aod::FT0s const&)
250+
void process(BCsWithTimeStamps const& bcs,
251+
aod::FT0s const&,
252+
aod::FDDs const&)
216253
{
217254
int64_t globalBCIdOfLastBCWithActivity = 0;
218255
for (const auto& bc : bcs) {
@@ -224,8 +261,9 @@ struct LumiStabilityPP {
224261
setLHCIFData(bc);
225262

226263
float timeSinceSOF = getTimeSinceSOF(bc);
227-
228-
if (bc.selection_bit(aod::evsel::kIsTriggerTVX)) {
264+
bool isTriggerTVX = (bc.has_ft0() ? TESTBIT(bc.ft0().triggerMask(), o2::ft0::Triggers::bitVertex) : false);
265+
266+
if (isTriggerTVX) {
229267
histNBcsVsTime[runNumber]->Fill(timeSinceSOF);
230268
}
231269

@@ -325,5 +363,5 @@ struct LumiStabilityPP {
325363
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
326364
{
327365
metadataInfo.initMetadata(cfgc);
328-
return WorkflowSpec{adaptAnalysisTask<LumiStabilityPP>(cfgc)};
366+
return WorkflowSpec{adaptAnalysisTask<BuildBcFlagTable>(cfgc), adaptAnalysisTask<LumiStabilityPP>(cfgc)};
329367
}

0 commit comments

Comments
 (0)