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
7 changes: 6 additions & 1 deletion PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ o2physics_add_dpl_workflow(straevselsconverter4

o2physics_add_dpl_workflow(straevselsconverter5
SOURCES straevselsconverter5.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::ITStracking
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::ITStracking O2Physics::AnalysisCCDB
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(straevselsconverter2rawcents
Expand Down Expand Up @@ -113,3 +113,8 @@ o2physics_add_dpl_workflow(stramccollisionconverter2
SOURCES stramccollisionconverter2.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(zdcneutronsconverter
SOURCES zdcneutronsconverter.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)
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 PWGLF/TableProducer/Strangeness/Converters/straevselsconverter5.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 PWGLF/TableProducer/Strangeness/Converters/straevselsconverter5.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,22 +8,80 @@
// 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.
#include "Framework/runDataProcessing.h"

Check failure on line 11 in PWGLF/TableProducer/Strangeness/Converters/straevselsconverter5.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 PWGLF/TableProducer/Strangeness/Converters/straevselsconverter5.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 PWGLF/TableProducer/Strangeness/Converters/straevselsconverter5.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \file is missing, incorrect or misplaced.
#include "Framework/AnalysisTask.h"
#include "Framework/AnalysisDataModel.h"
#include "CCDB/BasicCCDBManager.h"
#include "DataFormatsParameters/AggregatedRunInfo.h"
#include "ITStracking/Vertexer.h"
#include "PWGLF/DataModel/LFStrangenessTables.h"

using namespace o2;
using namespace o2::framework;
using namespace o2::aod::evsel;

static const int32_t nBCsPerOrbit = o2::constants::lhc::LHCMaxBunches;

// Converts Stra Event selections from 004 to 005
struct straevselsconverter5 {

Check failure on line 26 in PWGLF/TableProducer/Strangeness/Converters/straevselsconverter5.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/struct]

Use UpperCamelCase for names of structs.
Produces<aod::StraEvSels_005> straEvSels_005;

Check failure on line 27 in PWGLF/TableProducer/Strangeness/Converters/straevselsconverter5.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.

void process(aod::StraEvSels_004 const& straEvSels_004)
Service<o2::ccdb::BasicCCDBManager> ccdb;

int lastRun = -1;
int64_t lastTF = -1;
uint32_t lastRCT = 0;
uint64_t sorTimestamp = 0; // default SOR timestamp
uint64_t eorTimestamp = 1; // default EOR timestamp
int64_t bcSOR = -1; // global bc of the start of run
int64_t nBCsPerTF = -1; // duration of TF in bcs, should be 128*3564 or 3
std::map<uint64_t, uint32_t>* mapRCT = nullptr;

uint32_t getRctRaw(int run, uint64_t timestamp, uint64_t globalBC)
{
if (run != lastRun) {
lastRun = run;
auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run);
// first bc of the first orbit
bcSOR = runInfo.orbitSOR * nBCsPerOrbit;
// duration of TF in bcs
nBCsPerTF = runInfo.orbitsPerTF * nBCsPerOrbit;
// SOR and EOR timestamps
sorTimestamp = runInfo.sor;
eorTimestamp = runInfo.eor;
// timestamp of the middle of the run used to access run-wise CCDB entries
int64_t ts = runInfo.sor / 2 + runInfo.eor / 2;
// QC info
std::map<std::string, std::string> metadata;
metadata["run"] = Form("%d", run);
ccdb->setFatalWhenNull(0);
mapRCT = ccdb->getSpecific<std::map<uint64_t, uint32_t>>("Users/j/jian/RCT", ts, metadata);
ccdb->setFatalWhenNull(1);
if (mapRCT == nullptr) {
LOGP(info, "rct object missing... inserting dummy rct flags");
mapRCT = new std::map<uint64_t, uint32_t>;
mapRCT->insert(std::pair<uint64_t, uint32_t>(sorTimestamp, 0));
}
}

// store rct flags
uint32_t rct = lastRCT;
int64_t thisTF = (globalBC - bcSOR) / nBCsPerTF;
if (mapRCT != nullptr && thisTF != lastTF) { // skip for unanchored runs; do it once per TF
auto itrct = mapRCT->upper_bound(timestamp);
if (itrct != mapRCT->begin())
itrct--;
rct = itrct->second;
LOGP(debug, "sor={} eor={} ts={} rct={}", sorTimestamp, eorTimestamp, timestamp, rct);
lastRCT = rct;
lastTF = thisTF;
}
return rct;
}

void process(soa::Join<aod::StraEvSels_004, aod::StraStamps> const& straEvSels_004)
{
for (auto& values : straEvSels_004) {

Check failure on line 84 in PWGLF/TableProducer/Strangeness/Converters/straevselsconverter5.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.
straEvSels_005(values.sel8(),
values.selection_raw(),
values.multFT0A(),
Expand Down Expand Up @@ -55,7 +113,7 @@
values.energyCommonZNC(),
values.flags(),
0 /*dummy Alias value*/,
0 /*dummy Rct value*/);
getRctRaw(values.runNumber(), values.timestamp(), values.globalBC()) /* Rct value*/);
}
}
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// 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.
#include "Framework/runDataProcessing.h"

Check failure on line 11 in PWGLF/TableProducer/Strangeness/Converters/zdcneutronsconverter.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 PWGLF/TableProducer/Strangeness/Converters/zdcneutronsconverter.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \file is missing, incorrect or misplaced.
#include "Framework/AnalysisTask.h"
#include "Framework/AnalysisDataModel.h"
#include "PWGLF/DataModel/LFStrangenessTables.h"
#include "PWGLF/DataModel/LFStrangenessMLTables.h"

using namespace o2;
using namespace o2::framework;

//
struct zdcneutronsconverter {
Produces<aod::ZDCNeutrons> zdcNeutrons; // Primary neutrons within ZDC acceptance
Produces<aod::ZDCNMCCollRefs> zdcNeutronsMCCollRefs; // references collisions from ZDCNeutrons

void process(aod::StraEvSels const&)
{
}
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
return WorkflowSpec{
adaptAnalysisTask<zdcneutronsconverter>(cfgc)};
}
Loading