Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
60 changes: 53 additions & 7 deletions PWGUD/Core/SGSelector.h
Comment thread
vkucera marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,23 @@
// 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 PWGUD/Core/SGSelector.h

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 PWGUD/Core/SGSelector.h

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 PWGUD/Core/SGSelector.h

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \file is missing, incorrect or misplaced.
#ifndef PWGUD_CORE_SGSELECTOR_H_
#define PWGUD_CORE_SGSELECTOR_H_

#include <cmath>
#include "PWGUD/Core/SGCutParHolder.h"
#include "PWGUD/Core/UDHelpers.h"

#include "Common/CCDB/RCTSelectionFlags.h"

#include "Framework/AnalysisTask.h"
#include "Framework/Logger.h"

#include "TDatabasePDG.h"

Check failure on line 23 in PWGUD/Core/SGSelector.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/database]

Do not use TDatabasePDG directly. Use o2::constants::physics::Mass... or Service<o2::framework::O2DatabasePDG> instead.
#include "TLorentzVector.h"

Check failure on line 24 in PWGUD/Core/SGSelector.h

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
#include "Framework/Logger.h"
#include "Framework/AnalysisTask.h"
#include "PWGUD/Core/UDHelpers.h"
#include "PWGUD/Core/SGCutParHolder.h"

#include <cmath>
using namespace o2::aod::rctsel;

Check failure on line 27 in PWGUD/Core/SGSelector.h

View workflow job for this annotation

GitHub Actions / O2 linter

[using-directive]

Do not put using directives at global scope in headers.

template <typename BC>
struct SelectionResult {
Expand All @@ -29,7 +35,7 @@
class SGSelector
{
public:
SGSelector() : fPDG(TDatabasePDG::Instance()) {}
SGSelector() : fPDG(TDatabasePDG::Instance()), myRCTChecker{"CBT"}, myRCTCheckerHadron{"CBT_hadronPID"}, myRCTCheckerZDC{"CBT", true}, myRCTCheckerHadronZDC{"CBT_hadronPID", true} {}

Check failure on line 38 in PWGUD/Core/SGSelector.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/database]

Do not use TDatabasePDG directly. Use o2::constants::physics::Mass... or Service<o2::framework::O2DatabasePDG> instead.

template <typename CC, typename BCs, typename TCs, typename FWs>
int Print(SGCutParHolder /*diffCuts*/, CC& collision, BCs& /*bcRange*/, TCs& /*tracks*/, FWs& /*fwdtracks*/)
Expand Down Expand Up @@ -107,7 +113,7 @@
template <typename TFwdTrack>
int FwdTrkSelector(TFwdTrack const& fwdtrack)
{
if (fwdtrack.trackType() == 0 || fwdtrack.trackType() == 3)

Check failure on line 116 in PWGUD/Core/SGSelector.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return 1;
else
return 0;
Expand All @@ -131,7 +137,7 @@
} else if (gap == 1) {
if (FT0C > fit_cut[2] || ZNC > zdc_cut)
true_gap = -1;
} else if (gap == 2) {

Check failure on line 140 in PWGUD/Core/SGSelector.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
if ((FV0A > fit_cut[0] || FT0A > fit_cut[1] || ZNA > zdc_cut) && (FT0C > fit_cut[2] || ZNC > zdc_cut))
true_gap = -1;
else if ((FV0A > fit_cut[0] || FT0A > fit_cut[1] || ZNA > zdc_cut) && (FT0C <= fit_cut[2] && ZNC <= zdc_cut))
Expand All @@ -141,13 +147,53 @@
else if (FV0A <= fit_cut[0] && FT0A <= fit_cut[1] && ZNA <= zdc_cut && FT0C <= fit_cut[2] && ZNC <= zdc_cut)
true_gap = 2;
else
std::cout << "Something wrong with DG" << std::endl;
LOGF(info, "Something wrong with DG");
}
return true_gap;
}

// check CBT flags
template <typename CC>
bool isCBTOk(CC& collision)
{
if (myRCTChecker(collision))
return true;
return false;
}

// check CBT+hadronPID flags
template <typename CC>
bool isCBTHadronOk(CC& collision)
{
if (myRCTCheckerHadron(collision))
return true;
return false;
}

