diff --git a/algo/ca/qa/CaQaBuilder.cxx b/algo/ca/qa/CaQaBuilder.cxx index 38b36515946b6e3978f849fe95b0f0f17ec757bb..19e210fa8159886b6e43d62abca7325b6d0a9078 100644 --- a/algo/ca/qa/CaQaBuilder.cxx +++ b/algo/ca/qa/CaQaBuilder.cxx @@ -45,7 +45,6 @@ Data Builder::Build() // Fill track histograms int trkFirstHit = 0; // Index of hit in fpvRecoHits - int iTr = 0; for (auto& track : (*fpvTracks)) { int nHits = track.fNofHits; // Indices of hits in fpInputData->GetHits() diff --git a/core/base/CbmMatchRecoToMC.cxx b/core/base/CbmMatchRecoToMC.cxx index 6e35585a1f40bbdfb654da8cddd7adeff4f684fd..63ecb93969a4c48199a938267f39914af493a1da 100644 --- a/core/base/CbmMatchRecoToMC.cxx +++ b/core/base/CbmMatchRecoToMC.cxx @@ -157,7 +157,9 @@ void CbmMatchRecoToMC::Exec(Option_t* /*opt*/) // ----- MVD ----- if (!fbSuppressHitReMatching) { // MVD: digi->hit - if (fMvdHits && fMvdHitMatches && !fMvdCluster) { MatchHitsMvd(fMvdHits, fMvdHitMatches); } + if (fMvdHits && fMvdHitMatches && !fMvdCluster) { + MatchHitsMvd(fMvdHits, fMvdHitMatches); + } else { // MVD: digi->cluster MatchClusters(ECbmModuleId::kMvd, fMvdCluster, fMvdClusterMatches); @@ -201,17 +203,23 @@ void CbmMatchRecoToMC::Exec(Option_t* /*opt*/) MatchTracks(fTrdHitMatches, fTrdPoints, fTrdTracks, fTrdTrackMatches); } else if (fTrdHits) { // MC->hit->track - if (!fbSuppressHitReMatching) { MatchHitsToPoints(fTrdPoints, fTrdHits, fTrdHitMatches); } + if (!fbSuppressHitReMatching) { + MatchHitsToPoints(fTrdPoints, fTrdHits, fTrdHitMatches); + } MatchTracks(fTrdHitMatches, fTrdPoints, fTrdTracks, fTrdTrackMatches); } // TOF: (Digi->MC)+(Hit->Digi)=>(Hit->MC) - if (!fbSuppressHitReMatching) { MatchHitsTof(fTofHitDigiMatches, fTofHits, fTofHitMatches); } + if (!fbSuppressHitReMatching) { + MatchHitsTof(fTofHitDigiMatches, fTofHits, fTofHitMatches); + } // ----- FSD ----- if (!fbSuppressHitReMatching) { // FSD: digi->hit - if (fFsdHits && fFsdHitMatches) { MatchHitsFsd(fFsdHits, fFsdHitMatches); } + if (fFsdHits && fFsdHitMatches) { + MatchHitsFsd(fFsdHits, fFsdHitMatches); + } } @@ -224,11 +232,15 @@ void CbmMatchRecoToMC::Finish() {} void CbmMatchRecoToMC::ReadAndCreateDataBranches() { FairRootManager* ioman = FairRootManager::Instance(); - if (nullptr == ioman) { LOG(fatal) << "CbmMatchRecoToMC::ReadAndCreateDataBranches() NULL FairRootManager."; } + if (nullptr == ioman) { + LOG(fatal) << "CbmMatchRecoToMC::ReadAndCreateDataBranches() NULL FairRootManager."; + } CbmMCDataManager* mcManager = (CbmMCDataManager*) ioman->GetObject("MCDataManager"); - if (nullptr == mcManager) { LOG(fatal) << "CbmMatchRecoToMC::ReadAndCreateDataBranches() NULL MCDataManager."; } + if (nullptr == mcManager) { + LOG(fatal) << "CbmMatchRecoToMC::ReadAndCreateDataBranches() NULL MCDataManager."; + } fMCTracks = mcManager->InitBranch("MCTrack"); @@ -418,7 +430,9 @@ void CbmMatchRecoToMC::ReadAndCreateDataBranches() if (nullptr == fTofDigis) { LOG(info) << "No calibrated tof digi vector in the input files => trying original vector"; fTofDigis = ioman->InitObjectAs<std::vector<CbmTofDigi> const*>("TofDigi"); - if (nullptr == fTofDigis) { LOG(info) << "No original tof digi vector in the input files! Ignore TOF!"; } + if (nullptr == fTofDigis) { + LOG(info) << "No original tof digi vector in the input files! Ignore TOF!"; + } } else LOG(info) << "Found calibrated tof digi vector in one of the input files"; @@ -428,7 +442,9 @@ void CbmMatchRecoToMC::ReadAndCreateDataBranches() if (nullptr == fTofDigiMatch) { LOG(info) << "No calibrated tof digi to point match vector in the input files => trying original vector"; fTofDigiMatch = ioman->InitObjectAs<std::vector<CbmMatch> const*>("TofDigiMatch"); - if (nullptr == fTofDigiMatch) { LOG(fatal) << "No original tof digi to point match vector in the input files!"; } + if (nullptr == fTofDigiMatch) { + LOG(fatal) << "No original tof digi to point match vector in the input files!"; + } } else LOG(info) << "Found calibrated tof digi to point match vector in one of the input files"; @@ -673,7 +689,8 @@ void CbmMatchRecoToMC::MatchTracks(const TClonesArray* hitMatches, CbmMCDataArra break; } } - if (hasTrue) trueCounter++; + if (hasTrue) + trueCounter++; else wrongCounter++; } @@ -687,7 +704,9 @@ void CbmMatchRecoToMC::MatchStsTracks(const TClonesArray* mvdHitMatches, const T CbmMCDataArray* mvdPoints, CbmMCDataArray* stsPoints, const TClonesArray* tracks, TClonesArray* trackMatches) { - if (!tracks) { return; } + if (!tracks) { + return; + } if (!(stsHitMatches && stsPoints && tracks && trackMatches)) { LOG(error) << "CbmMatchRecoToMC: missing the necessary STS info for the " @@ -736,7 +755,9 @@ void CbmMatchRecoToMC::MatchStsTracks(const TClonesArray* mvdHitMatches, const T Int_t mcTrackId = point->GetTrackID(); CbmMCTrack* mcTrack = (CbmMCTrack*) fMCTracks->Get(link.GetFile(), link.GetEntry(), mcTrackId); assert(mcTrack); - if (mcTrack->GetNPoints(ECbmModuleId::kSts) < 2) { continue; } + if (mcTrack->GetNPoints(ECbmModuleId::kSts) < 2) { + continue; + } } /// trackMatch->AddLink(CbmLink(1., point->GetTrackID(), link.GetEntry(), link.GetFile())); @@ -756,7 +777,9 @@ void CbmMatchRecoToMC::MatchStsTracks(const TClonesArray* mvdHitMatches, const T } } - if (!trackMatch->GetNofLinks()) { continue; } + if (!trackMatch->GetNofLinks()) { + continue; + } // Calculate number of true and wrong hits Int_t trueCounter = trackMatch->GetNofTrueHits(); @@ -767,13 +790,17 @@ void CbmMatchRecoToMC::MatchStsTracks(const TClonesArray* mvdHitMatches, const T Bool_t hasTrue = false; for (Int_t iLink = 0; iLink < nofLinks; iLink++) { const FairMCPoint* point = static_cast<const FairMCPoint*>(stsPoints->Get(hitMatch->GetLink(iLink))); - if (nullptr == point) { continue; } + if (nullptr == point) { + continue; + } if (point->GetTrackID() == trackMatch->GetMatchedLink().GetIndex()) { hasTrue = true; break; } } - if (hasTrue) { trueCounter++; } + if (hasTrue) { + trueCounter++; + } else { wrongCounter++; } @@ -786,7 +813,9 @@ void CbmMatchRecoToMC::MatchStsTracks(const TClonesArray* mvdHitMatches, const T Bool_t hasTrue = false; for (Int_t iLink = 0; iLink < nofLinks; iLink++) { const FairMCPoint* point = static_cast<const FairMCPoint*>(mvdPoints->Get(hitMatch->GetLink(iLink))); - if (nullptr == point) { continue; } + if (nullptr == point) { + continue; + } if ( /*point->GetEventID() == trackMatch->GetMatchedLink().GetEntry() && */ point->GetTrackID() == trackMatch->GetMatchedLink().GetIndex()) { @@ -794,7 +823,9 @@ void CbmMatchRecoToMC::MatchStsTracks(const TClonesArray* mvdHitMatches, const T break; } } - if (hasTrue) { trueCounter++; } + if (hasTrue) { + trueCounter++; + } else { wrongCounter++; } @@ -899,7 +930,9 @@ vector<pair<Int_t, Int_t>> CbmMatchRecoToMC::GetMcTrackMotherIdsForRichHit(CbmDi // several photons can have same mother track // count only unique motherIds pair<Int_t, Int_t> val = std::make_pair(eventId, motherId); - if (std::find(result.begin(), result.end(), val) == result.end()) { result.push_back(val); } + if (std::find(result.begin(), result.end(), val) == result.end()) { + result.push_back(val); + } } return result; @@ -935,7 +968,9 @@ vector<Int_t> CbmMatchRecoToMC::GetMcTrackMotherIdsForRichHit(CbmDigiManager* di Int_t motherId = mcTrack->GetMotherId(); // several photons can have same mother track // count only unique motherIds - if (std::find(result.begin(), result.end(), motherId) == result.end()) { result.push_back(motherId); } + if (std::find(result.begin(), result.end(), motherId) == result.end()) { + result.push_back(motherId); + } } return result; diff --git a/core/qa/CbmQaCanvas.cxx b/core/qa/CbmQaCanvas.cxx index e1100845041c5d77b701c5ed8859118af91d8e77..c9aa3f7ae2e99ab2bdc9b1932246c6985f76ae92 100644 --- a/core/qa/CbmQaCanvas.cxx +++ b/core/qa/CbmQaCanvas.cxx @@ -23,7 +23,9 @@ void CbmQaCanvas::Streamer(TBuffer& R__b) // Save global gPad pointer, // because it will be modified by TCanvas streamer auto store = gPad; - if (R__b.IsReading()) { R__b.ReadClassBuffer(CbmQaCanvas::Class(), this); } + if (R__b.IsReading()) { + R__b.ReadClassBuffer(CbmQaCanvas::Class(), this); + } else { R__b.WriteClassBuffer(CbmQaCanvas::Class(), this); } diff --git a/core/qa/CbmQaCanvas.h b/core/qa/CbmQaCanvas.h index f22cb77fcb8a80a5bdbae3dadac8f7ec75951be9..2c2e7bdb89776027856763eedf9041c03f014a70 100644 --- a/core/qa/CbmQaCanvas.h +++ b/core/qa/CbmQaCanvas.h @@ -29,7 +29,7 @@ /// later this will cause crashes in the ROOT Browser for whatever reason. /// class CbmQaCanvas : public TCanvas { -public: + public: /// Default constructor needed by the ROOT streamer CbmQaCanvas() : TCanvas() {} @@ -57,7 +57,7 @@ public: } -private: + private: /// Use a specific type name in order to avoid ambiguities when unrolling /// templates enum MyBoolean : Bool_t; diff --git a/core/qa/CbmQaCmpDrawer.h b/core/qa/CbmQaCmpDrawer.h index 14832b880accb9f75394bd3b4a03c1cdef44b010..63c31c90de5491b0bda082b76b61baac0b63467b 100644 --- a/core/qa/CbmQaCmpDrawer.h +++ b/core/qa/CbmQaCmpDrawer.h @@ -11,7 +11,6 @@ #define CbmQaCmpDrawer_h 1 #include "Logger.h" - #include "TH1.h" #include "TH2.h" #include "TH3.h" @@ -28,7 +27,7 @@ /// template<class Obj> class CbmQaCmpDrawer { -public: + public: /// @brief Default constructor CbmQaCmpDrawer(); @@ -73,7 +72,7 @@ public: /// by the value (1. + kIndentFromMax), which is 1.1 by default void SetMaximum(double max) { fMaximum = max; } -private: + private: // Some constant expressions (TODO: move to a separate header) static constexpr double kLegEntryHight = 0.06; ///< Hight of one legend entry in Y axis static constexpr double kLegEntryWidth = 0.35; ///< Width of the legend @@ -164,11 +163,15 @@ void CbmQaCmpDrawer<Obj>::Draw(Option_t* /*opt*/) const int nObjects = fvpObjects.size(); int nRows = static_cast<int>(std::sqrt(nObjects)); int nCols = nObjects / nRows; - if (nCols * nRows < nObjects) { ++nCols; } + if (nCols * nRows < nObjects) { + ++nCols; + } gPad->Divide(nCols, nRows); for (auto it = fvpObjects.begin(); it != fvpObjects.end(); ++it) { - if constexpr (std::is_base_of_v<TH2, Obj>) { (*it)->Draw("colz"); } + if constexpr (std::is_base_of_v<TH2, Obj>) { + (*it)->Draw("colz"); + } else { (*it)->Draw(); } diff --git a/core/qa/CbmQaEff.cxx b/core/qa/CbmQaEff.cxx index d4b18167bfe46b274196dfcf911fe4e0742a0744..2d39033c0d835be7bce9907d3d46448c73d4c8ff 100644 --- a/core/qa/CbmQaEff.cxx +++ b/core/qa/CbmQaEff.cxx @@ -10,7 +10,6 @@ #include "CbmQaEff.h" #include "Logger.h" - #include "TString.h" // --------------------------------------------------------------------------------------------------------------------- @@ -72,13 +71,17 @@ std::tuple<double, double, double> CbmQaEff::GetTotalEfficiency() const // CbmQaEff* CbmQaEff::Integral(double lo, double hi) { - if (GetDimension() != 1) { return nullptr; } // For now efficiency integration works only for 1D + if (GetDimension() != 1) { + return nullptr; + } // For now efficiency integration works only for 1D // Underlying histograms with passed and total events auto* pPassed = (TH1D*) (this->GetPassedHistogram()); auto* pTotal = (TH1D*) (this->GetTotalHistogram()); - if (!pPassed) { return nullptr; } + if (!pPassed) { + return nullptr; + } // Integration range double range[2] = {0}; @@ -110,9 +113,13 @@ CbmQaEff* CbmQaEff::DrawCopy(Option_t* opt, const char* postfix) const { TString option = opt; option.ToLower(); - if (gPad && !option.Contains("same")) { gPad->Clear(); } + if (gPad && !option.Contains("same")) { + gPad->Clear(); + } TString newName = ""; - if (postfix) { newName.Form("%s%s", GetName(), postfix); } + if (postfix) { + newName.Form("%s%s", GetName(), postfix); + } CbmQaEff* pNewEff = (CbmQaEff*) Clone(newName.Data()); pNewEff->SetDirectory(nullptr); pNewEff->SetBit(kCanDelete); diff --git a/core/qa/CbmQaEff.h b/core/qa/CbmQaEff.h index f31fd14675310da9b3a6c113a439ec9a3c6960e5..eaf3c156e3a21f0ca7c77824e59d89a1eb97c789 100644 --- a/core/qa/CbmQaEff.h +++ b/core/qa/CbmQaEff.h @@ -12,9 +12,7 @@ #define CbmQaEff_h 1 #include "CbmQaCanvas.h" - #include "Logger.h" - #include "TEfficiency.h" #include "TFitResultPtr.h" #include "TGraphAsymmErrors.h" @@ -29,7 +27,7 @@ /// Implementation of ROOT TEfficiency class, which adds handy functionality and improves fitting and drawing /// class CbmQaEff : public TEfficiency { -public: + public: static constexpr int kMarkerStyle = 20; /// Default constructor @@ -57,12 +55,16 @@ public: { TEfficiency::Paint(opt); SetStats(); - if (fpStats) { fpStats->Draw(); } + if (fpStats) { + fpStats->Draw(); + } } void Draw(Option_t* opt = "") { - if (GetDimension() == 1) { this->SetMarkerStyle(kMarkerStyle); } + if (GetDimension() == 1) { + this->SetMarkerStyle(kMarkerStyle); + } TEfficiency::Draw(opt); } @@ -90,7 +92,7 @@ public: ClassDef(CbmQaEff, 1); -private: + private: TPaveText* fpStats = nullptr; ///< Statistics box // Functions of the base class, using which can produce inconsistent results diff --git a/core/qa/CbmQaHist.h b/core/qa/CbmQaHist.h index 194710611c4a344f558ef647ce38b393e61c8b62..ab212734ba2793ce05cdebe36f9ff0baad9c2233 100644 --- a/core/qa/CbmQaHist.h +++ b/core/qa/CbmQaHist.h @@ -35,7 +35,7 @@ /// template<class HistTypeT> class CbmQaHist : public HistTypeT { -public: + public: /// Default constructor only for the streamer CbmQaHist() : HistTypeT() { @@ -56,7 +56,9 @@ public: template<typename... Types> CbmQaHist(Types... args) : HistTypeT(args...) { - if (gStyle) { SetOptStatFit(gStyle->GetOptStat(), gStyle->GetOptFit()); } + if (gStyle) { + SetOptStatFit(gStyle->GetOptStat(), gStyle->GetOptFit()); + } this->SetLineWidth(2); } @@ -112,7 +114,9 @@ public: fOptStat = stat; fOptFit = fit; - if (!gStyle) { return; } // should not happen + if (!gStyle) { + return; + } // should not happen TVirtualPad* savePad = gPad; int saveStat = gStyle->GetOptStat(); @@ -134,7 +138,7 @@ public: if (savePad) savePad->cd(); } -private: + private: int fOptStat = 1; int fOptFit = 0; diff --git a/core/qa/CbmQaIO.cxx b/core/qa/CbmQaIO.cxx index 3ad2fc13bd60c74d29a628c4e970170fb62b7f0b..d440cb301102affb20d97a13940eac65e9c9e533 100644 --- a/core/qa/CbmQaIO.cxx +++ b/core/qa/CbmQaIO.cxx @@ -11,7 +11,6 @@ #include "CbmQaCanvas.h" #include "CbmQaUtil.h" - #include "TFile.h" #include "TPaveStats.h" @@ -19,8 +18,12 @@ // CbmQaIO::CbmQaIO(TString prefixName, std::shared_ptr<ObjList_t> pObjList) : fsPrefix(prefixName), fpvObjList(pObjList) { - if (!fsPrefix.IsNull()) { fsPrefix += "_"; } - if (!fpvObjList.get()) { fpvObjList = std::make_shared<ObjList_t>(); } + if (!fsPrefix.IsNull()) { + fsPrefix += "_"; + } + if (!fpvObjList.get()) { + fpvObjList = std::make_shared<ObjList_t>(); + } } // --------------------------------------------------------------------------------------------------------------------- @@ -109,9 +112,13 @@ void CbmQaIO::WriteToFile(TFile* pOutFile) const { pOutFile->cd(); for (auto& [pObject, sPath] : (*fpvObjList)) { - if (!pOutFile->GetDirectory(sPath)) { pOutFile->mkdir(sPath); } + if (!pOutFile->GetDirectory(sPath)) { + pOutFile->mkdir(sPath); + } pOutFile->cd(sPath); - if (pObject) { pObject->Write(); } + if (pObject) { + pObject->Write(); + } } } @@ -121,7 +128,9 @@ void CbmQaIO::WriteToFile(TFile* pOutFile) const void CbmQaIO::MakeQaDirectory(TString sDirectory) { // Add parent directory - if (fsRootFolderName.Length() != 0) { sDirectory = fsRootFolderName + "/" + sDirectory; } + if (fsRootFolderName.Length() != 0) { + sDirectory = fsRootFolderName + "/" + sDirectory; + } // Register the object in the list fpvObjList->push_back(std::make_pair(nullptr, sDirectory)); diff --git a/core/qa/CbmQaIO.h b/core/qa/CbmQaIO.h index 55fb1f318911bb6cff554fa87d715246bdc33487..2964cdac4d88f104104b2bfa4a86d9982e8305f7 100644 --- a/core/qa/CbmQaIO.h +++ b/core/qa/CbmQaIO.h @@ -13,9 +13,7 @@ #include "CbmQaCanvas.h" #include "CbmQaEff.h" #include "CbmQaTable.h" - #include "Logger.h" - #include "TCanvas.h" #include "TEfficiency.h" #include "TH1.h" @@ -41,7 +39,7 @@ class TFile; /// /// The class provides interface to write ROOT object into resulted files class CbmQaIO { -public: + public: using ObjList_t = std::vector<std::pair<TObject*, TString>>; enum class EStoringMode @@ -110,7 +108,7 @@ public: /// @brief Set storing mode void SetStoringMode(EStoringMode mode) { fStoringMode = mode; } -protected: + protected: /// @brief Function to check, if a property is defined /// @param property A property to be tested /// @param name A name of property (used for logging) @@ -146,9 +144,9 @@ protected: EStoringMode fStoringMode = EStoringMode::kSUBDIR; ///< Objects storing mode std::shared_ptr<ObjList_t> fpvObjList = nullptr; ///< List of registered ROOT objects - YAML::Node fConfigNode {}; ///< Configuration node + YAML::Node fConfigNode{}; ///< Configuration node -private: + private: /// @brief Creates and registers a ROOT object /// @param name A name of the ROOT object, which can contain a sub-directory /// @param args Other arguments, passed to the ROOT object constructor @@ -163,7 +161,9 @@ template<typename T> void CbmQaIO::CheckProperty(T&& property, const char* name) const { bool bPropertyUndefined = false; - if constexpr (std::is_signed_v<T>) { bPropertyUndefined = property < 0; } + if constexpr (std::is_signed_v<T>) { + bPropertyUndefined = property < 0; + } else if constexpr (std::is_floating_point_v<T>) { bPropertyUndefined = std::isnan(property); } @@ -180,7 +180,9 @@ void CbmQaIO::CheckProperty(T&& property, const char* name) const template<typename T, typename... Args> T* CbmQaIO::ConstructAndRegisterQaObject(TString sName, Args... args) { - if constexpr (std::is_base_of_v<CbmQaTable, T>) { static_assert(sizeof...(Args) == 3); } + if constexpr (std::is_base_of_v<CbmQaTable, T>) { + static_assert(sizeof...(Args) == 3); + } // Resolve directory name and object name auto iLastSlashPos = static_cast<int>(sName.Last('/')); @@ -207,17 +209,23 @@ T* CbmQaIO::ConstructAndRegisterQaObject(TString sName, Args... args) } else if constexpr (std::is_base_of_v<TCanvas, T>) { // canvases auto* pListOfCanvases = gROOT->GetListOfCanvases(); - if (-1 != pListOfCanvases->IndexOf(pObj)) { pListOfCanvases->Remove(pObj); } + if (-1 != pListOfCanvases->IndexOf(pObj)) { + pListOfCanvases->Remove(pObj); + } SetCanvasProperties(pObj); } // Define a "summary" subdirectory of canvases and tables if constexpr (std::is_base_of_v<CbmQaTable, T> || std::is_base_of_v<TCanvas, T>) { - if (EStoringMode::kSUBDIR == fStoringMode) { sDirectory = TString("Summary/") + sDirectory; } + if (EStoringMode::kSUBDIR == fStoringMode) { + sDirectory = TString("Summary/") + sDirectory; + } } // Add parent directory - if (fsRootFolderName.Length() != 0) { sDirectory = fsRootFolderName + "/" + sDirectory; } + if (fsRootFolderName.Length() != 0) { + sDirectory = fsRootFolderName + "/" + sDirectory; + } // Register the object in the list fpvObjList->push_back(std::make_pair(static_cast<TObject*>(pObj), sDirectory)); @@ -230,24 +238,32 @@ T* CbmQaIO::ConstructAndRegisterQaObject(TString sName, Args... args) template<typename T, typename... Args> T* CbmQaIO::MakeQaObject(TString sName, TString sTitle, Args... args) { - if constexpr (std::is_base_of_v<CbmQaTable, T>) { static_assert(sizeof...(Args) == 2); } + if constexpr (std::is_base_of_v<CbmQaTable, T>) { + static_assert(sizeof...(Args) == 2); + } // Resolve configuration tag, if any auto iLastSepPos = static_cast<int>(sName.Last(';')); TString sTagName = sName(iLastSepPos + 1, sName.Length() - iLastSepPos); - if (iLastSepPos != -1) { sName = sName(0, iLastSepPos); } + if (iLastSepPos != -1) { + sName = sName(0, iLastSepPos); + } bool bUseConfig = false; // Check, if parameters are provided for this tag if (fConfigNode) { if constexpr (std::is_base_of_v<TH1, T>) { if (fConfigNode["histograms"]) { - if (fConfigNode["histograms"][sTagName.Data()]) { bUseConfig = true; } + if (fConfigNode["histograms"][sTagName.Data()]) { + bUseConfig = true; + } } } else if constexpr (std::is_base_of_v<TCanvas, T>) { if (fConfigNode["canvases"]) { - if (fConfigNode["canvases"][sTagName.Data()]) { bUseConfig = true; } + if (fConfigNode["canvases"][sTagName.Data()]) { + bUseConfig = true; + } } } } @@ -285,7 +301,9 @@ T* CbmQaIO::MakeQaObject(TString sName, TString sTitle, Args... args) maxZ = axisNode["max"].as<double>(); } - if constexpr (std::is_base_of_v<CbmQaTable, T>) { return ConstructAndRegisterQaObject<T>(sName, title, args...); } + if constexpr (std::is_base_of_v<CbmQaTable, T>) { + return ConstructAndRegisterQaObject<T>(sName, title, args...); + } else if constexpr (std::is_base_of_v<TProfile2D, T>) { CheckProperty(nBinsX, Form("qa/histograms/%s/x/nbins", sTagName.Data())); CheckProperty(minX, Form("qa/histograms/%s/x/min", sTagName.Data())); diff --git a/core/qa/CbmQaManager.cxx b/core/qa/CbmQaManager.cxx index e03f2fada8840a229690f9383276f8077966d999..ce4852f2e16c404c905d9444ef2d4469db9453b3 100644 --- a/core/qa/CbmQaManager.cxx +++ b/core/qa/CbmQaManager.cxx @@ -10,7 +10,6 @@ #include "CbmQaManager.h" #include "CbmQaTask.h" - #include "Logger.h" #include <iomanip> @@ -31,7 +30,9 @@ void CbmQaManager::Finish() std::map<std::string, std::map<std::string, bool>> qaResults; for (auto* task : *(this->GetListOfTasks())) { auto* pQaTask = dynamic_cast<CbmQaTask*>(task); - if (pQaTask) { qaResults[std::string(task->GetName())] = pQaTask->Check(); } + if (pQaTask) { + qaResults[std::string(task->GetName())] = pQaTask->Check(); + } } fStatus = true; diff --git a/core/qa/CbmQaManager.h b/core/qa/CbmQaManager.h index 980cfbd352a0ecb66439d6d0724f741c491062e8..2c818769650606316f4e4b7cf730d6754b026b49 100644 --- a/core/qa/CbmQaManager.h +++ b/core/qa/CbmQaManager.h @@ -15,7 +15,7 @@ #include <string> class CbmQaManager : public FairTask { -public: + public: /// \brief Constructor from parameters /// \param verbose Verbose level CbmQaManager(int verbose = 1); @@ -39,7 +39,7 @@ public: void AddTask(FairTask* task) { this->Add(task); } /// \brief Action of the task in the time-slice - void Exec(Option_t*) {}; + void Exec(Option_t*){}; /// \brief Action of the task in the end of the run void Finish(); @@ -55,6 +55,6 @@ public: /// \brief Gets status flag bool GetStatus() const { return fStatus; } -private: + private: bool fStatus = true; ///< Status of QA: true - all tasks passed, false - at least one of the task failed }; diff --git a/core/qa/CbmQaPie.cxx b/core/qa/CbmQaPie.cxx index d9c48634d37a95993781fc89ed2448fadd53afbb..accb3e4e7d3593e75138e1e048e2d639b260ca1a 100644 --- a/core/qa/CbmQaPie.cxx +++ b/core/qa/CbmQaPie.cxx @@ -66,7 +66,9 @@ void CbmQaPie::Streamer(TBuffer& R__b) if (R__b.IsReading()) { for (int i = 0; i < fNvals; i++) { - if (gPad && gPad->GetListOfPrimitives()) { gPad->GetListOfPrimitives()->Remove(fPieSlices[i]); } + if (gPad && gPad->GetListOfPrimitives()) { + gPad->GetListOfPrimitives()->Remove(fPieSlices[i]); + } delete fPieSlices[i]; fPieSlices[i] = nullptr; } diff --git a/core/qa/CbmQaPie.h b/core/qa/CbmQaPie.h index 41c5afba81b71e34758d587e5d2864f8c182019f..07cc93baee213b2d454ce47198eca01a5723b3a2 100644 --- a/core/qa/CbmQaPie.h +++ b/core/qa/CbmQaPie.h @@ -10,9 +10,8 @@ #ifndef CbmQaPie_H #define CbmQaPie_H -#include "TPieSlice.h" - #include "TPie.h" +#include "TPieSlice.h" #include <vector> @@ -21,7 +20,7 @@ class TBrowser; /// A helper class for accessing protected members of TPieSlice /// class CbmQaPieSlice : public TPieSlice { -public: + public: /// assignment operator CbmQaPieSlice& operator=(const TPieSlice& inp) { return (*this = (const CbmQaPieSlice&) (inp)); } /// set a TPie pointer @@ -39,7 +38,7 @@ public: /// 5. TBrowser dosen't draw a TPie by a mouse click. /// class CbmQaPie : public TPie { -public: + public: /// Reimplementation of any existing TPie constructor template<typename... Types> CbmQaPie(Types... args) : TPie(args...) @@ -58,7 +57,7 @@ public: /// Prevents original TPie::Draw() from crashing when there are no entries void Draw(Option_t* option = "l"); -private: + private: /// a vector for slice streaming. It replaces the original array of pointers. std::vector<CbmQaPieSlice> fSliceStore; diff --git a/core/qa/CbmQaTable.cxx b/core/qa/CbmQaTable.cxx index 788e182f04b01aeee0902b986d7118dc848227ab..78c4d7e3a5cd6e5cdcf0e75201a1f0e3526bbb45 100644 --- a/core/qa/CbmQaTable.cxx +++ b/core/qa/CbmQaTable.cxx @@ -108,7 +108,9 @@ std::string CbmQaTable::ToString(int prec) const for (Int_t iCol = 0; iCol < fNcols; ++iCol) { std::string entry = std::string(this->GetXaxis()->GetBinLabel(iCol + 1)); - if (Int_t(entry.size()) + 3 > fColWidth) { entry = entry.substr(0, fColWidth - 3) + "..."; } + if (Int_t(entry.size()) + 3 > fColWidth) { + entry = entry.substr(0, fColWidth - 3) + "..."; + } aStream << std::setw(fColWidth) << std::setfill(' ') << entry << ' '; } aStream << '\n'; @@ -116,7 +118,9 @@ std::string CbmQaTable::ToString(int prec) const for (Int_t iRow = 0; iRow < fNrows; ++iRow) { // Print row title std::string entry = std::string(GetYaxis()->GetBinLabel(fNrows - iRow)); - if (static_cast<Int_t>(entry.size()) > fColWidth) { entry = entry.substr(0, fColWidth + 7) + "..."; } + if (static_cast<Int_t>(entry.size()) > fColWidth) { + entry = entry.substr(0, fColWidth + 7) + "..."; + } aStream << std::setw(fColWidth + 10) << std::setfill(' ') << entry << ' '; for (Int_t iCol = 0; iCol < fNcols; ++iCol) { diff --git a/core/qa/CbmQaTable.h b/core/qa/CbmQaTable.h index fc6fa72d9773f9d5a544245e281557695193d302..ecbaa171ccae5482f38ad3dc0a650380239581c7 100644 --- a/core/qa/CbmQaTable.h +++ b/core/qa/CbmQaTable.h @@ -22,7 +22,7 @@ /// TODO: SZh, 30.01.2023: Override THistPainter::PaintText() to add zeroes in tables class CbmQaTable : public TH2D { -public: + public: /// Default constructor CbmQaTable() : TH2D() {} @@ -76,7 +76,7 @@ public: /// Dumps table content into a stream friend std::ostream& operator<<(std::ostream& out, const CbmQaTable& aTable); -private: + private: // Forbid methods for direct access to the bins using TH2D::GetBinContent; using TH2D::GetBinError; @@ -85,18 +85,18 @@ private: // Structural fields - Int_t fNcols {0}; ///< number of columns in a table - Int_t fNrows {0}; ///< number of rows in a table + Int_t fNcols{0}; ///< number of columns in a table + Int_t fNrows{0}; ///< number of rows in a table - Int_t fColWidth {12}; ///< Width of column in number of symbols + Int_t fColWidth{12}; ///< Width of column in number of symbols // Some hard-coded constants - static constexpr Float_t kDefaultTextSize {0.03}; ///< default size of text - static constexpr Style_t kDefaultFontStyle {62}; ///< default text style + static constexpr Float_t kDefaultTextSize{0.03}; ///< default size of text + static constexpr Style_t kDefaultFontStyle{62}; ///< default text style - static constexpr Int_t kDefaultSetwPar {20}; ///< default size of entry in std::setw() for columns - static constexpr Int_t kRowTitlesSetwPar {30}; ///< size of entry in std::setw() for row titles - static constexpr Int_t kValuesPrecision {3}; ///< precision of output parameters + static constexpr Int_t kDefaultSetwPar{20}; ///< default size of entry in std::setw() for columns + static constexpr Int_t kRowTitlesSetwPar{30}; ///< size of entry in std::setw() for row titles + static constexpr Int_t kValuesPrecision{3}; ///< precision of output parameters // TODO: Apply this precision and other options to graphical verion of the table ClassDef(CbmQaTable, 1); diff --git a/core/qa/CbmQaTask.cxx b/core/qa/CbmQaTask.cxx index 6141bb5a446f35fb5ec817988b07cdcefe17eee9..a33bac96034011da163af86259b05a95269fbc09 100644 --- a/core/qa/CbmQaTask.cxx +++ b/core/qa/CbmQaTask.cxx @@ -13,7 +13,6 @@ #include "FairRootFileSink.h" #include "FairRootManager.h" #include "FairRunAna.h" - #include "TAxis.h" #include "TCanvas.h" #include "TF1.h" diff --git a/core/qa/CbmQaTask.h b/core/qa/CbmQaTask.h index 4c608051f4f8196e894a18f96a92c4b4271d6426..8e499e3e03070ea55479531f64d969645f1f8804 100644 --- a/core/qa/CbmQaTask.h +++ b/core/qa/CbmQaTask.h @@ -12,10 +12,8 @@ #include "CbmQaIO.h" #include "CbmQaTable.h" - #include "FairTask.h" #include "Logger.h" - #include "TCanvas.h" #include "TEfficiency.h" #include "TFolder.h" @@ -40,7 +38,7 @@ /// Class CbmQaTask is to be inherited with a particular QA-task. It provides mechanisms for storage and management /// of QA canvases and histograms management class CbmQaTask : public FairTask, public CbmQaIO { -public: + public: /// Constructor from parameters /// \param name Name of the task /// \param verbose Verbose level @@ -90,7 +88,7 @@ public: /// \return Map of checks: key - name of the check, value - result of the check virtual std::map<std::string, bool> Check() = 0; -protected: + protected: /// De-initialize the task virtual void DeInit() {} @@ -142,7 +140,7 @@ protected: /// @brief Puts setup title on the canvas void PutSetupNameOnPad(double xMin, double yMin, double xMax, double yMax); -private: + private: /// @brief De-initializes this task void DeInitBase(); @@ -150,7 +148,7 @@ private: std::string fsSetupName = ""; ///< Name of the setup (to draw on the canvases) - TParameter<int> fNofEvents {"nEvents", 0}; ///< Number of processed events + TParameter<int> fNofEvents{"nEvents", 0}; ///< Number of processed events }; diff --git a/core/qa/CbmQaUtil.cxx b/core/qa/CbmQaUtil.cxx index 4f02c68b361dfd819dfc5cb93595aba0aea1be06..e78e2e83719642b4254e23d36050f23a4f604d1c 100644 --- a/core/qa/CbmQaUtil.cxx +++ b/core/qa/CbmQaUtil.cxx @@ -11,7 +11,6 @@ #include "CbmQaUtil.h" #include "CbmQaCanvas.h" - #include "TAxis.h" #include "TCanvas.h" #include "TF1.h" @@ -33,15 +32,19 @@ namespace cbm::qa::util // TPaveStats* stats = (TPaveStats*) pHist->FindObject("stats"); - if (stats) { return stats; } + if (stats) { + return stats; + } TVirtualPad* padsav = gPad; auto styleSave = gStyle->GetOptStat(); CbmQaCanvas::GetDummyCanvas().cd(); //pHist->SetStats(false); // remove the old stat window - pHist->SetStats(true); // set the flag to create the stat window during Draw() - if (styleSave == 0) { gStyle->SetOptStat(1); } // set some stat option + pHist->SetStats(true); // set the flag to create the stat window during Draw() + if (styleSave == 0) { + gStyle->SetOptStat(1); + } // set some stat option // protection of a warning for automatic axis binning TAxis* x = pHist->GetXaxis(); @@ -50,9 +53,9 @@ namespace cbm::qa::util assert(x); assert(y); assert(z); - double rx[2] {x->GetXmin(), x->GetXmax()}; - double ry[2] {y->GetXmin(), y->GetXmax()}; - double rz[2] {z->GetXmin(), z->GetXmax()}; + double rx[2]{x->GetXmin(), x->GetXmax()}; + double ry[2]{y->GetXmin(), y->GetXmax()}; + double rz[2]{z->GetXmin(), z->GetXmax()}; x->SetLimits(0., 1.); y->SetLimits(0., 1.); @@ -66,7 +69,9 @@ namespace cbm::qa::util y->SetLimits(ry[0], ry[1]); z->SetLimits(rz[0], rz[1]); - if (styleSave == 0) { gStyle->SetOptStat(styleSave); } + if (styleSave == 0) { + gStyle->SetOptStat(styleSave); + } if (padsav) padsav->cd(); stats = (TPaveStats*) pHist->FindObject("stats"); @@ -126,7 +131,9 @@ namespace cbm::qa::util // fit in a quite mode - if (pHist->GetEntries() > 0) { pHist->Fit(&fit, "Q"); } + if (pHist->GetEntries() > 0) { + pHist->Fit(&fit, "Q"); + } TF1* f = pHist->GetFunction("FitKaniadakisGaussian"); if (nullptr != f) { diff --git a/core/qa/checker/CbmQaCheckerCore.cxx b/core/qa/checker/CbmQaCheckerCore.cxx index 17eff8f3a4b2adef80ae699fbcce3138e5fd075c..546d7bb68a42cfbc43c68ac093c683081711620f 100644 --- a/core/qa/checker/CbmQaCheckerCore.cxx +++ b/core/qa/checker/CbmQaCheckerCore.cxx @@ -10,9 +10,7 @@ #include "CbmQaCheckerCore.h" #include "CbmQaCheckerFileHandler.h" - #include "Logger.h" - #include "TClonesArray.h" #include "TFile.h" #include "TFolder.h" @@ -53,7 +51,9 @@ void Core::Process(Option_t* opt) fpObjDB->Init(); // ----- Register output file - if (fpOutFile == nullptr) { this->RegisterOutFile("QaCheckerOutput.root"); } + if (fpOutFile == nullptr) { + this->RegisterOutFile("QaCheckerOutput.root"); + } // ----- Process datasets and files int nDatasets = fpObjDB->GetNofDatasets(); diff --git a/core/qa/checker/CbmQaCheckerCore.h b/core/qa/checker/CbmQaCheckerCore.h index bb7c73981b96b3e3e0a217c568b5cef64e4b79d3..de0d419119ae034f71f49709568c5201a4f634ec 100644 --- a/core/qa/checker/CbmQaCheckerCore.h +++ b/core/qa/checker/CbmQaCheckerCore.h @@ -12,7 +12,6 @@ #include "CbmQaCheckerObjectDB.h" #include "CbmQaCheckerTypedefs.h" - #include "Rtypes.h" #include <memory> @@ -29,7 +28,7 @@ namespace cbm::qa::checker /// the comparison routine execution /// class Core { - public: + public: /// @brief Default ctor Core(); @@ -95,7 +94,7 @@ namespace cbm::qa::checker /// @param pathName Relative or absolute root path to input the input directories void SetInputRootPath(const char* pathName) { fpObjDB->SetInputRootPath(pathName); } - private: + private: std::shared_ptr<TFile> fpOutFile = nullptr; ///< Output file std::shared_ptr<ObjectDB> fpObjDB = nullptr; ///< Database of names diff --git a/core/qa/checker/CbmQaCheckerFileHandler.cxx b/core/qa/checker/CbmQaCheckerFileHandler.cxx index 1ef18e081f22636866fbf6f5dcc0a178a3af3d6e..592c91c100da2f883dde1d28b572eb84c29cb0a7 100644 --- a/core/qa/checker/CbmQaCheckerFileHandler.cxx +++ b/core/qa/checker/CbmQaCheckerFileHandler.cxx @@ -12,9 +12,7 @@ #include "CbmQaCheckerHist1DHandler.h" #include "CbmQaCheckerHist2DHandler.h" #include "CbmQaCheckerProfile1DHandler.h" - #include "Logger.h" - #include "TDirectoryFile.h" #include "TFile.h" #include "TFolder.h" @@ -110,7 +108,9 @@ void FileHandler::Process(Option_t* opt) skipObj = true; } } // iVer - if (skipObj) { continue; } + if (skipObj) { + continue; + } // Create an instance of an object handler std::unique_ptr<ObjectHandler> pObjHandler = nullptr; @@ -160,9 +160,13 @@ void FileHandler::Process(Option_t* opt) if (!bSuppressCanvases) { bool areDifferent = false; for (int iVer = 0; iVer < nVersions; ++iVer) { - if (fpObjDB->GetCmpResult(fDatasetID, fFileID, iObj, iVer)) { areDifferent = true; } + if (fpObjDB->GetCmpResult(fDatasetID, fFileID, iObj, iVer)) { + areDifferent = true; + } + } + if (areDifferent) { + pObjHandler->CreateCanvases(); } - if (areDifferent) { pObjHandler->CreateCanvases(); } } pObjHandler->Write(); @@ -184,6 +188,8 @@ TNamed* FileHandler::ReadObjectFromFile(TFile* pFile, const std::string& path) c int iPosSlash = path.find_last_of('/') + 1; std::string baseName = path.substr(iPosSlash, path.size()); std::string pathName = path.substr(0, iPosSlash); - if (pathName.size() > 0) { pFile->cd(pathName.c_str()); } + if (pathName.size() > 0) { + pFile->cd(pathName.c_str()); + } return dynamic_cast<TNamed*>(pFile->FindObjectAny(baseName.c_str())); } diff --git a/core/qa/checker/CbmQaCheckerFileHandler.h b/core/qa/checker/CbmQaCheckerFileHandler.h index 7f5e0ce862a371b2999131c11045f4903ddf40a5..aa3235202d2feb779c890455b32a163fa4216746 100644 --- a/core/qa/checker/CbmQaCheckerFileHandler.h +++ b/core/qa/checker/CbmQaCheckerFileHandler.h @@ -12,7 +12,6 @@ #include "CbmQaCheckerObjectDB.h" #include "CbmQaCheckerTypedefs.h" - #include "TClonesArray.h" #include <memory> @@ -27,7 +26,7 @@ namespace cbm::qa::checker /// @brief Handler for single files, created from different QA versions /// class FileHandler { - public: + public: /// @brief Constructor /// @param pObjDB Shared pointer to object database /// @param pOutDir Directory to store the output (/dataset/file) @@ -66,7 +65,7 @@ namespace cbm::qa::checker /// "U": enables interval comparison void Process(Option_t* opt = ""); - private: + private: /// @brief Creates nested directory from a given path /// @param path Path, parts of which are separated with slash /// @return Pointer to created TDirectory object diff --git a/core/qa/checker/CbmQaCheckerHist1DHandler.cxx b/core/qa/checker/CbmQaCheckerHist1DHandler.cxx index 16312a18088970ee1f7ac1351a498de599b00cb6..e27e32afb49132c1be929671f819d81d79bf9976 100644 --- a/core/qa/checker/CbmQaCheckerHist1DHandler.cxx +++ b/core/qa/checker/CbmQaCheckerHist1DHandler.cxx @@ -11,9 +11,7 @@ #include "CbmQaCanvas.h" #include "CbmQaCheckerTypedefs.h" - #include "Logger.h" - #include "TCanvas.h" #include "TError.h" #include "TFolder.h" @@ -46,10 +44,18 @@ CmpResult_t Hist1DHandler::Compare(const TNamed* pNum, const TNamed* pDenom) con std::bitset<sizeof(CmpResult_t) * 8> res; auto* pNumerator = static_cast<const TH1*>(pNum); auto* pDenominator = static_cast<const TH1*>(pDenom); - if (fOptionBits[EFlags::kPOINT] && ComparePointToPoint(pNumerator, pDenominator)) { res[EFlags::kPOINT] = true; } - if (fOptionBits[EFlags::kRATIO] && CompareRatioDeviation(pNumerator, pDenominator)) { res[EFlags::kRATIO] = true; } - if (fOptionBits[EFlags::kCHI2] && CompareWithChi2(pNumerator, pDenominator)) { res[EFlags::kCHI2] = true; } - if (fOptionBits[EFlags::kKOLM] && CompareWithKolmogorov(pNumerator, pDenominator)) { res[EFlags::kKOLM] = true; } + if (fOptionBits[EFlags::kPOINT] && ComparePointToPoint(pNumerator, pDenominator)) { + res[EFlags::kPOINT] = true; + } + if (fOptionBits[EFlags::kRATIO] && CompareRatioDeviation(pNumerator, pDenominator)) { + res[EFlags::kRATIO] = true; + } + if (fOptionBits[EFlags::kCHI2] && CompareWithChi2(pNumerator, pDenominator)) { + res[EFlags::kCHI2] = true; + } + if (fOptionBits[EFlags::kKOLM] && CompareWithKolmogorov(pNumerator, pDenominator)) { + res[EFlags::kKOLM] = true; + } return res.to_ulong(); } @@ -101,7 +107,9 @@ void Hist1DHandler::CreateCanvases() pPadRatio->cd(); auto* pMultiGraphRatio = new TMultiGraph((fsBaseName + "_ratio").data(), titleRatio); for (int iV = 0; iV < nVersions; ++iV) { - if (iV == iDef) { continue; } + if (iV == iDef) { + continue; + } auto* pRatio = static_cast<TH1*>(fvpObjects[iV]->Clone()); pRatio->SetDirectory(fpOutDir); auto currErrorLevel = gErrorIgnoreLevel; @@ -123,7 +131,9 @@ void Hist1DHandler::CreateCanvases() pPadDiff->cd(); auto* pMultiGraphDiff = new TMultiGraph((fsBaseName + "_diff").data(), titleDiff); for (int iV = 0; iV < nVersions; ++iV) { - if (iV == iDef) { continue; } + if (iV == iDef) { + continue; + } auto* pDiff = static_cast<TH1*>(fvpObjects[iV]->Clone()); pDiff->SetDirectory(fpOutDir); pDiff->Add(pDefault, -1.); @@ -158,19 +168,27 @@ bool Hist1DHandler::ComparePointToPoint(const TH1* pNumerator, const TH1* pDenom auto denBinContent = pDenominator->GetBinContent(iBinX, iBinY, iBinZ); // Check bin content if (!TMath::IsNaN(numBinContent) && !TMath::IsNaN(denBinContent)) { - if (numBinContent != denBinContent) { return true; } + if (numBinContent != denBinContent) { + return true; + } } else { - if (TMath::IsNaN(numBinContent) != TMath::IsNaN(denBinContent)) { return true; } + if (TMath::IsNaN(numBinContent) != TMath::IsNaN(denBinContent)) { + return true; + } } auto numBinError = pNumerator->GetBinError(iBinX, iBinY, iBinZ); auto denBinError = pDenominator->GetBinError(iBinX, iBinY, iBinZ); // Check bin error if (!TMath::IsNaN(numBinError) && !TMath::IsNaN(denBinError)) { - if (numBinError != denBinError) { return true; } + if (numBinError != denBinError) { + return true; + } } else { - if (TMath::IsNaN(numBinError) != TMath::IsNaN(denBinError)) { return true; } + if (TMath::IsNaN(numBinError) != TMath::IsNaN(denBinError)) { + return true; + } } } } diff --git a/core/qa/checker/CbmQaCheckerHist1DHandler.h b/core/qa/checker/CbmQaCheckerHist1DHandler.h index de0c828e5db1081257fc8c26dac6d86d2a5497e5..9193f6e9f9c76ca60319e83db86b157352403d98 100644 --- a/core/qa/checker/CbmQaCheckerHist1DHandler.h +++ b/core/qa/checker/CbmQaCheckerHist1DHandler.h @@ -27,7 +27,7 @@ namespace cbm::qa::checker /// statistical hypothesis tests (Chi2 test and Kolmogorov test). /// class Hist1DHandler : public ObjectHandler { - public: + public: /// Enumeration for bit-flags of different comparison methods enum EFlags { @@ -65,7 +65,7 @@ namespace cbm::qa::checker /// 3: Statistical test comparison with Kolmogorov test CmpResult_t Compare(const TNamed* pNum, const TNamed* pDenom) const; - private: + private: /// @brief Compares two histograms point-to-point /// @param pNumerator Pointer to the numerator object of comparison (usually new version) /// @param pDenominator Pointer to the denominator object for comparison (usually default) diff --git a/core/qa/checker/CbmQaCheckerHist2DHandler.h b/core/qa/checker/CbmQaCheckerHist2DHandler.h index fe3ce9b7a023e2c8d1aa2ac7fe87089c6da8c2ce..dbd6aaa73a5744492f05a8eecada63b756946ad1 100644 --- a/core/qa/checker/CbmQaCheckerHist2DHandler.h +++ b/core/qa/checker/CbmQaCheckerHist2DHandler.h @@ -17,7 +17,7 @@ namespace cbm::qa::checker /// @brief Specification of the handler for TProfile class /// class Hist2DHandler : public Hist1DHandler { - public: + public: /// @brief Constructor /// @param iObject Index of object /// @param iFile Index of file @@ -28,7 +28,7 @@ namespace cbm::qa::checker ~Hist2DHandler() = default; /// @brief Creates object comparison canvas - void CreateCanvases() {}; + void CreateCanvases(){}; }; } // namespace cbm::qa::checker diff --git a/core/qa/checker/CbmQaCheckerObjectDB.cxx b/core/qa/checker/CbmQaCheckerObjectDB.cxx index 582c06ab679ea66e3e592569573d6f20a38100a0..abf083a8c3b1c944f608ce175030ccf316dfd57a 100644 --- a/core/qa/checker/CbmQaCheckerObjectDB.cxx +++ b/core/qa/checker/CbmQaCheckerObjectDB.cxx @@ -106,7 +106,9 @@ void ObjectDB::Init() // ----- Add root path of input, if it were defined auto regexSlashes = std::regex("(/+)"); // regular expression for a sequence of consecutive slashes for (auto& path : fvVersionPaths) { - if (fsInputRootPath.size()) { path = fsInputRootPath + "/" + path; } + if (fsInputRootPath.size()) { + path = fsInputRootPath + "/" + path; + } path = std::regex_replace(path, regexSlashes, "/"); // replace all consecutive slashes with a single one } } diff --git a/core/qa/checker/CbmQaCheckerObjectDB.h b/core/qa/checker/CbmQaCheckerObjectDB.h index 23619482c76382a45cbea5d178c1c36c836ca165..7a0eccabc0fcd11ca72542774eca3bafeb7db721 100644 --- a/core/qa/checker/CbmQaCheckerObjectDB.h +++ b/core/qa/checker/CbmQaCheckerObjectDB.h @@ -23,7 +23,7 @@ namespace cbm::qa::checker /// /// The data base contains information on datasets, file-object pairs and versions, which are compared. class ObjectDB { - public: + public: /// @brief Default constructor ObjectDB() = default; @@ -68,7 +68,7 @@ namespace cbm::qa::checker /// @return Label of file const std::string& GetFileLabel(int iFile) const { return fvFileLabels[iFile]; } - private: + private: /// @brief Gets iterator range for object names stored in a file /// @note The iterator_range object behaves itself just like an ordinary STL container. /// @param iFile Index of file @@ -87,7 +87,7 @@ namespace cbm::qa::checker return boost::make_iterator_range(fvObjects.begin() + iBegin, fvObjects.begin() + iEnd); } - public: + public: /// @brief Gets comparison result /// @param iDS Index of dataset /// @param iFile Index of file @@ -173,7 +173,7 @@ namespace cbm::qa::checker /// @param pathName Relative or absolute root path to input the input directories void SetInputRootPath(const char* pathName) { fsInputRootPath = pathName; } - private: + private: int fDefVersionID = -1; ///< Index of default version std::string fsInputRootPath = ""; ///< Root path for input files diff --git a/core/qa/checker/CbmQaCheckerObjectHandler.cxx b/core/qa/checker/CbmQaCheckerObjectHandler.cxx index 336573ef2dccfcd8bf4929820e1c13ac356da03a..e7feabf6602548bf63eaff706e465d88c29d0007 100644 --- a/core/qa/checker/CbmQaCheckerObjectHandler.cxx +++ b/core/qa/checker/CbmQaCheckerObjectHandler.cxx @@ -10,9 +10,7 @@ #include "CbmQaCheckerObjectHandler.h" #include "CbmQaCanvas.h" - #include "Logger.h" - #include "TDirectory.h" #include "TNamed.h" @@ -53,7 +51,9 @@ void ObjectHandler::AddObjects(const std::vector<TNamed*>& vpObj) TDirectory* pCurrDir = gDirectory; gDirectory = fpOutDir; for (int iVer = 0; iVer < fpObjDB->GetNofVersions(); ++iVer) { - if (!fsBaseName.size()) { fsBaseName = vpObj[iVer]->GetName(); } + if (!fsBaseName.size()) { + fsBaseName = vpObj[iVer]->GetName(); + } else { LOG_IF(fatal, strcmp(fsBaseName.c_str(), vpObj[iVer]->GetName())) << "Hist1DHandler: attempt to add object of different name " << fsBaseName << " vs. " << vpObj[iVer]->GetName(); @@ -70,7 +70,9 @@ void ObjectHandler::CompareWithDefault() { int iDef = fpObjDB->GetDefaultID(); for (int iV = 0; iV < (int) fvpObjects.size(); ++iV) { - if (iV == iDef) { continue; } + if (iV == iDef) { + continue; + } auto res = this->Compare(fvpObjects[iV], fvpObjects[iDef]); fpObjDB->SetCmpResult(fDatasetID, fFileID, fObjectID, iV, res); } @@ -92,5 +94,7 @@ void ObjectHandler::Write() for (auto pObj : fvpObjects) { pObj->Write(); } - if (fpCanvas.get()) { fpCanvas->Write(); } + if (fpCanvas.get()) { + fpCanvas->Write(); + } } diff --git a/core/qa/checker/CbmQaCheckerObjectHandler.h b/core/qa/checker/CbmQaCheckerObjectHandler.h index 991ce354ff2e81c5f2f3283ced6ed5dc135484cd..7990060dea5a201d0f62ff9c0fc4bb019e87ff90 100644 --- a/core/qa/checker/CbmQaCheckerObjectHandler.h +++ b/core/qa/checker/CbmQaCheckerObjectHandler.h @@ -12,7 +12,6 @@ #include "CbmQaCheckerObjectDB.h" #include "CbmQaCheckerTypedefs.h" - #include "Rtypes.h" #include <memory> @@ -32,7 +31,7 @@ namespace cbm::qa::checker /// base. /// class ObjectHandler { - public: + public: /// @brief Default constructor /// @param iObject Index of object /// @param iFile Index of file @@ -48,7 +47,7 @@ namespace cbm::qa::checker void AddObjects(const std::vector<TNamed*>& vpObj); /// @brief Creates object comparison canvas - virtual void CreateCanvases() {}; + virtual void CreateCanvases(){}; /// @brief Compares two objects with different methods /// @param pNum Pointer to "numerator" object @@ -83,7 +82,7 @@ namespace cbm::qa::checker /// @brief Writes objects to file void Write(); - protected: + protected: int fObjectID = -1; ///< Index of object int fFileID = -1; ///< Index of file int fDatasetID = -1; ///< Index of dataset diff --git a/core/qa/checker/CbmQaCheckerProfile1DHandler.cxx b/core/qa/checker/CbmQaCheckerProfile1DHandler.cxx index db63fb788ef8714f9ff048cbd60dba7091e3983e..683c751229018966fd42ab9688214c3e51b0f92f 100644 --- a/core/qa/checker/CbmQaCheckerProfile1DHandler.cxx +++ b/core/qa/checker/CbmQaCheckerProfile1DHandler.cxx @@ -12,9 +12,7 @@ #include "CbmQaCanvas.h" #include "CbmQaCheckerHist1DHandler.h" #include "CbmQaCheckerTypedefs.h" - #include "Logger.h" - #include "TCanvas.h" #include "TError.h" #include "TFolder.h" @@ -84,7 +82,9 @@ void Profile1DHandler::CreateCanvases() pPadRatio->cd(); auto* pMultiGraphRatio = new TMultiGraph((fsBaseName + "_ratio").data(), titleRatio); for (int iV = 0; iV < nVersions; ++iV) { - if (iV == iDef) { continue; } + if (iV == iDef) { + continue; + } auto* pRatio = static_cast<TProfile*>(fvpObjects[iV])->ProjectionX(); auto currErrorLevel = gErrorIgnoreLevel; gErrorIgnoreLevel = kError; @@ -106,7 +106,9 @@ void Profile1DHandler::CreateCanvases() pPadDiff->cd(); auto* pMultiGraphDiff = new TMultiGraph((fsBaseName + "_diff").data(), titleDiff); for (int iV = 0; iV < nVersions; ++iV) { - if (iV == iDef) { continue; } + if (iV == iDef) { + continue; + } auto* pDiff = static_cast<TProfile*>(fvpObjects[iV])->ProjectionX(); pDiff->Add(pDefault, -1.); auto* pCopy = new TGraphAsymmErrors(pDiff); diff --git a/core/qa/checker/CbmQaCheckerProfile1DHandler.h b/core/qa/checker/CbmQaCheckerProfile1DHandler.h index c2ebbc509102003a96cb549c4acb08930b7eea64..7a2de22d8cbbeb4b8e6389ecf38fcd4c556cb6c8 100644 --- a/core/qa/checker/CbmQaCheckerProfile1DHandler.h +++ b/core/qa/checker/CbmQaCheckerProfile1DHandler.h @@ -17,7 +17,7 @@ namespace cbm::qa::checker /// @brief Specification of the handler for TProfile class /// class Profile1DHandler : public Hist1DHandler { - public: + public: /// @brief Constructor /// @param iObject Index of object /// @param iFile Index of file diff --git a/reco/KF/CbmKF.cxx b/reco/KF/CbmKF.cxx index d76b8d99ca2e773826c7d29562359a96fdbd5fb0..101bb865a9e0e42c8922ee58af8510e4954fd0c9 100644 --- a/reco/KF/CbmKF.cxx +++ b/reco/KF/CbmKF.cxx @@ -12,13 +12,11 @@ #include "CbmMvdTrackingInterface.h" #include "CbmStsTrackingInterface.h" #include "CbmTrackingDetectorInterfaceInit.h" - #include "FairBaseParSet.h" #include "FairField.h" #include "FairGeoNode.h" #include "FairRunAna.h" #include "FairRuntimeDb.h" - #include "TGeoManager.h" #include "TGeoMaterial.h" #include "TGeoMatrix.h" @@ -29,13 +27,12 @@ #include "TObjArray.h" #include "TString.h" +#include <cmath> #include <iostream> #include <list> #include <map> #include <vector> -#include <cmath> - using std::cout; using std::endl; using std::fabs; @@ -264,15 +261,17 @@ void CbmKF::GetTargetInfo() // The complete logic depends on the naming convention of the target. // If the node doesn't contain the string target the procedure will fail - CbmKFTube target {}; + CbmKFTube target{}; target.ID = -111; target.F = 1.; TString targetPath; - TGeoNode* targetNode {nullptr}; + TGeoNode* targetNode{nullptr}; FindTargetNode(targetPath, targetNode); - if (!targetNode) { LOG(fatal) << "Could not find the target."; } + if (!targetNode) { + LOG(fatal) << "Could not find the target."; + } Double_t local[3] = {0., 0., 0.}; // target centre, local c.s. Double_t global[3]; // target centre, global c.s. @@ -327,7 +326,9 @@ void CbmKF::FindTargetNode(TString& targetPath, TGeoNode*& targetNode) targetPath = "/" + TString(targetNode->GetName()); } - if (TString(targetNode->GetName()).Contains("target")) { return; } + if (TString(targetNode->GetName()).Contains("target")) { + return; + } for (Int_t iNode = 0; iNode < targetNode->GetNdaughters(); iNode++) { TGeoNode* newNode = targetNode->GetDaughter(iNode); @@ -346,7 +347,9 @@ void CbmKF::FindTargetNode(TString& targetPath, TGeoNode*& targetNode) Int_t CbmKF::GetMaterialIndex(Int_t uid) { map<Int_t, Int_t>::iterator i = fMaterialID2IndexMap.find(uid); - if (i != fMaterialID2IndexMap.end()) { return i->second; } + if (i != fMaterialID2IndexMap.end()) { + return i->second; + } return -1; } @@ -371,7 +374,9 @@ Int_t CbmKF::ReadTube(CbmKFTube& tube, FairGeoNode* node) tube.Fe = 0.02145; TString Mname = material->GetName(); - if (Mname == "MUCHWolfram") { tube.Fe = 0.009029; } + if (Mname == "MUCHWolfram") { + tube.Fe = 0.009029; + } else if (Mname == "MUCHiron") { tube.Fe = 0.02219; } @@ -586,12 +591,15 @@ Int_t CbmKF::Propagate(Double_t* T, Double_t* C, Double_t z_out, Double_t QP0) Double_t zz = z_out; if (z_out < 300. && 300 <= T[5]) CbmKFFieldMath::ExtrapolateLine(T, C, T, C, 300.); - if (T[5] < 300. && 300. < z_out) { zz = 300.; } + if (T[5] < 300. && 300. < z_out) { + zz = 300.; + } Bool_t repeat = 1; while (!err && repeat) { const Double_t max_step = 5.; Double_t zzz; - if (fabs(T[5] - zz) > max_step) zzz = T[5] + ((zz > T[5]) ? max_step : -max_step); + if (fabs(T[5] - zz) > max_step) + zzz = T[5] + ((zz > T[5]) ? max_step : -max_step); else { zzz = zz; repeat = 0; diff --git a/reco/KF/CbmKF.h b/reco/KF/CbmKF.h index b1bde574f7a22bdba844bd06ac546379a3b9068c..3afb35d4aedfd075140de908014196582c3d99b9 100644 --- a/reco/KF/CbmKF.h +++ b/reco/KF/CbmKF.h @@ -18,10 +18,8 @@ #define CBMKF_H #include "CbmKFMaterial.h" - #include "FairField.h" #include "FairTask.h" - #include "TGeoNode.h" #include <iostream> @@ -35,7 +33,7 @@ class TObjArray; class CbmKF : public FairTask { -public: + public: CbmKF(const char* name = "KF", Int_t iVerbose = 1); ~CbmKF(); @@ -93,7 +91,7 @@ public: const std::array<float, 3> GetTargetPosition(); -private: + private: static CbmKF* fInstance; FairField* fMagneticField; @@ -116,11 +114,11 @@ private: std::array<float, 3> fTargetXYZ; -private: + private: CbmKF(const CbmKF&); void operator=(const CbmKF&); -public: + public: ClassDef(CbmKF, 1); }; diff --git a/reco/KF/CbmKFFieldMath.cxx b/reco/KF/CbmKFFieldMath.cxx index bee9d3062872230a1ca5e1b378e3da4b0ca76024..81cf94c736025e0db3ade50b01447b20296b3212 100644 --- a/reco/KF/CbmKFFieldMath.cxx +++ b/reco/KF/CbmKFFieldMath.cxx @@ -5,7 +5,6 @@ #include "CbmKFFieldMath.h" #include "CbmKFMath.h" - #include "FairField.h" #include <cmath> @@ -122,7 +121,9 @@ Int_t CbmKFFieldMath::ExtrapolateRK4(const Double_t T_in[], // input track para for (step = 0; step < 4; ++step) { for (i = 0; i < 4; ++i) { - if (step == 0) { x[i] = x0[i]; } + if (step == 0) { + x[i] = x0[i]; + } else { x[i] = x0[i] + b[step] * k[step * 4 - 4 + i]; } @@ -130,7 +131,8 @@ Int_t CbmKFFieldMath::ExtrapolateRK4(const Double_t T_in[], // input track para Double_t point[3] = {x[0], x[1], z_in + a[step] * h}; Double_t B[3]; - if (MF) MF->GetFieldValue(point, B); + if (MF) + MF->GetFieldValue(point, B); else { B[0] = B[1] = B[2] = 0.; } @@ -182,7 +184,9 @@ Int_t CbmKFFieldMath::ExtrapolateRK4(const Double_t T_in[], // input track para for (step = 0; step < 4; ++step) { for (i = 0; i < 4; ++i) { - if (step == 0) { x[i] = x0[i]; } + if (step == 0) { + x[i] = x0[i]; + } else { x[i] = x0[i] + b[step] * k1[step * 4 - 4 + i]; } @@ -219,7 +223,9 @@ Int_t CbmKFFieldMath::ExtrapolateRK4(const Double_t T_in[], // input track para for (step = 0; step < 4; ++step) { for (i = 0; i < 4; ++i) { - if (step == 0) { x[i] = x0[i]; } + if (step == 0) { + x[i] = x0[i]; + } else if (i != 2) { x[i] = x0[i] + b[step] * k1[step * 4 - 4 + i]; } @@ -233,7 +239,9 @@ Int_t CbmKFFieldMath::ExtrapolateRK4(const Double_t T_in[], // input track para } // end of Runge-Kutta steps for derivatives dx/dtx for (i = 0; i < 4; ++i) { - if (i != 2) { J[10 + i] = x0[i] + c[0] * k1[i] + c[1] * k1[4 + i] + c[2] * k1[8 + i] + c[3] * k1[12 + i]; } + if (i != 2) { + J[10 + i] = x0[i] + c[0] * k1[i] + c[1] * k1[4 + i] + c[2] * k1[8 + i] + c[3] * k1[12 + i]; + } } // end of derivatives dx/dtx J[12] = 1.0; diff --git a/reco/KF/CbmKFFieldMath.h b/reco/KF/CbmKFFieldMath.h index a4851633c0c4ac148631e439817635fb42078a4c..6c6a85df55ba2d305c5643753bab9e4cf4d63d20 100644 --- a/reco/KF/CbmKFFieldMath.h +++ b/reco/KF/CbmKFFieldMath.h @@ -21,7 +21,7 @@ class FairField; class FairTrackParam; class CbmKFFieldMath : public TObject { -public: + public: CbmKFFieldMath() {} ~CbmKFFieldMath() {} diff --git a/reco/KF/CbmKFHit.h b/reco/KF/CbmKFHit.h index 8dadf16597df89194bd2e995e83592a454bd4941..7460c27577ffc4e7100fbbc61e93c19846681ea3 100644 --- a/reco/KF/CbmKFHit.h +++ b/reco/KF/CbmKFHit.h @@ -19,8 +19,8 @@ class CbmKFHit : public TObject { -public: - CbmKFHit() : MaterialIndex(0) {}; + public: + CbmKFHit() : MaterialIndex(0){}; virtual ~CbmKFHit() {} Int_t MaterialIndex; diff --git a/reco/KF/CbmKFMaterial.cxx b/reco/KF/CbmKFMaterial.cxx index 8328ca7d4cd63fc8a100d877cf3d06bd9ee16706..2ac3f91968ed400ffac90229e6d59e70631b183e 100644 --- a/reco/KF/CbmKFMaterial.cxx +++ b/reco/KF/CbmKFMaterial.cxx @@ -6,7 +6,6 @@ #include "CbmKF.h" #include "CbmKFMath.h" - #include "TString.h" #include <cmath> diff --git a/reco/KF/CbmKFMaterial.h b/reco/KF/CbmKFMaterial.h index ccce9ad046faff31f7ecf99520b352ea8b0b7530..8cb90d1ed0cb1f1b0aad18d1e8a6ddfbfcd726e4 100644 --- a/reco/KF/CbmKFMaterial.h +++ b/reco/KF/CbmKFMaterial.h @@ -19,9 +19,9 @@ class TString; class CbmKFMaterial : public TObject { -public: + public: CbmKFMaterial() : ID(-1), ZReference(-1), ZThickness(-1), RadLength(-1), F(1), Fe(0.02145) {} - virtual ~CbmKFMaterial() {}; + virtual ~CbmKFMaterial(){}; Int_t ID; Double_t ZReference; @@ -56,7 +56,7 @@ public: }; class CbmKFWall : public CbmKFMaterial { -public: + public: CbmKFWall() {} ~CbmKFWall() {} @@ -64,7 +64,7 @@ public: }; class CbmKFTube : public CbmKFMaterial { -public: + public: CbmKFTube() : x(0), y(0), z(0), dz(0), r(0), R(0), rr(0), RR(0) {} CbmKFTube(Int_t ID, Double_t x, Double_t y, Double_t z, Double_t dz, Double_t r, Double_t R, Double_t radL); ~CbmKFTube() {} @@ -85,7 +85,7 @@ public: }; class CbmKFBox : public CbmKFMaterial { -public: + public: CbmKFBox() : x(0), y(0), z(0), dx05(0), dy05(0), dz(0) {} CbmKFBox(Int_t ID, Double_t x, Double_t y, Double_t z, Double_t dx, Double_t dy, Double_t dz, Double_t radL); ~CbmKFBox() {} @@ -100,8 +100,8 @@ public: }; class CbmKFCone : public CbmKFMaterial { -public: - CbmKFCone() : z1(0), z2(0), r1(0), R1(0), r2(0), R2(0) {}; + public: + CbmKFCone() : z1(0), z2(0), r1(0), R1(0), r2(0), R2(0){}; ~CbmKFCone() {} Double_t z1, z2; diff --git a/reco/KF/CbmKFMath.cxx b/reco/KF/CbmKFMath.cxx index a9cb33cba7d7a9a8f88e465ed4f14338952d8b55..a331d174c67e2ae35347aaea0161bb2a3ddb6bfa 100644 --- a/reco/KF/CbmKFMath.cxx +++ b/reco/KF/CbmKFMath.cxx @@ -110,7 +110,8 @@ void CbmKFMath::four_dim_inv(Double_t a[4][4]) // Set b to I for (i = 0; i < 4; i++) for (j = 0; j < 4; j++) - if (i == j) b[i][j] = 1.0; + if (i == j) + b[i][j] = 1.0; else b[i][j] = 0.0; @@ -170,7 +171,8 @@ void CbmKFMath::five_dim_inv(Double_t a[5][5]) // Set b to I for (i = 0; i < 5; i++) { for (j = 0; j < 5; j++) { - if (i == j) b[i][j] = 1.0; + if (i == j) + b[i][j] = 1.0; else b[i][j] = 0.0; } @@ -750,7 +752,8 @@ Int_t CbmKFMath::GetNoise(Double_t Lrl, Double_t F, Double_t Fe, Double_t tx, Do Double_t m_energyLoss = Fe; // Double_t m_energyLoss = 0.02145;//0.060; Double_t corr = (1. - fabs(qp) * L * m_energyLoss); - if (corr > 0.001 * fabs(qp)) *Ecor *= 1. / corr; + if (corr > 0.001 * fabs(qp)) + *Ecor *= 1. / corr; else *Ecor = 1000. / fabs(qp); } diff --git a/reco/KF/CbmKFMath.h b/reco/KF/CbmKFMath.h index 54e0b0ab9454946f2e51a730a828d9e97411d4ff..e83167221fed511ded52d9e8b94f7d5ea038c9ef 100644 --- a/reco/KF/CbmKFMath.h +++ b/reco/KF/CbmKFMath.h @@ -21,7 +21,7 @@ class FairField; class FairTrackParam; class CbmKFMath : public TObject { -public: + public: CbmKFMath() {} ~CbmKFMath() {} diff --git a/reco/KF/CbmKFParticle.cxx b/reco/KF/CbmKFParticle.cxx index 7dbcd6afa93ea84d453e511bbdace109e34214a3..0cef3d0885e46e3f41e1ae4a9d204ca590ac2d6d 100644 --- a/reco/KF/CbmKFParticle.cxx +++ b/reco/KF/CbmKFParticle.cxx @@ -17,15 +17,13 @@ #include "CbmKFMath.h" #include "CbmKFTrack.h" #include "CbmStsKFTrackFitter.h" - #include "TMath.h" //#include "TDatabasePDG.h" #include "CbmKFParticleDatabase.h" -#include <vector> - #include <cmath> +#include <vector> using namespace std; @@ -1497,7 +1495,8 @@ Double_t CbmKFParticle::GetDStoPoint(const Double_t xyz[]) const if (pt2 < 1.e-4) return 0; - if (TMath::Abs(bq) < 1.e-8) dS = a / pt2; + if (TMath::Abs(bq) < 1.e-8) + dS = a / pt2; else dS = TMath::ATan2(bq * a, pt2 + bq1 * (dz * r[4] - dy * r[5]) - bq2 * (dz * r[3] - dx * r[5]) + bq3 * (dy * r[3] - dx * r[4])) diff --git a/reco/KF/CbmKFParticle.h b/reco/KF/CbmKFParticle.h index f76c4978994190e8b6a5a37c506ddbb6441599ad..a926f331bd6acea46f24144b935b7a36dbc2b497 100644 --- a/reco/KF/CbmKFParticle.h +++ b/reco/KF/CbmKFParticle.h @@ -21,7 +21,7 @@ class CbmKFParticle : public TObject { -public: + public: int Id() const { return fId; }; int NDaughters() const { return fDaughtersIds.size(); }; const std::vector<int>& DaughterIds() const { return fDaughtersIds; }; @@ -31,14 +31,14 @@ public: void AddDaughter(int id) { fDaughtersIds.push_back(id); } void CleanDaughtersId() { fDaughtersIds.clear(); } -private: + private: int fId; // id of particle std::vector<int> fDaughtersIds; // id of particles it created from. if size == 1 then this is id of track. TODO use in functions. why unsigned short int doesn't work??? int fPDG; // pdg hypothesis -public: + public: Double_t r[8], C[36]; Int_t NDF; Double_t Chi2, Q; @@ -46,10 +46,10 @@ public: float fieldRegion[10]; - CbmKFParticle() : fId(-1), fDaughtersIds(), fPDG(0), NDF(0), Chi2(0), Q(0), AtProductionVertex(0) {}; + CbmKFParticle() : fId(-1), fDaughtersIds(), fPDG(0), NDF(0), Chi2(0), Q(0), AtProductionVertex(0){}; CbmKFParticle(CbmKFTrackInterface* Track, Double_t* z0 = 0, Int_t* qHypo = 0, Int_t* pdg = 0); - ~CbmKFParticle() {}; + ~CbmKFParticle(){}; // Construction @@ -131,7 +131,7 @@ public: void SetPDG(int pdg) { fPDG = pdg; } int GetPDG() const { return fPDG; } -protected: + protected: Double_t& Cij(Int_t i, Int_t j) { return C[(j <= i) ? i * (i + 1) / 2 + j : j * (j + 1) / 2 + i]; } static Int_t IJ(Int_t i, Int_t j) { return (j <= i) ? i * (i + 1) / 2 + j : j * (j + 1) / 2 + i; } diff --git a/reco/KF/CbmKFParticleFinder.cxx b/reco/KF/CbmKFParticleFinder.cxx index 4343961162a72def9c7ae1ac3e8b8a06e2366773..ebc636349d7e32fb71bdc9c04d5f7944859f3116 100644 --- a/reco/KF/CbmKFParticleFinder.cxx +++ b/reco/KF/CbmKFParticleFinder.cxx @@ -17,25 +17,23 @@ #include "CbmMCDataManager.h" #include "CbmMCEventList.h" #include "CbmMCTrack.h" - #include "FairRunAna.h" //KF Particle headers -#include <Logger.h> - #include "KFPTrackVector.h" #include "KFParticleTopoReconstructor.h" +#include <Logger.h> + //ROOT headers #include "TClonesArray.h" //to get arrays from the FairRootManager #include "TMath.h" //to calculate Prob function #include "TStopwatch.h" //to measure the time //c++ and std headers +#include <cmath> #include <iostream> #include <vector> - -#include <cmath> using std::vector; CbmKFParticleFinder::CbmKFParticleFinder(const char* name, Int_t iVerbose) @@ -129,7 +127,7 @@ InitStatus CbmKFParticleFinder::Init() fCbmPrimVertex = (CbmVertex*) ioman->GetObject("PrimaryVertex."); auto& target = CbmKF::Instance()->vTargets[0]; - const std::array<float, 3> targetXYZ {(float) target.x, (float) target.y, (float) target.z}; + const std::array<float, 3> targetXYZ{(float) target.x, (float) target.y, (float) target.z}; fTopoReconstructor->SetTarget(targetXYZ); return kSUCCESS; @@ -155,7 +153,8 @@ void CbmKFParticleFinder::Exec(Option_t* /*opt*/) fTopoReconstructor->GetKFParticleFinder()->GetReconstructionList()); int nTracksEvent = 0; - if (fTimeSliceMode) nTracksEvent = event->GetNofStsTracks(); + if (fTimeSliceMode) + nTracksEvent = event->GetNofStsTracks(); else nTracksEvent = fTrackArray->GetEntriesFast(); @@ -181,7 +180,8 @@ void CbmKFParticleFinder::Exec(Option_t* /*opt*/) for (int iTr = 0; iTr < nTracksEvent; iTr++) { int stsTrackIndex = 0; - if (fTimeSliceMode) stsTrackIndex = event->GetStsTrackIndex(iTr); + if (fTimeSliceMode) + stsTrackIndex = event->GetStsTrackIndex(iTr); else stsTrackIndex = iTr; @@ -250,13 +250,15 @@ void CbmKFParticleFinder::Exec(Option_t* /*opt*/) bool isMCPVFound = false; for (int iMCEvent = 0; iMCEvent < nMCEvents; iMCEvent++) { int nMCTracks = 0; - if (fTimeSliceMode) nMCTracks = fMCTrackArray->Size(0, iMCEvent); + if (fTimeSliceMode) + nMCTracks = fMCTrackArray->Size(0, iMCEvent); else nMCTracks = fMCTrackArrayEvent->GetEntriesFast(); for (Int_t iMC = 0; iMC < nMCTracks; iMC++) { CbmMCTrack* cbmMCTrack; - if (fTimeSliceMode) cbmMCTrack = (CbmMCTrack*) fMCTrackArray->Get(0, iMCEvent, iMC); + if (fTimeSliceMode) + cbmMCTrack = (CbmMCTrack*) fMCTrackArray->Get(0, iMCEvent, iMC); else cbmMCTrack = (CbmMCTrack*) fMCTrackArrayEvent->At(iMC); @@ -443,7 +445,8 @@ void CbmKFParticleFinder::FillKFPTrackVector(KFPTrackVector* tracks, const vecto //fill vector with tracks for (Int_t iTr = 0; iTr < ntracks; iTr++) { const FairTrackParam* parameters; - if (atFirstPoint) parameters = vRTracks[iTr].GetParamFirst(); + if (atFirstPoint) + parameters = vRTracks[iTr].GetParamFirst(); else parameters = vRTracks[iTr].GetParamLast(); @@ -518,7 +521,8 @@ void CbmKFParticleFinder::FillKFPTrackVector(KFPTrackVector* tracks, const vecto tracks->SetNPixelHits(vRTracks[iTr].GetNofMvdHits(), iTr); if (fPVFindMode == 0 || fPVFindMode == 3) { - if (vChiToPrimVtx[iTr] < 3) tracks->SetPVIndex(0, iTr); + if (vChiToPrimVtx[iTr] < 3) + tracks->SetPVIndex(0, iTr); else tracks->SetPVIndex(-1, iTr); } diff --git a/reco/KF/CbmKFParticleFinder.h b/reco/KF/CbmKFParticleFinder.h index 7cb22c0fe50ec61e1a471366d3ff1e6130b3c569..8b81f20f6efd61fd7b211b60e90dadc83936f92d 100644 --- a/reco/KF/CbmKFParticleFinder.h +++ b/reco/KF/CbmKFParticleFinder.h @@ -9,9 +9,7 @@ #define CbmKFParticleFinder_HH #include "CbmStsTrack.h" - #include "FairTask.h" - #include "TString.h" #include <vector> @@ -30,7 +28,7 @@ struct KFFieldVector { }; class CbmKFParticleFinder : public FairTask { -public: + public: // Constructors/Destructors --------- CbmKFParticleFinder(const char* name = "CbmKFParticleFinder", Int_t iVerbose = 0); ~CbmKFParticleFinder(); @@ -85,7 +83,7 @@ public: //Add decay to the reconstruction list. By default, if list is empty - all decays are reconstructed. void AddDecayToReconstructionList(int pdg); -private: + private: double InversedChi2Prob(double p, int ndf) const; void FillKFPTrackVector(KFPTrackVector* tracks, const std::vector<CbmStsTrack>& vRTracks, const std::vector<KFFieldVector>& vField, const std::vector<int>& pdg, diff --git a/reco/KF/CbmKFParticleFinderPID.cxx b/reco/KF/CbmKFParticleFinderPID.cxx index 4bab8f7c2effd729668a464fba7d567a9ef0c865..5a8a731ccdc3a51cb7fcaf167224d7f0bd37a090 100644 --- a/reco/KF/CbmKFParticleFinderPID.cxx +++ b/reco/KF/CbmKFParticleFinderPID.cxx @@ -23,7 +23,6 @@ #include "CbmTrackMatchNew.h" #include "CbmTrdHit.h" #include "CbmTrdTrack.h" - #include "FairRunAna.h" //ROOT headers @@ -40,7 +39,8 @@ double vecMedian(const vector<double>& vec) vector<double> vecCopy = vec; sort(vecCopy.begin(), vecCopy.end()); int size = vecCopy.size(); - if (size % 2 == 0) median = (vecCopy[size / 2 - 1] + vecCopy[size / 2]) / 2; + if (size % 2 == 0) + median = (vecCopy[size / 2 - 1] + vecCopy[size / 2]) / 2; else median = vecCopy[size / 2]; return median; @@ -212,7 +212,9 @@ InitStatus CbmKFParticleFinderPID::Init() } fTrdHitArray = (TClonesArray*) ioman->GetObject(fTrdHitBranchName); - if (fTrdHitArray == nullptr) { Error("CbmKFParticleFinderPID::Init", "TRD hit array not found!"); } + if (fTrdHitArray == nullptr) { + Error("CbmKFParticleFinderPID::Init", "TRD hit array not found!"); + } if (fRichPIDMode > 0) { fRichRingArray = (TClonesArray*) ioman->GetObject(fRichBranchName); @@ -289,7 +291,9 @@ void CbmKFParticleFinderPID::SetMCPID() CbmMCTrack* cbmMCTrack = nullptr; - if (!fLegacyEventMode) { cbmMCTrack = dynamic_cast<CbmMCTrack*>(fMCTracks->Get(iFile, iEvent, mcTrackId)); } + if (!fLegacyEventMode) { + cbmMCTrack = dynamic_cast<CbmMCTrack*>(fMCTracks->Get(iFile, iEvent, mcTrackId)); + } else { cbmMCTrack = (CbmMCTrack*) fMCTrackArray->At(mcTrackId); } diff --git a/reco/KF/CbmKFParticleFinderPID.h b/reco/KF/CbmKFParticleFinderPID.h index 7e2698f9c8ddc067cd401eeba54b307af38ad34d..22a49122da394c396d3c27f6c13e7dded299c5ee 100644 --- a/reco/KF/CbmKFParticleFinderPID.h +++ b/reco/KF/CbmKFParticleFinderPID.h @@ -9,9 +9,7 @@ #define CbmKFParticleFinderPID_HH #include "CbmMCDataArray.h" - #include "FairTask.h" - #include "TString.h" #include <vector> @@ -22,13 +20,13 @@ class TObject; class CbmDigiManager; class CbmKFParticleFinderPID : public FairTask { -public: + public: struct Cuts { - Double_t fTrackLengthMin {0.}; - Double_t fTrackLengthMax {1.e10}; - Double_t fTrackTofTimeMin {0.}; - Double_t fTrackTofTimeMax {1.e10}; - Double_t fSP[7][5] {{0}}; // ? + Double_t fTrackLengthMin{0.}; + Double_t fTrackLengthMax{1.e10}; + Double_t fTrackTofTimeMin{0.}; + Double_t fTrackTofTimeMax{1.e10}; + Double_t fSP[7][5]{{0}}; // ? }; // Constructors/Destructors --------- @@ -79,7 +77,7 @@ public: const std::vector<int>& GetPID() const { return fPID; } -private: + private: const CbmKFParticleFinderPID& operator=(const CbmKFParticleFinderPID&); CbmKFParticleFinderPID(const CbmKFParticleFinderPID&); @@ -101,9 +99,9 @@ private: TString fMuchTrackBranchName; //input branches - TClonesArray* fRecoEvents {nullptr}; //! Array of CbmEvent objects - TClonesArray* fTrackArray; //input reco tracks - TClonesArray* fGlobalTrackArray; //input reco tracks + TClonesArray* fRecoEvents{nullptr}; //! Array of CbmEvent objects + TClonesArray* fTrackArray; //input reco tracks + TClonesArray* fGlobalTrackArray; //input reco tracks TClonesArray* fStsHitArray; TClonesArray* fStsClusterArray; CbmDigiManager* fDigiManager; //! Interface to digi branch diff --git a/reco/KF/CbmKFParticleFinderQa.cxx b/reco/KF/CbmKFParticleFinderQa.cxx index e09d7dd2f70457bb0ec7017d4bf820892e637029..ee5dbd5f82ff588839d8048bf9e1cbcd6ec778a9 100644 --- a/reco/KF/CbmKFParticleFinderQa.cxx +++ b/reco/KF/CbmKFParticleFinderQa.cxx @@ -14,7 +14,6 @@ #include "CbmMCTrack.h" #include "CbmTrack.h" #include "CbmTrackMatchNew.h" - #include "FairRunAna.h" //KF Particle headers @@ -35,11 +34,10 @@ #include "TSystem.h" //c++ and std headers +#include <cmath> #include <iomanip> #include <iostream> #include <vector> - -#include <cmath> using std::vector; CbmKFParticleFinderQa::CbmKFParticleFinderQa(const char* name, Int_t iVerbose, const KFParticleTopoReconstructor* tr, @@ -56,7 +54,8 @@ CbmKFParticleFinderQa::CbmKFParticleFinderQa(const char* name, Int_t iVerbose, c TFile* curFile = gFile; TDirectory* curDirectory = gDirectory; - if (!(fOutFileName == "")) fOutFile = new TFile(fOutFileName.Data(), "RECREATE"); + if (!(fOutFileName == "")) + fOutFile = new TFile(fOutFileName.Data(), "RECREATE"); else { fOutFile = gFile; } @@ -89,7 +88,9 @@ InitStatus CbmKFParticleFinderQa::Init() // check the mode fLegacyEventMode = 0; - if (!ioman->CheckBranch("CbmEvent") && ioman->CheckBranch("MCTrack")) { fLegacyEventMode = 1; } + if (!ioman->CheckBranch("CbmEvent") && ioman->CheckBranch("MCTrack")) { + fLegacyEventMode = 1; + } // MC Tracks if (!fLegacyEventMode) { @@ -111,7 +112,9 @@ InitStatus CbmKFParticleFinderQa::Init() } fRecoEvents = dynamic_cast<TClonesArray*>(ioman->GetObject("CbmEvent")); - if (nullptr == fRecoEvents) { LOG(warn) << GetName() << ": No event array! Will process entire tree."; } + if (nullptr == fRecoEvents) { + LOG(warn) << GetName() << ": No event array! Will process entire tree."; + } } else { fMCTrackArrayEvent = (TClonesArray*) ioman->GetObject("MCTrack"); @@ -162,7 +165,9 @@ void CbmKFParticleFinderQa::Exec(Option_t* /*opt*/) int nMCEvents = 1; if (!fLegacyEventMode) { - if (fRecoEvents) { nRecoEvents = fRecoEvents->GetEntriesFast(); } + if (fRecoEvents) { + nRecoEvents = fRecoEvents->GetEntriesFast(); + } nMCEvents = fMcEventList->GetNofEvents(); } @@ -192,7 +197,9 @@ void CbmKFParticleFinderQa::Exec(Option_t* /*opt*/) CbmMCTrack* cbmMCTrack; CbmLink mcTrackLink = mcEventLink; mcTrackLink.SetIndex(iMC); - if (!fLegacyEventMode) { cbmMCTrack = (CbmMCTrack*) fMCTrackArray->Get(mcTrackLink); } + if (!fLegacyEventMode) { + cbmMCTrack = (CbmMCTrack*) fMCTrackArray->Get(mcTrackLink); + } else { cbmMCTrack = (CbmMCTrack*) fMCTrackArrayEvent->At(iMC); } @@ -229,14 +236,17 @@ void CbmKFParticleFinderQa::Exec(Option_t* /*opt*/) q = 0; Double_t p = cbmMCTrack->GetP(); - if (cbmMCTrack->GetMotherId() >= 0) kfMCTrack.SetMotherId(cbmMCTrack->GetMotherId() + mcIndexOffset); + if (cbmMCTrack->GetMotherId() >= 0) + kfMCTrack.SetMotherId(cbmMCTrack->GetMotherId() + mcIndexOffset); else kfMCTrack.SetMotherId(-iMCEvent - 1); kfMCTrack.SetQP(q / p); kfMCTrack.SetPDG(pdg); kfMCTrack.SetNMCPoints(0); - if (!fLegacyEventMode) { mcToKFmcMap[iMCEvent][iMC] = mcTracks.size(); } + if (!fLegacyEventMode) { + mcToKFmcMap[iMCEvent][iMC] = mcTracks.size(); + } mcTracks.push_back(kfMCTrack); } @@ -264,7 +274,9 @@ void CbmKFParticleFinderQa::Exec(Option_t* /*opt*/) link = stsTrackMatch->GetLink(iLink); if (!fLegacyEventMode) { int eventIndex = fMcEventList->GetEventIndex(link); - if (eventIndex >= 0) { mcTrackId = mcToKFmcMap[eventIndex][iMCTrack]; } + if (eventIndex >= 0) { + mcTrackId = mcToKFmcMap[eventIndex][iMCTrack]; + } } else { mcTrackId = stsTrackMatch->GetLink(iLink).GetIndex(); @@ -382,7 +394,8 @@ void CbmKFParticleFinderQa::Finish() WriteHistosCurFile(fTopoPerformance->GetHistosDirectory()); if (fCheckDecayQA && fDecayToAnalyse > -1) { - if (fDecayToAnalyse < 0) Error("CbmKFParticleFinderQa::Finish", "Please specify the decay to be analysed."); + if (fDecayToAnalyse < 0) + Error("CbmKFParticleFinderQa::Finish", "Please specify the decay to be analysed."); else CheckDecayQA(); } @@ -401,7 +414,8 @@ void CbmKFParticleFinderQa::Finish() void CbmKFParticleFinderQa::WriteHistosCurFile(TObject* obj) { - if (!obj->IsFolder()) obj->Write(); + if (!obj->IsFolder()) + obj->Write(); else { TDirectory* cur = gDirectory; TFile* currentFile = gFile; diff --git a/reco/KF/CbmKFParticleFinderQa.h b/reco/KF/CbmKFParticleFinderQa.h index cd95997356f74af21dce99860dbc7cd0b853ceaa..be4262c99548800e97da28726d7f371f5d826ae2 100644 --- a/reco/KF/CbmKFParticleFinderQa.h +++ b/reco/KF/CbmKFParticleFinderQa.h @@ -9,7 +9,6 @@ #define CbmKFParticleFinderQa_HH #include "FairTask.h" - #include "TString.h" #include <vector> @@ -23,7 +22,7 @@ class TFile; class TObject; class CbmKFParticleFinderQa : public FairTask { -public: + public: // Constructors/Destructors --------- CbmKFParticleFinderQa(const char* name = "CbmKFParticleFinderQa", Int_t iVerbose = 0, const KFParticleTopoReconstructor* tr = nullptr, @@ -50,7 +49,7 @@ public: void SetDecayToAnalyse(int iDecay) { fDecayToAnalyse = iDecay; } bool IsTestPassed() { return fTestOk; } -private: + private: const CbmKFParticleFinderQa& operator=(const CbmKFParticleFinderQa&); CbmKFParticleFinderQa(const CbmKFParticleFinderQa&); @@ -59,42 +58,42 @@ private: void CheckDecayQA(); //input branches - TClonesArray* fRecoEvents {nullptr}; //! Array of CbmEvent objects - CbmMCDataArray* fMCTrackArray {nullptr}; //mc tracks - TClonesArray* fMCTrackArrayEvent {nullptr}; - CbmMCEventList* fMcEventList {nullptr}; //mc event list in timeslice - TClonesArray* fTrackMatchArray {nullptr}; //track match + TClonesArray* fRecoEvents{nullptr}; //! Array of CbmEvent objects + CbmMCDataArray* fMCTrackArray{nullptr}; //mc tracks + TClonesArray* fMCTrackArrayEvent{nullptr}; + CbmMCEventList* fMcEventList{nullptr}; //mc event list in timeslice + TClonesArray* fTrackMatchArray{nullptr}; //track match // output arrays of particles - TClonesArray* fRecParticles {nullptr}; // output array of KF Particles - TClonesArray* fMCParticles {nullptr}; // output array of MC Particles - TClonesArray* fMatchParticles {nullptr}; // output array of match objects + TClonesArray* fRecParticles{nullptr}; // output array of KF Particles + TClonesArray* fMCParticles{nullptr}; // output array of MC Particles + TClonesArray* fMatchParticles{nullptr}; // output array of match objects - Bool_t fSaveParticles {false}; - Bool_t fSaveMCParticles {false}; + Bool_t fSaveParticles{false}; + Bool_t fSaveMCParticles{false}; - bool fLegacyEventMode {false}; // event-by-event mode where data is stored in an old-fasion way + bool fLegacyEventMode{false}; // event-by-event mode where data is stored in an old-fasion way //output file with histograms - TString fOutFileName {"CbmKFParticleFinderQa.root"}; - TFile* fOutFile {nullptr}; - TString fEfffileName {"Efficiency.txt"}; + TString fOutFileName{"CbmKFParticleFinderQa.root"}; + TFile* fOutFile{nullptr}; + TString fEfffileName{"Efficiency.txt"}; //KF Particle QA - KFTopoPerformance* fTopoPerformance {nullptr}; + KFTopoPerformance* fTopoPerformance{nullptr}; - Int_t fPrintFrequency {100}; - Int_t fNEvents {0}; + Int_t fPrintFrequency{100}; + Int_t fNEvents{0}; Double_t fTime[5]; //for super event analysis - bool fSuperEventAnalysis {false}; + bool fSuperEventAnalysis{false}; //for tests - TString fReferenceResults {"./"}; - int fDecayToAnalyse {-1}; - bool fCheckDecayQA {false}; - bool fTestOk {false}; + TString fReferenceResults{"./"}; + int fDecayToAnalyse{-1}; + bool fCheckDecayQA{false}; + bool fTestOk{false}; ClassDef(CbmKFParticleFinderQa, 1); }; diff --git a/reco/KF/CbmKFParticleInterface.cxx b/reco/KF/CbmKFParticleInterface.cxx index a7fcce39ca2c5ed34356d925a195fa2eeac86074..850a0e9bd56847cf5a7695112926450cfb83ab69 100644 --- a/reco/KF/CbmKFParticleInterface.cxx +++ b/reco/KF/CbmKFParticleInterface.cxx @@ -23,10 +23,9 @@ #include "TStopwatch.h" //to measure the time //c++ and std headers +#include <cmath> #include <iostream> #include <vector> - -#include <cmath> using std::vector; @@ -49,7 +48,8 @@ void CbmKFParticleInterface::SetKFParticleFromStsTrack(CbmStsTrack* track, KFPar for (Int_t iTr = 0; iTr < 1; iTr++) { const FairTrackParam* parameters; - if (firstPoint) parameters = vRTracks[iTr].GetParamFirst(); + if (firstPoint) + parameters = vRTracks[iTr].GetParamFirst(); else parameters = vRTracks[iTr].GetParamLast(); diff --git a/reco/KF/CbmKFParticleInterface.h b/reco/KF/CbmKFParticleInterface.h index 14b5ed7321f83ae47df9b793cb53946d5cf938c2..8b527fc1afd4ff9443626fff4951e74644b808c6 100644 --- a/reco/KF/CbmKFParticleInterface.h +++ b/reco/KF/CbmKFParticleInterface.h @@ -16,16 +16,16 @@ class FairTrackParam; class CbmVertex; class CbmKFParticleInterface : public TObject { -public: + public: // Constructors/Destructors --------- - CbmKFParticleInterface() {}; - ~CbmKFParticleInterface() {}; + CbmKFParticleInterface(){}; + ~CbmKFParticleInterface(){}; static void SetKFParticleFromStsTrack(CbmStsTrack* track, KFParticle* particle, Int_t pdg = 211, Bool_t firstPoint = kTRUE); static void ExtrapolateTrackToPV(const CbmStsTrack* track, CbmVertex* pv, FairTrackParam* paramAtPV, float& chiPrim); -private: + private: const CbmKFParticleInterface& operator=(const CbmKFParticleInterface&); CbmKFParticleInterface(const CbmKFParticleInterface&); diff --git a/reco/KF/CbmKFPixelMeasurement.h b/reco/KF/CbmKFPixelMeasurement.h index a779ea5fd84f319561e0c88c723c13eec72f5d6e..a76d0e9485729e747b07854f013409158ec5ddcc 100644 --- a/reco/KF/CbmKFPixelMeasurement.h +++ b/reco/KF/CbmKFPixelMeasurement.h @@ -20,7 +20,7 @@ #include <vector> class CbmKFPixelMeasurement : public TObject { -public: + public: CbmKFPixelMeasurement() : z(0), x(0), y(0) {} ~CbmKFPixelMeasurement() {} diff --git a/reco/KF/CbmKFPrimaryVertexFinder.h b/reco/KF/CbmKFPrimaryVertexFinder.h index 6b615e18b324e20db83a4991ed617c4fdc54fba8..969c61d4c6e659c8bd17fbfc0973fe45533c6514 100644 --- a/reco/KF/CbmKFPrimaryVertexFinder.h +++ b/reco/KF/CbmKFPrimaryVertexFinder.h @@ -23,9 +23,9 @@ class CbmKFPrimaryVertexFinder : public TObject { std::vector<CbmKFTrackInterface*> Tracks; -public: + public: CbmKFPrimaryVertexFinder() : Tracks() { Clear(); }; - ~CbmKFPrimaryVertexFinder() {}; + ~CbmKFPrimaryVertexFinder(){}; virtual void Clear(Option_t* opt = ""); void AddTrack(CbmKFTrackInterface* Track); diff --git a/reco/KF/CbmKFSecondaryVertexFinder.cxx b/reco/KF/CbmKFSecondaryVertexFinder.cxx index ec26432d9c04a70dbcc72efec364451388e8f505..bcccb2ca0a23183f192ed02f21c91a5845653b04 100644 --- a/reco/KF/CbmKFSecondaryVertexFinder.cxx +++ b/reco/KF/CbmKFSecondaryVertexFinder.cxx @@ -52,7 +52,9 @@ void CbmKFSecondaryVertexFinder::Fit() r[2] = VGuess->GetRefZ(); } else { - if (CbmKF::Instance()->vTargets.empty()) { r[0] = r[1] = r[2] = 0.; } + if (CbmKF::Instance()->vTargets.empty()) { + r[0] = r[1] = r[2] = 0.; + } else { CbmKFTube& t = CbmKF::Instance()->vTargets[0]; r[0] = r[1] = 0.; diff --git a/reco/KF/CbmKFSecondaryVertexFinder.h b/reco/KF/CbmKFSecondaryVertexFinder.h index e1c976b32954231ef4667d97b7764d9e27951b1e..20a3aa495fa11822bf7145f4c8c3ab7dfca7afe7 100644 --- a/reco/KF/CbmKFSecondaryVertexFinder.h +++ b/reco/KF/CbmKFSecondaryVertexFinder.h @@ -31,12 +31,12 @@ class CbmKFSecondaryVertexFinder : public TObject { void AddTopoConstraint(); Double_t& Cij(Int_t i, Int_t j) { return C[(j <= i) ? i * (i + 1) / 2 + j : j * (j + 1) / 2 + i]; } -public: + public: CbmKFSecondaryVertexFinder() : vTracks(), NDF(0), Chi2(0), MassConstraint(0), VParent(nullptr), VGuess(nullptr) { Clear(); }; - ~CbmKFSecondaryVertexFinder() {}; + ~CbmKFSecondaryVertexFinder(){}; virtual void Clear(Option_t* opt = ""); void ClearTracks(); @@ -54,7 +54,7 @@ public: ClassDef(CbmKFSecondaryVertexFinder, 1); -private: + private: CbmKFSecondaryVertexFinder(const CbmKFSecondaryVertexFinder&); void operator=(const CbmKFSecondaryVertexFinder&); }; diff --git a/reco/KF/CbmKFTrackInterface.cxx b/reco/KF/CbmKFTrackInterface.cxx index 24cd7d66fa141860d807ecfd758c67b874fc3fdf..6f8da98fbaa987867a6b7defad0071dc68fb1497 100644 --- a/reco/KF/CbmKFTrackInterface.cxx +++ b/reco/KF/CbmKFTrackInterface.cxx @@ -62,7 +62,8 @@ Int_t CbmKFTrackInterface::Extrapolate(Double_t z_out, Double_t* QP0) ibeg = lower_bound(KF->vMaterial.begin(), KF->vMaterial.end(), z, CbmKFMaterial::compareP_z); iend = upper_bound(KF->vMaterial.begin(), KF->vMaterial.end(), Z, CbmKFMaterial::compareP_Z); if (iend != KF->vMaterial.end() && (*iend)->ZReference - (*iend)->ZThickness / 2 < Z) iend++; - if (downstream_direction) {} + if (downstream_direction) { + } else { i = ibeg; ibeg = iend; diff --git a/reco/KF/CbmKFTrackInterface.h b/reco/KF/CbmKFTrackInterface.h index c7e28cadb2dd2edee0e2d8d88b85b4e834068810..34ff66304061ef8d8771bd2c8b956369e9c9aa81 100644 --- a/reco/KF/CbmKFTrackInterface.h +++ b/reco/KF/CbmKFTrackInterface.h @@ -28,7 +28,7 @@ class CbmKFVertexInterface; class CbmKFTrackInterface { -public: + public: CbmKFTrackInterface() : fId() {} virtual ~CbmKFTrackInterface() {} @@ -53,7 +53,7 @@ public: /** Accessors to the track hits during track fit */ - virtual Int_t GetNOfHits() { return 0; } /// Number of hits + virtual Int_t GetNOfHits() { return 0; } /// Number of hits virtual CbmKFHit* GetHit(Int_t) { return nullptr; } /// Access to i-th hit /** Methods @@ -69,7 +69,7 @@ public: int Id() const { return fId; }; void SetId(int id) { fId = id; }; -protected: + protected: int fId; ClassDef(CbmKFTrackInterface, 1) diff --git a/reco/KF/CbmKFUMeasurement.h b/reco/KF/CbmKFUMeasurement.h index bfe1c91ac9b4d583fa0580996b4238b1b33eecc8..57fe56c244f5c092236611741e6d2d8f3b8db116 100644 --- a/reco/KF/CbmKFUMeasurement.h +++ b/reco/KF/CbmKFUMeasurement.h @@ -18,7 +18,7 @@ #include "CbmKFTrackInterface.h" class CbmKFUMeasurement : public TObject { -public: + public: CbmKFUMeasurement() : z(), u(), sigma2(), phi(), phi_s(), phi_c(), phi_ss(), phi_cc(), phi_2sc() {} ~CbmKFUMeasurement() {} diff --git a/reco/KF/CbmKFVertexInterface.cxx b/reco/KF/CbmKFVertexInterface.cxx index f62ad26526e56722e9d50fd16e6b7736090f8c83..28dc02835f1e6c8e54954ddc2880aecfc7f2c0f6 100644 --- a/reco/KF/CbmKFVertexInterface.cxx +++ b/reco/KF/CbmKFVertexInterface.cxx @@ -20,7 +20,6 @@ #include "CbmKFVertexInterface.h" #include "CbmVertex.h" - #include "TMatrixTSym.h" ClassImp(CbmKFVertexInterface) diff --git a/reco/KF/CbmKFVertexInterface.h b/reco/KF/CbmKFVertexInterface.h index 362f322b69378215f35d63d47f7eb1956065ad29..63319de98e81afec8d8bac02b8df581bc0d2e398 100644 --- a/reco/KF/CbmKFVertexInterface.h +++ b/reco/KF/CbmKFVertexInterface.h @@ -26,7 +26,7 @@ class CbmVertex; class CbmKFVertexInterface : public TObject { -public: + public: CbmKFVertexInterface() {} virtual ~CbmKFVertexInterface() {} diff --git a/reco/KF/CbmKfFitTracksTask.cxx b/reco/KF/CbmKfFitTracksTask.cxx index fc66ab460eeb85bf2daa569126842a64739f5364..0962838adf8bd988d288a90efde181010dc646eb 100644 --- a/reco/KF/CbmKfFitTracksTask.cxx +++ b/reco/KF/CbmKfFitTracksTask.cxx @@ -26,14 +26,11 @@ #include "CbmTofTrackingInterface.h" #include "CbmTrdTrack.h" #include "CbmTrdTrackingInterface.h" - #include "FairRootManager.h" - #include "TClonesArray.h" -#include <iostream> - #include <cmath> +#include <iostream> ClassImp(CbmKfFitTracksTask); diff --git a/reco/KF/CbmKfFitTracksTask.h b/reco/KF/CbmKfFitTracksTask.h index 69de5445fbd08683033e1006b5e6343103dd75e9..3f0b1e87533faf9cd5ffdf55a1d3d2f7dfc0b1a6 100644 --- a/reco/KF/CbmKfFitTracksTask.h +++ b/reco/KF/CbmKfFitTracksTask.h @@ -10,7 +10,6 @@ #pragma once #include "CbmKfTrackFitter.h" - #include "FairTask.h" class TClonesArray; @@ -19,7 +18,7 @@ class TClonesArray; /// @brief Task class for refitting global or sts tracks /// class CbmKfFitTracksTask : public FairTask { -public: + public: enum FitMode { kSts, @@ -43,20 +42,20 @@ public: void SetFitStsTracks() { fFitMode = FitMode::kSts; } void SetFitMcbmTracks() { fFitMode = FitMode::kMcbm; } -private: - FitMode fFitMode {FitMode::kGlobal}; ///> fit mode + private: + FitMode fFitMode{FitMode::kGlobal}; ///> fit mode /// input data arrays - TClonesArray* fGlobalTracks {nullptr}; ///< global tracks - TClonesArray* fStsTracks {nullptr}; ///< sts tracks - TClonesArray* fMuchTracks {nullptr}; ///< much tracks - TClonesArray* fTrdTracks {nullptr}; ///< trd tracks - TClonesArray* fTofTracks {nullptr}; ///< tof tracks + TClonesArray* fGlobalTracks{nullptr}; ///< global tracks + TClonesArray* fStsTracks{nullptr}; ///< sts tracks + TClonesArray* fMuchTracks{nullptr}; ///< much tracks + TClonesArray* fTrdTracks{nullptr}; ///< trd tracks + TClonesArray* fTofTracks{nullptr}; ///< tof tracks CbmKfTrackFitter fFitter; ///< track fitter - Int_t fNeventsProcessed {0}; ///< number of processed events + Int_t fNeventsProcessed{0}; ///< number of processed events ClassDefOverride(CbmKfFitTracksTask, 0); }; diff --git a/reco/KF/CbmKfTrackFitter.cxx b/reco/KF/CbmKfTrackFitter.cxx index 37700a9965f9163c08170ecd5a79afd9a4b4e463..0d0c80e4c5c3b9a27d270baf2b0f227295dd5b68 100644 --- a/reco/KF/CbmKfTrackFitter.cxx +++ b/reco/KF/CbmKfTrackFitter.cxx @@ -4,6 +4,12 @@ #include "CbmKfTrackFitter.h" +#include "CaConstants.h" +#include "CaFramework.h" +#include "CaSimd.h" +#include "CaStation.h" +#include "CaTrackFit.h" +#include "CaTrackParam.h" #include "CbmGlobalTrack.h" #include "CbmL1.h" #include "CbmL1Util.h" @@ -23,20 +29,11 @@ #include "CbmTrdHit.h" #include "CbmTrdTrack.h" #include "CbmTrdTrackingInterface.h" - #include "FairRootManager.h" - +#include "KFParticleDatabase.h" #include "TClonesArray.h" #include "TDatabasePDG.h" -#include "CaConstants.h" -#include "CaFramework.h" -#include "CaSimd.h" -#include "CaStation.h" -#include "CaTrackFit.h" -#include "CaTrackParam.h" -#include "KFParticleDatabase.h" - using std::vector; using namespace std; using ca::fmask; @@ -78,7 +75,9 @@ void CbmKfTrackFitter::Init() FairRootManager* ioman = FairRootManager::Instance(); - if (!ioman) { LOG(fatal) << "CbmKfTrackFitter: no FairRootManager"; } + if (!ioman) { + LOG(fatal) << "CbmKfTrackFitter: no FairRootManager"; + } // Get hits @@ -475,7 +474,9 @@ void CbmKfTrackFitter::AddMaterialEffects(const CbmKfTrackFitter::Track& t, CbmK bool upstreamDirection) { // add material effects - if (n.fMaterialLayer < 0) { return; } + if (n.fMaterialLayer < 0) { + return; + } auto& tr = n.fIsFitted ? n.fTrack : fFit.Tr(); @@ -521,14 +522,20 @@ void CbmKfTrackFitter::FitTrack(CbmKfTrackFitter::Track& t) for (int iNode = t.fFirstHitNode + 1; iNode < nNodes; iNode++) { FitNode& n = t.fNodes[iNode]; fFit.Extrapolate(n.fZ, field); - if (n.fIsFitted) { fFit.SetQp0(n.fTrack.GetQp()); } + if (n.fIsFitted) { + fFit.SetQp0(n.fTrack.GetQp()); + } AddMaterialEffects(t, n, false); // store track fitted at the previous node and extrapolated to this node n.fTrack = fFit.Tr(); n.fIsFitted = false; - if (n.fIsXySet) { fFit.FilterXY(n.fMxy); } - if (n.fIsTimeSet) { fFit.FilterTime(n.fMt); } + if (n.fIsXySet) { + fFit.FilterXY(n.fMxy); + } + if (n.fIsTimeSet) { + fFit.FilterTime(n.fMt); + } if (iNode >= t.fLastHitNode) { // store track fitted at the last node n.fTrack = fFit.Tr(); n.fIsFitted = true; @@ -547,11 +554,17 @@ void CbmKfTrackFitter::FitTrack(CbmKfTrackFitter::Track& t) FitNode& n = t.fNodes[iNode]; fFit.Extrapolate(n.fZ, field); - if (n.fIsXySet) { fFit.FilterXY(n.fMxy); } - if (n.fIsTimeSet) { fFit.FilterTime(n.fMt); } + if (n.fIsXySet) { + fFit.FilterXY(n.fMxy); + } + if (n.fIsTimeSet) { + fFit.FilterTime(n.fMt); + } // combine partially fitted downstream and upstream tracks - if (iNode > t.fFirstHitNode) { Smooth(n.fTrack, fFit.Tr()); } + if (iNode > t.fFirstHitNode) { + Smooth(n.fTrack, fFit.Tr()); + } else { n.fTrack = fFit.Tr(); } diff --git a/reco/KF/CbmKfTrackFitter.h b/reco/KF/CbmKfTrackFitter.h index 660c8a4989f84cab0c74384601b0393d97fe45a7..7e17effd462847d723d99687632d7d097ae81ff7 100644 --- a/reco/KF/CbmKfTrackFitter.h +++ b/reco/KF/CbmKfTrackFitter.h @@ -5,16 +5,15 @@ #pragma once // include this header only once per compilation unit -#include "CbmDefs.h" - -#include <vector> - #include "CaConstants.h" #include "CaMeasurementTime.h" #include "CaMeasurementXy.h" #include "CaSimd.h" #include "CaTrackFit.h" #include "CaTrackParam.h" +#include "CbmDefs.h" + +#include <vector> class CbmMvdHit; class CbmStsHit; @@ -41,7 +40,7 @@ namespace /// A fitter for the Cbm tracks /// class CbmKfTrackFitter { -public: + public: /// A node on the trajectory where the track parameters are: /// a) measured and / or /// b) scattered and / or @@ -50,46 +49,46 @@ public: /// struct FitNode { - double fZ {0.}; ///< Z coordinate + double fZ{0.}; ///< Z coordinate - ca::TrackParamV fTrack {}; ///< fitted track + ca::TrackParamV fTrack{}; ///< fitted track /// == Material information (if present) // TODO: change to the material layer index when the material layer is implemented - int fMaterialLayer {-1}; ///< index of the material layer. Currently equal to the active tracking station index + int fMaterialLayer{-1}; ///< index of the material layer. Currently equal to the active tracking station index - double fRadThick {0.}; ///< material radiation thickness at fZ + double fRadThick{0.}; ///< material radiation thickness at fZ /// == Hit information ( if present ) - ca::MeasurementXy<ca::fvec> fMxy {}; ///< XY-measurement at fZ + ca::MeasurementXy<ca::fvec> fMxy{}; ///< XY-measurement at fZ - ca::MeasurementTime<ca::fvec> fMt {}; ///< time measurement at fZ + ca::MeasurementTime<ca::fvec> fMt{}; ///< time measurement at fZ - ECbmModuleId fSystemId {ECbmModuleId::kNotExist}; ///< detector system ID of the hit - int fAddress {-1}; ///< detector ID of the hit + ECbmModuleId fSystemId{ECbmModuleId::kNotExist}; ///< detector system ID of the hit + int fAddress{-1}; ///< detector ID of the hit /// == Flags etc - bool fIsXySet {false}; ///< true if the XY measurement is set - bool fIsTimeSet {false}; ///< true if the time measurement is set - bool fIsFitted {false}; ///< true if the node is fitted, false if the fit failed - bool fIsRadThickSet {false}; ///< true if the radiation thickness is set - int fReference1 {-1}; ///< some reference can be set by the user - int fReference2 {-1}; ///< some reference can be set by the user + bool fIsXySet{false}; ///< true if the XY measurement is set + bool fIsTimeSet{false}; ///< true if the time measurement is set + bool fIsFitted{false}; ///< true if the node is fitted, false if the fit failed + bool fIsRadThickSet{false}; ///< true if the radiation thickness is set + int fReference1{-1}; ///< some reference can be set by the user + int fReference2{-1}; ///< some reference can be set by the user }; /// A track to be fitted struct Track { std::vector<FitNode> fNodes; ///< nodes on the track - int fFirstHitNode {-1}; ///< index of the first node with the XY measurement - int fLastHitNode {-1}; ///< index of the last node with the XY measurement + int fFirstHitNode{-1}; ///< index of the first node with the XY measurement + int fLastHitNode{-1}; ///< index of the last node with the XY measurement /// externally defined inverse momentum for the Multiple Scattering calculation. /// It is used for the tracks in field-free regions. /// When the momentum can be fitted, the fitted value is used. /// the default value is set to 0.1 GeV/c - double fMsQp0 {1. / 0.1}; - bool fIsMsQp0Set {false}; + double fMsQp0{1. / 0.1}; + bool fIsMsQp0Set{false}; void MakeConsistent(); // make the structure fields consistent }; @@ -123,7 +122,7 @@ public: /// fit sts tracks // void FitStsTracks(vector<CbmStsTrack>& Tracks, const vector<int>& pidHypo); -private: + private: void FilterFirstMeasurement(const FitNode& n); void AddMaterialEffects(const Track& t, FitNode& n, bool upstreamDirection); // combine two tracks @@ -135,19 +134,19 @@ private: ca::fvec y2, ca::fvec Cxx2, ca::fvec Cxy2, ca::fvec Cyy2); -private: + private: // input data arrays - TClonesArray* fInputMvdHits {nullptr}; - TClonesArray* fInputStsHits {nullptr}; - TClonesArray* fInputMuchHits {nullptr}; - TClonesArray* fInputTrdHits {nullptr}; - TClonesArray* fInputTofHits {nullptr}; - - TClonesArray* fInputGlobalTracks {nullptr}; - TClonesArray* fInputStsTracks {nullptr}; - TClonesArray* fInputMuchTracks {nullptr}; - TClonesArray* fInputTrdTracks {nullptr}; - TClonesArray* fInputTofTracks {nullptr}; + TClonesArray* fInputMvdHits{nullptr}; + TClonesArray* fInputStsHits{nullptr}; + TClonesArray* fInputMuchHits{nullptr}; + TClonesArray* fInputTrdHits{nullptr}; + TClonesArray* fInputTofHits{nullptr}; + + TClonesArray* fInputGlobalTracks{nullptr}; + TClonesArray* fInputStsTracks{nullptr}; + TClonesArray* fInputMuchTracks{nullptr}; + TClonesArray* fInputTrdTracks{nullptr}; + TClonesArray* fInputTofTracks{nullptr}; // @@ -155,6 +154,6 @@ private: ca::TrackFit fFit; // track fit object - double fMass {ca::constants::phys::PionMass}; // mass hypothesis for the fit - bool fIsElectron {false}; // fit track as an electron (with the bermsstrallung effect) + double fMass{ca::constants::phys::PionMass}; // mass hypothesis for the fit + bool fIsElectron{false}; // fit track as an electron (with the bermsstrallung effect) }; diff --git a/reco/KF/Interface/CbmEcalTrackExtrapolationKF.cxx b/reco/KF/Interface/CbmEcalTrackExtrapolationKF.cxx index d3be9a9a772834ebb2acef665239514bb6a5b2cf..21ea5d58310cea3e99e7abf04c0beaf06d54c3aa 100644 --- a/reco/KF/Interface/CbmEcalTrackExtrapolationKF.cxx +++ b/reco/KF/Interface/CbmEcalTrackExtrapolationKF.cxx @@ -11,10 +11,8 @@ #include "CbmMCTrack.h" #include "CbmStsKFTrackFitter.h" #include "CbmStsTrack.h" - #include "FairRootManager.h" #include "FairTrackParam.h" - #include "TClonesArray.h" #include <iostream> diff --git a/reco/KF/Interface/CbmEcalTrackExtrapolationKF.h b/reco/KF/Interface/CbmEcalTrackExtrapolationKF.h index b8b62290a0f1e19f9b2db94cb5d400dd0ae7a726..61356f5ce36db8eb90b0769ef8a0d59c1e8a512c 100644 --- a/reco/KF/Interface/CbmEcalTrackExtrapolationKF.h +++ b/reco/KF/Interface/CbmEcalTrackExtrapolationKF.h @@ -37,7 +37,7 @@ class TClonesArray; class CbmGlobalTrack; class CbmEcalTrackExtrapolationKF : public CbmEcalTrackExtrapolation { -public: + public: /** Default constructor **/ CbmEcalTrackExtrapolationKF(); /** Standard constructor **/ @@ -58,7 +58,7 @@ public: **/ virtual Int_t DoExtrapolate(TClonesArray* gTrackArray, TClonesArray* fTrackParamArray); -private: + private: /** Arrays **/ TClonesArray* fTrackParamArray; TClonesArray* fSTSArray; @@ -66,7 +66,7 @@ private: Int_t iEx; /** number of extrapolated tracks */ ClassDef(CbmEcalTrackExtrapolationKF, 1); -private: + private: CbmEcalTrackExtrapolationKF(const CbmEcalTrackExtrapolationKF&); void operator=(const CbmEcalTrackExtrapolationKF&); }; diff --git a/reco/KF/Interface/CbmGlobalTrackFitterKF.cxx b/reco/KF/Interface/CbmGlobalTrackFitterKF.cxx index 0c17ea7c0677af57fe58e9c04be4167a0d9ffbdf..5a6f48ecdc938ed64830f5d7afe2e327c16fda84 100644 --- a/reco/KF/Interface/CbmGlobalTrackFitterKF.cxx +++ b/reco/KF/Interface/CbmGlobalTrackFitterKF.cxx @@ -18,9 +18,7 @@ #include "CbmTrdHit.h" #include "CbmTrdTrack.h" #include "CbmVertex.h" - #include "FairRootManager.h" - #include "TClonesArray.h" #include "TMath.h" @@ -112,7 +110,9 @@ void CbmGlobalTrackFitterKF::Init() // The old name for the object is "PrimaryVertex" the new one // "PrimaryVertex." Check first for the new name fPrimVertex = dynamic_cast<CbmVertex*>(rootMgr->GetObject("PrimaryVertex.")); - if (nullptr == fPrimVertex) { fPrimVertex = dynamic_cast<CbmVertex*>(rootMgr->GetObject("PrimaryVertex")); } + if (nullptr == fPrimVertex) { + fPrimVertex = dynamic_cast<CbmVertex*>(rootMgr->GetObject("PrimaryVertex")); + } if (nullptr == fPrimVertex) { cout << "-W- CbmGlobalTrackFitterKF::Init : " << "no Primary Vertex!" << endl; @@ -142,10 +142,14 @@ void CbmGlobalTrackFitterKF::DoFit(CbmGlobalTrack* glbTrack) // Get STS track index Int_t stsTrackIndex = glbTrack->GetStsTrackIndex(); - if (-1 == stsTrackIndex) { return; } + if (-1 == stsTrackIndex) { + return; + } // Get STS track CbmStsTrack* stsTrack = (CbmStsTrack*) fArrayStsTrack->At(stsTrackIndex); - if (nullptr == stsTrack) { return; } + if (nullptr == stsTrack) { + return; + } const FairTrackParam* paramFirst; paramFirst = stsTrack->GetParamFirst(); fKfTrack->SetTrackParam(*paramFirst); @@ -154,7 +158,9 @@ void CbmGlobalTrackFitterKF::DoFit(CbmGlobalTrack* glbTrack) y_old = fKfTrack->GetTrack()[1]; z_old = z; Double_t p = 1.; - if (paramFirst->GetQp()) { p = TMath::Abs(1. / paramFirst->GetQp()); } + if (paramFirst->GetQp()) { + p = TMath::Abs(1. / paramFirst->GetQp()); + } // Int_t stsHitIndex; // CbmStsHit* stsHit; @@ -179,11 +185,17 @@ void CbmGlobalTrackFitterKF::DoFit(CbmGlobalTrack* glbTrack) // Get TRD track index Int_t trdTrackIndex = glbTrack->GetTrdTrackIndex(); - if (-1 == trdTrackIndex) { return; } + if (-1 == trdTrackIndex) { + return; + } // Get TRD track CbmTrdTrack* trdTrack = (CbmTrdTrack*) fArrayTrdTrack->At(trdTrackIndex); - if (nullptr == trdTrack) { return; } - if (trdTrack->GetNofHits() < 2) { return; } + if (nullptr == trdTrack) { + return; + } + if (trdTrack->GetNofHits() < 2) { + return; + } Int_t trdHitIndex = trdTrack->GetHitIndex(0); CbmTrdHit* trdHit = (CbmTrdHit*) fArrayTrdHit->At(trdHitIndex); @@ -228,7 +240,9 @@ void CbmGlobalTrackFitterKF::DoFit(CbmGlobalTrack* glbTrack) Int_t tofIndex = glbTrack->GetTofHitIndex(); - if (-1 == tofIndex) { return; } + if (-1 == tofIndex) { + return; + } CbmTofHit* tofHit = (CbmTofHit*) fArrayTofHit->At(tofIndex); x_new = tofHit->GetX(); y_new = tofHit->GetY(); diff --git a/reco/KF/Interface/CbmGlobalTrackFitterKF.h b/reco/KF/Interface/CbmGlobalTrackFitterKF.h index 7afdd10521c8267284b15f377da9a442a5f3fe1e..186d8a2c8dece4811dd3cb4b33c7870679cae884 100644 --- a/reco/KF/Interface/CbmGlobalTrackFitterKF.h +++ b/reco/KF/Interface/CbmGlobalTrackFitterKF.h @@ -18,7 +18,7 @@ class CbmVertex; class CbmGlobalTrackFitterKF : public CbmGlobalTrackFitter { -private: + private: TClonesArray* fArrayStsHit; // Array of STS hits TClonesArray* fArrayTrdHit; // Array of TRD hits TClonesArray* fArrayTofHit; // Array of TOF hits @@ -27,7 +27,7 @@ private: CbmVertex* fPrimVertex; // Primary vertex CbmKFTrack* fKfTrack; // KF track -public: + public: CbmGlobalTrackFitterKF(); virtual ~CbmGlobalTrackFitterKF(); @@ -36,7 +36,7 @@ public: ClassDef(CbmGlobalTrackFitterKF, 1); -private: + private: CbmGlobalTrackFitterKF(const CbmGlobalTrackFitterKF&); void operator=(const CbmGlobalTrackFitterKF&); }; diff --git a/reco/KF/Interface/CbmKFStsHit.cxx b/reco/KF/Interface/CbmKFStsHit.cxx index b9800b76be210c12c3009c960261a193ae8dacda..b76ac6c3d0f4d3893d3b554c1cc54fedd2938394 100644 --- a/reco/KF/Interface/CbmKFStsHit.cxx +++ b/reco/KF/Interface/CbmKFStsHit.cxx @@ -27,7 +27,8 @@ void CbmKFStsHit::Create(CbmStsHit* h) MaterialIndex = KF->GetMaterialIndex(id); - if (MaterialIndex >= 0) tube = (CbmKFTube*) KF->vMaterial[MaterialIndex]; + if (MaterialIndex >= 0) + tube = (CbmKFTube*) KF->vMaterial[MaterialIndex]; else { st_tube.z = st_tube.dz = st_tube.r = st_tube.R = st_tube.rr = st_tube.RR = 0; tube = &st_tube; @@ -60,7 +61,8 @@ void CbmKFStsHit::Create(CbmMvdHit* h) MaterialIndex = KF->GetMaterialIndex(id); // cout << " and material index = " << MaterialIndex << endl; - if (MaterialIndex >= 0) tube = (CbmKFTube*) KF->vMaterial[MaterialIndex]; + if (MaterialIndex >= 0) + tube = (CbmKFTube*) KF->vMaterial[MaterialIndex]; else { st_tube.z = st_tube.dz = st_tube.r = st_tube.R = st_tube.rr = st_tube.RR = 0; tube = &st_tube; diff --git a/reco/KF/Interface/CbmKFStsHit.h b/reco/KF/Interface/CbmKFStsHit.h index a8fdf8aa2b94d946a2a93dd96cbeee83e99bfe14..c69909e85c4e06c55c96870b68d09b9e02aa9dc7 100644 --- a/reco/KF/Interface/CbmKFStsHit.h +++ b/reco/KF/Interface/CbmKFStsHit.h @@ -14,9 +14,9 @@ class CbmMvdHit; class CbmKFStsHit : public CbmKFHit { -public: - CbmKFStsHit() : FitPoint(), tube(nullptr) {}; - ~CbmKFStsHit() {}; + public: + CbmKFStsHit() : FitPoint(), tube(nullptr){}; + ~CbmKFStsHit(){}; CbmKFPixelMeasurement FitPoint; CbmKFTube* tube; @@ -37,7 +37,7 @@ public: return *this; }; - CbmKFStsHit(const CbmKFStsHit& a) : FitPoint(a.FitPoint), tube(a.tube) {}; + CbmKFStsHit(const CbmKFStsHit& a) : FitPoint(a.FitPoint), tube(a.tube){}; ClassDef(CbmKFStsHit, 1); diff --git a/reco/KF/Interface/CbmKFTofHit.cxx b/reco/KF/Interface/CbmKFTofHit.cxx index 555e095f6d9807a490bdb3ad6384acdc1924d1df..80dc237922329063cf7a7b76f3254e3d98616775 100644 --- a/reco/KF/Interface/CbmKFTofHit.cxx +++ b/reco/KF/Interface/CbmKFTofHit.cxx @@ -12,7 +12,6 @@ #include "CbmKF.h" #include "CbmKFMaterial.h" #include "CbmTofHit.h" - #include "TMath.h" #include "TVector3.h" diff --git a/reco/KF/Interface/CbmKFTofHit.h b/reco/KF/Interface/CbmKFTofHit.h index 8f8a1a20a5c670ee292422efd6415ffb40358937..48c33fc2a163c666c4af0baf8889af2efd4d850a 100644 --- a/reco/KF/Interface/CbmKFTofHit.h +++ b/reco/KF/Interface/CbmKFTofHit.h @@ -25,12 +25,12 @@ class CbmTofHit; class CbmKFTofHit : public CbmKFHit { -public: + public: /** Default constructor **/ - CbmKFTofHit() : FitPoint(), wall(nullptr) {}; + CbmKFTofHit() : FitPoint(), wall(nullptr){}; /** Destructor **/ - ~CbmKFTofHit() {}; + ~CbmKFTofHit(){}; /** Measurement point **/ // CbmKFPixelMeasurement FitPoint; @@ -52,7 +52,7 @@ public: return *this; }; - CbmKFTofHit(const CbmKFTofHit& a) : FitPoint(a.FitPoint), wall(a.wall) {}; + CbmKFTofHit(const CbmKFTofHit& a) : FitPoint(a.FitPoint), wall(a.wall){}; ClassDef(CbmKFTofHit, 1); }; diff --git a/reco/KF/Interface/CbmKFTrack.cxx b/reco/KF/Interface/CbmKFTrack.cxx index d83845f88835c9041f021f81c31394ae5d0d78ab..cf42e24e430d8bdb213f61a5bf44edfaf84220b2 100644 --- a/reco/KF/Interface/CbmKFTrack.cxx +++ b/reco/KF/Interface/CbmKFTrack.cxx @@ -6,9 +6,7 @@ #include "CbmKFMath.h" #include "CbmStsTrack.h" - #include "FairTrackParam.h" - #include "TDatabasePDG.h" #include "TMath.h" #include "TParticlePDG.h" diff --git a/reco/KF/Interface/CbmKFTrack.h b/reco/KF/Interface/CbmKFTrack.h index 16dbac7f822c560cf6e96debaf26c28a35b22bd4..c3b3978131313a37003d48e63330fee2966bb6d1 100644 --- a/reco/KF/Interface/CbmKFTrack.h +++ b/reco/KF/Interface/CbmKFTrack.h @@ -24,12 +24,12 @@ class CbmStsTrack; class CbmKFTrack : public CbmKFTrackInterface { -private: + private: Double_t fT[6], fC[15], fMass, fChi2; Bool_t fIsElectron; Int_t fNDF; -public: + public: std::vector<CbmKFHit*> fHits; CbmKFTrack(); diff --git a/reco/KF/Interface/CbmKFTrdHit.cxx b/reco/KF/Interface/CbmKFTrdHit.cxx index cbda9dff9329809945f91f682e28870605cc669c..ed060cbb1ece371d66fc5c7cb2d8fbac9a943144 100644 --- a/reco/KF/Interface/CbmKFTrdHit.cxx +++ b/reco/KF/Interface/CbmKFTrdHit.cxx @@ -12,7 +12,6 @@ #include "CbmKF.h" #include "CbmKFMaterial.h" #include "CbmTrdHit.h" - #include "TMath.h" #include "TVector3.h" diff --git a/reco/KF/Interface/CbmKFTrdHit.h b/reco/KF/Interface/CbmKFTrdHit.h index f3a6b4b3d4bfa2fd7ebb4ecea99445056cfc7aad..12859959293dc079502891468050ddb08e324431 100644 --- a/reco/KF/Interface/CbmKFTrdHit.h +++ b/reco/KF/Interface/CbmKFTrdHit.h @@ -25,12 +25,12 @@ class CbmTrdHit; class CbmKFTrdHit : public CbmKFHit { -public: + public: /** Default constructor **/ - CbmKFTrdHit() : FitPoint(), wall(nullptr) {}; + CbmKFTrdHit() : FitPoint(), wall(nullptr){}; /** Destructor **/ - ~CbmKFTrdHit() {}; + ~CbmKFTrdHit(){}; /** Measurement point **/ // CbmKFPixelMeasurement FitPoint; @@ -52,7 +52,7 @@ public: return *this; }; - CbmKFTrdHit(const CbmKFTrdHit& a) : FitPoint(a.FitPoint), wall(a.wall) {}; + CbmKFTrdHit(const CbmKFTrdHit& a) : FitPoint(a.FitPoint), wall(a.wall){}; ClassDef(CbmKFTrdHit, 1); }; diff --git a/reco/KF/Interface/CbmKFVertex.h b/reco/KF/Interface/CbmKFVertex.h index a6a6ef0a8e407c4878c495404aedce3ea2940e01..c4fc0fe2c87f00d5590991c4e412950b6ddcd7c1 100644 --- a/reco/KF/Interface/CbmKFVertex.h +++ b/reco/KF/Interface/CbmKFVertex.h @@ -9,11 +9,11 @@ class CbmKFVertex : public CbmKFVertexInterface { -private: + private: Double_t fX, fY, fZ, fC[6], fChi2; Int_t fNDF, fNTracks; -public: + public: CbmKFVertex() : fX(0), fY(0), fZ(0), fChi2(0), fNDF(0), fNTracks(0) { for (int i = 0; i < 6; ++i) diff --git a/reco/KF/Interface/CbmPVFinderKF.cxx b/reco/KF/Interface/CbmPVFinderKF.cxx index 2bd7d649142df60dea65c92ed5d61b3023a8101c..42490a3bf56c44277a5ca9491ec2028175641f5c 100644 --- a/reco/KF/Interface/CbmPVFinderKF.cxx +++ b/reco/KF/Interface/CbmPVFinderKF.cxx @@ -9,7 +9,6 @@ #include "CbmKFTrack.h" #include "CbmKFVertex.h" #include "CbmStsTrack.h" - #include "TClonesArray.h" #include <cmath> diff --git a/reco/KF/Interface/CbmPVFinderKF.h b/reco/KF/Interface/CbmPVFinderKF.h index eb08ecf882d5aa9b5d25ec8fae5aed944aa9f99b..14d961aac3818af43fed310fda9e16fb6f0b279a 100644 --- a/reco/KF/Interface/CbmPVFinderKF.h +++ b/reco/KF/Interface/CbmPVFinderKF.h @@ -17,13 +17,13 @@ class CbmPVFinderKF : public CbmPrimaryVertexFinder { -public: + public: /** Default constructor **/ - CbmPVFinderKF() {}; + CbmPVFinderKF(){}; /** Destructor **/ - ~CbmPVFinderKF() {}; + ~CbmPVFinderKF(){}; /** Execution of PV finding. diff --git a/reco/KF/Interface/CbmStsFitPerformanceTask.cxx b/reco/KF/Interface/CbmStsFitPerformanceTask.cxx index 1df22de59505c08461e565120b6c8c3c9d227a22..33f46f38f6fef4036a26923a36a7fdbf339241e9 100644 --- a/reco/KF/Interface/CbmStsFitPerformanceTask.cxx +++ b/reco/KF/Interface/CbmStsFitPerformanceTask.cxx @@ -27,20 +27,17 @@ #include "CbmStsTrack.h" #include "CbmTrackMatch.h" #include "CbmVertex.h" - #include "FairMCApplication.h" #include "FairRootManager.h" - #include "TDatabasePDG.h" #include "TF1.h" #include "TParticlePDG.h" #include "TVector3.h" +#include <cmath> #include <iomanip> #include <iostream> -#include <cmath> - using std::cout; using std::endl; using std::fabs; @@ -50,7 +47,8 @@ using std::vector; void writedir2current(TObject* obj) { - if (!obj->IsFolder()) obj->Write(); + if (!obj->IsFolder()) + obj->Write(); else { TDirectory* cur = gDirectory; TDirectory* sub = cur->mkdir(obj->GetName()); @@ -373,7 +371,9 @@ InitStatus CbmStsFitPerformanceTask::ReInit() // The old name for the object is "PrimaryVertex" the new one // "PrimaryVertex." Check first for the new name fPrimaryVertex = dynamic_cast<CbmVertex*>(fManger->GetObject("PrimaryVertex.")); - if (nullptr == fPrimaryVertex) { fPrimaryVertex = dynamic_cast<CbmVertex*>(fManger->GetObject("PrimaryVertex")); } + if (nullptr == fPrimaryVertex) { + fPrimaryVertex = dynamic_cast<CbmVertex*>(fManger->GetObject("PrimaryVertex")); + } if (nullptr == fPrimaryVertex) { cout << "-W- CbmStsFitPerformanceTask::ReInit : " << "no Primary Vertex!" << endl; @@ -610,7 +610,8 @@ void CbmStsFitPerformanceTask::Exec(Option_t* /*option*/) fhDsP2->Fill(p1, dp / s); } // first point - if (!vMPoints.empty()) FillMCStateVectors(vMPoints.front(), mc); + if (!vMPoints.empty()) + FillMCStateVectors(vMPoints.front(), mc); else FillMCStateVectors(vPoints.front(), mc); FillTrackHisto(mc, track, fhFrst); @@ -625,7 +626,8 @@ void CbmStsFitPerformanceTask::Exec(Option_t* /*option*/) // impact point - if (TMath::Abs(mcTrack->GetPdgCode()) == 211) FillTrackHisto(mci, track, fhImpPi); + if (TMath::Abs(mcTrack->GetPdgCode()) == 211) + FillTrackHisto(mci, track, fhImpPi); else FillTrackHisto(mci, track, fhImp); @@ -958,7 +960,8 @@ Double_t CbmStsFitPerformanceTask::GetCharge(CbmMCTrack* mcTrack) Double_t q; Int_t pdgCode = mcTrack->GetPdgCode(); TParticlePDG* particlePDG = TDatabasePDG::Instance()->GetParticle(pdgCode); - if (particlePDG) q = particlePDG->Charge() / 3.; + if (particlePDG) + q = particlePDG->Charge() / 3.; else q = 0; return q; diff --git a/reco/KF/Interface/CbmStsFitPerformanceTask.h b/reco/KF/Interface/CbmStsFitPerformanceTask.h index a1c144ae4b5c22024a871f91a858168ff81cce17..79c631b185530bb2eb31cddcf6eb80a0898991b0 100644 --- a/reco/KF/Interface/CbmStsFitPerformanceTask.h +++ b/reco/KF/Interface/CbmStsFitPerformanceTask.h @@ -25,17 +25,15 @@ #include "CbmStsPoint.h" #include "CbmStsTrack.h" #include "CbmVertex.h" - #include "FairTask.h" #include "FairTrackParam.h" - #include "TClonesArray.h" #include "TH1D.h" #include "TH2D.h" class CbmStsFitPerformanceTask : public FairTask { -public: + public: /** Standard constructor */ CbmStsFitPerformanceTask(const char* name = "CbmStsFitPerformanceTask", Int_t iVerbose = 1); @@ -83,7 +81,7 @@ public: Double_t GetCharge(CbmMCTrack* mcTrack); -protected: + protected: void CreateTrackHisto(TH1D* hist[10], const char* name, const char* title); void CreateVertexHisto(TH1D* hist[9], const char* name, const char* title); void CreateD0Histo(TH1D* hist[14], const char* name, const char* title); @@ -133,7 +131,7 @@ protected: ClassDef(CbmStsFitPerformanceTask, 1); -private: + private: CbmStsFitPerformanceTask(const CbmStsFitPerformanceTask&); void operator=(const CbmStsFitPerformanceTask&); }; diff --git a/reco/KF/Interface/CbmStsKFSecondaryVertexFinder.cxx b/reco/KF/Interface/CbmStsKFSecondaryVertexFinder.cxx index 5daf1874811f439a5e68cc35b9300c019c1dce1c..f599b9f6dc20806075e251ae19886075a3b1157e 100644 --- a/reco/KF/Interface/CbmStsKFSecondaryVertexFinder.cxx +++ b/reco/KF/Interface/CbmStsKFSecondaryVertexFinder.cxx @@ -35,7 +35,9 @@ void CbmStsKFSecondaryVertexFinder::AddTrack(CbmStsTrack* Track) void CbmStsKFSecondaryVertexFinder::SetApproximation(CbmVertex* Guess) { - if (!Guess) { Finder.SetApproximation(); } + if (!Guess) { + Finder.SetApproximation(); + } else { VGuess.SetVertex(*Guess); Finder.SetApproximation(&VGuess); @@ -46,7 +48,9 @@ void CbmStsKFSecondaryVertexFinder::SetMassConstraint(Double_t MotherMass) { Fin void CbmStsKFSecondaryVertexFinder::SetTopoConstraint(CbmVertex* Parent) { - if (!Parent) { Finder.SetTopoConstraint(); } + if (!Parent) { + Finder.SetTopoConstraint(); + } else { VParent.SetVertex(*Parent); Finder.SetTopoConstraint(&VParent); diff --git a/reco/KF/Interface/CbmStsKFSecondaryVertexFinder.h b/reco/KF/Interface/CbmStsKFSecondaryVertexFinder.h index 038285ac92235ebf38a8b05b6157b5468b087d6e..8edea696a26cabd48d7b5a34ab51fa87e1e65f03 100644 --- a/reco/KF/Interface/CbmStsKFSecondaryVertexFinder.h +++ b/reco/KF/Interface/CbmStsKFSecondaryVertexFinder.h @@ -28,9 +28,9 @@ class CbmStsKFSecondaryVertexFinder : public TObject { CbmKFVertex VParent, VGuess; CbmKFSecondaryVertexFinder Finder; -public: + public: CbmStsKFSecondaryVertexFinder() : vStsTracks(), vKFTracks(), VParent(), VGuess(), Finder() { Clear(); }; - ~CbmStsKFSecondaryVertexFinder() {}; + ~CbmStsKFSecondaryVertexFinder(){}; virtual void Clear(Option_t* opt = ""); void AddTrack(CbmStsTrack* Track); diff --git a/reco/KF/Interface/CbmStsKFTrackFitter.cxx b/reco/KF/Interface/CbmStsKFTrackFitter.cxx index 18ae40134aecacb64a494219ff04b7f5873a3d64..2cadfb379d0af5151737d30e46a4f27f748e5a83 100644 --- a/reco/KF/Interface/CbmStsKFTrackFitter.cxx +++ b/reco/KF/Interface/CbmStsKFTrackFitter.cxx @@ -11,16 +11,13 @@ #include "CbmMvdHit.h" #include "CbmStsTrack.h" #include "CbmVertex.h" - #include "FairRootManager.h" - #include "TClonesArray.h" #include "TMath.h" #include "TMatrixTSym.h" -#include <iostream> - #include <cmath> +#include <iostream> using std::cout; using std::endl; @@ -179,7 +176,9 @@ Double_t CbmStsKFTrackFitter::GetChiToVertex(CbmStsTrack* track, CbmVertex* vtx) // "PrimaryVertex." Check first for the new name // TODO: don't use reinterpret_cast vtx = reinterpret_cast<CbmVertex*>(fManger->GetObject("PrimaryVertex.")); - if (nullptr == vtx) { vtx = reinterpret_cast<CbmVertex*>(fManger->GetObject("PrimaryVertex")); } + if (nullptr == vtx) { + vtx = reinterpret_cast<CbmVertex*>(fManger->GetObject("PrimaryVertex")); + } if (!vtx) { cout << "-W- CbmStsKFTrackFitter::GetChiToVertex: No Primary Vertex found!" << endl; return 100.; diff --git a/reco/KF/Interface/CbmStsKFTrackFitter.h b/reco/KF/Interface/CbmStsKFTrackFitter.h index 17e3522819083165da42f5a582da3410db089fef..f4192fe3334a43b8751ecb661124fa2cb24021a2 100644 --- a/reco/KF/Interface/CbmStsKFTrackFitter.h +++ b/reco/KF/Interface/CbmStsKFTrackFitter.h @@ -16,14 +16,14 @@ class TClonesArray; class CbmStsKFTrackFitter : public CbmStsTrackFitter { -public: + public: /** Default constructor */ CbmStsKFTrackFitter(); /** Destructor */ - ~CbmStsKFTrackFitter() {}; + ~CbmStsKFTrackFitter(){}; /** Initialisation @@ -64,7 +64,7 @@ public: */ Double_t FitToVertex(CbmStsTrack* track, CbmVertex* vtx, FairTrackParam* v_track); -private: + private: void SetKFHits(CbmKFTrack& T, CbmStsTrack* track); Bool_t CheckTrack(CbmKFTrack& T); @@ -75,10 +75,10 @@ private: Bool_t fIsInitialised; -public: + public: ClassDef(CbmStsKFTrackFitter, 1); -private: + private: CbmStsKFTrackFitter(const CbmStsKFTrackFitter&); void operator=(const CbmStsKFTrackFitter&); }; diff --git a/reco/KF/Interface/CbmTofTrackFitterKF.cxx b/reco/KF/Interface/CbmTofTrackFitterKF.cxx index 83a280d4e8384520cf2d9ec3e139f196ea2f5aa1..06bcadee40328a6beae29e07ea12c93ae88fca7f 100644 --- a/reco/KF/Interface/CbmTofTrackFitterKF.cxx +++ b/reco/KF/Interface/CbmTofTrackFitterKF.cxx @@ -12,12 +12,11 @@ #include "CbmKFTrack.h" #include "CbmTofHit.h" #include "CbmTofTracklet.h" - #include "FairRootManager.h" -#include <Logger.h> - #include "TClonesArray.h" +#include <Logger.h> + #include <iostream> #include <vector> @@ -143,11 +142,15 @@ Int_t CbmTofTrackFitterKF::DoFit(CbmTofTracklet* pTrack) fKfTrack->Fit(0); // Store parameters at first layer fKfTrack->GetTrackParam(*(const_cast<FairTrackParam*>(pTrack->GetParamFirst()))); - if (fVerbose > 2) { pTrack->GetParamFirst()->Print(); } + if (fVerbose > 2) { + pTrack->GetParamFirst()->Print(); + } fKfTrack->Fit(1); // Store parameters at last layer fKfTrack->GetTrackParam(*(const_cast<FairTrackParam*>(pTrack->GetParamLast()))); - if (fVerbose > 2) { pTrack->GetParamLast()->Print(); } + if (fVerbose > 2) { + pTrack->GetParamLast()->Print(); + } // Store chi2 of fit pTrack->SetChiSq(fKfTrack->GetRefChi2()); @@ -162,7 +165,9 @@ Int_t CbmTofTrackFitterKF::DoFit(CbmTofTracklet* pTrack) fKfTrack->fHits.clear(); LOG(debug) << "CbmTofTrackFitterKF::DoFit: TOF track fitted. chi2/ndf = " << pTrack->GetChiSq() / pTrack->GetNDF(); - if (fVerbose > 2) { cout << endl << endl; } + if (fVerbose > 2) { + cout << endl << endl; + } return 0; } diff --git a/reco/KF/Interface/CbmTofTrackFitterKF.h b/reco/KF/Interface/CbmTofTrackFitterKF.h index 26ab56087cb6d67403c5369c93d4bb944bbb281e..58522fbc4359df15e72c2b1563dc169b8deff7d9 100644 --- a/reco/KF/Interface/CbmTofTrackFitterKF.h +++ b/reco/KF/Interface/CbmTofTrackFitterKF.h @@ -19,13 +19,13 @@ class CbmKFTrack; class CbmTofTrackFitterKF : public CbmTofTrackFitter { -private: + private: TClonesArray* fArrayTofHit; // Array of TOF hits Int_t fVerbose; // Verbosity level Int_t fPid; // Mass hypothesis CbmKFTrack* fKfTrack; // KF track -public: + public: CbmTofTrackFitterKF(); CbmTofTrackFitterKF(Int_t verbose, Int_t pid); virtual ~CbmTofTrackFitterKF(); @@ -53,7 +53,7 @@ public: ClassDef(CbmTofTrackFitterKF, 1); -private: + private: void SetKFHits(CbmKFTrack& T, CbmTofTracklet* track); CbmTofTrackFitterKF(const CbmTofTrackFitterKF&); void operator=(const CbmTofTrackFitterKF&); diff --git a/reco/KF/Interface/CbmTrdTrackFitterKF.cxx b/reco/KF/Interface/CbmTrdTrackFitterKF.cxx index 51064125a437d3815dd3a55491c29d5552a46009..082e84326d0f7313b077fd7a705060be5d0f91c8 100644 --- a/reco/KF/Interface/CbmTrdTrackFitterKF.cxx +++ b/reco/KF/Interface/CbmTrdTrackFitterKF.cxx @@ -12,9 +12,7 @@ #include "CbmKFTrdHit.h" #include "CbmTrdHit.h" #include "CbmTrdTrack.h" - #include "FairRootManager.h" - #include "TClonesArray.h" #include <iostream> @@ -164,7 +162,9 @@ Int_t CbmTrdTrackFitterKF::DoFit(CbmTrdTrack* pTrack) if (fVerbose > 1) { cout << "TRD track fitted. chi2/ndf = " << pTrack->GetChiSq() / pTrack->GetNDF() << endl; - if (fVerbose > 2) { cout << endl << endl; } + if (fVerbose > 2) { + cout << endl << endl; + } } return 0; diff --git a/reco/KF/Interface/CbmTrdTrackFitterKF.h b/reco/KF/Interface/CbmTrdTrackFitterKF.h index c895ddaa811fa606c41d1289eeb38889664366e2..b9da6ead65b511923a935e230b02b84ad4c53a0d 100644 --- a/reco/KF/Interface/CbmTrdTrackFitterKF.h +++ b/reco/KF/Interface/CbmTrdTrackFitterKF.h @@ -18,13 +18,13 @@ class CbmKFTrack; class CbmTrdTrackFitterKF : public CbmTrdTrackFitter { -private: + private: TClonesArray* fArrayTrdHit; // Array of TRD hits Int_t fVerbose; // Verbosity level Int_t fPid; // Mass hypothesis CbmKFTrack* fKfTrack; // KF track -public: + public: CbmTrdTrackFitterKF(); CbmTrdTrackFitterKF(Int_t verbose, Int_t pid); virtual ~CbmTrdTrackFitterKF(); @@ -41,7 +41,7 @@ public: ClassDef(CbmTrdTrackFitterKF, 1); -private: + private: CbmTrdTrackFitterKF(const CbmTrdTrackFitterKF&); void operator=(const CbmTrdTrackFitterKF&); }; diff --git a/reco/KF/KFQA/CbmKFPartEfficiencies.h b/reco/KF/KFQA/CbmKFPartEfficiencies.h index 7d56e0bf57ced944b7d6c75e061b47a50c5ac2e5..55cb99cae76278ba0509f4ec567cca762c19d92a 100644 --- a/reco/KF/KFQA/CbmKFPartEfficiencies.h +++ b/reco/KF/KFQA/CbmKFPartEfficiencies.h @@ -6,11 +6,10 @@ #define CbmKFPartEfficiencies_H #include "CbmL1Counters.h" - #include "TNamed.h" class CbmKFPartEfficiencies : public TNamed { -public: + public: CbmKFPartEfficiencies() : partDaughterPdg() , names() @@ -435,13 +434,14 @@ public: fPdgToIndex[mPartPDG[iP]] = iP; } - virtual ~CbmKFPartEfficiencies() {}; + virtual ~CbmKFPartEfficiencies(){}; int GetParticleIndex(int pdg) { std::map<int, int>::iterator it; it = fPdgToIndex.find(pdg); - if (it != fPdgToIndex.end()) return it->second; + if (it != fPdgToIndex.end()) + return it->second; else return -1; } @@ -583,7 +583,7 @@ public: ClassDef(CbmKFPartEfficiencies, 1); -private: + private: std::vector<TString> names; // names counters indexed by index of counter std::map<TString, int> indices; // indices of counters indexed by a counter shortname diff --git a/reco/KF/KFQA/CbmKFTrErrMCPoints.h b/reco/KF/KFQA/CbmKFTrErrMCPoints.h index 78511ec64a7d6f2301dd9edaa279019b1390ce57..595eaf79bdaa45b40fe2368c23eecbc055a81d08 100644 --- a/reco/KF/KFQA/CbmKFTrErrMCPoints.h +++ b/reco/KF/KFQA/CbmKFTrErrMCPoints.h @@ -9,6 +9,7 @@ #ifndef _CbmKFTrErrMCPoints_h_ #define _CbmKFTrErrMCPoints_h_ +#include "TClonesArray.h" #include <CbmMvdHit.h> #include <CbmMvdPoint.h> #include <CbmStsHit.h> @@ -17,17 +18,15 @@ #include <FairMCPoint.h> -#include "TClonesArray.h" - #include <vector> class CbmMCTrack; class CbmKFTrErrMCPoints : public TObject { -public: + public: CbmKFTrErrMCPoints(); - ~CbmKFTrErrMCPoints() {}; + ~CbmKFTrErrMCPoints(){}; CbmMvdPoint* GetMvdPoint(Int_t i) { return MvdArray[i]; } CbmStsPoint* GetStsPoint(Int_t i) { return StsArray[i]; } diff --git a/reco/KF/KFQA/CbmKFTrackFitQa.cxx b/reco/KF/KFQA/CbmKFTrackFitQa.cxx index 0e14b8e866890cd2a59d4b96a7e6f411681b8ddf..6b12b2b6b8c640fb60353065cbe855b70a1f48d3 100644 --- a/reco/KF/KFQA/CbmKFTrackFitQa.cxx +++ b/reco/KF/KFQA/CbmKFTrackFitQa.cxx @@ -18,19 +18,17 @@ #include "CbmMatch.h" #include "CbmStsTrack.h" #include "CbmTrackMatch.h" - -#include <FairMCPoint.h> -#include <FairRootManager.h> - #include "TBranch.h" #include "TDatabasePDG.h" #include "TDirectory.h" #include "TFile.h" #include "TTree.h" -#include <iostream> +#include <FairMCPoint.h> +#include <FairRootManager.h> #include <cmath> +#include <iostream> using namespace std; using std::vector; @@ -318,7 +316,8 @@ void CbmKFTrackFitQa::FillHistoAtParticleVertex(CbmMCTrack* track_mc, CbmKFTrack if (isfinite(fC[14]) && fC[14] > 0) pull_AtPV_qp->Fill(ddqp_p / sqrt(fC[14])); if (isfinite(fT[4]) && (fabs(fT[4]) > 1.e-20)) { - if (qtrack == (fabs(fT[4]) / fT[4])) q_QA->Fill(P_mc, 100.0); + if (qtrack == (fabs(fT[4]) / fT[4])) + q_QA->Fill(P_mc, 100.0); else q_QA->Fill(P_mc, 0.0); @@ -343,7 +342,8 @@ void CbmKFTrackFitQa::FillHistoAtFirstPoint(CbmKFTrErrMCPoints* mc_points, CbmMC if (!mc_points) return; if ((mc_points->MvdArray.size() == 0) && (mc_points->StsArray.size() == 0)) return; - if (mc_points->MvdArray.size() > 0) MCFirstPoint = *mc_points->MvdArray.begin(); + if (mc_points->MvdArray.size() > 0) + MCFirstPoint = *mc_points->MvdArray.begin(); else MCFirstPoint = *mc_points->StsArray.begin(); @@ -361,7 +361,9 @@ void CbmKFTrackFitQa::FillHistoAtFirstPoint(CbmKFTrErrMCPoints* mc_points, CbmMC MCFirstPoint = *ists; //cout << "Z " << MCFirstPoint->GetZ() << " fT[5] " << fT[5] << " mctrackZ " << track_mc->GetStartZ() << " X " << fT[0] << " Xmc "<< track_mc->GetStartX()<< //" MCID " << track_mc->GetMotherId() << " MCIDPart " << MCFirstPoint->GetTrackID() << endl; - if (fabs(MCFirstPoint->GetZ() - fT[5]) < 1.) { break; } + if (fabs(MCFirstPoint->GetZ() - fT[5]) < 1.) { + break; + } } } track_kf->Extrapolate(MCFirstPoint->GetZ()); @@ -404,7 +406,8 @@ void CbmKFTrackFitQa::FillHistoAtFirstPoint(CbmKFTrErrMCPoints* mc_points, CbmMC if (isfinite(fC[14]) && fC[14] > 0) pull_AtFP_qp->Fill(ddqp_p / sqrt(fC[14])); if (isfinite(fT[4]) && (fabs(fT[4]) > 1.e-20)) { - if (qtrack == (fabs(fT[4]) / fT[4])) q_QA->Fill(P_mc, 100.0); + if (qtrack == (fabs(fT[4]) / fT[4])) + q_QA->Fill(P_mc, 100.0); else q_QA->Fill(P_mc, 0.0); diff --git a/reco/KF/KFQA/CbmKFTrackFitQa.h b/reco/KF/KFQA/CbmKFTrackFitQa.h index 6d6a5b75ce6dc3e83787823ba78ad6e0c999ebb4..254e080ba4bfe09fbd78ae68ed00ebd3d91a28a0 100644 --- a/reco/KF/KFQA/CbmKFTrackFitQa.h +++ b/reco/KF/KFQA/CbmKFTrackFitQa.h @@ -24,9 +24,7 @@ #include "CbmStsPoint.h" #include "CbmStsTrack.h" #include "CbmTrackMatch.h" - #include "FairTask.h" - #include "TClonesArray.h" #include "TH1.h" #include "TProfile.h" @@ -35,7 +33,7 @@ #include <vector> class CbmKFTrackFitQa : public FairTask { -public: + public: CbmKFTrackFitQa(); ~CbmKFTrackFitQa(); @@ -55,7 +53,7 @@ public: void Exec(Option_t* option); void Finish(); -private: + private: // Arrays of points, tracks, etc TClonesArray* listStsPts; @@ -127,7 +125,7 @@ private: ClassDef(CbmKFTrackFitQa, 1); -private: + private: CbmKFTrackFitQa(const CbmKFTrackFitQa&); void operator=(const CbmKFTrackFitQa&); }; diff --git a/reco/KF/KFQA/CbmKFTrackQa.cxx b/reco/KF/KFQA/CbmKFTrackQa.cxx index 5a3b4e2da416cc5bfa7392591eabe512ea2bb033..fb55d21039df90f3bed0f49d189cbae06e532818 100644 --- a/reco/KF/KFQA/CbmKFTrackQa.cxx +++ b/reco/KF/KFQA/CbmKFTrackQa.cxx @@ -11,14 +11,12 @@ #include "CbmMCTrack.h" #include "CbmTrack.h" #include "CbmTrackMatchNew.h" - #include "FairRunAna.h" //KF Particle headers +#include "CaField.h" #include "CbmKFVertex.h" #include "CbmL1PFFitter.h" - -#include "CaField.h" #include "KFMCTrack.h" #include "KFParticleMatch.h" #include "KFParticleTopoReconstructor.h" @@ -49,11 +47,10 @@ #include "CbmTrdHit.h" #include "CbmTrdTrack.h" +#include <cmath> #include <iomanip> #include <iostream> -#include <cmath> - using std::map; using std::vector; @@ -95,7 +92,8 @@ CbmKFTrackQa::CbmKFTrackQa(const char* name, Int_t iVerbose, TString outFileName TFile* curFile = gFile; TDirectory* curDirectory = gDirectory; - if (!(fOutFileName == "")) fOutFile = new TFile(fOutFileName.Data(), "RECREATE"); + if (!(fOutFileName == "")) + fOutFile = new TFile(fOutFileName.Data(), "RECREATE"); else fOutFile = gFile; @@ -342,18 +340,26 @@ InitStatus CbmKFTrackQa::Init() //Much track match fMuchTrackMatchArray = (TClonesArray*) ioman->GetObject(fMuchTrackMatchBranchName); - if (fMuchTrackMatchArray == nullptr) { Warning("CbmKFTrackQa::Init", "Much track match array not found!"); } + if (fMuchTrackMatchArray == nullptr) { + Warning("CbmKFTrackQa::Init", "Much track match array not found!"); + } //Much fMuchTrackArray = (TClonesArray*) ioman->GetObject(fMuchTrackBranchName); - if (fMuchTrackArray == nullptr) { Warning("CbmKFTrackQa::Init", "Much track-array not found!"); } + if (fMuchTrackArray == nullptr) { + Warning("CbmKFTrackQa::Init", "Much track-array not found!"); + } // mc data manager CbmMCDataManager* mcManager = (CbmMCDataManager*) ioman->GetObject("MCDataManager"); - if (mcManager == nullptr) { Warning("CbmKFTrackQa::Init", "mc manager not found!"); } + if (mcManager == nullptr) { + Warning("CbmKFTrackQa::Init", "mc manager not found!"); + } // Tof points fTofPoints = (CbmMCDataArray*) mcManager->InitBranch("TofPoint"); - if (fTofPoints == nullptr) { Warning("CbmKFTrackQa::Init", "tof points not found!"); } + if (fTofPoints == nullptr) { + Warning("CbmKFTrackQa::Init", "tof points not found!"); + } return kSUCCESS; } @@ -523,7 +529,8 @@ void CbmKFTrackQa::Exec(Option_t* /*opt*/) } } - if (fGlobalTrackArray == nullptr) Warning("KF Track QA", "No GlobalTrack array!"); + if (fGlobalTrackArray == nullptr) + Warning("KF Track QA", "No GlobalTrack array!"); else { for (Int_t igt = 0; igt < fGlobalTrackArray->GetEntriesFast(); igt++) { const CbmGlobalTrack* globalTrack = static_cast<const CbmGlobalTrack*>(fGlobalTrackArray->At(igt)); @@ -623,7 +630,8 @@ void CbmKFTrackQa::Exec(Option_t* /*opt*/) hRichRingHisto2D[0][2]->Fill(p, axisB); int iTrackCategory = -1; - if (stsTrackMCIndex < 0) iTrackCategory = 8; // ghost sts track + any ring + if (stsTrackMCIndex < 0) + iTrackCategory = 8; // ghost sts track + any ring else if (richTrackMCIndex < 0) iTrackCategory = 9; // normal sts track + ghost ring else if (stsTrackMCIndex != richTrackMCIndex) @@ -690,7 +698,8 @@ void CbmKFTrackQa::Exec(Option_t* /*opt*/) if (trdTrack->GetNofHits() > 0.) eloss = eloss / trdTrack->GetNofHits(); // average of dE/dx per station int iTrackCategory = -1; - if (stsTrackMCIndex < 0) iTrackCategory = 8; // ghost sts track + any trd track + if (stsTrackMCIndex < 0) + iTrackCategory = 8; // ghost sts track + any trd track else if (trdTrackMCIndex < 0) iTrackCategory = 9; // normal sts track + ghost trd track else if (stsTrackMCIndex != trdTrackMCIndex) @@ -717,13 +726,17 @@ void CbmKFTrackQa::Exec(Option_t* /*opt*/) // ( the use of "do{ .. } while(0);" let us exit the scope with the "break" operator. // it makes the code lighter. ) - if (!fTofHitArray || !fTofHitMatchArray) { break; } + if (!fTofHitArray || !fTofHitMatchArray) { + break; + } Int_t tofIndex = globalTrack->GetTofHitIndex(); // for tof histo Int_t stsIndex = globalTrack->GetStsTrackIndex(); // std::cout << "tofIndex: " << tofIndex << " stsIndex: " << stsIndex << std::endl; - if (stsIndex < 0) { break; } + if (stsIndex < 0) { + break; + } // check Sts -> Tof matching efficiency @@ -740,7 +753,9 @@ void CbmKFTrackQa::Exec(Option_t* /*opt*/) } } - if (stsTrackMCIndex < 0) { isReconstructible = 0; } + if (stsTrackMCIndex < 0) { + isReconstructible = 0; + } if (isReconstructible) { bool reconstructed = 0; @@ -770,7 +785,9 @@ void CbmKFTrackQa::Exec(Option_t* /*opt*/) hTofProfiles[iTrackCategory][2]->Fill(p, !matched); } - if (tofIndex < 0) { break; } + if (tofIndex < 0) { + break; + } CbmTofHit* tofHit = (CbmTofHit*) fTofHitArray->At(tofIndex); CbmMatch* tofHitMatch = (CbmMatch*) fTofHitMatchArray->At(tofIndex); @@ -779,7 +796,9 @@ void CbmKFTrackQa::Exec(Option_t* /*opt*/) // a valid mc link is needed to get the event time - if (tofLink.GetFile() < 0 || tofLink.GetEntry() < 0) { break; } + if (tofLink.GetFile() < 0 || tofLink.GetEntry() < 0) { + break; + } double eventTime = fMcEventList->GetEventTime(tofLink); @@ -794,7 +813,9 @@ void CbmKFTrackQa::Exec(Option_t* /*opt*/) hTofHisto2D[0][0]->Fill(p * q, m2); hTofHisto2D[0][1]->Fill(eloss * 1e6, m2); - if (!tofHit || !tofHitMatch || !stsMatch) { break; } + if (!tofHit || !tofHitMatch || !stsMatch) { + break; + } CbmTofPoint* tofPoint = (CbmTofPoint*) fTofPoints->Get(tofLink); Int_t tofMCTrackId = tofPoint->GetTrackID(); @@ -807,7 +828,8 @@ void CbmKFTrackQa::Exec(Option_t* /*opt*/) // std::cout << " mcl: " << tofMCl << " mc time: " << tofMCTime << " mc beta: " << tofMCl/tofMCTime/29.9792458 << std::endl; int iHitCategory = -1; - if (stsTrackMCIndex < 0) iHitCategory = 8; // ghost sts track + any tof hit + if (stsTrackMCIndex < 0) + iHitCategory = 8; // ghost sts track + any tof hit else if (tofMCTrackId < 0) iHitCategory = 9; // normal sts track + ghost tof hit else if (stsTrackMCIndex != tofMCTrackId) @@ -843,7 +865,8 @@ void CbmKFTrackQa::WriteHistosCurFile(TObject* obj) { - if (!obj->IsFolder()) obj->Write(); + if (!obj->IsFolder()) + obj->Write(); else { TDirectory* cur = gDirectory; TFile* currentFile = gFile; @@ -864,7 +887,8 @@ int CbmKFTrackQa::GetHistoIndex(int pdg) { map<int, int>::iterator it; it = fPDGtoIndexMap.find(TMath::Abs(pdg)); - if (it != fPDGtoIndexMap.end()) return it->second; + if (it != fPDGtoIndexMap.end()) + return it->second; else return 6; } diff --git a/reco/KF/KFQA/CbmKFTrackQa.h b/reco/KF/KFQA/CbmKFTrackQa.h index b580f307f8f8680e57d773e0312a0a198d71c583..ff56433454631b8854760183a3c769d5af8406e5 100644 --- a/reco/KF/KFQA/CbmKFTrackQa.h +++ b/reco/KF/KFQA/CbmKFTrackQa.h @@ -9,7 +9,6 @@ #define CbmKFTrackQa_HH #include "FairTask.h" - #include "TString.h" #include <map> @@ -28,7 +27,7 @@ class CbmMCDataArray; class CbmMCEventList; class CbmKFTrackQa : public FairTask { -public: + public: // Constructors/Destructors --------- CbmKFTrackQa(const char* name = "CbmKFTrackQa", Int_t iVerbose = 0, TString outFileName = "CbmKFTrackQa.root"); ~CbmKFTrackQa(); @@ -49,7 +48,7 @@ public: virtual void Exec(Option_t* opt); virtual void Finish(); -private: + private: const CbmKFTrackQa& operator=(const CbmKFTrackQa&); CbmKFTrackQa(const CbmKFTrackQa&); diff --git a/reco/KF/KFQA/KFParticleMatch.h b/reco/KF/KFQA/KFParticleMatch.h index b56e9bb1501ddd8d25989040dc3590a7a92b201e..fc5e4602dd7aec8a1c69a5c5f7259a76793e42c4 100644 --- a/reco/KF/KFQA/KFParticleMatch.h +++ b/reco/KF/KFQA/KFParticleMatch.h @@ -15,7 +15,7 @@ #include <vector> class KFParticleMatch : public TObject { -public: + public: KFParticleMatch(); ~KFParticleMatch(); @@ -28,7 +28,7 @@ public: Bool_t IsPhysicsBG() const { return (fMatchType == 1); } Bool_t IsRecoParticle() const { return (fMatchType == 2); } -private: + private: Int_t fMatch; Short_t fMatchType; // 0 - combinatorial BG, 1 - physics BG, 2 - reconstructed particle @@ -38,13 +38,14 @@ private: struct KFMatchParticles // used for Reco to MC match as well as for MC to Reco { - KFMatchParticles() : ids(), idsMI() {}; + KFMatchParticles() : ids(), idsMI(){}; bool IsMatched() const { return ids.size() != 0 || idsMI.size() != 0; }; bool IsMatchedWithPdg() const { return ids.size() != 0; }; int GetBestMatch() const { - if (ids.size() != 0) return ids[0]; + if (ids.size() != 0) + return ids[0]; else if (idsMI.size() != 0) return idsMI[0]; else @@ -52,7 +53,8 @@ struct KFMatchParticles // used for Reco to MC match as well as for MC to Reco }; int GetBestMatchWithPdg() const { - if (ids.size() != 0) return ids[0]; + if (ids.size() != 0) + return ids[0]; else return -1; }; diff --git a/reco/KF/ParticleFitter/CbmL1PFFitter.cxx b/reco/KF/ParticleFitter/CbmL1PFFitter.cxx index 1b8b6c60b9ac51197e3d9385790dc73d9e743e16..0b4261879459eb90c36f2cfeccc2582e895cc366 100644 --- a/reco/KF/ParticleFitter/CbmL1PFFitter.cxx +++ b/reco/KF/ParticleFitter/CbmL1PFFitter.cxx @@ -24,16 +24,9 @@ #include "CbmStsHit.h" #include "CbmStsSetup.h" #include "CbmStsTrack.h" - #include "TClonesArray.h" //ca::Framework tools -#include "CbmKFVertex.h" - -#include "FairRootManager.h" - -#include "TDatabasePDG.h" - #include "CaField.h" #include "CaFramework.h" #include "CaSimd.h" @@ -41,7 +34,10 @@ #include "CaToolsField.h" #include "CaTrackFit.h" #include "CaTrackParam.h" +#include "CbmKFVertex.h" +#include "FairRootManager.h" #include "KFParticleDatabase.h" +#include "TDatabasePDG.h" using namespace cbm::algo::ca; @@ -112,16 +108,24 @@ inline void CbmL1PFFitter::Initialize() FairRootManager* manager = FairRootManager::Instance(); - if (!manager) { LOG(fatal) << "CbmL1PFFitter: no FairRootManager"; } + if (!manager) { + LOG(fatal) << "CbmL1PFFitter: no FairRootManager"; + } - if (!CbmL1::Instance() || !CbmL1::Instance()->fpAlgo) { LOG(fatal) << "CbmL1PFFitter: no CbmL1 task initialised "; } + if (!CbmL1::Instance() || !CbmL1::Instance()->fpAlgo) { + LOG(fatal) << "CbmL1PFFitter: no CbmL1 task initialised "; + } using cbm::algo::ca::EDetectorID; fNmvdStationsActive = CbmL1::Instance()->fpAlgo->GetParameters().GetNstationsActive(EDetectorID::kMvd); fNstsStationsActive = CbmL1::Instance()->fpAlgo->GetParameters().GetNstationsActive(EDetectorID::kSts); - if (fNmvdStationsActive > 0) { fMvdHitArray = static_cast<TClonesArray*>(manager->GetObject("MvdHit")); } - if (fNstsStationsActive > 0) { fStsHitArray = static_cast<TClonesArray*>(manager->GetObject("StsHit")); } + if (fNmvdStationsActive > 0) { + fMvdHitArray = static_cast<TClonesArray*>(manager->GetObject("MvdHit")); + } + if (fNstsStationsActive > 0) { + fStsHitArray = static_cast<TClonesArray*>(manager->GetObject("StsHit")); + } cbm::ca::tools::SetOriginalCbmField(); @@ -173,7 +177,7 @@ void CbmL1PFFitter::Fit(std::vector<CbmStsTrack>& Tracks, const std::vector<CbmM TrackParamV& T = fit.Tr(); // fitting parametr coresponding to current track - CbmStsTrack* tr[fvec::size()] {nullptr}; + CbmStsTrack* tr[fvec::size()]{nullptr}; int ista; const ca::Station* sta = CbmL1::Instance()->fpAlgo->GetParameters().GetStations().begin(); @@ -490,7 +494,7 @@ void CbmL1PFFitter::GetChiToVertex(vector<CbmStsTrack>& Tracks, vector<PFFieldRe ca::TrackFit fit; TrackParamV& T = fit.Tr(); // fitting parametr coresponding to current track - CbmStsTrack* tr[fvec::size()] {nullptr}; + CbmStsTrack* tr[fvec::size()]{nullptr}; int nStations = fNmvdStationsActive + fNstsStationsActive; @@ -509,7 +513,9 @@ void CbmL1PFFitter::GetChiToVertex(vector<CbmStsTrack>& Tracks, vector<PFFieldRe unsigned short N_vTracks = Tracks.size(); int ista; for (unsigned short itrack = 0; itrack < N_vTracks; itrack += fvec::size()) { - if (N_vTracks - itrack < static_cast<unsigned short>(fvec::size())) { nTracks_SIMD = N_vTracks - itrack; } + if (N_vTracks - itrack < static_cast<unsigned short>(fvec::size())) { + nTracks_SIMD = N_vTracks - itrack; + } fvec mass2; for (int iVec = 0; iVec < nTracks_SIMD; iVec++) { diff --git a/reco/KF/ParticleFitter/CbmL1PFFitter.h b/reco/KF/ParticleFitter/CbmL1PFFitter.h index 784cfa5df3591a35b63afd7679b10a191861a92a..94617f8e29bff2f422733fb8c0c2fb625e8f6900 100644 --- a/reco/KF/ParticleFitter/CbmL1PFFitter.h +++ b/reco/KF/ParticleFitter/CbmL1PFFitter.h @@ -36,7 +36,7 @@ class CbmKFVertex; class TClonesArray; class CbmL1PFFitter { -public: + public: // A container for parameters of ca::FieldRegion struct PFFieldRegion { PFFieldRegion() {} @@ -44,7 +44,7 @@ public: void setFromL1FieldRegion(const ca::FieldRegion&, int i); void getL1FieldRegion(ca::FieldRegion&, int i); - float fP[10] {0.}; + float fP[10]{0.}; }; CbmL1PFFitter(); @@ -59,16 +59,16 @@ public: void GetChiToVertex(std::vector<CbmStsTrack>& Tracks, std::vector<PFFieldRegion>& field, std::vector<float>& chiToVtx, CbmKFVertex& primVtx, float chiPrim = -1); -private: + private: void Initialize(); int GetMvdStationIndex(const CbmMvdHit* h); int GetStsStationIndex(const CbmStsHit* h); -private: - bool fIsInitialised = {false}; // is the fitter initialised - int fNmvdStationsActive = {0}; // n MVD stations - int fNstsStationsActive = {0}; // n STS stations - TClonesArray* fMvdHitArray {nullptr}; // pointer to MVD hits - TClonesArray* fStsHitArray {nullptr}; // pointer to STS hits + private: + bool fIsInitialised = {false}; // is the fitter initialised + int fNmvdStationsActive = {0}; // n MVD stations + int fNstsStationsActive = {0}; // n STS stations + TClonesArray* fMvdHitArray{nullptr}; // pointer to MVD hits + TClonesArray* fStsHitArray{nullptr}; // pointer to STS hits }; #endif diff --git a/reco/KF/obsolete/CbmL1CATrdTrackFinderSA.cxx b/reco/KF/obsolete/CbmL1CATrdTrackFinderSA.cxx index 1906f891d81ec994cbedd752427db8eed27a44f2..e23fb2fb58cdbbd9c5ef473146e2833bcbc21f0a 100644 --- a/reco/KF/obsolete/CbmL1CATrdTrackFinderSA.cxx +++ b/reco/KF/obsolete/CbmL1CATrdTrackFinderSA.cxx @@ -23,7 +23,6 @@ #include "CbmTrdTrack.h" #include "CbmTrdTrackFitterKF.h" #include "CbmVertex.h" - #include "FairBaseParSet.h" #include "FairDetector.h" #include "FairGeoNode.h" @@ -31,21 +30,18 @@ #include "FairRootManager.h" #include "FairRunAna.h" #include "FairRuntimeDb.h" - +#include "L1Def.h" #include "TClonesArray.h" #include "TH1F.h" #include "TH2F.h" #include "TLinearFitter.h" +#include <cmath> #include <iostream> #include <list> #include <map> #include <vector> -#include <cmath> - -#include "L1Def.h" - using std::cout; using std::endl; using std::fabs; @@ -1610,7 +1606,9 @@ void CbmL1CATrdTrackFinderSA::FindNeighbour(vector<CbmL1TrdTracklet4*>& v1, vect Mid = (Left + Right) / 2; mesY = v2[Mid]->GetCoord(0); - if (amaxY < mesY) { Left = Mid + 1; } + if (amaxY < mesY) { + Left = Mid + 1; + } else { Right = Mid - 1; } @@ -2201,7 +2199,9 @@ void CbmL1CATrdTrackFinderSA::CreateSegments(vector<CbmL1TrdTracklet*> clSpacePo //--- end: for estimation dx and dy ------------------------------- */ - if (trRight->GetCoord(0) > y2 + dY) { continue; } + if (trRight->GetCoord(0) > y2 + dY) { + continue; + } else { if (bFirst) { bFirst = false; @@ -2393,7 +2393,9 @@ void CbmL1CATrdTrackFinderSA::CreateSpacePoints(vector<LayerWithHits> vTrdHitArr B_planeID = (*itB).planeID; B_mcTrID = (*itB).mcTrackID; - if (B_Y + sigmaB * B_DY < A_Y - sigmaA * A_DY) { continue; } + if (B_Y + sigmaB * B_DY < A_Y - sigmaA * A_DY) { + continue; + } else { /* Finding the bottom level to begin the second loop. The value of bottom level is taken from previous "second loop".*/ diff --git a/reco/KF/obsolete/CbmL1CATrdTrackFinderSA.h b/reco/KF/obsolete/CbmL1CATrdTrackFinderSA.h index 416e07a2f5eae02720cef9b082d6192b51581a92..15f0909f1ac59919c9924107f8e9e7817096f007 100644 --- a/reco/KF/obsolete/CbmL1CATrdTrackFinderSA.h +++ b/reco/KF/obsolete/CbmL1CATrdTrackFinderSA.h @@ -18,7 +18,6 @@ #include "CbmTrdTrack.h" #include "CbmTrdTrackFinder.h" - #include "TStopwatch.h" #include <map> @@ -37,11 +36,11 @@ class CbmL1TrdTracklet; class CbmL1TrdTracklet4; class CbmL1CATrdTrackFinderSA : public CbmTrdTrackFinder { -private: + private: CbmL1CATrdTrackFinderSA(const CbmL1CATrdTrackFinderSA&); CbmL1CATrdTrackFinderSA operator=(const CbmL1CATrdTrackFinderSA&); -public: + public: /** Default constructor **/ CbmL1CATrdTrackFinderSA(); @@ -95,7 +94,7 @@ public: TClonesArray* fArrayTrdHit; TClonesArray* fArrayTrdTrack; -private: + private: CbmGeoTrdPar* TrdPar; /** Event counter **/ @@ -124,7 +123,7 @@ private: /** Structure contains temporary values of track candidates **/ struct TempTrackStruct { - TempTrackStruct() : Chi2(0) {}; + TempTrackStruct() : Chi2(0){}; Double_t Chi2; Int_t M[12]; } tempTrack; @@ -213,7 +212,7 @@ private: /** Determine detector layout **/ void TrdLayout(); -public: + public: /** Write histogramms **/ void WriteHistogramms(); diff --git a/reco/KF/obsolete/CbmL1TofMerger.cxx b/reco/KF/obsolete/CbmL1TofMerger.cxx index efe8bc86282e890c19202cee1e7bd55ccd9c1ad1..3f6343db2af2dca375dc462d2a4aeb7f44b82f74 100644 --- a/reco/KF/obsolete/CbmL1TofMerger.cxx +++ b/reco/KF/obsolete/CbmL1TofMerger.cxx @@ -12,9 +12,7 @@ #include "CbmKFTrack.h" #include "CbmTofHit.h" #include "CbmTrdTrack.h" - #include "FairRootManager.h" - #include "TClonesArray.h" #include "TMath.h" diff --git a/reco/KF/obsolete/CbmL1TofMerger.h b/reco/KF/obsolete/CbmL1TofMerger.h index 7b4c32c13254c6a7c40fa0f9310ae1ac00dbb1cd..306bc09bbb7c20ae9609f543e9be34be60a38081 100644 --- a/reco/KF/obsolete/CbmL1TofMerger.h +++ b/reco/KF/obsolete/CbmL1TofMerger.h @@ -18,17 +18,17 @@ class FairTrackParam; class CbmL1TofMerger : public CbmTofMerger { -private: + private: CbmL1TofMerger(const CbmL1TofMerger&); // CHECKME CbmL1TofMerger operator=(const CbmL1TofMerger&); -private: + private: TClonesArray* fArrayTrdTrack; // Array of TRD tracks Bool_t Overlap(CbmKFTrack& track, const CbmTofHit* tofHit); Double_t GetChi2ToHit(CbmKFTrack& track, const CbmTofHit* tofHit); -public: + public: CbmL1TofMerger(); CbmL1TofMerger(Int_t verbose); ~CbmL1TofMerger(); diff --git a/reco/KF/obsolete/CbmL1TrackMerger.cxx b/reco/KF/obsolete/CbmL1TrackMerger.cxx index 69d3bccdef930bc26aa3c73111f95425205d3f96..35b1331f6e06012908b351762cff6516c6565f6b 100644 --- a/reco/KF/obsolete/CbmL1TrackMerger.cxx +++ b/reco/KF/obsolete/CbmL1TrackMerger.cxx @@ -13,9 +13,7 @@ #include "CbmStsTrack.h" #include "CbmTrackMatch.h" #include "CbmTrdTrack.h" - #include "FairRootManager.h" - #include "TClonesArray.h" #include "TH2F.h" #include "TMath.h" @@ -139,7 +137,9 @@ void CbmL1TrackMerger::Init() Int_t CbmL1TrackMerger::DoMerge(TClonesArray* stsTracks, TClonesArray* trdTracks, TClonesArray* glbTracks) { // Implementation of the merging algorithm - if (1 == fMethod) { return MergeSimple(stsTracks, trdTracks, glbTracks); } + if (1 == fMethod) { + return MergeSimple(stsTracks, trdTracks, glbTracks); + } else if (2 == fMethod) { return MergeImPlane(stsTracks, trdTracks, glbTracks); } @@ -274,13 +274,17 @@ Int_t CbmL1TrackMerger::MergeImPlane(TClonesArray* stsTracks, TClonesArray* trdT dtx = tx - trdTrack->GetParamFirst()->GetTx(); dty = ty - trdTrack->GetParamFirst()->GetTy(); theta = 180. / TMath::Pi() * TMath::ACos(1. / TMath::Sqrt(1 + tx * tx + ty * ty)); - if (stsTrackM->GetMCTrackId() == trdTrackM->GetMCTrackId()) { fh_dx_true->Fill(dx, theta); } + if (stsTrackM->GetMCTrackId() == trdTrackM->GetMCTrackId()) { + fh_dx_true->Fill(dx, theta); + } else { fh_dx_false->Fill(dx, theta); } // Cut on dx - if (theta < 5) { dx_cut = 1; } + if (theta < 5) { + dx_cut = 1; + } else if (theta < 10) { dx_cut = 4; } @@ -307,13 +311,17 @@ Int_t CbmL1TrackMerger::MergeImPlane(TClonesArray* stsTracks, TClonesArray* trdT } if (TMath::Abs(dx) > dx_cut) continue; // Fill histogramms - if (stsTrackM->GetMCTrackId() == trdTrackM->GetMCTrackId()) { fh_dy_true->Fill(dy, theta); } + if (stsTrackM->GetMCTrackId() == trdTrackM->GetMCTrackId()) { + fh_dy_true->Fill(dy, theta); + } else { fh_dy_false->Fill(dy, theta); } // Cut on dy - if (theta < 5) { dy_cut = 1; } + if (theta < 5) { + dy_cut = 1; + } else if (theta < 10) { dy_cut = 2; } @@ -337,13 +345,17 @@ Int_t CbmL1TrackMerger::MergeImPlane(TClonesArray* stsTracks, TClonesArray* trdT } if (TMath::Abs(dy) > dy_cut) continue; // Fill histogramms - if (stsTrackM->GetMCTrackId() == trdTrackM->GetMCTrackId()) { fh_dtx_true->Fill(dtx, theta); } + if (stsTrackM->GetMCTrackId() == trdTrackM->GetMCTrackId()) { + fh_dtx_true->Fill(dtx, theta); + } else { fh_dtx_false->Fill(dtx, theta); } // Cut on dtx - if (theta < 10) { dtx_cut = 0.001; } + if (theta < 10) { + dtx_cut = 0.001; + } else if (theta < 15) { dtx_cut = 0.002; } @@ -365,7 +377,9 @@ Int_t CbmL1TrackMerger::MergeImPlane(TClonesArray* stsTracks, TClonesArray* trdT dtx_cut *= 10; if (TMath::Abs(dtx) > dtx_cut) continue; // Fill histogramms - if (stsTrackM->GetMCTrackId() == trdTrackM->GetMCTrackId()) { fh_dty_true->Fill(dty, theta); } + if (stsTrackM->GetMCTrackId() == trdTrackM->GetMCTrackId()) { + fh_dty_true->Fill(dty, theta); + } else { fh_dty_false->Fill(dty, theta); } diff --git a/reco/KF/obsolete/CbmL1TrackMerger.h b/reco/KF/obsolete/CbmL1TrackMerger.h index da0cf3ca59e1365d619ba53dd0bad4fb7e2defe5..ec42c914da73af9e534c809fe2fd4a874f72a626 100644 --- a/reco/KF/obsolete/CbmL1TrackMerger.h +++ b/reco/KF/obsolete/CbmL1TrackMerger.h @@ -18,11 +18,11 @@ class TH2F; class CbmL1TrackMerger : public CbmTrackMerger { -private: + private: CbmL1TrackMerger(const CbmL1TrackMerger&); // CHECKME CbmL1TrackMerger operator=(const CbmL1TrackMerger&); -private: + private: Int_t fMethod; // Merging method: 1 - based on StsTrackIndex from TRD track // 2 - merging of tracks at the first TClonesArray* fArrayStsTrackM; // Array of STS track matches @@ -41,7 +41,7 @@ private: Int_t MergeSimple(TClonesArray* stsTracks, TClonesArray* trdTracks, TClonesArray* glbTracks); Int_t MergeImPlane(TClonesArray* stsTracks, TClonesArray* trdTracks, TClonesArray* glbTracks); -public: + public: CbmL1TrackMerger(); CbmL1TrackMerger(Int_t verbose); virtual ~CbmL1TrackMerger(); diff --git a/reco/KF/obsolete/CbmL1TrdTrackFinderSts.cxx b/reco/KF/obsolete/CbmL1TrdTrackFinderSts.cxx index 2c40c4b6f06eb2bcb30b228a564f3a74079fcbfc..5ded92782845224b34af76e84d59b664a05d2b39 100644 --- a/reco/KF/obsolete/CbmL1TrdTrackFinderSts.cxx +++ b/reco/KF/obsolete/CbmL1TrdTrackFinderSts.cxx @@ -16,13 +16,12 @@ #include "CbmTrdHit.h" #include "CbmTrdPoint.h" #include "CbmTrdTrack.h" - #include "FairBaseParSet.h" #include "FairDetector.h" #include "FairRootManager.h" #include "FairRunAna.h" #include "FairRuntimeDb.h" - +#include "L1Def.h" #include "TArc.h" #include "TCanvas.h" #include "TClonesArray.h" @@ -36,8 +35,6 @@ #include <map> #include <vector> -#include "L1Def.h" - using std::cout; using std::endl; using std::map; @@ -201,7 +198,9 @@ void CbmL1TrdTrackFinderSts::Init() Int_t CbmL1TrdTrackFinderSts::DoFind(TClonesArray* hitArray, TClonesArray* trackArray) { // Implementation of the track finding algorithm - if (NULL == hitArray) { return 0; } + if (NULL == hitArray) { + return 0; + } fArrayTrdHit = hitArray; fArrayTrdTrack = trackArray; @@ -333,7 +332,9 @@ void CbmL1TrdTrackFinderSts::Sts2Trd(Double_t pmin, Double_t pmax, Double_t chi2 // Add it to the array fvTrdTrack.push_back(trdTrack); // Control output - if (fVerbose > 1) { cout << "TRD track created from STS track " << iStsTrack << endl; } + if (fVerbose > 1) { + cout << "TRD track created from STS track " << iStsTrack << endl; + } } // sort(fvTrdTrack.begin(), fvTrdTrack.end(), CbmTrdTrack::CompareMomentum); } @@ -357,7 +358,9 @@ void CbmL1TrdTrackFinderSts::ProcessAllStations() itr++; } Clear(); - if (fVerbose > 0) { cout << "track candidates: " << fvTrdTrack.size() << "." << endl; } + if (fVerbose > 0) { + cout << "track candidates: " << fvTrdTrack.size() << "." << endl; + } } } // ----------------------------------------------------------------------- @@ -412,14 +415,18 @@ void CbmL1TrdTrackFinderSts::ProcessStation(CbmTrdTrack* pTrack, const Int_t& st TVector3 pos; Int_t stsTrackIndex = pTrack->GetPreviousTrackId(); - if (stsTrackIndex < 0) { Fatal("ProcessStation", "Invalid track index"); } + if (stsTrackIndex < 0) { + Fatal("ProcessStation", "Invalid track index"); + } CbmTrackMatch* stsM = L1_DYNAMIC_CAST<CbmTrackMatch*>(fArrayStsTrackM->At(stsTrackIndex)); Int_t trackID = stsM->GetMCTrackId(); // Loop over layers in this station for (Int_t iLayer = 0; iLayer < fNoTrdPerStation; iLayer++) { - if (pTrack->GetFlag()) { return; } + if (pTrack->GetFlag()) { + return; + } // Plane number plane = station * fNoTrdPerStation + iLayer; // Skip if no TRD hits @@ -448,10 +455,12 @@ void CbmL1TrdTrackFinderSts::ProcessStation(CbmTrdTrack* pTrack, const Int_t& st Double_t c1 = kfTrack.GetCovMatrix()[0]; Double_t c2 = kfTrack.GetCovMatrix()[2]; - if (finite(c1) && c1 > 1.e-10) c1 = (T[0] - pos.X()) / TMath::Sqrt(c1); + if (finite(c1) && c1 > 1.e-10) + c1 = (T[0] - pos.X()) / TMath::Sqrt(c1); else c1 = 100; - if (finite(c2) && c2 > 1.e-10) c2 = (T[1] - pos.Y()) / TMath::Sqrt(c2); + if (finite(c2) && c2 > 1.e-10) + c2 = (T[1] - pos.Y()) / TMath::Sqrt(c2); else c2 = 0; @@ -508,7 +517,9 @@ void CbmL1TrdTrackFinderSts::ProcessStation(CbmTrdTrack* pTrack, const Int_t& st } // Loop over TRD hits // Add hit to the track - if (indexOfClosest != -1) { pTrack->AddHit(indexOfClosest, kTRDHIT); } + if (indexOfClosest != -1) { + pTrack->AddHit(indexOfClosest, kTRDHIT); + } else { pTrack->SetFlag(1); } @@ -616,13 +627,19 @@ void CbmL1TrdTrackFinderSts::RemoveFakes() // Get hit index hitIndex = track->GetHitIndex(iHit); // Check flag - if (fmapHitUsed[hitIndex]) { n_false += 1; } + if (fmapHitUsed[hitIndex]) { + n_false += 1; + } } // Loop over hits // if((Double_t)n_false/(Double_t)nHits > 0.3) { - if (n_false > 0) { track->SetFlag(1); } + if (n_false > 0) { + track->SetFlag(1); + } - if (mapStsTrackUsed[track->GetPreviousTrackId()]) { track->SetFlag(1); } + if (mapStsTrackUsed[track->GetPreviousTrackId()]) { + track->SetFlag(1); + } // Skip the fake tracks if (track->GetFlag()) { @@ -649,8 +666,12 @@ void CbmL1TrdTrackFinderSts::RemoveFakes() Bool_t CbmL1TrdTrackFinderSts::Overlap(CbmKFTrack& track, CbmTrdHit* pHit) { // Check for geometrical overlap between track extrapolation and hit - if (track.GetCovMatrix()[0] > 100) { return kFALSE; } - if (track.GetCovMatrix()[2] > 100) { return kFALSE; } + if (track.GetCovMatrix()[0] > 100) { + return kFALSE; + } + if (track.GetCovMatrix()[2] > 100) { + return kFALSE; + } Bool_t overlap; if (pHit->GetDx() < 1e-9 && pHit->GetDy() < 1e-9) { diff --git a/reco/KF/obsolete/CbmL1TrdTrackFinderSts.h b/reco/KF/obsolete/CbmL1TrdTrackFinderSts.h index 71cdc7eb5e9a65f46f1d8cb357708120ae45e058..e49530fb9fb744ba1a5aea738cced9fc78779545 100644 --- a/reco/KF/obsolete/CbmL1TrdTrackFinderSts.h +++ b/reco/KF/obsolete/CbmL1TrdTrackFinderSts.h @@ -24,11 +24,11 @@ class TH2F; class CbmL1TrdTrackFinderSts : public CbmTrdTrackFinder { -private: + private: CbmL1TrdTrackFinderSts(const CbmL1TrdTrackFinderSts&); CbmL1TrdTrackFinderSts operator=(const CbmL1TrdTrackFinderSts&); -private: + private: Int_t fEvents; // Number of events processed Int_t fVerbose; // Verbosity level TClonesArray* fArrayTrdPoint; // Array of TRD points @@ -73,7 +73,7 @@ private: Bool_t Overlap(CbmKFTrack& track, CbmTrdHit* pHit); Double_t GetChi2Hit(CbmKFTrack& track, CbmTrdHit* pHit); -public: + public: CbmL1TrdTrackFinderSts(); CbmL1TrdTrackFinderSts(Int_t verbose); virtual ~CbmL1TrdTrackFinderSts(); diff --git a/reco/KF/obsolete/CbmL1TrdTracklet.cxx b/reco/KF/obsolete/CbmL1TrdTracklet.cxx index 37712b966fdd68860b9163c1524b4455f08c1624..a66246aae1879e48a84470c4e2dc9aba40e0ddb6 100644 --- a/reco/KF/obsolete/CbmL1TrdTracklet.cxx +++ b/reco/KF/obsolete/CbmL1TrdTracklet.cxx @@ -14,7 +14,7 @@ CbmL1TrdTracklet::CbmL1TrdTracklet() , fVal(0) , fY(0) , fIsAlone(0) - , fIndex(0) {}; + , fIndex(0){}; // ----------------------- Default destructor --------------------------- -CbmL1TrdTracklet::~CbmL1TrdTracklet() {}; +CbmL1TrdTracklet::~CbmL1TrdTracklet(){}; diff --git a/reco/KF/obsolete/CbmL1TrdTracklet.h b/reco/KF/obsolete/CbmL1TrdTracklet.h index 7c34f637ce8c6992a4e91248b1819ca2cdf4eba3..5904ad83b4d0db5e256bd653c96191332922db1c 100644 --- a/reco/KF/obsolete/CbmL1TrdTracklet.h +++ b/reco/KF/obsolete/CbmL1TrdTracklet.h @@ -11,7 +11,7 @@ class CbmL1TrdTracklet : public TObject { -public: + public: /** Default constructor **/ CbmL1TrdTracklet(); @@ -52,7 +52,7 @@ public: return (tr1->GetCoord(1) > tr2->GetCoord(1)); }; -private: + private: Int_t fID[2]; Int_t fIndLeft; Int_t fIndRight; diff --git a/reco/KF/obsolete/CbmL1TrdTracklet4.cxx b/reco/KF/obsolete/CbmL1TrdTracklet4.cxx index 58931fc7151b9052fd064f90ecbf1aa438fcae30..aa836b941feb309d52ee43f88f6a601254e158fa 100644 --- a/reco/KF/obsolete/CbmL1TrdTracklet4.cxx +++ b/reco/KF/obsolete/CbmL1TrdTracklet4.cxx @@ -16,7 +16,7 @@ CbmL1TrdTracklet4::CbmL1TrdTracklet4() , fIsAlone(0) , fIndex(0) , fExt1(0) - , fExt2(0) {}; + , fExt2(0){}; // ----------------------- Default destructor --------------------------- -CbmL1TrdTracklet4::~CbmL1TrdTracklet4() {}; +CbmL1TrdTracklet4::~CbmL1TrdTracklet4(){}; diff --git a/reco/KF/obsolete/CbmL1TrdTracklet4.h b/reco/KF/obsolete/CbmL1TrdTracklet4.h index 7a2cc7533dedbe3dad69e0aa62fa229fb46b7dd7..62f80be0b789b66d3b16324f9b773c83f6bb495a 100644 --- a/reco/KF/obsolete/CbmL1TrdTracklet4.h +++ b/reco/KF/obsolete/CbmL1TrdTracklet4.h @@ -11,7 +11,7 @@ class CbmL1TrdTracklet4 : public TObject { -public: + public: /** Default constructor **/ CbmL1TrdTracklet4(); @@ -80,7 +80,7 @@ public: //to store 4 Z value Double_t M[4]; -private: + private: //indexes of the four consistuent hits Int_t fInd[4]; diff --git a/reco/L1/CbmCaMCModule.cxx b/reco/L1/CbmCaMCModule.cxx index 71c58aa83fd8d21a46cf9352c643cc8e6e6abd05..cfe5ed794a026af45ee5463475279d5dfd45258f 100644 --- a/reco/L1/CbmCaMCModule.cxx +++ b/reco/L1/CbmCaMCModule.cxx @@ -20,13 +20,11 @@ #include "CbmStsHit.h" #include "CbmTimeSlice.h" #include "CbmTofPoint.h" - #include "FairEventHeader.h" #include "FairMCEventHeader.h" #include "FairRootManager.h" #include "FairRunAna.h" #include "Logger.h" - #include "TDatabasePDG.h" #include "TLorentzVector.h" #include "TVector3.h" @@ -55,7 +53,9 @@ using cbm::ca::tools::MCTrack; bool MCModule::InitRun() try { - if (fVerbose > 0) { LOG(info) << "CA MC Module: initializing CA tracking Monte-Carlo module... "; } + if (fVerbose > 0) { + LOG(info) << "CA MC Module: initializing CA tracking Monte-Carlo module... "; + } // Detector interfaces if (fvbUseDet[ca::EDetectorID::kMvd]) { @@ -94,11 +94,15 @@ try { fFileEventIDs.clear(); auto InitPointBranch = [&](const char* brName, ca::EDetectorID detID) { - if (fvbUseDet[detID]) { fvpBrPoints[detID] = mcManager->InitBranch(brName); } + if (fvbUseDet[detID]) { + fvpBrPoints[detID] = mcManager->InitBranch(brName); + } }; auto InitMatchesBranch = [&](const char* brName, ca::EDetectorID detID) { - if (fvbUseDet[detID]) { fvpBrHitMatches[detID] = dynamic_cast<TClonesArray*>(fairManager->GetObject(brName)); } + if (fvbUseDet[detID]) { + fvpBrHitMatches[detID] = dynamic_cast<TClonesArray*>(fairManager->GetObject(brName)); + } }; InitPointBranch("MvdPoint", ca::EDetectorID::kMvd); @@ -246,7 +250,9 @@ void MCModule::MatchRecoAndMC() this->MatchRecoAndMCTracks(); this->InitTrackInfo(); for (const auto& trkMC : fpMCData->GetTrackContainer()) { - if (trkMC.IsReconstructable()) { fMonitor.IncrementCounter(EMonitorKey::kMcTrackReconstructable); } + if (trkMC.IsReconstructable()) { + fMonitor.IncrementCounter(EMonitorKey::kMcTrackReconstructable); + } } } @@ -263,7 +269,9 @@ void MCModule::MatchRecoAndMCTracks() for (int iH : trkRe.Hits) { auto& vP = (*fpvQaHits)[iH].GetMcPointIds(); for (int iP : vP) { - if (iP < 0) { continue; } + if (iP < 0) { + continue; + } int iTmc = fpMCData->GetPoint(iP).GetTrackId(); mNofHitsVsMCTrkID[iTmc]++; } @@ -280,9 +288,13 @@ void MCModule::MatchRecoAndMCTracks() int iTmc = item.first; int nHitsTrkMc = item.second; - if (iTmc < 0) { continue; } + if (iTmc < 0) { + continue; + } - if (double(nHitsTrkMc) > double(nHitsTrkRe) * maxPurity) { maxPurity = double(nHitsTrkMc) / double(nHitsTrkRe); } + if (double(nHitsTrkMc) > double(nHitsTrkRe) * maxPurity) { + maxPurity = double(nHitsTrkMc) / double(nHitsTrkRe); + } auto& trkMc = fpMCData->GetTrack(iTmc); @@ -311,30 +323,54 @@ void MCModule::MatchRecoAndMCTracks() void MCModule::CheckInit() const { // Check parameters - if (!fpParameters.get()) { throw std::logic_error("Tracking parameters object was not defined"); } + if (!fpParameters.get()) { + throw std::logic_error("Tracking parameters object was not defined"); + } // Check output data containers - if (!fpMCData) { throw std::logic_error("MC data object was not registered"); } - if (!fpvRecoTracks) { throw std::logic_error("Reconstructed track container was not registered"); } - if (!fpvHitIds) { throw std::logic_error("Hit index container was not registered"); } - if (!fpvQaHits) { throw std::logic_error("QA hit container was not registered"); } - if (!fpvFstHitId) { throw std::logic_error("Array of first hit indexes in each detector was not registered"); } + if (!fpMCData) { + throw std::logic_error("MC data object was not registered"); + } + if (!fpvRecoTracks) { + throw std::logic_error("Reconstructed track container was not registered"); + } + if (!fpvHitIds) { + throw std::logic_error("Hit index container was not registered"); + } + if (!fpvQaHits) { + throw std::logic_error("QA hit container was not registered"); + } + if (!fpvFstHitId) { + throw std::logic_error("Array of first hit indexes in each detector was not registered"); + } // Check event list - if (!fbLegacyEventMode && !fpMCEventList) { throw std::logic_error("MC event list was not found"); } - if (!fbLegacyEventMode && !fpTimeSlice) { throw std::logic_error("Time slice was not found"); } + if (!fbLegacyEventMode && !fpMCEventList) { + throw std::logic_error("MC event list was not found"); + } + if (!fbLegacyEventMode && !fpTimeSlice) { + throw std::logic_error("Time slice was not found"); + } // Tracks branch - if (!fpMCTracks) { throw std::logic_error("MC tracks branch is unavailable"); } + if (!fpMCTracks) { + throw std::logic_error("MC tracks branch is unavailable"); + } // Event header - if (!fpMCEventHeader) { throw std::logic_error("MC event header is unavailable"); } + if (!fpMCEventHeader) { + throw std::logic_error("MC event header is unavailable"); + } // Check detectors initialization for (int iD = 0; iD < static_cast<int>(ca::EDetectorID::kEND); ++iD) { if (fvbUseDet[iD]) { - if (!fvpBrPoints[iD]) { throw std::logic_error(Form("MC points are unavailable for %s", kDetName[iD])); } - if (!fvpBrHitMatches[iD]) { throw std::logic_error(Form("Hit matches are unavailable for %s", kDetName[iD])); } + if (!fvpBrPoints[iD]) { + throw std::logic_error(Form("MC points are unavailable for %s", kDetName[iD])); + } + if (!fvpBrHitMatches[iD]) { + throw std::logic_error(Form("Hit matches are unavailable for %s", kDetName[iD])); + } } } } @@ -360,9 +396,13 @@ void MCModule::ReadMCPointsForDetector<ca::EDetectorID::kTof>() double bestWeight = 0; for (int iLink = 0; iLink < pHitMatch->GetNofLinks(); ++iLink) { const auto& link = pHitMatch->GetLink(iLink); - if (link.GetFile() != iFile || link.GetEntry() != iEvent) { continue; } + if (link.GetFile() != iFile || link.GetEntry() != iEvent) { + continue; + } int iPext = link.GetIndex(); - if (iPext < 0) { continue; } + if (iPext < 0) { + continue; + } auto* pExtPoint = static_cast<CbmTofPoint*>(pBrPoints->Get(link)); int trkId = pExtPoint->GetTrackID(); int rpcAddr = pExtPoint->GetDetectorID() << kNofBitsRpcAddress; // FIXME: @@ -373,7 +413,9 @@ void MCModule::ReadMCPointsForDetector<ca::EDetectorID::kTof>() mMatchedPointId[key] = iPext; } else { // If we find two links for the same interaction, we select the one with the largest weight - if (bestWeight < link.GetWeight()) { mMatchedPointId[key] = iPext; } + if (bestWeight < link.GetWeight()) { + mMatchedPointId[key] = iPext; + } } } } // iH @@ -397,14 +439,18 @@ void MCModule::ReadMCPointsForDetector<ca::EDetectorID::kTof>() if (rpcAddrCurr != rpcAddr || iTmcCurr != iTmc) { // The new interaction of the MC track with the TOF RPC if (iPointSelected != -1) { auto oPoint = FillMCPoint<ca::EDetectorID::kTof>(iPointSelected, iEvent, iFile); - if (oPoint) { fpMCData->AddPoint(*oPoint); } + if (oPoint) { + fpMCData->AddPoint(*oPoint); + } } iTmcCurr = iTmc; rpcAddrCurr = rpcAddr; auto key = std::make_pair(iTmc, rpcAddr); auto found = mMatchedPointId.find(key); bTrkHasHits = found != mMatchedPointId.end(); - if (bTrkHasHits) { iPointSelected = found->second; } + if (bTrkHasHits) { + iPointSelected = found->second; + } else { // First iteration zCell = fvpDetInterface[ca::EDetectorID::kTof]->GetZrefModule(pExtPoint->GetDetectorID()); @@ -425,7 +471,9 @@ void MCModule::ReadMCPointsForDetector<ca::EDetectorID::kTof>() // Add the last point if (iPointSelected != -1) { auto oPoint = FillMCPoint<ca::EDetectorID::kTof>(iPointSelected, iEvent, iFile); - if (oPoint) { fpMCData->AddPoint(*oPoint); } + if (oPoint) { + fpMCData->AddPoint(*oPoint); + } } } } // [iFile, iEvent] @@ -441,17 +489,29 @@ void MCModule::ReadMCPoints() DetIdArr_t<int> vNofPointsDet = {{0}}; for (const auto& [iFile, iEvent] : fFileEventIDs) { for (int iD = 0; iD < static_cast<int>(vNofPointsDet.size()); ++iD) { - if (fvbUseDet[iD]) { vNofPointsDet[iD] = fvpBrPoints[iD]->Size(iFile, iEvent); } + if (fvbUseDet[iD]) { + vNofPointsDet[iD] = fvpBrPoints[iD]->Size(iFile, iEvent); + } fpMCData->SetNofPointsOrig(static_cast<ca::EDetectorID>(iD), vNofPointsDet[iD]); } } // ----- Read MC points in MVD, STS, MuCh, TRD and TOF - if (fvbUseDet[ca::EDetectorID::kMvd]) { this->ReadMCPointsForDetector<ca::EDetectorID::kMvd>(); } - if (fvbUseDet[ca::EDetectorID::kSts]) { this->ReadMCPointsForDetector<ca::EDetectorID::kSts>(); } - if (fvbUseDet[ca::EDetectorID::kMuch]) { this->ReadMCPointsForDetector<ca::EDetectorID::kMuch>(); } - if (fvbUseDet[ca::EDetectorID::kTrd]) { this->ReadMCPointsForDetector<ca::EDetectorID::kTrd>(); } - if (fvbUseDet[ca::EDetectorID::kTof]) { this->ReadMCPointsForDetector<ca::EDetectorID::kTof>(); } + if (fvbUseDet[ca::EDetectorID::kMvd]) { + this->ReadMCPointsForDetector<ca::EDetectorID::kMvd>(); + } + if (fvbUseDet[ca::EDetectorID::kSts]) { + this->ReadMCPointsForDetector<ca::EDetectorID::kSts>(); + } + if (fvbUseDet[ca::EDetectorID::kMuch]) { + this->ReadMCPointsForDetector<ca::EDetectorID::kMuch>(); + } + if (fvbUseDet[ca::EDetectorID::kTrd]) { + this->ReadMCPointsForDetector<ca::EDetectorID::kTrd>(); + } + if (fvbUseDet[ca::EDetectorID::kTof]) { + this->ReadMCPointsForDetector<ca::EDetectorID::kTof>(); + } } // --------------------------------------------------------------------------------------------------------------------- @@ -484,7 +544,7 @@ void MCModule::ReadMCTracks() << " not found"; } // Create a CbmL1MCTrack - auto aTrk = MCTrack {}; + auto aTrk = MCTrack{}; aTrk.SetId(fpMCData->GetNofTracks()); // assign current number of tracks read so far as an ID of a new track aTrk.SetExternalId(iTrkExt); // external index of track is its index from CbmMCTrack objects container @@ -519,7 +579,9 @@ void MCModule::ReadMCTracks() else { // This is a secondary track, mother ID should be recalculated for the internal track array. int motherId = fpMCData->FindInternalTrackIndex(extMotherId, iEvent, iFile); - if (motherId == -1) { motherId = -3; } // Mother is neutral particle, which is rejected + if (motherId == -1) { + motherId = -3; + } // Mother is neutral particle, which is rejected aTrk.SetMotherId(motherId); } diff --git a/reco/L1/CbmCaMCModule.h b/reco/L1/CbmCaMCModule.h index 7d1462a14d7d45fca822ea17caa6075be3a31c8e..26765dbdb70ab5d7655ab5a52a0f332b4ffcf348 100644 --- a/reco/L1/CbmCaMCModule.h +++ b/reco/L1/CbmCaMCModule.h @@ -10,6 +10,11 @@ #ifndef CbmCaMCModule_h #define CbmCaMCModule_h 1 +#include "CaMonitor.h" +#include "CaParameters.h" +#include "CaToolsMCData.h" +#include "CaToolsMCPoint.h" +#include "CaVector.h" #include "CbmL1DetectorID.h" #include "CbmL1Hit.h" #include "CbmL1Track.h" @@ -29,7 +34,6 @@ #include "CbmTofTrackingInterface.h" #include "CbmTrdPoint.h" #include "CbmTrdTrackingInterface.h" - #include "TClonesArray.h" #include "TDatabasePDG.h" @@ -39,12 +43,6 @@ #include <string_view> #include <type_traits> -#include "CaMonitor.h" -#include "CaParameters.h" -#include "CaToolsMCData.h" -#include "CaToolsMCPoint.h" -#include "CaVector.h" - class CbmEvent; class CbmMCDataObject; class CbmL1HitDebugInfo; @@ -59,7 +57,7 @@ namespace cbm::ca class MCModule { - public: + public: /// @brief Constructor /// @param verbosity Verbosity level /// @param perfMode Performance mode (defines cut on number of consecutive stations with hit or point) @@ -162,7 +160,7 @@ namespace cbm::ca /// @brief Gets verbosity level int GetVerbosity() const { return fVerbose; } - private: + private: /// @brief Check class initialization /// @note The function throws std::logic_error, if initialization is incomplete void CheckInit() const; @@ -227,7 +225,7 @@ namespace cbm::ca kMissedMatchesTof, ///< Number of missed TOF matches kEND }; - ca::Monitor<EMonitorKey> fMonitor {"CA MC Module"}; ///< Monitor + ca::Monitor<EMonitorKey> fMonitor{"CA MC Module"}; ///< Monitor // ------ Flags DetIdArr_t<bool> fvbUseDet = {{false}}; ///< Flag: is detector subsystem used @@ -280,7 +278,9 @@ namespace cbm::ca const auto* pHitMatch = dynamic_cast<CbmMatch*>(fvpBrHitMatches[DetID]->At(iHitExt)); if (!pHitMatch) { LOG(warn) << "Hit match with index " << iHitExt << " is missing for " << kDetName[DetID]; - if constexpr (ca::EDetectorID::kMvd == DetID) { fMonitor.IncrementCounter(EMonitorKey::kMissedMatchesMvd); } + if constexpr (ca::EDetectorID::kMvd == DetID) { + fMonitor.IncrementCounter(EMonitorKey::kMissedMatchesMvd); + } else if constexpr (ca::EDetectorID::kSts == DetID) { fMonitor.IncrementCounter(EMonitorKey::kMissedMatchesSts); } @@ -388,7 +388,9 @@ namespace cbm::ca // // ----- Get station index int iStLoc = fvpDetInterface[DetID]->GetTrackingStationIndex(pExtPoint); int stationID = fpParameters->GetStationIndexActive(iStLoc, DetID); - if (stationID == -1) { return std::nullopt; } // Skip points from inactive stations + if (stationID == -1) { + return std::nullopt; + } // Skip points from inactive stations // Update point time with event time time += fpMCEventList->GetEventTime(iEvent, iFile); @@ -438,7 +440,9 @@ namespace cbm::ca int iTmcInt = fpMCData->FindInternalTrackIndex(iTmcExt, iEvent, iFile); oPoint->SetTrackId(iTmcInt); - if (iTmcInt > -1) { fpMCData->GetTrack(iTmcInt).AddPointIndex(oPoint->GetId()); } + if (iTmcInt > -1) { + fpMCData->GetTrack(iTmcInt).AddPointIndex(oPoint->GetId()); + } oPoint->SetStationId(stationID); oPoint->SetDetectorId(DetID); @@ -464,12 +468,16 @@ namespace cbm::ca template<ca::EDetectorID DetID> void MCModule::MatchPointsAndHits() { - if (!fvbUseDet[DetID]) { return; } + if (!fvbUseDet[DetID]) { + return; + } for (int iH = (*fpvFstHitId)[static_cast<int>(DetID)]; iH < (*fpvFstHitId)[static_cast<int>(DetID) + 1]; ++iH) { auto& hit = (*fpvQaHits)[iH]; auto [iBestP, vAllP] = MatchHitWithMc<DetID>(hit.ExtIndex); - if (iBestP >= 0) { hit.SetBestMcPointId(iBestP); } + if (iBestP >= 0) { + hit.SetBestMcPointId(iBestP); + } for (auto iP : vAllP) { if (iP >= 0) { hit.AddMcPointId(iP); @@ -487,7 +495,9 @@ namespace cbm::ca int nPointsEvent = fvpBrPoints[DetID]->Size(iFile, iEvent); for (int iP = 0; iP < nPointsEvent; ++iP) { std::optional<tools::MCPoint> oPoint = FillMCPoint<DetID>(iP, iEvent, iFile); - if (oPoint) { fpMCData->AddPoint(*oPoint); } + if (oPoint) { + fpMCData->AddPoint(*oPoint); + } } // iP: end } // key: end } diff --git a/reco/L1/CbmCaTimeSliceReader.cxx b/reco/L1/CbmCaTimeSliceReader.cxx index bb5e8a9d3377e7b32bd54b05c7afa886c8fecc13..f50c4eb1c4140b42de40aca5868ec1fcdf387862 100644 --- a/reco/L1/CbmCaTimeSliceReader.cxx +++ b/reco/L1/CbmCaTimeSliceReader.cxx @@ -9,23 +9,21 @@ #include "CbmCaTimeSliceReader.h" +#include "CaConstants.h" +#include "CaInputData.h" +#include "CaParameters.h" #include "CbmGlobalTrack.h" #include "CbmL1Util.h" // for CopyTrackParam2TC #include "CbmMuchTrack.h" #include "CbmStsTrack.h" #include "CbmTofTrack.h" #include "CbmTrdTrack.h" - #include "FairRootManager.h" #include "Logger.h" #include <algorithm> #include <numeric> -#include "CaConstants.h" -#include "CaInputData.h" -#include "CaParameters.h" - using cbm::ca::tools::HitRecord; using namespace cbm::algo::ca::constants; @@ -69,10 +67,16 @@ void TimeSliceReader::Clear() void TimeSliceReader::CheckInit() const { // Check parameters - if (!fpParameters.get()) { throw std::logic_error("Tracking parameters object was not defined"); } - if (!fpvHitIds) { throw std::logic_error("Hit index container was not defined"); } + if (!fpParameters.get()) { + throw std::logic_error("Tracking parameters object was not defined"); + } + if (!fpvHitIds) { + throw std::logic_error("Hit index container was not defined"); + } - if (!fpBrTimeSlice) { throw std::logic_error("Time slice branch is unavailable"); } + if (!fpBrTimeSlice) { + throw std::logic_error("Time slice branch is unavailable"); + } for (int iDet = 0; iDet < static_cast<int>(ca::EDetectorID::kEND); ++iDet) { if (fvbUseDet[iDet] && !fvpBrHits[iDet]) { @@ -82,10 +86,14 @@ void TimeSliceReader::CheckInit() const if (fpvTracks) { if (ECbmCaTrackingMode::kSTS == fTrackingMode) { - if (!fpBrRecoTracks) { throw std::logic_error("StsTrack branch is unavailable"); } + if (!fpBrRecoTracks) { + throw std::logic_error("StsTrack branch is unavailable"); + } } else if (ECbmCaTrackingMode::kMCBM == fTrackingMode) { - if (!fpBrRecoTracks) { throw std::logic_error("GlobalTrack branch is unavailable"); } + if (!fpBrRecoTracks) { + throw std::logic_error("GlobalTrack branch is unavailable"); + } if (fvbUseDet[ca::EDetectorID::kSts] && !fpBrStsTracks) { throw std::logic_error("StsTrack branch is not found"); } @@ -124,7 +132,9 @@ try { // Init branches auto InitHitBranch = [&](ca::EDetectorID detID, const char* branchName) { - if (fvbUseDet[detID]) { fvpBrHits[detID] = dynamic_cast<TClonesArray*>(pFairManager->GetObject(branchName)); } + if (fvbUseDet[detID]) { + fvpBrHits[detID] = dynamic_cast<TClonesArray*>(pFairManager->GetObject(branchName)); + } }; InitHitBranch(ca::EDetectorID::kMvd, "MvdHit"); @@ -344,7 +354,9 @@ void TimeSliceReader::ReadHits() // TODO: Address case with CbmEvent != nullptr for (int iDet = 0; iDet < static_cast<int>(ca::EDetectorID::kEND); ++iDet) { - if (fvbUseDet[iDet]) { fvNofHitsTotal[iDet] = fvpBrHits[iDet]->GetEntriesFast(); } + if (fvbUseDet[iDet]) { + fvNofHitsTotal[iDet] = fvpBrHits[iDet]->GetEntriesFast(); + } } int nHitsTot = std::accumulate(fvNofHitsTotal.begin(), fvNofHitsTotal.end(), 0); @@ -358,7 +370,9 @@ void TimeSliceReader::ReadHits() fpvQaHits->clear(); fpvQaHits->reserve(nHitsTot); } - if (fpIODataManager) { fpIODataManager->ResetInputData(nHitsTot); } + if (fpIODataManager) { + fpIODataManager->ResetInputData(nHitsTot); + } std::fill(fvHitFirstIndexDet.begin(), fvHitFirstIndexDet.end(), 0); @@ -377,10 +391,14 @@ void TimeSliceReader::ReadHits() fNofHits = std::accumulate(fvNofHitsUsed.cbegin(), fvNofHitsUsed.cend(), 0); // Update number of hit keys in input data object - if (fpIODataManager) { fpIODataManager->SetNhitKeys(fNofHitKeys); } + if (fpIODataManager) { + fpIODataManager->SetNhitKeys(fNofHitKeys); + } // Sort debug hits - if (fpvQaHits) { this->SortQaHits(); } + if (fpvQaHits) { + this->SortQaHits(); + } // Update maps of ext->int hit indexes // NOTE: fvpHitIds must be initialized, if we want to read tracks from the file @@ -422,7 +440,9 @@ void TimeSliceReader::StoreHitRecord(const HitRecord& hitRecord) } // Save hit ID information - if (fpvHitIds) { fpvHitIds->emplace_back(hitRecord.fDet, hitRecord.fExtId); } + if (fpvHitIds) { + fpvHitIds->emplace_back(hitRecord.fDet, hitRecord.fExtId); + } // Save debug information if (fpvQaHits) { diff --git a/reco/L1/CbmCaTimeSliceReader.h b/reco/L1/CbmCaTimeSliceReader.h index 1cd565d605513f66ed0dd150ff2c65cc8ef9bafd..6a211addbe0f09acc1f29055f41cc8895ae03be6 100644 --- a/reco/L1/CbmCaTimeSliceReader.h +++ b/reco/L1/CbmCaTimeSliceReader.h @@ -10,6 +10,9 @@ #ifndef CbmCaTimeSliceReader_h #define CbmCaTimeSliceReader_h 1 +#include "CaConstants.h" +#include "CaToolsHitRecord.h" +#include "CaVector.h" #include "CbmCaMCModule.h" #include "CbmL1.h" // TMP: for CbmL1HitStore #include "CbmL1DetectorID.h" @@ -26,20 +29,15 @@ #include "CbmTofTrackingInterface.h" #include "CbmTrdHit.h" #include "CbmTrdTrackingInterface.h" - #include "TClonesArray.h" -#include "CaConstants.h" -#include "CaToolsHitRecord.h" -#include "CaVector.h" - class CbmTimeSlice; namespace cbm::algo::ca { class DataManager; class Parameters; -} +} // namespace cbm::algo::ca namespace cbm::ca { @@ -50,7 +48,7 @@ namespace cbm::ca /// data structures. /// class TimeSliceReader { - public: + public: /// @brief Constructor from parameters /// @param mode Tracking mode TimeSliceReader() = default; @@ -134,7 +132,7 @@ namespace cbm::ca void SetTrackingMode(ECbmCaTrackingMode mode) { fTrackingMode = mode; } - private: + private: /// @brief Check class initialization /// @note The function throws std::logic_error, if initialization is incomplete void CheckInit() const; @@ -213,7 +211,9 @@ namespace cbm::ca template<ca::EDetectorID DetID> int cbm::ca::TimeSliceReader::ReadHitsForDetector() { - if (!fvbUseDet[DetID]) { return 0; } // Detector is entirelly not used + if (!fvbUseDet[DetID]) { + return 0; + } // Detector is entirelly not used const auto* pDetInterface = fvpDetInterface[DetID]; int nHitsTot = fvpBrHits[DetID]->GetEntriesFast(); // total number of hits provided by hit finder @@ -260,14 +260,20 @@ int cbm::ca::TimeSliceReader::ReadHitsForDetector() // *** Additional cuts for TOF *** // Skip Bmon hits - if (5 == CbmTofAddress::GetSmType(pTofHit->GetAddress())) { continue; } + if (5 == CbmTofAddress::GetSmType(pTofHit->GetAddress())) { + continue; + } // FIXME: Figure it out, if this cut is still needed (introduced a year ago for mCBM) - if (ECbmCaTrackingMode::kMCBM == fTrackingMode && pTofHit->GetZ() > 400) { continue; } + if (ECbmCaTrackingMode::kMCBM == fTrackingMode && pTofHit->GetZ() > 400) { + continue; + } } int iStActive = fpParameters->GetStationIndexActive(iStGeom, DetID); - if (iStActive == -1) { continue; } // Cut off inactive stations + if (iStActive == -1) { + continue; + } // Cut off inactive stations // Fill out data common for all the detectors hitRecord.fStaId = iStActive; @@ -288,13 +294,19 @@ int cbm::ca::TimeSliceReader::ReadHitsForDetector() // Update number of hit keys if constexpr (ca::EDetectorID::kSts == DetID) { - if (fNofHitKeys <= hitRecord.fStripF) { fNofHitKeys = hitRecord.fStripF + 1; } - if (fNofHitKeys <= hitRecord.fStripB) { fNofHitKeys = hitRecord.fStripB + 1; } + if (fNofHitKeys <= hitRecord.fStripF) { + fNofHitKeys = hitRecord.fStripF + 1; + } + if (fNofHitKeys <= hitRecord.fStripB) { + fNofHitKeys = hitRecord.fStripB + 1; + } } else { hitRecord.fStripF = fFirstHitKey + iHext; hitRecord.fStripB = hitRecord.fStripF; - if (fNofHitKeys <= hitRecord.fStripF) { fNofHitKeys = hitRecord.fStripF + 1; } + if (fNofHitKeys <= hitRecord.fStripF) { + fNofHitKeys = hitRecord.fStripF + 1; + } } // Save hit to data structures diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index d55ddcd9ae4677955e0ef92baeb937149ba994a8..c8335366388b4d7feddb711b1eaf38adc1082ba1 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -20,6 +20,7 @@ #include "CbmL1.h" +#include "CaToolsMaterialHelper.h" #include "CbmMCDataManager.h" #include "CbmMuchTrackingInterface.h" #include "CbmMvdTrackingInterface.h" @@ -29,20 +30,20 @@ #include "CbmTrdTrackingInterface.h" #include <boost/filesystem.hpp> - -#include "CaToolsMaterialHelper.h" // TODO: include of CbmSetup.h creates problems on Mac // #include "CbmSetup.h" +#include "CaFramework.h" +#include "CaHit.h" +#include "CaToolsDebugger.h" +#include "CaToolsField.h" #include "CbmEvent.h" #include "CbmMCDataObject.h" #include "CbmStsFindTracks.h" #include "CbmStsHit.h" #include "CbmTrackingDetectorInterfaceInit.h" - #include "FairEventHeader.h" #include "FairField.h" #include "FairRunAna.h" - #include "TGeoArb8.h" #include "TGeoBoolNode.h" #include "TGeoCompositeShape.h" @@ -56,6 +57,7 @@ #include "TSystem.h" #include "TVector3.h" #include "TVectorD.h" + #include <TFile.h> #include <chrono> @@ -64,11 +66,6 @@ #include <iostream> #include <list> -#include "CaFramework.h" -#include "CaHit.h" -#include "CaToolsDebugger.h" -#include "CaToolsField.h" - using namespace cbm::algo; // TODO: remove this line using std::cout; @@ -132,7 +129,9 @@ void CbmL1::CheckDetectorPresence() // TODO: temporary code!! // for a moment, the MVD digitizer doesn't work in TB mode // check the presence of MVD hits to make sure the MVD is really active - if (!FairRootManager::Instance()->GetObject("MvdHit")) { fUseMVD = false; } + if (!FairRootManager::Instance()->GetObject("MvdHit")) { + fUseMVD = false; + } } } @@ -140,7 +139,9 @@ void CbmL1::CheckDetectorPresence() // void CbmL1::DisableTrackingStation(ca::EDetectorID detID, int iSt) { - if (ca::EDetectorID::kEND != detID) { fvmDisabledStationIDs[detID].insert(iSt); } + if (ca::EDetectorID::kEND != detID) { + fvmDisabledStationIDs[detID].insert(iSt); + } } // --------------------------------------------------------------------------------------------------------------------- @@ -256,7 +257,9 @@ InitStatus CbmL1::Init() fvSelectedMcEvents.clear(); fTimeSlice = (CbmTimeSlice*) fairManager->GetObject("TimeSlice."); - if (!fTimeSlice) { LOG(fatal) << GetName() << ": No time slice branch in the tree!"; } + if (!fTimeSlice) { + LOG(fatal) << GetName() << ": No time slice branch in the tree!"; + } fpStsClusters = dynamic_cast<TClonesArray*>(fairManager->GetObject("StsCluster")); @@ -311,7 +314,9 @@ InitStatus CbmL1::Init() fpMvdPoints = mcManager->InitBranch("MvdPoint"); fpMvdDigiMatches = dynamic_cast<TClonesArray*>(fairManager->GetObject("MvdDigiMatch")); fpMvdHitMatches = dynamic_cast<TClonesArray*>(fairManager->GetObject("MvdHitMatch")); - if (!fpMvdHitMatches) { LOG(error) << "No fpMvdHitMatches provided, performance is not done correctly"; } + if (!fpMvdHitMatches) { + LOG(error) << "No fpMvdHitMatches provided, performance is not done correctly"; + } } if (fUseSTS) { @@ -323,7 +328,9 @@ InitStatus CbmL1::Init() fpTrdPoints = mcManager->InitBranch("TrdPoint"); - if (!fUseTRD) { fpTrdHitMatches = nullptr; } + if (!fUseTRD) { + fpTrdHitMatches = nullptr; + } else { fpTrdHitMatches = (TClonesArray*) fairManager->GetObject("TrdHitMatch"); } @@ -342,7 +349,9 @@ InitStatus CbmL1::Init() fpTofPoints = mcManager->InitBranch("TofPoint"); - if (!fUseTOF) { fpTofHitMatches = nullptr; } + if (!fUseTOF) { + fpTofHitMatches = nullptr; + } else { fpTofHitMatches = static_cast<TClonesArray*>(fairManager->GetObject("TofHitMatch")); } @@ -377,7 +386,9 @@ InitStatus CbmL1::Init() } } - if (!fUseMVD) { fpMvdHits = nullptr; } + if (!fUseMVD) { + fpMvdHits = nullptr; + } else { fpMvdHits = dynamic_cast<TClonesArray*>(fairManager->GetObject("MvdHit")); } @@ -487,13 +498,23 @@ InitStatus CbmL1::Init() // ** Active tracking detector subsystems selection ** // *************************************************** - std::set<ca::EDetectorID> vActiveTrackingDetectorIDs {}; // Set of detectors active in tracking + std::set<ca::EDetectorID> vActiveTrackingDetectorIDs{}; // Set of detectors active in tracking - if (fUseMVD) { vActiveTrackingDetectorIDs.insert(ca::EDetectorID::kMvd); } - if (fUseSTS) { vActiveTrackingDetectorIDs.insert(ca::EDetectorID::kSts); } - if (fUseMUCH) { vActiveTrackingDetectorIDs.insert(ca::EDetectorID::kMuch); } - if (fUseTRD) { vActiveTrackingDetectorIDs.insert(ca::EDetectorID::kTrd); } - if (fUseTOF) { vActiveTrackingDetectorIDs.insert(ca::EDetectorID::kTof); } + if (fUseMVD) { + vActiveTrackingDetectorIDs.insert(ca::EDetectorID::kMvd); + } + if (fUseSTS) { + vActiveTrackingDetectorIDs.insert(ca::EDetectorID::kSts); + } + if (fUseMUCH) { + vActiveTrackingDetectorIDs.insert(ca::EDetectorID::kMuch); + } + if (fUseTRD) { + vActiveTrackingDetectorIDs.insert(ca::EDetectorID::kTrd); + } + if (fUseTOF) { + vActiveTrackingDetectorIDs.insert(ca::EDetectorID::kTof); + } fInitManager.SetActiveDetectorIDs(vActiveTrackingDetectorIDs); // ************************************* @@ -589,7 +610,9 @@ InitStatus CbmL1::Init() stationInfo.SetXmax(trdInterface->GetXmax(iSt)); stationInfo.SetYmax(trdInterface->GetYmax(iSt)); - if (ca::Framework::TrackingMode::kGlobal == fTrackingMode) { stationInfo.SetTimeInfo(false); } + if (ca::Framework::TrackingMode::kGlobal == fTrackingMode) { + stationInfo.SetTimeInfo(false); + } stationInfo.SetTrackingStatus(true); if (fvmDisabledStationIDs[ca::EDetectorID::kTrd].find(iSt) != fvmDisabledStationIDs[ca::EDetectorID::kTrd].cend()) { @@ -645,10 +668,14 @@ InitStatus CbmL1::Init() } // Form parameters container - if (!fInitManager.FormParametersContainer()) { return kFATAL; } + if (!fInitManager.FormParametersContainer()) { + return kFATAL; + } // Write parameters object to file if needed - if (1 == fSTAPDataMode || 4 == fSTAPDataMode) { this->WriteSTAPParamObject(); } + if (1 == fSTAPDataMode || 4 == fSTAPDataMode) { + this->WriteSTAPParamObject(); + } } @@ -748,7 +775,9 @@ void CbmL1::Reconstruct(CbmEvent* event) } if (fVerbose > 1) { - if (event) { LOG(info) << "\nCbmL1::Exec event " << fEventNo << " ...\n"; } + if (event) { + LOG(info) << "\nCbmL1::Exec event " << fEventNo << " ...\n"; + } else { LOG(info) << "\nCbmL1::Exec time slice " << fEventNo << " ...\n"; } @@ -782,7 +811,9 @@ void CbmL1::Reconstruct(CbmEvent* event) } if (bestMcFile >= 0) { // suppress mc tracks from complementary mc events for (auto it = fvMCTracks.begin(); it != fvMCTracks.end(); ++it) { - if (it->iFile != bestMcFile || it->iEvent != bestMcEvent) { it->SetIsReconstructable(false); } + if (it->iFile != bestMcFile || it->iEvent != bestMcEvent) { + it->SetIsReconstructable(false); + } } } } @@ -792,11 +823,15 @@ void CbmL1::Reconstruct(CbmEvent* event) fpAlgo->SetMonitorData(monitorData); - if (fVerbose > 1) { LOG(info) << "L1 Track finder..."; } + if (fVerbose > 1) { + LOG(info) << "L1 Track finder..."; + } fpAlgo->fTrackFinder.FindTracks(); // IdealTrackFinder(); fTrackingTime = fpAlgo->fCaRecoTime; // TODO: remove (not used) - if (fVerbose > 1) { LOG(info) << "L1 Track finder ok"; } + if (fVerbose > 1) { + LOG(info) << "L1 Track finder ok"; + } // Update monitor data after the actual tracking monitorData = fpAlgo->GetMonitorData(); @@ -829,7 +864,9 @@ void CbmL1::Reconstruct(CbmEvent* event) // output performance if (fPerformance) { - if (fVerbose > 1) { LOG(info) << "Performance..."; } + if (fVerbose > 1) { + LOG(info) << "Performance..."; + } // // tracker input performance is moved to external QA tasks. @@ -845,7 +882,9 @@ void CbmL1::Reconstruct(CbmEvent* event) using std::setw; { int id = 0; - if (fvRecoTracks.size()) { LOG(info) << setw(4) << "No." << ' ' << fvRecoTracks[0].ToString(3, true); } + if (fvRecoTracks.size()) { + LOG(info) << setw(4) << "No." << ' ' << fvRecoTracks[0].ToString(3, true); + } for (const auto& trk : fvRecoTracks) { LOG(info) << setw(4) << (id++) << ' ' << trk.ToString(3); } @@ -853,7 +892,9 @@ void CbmL1::Reconstruct(CbmEvent* event) { LOG(info) << "---------- Reco hit sample"; int id = 0; - if (fvHitDebugInfo.size()) { LOG(info) << setw(4) << "No." << ' ' << fvHitDebugInfo[0].ToString(3, true); } + if (fvHitDebugInfo.size()) { + LOG(info) << setw(4) << "No." << ' ' << fvHitDebugInfo[0].ToString(3, true); + } for (const auto& h : fvHitDebugInfo) { LOG(info) << setw(4) << (id++) << ' ' << h.ToString(3); } @@ -861,15 +902,21 @@ void CbmL1::Reconstruct(CbmEvent* event) if (fPerformance) { LOG(info) << "---------- MC tracks sample"; int id = 0; - if (fvMCTracks.size()) { LOG(info) << setw(4) << "No." << ' ' << fvMCTracks[0].ToString(3, true); } + if (fvMCTracks.size()) { + LOG(info) << setw(4) << "No." << ' ' << fvMCTracks[0].ToString(3, true); + } for (const auto& trk : fvMCTracks) { - if (trk.Hits.size() || trk.Points.size()) { LOG(info) << setw(4) << (id++) << ' ' << trk.ToString(3); } + if (trk.Hits.size() || trk.Points.size()) { + LOG(info) << setw(4) << (id++) << ' ' << trk.ToString(3); + } } } if (fPerformance) { LOG(info) << "---------- MC points sample"; int id = 0; - if (fvMCPoints.size()) { LOG(info) << setw(4) << "No." << ' ' << fvMCPoints[0].ToString(3, true); } + if (fvMCPoints.size()) { + LOG(info) << setw(4) << "No." << ' ' << fvMCPoints[0].ToString(3, true); + } for (const auto& p : fvMCPoints) { LOG(info) << setw(4) << (id++) << ' ' << p.ToString(3); } @@ -879,12 +926,18 @@ void CbmL1::Reconstruct(CbmEvent* event) EfficienciesPerformance(); HistoPerformance(); TrackFitPerformance(); - if (fsMcTripletsOutputFilename.size()) { DumpMCTripletsToTree(); } + if (fsMcTripletsOutputFilename.size()) { + DumpMCTripletsToTree(); + } // TimeHist(); /// WriteSIMDKFData(); } - if (fVerbose > 1) { LOG(info) << "Tracking performance... done"; } - if (fVerbose > 1) { LOG(info) << "End of CA"; } + if (fVerbose > 1) { + LOG(info) << "Tracking performance... done"; + } + if (fVerbose > 1) { + LOG(info) << "End of CA"; + } static bool ask = 0; char symbol; @@ -965,7 +1018,8 @@ void CbmL1::Finish() // void CbmL1::writedir2current(TObject* obj) { - if (!obj->IsFolder()) obj->Write(); + if (!obj->IsFolder()) + obj->Write(); else { TDirectory* cur = gDirectory; TDirectory* sub = cur->mkdir(obj->GetName()); @@ -988,7 +1042,9 @@ void CbmL1::GenerateMaterialMaps() cbm::ca::tools::MaterialHelper matHelper; matHelper.SetSafeMaterialInitialization(fDoSafeMaterialInitialization); - if (!fMatBudgetParallelProjection) { matHelper.SetDoRadialProjection(fTargetZ); } + if (!fMatBudgetParallelProjection) { + matHelper.SetDoRadialProjection(fTargetZ); + } matHelper.SetNraysPerDim(fMatBudgetNrays); double zLast = fTargetZ + 1.; // some gap (+1cm) to skip the target material @@ -1009,8 +1065,12 @@ void CbmL1::GenerateMaterialMaps() //double maxXY = 80; // calculate n bins from the minimal pitch int nBins = static_cast<int>(std::ceil(2. * maxXY / fMatBudgetPitch)); - if (nBins < 1) { LOG(fatal) << " material nBins " << nBins << " is not positive, something is wrong"; } - if (nBins > fMatBudgetNbins) { nBins = fMatBudgetNbins; } + if (nBins < 1) { + LOG(fatal) << " material nBins " << nBins << " is not positive, something is wrong"; + } + if (nBins > fMatBudgetNbins) { + nBins = fMatBudgetNbins; + } ca::MaterialMap matBudget = matHelper.GenerateMaterialMap(station.GetZref(), zLast, zNew, maxXY, nBins); @@ -1091,7 +1151,9 @@ void CbmL1::DefineSTAPNames(const char* dirName) // FIXME: SZh 01.03.2023: Clean STAP names namespace bfs = boost::filesystem; - if (fSTAPDataMode == 0) { return; } + if (fSTAPDataMode == 0) { + return; + } // Define file prefix (/path/to/data/setup.reco.root -> "setup.reco") bfs::path pathToRecoOutput = FairRunAna::Instance()->GetUserOutputFileName().Data(); @@ -1100,7 +1162,9 @@ void CbmL1::DefineSTAPNames(const char* dirName) fSTAPDataPrefix = fSTAPDataPrefix.Strip(TString::EStripType::kBoth, '.'); TString sDirName = TString(dirName); - if (sDirName.Length() == 0) { fSTAPDataDir = pathToRecoOutput.parent_path().string(); } + if (sDirName.Length() == 0) { + fSTAPDataDir = pathToRecoOutput.parent_path().string(); + } else if (bfs::exists(sDirName.Data()) && bfs::is_directory(sDirName.Data())) { fSTAPDataDir = sDirName; } @@ -1111,7 +1175,9 @@ void CbmL1::DefineSTAPNames(const char* dirName) LOG(info) << "CbmL1: STAP data root directory is \033[1;32m" << bfs::system_complete(fSTAPDataDir.Data()) << "\033[0m"; - if (fSTAPDataMode == 4) { return; } + if (fSTAPDataMode == 4) { + return; + } // Directory for handling L1InputData objects TString sInputDataDir = fSTAPDataDir + "/" + fSTAPDataPrefix + "_cainputdata"; @@ -1291,7 +1357,9 @@ void CbmL1::DumpMaterialToFile(TString fileName) TString title = Form("Tracking station %d: Rad. thickness in [%s]. Z region [%.2f,%.2f] cm.", ist, "%", mat.GetZmin(), mat.GetZmax()); - if (fMatBudgetParallelProjection) { title += " Horisontal projection."; } + if (fMatBudgetParallelProjection) { + title += " Horisontal projection."; + } else { title += " Radial projection."; } @@ -1327,10 +1395,12 @@ void CbmL1::GetTargetInfo() fTargetZ = 1.e10; TString targetPath; - TGeoNode* targetNode {nullptr}; + TGeoNode* targetNode{nullptr}; FindTargetNode(targetPath, targetNode); - if (!targetNode) { LOG(fatal) << "L1: can not find the target!"; } + if (!targetNode) { + LOG(fatal) << "L1: can not find the target!"; + } Double_t local[3] = {0., 0., 0.}; // target centre, local c.s. Double_t global[3]; // target centre, global c.s. @@ -1355,7 +1425,9 @@ void CbmL1::FindTargetNode(TString& targetPath, TGeoNode*& targetNode) targetPath = "/" + TString(targetNode->GetName()); } - if (TString(targetNode->GetName()).Contains("target")) { return; } + if (TString(targetNode->GetName()).Contains("target")) { + return; + } for (Int_t iNode = 0; iNode < targetNode->GetNdaughters(); iNode++) { TGeoNode* newNode = targetNode->GetDaughter(iNode); diff --git a/reco/L1/CbmL1.h b/reco/L1/CbmL1.h index d9e4f18d308d6dcc8cbc9a248117c0014c557314..d83f5735c51137319d699308ae04e0f5151ad890 100644 --- a/reco/L1/CbmL1.h +++ b/reco/L1/CbmL1.h @@ -22,6 +22,14 @@ #define _CbmL1_h_ +#include "AlgoFairloggerCompat.h" +#include "CaDataManager.h" +#include "CaFramework.h" +#include "CaInitManager.h" +#include "CaMaterialMonitor.h" +#include "CaMonitor.h" +#include "CaTrackParam.h" +#include "CaVector.h" #include "CbmL1DetectorID.h" #include "CbmL1Hit.h" #include "CbmL1MCPoint.h" @@ -33,11 +41,9 @@ #include "CbmMvdHit.h" #include "CbmMvdPoint.h" #include "CbmTimeSlice.h" - #include "FairDetector.h" #include "FairRootManager.h" #include "FairTask.h" - #include "TClonesArray.h" #include "TH1.h" @@ -52,15 +58,6 @@ #include <unordered_map> #include <utility> -#include "AlgoFairloggerCompat.h" -#include "CaDataManager.h" -#include "CaFramework.h" -#include "CaInitManager.h" -#include "CaMaterialMonitor.h" -#include "CaMonitor.h" -#include "CaTrackParam.h" -#include "CaVector.h" - class CbmL1MCTrack; class CbmMCDataObject; class CbmEvent; @@ -112,7 +109,7 @@ namespace std /// TODO: L1InitManager - main interface of communication between cbmroot/bmnroot and ca::Framework (S.Zharko) /// class CbmL1 : public FairTask { -public: + public: // ********************** // ** Types definition ** // ********************** @@ -258,7 +255,7 @@ public: void SetMcbmMode() { fTrackingMode = ca::Framework::TrackingMode::kMcbm; } void SetGlobalMode() { fTrackingMode = ca::Framework::TrackingMode::kGlobal; } - ca::TrackingMonitor fMonitor {}; ///< Tracking monitor + ca::TrackingMonitor fMonitor{}; ///< Tracking monitor // void SetTrackingLevel( Int_t iLevel ){ fTrackingLevel = iLevel; } // void MomentumCutOff( Double_t cut ){ fMomentumCutOff = cut; } @@ -319,7 +316,7 @@ public: << " ! The material budget files are not used anymore !"; } -private: + private: struct TH1FParameters { TString name, title; int nbins; @@ -454,7 +451,7 @@ private: void DumpMaterialToFile(TString fileName); -private: + private: std::string fInputDataFilename = ""; ///< File name to read/write input hits std::string fsInputSearchWindowsFilename = ""; ///< File name to read search windows @@ -469,7 +466,7 @@ private: //std::unique_ptr<CbmCaMCModule> fpMCModule = nullptr; ///< MC-module for tracking -public: + public: // ** Basic data members ** ca::Framework* fpAlgo = nullptr; ///< Pointer to the L1 track finder algorithm @@ -477,20 +474,20 @@ public: ca::Framework::TrackingMode fTrackingMode = ca::Framework::TrackingMode::kSts; ///< Tracking mode: kSts, kMcbm or kGlobal - DFSET fvSelectedMcEvents {}; ///< Set of selected MC events with fileID and eventId + DFSET fvSelectedMcEvents{}; ///< Set of selected MC events with fileID and eventId ca::Vector<CbmL1Track> fvRecoTracks = {"CbmL1::fvRecoTracks"}; ///< Reconstructed tracks container -private: + private: static CbmL1* fpInstance; ///< Instance of CbmL1 - bool fDoSafeMaterialInitialization {false}; /// Do safe but slow material initialisation - /// to get around potential problems in TGeoVoxelFinder + bool fDoSafeMaterialInitialization{false}; /// Do safe but slow material initialisation + /// to get around potential problems in TGeoVoxelFinder - double fTargetX {1.e10}; ///< target position X - double fTargetY {1.e10}; ///< target position Y - double fTargetZ {1.e10}; ///< target position Z + double fTargetX{1.e10}; ///< target position X + double fTargetY{1.e10}; ///< target position Y + double fTargetZ{1.e10}; ///< target position Z int fNpointsMvd = 0; ///< Number of MC points for MVD int fNpointsSts = 0; ///< Number of MC points for STS @@ -623,18 +620,18 @@ private: int fEventNo = 0; ///< Current number of event/TS int fNofRecoTracks = 0; ///< Total number of reconstructed tracks -public: + public: // ** Repacked input data ** ca::Vector<CbmL1HitId> fvExternalHits = {"CbmL1::fvExternalHits"}; ///< Array of hits -private: + private: ca::Vector<CbmL1HitDebugInfo> fvHitDebugInfo = { "CbmL1::fvHitDebugInfo"}; ///< Container of hits with extended information // indices of MCPoints in fvMCPoints, indexed by index of hit in algo->vHits array. According to StsMatch. Used for IdealResponce // ca::Vector<int> vHitMCRef1; // CbmMatch HitMatch; -private: + private: std::unordered_map<CbmL1LinkKey, int> fmMCPointsLinksMap = {}; /// Internal MC point index vs. link std::unordered_map<CbmL1LinkKey, int> fmMCTracksLinksMap = {}; /// Internal MC track index vs. link @@ -644,30 +641,30 @@ private: // ** Tracking performance QA ** // ***************************** // TODO: move to a separate class (S.Zharko) - TFile* fPerfFile {nullptr}; - TDirectory* fHistoDir {nullptr}; - TDirectory* fTableDir {nullptr}; + TFile* fPerfFile{nullptr}; + TDirectory* fHistoDir{nullptr}; + TDirectory* fTableDir{nullptr}; static const int fNTimeHistos = 22; - TH1F* fTimeHisto[fNTimeHistos] {nullptr}; + TH1F* fTimeHisto[fNTimeHistos]{nullptr}; static const int fNGhostHistos = 9; - TH1F* fGhostHisto[fNGhostHistos] {nullptr}; + TH1F* fGhostHisto[fNGhostHistos]{nullptr}; TFile* fpMcTripletsOutFile = nullptr; ///< File to save MC-triplets tree TTree* fpMcTripletsTree = nullptr; ///< Tree to save MC-triplets std::string fsMcTripletsOutputFilename = ""; ///< Name of file to save MC-triplets tree - int fMatBudgetNbins {100}; ///< n bins in mat budget maps (fMatBudgetNbins x fMatBudgetNbins) - int fMatBudgetNrays {3}; ///< material budget n rays per dimansion in each bin - double fMatBudgetPitch {0.1}; ///< material budget minimal bin size in cm + int fMatBudgetNbins{100}; ///< n bins in mat budget maps (fMatBudgetNbins x fMatBudgetNbins) + int fMatBudgetNrays{3}; ///< material budget n rays per dimansion in each bin + double fMatBudgetPitch{0.1}; ///< material budget minimal bin size in cm - bool fMatBudgetParallelProjection {false}; ///< Calculate material budget with rays, parallel to Z axis - ///< Only needed in debug mode to produce detailed picture of the material + bool fMatBudgetParallelProjection{false}; ///< Calculate material budget with rays, parallel to Z axis + ///< Only needed in debug mode to produce detailed picture of the material - bool fExtrapolateToTheEndOfSTS {false}; + bool fExtrapolateToTheEndOfSTS{false}; - std::vector<ca::MaterialMonitor> fMaterialMonitor {}; ///< material monitoring + std::vector<ca::MaterialMonitor> fMaterialMonitor{}; ///< material monitoring ClassDef(CbmL1, 0); }; @@ -711,7 +708,9 @@ std::tuple<int, std::vector<int>> CbmL1::MatchHitWithMc(int iHitExt) const int iEvent = link.GetEntry(); int iFile = link.GetFile(); auto itPoint = fmMCPointsLinksMap.find(CbmL1LinkKey(iPointExt + indexShift, iEvent, iFile)); - if (itPoint == fmMCPointsLinksMap.cend()) { continue; } + if (itPoint == fmMCPointsLinksMap.cend()) { + continue; + } vPoints.push_back(itPoint->second); } } @@ -722,7 +721,9 @@ std::tuple<int, std::vector<int>> CbmL1::MatchHitWithMc(int iHitExt) const int iEvent = link.GetEntry(); int iFile = link.GetFile(); auto itPoint = fmMCPointsLinksMap.find(CbmL1LinkKey(iPointExt + indexShift, iEvent, iFile)); - if (itPoint != fmMCPointsLinksMap.cend()) { iPointInt = itPoint->second; } + if (itPoint != fmMCPointsLinksMap.cend()) { + iPointInt = itPoint->second; + } } } diff --git a/reco/L1/CbmL1Counters.h b/reco/L1/CbmL1Counters.h index 5d12ef004db9acf6353f96fe5ed9e9a54ec1968d..7619f1e0cf1b47cc719db40304242791e89cb702 100644 --- a/reco/L1/CbmL1Counters.h +++ b/reco/L1/CbmL1Counters.h @@ -5,6 +5,7 @@ #ifndef CbmL1Counters_H #define CbmL1Counters_H +#include "CaVector.h" #include "TString.h" #include <fstream> @@ -12,8 +13,6 @@ #include <iostream> #include <map> -#include "CaVector.h" - namespace { namespace cacore = cbm::algo::ca; @@ -114,11 +113,11 @@ struct TL1TracksCatCounters // counters for different tracks categories return strm; } -private: + private: double Div(double a, double b) { return (b > 0) ? a / b : -1.; }; -public: - cacore::Vector<T> counters {"TL1TracksCatCounters::counters"}; + public: + cacore::Vector<T> counters{"TL1TracksCatCounters::counters"}; }; struct TL1Efficiencies { @@ -132,11 +131,11 @@ struct TL1Efficiencies { , reco() , ghosts(0) , clones(0) - , nEvents(0) { + , nEvents(0){ // you should add counter with shortname="total" !! }; - virtual ~TL1Efficiencies() {}; + virtual ~TL1Efficiencies(){}; virtual void AddCounter(const TString& shortname, const TString& name); diff --git a/reco/L1/CbmL1DetectorID.h b/reco/L1/CbmL1DetectorID.h index 526698b95dc7eb433dd43a15f408efdadd69f791..4d1b66358dd7f9243df5b49020e2908537520c6a 100644 --- a/reco/L1/CbmL1DetectorID.h +++ b/reco/L1/CbmL1DetectorID.h @@ -10,11 +10,11 @@ #ifndef CbmL1DetectorID_h #define CbmL1DetectorID_h 1 -#include <string> - #include "CaConstants.h" #include "CaEnumArray.h" +#include <string> + namespace cbm::ca { namespace phys = cbm::algo::ca::constants::phys; diff --git a/reco/L1/CbmL1Hit.h b/reco/L1/CbmL1Hit.h index 71a993e2eecb80346f085fa494edc75484bfaf8f..d963af1eee39af96658732fd63136420c952c468 100644 --- a/reco/L1/CbmL1Hit.h +++ b/reco/L1/CbmL1Hit.h @@ -5,13 +5,12 @@ #ifndef _CbmL1Hit_h_ #define _CbmL1Hit_h_ +#include <cmath> #include <iomanip> #include <sstream> #include <string> #include <vector> -#include <cmath> - // TODO: SZh: Complete the rule of five // TODO: SZh: Make variables private // TODO: SZh: Move class to ca::tools (ca::tools::Hit) @@ -20,9 +19,9 @@ /// Identificator for cbm hits with their detector and index in cbm arrays /// class CbmL1HitId { -public: + public: CbmL1HitId() = default; - CbmL1HitId(int det, int index) : detId(det), hitId(index) {}; + CbmL1HitId(int det, int index) : detId(det), hitId(index){}; /// @brief String representation of class object /// @param header If true, header will be printed @@ -49,7 +48,7 @@ public: /// a helper class for performance evaluation that contains useful info about cbm hits with hit-mcpoint match information /// class CbmL1HitDebugInfo { // TODO: SZh 21.09.2022: Replace instances of this class with ca::Hit -public: + public: /// @brief Gets detector type /// 0 - MVD /// 1 - STS @@ -140,20 +139,20 @@ public: } // TODO: SZh 2.03.2023: make the variables private - int ExtIndex; ///< index of hit in the external branch - int IntIndex; ///< index of hit in the internal array - int iStation; ///< index of station in active stations array - int Det; ///< detector subsystem ID - double x; ///< x coordinate of position [cm] - double y; ///< y coordinate of position [cm] - double z; ///< z coordinate of position [cm] - double time; ///< hit time [ns] - double dx; ///< x coordinate error [cm] - double dy; ///< y coordinate error [cm] - double dt; ///< time error [ns] - double dxy; ///< covariance between x and y [cm2] - int fBestMcPointId {-1}; ///< index of best matched MC point - std::vector<int> fMcPointIds {}; ///< indices of all matched MC points + int ExtIndex; ///< index of hit in the external branch + int IntIndex; ///< index of hit in the internal array + int iStation; ///< index of station in active stations array + int Det; ///< detector subsystem ID + double x; ///< x coordinate of position [cm] + double y; ///< y coordinate of position [cm] + double z; ///< z coordinate of position [cm] + double time; ///< hit time [ns] + double dx; ///< x coordinate error [cm] + double dy; ///< y coordinate error [cm] + double dt; ///< time error [ns] + double dxy; ///< covariance between x and y [cm2] + int fBestMcPointId{-1}; ///< index of best matched MC point + std::vector<int> fMcPointIds{}; ///< indices of all matched MC points }; #endif diff --git a/reco/L1/CbmL1MCPoint.h b/reco/L1/CbmL1MCPoint.h index 555c67de3edced9d8ce3e75f3b6f4c378d877089..fa2f8b435dd1d043a73f9845a3b07385bf8e6e13 100644 --- a/reco/L1/CbmL1MCPoint.h +++ b/reco/L1/CbmL1MCPoint.h @@ -21,12 +21,12 @@ #ifndef CbmL1MCPoint_H #define CbmL1MCPoint_H +#include "CaVector.h" + #include <iomanip> #include <sstream> #include <string> -#include "CaVector.h" - namespace { using cbm::algo::ca::Vector; @@ -75,12 +75,14 @@ struct CbmL1MCPoint { int pointId = -1; int file = -1; int event = -1; - Vector<int> hitIds {"CbmL1MCPoint::hitIds"}; // indices of CbmL1Hits in L1->vStsHits array + Vector<int> hitIds{"CbmL1MCPoint::hitIds"}; // indices of CbmL1Hits in L1->vStsHits array /// Temporary log function for debugging std::string ToString(int verbose = 3, bool printHeader = false) const { - if (verbose < 1) { return std::string(); } + if (verbose < 1) { + return std::string(); + } std::stringstream msg; msg.precision(4); diff --git a/reco/L1/CbmL1MCTrack.cxx b/reco/L1/CbmL1MCTrack.cxx index 331177e2569b5c5da48ffd69ee2e67858e8fb7ba..919f36c8c14fa2c1381c9dde790aecc7a6e9b236 100644 --- a/reco/L1/CbmL1MCTrack.cxx +++ b/reco/L1/CbmL1MCTrack.cxx @@ -20,15 +20,14 @@ #include "CbmL1MCTrack.h" +#include "CaConstants.h" +#include "CaHit.h" #include "CbmL1.h" #include "CbmL1Constants.h" #include <iomanip> #include <sstream> -#include "CaConstants.h" -#include "CaHit.h" - using cbm::algo::ca::constants::size::MaxNstations; @@ -95,7 +94,8 @@ void CbmL1MCTrack::CalculateMCCont() for (int ih = 0; ih < nPoints; ih++) { CbmL1MCPoint& h = L1->fvMCPoints[Points[ih]]; int ista = h.iStation; - if (ista - istaold == 1) ncont++; + if (ista - istaold == 1) + ncont++; else if (ista - istaold > 1) { if (nMCContStations < ncont) nMCContStations = ncont; ncont = 1; @@ -111,7 +111,7 @@ void CbmL1MCTrack::CountHitStations() { CbmL1* L1 = CbmL1::Instance(); - int stationNhits[MaxNstations] {0}; + int stationNhits[MaxNstations]{0}; for (unsigned int iH = 0; iH < Hits.size(); iH++) { CbmL1HitDebugInfo& sh = L1->fvHitDebugInfo[Hits[iH]]; @@ -124,13 +124,17 @@ void CbmL1MCTrack::CountHitStations() int ncont = 0; for (int ista = 0; ista < L1->fpAlgo->GetParameters().GetNstationsActive(); ista++) { - if (maxNStaHits < stationNhits[ista]) { maxNStaHits = stationNhits[ista]; } + if (maxNStaHits < stationNhits[ista]) { + maxNStaHits = stationNhits[ista]; + } if (stationNhits[ista] > 0) { nStations++; ncont++; } else { - if (nHitContStations < ncont) { nHitContStations = ncont; } + if (nHitContStations < ncont) { + nHitContStations = ncont; + } ncont = 0; } } @@ -149,7 +153,8 @@ void CbmL1MCTrack::CalculateMaxNStaMC() int cur_maxNStaMC = 0, cur_maxNSensorMC = 0; for (unsigned int iH = 0; iH < Points.size(); iH++) { CbmL1MCPoint& mcP = L1->fvMCPoints[Points[iH]]; - if (mcP.iStation == lastSta) cur_maxNStaMC++; + if (mcP.iStation == lastSta) + cur_maxNStaMC++; else { // new station if (cur_maxNStaMC > maxNStaMC) maxNStaMC = cur_maxNStaMC; cur_maxNStaMC = 1; @@ -214,7 +219,9 @@ std::string CbmL1MCTrack::ToString(int verbose, bool header) const msg << setw(8) << setfill(' ') << "N h." << ' '; msg << setw(8) << setfill(' ') << "N p." << ' '; msg << setw(8) << setfill(' ') << "N r.tr." << ' '; - if (verbose > 2) { msg << setw(8) << setfill(' ') << "N t.tr." << ' '; } + if (verbose > 2) { + msg << setw(8) << setfill(' ') << "N t.tr." << ' '; + } msg << setw(12) << setfill(' ') << "zVTX [cm]" << ' '; msg << setw(12) << setfill(' ') << "t [ns]" << ' '; msg << setw(12) << setfill(' ') << "p [GeV/c]" << ' '; @@ -232,7 +239,9 @@ std::string CbmL1MCTrack::ToString(int verbose, bool header) const msg << setw(8) << setfill(' ') << Hits.size() << ' '; msg << setw(8) << setfill(' ') << Points.size() << ' '; msg << setw(8) << setfill(' ') << rTracks.size() << ' '; - if (verbose > 2) { msg << setw(8) << setfill(' ') << tTracks.size() << ' '; } + if (verbose > 2) { + msg << setw(8) << setfill(' ') << tTracks.size() << ' '; + } msg << setw(12) << setfill(' ') << z << ' '; msg << setw(12) << setfill(' ') << time << ' '; msg << setw(12) << setfill(' ') << p << ' '; diff --git a/reco/L1/CbmL1MCTrack.h b/reco/L1/CbmL1MCTrack.h index 991086c04cbe7adcfb715d034a79cda826d32c45..a5c1360298e9ee18cfdffd0e0a30cd24bb80be5b 100644 --- a/reco/L1/CbmL1MCTrack.h +++ b/reco/L1/CbmL1MCTrack.h @@ -21,16 +21,14 @@ #ifndef CbmL1MCTrack_H #define CbmL1MCTrack_H +#include "CaVector.h" #include "CbmL1MCPoint.h" - #include "TLorentzVector.h" #include "TVector3.h" #include <iostream> #include <string> -#include "CaVector.h" - namespace { namespace cacore = cbm::algo::ca; @@ -39,10 +37,10 @@ namespace class CbmL1Track; class CbmL1MCTrack { -public: + public: CbmL1MCTrack() = default; - CbmL1MCTrack(int _ID) : ID(_ID) {}; + CbmL1MCTrack(int _ID) : ID(_ID){}; CbmL1MCTrack(double mass, double q, TVector3 vr, TLorentzVector vp, int ID, int mother_ID, int pdg, unsigned int procID); @@ -79,13 +77,13 @@ public: /// @brief String representation of the contents std::string ToString(int verbose = 10, bool header = false) const; -private: + private: void CalculateMCCont(); void CountHitStations(); void CalculateMaxNStaMC(); void CalculateIsReconstructable(); -public: + public: double mass = 0.; double q = 0.; double p = 0.; @@ -103,11 +101,11 @@ public: int chainID = -1; // ID of the first particle in the decay chain int pdg = -1; unsigned int process_ID = (unsigned int) -1; - bool isSignal {0}; - cacore::Vector<int> Points {"CbmL1MCTrack::Points"}; // indices of pints in CbmL1::fvMCPoints - cacore::Vector<int> Hits {"CbmL1MCTrack::Hits"}; // indices of hits in algo->vHits or L1::vHits + bool isSignal{0}; + cacore::Vector<int> Points{"CbmL1MCTrack::Points"}; // indices of pints in CbmL1::fvMCPoints + cacore::Vector<int> Hits{"CbmL1MCTrack::Hits"}; // indices of hits in algo->vHits or L1::vHits -private: + private: int nMCContStations = 0; // number of consecutive stations with mcPoints int nHitContStations = 0; // number of consecutive stations with hits int maxNStaMC = 0; // max number of mcPoints on station @@ -121,10 +119,10 @@ private: bool isAdditional = false; // is not reconstructable, but stil interesting // next members filled and used in Performance - cacore::Vector<CbmL1Track*> rTracks {"CbmL1MCTrack::rTracks"}; // array of associated recoTracks - cacore::Vector<CbmL1Track*> tTracks {"CbmL1MCTrack::tTracks"}; // array of recoTracks - // which aren't associated with this mcTrack, - // but use some hits from it. + cacore::Vector<CbmL1Track*> rTracks{"CbmL1MCTrack::rTracks"}; // array of associated recoTracks + cacore::Vector<CbmL1Track*> tTracks{"CbmL1MCTrack::tTracks"}; // array of recoTracks + // which aren't associated with this mcTrack, + // but use some hits from it. // NOTE: SZh 14.12.2022: on the replacement from rTracks and tTracks cacore::Vector<int> rTrackIndexes = {"CbmL1MCTrack::rTrackIndexes"}; // array of associated recoTrack indexes diff --git a/reco/L1/CbmL1Performance.cxx b/reco/L1/CbmL1Performance.cxx index 19e1c8703aacd1e3b109a57cc2c3b3bde50ac9fa..40268631ebd530bba1e947094a94a8f98f99b6dc 100644 --- a/reco/L1/CbmL1Performance.cxx +++ b/reco/L1/CbmL1Performance.cxx @@ -18,6 +18,10 @@ *==================================================================== */ +#include "CaFramework.h" +#include "CaToolsDebugger.h" +#include "CaTrackFit.h" +#include "CaTrackParam.h" #include "CbmL1.h" #include "CbmL1Constants.h" #include "CbmL1Counters.h" @@ -34,11 +38,9 @@ #include "CbmTofPoint.h" #include "CbmTrdHit.h" #include "CbmTrdPoint.h" - #include "FairField.h" #include "FairRunAna.h" #include "FairTrackParam.h" // for vertex pulls - #include "TFile.h" #include "TH1.h" #include "TH2.h" @@ -48,18 +50,12 @@ #include <boost/filesystem.hpp> +#include <cmath> #include <iostream> #include <list> #include <map> #include <vector> -#include <cmath> - -#include "CaFramework.h" -#include "CaToolsDebugger.h" -#include "CaTrackFit.h" -#include "CaTrackParam.h" - using namespace cbm::algo::ca; using cbm::ca::tools::Debugger; @@ -85,7 +81,9 @@ void CbmL1::TrackMatch() // fill pMCTrackMap for (vector<CbmL1MCTrack>::iterator i = fvMCTracks.begin(); i != fvMCTracks.end(); ++i) { CbmL1MCTrack& MC = *i; - if (pMCTrackMap.find(MC.ID) == pMCTrackMap.end()) { pMCTrackMap.insert(pair<int, CbmL1MCTrack*>(MC.ID, &MC)); } + if (pMCTrackMap.find(MC.ID) == pMCTrackMap.end()) { + pMCTrackMap.insert(pair<int, CbmL1MCTrack*>(MC.ID, &MC)); + } else { cout << "*** L1: Track ID " << MC.ID << " encountered twice! ***" << endl; } @@ -134,7 +132,9 @@ void CbmL1::TrackMatch() double purity = double(nMcTrackHits) / double(hitsum); // count max-purity - if (max_percent < purity) { max_percent = purity; } + if (max_percent < purity) { + max_percent = purity; + } // set relation to the mcTrack assert(pMCTrackMap.find(iMcTrack) != pMCTrackMap.end()); @@ -195,7 +195,7 @@ struct TL1PerfEfficiencies : public TL1Efficiencies { AddCounter("slow_e", "Slow E efficiency"); } - virtual ~TL1PerfEfficiencies() {}; + virtual ~TL1PerfEfficiencies(){}; virtual void AddCounter(const TString& shortname, const TString& name) { @@ -284,7 +284,9 @@ struct TL1PerfEfficiencies : public TL1Efficiencies { if (ifPrintTableToLog) { cout << *aTable; // print a table to log } - if (!ifDeleteTable) { aTable->SetDirectory(fOutDir); } + if (!ifDeleteTable) { + aTable->SetDirectory(fOutDir); + } else { delete aTable; } @@ -302,7 +304,7 @@ struct TL1PerfEfficiencies : public TL1Efficiencies { TL1TracksCatCounters<int> mc_length; TL1TracksCatCounters<int> mc_length_hits; - TDirectory* fOutDir {nullptr}; // Specified for saving tables + TDirectory* fOutDir{nullptr}; // Specified for saving tables }; @@ -953,7 +955,9 @@ void CbmL1::HistoPerformance() // TODO: check if works correctly. Change vHitFa } } - if (mtra.IsAdditional()) { h_acc_mom_short123s->Fill(momentum); } + if (mtra.IsAdditional()) { + h_acc_mom_short123s->Fill(momentum); + } if (!mtra.IsReconstructable()) continue; mc_total++; @@ -1108,7 +1112,8 @@ void CbmL1::HistoPerformance() // TODO: check if works correctly. Change vHitFa if (mtra.isSignal) { // D0 h_reco_d0_mom->Fill(momentum); - if (reco) p_eff_d0_vs_mom->Fill(momentum, 100.0); + if (reco) + p_eff_d0_vs_mom->Fill(momentum, 100.0); else p_eff_d0_vs_mom->Fill(momentum, 0.0); } @@ -1299,14 +1304,18 @@ void CbmL1::TrackFitPerformance() int nTimeMeasurenments = 0; for (unsigned int ih = 0; ih < it->Hits.size(); ih++) { int ista = fvHitDebugInfo[it->Hits[ih]].iStation; - if (fpAlgo->GetParameters().GetStation(ista).timeInfo) { nTimeMeasurenments++; } + if (fpAlgo->GetParameters().GetStation(ista).timeInfo) { + nTimeMeasurenments++; + } } isTimeFitted = (nTimeMeasurenments > 1); } do { // first hit - if (it->GetNMCTracks() < 1) { break; } + if (it->GetNMCTracks() < 1) { + break; + } const CbmL1MCTrack& mcTrack = *(it->GetMCTracks()[0]); @@ -1369,7 +1378,9 @@ void CbmL1::TrackFitPerformance() do { // vertex - if (it->GetNMCTracks() < 1) { break; } + if (it->GetNMCTracks() < 1) { + break; + } CbmL1MCTrack mc = *(it->GetMCTracks()[0]); fit.SetTrack(*it); @@ -1436,7 +1447,9 @@ void CbmL1::TrackFitPerformance() } double dvi = tr.GetVi()[0] - sqrt(1. + mc.mass * mc.mass / mc.p / mc.p) * constants::phys::SpeedOfLightInvD; h_fitSV[14]->Fill(dvi * constants::phys::SpeedOfLightD); - if (std::isfinite((fscal) tr.C66()[0]) && tr.C66()[0] > 0.) { h_fitSV[15]->Fill(dvi / sqrt(tr.C66()[0])); } + if (std::isfinite((fscal) tr.C66()[0]) && tr.C66()[0] > 0.) { + h_fitSV[15]->Fill(dvi / sqrt(tr.C66()[0])); + } h_fitSV[16]->Fill(tr.GetVi()[0] * constants::phys::SpeedOfLightD); } } @@ -1512,7 +1525,9 @@ void CbmL1::TrackFitPerformance() } double dvi = tr.GetVi()[0] - sqrt(1. + mc.mass * mc.mass / mc.p / mc.p) * constants::phys::SpeedOfLightInvD; h_fitPV[14]->Fill(dvi * constants::phys::SpeedOfLightD); - if (std::isfinite((fscal) tr.C66()[0]) && tr.C66()[0] > 0.) { h_fitPV[15]->Fill(dvi / sqrt(tr.C66()[0])); } + if (std::isfinite((fscal) tr.C66()[0]) && tr.C66()[0] > 0.) { + h_fitPV[15]->Fill(dvi / sqrt(tr.C66()[0])); + } h_fitPV[16]->Fill(tr.GetVi()[0] * constants::phys::SpeedOfLightD); } } @@ -1618,7 +1633,9 @@ void CbmL1::FillFitHistos(TrackParamV& track, const CbmL1MCPoint& mcP, bool isTi } double dvi = tr.GetVi()[0] - sqrt(1. + mcP.mass * mcP.mass / mcP.p / mcP.p) * constants::phys::SpeedOfLightInvD; h[14]->Fill(dvi * constants::phys::SpeedOfLightD); - if (std::isfinite((fscal) tr.C66()[0]) && tr.C66()[0] > 0.) { h[15]->Fill(dvi / sqrt(tr.C66()[0])); } + if (std::isfinite((fscal) tr.C66()[0]) && tr.C66()[0] > 0.) { + h[15]->Fill(dvi / sqrt(tr.C66()[0])); + } h[16]->Fill(tr.GetVi()[0] * constants::phys::SpeedOfLightD); } } @@ -2379,13 +2396,15 @@ void CbmL1::DumpMCTripletsToTree() for (const auto& tr : fvMCTracks) { // Use only reconstructable tracks - if (!tr.IsReconstructable()) { continue; } + if (!tr.IsReconstructable()) { + continue; + } std::vector<ReducedMcPoint> vPoints; vPoints.reserve(tr.Points.size()); for (unsigned int iP = 0; iP < tr.Points.size(); ++iP) { const auto& point = fvMCPoints[tr.Points[iP]]; - vPoints.emplace_back(ReducedMcPoint {point.iStation, float(point.x), float(point.y), float(point.z)}); + vPoints.emplace_back(ReducedMcPoint{point.iStation, float(point.x), float(point.y), float(point.z)}); } std::sort(vPoints.begin(), vPoints.end(), diff --git a/reco/L1/CbmL1ReadEvent.cxx b/reco/L1/CbmL1ReadEvent.cxx index 5219a66bd95714aacd6da70ba307cdaf906b6be1..1752021d7a2872ac3a1e174c71f69cccd1d4221f 100644 --- a/reco/L1/CbmL1ReadEvent.cxx +++ b/reco/L1/CbmL1ReadEvent.cxx @@ -19,6 +19,8 @@ *==================================================================== */ +#include "CaFramework.h" +#include "CaToolsDebugger.h" #include "CbmEvent.h" #include "CbmL1.h" #include "CbmMCDataObject.h" @@ -40,17 +42,12 @@ #include "CbmTrdHit.h" #include "CbmTrdPoint.h" #include "CbmTrdTrackingInterface.h" - #include "FairMCEventHeader.h" - #include "TDatabasePDG.h" #include "TRandom.h" #include <iostream> -#include "CaFramework.h" -#include "CaToolsDebugger.h" - using std::cout; using std::endl; using std::find; @@ -79,8 +76,8 @@ struct TmpHit { double dx2; ///< hit position uncertainty along x axis [cm] double dy2; ///< hit position uncertainty along y axis [cm] double dxy; ///< hit position covariance along x and y axes [cm2] - std::vector<int> vMc {}; - int iBestMc {-1}; ///< index of MCPoint in the fvMCPoints array + std::vector<int> vMc{}; + int iBestMc{-1}; ///< index of MCPoint in the fvMCPoints array double time = 0.; ///< time of the hit [ns] double dt2 = 1.e8; ///< time error of the hit [ns] double rangeX; ///< hit range in X [cm] @@ -97,14 +94,30 @@ struct TmpHit { { if constexpr (kVerboseAccept) { std::stringstream msg; - if (std::isnan(x) || std::isinf(x)) { msg << ", x = " << x; } - if (std::isnan(y) || std::isinf(y)) { msg << ", y = " << y; } - if (std::isnan(z) || std::isinf(z)) { msg << ", z = " << z; } - if (std::isnan(time) || std::isinf(time)) { msg << ", t = " << time; } - if (std::isnan(dx2) || std::isinf(dx2)) { msg << ", dx2 = " << dx2; } - if (std::isnan(dy2) || std::isinf(dy2)) { msg << ", dy2 = " << dy2; } - if (std::isnan(dxy) || std::isinf(dxy)) { msg << ", dxy = " << dxy; } - if (std::isnan(dt2) || std::isinf(dt2)) { msg << ", dt2 = " << dt2; } + if (std::isnan(x) || std::isinf(x)) { + msg << ", x = " << x; + } + if (std::isnan(y) || std::isinf(y)) { + msg << ", y = " << y; + } + if (std::isnan(z) || std::isinf(z)) { + msg << ", z = " << z; + } + if (std::isnan(time) || std::isinf(time)) { + msg << ", t = " << time; + } + if (std::isnan(dx2) || std::isinf(dx2)) { + msg << ", dx2 = " << dx2; + } + if (std::isnan(dy2) || std::isinf(dy2)) { + msg << ", dy2 = " << dy2; + } + if (std::isnan(dxy) || std::isinf(dxy)) { + msg << ", dxy = " << dxy; + } + if (std::isnan(dt2) || std::isinf(dt2)) { + msg << ", dt2 = " << dt2; + } const auto& sMsg = msg.str(); if (sMsg.size()) { LOG(warn) << "CbmL1: Discarding hit " << ExtIndex << ": det = " << Det @@ -160,18 +173,38 @@ void CbmL1::ReadEvent(CbmEvent* event) { // reserve enough space for hits int nHitsTotal = 0; if (event) { // be careful: GetNofData() can return -1 - if (fUseMVD && fpMvdHits) { nHitsTotal += event->GetNofData(ECbmDataType::kMvdHit); } - if (fUseSTS && fpStsHits) { nHitsTotal += event->GetNofData(ECbmDataType::kStsHit); } - if (fUseMUCH && fpMuchPixelHits) { nHitsTotal += event->GetNofData(ECbmDataType::kMuchPixelHit); } - if (fUseTRD && fpTrdHits) { nHitsTotal += event->GetNofData(ECbmDataType::kTrdHit); } - if (fUseTOF && fpTofHits) { nHitsTotal += event->GetNofData(ECbmDataType::kTofHit); } + if (fUseMVD && fpMvdHits) { + nHitsTotal += event->GetNofData(ECbmDataType::kMvdHit); + } + if (fUseSTS && fpStsHits) { + nHitsTotal += event->GetNofData(ECbmDataType::kStsHit); + } + if (fUseMUCH && fpMuchPixelHits) { + nHitsTotal += event->GetNofData(ECbmDataType::kMuchPixelHit); + } + if (fUseTRD && fpTrdHits) { + nHitsTotal += event->GetNofData(ECbmDataType::kTrdHit); + } + if (fUseTOF && fpTofHits) { + nHitsTotal += event->GetNofData(ECbmDataType::kTofHit); + } } else { - if (fUseMVD && fpMvdHits) { nHitsTotal += fpMvdHits->GetEntriesFast(); } - if (fUseSTS && fpStsHits) { nHitsTotal += fpStsHits->GetEntriesFast(); } - if (fUseMUCH && fpMuchPixelHits) { nHitsTotal += fpMuchPixelHits->GetEntriesFast(); } - if (fUseTRD && fpTrdHits) { nHitsTotal += fpTrdHits->GetEntriesFast(); } - if (fUseTOF && fpTofHits) { nHitsTotal += fpTofHits->GetEntriesFast(); } + if (fUseMVD && fpMvdHits) { + nHitsTotal += fpMvdHits->GetEntriesFast(); + } + if (fUseSTS && fpStsHits) { + nHitsTotal += fpStsHits->GetEntriesFast(); + } + if (fUseMUCH && fpMuchPixelHits) { + nHitsTotal += fpMuchPixelHits->GetEntriesFast(); + } + if (fUseTRD && fpTrdHits) { + nHitsTotal += fpTrdHits->GetEntriesFast(); + } + if (fUseTOF && fpTofHits) { + nHitsTotal += fpTofHits->GetEntriesFast(); + } } tmpHits.reserve(nHitsTotal); } @@ -267,9 +300,13 @@ void CbmL1::ReadEvent(CbmEvent* event) double bestWeight = 0; for (int iLink = 0; iLink < pHitMatch->GetNofLinks(); ++iLink) { const auto& link = pHitMatch->GetLink(iLink); - if (link.GetFile() != iFile || link.GetEntry() != iEvent) { continue; } + if (link.GetFile() != iFile || link.GetEntry() != iEvent) { + continue; + } int iPext = link.GetIndex(); - if (iPext < 0) { continue; } + if (iPext < 0) { + continue; + } auto* pExtPoint = static_cast<CbmTofPoint*>(fpTofPoints->Get(link)); int trkId = pExtPoint->GetTrackID(); int rpcAddr = pExtPoint->GetDetectorID() << kNofBitsRpcAddress; // FIXME: @@ -280,7 +317,9 @@ void CbmL1::ReadEvent(CbmEvent* event) mMatchedPointId[key] = iPext; } else { // If we find two links for the same interaction, we select the one with the largest weight - if (bestWeight < link.GetWeight()) { mMatchedPointId[key] = iPext; } + if (bestWeight < link.GetWeight()) { + mMatchedPointId[key] = iPext; + } } } } // iH @@ -302,13 +341,17 @@ void CbmL1::ReadEvent(CbmEvent* event) int rpcAddr = pExtPoint->GetDetectorID() << kNofBitsRpcAddress; // New point if (rpcAddrCurr != rpcAddr || iTmcCurr != iTmc) { - if (iPointSelected != -1) { ReadMCPoint(ca::EDetectorID::kTof, iFile, iEvent, iPointSelected); } + if (iPointSelected != -1) { + ReadMCPoint(ca::EDetectorID::kTof, iFile, iEvent, iPointSelected); + } iTmcCurr = iTmc; rpcAddrCurr = rpcAddr; auto key = std::make_pair(iTmc, rpcAddr); auto found = mMatchedPointId.find(key); bTrkHasHits = found != mMatchedPointId.end(); - if (bTrkHasHits) { iPointSelected = found->second; } + if (bTrkHasHits) { + iPointSelected = found->second; + } else { // First iteration zCell = CbmTofTrackingInterface::Instance()->GetZrefModule(pExtPoint->GetDetectorID()); @@ -327,7 +370,9 @@ void CbmL1::ReadEvent(CbmEvent* event) } } // Add the last point - if (iPointSelected != -1) { ReadMCPoint(ca::EDetectorID::kTof, iFile, iEvent, iPointSelected); } + if (iPointSelected != -1) { + ReadMCPoint(ca::EDetectorID::kTof, iFile, iEvent, iPointSelected); + } } // iP } } //time_slice @@ -390,7 +435,9 @@ void CbmL1::ReadEvent(CbmEvent* event) th.iStripF = firstDetStrip + j; th.iStripB = th.iStripF; - if (NStrips <= th.iStripF) { NStrips = th.iStripF + 1; } + if (NStrips <= th.iStripF) { + NStrips = th.iStripF + 1; + } TVector3 pos, err; h->Position(pos); @@ -411,7 +458,9 @@ void CbmL1::ReadEvent(CbmEvent* event) std::tie(th.rangeX, th.rangeY, th.rangeT) = CbmMvdTrackingInterface::Instance()->GetHitRanges(*h); } th.Det = 0; - if (fPerformance) { std::tie(th.iBestMc, th.vMc) = MatchHitWithMc<ca::EDetectorID::kMvd>(hitIndex); } + if (fPerformance) { + std::tie(th.iBestMc, th.vMc) = MatchHitWithMc<ca::EDetectorID::kMvd>(hitIndex); + } th.fDataStream = (static_cast<int64_t>(th.Det) << 60) | h->GetAddress(); //if( th.iMC >=0 ) // DEBUG !!!! if (th.IfAccept()) { @@ -457,8 +506,12 @@ void CbmL1::ReadEvent(CbmEvent* event) th.iStripF = firstDetStrip + h->GetFrontClusterId(); th.iStripB = firstDetStrip + h->GetBackClusterId(); - if (NStrips <= th.iStripF) { NStrips = th.iStripF + 1; } - if (NStrips <= th.iStripB) { NStrips = th.iStripB + 1; } + if (NStrips <= th.iStripF) { + NStrips = th.iStripF + 1; + } + if (NStrips <= th.iStripB) { + NStrips = th.iStripB + 1; + } //Get time th.time = h->GetTime(); @@ -479,7 +532,9 @@ void CbmL1::ReadEvent(CbmEvent* event) std::tie(th.rangeX, th.rangeY, th.rangeT) = CbmStsTrackingInterface::Instance()->GetHitRanges(*h); } - if (fPerformance) { std::tie(th.iBestMc, th.vMc) = MatchHitWithMc<ca::EDetectorID::kSts>(hitIndex); } + if (fPerformance) { + std::tie(th.iBestMc, th.vMc) = MatchHitWithMc<ca::EDetectorID::kSts>(hitIndex); + } th.fDataStream = (static_cast<int64_t>(th.Det) << 60) | h->GetAddress(); if (th.IfAccept()) { @@ -523,7 +578,9 @@ void CbmL1::ReadEvent(CbmEvent* event) // th.iSector = 0; th.iStripF = firstDetStrip + hitIndex; th.iStripB = th.iStripF; - if (NStrips <= th.iStripF) { NStrips = th.iStripF + 1; } + if (NStrips <= th.iStripF) { + NStrips = th.iStripF + 1; + } th.x = h->GetX(); th.y = h->GetY(); @@ -535,7 +592,9 @@ void CbmL1::ReadEvent(CbmEvent* event) std::tie(th.rangeX, th.rangeY, th.rangeT) = CbmMuchTrackingInterface::Instance()->GetHitRanges(*h); } - if (fPerformance) { std::tie(th.iBestMc, th.vMc) = MatchHitWithMc<ca::EDetectorID::kMuch>(hitIndex); } + if (fPerformance) { + std::tie(th.iBestMc, th.vMc) = MatchHitWithMc<ca::EDetectorID::kMuch>(hitIndex); + } th.fDataStream = (static_cast<int64_t>(th.Det) << 60) | h->GetAddress(); if (th.IfAccept()) { tmpHits.push_back(th); @@ -607,7 +666,9 @@ void CbmL1::ReadEvent(CbmEvent* event) std::tie(th.rangeX, th.rangeY, th.rangeT) = CbmTrdTrackingInterface::Instance()->GetHitRanges(*h); - if (fPerformance) { std::tie(th.iBestMc, th.vMc) = MatchHitWithMc<ca::EDetectorID::kTrd>(hitIndex); } + if (fPerformance) { + std::tie(th.iBestMc, th.vMc) = MatchHitWithMc<ca::EDetectorID::kTrd>(hitIndex); + } th.fDataStream = (static_cast<int64_t>(th.Det) << 60) | h->GetAddress(); if (th.IfAccept()) { @@ -660,7 +721,9 @@ void CbmL1::ReadEvent(CbmEvent* event) // th.iSector = 0; th.iStripF = firstDetStrip + j; th.iStripB = th.iStripF; - if (NStrips <= th.iStripF) { NStrips = th.iStripF + 1; } + if (NStrips <= th.iStripF) { + NStrips = th.iStripF + 1; + } TVector3 pos, err; h->Position(pos); @@ -675,7 +738,9 @@ void CbmL1::ReadEvent(CbmEvent* event) //TODO: is it still needed here? (S.Zharko) if (ca::Framework::TrackingMode::kMcbm == fTrackingMode && th.z > 400) continue; - if (fPerformance) { std::tie(th.iBestMc, th.vMc) = MatchHitWithMc<ca::EDetectorID::kTof>(hitIndex); } + if (fPerformance) { + std::tie(th.iBestMc, th.vMc) = MatchHitWithMc<ca::EDetectorID::kTof>(hitIndex); + } th.fDataStream = (static_cast<int64_t>(th.Det) << 60) | h->GetAddress(); if (th.IfAccept()) { @@ -701,7 +766,9 @@ void CbmL1::ReadEvent(CbmEvent* event) * Measured hits gathering: END */ - if (fVerbose >= 10) { cout << "ReadEvent: strips are read." << endl; } + if (fVerbose >= 10) { + cout << "ReadEvent: strips are read." << endl; + } // ----- Fill and save fvExternalHits, fvHitDebugInfo and fvHitPointIndices vectors as well as fpData->vHits @@ -777,13 +844,19 @@ void CbmL1::ReadEvent(CbmEvent* event) fvHitPointIndices.push_back(th.vMc); fvHitBestPointIndices.push_back(th.iBestMc); } - if (fPerformance) { HitMatch(); } /// OLD + if (fPerformance) { + HitMatch(); + } /// OLD if (fVerbose >= 2) cout << "ReadEvent: mvd and sts are saved." << endl; // ----- Send data from IODataManager to ca::Framework -------------------------------------------------------------------- - if (1 == fSTAPDataMode) { WriteSTAPAlgoInputData(nCalls); } - if (2 == fSTAPDataMode) { ReadSTAPAlgoInputData(nCalls); } + if (1 == fSTAPDataMode) { + WriteSTAPAlgoInputData(nCalls); + } + if (2 == fSTAPDataMode) { + ReadSTAPAlgoInputData(nCalls); + } // TODO: SZh: If we read data from file, we don't need to collect them above. This should be addressed fpAlgo->ReceiveInputData(fpIODataManager->TakeInputData()); @@ -827,7 +900,9 @@ void CbmL1::Fill_vMCTracks() /* Loop over MC tracks */ for (Int_t iMCTrack = 0; iMCTrack < nMCTrack; iMCTrack++) { CbmMCTrack* MCTrack = dynamic_cast<CbmMCTrack*>(fpMcTracks->Get(iFile, iEvent, iMCTrack)); - if (!MCTrack) { continue; } + if (!MCTrack) { + continue; + } int mother_ID = MCTrack->GetMotherId(); @@ -933,7 +1008,9 @@ void CbmL1::ReadMCPoint(ca::EDetectorID iDet, int file, int event, int iPoint) CbmL1MCPoint MC; MC.iStation = fpAlgo->GetParameters().GetStationIndexActive(iStLoc, iDet); - if (MC.iStation < 0) { return; } + if (MC.iStation < 0) { + return; + } TVector3 xyzI, PI; fairPoint->Position(xyzI); @@ -977,7 +1054,9 @@ void CbmL1::ReadMCPoint(ca::EDetectorID iDet, int file, int event, int iPoint) if (MC.ID < 0) return; - if (!MCTrack) { return; } + if (!MCTrack) { + return; + } MC.pdg = MCTrack->GetPdgCode(); MC.mother_ID = MCTrack->GetMotherId(); @@ -1035,7 +1114,9 @@ void CbmL1::HitMatch() hit.SetBestMcPointId(fvHitBestPointIndices[iH]); hit.fMcPointIds.clear(); for (int iP : fvHitPointIndices[iH]) { - if (iP < 0) { continue; } + if (iP < 0) { + continue; + } hit.AddMcPointId(iP); fvMCPoints[iP].hitIds.push_back_no_warning(iH); } diff --git a/reco/L1/CbmL1Track.h b/reco/L1/CbmL1Track.h index 127938ebff7e816568e12a72d587a7d3a93d497c..9ddedc826ff069318f771ac0d7806691c24f34aa 100644 --- a/reco/L1/CbmL1Track.h +++ b/reco/L1/CbmL1Track.h @@ -22,9 +22,10 @@ #ifndef CbmL1Track_H #define CbmL1Track_H +#include "CaTrackParam.h" +#include "CaVector.h" #include "CbmL1Constants.h" #include "CbmL1MCTrack.h" - #include "TMath.h" #include <iterator> @@ -32,9 +33,6 @@ #include <string> #include <vector> -#include "CaTrackParam.h" -#include "CaVector.h" - namespace { namespace ca = cbm::algo::ca; @@ -43,7 +41,7 @@ namespace class CbmL1MCTrack; class CbmL1Track : public cbm::algo::ca::TrackParamD { -public: + public: CbmL1Track() = default; /// Adds pointer to MC track (TODO: remove this and related methods) @@ -122,23 +120,23 @@ public: cbm::algo::ca::TrackParamD TLast; ///< Track parameters in the end of the track std::vector<int> Hits; ///< Indexes of hits of this track - int nStations {0}; ///< Number of stations with hits of this track - int index {0}; ///< Index of this track (TODO: it seems to be not initialized) + int nStations{0}; ///< Number of stations with hits of this track + int index{0}; ///< Index of this track (TODO: it seems to be not initialized) - double fTrackTime {0.}; ///< Time of the track [ns] ??? + double fTrackTime{0.}; ///< Time of the track [ns] ??? std::map<int, int> hitMap; // N hits (second) from each mcTrack (first is a MC track ID) belong to current recoTrack // FIXME: SZh 14.12.2022: map => unordered_map -private: + private: // next members filled and used in Performance std::vector<CbmL1MCTrack*> mcTracks; // array of assosiated recoTracks. Should be only one. ca::Vector<int> fvMcTrackIndexes = {"CbmL1Track::fvMcTrackIndexes"}; // global indexes of MC tracks // NOTE: mcTracks should be replaced with fvMcTrackIndexes - double maxPurity {-1.}; ///< Maximum persent of hits, which belong to one mcTrack. + double maxPurity{-1.}; ///< Maximum persent of hits, which belong to one mcTrack. }; #endif diff --git a/reco/L1/CbmL1Util.h b/reco/L1/CbmL1Util.h index 6d62b6e9ac22b3cdb61e1f3a74593033089a1d74..4e8568dc9237bd63b599ee7ec29780fbe724aced 100644 --- a/reco/L1/CbmL1Util.h +++ b/reco/L1/CbmL1Util.h @@ -5,6 +5,7 @@ #ifndef CbmL1Util_H #define CbmL1Util_H 1 +#include "CaTrackParam.h" #include "CbmDefs.h" #include "CbmL1DetectorID.h" #include "CbmMuchTrackingInterface.h" @@ -12,11 +13,8 @@ #include "CbmStsTrackingInterface.h" #include "CbmTofTrackingInterface.h" #include "CbmTrdTrackingInterface.h" - #include "Rtypes.h" -#include "CaTrackParam.h" - class FairTrackParam; /// diff --git a/reco/L1/CbmL1Vtx.h b/reco/L1/CbmL1Vtx.h index 6b52c024c7a7e122c443aaebb36becba6b2d767d..5036ef35d28db7af2f572271ebc5f4e9f37ce07e 100644 --- a/reco/L1/CbmL1Vtx.h +++ b/reco/L1/CbmL1Vtx.h @@ -41,7 +41,7 @@ struct CbmL1Vtx { , chi2(0) , NDF(0) , mass(0) - , mass_err(0) {}; + , mass_err(0){}; double MC_mass, MC_q, MC_p, MC_x, MC_y, MC_z, MC_px, MC_py, MC_pz; int MC_ID, MC_pdg; diff --git a/reco/L1/CbmTrackingDetectorInterfaceInit.cxx b/reco/L1/CbmTrackingDetectorInterfaceInit.cxx index ad27b0b6688e4b0915d38ad51705cb8b2d33065e..13a88fa821690baf4cd3cd777b4cc25cc6bee9eb 100644 --- a/reco/L1/CbmTrackingDetectorInterfaceInit.cxx +++ b/reco/L1/CbmTrackingDetectorInterfaceInit.cxx @@ -37,18 +37,38 @@ CbmTrackingDetectorInterfaceInit::CbmTrackingDetectorInterfaceInit() : FairTask( fbUseTof = CbmSetup::Instance()->IsActive(ECbmModuleId::kTof); // Invoke the detector interfaces - if (fbUseMvd) { fpMvdTrackingInterface = new CbmMvdTrackingInterface(); } - if (fbUseSts) { fpStsTrackingInterface = new CbmStsTrackingInterface(); } - if (fbUseMuch) { fpMuchTrackingInterface = new CbmMuchTrackingInterface(); } - if (fbUseTrd) { fpTrdTrackingInterface = new CbmTrdTrackingInterface(); } - if (fbUseTof) { fpTofTrackingInterface = new CbmTofTrackingInterface(); } + if (fbUseMvd) { + fpMvdTrackingInterface = new CbmMvdTrackingInterface(); + } + if (fbUseSts) { + fpStsTrackingInterface = new CbmStsTrackingInterface(); + } + if (fbUseMuch) { + fpMuchTrackingInterface = new CbmMuchTrackingInterface(); + } + if (fbUseTrd) { + fpTrdTrackingInterface = new CbmTrdTrackingInterface(); + } + if (fbUseTof) { + fpTofTrackingInterface = new CbmTofTrackingInterface(); + } // Add subtasks - tracker detector interfaces - if (fbUseMvd) { this->Add(fpMvdTrackingInterface); } - if (fbUseSts) { this->Add(fpStsTrackingInterface); } - if (fbUseMuch) { this->Add(fpMuchTrackingInterface); } - if (fbUseTrd) { this->Add(fpTrdTrackingInterface); } - if (fbUseTof) { this->Add(fpTofTrackingInterface); } + if (fbUseMvd) { + this->Add(fpMvdTrackingInterface); + } + if (fbUseSts) { + this->Add(fpStsTrackingInterface); + } + if (fbUseMuch) { + this->Add(fpMuchTrackingInterface); + } + if (fbUseTrd) { + this->Add(fpTrdTrackingInterface); + } + if (fbUseTof) { + this->Add(fpTofTrackingInterface); + } } } @@ -56,5 +76,7 @@ CbmTrackingDetectorInterfaceInit::CbmTrackingDetectorInterfaceInit() : FairTask( // CbmTrackingDetectorInterfaceInit::~CbmTrackingDetectorInterfaceInit() { - if (fpInstance == this) { fpInstance = nullptr; } + if (fpInstance == this) { + fpInstance = nullptr; + } } diff --git a/reco/L1/CbmTrackingDetectorInterfaceInit.h b/reco/L1/CbmTrackingDetectorInterfaceInit.h index ffc52c2c730554553f1a9d523a92a6b66c40da05..7cb01e324812f6cbe606099193c58c7be8d9afe0 100644 --- a/reco/L1/CbmTrackingDetectorInterfaceInit.h +++ b/reco/L1/CbmTrackingDetectorInterfaceInit.h @@ -26,7 +26,7 @@ class CbmTofTrackingInterface; /// be added as a task to the FairRunAna instance prior to the CbmL1 task. /// class CbmTrackingDetectorInterfaceInit : public FairTask { -public: + public: /// Default constructor (only sts and mvd will be initialized) CbmTrackingDetectorInterfaceInit(); @@ -51,14 +51,14 @@ public: CbmTofTrackingInterface* GetTofTrackingInterface() { return fpTofTrackingInterface; } -private: + private: static CbmTrackingDetectorInterfaceInit* fpInstance; ///< Instance of the class - CbmMvdTrackingInterface* fpMvdTrackingInterface {nullptr}; ///< Instance of the MVD tracker interface - CbmStsTrackingInterface* fpStsTrackingInterface {nullptr}; ///< Instance of the STS tracker interface - CbmMuchTrackingInterface* fpMuchTrackingInterface {nullptr}; ///< Instance of the MuCh tracker interface - CbmTrdTrackingInterface* fpTrdTrackingInterface {nullptr}; ///< Instance of the TRD tracker interface - CbmTofTrackingInterface* fpTofTrackingInterface {nullptr}; ///< Instance of the TOF tracker interface + CbmMvdTrackingInterface* fpMvdTrackingInterface{nullptr}; ///< Instance of the MVD tracker interface + CbmStsTrackingInterface* fpStsTrackingInterface{nullptr}; ///< Instance of the STS tracker interface + CbmMuchTrackingInterface* fpMuchTrackingInterface{nullptr}; ///< Instance of the MuCh tracker interface + CbmTrdTrackingInterface* fpTrdTrackingInterface{nullptr}; ///< Instance of the TRD tracker interface + CbmTofTrackingInterface* fpTofTrackingInterface{nullptr}; ///< Instance of the TOF tracker interface bool fbUseMvd = false; ///< If MVD used in a setup bool fbUseSts = false; ///< If STS used in a setup diff --git a/reco/L1/L1Algo/inactive/L1Array.h b/reco/L1/L1Algo/inactive/L1Array.h index 21f0a5be5612a04740155c4096cc7dfb9518ade5..2e1f3c75d4603c43159a58bc148f5c94fa19f839 100644 --- a/reco/L1/L1Algo/inactive/L1Array.h +++ b/reco/L1/L1Algo/inactive/L1Array.h @@ -5,14 +5,14 @@ #ifndef L1Array_h #define L1Array_h 1 +#include "L1Assert.h" + #include <Logger.h> #include <array> #include <string> #include <utility> -#include "L1Assert.h" - /// Idea: std::array based class, where the size() and copacity() return different numbers. /// Size returns the effective size of array (i.e. the number of elements, which were really) @@ -22,7 +22,7 @@ using namespace cbm::algo::ca; //TODO: remove template<class Tvalue, std::size_t MaxCapacity> class L1Array : private std::array<Tvalue, MaxCapacity> { -public: + public: // Type definitions using Tbase = std::array<Tvalue, MaxCapacity>; using Tsize = typename Tbase::size_type; @@ -169,11 +169,11 @@ public: std::swap_ranges(begin(), end(), other.begin()); } -private: + private: using Tbase::at; - Tsize fSize {0}; - std::string fName {"no name"}; + Tsize fSize{0}; + std::string fName{"no name"}; }; diff --git a/reco/L1/L1Algo/inactive/L1Assert.h b/reco/L1/L1Algo/inactive/L1Assert.h index 7effb3cfec4b5d5db12ab097dcb331b9c4859f2f..b49f67afbe184fc974227bd9affe149da8da448c 100644 --- a/reco/L1/L1Algo/inactive/L1Assert.h +++ b/reco/L1/L1Algo/inactive/L1Assert.h @@ -36,7 +36,7 @@ using namespace cbm::algo::ca; //TODO: remove namespace L1Assert { - constexpr int kAssertionLevel {3}; + constexpr int kAssertionLevel{3}; /// Basic template function. Usage: place "level <= L1Assert::kAssertionLevel" as a template parameter template<bool IsAsserted> diff --git a/reco/L1/L1Algo/inactive/L1Event.h b/reco/L1/L1Algo/inactive/L1Event.h index e490ebe6099dca6ca789cff11149c7896a961323..a3a2e21d1a4422f5dec8c5f5409cf5662a7900be 100644 --- a/reco/L1/L1Algo/inactive/L1Event.h +++ b/reco/L1/L1Algo/inactive/L1Event.h @@ -6,18 +6,17 @@ #define L1Event_H #include "CbmL1Track.h" - -#include <vector> - #include "KFPTrackVector.h" #include "KFParticleTopoReconstructor.h" #include "KFTopoPerformance.h" +#include <vector> + using std::vector; class L1Event { -public: - L1Event() : fTopoReconstructor(), fKFPTrack(), fHit(0) {}; + public: + L1Event() : fTopoReconstructor(), fKFPTrack(), fHit(0){}; void Clear(); void TopoReconstructor(); @@ -46,7 +45,7 @@ public: return *this; } -private: + private: KFParticleTopoReconstructor fTopoReconstructor; KFPTrackVector fKFPTrack; diff --git a/reco/L1/L1Algo/inactive/L1EventEfficiencies.h b/reco/L1/L1Algo/inactive/L1EventEfficiencies.h index 900c3da018493ac9b5bd60b0e271143c0c5707fd..5e5e7cccdbacf7486f90bcdc7630a5a805de8e5c 100644 --- a/reco/L1/L1Algo/inactive/L1EventEfficiencies.h +++ b/reco/L1/L1Algo/inactive/L1EventEfficiencies.h @@ -8,7 +8,7 @@ #include <iostream> class L1EventEfficiencies { -public: + public: L1EventEfficiencies() : names() , indices() @@ -25,7 +25,7 @@ public: AddCounter("reconstructed", "Reconstructed tracks "); } - ~L1EventEfficiencies() {}; + ~L1EventEfficiencies(){}; void AddCounter(std::string shortname, std::string name) { @@ -54,7 +54,8 @@ public: ratio_reco = reco / mc; const double total = reco.counters[indices["reconstructable"]] + ghosts + clone.counters[indices["reconstructable"]]; - if (total > 0) ratio_ghosts = ghosts / total; + if (total > 0) + ratio_ghosts = ghosts / total; else ratio_ghosts = -1; ratio_clone = clone / mc; @@ -98,7 +99,7 @@ public: std::cout << "Ghost probability : " << ratio_ghosts << " | " << ghosts << std::endl; } -private: + private: std::vector<std::string> names; // names counters indexed by index of counter std::map<std::string, int> indices; // indices of counters indexed by a counter shortname diff --git a/reco/L1/L1Algo/inactive/L1EventMatch.h b/reco/L1/L1Algo/inactive/L1EventMatch.h index 95f6bd420f7fdd2e37025b510f81f3228e61ddf0..a9723fe0b7c72f46b53c46ad4a1e23be2d35d547 100644 --- a/reco/L1/L1Algo/inactive/L1EventMatch.h +++ b/reco/L1/L1Algo/inactive/L1EventMatch.h @@ -5,18 +5,18 @@ #ifndef L1EventMatch_H #define L1EventMatch_H -#include <map> -#include <vector> - #include "L1Event.h" #include "L1MCEvent.h" +#include <map> +#include <vector> + using std::map; using std::vector; class L1EventMatch { -public: - L1EventMatch() : fMCEvent(), fNTracks(0), fTracks() {}; + public: + L1EventMatch() : fMCEvent(), fNTracks(0), fTracks(){}; bool IsGhost() { return fMCEvent.size() == 0; } void Clear(); void AddTrack(int mcEventId) { fMCEvent[mcEventId]++; } @@ -29,7 +29,7 @@ public: map<int, int>& GetMCEvents() { return fMCEvent; } -private: + private: map<int, int> fMCEvent; int fNTracks; vector<int> fTracks; diff --git a/reco/L1/L1Algo/inactive/L1MCEvent.cxx b/reco/L1/L1Algo/inactive/L1MCEvent.cxx index 5ca0a866e227406b0b50124f42e5fc41f972011e..98b7402b005fe7fe886e086c3591a582ae2ec799 100644 --- a/reco/L1/L1Algo/inactive/L1MCEvent.cxx +++ b/reco/L1/L1Algo/inactive/L1MCEvent.cxx @@ -6,14 +6,17 @@ int L1MCEvent::IsReconstructed() { - if (fRecoEvents.size() > 0) return 1; + if (fRecoEvents.size() > 0) + return 1; else return 0; } int L1MCEvent::NClones() { - if (fRecoEvents.size() > 1) { return fRecoEvents.size() - 1; } + if (fRecoEvents.size() > 1) { + return fRecoEvents.size() - 1; + } else { return 0; } diff --git a/reco/L1/L1Algo/inactive/L1MCEvent.h b/reco/L1/L1Algo/inactive/L1MCEvent.h index 6ac4761ce0139ec0866e7167238cd0485f49e2d2..75b7ff987b41216b8d748769fda00933247b66e5 100644 --- a/reco/L1/L1Algo/inactive/L1MCEvent.h +++ b/reco/L1/L1Algo/inactive/L1MCEvent.h @@ -10,8 +10,8 @@ using std::vector; class L1MCEvent { -public: - L1MCEvent() : fMCEventId(-1), fRecoEvents(), fMCTrackId(0), fIsReconstructable(0) {}; + public: + L1MCEvent() : fMCEventId(-1), fRecoEvents(), fMCTrackId(0), fIsReconstructable(0){}; int IsReconstructed(); int NClones(); @@ -27,7 +27,7 @@ public: const vector<int>& GetRecoEvents() const { return fRecoEvents; } -private: + private: int fMCEventId; vector<int> fRecoEvents; vector<int> fMCTrackId; diff --git a/reco/L1/L1Algo/utils/CaAlgoRandom.cxx b/reco/L1/L1Algo/utils/CaAlgoRandom.cxx index da8d04f31ec1521cd9e21bddaa84a94596056a12..7cce6ff7360c1685f3897c6a31ef9fd81dc3c6ee 100644 --- a/reco/L1/L1Algo/utils/CaAlgoRandom.cxx +++ b/reco/L1/L1Algo/utils/CaAlgoRandom.cxx @@ -24,7 +24,9 @@ Random::Random(int seed) { this->SetSeed(seed); } // void Random::SetSeed(int seed) { - if (seed) { fSeed = seed; } + if (seed) { + fSeed = seed; + } else { std::random_device rd; unsigned int randomDeviceSeed = rd(); diff --git a/reco/L1/L1Algo/utils/CaAlgoRandom.h b/reco/L1/L1Algo/utils/CaAlgoRandom.h index 7b70cdf7be684779bd74e434abc648ee1b7e891b..ec0e9031cf55990c78148bc828747d8971172aac 100644 --- a/reco/L1/L1Algo/utils/CaAlgoRandom.h +++ b/reco/L1/L1Algo/utils/CaAlgoRandom.h @@ -10,19 +10,20 @@ #ifndef CaAlgoRandom_h #define CaAlgoRandom_h 1 +//#include "AlgoFairloggerCompat.h" +#include "FairLogger.h" + #include <cstdint> #include <random> #include <type_traits> -#include "AlgoFairloggerCompat.h" - namespace cbm::algo::ca { /// @brief A class, providing ROOT-free access to randomly generated variables class Random { using GeneratorType_t = std::mt19937_64; - public: + public: /// @brief Default constructor /// /// Sets seed equal to 1 @@ -74,7 +75,7 @@ namespace cbm::algo::ca T Uniform(const T& mean, const T& sigma) const; - private: + private: mutable GeneratorType_t fGenerator; ///< Random number generator unsigned int fSeed = 1; ///< Random number seed }; @@ -92,7 +93,7 @@ namespace cbm::algo::ca LOG_IF(fatal, !(nSigmas > 0 && std::isfinite(nSigmas))) << "ca::algo::Random::BoundedGaus nSigmas = " << nSigmas; LOG_IF(fatal, !(sigma > 0 && std::isfinite(sigma))) << "ca::algo::Random::BoundedGaus sigma = " << sigma; - std::normal_distribution rndGaus {mean, sigma}; + std::normal_distribution rndGaus{mean, sigma}; double res = 0; do { res = rndGaus(fGenerator); @@ -107,7 +108,7 @@ namespace cbm::algo::ca { LOG_IF(fatal, !(sigma > 0 && std::isfinite(sigma))) << "ca::algo::Random::Uniform sigma = " << sigma << " is illegal"; - std::uniform_real_distribution rnd {-sigma * std::sqrt(3) + mean, sigma * std::sqrt(3) + mean}; + std::uniform_real_distribution rnd{-sigma * std::sqrt(3) + mean, sigma * std::sqrt(3) + mean}; return rnd(fGenerator); } diff --git a/reco/L1/L1Algo/utils/CaUvConverter.cxx b/reco/L1/L1Algo/utils/CaUvConverter.cxx index dfae0670868cbf868adff3bbb1bae9d8d26d1203..836288b1e63d9b6100edc6577c52c2c296a8ed6b 100644 --- a/reco/L1/L1Algo/utils/CaUvConverter.cxx +++ b/reco/L1/L1Algo/utils/CaUvConverter.cxx @@ -6,9 +6,8 @@ #include <Logger.h> -#include <iostream> - #include <cmath> +#include <iostream> using namespace cbm::ca; @@ -60,7 +59,9 @@ void CaUvConverter::SetFromXYCovMatrix(double phiU, double dx2, double dxy, doub // check that u/v covariance is 0. auto [tmp1, duv, dv2] = ConvertCovMatrixXYtoUV(dx2, dxy, dy2); - if (fabs(duv) > 1.e-8) { LOG(error) << "can not define V coordinate from XY covariance matrix"; } + if (fabs(duv) > 1.e-8) { + LOG(error) << "can not define V coordinate from XY covariance matrix"; + } //std::cout << " u " << phiU / M_PI * 180. << "v " << phiV / M_PI * 180. << " du " << sqrt(du2) << " dv " << sqrt(dv2) // << " duv " << duv << std::endl; diff --git a/reco/L1/L1Algo/utils/CaUvConverter.h b/reco/L1/L1Algo/utils/CaUvConverter.h index 5f356f05d8b43a082cf66d88cfd4aec416634209..76e9f11d0e1430af8b3a22cafa8c4daf6427e7e0 100644 --- a/reco/L1/L1Algo/utils/CaUvConverter.h +++ b/reco/L1/L1Algo/utils/CaUvConverter.h @@ -14,7 +14,7 @@ namespace cbm::ca class CaUvConverter { - public: + public: /// @brief construct from U,V angles CaUvConverter(double phiU, double phiV) { SetFromUV(phiU, phiV); } @@ -70,18 +70,18 @@ namespace cbm::ca } - private: - double fcosU {cbm::algo::ca::constants::Undef<double>}; ///< U coordinate in XY - double fsinU {cbm::algo::ca::constants::Undef<double>}; + private: + double fcosU{cbm::algo::ca::constants::Undef<double>}; ///< U coordinate in XY + double fsinU{cbm::algo::ca::constants::Undef<double>}; - double fcosV {cbm::algo::ca::constants::Undef<double>}; ///< V coordinate in XY - double fsinV {cbm::algo::ca::constants::Undef<double>}; + double fcosV{cbm::algo::ca::constants::Undef<double>}; ///< V coordinate in XY + double fsinV{cbm::algo::ca::constants::Undef<double>}; - double fcosX {cbm::algo::ca::constants::Undef<double>}; ///< X coordinate in UV - double fsinX {cbm::algo::ca::constants::Undef<double>}; + double fcosX{cbm::algo::ca::constants::Undef<double>}; ///< X coordinate in UV + double fsinX{cbm::algo::ca::constants::Undef<double>}; - double fcosY {cbm::algo::ca::constants::Undef<double>}; ///< Y coordinate in UV - double fsinY {cbm::algo::ca::constants::Undef<double>}; + double fcosY{cbm::algo::ca::constants::Undef<double>}; ///< Y coordinate in UV + double fsinY{cbm::algo::ca::constants::Undef<double>}; }; } // namespace cbm::ca diff --git a/reco/L1/L1Algo/utils/L1AlgoDraw.cxx b/reco/L1/L1Algo/utils/L1AlgoDraw.cxx index aab0a32588add189b5760d941bf64f45bd50b9c7..a3ed77b8745e18ed5a03ffc29e5fc44dcdd55438 100644 --- a/reco/L1/L1Algo/utils/L1AlgoDraw.cxx +++ b/reco/L1/L1Algo/utils/L1AlgoDraw.cxx @@ -4,8 +4,9 @@ #include "L1AlgoDraw.h" +#include "CaFramework.h" +#include "CaSimd.h" #include "CbmL1.h" - #include "TApplication.h" #include "TCanvas.h" #include "TEllipse.h" @@ -22,9 +23,6 @@ #include "TText.h" #include "TView3D.h" -#include "CaFramework.h" -#include "CaSimd.h" - using namespace cbm::algo::ca; // NOTE: using std::cout, std::endl were removed from one of the headers, and it @@ -258,10 +256,14 @@ void L1AlgoDraw::DrawRecoTracks() pline.SetLineColor(kBlue); // TPolyLine3D pline3D(nHits); // pline3D.SetLineColor(kBlue); - if (fVerbose >= 4) { cout << "hits = "; } + if (fVerbose >= 4) { + cout << "hits = "; + } for (int iHit = 0; iHit < nHits; iHit++) { unsigned int ih = recoHits[curRecoHit++]; - if (fVerbose >= 4) { cout << ih << " "; } + if (fVerbose >= 4) { + cout << ih << " "; + } Point p = GetHitCoor(ih); lx.push_back(p.x); @@ -277,7 +279,9 @@ void L1AlgoDraw::DrawRecoTracks() lz_turned.push_back(v3.z()); // pline3D.SetPoint(iHit, p.x, p.y, p.z); } - if (fVerbose >= 4) { cout << endl; } + if (fVerbose >= 4) { + cout << endl; + } if (1) { NRecTracks++; diff --git a/reco/L1/L1Algo/utils/L1AlgoDraw.h b/reco/L1/L1Algo/utils/L1AlgoDraw.h index 39f7f9110e7c4a8f772bb437869e0500027751d5..1c288b67dda6ba83418d46bc6629dc4e27cb5507 100644 --- a/reco/L1/L1Algo/utils/L1AlgoDraw.h +++ b/reco/L1/L1Algo/utils/L1AlgoDraw.h @@ -5,15 +5,15 @@ #ifndef L1AlgoDraw_h #define L1AlgoDraw_h 1 +#include "CaHit.h" +#include "CaStation.h" +#include "CaTriplet.h" + #include <TString.h> #include <map> #include <vector> -#include "CaHit.h" -#include "CaStation.h" -#include "CaTriplet.h" - namespace { using namespace cbm::algo; @@ -28,12 +28,12 @@ namespace cbm::algo::ca class L1AlgoDraw { struct Point { - double x {0}, y {0}, z {0}; + double x{0}, y{0}, z{0}; Point() = default; - Point(double _x, double _y, double _z) : x(_x), y(_y), z(_z) {}; + Point(double _x, double _y, double _z) : x(_x), y(_y), z(_z){}; }; -public: + public: L1AlgoDraw(); void InitL1Draw(ca::Framework* algo_); @@ -58,7 +58,7 @@ public: void SaveCanvas(TString name); void DrawAsk(); -private: + private: L1AlgoDraw(const L1AlgoDraw&); L1AlgoDraw& operator=(const L1AlgoDraw&); @@ -67,29 +67,29 @@ private: void DrawTriplet(int il, int im, int ir); void DrawDoublet(int il, int ir); - ca::Framework* algo {nullptr}; + ca::Framework* algo{nullptr}; - std::vector<ca::Hit> vHits {}; - int HitsStartIndex[20] {0}; - int HitsStopIndex[20] {0}; + std::vector<ca::Hit> vHits{}; + int HitsStartIndex[20]{0}; + int HitsStopIndex[20]{0}; - int NStations {0}; - ca::Station vStations[20] {}; + int NStations{0}; + ca::Station vStations[20]{}; - int mcolor[10] {5, 7, 3, 8, 6, 2, 4, 1, 9, 14}; // color for hits on i-station - int StaColor {17}; // color for stantions - int hitsMStyle {20}; // style for hits - int fakesMStyle {24}; // style for fakes - int targetMStyle {29}; // style for target + int mcolor[10]{5, 7, 3, 8, 6, 2, 4, 1, 9, 14}; // color for hits on i-station + int StaColor{17}; // color for stantions + int hitsMStyle{20}; // style for hits + int fakesMStyle{24}; // style for fakes + int targetMStyle{29}; // style for target - double HitSize {1}; // size of hits + double HitSize{1}; // size of hits - int fVerbose {0}; - TCanvas* YZ {nullptr}; - TCanvas* YX {nullptr}; - TCanvas* XZ {nullptr}; - TCanvas* XYZ {nullptr}; - bool ask {true}; + int fVerbose{0}; + TCanvas* YZ{nullptr}; + TCanvas* YX{nullptr}; + TCanvas* XZ{nullptr}; + TCanvas* XYZ{nullptr}; + bool ask{true}; }; diff --git a/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h b/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h index 4c6600bde49535015a7c0eb8ece6e3c50715409d..b405f3d44d0e7293d206476827e40e8b4ad16749 100644 --- a/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h +++ b/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h @@ -26,7 +26,7 @@ using std::vector; template<int NHits> class L1Tracklet { -public: + public: L1Tracklet() = default; static bool compare(const L1Tracklet<NHits>& a, const L1Tracklet<NHits>& b) @@ -38,14 +38,14 @@ public: bool operator!=(const L1Tracklet<NHits>& a) { return !operator==(a); } bool operator<(const L1Tracklet<NHits>& a) { return compare(*this, a); } - int mcTrackId {-1}; - int iStation {-1}; + int mcTrackId{-1}; + int iStation{-1}; }; // reconstructed Tracklet template<int NHits> class L1RTracklet : public L1Tracklet<NHits> { -public: + public: L1RTracklet() = default; L1RTracklet(ca::HitIndex_t* ih_) : L1Tracklet<NHits>() { @@ -69,13 +69,13 @@ public: } bool operator!=(const L1RTracklet<NHits>& a) { return !operator==(a); } - ca::HitIndex_t i[NHits] {0}; // indices of left, middle and right hits + ca::HitIndex_t i[NHits]{0}; // indices of left, middle and right hits }; // MC Tracklet template<int NHits> class L1MTracklet : public L1Tracklet<NHits> { -public: + public: L1MTracklet() = default; void AddReconstructed(int recoId) { recoIds.push_back(recoId); }; @@ -86,13 +86,13 @@ public: bool IsReconstructable() { return isReconstructable; }; // is it possible to reconstruct bool IsPrimary() { return mcMotherTrackId < 0; }; // is it primary or secondary - int mcMotherTrackId {-1}; - float p {0.f}; // momentum - vector<int> recoIds {}; // indices of reco tracklets in sorted recoArray + int mcMotherTrackId{-1}; + float p{0.f}; // momentum + vector<int> recoIds{}; // indices of reco tracklets in sorted recoArray - vector<int> hitIds[NHits] {}; // indices of hits in L1::vHits. Separated by stations -private: - bool isReconstructable {false}; // is it reconstructed + vector<int> hitIds[NHits]{}; // indices of hits in L1::vHits. Separated by stations + private: + bool isReconstructable{false}; // is it reconstructed }; // tracklets categories @@ -112,7 +112,7 @@ struct TL1AlgoEfficiencies : public TL1Efficiencies { template<int NHits = 3> class L1AlgoEfficiencyPerformance { -public: + public: typedef L1RTracklet<NHits> L1RecoTracklet; typedef L1MTracklet<NHits> L1MCTracklet; L1AlgoEfficiencyPerformance() = default; @@ -126,23 +126,23 @@ public: static constexpr int MaxNStations = 10; -private: + private: L1AlgoEfficiencyPerformance<NHits>(const L1AlgoEfficiencyPerformance<NHits>&); L1AlgoEfficiencyPerformance<NHits>& operator=(const L1AlgoEfficiencyPerformance<NHits>&); void FillMC(); // collect mcTracklets from mcTracks void MatchTracks(); - CbmL1* fL1 {nullptr}; // TODO: remove dependency (S.Zharko) + CbmL1* fL1{nullptr}; // TODO: remove dependency (S.Zharko) - vector<L1RecoTracklet> recoTracklets {}; - vector<L1MCTracklet> mcTracklets {}; + vector<L1RecoTracklet> recoTracklets{}; + vector<L1MCTracklet> mcTracklets{}; - TL1AlgoEfficiencies ntra {}; // current event efficiencies - TL1AlgoEfficiencies NTRA {}; // efficiencies statistic + TL1AlgoEfficiencies ntra{}; // current event efficiencies + TL1AlgoEfficiencies NTRA{}; // efficiencies statistic - TL1AlgoEfficiencies ntra_sta[MaxNStations] {}; // for each station separately - TL1AlgoEfficiencies NTRA_STA[MaxNStations] {}; + TL1AlgoEfficiencies ntra_sta[MaxNStations]{}; // for each station separately + TL1AlgoEfficiencies NTRA_STA[MaxNStations]{}; }; // =================================================================================== @@ -224,10 +224,10 @@ bool L1AlgoEfficiencyPerformance<NHits>::AddOne(ca::HitIndex_t* iHits) for (int iih = 0; iih < NHits; iih++) { const int iMCP = fL1->fvHitDebugInfo[iHits[iih]].GetBestMcPointId(); if (iMCP > -1) { - int mcId = fL1->fvMCPoints[iMCP].ID; + int mcId = fL1->fvMCPoints[iMCP].ID; mcIds[iih].push_back(mcId); } - } // for hits + } // for hits // find all reconstructed track id-s for (int level = 0; level < NHits - 1; level++) { @@ -285,7 +285,8 @@ void L1AlgoEfficiencyPerformance<NHits>::MatchTracks() // << iReco << " " << recoTrlet.iStation << " " << recoTrlet.mcTrackId << " " << endl; if (recoTrlet != mcTrlet) { - if (recoTrlet < mcTrlet) iReco++; + if (recoTrlet < mcTrlet) + iReco++; else iMC++; } diff --git a/reco/L1/L1Algo/utils/L1AlgoFunctions.h b/reco/L1/L1Algo/utils/L1AlgoFunctions.h index f4e686fdedaf61b54e3f25060f6cca8227fd51a8..e45aed479efb0248f7dc7c382ff87d14da71ce5f 100644 --- a/reco/L1/L1Algo/utils/L1AlgoFunctions.h +++ b/reco/L1/L1Algo/utils/L1AlgoFunctions.h @@ -42,7 +42,9 @@ template<class Key, class T, class Hash = std::hash<Key>> void SetMappedValuesToMap(const std::unordered_map<Key, T, Hash>& inMap, std::unordered_map<Key, T, Hash>& aMap) { for (auto it = aMap.begin(); it != aMap.end(); ++it) { - if (inMap.find(it->first) != inMap.end()) { it->second = inMap.at(it->first); } + if (inMap.find(it->first) != inMap.end()) { + it->second = inMap.at(it->first); + } } } diff --git a/reco/L1/L1Algo/utils/L1AlgoPulls.h b/reco/L1/L1Algo/utils/L1AlgoPulls.h index 9ab379840e8c403257c748bcca04efc12a97712f..c6fac2cc335650e412d1e8e93f6e4b3e6111ee29 100644 --- a/reco/L1/L1Algo/utils/L1AlgoPulls.h +++ b/reco/L1/L1Algo/utils/L1AlgoPulls.h @@ -14,8 +14,8 @@ const int NStations = 0; #endif // BUILD_HISTO_FOR_EACH_STANTION +#include "CaTrackParam.h" #include "CbmL1.h" - #include "TCanvas.h" #include "TF1.h" #include "TStyle.h" @@ -23,27 +23,25 @@ const int NStations = 0; #include <iostream> #include <vector> -#include "CaTrackParam.h" - using std::cout; using std::endl; using std::vector; struct TL1TrackParameters { - double x {0.}, y {0.}, tx {0.}, ty {0.}, qp {0.}; + double x{0.}, y{0.}, tx{0.}, ty{0.}, qp{0.}; static constexpr int NParameters = 5; - TL1TrackParameters() {}; + TL1TrackParameters(){}; TL1TrackParameters(cbm::algo::ca::TrackParamV& T, int i) : x(T.GetX()[i]) , y(T.GetY()[i]) , tx(T.GetTx()[i]) , ty(T.GetTy()[i]) - , qp(T.GetQp()[i]) {}; + , qp(T.GetQp()[i]){}; - TL1TrackParameters(CbmL1MCPoint& T) : x(T.x), y(T.y), tx(T.px / T.pz), ty(T.py / T.pz), qp(T.q / T.p) {}; + TL1TrackParameters(CbmL1MCPoint& T) : x(T.x), y(T.y), tx(T.px / T.pz), ty(T.py / T.pz), qp(T.q / T.p){}; double operator[](int i) { @@ -83,7 +81,7 @@ struct TL1TrackParameters { }; class L1AlgoPulls { -public: + public: L1AlgoPulls() = default; void Init(); @@ -93,26 +91,26 @@ public: void Print(); // fast method to see pulls :) void Build(bool draw = 1); - int fNAllPulls {0}; // number of AddOne calls + int fNAllPulls{0}; // number of AddOne calls -private: + private: L1AlgoPulls(const L1AlgoPulls&); L1AlgoPulls& operator=(const L1AlgoPulls&); void makeUpHisto(TH1* hist, TString title, float& sigma); - CbmL1* fL1 {nullptr}; - vector<TL1TrackParameters> fGPulls {}; // pulls for all stations - vector<TL1TrackParameters> fStaPulls[NStations] {}; // pulls for each station - TH1F* histoPull[(1 + NStations) * TL1TrackParameters::NParameters] {nullptr}; + CbmL1* fL1{nullptr}; + vector<TL1TrackParameters> fGPulls{}; // pulls for all stations + vector<TL1TrackParameters> fStaPulls[NStations]{}; // pulls for each station + TH1F* histoPull[(1 + NStations) * TL1TrackParameters::NParameters]{nullptr}; - vector<TL1TrackParameters> fGRes {}; // residuals for all stations - TH1F* histoRes[(1 + NStations) * TL1TrackParameters::NParameters] {nullptr}; + vector<TL1TrackParameters> fGRes{}; // residuals for all stations + TH1F* histoRes[(1 + NStations) * TL1TrackParameters::NParameters]{nullptr}; static constexpr float TailCut = 5000.; // static constexpr float csCut = 5.; // chi-square cut static constexpr int textFont = 22; // TNewRoman - TStyle* histoStyle {nullptr}; + TStyle* histoStyle{nullptr}; }; diff --git a/reco/L1/L1Algo/utils/L1CADebug.h b/reco/L1/L1Algo/utils/L1CADebug.h index 40b610167e7a79d0f81879b3ca2f3d9f6f943bfe..5769a43cd6d60fed3db8b82feef30bf7bf6820ef 100644 --- a/reco/L1/L1Algo/utils/L1CADebug.h +++ b/reco/L1/L1Algo/utils/L1CADebug.h @@ -18,7 +18,7 @@ TH1F *h_pick_res_x[20][3][3], *h_pick_res_y[20][3][3], *h_pick_pull_x[20][3][3], void Pulls(int i, int j, int k, double* mc, TrackParamV& T, fvec qp0, ca::FieldRegion& fld) { TrackParamV tmp_T = T; - fvec z = mc[5]; + fvec z = mc[5]; L1Extrapolate(tmp_T, z, qp0, fld); double dx = mc[0] - tmp_T.x[0]; double dy = mc[1] - tmp_T.y[0]; diff --git a/reco/L1/OffLineInterface/CbmGlobalFindTracksEvents.cxx b/reco/L1/OffLineInterface/CbmGlobalFindTracksEvents.cxx index dcfae65e6c7168cf1fd425121d3f72d6f1374a3b..079a3f803a163e96fea7cf9fe7a3572ad2d6346c 100644 --- a/reco/L1/OffLineInterface/CbmGlobalFindTracksEvents.cxx +++ b/reco/L1/OffLineInterface/CbmGlobalFindTracksEvents.cxx @@ -26,6 +26,7 @@ #include "FairRootManager.h" #include "FairRunAna.h" #include "FairRuntimeDb.h" + #include <Logger.h> // Includes from ROOT @@ -142,7 +143,9 @@ InitStatus CbmGlobalFindTracksEvents::Init() // --- Get input array (Events) fEvents = dynamic_cast<TClonesArray*>(ioman->GetObject("CbmEvent")); - if (nullptr == fEvents) { LOG(warn) << GetName() << ": No event array! Will process entire tree."; } + if (nullptr == fEvents) { + LOG(warn) << GetName() << ": No event array! Will process entire tree."; + } // --- Get input array (StsHits) fStsHits = (TClonesArray*) ioman->GetObject("StsHit"); diff --git a/reco/L1/OffLineInterface/CbmGlobalFindTracksEvents.h b/reco/L1/OffLineInterface/CbmGlobalFindTracksEvents.h index c0ecdda25a3cf3774c92a63e4316dd64c81b4b29..1d749da84dbcd94f85153d45a23ab93351194ca0 100644 --- a/reco/L1/OffLineInterface/CbmGlobalFindTracksEvents.h +++ b/reco/L1/OffLineInterface/CbmGlobalFindTracksEvents.h @@ -14,9 +14,7 @@ #include "CbmL1GlobalTrackFinder.h" - #include "FairTask.h" - #include "TStopwatch.h" @@ -39,7 +37,7 @@ class CbmStsTrackFinderIdeal; **/ class CbmGlobalFindTracksEvents : public FairTask { -public: + public: /** Constructor ** @param finder Track finder engine. Default: Ideal track finder. ** @param useMvd Include MVD hits in track finding. Default kFALSE. @@ -77,7 +75,7 @@ public: }; -private: + private: Bool_t fUseMvd; // Inclusion of MVD hits CbmL1GlobalTrackFinder* fFinder; // TrackFinder concrete class TClonesArray* fEvents; //! Array of CbmEvent objects diff --git a/reco/L1/OffLineInterface/CbmL1GlobalFindTracksEvents.cxx b/reco/L1/OffLineInterface/CbmL1GlobalFindTracksEvents.cxx index 1bbc1ca5d5c4dc2dacc1bc8936ab32b9f8d83f1b..67d62569aeb7ef20229466a193007de77a983332 100644 --- a/reco/L1/OffLineInterface/CbmL1GlobalFindTracksEvents.cxx +++ b/reco/L1/OffLineInterface/CbmL1GlobalFindTracksEvents.cxx @@ -26,6 +26,7 @@ #include "FairRootManager.h" #include "FairRunAna.h" #include "FairRuntimeDb.h" + #include <Logger.h> // Includes from ROOT @@ -153,7 +154,9 @@ InitStatus CbmL1GlobalFindTracksEvents::Init() // --- Get input array (Events) fEvents = dynamic_cast<TClonesArray*>(ioman->GetObject("CbmEvent")); - if (nullptr == fEvents) { LOG(warn) << GetName() << ": No event array! Will process entire tree."; } + if (nullptr == fEvents) { + LOG(warn) << GetName() << ": No event array! Will process entire tree."; + } // --- Get input array (StsHits) fStsHits = (TClonesArray*) ioman->GetObject("StsHit"); diff --git a/reco/L1/OffLineInterface/CbmL1GlobalFindTracksEvents.h b/reco/L1/OffLineInterface/CbmL1GlobalFindTracksEvents.h index 4f28a8c0cad2b5a69eeaeb3d83b28bc5222e59c4..62f6a83a8a70c036c010fd7548ae5ddb74340456 100644 --- a/reco/L1/OffLineInterface/CbmL1GlobalFindTracksEvents.h +++ b/reco/L1/OffLineInterface/CbmL1GlobalFindTracksEvents.h @@ -14,9 +14,7 @@ #include "CbmL1GlobalTrackFinder.h" - #include "FairTask.h" - #include "TStopwatch.h" @@ -39,7 +37,7 @@ class CbmStsTrackFinderIdeal; **/ class CbmL1GlobalFindTracksEvents : public FairTask { -public: + public: /** Constructor ** @param finder Track finder engine. Default: Ideal track finder. ** @param useMvd Include MVD hits in track finding. Default kFALSE. @@ -77,7 +75,7 @@ public: }; -private: + private: Bool_t fUseMvd; // Inclusion of MVD hits CbmL1GlobalTrackFinder* fFinder; // TrackFinder concrete class TClonesArray* fEvents; //! Array of CbmEvent objects diff --git a/reco/L1/OffLineInterface/CbmL1GlobalTrackFinder.cxx b/reco/L1/OffLineInterface/CbmL1GlobalTrackFinder.cxx index 0dee55b1153adb86cf0194e136089bc6899f45eb..2cc29cef1f3a871971d910e90e1c9d7501271ca5 100644 --- a/reco/L1/OffLineInterface/CbmL1GlobalTrackFinder.cxx +++ b/reco/L1/OffLineInterface/CbmL1GlobalTrackFinder.cxx @@ -28,11 +28,9 @@ #include "CbmTofTrack.h" #include "CbmTrack.h" #include "CbmTrdTrack.h" - #include "FairHit.h" #include "FairMCPoint.h" #include "FairRootManager.h" - #include "TClonesArray.h" #include "TDatabasePDG.h" @@ -175,7 +173,9 @@ void CbmL1GlobalTrackFinder::CbmL1TrackToCbmStsTrack(CbmL1Track l1track, CbmStsT for (vector<int>::iterator ih = T.Hits.begin(); ih != T.Hits.end(); ++ih) { CbmL1HitId& h = L1->fvExternalHits[*ih]; - if (h.detId == 0) { track->AddMvdHit(h.hitId); } + if (h.detId == 0) { + track->AddMvdHit(h.hitId); + } else if (h.detId == 1) { track->AddHit(h.hitId, kSTSHIT); } diff --git a/reco/L1/OffLineInterface/CbmL1GlobalTrackFinder.h b/reco/L1/OffLineInterface/CbmL1GlobalTrackFinder.h index dfbbcea3e4c33d9dad4ca9c91754f8ca8e423d6c..844037d40b0632d8f4fe544fdd83725d2c677448 100644 --- a/reco/L1/OffLineInterface/CbmL1GlobalTrackFinder.h +++ b/reco/L1/OffLineInterface/CbmL1GlobalTrackFinder.h @@ -38,7 +38,7 @@ class CbmTofTrack; class CbmL1GlobalTrackFinder : public CbmStsTrackFinder { -public: + public: /** Default constructor **/ CbmL1GlobalTrackFinder(); @@ -71,14 +71,14 @@ public: void SetTrdTracksArray(TClonesArray* tracks) { fTrdTracks = tracks; } void SetTofTracksArray(TClonesArray* tracks) { fTofTracks = tracks; } -protected: + protected: TClonesArray* fGlobalTracks; // GlobalTrack array TClonesArray* fStsTracks; // StsTrack array TClonesArray* fMuchTracks; // MuchTrack array TClonesArray* fTrdTracks; // TrdTrack array TClonesArray* fTofTracks; // TofTrack array -private: + private: /** Copy the tracks from the L1-internal format and array ** to the output TClonesArray. ** @value Number of created tracks diff --git a/reco/L1/OffLineInterface/CbmL1StsTrackFinder.cxx b/reco/L1/OffLineInterface/CbmL1StsTrackFinder.cxx index eb4ca33d8630152111ad04d7b8d7bded618a9cad..618529d110a3a09e58e9a502d2b7494e1285ab53 100644 --- a/reco/L1/OffLineInterface/CbmL1StsTrackFinder.cxx +++ b/reco/L1/OffLineInterface/CbmL1StsTrackFinder.cxx @@ -23,11 +23,9 @@ #include "CbmL1Util.h" #include "CbmStsHit.h" #include "CbmStsTrack.h" - #include "FairHit.h" #include "FairMCPoint.h" #include "FairRootManager.h" - #include "TClonesArray.h" #include "TDatabasePDG.h" @@ -91,7 +89,9 @@ Int_t CbmL1StsTrackFinder::CopyL1Tracks(CbmEvent* event) for (vector<int>::iterator ih = it->Hits.begin(); ih != it->Hits.end(); ++ih) { CbmL1HitId& h = L1->fvExternalHits[*ih]; - if (h.detId == 0) { t->AddMvdHit(h.hitId); } + if (h.detId == 0) { + t->AddMvdHit(h.hitId); + } else if (h.detId == 1) { t->AddHit(h.hitId, kSTSHIT); } diff --git a/reco/L1/OffLineInterface/CbmL1StsTrackFinder.h b/reco/L1/OffLineInterface/CbmL1StsTrackFinder.h index 61627cb7647018736a58ee560032287f5d4a1c15..6b2201be180e4efd3cf89a4ee84da132a31f2a08 100644 --- a/reco/L1/OffLineInterface/CbmL1StsTrackFinder.h +++ b/reco/L1/OffLineInterface/CbmL1StsTrackFinder.h @@ -31,7 +31,7 @@ class CbmEvent; class CbmL1StsTrackFinder : public CbmStsTrackFinder { -public: + public: /** Default constructor **/ CbmL1StsTrackFinder(); @@ -60,7 +60,7 @@ public: /// for the multiple scattering and energy loss estimation void SetDefaultParticlePDG(int pdg = 13); // muon -private: + private: /** Copy the tracks from the L1-internal format and array ** to the output TClonesArray. ** @value Number of created tracks diff --git a/reco/L1/catools/CaToolsDebugger.cxx b/reco/L1/catools/CaToolsDebugger.cxx index f1fe2a19359063316e886141d274edf1740e428c..68b6f39e70c69991fc7d2a2aabda8c76c7812678 100644 --- a/reco/L1/catools/CaToolsDebugger.cxx +++ b/reco/L1/catools/CaToolsDebugger.cxx @@ -29,7 +29,9 @@ using cbm::ca::tools::Debugger; Debugger& Debugger::Instance() { static std::unique_ptr<Debugger> instance; - if (!instance) { instance.reset(new Debugger); } + if (!instance) { + instance.reset(new Debugger); + } return *instance.get(); } @@ -57,14 +59,18 @@ void Debugger::Write() Debugger::~Debugger() { /// Destructor - if (!fIsWritten && fFile) { std::cerr << "CaDebugger: you forgot to Write()!!" << std::endl; } + if (!fIsWritten && fFile) { + std::cerr << "CaDebugger: you forgot to Write()!!" << std::endl; + } } void Debugger::AddNtuple(const char* name, const char* varlist) { /// add ntuple - if (!fFile) { fFile = new TFile(fFileName.c_str(), "RECREATE"); } + if (!fFile) { + fFile = new TFile(fFileName.c_str(), "RECREATE"); + } assert(fFile); if (GetNtupleIndex(name) >= 0) return; TDirectory* currDir = gDirectory; @@ -88,6 +94,8 @@ int Debugger::GetNtupleIndex(const char* name) void Debugger::FillNtuple(const char* name, float v[]) { int iNtuple = GetNtupleIndex(name); - if (iNtuple < 0) { std::cerr << "CaDebugger: Ntuple (" << name << ") doesn't exist" << std::endl; } + if (iNtuple < 0) { + std::cerr << "CaDebugger: Ntuple (" << name << ") doesn't exist" << std::endl; + } fNtuples[iNtuple]->Fill(v); } diff --git a/reco/L1/catools/CaToolsDebugger.h b/reco/L1/catools/CaToolsDebugger.h index 8b7698110bb4e6e2a333f83ad068c0bc69c7fe60..fb094a63f57bbf611a1458137815884ff6fdaa40 100644 --- a/reco/L1/catools/CaToolsDebugger.h +++ b/reco/L1/catools/CaToolsDebugger.h @@ -21,7 +21,7 @@ namespace cbm::ca::tools /// Class ca::tools::Debugger helps to debug CA tracking /// class Debugger { - public: + public: // ***************************************** // ** Constructors and destructor ** // ***************************************** @@ -71,12 +71,14 @@ namespace cbm::ca::tools /// Get ntuple index int GetNtupleIndex(const char* name); - private: + private: template<typename T, typename... Targs> void FillFloatArray(float* v, T val, Targs... args) { v[0] = (float) val; - if (sizeof...(args) > 0) { FillFloatArray(v + 1, args...); } + if (sizeof...(args) > 0) { + FillFloatArray(v + 1, args...); + } } template<typename T> @@ -85,10 +87,10 @@ namespace cbm::ca::tools v[0] = (float) last; } - private: - std::string fFileName {"CAdebug.root"}; - bool fIsWritten {0}; - TFile* fFile {nullptr}; + private: + std::string fFileName{"CAdebug.root"}; + bool fIsWritten{0}; + TFile* fFile{nullptr}; std::vector<TNtuple*> fNtuples; }; } // namespace cbm::ca::tools diff --git a/reco/L1/catools/CaToolsField.h b/reco/L1/catools/CaToolsField.h index 07d82f2e26dde19192644dde965f33df0ed48f1e..c3b04a3e328bd93fbf2cf48817270af91865b6dc 100644 --- a/reco/L1/catools/CaToolsField.h +++ b/reco/L1/catools/CaToolsField.h @@ -9,11 +9,10 @@ #pragma once // include this header only once per compilation unit +#include "CaField.h" #include "FairField.h" #include "FairRunAna.h" -#include "CaField.h" - namespace cbm::ca::tools { /// pass the original magnetic field to L1Algo diff --git a/reco/L1/catools/CaToolsHitRecord.cxx b/reco/L1/catools/CaToolsHitRecord.cxx index d18b8b41c59444f100a762fe8e47127e34444439..37be522ea25f8e05ee2435ed72dc14af4ffdcaa8 100644 --- a/reco/L1/catools/CaToolsHitRecord.cxx +++ b/reco/L1/catools/CaToolsHitRecord.cxx @@ -11,9 +11,8 @@ #include "Logger.h" -#include <sstream> - #include <cmath> +#include <sstream> using cbm::ca::tools::HitRecord; @@ -23,14 +22,30 @@ bool HitRecord::Accept() const { if constexpr (kVerboseAccept) { std::stringstream msg; - if (std::isnan(fX) || std::isinf(fX)) { msg << ", x = " << fX; } - if (std::isnan(fY) || std::isinf(fY)) { msg << ", y = " << fY; } - if (std::isnan(fZ) || std::isinf(fZ)) { msg << ", z = " << fZ; } - if (std::isnan(fT) || std::isinf(fT)) { msg << ", t = " << fT; } - if (std::isnan(fDx2) || std::isinf(fDx2)) { msg << ", dx2 = " << fDx2; } - if (std::isnan(fDy2) || std::isinf(fDy2)) { msg << ", dy2 = " << fDy2; } - if (std::isnan(fDxy) || std::isinf(fDxy)) { msg << ", dxy = " << fDxy; } - if (std::isnan(fDt2) || std::isinf(fDt2)) { msg << ", dt2 = " << fDt2; } + if (std::isnan(fX) || std::isinf(fX)) { + msg << ", x = " << fX; + } + if (std::isnan(fY) || std::isinf(fY)) { + msg << ", y = " << fY; + } + if (std::isnan(fZ) || std::isinf(fZ)) { + msg << ", z = " << fZ; + } + if (std::isnan(fT) || std::isinf(fT)) { + msg << ", t = " << fT; + } + if (std::isnan(fDx2) || std::isinf(fDx2)) { + msg << ", dx2 = " << fDx2; + } + if (std::isnan(fDy2) || std::isinf(fDy2)) { + msg << ", dy2 = " << fDy2; + } + if (std::isnan(fDxy) || std::isinf(fDxy)) { + msg << ", dxy = " << fDxy; + } + if (std::isnan(fDt2) || std::isinf(fDt2)) { + msg << ", dt2 = " << fDt2; + } const auto& sMsg = msg.str(); if (sMsg.size()) { LOG(warn) << "HitRecord: Discarding hit " << fExtId << ": det = " << fDet diff --git a/reco/L1/catools/CaToolsHitRecord.h b/reco/L1/catools/CaToolsHitRecord.h index 180e74604540a9b0a1cb5b8b01380a9ce07b7a0c..d51d959404325484f61f33b5187c0a05bec474b7 100644 --- a/reco/L1/catools/CaToolsHitRecord.h +++ b/reco/L1/catools/CaToolsHitRecord.h @@ -45,6 +45,6 @@ namespace cbm::ca::tools static constexpr bool kVerboseAccept = true; bool Accept() const; }; -} // namespace ca::tools +} // namespace cbm::ca::tools #endif // CbmCaToolsHitRecord_h diff --git a/reco/L1/catools/CaToolsLinkKey.h b/reco/L1/catools/CaToolsLinkKey.h index 1e101f301f4baac849ed24eb8c2c78af3b418c01..d773f449dc23e691f4c94caec0ab3bf4c0bd3d80 100644 --- a/reco/L1/catools/CaToolsLinkKey.h +++ b/reco/L1/catools/CaToolsLinkKey.h @@ -10,10 +10,10 @@ #ifndef CaToolsLinkKey_h #define CaToolsLinkKey_h 1 -#include <boost/functional/hash.hpp> - #include "CaToolsDef.h" +#include <boost/functional/hash.hpp> + namespace cbm::ca::tools { struct LinkKey { @@ -33,7 +33,7 @@ namespace cbm::ca::tools int fEvent = cbm::algo::ca::constants::Undef<int>; ///< Index of MC event int fFile = cbm::algo::ca::constants::Undef<int>; ///< Index of MC file }; -} // namespace ca::tools +} // namespace cbm::ca::tools namespace std { diff --git a/reco/L1/catools/CaToolsMCData.cxx b/reco/L1/catools/CaToolsMCData.cxx index 0aa8c4ad5b055574dbb54c0cd1f5014ae463cc51..927a9625cae8adb370f51530592835e6976d76c5 100644 --- a/reco/L1/catools/CaToolsMCData.cxx +++ b/reco/L1/catools/CaToolsMCData.cxx @@ -41,7 +41,9 @@ MCData::MCData(MCData&& other) noexcept { this->Swap(other); } // MCData& MCData::operator=(const MCData& other) { - if (this != &other) { MCData(other).Swap(*this); } + if (this != &other) { + MCData(other).Swap(*this); + } return *this; } @@ -90,7 +92,9 @@ void MCData::InitTrackInfo(const ca::Vector<CbmL1HitDebugInfo>& vHits) for (int iP : aTrk.GetPointIndexes()) { const auto& point = fvPoints[iP]; for (int iH : point.GetHitIndexes()) { - if (std::find(vHitIds.begin(), vHitIds.end(), iH) == vHitIds.end()) { aTrk.AddHitIndex(iH); } + if (std::find(vHitIds.begin(), vHitIds.end(), iH) == vHitIds.end()) { + aTrk.AddHitIndex(iH); + } } } // Initialize arrangements of points and hits within stations @@ -103,7 +107,9 @@ void MCData::InitTrackInfo(const ca::Vector<CbmL1HitDebugInfo>& vHits) // std::string MCData::ToString(int verbose) const { - if (verbose < 1) { return std::string(); } + if (verbose < 1) { + return std::string(); + } std::stringstream msg; msg << "MCData: " << fvTracks.size() << " tracks, " << fvPoints.size() << " points, "; msg << fmTrackLinkMap.size() << " track links, " << fmPointLinkMap.size() << " point links"; diff --git a/reco/L1/catools/CaToolsMCData.h b/reco/L1/catools/CaToolsMCData.h index 9f4014c282ffe3644413f0c069ddadb90d222597..767787ac6d694f62a729b4bc9e0f9c64b15c9a7d 100644 --- a/reco/L1/catools/CaToolsMCData.h +++ b/reco/L1/catools/CaToolsMCData.h @@ -10,10 +10,6 @@ #ifndef CaToolsMCData_h #define CaToolsMCData_h 1 -#include <numeric> -#include <string> -#include <unordered_map> - #include "CaSimd.h" #include "CaToolsDef.h" #include "CaToolsLinkKey.h" @@ -21,6 +17,10 @@ #include "CaToolsMCTrack.h" #include "CaVector.h" +#include <numeric> +#include <string> +#include <unordered_map> + namespace cbm::algo::ca { enum class EDetectorID; @@ -32,7 +32,7 @@ namespace cbm::ca::tools { /// This class represents a package for tracking-related data class MCData { - public: + public: // ********************************* // ** Constructors and destructor ** // ********************************* @@ -182,7 +182,7 @@ namespace cbm::ca::tools /// - #2: First five tracks and points are printed (partially) std::string ToString(int verbose = 1) const; - private: + private: // ****************************** // ** Member variables ** // ****************************** diff --git a/reco/L1/catools/CaToolsMCPoint.cxx b/reco/L1/catools/CaToolsMCPoint.cxx index f810e8361e830e2dba4187de3edb137d3dc77a61..31c72c0d274c9827dc65181b7fb466df045544dd 100644 --- a/reco/L1/catools/CaToolsMCPoint.cxx +++ b/reco/L1/catools/CaToolsMCPoint.cxx @@ -19,7 +19,9 @@ using cbm::ca::tools::MCPoint; // std::string MCPoint::ToString(int verbose, bool printHeader) const { - if (verbose < 1) { return std::string(); } + if (verbose < 1) { + return std::string(); + } std::stringstream msg; msg.precision(4); diff --git a/reco/L1/catools/CaToolsMCPoint.h b/reco/L1/catools/CaToolsMCPoint.h index 8a8b6686689439c53fed4f272354b2a4ba121b38..b757c75d45cb586cd2b3b9c28b76c9fcbeb65af6 100644 --- a/reco/L1/catools/CaToolsMCPoint.h +++ b/reco/L1/catools/CaToolsMCPoint.h @@ -10,12 +10,12 @@ #ifndef CaToolsMCPoint_h #define CaToolsMCPoint_h 1 -#include <string> - #include "CaToolsDef.h" #include "CaToolsLinkKey.h" #include "CaVector.h" +#include <string> + using namespace cbm::algo::ca; //TODO: remove namespace cbm::algo::ca @@ -31,7 +31,7 @@ namespace cbm::ca::tools /// @brief Class describes a unified MC-point, used in CA tracking QA analysis /// class MCPoint { - public: + public: /// @brief Default constructor MCPoint() = default; @@ -337,7 +337,7 @@ namespace cbm::ca::tools // ** Data variables ** // **************************** - private: + private: /// \brief Position at reference z of station [cm] std::array<double, 3> fPos = {constants::Undef<double>, constants::Undef<double>, constants::Undef<double>}; /// \brief Position at entrance to station [cm] @@ -367,9 +367,9 @@ namespace cbm::ca::tools ca::EDetectorID fDetectorId; ///< Detector ID of MC point // TODO: SZh 17.05.2023: Check, if there are more then one index can be added - ca::Vector<int> fvHitIndexes {"ca::tools::MCPoint::fvHitIndexes"}; ///< Indexes of hits, assigned to this point + ca::Vector<int> fvHitIndexes{"ca::tools::MCPoint::fvHitIndexes"}; ///< Indexes of hits, assigned to this point }; -} // namespace ca::tools +} // namespace cbm::ca::tools #endif // CaToolsMCPoint_h diff --git a/reco/L1/catools/CaToolsMCTrack.cxx b/reco/L1/catools/CaToolsMCTrack.cxx index abbf2aaf627eeef50f2b9781ec06d8136b612778..45da5296c9a2d2dd514cd76eb0ad2727e89b3e02 100644 --- a/reco/L1/catools/CaToolsMCTrack.cxx +++ b/reco/L1/catools/CaToolsMCTrack.cxx @@ -9,13 +9,12 @@ #include "CaToolsMCTrack.h" +#include "CaToolsMCPoint.h" #include "CbmL1Hit.h" #include <iomanip> #include <sstream> -#include "CaToolsMCPoint.h" - using cbm::ca::tools::MCPoint; using cbm::ca::tools::MCTrack; @@ -92,16 +91,22 @@ void MCTrack::InitHitsInfo(const ca::Vector<CbmL1HitDebugInfo>& vHits) // Check if this hit is on the same station as the previous one and update max number of hits within a station a // station - if (iSt == iStPrev) { currMaxNofHitsOnStation++; } // the same station + if (iSt == iStPrev) { + currMaxNofHitsOnStation++; + } // the same station else { // the next station (reset hits counter and update number of stations) - if (currMaxNofHitsOnStation > fMaxNofHitsOnStation) { fMaxNofHitsOnStation = currMaxNofHitsOnStation; } + if (currMaxNofHitsOnStation > fMaxNofHitsOnStation) { + fMaxNofHitsOnStation = currMaxNofHitsOnStation; + } currMaxNofHitsOnStation = 1; fTotNofStationsWithHit++; } // Check if this hit is on the next station comparing with the previous hit and update the number of consecutive // stations - if (iSt - iStPrev == 1) { currNofConsStationsWithHit++; } + if (iSt - iStPrev == 1) { + currNofConsStationsWithHit++; + } else if (iSt - iStPrev > 1) { if (currNofConsStationsWithHit > fNofConsStationsWithHit) { fNofConsStationsWithHit = currNofConsStationsWithHit; @@ -111,8 +116,12 @@ void MCTrack::InitHitsInfo(const ca::Vector<CbmL1HitDebugInfo>& vHits) iStPrev = iSt; } // Loop over hit indexes assigned to this track: end - if (currMaxNofHitsOnStation > fMaxNofHitsOnStation) { fMaxNofHitsOnStation = currMaxNofHitsOnStation; } - if (currNofConsStationsWithHit > fNofConsStationsWithHit) { fNofConsStationsWithHit = currNofConsStationsWithHit; } + if (currMaxNofHitsOnStation > fMaxNofHitsOnStation) { + fMaxNofHitsOnStation = currMaxNofHitsOnStation; + } + if (currNofConsStationsWithHit > fNofConsStationsWithHit) { + fNofConsStationsWithHit = currNofConsStationsWithHit; + } } // --------------------------------------------------------------------------------------------------------------------- @@ -134,9 +143,13 @@ void MCTrack::InitPointsInfo(const ca::Vector<MCPoint>& vPoints) int iSt = point.GetStationId(); // current index of active station // Check if this point is on the same station as the previous one and update max number of points within a station - if (iSt == iStPrev) { currMaxNofPointsOnStation++; } // the same station + if (iSt == iStPrev) { + currMaxNofPointsOnStation++; + } // the same station else { // the next station (reset points counter and update number of stations) - if (currMaxNofPointsOnStation > fMaxNofPointsOnStation) { fMaxNofPointsOnStation = currMaxNofPointsOnStation; } + if (currMaxNofPointsOnStation > fMaxNofPointsOnStation) { + fMaxNofPointsOnStation = currMaxNofPointsOnStation; + } currMaxNofPointsOnStation = 1; fTotNofStationsWithPoint++; } @@ -144,9 +157,13 @@ void MCTrack::InitPointsInfo(const ca::Vector<MCPoint>& vPoints) // Check if this point is on the same sensor as the previous one and update max number of points within a sensor // NOTE: points sometimes have different z positions within a sensor, so the max number of points within a sensor // might be calculated incorrectly. (TODO: remove this variable?) - if (point.GetZ() == zPrev) { currMaxNofPointsOnSensor++; } + if (point.GetZ() == zPrev) { + currMaxNofPointsOnSensor++; + } else { - if (currMaxNofPointsOnSensor > fMaxNofPointsOnSensor) { fMaxNofPointsOnSensor = currMaxNofPointsOnSensor; } + if (currMaxNofPointsOnSensor > fMaxNofPointsOnSensor) { + fMaxNofPointsOnSensor = currMaxNofPointsOnSensor; + } currMaxNofPointsOnSensor = 1; } @@ -154,8 +171,12 @@ void MCTrack::InitPointsInfo(const ca::Vector<MCPoint>& vPoints) zPrev = point.GetZ(); } // Loop over point indexes assigned to this track - if (currMaxNofPointsOnStation > fMaxNofPointsOnStation) { fMaxNofPointsOnStation = currMaxNofPointsOnStation; } - if (currMaxNofPointsOnSensor > fMaxNofPointsOnSensor) { fMaxNofPointsOnSensor = currMaxNofPointsOnSensor; } + if (currMaxNofPointsOnStation > fMaxNofPointsOnStation) { + fMaxNofPointsOnStation = currMaxNofPointsOnStation; + } + if (currMaxNofPointsOnSensor > fMaxNofPointsOnSensor) { + fMaxNofPointsOnSensor = currMaxNofPointsOnSensor; + } fNofConsStationsWithPoint = 0; int currNofConsStationsWithPoint = 0; // current number of consecutive stations with points @@ -165,7 +186,9 @@ void MCTrack::InitPointsInfo(const ca::Vector<MCPoint>& vPoints) int iSt = vPoints[iP].GetStationId(); // Check if this point is on the next station comparing with the previous point and update the number of consecutive // stations - if (iSt - iStPrev == 1) { currNofConsStationsWithPoint++; } + if (iSt - iStPrev == 1) { + currNofConsStationsWithPoint++; + } else if (iSt - iStPrev > 1) { if (currNofConsStationsWithPoint > fNofConsStationsWithPoint) { fNofConsStationsWithPoint = currNofConsStationsWithPoint; @@ -173,7 +196,9 @@ void MCTrack::InitPointsInfo(const ca::Vector<MCPoint>& vPoints) currNofConsStationsWithPoint = 1; } - if (iSt <= iStPrev) { continue; } // Tracks propagating in backward direction + if (iSt <= iStPrev) { + continue; + } // Tracks propagating in backward direction iStPrev = iSt; } if (currNofConsStationsWithPoint > fNofConsStationsWithPoint) { @@ -204,7 +229,9 @@ std::string MCTrack::ToString(int verbose, bool header) const msg << setw(8) << setfill(' ') << "N h." << ' '; msg << setw(8) << setfill(' ') << "N p." << ' '; msg << setw(8) << setfill(' ') << "N r.tr." << ' '; - if (verbose > 2) { msg << setw(8) << setfill(' ') << "N t.tr." << ' '; } + if (verbose > 2) { + msg << setw(8) << setfill(' ') << "N t.tr." << ' '; + } msg << setw(12) << setfill(' ') << "zVTX [cm]" << ' '; msg << setw(12) << setfill(' ') << "t [ns]" << ' '; msg << setw(12) << setfill(' ') << "p [GeV/c]" << ' '; @@ -222,7 +249,9 @@ std::string MCTrack::ToString(int verbose, bool header) const msg << setw(8) << setfill(' ') << GetNofHits() << ' '; msg << setw(8) << setfill(' ') << GetNofPoints() << ' '; msg << setw(8) << setfill(' ') << GetNofRecoTracks() << ' '; - if (verbose > 2) { msg << setw(8) << setfill(' ') << GetNofTouchTracks() << ' '; } + if (verbose > 2) { + msg << setw(8) << setfill(' ') << GetNofTouchTracks() << ' '; + } msg << setw(12) << setfill(' ') << GetStartZ() << ' '; msg << setw(12) << setfill(' ') << GetStartT() << ' '; msg << setw(12) << setfill(' ') << GetP() << ' '; diff --git a/reco/L1/catools/CaToolsMCTrack.h b/reco/L1/catools/CaToolsMCTrack.h index aeda05ea67d194135680cc809909e32f76cbcbcb..059d012bf16352c939bf0dc447a7532a8c86ce28 100644 --- a/reco/L1/catools/CaToolsMCTrack.h +++ b/reco/L1/catools/CaToolsMCTrack.h @@ -10,16 +10,14 @@ #ifndef CaToolsMCTrack_h #define CaToolsMCTrack_h 1 +#include "CaToolsDef.h" +#include "CaToolsLinkKey.h" +#include "CaVector.h" #include "CbmL1Hit.h" - #include "TMath.h" #include <functional> -#include "CaToolsDef.h" -#include "CaToolsLinkKey.h" -#include "CaVector.h" - class CbmL1HitDebugInfo; namespace cbm::ca::tools @@ -29,7 +27,7 @@ namespace cbm::ca::tools namespace constants = cbm::algo::ca::constants; class MCTrack { - public: + public: /// Default constructor MCTrack() = default; @@ -332,7 +330,7 @@ namespace cbm::ca::tools /// @return String representation std::string ToString(int verbose = 1, bool header = false) const; - private: + private: // **************************** // ** Data variables ** // **************************** @@ -376,6 +374,6 @@ namespace cbm::ca::tools ///< which use hits from this track }; -} // namespace ca::tools +} // namespace cbm::ca::tools #endif // CaToolsMCTrack_h diff --git a/reco/L1/catools/CaToolsMaterialHelper.cxx b/reco/L1/catools/CaToolsMaterialHelper.cxx index 151eb1008d7a5b2db8cb8c02242950fc60a54880..bf87789fe7af71823c4ede712e512edd1342b352 100644 --- a/reco/L1/catools/CaToolsMaterialHelper.cxx +++ b/reco/L1/catools/CaToolsMaterialHelper.cxx @@ -6,7 +6,6 @@ #include "CaToolsMaterialHelper.h" #include "Logger.h" - #include "TGeoManager.h" #include "TGeoMedium.h" #include "TGeoNavigator.h" @@ -50,7 +49,9 @@ MaterialHelper::MaterialHelper() // ensure that at least one thread is set - if (fNthreads < 1) { fNthreads = 1; } + if (fNthreads < 1) { + fNthreads = 1; + } LOG(info) << " Maps will be created using " << fNthreads << " CPU threads"; LOG(info) << ""; @@ -83,9 +84,13 @@ MaterialHelper::MaterialHelper() if (volumes) { for (int iv = 0; iv < volumes->GetEntriesFast(); iv++) { TGeoVolume* vol = dynamic_cast<TGeoVolume*>(volumes->At(iv)); - if (!vol) { continue; } + if (!vol) { + continue; + } TGeoVoxelFinder* finder = vol->GetVoxels(); - if (finder) { finder->SetInvalid(); } + if (finder) { + finder->SetInvalid(); + } } } } @@ -115,9 +120,13 @@ MaterialHelper::MaterialHelper() if (volumes) { for (int iv = 0; iv < volumes->GetEntriesFast(); iv++) { TGeoVolumeAssembly* vol = dynamic_cast<TGeoVolumeAssembly*>(volumes->At(iv)); - if (!vol) { continue; } + if (!vol) { + continue; + } TGeoVoxelFinder* finder = vol->GetVoxels(); - if (finder) { finder->SetInvalid(); } + if (finder) { + finder->SetInvalid(); + } } } } @@ -140,7 +149,9 @@ MaterialHelper::~MaterialHelper() // once TGeoManager is swithched in multithreaded mode, there is no way to make it non-mltithreaded again // therefore we should set SetMaxThreads( >=0 ) - if (fNthreadsOld > 0) { gGeoManager->SetMaxThreads(fNthreadsOld); } + if (fNthreadsOld > 0) { + gGeoManager->SetMaxThreads(fNthreadsOld); + } else { gGeoManager->SetMaxThreads(1); } @@ -161,14 +172,18 @@ TGeoNavigator* MaterialHelper::GetCurrentNavigator(int iThread) navi = gGeoManager->AddNavigator(); - if (iThread >= 0) { fNavigators.push_back(navi); } + if (iThread >= 0) { + fNavigators.push_back(navi); + } if (navi != gGeoManager->GetCurrentNavigator()) { LOG(fatal) << "ca::tools::MaterialHelper: unexpected behavior of TGeoManager::AddNavigator() !!"; } } - if (!navi) { LOG(fatal) << "ca::tools::MaterialHelper: can not find / create TGeoNavigator for thread " << iThread; } + if (!navi) { + LOG(fatal) << "ca::tools::MaterialHelper: can not find / create TGeoNavigator for thread " << iThread; + } return navi; } @@ -195,7 +210,9 @@ void MaterialHelper::InitThreads() gGeoManager->SetMaxThreads(fNthreads); // in case the number of threads is truncated by TGeoManager (must not happen) fNthreads = gGeoManager->GetMaxThreads(); - if (fNthreads < 1) { fNthreads = 1; } + if (fNthreads < 1) { + fNthreads = 1; + } } CleanUpThreads(); } @@ -209,7 +226,9 @@ MaterialMap MaterialHelper::GenerateMaterialMap(double zRef, double zMin, double "target Z = " << fTargetZ << ", material reference z = " << zRef; } - if (zMin < fTargetZ) { zMin = fTargetZ; } + if (zMin < fTargetZ) { + zMin = fTargetZ; + } } if (!(zMin <= zRef && zRef <= zMax)) { @@ -283,10 +302,14 @@ MaterialMap MaterialHelper::GenerateMaterialMap(double zRef, double zMin, double } TGeoMedium* medium = node->GetMedium(); - if (!medium) { LOG(fatal) << "ca::tools::MaterialHelper: TGeoNavigator can not find the geo medium"; } + if (!medium) { + LOG(fatal) << "ca::tools::MaterialHelper: TGeoNavigator can not find the geo medium"; + } TGeoMaterial* material = medium->GetMaterial(); - if (!material) { LOG(fatal) << "ca::tools::MaterialHelper: TGeoNavigator can not find the geo material"; } + if (!material) { + LOG(fatal) << "ca::tools::MaterialHelper: TGeoNavigator can not find the geo material"; + } double radLen = material->GetRadLen(); @@ -343,7 +366,9 @@ MaterialMap MaterialHelper::GenerateMaterialMap(double zRef, double zMin, double } } radThick /= nRays; - if (doPrint) { std::cout << " radThick " << radThick << std::endl; } + if (doPrint) { + std::cout << " radThick " << radThick << std::endl; + } //doPrint = (radThick > 0.01); matBudget.SetRadThickBin(iBinX, iBinY, radThick); } // iBinX diff --git a/reco/L1/catools/CaToolsMaterialHelper.h b/reco/L1/catools/CaToolsMaterialHelper.h index f07251931568ab8b8fa2e379f6f6a418f3f50788..8a42ba95b76acb21b233083f923b3ca5c42e4263 100644 --- a/reco/L1/catools/CaToolsMaterialHelper.h +++ b/reco/L1/catools/CaToolsMaterialHelper.h @@ -12,11 +12,10 @@ #ifndef CaToolsMaterialHelper_H #define CaToolsMaterialHelper_H +#include "CaMaterialMap.h" #include "Rtypes.h" #include "TObject.h" -#include "CaMaterialMap.h" - class TGeoNavigator; namespace cbm::ca::tools @@ -27,7 +26,7 @@ namespace cbm::ca::tools /// class to create ca::MaterialMap material maps form the ROOT geometry /// class MaterialHelper : public TObject { - public: + public: MaterialHelper(); ~MaterialHelper(); @@ -66,7 +65,7 @@ namespace cbm::ca::tools void SetSafeMaterialInitialization(bool val = true) { fDoSafeInitialization = val; } - private: + private: /// initialise the necessary amount of threads in TGeoManager void InitThreads(); @@ -77,15 +76,15 @@ namespace cbm::ca::tools /// Produce an error when anything goes wrong TGeoNavigator* GetCurrentNavigator(int iThread); - private: - int fNthreadsOld {0}; // number of threads in TGeoManager before the helper was created - int fNthreads {0}; // number of threads - bool fDoRadialProjection {false}; // project rays horisontally along the Z axis (special mode) - int fNraysBinPerDim {3}; // shoot fNraysBinPerDim * fNraysBinPerDim rays in each map bin - double fTargetZ {0.}; // z of the target for the radial projection - std::vector<TGeoNavigator*> fNavigators {}; // list of created navigators - bool fDoSafeInitialization {false}; // perform slow but safe initialization - // to get around the crashes in TGeoVoxelFinder + private: + int fNthreadsOld{0}; // number of threads in TGeoManager before the helper was created + int fNthreads{0}; // number of threads + bool fDoRadialProjection{false}; // project rays horisontally along the Z axis (special mode) + int fNraysBinPerDim{3}; // shoot fNraysBinPerDim * fNraysBinPerDim rays in each map bin + double fTargetZ{0.}; // z of the target for the radial projection + std::vector<TGeoNavigator*> fNavigators{}; // list of created navigators + bool fDoSafeInitialization{false}; // perform slow but safe initialization + // to get around the crashes in TGeoVoxelFinder ClassDef(MaterialHelper, 0); }; diff --git a/reco/L1/catools/CaToolsWFExpression.cxx b/reco/L1/catools/CaToolsWFExpression.cxx index 8c04aff3d227419897775a7b3e0b4ab1489b81a2..4c5bc92f08a9e52b2eb673ac72a9b86c0ecac690 100644 --- a/reco/L1/catools/CaToolsWFExpression.cxx +++ b/reco/L1/catools/CaToolsWFExpression.cxx @@ -6,7 +6,6 @@ #include "CaToolsWFExpression.h" #include "Logger.h" - #include "TBox.h" #include "TF1.h" #include "TGraph.h" diff --git a/reco/L1/catools/CaToolsWFExpression.h b/reco/L1/catools/CaToolsWFExpression.h index 98773ccee450032653e7cd39de495a10fba60d49..1b2fcd7c3b8434819f7f3511b498becccd3b565c 100644 --- a/reco/L1/catools/CaToolsWFExpression.h +++ b/reco/L1/catools/CaToolsWFExpression.h @@ -5,6 +5,7 @@ #ifndef CaToolsWFExpression_h #define CaToolsWFExpression_h 1 +#include "CaToolsDef.h" #include "TCut.h" #include "TString.h" @@ -12,8 +13,6 @@ #include <tuple> #include <vector> -#include "CaToolsDef.h" - class TTree; class TH2F; class TPad; @@ -25,7 +24,7 @@ namespace cbm::ca::tools /// \note DISTANCE (expression, axis) -- dx or dy, signed distance between the extrapolated point and real MC-point /// PARAMETER (expression, axis) -- x0 or y0, a parameter, vs. which the distance is studied class WFExpression { - public: + public: static constexpr int kNpars = 1; /// TMP: number of parameters /// Default constructor @@ -82,7 +81,7 @@ namespace cbm::ca::tools /// Sets title of the histograms void SetTitle(const char* title) { fsTitle = title; } - private: + private: // ***************************** // ** Private class functions ** // ***************************** @@ -125,6 +124,6 @@ namespace cbm::ca::tools TPad* fpPadBase = nullptr; ///< Pointer to a pad for base histogram TPad* fpPadSlices = nullptr; ///< Pointer to a pad for slices }; -} // namespace ca +} // namespace cbm::ca::tools #endif // CaToolsWFExpression_h diff --git a/reco/L1/catools/CaToolsWindowFinder.cxx b/reco/L1/catools/CaToolsWindowFinder.cxx index 5ecdbf1e0ace2fe17eef64c7492ca13e113ee592..41b0cd1ff09b7006a04705c783a7e232f95faf47 100644 --- a/reco/L1/catools/CaToolsWindowFinder.cxx +++ b/reco/L1/catools/CaToolsWindowFinder.cxx @@ -9,8 +9,11 @@ #include "CaToolsWindowFinder.h" +#include "CaConfigReader.h" +#include "CaConstants.h" +#include "CaSearchWindow.h" +#include "CaToolsWFExpression.h" #include "Logger.h" - #include "TCanvas.h" #include "TChain.h" #include "TPad.h" @@ -24,11 +27,6 @@ #include <yaml-cpp/yaml.h> -#include "CaConfigReader.h" -#include "CaConstants.h" -#include "CaSearchWindow.h" -#include "CaToolsWFExpression.h" - using namespace cbm::ca::tools; using namespace cbm::algo::ca::constants; // for colored logs @@ -65,7 +63,9 @@ ca::SearchWindow WindowFinder::CreateSW(int iStation, const ca::Iteration& caIte // Get a cut TCut cut = GetTrackSelectionCut(iStation, caIter); - if (TString(fExtraCut.GetTitle()).Length()) { cut = cut && fExtraCut; } + if (TString(fExtraCut.GetTitle()).Length()) { + cut = cut && fExtraCut; + } // Set a unique to a canvas using the cut expression TString sUniqueName = cut.GetTitle(); @@ -226,7 +226,9 @@ void WindowFinder::PrintCaseInformation(TPad* pPad, int iStation, const ca::Iter textL->AddText(Form("Track finder iteration: %s", caIter.GetName().c_str())); textL->AddText(Form(" - |q/p| < %.2f e(Gev/c)^{-1}", caIter.GetMaxQp())); textL->AddText(Form(" - primary: %s", caIter.GetPrimaryFlag() ? "yes" : "no")); - if (TString(fExtraCut.GetTitle()).Length()) { textL->AddText(Form("Optional cut: %s", fExtraCut.GetTitle())); } + if (TString(fExtraCut.GetTitle()).Length()) { + textL->AddText(Form("Optional cut: %s", fExtraCut.GetTitle())); + } textL->Draw(); TPaveText* textR = new TPaveText(0.51, 0.01, 0.99, 0.99); diff --git a/reco/L1/catools/CaToolsWindowFinder.h b/reco/L1/catools/CaToolsWindowFinder.h index eea45f3fa7d1dfcb79e1614782b657307dc80bbf..6dcf8a032676f6554c24d1cac3c3ceb5c4faf815 100644 --- a/reco/L1/catools/CaToolsWindowFinder.h +++ b/reco/L1/catools/CaToolsWindowFinder.h @@ -10,14 +10,13 @@ #ifndef CaToolsWindowFinder_h #define CaToolsWindowFinder_h 1 +#include "CaIteration.h" #include "TCut.h" #include "TObject.h" #include <array> #include <vector> -#include "CaIteration.h" - // TODO: Replace tmp asserts with exceptions class TChain; @@ -45,11 +44,11 @@ namespace cbm::ca::tools /// TODO: ... write an instruction ... class WindowFinder : public TObject { - public: + public: // TODO: TEMPORARY CONSTANT EXPRESSIONS (TO BE MOVED TO A SEPARATE HEADER) static constexpr const char* kTreeName = "t"; ///< Name of the input MC triplets tree - public: + public: /// Default constructor WindowFinder(); @@ -112,7 +111,7 @@ namespace cbm::ca::tools void SetTarget(double x, double y, double z); - private: + private: /// Creates a search window for a selected station and iteration ca::SearchWindow CreateSW(int iStation, const ca::Iteration& caIter); @@ -157,6 +156,6 @@ namespace cbm::ca::tools ClassDef(WindowFinder, 0); }; -} // namespace ca +} // namespace cbm::ca::tools #endif // CaToolsWindowsFinder_h diff --git a/reco/L1/qa/CbmCaHitQaData.h b/reco/L1/qa/CbmCaHitQaData.h index cd2fa8af1c6d110401f0ea846f69f86baa6e42c5..8cf9506fa1f608403869b449fc863983e1c71a3d 100644 --- a/reco/L1/qa/CbmCaHitQaData.h +++ b/reco/L1/qa/CbmCaHitQaData.h @@ -10,17 +10,16 @@ #ifndef CbmCaHitQaData_h #define CbmCaHitQaData_h 1 +#include <cmath> #include <limits> #include <tuple> -#include <cmath> - namespace cbm::ca { /// @class HitQaData /// @brief Contains necessary data to calculate hit residuals and pulls class HitQaData { - public: + public: /// @brief Default constructor HitQaData() = default; @@ -290,7 +289,7 @@ namespace cbm::ca /// @return Station local index void SetStationID(int iStLoc) { fStationID = iStLoc; } - private: + private: static constexpr double kNAN = std::numeric_limits<double>::signaling_NaN(); double fPhiU = kNAN; ///< Stereo angle for front strips [rad] diff --git a/reco/L1/qa/CbmCaInputQaBase.cxx b/reco/L1/qa/CbmCaInputQaBase.cxx index bc1f7d0b6b799cbc7e33842358b3b1b13adc281d..2864e30369d7fad78a75f7854e1f3e1e0a9f57cc 100644 --- a/reco/L1/qa/CbmCaInputQaBase.cxx +++ b/reco/L1/qa/CbmCaInputQaBase.cxx @@ -9,6 +9,7 @@ #include "CbmCaInputQaBase.h" +#include "CaConstants.h" #include "CbmAddress.h" #include "CbmL1DetectorID.h" #include "CbmMCDataArray.h" @@ -32,11 +33,9 @@ #include "CbmTrackingDetectorInterfaceBase.h" #include "CbmTrdHit.h" #include "CbmTrdPoint.h" - #include "FairMCPoint.h" #include "FairRootManager.h" #include "Logger.h" - #include "TBox.h" #include "TClonesArray.h" #include "TEllipse.h" @@ -56,8 +55,6 @@ #include <numeric> #include <tuple> -#include "CaConstants.h" - using namespace cbm::algo::ca::constants; namespace @@ -335,8 +332,12 @@ void CbmCaInputQaBase<DetID>::FillHistograms() if constexpr (ca::EDetectorID::kTof == DetID) { auto address = pHit->GetAddress(); - if (0x00202806 == address || 0x00002806 == address) { continue; } // TEST - if (5 == CbmTofAddress::GetSmType(address)) { continue; } // Skip Bmon hits + if (0x00202806 == address || 0x00002806 == address) { + continue; + } // TEST + if (5 == CbmTofAddress::GetSmType(address)) { + continue; + } // Skip Bmon hits } // ************************* @@ -405,7 +406,9 @@ void CbmCaInputQaBase<DetID>::FillHistograms() int iP = link.GetIndex(); // Index of MC point // Skip noisy links - if (iP < 0) { continue; } + if (iP < 0) { + continue; + } ++nMCpoints; @@ -438,14 +441,18 @@ void CbmCaInputQaBase<DetID>::FillHistograms() // The mc track must satisfy the cuts // - if (pHitMatch->GetNofLinks() != 1) { continue; } + if (pHitMatch->GetNofLinks() != 1) { + continue; + } // The best link to in the match (probably, the cut on nMCpoints is meaningless) assert(pHitMatch->GetNofLinks() > 0); // Should be always true due to the cut above const auto& bestPointLink = pHitMatch->GetMatchedLink(); // Skip noisy links - if (bestPointLink.GetIndex() < 0) { continue; } + if (bestPointLink.GetIndex() < 0) { + continue; + } // Point matched by the best link const auto* pMCPoint = dynamic_cast<const Point_t*>(fpMCPoints->Get(bestPointLink)); @@ -462,11 +469,15 @@ void CbmCaInputQaBase<DetID>::FillHistograms() LOG_IF(fatal, t0MC < 0) << fName << ": MC time zero is lower then 0 ns: " << t0MC; // cut on the mc track quality - if (!IsTrackSelected(pMCTrack, pMCPoint)) { continue; } + if (!IsTrackSelected(pMCTrack, pMCPoint)) { + continue; + } { // skip the case when the mc point participates to several hits int iE = fpMCEventList->GetEventIndex(bestTrackLink); - if (vNofHitsPerMcTrack[iE][iSt][pMCPoint->GetTrackID()] != 1) { continue; } + if (vNofHitsPerMcTrack[iE][iSt][pMCPoint->GetTrackID()] != 1) { + continue; + } } // ----- MC point properties @@ -510,7 +521,9 @@ void CbmCaInputQaBase<DetID>::FillHistograms() fHitQaData.SetPointZ(fHitQaData.GetHitZ()); double zRes = kNAN; - if constexpr (ca::EDetectorID::kTof == DetID) { zRes = fHitQaData.GetHitZ() - pMCPoint->GetZ(); } + if constexpr (ca::EDetectorID::kTof == DetID) { + zRes = fHitQaData.GetHitZ() - pMCPoint->GetZ(); + } else { zRes = fHitQaData.GetHitZ() - 0.5 * (pMCPoint->GetZ() + pMCPoint->GetZOut()); } @@ -639,12 +652,16 @@ void CbmCaInputQaBase<DetID>::FillHistograms() << ", event id = " << iEvent << ", track id = " << iTr; // check efficiency only once per mc track per station - if (vIsTrackProcessed[iSt][iTr]) { continue; } + if (vIsTrackProcessed[iSt][iTr]) { + continue; + } vIsTrackProcessed[iSt][iTr] = true; // cut on the mc track quality - if (!fHitQaData.GetIfTrackSelected()) { continue; } + if (!fHitQaData.GetIfTrackSelected()) { + continue; + } // Conditions under which point is accounted as reconstructed: point bool ifTrackHasHits = fHitQaData.GetIfTrackHasHits(); @@ -778,7 +795,9 @@ InitStatus CbmCaInputQaBase<DetID>::InitHistograms() // ----- Subdirectories MakeQaDirectory("Summary"); MakeQaDirectory("Summary/vs Station"); - if constexpr (ca::EDetectorID::kSts == DetID) { MakeQaDirectory("Summary/vs N digi"); } + if constexpr (ca::EDetectorID::kSts == DetID) { + MakeQaDirectory("Summary/vs N digi"); + } MakeQaDirectory("All stations"); // ----- Histograms initialization @@ -1409,7 +1428,9 @@ bool CbmCaInputQaBase<DetID>::IsTrackSelected(const CbmMCTrack* track, const Poi { assert(point); - if (fTrackSelectionPrimary && track->GetMotherId() >= 0) { return false; } + if (fTrackSelectionPrimary && track->GetMotherId() >= 0) { + return false; + } double px = std::numeric_limits<double>::signaling_NaN(); double py = std::numeric_limits<double>::signaling_NaN(); @@ -1426,11 +1447,17 @@ bool CbmCaInputQaBase<DetID>::IsTrackSelected(const CbmMCTrack* track, const Poi } double p = sqrt(px * px + py * py + pz * pz); - if (pz <= 0.) { return false; } + if (pz <= 0.) { + return false; + } - if (p < fTrackSelectionMomentum) { return false; } + if (p < fTrackSelectionMomentum) { + return false; + } - if (TMath::ATan2(sqrt(px * px + py * py), pz) * TMath::RadToDeg() > fTrackSelectionAngle) { return false; } + if (TMath::ATan2(sqrt(px * px + py * py), pz) * TMath::RadToDeg() > fTrackSelectionAngle) { + return false; + } return true; } diff --git a/reco/L1/qa/CbmCaInputQaBase.h b/reco/L1/qa/CbmCaInputQaBase.h index b2e623356d33c6fcacc349415f96a05485aadf6b..01def8756c36ccfa1a6714a178a6fc44ad0de428 100644 --- a/reco/L1/qa/CbmCaInputQaBase.h +++ b/reco/L1/qa/CbmCaInputQaBase.h @@ -15,7 +15,6 @@ #include "CbmL1DetectorID.h" #include "CbmMCDataManager.h" #include "CbmQaTask.h" - #include "TMath.h" #include <set> @@ -46,11 +45,11 @@ namespace /// A QA-task class, which provides assurance of MuCh hits and geometry template<EDetectorID DetID> class CbmCaInputQaBase : public CbmQaTask { -protected: + protected: using Point_t = cbm::ca::PointTypes_t::at<DetID>; ///< Point type for detector ID using Hit_t = cbm::ca::HitTypes_t::at<DetID>; ///< Hit type for detector ID -public: + public: /// @brief Constructor from parameters /// @param name Name of the task /// @param verbose Verbose level @@ -94,7 +93,7 @@ public: /// @param mom Minimum absolute value of momentum void SetMinMomentum(double mom) { fMinMomentum = mom; } -protected: + protected: // ******************************************** // ** Virtual method override from CbmQaTask ** // ******************************************** @@ -286,8 +285,8 @@ protected: std::vector<TH1F*> fvph_reco_eff; ///< Distribution of hit reconstruction efficiency in bins of fvpe_reco_eff_vs_xy // FIXME: change to private -protected: - cbm::ca::HitQaData fHitQaData {}; ///< Current hit QA data object + protected: + cbm::ca::HitQaData fHitQaData{}; ///< Current hit QA data object }; #endif // CbmCaInputQaBase_h diff --git a/reco/L1/qa/CbmCaInputQaMuch.cxx b/reco/L1/qa/CbmCaInputQaMuch.cxx index bd6f99474ed00dee8ef68bf7553d6e70dfc1ef2d..a7a6e7dcbeaecacc69edbb60079f54062de24a9b 100644 --- a/reco/L1/qa/CbmCaInputQaMuch.cxx +++ b/reco/L1/qa/CbmCaInputQaMuch.cxx @@ -8,6 +8,7 @@ /// \author S.Zharko <s.zharko@gsi.de> #include "CbmCaInputQaMuch.h" + #include "CbmMuchTrackingInterface.h" ClassImp(CbmCaInputQaMuch); @@ -71,7 +72,9 @@ InitStatus CbmCaInputQaMuch::InitDataBranches() fpDetInterface = CbmMuchTrackingInterface::Instance(); auto baseInitStatus = CbmCaInputQaBase::InitDataBranches(); - if (kSUCCESS != baseInitStatus) { return baseInitStatus; } + if (kSUCCESS != baseInitStatus) { + return baseInitStatus; + } return kSUCCESS; } @@ -81,7 +84,9 @@ InitStatus CbmCaInputQaMuch::InitDataBranches() InitStatus CbmCaInputQaMuch::InitCanvases() { auto baseInitStatus = CbmCaInputQaBase::InitCanvases(); - if (kSUCCESS != baseInitStatus) { return baseInitStatus; } + if (kSUCCESS != baseInitStatus) { + return baseInitStatus; + } return kSUCCESS; } @@ -91,7 +96,9 @@ InitStatus CbmCaInputQaMuch::InitCanvases() InitStatus CbmCaInputQaMuch::InitHistograms() { auto baseInitStatus = CbmCaInputQaBase::InitHistograms(); - if (kSUCCESS != baseInitStatus) { return baseInitStatus; } + if (kSUCCESS != baseInitStatus) { + return baseInitStatus; + } return kSUCCESS; } diff --git a/reco/L1/qa/CbmCaInputQaMuch.h b/reco/L1/qa/CbmCaInputQaMuch.h index 362b41e198517a3d852f3e14455043d77f9265a7..48a3cfde760d6b1ed01a1dd51c02c3e4bebf9458 100644 --- a/reco/L1/qa/CbmCaInputQaMuch.h +++ b/reco/L1/qa/CbmCaInputQaMuch.h @@ -16,13 +16,13 @@ /// A QA-task class, which provides assurance of TOF hits and geometry /// class CbmCaInputQaMuch : public CbmCaInputQaBase<cbm::algo::ca::EDetectorID::kMuch> { -public: + public: /// @brief Constructor from parameters /// @param verbose Verbose level /// @param isMCUsed Flag, whether MC information is available for this task CbmCaInputQaMuch(int verbose, bool isMCUsed); -protected: + protected: /// \brief Method to check, if the QA results are acceptable /// \return Map of checks: key - name of the check, value - result of the check std::map<std::string, bool> Check() { return CbmCaInputQaBase::Check(); } @@ -51,7 +51,7 @@ protected: /// @brief Fills histograms per MC point void FillHistogramsPerPoint() {} -private: + private: ClassDef(CbmCaInputQaMuch, 0); }; diff --git a/reco/L1/qa/CbmCaInputQaMvd.cxx b/reco/L1/qa/CbmCaInputQaMvd.cxx index 3662273519619d64027bb2f9b09ad4ff728d64af..a8016b3c7a74fb548977f3888c4c8f7a12328333 100644 --- a/reco/L1/qa/CbmCaInputQaMvd.cxx +++ b/reco/L1/qa/CbmCaInputQaMvd.cxx @@ -71,7 +71,9 @@ InitStatus CbmCaInputQaMvd::InitDataBranches() fpDetInterface = CbmMvdTrackingInterface::Instance(); auto baseInitStatus = CbmCaInputQaBase::InitDataBranches(); - if (kSUCCESS != baseInitStatus) { return baseInitStatus; } + if (kSUCCESS != baseInitStatus) { + return baseInitStatus; + } return kSUCCESS; } @@ -81,7 +83,9 @@ InitStatus CbmCaInputQaMvd::InitDataBranches() InitStatus CbmCaInputQaMvd::InitCanvases() { auto baseInitStatus = CbmCaInputQaBase::InitCanvases(); - if (kSUCCESS != baseInitStatus) { return baseInitStatus; } + if (kSUCCESS != baseInitStatus) { + return baseInitStatus; + } return kSUCCESS; } @@ -91,7 +95,9 @@ InitStatus CbmCaInputQaMvd::InitCanvases() InitStatus CbmCaInputQaMvd::InitHistograms() { auto baseInitStatus = CbmCaInputQaBase::InitHistograms(); - if (kSUCCESS != baseInitStatus) { return baseInitStatus; } + if (kSUCCESS != baseInitStatus) { + return baseInitStatus; + } return kSUCCESS; } diff --git a/reco/L1/qa/CbmCaInputQaMvd.h b/reco/L1/qa/CbmCaInputQaMvd.h index e96b5f23b800fdf70a408d79bdba1e35f8ab646a..7e5079899a712e7df8961415e49296423f7e2ae0 100644 --- a/reco/L1/qa/CbmCaInputQaMvd.h +++ b/reco/L1/qa/CbmCaInputQaMvd.h @@ -16,13 +16,13 @@ /// A QA-task class, which provides assurance of TOF hits and geometry /// class CbmCaInputQaMvd : public CbmCaInputQaBase<cbm::algo::ca::EDetectorID::kMvd> { -public: + public: /// @brief Constructor from parameters /// @param verbose Verbose level /// @param isMCUsed Flag, whether MC information is available for this task CbmCaInputQaMvd(int verbose, bool isMCUsed); -protected: + protected: /// \brief Method to check, if the QA results are acceptable /// \return Map of checks: key - name of the check, value - result of the check std::map<std::string, bool> Check() { return CbmCaInputQaBase::Check(); } @@ -51,7 +51,7 @@ protected: /// @brief Fills histograms per MC point void FillHistogramsPerPoint() {} -private: + private: ClassDef(CbmCaInputQaMvd, 0); }; diff --git a/reco/L1/qa/CbmCaInputQaSetup.cxx b/reco/L1/qa/CbmCaInputQaSetup.cxx index b35775c21df0fa4ff44668023e8a2bc9be8128a7..d56e079c58bb46e121072c28dd83ca4dc965abb5 100644 --- a/reco/L1/qa/CbmCaInputQaSetup.cxx +++ b/reco/L1/qa/CbmCaInputQaSetup.cxx @@ -9,15 +9,12 @@ #include "CbmCaInputQaSetup.h" +#include "AlgoFairloggerCompat.h" +#include "CaInitManager.h" #include "CbmMCDataManager.h" - #include "FairRootManager.h" - #include "TAxis.h" -#include "AlgoFairloggerCompat.h" -#include "CaInitManager.h" - using cbm::algo::ca::InitManager; using cbm::algo::ca::Parameters; using cbm::ca::InputQaSetup; @@ -35,10 +32,14 @@ std::map<std::string, bool> InputQaSetup::Check() { return std::map<std::string, // void InputQaSetup::CheckInit() const { - if (IsMCUsed() && !fpMCEventHeader) { throw std::logic_error("MC event header branch is unavailable"); } + if (IsMCUsed() && !fpMCEventHeader) { + throw std::logic_error("MC event header branch is unavailable"); + } for (int iD = 0; iD < static_cast<int>(ca::EDetectorID::kEND); ++iD) { if (fvbUseDet[iD]) { - if (!fvpBrHits[iD]) { throw std::logic_error(Form("Hit branch is unavailable for %s", kDetName[iD])); } + if (!fvpBrHits[iD]) { + throw std::logic_error(Form("Hit branch is unavailable for %s", kDetName[iD])); + } if (IsMCUsed() && !fvpBrPoints[iD]) { throw std::logic_error(Form("MC point branch is unavailable for %s", kDetName[iD])); } @@ -50,11 +51,21 @@ void InputQaSetup::CheckInit() const // void InputQaSetup::FillHistograms() { - if (fvbUseDet[ca::EDetectorID::kMvd]) { this->FillHistogramsDet<ca::EDetectorID::kMvd>(); } - if (fvbUseDet[ca::EDetectorID::kSts]) { this->FillHistogramsDet<ca::EDetectorID::kSts>(); } - if (fvbUseDet[ca::EDetectorID::kMuch]) { this->FillHistogramsDet<ca::EDetectorID::kMuch>(); } - if (fvbUseDet[ca::EDetectorID::kTrd]) { this->FillHistogramsDet<ca::EDetectorID::kTrd>(); } - if (fvbUseDet[ca::EDetectorID::kTof]) { this->FillHistogramsDet<ca::EDetectorID::kTof>(); } + if (fvbUseDet[ca::EDetectorID::kMvd]) { + this->FillHistogramsDet<ca::EDetectorID::kMvd>(); + } + if (fvbUseDet[ca::EDetectorID::kSts]) { + this->FillHistogramsDet<ca::EDetectorID::kSts>(); + } + if (fvbUseDet[ca::EDetectorID::kMuch]) { + this->FillHistogramsDet<ca::EDetectorID::kMuch>(); + } + if (fvbUseDet[ca::EDetectorID::kTrd]) { + this->FillHistogramsDet<ca::EDetectorID::kTrd>(); + } + if (fvbUseDet[ca::EDetectorID::kTof]) { + this->FillHistogramsDet<ca::EDetectorID::kTof>(); + } } // --------------------------------------------------------------------------------------------------------------------- @@ -89,7 +100,9 @@ InitStatus InputQaSetup::InitCanvases() auto UpBinEdge = [](TAxis* pAxis, double val) { return pAxis->GetBinUpEdge(pAxis->FindBin(val)); }; for (int iDet = 0; iDet < static_cast<int>(fvpDetInterface.size()); ++iDet) { - if (!fvbUseDet[iDet]) { continue; } + if (!fvbUseDet[iDet]) { + continue; + } int nSt = fvpDetInterface[iDet]->GetNtrackingStations(); for (int iSt = 0; iSt < nSt; ++iSt) { int iStActive = fpParameters->GetStationIndexActive(iSt, static_cast<ca::EDetectorID>(iDet)); @@ -172,11 +185,15 @@ try { }; auto InitHitBranch = [&](const char* brName, ca::EDetectorID detID) { - if (fvbUseDet[detID]) { fvpBrHits[detID] = dynamic_cast<TClonesArray*>(pFairManager->GetObject(brName)); } + if (fvbUseDet[detID]) { + fvpBrHits[detID] = dynamic_cast<TClonesArray*>(pFairManager->GetObject(brName)); + } }; auto InitPointBranch = [&](const char* brName, ca::EDetectorID detID) { - if (IsMCUsed() && fvbUseDet[detID]) { fvpBrPoints[detID] = pMcManager->InitBranch(brName); } + if (IsMCUsed() && fvbUseDet[detID]) { + fvpBrPoints[detID] = pMcManager->InitBranch(brName); + } }; InitDetInterface(CbmMvdTrackingInterface::Instance(), ca::EDetectorID::kMvd); @@ -215,7 +232,9 @@ InitStatus InputQaSetup::InitHistograms() MakeQaDirectory("hit_occupancy"); for (int iD = 0; iD < static_cast<int>(ca::EDetectorID::kEND); ++iD) { - if (fvbUseDet[iD]) { MakeQaDirectory(Form("hit_occupancy/%s", kDetName[iD])); } + if (fvbUseDet[iD]) { + MakeQaDirectory(Form("hit_occupancy/%s", kDetName[iD])); + } } fph_hit_xz.resize(nStGeo + 1); diff --git a/reco/L1/qa/CbmCaInputQaSetup.h b/reco/L1/qa/CbmCaInputQaSetup.h index f9a7664f48343ca9d10aca3e5161252d2c8c3930..587c90c7fc1ebfbaef09c6fdee72a85af35db73c 100644 --- a/reco/L1/qa/CbmCaInputQaSetup.h +++ b/reco/L1/qa/CbmCaInputQaSetup.h @@ -10,6 +10,7 @@ #ifndef CbmCaInputQaSetup_h #define CbmCaInputQaSetup_h 1 +#include "CaParameters.h" #include "CbmL1DetectorID.h" #include "CbmMCDataArray.h" #include "CbmMCDataObject.h" @@ -30,17 +31,14 @@ #include "CbmTrdHit.h" #include "CbmTrdPoint.h" #include "CbmTrdTrackingInterface.h" - #include "TClonesArray.h" -#include "CaParameters.h" - namespace cbm::ca { /// @class InputQaSetup /// @brief A QA task to analyze hit and MC point occupancy distributions in different tracking stations class InputQaSetup : public CbmQaTask { - public: + public: /// @brief Constructor from parameters /// @param verbose Verbosity level /// @param isMCUsed Flag, if MC information is available for this task @@ -72,7 +70,7 @@ namespace cbm::ca /// @brief Fills histograms void FillHistograms(); - private: + private: /// @brief Checks branches initialization void CheckInit() const; @@ -91,9 +89,9 @@ namespace cbm::ca DetIdArr_t<TClonesArray*> fvpBrHits = {{nullptr}}; ///< Input branch for hits DetIdArr_t<CbmMCDataArray*> fvpBrPoints = {{nullptr}}; ///< Input branch for MC points - CbmMCDataObject* fpMCEventHeader = nullptr; ///< Pointer to MC event header + CbmMCDataObject* fpMCEventHeader = nullptr; ///< Pointer to MC event header std::unique_ptr<ca::Parameters> fpParameters = nullptr; ///< Pointer to CA parameters object - std::string fsParametersFilename = ""; ///< Filename for the tracking parameters + std::string fsParametersFilename = ""; ///< Filename for the tracking parameters DetIdArr_t<std::vector<double>> fvXmin; DetIdArr_t<std::vector<double>> fvXmax; @@ -129,7 +127,9 @@ namespace cbm::ca // skip Bmon hits if constexpr (ca::EDetectorID::kTof == DetID) { - if (5 == CbmTofAddress::GetSmType(address)) { continue; } + if (5 == CbmTofAddress::GetSmType(address)) { + continue; + } } int iStLoc = fvpDetInterface[DetID]->GetTrackingStationIndex(address); @@ -137,12 +137,24 @@ namespace cbm::ca auto xHit = pHit->GetX(); auto yHit = pHit->GetY(); auto zHit = pHit->GetZ(); - if (fvXmin[DetID][iStLoc] > xHit) { fvXmin[DetID][iStLoc] = xHit; } - if (fvXmax[DetID][iStLoc] < xHit) { fvXmax[DetID][iStLoc] = xHit; } - if (fvYmin[DetID][iStLoc] > yHit) { fvYmin[DetID][iStLoc] = yHit; } - if (fvYmax[DetID][iStLoc] < yHit) { fvYmax[DetID][iStLoc] = yHit; } - if (fvZmin[DetID][iStLoc] > zHit) { fvZmin[DetID][iStLoc] = zHit; } - if (fvZmax[DetID][iStLoc] < zHit) { fvZmax[DetID][iStLoc] = zHit; } + if (fvXmin[DetID][iStLoc] > xHit) { + fvXmin[DetID][iStLoc] = xHit; + } + if (fvXmax[DetID][iStLoc] < xHit) { + fvXmax[DetID][iStLoc] = xHit; + } + if (fvYmin[DetID][iStLoc] > yHit) { + fvYmin[DetID][iStLoc] = yHit; + } + if (fvYmax[DetID][iStLoc] < yHit) { + fvYmax[DetID][iStLoc] = yHit; + } + if (fvZmin[DetID][iStLoc] > zHit) { + fvZmin[DetID][iStLoc] = zHit; + } + if (fvZmax[DetID][iStLoc] < zHit) { + fvZmax[DetID][iStLoc] = zHit; + } fph_hit_xz[iStGeo]->Fill(zHit, xHit); fph_hit_yz[iStGeo]->Fill(zHit, yHit); diff --git a/reco/L1/qa/CbmCaInputQaSts.cxx b/reco/L1/qa/CbmCaInputQaSts.cxx index 57342b9371a6ff367184c62ee6d612dfe68bbe5a..b67a942cdbec4fe9822e34ad3b7761ddb19009f4 100644 --- a/reco/L1/qa/CbmCaInputQaSts.cxx +++ b/reco/L1/qa/CbmCaInputQaSts.cxx @@ -22,10 +22,8 @@ #include "CbmStsPoint.h" #include "CbmStsTrackingInterface.h" #include "CbmTimeSlice.h" - #include "FairRootManager.h" #include "Logger.h" - #include "TBox.h" #include "TClonesArray.h" #include "TEllipse.h" @@ -129,7 +127,9 @@ void CbmCaInputQaSts::FillHistogramsPerHit() const auto* pCluster = dynamic_cast<const CbmStsCluster*>(fpClusters->At(pHit->GetFrontClusterId())); assert(pCluster); int nDigis = pCluster->GetNofDigis(); - if (nDigis > fkMaxDigisInClusterForPulls) { nDigis = 0; } + if (nDigis > fkMaxDigisInClusterForPulls) { + nDigis = 0; + } fvph_pull_u_Ndig[nDigis]->Fill(fHitQaData.GetPullU()); } @@ -137,7 +137,9 @@ void CbmCaInputQaSts::FillHistogramsPerHit() const auto* pCluster = dynamic_cast<const CbmStsCluster*>(fpClusters->At(pHit->GetBackClusterId())); assert(pCluster); int nDigis = pCluster->GetNofDigis(); - if (nDigis > fkMaxDigisInClusterForPulls) { nDigis = 0; } + if (nDigis > fkMaxDigisInClusterForPulls) { + nDigis = 0; + } fvph_pull_v_Ndig[nDigis]->Fill(fHitQaData.GetPullV()); } } @@ -154,7 +156,9 @@ InitStatus CbmCaInputQaSts::InitDataBranches() fpDetInterface = CbmStsTrackingInterface::Instance(); auto baseInitStatus = CbmCaInputQaBase::InitDataBranches(); - if (kSUCCESS != baseInitStatus) { return baseInitStatus; } + if (kSUCCESS != baseInitStatus) { + return baseInitStatus; + } // Clusters container fpClusters = dynamic_cast<TClonesArray*>(FairRootManager::Instance()->GetObject("StsCluster")); @@ -170,7 +174,9 @@ InitStatus CbmCaInputQaSts::InitDataBranches() InitStatus CbmCaInputQaSts::InitCanvases() { auto baseInitStatus = CbmCaInputQaBase::InitCanvases(); - if (kSUCCESS != baseInitStatus) { return baseInitStatus; } + if (kSUCCESS != baseInitStatus) { + return baseInitStatus; + } gStyle->SetOptFit(1); @@ -202,7 +208,9 @@ InitStatus CbmCaInputQaSts::InitCanvases() InitStatus CbmCaInputQaSts::InitHistograms() { auto baseInitStatus = CbmCaInputQaBase::InitHistograms(); - if (kSUCCESS != baseInitStatus) { return baseInitStatus; } + if (kSUCCESS != baseInitStatus) { + return baseInitStatus; + } int nSt = fpDetInterface->GetNtrackingStations(); std::string detName = fpDetInterface->GetDetectorName(); diff --git a/reco/L1/qa/CbmCaInputQaSts.h b/reco/L1/qa/CbmCaInputQaSts.h index cc90d094aba5e9e2e9a1cf0f5ce7bedd3df1bd0f..271d459f6c8f1d138b1889dca6f90d2bf2a2594e 100644 --- a/reco/L1/qa/CbmCaInputQaSts.h +++ b/reco/L1/qa/CbmCaInputQaSts.h @@ -14,7 +14,6 @@ #include "CbmCaInputQaBase.h" #include "CbmMCDataManager.h" #include "CbmQaTask.h" - #include "TMath.h" #include <set> @@ -38,13 +37,13 @@ class TProfile2D; /// A QA-task class, which provides assurance of MuCh hits and geometry class CbmCaInputQaSts : public CbmCaInputQaBase<cbm::algo::ca::EDetectorID::kSts> { -public: + public: /// Constructor from parameters /// \param verbose Verbose level /// \param isMCUsed Flag, whether MC information is available for this task CbmCaInputQaSts(int verbose, bool isMCUsed); -protected: + protected: /// \brief Method to check, if the QA results are acceptable /// \return Map of checks: key - name of the check, value - result of the check std::map<std::string, bool> Check(); @@ -73,14 +72,14 @@ protected: /// @brief Fills histograms per MC point void FillHistogramsPerPoint(); -private: + private: // ----- Data branches TClonesArray* fpClusters = nullptr; ///< Array of hit clusters // ----- Histograms (additional to ones from the base class) // NOTE: the last element of each vector stands for integral distribution over all stations - const int fkMaxDigisInClusterForPulls {5}; ///< max digis in cluster for separate histogramming of puls + const int fkMaxDigisInClusterForPulls{5}; ///< max digis in cluster for separate histogramming of puls std::vector<TH1F*> fvph_pull_u_Ndig; ///< pull for u coordinate, depending on N digis in the cluster std::vector<TH1F*> fvph_pull_v_Ndig; ///< pull for v coordinate, depending on N digis in the cluster diff --git a/reco/L1/qa/CbmCaInputQaTof.cxx b/reco/L1/qa/CbmCaInputQaTof.cxx index 4d82766cfeb865d44ed1056029e12cd8c5b7c375..226374c5c4a6ca68957431fa258350610a9dbb43 100644 --- a/reco/L1/qa/CbmCaInputQaTof.cxx +++ b/reco/L1/qa/CbmCaInputQaTof.cxx @@ -9,6 +9,7 @@ #include "CbmCaInputQaTof.h" +#include "CaToolsLinkKey.h" #include "CbmAddress.h" #include "CbmMCDataArray.h" #include "CbmMCEventList.h" @@ -16,12 +17,10 @@ #include "CbmTofHit.h" #include "CbmTofPoint.h" #include "CbmTofTrackingInterface.h" - #include "FairRootManager.h" #include "FairRunAna.h" #include "FairRuntimeDb.h" #include "Logger.h" - #include "TBox.h" #include "TClonesArray.h" #include "TF1.h" @@ -35,8 +34,6 @@ #include <iomanip> #include <numeric> -#include "CaToolsLinkKey.h" - ClassImp(CbmCaInputQaTof); // --------------------------------------------------------------------------------------------------------------------- @@ -127,7 +124,9 @@ void CbmCaInputQaTof::FillHistograms() msg << fName << ": hit: id=" << iHit << ", NofLinks=" << pHitMatch->GetNofLinks() << ", "; msg << "iSt=" << fpDetInterface->GetTrackingStationIndex(address) << ", "; msg << "RPC=(" << iHitSmType << "," << iHitSm << "," << iHitRpc << ")"; - if (pHitMatch->GetNofLinks() == 0) { continue; } + if (pHitMatch->GetNofLinks() == 0) { + continue; + } const auto& bestLink = pHitMatch->GetMatchedLink(); for (int iLink = 0; iLink < pHitMatch->GetNofLinks(); ++iLink) { const auto& link = pHitMatch->GetLink(iLink); @@ -136,7 +135,9 @@ void CbmCaInputQaTof::FillHistograms() int iFile = link.GetFile(); msg << "\n\tLink " << iLink << ": " << iPointExt << ", " << iEvent << ", " << iFile << " (best? "; msg << (bestLink == link) << ')'; - if (iPointExt < 0) { continue; } + if (iPointExt < 0) { + continue; + } msg << ", "; auto* pPoint = dynamic_cast<CbmTofPoint*>(fpMCPoints->Get(link)); PrintPoint(pPoint, msg); @@ -177,9 +178,9 @@ void CbmCaInputQaTof::FillHistogramsPerHit() int iHitRpc = CbmTofAddress::GetRpcId(address); { // Check, if the hit is created on the one of the defined RPCs. If not, save to address into map - double xHit = pHit->GetX(); - double yHit = pHit->GetY(); - double zHit = pHit->GetZ(); + double xHit = pHit->GetX(); + double yHit = pHit->GetY(); + double zHit = pHit->GetZ(); fvph_hit_xy_vs_cell[iHitSmType][iHitSm][iHitRpc]->Fill(xHit, yHit); fvph_hit_zx_vs_cell[iHitSmType][iHitSm][iHitRpc]->Fill(zHit, xHit); fvph_hit_zy_vs_cell[iHitSmType][iHitSm][iHitRpc]->Fill(zHit, yHit); @@ -194,7 +195,9 @@ InitStatus CbmCaInputQaTof::InitDataBranches() fpDetInterface = CbmTofTrackingInterface::Instance(); auto baseInitStatus = CbmCaInputQaBase::InitDataBranches(); - if (kSUCCESS != baseInitStatus) { return baseInitStatus; } + if (kSUCCESS != baseInitStatus) { + return baseInitStatus; + } auto* pRuntimeDb = FairRunAna::Instance()->GetRuntimeDb(); fDigiPar = dynamic_cast<CbmTofDigiPar*>(pRuntimeDb->getContainer("CbmTofDigiPar")); @@ -208,7 +211,9 @@ InitStatus CbmCaInputQaTof::InitDataBranches() InitStatus CbmCaInputQaTof::InitCanvases() { auto baseInitStatus = CbmCaInputQaBase::InitCanvases(); - if (kSUCCESS != baseInitStatus) { return baseInitStatus; } + if (kSUCCESS != baseInitStatus) { + return baseInitStatus; + } // Hit occupancy vs TOF cell { @@ -270,7 +275,9 @@ InitStatus CbmCaInputQaTof::InitCanvases() InitStatus CbmCaInputQaTof::InitHistograms() { auto baseInitStatus = CbmCaInputQaBase::InitHistograms(); - if (kSUCCESS != baseInitStatus) { return baseInitStatus; } + if (kSUCCESS != baseInitStatus) { + return baseInitStatus; + } // Hit occupancy vs. TOF cell MakeQaDirectory("occup_cell/"); @@ -279,7 +286,9 @@ InitStatus CbmCaInputQaTof::InitHistograms() fvph_hit_zx_vs_cell.resize(nSmTypes); fvph_hit_zy_vs_cell.resize(nSmTypes); for (int iSmType = 0; iSmType < nSmTypes; ++iSmType) { - if (iSmType == 5) { continue; } // skip Bmon + if (iSmType == 5) { + continue; + } // skip Bmon MakeQaDirectory(Form("occup_cell/sm_type_%d", iSmType)); int nSm = fDigiBdfPar->GetNbSm(iSmType); int nRpc = fDigiBdfPar->GetNbRpc(iSmType); diff --git a/reco/L1/qa/CbmCaInputQaTof.h b/reco/L1/qa/CbmCaInputQaTof.h index a8cb8f288a9a454271140bcbee626163fc148c6b..4f3b5872c0010e89512c02103d3986179d7d9b68 100644 --- a/reco/L1/qa/CbmCaInputQaTof.h +++ b/reco/L1/qa/CbmCaInputQaTof.h @@ -15,7 +15,6 @@ #include "CbmMCDataManager.h" #include "CbmQaTask.h" #include "CbmTofCell.h" - #include "TMath.h" #include <iomanip> @@ -43,13 +42,13 @@ class CbmTofDigiBdfPar; /// A QA-task class, which provides assurance of TOF hits and geometry /// class CbmCaInputQaTof : public CbmCaInputQaBase<cbm::algo::ca::EDetectorID::kTof> { -public: + public: /// @brief Constructor from parameters /// @param verbose Verbose level /// @param isMCUsed Flag, whether MC information is available for this task CbmCaInputQaTof(int verbose, bool isMCUsed); -protected: + protected: /// \brief Method to check, if the QA results are acceptable /// \return Map of checks: key - name of the check, value - result of the check std::map<std::string, bool> Check() { return CbmCaInputQaBase::Check(); } @@ -78,7 +77,7 @@ protected: /// @brief Fills histograms per MC point void FillHistogramsPerPoint() {} -private: + private: /// @brief Fills channel info map void FillChannelInfoMap(); diff --git a/reco/L1/qa/CbmCaInputQaTrd.cxx b/reco/L1/qa/CbmCaInputQaTrd.cxx index e472fdd7d4ed641c890ae0eb105e78649cf9bcd9..57b3952d7e55416e0d3cde8f1570777b0e446d65 100644 --- a/reco/L1/qa/CbmCaInputQaTrd.cxx +++ b/reco/L1/qa/CbmCaInputQaTrd.cxx @@ -8,6 +8,7 @@ /// @author S.Zharko <s.zharko@gsi.de> #include "CbmCaInputQaTrd.h" + #include "CbmTrdTrackingInterface.h" ClassImp(CbmCaInputQaTrd); @@ -33,10 +34,10 @@ void CbmCaInputQaTrd::DefineParameters() range[1] = max; }; // Hit errors - SetRange(fRHitDx, 0.0000, 5.00); // [cm] - SetRange(fRHitDy, 0.0000, 5.00); // [cm] - SetRange(fRHitDu, 0.0000, 5.00); // [cm] - SetRange(fRHitDv, 0.0000, 5.00); // [cm] + SetRange(fRHitDx, 0.0000, 5.00); // [cm] + SetRange(fRHitDy, 0.0000, 5.00); // [cm] + SetRange(fRHitDu, 0.0000, 5.00); // [cm] + SetRange(fRHitDv, 0.0000, 5.00); // [cm] SetRange(fRHitDt, 0.0000, 100.00); // [ns] // Residuals SetRange(fRResX, -10.00, 10.00); @@ -70,7 +71,9 @@ InitStatus CbmCaInputQaTrd::InitDataBranches() fpDetInterface = CbmTrdTrackingInterface::Instance(); auto baseInitStatus = CbmCaInputQaBase::InitDataBranches(); - if (kSUCCESS != baseInitStatus) { return baseInitStatus; } + if (kSUCCESS != baseInitStatus) { + return baseInitStatus; + } return kSUCCESS; } @@ -80,7 +83,9 @@ InitStatus CbmCaInputQaTrd::InitDataBranches() InitStatus CbmCaInputQaTrd::InitCanvases() { auto baseInitStatus = CbmCaInputQaBase::InitCanvases(); - if (kSUCCESS != baseInitStatus) { return baseInitStatus; } + if (kSUCCESS != baseInitStatus) { + return baseInitStatus; + } return kSUCCESS; } @@ -90,7 +95,9 @@ InitStatus CbmCaInputQaTrd::InitCanvases() InitStatus CbmCaInputQaTrd::InitHistograms() { auto baseInitStatus = CbmCaInputQaBase::InitHistograms(); - if (kSUCCESS != baseInitStatus) { return baseInitStatus; } + if (kSUCCESS != baseInitStatus) { + return baseInitStatus; + } return kSUCCESS; } diff --git a/reco/L1/qa/CbmCaInputQaTrd.h b/reco/L1/qa/CbmCaInputQaTrd.h index faafccc471c8685a2b66e5cb081f2cad79cb6d3a..419a6ad5d1dedb4b227acfbf9d48fa851b985c35 100644 --- a/reco/L1/qa/CbmCaInputQaTrd.h +++ b/reco/L1/qa/CbmCaInputQaTrd.h @@ -16,13 +16,13 @@ /// A QA-task class, which provides assurance of TOF hits and geometry /// class CbmCaInputQaTrd : public CbmCaInputQaBase<cbm::algo::ca::EDetectorID::kTrd> { -public: + public: /// @brief Constructor from parameters /// @param verbose Verbose level /// @param isMCUsed Flag, whether MC information is available for this task CbmCaInputQaTrd(int verbose, bool isMCUsed); -protected: + protected: /// \brief Method to check, if the QA results are acceptable /// \return Map of checks: key - name of the check, value - result of the check std::map<std::string, bool> Check() { return CbmCaInputQaBase::Check(); } @@ -51,7 +51,7 @@ protected: /// @brief Fills histograms per MC point void FillHistogramsPerPoint() {} -private: + private: ClassDef(CbmCaInputQaTrd, 0); }; diff --git a/reco/L1/qa/CbmCaOutputQa.cxx b/reco/L1/qa/CbmCaOutputQa.cxx index 91aea772f1b28c6b4ba1f6b0c79c3600f9aeff06..a3fa5d153a45964f38c7cd9b9931b5cab91ec335 100644 --- a/reco/L1/qa/CbmCaOutputQa.cxx +++ b/reco/L1/qa/CbmCaOutputQa.cxx @@ -9,20 +9,17 @@ #include "CbmCaOutputQa.h" +#include "CaInitManager.h" #include "CbmCaMCModule.h" #include "CbmQaCanvas.h" - #include "FairRootManager.h" #include "Logger.h" - #include "TAttLine.h" #include "THStack.h" #include "TMarker.h" #include "TPad.h" #include "TText.h" -#include "CaInitManager.h" - using cbm::algo::ca::InitManager; using cbm::algo::ca::Parameters; using cbm::ca::MCModule; @@ -95,13 +92,17 @@ void OutputQa::FillHistograms() const auto& recoTrk = fvRecoTracks[iTrkReco]; // Reject tracks, which do not contain hits - if (recoTrk.GetNofHits() < 1) { continue; } + if (recoTrk.GetNofHits() < 1) { + continue; + } FillRecoTrack(ETrackType::kAll, iTrkReco); if (IsMCUsed()) { // NOTE: The ghost status of track is now defined by its purity, thus it can still contain MC information - if (recoTrk.IsGhost()) { FillRecoTrack(ETrackType::kGhost, iTrkReco); } + if (recoTrk.IsGhost()) { + FillRecoTrack(ETrackType::kGhost, iTrkReco); + } int iTrkMC = recoTrk.GetMatchedMCTrackIndex(); if (iTrkMC > -1) { @@ -110,19 +111,29 @@ void OutputQa::FillHistograms() bool isPrimary = mcTrk.IsPrimary(); // Cut tracks, which did not leave hits in tracker - if (mcTrk.GetNofHits() == 0) { continue; } + if (mcTrk.GetNofHits() == 0) { + continue; + } if (isPrimary) { FillRecoTrack(ETrackType::kPrim, iTrkReco); bool bFast = mcTrk.GetP() > CbmL1Constants::MinFastMom; bool bLong = mcTrk.GetTotNofStationsWithHit() == fpParameters->GetNstationsActive(); - if (bFast) { FillRecoTrack(ETrackType::kPrimFast, iTrkReco); } - if (bLong) { FillRecoTrack(ETrackType::kPrimLong, iTrkReco); } - if (bLong && bFast) { FillRecoTrack(ETrackType::kPrimLongFast, iTrkReco); } + if (bFast) { + FillRecoTrack(ETrackType::kPrimFast, iTrkReco); + } + if (bLong) { + FillRecoTrack(ETrackType::kPrimLong, iTrkReco); + } + if (bLong && bFast) { + FillRecoTrack(ETrackType::kPrimLongFast, iTrkReco); + } } else { FillRecoTrack(ETrackType::kSec, iTrkReco); - if (mcTrk.GetP() > CbmL1Constants::MinFastMom) { FillRecoTrack(ETrackType::kSecFast, iTrkReco); } + if (mcTrk.GetP() > CbmL1Constants::MinFastMom) { + FillRecoTrack(ETrackType::kSecFast, iTrkReco); + } } // Track distributions for different particle species @@ -197,10 +208,14 @@ void OutputQa::FillHistograms() // ----- CUTS ON MC TRACKS // Cut tracks, which did not leave hits in tracker - if (mcTrk.GetNofHits() == 0) { continue; } + if (mcTrk.GetNofHits() == 0) { + continue; + } // Cut tracks, which cannot be reconstructed - if (!mcTrk.IsReconstructable()) { continue; } + if (!mcTrk.IsReconstructable()) { + continue; + } int pdg = mcTrk.GetPdgCode(); bool isPrimary = mcTrk.IsPrimary(); @@ -210,13 +225,21 @@ void OutputQa::FillHistograms() FillMCTrack(ETrackType::kPrim, iTrkMC); bool bFast = mcTrk.GetP() > CbmL1Constants::MinFastMom; bool bLong = mcTrk.GetTotNofStationsWithHit() == fpParameters->GetNstationsActive(); - if (bFast) { FillMCTrack(ETrackType::kPrimFast, iTrkMC); } - if (bLong) { FillMCTrack(ETrackType::kPrimLong, iTrkMC); } - if (bLong && bFast) { FillMCTrack(ETrackType::kPrimLongFast, iTrkMC); } + if (bFast) { + FillMCTrack(ETrackType::kPrimFast, iTrkMC); + } + if (bLong) { + FillMCTrack(ETrackType::kPrimLong, iTrkMC); + } + if (bLong && bFast) { + FillMCTrack(ETrackType::kPrimLongFast, iTrkMC); + } } else { FillMCTrack(ETrackType::kSec, iTrkMC); - if (mcTrk.GetP() > CbmL1Constants::MinFastMom) { FillMCTrack(ETrackType::kSecFast, iTrkMC); } + if (mcTrk.GetP() > CbmL1Constants::MinFastMom) { + FillMCTrack(ETrackType::kSecFast, iTrkMC); + } } // Track distributions for different particle species @@ -431,7 +454,9 @@ InitStatus OutputQa::InitDataBranches() << "via OutputQa::ReadParameters(filename) from the qa macro"; // Initialize IO data manager - if (!fpDataManager.get()) { fpDataManager = std::make_shared<ca::DataManager>(); } + if (!fpDataManager.get()) { + fpDataManager = std::make_shared<ca::DataManager>(); + } // Initialize time slice reader instance fpTSReader->SetTrackingMode(fTrackingMode); @@ -445,7 +470,9 @@ InitStatus OutputQa::InitDataBranches() fpTSReader->RegisterTracksContainer(fvRecoTracks); fpTSReader->RegisterQaHitContainer(fvHits); fpTSReader->RegisterHitIndexContainer(fvHitIds); - if (!fpTSReader->InitRun()) { return kFATAL; } + if (!fpTSReader->InitRun()) { + return kFATAL; + } // Initialize MC module if (IsMCUsed()) { @@ -462,7 +489,9 @@ InitStatus OutputQa::InitDataBranches() fpMCModule->RegisterQaHitContainer(fvHits); fpMCModule->RegisterParameters(fpParameters); fpMCModule->RegisterFirstHitIndexes(fpTSReader->GetHitFirstIndexDet()); - if (!fpMCModule->InitRun()) { return kFATAL; } + if (!fpMCModule->InitRun()) { + return kFATAL; + } } // Initialize monitor @@ -481,7 +510,9 @@ InitStatus OutputQa::InitDataBranches() InitStatus OutputQa::InitHistograms() { auto RegisterTrackQa = [&](const char* typeName, const char* title, ETrackType type, bool bSuppressMC = false) { - if (!fvbTrackTypeOn[type]) { return; } + if (!fvbTrackTypeOn[type]) { + return; + } bool bUseMC = IsMCUsed() && !bSuppressMC; fvsTrackTypeName[type] = typeName; fvpTrackHistograms[type] = std::make_unique<TrackTypeQa>(typeName, fsPrefix.Data(), bUseMC, fpvObjList); @@ -586,7 +617,9 @@ std::map<std::string, bool> OutputQa::Check() double nEvents = static_cast<double>(GetEventNumber()); LOG(info) << "Number of events: " << GetEventNumber(); for (auto trType : fmSummaryTableEntries) { - if (!fvbTrackTypeOn[trType] || !fvpTrackHistograms[trType]->IsMCUsed()) { continue; } + if (!fvbTrackTypeOn[trType] || !fvpTrackHistograms[trType]->IsMCUsed()) { + continue; + } aTable->SetRowName(iRow, fvpTrackHistograms[trType]->GetTitle()); aTable->SetCell(iRow, 0, fvpTrackHistograms[trType]->GetIntegratedEff()); aTable->SetCell(iRow, 1, fvpTrackHistograms[trType]->GetKilledRate()); @@ -704,7 +737,9 @@ void OutputQa::DrawEvent() for (int iTmc = 0; iTmc < nMCTracks; ++iTmc) { const auto& trk = fMCData.GetTrack(iTmc); int nPoints = trk.GetNofPoints(); - if (nPoints == 0) { continue; } + if (nPoints == 0) { + continue; + } std::vector<double> trkPointX(nPoints); std::vector<double> trkPointY(nPoints); std::vector<double> trkPointZ(nPoints); @@ -916,7 +951,9 @@ InitStatus OutputQa::InitTimeSlice() fMonitor.IncrementCounter(EMonitorKey::kMcPoint, nMCPoints); fMonitor.IncrementCounter(EMonitorKey::kMcTrack, nMCTracks); - if (fbDrawEvents && nMCPoints > std::max(0, fEvtDisplayMinNofPoints)) { DrawEvent(); } + if (fbDrawEvents && nMCPoints > std::max(0, fEvtDisplayMinNofPoints)) { + DrawEvent(); + } } // ****** DEBUG: BEGIN @@ -925,16 +962,22 @@ InitStatus OutputQa::InitTimeSlice() { LOG(info) << "---------- Reco track sample"; int id = 0; - if (fvRecoTracks.size()) { LOG(info) << setw(4) << "No." << ' ' << fvRecoTracks[0].ToString(3, true); } + if (fvRecoTracks.size()) { + LOG(info) << setw(4) << "No." << ' ' << fvRecoTracks[0].ToString(3, true); + } for (const auto& trk : fvRecoTracks) { - if (trk.IsGhost()) { LOG(info) << "I AM A GHOST! BOO!"; } + if (trk.IsGhost()) { + LOG(info) << "I AM A GHOST! BOO!"; + } LOG(info) << setw(4) << (id++) << ' ' << trk.ToString(3); } } { LOG(info) << "---------- Reco hit sample"; int id = 0; - if (fvHits.size()) { LOG(info) << setw(4) << "No." << ' ' << fvHits[0].ToString(3, true); } + if (fvHits.size()) { + LOG(info) << setw(4) << "No." << ' ' << fvHits[0].ToString(3, true); + } for (const auto& h : fvHits) { LOG(info) << setw(4) << (id++) << ' ' << h.ToString(3); } @@ -946,7 +989,9 @@ InitStatus OutputQa::InitTimeSlice() LOG(info) << setw(4) << "No." << ' ' << fMCData.GetTrack(0).ToString(3, true); } for (const auto& trk : fMCData.GetTrackContainer()) { - if (trk.GetNofHits() || trk.GetNofPoints()) { LOG(info) << setw(4) << (id++) << ' ' << trk.ToString(3); } + if (trk.GetNofHits() || trk.GetNofPoints()) { + LOG(info) << setw(4) << (id++) << ' ' << trk.ToString(3); + } } } if (IsMCUsed()) { diff --git a/reco/L1/qa/CbmCaOutputQa.h b/reco/L1/qa/CbmCaOutputQa.h index 90afb81c5db3c41c1af6dec2f55f17f969c6982f..46b2f3e7c069f1191defc6478a2d66ee5be4b8dc 100644 --- a/reco/L1/qa/CbmCaOutputQa.h +++ b/reco/L1/qa/CbmCaOutputQa.h @@ -10,6 +10,10 @@ #ifndef CbmCaOutputQa_h #define CbmCaOutputQa_h 1 +#include "CaMonitor.h" +#include "CaParameters.h" +#include "CaToolsDebugger.h" +#include "CaVector.h" #include "CbmCaMCModule.h" #include "CbmCaTimeSliceReader.h" #include "CbmCaTrackTypeQa.h" @@ -21,11 +25,6 @@ #include <array> #include <memory> -#include "CaMonitor.h" -#include "CaParameters.h" -#include "CaToolsDebugger.h" -#include "CaVector.h" - namespace cbm::ca { /// @brief Enumeration fors track category @@ -113,7 +112,7 @@ namespace cbm::ca Style_t fMarker = 1; ///< Marker style }; - public: + public: /// @brief Constructor from parameters /// @param verbose Verbosity level /// @param isMCUsed Flag, if MC information is available for this task @@ -133,7 +132,9 @@ namespace cbm::ca /// Creates a debugger and enables its usage inside a QA task void EnableDebugger(const char* filename) { - if (!fpDebugger.get()) { fpDebugger = std::make_shared<tools::Debugger>(filename); } + if (!fpDebugger.get()) { + fpDebugger = std::make_shared<tools::Debugger>(filename); + } } /// @brief Reads defined parameters object from file @@ -193,7 +194,7 @@ namespace cbm::ca ClassDef(OutputQa, 0); - protected: + protected: /// \brief Method to check, if the QA results are acceptable /// \return Map of checks: key - name of the check, value - result of the check std::map<std::string, bool> Check(); @@ -222,13 +223,15 @@ namespace cbm::ca /// @param void FillTrackTypeHistograms(); - private: + private: /// @brief Fills reconstructed track by its index /// @param type Track type /// @param iTrkReco Index of reconstructed track [[gnu::always_inline]] void FillRecoTrack(ETrackType type, int iTrkReco) { - if (fvbTrackTypeOn[type]) { fvpTrackHistograms[type]->FillRecoTrack(iTrkReco); } + if (fvbTrackTypeOn[type]) { + fvpTrackHistograms[type]->FillRecoTrack(iTrkReco); + } } /// @brief Fills MC track by its index @@ -258,19 +261,19 @@ namespace cbm::ca bool fbUseTof = false; ///< is TOF used bool fbDrawEvents = false; ///< flag to draw events with the event display int fEvtDisplayMinNofPoints = 2; ///< minimum number of MC points in the event display - int fPerformanceMode = 1; ///< Performance mode + int fPerformanceMode = 1; ///< Performance mode ECbmCaTrackingMode fTrackingMode = ECbmCaTrackingMode::kSTS; ///< Tracking mode - std::unique_ptr<TimeSliceReader> fpTSReader = nullptr; ///< Reader of the time slice - std::shared_ptr<MCModule> fpMCModule = nullptr; ///< MC module - std::shared_ptr<ca::DataManager> fpDataManager = nullptr; ///< Data manager - std::shared_ptr<tools::Debugger> fpDebugger = nullptr; ///< Debugger - std::shared_ptr<ca::Parameters> fpParameters = nullptr; ///< Tracking parameters object + std::unique_ptr<TimeSliceReader> fpTSReader = nullptr; ///< Reader of the time slice + std::shared_ptr<MCModule> fpMCModule = nullptr; ///< MC module + std::shared_ptr<ca::DataManager> fpDataManager = nullptr; ///< Data manager + std::shared_ptr<tools::Debugger> fpDebugger = nullptr; ///< Debugger + std::shared_ptr<ca::Parameters> fpParameters = nullptr; ///< Tracking parameters object - ca::Vector<CbmL1HitId> fvHitIds {"CbmCaOutputQa::fvHitIds"}; - ca::Vector<CbmL1HitDebugInfo> fvHits {"CbmCaOutputQa::fvHits"}; - ca::Vector<CbmL1Track> fvRecoTracks {"CbmCaOutputQa::fvRecoTracks"}; + ca::Vector<CbmL1HitId> fvHitIds{"CbmCaOutputQa::fvHitIds"}; + ca::Vector<CbmL1HitDebugInfo> fvHits{"CbmCaOutputQa::fvHits"}; + ca::Vector<CbmL1Track> fvRecoTracks{"CbmCaOutputQa::fvRecoTracks"}; tools::MCData fMCData; ///< Input MC data (points and tracks) /// @enum EMonitorKey @@ -285,7 +288,7 @@ namespace cbm::ca kEND }; - ca::Monitor<EMonitorKey> fMonitor {"Output tracking QA"}; + ca::Monitor<EMonitorKey> fMonitor{"Output tracking QA"}; std::set<ETrackType> fmSummaryTableEntries; ///< Which track types should be listed in the summary table @@ -319,10 +322,14 @@ void cbm::ca::OutputQa::DrawSetOf(const std::vector<ETrackType>& vTypes, std::fu { CbmQaCmpDrawer<TObj> drawer; for (auto type : vTypes) { - if (!fvbTrackTypeOn[type] || !fvpTrackHistograms[type]->IsMCUsed()) { continue; } + if (!fvbTrackTypeOn[type] || !fvpTrackHistograms[type]->IsMCUsed()) { + continue; + } drawer.RegisterObject(GetObj(type), fvpTrackHistograms[type]->GetTitle()); } - if constexpr (std::is_same_v<TH1F, TObj>) { drawer.SetMinimum(1.e-1); } + if constexpr (std::is_same_v<TH1F, TObj>) { + drawer.SetMinimum(1.e-1); + } drawer.Draw(""); drawer.Clear(); } @@ -335,7 +342,9 @@ void cbm::ca::OutputQa::DrawSetOf(const std::vector<ETrackType>& vTypes, std::fu [[gnu::always_inline]] inline void cbm::ca::OutputQa::FillMCTrack(ETrackType type, int iTrkMC) { // Fill histograms and efficiency profiles - if (fvbTrackTypeOn[type]) { fvpTrackHistograms[type]->FillMCTrack(iTrkMC); } + if (fvbTrackTypeOn[type]) { + fvpTrackHistograms[type]->FillMCTrack(iTrkMC); + } } #endif // CbmCaOutputQa_h diff --git a/reco/L1/qa/CbmCaTrackFitQa.cxx b/reco/L1/qa/CbmCaTrackFitQa.cxx index 3359040e8446ef3137c6da43b90e8cb2fb156815..7a2d1cf5f16a2c2fb610009da387072f3f9d6999 100644 --- a/reco/L1/qa/CbmCaTrackFitQa.cxx +++ b/reco/L1/qa/CbmCaTrackFitQa.cxx @@ -9,9 +9,12 @@ #include "CbmCaTrackFitQa.h" +#include "CaField.h" +#include "CaToolsField.h" +#include "CaToolsMCData.h" +#include "CaTrackFit.h" #include "CbmL1Track.h" #include "CbmQaCanvas.h" - #include "TF1.h" #include "TFormula.h" #include "TH1.h" @@ -20,11 +23,6 @@ #include <algorithm> -#include "CaField.h" -#include "CaToolsField.h" -#include "CaToolsMCData.h" -#include "CaTrackFit.h" - using namespace cbm::algo::ca; // ******************************************************* @@ -54,7 +52,9 @@ CbmQaCanvas* TrackFitQa::CreateResidualPlot() for (int iType = static_cast<int>(ETrackParType::kBEGIN); iType < static_cast<int>(ETrackParType::kEND); ++iType) { ETrackParType type = static_cast<ETrackParType>(iType); - if (fvbParIgnored[type]) { continue; } + if (fvbParIgnored[type]) { + continue; + } pCanv->cd(iType + 1); fvphResiduals[type]->Draw(); } @@ -71,7 +71,9 @@ CbmQaCanvas* TrackFitQa::CreatePullPlot() for (int iType = static_cast<int>(ETrackParType::kBEGIN); iType < static_cast<int>(ETrackParType::kEND); ++iType) { ETrackParType type = static_cast<ETrackParType>(iType); - if (fvbParIgnored[type]) { continue; } + if (fvbParIgnored[type]) { + continue; + } auto fit = TF1("fitpull", "[0] * TMath::Exp(TMath::ASinH(-0.5*[3]*((x-[1])/[2])**2)/[3])", -10., 10.); fit.SetParameters(100, 0., 1., .3); fit.SetParLimits(3, 0., 2.); @@ -93,13 +95,17 @@ void TrackFitQa::Init() cbm::ca::tools::SetOriginalCbmField(); auto CreateResidualHisto = [&](ETrackParType t, const char* name, const char* title) { - if (fvbParIgnored[t]) { return; } + if (fvbParIgnored[t]) { + return; + } TString sPrefix = (fsTitle.Length() > 0) ? fsTitle + " point residual for " : "residual for "; fvphResiduals[t] = MakeQaObject<TH1F>(name, sPrefix + title, fvRBins[t], fvRLo[t], fvRUp[t]); }; auto CreatePullHisto = [&](ETrackParType t, const char* name, const char* title) { - if (fvbParIgnored[t]) { return; } + if (fvbParIgnored[t]) { + return; + } TString sPrefix = (fsTitle.Length() > 0) ? fsTitle + " point pull for " : "pull for "; fvphPulls[t] = MakeQaObject<TH1F>(name, sPrefix + title, fvPBins[t], fvPLo[t], fvPUp[t]); }; @@ -156,8 +162,8 @@ void TrackFitQa::Fill(const TrackParamV& trPar, const tools::MCPoint& mcPoint, b FillResAndPull(ETrackParType::kQP, trPar.GetQp()[0], trParExtr.GetQpError()[0], mcPoint.GetQpOut()); // Momentum resolution - double recoP = std::fabs(mcPoint.GetCharge() / trParExtr.GetQp()[0]); // reco mom. (with MC charge) - double resP = recoP - mcPoint.GetPOut(); // residual of total momentum + double recoP = std::fabs(mcPoint.GetCharge() / trParExtr.GetQp()[0]); // reco mom. (with MC charge) + double resP = recoP - mcPoint.GetPOut(); // residual of total momentum // Phi resolution double mcPhi = mcPoint.GetPhiOut(); diff --git a/reco/L1/qa/CbmCaTrackFitQa.h b/reco/L1/qa/CbmCaTrackFitQa.h index 270bbf81716cecb79e1ea417b39fee6399ca8818..46db6aee939a054409dbefa4813f1b8182879d95 100644 --- a/reco/L1/qa/CbmCaTrackFitQa.h +++ b/reco/L1/qa/CbmCaTrackFitQa.h @@ -10,22 +10,21 @@ #ifndef CbmCaTrackFitQa_h #define CbmCaTrackFitQa_h 1 -#include "CbmL1DetectorID.h" -#include "CbmQaIO.h" - -#include <array> - #include "CaConstants.h" #include "CaEnumArray.h" #include "CaField.h" #include "CaTrackParam.h" +#include "CbmL1DetectorID.h" +#include "CbmQaIO.h" + +#include <array> // Forward declarations namespace cbm::ca::tools { class MCData; class MCPoint; -} // namespace ca::tools +} // namespace cbm::ca::tools class CbmL1Track; class CbmL1HitDebugInfo; @@ -67,7 +66,7 @@ namespace cbm::ca /// Class provides histograms to monitor track fit parameters at a selected z-coordinate. /// The parameters include x, y, tx, ty, time, q/p, vi (inverse speed). class TrackFitQa : public CbmQaIO { - public: + public: /// @brief Constructor /// @param pointTag Tag for point, in which the parameters are analyzed /// @param prefix Name of unique prefix @@ -171,7 +170,7 @@ namespace cbm::ca static constexpr int kCXSIZEPX = 600; ///< Canvas size along x-axis [px] static constexpr int kCYSIZEPX = 600; ///< Canvas size along y-axis [px] - private: + private: /// @brief Sets default histogram and track parameter properties void SetDefaultProperties(); @@ -210,7 +209,9 @@ namespace cbm::ca // TODO: Test this function for performance penalties inline void TrackFitQa::FillResAndPull(ETrackParType type, double recoVal, double recoErr, double trueVal) { - if (fvbParIgnored[type]) { return; } + if (fvbParIgnored[type]) { + return; + } double res = recoVal - trueVal; double pull = res / recoErr; fvphResiduals[type]->Fill(res); diff --git a/reco/L1/qa/CbmCaTrackTypeQa.cxx b/reco/L1/qa/CbmCaTrackTypeQa.cxx index f5c9c09be1c8926a3090ab46b88a7bd48637b836..00407aefc4400e77446e1e4773ba1fe2decb1a90 100644 --- a/reco/L1/qa/CbmCaTrackTypeQa.cxx +++ b/reco/L1/qa/CbmCaTrackTypeQa.cxx @@ -9,11 +9,10 @@ #include "CbmCaTrackTypeQa.h" +#include "CaToolsMCData.h" #include "CbmCaTrackFitQa.h" #include "CbmL1Track.h" -#include "CaToolsMCData.h" - using cbm::algo::ca::FieldRegion; using cbm::algo::ca::TrackFit; using cbm::ca::TrackTypeQa; @@ -213,7 +212,9 @@ void TrackTypeQa::FillRecoTrack(int iTrkReco, double weight) int nTimeMeasurements = 0; for (int iH : recoTrack.GetHitIndexes()) { int iSt = (*fpvHits)[iH].GetStationId(); - if (fpParameters->GetStation(iSt).timeInfo) { ++nTimeMeasurements; } + if (fpParameters->GetStation(iSt).timeInfo) { + ++nTimeMeasurements; + } } bool isTimeFitted = (nTimeMeasurements > 1); @@ -265,7 +266,9 @@ void TrackTypeQa::FillRecoTrack(int iTrkReco, double weight) } fTrackFit.Extrapolate(mcTrkVertex.GetZ(), fFieldRegion); const TrackParamV& trParExtr = fTrackFit.Tr(); - if (mcTrkVertex.GetZ() == trParExtr.GetZ()[0]) { fpFitQaVertex->Fill(trParExtr, mcTrkVertex, isTimeFitted); } + if (mcTrkVertex.GetZ() == trParExtr.GetZ()[0]) { + fpFitQaVertex->Fill(trParExtr, mcTrkVertex, isTimeFitted); + } else { LOG(warn) << "iTrkReco = " << iTrkReco << ", mcTrkVertex = " << mcTrkVertex.GetZ() << ", par = " << trParExtr.GetZ()[0]; diff --git a/reco/L1/qa/CbmCaTrackTypeQa.h b/reco/L1/qa/CbmCaTrackTypeQa.h index 2e1a8de3bfd9ffcd9e3e4b7996f808a24f82305d..63ab870652b4a635db951e172b22cd4b49aa95c8 100644 --- a/reco/L1/qa/CbmCaTrackTypeQa.h +++ b/reco/L1/qa/CbmCaTrackTypeQa.h @@ -10,6 +10,9 @@ #ifndef CbmCaTrackTypeQa_h #define CbmCaTrackTypeQa_h 1 +#include "CaField.h" +#include "CaParameters.h" +#include "CaTrackFit.h" #include "CbmCaTrackFitQa.h" #include "CbmL1DetectorID.h" #include "CbmL1Hit.h" @@ -18,16 +21,12 @@ #include <map> #include <string> -#include "CaField.h" -#include "CaParameters.h" -#include "CaTrackFit.h" - // Forward declarations namespace cbm::ca::tools { class MCData; class MCTrack; -} // namespace ca::tools +} // namespace cbm::ca::tools class CbmL1Track; class CbmL1HitDebugInfo; @@ -43,7 +42,7 @@ namespace cbm::ca /// The class provides set of histograms, counters, and efficiencies for monitoring tracks of a particular type /// (reco_fast_long, mc_pi, reco_ghost) class TrackTypeQa : virtual public CbmQaIO { - public: + public: /// @brief Constructor /// @param typeName Name of tracks type (used as a prefix for histogram) /// @note Track type is stored as a root directory name in the CbmQaIO base class @@ -201,19 +200,19 @@ namespace cbm::ca // to be separated with "_" (example: "p_yMC" -- reconstructed momentum vs MC rapidity) // ** Histograms from reconstructed information only ** - TH1F* fph_reco_p = nullptr; ///< Total momentum over charge of reconstructed tracks - TH1F* fph_reco_pt = nullptr; ///< Transverse momentum over charge of reconstructed tracks - TH1F* fph_reco_phi = nullptr; ///< Azimuthal angle of reconstructed tracks - TH1F* fph_reco_theta = nullptr; ///< Polar angle of reconstructed tracks + TH1F* fph_reco_p = nullptr; ///< Total momentum over charge of reconstructed tracks + TH1F* fph_reco_pt = nullptr; ///< Transverse momentum over charge of reconstructed tracks + TH1F* fph_reco_phi = nullptr; ///< Azimuthal angle of reconstructed tracks + TH1F* fph_reco_theta = nullptr; ///< Polar angle of reconstructed tracks TH2F* fph_reco_theta_phi = nullptr; ///< Polar angle vs. azimuthal angle of reconstructed tracks - TH1F* fph_reco_tx = nullptr; ///< Slope along x-axis of reconstructed tracks - TH1F* fph_reco_ty = nullptr; ///< Slope along y-axis of reconstructed tracks + TH1F* fph_reco_tx = nullptr; ///< Slope along x-axis of reconstructed tracks + TH1F* fph_reco_ty = nullptr; ///< Slope along y-axis of reconstructed tracks TH2F* fph_reco_ty_tx = nullptr; ///< Slope along x-axis vs y-axis of reconstructed tracks - TH1F* fph_reco_eta = nullptr; ///< Pseudo-rapidity of reconstructed tracks - TH1F* fph_reco_fhitR = nullptr; ///< Distance of the first hit from z-axis for reconstructed tracks - TH1F* fph_reco_nhits = nullptr; ///< Hit number of reconstructed tracks - TH1F* fph_reco_fsta = nullptr; ///< First station index of reconstructed tracks - TH1F* fph_reco_chi2_ndf = nullptr; ///< Fit chi2 over NDF of reconstructed tracks + TH1F* fph_reco_eta = nullptr; ///< Pseudo-rapidity of reconstructed tracks + TH1F* fph_reco_fhitR = nullptr; ///< Distance of the first hit from z-axis for reconstructed tracks + TH1F* fph_reco_nhits = nullptr; ///< Hit number of reconstructed tracks + TH1F* fph_reco_fsta = nullptr; ///< First station index of reconstructed tracks + TH1F* fph_reco_chi2_ndf = nullptr; ///< Fit chi2 over NDF of reconstructed tracks // ** Reconstructed track distributions, requiring MC information ** TH1F* fph_reco_pMC = nullptr; ///< MC total momentum over charge of reconstructed tracks @@ -265,7 +264,7 @@ namespace cbm::ca // TODO: Provide integrated efficiencies - private: + private: /// @brief Overrided virtual function of the CbmQaIO class, defines properties of the histograms /// @param pHist Pointer to a histogram, which properties are to be set virtual void SetHistoProperties(TH1* pHist); @@ -291,9 +290,9 @@ namespace cbm::ca bool fbUseMC = false; ///< Flag: true - MC information is used TString fsTitle = ""; ///< Title of the track category - ca::Vector<CbmL1Track>* fpvRecoTracks = nullptr; ///< Pointer to vector of reconstructed tracks - ca::Vector<CbmL1HitDebugInfo>* fpvHits = nullptr; ///< Pointer to vector of reconstructed hits - tools::MCData* fpMCData = nullptr; ///< Pointer to MC data object + ca::Vector<CbmL1Track>* fpvRecoTracks = nullptr; ///< Pointer to vector of reconstructed tracks + ca::Vector<CbmL1HitDebugInfo>* fpvHits = nullptr; ///< Pointer to vector of reconstructed hits + tools::MCData* fpMCData = nullptr; ///< Pointer to MC data object std::shared_ptr<ca::Parameters> fpParameters = nullptr; ///< Pointer to parameters object diff --git a/reco/L1/qa/CbmTofInteraction.cxx b/reco/L1/qa/CbmTofInteraction.cxx index 59624bb7ea6782af9018530644c7154b2e0ffa6a..0b9b793e800297e4632ee7df2e16d42dfac57f1f 100644 --- a/reco/L1/qa/CbmTofInteraction.cxx +++ b/reco/L1/qa/CbmTofInteraction.cxx @@ -17,7 +17,7 @@ // --------------------------------------------------------------------------------------------------------------------- // -CbmTofInteraction::CbmTofInteraction() : CbmTofPoint(), fNofPoints(0) {}; +CbmTofInteraction::CbmTofInteraction() : CbmTofPoint(), fNofPoints(0){}; // --------------------------------------------------------------------------------------------------------------------- // diff --git a/reco/L1/qa/CbmTofInteraction.h b/reco/L1/qa/CbmTofInteraction.h index 23259ed1543a6688a2baffc1a66185ea406b8369..f25c7743f066480845cd2133f6c55ccc32d11ed9 100644 --- a/reco/L1/qa/CbmTofInteraction.h +++ b/reco/L1/qa/CbmTofInteraction.h @@ -18,7 +18,7 @@ /// Class describes an interaction of a MC track with a TOF module as a solid structure /// class CbmTofInteraction : public CbmTofPoint { -public: + public: // ----- Constructors and destructor /// Default constructor CbmTofInteraction(); @@ -58,7 +58,7 @@ public: /// \brief Gets pointers to points (TMP!!!!) const std::vector<const CbmTofPoint*>& GetPoints() const { return fvpPoints; } -private: + private: // ----- Utility functions /// \brief Updates average of the property from original TOF MC-point /// \param update Property of the added MC point diff --git a/reco/L1/qa/CbmTrackerInputQaTof.cxx b/reco/L1/qa/CbmTrackerInputQaTof.cxx index efcf197744f25f7d77667ad1602b623852054a1d..6e1bc555cb36fb3002fb28b34ec2b6802b6b0da8 100644 --- a/reco/L1/qa/CbmTrackerInputQaTof.cxx +++ b/reco/L1/qa/CbmTrackerInputQaTof.cxx @@ -124,10 +124,14 @@ void CbmTrackerInputQaTof::SetParContainers() // Get run and runtime database FairRunAna* ana = FairRunAna::Instance(); - if (!ana) { LOG(fatal) << "No FairRunAna instance"; } + if (!ana) { + LOG(fatal) << "No FairRunAna instance"; + } FairRuntimeDb* rtdb = ana->GetRuntimeDb(); - if (!rtdb) { LOG(fatal) << "No FairRuntimeDb instance"; } + if (!rtdb) { + LOG(fatal) << "No FairRuntimeDb instance"; + } // fTofDigiPar = dynamic_cast<CbmTofDigiPar*>(rtdb->getContainer("CbmTofDigiPar")); // fTofGeoPar = dynamic_cast<CbmTofParSetGeo*>(rtdb->getContainer("CbmTofParSetGeo")); @@ -216,7 +220,9 @@ InitStatus CbmTrackerInputQaTof::ReInit() if (nullptr == fDigis) { LOG(info) << "No calibrated tof digi vector in the input files => trying original vector"; fDigis = dynamic_cast<TClonesArray*>(manager->GetObject("TofDigi")); - if (nullptr == fDigis) { LOG(info) << "No original tof digi vector in the input files! Ignore TOF!"; } + if (nullptr == fDigis) { + LOG(info) << "No original tof digi vector in the input files! Ignore TOF!"; + } } fTofCalDigiMatch = dynamic_cast<TClonesArray*>(manager->GetObject("TofCalDigiMatch")); @@ -351,7 +357,9 @@ InitStatus CbmTrackerInputQaTof::ReInit() // ------------------------------------------------------------------------- void CbmTrackerInputQaTof::Exec(Option_t*) { - if (!fIsTofInSetup) { return; } + if (!fIsTofInSetup) { + return; + } // update number of processed events fNevents.SetVal(fNevents.GetVal() + 1); @@ -364,7 +372,9 @@ void CbmTrackerInputQaTof::Exec(Option_t*) void CbmTrackerInputQaTof::Finish() { FairSink* sink = FairRootManager::Instance()->GetSink(); - if (sink) { sink->WriteObject(&GetQa(), nullptr); } + if (sink) { + sink->WriteObject(&GetQa(), nullptr); + } } int CbmTrackerInputQaTof::GetStationIndex(CbmTofPoint* p) @@ -489,7 +499,9 @@ void CbmTrackerInputQaTof::ResolutionQa() CbmTofPoint* p = dynamic_cast<CbmTofPoint*>(fMcPoints->Get(fileId, eventId, iMC)); int PointStation = GetStationIndex(p); if (PointStation < 0) continue; - if (!selectedMcPointPerStation[PointStation][p->GetTrackID()]) { selectedPoints[iE].push_back(iMC); } + if (!selectedMcPointPerStation[PointStation][p->GetTrackID()]) { + selectedPoints[iE].push_back(iMC); + } selectedMcPointPerStation[PointStation][p->GetTrackID()] = 1; } @@ -508,7 +520,9 @@ void CbmTrackerInputQaTof::ResolutionQa() for (Int_t iHit = 0; iHit < nHits; iHit++) { CbmTofHit* hit = dynamic_cast<CbmTofHit*>(fHits->At(iHit)); - if (!hit) { LOG(fatal) << "Tof hit N " << iHit << " doesn't exist"; } + if (!hit) { + LOG(fatal) << "Tof hit N " << iHit << " doesn't exist"; + } const int address = hit->GetAddress(); //should ignore these hits for some reason @@ -521,17 +535,23 @@ void CbmTrackerInputQaTof::ResolutionQa() } CbmMatch* myHitMatch = dynamic_cast<CbmMatch*>(fHitMatches->At(iHit)); - if (!myHitMatch) { LOG(fatal) << "Tof hit match N " << iHit << " doesn't exist"; } + if (!myHitMatch) { + LOG(fatal) << "Tof hit match N " << iHit << " doesn't exist"; + } // take corresponding MC point const CbmLink& bestLink = myHitMatch->GetMatchedLink(); // skip hits from the noise digis - if (bestLink.GetIndex() < 0) { continue; } + if (bestLink.GetIndex() < 0) { + continue; + } CbmTofPoint* p = dynamic_cast<CbmTofPoint*>(fMcPoints->Get(bestLink)); - if (!p) { LOG(error) << "CbmTrackerInputQaTof:: link points to a non-existing MC point"; } + if (!p) { + LOG(error) << "CbmTrackerInputQaTof:: link points to a non-existing MC point"; + } if (p->GetDetectorID() != (int) hit->GetAddress()) { LOG(error) << "CbmTrackerInputQaTof:: mc point module address differs from the hit module address"; diff --git a/reco/L1/qa/CbmTrackerInputQaTof.h b/reco/L1/qa/CbmTrackerInputQaTof.h index 69ea8ade2ef3a62b7f52fe1fe3d2f7f61c4ea062..18b4cd213b9f4a40f91ff094e04d49a34a7ec96b 100644 --- a/reco/L1/qa/CbmTrackerInputQaTof.h +++ b/reco/L1/qa/CbmTrackerInputQaTof.h @@ -42,7 +42,7 @@ class TClonesArray; /// class CbmTrackerInputQaTof : public FairTask { -public: + public: /// Constructor CbmTrackerInputQaTof(const char* name = "TrackerInputQaTof", Int_t verbose = 1); @@ -71,7 +71,7 @@ public: /// The reference is non-const, because FairSink can not write const objects TFolder& GetQa(); -private: + private: /// Check the geometry InitStatus GeometryQa(); @@ -86,48 +86,48 @@ private: // Setup - Bool_t fIsTofInSetup {false}; - Bool_t fIsMcPresent {false}; + Bool_t fIsTofInSetup{false}; + Bool_t fIsMcPresent{false}; - Int_t fNtrackingStations {0}; + Int_t fNtrackingStations{0}; - CbmTimeSlice* fTimeSlice {nullptr}; - CbmTofParSetGeo* fTofGeoPar {nullptr}; - CbmTofDigiPar* fTofDigiPar {nullptr}; + CbmTimeSlice* fTimeSlice{nullptr}; + CbmTofParSetGeo* fTofGeoPar{nullptr}; + CbmTofDigiPar* fTofDigiPar{nullptr}; /// MC data - CbmMCEventList* fMcEventList {nullptr}; // list of MC events connected to the current time slice - CbmMCDataManager* fMcManager {nullptr}; - CbmMCDataArray* fMcTracks {nullptr}; - CbmMCDataArray* fMcPoints {nullptr}; + CbmMCEventList* fMcEventList{nullptr}; // list of MC events connected to the current time slice + CbmMCDataManager* fMcManager{nullptr}; + CbmMCDataArray* fMcTracks{nullptr}; + CbmMCDataArray* fMcPoints{nullptr}; /// Data - TClonesArray* fClusters {nullptr}; - TClonesArray* fHits {nullptr}; - TClonesArray* fHitMatches {nullptr}; + TClonesArray* fClusters{nullptr}; + TClonesArray* fHits{nullptr}; + TClonesArray* fHitMatches{nullptr}; - TClonesArray* fHitDigiMatches {nullptr}; - TClonesArray* fDigis {nullptr}; - TClonesArray* fTofCalDigiMatch {nullptr}; + TClonesArray* fHitDigiMatches{nullptr}; + TClonesArray* fDigis{nullptr}; + TClonesArray* fTofCalDigiMatch{nullptr}; /// Output - TFolder fOutFolder {"TrackerInputQaTof", "TrackerInputQaTof"}; /// output folder with histos and canvases - TFolder* fHistFolder {nullptr}; /// subfolder for histograms + TFolder fOutFolder{"TrackerInputQaTof", "TrackerInputQaTof"}; /// output folder with histos and canvases + TFolder* fHistFolder{nullptr}; /// subfolder for histograms - TParameter<int> fNevents {"nEvents", 0}; /// number of processed events + TParameter<int> fNevents{"nEvents", 0}; /// number of processed events /// Histogram for Residual Distribution - CbmQaHist<TH1D> fhResidualX {"hResidualX", "Tof: Residual X;(X_{reco} - X_{MC})(cm)", 100, -10, 10}; - CbmQaHist<TH1D> fhResidualY {"hRresidualY", "Tof: Residual Y;(Y_{reco} - Y_{MC})(cm)", 100, -10, 10}; - CbmQaHist<TH1D> fhResidualT {"hRresidualT", "Tof: Residual T;(T_{reco} - T_{MC})(ns)", 100, -50, 50}; - CbmQaHist<TH1D> fhResidualZ {"hRresidualZ", "Tof: Residual Z;(Z_{reco} - Z_{MC})(cm)", 100, -100, 100}; + CbmQaHist<TH1D> fhResidualX{"hResidualX", "Tof: Residual X;(X_{reco} - X_{MC})(cm)", 100, -10, 10}; + CbmQaHist<TH1D> fhResidualY{"hRresidualY", "Tof: Residual Y;(Y_{reco} - Y_{MC})(cm)", 100, -10, 10}; + CbmQaHist<TH1D> fhResidualT{"hRresidualT", "Tof: Residual T;(T_{reco} - T_{MC})(ns)", 100, -50, 50}; + CbmQaHist<TH1D> fhResidualZ{"hRresidualZ", "Tof: Residual Z;(Z_{reco} - Z_{MC})(cm)", 100, -100, 100}; /// Histogram for PULL Distribution - CbmQaHist<TH1D> fhPullX {"hPullX", "Tof: Pull X;(X_{reco} - X_{MC}) / #sigmaU_{reco}", 100, -5, 5}; - CbmQaHist<TH1D> fhPullY {"hPullX", "Tof: Pull Y;(Y_{reco} - Y_{MC}) / #sigmaV_{reco}", 100, -5, 5}; - CbmQaHist<TH1D> fhPullT {"hPullT", "Tof: Pull T;(T_{reco} - T_{MC}) / #sigmaT_{reco}", 100, -5, 5}; + CbmQaHist<TH1D> fhPullX{"hPullX", "Tof: Pull X;(X_{reco} - X_{MC}) / #sigmaU_{reco}", 100, -5, 5}; + CbmQaHist<TH1D> fhPullY{"hPullX", "Tof: Pull Y;(Y_{reco} - Y_{MC}) / #sigmaV_{reco}", 100, -5, 5}; + CbmQaHist<TH1D> fhPullT{"hPullT", "Tof: Pull T;(T_{reco} - T_{MC}) / #sigmaT_{reco}", 100, -5, 5}; /// List of the above histogramms std::vector<CbmQaHist<TH1D>*> fHistList; @@ -144,14 +144,14 @@ private: /// Canvaces: collection of histogramms - CbmQaCanvas fCanvResidual {"cResidual", "Residual Distribution", 3 * 500, 2 * 500}; - CbmQaCanvas fCanvPull {"cPull", "Pull Distribution", 3 * 500, 2 * 500}; - CbmQaCanvas fCanvEfficiencyXY {"cEfficiencyXY", "Efficiency XY: % reconstructed McPoint", 2 * 500, 2 * 500}; - CbmQaCanvas fCanvEfficiencyR {"cEfficiencyR", "Efficiency R: % reconstructed McPoint", 2 * 500, 2 * 500}; - CbmQaCanvas fCanvHitsPerPoint {"cHitsPerMcPoint", "Efficiency: Hits Per McPoint", 2 * 500, 2 * 500}; - CbmQaCanvas fCanvPointsPerHit {"cMcPointsPerHit", "Purity: McPoints per Hit", 2 * 500, 2 * 500}; + CbmQaCanvas fCanvResidual{"cResidual", "Residual Distribution", 3 * 500, 2 * 500}; + CbmQaCanvas fCanvPull{"cPull", "Pull Distribution", 3 * 500, 2 * 500}; + CbmQaCanvas fCanvEfficiencyXY{"cEfficiencyXY", "Efficiency XY: % reconstructed McPoint", 2 * 500, 2 * 500}; + CbmQaCanvas fCanvEfficiencyR{"cEfficiencyR", "Efficiency R: % reconstructed McPoint", 2 * 500, 2 * 500}; + CbmQaCanvas fCanvHitsPerPoint{"cHitsPerMcPoint", "Efficiency: Hits Per McPoint", 2 * 500, 2 * 500}; + CbmQaCanvas fCanvPointsPerHit{"cMcPointsPerHit", "Purity: McPoints per Hit", 2 * 500, 2 * 500}; -private: + private: /// Suppressed copy constructor CbmTrackerInputQaTof(const CbmTrackerInputQaTof&) = delete; diff --git a/reco/L1/qa/CbmTrackerInputQaTrd.cxx b/reco/L1/qa/CbmTrackerInputQaTrd.cxx index 166b7999458754f7d476eaf4065c008be0f781f5..ac26273d5da34d4503a9bf31e7616e4fe0dbd829 100644 --- a/reco/L1/qa/CbmTrackerInputQaTrd.cxx +++ b/reco/L1/qa/CbmTrackerInputQaTrd.cxx @@ -129,10 +129,14 @@ void CbmTrackerInputQaTrd::SetParContainers() // Get run and runtime database FairRunAna* ana = FairRunAna::Instance(); - if (!ana) { LOG(fatal) << "No FairRunAna instance"; } + if (!ana) { + LOG(fatal) << "No FairRunAna instance"; + } FairRuntimeDb* rtdb = ana->GetRuntimeDb(); - if (!rtdb) { LOG(fatal) << "No FairRuntimeDb instance"; } + if (!rtdb) { + LOG(fatal) << "No FairRuntimeDb instance"; + } fTrdDigiPar = dynamic_cast<CbmTrdParSetDigi*>(rtdb->getContainer("CbmTrdParSetDigi")); fTrdGeoPar = dynamic_cast<CbmTrdParSetGeo*>(rtdb->getContainer("CbmTrdParSetGeo")); @@ -257,7 +261,9 @@ InitStatus CbmTrackerInputQaTrd::ReInit() TObjArray* layers = topNode->GetNodes(); for (Int_t iLayer = 0; iLayer < layers->GetEntriesFast(); iLayer++) { TGeoNode* layer = static_cast<TGeoNode*>(layers->At(iLayer)); - if (TString(layer->GetName()).Contains("layer")) { layerCounter++; } + if (TString(layer->GetName()).Contains("layer")) { + layerCounter++; + } } } } @@ -364,7 +370,9 @@ InitStatus CbmTrackerInputQaTrd::ReInit() // ------------------------------------------------------------------------- void CbmTrackerInputQaTrd::Exec(Option_t*) { - if (!fIsTrdInSetup) { return; } + if (!fIsTrdInSetup) { + return; + } // update number of processed events fNevents.SetVal(fNevents.GetVal() + 1); @@ -377,7 +385,9 @@ void CbmTrackerInputQaTrd::Exec(Option_t*) void CbmTrackerInputQaTrd::Finish() { FairSink* sink = FairRootManager::Instance()->GetSink(); - if (sink) { sink->WriteObject(&GetQa(), nullptr); } + if (sink) { + sink->WriteObject(&GetQa(), nullptr); + } } @@ -512,13 +522,17 @@ void CbmTrackerInputQaTrd::ResolutionQa() } myHitMatch.AddLinks(*match); } - if (myHitMatch.GetNofLinks() == 0) { continue; } + if (myHitMatch.GetNofLinks() == 0) { + continue; + } const CbmLink& bestLink = myHitMatch.GetMatchedLink(); { // check if the hit match is correct CbmMatch* hitMatch = dynamic_cast<CbmMatch*>(fHitMatches->At(iHit)); - if (hitMatch == nullptr) { LOG(error) << "hit match for TRD hit " << iHit << " doesn't exist"; } + if (hitMatch == nullptr) { + LOG(error) << "hit match for TRD hit " << iHit << " doesn't exist"; + } else { const CbmLink& link = hitMatch->GetMatchedLink(); if ((link != bestLink) && (link.GetWeight() != bestLink.GetWeight())) { @@ -552,7 +566,9 @@ void CbmTrackerInputQaTrd::ResolutionQa() // take corresponding MC point // skip hits from the noise digis - if (bestLink.GetIndex() < 0) { continue; } + if (bestLink.GetIndex() < 0) { + continue; + } CbmTrdPoint* p = dynamic_cast<CbmTrdPoint*>(fMcPoints->Get(bestLink)); if (p == nullptr) { diff --git a/reco/L1/qa/CbmTrackerInputQaTrd.h b/reco/L1/qa/CbmTrackerInputQaTrd.h index c7c6f5aad81b1ba32a4453434aafe95bababa1d0..bbf6940150571db8ec2c29a2fbc8230396623bdb 100644 --- a/reco/L1/qa/CbmTrackerInputQaTrd.h +++ b/reco/L1/qa/CbmTrackerInputQaTrd.h @@ -42,7 +42,7 @@ class TClonesArray; /// class CbmTrackerInputQaTrd : public FairTask { -public: + public: /// Constructor CbmTrackerInputQaTrd(const char* name = "TrackerInputQaTrd", Int_t verbose = 1); @@ -71,7 +71,7 @@ public: /// The reference is non-const, because FairSink can not write const objects TFolder& GetQa(); -private: + private: /// Check the geometry InitStatus GeometryQa(); @@ -84,52 +84,52 @@ private: // Setup - Bool_t fIsTrdInSetup {false}; - Bool_t fIsMcPresent {false}; + Bool_t fIsTrdInSetup{false}; + Bool_t fIsMcPresent{false}; - Int_t fNtrackingStations {0}; + Int_t fNtrackingStations{0}; - CbmTimeSlice* fTimeSlice {nullptr}; - CbmTrdParSetGeo* fTrdGeoPar {nullptr}; - CbmTrdParSetDigi* fTrdDigiPar {nullptr}; - CbmDigiManager* fDigiManager {nullptr}; + CbmTimeSlice* fTimeSlice{nullptr}; + CbmTrdParSetGeo* fTrdGeoPar{nullptr}; + CbmTrdParSetDigi* fTrdDigiPar{nullptr}; + CbmDigiManager* fDigiManager{nullptr}; /// MC data - CbmMCEventList* fMcEventList {nullptr}; // list of MC events connected to the current time slice - CbmMCDataManager* fMcManager {nullptr}; - CbmMCDataArray* fMcTracks {nullptr}; - CbmMCDataArray* fMcPoints {nullptr}; + CbmMCEventList* fMcEventList{nullptr}; // list of MC events connected to the current time slice + CbmMCDataManager* fMcManager{nullptr}; + CbmMCDataArray* fMcTracks{nullptr}; + CbmMCDataArray* fMcPoints{nullptr}; /// Data - TClonesArray* fClusters {nullptr}; - TClonesArray* fHits {nullptr}; - TClonesArray* fHitMatches {nullptr}; + TClonesArray* fClusters{nullptr}; + TClonesArray* fHits{nullptr}; + TClonesArray* fHitMatches{nullptr}; /// Output - TFolder fOutFolder {"TrackerInputQaTrd", "TrackerInputQaTrd"}; /// output folder with histos and canvases - TFolder* fHistFolder {nullptr}; /// subfolder for histograms + TFolder fOutFolder{"TrackerInputQaTrd", "TrackerInputQaTrd"}; /// output folder with histos and canvases + TFolder* fHistFolder{nullptr}; /// subfolder for histograms - TParameter<int> fNevents {"nEvents", 0}; /// number of processed events + TParameter<int> fNevents{"nEvents", 0}; /// number of processed events /// Histogram for Residual Distribution - CbmQaHist<TH1D> fh1DresidualU {"h1DresidualU", "Trd1D: Residual U;(U_{reco} - U_{MC})(cm)", 100, -.5, .5}; - CbmQaHist<TH1D> fh1DresidualV {"h1DresidualV", "Trd1D: Residual V;(V_{reco} - V_{MC})(cm)", 100, -10, 10}; - CbmQaHist<TH1D> fh1DresidualT {"h1DresidualT", "Trd1D: Residual T;(T_{reco} - T_{MC})(ns)", 100, -50, 50}; + CbmQaHist<TH1D> fh1DresidualU{"h1DresidualU", "Trd1D: Residual U;(U_{reco} - U_{MC})(cm)", 100, -.5, .5}; + CbmQaHist<TH1D> fh1DresidualV{"h1DresidualV", "Trd1D: Residual V;(V_{reco} - V_{MC})(cm)", 100, -10, 10}; + CbmQaHist<TH1D> fh1DresidualT{"h1DresidualT", "Trd1D: Residual T;(T_{reco} - T_{MC})(ns)", 100, -50, 50}; - CbmQaHist<TH1D> fh2DresidualX {"h2DresidualX", "Trd2D: Residual X;(X_{reco} - X_{MC})(cm)", 100, -5, 5}; - CbmQaHist<TH1D> fh2DresidualY {"h2DresidualY", "Trd2D: Residual Y;(Y_{reco} - Y_{MC})(cm)", 100, -5, 5}; - CbmQaHist<TH1D> fh2DresidualT {"h2DresidualT", "Trd2D: Residual T;(T_{reco} - T_{MC})(ns)", 100, -1000, 1000}; + CbmQaHist<TH1D> fh2DresidualX{"h2DresidualX", "Trd2D: Residual X;(X_{reco} - X_{MC})(cm)", 100, -5, 5}; + CbmQaHist<TH1D> fh2DresidualY{"h2DresidualY", "Trd2D: Residual Y;(Y_{reco} - Y_{MC})(cm)", 100, -5, 5}; + CbmQaHist<TH1D> fh2DresidualT{"h2DresidualT", "Trd2D: Residual T;(T_{reco} - T_{MC})(ns)", 100, -1000, 1000}; /// Histogram for PULL Distribution - CbmQaHist<TH1D> fh1DpullU {"h1DpullU", "Trd1D: Pull U;(U_{reco} - U_{MC}) / #sigmaU_{reco}", 100, -5, 5}; - CbmQaHist<TH1D> fh1DpullV {"h1DpullV", "Trd1D: Pull V;(V_{reco} - V_{MC}) / #sigmaV_{reco}", 100, -5, 5}; - CbmQaHist<TH1D> fh1DpullT {"h1DpullT", "Trd1D: Pull T;(T_{reco} - T_{MC}) / #sigmaT_{reco}", 100, -5, 5}; + CbmQaHist<TH1D> fh1DpullU{"h1DpullU", "Trd1D: Pull U;(U_{reco} - U_{MC}) / #sigmaU_{reco}", 100, -5, 5}; + CbmQaHist<TH1D> fh1DpullV{"h1DpullV", "Trd1D: Pull V;(V_{reco} - V_{MC}) / #sigmaV_{reco}", 100, -5, 5}; + CbmQaHist<TH1D> fh1DpullT{"h1DpullT", "Trd1D: Pull T;(T_{reco} - T_{MC}) / #sigmaT_{reco}", 100, -5, 5}; - CbmQaHist<TH1D> fh2DpullX {"h2DpullX", "Trd2D: Pull X;(X_{reco} - X_{MC}) / #sigmaX_{reco}", 100, -5, 5}; - CbmQaHist<TH1D> fh2DpullY {"h2DpullY", "Trd2D: Pull Y;(Y_{reco} - Y_{MC}) / #sigmaY_{reco}", 100, -5, 5}; - CbmQaHist<TH1D> fh2DpullT {"h2DpullT", "Trd2D: Pull T;(T_{reco} - T_{MC}) / #sigmaT_{reco}", 100, -5, 5}; + CbmQaHist<TH1D> fh2DpullX{"h2DpullX", "Trd2D: Pull X;(X_{reco} - X_{MC}) / #sigmaX_{reco}", 100, -5, 5}; + CbmQaHist<TH1D> fh2DpullY{"h2DpullY", "Trd2D: Pull Y;(Y_{reco} - Y_{MC}) / #sigmaY_{reco}", 100, -5, 5}; + CbmQaHist<TH1D> fh2DpullT{"h2DpullT", "Trd2D: Pull T;(T_{reco} - T_{MC}) / #sigmaT_{reco}", 100, -5, 5}; /// List of the above histogramms std::vector<CbmQaHist<TH1D>*> fHistList; @@ -146,14 +146,14 @@ private: /// Canvaces: collection of histogramms - CbmQaCanvas fCanvResidual {"cResidual", "Residual Distribution", 3 * 500, 2 * 500}; - CbmQaCanvas fCanvPull {"cPull", "Pull Distribution", 3 * 500, 2 * 500}; - CbmQaCanvas fCanvEfficiencyXY {"cEfficiencyXY", "Efficiency XY: % reconstructed McPoint", 2 * 500, 2 * 500}; - CbmQaCanvas fCanvEfficiencyR {"cEfficiencyR", "Efficiency R: % reconstructed McPoint", 2 * 500, 2 * 500}; - CbmQaCanvas fCanvHitsPerPoint {"cHitsPerMcPoint", "Efficiency: Hits Per McPoint", 2 * 500, 2 * 500}; - CbmQaCanvas fCanvPointsPerHit {"cMcPointsPerHit", "Purity: McPoints per Hit", 2 * 500, 2 * 500}; + CbmQaCanvas fCanvResidual{"cResidual", "Residual Distribution", 3 * 500, 2 * 500}; + CbmQaCanvas fCanvPull{"cPull", "Pull Distribution", 3 * 500, 2 * 500}; + CbmQaCanvas fCanvEfficiencyXY{"cEfficiencyXY", "Efficiency XY: % reconstructed McPoint", 2 * 500, 2 * 500}; + CbmQaCanvas fCanvEfficiencyR{"cEfficiencyR", "Efficiency R: % reconstructed McPoint", 2 * 500, 2 * 500}; + CbmQaCanvas fCanvHitsPerPoint{"cHitsPerMcPoint", "Efficiency: Hits Per McPoint", 2 * 500, 2 * 500}; + CbmQaCanvas fCanvPointsPerHit{"cMcPointsPerHit", "Purity: McPoints per Hit", 2 * 500, 2 * 500}; -private: + private: /// Suppressed copy constructor CbmTrackerInputQaTrd(const CbmTrackerInputQaTrd&) = delete; diff --git a/reco/L1/utils/CbmCaIdealHitProducer.cxx b/reco/L1/utils/CbmCaIdealHitProducer.cxx index 896ea94fe1c7fe1f85932de28db7fb31c6917487..1daf544d2245a4467fe450bb128d4c8484d9db18 100644 --- a/reco/L1/utils/CbmCaIdealHitProducer.cxx +++ b/reco/L1/utils/CbmCaIdealHitProducer.cxx @@ -28,11 +28,21 @@ InitStatus IdealHitProducer::Init() InitStatus ret = kSUCCESS; - if (fbUseDet[ca::EDetectorID::kMvd]) { ret = std::max(fHitProducerMvd.Init(), ret); } - if (fbUseDet[ca::EDetectorID::kSts]) { ret = std::max(fHitProducerSts.Init(), ret); } - if (fbUseDet[ca::EDetectorID::kMuch]) { ret = std::max(fHitProducerMuch.Init(), ret); } - if (fbUseDet[ca::EDetectorID::kTrd]) { ret = std::max(fHitProducerTrd.Init(), ret); } - if (fbUseDet[ca::EDetectorID::kTof]) { ret = std::max(fHitProducerTof.Init(), ret); } + if (fbUseDet[ca::EDetectorID::kMvd]) { + ret = std::max(fHitProducerMvd.Init(), ret); + } + if (fbUseDet[ca::EDetectorID::kSts]) { + ret = std::max(fHitProducerSts.Init(), ret); + } + if (fbUseDet[ca::EDetectorID::kMuch]) { + ret = std::max(fHitProducerMuch.Init(), ret); + } + if (fbUseDet[ca::EDetectorID::kTrd]) { + ret = std::max(fHitProducerTrd.Init(), ret); + } + if (fbUseDet[ca::EDetectorID::kTof]) { + ret = std::max(fHitProducerTof.Init(), ret); + } return kSUCCESS; } @@ -40,11 +50,21 @@ InitStatus IdealHitProducer::Init() // void IdealHitProducer::Exec(Option_t* option) { - if (fbUseDet[ca::EDetectorID::kMvd]) { fHitProducerMvd.Exec(option); } - if (fbUseDet[ca::EDetectorID::kSts]) { fHitProducerSts.Exec(option); } - if (fbUseDet[ca::EDetectorID::kMuch]) { fHitProducerMuch.Exec(option); } - if (fbUseDet[ca::EDetectorID::kTrd]) { fHitProducerTrd.Exec(option); } - if (fbUseDet[ca::EDetectorID::kTof]) { fHitProducerTof.Exec(option); } + if (fbUseDet[ca::EDetectorID::kMvd]) { + fHitProducerMvd.Exec(option); + } + if (fbUseDet[ca::EDetectorID::kSts]) { + fHitProducerSts.Exec(option); + } + if (fbUseDet[ca::EDetectorID::kMuch]) { + fHitProducerMuch.Exec(option); + } + if (fbUseDet[ca::EDetectorID::kTrd]) { + fHitProducerTrd.Exec(option); + } + if (fbUseDet[ca::EDetectorID::kTof]) { + fHitProducerTof.Exec(option); + } } // --------------------------------------------------------------------------------------------------------------------- diff --git a/reco/L1/utils/CbmCaIdealHitProducer.h b/reco/L1/utils/CbmCaIdealHitProducer.h index 736ad0755e9b39d3b79b8fbba07371474ca5e286..c3fcf7721207fee2310cc44399cf395a7ff52a31 100644 --- a/reco/L1/utils/CbmCaIdealHitProducer.h +++ b/reco/L1/utils/CbmCaIdealHitProducer.h @@ -12,7 +12,6 @@ #include "CbmCaIdealHitProducerDet.h" #include "CbmL1DetectorID.h" - #include "FairTask.h" #include <string> @@ -21,7 +20,7 @@ namespace cbm::ca { /// @brief Ideal hit producer task for CA tracking class IdealHitProducer : public FairTask { - public: + public: /// @brief Constructor /// @param name Name of the task /// @param verbose Verbosity level @@ -57,7 +56,7 @@ namespace cbm::ca ClassDef(IdealHitProducer, 1); - private: + private: IdealHitProducerDet<ca::EDetectorID::kMvd> fHitProducerMvd; ///< Instance of hit producer for MVD IdealHitProducerDet<ca::EDetectorID::kSts> fHitProducerSts; ///< Instance of hit producer for STS IdealHitProducerDet<ca::EDetectorID::kMuch> fHitProducerMuch; ///< Instance of hit producer for MuCh diff --git a/reco/L1/utils/CbmCaIdealHitProducerDet.h b/reco/L1/utils/CbmCaIdealHitProducerDet.h index e196a632778f02c1258bac994a1f57438177c14f..c233eed55fb236ce71c6a6672a7dea21527192e9 100644 --- a/reco/L1/utils/CbmCaIdealHitProducerDet.h +++ b/reco/L1/utils/CbmCaIdealHitProducerDet.h @@ -10,6 +10,10 @@ #ifndef CbmCaIdealHitProducerDet_h #define CbmCaIdealHitProducerDet_h 1 +#include "AlgoFairloggerCompat.h" +#include "CaAlgoRandom.h" +#include "CaConstants.h" +#include "CaUvConverter.h" #include "CbmEvent.h" #include "CbmL1DetectorID.h" #include "CbmMCDataArray.h" @@ -36,10 +40,8 @@ #include "CbmTrdHit.h" #include "CbmTrdPoint.h" #include "CbmTrdTrackingInterface.h" - #include "FairRootManager.h" #include "FairTask.h" - #include "TClonesArray.h" #include "TVector3.h" @@ -52,11 +54,6 @@ #include <yaml-cpp/yaml.h> -#include "AlgoFairloggerCompat.h" -#include "CaAlgoRandom.h" -#include "CaConstants.h" -#include "CaUvConverter.h" - namespace cbm::ca { namespace constants = cbm::algo::ca::constants; @@ -66,7 +63,7 @@ namespace cbm::ca /// template<ca::EDetectorID DetID> class IdealHitProducerDet { - public: + public: using Hit_t = HitTypes_t::at<DetID>; using Point_t = PointTypes_t::at<DetID>; @@ -105,7 +102,7 @@ namespace cbm::ca /// @param name Name of the configuration file void SetConfigName(const char* name) { fsConfigName = name; } - private: + private: static constexpr double kHitWSize = 3.5; ///< half-width for the bounded gaussian [sigma] /// @brief Gets pointer to matched MC point @@ -129,12 +126,12 @@ namespace cbm::ca /// @brief A structure to keep hit adjustment/creation settings for each station struct HitParameters { - double fPhiU {constants::Undef<double>}; ///< Angle of the first independent measured coordinate [rad] - double fPhiV {constants::Undef<double>}; ///< Angle of the second independent measured coordinate [rad] + double fPhiU{constants::Undef<double>}; ///< Angle of the first independent measured coordinate [rad] + double fPhiV{constants::Undef<double>}; ///< Angle of the second independent measured coordinate [rad] - double fDu {constants::Undef<double>}; ///< Error of u-coordinate measurement [cm] - double fDv {constants::Undef<double>}; ///< Error of v-coordinate measurement [cm] - double fDt {constants::Undef<double>}; ///< Error of time measurement [ns] + double fDu{constants::Undef<double>}; ///< Error of u-coordinate measurement [cm] + double fDv{constants::Undef<double>}; ///< Error of v-coordinate measurement [cm] + double fDt{constants::Undef<double>}; ///< Error of time measurement [ns] /// PDFs selection for different quantities /// - 0: Bounded Gaussian distribution @@ -176,7 +173,7 @@ namespace cbm::ca std::vector<HitParameters> fvStationPars; ///< Parameters, stored for each station - ca::Random fRandom {1}; ///< Random generator + ca::Random fRandom{1}; ///< Random generator /// @brief Management flag, which does run the routine if there was a request bool fbRunTheRoutine = true; @@ -214,7 +211,9 @@ namespace cbm::ca InitStatus IdealHitProducerDet<DetID>::Init() try { auto CheckBranch = [](auto pBranch, const char* brName) { - if (!pBranch) { throw std::logic_error(Form("Branch %s is not available", brName)); } + if (!pBranch) { + throw std::logic_error(Form("Branch %s is not available", brName)); + } }; // ------ Input branch initialization @@ -325,7 +324,9 @@ namespace cbm::ca config = YAML::LoadFile(fsConfigName)["ideal_hit_producer"]; std::string detBranchName = ""; - if constexpr (ca::EDetectorID::kMvd == DetID) { detBranchName = "mvd"; } + if constexpr (ca::EDetectorID::kMvd == DetID) { + detBranchName = "mvd"; + } else if constexpr (ca::EDetectorID::kSts == DetID) { detBranchName = "sts"; } @@ -406,8 +407,8 @@ namespace cbm::ca void IdealHitProducerDet<DetID>::PushBackHit(const HitTypes_t::at<DetID>* pHit) { // Common fields for all the subsystems - auto pos = TVector3 {}; - auto dpos = TVector3 {}; + auto pos = TVector3{}; + auto dpos = TVector3{}; pHit->Position(pos); pHit->PositionError(dpos); @@ -467,7 +468,9 @@ namespace cbm::ca assert(pHitMatch); if (pHitMatch->GetNofLinks() > 0) { const auto& link = pHitMatch->GetMatchedLink(); - if (link.GetIndex() > -1) { return std::make_optional(link); } + if (link.GetIndex() > -1) { + return std::make_optional(link); + } } return std::nullopt; } @@ -492,7 +495,9 @@ namespace cbm::ca assert(ca::EDetectorID::kTof != DetID); // ------ Check, if there are any requirement to run the routine for this detector - if (!fbRunTheRoutine) { return; } + if (!fbRunTheRoutine) { + return; + } // ------ Copy hit and match branches to the temporary array and clear the main arrays if (fpBrHits) { @@ -523,23 +528,29 @@ namespace cbm::ca const auto& setting = fvStationPars[iSt]; // Skip hits from stations, where new hits are to be created from points - if (setting.fMode == 2) { continue; } + if (setting.fMode == 2) { + continue; + } else { - if (5 == CbmTofAddress::GetSmType(pHit->GetAddress())) { LOG(info) << "TOF is TZERO!"; } + if (5 == CbmTofAddress::GetSmType(pHit->GetAddress())) { + LOG(info) << "TOF is TZERO!"; + } } // ------ Adjust hit to matched MC point if (setting.fMode == 1) { // Access matched MC point auto oLinkToPoint = GetMatchedPointLink(iH); - if (oLinkToPoint == std::nullopt) { continue; } // Hit had no links, so it's fake + if (oLinkToPoint == std::nullopt) { + continue; + } // Hit had no links, so it's fake auto& link = oLinkToPoint.value(); auto* pPoint = static_cast<Point_t*>(fpBrPoints->Get(link)); // Get point position and time - auto posIn = TVector3 {}; - auto posOut = TVector3 {}; + auto posIn = TVector3{}; + auto posOut = TVector3{}; if constexpr (ca::EDetectorID::kTof == DetID) { pPoint->Position(posIn); @@ -605,7 +616,9 @@ namespace cbm::ca auto* pPoint = static_cast<Point_t*>(fpBrPoints->Get(fileId, eventId, iP)); int iSt = fpDetInterface->GetTrackingStationIndex(pPoint->GetDetectorID()); const auto& setting = fvStationPars[iSt]; - if (setting.fMode != 2) { continue; } + if (setting.fMode != 2) { + continue; + } double du = setting.fDu; double dv = setting.fDv; double dt = setting.fDt; @@ -615,8 +628,8 @@ namespace cbm::ca auto [dx2, dxy, dy2] = conv.ConvertCovMatrixUVtoXY(du * du, 0., dv * dv); // Get point position and time - auto posIn = TVector3 {}; - auto posOut = TVector3 {}; + auto posIn = TVector3{}; + auto posOut = TVector3{}; if constexpr (ca::EDetectorID::kTof == DetID) { pPoint->Position(posIn); @@ -644,10 +657,12 @@ namespace cbm::ca pos.SetX(x); pos.SetY(y); pos.SetZ(z); - auto dpos = TVector3 {std::sqrt(dx2), std::sqrt(dy2), dz}; + auto dpos = TVector3{std::sqrt(dx2), std::sqrt(dy2), dz}; // Push back a new artificial hit - if constexpr (ca::EDetectorID::kMvd == DetID) { new ((*fpBrHits)[fHitCounter]) CbmMvdHit(); } + if constexpr (ca::EDetectorID::kMvd == DetID) { + new ((*fpBrHits)[fHitCounter]) CbmMvdHit(); + } else { auto address = pPoint->GetDetectorID(); if constexpr (ca::EDetectorID::kSts == DetID) { @@ -702,7 +717,9 @@ namespace cbm::ca double tEnd = event->GetEndTime(); for (UInt_t iH = 0; iH < vHitMcEventTime.size(); iH++) { double t = vHitMcEventTime[iH]; - if ((t >= tStart && t <= tEnd) || tStart < 0 || tEnd < 0) { event->AddData(fHitDataType, iH); } + if ((t >= tStart && t <= tEnd) || tStart < 0 || tEnd < 0) { + event->AddData(fHitDataType, iH); + } } } } diff --git a/reco/detectors/trd/qa/CbmTrdCalibTracker.cxx b/reco/detectors/trd/qa/CbmTrdCalibTracker.cxx index 29e016768ab90b67266a6e662289b86d96ee53b8..259a0fe8f5a38bfab804352b2f1a63b7441d9c52 100644 --- a/reco/detectors/trd/qa/CbmTrdCalibTracker.cxx +++ b/reco/detectors/trd/qa/CbmTrdCalibTracker.cxx @@ -135,10 +135,14 @@ void CbmTrdCalibTracker::SetParContainers() // Get run and runtime database FairRunAna* ana = FairRunAna::Instance(); - if (!ana) { LOG(fatal) << "No FairRunAna instance"; } + if (!ana) { + LOG(fatal) << "No FairRunAna instance"; + } FairRuntimeDb* rtdb = ana->GetRuntimeDb(); - if (!rtdb) { LOG(fatal) << "No FairRuntimeDb instance"; } + if (!rtdb) { + LOG(fatal) << "No FairRuntimeDb instance"; + } fTrdDigiPar = dynamic_cast<CbmTrdParSetDigi*>(rtdb->getContainer("CbmTrdParSetDigi")); fTrdGeoPar = dynamic_cast<CbmTrdParSetGeo*>(rtdb->getContainer("CbmTrdParSetGeo")); @@ -263,7 +267,9 @@ InitStatus CbmTrdCalibTracker::ReInit() TObjArray* layers = topNode->GetNodes(); for (Int_t iLayer = 0; iLayer < layers->GetEntriesFast(); iLayer++) { TGeoNode* layer = static_cast<TGeoNode*>(layers->At(iLayer)); - if (TString(layer->GetName()).Contains("layer")) { layerCounter++; } + if (TString(layer->GetName()).Contains("layer")) { + layerCounter++; + } } } } @@ -374,7 +380,9 @@ InitStatus CbmTrdCalibTracker::ReInit() // ------------------------------------------------------------------------- void CbmTrdCalibTracker::Exec(Option_t*) { - if (!fIsTrdInSetup) { return; } + if (!fIsTrdInSetup) { + return; + } // update number of processed events fNevents.SetVal(fNevents.GetVal() + 1); @@ -387,7 +395,9 @@ void CbmTrdCalibTracker::Exec(Option_t*) void CbmTrdCalibTracker::Finish() { FairSink* sink = FairRootManager::Instance()->GetSink(); - if (sink) { sink->WriteObject(&GetQa(), nullptr); } + if (sink) { + sink->WriteObject(&GetQa(), nullptr); + } } @@ -546,7 +556,9 @@ void CbmTrdCalibTracker::ResolutionQa() } hmc->PurgeSignals(); - if (myHitMatch.GetNofLinks() == 0) { continue; } + if (myHitMatch.GetNofLinks() == 0) { + continue; + } const CbmLink& bestLink = myHitMatch.GetMatchedLink();