Skip to content

Commit 1d77b95

Browse files
committed
Added predefined RCT selectors
1 parent 9db231f commit 1d77b95

File tree

7 files changed

+312
-80
lines changed

7 files changed

+312
-80
lines changed

PWGUD/Core/SGSelector.h

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,19 @@
1212
#ifndef PWGUD_CORE_SGSELECTOR_H_
1313
#define PWGUD_CORE_SGSELECTOR_H_
1414

15-
#include <cmath>
15+
#include "PWGUD/Core/SGCutParHolder.h"
16+
#include "PWGUD/Core/UDHelpers.h"
17+
18+
#include "Common/CCDB/RCTSelectionFlags.h"
19+
20+
#include "Framework/AnalysisTask.h"
21+
#include "Framework/Logger.h"
22+
1623
#include "TDatabasePDG.h"
1724
#include "TLorentzVector.h"
18-
#include "Framework/Logger.h"
19-
#include "Framework/AnalysisTask.h"
20-
#include "PWGUD/Core/UDHelpers.h"
21-
#include "PWGUD/Core/SGCutParHolder.h"
25+
26+
#include <cmath>
27+
using namespace o2::aod::rctsel;
2228

2329
template <typename BC>
2430
struct SelectionResult {
@@ -29,7 +35,7 @@ struct SelectionResult {
2935
class SGSelector
3036
{
3137
public:
32-
SGSelector() : fPDG(TDatabasePDG::Instance()) {}
38+
SGSelector() : fPDG(TDatabasePDG::Instance()), myRCTChecker{"CBT"}, myRCTCheckerHadron{"CBT_hadronPID"}, myRCTCheckerZDC{"CBT", true}, myRCTCheckerHadronZDC{"CBT_hadronPID", true} {}
3339

3440
template <typename CC, typename BCs, typename TCs, typename FWs>
3541
int Print(SGCutParHolder /*diffCuts*/, CC& collision, BCs& /*bcRange*/, TCs& /*tracks*/, FWs& /*fwdtracks*/)
@@ -146,8 +152,48 @@ class SGSelector
146152
return true_gap;
147153
}
148154

155+
// check CBT flags
156+
template <typename CC>
157+
bool isCBTOk(CC& collision)
158+
{
159+
if (myRCTChecker(collision))
160+
return true;
161+
return false;
162+
}
163+
164+
// check CBT+hadronPID flags
165+
template <typename CC>
166+
bool isCBTHadronOk(CC& collision)
167+
{
168+
if (myRCTCheckerHadron(collision))
169+
return true;
170+
return false;
171+
}
172+
173+
// check CBT+ZDC flags
174+
template <typename CC>
175+
bool isCBTZdcOk(CC& collision)
176+
{
177+
if (myRCTCheckerZDC(collision))
178+
return true;
179+
return false;
180+
}
181+
182+
// check CBT+hadronPID+ZDC flags
183+
template <typename CC>
184+
bool isCBTHadronZdcOk(CC& collision)
185+
{
186+
if (myRCTCheckerHadronZDC(collision))
187+
return true;
188+
return false;
189+
}
190+
149191
private:
150192
TDatabasePDG* fPDG;
193+
RCTFlagsChecker myRCTChecker;
194+
RCTFlagsChecker myRCTCheckerHadron;
195+
RCTFlagsChecker myRCTCheckerZDC;
196+
RCTFlagsChecker myRCTCheckerHadronZDC;
151197
};
152198

153199
#endif // PWGUD_CORE_SGSELECTOR_H_

PWGUD/DataModel/UDTables.h

Lines changed: 37 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,9 @@ 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+
DECLARE_SOA_COLUMN(Rct_raw, rct_raw, uint32_t); //! run condition table mask
126+
// information about mask names -> Common/CCDB/RCTSelectionFlags.h
127+
114128
// Gap Side Information
115129
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)
116130
// FIT selection flags
@@ -249,6 +263,24 @@ DECLARE_SOA_TABLE_VERSIONED(UDCollisionSelExtras_002, "AOD", "UDCOLSELEXTRA", 2,
249263
udcollision::ZvtxFT0vPV, //! kIsGoodZvtxFT0vsPV
250264
udcollision::VtxITSTPC); //! kIsVertexITSTPC
251265

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

