Skip to content
Closed
49 changes: 39 additions & 10 deletions PWGUD/Core/UDHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@

#include <CommonConstants/LHCConstants.h>
#include <DataFormatsFIT/Triggers.h>
#include <DataFormatsFT0/Digit.h>
#include <Framework/AnalysisDataModel.h>
#include <Framework/Logger.h>
#include <Framework/SliceCache.h>

#include <TLorentzVector.h>

Check failure on line 32 in PWGUD/Core/UDHelpers.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 <Rtypes.h>

Expand Down Expand Up @@ -560,32 +561,60 @@
thr1[0] = thr1[1] = thr1[2] = thr1[3] = 0ull;
thr2[0] = thr2[1] = thr2[2] = thr2[3] = 0ull;

constexpr int nChFT0A = 96;
constexpr int nChFT0C = 112;
constexpr int nChFV0A = 48;

constexpr int kFT0AOffset = 0;
constexpr int kFT0COffset = 96;
constexpr int kFV0Offset = 208;

auto ampsA = ft0.amplitudeA();
const int nA = std::min<int>(ampsA.size(), 96);
auto chanA = ft0.channelA();
const int nA = std::min<int>(ampsA.size(), chanA.size());

for (int i = 0; i < nA; ++i) {
const auto a = ampsA[i];
setBit(thr1, kFT0AOffset + i, a >= thr1_FT0A);
setBit(thr2, kFT0AOffset + i, a >= thr2_FT0A);
const int c = chanA[i];

if (c < 0 || c >= nChFT0A) {
continue;
}

setBit(thr1, kFT0AOffset + c, a >= thr1_FT0A);
setBit(thr2, kFT0AOffset + c, a >= thr2_FT0A);
}

auto ampsC = ft0.amplitudeC();
const int nC = std::min<int>(ampsC.size(), 112);
auto chanC = ft0.channelC();
const int nC = std::min<int>(ampsC.size(), chanC.size());

for (int i = 0; i < nC; ++i) {
const auto a = ampsC[i];
setBit(thr1, kFT0COffset + i, a >= thr1_FT0C);
setBit(thr2, kFT0COffset + i, a >= thr2_FT0C);
const int c = chanC[i]; // physical FT0C channel id

if (c < 0 || c >= nChFT0C) {
continue;
}

setBit(thr1, kFT0COffset + c, a >= thr1_FT0C);
setBit(thr2, kFT0COffset + c, a >= thr2_FT0C);
}

auto ampsV = fv0a.amplitude();
const int nV = std::min<int>(ampsV.size(), 48);
auto chanV = fv0a.channel();
const int nV = std::min<int>(ampsV.size(), chanV.size());

for (int i = 0; i < nV; ++i) {
const auto a = ampsV[i];
setBit(thr1, kFV0Offset + i, a >= thr1_FV0A);
setBit(thr2, kFV0Offset + i, a >= thr2_FV0A);
const int c = chanV[i];

if (c < 0 || c >= nChFV0A) {
continue;
}

setBit(thr1, kFV0Offset + c, a >= thr1_FV0A);
setBit(thr2, kFV0Offset + c, a >= thr2_FV0A);
}
}

Expand Down Expand Up @@ -664,7 +693,7 @@
double y = chPos.Y() + offsetFT0[i].getY();
double z = chPos.Z() + offsetFT0[i].getZ();

