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
85 changes: 6 additions & 79 deletions PWGDQ/Core/VarManager.cxx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// 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.
Expand All @@ -8,8 +8,8 @@
// 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 <cmath>

Check warning on line 11 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \author is missing, incorrect or misplaced.

Check warning on line 11 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \brief is missing, incorrect or misplaced.

Check warning on line 11 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \file is missing, incorrect or misplaced.
#include <iostream>

Check warning on line 12 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[include-iostream]

Do not include iostream. Use O2 logging instead.
#include <vector>
#include <map>
#include "PWGDQ/Core/VarManager.h"
Expand All @@ -28,9 +28,6 @@
bool VarManager::fgUsedKF = false;
float VarManager::fgMagField = 0.5;
float VarManager::fgValues[VarManager::kNVars] = {0.0f};
std::map<int, int> VarManager::fgRunMap;
TString VarManager::fgRunStr = "";
std::vector<int> VarManager::fgRunList = {0};
float VarManager::fgCenterOfMassEnergy = 13600; // GeV
float VarManager::fgMassofCollidingParticle = 9.382720; // GeV
float VarManager::fgTPCInterSectorBoundary = 1.0; // cm
Expand Down Expand Up @@ -61,7 +58,7 @@
VarManager::~VarManager() = default;

//__________________________________________________________________
void VarManager::SetVariableDependencies()

Check warning on line 61 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
{
//
// Set as used variables on which other variables calculation depends
Expand Down Expand Up @@ -97,7 +94,7 @@
}

//__________________________________________________________________
void VarManager::ResetValues(int startValue, int endValue, float* values)

Check warning on line 97 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
{
//
// reset all variables to an "innocent" value
Expand All @@ -105,76 +102,13 @@
if (!values) {
values = fgValues;
}
for (Int_t i = startValue; i < endValue; ++i) {

Check warning on line 105 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
values[i] = -9999.;
}
}

//__________________________________________________________________
void VarManager::SetRunNumbers(int n, int* runs)
{
//
// maps the list of runs such that one can plot the list of runs nicely in a histogram axis
//
for (int i = 0; i < n; ++i) {
fgRunMap[runs[i]] = i + 1;
fgRunStr += Form("%d;", runs[i]);
}
}

//__________________________________________________________________
void VarManager::SetRunNumbers(std::vector<int> runs)
{
//
// maps the list of runs such that one can plot the list of runs nicely in a histogram axis
//
int i = 0;
for (auto run = runs.begin(); run != runs.end(); run++, i++) {
fgRunMap[*run] = i + 1;
fgRunStr += Form("%d;", *run);
}
fgRunList = runs;
}

//__________________________________________________________________
void VarManager::SetDummyRunlist(int InitRunnumber)
{
//
// runlist for the different periods
fgRunList.clear();
fgRunList.push_back(InitRunnumber);
fgRunList.push_back(InitRunnumber + 100);
}

//__________________________________________________________________
int VarManager::GetDummyFirst()
{
//
// Get the fist index of the vector of run numbers
//
return fgRunList[0];
}
//__________________________________________________________________
int VarManager::GetDummyLast()
{
//
// Get the last index of the vector of run numbers
//
return fgRunList[fgRunList.size() - 1];
}
//_________________________________________________________________
float VarManager::GetRunIndex(double Runnumber)
{
//
// Get the index of RunNumber in it's runlist
//
int runNumber = static_cast<int>(Runnumber);
auto runIndex = std::find(fgRunList.begin(), fgRunList.end(), runNumber);
float index = std::distance(fgRunList.begin(), runIndex);
return index;
}
//__________________________________________________________________
void VarManager::SetCollisionSystem(TString system, float energy)

Check warning on line 111 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
{
//
// Set the collision system and the center of mass energy
Expand All @@ -191,15 +125,12 @@
}

//__________________________________________________________________
void VarManager::FillEventDerived(float* values)
{
//
// Fill event-wise derived quantities (these are all quantities which can be computed just based on the values already filled in the FillEvent() function)
//
if (fgUsedVars[kRunId]) {
values[kRunId] = (fgRunMap.size() > 0 ? fgRunMap[static_cast<int>(values[kRunNo])] : 0);
}
}
// void VarManager::FillEventDerived(float* values)
// {
// //
// // Fill event-wise derived quantities (these are all quantities which can be computed just based on the values already filled in the FillEvent() function)
// //
// }

