Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
76 changes: 44 additions & 32 deletions PWGUD/Core/UDHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,14 +425,14 @@ bool cleanFDD(T& bc, float maxFITtime, float limitA, float limitC)
// lims[4]: FDDC

template <typename T>
bool cleanFIT(T& bc, float maxFITtime, std::vector<float> lims)
bool cleanFIT(T& bc, float maxFITtime, std::vector<float> const& lims)
{
return cleanFV0(bc, maxFITtime, lims[0]) &&
cleanFT0(bc, maxFITtime, lims[1], lims[2]) &&
cleanFDD(bc, maxFITtime, lims[3], lims[4]);
}
template <typename T>
bool cleanFITCollision(T& col, float maxFITtime, std::vector<float> lims)
bool cleanFITCollision(T& col, float maxFITtime, std::vector<float> const& lims)
{
bool isCleanFV0 = true;
if (col.has_foundFV0()) {
Expand All @@ -453,7 +453,7 @@ bool cleanFITCollision(T& col, float maxFITtime, std::vector<float> lims)

// -----------------------------------------------------------------------------
template <typename T>
bool cleanFITA(T& bc, float maxFITtime, std::vector<float> lims)
bool cleanFITA(T& bc, float maxFITtime, std::vector<float> const& lims)
{
return cleanFV0(bc, maxFITtime, lims[0]) &&
cleanFT0A(bc, maxFITtime, lims[1]) &&
Expand All @@ -462,7 +462,7 @@ bool cleanFITA(T& bc, float maxFITtime, std::vector<float> lims)

// -----------------------------------------------------------------------------
template <typename T>
bool cleanFITC(T& bc, float maxFITtime, std::vector<float> lims)
bool cleanFITC(T& bc, float maxFITtime, std::vector<float> const& lims)
{
return cleanFT0C(bc, maxFITtime, lims[2]) &&
cleanFDDC(bc, maxFITtime, lims[4]);
Expand Down Expand Up @@ -506,7 +506,7 @@ bool TCE(T& bc)

// -----------------------------------------------------------------------------
template <typename T>
bool TOR(T& bc, float maxFITtime, std::vector<float> lims)
bool TOR(T& bc, float maxFITtime, std::vector<float> const& lims)
{
auto torA = !cleanFT0A(bc, maxFITtime, lims[1]);
auto torC = !cleanFT0C(bc, maxFITtime, lims[2]);
Expand Down Expand Up @@ -565,27 +565,48 @@ inline void buildFT0FV0Words(TFT0 const& ft0, TFV0A const& fv0a,
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 >= 96) {
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];

if (c < 0 || c >= 112) {
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 >= 48) {
continue;
}

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

Expand Down Expand Up @@ -777,24 +798,15 @@ template <typename T>
bool goodCollision(T const& coll, DGCutparHolder const& diffCuts)
// Return true if collision is accepted according to user-chosen rules from event selection task
{
bool accepted = true;
std::vector<int> sels = diffCuts.collisionSel();
if (sels[0])
accepted = accepted && cutNoTimeFrameBorder(coll);
if (sels[1])
accepted = accepted && cutNoSameBunchPileup(coll);
if (sels[2])
accepted = accepted && cutNoITSROFrameBorder(coll);
if (sels[3])
accepted = accepted && cutIsGoodZvtxFT0vsPV(coll);
if (sels[4])
accepted = accepted && cutIsVertexITSTPC(coll);
if (sels[5])
accepted = accepted && cutIsVertexTRDmatched(coll);
if (sels[6])
accepted = accepted && cutIsVertexTOFmatched(coll);

return accepted;
auto const sels = diffCuts.collisionSel();

return (!sels[0] || cutNoTimeFrameBorder(coll)) &&
(!sels[1] || cutNoSameBunchPileup(coll)) &&
(!sels[2] || cutNoITSROFrameBorder(coll)) &&
(!sels[3] || cutIsGoodZvtxFT0vsPV(coll)) &&
(!sels[4] || cutIsVertexITSTPC(coll)) &&
(!sels[5] || cutIsVertexTRDmatched(coll)) &&
(!sels[6] || cutIsVertexTOFmatched(coll));
}

// -----------------------------------------------------------------------------
Expand Down
47 changes: 31 additions & 16 deletions PWGUD/DataModel/UDTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,28 +410,43 @@ DECLARE_SOA_TABLE(UDTracksLabels, "AOD", "UDTRACKLABEL",

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

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
DECLARE_SOA_COLUMN(Thr1W3, thr1W3, uint64_t); /// 1 MIP thresholds for FT0C ch 97 - 112 & FV0 0 - 47
DECLARE_SOA_COLUMN(Thr1W1, thr1W1, uint64_t); /// 1 MIP thresholds for FT0A ch 64 - ch 95 & FT0C ch 0 - ch 31
DECLARE_SOA_COLUMN(Thr1W2, thr1W2, uint64_t); /// 1 MIP thresholds for FT0C ch 32 - ch 95
DECLARE_SOA_COLUMN(Thr1W3, thr1W3, uint64_t); /// 1 MIP thresholds for FT0C ch 96 - 111 & FV0 0 - 47

DECLARE_SOA_COLUMN(Thr2W0, thr2W0, uint64_t); /// 2 MIP thresholds for FT0A ch 0 - ch 63
DECLARE_SOA_COLUMN(Thr2W1, thr2W1, uint64_t); /// 2 MIP thresholds for FT0A ch 63 - ch 96 & FT0C ch 0 - ch 31
DECLARE_SOA_COLUMN(Thr2W2, thr2W2, uint64_t); /// 2 MIP thresholds for FT0C ch 32 - ch 96
DECLARE_SOA_COLUMN(Thr2W3, thr2W3, uint64_t); /// 2 MIP thresholds for FT0C ch 97 - 112 & FV0 0 - 47
DECLARE_SOA_COLUMN(Thr2W1, thr2W1, uint64_t); /// 2 MIP thresholds for FT0A ch 64 - ch 95 & FT0C ch 0 - ch 31
DECLARE_SOA_COLUMN(Thr2W2, thr2W2, uint64_t); /// 2 MIP thresholds for FT0C ch 32 - ch 95
DECLARE_SOA_COLUMN(Thr2W3, thr2W3, uint64_t); /// 2 MIP thresholds for FT0C ch 96 - 111 & 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
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
);
udcollfitbits::Thr1W0,
udcollfitbits::Thr1W1,
udcollfitbits::Thr1W2,
udcollfitbits::Thr1W3,
udcollfitbits::Thr2W0,
udcollfitbits::Thr2W1,
udcollfitbits::Thr2W2,
udcollfitbits::Thr2W3);

DECLARE_SOA_TABLE_VERSIONED(UDCollisionFITBits_001, "AOD", "UDCOLLFITBITS", 1,
o2::soa::Index<>,
udcollfitbits::UDCollisionId,
udcollfitbits::Thr1W0,
udcollfitbits::Thr1W1,
udcollfitbits::Thr1W2,
udcollfitbits::Thr1W3,
udcollfitbits::Thr2W0,
udcollfitbits::Thr2W1,
udcollfitbits::Thr2W2,
udcollfitbits::Thr2W3);

using UDCollisionFITBits = UDCollisionFITBits_001;

using UDTrack = UDTracks::iterator;
using UDTrackCov = UDTracksCov::iterator;
Expand Down
4 changes: 4 additions & 0 deletions PWGUD/TableProducer/Converters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ o2physics_add_dpl_workflow(collisions-converter
SOURCES UDCollisionsConverter.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
COMPONENT_NAME Analysis)
o2physics_add_dpl_workflow(collision-fit-bits-converter
SOURCES UDCollisionFITBitsConverter.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(collisionselextras-converter
SOURCES UDCollisionSelExtrasConverter.cxx
Expand Down
61 changes: 61 additions & 0 deletions PWGUD/TableProducer/Converters/UDCollisionFITBitsConverter.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// 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 from version 000 to 001
///
/// The legacy table was written with exactly one FIT-bit row for every
/// UDCollision, in identical row order. Therefore row i of
/// UDCollisionFITBits_000 belongs to row i of UDCollisions. Because the
/// legacy table does not store this association explicitly, the converter
/// materialises it by writing the FIT-bit row's global index as
/// UDCollisionId. The eight packed FIT-bit words are copied unchanged.
///
/// Executable: o2-analysis-ud-collision-fit-bits-converter
///
/// \author Sandor Lokos, sandor.lokos@cern.ch

#include "PWGUD/DataModel/UDTables.h"

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

using namespace o2;
using namespace o2::framework;

struct UDCollisionFITBitsConverter {
Produces<aod::UDCollisionFITBits_001> outputFITBits;

void process(aod::UDCollisionFITBits_000 const& legacyFITBits)
{
outputFITBits.reserve(legacyFITBits.size());

for (const auto& bits : legacyFITBits) {
outputFITBits(bits.globalIndex(),
bits.thr1W0(),
bits.thr1W1(),
bits.thr1W2(),
bits.thr1W3(),
bits.thr2W0(),
bits.thr2W1(),
bits.thr2W2(),
bits.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
18 changes: 9 additions & 9 deletions PWGUD/Tasks/sgFITAnalyzer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -778,36 +778,36 @@ struct SGFITAnalyzer {
avPtPVa += track.pt();
vecEtaPVa.push_back(vtrk.Eta());
registry.get<TH1>(HIST("tracks/etaApv"))->Fill(vtrk.Eta(), 1.);
if (!an)
if (!an) {
registry.get<TH1>(HIST("tracks/eta2Apv"))->Fill(vtrk.Eta(), 1.);
if (!an)
z0pva++;
else if (an == 4)
} else if (an == 4) {
z1pva++;
}
}
if (truegapSide == 1) {
pvc++;
avPtPVc += track.pt();
vecEtaPVc.push_back(vtrk.Eta());
registry.get<TH1>(HIST("tracks/etaCpv"))->Fill(vtrk.Eta(), 1.);
if (!cn)
if (!cn) {
registry.get<TH1>(HIST("tracks/eta2Cpv"))->Fill(vtrk.Eta(), 1.);
if (!cn)
z0pvc++;
else if (cn == 4)
} else if (cn == 4) {
z1pvc++;
}
}
if (truegapSide == 2) {
pvac++;
avPtPVac += track.pt();
vecEtaPVac.push_back(vtrk.Eta());
registry.get<TH1>(HIST("tracks/etaACpv"))->Fill(vtrk.Eta(), 1.);
if (!an && !cn)
if (!an && !cn) {
registry.get<TH1>(HIST("tracks/eta2ACpv"))->Fill(vtrk.Eta(), 1.);
if (!an && !cn)
z0pvac++;
else if (an >= 3 && cn >= 3)
} else if (an >= 3 && cn >= 3) {
z1pvac++;
}
}
registry.get<TH2>(HIST("tracks/TPCSignalvspPVC"))->Fill(vtrk.Mag(), signalTPC, 1.);
registry.get<TH2>(HIST("tracks/TOFSignalvspPVC"))->Fill(vtrk.Mag(), signalTOF, 1.);
Expand Down
Loading
Loading