// check CBT+ZDC flags
template <typename CC>
bool isCBTZdcOk(CC& collision)
{
if (myRCTCheckerZDC(collision))
return true;
return false;
}

// check CBT+hadronPID+ZDC flags
template <typename CC>
bool isCBTHadronZdcOk(CC& collision)
{
if (myRCTCheckerHadronZDC(collision))
return true;
return false;
}

private:
TDatabasePDG* fPDG;

Check failure on line 192 in PWGUD/Core/SGSelector.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/database]

Do not use TDatabasePDG directly. Use o2::constants::physics::Mass... or Service<o2::framework::O2DatabasePDG> instead.
RCTFlagsChecker myRCTChecker;
RCTFlagsChecker myRCTCheckerHadron;
RCTFlagsChecker myRCTCheckerZDC;
RCTFlagsChecker myRCTCheckerHadronZDC;
};

#endif // PWGUD_CORE_SGSELECTOR_H_
43 changes: 38 additions & 5 deletions PWGUD/DataModel/UDTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,29 @@
// 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.
//
/// \file UDTables.h
/// \brief Defines tables and colums for derived data used by UD group
/// \author Paul Buhler <paul.buhler@cern.ch>, Wiena
/// \since January 2023
/// \author Sasha Bylinkin <sasha.bylinkin@cern.ch>, Bergen
/// \since January 2024
/// \author Adam Matyja <adam.tomasz.matyja@cern.ch>, INP PAN Krakow, Poland
/// \since May 2025

#ifndef PWGUD_DATAMODEL_UDTABLES_H_
#define PWGUD_DATAMODEL_UDTABLES_H_

#include <vector>
#include <cmath>
#include "Common/DataModel/PIDResponse.h"
#include "Common/DataModel/TrackSelectionTables.h"

#include "Framework/ASoA.h"
#include "Framework/AnalysisDataModel.h"
#include "Framework/DataTypes.h"
#include "MathUtils/Utils.h"
#include "Common/DataModel/PIDResponse.h"
#include "Common/DataModel/TrackSelectionTables.h"

#include <cmath>
#include <vector>