//__________________________________________________________________
void VarManager::FillTrackDerived(float* values)
Expand All @@ -223,15 +154,13 @@
//
// Set default variable names
//
for (Int_t ivar = 0; ivar < kNVars; ++ivar) {

Check warning on line 157 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
fgVariableNames[ivar] = "DEFAULT NOT DEFINED";
fgVariableUnits[ivar] = "n/a";
}

fgVariableNames[kRunNo] = "Run number";
fgVariableUnits[kRunNo] = "";
fgVariableNames[kRunId] = "Run number";
fgVariableUnits[kRunId] = "";
fgVariableNames[kBC] = "Bunch crossing";
fgVariableUnits[kBC] = "";
fgVariableNames[kTimeFromSOR] = "time since SOR";
Expand Down Expand Up @@ -1095,8 +1024,6 @@
// Set the variables short names map. This is needed for dynamic configuration via JSON files
fgVarNamesMap["kNothing"] = kNothing;
fgVarNamesMap["kRunNo"] = kRunNo;
fgVarNamesMap["kRunId"] = kRunId;
fgVarNamesMap["kRunIndex"] = kRunIndex;
fgVarNamesMap["kNRunWiseVariables"] = kNRunWiseVariables;
fgVarNamesMap["kTimestamp"] = kTimestamp;
fgVarNamesMap["kTimeFromSOR"] = kTimeFromSOR;
Expand Down
34 changes: 2 additions & 32 deletions PWGDQ/Core/VarManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,6 @@ class VarManager : public TObject
kNothing = -1,
// Run wise variables
kRunNo = 0,
kRunId,
kRunIndex,
kNRunWiseVariables,

// Event wise variables
Expand Down Expand Up @@ -898,29 +896,6 @@ class VarManager : public TObject
return false;
}

static void SetRunNumbers(int n, int* runs);
static void SetRunNumbers(std::vector<int> runs);
static float GetRunIndex(double);
static void SetDummyRunlist(int InitRunnumber);
static int GetDummyFirst();
static int GetDummyLast();
static int GetDummyNRuns()
{
if (fgRunMap.size() == 0) {
return 101;
} else {
return fgRunMap.size();
}
}
static int GetNRuns()
{
return fgRunMap.size();
}
static TString GetRunStr()
{
return fgRunStr;
}

// Setup the collision system
static void SetCollisionSystem(TString system, float energy);

Expand Down Expand Up @@ -1159,9 +1134,6 @@ class VarManager : public TObject
static void SetVariableDependencies(); // toggle those variables on which other used variables might depend

static float fgMagField;
static std::map<int, int> fgRunMap; // map of runs to be used in histogram axes
static TString fgRunStr; // semi-colon separated list of runs, to be used for histogram axis labels
static std::vector<int> fgRunList; // vector of runs, to be used for histogram axis
static float fgCenterOfMassEnergy; // collision energy
static float fgMassofCollidingParticle; // mass of the colliding particle
static float fgTPCInterSectorBoundary; // TPC inter-sector border size at the TPC outer radius, in cm
Expand All @@ -1172,7 +1144,7 @@ class VarManager : public TObject
static uint64_t fgSOR; // Timestamp for start of run
static uint64_t fgEOR; // Timestamp for end of run

static void FillEventDerived(float* values = nullptr);
// static void FillEventDerived(float* values = nullptr);
static void FillTrackDerived(float* values = nullptr);
template <typename T, typename U, typename V>
static auto getRotatedCovMatrixXX(const T& matrix, U phi, V theta);
Expand Down Expand Up @@ -1442,7 +1414,6 @@ void VarManager::FillBC(T const& bc, float* values)
values[kBCOrbit] = bc.globalBC() % o2::constants::lhc::LHCMaxBunches;
values[kTimestamp] = bc.timestamp();
values[kTimeFromSOR] = (fgSOR > 0 ? (bc.timestamp() - fgSOR) / 60000. : -1.0);
values[kRunIndex] = GetRunIndex(bc.runNumber());
}

template <uint32_t fillMap, typename T>
Expand Down Expand Up @@ -1611,7 +1582,6 @@ void VarManager::FillEvent(T const& event, float* values)

