Skip to content

Commit 3a737d3

Browse files
committed
making some changes based on o2-linter and AI cleaning suggestions
1 parent 1a271f7 commit 3a737d3

1 file changed

Lines changed: 26 additions & 27 deletions

File tree

PWGUD/Tasks/upcVmRof.cxx

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
#include "Common/CCDB/EventSelectionParams.h"
1818
#include "Common/DataModel/EventSelection.h"
19-
#include "Common/DataModel/FT0Corrected.h"
20-
#include "Common/DataModel/PIDResponseTOF.h"
2119
#include "Common/DataModel/PIDResponseTPC.h"
2220
#include "Common/DataModel/TrackSelectionTables.h"
2321

@@ -47,16 +45,13 @@
4745
using namespace o2;
4846
using namespace o2::framework;
4947
using namespace o2::framework::expressions;
50-
using namespace o2::dataformats;
5148

52-
// my shortcuts
5349
using BCsTSsSels = soa::Join<aod::BCsWithTimestamps, aod::BcSels, aod::Run3MatchedToBCSparse>;
5450
using ColSels = soa::Join<aod::Collisions, aod::EvSels>;
55-
using TRKs = soa::Join<aod::Tracks, /*aod::TracksCov,*/ aod::TracksExtra, aod::TracksDCA, aod::TrackSelection,
51+
using TRKs = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection,
5652
aod::pidTPCFullEl, aod::pidTPCFullMu, aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr,
5753
aod::pidTPCFullDe, aod::pidTPCFullTr, aod::pidTPCFullHe, aod::pidTPCFullAl>;
5854

59-
// my shortcuts: iterators
6055
using ColSel = ColSels::iterator;
6156

