Skip to content

Commit d0ffa12

Browse files
authored
adding extraction of orbitsPerTF by LPMProductionTag
adding automatic extraction of orbitsPerTF from ccdb by LPMProductionTag (to be in correspondence with the same change in the new eventSelectionService workflow)
1 parent 1c60577 commit d0ffa12

File tree

1 file changed

+33
-23
lines changed

1 file changed

+33
-23
lines changed

Common/TableProducer/eventSelection.cxx

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,38 @@
1414
///
1515
/// \author Evgeny Kryshen <evgeny.kryshen@cern.ch> and Igor Altsybeev <Igor.Altsybeev@cern.ch>
1616

17-
#include <vector>
18-
#include <map>
19-
#include <string>
20-
#include <limits>
21-
22-
#include "Framework/ConfigParamSpec.h"
23-
#include "Framework/runDataProcessing.h"
24-
#include "Framework/AnalysisTask.h"
25-
#include "Framework/AnalysisDataModel.h"
2617
#include "Common/DataModel/EventSelection.h"
18+
19+
#include "MetadataHelper.h"
20+
2721
#include "Common/CCDB/EventSelectionParams.h"
2822
#include "Common/CCDB/TriggerAliases.h"
23+
2924
#include "CCDB/BasicCCDBManager.h"
3025
#include "CommonConstants/LHCConstants.h"
31-
#include "Framework/HistogramRegistry.h"
26+
#include "DataFormatsCTP/Configuration.h"
27+
#include "DataFormatsCTP/Scalers.h"
3228
#include "DataFormatsFT0/Digit.h"
33-
#include "DataFormatsParameters/GRPLHCIFData.h"
34-
#include "DataFormatsParameters/GRPECSObject.h"
35-
#include "ITSMFTBase/DPLAlpideParam.h"
36-
#include "MetadataHelper.h"
37-
#include "DataFormatsParameters/AggregatedRunInfo.h"
3829
#include "DataFormatsITSMFT/NoiseMap.h" // missing include in TimeDeadMap.h
3930
#include "DataFormatsITSMFT/TimeDeadMap.h"
31+
#include "DataFormatsParameters/AggregatedRunInfo.h"
32+
#include "DataFormatsParameters/GRPECSObject.h"
33+
#include "DataFormatsParameters/GRPLHCIFData.h"
34+
#include "Framework/AnalysisDataModel.h"
35+
#include "Framework/AnalysisTask.h"
36+
#include "Framework/ConfigParamSpec.h"
37+
#include "Framework/HistogramRegistry.h"
38+
#include "Framework/runDataProcessing.h"
39+
#include "ITSMFTBase/DPLAlpideParam.h"
4040
#include "ITSMFTReconstruction/ChipMappingITS.h"
41-
#include "DataFormatsCTP/Configuration.h"
42-
#include "DataFormatsCTP/Scalers.h"
4341

4442
#include "TH1D.h"
4543

44+
#include <limits>
45+
#include <map>
46+
#include <string>
47+
#include <vector>
48+
4649
using namespace o2;
4750
using namespace o2::framework;
4851
using namespace o2::aod::evsel;
@@ -84,6 +87,8 @@ struct BcSelectionTask {
8487
int mITSROFrameEndBorderMargin = 20; // default value
8588
int mTimeFrameStartBorderMargin = 300; // default value
8689
int mTimeFrameEndBorderMargin = 4000; // default value
90+
std::string strLPMProductionTag = ""; // MC production tag to be retrieved from AO2D metadata
91+
8792
TriggerAliases* aliases = nullptr;
8893
EventSelectionParams* par = nullptr;
8994
std::map<uint64_t, uint32_t>* mapRCT = nullptr;
@@ -99,6 +104,8 @@ struct BcSelectionTask {
99104
ccdb->setURL("http://alice-ccdb.cern.ch");
100105
ccdb->setCaching(true);
101106
ccdb->setLocalObjectValidityChecking();
107+
strLPMProductionTag = metadataInfo.get("LPMProductionTag"); // to extract info from ccdb by the tag
108+
102109
histos.add("hCounterInvalidBCTimestamp", "", kTH1D, {{1, 0., 1.}});
103110
}
104111

@@ -256,7 +263,7 @@ struct BcSelectionTask {
256263
// duration of TF in bcs
257264
nBCsPerTF = 32; // hard-coded for Run3 MC (no info from ccdb at the moment)
258265
} else {
259-
auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run);
266+
auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run, strLPMProductionTag);
260267
// SOR and EOR timestamps
261268
sorTimestamp = runInfo.sor;
262269
eorTimestamp = runInfo.eor;
@@ -511,10 +518,11 @@ struct EventSelectionTask {
511518
int lastRun = -1; // last run number (needed to access ccdb only if run!=lastRun)
512519
std::bitset<nBCsPerOrbit> bcPatternB; // bc pattern of colliding bunches
513520

514-
int64_t bcSOR = -1; // global bc of the start of the first orbit
515-
int64_t nBCsPerTF = -1; // duration of TF in bcs, should be 128*3564 or 32*3564
516-
int rofOffset = -1; // ITS ROF offset, in bc
517-
int rofLength = -1; // ITS ROF length, in bc
521+
int64_t bcSOR = -1; // global bc of the start of the first orbit
522+
int64_t nBCsPerTF = -1; // duration of TF in bcs, should be 128*3564 or 32*3564
523+
int rofOffset = -1; // ITS ROF offset, in bc
524+
int rofLength = -1; // ITS ROF length, in bc
525+
std::string strLPMProductionTag = ""; // MC production tag to be retrieved from AO2D metadata
518526

519527
int32_t findClosest(int64_t globalBC, std::map<int64_t, int32_t>& bcs)
520528
{
@@ -580,6 +588,7 @@ struct EventSelectionTask {
580588
}
581589
}
582590
}
591+
strLPMProductionTag = metadataInfo.get("LPMProductionTag"); // to extract info from ccdb by the tag
583592

584593
ccdb->setURL("http://alice-ccdb.cern.ch");
585594
ccdb->setCaching(true);
@@ -678,7 +687,7 @@ struct EventSelectionTask {
678687
int run3min = 500000;
679688
if (run != lastRun && run >= run3min) {
680689
lastRun = run;
681-
auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run);
690+
auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run, strLPMProductionTag);
682691
// first bc of the first orbit
683692
bcSOR = runInfo.orbitSOR * nBCsPerOrbit;
684693
// duration of TF in bcs
@@ -1458,6 +1467,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
14581467
{
14591468
// Parse the metadata
14601469
metadataInfo.initMetadata(cfgc);
1470+
metadataInfo.print();
14611471

14621472
return WorkflowSpec{
14631473
adaptAnalysisTask<BcSelectionTask>(cfgc),

0 commit comments

Comments
 (0)