Skip to content

Commit 2e13835

Browse files
committed
Add globalBc to reducedMcEvents and use it in MC TF and ROF border
calculations
1 parent d60f1b2 commit 2e13835

6 files changed

Lines changed: 55 additions & 4 deletions

File tree

PWGDQ/Core/VarManager.cxx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,14 @@ void VarManager::SetDefaultVarNames()
744744
fgVariableUnits[kMultMCNParticlesEta05] = "Multiplicity_eta05";
745745
fgVariableUnits[kMultMCNParticlesEta08] = "Multiplicity_eta08";
746746
fgVariableUnits[kMultMCNParticlesEta10] = "Multiplicity_eta10";
747+
fgVariableNames[kMCIsNoTFBorder] = "MC Is not TF border";
748+
fgVariableUnits[kMCIsNoTFBorder] = "";
749+
fgVariableNames[kMCIsNoTFBorderRecomputed] = "MC Is not TF border";
750+
fgVariableUnits[kMCIsNoTFBorderRecomputed] = "";
751+
fgVariableNames[kMCIsNoITSROFBorder] = "MC Is not ITS ROF border";
752+
fgVariableUnits[kMCIsNoITSROFBorder] = "";
753+
fgVariableNames[kMCIsNoITSROFBorderRecomputed] = "MC Is not ITS ROF border";
754+
fgVariableUnits[kMCIsNoITSROFBorderRecomputed] = "";
747755
fgVariableNames[kTwoEvPosZ1] = "vtx-z_{1}";
748756
fgVariableUnits[kTwoEvPosZ1] = "cm";
749757
fgVariableNames[kTwoEvPosZ2] = "vtx-z_{2}";

PWGDQ/Core/VarManager.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,8 @@ class VarManager : public TObject
342342
kMultMCNParticlesEta10,
343343
kMultMCNParticlesEta08,
344344
kMultMCNParticlesEta05,
345+
kMCIsNoITSROFBorderRecomputed,
346+
kMCIsNoTFBorderRecomputed,
345347
kQ1ZNAX,
346348
kQ1ZNAY,
347349
kQ1ZNCX,
@@ -2384,6 +2386,14 @@ void VarManager::FillEvent(T const& event, float* values)
23842386
values[kMultMCNParticlesEta05] = event.multMCNParticlesEta05();
23852387
values[kMultMCNParticlesEta08] = event.multMCNParticlesEta08();
23862388
values[kMultMCNParticlesEta10] = event.multMCNParticlesEta10();
2389+
if (fgUsedVars[kMCIsNoITSROFBorderRecomputed]) {
2390+
uint16_t bcInITSROF = (event.globalBC() + o2::constants::lhc::LHCMaxBunches - fgITSROFbias) % fgITSROFlength;
2391+
values[kMCIsNoITSROFBorderRecomputed] = bcInITSROF > fgITSROFBorderMarginLow && bcInITSROF < fgITSROFlength - fgITSROFBorderMarginHigh ? 1.0 : 0.0;
2392+
}
2393+
if (fgUsedVars[kMCIsNoTFBorderRecomputed]) {
2394+
int64_t bcInTF = (event.globalBC() - fgBCSOR) % fgNBCsPerTF;
2395+
values[kMCIsNoTFBorderRecomputed] = bcInTF > fgTFBorderMarginLow && bcInTF < fgNBCsPerTF - fgTFBorderMarginHigh ? 1.0 : 0.0;
2396+
}
23872397
}
23882398

