Skip to content
Open
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
30 changes: 23 additions & 7 deletions PWGEM/Dilepton/TableProducer/skimmerOTS.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/TableProducer/skimmerOTS.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Provide mandatory file documentation.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand All @@ -8,7 +8,7 @@
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
//

Check failure on line 11 in PWGEM/Dilepton/TableProducer/skimmerOTS.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \author is missing, incorrect or misplaced.

Check failure on line 11 in PWGEM/Dilepton/TableProducer/skimmerOTS.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \brief is missing, incorrect or misplaced.

Check failure on line 11 in PWGEM/Dilepton/TableProducer/skimmerOTS.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \file is missing, incorrect or misplaced.
// ========================
//
// This code produces trigger information. OTS = offline trigger selection.
Expand All @@ -33,17 +33,27 @@
using namespace o2::framework::expressions;
using namespace o2::soa;

// Enum containing the ordering of statistics histograms for the zorro information
enum SkimStatsHists {
kStatsZorroInfo = 0,
kStatsZorroSel
};

struct skimmerOTS {
Produces<o2::aod::EMSWTriggerInfosTMP> swt_tmp;

Check failure on line 43 in PWGEM/Dilepton/TableProducer/skimmerOTS.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.

// CCDB options
Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Configurable<std::string> cfgCcdbPathZorro{"ccdb-path-zorro", "/Users/m/mpuccio/EventFiltering/OTS/Chunked/", "base path to the ccdb object for zorro"};
Configurable<std::string> cfg_swt_names{"cfg_swt_names", "fHighTrackMult,fHighFt0Mult", "comma-separated software trigger names"}; // !trigger names have to be pre-registered in dileptonTable.h for bit operation!

Check failure on line 48 in PWGEM/Dilepton/TableProducer/skimmerOTS.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
Configurable<uint64_t> cfgBcTolerance{"cfgBcTolerance", 100, "Number of BCs of margin for software triggers"};

std::vector<std::string> swt_names;

Check failure on line 51 in PWGEM/Dilepton/TableProducer/skimmerOTS.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
int mRunNumber;
Service<o2::ccdb::BasicCCDBManager> ccdb;

OutputObj<TList> fStatsList{"Zorro"}; //! Info from Zorro

HistogramRegistry registry{"registry"};
void init(o2::framework::InitContext&)
{
Expand All @@ -66,7 +76,12 @@
hEventCounter->GetXaxis()->SetBinLabel(idx + 2, swt_names[idx].data());
}

registry.add("hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you keep hNInspectedTVX?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The number of insptected TVX is in the zorro info histo, so that to avoid duplication of information I removed it.

fStatsList.setObject(new TList());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move histograms under registry?
One can do following:
std::shared_pt h1; // as a data member;
h1 = registry.add("name", "title", kTH1D, {{your binning}}); // in init
zorro.populateExternalHists(XXXX, reinterpret_cast<TH1D*>h1, YYY)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Daiki, I am sorry but by me this solution did not compile. It was complaining about a impossible convertion of a std::shared_pt into reinterpret_cast<TH2D*>.

fStatsList->SetOwner(kTRUE);
TH2D* histZorroInfo = new TH2D("ZorroInfo", "Zorro information", 1, -0.5, 0.5, 1, -0.5, 0.5);
fStatsList->AddAt(histZorroInfo, kStatsZorroInfo);
TH2D* histZorroSel = new TH2D("ZorroSel", "trigger of interested", 1, -0.5, 0.5, 1, -0.5, 0.5);
fStatsList->AddAt(histZorroSel, kStatsZorroSel);
}

~skimmerOTS()
Expand All @@ -85,14 +100,14 @@
if (mRunNumber == bc.runNumber()) {
return;
}

zorro.setBaseCCDBPath(cfgCcdbPathZorro.value);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed anymore, because zorro objects have been moved to common directory.

zorro.setBCtolerance(cfgBcTolerance);
mTOIidx = zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), cfg_swt_names.value);
for (auto& idx : mTOIidx) {

Check failure on line 106 in PWGEM/Dilepton/TableProducer/skimmerOTS.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
LOGF(info, "Trigger of Interest : index = %d", idx);
}
mNinspectedTVX = zorro.getInspectedTVX()->GetBinContent(1);
LOGF(info, "total inspected TVX events = %d in run number %d", mNinspectedTVX, bc.runNumber());
registry.fill(HIST("hNInspectedTVX"), bc.runNumber(), mNinspectedTVX);

mRunNumber = bc.runNumber();
}
Expand All @@ -102,16 +117,17 @@

void process(MyCollisions const& collisions, MyBCs const&)
{
for (auto& collision : collisions) {

Check failure on line 120 in PWGEM/Dilepton/TableProducer/skimmerOTS.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
auto bc = collision.template bc_as<MyBCs>(); // don't use foundBC.
initCCDB(bc);

uint16_t trigger_bitmap = 0;

Check failure on line 124 in PWGEM/Dilepton/TableProducer/skimmerOTS.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
registry.fill(HIST("hEventCounter"), 1); // all
zorro.populateHistRegistry(registry, bc.runNumber());
registry.fill(HIST("hEventCounter"), 1); // all
zorro.populateExternalHists(bc.runNumber(), reinterpret_cast<TH2D*>(fStatsList->At(kStatsZorroInfo)), reinterpret_cast<TH2D*>(fStatsList->At(kStatsZorroSel)));

if (zorro.isSelected(bc.globalBC())) { // triggered event
auto swt_bitset = zorro.getLastResult(); // this has to be called after zorro::isSelected, or simply call zorro.fetch
// if (zorro.isSelected(bc.globalBC())) { // triggered event
if (zorro.isSelected(bc.globalBC(), cfgBcTolerance, reinterpret_cast<TH2D*>(fStatsList->At(kStatsZorroSel)))) { // triggered event
auto swt_bitset = zorro.getLastResult(); // this has to be called after zorro::isSelected, or simply call zorro.fetch
// LOGF(info, "swt_bitset.to_string().c_str() = %s", swt_bitset.to_string().c_str());
for (size_t idx = 0; idx < mTOIidx.size(); idx++) {
if (swt_bitset.test(mTOIidx[idx])) {
Expand Down
Loading