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
2 changes: 1 addition & 1 deletion Tutorials/PWGCF/EventPlane/src/qVectorstutorial.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in Tutorials/PWGCF/EventPlane/src/qVectorstutorial.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/workflow-file]

Name of a workflow file must match the name of the main struct in it (without the PWG prefix). (Class implementation files should be in "Core" directories.)
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand Down Expand Up @@ -98,7 +98,7 @@
}

template <typename TrackType>
bool SelTrack(const TrackType track)
bool SelTrack(const TrackType& track)
{
if (track.pt() < cfgMinPt)
return false;
Expand All @@ -125,7 +125,7 @@
template <typename CollType>
void fillHistosQvec(const CollType& collision, int nmode)
{
if (nmode == 2) {

Check failure on line 128 in Tutorials/PWGCF/EventPlane/src/qVectorstutorial.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histosQA.fill(HIST("histQvecV2"), collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], collision.centFT0C());
histosQA.fill(HIST("histEvtPlV2"), helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), collision.centFT0C());
histosQA.fill(HIST("histQvecRes_SigRefAV2"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), collision.centFT0C());
Expand All @@ -135,14 +135,14 @@
template <typename CollType, typename TrackType>
void fillHistosFlow(const CollType& collision, const TrackType& track, int nmode)
{
if (collision.sumAmplFT0C() < 1e-4) {

Check failure on line 138 in Tutorials/PWGCF/EventPlane/src/qVectorstutorial.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return;
}
for (auto& trk : track) {

Check failure on line 141 in Tutorials/PWGCF/EventPlane/src/qVectorstutorial.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 (!SelTrack(trk)) {
continue;
}
if (nmode == 2) {

Check failure on line 145 in Tutorials/PWGCF/EventPlane/src/qVectorstutorial.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histosQA.fill(HIST("histCosDetV2"), collision.centFT0C(), trk.pt(),
std::cos(static_cast<float>(nmode) * (trk.phi() - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode))));
}
Expand Down
4 changes: 2 additions & 2 deletions Tutorials/PWGEM/Cocktail/plotLFCocktail.C
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ TString histLegends[nHists] = {
"#phi#rightarrow#etae^{+}e^{-}, #phi#rightarrow#pi^{0}e^{+}e^{-}, "
"#phi#rightarrowe^{+}e^{-}"};

void loadHistos(TFile* file, TH1F* hists[], TString name_extra, int rebin,
void loadHistos(TFile* file, TH1F* hists[], const TString& name_extra, int rebin,
int nEvents)
{
for (int i = 0; i < nHists; i++) {
Expand All @@ -42,7 +42,7 @@ void loadHistos(TFile* file, TH1F* hists[], TString name_extra, int rebin,
}
}

void plotLFCocktail(TString filename = "AnalysisResults.root", int rebin = 1)
void plotLFCocktail(const TString& filename = "AnalysisResults.root", int rebin = 1)
{

TFile* file = TFile::Open(filename.Data());
Expand Down
2 changes: 1 addition & 1 deletion Tutorials/PWGLF/Resonance/resonancesCombine.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <Framework/OutputObjHeader.h>
#include <Framework/runDataProcessing.h>

#include <TLorentzVector.h>

Check failure on line 32 in Tutorials/PWGLF/Resonance/resonancesCombine.cxx

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.

using namespace o2;
using namespace o2::framework;
Expand Down Expand Up @@ -93,7 +93,7 @@
}

template <typename TrackType>
bool trackCut(const TrackType track)
bool trackCut(const TrackType& track)
{
if (std::abs(track.pt()) < cMinPtcut)
return false;
Expand Down Expand Up @@ -122,7 +122,7 @@
}

double rapidity, mass, pT, paircharge;
TLorentzVector daughter1, daughter2, mother;

Check failure on line 125 in Tutorials/PWGLF/Resonance/resonancesCombine.cxx

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.
template <bool IsMC, bool IsMix, typename CollisionType, typename TracksType>
void fillHistograms(const CollisionType& collision, const TracksType& dTracks1, const TracksType& dTracks2)
{
Expand Down Expand Up @@ -159,7 +159,7 @@
rapidity = mother.Rapidity();
paircharge = track1Reso.sign() * track2Reso.sign();

if (std::abs(rapidity) > 0.5)

Check failure on line 162 in Tutorials/PWGLF/Resonance/resonancesCombine.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
continue;

if (paircharge < 0) {
Expand Down Expand Up @@ -187,9 +187,9 @@
// Event plane
auto collisionQvec = collision.template collision_as<aod::Qvectors>(); // Qvectors table is not in the ResoCollisions table (Important)
auto evtPl = -999.0;
if (collisionQvec.qvecAmp()[evtPlDetId] > 1e-8)

Check failure on line 190 in Tutorials/PWGLF/Resonance/resonancesCombine.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
evtPl = helperEP.GetEventPlane(collisionQvec.qvecRe()[evtPlDetId * 4 + 3], collisionQvec.qvecIm()[evtPlDetId * 4 + 3], 2);
if (evtPl > -999.0)

Check failure on line 192 in Tutorials/PWGLF/Resonance/resonancesCombine.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("hEvtPl"), evtPl);

fillHistograms<false, false>(collision, resotracks, resotracks);
Expand Down
2 changes: 1 addition & 1 deletion Tutorials/PWGLF/Resonance/resonancesMicrotrack.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ struct ResonancesMicrotrack {
}

template <bool IsResoMicrotrack, typename TrackType>
bool trackCut(const TrackType track)
bool trackCut(const TrackType& track)
{
if constexpr (!IsResoMicrotrack) {
if (std::abs(track.pt()) < cMinPtcut)
Expand Down
4 changes: 2 additions & 2 deletions Tutorials/PWGLF/Resonance/resonances_step0.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct resonances_tutorial {

// Track selection
template <typename TrackType>
bool trackCut(const TrackType track)
bool trackCut(const TrackType& track)
{
// basic track cuts
if (std::abs(track.pt()) < cMinPtcut)
Expand All @@ -60,7 +60,7 @@ struct resonances_tutorial {
template <bool IsMC, bool IsMix, typename CollisionType, typename TracksType>
void fillHistograms(const CollisionType& /*collision*/, const TracksType& dTracks1, const TracksType& /*dTracks2*/)
{
for (auto track1 : dTracks1) { // loop over all dTracks1
for (const auto& track1 : dTracks1) { // loop over all dTracks1
if (!trackCut(track1))
continue; // track selection and PID selection
histos.fill(HIST("hEta"), track1.eta());
Expand Down
6 changes: 3 additions & 3 deletions Tutorials/PWGLF/Resonance/resonances_step1.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct resonances_tutorial {

// Track selection
template <typename TrackType>
bool trackCut(const TrackType track)
bool trackCut(const TrackType& track)
{
// basic track cuts
if (std::abs(track.pt()) < cMinPtcut)
Expand Down Expand Up @@ -121,7 +121,7 @@ struct resonances_tutorial {
void fillHistograms(const CollisionType& collision, const TracksType& dTracks1, const TracksType& dTracks2)
{
auto multiplicity = collision.cent();
for (auto track1 : dTracks1) { // loop over all dTracks1
for (const auto& track1 : dTracks1) { // loop over all dTracks1
if (!trackCut(track1) || !selectionPID(track1)) {
continue; // track selection and PID selection
}
Expand All @@ -133,7 +133,7 @@ struct resonances_tutorial {
if (track1.hasTOF()) {
histos.fill(HIST("hNsigmaKaonTOF"), track1.tofNSigmaKa());
}
for (auto track2 : dTracks2) { // loop over all dTracks2
for (const auto& track2 : dTracks2) { // loop over all dTracks2
if (!trackCut(track2) || !selectionPID(track2)) {
continue; // track selection and PID selection
}
Expand Down
6 changes: 3 additions & 3 deletions Tutorials/PWGLF/Resonance/resonances_step2.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ struct resonances_tutorial {

// Track selection
template <typename TrackType>
bool trackCut(const TrackType track)
bool trackCut(const TrackType& track)
{
// basic track cuts
if (std::abs(track.pt()) < cMinPtcut)
Expand Down Expand Up @@ -133,7 +133,7 @@ struct resonances_tutorial {
void fillHistograms(const CollisionType& collision, const TracksType& dTracks1, const TracksType& dTracks2)
{
auto multiplicity = collision.cent();
for (auto track1 : dTracks1) { // loop over all dTracks1
for (const auto& track1 : dTracks1) { // loop over all dTracks1
if (!trackCut(track1) || !selectionPID(track1)) {
continue; // track selection and PID selection
}
Expand All @@ -145,7 +145,7 @@ struct resonances_tutorial {
if (track1.hasTOF()) {
histos.fill(HIST("hNsigmaKaonTOF"), track1.tofNSigmaKa());
}
for (auto track2 : dTracks2) { // loop over all dTracks2
for (const auto& track2 : dTracks2) { // loop over all dTracks2
if (!trackCut(track2) || !selectionPID(track2)) {
continue; // track selection and PID selection
}
Expand Down
4 changes: 2 additions & 2 deletions Tutorials/PWGLF/Resonance/resonances_step3.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct resonances_tutorial {

// MC particle selection
template <typename ParticleType>
bool ptCut(const ParticleType resoParents)
bool ptCut(const ParticleType& resoParents)
{
// basic pt cuts
if (std::abs(resoParents.pt()) < cMinPtcut)
Expand All @@ -60,7 +60,7 @@ struct resonances_tutorial {
template <typename CollisionType, typename ParticleType>
void fillHistograms(const CollisionType& /*collision*/, const ParticleType& resoParents)
{
for (auto part : resoParents) { // loop over all resoParents
for (const auto& part : resoParents) { // loop over all resoParents
if (!ptCut(part))
continue; // pt selection

Expand Down
2 changes: 1 addition & 1 deletion Tutorials/PWGLF/Resonance/resonances_step4.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct resonances_tutorial {

// MC particle selection
template <typename ParticleType>
bool ptCut(const ParticleType resoParents)
bool ptCut(const ParticleType& resoParents)
{
// basic pt cuts
if (std::abs(resoParents.pt()) < cMinPtcut)
Expand Down
4 changes: 2 additions & 2 deletions Tutorials/PWGLF/Resonance/resonances_step5.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct resonances_tutorial {

// Track selection
template <typename TrackType>
bool trackCut(const TrackType track)
bool trackCut(const TrackType& track)
{
// basic track cuts
if (std::abs(track.pt()) < cMinPtcut)
Expand Down Expand Up @@ -113,7 +113,7 @@ struct resonances_tutorial {
template <typename CollisionType, typename TracksType>
void fillHistograms(const CollisionType& /* collision */, const TracksType& dTracks)
{
for (auto track : dTracks) { // loop over all dTracks
for (const auto& track : dTracks) { // loop over all dTracks
if (!trackCut(track) || !selectionPID(track)) {
continue; // track selection and PID selection
}
Expand Down
6 changes: 3 additions & 3 deletions Tutorials/PWGLF/Resonance/resonances_step6.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ struct resonances_tutorial {

// Track selection
template <typename TrackType>
bool trackCut(const TrackType track)
bool trackCut(const TrackType& track)
{
// basic track cuts
if (std::abs(track.pt()) < cMinPtcut)
Expand Down Expand Up @@ -140,7 +140,7 @@ struct resonances_tutorial {
void fillHistograms(const CollisionType& collision, const TracksType& dTracks1, const TracksType& dTracks2)
{
auto multiplicity = collision.cent();
for (auto track1 : dTracks1) { // loop over all dTracks1
for (const auto& track1 : dTracks1) { // loop over all dTracks1
if (!trackCut(track1) || !selectionPID(track1)) {
continue; // track selection and PID selection
}
Expand All @@ -152,7 +152,7 @@ struct resonances_tutorial {
if (track1.hasTOF()) {
histos.fill(HIST("hNsigmaKaonTOF"), track1.tofNSigmaKa());
}
for (auto track2 : dTracks2) { // loop over all dTracks2
for (const auto& track2 : dTracks2) { // loop over all dTracks2
if (!trackCut(track2) || !selectionPID(track2)) {
continue; // track selection and PID selection
}
Expand Down
2 changes: 1 addition & 1 deletion Tutorials/PWGUD/UDTutorial_01.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ struct UDTutorial01 {
LOGF(info, "<UDTutorial01> Number of tracks %d", dgtracks.size());
LOGF(info, "<UDTutorial01> Number of PV contributors %d", PVContributors.size());
}
for (auto track : dgtracks) {
for (const auto& track : dgtracks) {
registry.get<TH1>(HIST("tracks/QCAll"))->Fill(0., 1.);
registry.get<TH1>(HIST("tracks/QCAll"))->Fill(1., track.hasITS() * 1.);
registry.get<TH1>(HIST("tracks/QCAll"))->Fill(2., track.hasTPC() * 1.);
Expand Down
6 changes: 3 additions & 3 deletions Tutorials/PWGUD/UDTutorial_02a.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ struct UDTutorial02a {

// check PID of tracks, use nSigmaTPC
// cut on track pT
for (auto trk : PVContributors) {
for (const auto& trk : PVContributors) {
if (trk.tpcNSigmaPi() < -3. || trk.tpcNSigmaPi() > 3.) {
if (verbose) {
LOGF(info, "<UDTutorials02> Candidate rejected: nSigmaTPC pion is %f", trk.tpcNSigmaPi());
Expand All @@ -148,7 +148,7 @@ struct UDTutorial02a {
TParticlePDG* pion = pdg->GetParticle(211);
TLorentzVector lvtmp;
auto ivm = TLorentzVector(0., 0., 0., 0.);
for (auto trk : PVContributors) {
for (const auto& trk : PVContributors) {
lvtmp.SetXYZM(trk.px(), trk.py(), trk.pz(), pion->Mass());
ivm += lvtmp;
}
Expand All @@ -166,7 +166,7 @@ struct UDTutorial02a {
LOGF(info, "<UDTutorials02> Candidate accepted!");
}
registry.get<TH2>(HIST("dgcandidates/IVMptsys"))->Fill(ivm.M(), ivm.Perp());
for (auto trk : PVContributors) {
for (const auto& trk : PVContributors) {
registry.get<TH2>(HIST("dgcandidates/IVMpttrk"))->Fill(ivm.M(), trk.pt());

// fill nSigma histograms
Expand Down
8 changes: 4 additions & 4 deletions Tutorials/PWGUD/UDTutorial_03a.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ struct UDTutorial03a {
}

// check if a reconstructed track is a muon candidate
bool isMuonCandidate_rec(TC track)
bool isMuonCandidate_rec(const TC& track)
{
if (abs(track.tpcNSigmaMu()) > 3.) {
return false;
Expand Down Expand Up @@ -142,7 +142,7 @@ struct UDTutorial03a {
// and be muon candidates
int netCharge = 0;
int ind = -1;
for (auto track : tracks) {
for (const auto& track : tracks) {
ind++;
if (track.isPVContributor()) {
if (!isMuonCandidate_rec(track)) {
Expand Down Expand Up @@ -297,7 +297,7 @@ struct UDTutorial03a {
TLorentzVector* lv_gen = new TLorentzVector();

// loop over all genererated collisions
for (auto mccollision : mccollisions) {
for (const auto& mccollision : mccollisions) {
registry.get<TH1>(HIST("MC/Stat"))->Fill(0., 1.);

// get McParticles which belong to mccollision
Expand Down Expand Up @@ -350,7 +350,7 @@ struct UDTutorial03a {
registry.get<TH1>(HIST("Reco/Stat"))->Fill(0., 1.);
registry.get<TH1>(HIST("Reco/nTracks"))->Fill(tracks.size(), 1.);
int nContributors = 0;
for (auto track : tracks) {
for (const auto& track : tracks) {
if (track.isPVContributor()) {
nContributors++;
}
Expand Down
20 changes: 10 additions & 10 deletions Tutorials/PWGUD/UDTutorial_03b.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ struct UDTutorial03b {
}

// check if a reconstructed track represents a muon candidate
bool isMuonCandidate_rec(TC track)
bool isMuonCandidate_rec(const TC& track)
{
if (abs(track.tpcNSigmaMu()) > 3.) {
return false;
Expand All @@ -140,7 +140,7 @@ struct UDTutorial03b {

// find the McParticles belongin to given tracks
template <typename MCTrack>
std::vector<int64_t> getDaughterParts_rec(TCs const& tracks, std::vector<int64_t> trackIds, MCTrack const& /*parts*/)
std::vector<int64_t> getDaughterParts_rec(TCs const& tracks, const std::vector<int64_t>& trackIds, MCTrack const& /*parts*/)
{
std::vector<int64_t> emptySelection;
std::vector<int64_t> selectedParts;
Expand All @@ -158,7 +158,7 @@ struct UDTutorial03b {

// retrieve the reconstructed tracks which are associated with the given McParticles
template <typename McPart>
std::vector<int64_t> getDaughterTracks_gen(McPart const& parts, std::vector<int64_t> partIds, TCs const& tracks)
std::vector<int64_t> getDaughterTracks_gen(McPart const& parts, const std::vector<int64_t>& partIds, TCs const& tracks)
{
// return a vector of track indices
std::vector<int64_t> emptySelection;
Expand All @@ -173,7 +173,7 @@ struct UDTutorial03b {
if (trs.size() > 1) {
LOGF(info, "%d tracks belong to same McParticle!", trs.size());
}
for (auto tr : trs) {
for (const auto& tr : trs) {
selectedTracks.push_back(tr.globalIndex());
}
}
Expand All @@ -196,7 +196,7 @@ struct UDTutorial03b {
// and be muon candidates
int netCharge = 0;
int ind = -1;
for (auto track : tracks) {
for (const auto& track : tracks) {
ind++;
if (track.isPVContributor()) {
if (!isMuonCandidate_rec(track)) {
Expand Down Expand Up @@ -328,7 +328,7 @@ struct UDTutorial03b {
TLorentzVector* lv_rec = new TLorentzVector();

// loop over all generated collisions
for (auto mccollision : mccollisions) {
for (const auto& mccollision : mccollisions) {
registry.get<TH1>(HIST("MC/Stat"))->Fill(0., 1.);

// get reconstructed collision which belongs to mccollision
Expand Down Expand Up @@ -400,14 +400,14 @@ struct UDTutorial03b {
registry.get<TH2>(HIST("MC/selMPt"))->Fill(lv_rec->M(), lv_rec->Pt(), 1.);

// compute the difference between generated and reconstructed particle momentum
for (auto McPart : partSlice) {
for (const auto& McPart : partSlice) {
// get track which corresponds to McPart
auto trackSlice = tracks.sliceBy(trackPerMcParticle, McPart.globalIndex());
registry.get<TH1>(HIST("MC/nRecTracks"))->Fill(trackSlice.size(), 1.);

// are there reconstructed tracks?
if (trackSlice.size() > 0) {
for (auto track : trackSlice) {
for (const auto& track : trackSlice) {
auto pTrack = track.p();
auto pPart = McPart.p();
auto pDiff = pTrack - pPart;
Expand Down Expand Up @@ -436,7 +436,7 @@ struct UDTutorial03b {
registry.get<TH1>(HIST("Reco/Stat"))->Fill(0., 1.);
registry.get<TH1>(HIST("Reco/nTracks"))->Fill(tracks.size(), 1.);
int nContributors = 0;
for (auto track : tracks) {
for (const auto& track : tracks) {
if (track.isPVContributor()) {
nContributors++;
}
Expand Down Expand Up @@ -489,7 +489,7 @@ struct UDTutorial03b {
}

// compute the difference between generated and reconstructed momentum
for (auto track : tracks) {
for (const auto& track : tracks) {
// is there an associated McParticle?
if (track.has_mcParticle()) {
auto pTrack = track.p();
Expand Down
Loading
Loading