23892399
if constexpr ((fillMap & EventFilter) > 0 || (fillMap & RapidityGapFilter) > 0) {

PWGDQ/DataModel/ReducedInfoTables.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,14 @@ DECLARE_SOA_TABLE_VERSIONED(ReducedMCEvents_001, "AOD", "REDUCEDMCEVENT", 1, //!
252252
mccollision::T, mccollision::Weight, mccollision::ImpactParameter, cent::CentFT0C,
253253
mult::MultMCNParticlesEta05, mult::MultMCNParticlesEta08, mult::MultMCNParticlesEta10);
254254

255-
using ReducedMCEvents = ReducedMCEvents_001;
255+
DECLARE_SOA_TABLE_VERSIONED(ReducedMCEvents_002, "AOD", "REDUCEDMCEVENT", 2, //! Event level MC truth information
256+
o2::soa::Index<>,
257+
bc::GlobalBC,
258+
mccollision::GeneratorsID, reducedevent::MCPosX, reducedevent::MCPosY, reducedevent::MCPosZ,
259+
mccollision::T, mccollision::Weight, mccollision::ImpactParameter, cent::CentFT0C,
260+
mult::MultMCNParticlesEta05, mult::MultMCNParticlesEta08, mult::MultMCNParticlesEta10);
261+
262+
using ReducedMCEvents = ReducedMCEvents_002;
256263

257264
using ReducedEvent = ReducedEvents::iterator;
258265
using StoredReducedEvent = StoredReducedEvents::iterator;

PWGDQ/TableProducer/tableMakerMC.cxx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,8 @@ struct TableMakerMC {
474474
eventInfo(collision.globalIndex());
475475
// make an entry for this MC event only if it was not already added to the table
476476
if (!(fEventLabels.find(mcCollision.globalIndex()) != fEventLabels.end())) {
477-
eventMC(mcCollision.generatorsID(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(),
477+
auto mcBc = mcCollision.template bc_as<aod::BCsWithTimestamps>();
478+
eventMC(mcBc.globalBC(), mcCollision.generatorsID(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(),
478479
mcCollision.t(), mcCollision.weight(), mcCollision.impactParameter(), 1, 1, 1, 1);
479480
fEventLabels[mcCollision.globalIndex()] = fCounters[1];
480481
fCounters[1]++;
@@ -1109,7 +1110,8 @@ struct TableMakerMC {
11091110
eventInfo(collision.globalIndex());
11101111
// make an entry for this MC event only if it was not already added to the table
11111112
if (!(fEventLabels.find(mcCollision.globalIndex()) != fEventLabels.end())) {
1112-
eventMC(mcCollision.generatorsID(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(),
1113+
auto mcBc = mcCollision.template bc_as<aod::BCsWithTimestamps>();
1114+
eventMC(mcBc.globalBC(), mcCollision.generatorsID(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(),
11131115
mcCollision.t(), mcCollision.weight(), mcCollision.impactParameter(), 1, 1, 1, 1);
11141116
fEventLabels[mcCollision.globalIndex()] = fCounters[1];
11151117
fCounters[1]++;

PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,12 +526,13 @@ struct TableMakerMC {
526526

527527
// Loop over MC collisions
528528
for (auto& mcCollision : mcCollisions) {
529+
auto bc = mcCollision.template bc_as<TBCs>();
529530
// Get MC collision information into the VarManager
530531
VarManager::FillEvent<gkEventMcFillMapWithCent>(mcCollision);
531532
// Fill histograms
532533
fHistMan->FillHistClass("Event_MCTruth", VarManager::fgValues);
533534
// Create the skimmed table entry for this collision
534-
eventMC(mcCollision.generatorsID(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(),
535+
eventMC(bc.globalBC(), mcCollision.generatorsID(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(),
535536
mcCollision.t(), mcCollision.weight(), mcCollision.impactParameter(), mcCollision.bestCollisionCentFT0C(),
536537
mcCollision.multMCNParticlesEta05(), mcCollision.multMCNParticlesEta08(), mcCollision.multMCNParticlesEta10());
537538
}

PWGDQ/Tasks/dqEfficiency_withAssoc.cxx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828

2929
#include <CCDB/BasicCCDBManager.h>
3030
#include <CCDB/CcdbApi.h>
31+
#include <DataFormatsITSMFT/DPLAlpideParam.h>
32+
#include <DataFormatsParameters/AggregatedRunInfo.h>
3133
#include <DataFormatsParameters/GRPMagField.h>
3234
#include <DetectorsBase/GeometryManager.h>
3335
#include <DetectorsBase/MatLayerCylSet.h>
@@ -297,6 +299,12 @@ struct AnalysisEventSelection {
297299
Configurable<std::string> fConfigAddEventMCHistogram{"cfgAddEventMCHistogram", "generator", "Comma separated list of histograms"};
298300
Configurable<std::string> fConfigAddJSONHistograms{"cfgAddJSONHistograms", "", "Add event histograms defined via JSON formatting (see HistogramsLibrary)"};
299301

302+
Configurable<int> fConfigITSROFrameStartBorderMargin{"cfgITSROFrameStartBorderMargin", -1, "Number of bcs at the start of ITS RO Frame border. Take from CCDB if -1"};
303+
Configurable<int> fConfigITSROFrameEndBorderMargin{"cfgITSROFrameEndBorderMargin", -1, "Number of bcs at the end of ITS RO Frame border. Take from CCDB if -1"};
304+
Configurable<int> fConfigTFStartBorderMargin{"cfgTFStartBorderMargin", -1, "Number of bcs at the start of TF border. Take from CCDB if -1"};
305+
Configurable<int> fConfigTFEndBorderMargin{"cfgTFEndBorderMargin", -1, "Number of bcs at the end of TF border. Take from CCDB if -1"};
306+
Configurable<int> fConfigNumberOfOrbitsPerTF{"cfgNumberOfOrbitsPerTF", -1, "Number of orbits per Time Frame. Take from CCDB if -1"};
307+
300308
Configurable<float> fConfigSplitCollisionsDeltaZ{"splitCollisionsDeltaZ", 1.0, "maximum delta-z (cm) between two collisions to consider them as split candidates"};
301309
Configurable<unsigned int> fConfigSplitCollisionsDeltaBC{"splitCollisionsDeltaBC", 100, "maximum delta-BC between two collisions to consider them as split candidates; do not apply if value is negative"};
302310
Configurable<bool> fConfigCheckSplitCollisions{"checkSplitCollisions", false, "If true, run the split collision check and fill histograms"};
@@ -383,6 +391,21 @@ struct AnalysisEventSelection {
383391
uint64_t sor = std::atol(fHeader["SOR"].c_str());
384392
uint64_t eor = std::atol(fHeader["EOR"].c_str());
385393
VarManager::SetSORandEOR(sor, eor);
394+
395+
auto alppar = fCCDB->getForTimeStamp<o2::itsmft::DPLAlpideParam<0>>("ITS/Config/AlpideParam", events.begin().timestamp());
396+
EventSelectionParams* par = fCCDB->getForTimeStamp<EventSelectionParams>("EventSelection/EventSelectionParams", events.begin().timestamp());
397+
int itsROFrameStartBorderMargin = fConfigITSROFrameStartBorderMargin < 0 ? par->fITSROFrameStartBorderMargin : fConfigITSROFrameStartBorderMargin;
398+
int itsROFrameEndBorderMargin = fConfigITSROFrameEndBorderMargin < 0 ? par->fITSROFrameEndBorderMargin : fConfigITSROFrameEndBorderMargin;
399+
VarManager::SetITSROFBorderselection(alppar->roFrameBiasInBC, alppar->roFrameLengthInBC, itsROFrameStartBorderMargin, itsROFrameEndBorderMargin);
400+
401+
int timeFrameStartBorderMargin = fConfigTFStartBorderMargin < 0 ? par->fTimeFrameStartBorderMargin : fConfigTFStartBorderMargin;
402+
int timeFrameEndBorderMargin = fConfigTFEndBorderMargin < 0 ? par->fTimeFrameEndBorderMargin : fConfigTFEndBorderMargin;
403+
auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), events.begin().runNumber());
404+
int64_t bcSOR = runInfo.orbitSOR * o2::constants::lhc::LHCMaxBunches;
405+
int64_t nBCsPerTF = fConfigNumberOfOrbitsPerTF < 0 ? runInfo.orbitsPerTF * o2::constants::lhc::LHCMaxBunches : fConfigNumberOfOrbitsPerTF * o2::constants::lhc::LHCMaxBunches;
406+
VarManager::SetTFBorderselection(bcSOR, nBCsPerTF, timeFrameStartBorderMargin, timeFrameEndBorderMargin);
407+
408+
fCurrentRun = events.begin().runNumber();
386409
}
387410

388411
fSelMap.clear();

0 commit comments

Comments
 (0)