Skip to content

Commit 190ed12

Browse files
committed
[EMCAL-1152] EMCAL/base: Fix cpplint errors
- Fix cpplint errors
1 parent 762cef7 commit 190ed12

23 files changed

+908
-767
lines changed

Detectors/EMCAL/base/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ o2_add_test(RCUTrailer
5858

5959
o2_add_test_root_macro(test/testGeometryRowColIndexing.C
6060
PUBLIC_LINK_LIBRARIES O2::EMCALBase
61-
LABELS emcal)
61+
LABELS emcal)

Detectors/EMCAL/base/include/EMCALBase/ClusterFactory.h

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,27 @@
88
// In applying this license CERN does not waive the privileges and immunities
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
11-
#ifndef ALICEO2_EMCAL_CLUSTERFACTORY_H_
12-
#define ALICEO2_EMCAL_CLUSTERFACTORY_H_
11+
12+
/// \file ClusterFactory.h
13+
/// \brief Header file for EMCal cluster factory class that creates clusters from cells
14+
/// \author Markus Fasel, markus.fasel@cern.ch
15+
/// \author Hadi Hassan, hadi.hassan@cern.ch
16+
/// \author M. Hemmer, marvin.hemmer@cern.ch
17+
18+
#ifndef DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_CLUSTERFACTORY_H_
19+
#define DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_CLUSTERFACTORY_H_
20+
#include <gsl/span>
21+
1322
#include <array>
1423
#include <vector>
1524
#include <optional>
1625
#include <utility>
17-
#include <gsl/span>
26+
#include <string>
27+
#include <tuple>
28+
1829
#include "Rtypes.h"
1930
#include "fmt/format.h"
31+
2032
#include "DataFormatsEMCAL/Cluster.h"
2133
#include "DataFormatsEMCAL/Digit.h"
2234
#include "DataFormatsEMCAL/Cell.h"
@@ -175,13 +187,14 @@ class ClusterFactory
175187
/// \return Pointer to the current event
176188
AnalysisCluster* operator*() { return &mCurrentCluster; }
177189

178-
/// \brief Get reference to the current cluster
179-
/// \return Reference to the current event of the iterator
180-
AnalysisCluster& operator&() { return mCurrentCluster; }
190+
// Unary operator& is dangerous. We should not use it!
191+
// /// \brief Get reference to the current cluster
192+
// /// \return Reference to the current event of the iterator
193+
// AnalysisCluster& operator&() { return mCurrentCluster; }
181194

182195
/// \brief Get the index of the current event
183196
/// \return Index of the current event
184-
int current_index() const { return mClusterID; }
197+
int currentIndex() const { return mClusterID; }
185198

186199
private:
187200
const ClusterFactory& mClusterFactory; ///< Event factory connected to the iterator
@@ -223,11 +236,11 @@ class ClusterFactory
223236

224237
/// \brief Get backward start iterator
225238
/// \return Start iterator
226-
ClusterIterator rbegin() const { return ClusterIterator(*this, getNumberOfClusters() - 1, false); };
239+
ClusterIterator rbegin() const { return ClusterIterator(*this, getNumberOfClusters() - 1, false); }
227240

228241
/// \brief Get backward end iteration marker
229242
/// \return Iteration end marker
230-
ClusterIterator rend() const { return ClusterIterator(*this, -1, false); };
243+
ClusterIterator rend() const { return ClusterIterator(*this, -1, false); }
231244

232245
/// \brief Reset containers
233246
void reset();
@@ -236,8 +249,8 @@ class ClusterFactory
236249
/// evaluates cluster parameters: position, shower shape, primaries ...
237250
AnalysisCluster buildCluster(int index, o2::emcal::ClusterLabel* clusterLabel = nullptr) const;
238251

239-
void SetECALogWeight(Float_t w) { mLogWeight = w; }
240-
float GetECALogWeight() const { return mLogWeight; }
252+
void setECALogWeight(float w) { mLogWeight = w; }
253+
float getECALogWeight() const { return mLogWeight; }
241254

