Skip to content
Open
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
18 changes: 18 additions & 0 deletions PWGDQ/Core/CutsLibrary.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include <RtypesCore.h>

#include <iostream>

Check failure on line 23 in PWGDQ/Core/CutsLibrary.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[include-iostream]

Do not include iostream. Use O2 logging instead.
#include <set>
#include <string>
#include <vector>
Expand Down Expand Up @@ -1169,7 +1169,7 @@
return cut;
}

for (int iCut = 0; iCut < 10; iCut++) {

Check failure on line 1172 in PWGDQ/Core/CutsLibrary.cxx

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.
if (!nameStr.compare(Form("jpsiEleSel%d_ionut", iCut))) {
cut->AddCut(GetAnalysisCut("kineJpsiEle_ionut"));
cut->AddCut(GetAnalysisCut("dcaCut1_ionut"));
Expand Down Expand Up @@ -1469,7 +1469,7 @@
return cut;
}

for (int i = 1; i <= 8; i++) {

Check failure on line 1472 in PWGDQ/Core/CutsLibrary.cxx

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.
if (!nameStr.compare(Form("dalitzSelected%d", i))) {
cut->AddCut(GetAnalysisCut(Form("dalitzLeg%d", i)));
return cut;
Expand Down Expand Up @@ -1943,7 +1943,7 @@
return cut;
}

for (unsigned int i = 0; i < 30; i++) {

Check failure on line 1946 in PWGDQ/Core/CutsLibrary.cxx

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.
if (!nameStr.compare(Form("ElSelCutVar%s%i", vecPIDcase.at(icase).Data(), i))) {
cut->AddCut(GetAnalysisCut("lmeeStandardKine"));
cut->AddCut(GetAnalysisCut(Form("lmeeCutVarTrackCuts%i", i)));
Expand Down Expand Up @@ -2713,7 +2713,7 @@
return cut;
}

for (int i = 1; i <= 8; i++) {

Check failure on line 2716 in PWGDQ/Core/CutsLibrary.cxx

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.
if (!nameStr.compare(Form("lmee%s_pp502TeV_PID%s_UsePrefilter%d", vecTypetrackWithPID.at(jcase).Data(), vecPIDcase.at(icase).Data(), i))) {
cut->AddCut(GetAnalysisCut(Form("notDalitzLeg%d", i)));
cut->AddCut(GetAnalysisCut("lmeeStandardKine"));
Expand Down Expand Up @@ -2770,7 +2770,7 @@
return cut;
}

for (int i = 1; i <= 8; i++) {

Check failure on line 2773 in PWGDQ/Core/CutsLibrary.cxx

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.
if (!nameStr.compare(Form("lmee%s_eNSigmaRun3%s_UsePrefilter%d", vecTypetrackWithPID.at(jcase).Data(), vecPIDcase.at(icase).Data(), i))) {
cut->AddCut(GetAnalysisCut(Form("notDalitzLeg%d", i)));
cut->AddCut(GetAnalysisCut("lmeeStandardKine"));
Expand Down Expand Up @@ -4317,6 +4317,24 @@
return cut;
}

if (!nameStr.compare("acceptance_pp13600")) {
cut->AddCut(VarManager::kMCY, -0.8, 0.8);
cut->AddCut(VarManager::kMCPt1, 1.0, 1000.0);
cut->AddCut(VarManager::kMCPt2, 1.0, 1000.0);
cut->AddCut(VarManager::kMCEta1, -0.8, 0.8);
cut->AddCut(VarManager::kMCEta2, -0.8, 0.8);
return cut;
}

if (!nameStr.compare("acceptance_pp5360")) {
cut->AddCut(VarManager::kMCY, -0.9, 0.9);
cut->AddCut(VarManager::kMCPt1, 1.0, 1000.0);
cut->AddCut(VarManager::kMCPt2, 1.0, 1000.0);
cut->AddCut(VarManager::kMCEta1, -0.9, 0.9);
cut->AddCut(VarManager::kMCEta2, -0.9, 0.9);
return cut;
}

// ---------------------------------------------------
// MC generated particle acceptance cuts

Expand Down Expand Up @@ -4494,7 +4512,7 @@
cut->AddCut(VarManager::kITSncls, 6.5, 7.5);
cut->AddCut(VarManager::kTPCnclsCR, 80.0, 161.);
cut->AddCut(VarManager::kTPCncls, 90.0, 170.);
} else if (icase == 2) {

Check failure on line 4515 in PWGDQ/Core/CutsLibrary.cxx

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.
cut->AddCut(VarManager::kIsSPDfirst, 0.5, 1.5);
cut->AddCut(VarManager::kITSchi2, 0.0, 5.0);
cut->AddCut(VarManager::kITSncls, 4.5, 7.5);
Expand Down Expand Up @@ -7238,11 +7256,11 @@
labelsFlatBin.push_back(Form("%s_cent%.0f_%.0f_pt%.1f_%.1f", cent.c_str(), centMin, centMax, ptMin, ptMax));
LOG(info) << "Added cut for " << Form("%s_cent%.0f_%.0f_pt%.1f_%.1f", cent.c_str(), centMin, centMax, ptMin, ptMax) << " with cuts: [";
for (size_t i = 0; i < binCuts.size(); ++i) {
std::cout << binCuts[i];

Check failure on line 7259 in PWGDQ/Core/CutsLibrary.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
if (i != binCuts.size() - 1)
std::cout << ", ";

Check failure on line 7261 in PWGDQ/Core/CutsLibrary.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
}
std::cout << "] and direction: " << (exclude ? "CutGreater" : "CutSmaller") << std::endl;

Check failure on line 7263 in PWGDQ/Core/CutsLibrary.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
}
}

Expand Down
8 changes: 8 additions & 0 deletions PWGDQ/Core/VarManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,10 @@ class VarManager : public TObject
kMCMotherPdgCode,

// MC pair variables
kMCPt1,
kMCEta1,
kMCPt2,
kMCEta2,
kMCCosThetaHE,
kMCPhiHE,
kMCPhiTildeHE,
Expand Down Expand Up @@ -3716,6 +3720,10 @@ void VarManager::FillPairMC(T1 const& t1, T2 const& t2, float* values)
values[kMCEta] = v12.Eta();
values[kMCPhi] = v12.Phi();
values[kMCY] = -v12.Rapidity();
values[kMCPt1] = t1.pt();
values[kMCPt2] = t2.pt();
values[kMCEta1] = t1.eta();
values[kMCEta2] = t2.eta();

// polarization parameters
bool useHE = fgUsedVars[kMCCosThetaHE] || fgUsedVars[kMCPhiHE]; // helicity frame
Expand Down
76 changes: 40 additions & 36 deletions PWGDQ/Tasks/dqEfficiency_withAssoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1325,6 +1325,7 @@ struct AnalysisSameEventPairing {
Produces<aod::DileptonsInfo> dileptonInfoList;
Produces<aod::JPsieeCandidates> PromptNonPromptSepTable;
Produces<aod::OniaMCTruth> MCTruthTableEffi;
Produces<aod::DileptonPolarization> dileptonPolarList;

o2::base::MatLayerCylSet* fLUT = nullptr;
int fCurrentRun; // needed to detect if the run changed and trigger update of calibrations etc.
Expand All @@ -1335,7 +1336,7 @@ struct AnalysisSameEventPairing {
Configurable<std::string> track{"cfgTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"};
Configurable<std::string> muon{"cfgMuonCuts", "", "Comma separated list of muon cuts"};
Configurable<std::string> pair{"cfgPairCuts", "", "Comma separated list of pair cuts, !!! Use only if you know what you are doing, otherwise leave empty"};
Configurable<std::string> MCgenAcc{"cfgMCGenAccCut", "", "cut for MC generated particles acceptance"};
Configurable<std::string> MCgenAcc{"cfgMCGenAccCuts", "", "Comma separated list of MC generated particles acceptance cuts, !!! Use only if you know what you are doing, otherwise leave empty"};
// TODO: Add pair cuts via JSON
} fConfigCuts;

Expand All @@ -1354,6 +1355,7 @@ struct AnalysisSameEventPairing {
Configurable<bool> useRemoteField{"cfgUseRemoteField", false, "Chose whether to fetch the magnetic field from ccdb or set it manually"};
Configurable<float> magField{"cfgMagField", 5.0f, "Manually set magnetic field"};
Configurable<bool> flatTables{"cfgFlatTables", false, "Produce a single flat tables with all relevant information of the pairs and single tracks"};
Configurable<bool> polarTables{"cfgPolarTables", false, "Produce tables with dilepton polarization information"};
Configurable<bool> useKFVertexing{"cfgUseKFVertexing", false, "Use KF Particle for secondary vertex reconstruction (DCAFitter is used by default)"};
Configurable<bool> useAbsDCA{"cfgUseAbsDCA", false, "Use absolute DCA minimization instead of chi^2 minimization in secondary vertexing"};
Configurable<bool> propToPCA{"cfgPropToPCA", false, "Propagate tracks to secondary vertex"};
Expand Down Expand Up @@ -1396,7 +1398,7 @@ struct AnalysisSameEventPairing {
std::vector<MCSignal*> fGenMCSignals;

std::vector<AnalysisCompositeCut> fPairCuts;
AnalysisCompositeCut fMCGenAccCut;
std::vector<AnalysisCut*> fMCGenAccCuts;
bool fUseMCGenAccCut = false;

uint32_t fTrackFilterMask; // mask for the track cuts required in this task to be applied on the barrel cuts produced upstream
Expand Down Expand Up @@ -1485,16 +1487,6 @@ struct AnalysisSameEventPairing {
}
}

// get the mc generated acceptance cut
TString mcGenAccCutStr = fConfigCuts.MCgenAcc.value;
if (mcGenAccCutStr != "") {
AnalysisCut* cut = dqcuts::GetAnalysisCut(mcGenAccCutStr.Data());
if (cut != nullptr) {
fMCGenAccCut.AddCut(cut);
}
fUseMCGenAccCut = true;
}

// check that the barrel track cuts array required in this task is not empty
if (!trackCutsStr.IsNull()) {
// tokenize and loop over the barrel cuts produced by the barrel track selection task
Expand Down Expand Up @@ -1663,6 +1655,19 @@ struct AnalysisSameEventPairing {
} // end loop over cuts
} // end if (muonCutsStr)

// get the mc generated acceptance cuts
TString mcgenCutsStr = fConfigCuts.MCgenAcc.value;
if (!mcgenCutsStr.IsNull()) {
std::unique_ptr<TObjArray> objArray(mcgenCutsStr.Tokenize(","));
for (int icut = 0; icut < objArray->GetEntries(); ++icut) {
AnalysisCut* cut = dqcuts::GetAnalysisCut(objArray->At(icut)->GetName());
if (cut != nullptr) {
fMCGenAccCuts.push_back(cut);
}
}
fUseMCGenAccCut = true;
}

// Add histogram classes for each specified MCsignal at the generator level
// TODO: create a std::vector of hist classes to be used at Fill time, to avoid using Form in the process function
TString sigGenNamesStr = fConfigMC.genSignals.value;
Expand Down Expand Up @@ -1695,6 +1700,12 @@ struct AnalysisSameEventPairing {
histNames += Form("MCTruthGenPair_%s;", sig->GetName());
histNames += Form("MCTruthGenPairSel_%s;", sig->GetName());
fHasTwoProngGenMCsignals = true;
// for these pair level signals, also add histograms for each MCgenAcc cut if specified
if (fUseMCGenAccCut) {
for (auto& cut : fMCGenAccCuts) {
histNames += Form("MCTruthGenPairSel_%s_%s;", sig->GetName(), cut->GetName());
}
}
}
}
}
Expand Down Expand Up @@ -1806,6 +1817,9 @@ struct AnalysisSameEventPairing {
dileptonMiniTreeGen.reserve(1);
dileptonMiniTreeRec.reserve(1);
}
if (fConfigOptions.polarTables.value) {
dileptonPolarList.reserve(1);
}
constexpr bool eventHasQvector = ((TEventFillMap & VarManager::ObjTypes::ReducedEventQvector) > 0);
constexpr bool trackHasCov = ((TTrackFillMap & VarManager::ObjTypes::ReducedTrackBarrelCov) > 0);

Expand Down Expand Up @@ -1900,6 +1914,13 @@ struct AnalysisSameEventPairing {
VarManager::fgValues[VarManager::kVertexingTauzProjected], VarManager::fgValues[VarManager::kVertexingTauxyProjected],
VarManager::fgValues[VarManager::kVertexingLzProjected], VarManager::fgValues[VarManager::kVertexingLxyProjected]);
}
if (fConfigOptions.polarTables.value && t1.has_reducedMCTrack() && t2.has_reducedMCTrack()) {
dileptonPolarList(VarManager::fgValues[VarManager::kCosThetaHE], VarManager::fgValues[VarManager::kPhiHE], VarManager::fgValues[VarManager::kPhiTildeHE],
VarManager::fgValues[VarManager::kCosThetaCS], VarManager::fgValues[VarManager::kPhiCS], VarManager::fgValues[VarManager::kPhiTildeCS],
VarManager::fgValues[VarManager::kCosThetaPP], VarManager::fgValues[VarManager::kPhiPP], VarManager::fgValues[VarManager::kPhiTildePP],
VarManager::fgValues[VarManager::kCosThetaRM],
VarManager::fgValues[VarManager::kCosThetaStarTPC], VarManager::fgValues[VarManager::kCosThetaStarFT0A], VarManager::fgValues[VarManager::kCosThetaStarFT0C]);
}
}
}
}
Expand Down Expand Up @@ -2147,12 +2168,6 @@ struct AnalysisSameEventPairing {

for (auto& mctrack : mcTracks) {
VarManager::FillTrackMC(mcTracks, mctrack);
// if we have a mc generated acceptance cut, apply it here
if (fUseMCGenAccCut) {
if (!fMCGenAccCut.IsSelected(VarManager::fgValues)) {
continue;
}
}
// NOTE: Signals are checked here mostly based on the skimmed MC stack, so depending on the requested signal, the stack could be incomplete.
// NOTE: However, the working model is that the decisions on MC signals are precomputed during skimming and are stored in the mcReducedFlags member.
// TODO: Use the mcReducedFlags to select signals
Expand All @@ -2176,12 +2191,6 @@ struct AnalysisSameEventPairing {
continue;
}
VarManager::FillTrackMC(mcTracks, track);
// if we have a mc generated acceptance cut, apply it here
if (fUseMCGenAccCut) {
if (!fMCGenAccCut.IsSelected(VarManager::fgValues)) {
continue;
}
}
auto track_raw = mcTracks.rawIteratorAt(track.globalIndex());
mcDecision = 0;
isig = 0;
Expand Down Expand Up @@ -2212,11 +2221,6 @@ struct AnalysisSameEventPairing {
}
if (sig->CheckSignal(true, t1_raw, t2_raw)) {
VarManager::FillPairMC<TPairType>(t1, t2);
if (fUseMCGenAccCut) {
if (!fMCGenAccCut.IsSelected(VarManager::fgValues)) {
continue;
}
}
fHistMan->FillHistClass(Form("MCTruthGenPair_%s", sig->GetName()), VarManager::fgValues);
}
}
Expand Down Expand Up @@ -2247,12 +2251,15 @@ struct AnalysisSameEventPairing {
if (sig->CheckSignal(true, t1_raw, t2_raw)) {
mcDecision |= (static_cast<uint32_t>(1) << isig);
VarManager::FillPairMC<TPairType>(t1, t2);
fHistMan->FillHistClass(Form("MCTruthGenPairSel_%s", sig->GetName()), VarManager::fgValues);
// Fill also acceptance cut histograms if requested
if (fUseMCGenAccCut) {
if (!fMCGenAccCut.IsSelected(VarManager::fgValues)) {
continue;
for (auto& cut : fMCGenAccCuts) {
if (cut->IsSelected(VarManager::fgValues)) {
fHistMan->FillHistClass(Form("MCTruthGenPairSel_%s_%s", sig->GetName(), cut->GetName()), VarManager::fgValues);
}
}
}
fHistMan->FillHistClass(Form("MCTruthGenPairSel_%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());
Expand Down Expand Up @@ -2293,10 +2300,7 @@ struct AnalysisSameEventPairing {
MyBarrelTracksWithCovWithAmbiguitiesWithColl const& barrelTracks, ReducedMCEvents const& mcEvents, ReducedMCTracks const& mcTracks)
{
runSameEventPairing<true, VarManager::kDecayToEE, gkEventFillMapWithCov, gkTrackFillMapWithCovWithColl>(events, trackAssocsPerCollision, barrelAssocs, barrelTracks, mcEvents, mcTracks);
// Feature replaced by processMCGen
/* if (fConfigMC.runMCGenPair) {
runMCGen<VarManager::kDecayToEE>(mcEvents, mcTracks);
}*/
runMCGenWithGrouping<VarManager::kDecayToEE>(events, mcEvents, mcTracks);
}

void processMuonOnlySkimmed(MyEventsVtxCovSelected const& events,
Expand Down
Loading