6257
namespace o2::aod
@@ -171,18 +166,18 @@ struct UpcVmRof {
171166
HistogramRegistry colTH1Registry{"colTH1Registry", {}};
172167
std::map<std::string, std::shared_ptr<TH1>> colTH1Pointers;
173168

174-
// varibles to store filling scheme info
169+
// variables to store filling scheme info
175170
std::bitset<o2::constants::lhc::LHCMaxBunches> beamPatternA;
176171
std::bitset<o2::constants::lhc::LHCMaxBunches> beamPatternC;
177172
std::bitset<o2::constants::lhc::LHCMaxBunches> bcPatternA;
178173
std::bitset<o2::constants::lhc::LHCMaxBunches> bcPatternB;
179174
std::bitset<o2::constants::lhc::LHCMaxBunches> bcPatternC;
180175

181176
// constants related to ITS ROFs
182-
static const int rofPerOrbit = 6; // valid for pO, OO and PbPb in Run 3
183-
static const int rofShift = 64; // bc shift of ITS. Valid for pO, OO and PbPb in Run 3
177+
static constexpr int rofPerOrbit = 6; // valid for pO, OO and PbPb in Run 3
178+
static constexpr int rofShift = 64; // bc shift of ITS. Valid for pO, OO and PbPb in Run 3
184179

185-
// varibles to store run info
180+
// variables to store run info
186181
int runNumberBc = 0; // run number used to process BCs
187182
int runNumberCol = 0; // run number used to process collisions
188183
int64_t sor = 0; // best known timestamp for the start of run
@@ -196,8 +191,12 @@ struct UpcVmRof {
196191
// constant related to trigger mask indices
197192
// https://github.com/AliceO2Group/AliceO2/blob/6c0251c35e5cbf6028d2bd6f7e30f9a4fd348e38/DataFormats/Detectors/CTP/src/Configuration.cxx#L1123
198193
// PbPb triggers: 1ZNC, FV0CH+FT0VTX, OO: 1ZNC, FT0CE+FT0VTX
199-
static const int ft0vtxIdx = 2;
200-
static const int ft0ceIdx = 4;
194+
static constexpr int ft0vtxIdx = 2;
195+
static constexpr int ft0ceIdx = 4;
196+
197+
// number of tracks for the selected event topologies
198+
static constexpr int nTrksTwoBody = 2;
199+
static constexpr int nTrksFourBody = 4;
201200

202201
// information for selection collisions
203202
Configurable<float> maxAbsPosZ{"maxAbsPosZ", 10.0, "max |Z| position of vtx"};
@@ -264,7 +263,7 @@ struct UpcVmRof {
264263
// compute TF for this BC
265264
int64_t getTimeFrame(int64_t globalBC)
266265
{
267-
return std::floor((globalBC - bcSOR) / nBCsPerTF);
266+
return (globalBC - bcSOR) / nBCsPerTF;
268267
}
269268

270269
//--------------------------------------------------------------------------------
@@ -274,7 +273,7 @@ struct UpcVmRof {
274273
int64_t bctmp = thisBC - rofShift;
275274
if (bctmp < 0)
276275
bctmp = o2::constants::lhc::LHCMaxBunches - rofShift - 1;
277-
return std::floor(bctmp / nBCsPerROF);
276+
return static_cast<int>(bctmp / nBCsPerROF);
278277
}
279278

280279
//--------------------------------------------------------------------------------
@@ -484,12 +483,12 @@ struct UpcVmRof {
484483
colTH1Pointers[Form("col/%d/colSel_H", runNumberCol)]->Fill(11);
485484

486485
// select number of contributors
487-
if (!((col.numContrib() == 2) || (col.numContrib() == 4)))
486+
if (!((col.numContrib() == nTrksTwoBody) || (col.numContrib() == nTrksFourBody)))
488487
return;
489-
if (col.numContrib() == 2) {
488+
if (col.numContrib() == nTrksTwoBody) {
490489
colTH1Pointers[Form("col/%d/colSel_H", runNumberCol)]->Fill(16);
491490
}
492-
if (col.numContrib() == 4) {
491+
if (col.numContrib() == nTrksFourBody) {
493492
colTH1Pointers[Form("col/%d/colSel_H", runNumberCol)]->Fill(18);
494493
}
495494

@@ -530,15 +529,15 @@ struct UpcVmRof {
530529
colTH1Pointers[Form("col/%d/trkSel_H", runNumberCol)]->Fill(8);
531530
selTrks.push_back(track);
532531
}
533-
if (!(((col.numContrib() == 2) && (selTrks.size() == 2)) ||
534-
((col.numContrib() == 4) && (selTrks.size() == 4))))
532+
if (!(((col.numContrib() == nTrksTwoBody) && (selTrks.size() == nTrksTwoBody)) ||
533+
((col.numContrib() == nTrksFourBody) && (selTrks.size() == nTrksFourBody))))
535534
return;
536535

537536
// selected events
538-
if ((col.numContrib() == 2) && (selTrks.size() == 2)) {
537+
if ((col.numContrib() == nTrksTwoBody) && (selTrks.size() == nTrksTwoBody)) {
539538
colTH1Pointers[Form("col/%d/colSel_H", runNumberCol)]->Fill(17);
540539
}
541-
if ((col.numContrib() == 4) && (selTrks.size() == 4)) {
540+
if ((col.numContrib() == nTrksFourBody) && (selTrks.size() == nTrksFourBody)) {
542541
colTH1Pointers[Form("col/%d/colSel_H", runNumberCol)]->Fill(19);
543542
}
544543

@@ -577,10 +576,10 @@ struct UpcVmRof {
577576
} // FT0 selection
578577

579578
// final number of selected events
580-
if ((col.numContrib() == 2) && (selTrks.size() == 2)) {
579+
if ((col.numContrib() == nTrksTwoBody) && (selTrks.size() == nTrksTwoBody)) {
581580
colTH1Pointers[Form("col/%d/colSel_H", runNumberCol)]->Fill(20);
582581
}
583-
if ((col.numContrib() == 4) && (selTrks.size() == 4)) {
582+
if ((col.numContrib() == nTrksFourBody) && (selTrks.size() == nTrksFourBody)) {
584583
colTH1Pointers[Form("col/%d/colSel_H", runNumberCol)]->Fill(21);
585584
}
586585

@@ -597,10 +596,10 @@ struct UpcVmRof {
597596

598597
// get FDD info
599598
float aFDDA = 0;
600-
float tFDDA = 33; // default time to mark events without FT0 info
599+
float tFDDA = 33; // default time to mark events without FDD info
601600
int nFDDA = 0;
602601
float aFDDC = 0;
603-
float tFDDC = 33; // default time to mark events without FT0 info
602+
float tFDDC = 33; // default time to mark events without FDD info
604603
int nFDDC = 0;
605604
if (bc.has_foundFDD()) {
606605
tFDDA = bc.foundFDD().timeA();
@@ -665,7 +664,7 @@ struct UpcVmRof {
665664

666665
// fill output table
667666
int recoFlag = (col.flags() & dataformats::Vertex<o2::dataformats::TimeStamp<int>>::Flags::UPCMode) ? 1 : 0;
668-
if (selTrks.size() == 2) {
667+
if (selTrks.size() == nTrksTwoBody) {
669668
colTH1Pointers[Form("col/%d/twoTrkTF_H", runNumberCol)]->Fill(thisTF);
670669
twoTrkTable(runNumberCol, col.posX(), col.posY(), col.posZ(), col.chi2(), thisBC, thisTF, thisROF, recoFlag,
671670
aFT0A, aFT0C, aFV0A, aFDDA, aFDDC, tFT0A, tFT0C, tFV0A, tFDDA, tFDDC, nFT0A, nFT0C, nFV0A, nFDDA, nFDDC,
@@ -675,7 +674,7 @@ struct UpcVmRof {
675674
selTrks[1].pt(), selTrks[1].eta(), selTrks[1].phi(), selTrks[1].sign(),
676675
selTrks[1].tpcNSigmaPi(), selTrks[1].tpcNSigmaEl(), selTrks[1].tpcNSigmaKa(), selTrks[1].tpcNSigmaPr());
677676
}
678-
if (selTrks.size() == 4) {
677+
if (selTrks.size() == nTrksFourBody) {
679678
colTH1Pointers[Form("col/%d/fourTrkTF_H", runNumberCol)]->Fill(thisTF);
680679
fourTrkTable(runNumberCol, col.posX(), col.posY(), col.posZ(), col.chi2(), thisBC, thisTF, thisROF, recoFlag,
681680
aFT0A, aFT0C, aFV0A, aFDDA, aFDDC, tFT0A, tFT0C, tFV0A, tFDDA, tFDDC, nFT0A, nFT0C, nFV0A, nFDDA, nFDDC,

0 commit comments

Comments
 (0)