274306
using UDCollisions = UDCollisions_001;
275-
using UDCollisionSelExtras = UDCollisionSelExtras_002;
307+
using UDCollisionSelExtras = UDCollisionSelExtras_003;
276308

277309
using UDCollision = UDCollisions::iterator;
278310
using SGCollision = SGCollisions::iterator;
Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,26 @@
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.
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.
44
#
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".
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".
77
#
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
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
1010
# or submit itself to any jurisdiction.
1111

12-
o2physics_add_dpl_workflow(fwd-tracks-extra-converter
13-
SOURCES UDFwdTracksExtraConverter.cxx
14-
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
15-
COMPONENT_NAME Analysis)
12+
o2physics_add_dpl_workflow(fwd - tracks - extra - converter SOURCES UDFwdTracksExtraConverter.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis)
1613

14+
o2physics_add_dpl_workflow(collisions - converter
15+
SOURCES UDCollisionsConverter.cxx
16+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
17+
COMPONENT_NAME Analysis)
1718

18-
o2physics_add_dpl_workflow(collisions-converter
19-
SOURCES UDCollisionsConverter.cxx
20-
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
21-
COMPONENT_NAME Analysis)
19+
o2physics_add_dpl_workflow(collisionselextras - converter
20+
SOURCES UDCollisionSelExtrasConverter.cxx
21+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
22+
COMPONENT_NAME Analysis)
2223

23-
o2physics_add_dpl_workflow(collisionselextras-converter
24-
SOURCES UDCollisionSelExtrasConverter.cxx
25-
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
26-
COMPONENT_NAME Analysis)
24+
o2physics_add_dpl_workflow(collisionselextras - converter - v002 SOURCES UDCollisionSelExtrasV002Converter.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis)
2725

28-
o2physics_add_dpl_workflow(collisionselextras-converter-v002
29-
SOURCES UDCollisionSelExtrasV002Converter.cxx
30-
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
31-
COMPONENT_NAME Analysis)
26+
o2physics_add_dpl_workflow(collisionselextras - converter - v003 SOURCES UDCollisionSelExtrasV003Converter.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore 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 ((int)doprocessV000ToV003 + (int)doprocessV001ToV003 + (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_raw
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_raw
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_raw
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+
}

PWGUD/TableProducer/DGCandProducer.cxx

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,23 @@
1212
// \brief Saves relevant information of DG candidates
1313
// \author Paul Buehler, paul.buehler@oeaw.ac.at
1414

15-
#include <vector>
16-
#include <string>
17-
#include <map>
18-
#include "Framework/runDataProcessing.h"
19-
#include "Framework/AnalysisTask.h"
20-
#include "Framework/HistogramRegistry.h"
21-
#include "ReconstructionDataFormats/Vertex.h"
15+
#include "PWGUD/Core/DGSelector.h"
16+
#include "PWGUD/Core/UPCHelpers.h"
17+
#include "PWGUD/DataModel/UDTables.h"
18+
19+
#include "Common/CCDB/ctpRateFetcher.h"
2220
#include "EventFiltering/Zorro.h"
2321
#include "EventFiltering/ZorroSummary.h"
22+
2423
#include "CCDB/BasicCCDBManager.h"
25-
#include "Common/CCDB/ctpRateFetcher.h"
26-
#include "PWGUD/DataModel/UDTables.h"
27-
#include "PWGUD/Core/UPCHelpers.h"
28-
#include "PWGUD/Core/DGSelector.h"
24+
#include "Framework/AnalysisTask.h"
25+
#include "Framework/HistogramRegistry.h"
26+
#include "Framework/runDataProcessing.h"
27+
#include "ReconstructionDataFormats/Vertex.h"
28+
29+
#include <map>
30+
#include <string>
31+
#include <vector>
2932

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

360363
// update DGTracks tables

0 commit comments

Comments
 (0)