Skip to content
Open
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
41 changes: 41 additions & 0 deletions PWGUD/TableProducer/UPCCandidateProducer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "PWGUD/DataModel/UDTables.h"

#include "Common/CCDB/EventSelectionParams.h"
#include "Common/CCDB/RCTSelectionFlags.h"
#include "Common/DataModel/EventSelection.h"
#include "Common/DataModel/PIDResponseTOF.h"
#include "Common/DataModel/PIDResponseTPC.h"
Expand Down Expand Up @@ -50,13 +51,15 @@
#include <limits>
#include <map>
#include <numeric>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace o2::framework;
using namespace o2::framework::expressions;
using namespace o2::aod::rctsel;

struct UpcCandProducer {
bool fDoMC{false};
Expand Down Expand Up @@ -91,6 +94,9 @@
std::vector<bool> fwdSelectors;
std::vector<bool> barrelSelectors;

// RCT flag checker
RCTFlagsChecker myRCTChecker;

// skimmer flags
// choose a source of signal MC events
Configurable<int> fSignalGenID{"signalGenID", 1, "Signal generator ID"};
Expand Down Expand Up @@ -125,9 +131,15 @@
Configurable<bool> fRequireNoTimeFrameBorder{"requireNoTimeFrameBorder", true, "Require kNoTimeFrameBorder selection bit"};
Configurable<bool> fRequireNoITSROFrameBorder{"requireNoITSROFrameBorder", true, "Require kNoITSROFrameBorder selection bit"};

Configurable<std::string> rctLabel{"rctLabel", "CBT_muon", "RCT label to use, options: CBT, CBT_hadronPID, CBT_electronPID, CBT_calo, CBT_muon, CBT_muon_glo"};
Configurable<bool> checkZDC{"checkZDC", false, "Consider ZDC quality"};
Configurable<bool> useLAasBad{"useLAasBad", false, "Consider Lim acc flag as Bad"};

// QA histograms
HistogramRegistry histRegistry{"HistRegistry", {}, OutputObjHandlingPolicy::AnalysisObject};

using CollisionsSels = o2::soa::Join<o2::aod::Collisions, o2::aod::EvSels>;

using BCsWithBcSels = o2::soa::Join<o2::aod::BCs, o2::aod::BcSels, o2::aod::BCFlags>;

using ForwardTracks = o2::soa::Join<o2::aod::UDFwdTracksProp, o2::aod::UDFwdTracksCovProp>;
Expand All @@ -146,6 +158,9 @@

upcCuts = (UPCCutparHolder)inputCuts;

// initialize RCT flag checker
myRCTChecker.init(rctLabel.value, checkZDC.value, useLAasBad.value);

const AxisSpec axisTrgCounters{10, 0.5, 10.5, ""};
histRegistry.add("hCountersTrg", "", kTH1F, {axisTrgCounters});
histRegistry.get<TH1>(HIST("hCountersTrg"))->GetXaxis()->SetBinLabel(1, "TCE");
Expand Down Expand Up @@ -179,6 +194,11 @@
histRegistry.get<TH1>(HIST("BarrelsSelCounter"))->GetXaxis()->SetBinLabel(upchelpers::kBarrelSelTPCChi2 + 1, "TPCChi2");
histRegistry.get<TH1>(HIST("BarrelsSelCounter"))->GetXaxis()->SetBinLabel(upchelpers::kBarrelSelDCAXY + 1, "DCAXY");
histRegistry.get<TH1>(HIST("BarrelsSelCounter"))->GetXaxis()->SetBinLabel(upchelpers::kBarrelSelDCAZ + 1, "DCAZ");

histRegistry.add("RCTSelCounter", "RCTSelCounter", kTH1F, {{3, 0.5, 3.5}});
histRegistry.get<TH1>(HIST("RCTSelCounter"))->GetXaxis()->SetBinLabel(1, "Before RCT sel");
histRegistry.get<TH1>(HIST("RCTSelCounter"))->GetXaxis()->SetBinLabel(2, "After RCT sel");
histRegistry.get<TH1>(HIST("RCTSelCounter"))->GetXaxis()->SetBinLabel(3, "RCT rejected");
}

