diff --git a/Common/CCDB/TriggerAliases.h b/Common/CCDB/TriggerAliases.h index f1baf04fdcc..3ee5c3ba87c 100644 --- a/Common/CCDB/TriggerAliases.h +++ b/Common/CCDB/TriggerAliases.h @@ -12,10 +12,11 @@ #ifndef COMMON_CCDB_TRIGGERALIASES_H_ #define COMMON_CCDB_TRIGGERALIASES_H_ +#include + #include #include #include -#include enum triggerAliases { kINT7 = 0, @@ -57,7 +58,7 @@ class TriggerAliases TriggerAliases() = default; ~TriggerAliases() = default; - void AddAlias(uint32_t aliasId, std::string classNames) { mAliasToClassNames[aliasId] = classNames; } + void AddAlias(uint32_t aliasId, std::string const& classNames) { mAliasToClassNames[aliasId] = classNames; } void AddClassIdToAlias(uint32_t aliasId, int classId); const std::map& GetAliasToClassNamesMap() const { return mAliasToClassNames; } const std::map& GetAliasToTriggerMaskMap() const { return mAliasToTriggerMask; } diff --git a/Common/CCDB/ctpRateFetcher.cxx b/Common/CCDB/ctpRateFetcher.cxx index 6940fd1e921..4dbec5d8c0c 100644 --- a/Common/CCDB/ctpRateFetcher.cxx +++ b/Common/CCDB/ctpRateFetcher.cxx @@ -11,18 +11,19 @@ #include "ctpRateFetcher.h" +#include +#include +#include +#include +#include + #include +#include #include -#include "CommonConstants/LHCConstants.h" -#include "DataFormatsCTP/Configuration.h" -#include "DataFormatsCTP/Scalers.h" -#include "DataFormatsParameters/GRPLHCIFData.h" -#include "CCDB/BasicCCDBManager.h" - namespace o2 { -double ctpRateFetcher::fetch(o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, int runNumber, std::string sourceName, bool fCrashOnNull) +double ctpRateFetcher::fetch(o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, int runNumber, const std::string& sourceName, bool fCrashOnNull) { setupRun(runNumber, ccdb, timeStamp); if (sourceName.find("ZNC") != std::string::npos) { diff --git a/Common/CCDB/ctpRateFetcher.h b/Common/CCDB/ctpRateFetcher.h index 6aaf5e3ebaa..9d4de6215d3 100644 --- a/Common/CCDB/ctpRateFetcher.h +++ b/Common/CCDB/ctpRateFetcher.h @@ -12,9 +12,9 @@ #ifndef COMMON_CCDB_CTPRATEFETCHER_H_ #define COMMON_CCDB_CTPRATEFETCHER_H_ -#include +#include -#include "CCDB/BasicCCDBManager.h" +#include namespace o2 { @@ -34,7 +34,7 @@ class ctpRateFetcher { public: ctpRateFetcher() = default; - double fetch(o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, int runNumber, std::string sourceName, bool fCrashOnNull = true); + double fetch(o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, int runNumber, const std::string& sourceName, bool fCrashOnNull = true); void setManualCleanup(bool manualCleanup = true) { mManualCleanup = manualCleanup; } diff --git a/Common/Core/CollisionAssociation.h b/Common/Core/CollisionAssociation.h index 69ec38a24db..e6b7f9f8cc5 100644 --- a/Common/Core/CollisionAssociation.h +++ b/Common/Core/CollisionAssociation.h @@ -20,13 +20,13 @@ #ifndef COMMON_CORE_COLLISIONASSOCIATION_H_ #define COMMON_CORE_COLLISIONASSOCIATION_H_ -#include +#include +#include +#include + #include #include - -#include "CommonConstants/LHCConstants.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" +#include namespace o2::aod { @@ -191,30 +191,30 @@ class CollisionAssociation for (auto& iterationWindow : trackIterationWindows) { bool iteratorMoved = false; const bool isAssignedTrackWindow = (iterationWindow.first != iterationWindow.second) ? iterationWindow.first.has_collision() : false; - for (auto track = iterationWindow.first; track != iterationWindow.second; ++track) { - int64_t trackBC = globalBC[track.filteredIndex()]; + for (auto trackInWindow = iterationWindow.first; trackInWindow != iterationWindow.second; ++trackInWindow) { + int64_t trackBC = globalBC[trackInWindow.filteredIndex()]; if (trackBC < 0) { continue; } // 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) - const int64_t bcOffset = trackBC - (int64_t)collBC; + const int64_t bcOffset = trackBC - static_cast(collBC); if constexpr (isCentralBarrel) { // only for blocks with collision association if (isAssignedTrackWindow) { constexpr int margin = 200; if (!iteratorMoved && bcOffset > -bcOffsetMax - margin) { - iterationWindow.first.setCursor(track.filteredIndex()); + iterationWindow.first.setCursor(trackInWindow.filteredIndex()); iteratorMoved = true; - LOGP(debug, "Moving iterator begin {}", track.filteredIndex()); + LOGP(debug, "Moving iterator begin {}", trackInWindow.filteredIndex()); } else if (bcOffset > bcOffsetMax + margin) { - LOGP(debug, "Stopping iterator {}", track.filteredIndex()); + LOGP(debug, "Stopping iterator {}", trackInWindow.filteredIndex()); break; } } } - int64_t bcOffsetWindow = trackBCCache[track.filteredIndex()] - (int64_t)collBC; + int64_t bcOffsetWindow = trackBCCache[trackInWindow.filteredIndex()] - static_cast(collBC); if (std::abs(bcOffsetWindow) > bcOffsetMax) { continue; } @@ -222,27 +222,27 @@ class CollisionAssociation float trackTime = 0; float trackTimeRes = 0; if constexpr (isCentralBarrel) { - if (mUsePvAssociation && track.isPVContributor()) { - trackTime = track.collision().collisionTime(); // if PV contributor, we assume the time to be the one of the collision - trackTimeRes = o2::constants::lhc::LHCBunchSpacingNS; // 1 BC + if (mUsePvAssociation && trackInWindow.isPVContributor()) { + trackTime = trackInWindow.collision().collisionTime(); // if PV contributor, we assume the time to be the one of the collision + trackTimeRes = o2::constants::lhc::LHCBunchSpacingNS; // 1 BC } else { - trackTime = track.trackTime(); - trackTimeRes = track.trackTimeRes(); + trackTime = trackInWindow.trackTime(); + trackTimeRes = trackInWindow.trackTimeRes(); } } else { - trackTime = track.trackTime(); - trackTimeRes = track.trackTimeRes(); + trackTime = trackInWindow.trackTime(); + trackTimeRes = trackInWindow.trackTimeRes(); } const float deltaTime = trackTime - collTime + bcOffset * o2::constants::lhc::LHCBunchSpacingNS; float sigmaTimeRes2 = collTimeRes2 + trackTimeRes * trackTimeRes; - 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); + 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); float thresholdTime = 0.; if constexpr (isCentralBarrel) { - if (mUsePvAssociation && track.isPVContributor()) { + if (mUsePvAssociation && trackInWindow.isPVContributor()) { thresholdTime = trackTimeRes; - } else if (TESTBIT(track.flags(), o2::aod::track::TrackTimeResIsRange)) { + } else if (TESTBIT(trackInWindow.flags(), o2::aod::track::TrackTimeResIsRange)) { // the track time resolution is a range, not a gaussian resolution thresholdTime = trackTimeRes + mNumSigmaForTimeCompat * std::sqrt(collTimeRes2) + mTimeMargin; } else { @@ -262,7 +262,7 @@ class CollisionAssociation if (std::abs(deltaTime) < thresholdTime) { const auto collIdx = collision.globalIndex(); - const auto trackIdx = track.globalIndex(); + const auto trackIdx = trackInWindow.globalIndex(); LOGP(debug, "Filling track id {} for coll id {}", trackIdx, collIdx); association(collIdx, trackIdx); if (mFillTableOfCollIdsPerTrack) { @@ -278,9 +278,9 @@ class CollisionAssociation // create reverse index track to collisions if enabled if (mFillTableOfCollIdsPerTrack) { std::vector empty{}; - for (const auto& track : tracksUnfiltered) { + for (const auto& trackUnfiltered : tracksUnfiltered) { - const auto trackId = track.globalIndex(); + const auto trackId = trackUnfiltered.globalIndex(); if (collsPerTrack[trackId] == nullptr) { reverseIndices(empty); } else { diff --git a/Common/Core/CollisionTypeHelper.cxx b/Common/Core/CollisionTypeHelper.cxx index 4d7e1de3f87..10e23f19423 100644 --- a/Common/Core/CollisionTypeHelper.cxx +++ b/Common/Core/CollisionTypeHelper.cxx @@ -17,9 +17,8 @@ #include "Common/Core/CollisionTypeHelper.h" -#include "DataFormatsParameters/GRPLHCIFData.h" - -#include +#include +#include #include diff --git a/Common/Core/EventPlaneHelper.cxx b/Common/Core/EventPlaneHelper.cxx index 75424d900d9..8c8cb88c896 100644 --- a/Common/Core/EventPlaneHelper.cxx +++ b/Common/Core/EventPlaneHelper.cxx @@ -20,13 +20,14 @@ #include "Common/Core/EventPlaneHelper.h" +#include +#include + #include +#include #include -#include #include - -#include "TMath.h" -#include "TVector3.h" +#include double EventPlaneHelper::GetPhiFV0(int chno, o2::fv0::Geometry* fv0geom) { @@ -37,8 +38,8 @@ double EventPlaneHelper::GetPhiFV0(int chno, o2::fv0::Geometry* fv0geom) float offsetX = 0.; float offsetY = 0.; - int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, - 32, 40, 33, 41, 34, 42, 35, 43}; + const int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, + 32, 40, 33, 41, 34, 42, 35, 43}; bool isChnoInLeft = std::find(std::begin(cellsInLeft), std::end(cellsInLeft), chno) != std::end(cellsInLeft); if (isChnoInLeft) { @@ -131,10 +132,10 @@ void EventPlaneHelper::DoCorrections(float& qx, float& qy, qy = (qy - corrections[2] * qx) / (1.0 - corrections[3] * corrections[2]); // Rescaling of the Qx-Qy into a circle. - if (fabs(corrections[4]) > 1e-8) { + if (std::fabs(corrections[4]) > 1e-8) { qx /= corrections[4]; } - if (fabs(corrections[5]) > 1e-8) { + if (std::fabs(corrections[5]) > 1e-8) { qy /= corrections[5]; } } @@ -153,9 +154,9 @@ void EventPlaneHelper::DoTwist(float& qx, float& qy, float lp, float lm) void EventPlaneHelper::DoRescale(float& qx, float& qy, float ap, float am) { - if (fabs(ap) > 1e-8) + if (std::fabs(ap) > 1e-8) qx /= ap; - if (fabs(am) > 1e-8) + if (std::fabs(am) > 1e-8) qy /= am; } diff --git a/Common/Core/FFitWeights.cxx b/Common/Core/FFitWeights.cxx index 3a92114f48c..4133d6453eb 100644 --- a/Common/Core/FFitWeights.cxx +++ b/Common/Core/FFitWeights.cxx @@ -16,12 +16,12 @@ #include "FFitWeights.h" -#include +#include + #include +#include #include -#include - ClassImp(FFitWeights) FFitWeights::FFitWeights() : TNamed("", ""), @@ -111,7 +111,7 @@ void FFitWeights::addArray(TObjArray* targ, TObjArray* sour) } }; -void FFitWeights::qSelection(std::vector nhv, std::vector stv) /* only execute OFFLINE */ +void FFitWeights::qSelection(const std::vector& nhv, const std::vector& stv) /* only execute OFFLINE */ { TObjArray* tar{nullptr}; diff --git a/Common/Core/FFitWeights.h b/Common/Core/FFitWeights.h index c80165730f7..68470f95b55 100644 --- a/Common/Core/FFitWeights.h +++ b/Common/Core/FFitWeights.h @@ -17,22 +17,22 @@ #ifndef COMMON_CORE_FFITWEIGHTS_H_ #define COMMON_CORE_FFITWEIGHTS_H_ -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include #include #include - -#include "TNamed.h" -#include "TObjArray.h" -#include "TH3D.h" -#include "TH2D.h" -#include "TH1D.h" -#include "TFile.h" -#include "TCollection.h" -#include "TString.h" -#include "TMath.h" +#include +#include +#include class FFitWeights : public TNamed { @@ -53,11 +53,11 @@ class FFitWeights : public TNamed TAxis* getqVecAx() { return qAxis; } Long64_t Merge(TCollection* collist); - void qSelection(std::vector nhv, std::vector stv); + void qSelection(const std::vector& nhv, const std::vector& stv); float eval(float centr, const float& dqn, const int nh, const char* pf = ""); void setResolution(int res) { nResolution = res; } int getResolution() const { return nResolution; } - void setQnType(std::vector> qninp) { qnTYPE = qninp; } + void setQnType(const std::vector>& qninp) { qnTYPE = qninp; } private: TObjArray* fW_data; diff --git a/Common/Core/MetadataHelper.cxx b/Common/Core/MetadataHelper.cxx index b8c2fe6ad22..91037d615d0 100644 --- a/Common/Core/MetadataHelper.cxx +++ b/Common/Core/MetadataHelper.cxx @@ -17,8 +17,10 @@ #include "Common/Core/MetadataHelper.h" -#include "Framework/InitContext.h" -#include "Framework/RunningWorkflowInfo.h" +#include +#include + +#include using namespace o2::common::core; diff --git a/Common/Core/OrbitRange.h b/Common/Core/OrbitRange.h index 65e3abe2c69..f499b771e9b 100644 --- a/Common/Core/OrbitRange.h +++ b/Common/Core/OrbitRange.h @@ -13,16 +13,17 @@ // Container to store minimum and maximum orbit counter // -#ifndef OrbitRange_H -#define OrbitRange_H +#ifndef COMMON_CORE_ORBITRANGE_H_ +#define COMMON_CORE_ORBITRANGE_H_ + +#include -#include "TNamed.h" class TCollection; class OrbitRange : public TNamed { public: - OrbitRange(const char* name = "orbitRange") : TNamed(name, name), fRunNumber(0), fMinOrbit(0xFFFFFFFF), fMaxOrbit(0) {} + explicit OrbitRange(const char* name = "orbitRange") : TNamed(name, name), fRunNumber(0), fMinOrbit(0xFFFFFFFF), fMaxOrbit(0) {} ~OrbitRange() {} void SetRunNumber(uint32_t runNumber) { fRunNumber = runNumber; } void SetMinOrbit(uint32_t orbit) { fMinOrbit = orbit; } @@ -39,4 +40,4 @@ class OrbitRange : public TNamed ClassDef(OrbitRange, 1) }; -#endif +#endif // COMMON_CORE_ORBITRANGE_H_ diff --git a/Common/Core/PID/DetectorResponse.h b/Common/Core/PID/DetectorResponse.h index 1f687a4605c..7b8c5bb2406 100644 --- a/Common/Core/PID/DetectorResponse.h +++ b/Common/Core/PID/DetectorResponse.h @@ -17,21 +17,25 @@ /// This provides the basic quantities computed by any response i.e. expected values, resolutions and Nsigmas /// -#ifndef O2_ANALYSIS_PID_DETECTORRESPONSE_H_ -#define O2_ANALYSIS_PID_DETECTORRESPONSE_H_ +#ifndef COMMON_CORE_PID_DETECTORRESPONSE_H_ +#define COMMON_CORE_PID_DETECTORRESPONSE_H_ + +#include #include +#include #include -#include "Framework/Logger.h" // ROOT includes -#include "Rtypes.h" -#include "TMath.h" -#include "TFile.h" +#include +#include + +#include // O2 includes -#include "ReconstructionDataFormats/PID.h" #include "Common/Core/PID/ParamBase.h" +#include + namespace o2::pid { /// \brief Class to handle the general detector response @@ -52,7 +56,7 @@ class DetectorResponse /// \param fname File name used for input /// \param pname Name of the parametrization in the file /// \param ptype Type of the parametrization - void LoadParamFromFile(const TString fname, const TString pname, const Param_t ptype); + void LoadParamFromFile(const TString& fname, const TString& pname, const Param_t ptype); /// Setter for the parametrization /// \param ptype Type of the parametrization @@ -65,7 +69,7 @@ class DetectorResponse /// Setter for the parametrizations parameters, if the parametrization is not yet initialized a new parametrization is created without any implementation and just parameters /// \param ptype parametrization type /// \param p vector with parameters - void SetParameters(const Param_t ptype, std::vector p); + void SetParameters(const Param_t ptype, const std::vector& p); /// Getter for the value of the parametrization /// \param ptype parametrization type @@ -85,7 +89,7 @@ inline void DetectorResponse::LoadParam(const Param_t ptype, Parametrization* pa mParam[ptype] = param; } -inline void DetectorResponse::LoadParamFromFile(const TString fname, const TString pname, const Param_t ptype) +inline void DetectorResponse::LoadParamFromFile(const TString& fname, const TString& pname, const Param_t ptype) { TFile f(fname, "READ"); if (!f.Get(pname)) { @@ -97,7 +101,7 @@ inline void DetectorResponse::LoadParamFromFile(const TString fname, const TStri mParam[ptype]->Print(); } -inline void DetectorResponse::SetParameters(const DetectorResponse::Param_t ptype, std::vector p) +inline void DetectorResponse::SetParameters(const DetectorResponse::Param_t ptype, const std::vector& p) { if (!mParam[ptype]) { const std::string pname = std::string(ParamName[ptype]) + "_default_param"; @@ -110,4 +114,4 @@ inline void DetectorResponse::SetParameters(const DetectorResponse::Param_t ptyp } // namespace o2::pid -#endif // O2_ANALYSIS_PID_DETECTORRESPONSE_H_ +#endif // COMMON_CORE_PID_DETECTORRESPONSE_H_ diff --git a/Common/Core/PID/PIDTOF.h b/Common/Core/PID/PIDTOF.h index ad16716916c..5822732dc5c 100644 --- a/Common/Core/PID/PIDTOF.h +++ b/Common/Core/PID/PIDTOF.h @@ -24,18 +24,19 @@ #include // ROOT includes -#include "Rtypes.h" -#include "TMath.h" -#include "TGraph.h" -#include "TFile.h" -#include "TF2.h" +#include +#include +#include +#include + +#include // O2 includes -#include "DataFormatsTOF/ParameterContainers.h" -#include "Framework/Logger.h" -#include "ReconstructionDataFormats/PID.h" -#include "Framework/DataTypes.h" -#include "CommonConstants/PhysicsConstants.h" +#include +#include +#include +#include +#include namespace o2::pid::tof { @@ -444,7 +445,7 @@ class ExpTimes static constexpr float mMassZSqared = mMassZ * mMassZ; /// (M/z)^2 /// Computes the expected time of a track, given it TOF expected momentum - static float ComputeExpectedTime(const float tofExpMom, const float length) { return length * sqrt((mMassZSqared) + (tofExpMom * tofExpMom)) / (o2::constants::physics::LightSpeedCm2PS * tofExpMom); } + static float ComputeExpectedTime(const float tofExpMom, const float length) { return length * std::sqrt((mMassZSqared) + (tofExpMom * tofExpMom)) / (o2::constants::physics::LightSpeedCm2PS * tofExpMom); } /// Gets the expected signal of the track of interest under the PID assumption /// \param track Track of interest @@ -485,11 +486,11 @@ class ExpTimes static float GetExpectedSigma(const ParamType& parameters, const TrackType& track, const float tofSignal, const float collisionTimeRes) { const float& mom = track.p(); - const float& eta = track.eta(); + const float& etaTrack = track.eta(); if (mom <= 0) { return -999.f; } - const float reso = parameters.template getResolution(mom, eta); + const float reso = parameters.template getResolution(mom, etaTrack); if (reso > 0) { return std::sqrt(reso * reso + parameters[4] * parameters[4] + collisionTimeRes * collisionTimeRes); } diff --git a/Common/Core/PID/ParamBase.cxx b/Common/Core/PID/ParamBase.cxx index 74824781d07..a79ed660b7d 100644 --- a/Common/Core/PID/ParamBase.cxx +++ b/Common/Core/PID/ParamBase.cxx @@ -17,14 +17,17 @@ /// These are the basic storage elements to be kept in the CCDB /// -#include "PID/ParamBase.h" -#include "Framework/Logger.h" -#include "TFile.h" +#include +#include + +#include + +#include namespace o2::pid { -void Parameters::SetParameters(const std::vector params) +void Parameters::SetParameters(const std::vector& params) { if (mPar.size() != params.size()) { LOG(fatal) << "Updating parametrization size! Trying to fit a parametrization of size " << params.size() << " into one of size " << mPar.size(); @@ -40,7 +43,7 @@ void Parameters::Print(Option_t* /*options*/) const } }; -void Parameters::LoadParamFromFile(const TString FileName, const TString ParamName) +void Parameters::LoadParamFromFile(const TString& FileName, const TString& ParamName) { TFile f(FileName, "READ"); if (!f.Get(ParamName)) { @@ -66,7 +69,7 @@ void Parametrization::Print(Option_t* options) const mParameters.Print(options); }; -void Parametrization::LoadParamFromFile(const TString FileName, const TString ParamName) +void Parametrization::LoadParamFromFile(const TString& FileName, const TString& ParamName) { TFile f(FileName, "READ"); if (!f.Get(ParamName)) { diff --git a/Common/Core/PID/ParamBase.h b/Common/Core/PID/ParamBase.h index ec4b17083f4..cc7812c3036 100644 --- a/Common/Core/PID/ParamBase.h +++ b/Common/Core/PID/ParamBase.h @@ -26,10 +26,10 @@ #include // std::vector // ROOT includes -#include "TNamed.h" -#include "TFile.h" +#include -#include "Framework/Logger.h" +#include +#include namespace o2::pid { @@ -49,11 +49,11 @@ class Parameters : public TNamed /// Parametric constructor /// \param size Number of parameters in the container - Parameters(const TString name, unsigned int size) : TNamed(name, name), mPar(std::vector(size)) {} + Parameters(const TString& name, unsigned int size) : TNamed(name, name), mPar(std::vector(size)) {} /// Parametric constructor /// \param params Parameters to initialize the container - Parameters(const TString name, const std::vector params) : TNamed(name, name), mPar{} { SetParameters(params); } + Parameters(const TString& name, const std::vector& params) : TNamed(name, name), mPar{} { SetParameters(params); } /// Default destructor ~Parameters() override = default; @@ -69,11 +69,11 @@ class Parameters : public TNamed /// Setter for the parameter, using a vector /// \param params vector with parameters - void SetParameters(const std::vector params); + void SetParameters(const std::vector& params); /// Setter for the parameter, using a parameter object /// \param params parameter object with parameters - void SetParameters(const Parameters params) { SetParameters(params.mPar); } + void SetParameters(const Parameters& params) { SetParameters(params.mPar); } /// Setter for the parameter, using a parameter pointer /// \param params pointer to parameter object with parameters @@ -85,7 +85,7 @@ class Parameters : public TNamed /// Loader from file /// \param FileName name of the input file /// \param ParamName name of the input object - void LoadParamFromFile(const TString FileName, const TString ParamName); + void LoadParamFromFile(const TString& FileName, const TString& ParamName); /// Getter for the parameters /// \return returns an array of parameters @@ -138,7 +138,7 @@ class PidParameters : public TNamed /// Setter for the parameter, using a parameter object /// \param params parameter object with parameters - void SetParameters(const PidParameters params) { SetParameters(params.mPar); } + void SetParameters(const PidParameters& params) { SetParameters(params.mPar); } /// Setter for the parameter, using a parameter pointer /// \param params pointer to parameter object with parameters @@ -164,7 +164,7 @@ class PidParameters : public TNamed /// Loader from file /// \param FileName name of the input file /// \param ParamName name of the input object - void LoadParamFromFile(const TString FileName, const TString ParamName) + void LoadParamFromFile(const TString& FileName, const TString& ParamName) { TFile f(FileName, "READ"); if (!f.Get(ParamName)) { @@ -215,12 +215,12 @@ class Parametrization : public TNamed /// Parametric constructor /// \param name Name (and title) of the parametrization /// \param size Number of parameters of the parametrization - Parametrization(TString name, unsigned int size) : TNamed(name, name), mParameters(name + "Parameters", size) {} + Parametrization(const TString& name, unsigned int size) : TNamed(name, name), mParameters(name + "Parameters", size) {} /// Parametric constructor /// \param name Name (and title) of the parametrization /// \param params Parameters of the parametrization - Parametrization(TString name, const std::vector params) : TNamed(name, name), mParameters{name + "Parameters", params} {} + Parametrization(const TString& name, const std::vector& params) : TNamed(name, name), mParameters{name + "Parameters", params} {} /// Default destructor ~Parametrization() override = default; @@ -235,7 +235,7 @@ class Parametrization : public TNamed /// Loader from file /// \param FileName name of the input file /// \param ParamName name of the input object - void LoadParamFromFile(const TString FileName, const TString ParamName); + void LoadParamFromFile(const TString& FileName, const TString& ParamName); /// Setter for the parameter at position iparam /// \param iparam index in the array of the parameters diff --git a/Common/Core/TableHelper.cxx b/Common/Core/TableHelper.cxx index 04745ffe694..57f03e43c35 100644 --- a/Common/Core/TableHelper.cxx +++ b/Common/Core/TableHelper.cxx @@ -17,8 +17,8 @@ #include "Common/Core/TableHelper.h" -#include "Framework/InitContext.h" -#include "Framework/RunningWorkflowInfo.h" +#include +#include #include @@ -26,7 +26,7 @@ /// @param initContext initContext of the init function void o2::common::core::printTablesInWorkflow(o2::framework::InitContext& initContext) { - auto& workflows = initContext.services().get(); + const auto& workflows = initContext.services().get(); for (auto const& device : workflows.devices) { for (auto const& input : device.inputs) { LOG(info) << "Table: " << input.matcher.binding << " in device: " << device.name; @@ -41,7 +41,7 @@ bool o2::common::core::isTableRequiredInWorkflow(o2::framework::InitContext& ini { LOG(debug) << "Checking if table " << table << " is needed"; bool tableNeeded = false; - auto& workflows = initContext.services().get(); + const auto& workflows = initContext.services().get(); for (auto const& device : workflows.devices) { for (auto const& input : device.inputs) { if (input.matcher.binding == table) { diff --git a/Common/Core/TableHelper.h b/Common/Core/TableHelper.h index 56d2264ed6c..40f31515a79 100644 --- a/Common/Core/TableHelper.h +++ b/Common/Core/TableHelper.h @@ -18,9 +18,9 @@ #ifndef COMMON_CORE_TABLEHELPER_H_ #define COMMON_CORE_TABLEHELPER_H_ -#include "Framework/Configurable.h" -#include "Framework/InitContext.h" -#include "Framework/RunningWorkflowInfo.h" +#include +#include +#include #include @@ -70,7 +70,7 @@ bool getTaskOptionValue(o2::framework::InitContext& initContext, const std::stri if (verbose) { LOG(info) << "Checking for option '" << optName << "' in task '" << taskName << "'"; } - auto& workflows = initContext.services().get(); + const auto& workflows = initContext.services().get(); int deviceCounter = 0; bool found = false; for (auto const& device : workflows.devices) { diff --git a/Common/Core/TrackSelection.cxx b/Common/Core/TrackSelection.cxx index 717d7db77f5..474a6859e0c 100644 --- a/Common/Core/TrackSelection.cxx +++ b/Common/Core/TrackSelection.cxx @@ -13,9 +13,14 @@ // Class for track selection // -#include "Framework/Logger.h" #include "Common/Core/TrackSelection.h" +#include + +#include +#include +#include + bool TrackSelection::FulfillsITSHitRequirements(uint8_t itsClusterMap) const { constexpr uint8_t bit = 1; @@ -167,7 +172,7 @@ void TrackSelection::print() const LOG(info) << mCutNames[i] << " == " << mRequireITSRefit; break; case TrackCuts::kITSHits: - for (auto& itsRequirement : mRequiredITSHits) { + for (const auto& itsRequirement : mRequiredITSHits) { LOG(info) << mCutNames[i] << " == " << itsRequirement.first; } break; diff --git a/Common/Core/TrackSelection.h b/Common/Core/TrackSelection.h index 19d77a198e1..4be97408f73 100644 --- a/Common/Core/TrackSelection.h +++ b/Common/Core/TrackSelection.h @@ -16,13 +16,15 @@ #ifndef COMMON_CORE_TRACKSELECTION_H_ #define COMMON_CORE_TRACKSELECTION_H_ +#include "Framework/DataTypes.h" +#include "Framework/Logger.h" + +#include + #include -#include -#include #include -#include "Framework/Logger.h" -#include "Framework/DataTypes.h" -#include "Rtypes.h" +#include +#include class TrackSelection { diff --git a/Common/Core/trackUtilities.h b/Common/Core/trackUtilities.h index e67e0f82d6f..21d30990e72 100644 --- a/Common/Core/trackUtilities.h +++ b/Common/Core/trackUtilities.h @@ -17,12 +17,14 @@ #ifndef COMMON_CORE_TRACKUTILITIES_H_ #define COMMON_CORE_TRACKUTILITIES_H_ -#include // std::move -#include "CommonConstants/MathConstants.h" -#include "ReconstructionDataFormats/Track.h" -#include "ReconstructionDataFormats/Vertex.h" #include "Common/Core/RecoDecay.h" +#include +#include +#include + +#include // std::move + /// Extracts track parameters from a track. template o2::track::TrackParametrization getTrackPar(const T& track) @@ -122,12 +124,12 @@ auto getRotatedCovMatrixXX(const T& matrix, U phi, V theta) template void getPxPyPz(T const& trackPars, U& pVec) { - auto pt = 1.f / std::abs(trackPars.getQ2Pt()); + auto ptTrack = 1.f / std::abs(trackPars.getQ2Pt()); float cs = cosf(trackPars.getAlpha()), sn = sinf(trackPars.getAlpha()); auto r = std::sqrt((1.f - trackPars.getSnp()) * (1.f + trackPars.getSnp())); - pVec[0] = pt * (r * cs - trackPars.getSnp() * sn); - pVec[1] = pt * (trackPars.getSnp() * cs + r * sn); - pVec[2] = pt * trackPars.getTgl(); + pVec[0] = ptTrack * (r * cs - trackPars.getSnp() * sn); + pVec[1] = ptTrack * (trackPars.getSnp() * cs + r * sn); + pVec[2] = ptTrack * trackPars.getTgl(); } /// Calculates DCA XYZ of a track w.r.t. the primary vertex and its uncertainty if required. diff --git a/Common/TableProducer/PID/pidBayes.cxx b/Common/TableProducer/PID/pidBayes.cxx index abedb281668..5a91afa6f70 100644 --- a/Common/TableProducer/PID/pidBayes.cxx +++ b/Common/TableProducer/PID/pidBayes.cxx @@ -16,29 +16,30 @@ /// Only the tables for the mass hypotheses requested are filled, the others are sent empty. /// -#include #include -#include #include #include +#include +#include // O2 includes -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/Array2D.h" -#include "CCDB/BasicCCDBManager.h" -#include "Common/Core/PID/TPCPIDResponse.h" +#include "pidTOFBase.h" + #include "Common/Core/PID/DetectorResponse.h" -#include "Common/Core/PID/ParamBase.h" #include "Common/Core/PID/PIDTOF.h" +#include "Common/Core/PID/ParamBase.h" +#include "Common/Core/PID/TPCPIDResponse.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/PIDResponseCombined.h" -#include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" +#include "Common/DataModel/TrackSelectionTables.h" -#include "pidTOFBase.h" +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -52,7 +53,7 @@ void customize(std::vector& workflowOptions) std::swap(workflowOptions, options); } -#include "Framework/runDataProcessing.h" +#include struct bayesPid { using Trks = soa::Join; @@ -163,7 +164,7 @@ struct bayesPid { } // Checking the tables are requested in the workflow and enabling them - auto& workflows = initContext.services().get(); + const auto& workflows = initContext.services().get(); for (DeviceSpec const& device : workflows.devices) { for (auto const& input : device.inputs) { auto enableFlag = [&input](const PID::ID& id, Configurable& flag) { @@ -284,12 +285,12 @@ struct bayesPid { // bethe = fTPCResponse.GetExpectedSignal(track, type, AliTPCPIDResponse::kdEdxDefault, fUseTPCEtaCorrection, fUseTPCMultiplicityCorrection, fUseTPCPileupCorrection); // sigma = fTPCResponse.GetExpectedSigma(track, type, AliTPCPIDResponse::kdEdxDefault, fUseTPCEtaCorrection, fUseTPCMultiplicityCorrection, fUseTPCPileupCorrection); - if (abs(dedx - bethe) > fRange * sigma) { - // Probability[kTPC][pid] = exp(-0.5 * fRange * fRange) / sigma; // BUG fix - Probability[kTPC][pid] = exp(-0.5 * fRange * fRange); + if (std::abs(dedx - bethe) > fRange * sigma) { + // Probability[kTPC][pid] = std::exp(-0.5 * fRange * fRange) / sigma; // BUG fix + Probability[kTPC][pid] = std::exp(-0.5 * fRange * fRange); } else { - // Probability[kTPC][pid] = exp(-0.5 * (dedx - bethe) * (dedx - bethe) / (sigma * sigma)) / sigma; //BUG fix - Probability[kTPC][pid] = exp(-0.5 * (dedx - bethe) * (dedx - bethe) / (sigma * sigma)); + // Probability[kTPC][pid] = std::exp(-0.5 * (dedx - bethe) * (dedx - bethe) / (sigma * sigma)) / sigma; //BUG fix + Probability[kTPC][pid] = std::exp(-0.5 * (dedx - bethe) * (dedx - bethe) / (sigma * sigma)); mismatch = false; } if (Probability[kTPC][pid] <= 0.f) { @@ -325,10 +326,10 @@ struct bayesPid { constexpr respTOF responseTOFPID; // const float pt = track.pt(); - float mismPropagationFactor[10] = {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}; + const float mismPropagationFactor[10] = {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}; // In the O2 this cannot be done because the cluster information is missing in the AOD // if (!fNoTOFmism) { // this flag allows to disable mismatch for iterative procedure to get prior probabilities - // mismPropagationFactor[3] = 1 + exp(1 - 1.12 * pt); // it has to be aligned with the one in AliPIDCombined + // mismPropagationFactor[3] = 1 + std::exp(1 - 1.12 * pt); // it has to be aligned with the one in AliPIDCombined // mismPropagationFactor[4] = 1 + 1. / (4.71114 - 5.72372 * pt + 2.94715 * pt * pt); // it has to be aligned with the one in AliPIDCombined // int nTOFcluster = 0; @@ -342,10 +343,10 @@ struct bayesPid { // nTOFcluster = 80; // break; // case kPPB: // pPb 5.05 ATeV - // nTOFcluster = int(308 - 2.12 * fCurrCentrality + exp(4.917 - 0.1604 * fCurrCentrality)); + // nTOFcluster = int(308 - 2.12 * fCurrCentrality + std::exp(4.917 - 0.1604 * fCurrCentrality)); // break; // case kPBPB: // PbPb 2.76 ATeV - // nTOFcluster = int(exp(9.4 - 0.022 * fCurrCentrality)); + // nTOFcluster = int(std::exp(9.4 - 0.022 * fCurrCentrality)); // break; // } // } @@ -376,9 +377,9 @@ struct bayesPid { const float sig = /*responseTOFPID.GetExpectedSigma(Response[kTOF], track)*/ +0.f; if (nsigmas < fTOFtail) { - Probability[kTOF][pid] = exp(-0.5 * nsigmas * nsigmas) / sig; + Probability[kTOF][pid] = std::exp(-0.5 * nsigmas * nsigmas) / sig; } else { - Probability[kTOF][pid] = exp(-(nsigmas - fTOFtail * 0.5) * fTOFtail) / sig; + Probability[kTOF][pid] = std::exp(-(nsigmas - fTOFtail * 0.5) * fTOFtail) / sig; } Probability[kTOF][pid] += fgTOFmismatchProb * mismPropagationFactor[pid]; @@ -556,7 +557,7 @@ struct bayesPidQa { double lmin = TMath::Log10(min); double ldelta = (TMath::Log10(max) - lmin) / (static_cast(kNBins)); for (int i = 0; i < kNBins; i++) { - binp[i] = exp(TMath::Log(10) * (lmin + i * ldelta)); + binp[i] = std::exp(TMath::Log(10) * (lmin + i * ldelta)); } binp[kNBins] = max + 1; h->GetXaxis()->Set(kNBins, binp); diff --git a/Common/TableProducer/PID/pidTOFBase.cxx b/Common/TableProducer/PID/pidTOFBase.cxx index f0f9722fc6b..f55a4049e04 100644 --- a/Common/TableProducer/PID/pidTOFBase.cxx +++ b/Common/TableProducer/PID/pidTOFBase.cxx @@ -15,25 +15,27 @@ /// \brief Base to build tasks for TOF PID tasks. /// +#include #include #include -#include // O2 includes -#include "CCDB/BasicCCDBManager.h" -#include "TOFBase/EventTimeMaker.h" -#include "Framework/AnalysisTask.h" -#include "ReconstructionDataFormats/Track.h" +#include +#include +#include +#include // O2Physics includes -#include "Common/DataModel/TrackSelectionTables.h" +#include "TableHelper.h" +#include "pidTOFBase.h" + #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/FT0Corrected.h" #include "Common/DataModel/Multiplicity.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -#include "TableHelper.h" -#include "pidTOFBase.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include using namespace o2; using namespace o2::framework; @@ -111,7 +113,7 @@ struct tofSignal { if (enableTableFlags) { tableFlags.reserve(tracks.size()); } - for (auto& t : tracks) { + for (const auto& t : tracks) { const auto s = o2::pid::tof::TOFSignal::GetTOFSignal(t); if (enableQaHistograms) { histos.fill(HIST("tofSignal"), s); @@ -139,7 +141,7 @@ struct tofSignal { if (enableTableFlags) { tableFlags.reserve(tracks.size()); } - for (auto& t : tracks) { + for (const auto& t : tracks) { table(o2::pid::tof::TOFSignal::GetTOFSignal(t)); if (!enableTableFlags) { continue; @@ -388,7 +390,7 @@ struct tofEventTime { evTimeTOF.removeBias(trk, nGoodTracksForTOF, et, erret, 2); } uint8_t flags = 0; - if (erret < errDiamond && (maxEvTimeTOF <= 0.f || abs(et) < maxEvTimeTOF)) { + if (erret < errDiamond && (maxEvTimeTOF <= 0.f || std::abs(et) < maxEvTimeTOF)) { flags |= o2::aod::pidflags::enums::PIDFlags::EvTimeTOF; } else { et = 0.f; @@ -407,7 +409,7 @@ struct tofEventTime { /// /// Process function to prepare the event for each track on Run 3 data with the FT0 using EvTimeCollisionsFT0 = soa::Join; - void processFT0(TrksEvTime& tracks, + void processFT0(TrksEvTime const& tracks, aod::FT0s const&, EvTimeCollisionsFT0 const&) { @@ -463,7 +465,7 @@ struct tofEventTime { if constexpr (removeTOFEvTimeBias) { evTimeTOF.removeBias(trk, nGoodTracksForTOF, t0TOF[0], t0TOF[1], 2); } - if (t0TOF[1] < errDiamond && (maxEvTimeTOF <= 0 || abs(t0TOF[0]) < maxEvTimeTOF)) { + if (t0TOF[1] < errDiamond && (maxEvTimeTOF <= 0 || std::abs(t0TOF[0]) < maxEvTimeTOF)) { flags |= o2::aod::pidflags::enums::PIDFlags::EvTimeTOF; weight = 1.f / (t0TOF[1] * t0TOF[1]); @@ -491,7 +493,7 @@ struct tofEventTime { } else { tableFlags(flags); } - tableEvTime(eventTime / sumOfWeights, sqrt(1. / sumOfWeights)); + tableEvTime(eventTime / sumOfWeights, std::sqrt(1. / sumOfWeights)); if (enableTableTOFOnly) { tableEvTimeTOFOnly((uint8_t)filterForTOFEventTime(trk), t0TOF[0], t0TOF[1], evTimeTOF.mEventTimeMultiplicity); } @@ -502,7 +504,7 @@ struct tofEventTime { /// /// Process function to prepare the event for each track on Run 3 data with only the FT0 - void processOnlyFT0(TrksEvTime& tracks, + void processOnlyFT0(TrksEvTime const& tracks, aod::FT0s const&, EvTimeCollisionsFT0 const&) { diff --git a/Common/TableProducer/PID/pidTOFMerge.cxx b/Common/TableProducer/PID/pidTOFMerge.cxx index 7ea0ac3b3b1..91c76e6e50a 100644 --- a/Common/TableProducer/PID/pidTOFMerge.cxx +++ b/Common/TableProducer/PID/pidTOFMerge.cxx @@ -22,12 +22,12 @@ #include // O2 includes -#include "CCDB/BasicCCDBManager.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/Track.h" -#include "TOFBase/EventTimeMaker.h" +#include +#include +#include +#include +#include +#include // O2Physics includes #include "CollisionTypeHelper.h" @@ -83,14 +83,14 @@ struct TOFCalibConfig { } template - void getCfg(o2::framework::InitContext& initContext, const std::string name, VType& v, const std::string task) + void getCfg(o2::framework::InitContext& initContext, const std::string& name, VType& v, const std::string& task) { if (!getTaskOptionValue(initContext, task, name, v, false)) { LOG(fatal) << "Could not get " << name << " from " << task << " task"; } } - void inheritFromBaseTask(o2::framework::InitContext& initContext, const std::string task = "tof-signal") + void inheritFromBaseTask(o2::framework::InitContext& initContext, const std::string& task = "tof-signal") { mInitMode = 2; getCfg(initContext, "ccdb-url", mUrl, task); @@ -329,7 +329,7 @@ struct TOFCalibConfig { // Configurable options std::string mUrl; std::string mPathGrpLhcIf; - int64_t mTimestamp; + int64_t mTimestamp{0}; std::string mTimeShiftCCDBPathPos; std::string mTimeShiftCCDBPathNeg; std::string mTimeShiftCCDBPathPosMC; @@ -338,10 +338,10 @@ struct TOFCalibConfig { std::string mParametrizationPath; std::string mReconstructionPass; std::string mReconstructionPassDefault; - bool mFatalOnPassNotAvailable; - bool mEnableTimeDependentResponse; - int mCollisionSystem; - bool mAutoSetProcessFunctions; + bool mFatalOnPassNotAvailable{false}; + bool mEnableTimeDependentResponse{false}; + int mCollisionSystem{-1}; + bool mAutoSetProcessFunctions{false}; }; // Part 1 TOF signal definition diff --git a/Common/TableProducer/PID/pidTPC.cxx b/Common/TableProducer/PID/pidTPC.cxx index e9c2015afbc..fd6efd7bff8 100644 --- a/Common/TableProducer/PID/pidTPC.cxx +++ b/Common/TableProducer/PID/pidTPC.cxx @@ -24,9 +24,9 @@ #include #include // ROOT includes -#include "TFile.h" -#include "TRandom.h" -#include "TSystem.h" +#include +#include +#include // O2 includes #include "MetadataHelper.h" @@ -39,13 +39,13 @@ #include "Common/DataModel/PIDResponseTPC.h" #include "Tools/ML/model.h" -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/Track.h" +#include +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -166,7 +166,7 @@ struct tpcPid { } response = new o2::pid::tpc::Response(); // Checking the tables are requested in the workflow and enabling them - auto enableFlag = [&](const std::string particle, Configurable& flag) { + auto enableFlag = [&](const std::string& particle, Configurable& flag) { enableFlagIfTableRequired(initContext, "pidTPC" + particle, flag); }; enableFlag("FullEl", pidFullEl); @@ -376,7 +376,7 @@ struct tpcPid { if ((in_batch_counter == track_prop_size) || (total_input_count == total_eval_size)) { // If the batch size is reached, reset the counter int32_t fill_shift = (exec_counter * track_prop_size - ((total_input_count == total_eval_size) ? (total_input_count % track_prop_size) : 0)) * output_dimensions; auto start_network_eval = std::chrono::high_resolution_clock::now(); - float* output_network = network.evalModel(track_properties); + const float* output_network = network.evalModel(track_properties); auto stop_network_eval = std::chrono::high_resolution_clock::now(); duration_network += std::chrono::duration>(stop_network_eval - start_network_eval).count(); @@ -437,8 +437,8 @@ struct tpcPid { } } auto expSignal = response->GetExpectedSignal(trk, pid); - auto expSigma = trk.has_collision() ? response->GetExpectedSigma(collisions.iteratorAt(trk.collisionId()), trk, pid) : 0.07 * expSignal; // use default sigma value of 7% if no collision information to estimate resolution - if (expSignal < 0. || expSigma < 0.) { // skip if expected signal invalid + auto expSigma = trk.has_collision() ? response->GetExpectedSigma(collisions.iteratorAt(trk.collisionId()), trk, pid) : 0.07f * expSignal; // use default sigma value of 7% if no collision information to estimate resolution + if (expSignal < 0. || expSigma < 0.) { // skip if expected signal invalid if (flagFull) tableFull(-999.f, -999.f); if (flagTiny) diff --git a/Common/TableProducer/caloClusterProducer.cxx b/Common/TableProducer/caloClusterProducer.cxx index 086885beb4c..6b660ad4c68 100644 --- a/Common/TableProducer/caloClusterProducer.cxx +++ b/Common/TableProducer/caloClusterProducer.cxx @@ -14,36 +14,35 @@ /// /// \author Dmitri Peresunko +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/CaloClusters.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include #include #include #include #include -#include "Framework/ConfigParamSpec.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/CaloClusters.h" -#include "Common/Core/trackUtilities.h" -#include "ReconstructionDataFormats/TrackParametrization.h" -#include "DetectorsBase/Propagator.h" - -#include "CommonUtils/NameConf.h" -#include "CCDB/BasicCCDBManager.h" -#include "SimulationDataFormat/MCTruthContainer.h" - -#include "DataFormatsParameters/GRPMagField.h" -#include "DataFormatsPHOS/Cell.h" -#include "DataFormatsPHOS/Cluster.h" -#include "DataFormatsPHOS/TriggerRecord.h" -#include "DataFormatsPHOS/MCLabel.h" -#include "DataFormatsPHOS/BadChannelsMap.h" -#include "DataFormatsPHOS/CalibParams.h" -#include "PHOSBase/Geometry.h" -#include "PHOSReconstruction/Clusterer.h" - using namespace o2::framework; using namespace o2; @@ -105,9 +104,9 @@ struct CaloClusterProducer { ~TrackTrigRec() = default; public: - int64_t mTR; // BC ref - int mStart[kCpvCells]; // X (phi) track coordinate in PHOS plane - int mEnd[kCpvCells]; // Z (theta) track coordinate in PHOS plane + int64_t mTR{-1}; // BC ref + int mStart[kCpvCells] = {0}; // X (phi) track coordinate in PHOS plane + int mEnd[kCpvCells] = {0}; // Z (theta) track coordinate in PHOS plane }; void init(o2::framework::InitContext&) @@ -141,18 +140,18 @@ struct CaloClusterProducer { // If several collisions appear in BC, choose one with largers number of contributors std::map colMap; - int colId = 0; + int colIdOuter = 0; for (const auto& cl : colls) { auto colbc = colMap.find(cl.bc_as().globalBC()); if (colbc == colMap.end()) { // single collision per BC - colMap[cl.bc_as().globalBC()] = colId; + colMap[cl.bc_as().globalBC()] = colIdOuter; } else { // not unique collision per BC auto coll2 = colls.begin() + colbc->second; if (cl.numContrib() > coll2.numContrib()) { - colMap[cl.bc_as().globalBC()] = colId; + colMap[cl.bc_as().globalBC()] = colIdOuter; } } - colId++; + colIdOuter++; } // Fill list of cells and cell TrigRecs per TF as an input for clusterizer @@ -272,13 +271,13 @@ struct CaloClusterProducer { // Extract primary vertex TVector3 vtx = {0., 0., 0.}; // default, if not collision will be found - int colId = -1; + int colIdInner = -1; auto coliter = colMap.find(cluTR.getBCData().toLong()); if (coliter != colMap.end()) { // get vertex from collision // find collision corresponding to current BC auto clvtx = colls.begin() + coliter->second; vtx.SetXYZ(clvtx.posX(), clvtx.posY(), clvtx.posZ()); - colId = coliter->second; + colIdInner = coliter->second; } bool cpvExist = false; @@ -381,7 +380,7 @@ struct CaloClusterProducer { clu.getElipsAxis(lambdaShort, lambdaLong); // Clear Collision assignment - if (colId == -1) { + if (colIdInner == -1) { // Ambiguos Collision assignment cluambcursor( bcMap[cluTR.getBCData().toLong()], @@ -395,7 +394,7 @@ struct CaloClusterProducer { clu.getDistanceToBadChannel()); } else { // Normal collision - auto col = colls.begin() + colId; + auto col = colls.begin() + colIdInner; clucursor( col, mom.X(), mom.Y(), mom.Z(), e, @@ -435,18 +434,18 @@ struct CaloClusterProducer { // If several collisions appear in BC, choose one with largers number of contributors std::map colMap; - int colId = 0; + int colIdOuter = 0; for (auto const& cl : colls) { auto colbc = colMap.find(cl.bc_as().globalBC()); if (colbc == colMap.end()) { // single collision per BC - colMap[cl.bc_as().globalBC()] = colId; + colMap[cl.bc_as().globalBC()] = colIdOuter; } else { // not unique collision per BC auto coll2 = colls.begin() + colbc->second; if (cl.numContrib() > coll2.numContrib()) { - colMap[cl.bc_as().globalBC()] = colId; + colMap[cl.bc_as().globalBC()] = colIdOuter; } } - colId++; + colIdOuter++; } // Fill list of cells and cell TrigRecs per TF as an input for clusterizer @@ -588,13 +587,13 @@ struct CaloClusterProducer { // Extract primary vertex TVector3 vtx = {0., 0., 0.}; // default, if not collision will be found - int colId = -1; + int colIdInner = -1; auto coliter = colMap.find(cluTR.getBCData().toLong()); if (coliter != colMap.end()) { // get vertex from collision // find collision corresponding to current BC auto clvtx = colls.begin() + coliter->second; vtx.SetXYZ(clvtx.posX(), clvtx.posY(), clvtx.posZ()); - colId = coliter->second; + colIdInner = coliter->second; } bool cpvExist = false; @@ -705,7 +704,7 @@ struct CaloClusterProducer { mcamplitudes.push_back(cellLab.getEdep()); } // Clear Collision assignment - if (colId == -1) { + if (colIdInner == -1) { // Ambiguos Collision assignment cluambcursor( bcMap[cluTR.getBCData().toLong()], @@ -722,7 +721,7 @@ struct CaloClusterProducer { mcamplitudes); } else { // Normal collision - auto col = colls.begin() + colId; + auto col = colls.begin() + colIdInner; clucursor( col, mom.X(), mom.Y(), mom.Z(), e, @@ -778,18 +777,18 @@ struct CaloClusterProducer { // If several collisions appear in BC, choose one with largers number of contributors std::map colMap; - int colId = 0; + int colIdOuter = 0; for (const auto& cl : colls) { auto colbc = colMap.find(cl.bc_as().globalBC()); if (colbc == colMap.end()) { // single collision per BC - colMap[cl.bc_as().globalBC()] = colId; + colMap[cl.bc_as().globalBC()] = colIdOuter; } else { // not unique collision per BC auto coll2 = colls.begin() + colbc->second; if (cl.numContrib() > coll2.numContrib()) { - colMap[cl.bc_as().globalBC()] = colId; + colMap[cl.bc_as().globalBC()] = colIdOuter; } } - colId++; + colIdOuter++; } // Fill list of cells and cell TrigRecs per TF as an input for clusterizer // clusterize @@ -982,13 +981,13 @@ struct CaloClusterProducer { // Extract primary vertex TVector3 vtx = {0., 0., 0.}; // default, if not collision will be found - int colId = -1; + int colIdInner = -1; auto coliter = colMap.find(cluTR.getBCData().toLong()); if (coliter != colMap.end()) { // get vertex from collision // find collision corresponding to current BC auto clvtx = colls.begin() + coliter->second; vtx.SetXYZ(clvtx.posX(), clvtx.posY(), clvtx.posZ()); - colId = coliter->second; + colIdInner = coliter->second; } bool cpvExist = false; @@ -1119,7 +1118,7 @@ struct CaloClusterProducer { if (cpvExist) { cpvindex = -1; // there were CPV clusters } - if (colId == -1) { + if (colIdInner == -1) { // Ambiguos Collision assignment cluambcursor( bcMap[cluTR.getBCData().toLong()], @@ -1133,7 +1132,7 @@ struct CaloClusterProducer { clu.getDistanceToBadChannel()); } else { // Normal collision - auto col = colls.begin() + colId; + auto col = colls.begin() + colIdInner; clucursor( col, mom.X(), mom.Y(), mom.Z(), e, @@ -1187,18 +1186,18 @@ struct CaloClusterProducer { // If several collisions appear in BC, choose one with largers number of contributors std::map colMap; - int colId = 0; + int colIdOuter = 0; for (const auto& cl : colls) { auto colbc = colMap.find(cl.bc_as().globalBC()); if (colbc == colMap.end()) { // single collision per BC - colMap[cl.bc_as().globalBC()] = colId; + colMap[cl.bc_as().globalBC()] = colIdOuter; } else { // not unique collision per BC auto coll2 = colls.begin() + colbc->second; if (cl.numContrib() > coll2.numContrib()) { - colMap[cl.bc_as().globalBC()] = colId; + colMap[cl.bc_as().globalBC()] = colIdOuter; } } - colId++; + colIdOuter++; } // Fill list of cells and cell TrigRecs per TF as an input for clusterizer // clusterize @@ -1413,13 +1412,13 @@ struct CaloClusterProducer { // Extract primary vertex TVector3 vtx = {0., 0., 0.}; // default, if not collision will be found - int colId = -1; + int colIdInner = -1; auto coliter = colMap.find(cluTR.getBCData().toLong()); if (coliter != colMap.end()) { // get vertex from collision // find collision corresponding to current BC auto clvtx = colls.begin() + coliter->second; vtx.SetXYZ(clvtx.posX(), clvtx.posY(), clvtx.posZ()); - colId = coliter->second; + colIdInner = coliter->second; } bool cpvExist = false; @@ -1555,7 +1554,7 @@ struct CaloClusterProducer { mclabels.push_back(cellLab.getTrackID()); // Track ID in current event? mcamplitudes.push_back(cellLab.getEdep()); } - if (colId == -1) { + if (colIdInner == -1) { // Ambiguos Collision assignment cluambcursor( bcMap[cluTR.getBCData().toLong()], @@ -1571,7 +1570,7 @@ struct CaloClusterProducer { mclabels, mcamplitudes); } else { // Normal collision - auto col = colls.begin() + colId; + auto col = colls.begin() + colIdInner; clucursor( col, mom.X(), mom.Y(), mom.Z(), e, diff --git a/Common/TableProducer/centralityTable.cxx b/Common/TableProducer/centralityTable.cxx index 9198f79499e..e83c41d00c1 100644 --- a/Common/TableProducer/centralityTable.cxx +++ b/Common/TableProducer/centralityTable.cxx @@ -15,25 +15,28 @@ /// \author ALICE // -#include -#include -#include -#include +#include "MetadataHelper.h" +#include "TableHelper.h" -#include -#include -#include -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/HistogramRegistry.h" -#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" -#include "MetadataHelper.h" -#include "TableHelper.h" -#include "TList.h" +#include "Common/DataModel/Multiplicity.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -410,7 +413,7 @@ struct CentralityTable { } } - auto scaleMC = [](float x, float pars[6]) { + auto scaleMC = [](float x, const float pars[6]) { return std::pow(((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4], 1.0f / pars[5]); }; @@ -647,7 +650,7 @@ struct CentralityTable { auto populateTable = [&](auto& table, struct CalibrationInfo& estimator, float multiplicity) { const bool assignOutOfRange = embedINELgtZEROselection && !collision.isInelGt0(); - auto scaleMC = [](float x, float pars[6]) { + auto scaleMC = [](float x, const float pars[6]) { return std::pow(((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4], 1.0f / pars[5]); }; diff --git a/Common/TableProducer/eventSelection.cxx b/Common/TableProducer/eventSelection.cxx index f32c4723a47..25225144ab5 100644 --- a/Common/TableProducer/eventSelection.cxx +++ b/Common/TableProducer/eventSelection.cxx @@ -14,34 +14,55 @@ /// /// \author Evgeny Kryshen and Igor Altsybeev -#include -#include -#include -#include - -#include "Framework/ConfigParamSpec.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" #include "Common/DataModel/EventSelection.h" + #include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/RCTSelectionFlags.h" #include "Common/CCDB/TriggerAliases.h" -#include "CCDB/BasicCCDBManager.h" -#include "CommonConstants/LHCConstants.h" -#include "Framework/HistogramRegistry.h" -#include "DataFormatsFT0/Digit.h" -#include "DataFormatsParameters/GRPLHCIFData.h" -#include "DataFormatsParameters/GRPECSObject.h" -#include "ITSMFTBase/DPLAlpideParam.h" -#include "MetadataHelper.h" -#include "DataFormatsParameters/AggregatedRunInfo.h" -#include "DataFormatsITSMFT/NoiseMap.h" // missing include in TimeDeadMap.h -#include "DataFormatsITSMFT/TimeDeadMap.h" -#include "ITSMFTReconstruction/ChipMappingITS.h" -#include "DataFormatsCTP/Configuration.h" -#include "DataFormatsCTP/Scalers.h" - -#include "TH1D.h" +#include "Common/Core/MetadataHelper.h" + +#include +#include +#include +#include +#include +#include // missing include in TimeDeadMap. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -317,7 +338,7 @@ struct BcSelectionTask { if (mapRCT == nullptr) { LOGP(info, "rct object missing... inserting dummy rct flags"); mapRCT = new std::map; - uint32_t dummyValue = 1 << 31; // setting bit 31 to indicate that rct object is missing + uint32_t dummyValue = 1u << 31; // setting bit 31 to indicate that rct object is missing mapRCT->insert(std::pair(sorTimestamp, dummyValue)); } } @@ -521,7 +542,7 @@ struct EventSelectionTask { int rofLength = -1; // ITS ROF length, in bc std::string strLPMProductionTag = ""; // MC production tag to be retrieved from AO2D metadata - int32_t findClosest(int64_t globalBC, std::map& bcs) + int32_t findClosest(int64_t globalBC, const std::map& bcs) { auto it = bcs.lower_bound(globalBC); int64_t bc1 = it->first; diff --git a/Common/TableProducer/multiplicityTable.cxx b/Common/TableProducer/multiplicityTable.cxx index 12cde8a9869..efbb87908d2 100644 --- a/Common/TableProducer/multiplicityTable.cxx +++ b/Common/TableProducer/multiplicityTable.cxx @@ -15,26 +15,29 @@ /// \author ALICE /// -#include -#include -#include -#include +#include "PWGMM/Mult/DataModel/bestCollisionTable.h" -#include "Framework/ConfigParamSpec.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "CCDB/BasicCCDBManager.h" -#include "Common/DataModel/Multiplicity.h" +#include "Common/Core/MetadataHelper.h" +#include "Common/Core/TableHelper.h" #include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "TableHelper.h" -#include "MetadataHelper.h" -#include "TList.h" -#include "PWGMM/Mult/DataModel/bestCollisionTable.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -100,9 +103,9 @@ struct MultiplicityTable { Produces tablePVZeqs; // 12 Produces tableExtraMc; // 13 Produces tableExtraMult2MCExtras; - Produces multHepMCHIs; // Not accounted for, produced using custom process function to avoid dependencies - Produces mftMults; // Not accounted for, produced using custom process function to avoid dependencies - Produces multsGlobal; // Not accounted for, produced based on process function processGlobalTrackingCounters + Produces multHepMCHIs; // Not accounted for, produced using custom process function to avoid dependencies + Produces mftMults; // Not accounted for, produced using custom process function to avoid dependencies + Produces multsGlobal; // Not accounted for, produced based on process function processGlobalTrackingCounters // For vertex-Z corrections in calibration Service ccdb; @@ -521,12 +524,6 @@ struct MultiplicityTable { } break; case kZDCMults: // ZDC { - multZNA = -1.f; - multZNC = -1.f; - multZEM1 = -1.f; - multZEM2 = -1.f; - multZPA = -1.f; - multZPC = -1.f; if (bc.has_zdc()) { multZNA = bc.zdc().amplitudeZNA(); multZNC = bc.zdc().amplitudeZNC(); diff --git a/Common/TableProducer/qVectorsTable.cxx b/Common/TableProducer/qVectorsTable.cxx index bfdb319db75..9b6189ef121 100644 --- a/Common/TableProducer/qVectorsTable.cxx +++ b/Common/TableProducer/qVectorsTable.cxx @@ -18,7 +18,22 @@ /// (with or without corrections) and save the results in a dedicated table. /// -// C++/ROOT includes. +#include "Common/Core/EventPlaneHelper.h" +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/FT0Corrected.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/Qvectors.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include +#include +#include + #include #include @@ -27,26 +42,6 @@ #include #include -// o2Physics includes. -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "Framework/RunningWorkflowInfo.h" - -#include "Common/Core/EventPlaneHelper.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/FT0Corrected.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" - -#include "Common/DataModel/Qvectors.h" - -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -// o2 includes. -#include "CCDB/BasicCCDBManager.h" -#include "DetectorsCommonDataFormats/AlignParam.h" - using namespace o2; using namespace o2::framework; @@ -169,7 +164,7 @@ struct qVectorsTable { void init(InitContext& initContext) { // Check the sub-detector used - auto& workflows = initContext.services().get(); + const auto& workflows = initContext.services().get(); for (DeviceSpec const& device : workflows.devices) { for (auto const& input : device.inputs) { if (input.matcher.binding == "Qvectors") { @@ -260,7 +255,7 @@ struct qVectorsTable { } fullPath = cfgGainEqPath; fullPath += "/FT0"; - auto objft0Gain = getForTsOrRun>(fullPath, timestamp, runnumber); + const auto objft0Gain = getForTsOrRun>(fullPath, timestamp, runnumber); if (!objft0Gain || cfgCorrLevel == 0) { for (auto i{0u}; i < 208; i++) { FT0RelGainConst.push_back(1.); @@ -271,7 +266,7 @@ struct qVectorsTable { fullPath = cfgGainEqPath; fullPath += "/FV0"; - auto objfv0Gain = getForTsOrRun>(fullPath, timestamp, runnumber); + const auto objfv0Gain = getForTsOrRun>(fullPath, timestamp, runnumber); if (!objfv0Gain || cfgCorrLevel == 0) { for (auto i{0u}; i < 48; i++) { FV0RelGainConst.push_back(1.); @@ -560,7 +555,7 @@ struct qVectorsTable { runNumber = currentRun; } - float centAllEstim[4] = { + const float centAllEstim[4] = { coll.centFT0M(), coll.centFT0A(), coll.centFT0C(), coll.centFV0A()}; cent = centAllEstim[cfgCentEsti]; diff --git a/Common/TableProducer/trackselection.cxx b/Common/TableProducer/trackselection.cxx index 8ce5a88e0bd..142ae81a2e1 100644 --- a/Common/TableProducer/trackselection.cxx +++ b/Common/TableProducer/trackselection.cxx @@ -17,14 +17,16 @@ /// \brief Task performing basic track selection. /// -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" #include "Common/Core/TrackSelection.h" + +#include "Common/Core/TableHelper.h" #include "Common/Core/TrackSelectionDefaults.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "Common/Core/trackUtilities.h" -#include "TableHelper.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -149,7 +151,7 @@ struct TrackSelectionTask { return; } if (isRun3) { - for (auto& track : tracks) { + for (const auto& track : tracks) { if (produceTable == 1) { filterTable((uint8_t)0, @@ -190,7 +192,7 @@ struct TrackSelectionTask { return; } - for (auto& track : tracks) { + for (const auto& track : tracks) { o2::aod::track::TrackSelectionFlags::flagtype trackflagGlob = globalTracks.IsSelectedMask(track); if (produceTable == 1) { filterTable((uint8_t)globalTracksSDD.IsSelected(track), diff --git a/Common/Tasks/checkDataModelMC.cxx b/Common/Tasks/checkDataModelMC.cxx index fb2762a02b7..c8c0ecdda62 100644 --- a/Common/Tasks/checkDataModelMC.cxx +++ b/Common/Tasks/checkDataModelMC.cxx @@ -13,8 +13,11 @@ /// \author /// \since -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" +#include +#include + +#include +#include using namespace o2; using namespace o2::framework; @@ -42,7 +45,7 @@ void checkDaughters(const T& particlesMC, LOG(fatal) << "MC particle " << particle.globalIndex() << " with PDG " << particle.pdgCode() << " has first and last daughter indices " << firstDauIdx << ", " << lastDauIdx; } } - for (auto& idxDau : particle.daughtersIds()) { + for (const auto& idxDau : particle.daughtersIds()) { if (idxDau >= 0 && ((unsigned long int)idxDau > offset + particlesMC.size() || (unsigned long int)idxDau < offset)) { if (debugMode) { debugHisto->Fill(1); @@ -88,7 +91,7 @@ struct CheckMcParticlesIndices { void process(aod::McParticles const& particlesMC) { long unsigned int offset = 0; - for (auto& particle : particlesMC) { + for (const auto& particle : particlesMC) { checkDaughters(particlesMC, particle, offset, debugMode.value, hDebug); } } @@ -112,7 +115,7 @@ struct CheckMcParticlesIndicesGrouped { void process(aod::McCollision const&, aod::McParticles const& particlesMC) { - for (auto& particle : particlesMC) { + for (const auto& particle : particlesMC) { checkDaughters(particlesMC, particle, particlesMC.offset(), debugMode.value, hDebug); } } diff --git a/Common/Tasks/evtPlanesResolution.cxx b/Common/Tasks/evtPlanesResolution.cxx deleted file mode 100644 index e493ff3f00e..00000000000 --- a/Common/Tasks/evtPlanesResolution.cxx +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// -/// \file evtPlanesResolution.cxx -/// \author Cindy Mordasini -/// \author Anna Önnerstad -/// -/// \brief ... -/// - -// C++/ROOT includes. -#include -#include -#include -#include -#include -#include -#include - -// o2Physics includes. -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/StaticFor.h" - -#include "Common/DataModel/EvtPlanes.h" -#include "Common/Core/EventPlaneHelper.h" - -// o2 includes. - -using namespace o2; -using namespace o2::framework; - -namespace ep -{ -static constexpr std::string_view centClasses[] = { - "Centrality_0-5/", "Centrality_5-10/", "Centrality_10-20/", "Centrality_20-30/", - "Centrality_30-40/", "Centrality_40-50/", "Centrality_50-60/", "Centrality_60-80/"}; -} // namespace ep - -struct evtPlanesResolution { - // Configurables. - - // Histogram registry for the output QA figures and list of centrality classes for it. - // Objects are NOT saved in alphabetical orders, and registry names are NOT saved - // as TDirectoryFile. - HistogramRegistry histosQA{"histosQA", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; - - // Helper variables. - EventPlaneHelper helperEP; - - Configurable cfgMinTPCTracks{"cfgMinTPCTracks", 20, "minimum TPC tracks participating in Q-vector reconstruction"}; - Configurable cfgnMod{"cfgnMod", 2, "Modulation of interest"}; - - void init(InitContext const&) - { - // Fill the registry with the needed objects. - const AxisSpec axisEvtPl{360, -constants::math::PI, constants::math::PI}; - - histosQA.add("Centrality_0-5/histEvtPlUncor", "", {HistType::kTH1F, {axisEvtPl}}); - histosQA.add("Centrality_0-5/histEvtPlRectr", "", {HistType::kTH1F, {axisEvtPl}}); - histosQA.add("Centrality_0-5/histEvtPlTwist", "", {HistType::kTH1F, {axisEvtPl}}); - histosQA.add("Centrality_0-5/histEvtPlFinal", "", {HistType::kTH1F, {axisEvtPl}}); - - histosQA.add("Centrality_0-5/histEvtPlBPosUncor", "", {HistType::kTH1F, {axisEvtPl}}); - histosQA.add("Centrality_0-5/histEvtPlBPosRectr", "", {HistType::kTH1F, {axisEvtPl}}); - histosQA.add("Centrality_0-5/histEvtPlBPosTwist", "", {HistType::kTH1F, {axisEvtPl}}); - histosQA.add("Centrality_0-5/histEvtPlBPosFinal", "", {HistType::kTH1F, {axisEvtPl}}); - - histosQA.add("Centrality_0-5/histEvtPlBNegUncor", "", {HistType::kTH1F, {axisEvtPl}}); - histosQA.add("Centrality_0-5/histEvtPlBNegRectr", "", {HistType::kTH1F, {axisEvtPl}}); - histosQA.add("Centrality_0-5/histEvtPlBNegTwist", "", {HistType::kTH1F, {axisEvtPl}}); - histosQA.add("Centrality_0-5/histEvtPlBNegFinal", "", {HistType::kTH1F, {axisEvtPl}}); - - histosQA.add("Centrality_0-5/histEvtPlResolution", "", {HistType::kTH1F, {axisEvtPl}}); - - for (int iBin = 1; iBin < 8; iBin++) { - histosQA.addClone("Centrality_0-5/", ep::centClasses[iBin].data()); - } - } // End void init(InitContext const&) - - template - void fillHistosEvtPl(const T& vec) - { - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlUncor"), vec.evtPlUncor()); - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlRectr"), vec.evtPlRectr()); - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlTwist"), vec.evtPlTwist()); - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlFinal"), vec.evtPlFinal()); - - if (vec.nTrkBPos() < cfgMinTPCTracks || vec.nTrkBNeg() < cfgMinTPCTracks) - return; - - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlBPosUncor"), vec.evtPlBPosUncor()); - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlBPosRectr"), vec.evtPlBPosRectr()); - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlBPosTwist"), vec.evtPlBPosTwist()); - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlBPosFinal"), vec.evtPlBPosFinal()); - - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlBNegUncor"), vec.evtPlBNegUncor()); - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlBNegRectr"), vec.evtPlBNegRectr()); - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlBNegTwist"), vec.evtPlBNegTwist()); - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlBNegFinal"), vec.evtPlBNegFinal()); - - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlResolution"), - std::sqrt(std::cos((vec.evtPlFinal() - vec.evtPlBPosFinal()) * cfgnMod) * std::cos((vec.evtPlFinal() - vec.evtPlBNegFinal()) * cfgnMod) / - std::cos((vec.evtPlBPosFinal() - vec.evtPlBNegFinal()) * cfgnMod))); - } - - void process(aod::EvtPlane const& evPl) - { - int centBin = helperEP.GetCentBin(evPl.cent()); - switch (centBin) { - case 0: - fillHistosEvtPl<0>(evPl); - break; - case 1: - fillHistosEvtPl<1>(evPl); - break; - case 2: - fillHistosEvtPl<2>(evPl); - break; - case 3: - fillHistosEvtPl<3>(evPl); - break; - case 4: - fillHistosEvtPl<4>(evPl); - break; - case 5: - fillHistosEvtPl<5>(evPl); - break; - case 6: - fillHistosEvtPl<6>(evPl); - break; - case 7: - fillHistosEvtPl<7>(evPl); - break; - } // End switch(centBin) - } // End void process(...) -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; -} diff --git a/Common/Tasks/propagatorQa.cxx b/Common/Tasks/propagatorQa.cxx index f978f8bc564..3a426d2cf09 100644 --- a/Common/Tasks/propagatorQa.cxx +++ b/Common/Tasks/propagatorQa.cxx @@ -14,27 +14,29 @@ // Work in progress! More to follow, use at your own peril // -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" -#include "ReconstructionDataFormats/Track.h" #include "Common/Core/trackUtilities.h" -#include "CCDB/BasicCCDBManager.h" -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DetectorsBase/Propagator.h" -#include "trackSelectionRequest.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/Tools/trackSelectionRequest.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -#include "Framework/runDataProcessing.h" - struct propagatorQa { Service ccdb; @@ -100,12 +102,12 @@ struct propagatorQa { ccdb->setFatalWhenNull(false); // output objects - const AxisSpec axisX{(int)NbinsX, 0.0f, +250.0f, "X value"}; - const AxisSpec axisDCAxy{(int)NbinsDCA, -windowDCA, windowDCA, "DCA_{xy} (cm)"}; - const AxisSpec axisPt{(int)NbinsPt, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}; - const AxisSpec axisPtCoarse{(int)NbinsPtCoarse, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}; - const AxisSpec axisTanLambda{(int)NbinsTanLambda, -TanLambdaLimit, +TanLambdaLimit, "tan(#lambda)"}; - const AxisSpec axisDeltaPt{(int)NbinsDeltaPt, -DeltaPtLimit, +DeltaPtLimit, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec axisX{NbinsX, 0.0f, +250.0f, "X value"}; + const AxisSpec axisDCAxy{NbinsDCA, -windowDCA, windowDCA, "DCA_{xy} (cm)"}; + const AxisSpec axisPt{NbinsPt, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec axisPtCoarse{NbinsPtCoarse, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec axisTanLambda{NbinsTanLambda, -TanLambdaLimit, +TanLambdaLimit, "tan(#lambda)"}; + const AxisSpec axisDeltaPt{NbinsDeltaPt, -DeltaPtLimit, +DeltaPtLimit, "#it{p}_{T} (GeV/#it{c})"}; // All tracks histos.add("hTrackX", "hTrackX", kTH1F, {axisX}); @@ -145,8 +147,8 @@ struct propagatorQa { histos.add("hdcaXYusedInSVertexer", "hdcaXYusedInSVertexer", kTH1F, {axisDCAxy}); histos.add("hUpdateRadiiusedInSVertexer", "hUpdateRadiiusedInSVertexer", kTH1F, {axisX}); // bit packed ITS cluster map - const AxisSpec axisITSCluMap{(int)128, -0.5f, +127.5f, "Packed ITS map"}; - const AxisSpec axisRadius{(int)dQANBinsRadius, 0.0f, +50.0f, "Radius (cm)"}; + const AxisSpec axisITSCluMap{128, -0.5f, +127.5f, "Packed ITS map"}; + const AxisSpec axisRadius{dQANBinsRadius, 0.0f, +50.0f, "Radius (cm)"}; // Histogram to bookkeep cluster maps histos.add("h2dITSCluMap", "h2dITSCluMap", kTH3D, {axisITSCluMap, axisRadius, axisPtCoarse}); @@ -170,7 +172,7 @@ struct propagatorQa { if (d_bz_input > -990) { d_bz = d_bz_input; o2::parameters::GRPMagField grpmag; - if (fabs(d_bz) > 1e-5) { + if (std::fabs(d_bz) > 1e-5) { grpmag.setL3Current(30000.f / (d_bz / 5.0f)); } o2::base::Propagator::initFieldFromGRP(&grpmag); @@ -210,7 +212,7 @@ struct propagatorQa { initCCDB(bc); std::array dcaInfo; - for (auto& track : tracks) { + for (const auto& track : tracks) { if (track.tpcNClsFound() < minTPCClustersRequired) continue; @@ -273,7 +275,7 @@ struct propagatorQa { // ITS cluster map float lMCCreation = TMath::Sqrt(mctrack.vx() * mctrack.vx() + mctrack.vy() * mctrack.vy()); - histos.fill(HIST("h2dITSCluMap"), (float)track.itsClusterMap(), lMCCreation, track.pt()); + histos.fill(HIST("h2dITSCluMap"), static_cast(track.itsClusterMap()), lMCCreation, track.pt()); if (lIsPrimary) { histos.fill(HIST("hPrimaryDeltaTanLambdaVsPt"), track.tgl(), track.tgl() - lTrackParametrization.getTgl()); @@ -291,12 +293,12 @@ struct propagatorQa { histos.fill(HIST("hPrimaryDeltaDCAs"), lCircleDCA - lDCA); histos.fill(HIST("hPrimaryDeltaDCAsVsPt"), track.pt(), lCircleDCA - lDCA); histos.fill(HIST("hPrimaryRecalculatedDeltaDCAsVsPt"), track.pt(), lRecalculatedDCA - lDCA); - histos.fill(HIST("h2dITSCluMapPrimaries"), (float)track.itsClusterMap(), lMCCreation, track.pt()); + histos.fill(HIST("h2dITSCluMapPrimaries"), static_cast(track.itsClusterMap()), lMCCreation, track.pt()); } // determine if track was used in svertexer bool usedInSVertexer = false; bool lUsedByV0 = false, lUsedByCascade = false; - for (auto& V0 : V0s) { + for (const auto& V0 : V0s) { if (V0.posTrackId() == track.globalIndex()) { lUsedByV0 = true; break; @@ -306,7 +308,7 @@ struct propagatorQa { break; } } - for (auto& cascade : cascades) { + for (const auto& cascade : cascades) { if (cascade.bachelorId() == track.globalIndex()) { lUsedByCascade = true; break; @@ -315,10 +317,10 @@ struct propagatorQa { if (lUsedByV0 || lUsedByCascade) usedInSVertexer = true; - if (usedInSVertexer) + if (usedInSVertexer) { histos.fill(HIST("hUpdateRadiiusedInSVertexer"), lRadiusOfLastUpdate); - if (usedInSVertexer) histos.fill(HIST("hdcaXYusedInSVertexer"), lDCA); + } } } PROCESS_SWITCH(propagatorQa, processMC, "process MC", true); @@ -330,7 +332,7 @@ struct propagatorQa { initCCDB(bc); std::array dcaInfo; - for (auto& track : tracks) { + for (const auto& track : tracks) { if (track.tpcNClsFound() < minTPCClustersRequired) continue; @@ -388,7 +390,7 @@ struct propagatorQa { // ITS cluster map float lMCCreation = 0.1; // dummy value, we don't know - histos.fill(HIST("h2dITSCluMap"), (float)track.itsClusterMap(), lMCCreation, track.pt()); + histos.fill(HIST("h2dITSCluMap"), static_cast(track.itsClusterMap()), lMCCreation, track.pt()); // A hack: use DCA as equiv to primary if (TMath::Abs(lDCA) < 0.05) { // 500 microns @@ -406,13 +408,13 @@ struct propagatorQa { histos.fill(HIST("hPrimaryDeltaDCAs"), lCircleDCA - lDCA); histos.fill(HIST("hPrimaryDeltaDCAsVsPt"), track.pt(), lCircleDCA - lDCA); histos.fill(HIST("hPrimaryRecalculatedDeltaDCAsVsPt"), track.pt(), lRecalculatedDCA - lDCA); - histos.fill(HIST("h2dITSCluMapPrimaries"), (float)track.itsClusterMap(), lMCCreation, track.pt()); + histos.fill(HIST("h2dITSCluMapPrimaries"), static_cast(track.itsClusterMap()), lMCCreation, track.pt()); } // determine if track was used in svertexer bool usedInSVertexer = false; bool lUsedByV0 = false, lUsedByCascade = false; - for (auto& V0 : V0s) { + for (const auto& V0 : V0s) { if (V0.posTrackId() == track.globalIndex()) { lUsedByV0 = true; break; @@ -422,7 +424,7 @@ struct propagatorQa { break; } } - for (auto& cascade : cascades) { + for (const auto& cascade : cascades) { if (cascade.bachelorId() == track.globalIndex()) { lUsedByCascade = true; break; @@ -431,10 +433,10 @@ struct propagatorQa { if (lUsedByV0 || lUsedByCascade) usedInSVertexer = true; - if (usedInSVertexer) + if (usedInSVertexer) { histos.fill(HIST("hUpdateRadiiusedInSVertexer"), lRadiusOfLastUpdate); - if (usedInSVertexer) histos.fill(HIST("hdcaXYusedInSVertexer"), lDCA); + } } } PROCESS_SWITCH(propagatorQa, processData, "process data", false); @@ -446,7 +448,7 @@ struct propagatorQa { initCCDB(bc); std::array dcaInfo; - for (auto& trackIU : tracksIU) { + for (const auto& trackIU : tracksIU) { if (trackIU.tpcNClsFound() < minTPCClustersRequired) continue; // skip if not enough TPC clusters diff --git a/Common/Tasks/trackqa.cxx b/Common/Tasks/trackqa.cxx index d10d42af8da..788fba7e29b 100644 --- a/Common/Tasks/trackqa.cxx +++ b/Common/Tasks/trackqa.cxx @@ -13,15 +13,25 @@ // Task producing basic tracking qa histograms // +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + #include // std::swap #include -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TrackSelectionDefaults.h" +#include using namespace o2; using namespace o2::framework; @@ -34,7 +44,7 @@ void customize(std::vector& workflowOptions) {"add-cut-qa", VariantType::Int, 0, {"Add track cut QA histograms."}}}; std::swap(workflowOptions, options); } -#include "Framework/runDataProcessing.h" +#include //**************************************************************************************** /** @@ -105,7 +115,7 @@ struct TrackQa { histos.fill(HIST("TrackPar/snp"), track.snp()); histos.fill(HIST("TrackPar/tgl"), track.tgl()); for (unsigned int i = 0; i < 32; i++) { - if (track.flags() & (1 << i)) { + if (track.flags() & (1u << i)) { histos.fill(HIST("TrackPar/flags"), i); } } diff --git a/Common/Tools/EventSelectionTools.h b/Common/Tools/EventSelectionTools.h index eef9ddaf7f6..a798e1b7142 100644 --- a/Common/Tools/EventSelectionTools.h +++ b/Common/Tools/EventSelectionTools.h @@ -19,33 +19,35 @@ #define bitcheck(var, nbit) ((var) & (static_cast(1) << (nbit))) #define bitcheck64(var, nbit) ((var) & (static_cast(1) << (nbit))) -#include "MetadataHelper.h" -#include "TableHelper.h" - #include "Common/CCDB/EventSelectionParams.h" #include "Common/CCDB/TriggerAliases.h" +#include "Common/Core/MetadataHelper.h" +#include "Common/Core/TableHelper.h" #include "Common/DataModel/EventSelection.h" -#include "CCDB/BasicCCDBManager.h" -#include "CommonConstants/LHCConstants.h" -#include "DataFormatsCTP/Configuration.h" -#include "DataFormatsCTP/Scalers.h" -#include "DataFormatsFT0/Digit.h" -#include "DataFormatsITSMFT/NoiseMap.h" // missing include in TimeDeadMap.h -#include "DataFormatsITSMFT/TimeDeadMap.h" -#include "DataFormatsParameters/AggregatedRunInfo.h" -#include "DataFormatsParameters/GRPECSObject.h" -#include "DataFormatsParameters/GRPLHCIFData.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/HistogramRegistry.h" -#include "ITSMFTBase/DPLAlpideParam.h" -#include "ITSMFTReconstruction/ChipMappingITS.h" +#include +#include +#include +#include +#include +#include // missing include in TimeDeadMap.h +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include +#include +#include #include #include +#include //__________________________________________ // MultModule @@ -191,8 +193,9 @@ class BcSelectionModule template bool configure(TCCDB& ccdb, TBCs const& bcs) { - if (bcs.size() == 0) + if (bcs.size() == 0) { return false; + } int run = bcs.iteratorAt(0).runNumber(); if (run != lastRun) { lastRun = run; @@ -266,7 +269,7 @@ class BcSelectionModule if (mapRCT == nullptr) { LOGP(info, "rct object missing... inserting dummy rct flags"); mapRCT = new std::map; - uint32_t dummyValue = 1 << 31; // setting bit 31 to indicate that rct object is missing + uint32_t dummyValue = 1u << 31; // setting bit 31 to indicate that rct object is missing mapRCT->insert(std::pair(sorTimestamp, dummyValue)); } } @@ -623,7 +626,7 @@ class EventSelectionModule std::vector diffVzParMean; // parameterization for mean of diff vZ by FT0 vs by tracks std::vector diffVzParSigma; // parameterization for stddev of diff vZ by FT0 vs by tracks - int32_t findClosest(int64_t globalBC, std::map& bcs) + int32_t findClosest(const int64_t globalBC, const std::map& bcs) { auto it = bcs.lower_bound(globalBC); int64_t bc1 = it->first; @@ -716,6 +719,9 @@ class EventSelectionModule template bool configure(TCCDB& ccdb, TTimestamps const& timestamps, TBCs const& bcs) { + if (bcs.size() == 0) { + return false; + } int run = bcs.iteratorAt(0).runNumber(); // extract bc pattern from CCDB for data or anchored MC only if (run != lastRun && run >= run3min) { @@ -1364,11 +1370,11 @@ class EventSelectionModule // compare zVtx from FT0 and from PV bool isGoodZvtxFT0vsPV = 0; if (bcselEntry.foundFT0Id > -1) { - auto foundFT0 = ft0s.rawIteratorAt(bcselEntry.foundFT0Id); - float diffVz = foundFT0.posZ() - col.posZ(); - if (runLightIons == -1) + auto foundFT0Inner = ft0s.rawIteratorAt(bcselEntry.foundFT0Id); + float diffVz = foundFT0Inner.posZ() - col.posZ(); + if (runLightIons == -1) { isGoodZvtxFT0vsPV = std::fabs(diffVz) < evselOpts.maxDiffZvtxFT0vsPV; - else { // special treatment of light ion runs + } else { // special treatment of light ion runs float multT0A = bc.ft0().sumAmpA(); float multT0C = bc.ft0().sumAmpC(); float T0M = multT0A + multT0C; @@ -1540,11 +1546,13 @@ class LumiModule template bool configure(TCCDB& ccdb, TTimestamps const& timestamps, TBCs const& bcs) { - if (bcs.size() == 0) + if (bcs.size() == 0) { return false; + } int run = bcs.iteratorAt(0).runNumber(); - if (run < 500000) // o2-linter: disable=magic-number (skip for unanchored MCs) + if (run < 500000) { // o2-linter: disable=magic-number (skip for unanchored MCs) return false; + } if (run != lastRun && run >= 520259) { // o2-linter: disable=magic-number (scalers available for runs above 520120) lastRun = run; int64_t ts = timestamps[0]; diff --git a/Common/Tools/MultModule.h b/Common/Tools/MultModule.h index 2250717a601..d37f37a11fb 100644 --- a/Common/Tools/MultModule.h +++ b/Common/Tools/MultModule.h @@ -16,22 +16,26 @@ #ifndef COMMON_TOOLS_MULTMODULE_H_ #define COMMON_TOOLS_MULTMODULE_H_ -#include -#include -#include -#include -#include -#include -#include -#include "Framework/AnalysisDataModel.h" -#include "Framework/Configurable.h" -#include "Framework/HistogramSpec.h" -#include "TableHelper.h" +#include "PWGMM/Mult/DataModel/bestCollisionTable.h" + #include "Common/Core/TPCVDriftManager.h" -#include "Common/DataModel/Multiplicity.h" +#include "Common/Core/TableHelper.h" #include "Common/DataModel/Centrality.h" -#include "PWGMM/Mult/DataModel/bestCollisionTable.h" -#include "TFormula.h" +#include "Common/DataModel/Multiplicity.h" + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include //__________________________________________ // MultModule @@ -435,7 +439,7 @@ class MultModule internalOpts.mEnabledTables.resize(nTablesConst, 0); LOGF(info, "Configuring tables to generate"); - auto& workflows = context.services().template get(); + const auto& workflows = context.services().template get(); TString listOfRequestors[nTablesConst]; for (int i = 0; i < nTablesConst; i++) { @@ -1246,7 +1250,7 @@ class MultModule auto populateTable = [&](auto& table, struct CalibrationInfo& estimator, float multiplicity, bool isInelGt0) { const bool assignOutOfRange = internalOpts.embedINELgtZEROselection && !isInelGt0; - auto scaleMC = [](float x, float pars[6]) { + auto scaleMC = [](float x, const float pars[6]) { return std::pow(((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4], 1.0f / pars[5]); }; @@ -1331,7 +1335,7 @@ class MultModule const auto& firstbc = bcs.begin(); ConfigureCentralityRun2(ccdb, metadataInfo, firstbc); - auto scaleMC = [](float x, float pars[6]) { + auto scaleMC = [](float x, const float pars[6]) { return std::pow(((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4], 1.0f / pars[5]); }; diff --git a/Common/Tools/Multiplicity/multCalibrator.cxx b/Common/Tools/Multiplicity/multCalibrator.cxx index e9931c0389f..493a3d5feac 100644 --- a/Common/Tools/Multiplicity/multCalibrator.cxx +++ b/Common/Tools/Multiplicity/multCalibrator.cxx @@ -16,17 +16,20 @@ // - victor.gonzalez@cern.ch // - david.dobrigkeit.chinellato@cern.ch // -#include "TList.h" -#include "TDirectory.h" -#include "TFile.h" -#include "TH1F.h" -#include "TH1D.h" -#include "TProfile.h" -#include "TStopwatch.h" -#include "TArrayL64.h" -#include "TArrayF.h" #include "multCalibrator.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include // FIXME + using namespace std; const TString multCalibrator::fCentEstimName[kNCentEstim] = { @@ -100,10 +103,10 @@ Bool_t multCalibrator::Calibrate() return kFALSE; } - //Step 1: verify if input file contains desired histograms + // Step 1: verify if input file contains desired histograms TH1D* hRaw[kNCentEstim]; for (Int_t iv = 0; iv < kNCentEstim; iv++) { - hRaw[iv] = (TH1D*)fileInput->Get(Form("multiplicity-qa/multiplicityQa/h%s", fCentEstimName[iv].Data())); + hRaw[iv] = reinterpret_cast(fileInput->Get(Form("multiplicity-qa/multiplicityQa/h%s", fCentEstimName[iv].Data()))); if (!hRaw[iv]) { cout << Form("File does not contain histogram h%s, which is necessary for calibration!", fCentEstimName[iv].Data()) << endl; return kFALSE; @@ -112,7 +115,7 @@ Bool_t multCalibrator::Calibrate() cout << "Histograms loaded! Will now calibrate..." << endl; - //Create output file + // Create output file TFile* fOut = new TFile(fOutputFileName.Data(), "RECREATE"); TH1F* hCalib[kNCentEstim]; for (Int_t iv = 0; iv < kNCentEstim; iv++) { @@ -129,7 +132,7 @@ Bool_t multCalibrator::Calibrate() Double_t multCalibrator::GetRawMax(TH1* histo) { - //This function gets the max X value (right edge) which is filled. + // This function gets the max X value (right edge) which is filled. for (Int_t ii = histo->GetNbinsX(); ii > 0; ii--) { if (histo->GetBinContent(ii) < 1e-10) return histo->GetBinLowEdge(ii + 1); @@ -139,24 +142,24 @@ Double_t multCalibrator::GetRawMax(TH1* histo) Double_t multCalibrator::GetBoundaryForPercentile(TH1* histo, Double_t lPercentileRequested, Double_t& lPrecisionEstimate) { - //This function returns the boundary for a specific percentile. - //It uses a linear interpolation in an attempt to get more precision - //than the binning of the histogram used for quantiling. + // This function returns the boundary for a specific percentile. + // It uses a linear interpolation in an attempt to get more precision + // than the binning of the histogram used for quantiling. // - //It also estimates a certain level of precision of the procedure - //by explicitly comparing the bin content of the bins around the boundary - //with the entire cross section, effectively reporting back a percentage - //that corresponds to those bins. If this percentage is O(percentile bin - //width requested), then the user should worry and we print out a warning. + // It also estimates a certain level of precision of the procedure + // by explicitly comparing the bin content of the bins around the boundary + // with the entire cross section, effectively reporting back a percentage + // that corresponds to those bins. If this percentage is O(percentile bin + // width requested), then the user should worry and we print out a warning. const Double_t lPrecisionConstant = 2.0; Double_t lRawMax = GetRawMax(histo); if (lPercentileRequested < 1e-7) - return lRawMax; //safeguard + return lRawMax; // safeguard if (lPercentileRequested > 100 - 1e-7) - return 0.0; //safeguard + return 0.0; // safeguard Double_t lReturnValue = 0.0; Double_t lPercentile = 100.0 - lPercentileRequested; @@ -182,7 +185,7 @@ Double_t multCalibrator::GetBoundaryForPercentile(TH1* histo, Double_t lPercenti for (Long_t ibin = lFirstBin; ibin < lNBins; ibin++) { lCount += histo->GetBinContent(ibin); if (lCount >= lCountDesired) { - //Found bin I am looking for! + // Found bin I am looking for! Double_t lWidth = histo->GetBinWidth(ibin); Double_t lLeftPercentile = 100. * (lCount - histo->GetBinContent(ibin)) / lHadronicTotal; Double_t lRightPercentile = 100. * lCount / lHadronicTotal; @@ -200,12 +203,12 @@ Double_t multCalibrator::GetBoundaryForPercentile(TH1* histo, Double_t lPercenti //________________________________________________________________ void multCalibrator::SetStandardAdaptiveBoundaries() { - //Function to set standard adaptive boundaries - //Typically used in pp, goes to 0.001% binning for highest multiplicity + // Function to set standard adaptive boundaries + // Typically used in pp, goes to 0.001% binning for highest multiplicity lNDesiredBoundaries = 0; lDesiredBoundaries = new Double_t[1100]; lDesiredBoundaries[0] = 100; - //From Low To High Multiplicity + // From Low To High Multiplicity for (Int_t ib = 1; ib < 91; ib++) { lNDesiredBoundaries++; lDesiredBoundaries[lNDesiredBoundaries] = lDesiredBoundaries[lNDesiredBoundaries - 1] - 1.0; @@ -229,12 +232,12 @@ void multCalibrator::SetStandardAdaptiveBoundaries() //________________________________________________________________ void multCalibrator::SetStandardOnePercentBoundaries() { - //Function to set standard adaptive boundaries - //Typically used in pp, goes to 0.001% binning for highest multiplicity + // Function to set standard adaptive boundaries + // Typically used in pp, goes to 0.001% binning for highest multiplicity lNDesiredBoundaries = 101; lDesiredBoundaries = new Double_t[101]; lDesiredBoundaries[0] = 100; - //From Low To High Multiplicity + // From Low To High Multiplicity for (Int_t ib = 1; ib < 101; ib++) lDesiredBoundaries[ib] = lDesiredBoundaries[ib - 1] - 1.0; cout << "Set standard 1%-wide percentile boundaries! Nboundaries: " << lNDesiredBoundaries << endl; @@ -243,10 +246,10 @@ void multCalibrator::SetStandardOnePercentBoundaries() //________________________________________________________________ TH1F* multCalibrator::GetCalibrationHistogram(TH1* histoRaw, TString lHistoName) { - //This function returns a calibration histogram + // This function returns a calibration histogram //(pp or p-Pb like, no anchor point considered) - //Reset + recreate precision histogram + // Reset + recreate precision histogram ResetPrecisionHistogram(); // Consistency check @@ -256,10 +259,10 @@ TH1F* multCalibrator::GetCalibrationHistogram(TH1* histoRaw, TString lHistoName) cout << "Last boundary: " << lDesiredBoundaries[0] << endl; } - //Aux vars + // Aux vars Double_t lMiddleOfBins[1000]; for (Long_t lB = 1; lB < lNDesiredBoundaries; lB++) { - //place squarely at the middle to ensure it's all fine + // place squarely at the middle to ensure it's all fine lMiddleOfBins[lB - 1] = 0.5 * (lDesiredBoundaries[lB] + lDesiredBoundaries[lB - 1]); } Double_t lBounds[lNDesiredBoundaries + 1]; @@ -276,7 +279,7 @@ TH1F* multCalibrator::GetCalibrationHistogram(TH1* histoRaw, TString lHistoName) lBounds[lDisplacedii] = GetBoundaryForPercentile(histoRaw, lDesiredBoundaries[ii], lPrecision[ii]); TString lPrecisionString = "(Precision OK)"; if (ii != 0 && ii != lNDesiredBoundaries - 1) { - //check precision, please + // check precision, please if (lPrecision[ii] / TMath::Abs(lDesiredBoundaries[ii + 1] - lDesiredBoundaries[ii]) > fkPrecisionWarningThreshold) lPrecisionString = "(WARNING: BINNING MAY LEAD TO IMPRECISION!)"; if (lPrecision[ii] / TMath::Abs(lDesiredBoundaries[ii - 1] - lDesiredBoundaries[ii]) > fkPrecisionWarningThreshold) @@ -302,8 +305,8 @@ void multCalibrator::ResetPrecisionHistogram() delete fPrecisionHistogram; fPrecisionHistogram = 0x0; } - if (lNDesiredBoundaries > 0) { //only if initialized - //invert boundaries, please + if (lNDesiredBoundaries > 0) { // only if initialized + // invert boundaries, please Double_t lInverseDesiredBoundaries[1100]; for (Int_t ii = 0; ii < lNDesiredBoundaries; ii++) { lInverseDesiredBoundaries[ii] = lDesiredBoundaries[lNDesiredBoundaries - (ii + 1)]; diff --git a/Common/Tools/Multiplicity/multCalibrator.h b/Common/Tools/Multiplicity/multCalibrator.h index b5c618bdc3d..1ad8839a1f1 100644 --- a/Common/Tools/Multiplicity/multCalibrator.h +++ b/Common/Tools/Multiplicity/multCalibrator.h @@ -16,33 +16,33 @@ // - victor.gonzalez@cern.ch // - david.dobrigkeit.chinellato@cern.ch // -#ifndef MULTCALIBRATOR_H -#define MULTCALIBRATOR_H +#ifndef COMMON_TOOLS_MULTIPLICITY_MULTCALIBRATOR_H_ +#define COMMON_TOOLS_MULTIPLICITY_MULTCALIBRATOR_H_ + +#include +#include #include #include -#include "TNamed.h" -#include "TH1D.h" - class multCalibrator : public TNamed { public: - //Constructors/Destructor + // Constructors/Destructor multCalibrator(); - multCalibrator(const char* name, const char* title = "Multiplicity Calibration Class"); + explicit multCalibrator(const char* name, const char* title = "Multiplicity Calibration Class"); ~multCalibrator(); - //void Print(Option_t *option="") const; + // void Print(Option_t *option="") const; //_________________________________________________________________________ - //Interface: steering functions to be used in calibration macro + // Interface: steering functions to be used in calibration macro - //Set Filenames + // Set Filenames void SetInputFile(TString lFile) { fInputFileName = lFile.Data(); } void SetOutputFile(TString lFile) { fOutputFileName = lFile.Data(); } - //Set Boundaries to find + // Set Boundaries to find void SetBoundaries(Long_t lNB, Double_t* lB) { if (lNB < 2 || lNB > 1e+6) { @@ -56,24 +56,24 @@ class multCalibrator : public TNamed void SetAnchorPointRaw(Float_t lRaw) { fAnchorPointValue = lRaw; } void SetAnchorPointPercentage(Float_t lPer) { fAnchorPointPercentage = lPer; } - void SetStandardAdaptiveBoundaries(); //standard adaptive (pp-like) - void SetStandardOnePercentBoundaries(); //standard 1% (Pb-Pb like) + void SetStandardAdaptiveBoundaries(); // standard adaptive (pp-like) + void SetStandardOnePercentBoundaries(); // standard 1% (Pb-Pb like) - //Master Function in this Class: To be called once filenames are set + // Master Function in this Class: To be called once filenames are set Bool_t Calibrate(); - //Aux function. Keep public, accessible outside as rather useful utility + // Aux function. Keep public, accessible outside as rather useful utility TH1F* GetCalibrationHistogram(TH1* histoRaw, TString lHistoName = "hCalib"); - //Auxiliary functions + // Auxiliary functions Double_t GetRawMax(TH1* histo); Double_t GetBoundaryForPercentile(TH1* histo, Double_t lPercentileRequested, Double_t& lPrecisionEstimate); - //Precision bookkeeping - TH1D* GetPrecisionHistogram() { return fPrecisionHistogram; }; //gets precision histogram from current object - void ResetPrecisionHistogram(); //Reset precision histogram, if it exists + // Precision bookkeeping + TH1D* GetPrecisionHistogram() { return fPrecisionHistogram; } // gets precision histogram from current object + void ResetPrecisionHistogram(); // Reset precision histogram, if it exists - //Aliases for centrality estimators + // Aliases for centrality estimators enum fCentEstim { kCentRawV0M = 0, kCentRawT0M, @@ -89,7 +89,7 @@ class multCalibrator : public TNamed static const TString fCentEstimName[kNCentEstim]; //! name (internal) private: - //Calibration Boundaries to locate + // Calibration Boundaries to locate Double_t* lDesiredBoundaries; Long_t lNDesiredBoundaries; Double_t fkPrecisionWarningThreshold; @@ -105,11 +105,11 @@ class multCalibrator : public TNamed // TList object for storing histograms TList* fCalibHists; - TH1D* fPrecisionHistogram; //for bookkeeping of precision report + TH1D* fPrecisionHistogram; // for bookkeeping of precision report ClassDef(multCalibrator, 1); //(this classdef is only for bookkeeping, class will not usually // be streamed according to current workflow except in very specific // tests!) }; -#endif +#endif // COMMON_TOOLS_MULTIPLICITY_MULTCALIBRATOR_H_ diff --git a/Common/Tools/Multiplicity/multGlauberNBDFitter.cxx b/Common/Tools/Multiplicity/multGlauberNBDFitter.cxx index a765db72448..dbdefd874d4 100644 --- a/Common/Tools/Multiplicity/multGlauberNBDFitter.cxx +++ b/Common/Tools/Multiplicity/multGlauberNBDFitter.cxx @@ -26,13 +26,16 @@ **********************************************/ #include "multGlauberNBDFitter.h" -#include "TList.h" -#include "TFile.h" -#include "TF1.h" -#include "TStopwatch.h" -#include "TVirtualFitter.h" -#include "TProfile.h" -#include "TFitResult.h" + +#include +#include +#include +#include +#include +#include +#include + +#include // FIXME using namespace std; @@ -42,6 +45,7 @@ multGlauberNBDFitter::multGlauberNBDFitter() : TNamed(), fNBD(0x0), fhNanc(0x0), fhNpNc(0x0), + fhV0M(0x0), ffChanged(kTRUE), fCurrentf(-1), fAncestorMode(2), @@ -63,14 +67,14 @@ multGlauberNBDFitter::multGlauberNBDFitter() : TNamed(), fNcoll = new Double_t[fMaxNpNcPairs]; fContent = new Long_t[fMaxNpNcPairs]; - //Ancestor histo + // Ancestor histo fhNanc = new TH1D("fhNanc", "", 1000, -0.5, 999.5); - //NBD + // NBD fNBD = new TF1("fNBD", "ROOT::Math::negative_binomial_pdf(x,[0],[1])", 0, 45000); fNBD->SetNpx(45000); - //master function + // master function fGlauberNBD = new TF1("fGlauberNBD", this, &multGlauberNBDFitter::ProbDistrib, 0, 50000, 4, "multGlauberNBDFitter", "ProbDistrib"); fGlauberNBD->SetParameter(0, fMu); @@ -89,6 +93,7 @@ multGlauberNBDFitter::multGlauberNBDFitter(const char* name, const char* title) fNBD(0x0), fhNanc(0x0), fhNpNc(0x0), + fhV0M(0x0), ffChanged(kTRUE), fCurrentf(-1), fAncestorMode(2), @@ -105,19 +110,19 @@ multGlauberNBDFitter::multGlauberNBDFitter(const char* name, const char* title) fFitOptions("R0"), fFitNpx(5000) { - //Named constructor + // Named constructor fNpart = new Double_t[fMaxNpNcPairs]; fNcoll = new Double_t[fMaxNpNcPairs]; fContent = new Long_t[fMaxNpNcPairs]; - //Ancestor histo - //fhNanc = new TH1D("fhNanc", "", fAncestorMode==2?10000:1000, -0.5, 999.5); + // Ancestor histo + // fhNanc = new TH1D("fhNanc", "", fAncestorMode==2?10000:1000, -0.5, 999.5); - //NBD + // NBD fNBD = new TF1("fNBD", "ROOT::Math::negative_binomial_pdf(x,[0],[1])", 0, 45000); fNBD->SetNpx(45000); - //master function + // master function fGlauberNBD = new TF1("fGlauberNBD", this, &multGlauberNBDFitter::ProbDistrib, 0, 50000, 5, "multGlauberNBDFitter", "ProbDistrib"); fGlauberNBD->SetParameter(0, fMu); @@ -157,18 +162,18 @@ multGlauberNBDFitter::~multGlauberNBDFitter() //______________________________________________________ Double_t multGlauberNBDFitter::ProbDistrib(Double_t* x, Double_t* par) -//Master fitter function +// Master fitter function { Double_t lMultValue = x[0]; Double_t lProbability = 0.0; ffChanged = kTRUE; const Double_t lAlmost0 = 1.e-13; - //Comment this line in order to make the code evaluate Nancestor all the time + // Comment this line in order to make the code evaluate Nancestor all the time if (TMath::Abs(fCurrentf - par[2]) < lAlmost0) ffChanged = kFALSE; //______________________________________________________ - //Recalculate the ancestor distribution in case f changed + // Recalculate the ancestor distribution in case f changed if (ffChanged) { fCurrentf = par[2]; fhNanc->Reset(); @@ -192,12 +197,12 @@ Double_t multGlauberNBDFitter::ProbDistrib(Double_t* x, Double_t* par) fhNanc->Scale(1. / fhNanc->Integral()); } //______________________________________________________ - //Actually evaluate function + // Actually evaluate function Int_t lStartBin = fhNanc->FindBin(0.0) + 1; for (Long_t iNanc = lStartBin; iNanc < fhNanc->GetNbinsX() + 1; iNanc++) { Double_t lNancestors = fhNanc->GetBinCenter(iNanc); Double_t lNancestorCount = fhNanc->GetBinContent(iNanc); - //if(lNancestorCount<1e-12&&lNancestors>10) break; + // if(lNancestorCount<1e-12&&lNancestors>10) break; // allow for variable mu in case requested Double_t lThisMu = (((Double_t)lNancestors)) * (par[0] + par[4] * lNancestors); @@ -219,7 +224,7 @@ Bool_t multGlauberNBDFitter::SetNpartNcollCorrelation(TH2* hNpNc) { Bool_t lReturnValue = kTRUE; if (hNpNc) { - fhNpNc = (TH2*)hNpNc; + fhNpNc = reinterpret_cast(hNpNc); } else { lReturnValue = kFALSE; } @@ -231,7 +236,7 @@ Bool_t multGlauberNBDFitter::SetInputV0M(TH1* hV0M) { Bool_t lReturnValue = kTRUE; if (hV0M) { - fhV0M = (TH1*)hV0M; + fhV0M = reinterpret_cast(hV0M); } else { lReturnValue = kFALSE; } @@ -279,7 +284,7 @@ void multGlauberNBDFitter::InitAncestor() Bool_t multGlauberNBDFitter::DoFit() { InitAncestor(); - //Try very hard, please + // Try very hard, please TVirtualFitter::SetMaxIterations(5000000); if (!InitializeNpNc()) { cout << "---> Initialization of Npart x Ncoll correlation info failed!" << endl; @@ -317,12 +322,12 @@ Bool_t multGlauberNBDFitter::DoFit() //________________________________________________________________ Bool_t multGlauberNBDFitter::InitializeNpNc() { - //This function initializes fhNpNc - //Warning: X == Npart, Y == Ncoll + // This function initializes fhNpNc + // Warning: X == Npart, Y == Ncoll Bool_t lReturnValue = kFALSE; if (fhNpNc) { fNNpNcPairs = 0; - //Sweep all allowed values of Npart, Ncoll; find counters + // Sweep all allowed values of Npart, Ncoll; find counters for (int xbin = 1; xbin < 500; xbin++) { for (int ybin = 1; ybin < 3000; ybin++) { if (fhNpNc->GetBinContent(fhNpNc->FindBin(xbin, ybin)) != 0) { @@ -345,12 +350,12 @@ Bool_t multGlauberNBDFitter::InitializeNpNc() //________________________________________________________________ Double_t multGlauberNBDFitter::ContinuousNBD(Double_t n, Double_t mu, Double_t k) { - //Adaptation of the negative binomial distribution - //for non-integer arguments: analytical continuation + // Adaptation of the negative binomial distribution + // for non-integer arguments: analytical continuation // - //This function would actually also be fine with integers; - //in fact it is equivalent to that if 'n' is typecast as - //an integer prior to use + // This function would actually also be fine with integers; + // in fact it is equivalent to that if 'n' is typecast as + // an integer prior to use Double_t F; Double_t f; @@ -390,10 +395,10 @@ void multGlauberNBDFitter::CalculateAvNpNc(TProfile* lNPartProf, TProfile* lNCol cout << "Glauber NBD norm ..........: " << fnorm << endl; cout << "Glauber NBD dmu/dNanc .....: " << fdMu << endl; - //2-fold nested loop: - // + looping over all Nancestor combinations - // + looping over all possible final multiplicities - // ^---> final product already multiplicity-binned + // 2-fold nested loop: + // + looping over all Nancestor combinations + // + looping over all possible final multiplicities + // ^---> final product already multiplicity-binned //______________________________________________________ if (lLoRange < -1 && lHiRange < -1) { diff --git a/Common/Tools/Multiplicity/multGlauberNBDFitter.h b/Common/Tools/Multiplicity/multGlauberNBDFitter.h index 42d5cab046f..951be39bd50 100644 --- a/Common/Tools/Multiplicity/multGlauberNBDFitter.h +++ b/Common/Tools/Multiplicity/multGlauberNBDFitter.h @@ -9,59 +9,60 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // -#ifndef MULTGLAUBERNBDFITTER_H -#define MULTGLAUBERNBDFITTER_H +#ifndef COMMON_TOOLS_MULTIPLICITY_MULTGLAUBERNBDFITTER_H_ +#define COMMON_TOOLS_MULTIPLICITY_MULTGLAUBERNBDFITTER_H_ + +#include +#include +#include +#include +#include +#include #include -#include "TNamed.h" -#include "TF1.h" -#include "TH1.h" -#include "TH1D.h" -#include "TH2.h" -#include "TProfile.h" class multGlauberNBDFitter : public TNamed { public: - //basic functionality + // basic functionality multGlauberNBDFitter(); - multGlauberNBDFitter(const char* name, const char* title = "Glauber+NBD fitter"); + explicit multGlauberNBDFitter(const char* name, const char* title = "Glauber+NBD fitter"); ~multGlauberNBDFitter(); - //Master fitter function + // Master fitter function Double_t ProbDistrib(Double_t* x, Double_t* par); void InitAncestor(); - //Do Fit: where everything happens + // Do Fit: where everything happens Bool_t DoFit(); - //Set input characteristics: the 2D plot with Npart, Nanc + // Set input characteristics: the 2D plot with Npart, Nanc Bool_t SetNpartNcollCorrelation(TH2* hNpNc); - //Set main input to be fitted (the V0M distribution) + // Set main input to be fitted (the V0M distribution) Bool_t SetInputV0M(TH1* hV0M); - //Interface to get funtions if asked to + // Interface to get funtions if asked to TF1* GetNBD(); TF1* GetGlauberNBD(); - //Helper + // Helper Bool_t InitializeNpNc(); - //Interface for debug + // Interface for debug void SetAncestorMode(Int_t lAncMode = 0) { fAncestorMode = lAncMode; } Int_t GetAncestorMode() { return fAncestorMode; } TH1D* GetAncestorHistogram() { return fhNanc; } - //Interface to set vals + // Interface to set vals void SetMu(Double_t lVal) { fMu = lVal; } void Setk(Double_t lVal) { fk = lVal; } void Setf(Double_t lVal) { ff = lVal; } void SetNorm(Double_t lVal) { fnorm = lVal; } - //Interface to get vals + // Interface to get vals Double_t GetMu() { return fMu; } Double_t Getk() { return fk; } Double_t Getf() { return ff; } @@ -71,41 +72,41 @@ class multGlauberNBDFitter : public TNamed void SetFitOptions(TString lOpt); void SetFitNpx(Long_t lNpx); - //For ancestor mode 2 + // For ancestor mode 2 Double_t ContinuousNBD(Double_t n, Double_t mu, Double_t k); - //For estimating Npart, Ncoll in multiplicity bins + // For estimating Npart, Ncoll in multiplicity bins void CalculateAvNpNc(TProfile* lNPartProf, TProfile* lNCollProf, TH2F* lNPart2DPlot, TH2F* lNColl2DPlot, TH1F* hPercentileMap, Double_t lLoRange = -1, Double_t lHiRange = -1); - //void Print(Option_t *option="") const; + // void Print(Option_t *option="") const; private: - //This function serves as the (analytical) NBD + // This function serves as the (analytical) NBD TF1* fNBD; - //This function is the key fitting function + // This function is the key fitting function TF1* fGlauberNBD; - //Reference histo - TH1D* fhNanc; //basic ancestor distribution - TH2* fhNpNc; //correlation between Npart and Ncoll - TH1* fhV0M; //basic ancestor distribution + // Reference histo + TH1D* fhNanc; // basic ancestor distribution + TH2* fhNpNc; // correlation between Npart and Ncoll + TH1* fhV0M; // basic ancestor distribution - //Fitting utilities + // Fitting utilities Bool_t ffChanged; Double_t fCurrentf; - //0: truncation, 1: rounding, 2: analytical continuation + // 0: truncation, 1: rounding, 2: analytical continuation Int_t fAncestorMode; - //Buffer for (Npart, Ncoll) pairs in memory + // Buffer for (Npart, Ncoll) pairs in memory Double_t* fNpart; Double_t* fNcoll; Long_t* fContent; - Long_t fNNpNcPairs; //number of pairs to use + Long_t fNNpNcPairs; // number of pairs to use Long_t fMaxNpNcPairs; - //The actual output: mu, k, f, norm + // The actual output: mu, k, f, norm Double_t fMu; Double_t fdMu; // variable mu option Double_t fk; @@ -117,4 +118,4 @@ class multGlauberNBDFitter : public TNamed ClassDef(multGlauberNBDFitter, 1); }; -#endif +#endif // COMMON_TOOLS_MULTIPLICITY_MULTGLAUBERNBDFITTER_H_ diff --git a/Common/Tools/Multiplicity/multMCCalibrator.cxx b/Common/Tools/Multiplicity/multMCCalibrator.cxx index 5b490daf77d..7e93e9b023e 100644 --- a/Common/Tools/Multiplicity/multMCCalibrator.cxx +++ b/Common/Tools/Multiplicity/multMCCalibrator.cxx @@ -16,19 +16,23 @@ // - victor.gonzalez@cern.ch // - david.dobrigkeit.chinellato@cern.ch // -#include "TList.h" -#include "TDirectory.h" -#include "TFile.h" -#include "TF1.h" -#include "TH1F.h" -#include "TH1D.h" -#include "TProfile.h" -#include "TStopwatch.h" -#include "TArrayL64.h" -#include "TArrayF.h" -#include "multCalibrator.h" #include "multMCCalibrator.h" +#include "multCalibrator.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include // FIXME + using namespace std; multMCCalibrator::multMCCalibrator() : TNamed(), @@ -79,22 +83,22 @@ Bool_t multMCCalibrator::Calibrate() cout << " * Output File............: " << fOutputFileName.Data() << endl; cout << endl; - //Opening data and simulation file... + // Opening data and simulation file... TFile* fileData = new TFile(fDataInputFileName.Data(), "READ"); TFile* fileSim = new TFile(fSimInputFileName.Data(), "READ"); - //Step 1: verify if input file contains desired histograms + // Step 1: verify if input file contains desired histograms TProfile* hProfData[multCalibrator::kNCentEstim]; TProfile* hProfSim[multCalibrator::kNCentEstim]; cout << " * acquiring input profiles..." << endl; for (Int_t iv = 0; iv < multCalibrator::kNCentEstim; iv++) { - hProfData[iv] = (TProfile*)fileData->Get(Form("multiplicity-qa/multiplicityQa/hProf%s", multCalibrator::fCentEstimName[iv].Data())); + hProfData[iv] = reinterpret_cast(fileData->Get(Form("multiplicity-qa/multiplicityQa/hProf%s", multCalibrator::fCentEstimName[iv].Data()))); if (!hProfData[iv]) { cout << Form("Data file does not contain histogram h%s, which is necessary for calibration!", multCalibrator::fCentEstimName[iv].Data()) << endl; return kFALSE; } hProfData[iv]->SetName(Form("hProfData_%s", multCalibrator::fCentEstimName[iv].Data())); - hProfSim[iv] = (TProfile*)fileSim->Get(Form("multiplicity-qa/multiplicityQa/hProf%s", multCalibrator::fCentEstimName[iv].Data())); + hProfSim[iv] = reinterpret_cast(fileSim->Get(Form("multiplicity-qa/multiplicityQa/hProf%s", multCalibrator::fCentEstimName[iv].Data()))); if (!hProfSim[iv]) { cout << Form("Sim file does not contain histogram h%s, which is necessary for calibration!", multCalibrator::fCentEstimName[iv].Data()) << endl; return kFALSE; @@ -135,14 +139,14 @@ Bool_t multMCCalibrator::Calibrate() //________________________________________________________________ TF1* multMCCalibrator::GetFit(TProfile* fProf, Bool_t lQuadratic) { - TString fFormula = "[0]*x"; //old/deprecated (avoid if possible, please) + TString fFormula = "[0]*x"; // old/deprecated (avoid if possible, please) if (lQuadratic) fFormula = "[0]+[1]*TMath::Power(x,[2])"; // Function to return fit function to profile for posterior inversion TF1* fit = new TF1(Form("%s_fit", fProf->GetName()), fFormula.Data(), fProf->GetBinLowEdge(1), fProf->GetBinLowEdge(fProf->GetNbinsX())); - //Guesstimate inclination from data points in profile + // Guesstimate inclination from data points in profile Double_t lMeanInclination = 0; Long_t lInclinationCount = 0; for (Int_t ii = 2; ii < fProf->GetNbinsX(); ii++) { @@ -158,7 +162,7 @@ TF1* multMCCalibrator::GetFit(TProfile* fProf, Bool_t lQuadratic) if (lInclinationCount >= 5) lMeanInclination /= lInclinationCount; - //Give it a little nudge, cause life's hard + // Give it a little nudge, cause life's hard fit->SetParameter(0, 0.0); fit->SetParameter(1, lMeanInclination); fit->SetParameter(2, 1.0); diff --git a/Common/Tools/Multiplicity/multMCCalibrator.h b/Common/Tools/Multiplicity/multMCCalibrator.h index f88bddf98c3..7d355146728 100644 --- a/Common/Tools/Multiplicity/multMCCalibrator.h +++ b/Common/Tools/Multiplicity/multMCCalibrator.h @@ -16,34 +16,35 @@ // - victor.gonzalez@cern.ch // - david.dobrigkeit.chinellato@cern.ch // -#ifndef MULTMCCALIBRATOR_H -#define MULTMCCALIBRATOR_H +#ifndef COMMON_TOOLS_MULTIPLICITY_MULTMCCALIBRATOR_H_ +#define COMMON_TOOLS_MULTIPLICITY_MULTMCCALIBRATOR_H_ -#include -#include "TNamed.h" -#include "TF1.h" -#include "TH1D.h" -#include "TProfile.h" +#include +#include +#include +#include + +#include // FIXME #include class multMCCalibrator : public TNamed { public: - //Constructors/Destructor + // Constructors/Destructor multMCCalibrator(); - multMCCalibrator(const char* name, const char* title = "MC Multiplicity Calibration Class"); + explicit multMCCalibrator(const char* name, const char* title = "MC Multiplicity Calibration Class"); ~multMCCalibrator(); //_________________________________________________________________________ - //Interface: steering functions to be used in calibration macro + // Interface: steering functions to be used in calibration macro - //Set Filenames + // Set Filenames void SetDataInputFile(TString lFile) { fDataInputFileName = lFile.Data(); } void SetSimInputFile(TString lFile) { fSimInputFileName = lFile.Data(); } void SetOutputFile(TString lFile) { fOutputFileName = lFile.Data(); } - //Master Function in this Class: To be called once filenames are set + // Master Function in this Class: To be called once filenames are set Bool_t Calibrate(); TF1* GetFit(TProfile* fProf, Bool_t lQuadratic = kTRUE); @@ -63,4 +64,4 @@ class multMCCalibrator : public TNamed // be streamed according to current workflow except in very specific // tests!) }; -#endif +#endif // COMMON_TOOLS_MULTIPLICITY_MULTMCCALIBRATOR_H_ diff --git a/Common/Tools/PID/handleParamBase.h b/Common/Tools/PID/handleParamBase.h index 01c2a66ab8b..53938f26b7f 100644 --- a/Common/Tools/PID/handleParamBase.h +++ b/Common/Tools/PID/handleParamBase.h @@ -19,12 +19,15 @@ #ifndef COMMON_TOOLS_PID_HANDLEPARAMBASE_H_ #define COMMON_TOOLS_PID_HANDLEPARAMBASE_H_ +#include +#include + +#include + +#include + #include #include -#include "CCDB/CcdbApi.h" -#include -#include "Framework/Logger.h" -#include "TFile.h" // Global executable arguments namespace bpo = boost::program_options; @@ -79,9 +82,9 @@ void setStandardOpt(bpo::options_description& options) } template -T* retrieveFromCCDB(const std::string path, +T* retrieveFromCCDB(const std::string& path, const int64_t timestamp, - std::map metadata) + const std::map& metadata) { std::map headers; LOG(info) << "Object " << path << " for timestamp " << timestamp << " -> " << timeStampToHReadble(timestamp); @@ -99,7 +102,7 @@ T* retrieveFromCCDB(const std::string path, } template -T* retrieveFromCCDB(const std::string path, +T* retrieveFromCCDB(const std::string& path, const int64_t timestamp) { std::map metadata; diff --git a/Common/Tools/TrackPropagationModule.h b/Common/Tools/TrackPropagationModule.h index 305a7c774f2..a08ec358993 100644 --- a/Common/Tools/TrackPropagationModule.h +++ b/Common/Tools/TrackPropagationModule.h @@ -16,16 +16,25 @@ #ifndef COMMON_TOOLS_TRACKPROPAGATIONMODULE_H_ #define COMMON_TOOLS_TRACKPROPAGATIONMODULE_H_ -#include "TableHelper.h" - +#include "Common/Core/TableHelper.h" +#include "Common/DataModel/TrackSelectionTables.h" #include "Common/Tools/TrackTuner.h" -#include "DataFormatsCalibration/MeanVertexObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DetectorsBase/Propagator.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/Configurable.h" -#include "Framework/HistogramSpec.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include #include #include @@ -89,7 +98,7 @@ class TrackPropagationModule std::shared_ptr trackTunedTracks; // Running variables - std::array mDcaInfo; + std::array mDcaInfo{}; o2::dataformats::DCA mDcaInfoCov; o2::dataformats::VertexBase mVtx; o2::track::TrackParametrization mTrackPar; diff --git a/Common/Tools/TrackTuner.h b/Common/Tools/TrackTuner.h index 26937eb9131..60cf377a410 100644 --- a/Common/Tools/TrackTuner.h +++ b/Common/Tools/TrackTuner.h @@ -18,34 +18,37 @@ #ifndef COMMON_TOOLS_TRACKTUNER_H_ #define COMMON_TOOLS_TRACKTUNER_H_ +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include #include #include +#include #include #include #include -#include -#include -#include - -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" -#include "CommonConstants/GeomConstants.h" -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "CommonUtils/NameConf.h" -#include "DataFormatsCalibration/MeanVertexObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/Configurable.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -#include "Framework/RunningWorkflowInfo.h" -#include "ReconstructionDataFormats/DCA.h" -#include "ReconstructionDataFormats/Track.h" -#include namespace o2::aod { @@ -246,7 +249,7 @@ struct TrackTuner : o2::framework::ConfigurableGroup { LOG(info) << "[TrackTuner]"; LOG(info) << "[TrackTuner] >>> String slices:"; - for (std::string& s : slices) + for (const std::string& s : slices) LOG(info) << "[TrackTuner] " << s; /// check if the number of input parameters is correct @@ -260,7 +263,7 @@ struct TrackTuner : o2::framework::ConfigurableGroup { /// lambda expression to search for the parameter value (as string) in the configuration string auto getValueString = [&](uint8_t iPar) { /// this allows to search the parameter configuration even if they are not written in order - auto it = std::find_if(slices.begin(), slices.end(), [&](std::string s) { return s.find(mapParNames[iPar]) != std::string::npos; }); + auto it = std::find_if(slices.begin(), slices.end(), [&](const std::string& s) { return s.find(mapParNames[iPar]) != std::string::npos; }); if (it == std::end(slices)) { // parameter not found LOG(fatal) << "\"" << mapParNames[iPar] << "\" not found in the configuration string"; @@ -274,7 +277,7 @@ struct TrackTuner : o2::framework::ConfigurableGroup { }; /// further lambda expression to handle bool initialization - auto setBoolFromString = [=](bool& b, std::string str) { + auto setBoolFromString = [=](bool& b, const std::string& str) { if (!str.compare("1") || str.find("true") != std::string::npos || str.find("True") != std::string::npos || str.find("TRUE") != std::string::npos) { b = true; } else if (!str.compare("0") || str.find("false") != std::string::npos || str.find("False") != std::string::npos || str.find("FALSE") != std::string::npos) { diff --git a/Common/Tools/trackSelectionRequest.h b/Common/Tools/trackSelectionRequest.h index 123392611f0..a056eaaaed0 100644 --- a/Common/Tools/trackSelectionRequest.h +++ b/Common/Tools/trackSelectionRequest.h @@ -21,18 +21,20 @@ // Because of this, it is particularly important that the cuts in this object // in an analysis! -#ifndef TRACKSELECTIONREQUEST_H -#define TRACKSELECTIONREQUEST_H +#ifndef COMMON_TOOLS_TRACKSELECTIONREQUEST_H_ +#define COMMON_TOOLS_TRACKSELECTIONREQUEST_H_ -#include -#include #include +#include + +#include + class trackSelectionRequest { public: trackSelectionRequest() - : trackPhysicsType{0}, minPt{0.0}, maxPt{1e+6}, minEta{-100}, maxEta{+100}, maxDCAz{1e+6}, maxDCAxyPtDep{1e+6}, requireTPC{false}, minTPCclusters{-1}, minTPCcrossedrows{-1}, minTPCcrossedrowsoverfindable{0.0}, requireITS{false}, minITSclusters{-1}, maxITSChi2percluster{1e+6} + : trackPhysicsType{0}, minPt{0.0}, maxPt{1e+6}, minEta{-100}, maxEta{+100}, maxDCAz{1e+6}, maxDCAxyPtDep{1e+6}, requireTPC{false}, minTPCclusters{-1}, minTPCcrossedrows{-1}, minTPCcrossedrowsoverfindable{0.0}, maxTPCFractionSharedCls{0.0}, requireITS{false}, minITSclusters{-1}, maxITSChi2percluster{1e+6} { // constructor } @@ -88,7 +90,7 @@ class trackSelectionRequest if (lTrack.eta() > maxEta) return false; // DCA to PV - if (fabs(lTrack.dcaXY()) < maxDCAz) + if (std::fabs(lTrack.dcaXY()) < maxDCAz) return false; // TracksExtra-based if (lTrack.hasTPC() == false && requireTPC) @@ -163,4 +165,4 @@ class trackSelectionRequest std::ostream& operator<<(std::ostream& os, trackSelectionRequest const& c); -#endif // TRACKSELECTIONREQUEST_H +#endif // COMMON_TOOLS_TRACKSELECTIONREQUEST_H_