Skip to content

Commit e2ff8e7

Browse files
authored
[PWGUD] Added RCT flags to UD tables (#11714)
1 parent 267749a commit e2ff8e7

File tree

7 files changed

+326
-70
lines changed

7 files changed

+326
-70
lines changed

PWGUD/Core/SGSelector.h

Lines changed: 78 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,47 @@
88
// In applying this license CERN does not waive the privileges and immunities
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
11+
//
12+
/// \file SGSelector.h
13+
/// \author Alexander Bylinkin
14+
/// \author Adam Matyja
15+
/// \since 2023-11-21
16+
/// \brief Support class holding tools to work with Single Gap selection in central barrel UPCs
17+
///
1118

1219
#ifndef PWGUD_CORE_SGSELECTOR_H_
1320
#define PWGUD_CORE_SGSELECTOR_H_
1421

15-
#include <cmath>
16-
#include "TDatabasePDG.h"
17-
#include "TLorentzVector.h"
18-
#include "Framework/Logger.h"
19-
#include "Framework/AnalysisTask.h"
20-
#include "PWGUD/Core/UDHelpers.h"
2122
#include "PWGUD/Core/SGCutParHolder.h"
23+
#include "PWGUD/Core/UDHelpers.h"
24+
25+
#include "Common/CCDB/RCTSelectionFlags.h"
26+
27+
#include "Framework/AnalysisTask.h"
28+
#include "Framework/Logger.h"
29+
30+
#include <cmath>
2231

2332
template <typename BC>
2433
struct SelectionResult {
2534
int value; // The original integer return value
2635
BC* bc; // Pointer to the BC object
2736
};
2837

38+
namespace o2::aod::sgselector
39+
{
40+
enum TrueGap : int {
41+
NoGap = -1,
42+
SingleGapA = 0,
43+
SingleGapC = 1,
44+
DoubleGap = 2
45+
};
46+
}
47+
2948
class SGSelector
3049
{
3150
public:
32-
SGSelector() : fPDG(TDatabasePDG::Instance()) {}
51+
SGSelector() : myRCTChecker{"CBT"}, myRCTCheckerHadron{"CBT_hadronPID"}, myRCTCheckerZDC{"CBT", true}, myRCTCheckerHadronZDC{"CBT_hadronPID", true} {}
3352

3453
template <typename CC, typename BCs, typename TCs, typename FWs>
3554
int Print(SGCutParHolder /*diffCuts*/, CC& collision, BCs& /*bcRange*/, TCs& /*tracks*/, FWs& /*fwdtracks*/)
@@ -107,7 +126,8 @@ class SGSelector
107126
template <typename TFwdTrack>
108127
int FwdTrkSelector(TFwdTrack const& fwdtrack)
109128
{
110-
if (fwdtrack.trackType() == 0 || fwdtrack.trackType() == 3)
129+
// if (fwdtrack.trackType() == 0 || fwdtrack.trackType() == 3)
130+
if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack || fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack)
111131
return 1;
112132
else
113133
return 0;
@@ -125,29 +145,68 @@ class SGSelector
125145
FT0C = collision.totalFT0AmplitudeC();
126146
ZNA = collision.energyCommonZNA();
127147
ZNC = collision.energyCommonZNC();
128-
if (gap == 0) {
148+
if (gap == o2::aod::sgselector::SingleGapA) { // gap == 0
129149
if (FV0A > fit_cut[0] || FT0A > fit_cut[1] || ZNA > zdc_cut)
130-
true_gap = -1;
131-
} else if (gap == 1) {
150+
true_gap = o2::aod::sgselector::NoGap; // -1
151+
} else if (gap == o2::aod::sgselector::SingleGapC) { // gap == 1
132152
if (FT0C > fit_cut[2] || ZNC > zdc_cut)
133-
true_gap = -1;
134-
} else if (gap == 2) {
153+
true_gap = o2::aod::sgselector::NoGap; // -1
154+
} else if (gap == o2::aod::sgselector::DoubleGap) { // gap == 2
135155
if ((FV0A > fit_cut[0] || FT0A > fit_cut[1] || ZNA > zdc_cut) && (FT0C > fit_cut[2] || ZNC > zdc_cut))
136-
true_gap = -1;
156+
true_gap = o2::aod::sgselector::NoGap; // -1
137157
else if ((FV0A > fit_cut[0] || FT0A > fit_cut[1] || ZNA > zdc_cut) && (FT0C <= fit_cut[2] && ZNC <= zdc_cut))
138-
true_gap = 1;
158+
true_gap = o2::aod::sgselector::SingleGapC; // 1
139159
else if ((FV0A <= fit_cut[0] && FT0A <= fit_cut[1] && ZNA <= zdc_cut) && (FT0C > fit_cut[2] || ZNC > zdc_cut))
140-
true_gap = 0;
160+
true_gap = o2::aod::sgselector::SingleGapA; // 0
141161
else if (FV0A <= fit_cut[0] && FT0A <= fit_cut[1] && ZNA <= zdc_cut && FT0C <= fit_cut[2] && ZNC <= zdc_cut)
142-
true_gap = 2;
162+
true_gap = o2::aod::sgselector::DoubleGap; // 2
143163
else
144-
std::cout << "Something wrong with DG" << std::endl;
164+
LOGF(info, "Something wrong with DG");
145165
}
146166
return true_gap;
147167
}
148168

169+
// check CBT flags
170+
template <typename CC>
171+
bool isCBTOk(CC& collision)
172+
{
173+
if (myRCTChecker(collision))
174+
return true;
175+
return false;
176+
}
177+
178+
// check CBT+hadronPID flags
179+
template <typename CC>
180+
bool isCBTHadronOk(CC& collision)
181+
{
182+
if (myRCTCheckerHadron(collision))
183+
return true;
184+
return false;
185+
}
186+
187+
// check CBT+ZDC flags
188+
template <typename CC>
189+
bool isCBTZdcOk(CC& collision)
190+
{
191+
if (myRCTCheckerZDC(collision))
192+
return true;
193+
return false;
194+
}
195+
196+
// check CBT+hadronPID+ZDC flags
197+
template <typename CC>
198+
bool isCBTHadronZdcOk(CC& collision)
199+
{
200+
if (myRCTCheckerHadronZDC(collision))
201+
return true;
202+
return false;
203+
}
204+
149205
private:
150-
TDatabasePDG* fPDG;
206+
o2::aod::rctsel::RCTFlagsChecker myRCTChecker;
207+
o2::aod::rctsel::RCTFlagsChecker myRCTCheckerHadron;
208+
o2::aod::rctsel::RCTFlagsChecker myRCTCheckerZDC;
209+
o2::aod::rctsel::RCTFlagsChecker myRCTCheckerHadronZDC;
151210
};
152211

153212
#endif // PWGUD_CORE_SGSELECTOR_H_

PWGUD/DataModel/UDTables.h

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,29 @@
88
// In applying this license CERN does not waive the privileges and immunities
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
11+
//
12+
/// \file UDTables.h
13+
/// \brief Defines tables and colums for derived data used by UD group
14+
/// \author Paul Buhler <paul.buhler@cern.ch>, Wiena
15+
/// \since January 2023
16+
/// \author Sasha Bylinkin <sasha.bylinkin@cern.ch>, Bergen
17+
/// \since January 2024
18+
/// \author Adam Matyja <adam.tomasz.matyja@cern.ch>, INP PAN Krakow, Poland
19+
/// \since May 2025
1120

1221
#ifndef PWGUD_DATAMODEL_UDTABLES_H_
1322
#define PWGUD_DATAMODEL_UDTABLES_H_
1423

15-
#include <vector>
16-
#include <cmath>
24+
#include "Common/DataModel/PIDResponse.h"
25+
#include "Common/DataModel/TrackSelectionTables.h"
26+
1727
#include "Framework/ASoA.h"
1828
#include "Framework/AnalysisDataModel.h"
1929
#include "Framework/DataTypes.h"
2030
#include "MathUtils/Utils.h"
21-
#include "Common/DataModel/PIDResponse.h"
22-
#include "Common/DataModel/TrackSelectionTables.h"
31+
32+
#include <cmath>
33+
#include <vector>
2334

2435
namespace o2::aod
2536
{
@@ -111,6 +122,10 @@ DECLARE_SOA_COLUMN(ITSROFb, itsROFb, int);
111122
DECLARE_SOA_COLUMN(Sbp, sbp, int);
112123
DECLARE_SOA_COLUMN(ZvtxFT0vPV, zVtxFT0vPV, int);
113124
DECLARE_SOA_COLUMN(VtxITSTPC, vtxITSTPC, int);
125+
// information about mask names -> Common/CCDB/RCTSelectionFlags.h
126+
// DECLARE_SOA_COLUMN(Rct, rct, uint32_t); //! run condition table mask
127+
DECLARE_SOA_BITMAP_COLUMN(Rct, rct, 32); //! run condition table mask
128+
114129
// Gap Side Information
115130
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)
116131
// FIT selection flags
@@ -249,6 +264,24 @@ DECLARE_SOA_TABLE_VERSIONED(UDCollisionSelExtras_002, "AOD", "UDCOLSELEXTRA", 2,
249264
udcollision::ZvtxFT0vPV, //! kIsGoodZvtxFT0vsPV
250265
udcollision::VtxITSTPC); //! kIsVertexITSTPC
251266

267+
DECLARE_SOA_TABLE_VERSIONED(UDCollisionSelExtras_003, "AOD", "UDCOLSELEXTRA", 3,
268+
udcollision::ChFT0A, //! number of active channels in FT0A
269+
udcollision::ChFT0C, //! number of active channels in FT0C
270+
udcollision::ChFDDA, //! number of active channels in FDDA
271+
udcollision::ChFDDC, //! number of active channels in FDDC
272+
udcollision::ChFV0A, //! number of active channels in FV0A
273+
udcollision::OccupancyInTime, //! Occupancy
274+
udcollision::HadronicRate, //! Interaction Rate
275+
udcollision::Trs, //! kNoCollInTimeRangeStandard
276+
udcollision::Trofs, //! kNoCollInRofStandard
277+
udcollision::Hmpr, //! kNoHighMultCollInPrevRof
278+
udcollision::TFb, //! kNoTimeFrameBorder
279+
udcollision::ITSROFb, //! kNoITSROFrameBorder
280+
udcollision::Sbp, //! kNoSameBunchPileup
281+
udcollision::ZvtxFT0vPV, //! kIsGoodZvtxFT0vsPV
282+
udcollision::VtxITSTPC, //! kIsVertexITSTPC
283+
udcollision::Rct); //! RCT mask
284+
252285
// central barrel-specific selections
253286
DECLARE_SOA_TABLE(UDCollisionsSelsCent, "AOD", "UDCOLSELCNT",
254287
udcollision::DBcTOR,
@@ -272,7 +305,7 @@ DECLARE_SOA_TABLE(UDMcCollsLabels, "AOD", "UDMCCOLLSLABEL",
272305
udcollision::UDMcCollisionId);
273306

274307
using UDCollisions = UDCollisions_001;
275-
using UDCollisionSelExtras = UDCollisionSelExtras_002;
308+
using UDCollisionSelExtras = UDCollisionSelExtras_003;
276309

277310
using UDCollision = UDCollisions::iterator;
278311
using SGCollision = SGCollisions::iterator;

PWGUD/TableProducer/Converters/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,8 @@ o2physics_add_dpl_workflow(collisionselextras-converter-v002
2929
SOURCES UDCollisionSelExtrasV002Converter.cxx
3030
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
3131
COMPONENT_NAME Analysis)
32+
33+
o2physics_add_dpl_workflow(collisionselextras-converter-v003
34+
SOURCES UDCollisionSelExtrasV003Converter.cxx
35+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
36+
COMPONENT_NAME Analysis)
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file UDCollisionSelExtrasV003Converter.cxx
13+
/// \brief Converts UDCollisionSelExtras table from version 000 to 003 and 001 to 003 and 002 to 003
14+
/// \author Adam Matyja <adam.tomasz.matyja@cern.ch>
15+
16+
#include "PWGUD/DataModel/UDTables.h"
17+
18+
#include "Framework/AnalysisDataModel.h"
19+
#include "Framework/AnalysisTask.h"
20+
#include "Framework/runDataProcessing.h"
21+
22+
using namespace o2;
23+
using namespace o2::framework;
24+
25+
// Converts UDCollisions for version 000 to 003 and 001 to 003 and 002 to 003
26+
struct UDCollisionSelExtrasV003Converter {
27+
Produces<o2::aod::UDCollisionSelExtras_003> udCollisionSelExtras_003;
28+
29+
void init(InitContext const&)
30+
{
31+
if (!doprocessV000ToV003 && !doprocessV001ToV003 && !doprocessV002ToV003) {
32+
LOGF(fatal, "Neither processV000ToV003 nor processV001ToV003 nor processV002ToV003 is enabled. Please choose one!");
33+
}
34+
if (static_cast<int>(doprocessV000ToV003) + static_cast<int>(doprocessV001ToV003) + static_cast<int>(doprocessV002ToV003) > 1) {
35+
LOGF(fatal, "More than one among processV000ToV003, processV001ToV003, processV002ToV003 is enabled. Please choose only one!");
36+
}
37+
}
38+
39+
void processV000ToV003(o2::aod::UDCollisionSelExtras_000 const& collisions)
40+
{
41+
42+
for (const auto& collision : collisions) {
43+
44+
udCollisionSelExtras_003(collision.chFT0A(),
45+
collision.chFT0C(),
46+
collision.chFDDA(),
47+
collision.chFDDC(),
48+
collision.chFV0A(),
49+
0, // dummy occupancy
50+
0.0f, // dummy rate
51+
0, // dummy trs
52+
0, // dummy trofs
53+
0, // dummy hmpr
54+
0, // dummy tfb
55+
0, // dummy itsROFb
56+
0, // dummy sbp
57+
0, // dummy zVtxFT0vPV
58+
0, // dummy vtxITSTPC
59+
0); // dummy rct
60+
}
61+
}
62+
PROCESS_SWITCH(UDCollisionSelExtrasV003Converter, processV000ToV003, "process v000-to-v003 conversion", false);
63+
64+
void processV001ToV003(o2::aod::UDCollisionSelExtras_001 const& collisions)
65+
{
66+
67+
for (const auto& collision : collisions) {
68+
69+
udCollisionSelExtras_003(collision.chFT0A(),
70+
collision.chFT0C(),
71+
collision.chFDDA(),
72+
collision.chFDDC(),
73+
collision.chFV0A(),
74+
collision.occupancyInTime(),
75+
collision.hadronicRate(),
76+
collision.trs(),
77+
collision.trofs(),
78+
collision.hmpr(),
79+
0, // dummy tfb
80+
0, // dummy itsROFb
81+
0, // dummy sbp
82+
0, // dummy zVtxFT0vPV
83+
0, // dummy vtxITSTPC
84+
0); // dummy rct
85+
}
86+
}
87+
PROCESS_SWITCH(UDCollisionSelExtrasV003Converter, processV001ToV003, "process v001-to-v003 conversion", false);
88+
89+
void processV002ToV003(o2::aod::UDCollisionSelExtras_002 const& collisions)
90+
{
91+
92+
for (const auto& collision : collisions) {
93+
94+
udCollisionSelExtras_003(collision.chFT0A(),
95+
collision.chFT0C(),
96+
collision.chFDDA(),
97+
collision.chFDDC(),
98+
collision.chFV0A(),
99+
collision.occupancyInTime(),
100+
collision.hadronicRate(),
101+
collision.trs(),
102+
collision.trofs(),
103+
collision.hmpr(),
104+
collision.tfb(),
105+
collision.itsROFb(),
106+
collision.sbp(),
107+
collision.zVtxFT0vPV(),
108+
collision.vtxITSTPC(),
109+
0); // dummy rct
110+
}
111+
}
112+
PROCESS_SWITCH(UDCollisionSelExtrasV003Converter, processV002ToV003, "process v002-to-v003 conversion", true);
113+
};
114+
115+
/// Spawn the extended table for UDCollisionSelExtras003 to avoid the call to the internal spawner and a consequent circular dependency
116+
// struct UDCollisionSelExtrasSpawner {
117+
// Spawns<aod::UDCollisionSelExtras_003> udCollisionSelExtras_003;
118+
// };
119+
120+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
121+
{
122+
return WorkflowSpec{
123+
adaptAnalysisTask<UDCollisionSelExtrasV003Converter>(cfgc),
124+
// adaptAnalysisTask<UDCollisionSelExtrasSpawner>(cfgc),
125+
};
126+
}

0 commit comments

Comments
 (0)