Skip to content

Commit 546ef97

Browse files
committed
Fix bugs, bad practice, includes
1 parent 8d53971 commit 546ef97

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+589
-514
lines changed

Common/CCDB/TriggerAliases.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
#ifndef COMMON_CCDB_TRIGGERALIASES_H_
1313
#define COMMON_CCDB_TRIGGERALIASES_H_
1414

15+
#include <Rtypes.h>
16+
1517
#include <cstdint>
1618
#include <map>
1719
#include <string>
18-
#include <Rtypes.h>
1920

2021
enum triggerAliases {
2122
kINT7 = 0,
@@ -57,7 +58,7 @@ class TriggerAliases
5758
TriggerAliases() = default;
5859
~TriggerAliases() = default;
5960

60-
void AddAlias(uint32_t aliasId, std::string classNames) { mAliasToClassNames[aliasId] = classNames; }
61+
void AddAlias(uint32_t aliasId, std::string const& classNames) { mAliasToClassNames[aliasId] = classNames; }
6162
void AddClassIdToAlias(uint32_t aliasId, int classId);
6263
const std::map<uint32_t, std::string>& GetAliasToClassNamesMap() const { return mAliasToClassNames; }
6364
const std::map<uint32_t, ULong64_t>& GetAliasToTriggerMaskMap() const { return mAliasToTriggerMask; }

Common/CCDB/ctpRateFetcher.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@
1111

1212
#include "ctpRateFetcher.h"
1313

14-
#include <map>
15-
#include <vector>
16-
14+
#include "CCDB/BasicCCDBManager.h"
1715
#include "CommonConstants/LHCConstants.h"
1816
#include "DataFormatsCTP/Configuration.h"
1917
#include "DataFormatsCTP/Scalers.h"
2018
#include "DataFormatsParameters/GRPLHCIFData.h"
21-
#include "CCDB/BasicCCDBManager.h"
19+
20+
#include <map>
21+
#include <vector>
2222

2323
namespace o2
2424
{
25-
double ctpRateFetcher::fetch(o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, int runNumber, std::string sourceName, bool fCrashOnNull)
25+
double ctpRateFetcher::fetch(o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, int runNumber, const std::string& sourceName, bool fCrashOnNull)
2626
{
2727
setupRun(runNumber, ccdb, timeStamp);
2828
if (sourceName.find("ZNC") != std::string::npos) {

Common/CCDB/ctpRateFetcher.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
#ifndef COMMON_CCDB_CTPRATEFETCHER_H_
1313
#define COMMON_CCDB_CTPRATEFETCHER_H_
1414

15-
#include <string>
16-
1715
#include "CCDB/BasicCCDBManager.h"
1816

17+
#include <string>
18+
1919
namespace o2
2020
{
2121

@@ -34,7 +34,7 @@ class ctpRateFetcher
3434
{
3535
public:
3636
ctpRateFetcher() = default;
37-
double fetch(o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, int runNumber, std::string sourceName, bool fCrashOnNull = true);
37+
double fetch(o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, int runNumber, const std::string& sourceName, bool fCrashOnNull = true);
3838

3939
void setManualCleanup(bool manualCleanup = true) { mManualCleanup = manualCleanup; }
4040

Common/Core/CollisionAssociation.h

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
#ifndef COMMON_CORE_COLLISIONASSOCIATION_H_
2121
#define COMMON_CORE_COLLISIONASSOCIATION_H_
2222

23-
#include <vector>
24-
#include <memory>
25-
#include <utility>
26-
2723
#include "CommonConstants/LHCConstants.h"
28-
#include "Framework/AnalysisDataModel.h"
2924
#include "Framework/ASoAHelpers.h"
25+
#include "Framework/AnalysisDataModel.h"
26+
27+
#include <memory>
28+
#include <utility>
29+
#include <vector>
3030

3131
namespace o2::aod
3232
{
@@ -191,58 +191,58 @@ class CollisionAssociation
191191
for (auto& iterationWindow : trackIterationWindows) {
192192
bool iteratorMoved = false;
193193
const bool isAssignedTrackWindow = (iterationWindow.first != iterationWindow.second) ? iterationWindow.first.has_collision() : false;
194-
for (auto track = iterationWindow.first; track != iterationWindow.second; ++track) {
195-
int64_t trackBC = globalBC[track.filteredIndex()];
194+
for (auto trackInWindow = iterationWindow.first; trackInWindow != iterationWindow.second; ++trackInWindow) {
195+
int64_t trackBC = globalBC[trackInWindow.filteredIndex()];
196196
if (trackBC < 0) {
197197
continue;
198198
}
199199

200200
// Optimization to avoid looping over the full track list each time. This builds on that tracks are sorted by BCs (which they should be because collisions are sorted by BCs)
201-
const int64_t bcOffset = trackBC - (int64_t)collBC;
201+
const int64_t bcOffset = trackBC - static_cast<int64_t>(collBC);
202202
if constexpr (isCentralBarrel) {
203203
// only for blocks with collision association
204204
if (isAssignedTrackWindow) {
205205
constexpr int margin = 200;
206206
if (!iteratorMoved && bcOffset > -bcOffsetMax - margin) {
207-
iterationWindow.first.setCursor(track.filteredIndex());
207+
iterationWindow.first.setCursor(trackInWindow.filteredIndex());
208208
iteratorMoved = true;
209-
LOGP(debug, "Moving iterator begin {}", track.filteredIndex());
209+
LOGP(debug, "Moving iterator begin {}", trackInWindow.filteredIndex());
210210
} else if (bcOffset > bcOffsetMax + margin) {
211-
LOGP(debug, "Stopping iterator {}", track.filteredIndex());
211+
LOGP(debug, "Stopping iterator {}", trackInWindow.filteredIndex());
212212
break;
213213
}
214214
}
215215
}
216216

217-
int64_t bcOffsetWindow = trackBCCache[track.filteredIndex()] - (int64_t)collBC;
217+
int64_t bcOffsetWindow = trackBCCache[trackInWindow.filteredIndex()] - static_cast<int64_t>(collBC);
218218
if (std::abs(bcOffsetWindow) > bcOffsetMax) {
219219
continue;
220220
}
221221

222222
float trackTime = 0;
223223
float trackTimeRes = 0;
224224
if constexpr (isCentralBarrel) {
225-
if (mUsePvAssociation && track.isPVContributor()) {
226-
trackTime = track.collision().collisionTime(); // if PV contributor, we assume the time to be the one of the collision
227-
trackTimeRes = o2::constants::lhc::LHCBunchSpacingNS; // 1 BC
225+
if (mUsePvAssociation && trackInWindow.isPVContributor()) {
226+
trackTime = trackInWindow.collision().collisionTime(); // if PV contributor, we assume the time to be the one of the collision
227+
trackTimeRes = o2::constants::lhc::LHCBunchSpacingNS; // 1 BC
228228
} else {
229-
trackTime = track.trackTime();
230-
trackTimeRes = track.trackTimeRes();
229+
trackTime = trackInWindow.trackTime();
230+
trackTimeRes = trackInWindow.trackTimeRes();
231231
}
232232
} else {
233-
trackTime = track.trackTime();
234-
trackTimeRes = track.trackTimeRes();
233+
trackTime = trackInWindow.trackTime();
234+
trackTimeRes = trackInWindow.trackTimeRes();
235235
}
236236

237237
const float deltaTime = trackTime - collTime + bcOffset * o2::constants::lhc::LHCBunchSpacingNS;
238238
float sigmaTimeRes2 = collTimeRes2 + trackTimeRes * trackTimeRes;
239-
LOGP(debug, "collision time={}, collision time res={}, track time={}, track time res={}, bc collision={}, bc track={}, delta time={}", collTime, collision.collisionTimeRes(), track.trackTime(), track.trackTimeRes(), collBC, trackBC, deltaTime);
239+
LOGP(debug, "collision time={}, collision time res={}, track time={}, track time res={}, bc collision={}, bc track={}, delta time={}", collTime, collision.collisionTimeRes(), trackInWindow.trackTime(), trackInWindow.trackTimeRes(), collBC, trackBC, deltaTime);
240240

241241
float thresholdTime = 0.;
242242
if constexpr (isCentralBarrel) {
243-
if (mUsePvAssociation && track.isPVContributor()) {
243+
if (mUsePvAssociation && trackInWindow.isPVContributor()) {
244244
thresholdTime = trackTimeRes;
245-
} else if (TESTBIT(track.flags(), o2::aod::track::TrackTimeResIsRange)) {
245+
} else if (TESTBIT(trackInWindow.flags(), o2::aod::track::TrackTimeResIsRange)) {
246246
// the track time resolution is a range, not a gaussian resolution
247247
thresholdTime = trackTimeRes + mNumSigmaForTimeCompat * std::sqrt(collTimeRes2) + mTimeMargin;
248248
} else {
@@ -262,7 +262,7 @@ class CollisionAssociation
262262

263263
if (std::abs(deltaTime) < thresholdTime) {
264264
const auto collIdx = collision.globalIndex();
265-
const auto trackIdx = track.globalIndex();
265+
const auto trackIdx = trackInWindow.globalIndex();
266266
LOGP(debug, "Filling track id {} for coll id {}", trackIdx, collIdx);
267267
association(collIdx, trackIdx);
268268
if (mFillTableOfCollIdsPerTrack) {
@@ -278,9 +278,9 @@ class CollisionAssociation
278278
// create reverse index track to collisions if enabled
279279
if (mFillTableOfCollIdsPerTrack) {
280280
std::vector<int> empty{};
281-
for (const auto& track : tracksUnfiltered) {
281+
for (const auto& trackUnfiltered : tracksUnfiltered) {
282282

283-
const auto trackId = track.globalIndex();
283+
const auto trackId = trackUnfiltered.globalIndex();
284284
if (collsPerTrack[trackId] == nullptr) {
285285
reverseIndices(empty);
286286
} else {

Common/Core/EventPlaneHelper.cxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020

2121
#include "Common/Core/EventPlaneHelper.h"
2222

23+
#include "TMath.h"
24+
#include "TVector3.h"
25+
2326
#include <algorithm>
2427
#include <iterator>
25-
#include <vector>
2628
#include <memory>
27-
28-
#include "TMath.h"
29-
#include "TVector3.h"
29+
#include <vector>
3030

3131
double EventPlaneHelper::GetPhiFV0(int chno, o2::fv0::Geometry* fv0geom)
3232
{
@@ -37,8 +37,8 @@ double EventPlaneHelper::GetPhiFV0(int chno, o2::fv0::Geometry* fv0geom)
3737
float offsetX = 0.;
3838
float offsetY = 0.;
3939

40-
int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27,
41-
32, 40, 33, 41, 34, 42, 35, 43};
40+
const int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27,
41+
32, 40, 33, 41, 34, 42, 35, 43};
4242
bool isChnoInLeft = std::find(std::begin(cellsInLeft), std::end(cellsInLeft), chno) != std::end(cellsInLeft);
4343

4444
if (isChnoInLeft) {

Common/Core/FFitWeights.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616

1717
#include "FFitWeights.h"
1818

19-
#include <string>
19+
#include <TSpline.h>
20+
2021
#include <cstdio>
22+
#include <string>
2123
#include <vector>
2224

23-
#include <TSpline.h>
24-
2525
ClassImp(FFitWeights)
2626

2727
FFitWeights::FFitWeights() : TNamed("", ""),
@@ -111,7 +111,7 @@ void FFitWeights::addArray(TObjArray* targ, TObjArray* sour)
111111
}
112112
};
113113

114-
void FFitWeights::qSelection(std::vector<int> nhv, std::vector<std::string> stv) /* only execute OFFLINE */
114+
void FFitWeights::qSelection(std::vector<int> const& nhv, std::vector<std::string> const& stv) /* only execute OFFLINE */
115115
{
116116
TObjArray* tar{nullptr};
117117

Common/Core/FFitWeights.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@
1717
#ifndef COMMON_CORE_FFITWEIGHTS_H_
1818
#define COMMON_CORE_FFITWEIGHTS_H_
1919

20-
#include <vector>
21-
#include <string>
22-
#include <utility>
23-
#include <algorithm>
24-
#include <complex>
25-
#include <memory>
26-
20+
#include "TCollection.h"
21+
#include "TFile.h"
22+
#include "TH1D.h"
23+
#include "TH2D.h"
24+
#include "TH3D.h"
25+
#include "TMath.h"
2726
#include "TNamed.h"
2827
#include "TObjArray.h"
29-
#include "TH3D.h"
30-
#include "TH2D.h"
31-
#include "TH1D.h"
32-
#include "TFile.h"
33-
#include "TCollection.h"
3428
#include "TString.h"
35-
#include "TMath.h"
29+
30+
#include <algorithm>
31+
#include <complex>
32+
#include <memory>
33+
#include <string>
34+
#include <utility>
35+
#include <vector>
3636

3737
class FFitWeights : public TNamed
3838
{
@@ -53,11 +53,11 @@ class FFitWeights : public TNamed
5353
TAxis* getqVecAx() { return qAxis; }
5454

5555
Long64_t Merge(TCollection* collist);
56-
void qSelection(std::vector<int> nhv, std::vector<std::string> stv);
56+
void qSelection(std::vector<int> const& nhv, std::vector<std::string> const& stv);
5757
float eval(float centr, const float& dqn, const int nh, const char* pf = "");
5858
void setResolution(int res) { nResolution = res; }
5959
int getResolution() const { return nResolution; }
60-
void setQnType(std::vector<std::pair<int, std::string>> qninp) { qnTYPE = qninp; }
60+
void setQnType(std::vector<std::pair<int, std::string>> const& qninp) { qnTYPE = qninp; }
6161

6262
private:
6363
TObjArray* fW_data;

Common/Core/MetadataHelper.cxx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,7 @@ bool MetadataHelper::isFullyDefined() const
7878
if (!mIsInitialized) {
7979
LOG(fatal) << "Metadata not initialized";
8080
}
81-
for (const auto& key : mMetadata) {
82-
if (!isKeyDefined(key.first)) {
83-
return false;
84-
}
85-
}
86-
return true;
81+
return std::all_of(mMetadata.begin(), mMetadata.end(), [this](const auto& key) { return isKeyDefined(key.first); });
8782
}
8883

8984
std::string MetadataHelper::get(std::string const& key) const

Common/Core/OrbitRange.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@
1313
// Container to store minimum and maximum orbit counter
1414
//
1515

16-
#ifndef OrbitRange_H
17-
#define OrbitRange_H
16+
#ifndef COMMON_CORE_ORBITRANGE_H_
17+
#define COMMON_CORE_ORBITRANGE_H_
18+
19+
#include <TNamed.h>
1820

19-
#include "TNamed.h"
2021
class TCollection;
2122

2223
class OrbitRange : public TNamed
2324
{
2425
public:
25-
OrbitRange(const char* name = "orbitRange") : TNamed(name, name), fRunNumber(0), fMinOrbit(0xFFFFFFFF), fMaxOrbit(0) {}
26+
explicit OrbitRange(const char* name = "orbitRange") : TNamed(name, name), fRunNumber(0), fMinOrbit(0xFFFFFFFF), fMaxOrbit(0) {}
2627
~OrbitRange() {}
2728
void SetRunNumber(uint32_t runNumber) { fRunNumber = runNumber; }
2829
void SetMinOrbit(uint32_t orbit) { fMinOrbit = orbit; }
@@ -39,4 +40,4 @@ class OrbitRange : public TNamed
3940
ClassDef(OrbitRange, 1)
4041
};
4142

42-
#endif
43+
#endif // COMMON_CORE_ORBITRANGE_H_

0 commit comments

Comments
 (0)