242255
void doEvalLocal2tracking(bool justCluster)
243256
{
@@ -256,14 +269,14 @@ class ClusterFactory
256269

257270
///
258271
/// evaluates local position of clusters in SM
259-
void evalLocalPositionFit(Double_t deff, Double_t w0, Double_t phiSlope, gsl::span<const int> inputsIndices, AnalysisCluster& cluster) const;
272+
void evalLocalPositionFit(double deff, double w0, double phiSlope, gsl::span<const int> inputsIndices, AnalysisCluster& cluster) const;
260273

261274
///
262275
/// Applied for simulation data with threshold 3 adc
263276
/// Calculate efective distance (deff) and weigh parameter (w0)
264277
/// for coordinate calculation; 0.5 GeV < esum <100 GeV.
265278
/// Look to: http://rhic.physics.wayne.edu/~pavlinov/ALICE/SHISHKEBAB/RES/CALIB/GEOMCORR/deffandW0VaEgamma_2.gif
266-
static void getDeffW0(const Double_t esum, Double_t& deff, Double_t& w0);
279+
static void getDeffW0(const double esum, double& deff, double& w0);
267280

268281
///
269282
/// Finds the maximum energy in the cluster
@@ -280,19 +293,19 @@ class ClusterFactory
280293
/// \param exoticTime: time of the cell with largest energy fraction in cluster
281294
/// \param fCross: exoticity parameter (1-E_cross/E_cell^max) will be caluclated for this check
282295
/// \return bool true if cell is found exotic
283-
bool isExoticCell(short towerId, float ecell, float const exoticTime, float& fCross) const;
296+
bool isExoticCell(int16_t towerId, float ecell, float const exoticTime, float& fCross) const;
284297

285298
/// \brief Calculate the energy in the cross around the energy of a given cell.
286299
/// \param absID: controlled cell absolute ID number
287300
/// \param energy: cluster or cell max energy, used for weight calculation
288301
/// \param exoticTime time of the cell with largest energy fraction in cluster
289302
/// \return the energy in the cross around the energy of a given cell
290-
float getECross(short absID, float energy, float const exoticTime) const;
303+
float getECross(int16_t absID, float energy, float const exoticTime) const;
291304

292305
/// \param eCell: cluster cell energy
293306
/// \param eCluster: cluster or cell max energy
294307
/// \return weight of cell for shower shape calculation
295-
float GetCellWeight(float eCell, float eCluster) const;
308+
float getCellWeight(float eCell, float eCluster) const;
296309

297310
///
298311
/// Calculates the multiplicity of digits/cells with energy larger than level*energy
@@ -314,7 +327,7 @@ class ClusterFactory
314327
///
315328
/// \param e: energy in GeV)
316329
/// \param key: = 0(gamma, default); != 0(electron)
317-
Double_t tMaxInCm(const Double_t e = 0.0, const int key = 0) const;
330+
double tMaxInCm(const double e = 0.0, const int key = 0) const;
318331

319332
bool getLookUpInit() const { return mLookUpInit; }
320333

@@ -352,7 +365,7 @@ class ClusterFactory
352365
void setLookUpTable(void)
353366
{
354367
mLoolUpTowerToIndex.fill(-1);
355-
for (auto iCellIndex : mCellsIndices) {
368+
for (const auto& iCellIndex : mCellsIndices) {
356369
mLoolUpTowerToIndex[mInputsContainer[iCellIndex].getTower()] = iCellIndex;
357370
}
358371
mLookUpInit = true;
@@ -436,12 +449,12 @@ class ClusterFactory
436449
gsl::span<const o2::emcal::Cluster> mClustersContainer; ///< Container for all the clusters in the event
437450
gsl::span<const InputType> mInputsContainer; ///< Container for all the cells/digits in the event
438451
gsl::span<const int> mCellsIndices; ///< Container for cells indices in the event
439-
std::array<short, 17664> mLoolUpTowerToIndex; ///< Lookup table to match tower id with cell index, needed for exotic check
452+
std::array<int16_t, 17664> mLoolUpTowerToIndex; ///< Lookup table to match tower id with cell index, needed for exotic check
440453
gsl::span<const o2::emcal::CellLabel> mCellLabelContainer; ///< Container for all the cell labels in the event
441454

442455
ClassDefNV(ClusterFactory, 2);
443456
};
444457

445458
} // namespace emcal
446459
} // namespace o2
447-
#endif // ALICEO2_EMCAL_CLUSTERFACTORY_H_
460+
#endif // DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_CLUSTERFACTORY_H_

0 commit comments

Comments
 (0)