Skip to content
Merged
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
89 changes: 42 additions & 47 deletions PWGEM/Dilepton/Tasks/testPV.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in PWGEM/Dilepton/Tasks/testPV.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/workflow-file]

Name of a workflow file must match the name of the main struct in it (without the PWG prefix). (Class implementation files should be in "Core" directories.)

Check failure on line 1 in PWGEM/Dilepton/Tasks/testPV.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-task]

Specify task name only when it cannot be derived from the struct name. Only append to the default name.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand Down Expand Up @@ -30,29 +30,24 @@

#include <string>

using namespace o2;
using namespace o2::soa;
using namespace o2::framework;
using namespace o2::framework::expressions;

struct testPV {

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

Check failure on line 36 in PWGEM/Dilepton/Tasks/testPV.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)

struct : ConfigurableGroup {
struct : o2::framework::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"};
Configurable<bool> cfgRequireNoTFB{"cfgRequireNoTFB", true, "require No time frame border"};
Configurable<bool> cfgRequireNoITSROFB{"cfgRequireNoITSROFB", false, "require no ITS readout frame border"};
Configurable<bool> cfgRequireNoSameBunchPileup{"cfgRequireNoSameBunchPileup", false, "require no same bunch pileup in event cut"};
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.
o2::framework::Configurable<int> cfgEventGeneratorId{"cfgEventGeneratorId", -1, "event generator index. e.g. select gap/signal events"};
o2::framework::Configurable<float> cfgChi2PerNcontribMax{"cfgChi2PerNcontribMax", 1e+10, "max. chi2/Ncontrib of PV"};
o2::framework::Configurable<float> cfgZvtxMin{"cfgZvtxMin", -10.f, "min. Zvtx"};
o2::framework::Configurable<float> cfgZvtxMax{"cfgZvtxMax", 10.f, "max. Zvtx"};
o2::framework::Configurable<bool> cfgRequireFT0AND{"cfgRequireFT0AND", true, "require FT0AND"};
o2::framework::Configurable<bool> cfgRequireNoTFB{"cfgRequireNoTFB", true, "require No time frame border"};
o2::framework::Configurable<bool> cfgRequireNoITSROFB{"cfgRequireNoITSROFB", false, "require no ITS readout frame border"};
o2::framework::Configurable<bool> cfgRequireNoSameBunchPileup{"cfgRequireNoSameBunchPileup", false, "require no same bunch pileup in event cut"};
o2::framework::Configurable<bool> cfgRequireGoodZvtxFT0vsPV{"cfgRequireGoodZvtxFT0vsPV", false, "require good Zvtx between FT0 vs. PV in event cut"};
o2::framework::Configurable<bool> cfgRequireVertexITSTPC{"cfgRequireVertexITSTPC", false, "require Vertex ITSTPC in event cut"}; // ITS-TPC matched track contributes PV.
o2::framework::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"};
Expand All @@ -62,14 +57,14 @@
} eventCut;

// for zorro
struct : ConfigurableGroup {
struct : o2::framework::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"};
o2::framework::Configurable<std::string> cfgTriggerName{"cfgTriggerName", "fGlobalDimuon", "desired software trigger name"};
o2::framework::Configurable<std::string> ccdbPathSoftwareTrigger{"ccdbPathSoftwareTrigger", "EventFiltering/Zorro/", "ccdb path for ZORRO objects"};
o2::framework::Configurable<uint64_t> bcMarginForSoftwareTrigger{"bcMarginForSoftwareTrigger", 100, "Number of BCs of margin for software triggers"};
} zorroGroup;

HistogramRegistry fRegistry{"fRegistry"};
o2::framework::HistogramRegistry fRegistry{"fRegistry"};
Zorro zorro;

void init(o2::framework::InitContext&)
Expand All @@ -85,7 +80,7 @@
}

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

template <bool isTriggerAnalysis, typename TBC>
void initCCDB(TBC const& bc)
Expand All @@ -105,26 +100,26 @@