namespace o2::aod
{
Expand Down Expand Up @@ -111,6 +122,10 @@ DECLARE_SOA_COLUMN(ITSROFb, itsROFb, int);
DECLARE_SOA_COLUMN(Sbp, sbp, int);
DECLARE_SOA_COLUMN(ZvtxFT0vPV, zVtxFT0vPV, int);
DECLARE_SOA_COLUMN(VtxITSTPC, vtxITSTPC, int);
// information about mask names -> Common/CCDB/RCTSelectionFlags.h
// DECLARE_SOA_COLUMN(Rct, rct, uint32_t); //! run condition table mask
DECLARE_SOA_BITMAP_COLUMN(Rct, rct, 32); //! run condition table mask

// Gap Side Information
DECLARE_SOA_COLUMN(GapSide, gapSide, uint8_t); // 0 for side A, 1 for side C, 2 for both sides (or use an enum for better readability)
// FIT selection flags
Expand Down Expand Up @@ -249,6 +264,24 @@ DECLARE_SOA_TABLE_VERSIONED(UDCollisionSelExtras_002, "AOD", "UDCOLSELEXTRA", 2,
udcollision::ZvtxFT0vPV, //! kIsGoodZvtxFT0vsPV
udcollision::VtxITSTPC); //! kIsVertexITSTPC

DECLARE_SOA_TABLE_VERSIONED(UDCollisionSelExtras_003, "AOD", "UDCOLSELEXTRA", 3,
udcollision::ChFT0A, //! number of active channels in FT0A
udcollision::ChFT0C, //! number of active channels in FT0C
udcollision::ChFDDA, //! number of active channels in FDDA
udcollision::ChFDDC, //! number of active channels in FDDC
udcollision::ChFV0A, //! number of active channels in FV0A
udcollision::OccupancyInTime, //! Occupancy
udcollision::HadronicRate, //! Interaction Rate
udcollision::Trs, //! kNoCollInTimeRangeStandard
udcollision::Trofs, //! kNoCollInRofStandard
udcollision::Hmpr, //! kNoHighMultCollInPrevRof
udcollision::TFb, //! kNoTimeFrameBorder
udcollision::ITSROFb, //! kNoITSROFrameBorder
udcollision::Sbp, //! kNoSameBunchPileup
udcollision::ZvtxFT0vPV, //! kIsGoodZvtxFT0vsPV
udcollision::VtxITSTPC, //! kIsVertexITSTPC
udcollision::Rct); //! RCT mask

// central barrel-specific selections
DECLARE_SOA_TABLE(UDCollisionsSelsCent, "AOD", "UDCOLSELCNT",
udcollision::DBcTOR,
Expand All @@ -272,7 +305,7 @@ DECLARE_SOA_TABLE(UDMcCollsLabels, "AOD", "UDMCCOLLSLABEL",
udcollision::UDMcCollisionId);

using UDCollisions = UDCollisions_001;
using UDCollisionSelExtras = UDCollisionSelExtras_002;
using UDCollisionSelExtras = UDCollisionSelExtras_003;

using UDCollision = UDCollisions::iterator;
using SGCollision = SGCollisions::iterator;
Expand Down
5 changes: 5 additions & 0 deletions PWGUD/TableProducer/Converters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ o2physics_add_dpl_workflow(collisionselextras-converter-v002
SOURCES UDCollisionSelExtrasV002Converter.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(collisionselextras-converter-v003
SOURCES UDCollisionSelExtrasV003Converter.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
COMPONENT_NAME Analysis)
126 changes: 126 additions & 0 deletions PWGUD/TableProducer/Converters/UDCollisionSelExtrasV003Converter.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
// 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.

/// \file UDCollisionSelExtrasV003Converter.cxx
/// \brief Converts UDCollisionSelExtras table from version 000 to 003 and 001 to 003 and 002 to 003
/// \author Adam Matyja <adam.tomasz.matyja@cern.ch>

#include "PWGUD/DataModel/UDTables.h"

#include "Framework/AnalysisDataModel.h"
#include "Framework/AnalysisTask.h"
#include "Framework/runDataProcessing.h"

using namespace o2;
using namespace o2::framework;

// Converts UDCollisions for version 000 to 003 and 001 to 003 and 002 to 003
struct UDCollisionSelExtrasV003Converter {
Produces<o2::aod::UDCollisionSelExtras_003> udCollisionSelExtras_003;

void init(InitContext const&)
{
if (!doprocessV000ToV003 && !doprocessV001ToV003 && !doprocessV002ToV003) {
LOGF(fatal, "Neither processV000ToV003 nor processV001ToV003 nor processV002ToV003 is enabled. Please choose one!");
}
if (static_cast<int>(doprocessV000ToV003) + static_cast<int>(doprocessV001ToV003) + static_cast<int>(doprocessV002ToV003) > 1) {
LOGF(fatal, "More than one among processV000ToV003, processV001ToV003, processV002ToV003 is enabled. Please choose only one!");
}
}

void processV000ToV003(o2::aod::UDCollisionSelExtras_000 const& collisions)
{

for (const auto& collision : collisions) {

udCollisionSelExtras_003(collision.chFT0A(),
collision.chFT0C(),
collision.chFDDA(),
collision.chFDDC(),
collision.chFV0A(),
0, // dummy occupancy
0.0f, // dummy rate
0, // dummy trs
0, // dummy trofs
0, // dummy hmpr
0, // dummy tfb
0, // dummy itsROFb
0, // dummy sbp
0, // dummy zVtxFT0vPV
0, // dummy vtxITSTPC
0); // dummy rct
}
}
PROCESS_SWITCH(UDCollisionSelExtrasV003Converter, processV000ToV003, "process v000-to-v003 conversion", false);

void processV001ToV003(o2::aod::UDCollisionSelExtras_001 const& collisions)
{

for (const auto& collision : collisions) {

udCollisionSelExtras_003(collision.chFT0A(),
collision.chFT0C(),
collision.chFDDA(),
collision.chFDDC(),
collision.chFV0A(),
collision.occupancyInTime(),
collision.hadronicRate(),
collision.trs(),
collision.trofs(),
collision.hmpr(),
0, // dummy tfb
0, // dummy itsROFb
0, // dummy sbp
0, // dummy zVtxFT0vPV
0, // dummy vtxITSTPC
0); // dummy rct
}
}
PROCESS_SWITCH(UDCollisionSelExtrasV003Converter, processV001ToV003, "process v001-to-v003 conversion", false);

void processV002ToV003(o2::aod::UDCollisionSelExtras_002 const& collisions)
{

for (const auto& collision : collisions) {

udCollisionSelExtras_003(collision.chFT0A(),
collision.chFT0C(),
collision.chFDDA(),
collision.chFDDC(),
collision.chFV0A(),
collision.occupancyInTime(),
collision.hadronicRate(),
collision.trs(),
collision.trofs(),
collision.hmpr(),
collision.tfb(),
collision.itsROFb(),
collision.sbp(),
collision.zVtxFT0vPV(),
collision.vtxITSTPC(),
0); // dummy rct
}
}
PROCESS_SWITCH(UDCollisionSelExtrasV003Converter, processV002ToV003, "process v002-to-v003 conversion", true);
};

/// Spawn the extended table for UDCollisionSelExtras003 to avoid the call to the internal spawner and a consequent circular dependency
// struct UDCollisionSelExtrasSpawner {
// Spawns<aod::UDCollisionSelExtras_003> udCollisionSelExtras_003;
// };

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
return WorkflowSpec{
adaptAnalysisTask<UDCollisionSelExtrasV003Converter>(cfgc),
// adaptAnalysisTask<UDCollisionSelExtrasSpawner>(cfgc),
};
}
27 changes: 15 additions & 12 deletions PWGUD/TableProducer/DGCandProducer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,23 @@
// \brief Saves relevant information of DG candidates
// \author Paul Buehler, paul.buehler@oeaw.ac.at

#include <vector>
#include <string>
#include <map>
#include "Framework/runDataProcessing.h"
#include "Framework/AnalysisTask.h"
#include "Framework/HistogramRegistry.h"
#include "ReconstructionDataFormats/Vertex.h"
#include "PWGUD/Core/DGSelector.h"
#include "PWGUD/Core/UPCHelpers.h"
#include "PWGUD/DataModel/UDTables.h"

#include "Common/CCDB/ctpRateFetcher.h"
#include "EventFiltering/Zorro.h"
#include "EventFiltering/ZorroSummary.h"

#include "CCDB/BasicCCDBManager.h"
#include "Common/CCDB/ctpRateFetcher.h"
#include "PWGUD/DataModel/UDTables.h"
#include "PWGUD/Core/UPCHelpers.h"
#include "PWGUD/Core/DGSelector.h"
#include "Framework/AnalysisTask.h"
#include "Framework/HistogramRegistry.h"
#include "Framework/runDataProcessing.h"
#include "ReconstructionDataFormats/Vertex.h"

#include <map>
#include <string>
#include <vector>

using namespace o2;
using namespace o2::framework;
Expand Down Expand Up @@ -354,7 +357,7 @@ struct DGCandProducer {
fitInfo.BBFT0Apf, fitInfo.BBFT0Cpf, fitInfo.BGFT0Apf, fitInfo.BGFT0Cpf,
fitInfo.BBFV0Apf, fitInfo.BGFV0Apf,
fitInfo.BBFDDApf, fitInfo.BBFDDCpf, fitInfo.BGFDDApf, fitInfo.BGFDDCpf);
outputCollisionSelExtras(chFT0A, chFT0C, chFDDA, chFDDC, chFV0A, occ, ir, trs, trofs, hmpr, tfb, itsROFb, sbp, zVtxFT0vPv, vtxITSTPC);
outputCollisionSelExtras(chFT0A, chFT0C, chFDDA, chFDDC, chFV0A, occ, ir, trs, trofs, hmpr, tfb, itsROFb, sbp, zVtxFT0vPv, vtxITSTPC, collision.rct_raw());
outputCollsLabels(collision.globalIndex());

// update DGTracks tables
Expand Down
Loading
Loading