if constexpr ((fillMap & ReducedEvent) > 0) {
values[kRunNo] = event.runNumber();
values[kRunIndex] = GetRunIndex(event.runNumber());
values[kVtxX] = event.posX();
values[kVtxY] = event.posY();
values[kVtxZ] = event.posZ();
Expand Down Expand Up @@ -1903,7 +1873,7 @@ void VarManager::FillEvent(T const& event, float* values)
FillZDC(event, values);
}

FillEventDerived(values);
// FillEventDerived(values);
}

template <uint32_t fillMap, typename TEvent, typename TAssoc, typename TTracks>
Expand Down
8 changes: 0 additions & 8 deletions PWGDQ/TableProducer/tableMaker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ struct TableMaker {
Configurable<bool> fConfigComputeTPCpostCalib{"cfgTPCpostCalib", false, "If true, compute TPC post-calibrated n-sigmas(electrons, pions, protons)"};
Configurable<bool> fConfigComputeTPCpostCalibKaon{"cfgTPCpostCalibKaon", false, "If true, compute TPC post-calibrated n-sigmas for kaons"};
Configurable<bool> fConfigIsOnlyforMaps{"cfgIsforMaps", false, "If true, run for postcalibration maps only"};
Configurable<bool> fConfigDummyRunlist{"cfgDummyRunlist", false, "If true, use dummy runlist"};
Configurable<int> fConfigInitRunNumber{"cfgInitRunNumber", 543215, "Initial run number used in run by run checks"};
Configurable<bool> fPropMuon{"cfgPropMuon", false, "Propgate muon tracks through absorber"};
Configurable<std::string> geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"};
Configurable<std::string> grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
Expand Down Expand Up @@ -329,10 +327,6 @@ struct TableMaker {
}
}

if (fConfigDummyRunlist) {
VarManager::SetDummyRunlist(fConfigInitRunNumber);
}

