Skip to content

Commit

Permalink
Apply cut for MCGenSignal
Browse files Browse the repository at this point in the history
  • Loading branch information
zjxiongOvO committed Apr 24, 2024
1 parent 55b1d95 commit 603a8a1
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
13 changes: 13 additions & 0 deletions PWGDQ/Core/CutsLibrary.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,11 @@ AnalysisCompositeCut* o2::aod::dqcuts::GetCompositeCut(const char* cutName)
return cut;
}

if (!nameStr.compare("jpsiMCGenPairKine")) {
cut->AddCut(GetAnalysisCut("MCGenPairKineJpsi"));
return cut;
}

if (!nameStr.compare("pionPIDCut1")) {
cut->AddCut(GetAnalysisCut("pionQualityCut1"));
cut->AddCut(GetAnalysisCut("pionPIDnsigma"));
Expand Down Expand Up @@ -2936,6 +2941,14 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName)
return cut;
}

if (!nameStr.compare("MCGenPairKineJpsi")) {
cut->AddCut(VarManager::kPt1, 1.0, 1000.0);
cut->AddCut(VarManager::kPt2, 1.0, 1000.0);
cut->AddCut(VarManager::kEta1, -0.9, 0.9);
cut->AddCut(VarManager::kEta2, -0.9, 0.9);
return cut;
}

// -----------------------------------------------
// Barrel track quality cuts

Expand Down
5 changes: 5 additions & 0 deletions PWGDQ/Core/VarManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -2429,6 +2429,11 @@ void VarManager::FillPairMC(T1 const& t1, T2 const& t2, float* values, PairCandi
values[kEta] = v12.Eta();
values[kPhi] = v12.Phi();
values[kRap] = -v12.Rapidity();

values[kPt1] = t1.pt();
values[kPt2] = t2.pt();
values[kEta1] = t1.eta();
values[kEta2] = t2.eta();
}

template <typename T1, typename T2, typename T3>
Expand Down
24 changes: 24 additions & 0 deletions PWGDQ/Tasks/dqEfficiency.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ struct AnalysisSameEventPairing {
Filter filterMuonSelected = aod::dqanalysisflags::isMuonSelected > 0;
Configurable<std::string> fConfigTrackCuts{"cfgTrackCuts", "", "Comma separated list of barrel track cuts"};
Configurable<std::string> fConfigMuonCuts{"cfgMuonCuts", "", "Comma separated list of barrel track cuts"};
Configurable<std::string> fConfigMCSignalCuts{"cfgMCSignalCuts", "", "Comma separated list of MC signals"};
Configurable<std::string> fConfigMCRecSignals{"cfgBarrelMCRecSignals", "", "Comma separated list of MC signals (reconstructed)"};
Configurable<std::string> fConfigMCGenSignals{"cfgBarrelMCGenSignals", "", "Comma separated list of MC signals (generated)"};
Configurable<bool> fConfigFlatTables{"cfgFlatTables", false, "Produce a single flat tables with all relevant information of the pairs and single tracks"};
Expand Down Expand Up @@ -525,6 +526,7 @@ struct AnalysisSameEventPairing {
std::vector<std::vector<TString>> fBarrelMuonHistNamesMCmatched;
std::vector<MCSignal> fRecMCSignals;
std::vector<MCSignal> fGenMCSignals;
std::vector<AnalysisCompositeCut> fGenMCSignalsCuts;

void init(o2::framework::InitContext& context)
{
Expand Down Expand Up @@ -664,6 +666,12 @@ struct AnalysisSameEventPairing {

// 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 sigGenCutNamesStr = fConfigMCSignalCuts.value;
std::unique_ptr<TObjArray> objGenSigCutArray(sigGenCutNamesStr.Tokenize(","));
for (int icut = 0; icut < objGenSigCutArray->GetEntries(); icut++) {
fGenMCSignalsCuts.push_back(*dqcuts::GetCompositeCut(objGenSigCutArray->At(icut)->GetName()));
}

TString sigGenNamesStr = fConfigMCGenSignals.value;
std::unique_ptr<TObjArray> objGenSigArray(sigGenNamesStr.Tokenize(","));
for (int isig = 0; isig < objGenSigArray->GetEntries(); isig++) {
Expand All @@ -672,9 +680,15 @@ struct AnalysisSameEventPairing {
if (sig->GetNProngs() == 1) { // NOTE: 1-prong signals required
fGenMCSignals.push_back(*sig);
histNames += Form("MCTruthGen_%s;", sig->GetName()); // TODO: Add these names to a std::vector to avoid using Form in the process function
for (auto sigCut : fGenMCSignalsCuts) {
histNames += Form("MCTruthGen_%s_%s;", sig->GetName(), sigCut.GetName());
}
} else if (sig->GetNProngs() == 2) { // NOTE: 2-prong signals required
fGenMCSignals.push_back(*sig);
histNames += Form("MCTruthGenPair_%s;", sig->GetName());
for (auto sigCut : fGenMCSignalsCuts) {
histNames += Form("MCTruthGenPair_%s_%s;", sig->GetName(), sigCut.GetName());
}
}
}
}
Expand Down Expand Up @@ -860,6 +874,11 @@ struct AnalysisSameEventPairing {
}
if (checked) {
fHistMan->FillHistClass(Form("MCTruthGen_%s", sig.GetName()), VarManager::fgValues);
for (auto& sigCut : fGenMCSignalsCuts) {
if (sigCut.IsSelected(VarManager::fgValues)) {
fHistMan->FillHistClass(Form("MCTruthGen_%s_%s", sig.GetName(), sigCut.GetName()), VarManager::fgValues);
}
}
}
}
}
Expand All @@ -881,6 +900,11 @@ struct AnalysisSameEventPairing {
if (checked) {
VarManager::FillPairMC(t1, t2);
fHistMan->FillHistClass(Form("MCTruthGenPair_%s", sig.GetName()), VarManager::fgValues);
for (auto& sigCut : fGenMCSignalsCuts) {
if (sigCut.IsSelected(VarManager::fgValues)) {
fHistMan->FillHistClass(Form("MCTruthGenPair_%s_%s", sig.GetName(), sigCut.GetName()), VarManager::fgValues);
}
}
}
}
} // end of true pairing loop
Expand Down

0 comments on commit 603a8a1

Please sign in to comment.