template <typename T>
Expand Down Expand Up @@ -251,7 +271,7 @@
return false;
if (upcCuts.getCheckMaxDcaXY()) {
float dca = track.dcaXY();
float maxDCA = 0.0105f + 0.0350f / pow(track.pt(), 1.1f);

Check failure on line 274 in PWGUD/TableProducer/UPCCandidateProducer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
if (dca > maxDCA)
return false;
}
Expand Down Expand Up @@ -350,7 +370,7 @@
// collecting new mother IDs
if (mcPart.has_mothers()) {
const auto& motherIDs = mcPart.mothersIds();
for (auto motherID : motherIDs) {

Check failure on line 373 in PWGUD/TableProducer/UPCCandidateProducer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (motherID >= nMCParticles) {
continue;
}
Expand Down Expand Up @@ -401,7 +421,7 @@
uint64_t globalBC, uint64_t closestBcMCH,
const o2::aod::McFwdTrackLabels* mcTrackLabels)
{
for (auto trackID : trackIDs) {

Check failure on line 424 in PWGUD/TableProducer/UPCCandidateProducer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
const auto& track = tracks.iteratorAt(trackID);
double trTime = track.trackTime();
double mchmidChi2 = track.chi2MatchMCHMID();
Expand Down Expand Up @@ -438,9 +458,9 @@
clustersPerTrack[cls.fwdtrackId()].push_back(cls.globalIndex());
}
int newId = 0;
for (auto trackId : trackIds) {

Check failure on line 461 in PWGUD/TableProducer/UPCCandidateProducer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
const auto& clusters = clustersPerTrack.at(trackId);
for (auto clsId : clusters) {

Check failure on line 463 in PWGUD/TableProducer/UPCCandidateProducer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
const auto& clsInfo = fwdTrkCls.iteratorAt(clsId);
udFwdTrkClusters(newId, clsInfo.x(), clsInfo.y(), clsInfo.z(), clsInfo.clInfo());
}
Expand All @@ -456,7 +476,7 @@
const o2::aod::McTrackLabels* mcTrackLabels,
std::unordered_map<int64_t, uint64_t>& /*ambBarrelTrBCs*/)
{
for (auto trackID : trackIDs) {

Check failure on line 479 in PWGUD/TableProducer/UPCCandidateProducer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
const auto& track = tracks.iteratorAt(trackID);
double trTime = track.trackTime() - std::round(track.trackTime() / o2::constants::lhc::LHCBunchSpacingNS) * o2::constants::lhc::LHCBunchSpacingNS;
int64_t colId = track.collisionId() >= 0 ? track.collisionId() : -1;
Expand Down Expand Up @@ -531,10 +551,10 @@
const auto& ampsA = ft0.amplitudeA();
const auto& ampsC = ft0.amplitudeC();
fitInfo.ampFT0A = 0.;
for (auto amp : ampsA)

Check failure on line 554 in PWGUD/TableProducer/UPCCandidateProducer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
fitInfo.ampFT0A += amp;
fitInfo.ampFT0C = 0.;
for (auto amp : ampsC)

Check failure on line 557 in PWGUD/TableProducer/UPCCandidateProducer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
fitInfo.ampFT0C += amp;
fitInfo.triggerMaskFT0 = ft0.triggerMask();
}
Expand All @@ -543,7 +563,7 @@
fitInfo.timeFV0A = fv0a.time();
const auto& amps = fv0a.amplitude();
fitInfo.ampFV0A = 0.;
for (auto amp : amps)

Check failure on line 566 in PWGUD/TableProducer/UPCCandidateProducer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
fitInfo.ampFV0A += amp;
fitInfo.triggerMaskFV0A = fv0a.triggerMask();
}
Expand All @@ -554,7 +574,7 @@
const auto& ampsA = fdd.chargeA();
const auto& ampsC = fdd.chargeC();
fitInfo.ampFDDA = 0.;
for (auto amp : ampsA) {

Check failure on line 577 in PWGUD/TableProducer/UPCCandidateProducer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
fitInfo.ampFDDA += amp;
}
fitInfo.ampFDDC = 0.;
Expand Down Expand Up @@ -682,6 +702,13 @@
uint64_t trackBC = 0;
if (trk.has_collision()) {
const auto& col = trk.collision();
auto bcRCT = col.bc_as<TBCs>();
histRegistry.get<TH1>(HIST("RCTSelCounter"))->Fill(1);
if (!myRCTChecker(bcRCT)) {
histRegistry.get<TH1>(HIST("RCTSelCounter"))->Fill(3);
continue;
}
histRegistry.get<TH1>(HIST("RCTSelCounter"))->Fill(2);
nContrib = col.numContrib();
trackBC = col.bc_as<TBCs>().globalBC();
hasTrackBC = true;
Expand Down Expand Up @@ -725,6 +752,13 @@
if (!trk.has_collision())
continue;
const auto& col = trk.collision();
auto bcRCT = col.bc_as<TBCs>();
histRegistry.get<TH1>(HIST("RCTSelCounter"))->Fill(1);
if (!myRCTChecker(bcRCT)) {
histRegistry.get<TH1>(HIST("RCTSelCounter"))->Fill(3);
continue;
}
histRegistry.get<TH1>(HIST("RCTSelCounter"))->Fill(2);
nContrib = col.numContrib();
trackBC = col.bc_as<TBCs>().globalBC();
hasTrackBC = true;
Expand Down Expand Up @@ -765,6 +799,13 @@
if (!trk.has_collision())
continue;
const auto& col = trk.collision();
auto bcRCT = col.bc_as<TBCs>();
histRegistry.get<TH1>(HIST("RCTSelCounter"))->Fill(1);
if (!myRCTChecker(bcRCT)) {
histRegistry.get<TH1>(HIST("RCTSelCounter"))->Fill(3);
continue;
}
histRegistry.get<TH1>(HIST("RCTSelCounter"))->Fill(2);
nContrib = col.numContrib();
trackBC = col.bc_as<TBCs>().globalBC();
const auto& bc = col.bc_as<TBCs>();
Expand Down
Loading