Skip to content
Merged
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
56 changes: 28 additions & 28 deletions PWGDQ/Tasks/filterPPwithAssociation.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//
// Contact: iarsene@cern.ch, i.c.arsene@fys.uio.no
//
#include <iostream>

Check warning on line 14 in PWGDQ/Tasks/filterPPwithAssociation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[include-iostream]

Do not include iostream. Use O2 logging instead.
#include <vector>
#include <map>
#include <string>
Expand Down Expand Up @@ -107,7 +107,7 @@
aod::pidTOFFullKa, aod::pidTOFFullPr>;
using MyBarrelTracksTPCPID = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA,
aod::pidTPCFullEl, aod::pidTPCFullPi,
aod::pidTPCFullKa, aod::pidTPCFullPr>;
aod::pidTPCFullKa, aod::pidTPCFullPr>;

using MyBarrelTracksAssocSelected = soa::Join<TrackAssoc, aod::DQBarrelTrackCuts, aod::DQEMuBarrelTrackCuts>; // As the kinelatic values must be re-computed for the tracks everytime it is associated to a collision, the selection is done not on the tracks, but on the track-collision association

Expand All @@ -125,7 +125,7 @@
void PrintBitMap(TMap map, int nbits)
{
for (int i = 0; i < nbits; i++) {
cout << ((map & (TMap(1) << i)) > 0 ? "1" : "0");

Check warning on line 128 in PWGDQ/Tasks/filterPPwithAssociation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
}
}

Expand Down Expand Up @@ -260,12 +260,12 @@
fHistMan->SetDefaultVarNames(VarManager::fgVariableNames, VarManager::fgVariableUnits);

TString cutNames = "TrackBarrel_BeforeCuts;";
for (auto& cut : fTrackCuts) {

Check warning on line 263 in PWGDQ/Tasks/filterPPwithAssociation.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.
cutNames += Form("TrackBarrel_%s;", cut.GetName());
fCutHistNames.push_back(Form("TrackBarrel_%s", cut.GetName()));
}

DefineHistograms(fHistMan, cutNames.Data(), fConfigHistClasses.value); // define all histograms
DefineHistograms(fHistMan, cutNames.Data(), fConfigHistClasses.value); // define all histograms
VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill
fOutputList.setObject(fHistMan->GetMainHistogramList());

Expand Down Expand Up @@ -305,7 +305,7 @@

// material correction for track propagation
// o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT;
//o2::base::Propagator::MatCorrType noMatCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE;
// o2::base::Propagator::MatCorrType noMatCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE;

uint32_t filterMap = static_cast<uint32_t>(0);
uint32_t filterMapEMu = static_cast<uint32_t>(0);
Expand All @@ -313,7 +313,7 @@
emuSel.reserve(tracksBarrel.size());