// If this channel belongs to FT0C, flip z (matches your original intent)
// If this channel belongs to FT0C, flip z
const bool isC = (ft0Ch >= kFT0AChannels);
if (isC) {
z = -z;
Expand Down Expand Up @@ -924,7 +953,7 @@
bool isPythiaCDE(T MCparts)
{
for (const auto& mcpart : MCparts) {
if (mcpart.pdgCode() == 9900110) {

Check failure on line 956 in PWGUD/Core/UDHelpers.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
return true;
}
}
Expand All @@ -940,9 +969,9 @@
if (MCparts.size() < 3) {
return false;
} else {
if (MCparts.iteratorAt(0).pdgCode() != 443013)

Check failure on line 972 in PWGUD/Core/UDHelpers.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
return false;
if (std::abs(MCparts.iteratorAt(1).pdgCode()) != 13)

Check failure on line 974 in PWGUD/Core/UDHelpers.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
return false;
if (MCparts.iteratorAt(2).pdgCode() != -MCparts.iteratorAt(1).pdgCode())
return false;
Expand Down Expand Up @@ -984,11 +1013,11 @@
if (MCparts.size() < 6) {
return false;
} else {
if (MCparts.iteratorAt(0).pdgCode() != 2212)

Check failure on line 1016 in PWGUD/Core/UDHelpers.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
return false;
if (MCparts.iteratorAt(1).pdgCode() != 2212)

Check failure on line 1018 in PWGUD/Core/UDHelpers.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
return false;
if (MCparts.iteratorAt(2).pdgCode() != 2212)

Check failure on line 1020 in PWGUD/Core/UDHelpers.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
return false;
if (MCparts.iteratorAt(3).pdgCode() != 2212)
return false;
Expand Down Expand Up @@ -1029,13 +1058,13 @@
// -----------------------------------------------------------------------------
// Invariant mass of GRANIITTI generated event
template <typename T>
TLorentzVector ivmGraniittiCDE(T MCparts)

Check failure on line 1061 in PWGUD/Core/UDHelpers.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.
{
TLorentzVector ivm = TLorentzVector(0., 0., 0., 0.);

Check failure on line 1063 in PWGUD/Core/UDHelpers.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.

// is this a GRANIITTI generated event?
if (isGraniittiCDE(MCparts)) {
TLorentzVector lvtmp;

Check failure on line 1067 in PWGUD/Core/UDHelpers.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.

for (int ii = 7; ii < MCparts.size(); ii++) {
auto mcPart = MCparts.iteratorAt(ii);
Expand Down
19 changes: 18 additions & 1 deletion PWGUD/DataModel/UDTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@ DECLARE_SOA_TABLE(UDTracksLabels, "AOD", "UDTRACKLABEL",

namespace udcollfitbits
{
DECLARE_SOA_INDEX_COLUMN(UDCollision, udCollision); /// Link to the UDCOLLISION table, only in version 1

DECLARE_SOA_COLUMN(Thr1W0, thr1W0, uint64_t); /// 1 MIP thresholds for FT0A ch 0 - ch 63
DECLARE_SOA_COLUMN(Thr1W1, thr1W1, uint64_t); /// 1 MIP thresholds for FT0A ch 64 - ch 96 & FT0C ch 0 - ch 31
DECLARE_SOA_COLUMN(Thr1W2, thr1W2, uint64_t); /// 1 MIP thresholds for FT0C ch 32 - ch 96
Expand All @@ -421,7 +423,7 @@ DECLARE_SOA_COLUMN(Thr2W2, thr2W2, uint64_t); /// 2 MIP thresholds for FT0C ch 3
DECLARE_SOA_COLUMN(Thr2W3, thr2W3, uint64_t); /// 2 MIP thresholds for FT0C ch 97 - 112 & FV0 0 - 47
} // namespace udcollfitbits

DECLARE_SOA_TABLE(UDCollisionFITBits, "AOD", "UDCOLLFITBITS",
DECLARE_SOA_TABLE(UDCollisionFITBits_000, "AOD", "UDCOLLFITBITS",
o2::soa::Index<>,
udcollfitbits::Thr1W0, /// 1 MIP thresholds for FT0A ch 0 - ch 63
udcollfitbits::Thr1W1, /// 1 MIP thresholds for FT0A ch 63 - ch 96 & FT0C ch 0 - ch 31
Expand All @@ -433,6 +435,21 @@ DECLARE_SOA_TABLE(UDCollisionFITBits, "AOD", "UDCOLLFITBITS",
udcollfitbits::Thr2W3 /// 2 MIP thresholds for FT0C ch 97 - 112 & FV0 0 - 47
);

DECLARE_SOA_TABLE_VERSIONED(UDCollisionFITBits_001, "AOD", "UDCOLLFITBITS", 1,
o2::soa::Index<>,
udcollfitbits::UDCollisionId, /// Link to the UDCOLLISION table <---- EXTRA
udcollfitbits::Thr1W0, /// 1 MIP thresholds for FT0A ch 0 - ch 63
udcollfitbits::Thr1W1, /// 1 MIP thresholds for FT0A ch 63 - ch 96 & FT0C ch 0 - ch 31
udcollfitbits::Thr1W2, /// 1 MIP thresholds for FT0C ch 32 - ch 96
udcollfitbits::Thr1W3, /// 1 MIP thresholds for FT0C ch 97 - 112 & FV0 0 - 47
udcollfitbits::Thr2W0, /// 2 MIP thresholds for FT0A ch 0 - ch 63
udcollfitbits::Thr2W1, /// 2 MIP thresholds for FT0A ch 63 - ch 96 & FT0C ch 0 - ch 31
udcollfitbits::Thr2W2, /// 2 MIP thresholds for FT0C ch 32 - ch 96
udcollfitbits::Thr2W3 /// 2 MIP thresholds for FT0C ch 97 - 112 & FV0 0 - 47
);

using UDCollisionFITBits = UDCollisionFITBits_001;

using UDTrack = UDTracks::iterator;
using UDTrackCov = UDTracksCov::iterator;
using UDTrackExtra = UDTracksExtra::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 @@ -34,3 +34,8 @@ o2physics_add_dpl_workflow(collisionselextras-converter-v003
SOURCES UDCollisionSelExtrasV003Converter.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(fit-bits-converter
SOURCES UDFITbitConverter.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
COMPONENT_NAME Analysis)
63 changes: 63 additions & 0 deletions PWGUD/TableProducer/Converters/UDFITbitConverter.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// 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 UDCollisionFITBitsConverter.cxx
/// \brief Converts UDCollisionFITBits table from version 000 to 001
///
/// This task converts the UDCollisionFITBits table from version 000,
/// without an explicit UDCollisionId link, to version 001, which includes
/// the UDCollisionId column.
///
/// The conversion assumes the version-000 table has one row per UDCollision
/// and follows the same ordering as the UDCollisions table.
///
/// executable name o2-analysis-ud-fit-bits-converter
///
/// \author Sandor Lokos <sandor.lokos@cern.ch>

#include "PWGUD/DataModel/UDTables.h"

#include <Framework/AnalysisDataModel.h>
#include <Framework/AnalysisHelpers.h>
#include <Framework/AnalysisTask.h>
#include <Framework/runDataProcessing.h>

using namespace o2;
using namespace o2::framework;

// Converts UDCollisionFITBits from version 000 to 001
struct UDCollisionFITBitsConverter {
Produces<o2::aod::UDCollisionFITBits_001> udCollisionFITBits_001;

void process(o2::aod::UDCollisionFITBits_000 const& fitBits)
{
udCollisionFITBits_001.reserve(fitBits.size());

for (const auto& fitBit : fitBits) {
udCollisionFITBits_001(fitBit.globalIndex(), // UDCollisionId; version 000 has no explicit link
fitBit.thr1W0(),
fitBit.thr1W1(),
fitBit.thr1W2(),
fitBit.thr1W3(),
fitBit.thr2W0(),
fitBit.thr2W1(),
fitBit.thr2W2(),
fitBit.thr2W3());
}
}
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
return WorkflowSpec{
adaptAnalysisTask<UDCollisionFITBitsConverter>(cfgc),
};
}
3 changes: 2 additions & 1 deletion PWGUD/TableProducer/SGCandProducer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,8 @@ struct SGCandProducer {
fitCuts.thr2_FV0A());
}

outputFITBits(w1[0], w1[1], w1[2], w1[3],
outputFITBits(outputCollisions.lastIndex(),
w1[0], w1[1], w1[2], w1[3],
w2[0], w2[1], w2[2], w2[3]);

if (newbc.has_zdc()) {
Expand Down
5 changes: 5 additions & 0 deletions PWGUD/Tasks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,11 @@ o2physics_add_dpl_workflow(upc-test-fit-bit-mapping
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(fit-multiplicity
SOURCES upcFITMultiplicity.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(pt-spectra-inclusive-upc
SOURCES ptSpectraInclusiveUpc.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
Expand Down
Loading
Loading