void addHistograms()
{
auto hCollisionCounter = fRegistry.add<TH1>("hCollisionCounter", "collision counter", kTH1D, {{2, 0.5f, 2.5f}}, false);
auto hCollisionCounter = fRegistry.add<TH1>("hCollisionCounter", "collision counter", o2::framework::HistType::kTH1D, {{2, 0.5f, 2.5f}}, false);
hCollisionCounter->GetXaxis()->SetBinLabel(1, "all");
hCollisionCounter->GetXaxis()->SetBinLabel(2, "accepted");

fRegistry.add("Vertex/hZvtx", "vertex z; Z_{vtx} (cm)", kTH1F, {{100, -50, +50}}, false);
fRegistry.add("Vertex/hNContrib", "Number of PV contributors;N_{contrib}", kTH1F, {{101, -0.5, 100.5}}, false);
fRegistry.add("Vertex/hChi2", "vertex chi2;#chi^{2}/N_{contrib}", kTH1F, {{100, 0, 10}}, false);
fRegistry.add("Vertex/hChi2vsNContrib", "vertex #chi^{2}/N_{contrib} vs. N_{contrib};N_{contrib};#chi^{2}/N_{contrib}", kTH2F, {{101, -0.5, 100.5}, {100, 0, 10}}, false);
fRegistry.add("Vertex/hZvtx", "vertex z; Z_{vtx} (cm)", o2::framework::HistType::kTH1F, {{100, -50, +50}}, false);
fRegistry.add("Vertex/hNContrib", "Number of PV contributors;N_{contrib}", o2::framework::HistType::kTH1F, {{101, -0.5, 100.5}}, false);
fRegistry.add("Vertex/hChi2", "vertex chi2;#chi^{2}/N_{contrib}", o2::framework::HistType::kTH1F, {{100, 0, 10}}, false);
fRegistry.add("Vertex/hChi2vsNContrib", "vertex #chi^{2}/N_{contrib} vs. N_{contrib};N_{contrib};#chi^{2}/N_{contrib}", o2::framework::HistType::kTH2F, {{101, -0.5, 100.5}, {100, 0, 10}}, false);

fRegistry.add("Vertex/hSigmaX", "vertex #sigma_{X} vs. N_{contrib};N_{contrib};#sigma_{X} (#mum)", kTH2F, {{101, -0.5, 100.5}, {1000, 0, 100}}, false);
fRegistry.add("Vertex/hSigmaY", "vertex #sigma_{Y} vs. N_{contrib};N_{contrib};#sigma_{Y} (#mum)", kTH2F, {{101, -0.5, 100.5}, {1000, 0, 100}}, false);
fRegistry.add("Vertex/hSigmaZ", "vertex #sigma_{Z} vs. N_{contrib};N_{contrib};#sigma_{Z} (#mum)", kTH2F, {{101, -0.5, 100.5}, {1000, 0, 100}}, false);
fRegistry.add("Vertex/hSigmaX", "vertex #sigma_{X} vs. N_{contrib};N_{contrib};#sigma_{X} (#mum)", o2::framework::HistType::kTH2F, {{101, -0.5, 100.5}, {1000, 0, 100}}, false);
fRegistry.add("Vertex/hSigmaY", "vertex #sigma_{Y} vs. N_{contrib};N_{contrib};#sigma_{Y} (#mum)", o2::framework::HistType::kTH2F, {{101, -0.5, 100.5}, {1000, 0, 100}}, false);
fRegistry.add("Vertex/hSigmaZ", "vertex #sigma_{Z} vs. N_{contrib};N_{contrib};#sigma_{Z} (#mum)", o2::framework::HistType::kTH2F, {{101, -0.5, 100.5}, {1000, 0, 100}}, false);

fRegistry.add("Vertex/hCollisionTime", "vertex time;N_{contrib};collision time (ns)", kTH2F, {{101, -0.5, 100.5}, {500, -25, 25}}, false);
fRegistry.add("Vertex/hCollisionTimeRes", "vertex time resolution;N_{contrib};collision time resolution (ns)", kTH2F, {{101, -0.5, 100.5}, {250, 0, 25}}, false);
fRegistry.add("Vertex/hCollisionTime", "vertex time;N_{contrib};collision time (ns)", o2::framework::HistType::kTH2F, {{101, -0.5, 100.5}, {500, -25, 25}}, false);
fRegistry.add("Vertex/hCollisionTimeRes", "vertex time resolution;N_{contrib};collision time resolution (ns)", o2::framework::HistType::kTH2F, {{101, -0.5, 100.5}, {250, 0, 25}}, false);

if (doprocessMC) {
fRegistry.add("Vertex/hDeltaX", "vertex #DeltaX vs. N_{contrib};N_{contrib};#DeltaX = (X_{rec} #minus X_{gen})/#sigma_{X}", kTH2F, {{101, -0.5, 100.5}, {200, -10, 10}}, false);
fRegistry.add("Vertex/hDeltaY", "vertex #DeltaY vs. N_{contrib};N_{contrib};#DeltaY = (Y_{rec} #minus Y_{gen})/#sigma_{Y}", kTH2F, {{101, -0.5, 100.5}, {200, -10, 10}}, false);
fRegistry.add("Vertex/hDeltaZ", "vertex #DeltaZ vs. N_{contrib};N_{contrib};#DeltaZ = (Z_{rec} #minus Z_{gen})/#sigma_{Z}", kTH2F, {{101, -0.5, 100.5}, {200, -10, 10}}, false);
fRegistry.add("Vertex/hDeltaX", "vertex #DeltaX vs. N_{contrib};N_{contrib};#DeltaX = (X_{rec} #minus X_{gen})/#sigma_{X}", o2::framework::HistType::kTH2F, {{101, -0.5, 100.5}, {200, -10, 10}}, false);
fRegistry.add("Vertex/hDeltaY", "vertex #DeltaY vs. N_{contrib};N_{contrib};#DeltaY = (Y_{rec} #minus Y_{gen})/#sigma_{Y}", o2::framework::HistType::kTH2F, {{101, -0.5, 100.5}, {200, -10, 10}}, false);
fRegistry.add("Vertex/hDeltaZ", "vertex #DeltaZ vs. N_{contrib};N_{contrib};#DeltaZ = (Z_{rec} #minus Z_{gen})/#sigma_{Z}", o2::framework::HistType::kTH2F, {{101, -0.5, 100.5}, {200, -10, 10}}, false);
}
}