VarManager::ResetValues(0, VarManager::kNBarrelTrackVariables);
for (auto& trackAssoc : trackAssocs) {

Check warning on line 316 in PWGDQ/Tasks/filterPPwithAssociation.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.
filterMap = static_cast<uint32_t>(0);
filterMapEMu = static_cast<uint32_t>(0);

Expand All @@ -322,7 +322,7 @@
VarManager::FillTrack<TTrackFillMap>(track);
// compute quantities which depend on the associated collision, such as DCA
if (fPropTrack && (track.collisionId() != collision.globalIndex())) {
VarManager::FillTrackCollision<TTrackFillMap>(track, collision);
VarManager::FillTrackCollision<TTrackFillMap>(track, collision);
}
if (fConfigQA) {
fHistMan->FillHistClass("TrackBarrel_BeforeCuts", VarManager::fgValues);
Expand All @@ -349,7 +349,7 @@

void processSelection(Collisions const& collisions, aod::BCsWithTimestamps const& bcs, MyBarrelTracks const& tracks, aod::TrackAssoc const& trackAssocs)
{
for (auto& collision : collisions) {

Check warning on line 352 in PWGDQ/Tasks/filterPPwithAssociation.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.
auto trackIdsThisCollision = trackAssocs.sliceBy(barrelTrackIndicesPerCollision, collision.globalIndex());
runTrackSelection<gkTrackFillMap>(collision, bcs, tracks, trackIdsThisCollision);
}
Expand All @@ -357,7 +357,7 @@

void processSelectionTPCPID(Collisions const& collisions, aod::BCsWithTimestamps const& bcs, MyBarrelTracksTPCPID const& tracks, aod::TrackAssoc const& trackAssocs)
{
for (auto& collision : collisions) {

Check warning on line 360 in PWGDQ/Tasks/filterPPwithAssociation.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.
auto trackIdsThisCollision = trackAssocs.sliceBy(barrelTrackIndicesPerCollision, collision.globalIndex());
runTrackSelection<gkTrackFillMapTPCPID>(collision, bcs, tracks, trackIdsThisCollision);
}
Expand Down Expand Up @@ -440,7 +440,7 @@
fCutHistNames.push_back(Form("Muon_%s", fTrackCuts[i].GetName()));
}

DefineHistograms(fHistMan, cutNames.Data(), fConfigHistClasses.value); // define all histograms
DefineHistograms(fHistMan, cutNames.Data(), fConfigHistClasses.value); // define all histograms
VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill
fOutputList.setObject(fHistMan->GetMainHistogramList());
}
Expand Down Expand Up @@ -468,7 +468,7 @@

VarManager::ResetValues(0, VarManager::kNMuonTrackVariables);

for (auto& muonAssoc : muonAssocs) {

Check warning on line 471 in PWGDQ/Tasks/filterPPwithAssociation.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.
filterMap = static_cast<uint32_t>(0);
filterMapEMu = static_cast<uint32_t>(0);
auto muon = muonAssoc.template fwdtrack_as<TMuons>();
Expand Down Expand Up @@ -558,9 +558,9 @@
std::map<uint64_t, uint64_t> fFiltersMap; // map of filters for events that passed at least one filter
std::map<uint64_t, std::vector<bool>> fCEFPfilters; // map of CEFP filters for events that passed at least one filter

uint32_t fPairingLSBarrel; // used to set in which cut setting LS pairs will be analysed
uint32_t fPairingLSMuon; // used to set in which cut setting LS pairs will be analysed
uint32_t fPairingLSBarrelMuon; // used to set in which cut setting LS pairs will be analysed
uint32_t fPairingLSBarrel; // used to set in which cut setting LS pairs will be analysed
uint32_t fPairingLSMuon; // used to set in which cut setting LS pairs will be analysed
uint32_t fPairingLSBarrelMuon; // used to set in which cut setting LS pairs will be analysed

void DefineCuts()
{
Expand Down Expand Up @@ -745,7 +745,7 @@
VarManager::ResetValues(0, VarManager::kNVars);
VarManager::FillEvent<TEventFillMap>(collision); // event properties could be needed for cuts or histogramming

std::vector<std::map<uint64_t,int>> taggedCollisions(fNBarrelCuts+fNMuonCuts+fNElectronMuonCuts); // collisions corresponding to selected associations or to which selected tracks are assigned in AO2D
std::vector<std::map<uint64_t, int>> taggedCollisions(fNBarrelCuts + fNMuonCuts + fNElectronMuonCuts); // collisions corresponding to selected associations or to which selected tracks are assigned in AO2D

std::vector<int> objCountersBarrel(fNBarrelCuts, 0); // init all counters to zero
uint32_t pairingMask = 0; // in order to know which of the selections actually require pairing
Expand All @@ -756,10 +756,10 @@
for (int i = 0; i < fNBarrelCuts; ++i) {
if (trackAssoc.isDQBarrelSelected() & (static_cast<uint32_t>(1) << i)) {
objCountersBarrel[i] += 1;
taggedCollisions[i][collision.globalIndex()] = 1; // add the current associated collision to the map
taggedCollisions[i][collision.globalIndex()] = 1; // add the current associated collision to the map
auto t1 = trackAssoc.template track_as<TTracks>();
if (t1.has_collision()) {
taggedCollisions[i][t1.collisionId()] = 1; // add the originally assigned collision to the map
taggedCollisions[i][t1.collisionId()] = 1; // add the originally assigned collision to the map
}
}
}
Expand All @@ -772,7 +772,7 @@
pairingMask |= (static_cast<uint32_t>(1) << i);
}
objCountersBarrel[i] = 0; // reset counters for selections where pairing is needed (count pairs instead)
taggedCollisions[i].clear(); // empty the list of tagged collisions if pairing is needed (so we count just events with pairs or containing selected pair legs)
taggedCollisions[i].clear(); // empty the list of tagged collisions if pairing is needed (so we count just events with pairs or containing selected pair legs)
}
}

Expand Down Expand Up @@ -808,12 +808,12 @@
continue;
}

taggedCollisions[icut][collision.globalIndex()] = 1; // add the originally assigned collision to the map
taggedCollisions[icut][collision.globalIndex()] = 1; // add the originally assigned collision to the map
if (t1.has_collision()) {
taggedCollisions[icut][t1.collisionId()] = 1; // add the originally assigned collision to the map
taggedCollisions[icut][t1.collisionId()] = 1; // add the originally assigned collision to the map
}
if (t2.has_collision()) {
taggedCollisions[icut][t2.collisionId()] = 1; // add the originally assigned collision to the map
taggedCollisions[icut][t2.collisionId()] = 1; // add the originally assigned collision to the map
}

