Skip to content
Merged
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
2 changes: 1 addition & 1 deletion PWGEM/Dilepton/Tasks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@
# or submit itself to any jurisdiction.


o2physics_add_dpl_workflow(efficiency-ee

Check failure on line 13 in PWGEM/Dilepton/Tasks/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name efficiency-ee does not match its file name emEfficiencyEE.cxx. (Matches efficiencyEe.cxx.)
SOURCES emEfficiencyEE.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase O2Physics::PWGDQCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(lmee-lf-cocktail

Check failure on line 18 in PWGEM/Dilepton/Tasks/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name lmee-lf-cocktail does not match its file name lmeeLFCocktail.cxx. (Matches lmeeLfCocktail.cxx.)
SOURCES lmeeLFCocktail.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(lmee-hf-cocktail

Check failure on line 23 in PWGEM/Dilepton/Tasks/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name lmee-hf-cocktail does not match its file name lmeeHFCocktail.cxx. (Matches lmeeHfCocktail.cxx.)
SOURCES lmeeHFCocktail.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(mc-templates

Check failure on line 28 in PWGEM/Dilepton/Tasks/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name mc-templates does not match its file name MCtemplates.cxx. (Matches mcTemplates.cxx.)
SOURCES MCtemplates.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase O2Physics::PWGDQCore
COMPONENT_NAME Analysis)
Expand Down Expand Up @@ -55,32 +55,32 @@
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase O2Physics::PWGDQCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(create-ttp

Check failure on line 58 in PWGEM/Dilepton/Tasks/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name create-ttp does not match its file name createTTP.cxx. (Matches createTtp.cxx.)
SOURCES createTTP.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(event-qc

Check failure on line 63 in PWGEM/Dilepton/Tasks/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name event-qc does not match its file name eventQC.cxx. (Matches eventQc.cxx.)
SOURCES eventQC.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(single-electron-qc

Check failure on line 68 in PWGEM/Dilepton/Tasks/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name single-electron-qc does not match its file name singleElectronQC.cxx. (Matches singleElectronQc.cxx.)
SOURCES singleElectronQC.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::PWGEMDileptonCore O2Physics::EventFilteringUtils
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(single-electron-qc-mc

Check failure on line 73 in PWGEM/Dilepton/Tasks/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name single-electron-qc-mc does not match its file name singleElectronQCMC.cxx. (Matches singleElectronQcMc.cxx.)
SOURCES singleElectronQCMC.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::PWGEMDileptonCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(single-muon-qc

Check failure on line 78 in PWGEM/Dilepton/Tasks/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name single-muon-qc does not match its file name singleMuonQC.cxx. (Matches singleMuonQc.cxx.)
SOURCES singleMuonQC.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::PWGEMDileptonCore O2Physics::EventFilteringUtils
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(single-muon-qc-mc

Check failure on line 83 in PWGEM/Dilepton/Tasks/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name single-muon-qc-mc does not match its file name singleMuonQCMC.cxx. (Matches singleMuonQcMc.cxx.)
SOURCES singleMuonQCMC.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::PWGEMDileptonCore
COMPONENT_NAME Analysis)
Expand Down Expand Up @@ -172,7 +172,7 @@

o2physics_add_dpl_workflow(test-pv
SOURCES testPV.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(evaluate-acceptance
Expand Down
62 changes: 49 additions & 13 deletions PWGEM/Dilepton/Tasks/testPV.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
/// \author daiki.sekihata@cern.ch

#include "Common/CCDB/EventSelectionParams.h"
#include "Common/Core/Zorro.h"
#include "Common/DataModel/EventSelection.h"

#include <CCDB/BasicCCDBManager.h>
#include <Framework/AnalysisDataModel.h>
#include <Framework/AnalysisTask.h>
#include <Framework/Configurable.h>
Expand All @@ -36,11 +38,12 @@ using namespace o2::framework::expressions;
struct testPV {

// Configurables
// Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};

struct : ConfigurableGroup {
std::string prefix = "eventCut";
Configurable<int> cfgEventGeneratorId{"cfgEventGeneratorId", -1, "event generator index. e.g. select gap/signal events"};
Configurable<float> cfgChi2PerNcontribMax{"cfgChi2PerNcontribMax", 1e+10, "max. chi2/Ncontrib of PV"};
Configurable<float> cfgZvtxMin{"cfgZvtxMin", -10.f, "min. Zvtx"};
Configurable<float> cfgZvtxMax{"cfgZvtxMax", 10.f, "max. Zvtx"};
Configurable<bool> cfgRequireFT0AND{"cfgRequireFT0AND", true, "require FT0AND"};
Expand All @@ -50,37 +53,53 @@ struct testPV {
Configurable<bool> cfgRequireGoodZvtxFT0vsPV{"cfgRequireGoodZvtxFT0vsPV", false, "require good Zvtx between FT0 vs. PV in event cut"};
Configurable<bool> cfgRequireVertexITSTPC{"cfgRequireVertexITSTPC", false, "require Vertex ITSTPC in event cut"}; // ITS-TPC matched track contributes PV.
Configurable<bool> cfgRequireVertexTOFmatched{"cfgRequireVertexTOFmatched", false, "require Vertex TOFmatched in event cut"}; // ITS-TPC-TOF matched track contributes PV.

// for RCT
o2::framework::Configurable<bool> cfgRequireGoodRCT{"cfgRequireGoodRCT", true, "require good detector flag in run condtion table"};
o2::framework::Configurable<std::string> cfgRCTLabel{"cfgRCTLabel", "CBT", "select 1 [CBT, CBT_hadronPID, CBT_muon_glo] see O2Physics/Common/CCDB/RCTSelectionFlags.h"};
o2::framework::Configurable<bool> cfgCheckZDC{"cfgCheckZDC", false, "set ZDC flag for AA"};
o2::framework::Configurable<bool> cfgTreatLimitedAcceptanceAsBad{"cfgTreatLimitedAcceptanceAsBad", false, "reject all events where the detectors relevant for the specified Runlist are flagged as LimitedAcceptance"};
} eventCut;

// for zorro
struct : ConfigurableGroup {
std::string prefix = "zorroGroup";
Configurable<std::string> cfgTriggerName{"cfgTriggerName", "fGlobalDimuon", "desired software trigger name"};
Configurable<std::string> ccdbPathSoftwareTrigger{"ccdbPathSoftwareTrigger", "EventFiltering/Zorro/", "ccdb path for ZORRO objects"};
Configurable<uint64_t> bcMarginForSoftwareTrigger{"bcMarginForSoftwareTrigger", 100, "Number of BCs of margin for software triggers"};
} zorroGroup;

HistogramRegistry fRegistry{"fRegistry"};
Zorro zorro;

void init(o2::framework::InitContext&)
{
// ccdb->setURL(ccdburl);
// ccdb->setCaching(true);
// ccdb->setLocalObjectValidityChecking();
// ccdb->setFatalWhenNull(false);
ccdb->setURL(ccdburl);
ccdb->setCaching(true);
ccdb->setLocalObjectValidityChecking();
ccdb->setFatalWhenNull(false);

mRunNumber = 0;

addHistograms();
}

int mRunNumber{0};
// Service<o2::ccdb::BasicCCDBManager> ccdb;
Service<o2::ccdb::BasicCCDBManager> ccdb;

template <typename TBC>
template <bool isTriggerAnalysis, typename TBC>
void initCCDB(TBC const& bc)
{
if (mRunNumber == bc.runNumber()) {
return;
}

if constexpr (isTriggerAnalysis) {
zorro.setCCDBpath(zorroGroup.ccdbPathSoftwareTrigger);
zorro.setBCtolerance(zorroGroup.bcMarginForSoftwareTrigger); // this does nothing.
zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), zorroGroup.cfgTriggerName.value);
}

mRunNumber = bc.runNumber();
}

Expand Down Expand Up @@ -136,6 +155,9 @@ struct testPV {
if (eventCut.cfgRequireVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) {
return false;
}
if (collision.chi2() / collision.numContrib() > eventCut.cfgChi2PerNcontribMax) {
return false;
}
return true;
}

Expand All @@ -155,12 +177,12 @@ struct testPV {
fRegistry.fill(HIST("Vertex/hCollisionTimeRes"), collision.numContrib(), collision.collisionTimeRes());
}

template <bool isMC, typename TBCs, typename TCollisions, typename TMCCollisions, typename TMCParticles>
template <bool isMC, bool isTriggerAnalysis, typename TBCs, typename TCollisions, typename TMCCollisions, typename TMCParticles>
void run(TBCs const&, TCollisions const& collisions, TMCCollisions const&, TMCParticles const&)
{
for (const auto& collision : collisions) {
auto bc = collision.template bc_as<TBCs>();
initCCDB(bc);
initCCDB<isTriggerAnalysis>(bc);

if constexpr (isMC) {
if (!collision.has_mcCollision()) {
Expand All @@ -172,6 +194,12 @@ struct testPV {
}
}

if constexpr (isTriggerAnalysis) {
if (!zorro.isSelected(bc.globalBC(), zorroGroup.bcMarginForSoftwareTrigger)) { // triggered event
continue;
}
}

fRegistry.fill(HIST("hCollisionCounter"), 1);

if (!isSelectedCollision(collision)) {
Expand All @@ -190,21 +218,29 @@ struct testPV {
} // end of collision loop
}

using MyCollisions = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels>;
using MyCollisions = soa::Join<aod::Collisions, aod::EvSels>;
using MyCollisionsMC = soa::Join<MyCollisions, aod::McCollisionLabels>;
using MyBCs = soa::Join<aod::BCsWithTimestamps, aod::BcSels>;

Filter collisionFilter_evsel = eventCut.cfgZvtxMin < o2::aod::collision::posZ && o2::aod::collision::posZ < eventCut.cfgZvtxMax;
using FilteredMyCollisions = soa::Filtered<MyCollisions>;
using FilteredMyCollisionsMC = soa::Filtered<MyCollisionsMC>;

void processData(FilteredMyCollisions const& collisions, MyBCs const& bcs)
{
run<false>(bcs, collisions, nullptr, nullptr);
run<false, false>(bcs, collisions, nullptr, nullptr);
}
PROCESS_SWITCH(testPV, processData, "processData", true);

void processMC(FilteredMyCollisions const& collisions, MyBCs const& bcs, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles)
void processTriggeredData(FilteredMyCollisions const& collisions, MyBCs const& bcs)
{
run<false, true>(bcs, collisions, nullptr, nullptr);
}
PROCESS_SWITCH(testPV, processTriggeredData, "processTriggeredData", true);

void processMC(FilteredMyCollisionsMC const& collisions, MyBCs const& bcs, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles)
{
run<true>(bcs, collisions, mcCollisions, mcParticles);
run<true, false>(bcs, collisions, mcCollisions, mcParticles);
}
PROCESS_SWITCH(testPV, processMC, "processMC", false);

Expand Down
Loading