Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions Common/Tools/Multiplicity/MultModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@
internalOpts.mEnabledTables.resize(nTablesConst, 0);

LOGF(info, "Configuring tables to generate");
LOGF(info, "Metadata information: isMC? %i", metadataInfo.isMC());
const auto& workflows = context.services().template get<o2::framework::RunningWorkflowInfo const>();

TString listOfRequestors[nTablesConst];
Expand Down Expand Up @@ -505,16 +506,6 @@
listOfRequestors[kPVMults].Append(Form("%s ", "dependency check"));
}

// capture the need for PYTHIA calibration in Pb-Pb runs
if (metadataInfo.isMC() && mRunNumber >= 544013 && mRunNumber <= 545367) {
internalOpts.generatorName.value = "PYTHIA";
}

// capture the need for PYTHIA calibration in light ion runs automatically
if (metadataInfo.isMC() && mRunNumber >= 564250 && mRunNumber <= 564472) {
internalOpts.generatorName.value = "PYTHIA";
}

// list enabled tables
for (int i = 0; i < nTablesConst; i++) {
// printout to be improved in the future
Expand Down Expand Up @@ -588,9 +579,9 @@
if (internalOpts.mEnabledTables[kPVMults]) {
if (std::abs(track.eta()) < 1.0) {
mults.multNContribsEta1++; // pvmults
if (std::abs(track.eta()) < 0.8) {

Check failure on line 582 in Common/Tools/Multiplicity/MultModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
mults.multNContribs++; // pvmults
if (std::abs(track.eta()) < 0.5) {

Check failure on line 584 in Common/Tools/Multiplicity/MultModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
mults.multNContribsEtaHalf++; // pvmults
}
}
Expand Down Expand Up @@ -694,7 +685,7 @@
auto amplitude = fv0.amplitude()[ii];
auto channel = fv0.channel()[ii];
mults.multFV0A += amplitude;
if (channel > 7) {

Check failure on line 688 in Common/Tools/Multiplicity/MultModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
mults.multFV0AOuter += amplitude;
}
}
Expand Down Expand Up @@ -771,7 +762,7 @@
//_______________________________________________________________________
// vertex-Z equalized signals
if (internalOpts.mEnabledTables[kFV0MultZeqs]) {
if (std::fabs(collision.posZ()) < 15.0f && lCalibLoaded) {

Check failure on line 765 in Common/Tools/Multiplicity/MultModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
mults.multFV0AZeq = hVtxZFV0A->Interpolate(0.0) * mults.multFV0A / hVtxZFV0A->Interpolate(collision.posZ());
} else {
mults.multFV0AZeq = 0.0f;
Expand All @@ -779,7 +770,7 @@
cursors.tableFV0Zeqs(mults.multFV0AZeq);
}
if (internalOpts.mEnabledTables[kFT0MultZeqs]) {
if (std::fabs(collision.posZ()) < 15.0f && lCalibLoaded) {

Check failure on line 773 in Common/Tools/Multiplicity/MultModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
mults.multFT0AZeq = hVtxZFT0A->Interpolate(0.0) * mults.multFT0A / hVtxZFT0A->Interpolate(collision.posZ());
mults.multFT0CZeq = hVtxZFT0C->Interpolate(0.0) * mults.multFT0C / hVtxZFT0C->Interpolate(collision.posZ());
} else {
Expand All @@ -789,7 +780,7 @@
cursors.tableFT0Zeqs(mults.multFT0AZeq, mults.multFT0CZeq);
}
if (internalOpts.mEnabledTables[kFDDMultZeqs]) {
if (std::fabs(collision.posZ()) < 15.0f && lCalibLoaded) {

Check failure on line 783 in Common/Tools/Multiplicity/MultModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
mults.multFDDAZeq = hVtxZFDDA->Interpolate(0.0) * mults.multFDDA / hVtxZFDDA->Interpolate(collision.posZ());
mults.multFDDCZeq = hVtxZFDDC->Interpolate(0.0) * mults.multFDDC / hVtxZFDDC->Interpolate(collision.posZ());
} else {
Expand All @@ -816,9 +807,9 @@
if (track.isPVContributor()) {
if (std::abs(track.eta()) < 1.0) {
mults.multNContribsEta1++; // pvmults
if (std::abs(track.eta()) < 0.8) {

Check failure on line 810 in Common/Tools/Multiplicity/MultModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
mults.multNContribs++; // pvmults
if (std::abs(track.eta()) < 0.5) {

Check failure on line 812 in Common/Tools/Multiplicity/MultModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
mults.multNContribsEtaHalf++; // pvmults
}
}
Expand Down Expand Up @@ -853,10 +844,10 @@
}
mults.multNbrContribsEta10GlobalTrackWoDCA++;

if (std::abs(track.eta()) < 0.8) {

Check failure on line 847 in Common/Tools/Multiplicity/MultModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
mults.multNbrContribsEta08GlobalTrackWoDCA++;
}
if (std::abs(track.eta()) < 0.5) {

Check failure on line 850 in Common/Tools/Multiplicity/MultModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
mults.multNbrContribsEta05GlobalTrackWoDCA++;
}
}
Expand Down Expand Up @@ -1145,6 +1136,20 @@
{
if (bc.runNumber() != mRunNumberCentrality) {
mRunNumberCentrality = bc.runNumber(); // mark that this run has been attempted already regardless of outcome
LOGF(info, "centrality loading procedure for timestamp=%llu, run number=%d", bc.timestamp(), bc.runNumber());

// capture the need for PYTHIA calibration in Pb-Pb runs
if (metadataInfo.isMC() && mRunNumber >= 544013 && mRunNumber <= 545367) {
LOGF(info, "This is MC for Pb-Pb. Setting generatorName automatically to PYTHIA");
internalOpts.generatorName.value = "PYTHIA";
}

// capture the need for PYTHIA calibration in light ion runs automatically
if (metadataInfo.isMC() && mRunNumber >= 564250 && mRunNumber <= 564472) {
LOGF(info, "This is MC for light ion runs. Setting generatorName automatically to PYTHIA");
internalOpts.generatorName.value = "PYTHIA";
}

LOGF(info, "centrality loading procedure for timestamp=%llu, run number=%d", bc.timestamp(), bc.runNumber());
TList* callst = nullptr;
// Check if the ccdb path is a root file
Expand Down Expand Up @@ -1258,6 +1263,10 @@
auto populateTable = [&](auto& table, struct CalibrationInfo& estimator, float multiplicity, bool isInelGt0) {
const bool assignOutOfRange = internalOpts.embedINELgtZEROselection && !isInelGt0;
auto scaleMC = [](float x, const float pars[6]) {
float core = ((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4];
if (core < 0.0f) {
return 0.0f; // this should be marked as low multiplicity and not mapped, core^pars[5] would be NaN
}
return std::pow(((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4], 1.0f / pars[5]);
};

Expand Down Expand Up @@ -1343,6 +1352,10 @@
ConfigureCentralityRun2(ccdb, metadataInfo, firstbc);

auto scaleMC = [](float x, const float pars[6]) {
float core = ((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4];
if (core < 0.0f) {
return 0.0f; // this should be marked as low multiplicity and not mapped, core^pars[5] would be NaN
}
return std::pow(((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4], 1.0f / pars[5]);
};

Expand Down
23 changes: 20 additions & 3 deletions PWGDQ/Tasks/dqEfficiency_withAssoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,7 @@ struct AnalysisMuonSelection {
Configurable<std::string> fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Configurable<std::string> grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
Configurable<int64_t> fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"};
Configurable<float> fConfigMagField{"cfgMagField", 5.0f, "Manually set magnetic field"};
Configurable<std::string> fConfigGeoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"};

Configurable<std::string> fConfigMCSignals{"cfgMuonMCSignals", "", "Comma separated list of MC signals"};
Expand Down Expand Up @@ -884,7 +885,9 @@ struct AnalysisMuonSelection {
o2::base::Propagator::initFieldFromGRP(grpmag);
VarManager::SetMagneticField(grpmag->getNominalL3Field());
} else {
LOGF(fatal, "GRP object is not available in CCDB at timestamp=%llu", events.begin().timestamp());
// LOGF(fatal, "GRP object is not available in CCDB at timestamp=%llu", events.begin().timestamp());
// If the magnetic field is not found it is configured by had by the user
VarManager::SetMagneticField(fConfigMagField.value);
}
fCurrentRun = events.begin().runNumber();
}
Expand Down Expand Up @@ -2173,9 +2176,12 @@ struct AnalysisSameEventPairing {

PresliceUnsorted<ReducedMCTracks> perReducedMcGenEvent = aod::reducedtrackMC::reducedMCeventId;

void processMCGen(soa::Filtered<MyEventsVtxCovSelected> const& events, ReducedMCEvents const& /*mcEvents*/, ReducedMCTracks const& mcTracks)
void processMCGen(soa::Filtered<MyEventsVtxCovSelected> const& events, ReducedMCEvents const& mcEvents, ReducedMCTracks const& mcTracks)
{
// Fill Generated histograms taking into account all generated tracks
uint32_t mcDecision = 0;
int isig = 0;

for (auto& mctrack : mcTracks) {
VarManager::FillTrackMC(mcTracks, mctrack);
// NOTE: Signals are checked here mostly based on the skimmed MC stack, so depending on the requested signal, the stack could be incomplete.
Expand Down Expand Up @@ -2209,9 +2215,15 @@ struct AnalysisSameEventPairing {
// auto track_raw = groupedMCTracks.rawIteratorAt(track.globalIndex());
for (auto& sig : fGenMCSignals) {
if (sig->CheckSignal(true, track_raw)) {
mcDecision |= (static_cast<uint32_t>(1) << isig);
fHistMan->FillHistClass(Form("MCTruthGenSel_%s", sig->GetName()), VarManager::fgValues);
if (useMiniTree.fConfigMiniTree) {
auto mcEvent = mcEvents.rawIteratorAt(track_raw.reducedMCeventId());
dileptonMiniTreeGen(mcDecision, mcEvent.impactParameter(), track_raw.pt(), track_raw.eta(), track_raw.phi(), -999, -999, -999);
}
}
}
isig++;
}
} // end loop over reconstructed events
if (fHasTwoProngGenMCsignals) {
Expand All @@ -2224,12 +2236,17 @@ struct AnalysisSameEventPairing {
continue;
}
if (sig->CheckSignal(true, t1_raw, t2_raw)) {
// mcDecision |= (static_cast<uint32_t>(1) << isig);
mcDecision |= (static_cast<uint32_t>(1) << isig);
VarManager::FillPairMC<VarManager::kDecayToMuMu>(t1, t2); // NOTE: This feature will only work for muons
fHistMan->FillHistClass(Form("MCTruthGenPair_%s", sig->GetName()), VarManager::fgValues);
if (useMiniTree.fConfigMiniTree) {
// WARNING! To be checked
dileptonMiniTreeGen(mcDecision, -999, t1.pt(), t1.eta(), t1.phi(), t2.pt(), t2.eta(), t2.phi());
}
}
}
}
isig++;
}
}
}
Expand Down
Loading