objCountersBarrel[icut] += 1; // count the pair
Expand All @@ -832,10 +832,10 @@
for (int i = 0; i < fNMuonCuts; ++i) {
if (muon.isDQMuonSelected() & (static_cast<uint32_t>(1) << i)) {
objCountersMuon[i] += 1;
taggedCollisions[i + fNBarrelCuts][collision.globalIndex()] = 1; // add the current associated collision to the map
taggedCollisions[i + fNBarrelCuts][collision.globalIndex()] = 1; // add the current associated collision to the map
auto t1 = muon.template fwdtrack_as<TMuons>();
if (t1.has_collision()) {
taggedCollisions[i + fNBarrelCuts][t1.collisionId()] = 1; // add the originally assigned collision to the map
taggedCollisions[i + fNBarrelCuts][t1.collisionId()] = 1; // add the originally assigned collision to the map
}
}
}
Expand All @@ -849,7 +849,7 @@
pairingMask |= (static_cast<uint32_t>(1) << i);
}
objCountersMuon[i] = 0; // reset counters for selections where pairing is needed (count pairs instead)
taggedCollisions[i + fNBarrelCuts].clear(); // empty the list of tagged collisions if pairing is needed (so we count just events with pairs or containing selected pair legs)
taggedCollisions[i + fNBarrelCuts].clear(); // empty the list of tagged collisions if pairing is needed (so we count just events with pairs or containing selected pair legs)
}
}

Expand Down Expand Up @@ -888,12 +888,12 @@
continue;
}

taggedCollisions[icut + fNBarrelCuts][collision.globalIndex()] = 1; // add the originally assigned collision to the map
taggedCollisions[icut + fNBarrelCuts][collision.globalIndex()] = 1; // add the originally assigned collision to the map
if (t1.has_collision()) {
taggedCollisions[icut + fNBarrelCuts][t1.collisionId()] = 1; // add the originally assigned collision to the map
taggedCollisions[icut + fNBarrelCuts][t1.collisionId()] = 1; // add the originally assigned collision to the map
}
if (t2.has_collision()) {
taggedCollisions[icut + fNBarrelCuts][t2.collisionId()] = 1; // add the originally assigned collision to the map
taggedCollisions[icut + fNBarrelCuts][t2.collisionId()] = 1; // add the originally assigned collision to the map
}

objCountersMuon[icut] += 1;
Expand All @@ -918,7 +918,7 @@
}
}
}

// run pairing if there is at least one selection that requires it
pairFilter = 0;
if (pairingMask > 0) {
Expand Down Expand Up @@ -948,12 +948,12 @@
continue;
}

taggedCollisions[icut + fNBarrelCuts + fNMuonCuts][collision.globalIndex()] = 1; // add the originally assigned collision to the map
taggedCollisions[icut + fNBarrelCuts + fNMuonCuts][collision.globalIndex()] = 1; // add the originally assigned collision to the map
if (t1.has_collision()) {
taggedCollisions[icut + fNBarrelCuts + fNMuonCuts][t1.collisionId()] = 1; // add the originally assigned collision to the map
taggedCollisions[icut + fNBarrelCuts + fNMuonCuts][t1.collisionId()] = 1; // add the originally assigned collision to the map
}
if (t2.has_collision()) {
taggedCollisions[icut + fNBarrelCuts + fNMuonCuts][t2.collisionId()] = 1; // add the originally assigned collision to the map
taggedCollisions[icut + fNBarrelCuts + fNMuonCuts][t2.collisionId()] = 1; // add the originally assigned collision to the map
}

objCountersElectronMuon[icut] += 1;
Expand All @@ -965,7 +965,7 @@
}
}
// compute the decisions and publish
uint64_t filter = 0;
uint64_t filter = 0;
if constexpr (static_cast<bool>(TTrackFillMap)) {
for (int i = 0; i < fNBarrelCuts; i++) {
if (objCountersBarrel[i] >= fBarrelNreqObjs[i]) {
Expand Down Expand Up @@ -1044,9 +1044,9 @@
} else { // this collision was already fired, possible via collision - track association; add as an OR the new decisions
fFiltersMap[collId] |= (static_cast<uint64_t>(1) << iTrig);
fCEFPfilters[collId][iTrig] = true;
}
}
}
}
}
}
return filter;
}
Expand Down Expand Up @@ -1116,7 +1116,7 @@
}
}

cout << "-------------------- In this TF, eventsFired / totalTriggered :: " << eventsFired << "/" << totalEventsTriggered << endl;

Check warning on line 1119 in PWGDQ/Tasks/filterPPwithAssociation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
}

void processFilterMuonPP(MyEventsSelected const& collisions,
Expand Down Expand Up @@ -1235,7 +1235,7 @@
}
}

cout << "-------------------- In this TF, eventsFired / totalTriggered :: " << eventsFired << "/" << totalEventsTriggered << endl;

Check warning on line 1238 in PWGDQ/Tasks/filterPPwithAssociation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
}

// TODO: dummy function for the case when no process function is enabled
Expand Down Expand Up @@ -1265,7 +1265,7 @@
// Define here the histograms for all the classes required in analysis.
//
std::unique_ptr<TObjArray> objArray(histClasses.Tokenize(";"));
for (Int_t iclass = 0; iclass < objArray->GetEntries(); ++iclass) {

Check warning on line 1268 in PWGDQ/Tasks/filterPPwithAssociation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
TString classStr = objArray->At(iclass)->GetName();
histMan->AddHistClass(classStr.Data());

Expand Down
Loading