Skip to content

Commit d71cfad

Browse files
abylinkinalibuildrolavick
authored
PWGUD Table Producers modified to include the UPC Reco flag in collisions (AliceO2Group#7975)
* Add files via upload * Add files via upload * Add files via upload * Add files via upload * Please consider the following formatting changes * Fix error in UPCCandProducer when building O2Physics I assume the error is due to BCFlags table not to be joined with BC table * Update UDCollisionsConverter.cxx * Update DGBCCandProducer.cxx * Update DGCandProducer.cxx * Update SGCandProducer.cxx * Update DGCandProducer.cxx * Update UPCCandidateProducer.cxx * Update DGBCCandProducer.cxx * Update DGCandProducer.cxx * Update SGCandProducer.cxx * Please consider the following formatting changes * Update UPCCandidateProducer.cxx All BCs should have now have the same table definitions * Update SGCandProducer.cxx * Update DGCandProducer.cxx * Update DGBCCandProducer.cxx * Please consider the following formatting changes * Update UPCCandidateProducer.cxx * Please consider the following formatting changes * Update UPCCandidateProducer.cxx Fix typo probably introduced when global replace was done * Update DGBCCandProducer.cxx * Update DGCandProducer.cxx * Update SGCandProducer.cxx * Update DGBCCandProducer.cxx fix of Vertex::UPCMode * Update DGCandProducer.cxx fix of Vertex::UPCMode * Update SGCandProducer.cxx fix of Vertex::UPCMode * Update UPCCandidateProducer.cxx TODO added to not forget the implementation of collision flag association via bc table is not fully correct. bcs.iteratorAt(0) takes only first BC in a timeframe, and in an analysis task data should be processed TF-by-TF (if I'm not mistaken again), so it should be a corresponding BCId for each collision. UPCCandidateProducer matches tracks by time (BC) independently of reconstructed vertices, so additional checks should be added at some point to determine settings for a given ITSROF based e.g. on track BCs. * Update DGBCCandProducer.cxx fix * Update DGCandProducer.cxx fix * Update SGCandProducer.cxx fix * Update DGBCCandProducer.cxx fix * Update DGCandProducer.cxx fix * Update DGCandProducer.cxx fix * Update DGBCCandProducer.cxx * Update DGBCCandProducer.cxx * Update DGCandProducer.cxx * Update SGCandProducer.cxx --------- Co-authored-by: ALICE Action Bot <[email protected]> Co-authored-by: rolavick <[email protected]>
1 parent 5255f41 commit d71cfad

File tree

7 files changed

+148
-26
lines changed

7 files changed

+148
-26
lines changed

PWGUD/DataModel/UDTables.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ DECLARE_SOA_INDEX_COLUMN(UDMcCollision, udMcCollision);
151151

152152
} // namespace udcollision
153153

154-
DECLARE_SOA_TABLE(UDCollisions, "AOD", "UDCOLLISION",
154+
DECLARE_SOA_TABLE(UDCollisions_000, "AOD", "UDCOLLISION",
155155
o2::soa::Index<>,
156156
udcollision::GlobalBC,
157157
udcollision::RunNumber,
@@ -161,6 +161,18 @@ DECLARE_SOA_TABLE(UDCollisions, "AOD", "UDCOLLISION",
161161
collision::NumContrib,
162162
udcollision::NetCharge,
163163
udcollision::RgtrwTOF);
164+
// Version with UPC Reco Flag
165+
DECLARE_SOA_TABLE_VERSIONED(UDCollisions_001, "AOD", "UDCOLLISION", 1,
166+
o2::soa::Index<>,
167+
udcollision::GlobalBC,
168+
udcollision::RunNumber,
169+
collision::PosX,
170+
collision::PosY,
171+
collision::PosZ,
172+
collision::Flags,
173+
collision::NumContrib,
174+
udcollision::NetCharge,
175+
udcollision::RgtrwTOF);
164176

165177
DECLARE_SOA_TABLE(SGCollisions, "AOD", "SGCOLLISION",
166178
udcollision::GapSide);
@@ -208,6 +220,8 @@ DECLARE_SOA_TABLE(UDCollsLabels, "AOD", "UDCOLLSLABEL",
208220
DECLARE_SOA_TABLE(UDMcCollsLabels, "AOD", "UDMCCOLLSLABEL",
209221
udcollision::UDMcCollisionId);
210222

223+
using UDCollisions = UDCollisions_001;
224+
211225
using UDCollision = UDCollisions::iterator;
212226
using SGCollision = SGCollisions::iterator;
213227
using UDCollisionsSel = UDCollisionsSels::iterator;

PWGUD/TableProducer/Converters/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,9 @@ o2physics_add_dpl_workflow(fwd-tracks-extra-converter
1414
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
1515
COMPONENT_NAME Analysis)
1616

17+
18+
o2physics_add_dpl_workflow(collisions-converter
19+
SOURCES UDCollisionsConverter.cxx
20+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
21+
COMPONENT_NAME Analysis)
22+
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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 UDCollisionsConverter.cxx
13+
/// \brief Converts UDCollisions table from version 000 to 001
14+
15+
/// This task allows for the conversion of the UDCollisions table from the version 000,
16+
/// that is before the introduction of Flags for UPC reconstruction
17+
/// to the version 001, that includes it
18+
19+
/// executable name o2-analysis-ud-collisions-converter
20+
21+
/// \author Sasha Bylinkin <[email protected]>
22+
23+
#include "Framework/runDataProcessing.h"
24+
#include "Framework/AnalysisTask.h"
25+
#include "Framework/AnalysisDataModel.h"
26+
#include "PWGUD/DataModel/UDTables.h"
27+
28+
using namespace o2;
29+
using namespace o2::framework;
30+
31+
// Converts UDCollisions for version 000 to 001
32+
struct UDCollisionsConverter {
33+
Produces<o2::aod::UDCollisions_001> udCollisions_001;
34+
35+
void process(o2::aod::UDCollisions_000 const& collisions)
36+
{
37+
38+
for (const auto& collision : collisions) {
39+
40+
udCollisions_001(collision.globalBC(),
41+
collision.runNumber(),
42+
collision.posX(),
43+
collision.posY(),
44+
collision.posZ(),
45+
0.0f, // dummy UPC reco flag, not available in version 000
46+
collision.numContrib(),
47+
collision.netCharge(),
48+
collision.rgtrwTOF());
49+
}
50+
}
51+
};
52+
53+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
54+
{
55+
return WorkflowSpec{
56+
adaptAnalysisTask<UDCollisionsConverter>(cfgc),
57+
};
58+
}

PWGUD/TableProducer/DGBCCandProducer.cxx

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <algorithm>
1818
#include "Framework/runDataProcessing.h"
1919
#include "Framework/AnalysisTask.h"
20+
#include "ReconstructionDataFormats/Vertex.h"
2021
#include "PWGUD/DataModel/UDTables.h"
2122
#include "PWGUD/Core/UDHelpers.h"
2223
#include "PWGUD/Core/UPCHelpers.h"
@@ -279,11 +280,11 @@ struct DGBCCandProducer {
279280

280281
// update UDTables
281282
template <typename TTracks>
282-
void updateUDTables(bool onlyPV, int64_t colID, uint64_t bcnum, int rnum, float vx, float vy, float vz,
283+
void updateUDTables(bool onlyPV, int64_t colID, uint64_t bcnum, int rnum, float vx, float vy, float vz, int flag,
283284
uint16_t const& ntrks, int8_t const& ncharge, float const& rtrwTOF,
284285
TTracks const& tracks, upchelpers::FITInfo const& fitInfo)
285286
{
286-
outputCollisions(bcnum, rnum, vx, vy, vz, ntrks, ncharge, rtrwTOF);
287+
outputCollisions(bcnum, rnum, vx, vy, vz, flag, ntrks, ncharge, rtrwTOF);
287288
outputCollisionsSels(fitInfo.ampFT0A, fitInfo.ampFT0C, fitInfo.timeFT0A, fitInfo.timeFT0C,
288289
fitInfo.triggerMaskFT0,
289290
fitInfo.ampFDDA, fitInfo.ampFDDC, fitInfo.timeFDDA, fitInfo.timeFDDC,
@@ -383,7 +384,7 @@ struct DGBCCandProducer {
383384

384385
// check if DG event
385386
// distinguish between cases with and without associated BC
386-
// 1. candidate has associated BC and associated collision -> vertex position: col.[posX(), posY(), posZ()]
387+
// 1. candidate has associated BC and associated collision -> position: col.[posX(), posY(), posZ()]
387388
// 2. candidate has associated BC but no associated collision -> [-2., 2., -2.]
388389
// 3. candidate has no associated BC -> [-3., 3., -3.]
389390
int isDG = -1;
@@ -415,8 +416,11 @@ struct DGBCCandProducer {
415416
registry.get<TH1>(HIST("table/candCase"))->Fill(1, 1.);
416417
rtrwTOF = udhelpers::rPVtrwTOF<true>(colTracks, col.numContrib());
417418
nCharge = udhelpers::netCharge<true>(colTracks);
418-
419-
updateUDTables(false, col.globalIndex(), bc.globalBC(), bc.runNumber(), col.posX(), col.posY(), col.posZ(),
419+
int upc_flag = 0;
420+
ushort flags = col.flags();
421+
if (flags & dataformats::Vertex<o2::dataformats::TimeStamp<int>>::Flags::UPCMode)
422+
upc_flag = 1;
423+
updateUDTables(false, col.globalIndex(), bc.globalBC(), bc.runNumber(), col.posX(), col.posY(), col.posZ(), upc_flag,
420424
col.numContrib(), nCharge, rtrwTOF, colTracks, fitInfo);
421425
}
422426
} else {
@@ -448,7 +452,7 @@ struct DGBCCandProducer {
448452
rtrwTOF = udhelpers::rPVtrwTOF<false>(tracksArray, tracksArray.size());
449453
nCharge = udhelpers::netCharge<false>(tracksArray);
450454

451-
updateUDTables(false, -1, bc.globalBC(), bc.runNumber(), -2., 2., -2,
455+
updateUDTables(false, -1, bc.globalBC(), bc.runNumber(), -2., 2., -2, 0,
452456
tracksArray.size(), nCharge, rtrwTOF, tracksArray, fitInfo);
453457
}
454458
}
@@ -494,7 +498,7 @@ struct DGBCCandProducer {
494498
rtrwTOF = udhelpers::rPVtrwTOF<false>(tracksArray, tracksArray.size());
495499
nCharge = udhelpers::netCharge<false>(tracksArray);
496500

497-
updateUDTables(false, -1, bcnum, tibc.runNumber(), -3., 3., -3,
501+
updateUDTables(false, -1, bcnum, tibc.runNumber(), -3., 3., -3, 0,
498502
tracksArray.size(), nCharge, rtrwTOF, tracksArray, fitInfo);
499503
}
500504
}
@@ -612,7 +616,11 @@ struct DGBCCandProducer {
612616
auto rtrwTOF = udhelpers::rPVtrwTOF<true>(colTracks, col.numContrib());
613617
auto nCharge = udhelpers::netCharge<true>(colTracks);
614618
udhelpers::getFITinfo(fitInfo, bc, bcs, ft0s, fv0as, fdds);
615-
updateUDTables(false, col.globalIndex(), bcnum, bc.runNumber(), col.posX(), col.posY(), col.posZ(),
619+
int upc_flag = 0;
620+
ushort flags = col.flags();
621+
if (flags & dataformats::Vertex<o2::dataformats::TimeStamp<int>>::Flags::UPCMode)
622+
upc_flag = 1;
623+
updateUDTables(false, col.globalIndex(), bcnum, bc.runNumber(), col.posX(), col.posY(), col.posZ(), upc_flag,
616624
col.numContrib(), nCharge, rtrwTOF, colTracks, fitInfo);
617625
// fill UDZdcs
618626
if (bc.has_zdc()) {
@@ -681,7 +689,11 @@ struct DGBCCandProducer {
681689
}
682690

683691
int64_t colID = withCollision ? col.globalIndex() : -1;
684-
updateUDTables(false, colID, bcnum, tibc.runNumber(), vpos[0], vpos[1], vpos[2],
692+
int upc_flag = 0;
693+
ushort flags = col.flags();
694+
if (flags & dataformats::Vertex<o2::dataformats::TimeStamp<int>>::Flags::UPCMode)
695+
upc_flag = 1;
696+
updateUDTables(false, colID, bcnum, tibc.runNumber(), vpos[0], vpos[1], vpos[2], upc_flag,
685697
tracksArray.size(), nCharge, rtrwTOF, tracksArray, fitInfo);
686698
// fill UDZdcs
687699
if (bc.globalBC() == bcnum) {

PWGUD/TableProducer/DGCandProducer.cxx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include "Framework/runDataProcessing.h"
1616
#include "Framework/AnalysisTask.h"
17+
#include "ReconstructionDataFormats/Vertex.h"
1718
#include "PWGUD/DataModel/UDTables.h"
1819
#include "PWGUD/Core/UPCHelpers.h"
1920
#include "PWGUD/Core/DGSelector.h"
@@ -269,8 +270,12 @@ struct DGCandProducer {
269270

270271
// update DG candidates tables
271272
auto rtrwTOF = udhelpers::rPVtrwTOF<true>(tracks, collision.numContrib());
273+
int upc_flag = 0;
274+
ushort flags = collision.flags();
275+
if (flags & dataformats::Vertex<o2::dataformats::TimeStamp<int>>::Flags::UPCMode)
276+
upc_flag = 1;
272277
outputCollisions(bc.globalBC(), bc.runNumber(),
273-
collision.posX(), collision.posY(), collision.posZ(),
278+
collision.posX(), collision.posY(), collision.posZ(), upc_flag,
274279
collision.numContrib(), udhelpers::netCharge<true>(tracks),
275280
rtrwTOF);
276281
outputCollisionsSels(fitInfo.ampFT0A, fitInfo.ampFT0C, fitInfo.timeFT0A, fitInfo.timeFT0C,

PWGUD/TableProducer/SGCandProducer.cxx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <cmath>
1313
#include "Framework/ASoA.h"
1414
#include "Framework/AnalysisDataModel.h"
15+
#include "ReconstructionDataFormats/Vertex.h"
1516
#include "Common/CCDB/EventSelectionParams.h"
1617
#include "Common/DataModel/EventSelection.h"
1718
#include "CommonConstants/LHCConstants.h"
@@ -213,10 +214,15 @@ struct SGCandProducer {
213214
upchelpers::FITInfo fitInfo{};
214215
udhelpers::getFITinfo(fitInfo, newbc, bcs, ft0s, fv0as, fdds);
215216
// update SG candidates tables
217+
int upc_flag = 0;
218+
ushort flags = collision.flags();
219+
if (flags & dataformats::Vertex<o2::dataformats::TimeStamp<int>>::Flags::UPCMode)
220+
upc_flag = 1;
216221
outputCollisions(bc.globalBC(), bc.runNumber(),
217-
collision.posX(), collision.posY(), collision.posZ(),
222+
collision.posX(), collision.posY(), collision.posZ(), upc_flag,
218223
collision.numContrib(), udhelpers::netCharge<true>(tracks),
219224
1.); // rtrwTOF); //omit the calculation to speed up the things while skimming
225+
220226
outputSGCollisions(issgevent);
221227
outputCollisionsSels(fitInfo.ampFT0A, fitInfo.ampFT0C, fitInfo.timeFT0A, fitInfo.timeFT0C,
222228
fitInfo.triggerMaskFT0,

0 commit comments

Comments
 (0)