DefineHistograms(histClasses); // define all histograms
VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill
fOutputList.setObject(fHistMan->GetMainHistogramList());
Expand Down Expand Up @@ -436,7 +430,6 @@ struct TableMaker {
VarManager::fgValues[VarManager::kRunNo] = bc.runNumber();
VarManager::fgValues[VarManager::kBC] = bc.globalBC();
VarManager::fgValues[VarManager::kTimestamp] = bc.timestamp();
VarManager::fgValues[VarManager::kRunIndex] = VarManager::GetRunIndex(bc.runNumber());
VarManager::FillEvent<TEventFillMap>(collision); // extract event information and place it in the fValues array
if (fDoDetailedQA) {
fHistMan->FillHistClass("Event_BeforeCuts", VarManager::fgValues);
Expand Down Expand Up @@ -910,7 +903,6 @@ struct TableMaker {
VarManager::fgValues[VarManager::kRunNo] = bc.runNumber();
VarManager::fgValues[VarManager::kBC] = bc.globalBC();
VarManager::fgValues[VarManager::kTimestamp] = bc.timestamp();
VarManager::fgValues[VarManager::kRunIndex] = VarManager::GetRunIndex(bc.runNumber());
VarManager::FillEvent<TEventFillMap>(collision); // extract event information and place it in the fValues array
if (fDoDetailedQA) {
fHistMan->FillHistClass("Event_BeforeCuts", VarManager::fgValues);
Expand Down
6 changes: 0 additions & 6 deletions PWGDQ/TableProducer/tableMaker_withAssoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,6 @@ struct TableMaker {
Configurable<bool> fConfigComputeTPCpostCalibKaon{"cfgTPCpostCalibKaon", false, "If true, compute TPC post-calibrated n-sigmas for kaons"};
Configurable<bool> fConfigIsOnlyforMaps{"cfgIsforMaps", false, "If true, run for postcalibration maps only"};
Configurable<bool> fConfigSaveElectronSample{"cfgSaveElectronSample", false, "If true, only save electron sample"};
Configurable<bool> fConfigDummyRunlist{"cfgDummyRunlist", false, "If true, use dummy runlist"};
Configurable<int> fConfigInitRunNumber{"cfgInitRunNumber", 543215, "Initial run number used in run by run checks"};
} fConfigPostCalibTPC;

struct : ConfigurableGroup {
Expand Down Expand Up @@ -397,10 +395,6 @@ struct TableMaker {
}
}

if (fConfigPostCalibTPC.fConfigDummyRunlist) {
VarManager::SetDummyRunlist(fConfigPostCalibTPC.fConfigInitRunNumber);
}

DefineHistograms(histClasses); // define all histograms
// Additional histogram via the JSON configurable
TString addHistsStr = fConfigHistOutput.fConfigAddJSONHistograms.value;
Expand Down
26 changes: 11 additions & 15 deletions PWGDQ/Tasks/dqEfficiency_withAssoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <map>
#include <string>
#include <memory>
#include <utility>
#include <TH1F.h>
#include <TH3F.h>
#include <THashList.h>
Expand Down Expand Up @@ -394,8 +395,6 @@ struct AnalysisTrackSelection {
Configurable<int64_t> fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"};
Configurable<bool> fConfigComputeTPCpostCalib{"cfgTPCpostCalib", false, "If true, compute TPC post-calibrated n-sigmas"};
Configurable<std::string> grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
Configurable<bool> fConfigDummyRunlist{"cfgDummyRunlist", false, "If true, use dummy runlist"};
Configurable<int> fConfigInitRunNumber{"cfgInitRunNumber", 543215, "Initial run number used in run by run checks"};

Configurable<std::string> fConfigMCSignals{"cfgTrackMCSignals", "", "Comma separated list of MC signals"};
Configurable<std::string> fConfigMCSignalsJSON{"cfgTrackMCsignalsJSON", "", "Additional list of MC signals via JSON"};
Expand Down Expand Up @@ -433,7 +432,7 @@ struct AnalysisTrackSelection {
if (addTrackCutsStr != "") {
std::vector<AnalysisCut*> addTrackCuts = dqcuts::GetCutsFromJSON(addTrackCutsStr.Data());
for (auto& t : addTrackCuts) {
fTrackCuts.push_back((AnalysisCompositeCut*)t);
fTrackCuts.push_back(reinterpret_cast<AnalysisCompositeCut*>(t));
}
}
VarManager::SetUseVars(AnalysisCut::fgUsedVars); // provide the list of required variables so that VarManager knows what to fill
Expand Down Expand Up @@ -493,9 +492,6 @@ struct AnalysisTrackSelection {
fOutputList.setObject(fHistMan->GetMainHistogramList());
}

if (fConfigDummyRunlist) {
VarManager::SetDummyRunlist(fConfigInitRunNumber);
}
if (fConfigComputeTPCpostCalib) {
fCCDB->setURL(fConfigCcdbUrl.value);
fCCDB->setCaching(true);
Expand Down Expand Up @@ -760,7 +756,7 @@ struct AnalysisMuonSelection {
if (addCutsStr != "") {
std::vector<AnalysisCut*> addCuts = dqcuts::GetCutsFromJSON(addCutsStr.Data());
for (auto& t : addCuts) {
fMuonCuts.push_back((AnalysisCompositeCut*)t);
fMuonCuts.push_back(reinterpret_cast<AnalysisCompositeCut*>(t));
}
}
VarManager::SetUseVars(AnalysisCut::fgUsedVars); // provide the list of required variables so that VarManager knows what to fill
Expand Down Expand Up @@ -2203,7 +2199,7 @@ struct AnalysisAsymmetricPairing {
if (addPairCutsStr != "") {
std::vector<AnalysisCut*> addPairCuts = dqcuts::GetCutsFromJSON(addPairCutsStr.Data());
for (auto& t : addPairCuts) {
fPairCuts.push_back((AnalysisCompositeCut*)t);
fPairCuts.push_back(reinterpret_cast<AnalysisCompositeCut*>(t));
cutNamesStr += Form(",%s", t->GetName());
}
}
Expand Down Expand Up @@ -3290,7 +3286,7 @@ struct AnalysisDileptonTrack {
// loop over all the upstream cuts and make a bit mask for the track cuts specified in this task
for (int icut = 0; icut < cfgTrackSelection_objArrayTrackCuts->GetEntries(); icut++) {
if (cfgDileptonTrack_objArrayTrackCuts->FindObject(cfgTrackSelection_objArrayTrackCuts->At(icut)->GetName())) {
fTrackCutBitMap |= (uint32_t(1) << icut);
fTrackCutBitMap |= (static_cast<uint32_t>(1) << icut);
}
}
// finally, store the total number of upstream tasks, for easy access
Expand Down Expand Up @@ -3358,7 +3354,7 @@ struct AnalysisDileptonTrack {
for (int iCutTrack = 0; iCutTrack < fNCuts; iCutTrack++) {

// here we check that this track cut is one of those required to associate with the dileptons
if (!(fTrackCutBitMap & (uint32_t(1) << iCutTrack))) {
if (!(fTrackCutBitMap & (static_cast<uint32_t>(1) << iCutTrack))) {
continue;
}

Expand Down Expand Up @@ -3593,13 +3589,13 @@ struct AnalysisDileptonTrack {
// loop over specified track cuts (the tracks to be combined with the dileptons)
for (int iTrackCut = 0; iTrackCut < fNCuts; iTrackCut++) {

if (!(trackSelection & (uint32_t(1) << iTrackCut))) {
if (!(trackSelection & (static_cast<uint32_t>(1) << iTrackCut))) {
continue;
}

fHistMan->FillHistClass(Form("DileptonTrack_%s_%s", fTrackCutNames[icut].Data(), fTrackCutNames[iTrackCut].Data()), fValuesHadron);
for (uint32_t isig = 0; isig < fRecMCSignals.size(); isig++) {
if (mcDecision & (uint32_t(1) << isig)) {
if (mcDecision & (static_cast<uint32_t>(1) << isig)) {
fHistMan->FillHistClass(Form("DileptonTrackMCMatched_%s_%s_%s", fTrackCutNames[icut].Data(), fTrackCutNames[iTrackCut].Data(), fRecMCSignals[isig]->GetName()), fValuesHadron);
}
}
Expand All @@ -3609,7 +3605,7 @@ struct AnalysisDileptonTrack {
if (dilepton.commonFilterMap_bit(fCommonTrackCutMap[iCommonCut])) {
fHistMan->FillHistClass(Form("DileptonTrack_%s_%s_%s", fTrackCutNames[icut].Data(), fCommonPairCutNames[iCommonCut].Data(), fTrackCutNames[iTrackCut].Data()), fValuesHadron);
for (uint32_t isig = 0; isig < fRecMCSignals.size(); isig++) {
if (mcDecision & (uint32_t(1) << isig)) {
if (mcDecision & (static_cast<uint32_t>(1) << isig)) {
fHistMan->FillHistClass(Form("DileptonTrackMCMatched_%s_%s_%s_%s", fTrackCutNames[icut].Data(), fCommonPairCutNames[iCommonCut].Data(), fTrackCutNames[iTrackCut].Data(), fRecMCSignals[isig]->GetName()), fValuesHadron);
}
}
Expand All @@ -3619,15 +3615,15 @@ struct AnalysisDileptonTrack {
if (dilepton.pairFilterMap_bit(iPairCut)) {
fHistMan->FillHistClass(Form("DileptonTrack_%s_%s_%s", fTrackCutNames[icut].Data(), fPairCutNames[iPairCut].Data(), fTrackCutNames[iTrackCut].Data()), fValuesHadron);
for (uint32_t isig = 0; isig < fRecMCSignals.size(); isig++) {
if (mcDecision & (uint32_t(1) << isig)) {
if (mcDecision & (static_cast<uint32_t>(1) << isig)) {
fHistMan->FillHistClass(Form("DileptonTrackMCMatched_%s_%s_%s_%s", fTrackCutNames[icut].Data(), fPairCutNames[iPairCut].Data(), fTrackCutNames[iTrackCut].Data(), fRecMCSignals[isig]->GetName()), fValuesHadron);
}
}
for (int iCommonCut = 0; iCommonCut < fNCommonTrackCuts; iCommonCut++) {
if (dilepton.commonFilterMap_bit(fCommonTrackCutMap[iCommonCut])) {
fHistMan->FillHistClass(Form("DileptonTrack_%s_%s_%s_%s", fTrackCutNames[icut].Data(), fCommonPairCutNames[iCommonCut].Data(), fPairCutNames[iPairCut].Data(), fTrackCutNames[iTrackCut].Data()), fValuesHadron);
for (uint32_t isig = 0; isig < fRecMCSignals.size(); isig++) {
if (mcDecision & (uint32_t(1) << isig)) {
if (mcDecision & (static_cast<uint32_t>(1) << isig)) {
fHistMan->FillHistClass(Form("DileptonTrackMCMatched_%s_%s_%s_%s_%s", fTrackCutNames[icut].Data(), fCommonPairCutNames[iCommonCut].Data(), fPairCutNames[iPairCut].Data(), fTrackCutNames[iTrackCut].Data(), fRecMCSignals[isig]->GetName()), fValuesHadron);
}
}
Expand Down
Loading
Loading