Expand Down Expand Up @@ -218,13 +213,13 @@
} // end of collision loop
}

using MyCollisions = soa::Join<aod::Collisions, aod::EvSels>;
using MyCollisionsMC = soa::Join<MyCollisions, aod::McCollisionLabels>;
using MyBCs = soa::Join<aod::BCsWithTimestamps, aod::BcSels>;
using MyCollisions = o2::soa::Join<o2::aod::Collisions, o2::aod::EvSels>;
using MyCollisionsMC = o2::soa::Join<MyCollisions, o2::aod::McCollisionLabels>;
using MyBCs = o2::soa::Join<o2::aod::BCsWithTimestamps, o2::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>;
o2::framework::expressions::Filter collisionFilter_evsel = eventCut.cfgZvtxMin < o2::aod::collision::posZ && o2::aod::collision::posZ < eventCut.cfgZvtxMax;
using FilteredMyCollisions = o2::soa::Filtered<MyCollisions>;
using FilteredMyCollisionsMC = o2::soa::Filtered<MyCollisionsMC>;

void processData(FilteredMyCollisions const& collisions, MyBCs const& bcs)
{
Expand All @@ -236,9 +231,9 @@
{
run<false, true>(bcs, collisions, nullptr, nullptr);
}
PROCESS_SWITCH(testPV, processTriggeredData, "processTriggeredData", true);
PROCESS_SWITCH(testPV, processTriggeredData, "processTriggeredData", false);

void processMC(FilteredMyCollisionsMC const& collisions, MyBCs const& bcs, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles)
void processMC(FilteredMyCollisionsMC const& collisions, MyBCs const& bcs, o2::aod::McCollisions const& mcCollisions, o2::aod::McParticles const& mcParticles)
{
run<true, false>(bcs, collisions, mcCollisions, mcParticles);
}
Expand All @@ -247,7 +242,7 @@
void processDummy(MyCollisions const&) {}
PROCESS_SWITCH(testPV, processDummy, "processDummy", false);
};
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
o2::framework::WorkflowSpec defineDataProcessing(o2::framework::ConfigContext const& cfgc)
{
return WorkflowSpec{adaptAnalysisTask<testPV>(cfgc, TaskName{"test-pv"})};
return o2::framework::WorkflowSpec{adaptAnalysisTask<testPV>(cfgc, o2::framework::TaskName{"test-pv"})};

Check failure on line 247 in PWGEM/Dilepton/Tasks/testPV.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-task]

Device names test-pv and test-p-v generated from the specified task name test-pv and from the struct name testPV, respectively, differ in hyphenation. Consider fixing capitalisation of the struct name to TestPv and removing TaskName.
}
Loading