From 51eb07f367dab4ff54b4d0d8a5ba5347263fb699 Mon Sep 17 00:00:00 2001 From: "se.gorbunov" <se.gorbunov@gsi.de> Date: Fri, 20 Sep 2024 11:59:52 +0200 Subject: [PATCH] cleanup; remove unused code --- algo/ca/core/CMakeLists.txt | 3 +- .../conversion/CbmAnaConversion.cxx | 1 - .../conversion/CbmAnaConversionPhotons.cxx | 1 - .../conversion/CbmAnaConversionPhotons2.cxx | 1 - analysis/PWGDIL/dielectron/lmvm/LmvmTask.cxx | 2 - analysis/PWGDIL/dielectron/lmvm/LmvmTask.h | 2 - .../papaframework/PairAnalysisVarManager.cxx | 24 - .../papaframework/PairAnalysisVarManager.h | 21 - reco/KF/CbmKFTrackInterface.cxx | 1 - reco/KF/CbmKFUMeasurement.cxx | 72 -- reco/KF/CbmKFUMeasurement.h | 42 - reco/KF/KF.cmake | 6 - reco/KF/KFLinkDef.h | 1 - reco/L1/CMakeLists.txt | 8 +- reco/L1/L1Algo/inactive/L1Array.h | 180 ---- reco/L1/L1Algo/inactive/L1Assert.h | 63 -- reco/L1/L1Algo/inactive/L1Event.cxx | 16 - reco/L1/L1Algo/inactive/L1Event.h | 55 -- reco/L1/L1Algo/inactive/L1EventEfficiencies.h | 118 --- reco/L1/L1Algo/inactive/L1EventMatch.cxx | 11 - reco/L1/L1Algo/inactive/L1EventMatch.h | 38 - reco/L1/L1Algo/inactive/L1MCEvent.cxx | 23 - reco/L1/L1Algo/inactive/L1MCEvent.h | 37 - reco/L1/L1Algo/utils/L1AlgoDraw.cxx | 846 ------------------ reco/L1/L1Algo/utils/L1AlgoDraw.h | 98 -- .../utils/L1AlgoEfficiencyPerformance.cxx | 8 - .../utils/L1AlgoEfficiencyPerformance.h | 399 --------- reco/L1/L1Algo/utils/L1AlgoPulls.cxx | 268 ------ reco/L1/L1Algo/utils/L1AlgoPulls.h | 128 --- reco/littrack/cbm/qa/tof/CbmLitTofQa.cxx | 4 - reco/littrack/cbm/qa/tof/CbmLitTofQa.h | 4 +- 31 files changed, 4 insertions(+), 2477 deletions(-) delete mode 100644 reco/KF/CbmKFUMeasurement.cxx delete mode 100644 reco/KF/CbmKFUMeasurement.h delete mode 100644 reco/L1/L1Algo/inactive/L1Array.h delete mode 100644 reco/L1/L1Algo/inactive/L1Assert.h delete mode 100644 reco/L1/L1Algo/inactive/L1Event.cxx delete mode 100644 reco/L1/L1Algo/inactive/L1Event.h delete mode 100644 reco/L1/L1Algo/inactive/L1EventEfficiencies.h delete mode 100644 reco/L1/L1Algo/inactive/L1EventMatch.cxx delete mode 100644 reco/L1/L1Algo/inactive/L1EventMatch.h delete mode 100644 reco/L1/L1Algo/inactive/L1MCEvent.cxx delete mode 100644 reco/L1/L1Algo/inactive/L1MCEvent.h delete mode 100644 reco/L1/L1Algo/utils/L1AlgoDraw.cxx delete mode 100644 reco/L1/L1Algo/utils/L1AlgoDraw.h delete mode 100644 reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.cxx delete mode 100644 reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h delete mode 100644 reco/L1/L1Algo/utils/L1AlgoPulls.cxx delete mode 100644 reco/L1/L1Algo/utils/L1AlgoPulls.h diff --git a/algo/ca/core/CMakeLists.txt b/algo/ca/core/CMakeLists.txt index 513e813840..d17ca0aa87 100644 --- a/algo/ca/core/CMakeLists.txt +++ b/algo/ca/core/CMakeLists.txt @@ -116,7 +116,8 @@ install( tracking/CaTrackFinderWindow.h tracking/CaTrackFitter.h tracking/CaTripletConstructor.h - DESTINATION + + DESTINATION include/ ) diff --git a/analysis/PWGDIL/dielectron/conversion/CbmAnaConversion.cxx b/analysis/PWGDIL/dielectron/conversion/CbmAnaConversion.cxx index 716e04fd60..6670b69154 100644 --- a/analysis/PWGDIL/dielectron/conversion/CbmAnaConversion.cxx +++ b/analysis/PWGDIL/dielectron/conversion/CbmAnaConversion.cxx @@ -23,7 +23,6 @@ #include "CbmRichHit.h" #include "CbmRichPoint.h" #include "CbmRichRing.h" -#include "CbmStsKFTrackFitter.h" #include "CbmStsTrack.h" #include "CbmTrackMatchNew.h" #include "CbmUtils.h" diff --git a/analysis/PWGDIL/dielectron/conversion/CbmAnaConversionPhotons.cxx b/analysis/PWGDIL/dielectron/conversion/CbmAnaConversionPhotons.cxx index 075e1214e2..f838101932 100644 --- a/analysis/PWGDIL/dielectron/conversion/CbmAnaConversionPhotons.cxx +++ b/analysis/PWGDIL/dielectron/conversion/CbmAnaConversionPhotons.cxx @@ -23,7 +23,6 @@ #include "FairRootManager.h" #include <Logger.h> -//#include "CbmStsKFTrackFitter.h" #include "CbmAnaConversionCutSettings.h" #include "CbmLitGlobalElectronId.h" diff --git a/analysis/PWGDIL/dielectron/conversion/CbmAnaConversionPhotons2.cxx b/analysis/PWGDIL/dielectron/conversion/CbmAnaConversionPhotons2.cxx index 57da175329..acf0aad0f9 100644 --- a/analysis/PWGDIL/dielectron/conversion/CbmAnaConversionPhotons2.cxx +++ b/analysis/PWGDIL/dielectron/conversion/CbmAnaConversionPhotons2.cxx @@ -26,7 +26,6 @@ #include "FairRootManager.h" #include <Logger.h> -//#include "CbmStsKFTrackFitter.h" #include "CbmAnaConversionCutSettings.h" #include "CbmAnaConversionKinematicParams.h" #include "CbmLitGlobalElectronId.h" diff --git a/analysis/PWGDIL/dielectron/lmvm/LmvmTask.cxx b/analysis/PWGDIL/dielectron/lmvm/LmvmTask.cxx index 54086def80..a2cffce541 100755 --- a/analysis/PWGDIL/dielectron/lmvm/LmvmTask.cxx +++ b/analysis/PWGDIL/dielectron/lmvm/LmvmTask.cxx @@ -15,7 +15,6 @@ #include "CbmRichRing.h" #include "CbmRichUtil.h" #include "CbmStsHit.h" -#include "CbmStsKFTrackFitter.h" #include "CbmStsTrack.h" #include "CbmTofHit.h" #include "CbmTofPoint.h" @@ -300,7 +299,6 @@ InitStatus LmvmTask::Init() InitHists(); - fKFFitter.Init(); CbmLitMCTrackCreator::Instance(); CbmLitGlobalElectronId::GetInstance(); diff --git a/analysis/PWGDIL/dielectron/lmvm/LmvmTask.h b/analysis/PWGDIL/dielectron/lmvm/LmvmTask.h index 263594b095..b21e82d426 100755 --- a/analysis/PWGDIL/dielectron/lmvm/LmvmTask.h +++ b/analysis/PWGDIL/dielectron/lmvm/LmvmTask.h @@ -7,7 +7,6 @@ #include "CbmGlobalTrack.h" #include "CbmKFVertex.h" -#include "CbmStsKFTrackFitter.h" #include "FairMCEventHeader.h" #include "FairRootManager.h" @@ -193,7 +192,6 @@ private: TClonesArray* fTofTracks = nullptr; CbmVertex* fPrimVertex = nullptr; CbmKFVertex fKFVertex; - CbmStsKFTrackFitter fKFFitter; bool fUseMvd = false; diff --git a/analysis/PWGDIL/dielectron/papaframework/PairAnalysisVarManager.cxx b/analysis/PWGDIL/dielectron/papaframework/PairAnalysisVarManager.cxx index 4025c98f50..d6c6288168 100644 --- a/analysis/PWGDIL/dielectron/papaframework/PairAnalysisVarManager.cxx +++ b/analysis/PWGDIL/dielectron/papaframework/PairAnalysisVarManager.cxx @@ -336,8 +336,6 @@ ClassImp(PairAnalysisVarManager) PairAnalysisEvent* PairAnalysisVarManager::fgEvent = 0x0; CbmKFVertex* PairAnalysisVarManager::fgKFVertex = 0x0; CbmVertex* PairAnalysisVarManager::fgVertexMC = 0x0; -//CbmStsKFTrackFitter* PairAnalysisVarManager::fgKFFitter = 0x0; -//CbmL1PFFitter* PairAnalysisVarManager::fgL1Fitter = 0x0; TBits* PairAnalysisVarManager::fgFillMap = 0x0; Int_t PairAnalysisVarManager::fgCurrentRun = -1; Double_t PairAnalysisVarManager::fgData[PairAnalysisVarManager::kNMaxValuesMC] = {0.}; @@ -409,25 +407,3 @@ UInt_t PairAnalysisVarManager::GetValueTypeMC(UInt_t var) return GetValueType(valname); } -/* -Double_t PairAnalysisVarManager::GetChiToVertex(const CbmStsTrack *track, CbmVertex *vertex) -{ - // - // Get vertex chi/ndf between ststrack and vertex - // - - // KFFitter - return fgKFFitter->GetChiToVertex(track,vertex); - - // L1PFFitter - vector<CbmStsTrack> stsTracks; - stsTracks.resize(1); - stsTracks[0] = *track; - vector<L1FieldRegion> vField; - vector<float> chiPrim; - fgL1Fitter->GetChiToVertex(stsTracks, vField, chiPrim, fgKFVertex, 3.e+6); - printf("L1fitter: %f\n", chiPrim[0]); - return chiPrim[0]; - -} -*/ diff --git a/analysis/PWGDIL/dielectron/papaframework/PairAnalysisVarManager.h b/analysis/PWGDIL/dielectron/papaframework/PairAnalysisVarManager.h index 521dc40754..3cf9555f8c 100644 --- a/analysis/PWGDIL/dielectron/papaframework/PairAnalysisVarManager.h +++ b/analysis/PWGDIL/dielectron/papaframework/PairAnalysisVarManager.h @@ -50,11 +50,6 @@ #include <TVector2.h> #include <TVector3.h> - -//#include "L1Field.h" -//#include "CbmL1PFFitter.h" -//#include <CbmStsKFTrackFitter.h> - #include "PairAnalysisEvent.h" #include "PairAnalysisHelper.h" #include "PairAnalysisMC.h" @@ -379,7 +374,6 @@ public: virtual ~PairAnalysisVarManager(); static void InitFormulas(); - static void InitFitter(); static void Fill(const TObject* particle, Double_t* const values); static void FillVarMCParticle(const CbmMCTrack* p1, const CbmMCTrack* p2, Double_t* const values); @@ -422,8 +416,6 @@ private: static PairAnalysisEvent* fgEvent; // current event pointer static CbmKFVertex* fgKFVertex; // kf vertex @TODO: OBSOLETE/UNUSED? static CbmVertex* fgVertexMC; // MC vertex - // static CbmStsKFTrackFitter*fgKFFitter; // kf fitter - // static CbmL1PFFitter *fgL1Fitter; // L1 fitter static TBits* fgFillMap; // map for filling variables static Int_t fgCurrentRun; // current run number @@ -453,10 +445,6 @@ private: static void FillSumVarMCPoint(const FairMCPoint* hit, Double_t* const values); static void FillVarMCHeader(const FairMCEventHeader* header, Double_t* const values); - // static Double_t GetChiToVertex( const CbmStsTrack *track, CbmVertex *vertex); - - // static void FillVarKFParticle(const AliKFParticle *pair, Double_t * const values); - // setter static void ResetArrayData(Int_t to, Double_t* const values); static void ResetArrayDataMC(Int_t to, Double_t* const values); @@ -2188,13 +2176,4 @@ inline void PairAnalysisVarManager::InitFormulas() } } -inline void PairAnalysisVarManager::InitFitter() -{ - /* if(!fgKFFitter) { */ - /* fgKFFitter = new CbmStsKFTrackFitter(); */ - /* fgKFFitter->Init(); */ - /* } */ - // if(!fgL1Fitter) fgL1Fitter = new CbmL1PFFitter(); -} - #endif diff --git a/reco/KF/CbmKFTrackInterface.cxx b/reco/KF/CbmKFTrackInterface.cxx index d4103d073d..f1d7d455dd 100644 --- a/reco/KF/CbmKFTrackInterface.cxx +++ b/reco/KF/CbmKFTrackInterface.cxx @@ -19,7 +19,6 @@ #include "CbmKFTrackInterface.h" #include "CbmKF.h" -#include "CbmKFFieldMath.h" #include "CbmKFHit.h" #include "CbmKFMath.h" #include "CbmKFVertexInterface.h" diff --git a/reco/KF/CbmKFUMeasurement.cxx b/reco/KF/CbmKFUMeasurement.cxx deleted file mode 100644 index f212161d24..0000000000 --- a/reco/KF/CbmKFUMeasurement.cxx +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright (C) 2006-2010 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Denis Bertini [committer], Sergey Gorbunov, Maksym Zyzak */ - -#include "CbmKFUMeasurement.h" - -#include <cmath> - -using std::isfinite; - -ClassImp(CbmKFUMeasurement) - - void CbmKFUMeasurement::Set(Double_t z_, Double_t u_, Double_t phi_, Double_t sigma2_) -{ - this->z = z_; - this->u = u_; - this->phi = phi_; - this->sigma2 = sigma2_; - phi_s = sin(phi_); - phi_c = cos(phi_); - phi_ss = phi_s * phi_s; - phi_cc = phi_c * phi_c; - phi_2sc = 2. * phi_s * phi_c; -} - -Int_t CbmKFUMeasurement::Filter(CbmKFTrackInterface& track) -{ - - Double_t* T = track.GetTrack(); - Double_t* C = track.GetCovMatrix(); - - Double_t W = sigma2 + phi_cc * C[0] + phi_2sc * C[1] + phi_ss * C[2]; - if (!isfinite(W) || W < 1.e-10) { - return 1; - } - W = 1. / W; - if (!isfinite(W)) { - return 1; - } - - Double_t zeta = phi_c * T[0] + phi_s * T[1] - u; - - track.GetRefChi2() += zeta * zeta * W; - track.GetRefNDF() += 1; - Double_t K[5] = {phi_c * C[0] + phi_s * C[1], phi_c * C[1] + phi_s * C[2], phi_c * C[3] + phi_s * C[4], - phi_c * C[6] + phi_s * C[7], phi_c * C[10] + phi_s * C[11]}; - - Double_t KW[5] = {K[0] * W, K[1] * W, K[2] * W, K[3] * W, K[4] * W}; - - T[0] -= KW[0] * zeta; - T[1] -= KW[1] * zeta; - T[2] -= KW[2] * zeta; - T[3] -= KW[3] * zeta; - T[4] -= KW[4] * zeta; - - C[0] -= K[0] * KW[0]; - C[1] -= K[1] * KW[0]; - C[2] -= K[1] * KW[1]; - C[3] -= K[2] * KW[0]; - C[4] -= K[2] * KW[1]; - C[5] -= K[2] * KW[2]; - C[6] -= K[3] * KW[0]; - C[7] -= K[3] * KW[1]; - C[8] -= K[3] * KW[2]; - C[9] -= K[3] * KW[3]; - C[10] -= K[4] * KW[0]; - C[11] -= K[4] * KW[1]; - C[12] -= K[4] * KW[2]; - C[13] -= K[4] * KW[3]; - C[14] -= K[4] * KW[4]; - return 0; -} diff --git a/reco/KF/CbmKFUMeasurement.h b/reco/KF/CbmKFUMeasurement.h deleted file mode 100644 index 57fe56c244..0000000000 --- a/reco/KF/CbmKFUMeasurement.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 2006-2012 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Sergey Gorbunov, Denis Bertini [committer], Igor Kulakov */ - -/** Class for 1-D measurement calculations for CbmKFHit hits - * - * @author S.Gorbunov - * @version 0.0 - * @since 02.12.05 - * - * Description will be here - * - */ - -#ifndef CBMKFMEASUREMENT_H -#define CBMKFMEASUREMENT_H 1 - -#include "CbmKFTrackInterface.h" - -class CbmKFUMeasurement : public TObject { - public: - CbmKFUMeasurement() : z(), u(), sigma2(), phi(), phi_s(), phi_c(), phi_ss(), phi_cc(), phi_2sc() {} - ~CbmKFUMeasurement() {} - - Double_t z; - Double_t u; - Double_t sigma2; - Double_t phi; - - void Set(Double_t z, Double_t u, Double_t phi, Double_t sigma2); - Int_t Filter(CbmKFTrackInterface& track); - - Double_t phi_s; - Double_t phi_c; - Double_t phi_ss; - Double_t phi_cc; - Double_t phi_2sc; - - ClassDef(CbmKFUMeasurement, 1) -}; - -#endif /* !CBMKFUMEASUREMENT_H */ diff --git a/reco/KF/KF.cmake b/reco/KF/KF.cmake index 6f17ea7e68..f07853a032 100644 --- a/reco/KF/KF.cmake +++ b/reco/KF/KF.cmake @@ -17,7 +17,6 @@ set(SRCS CbmKFPixelMeasurement.cxx CbmKFPrimaryVertexFinder.cxx CbmKFTrackInterface.cxx - CbmKFUMeasurement.cxx CbmKFVertexInterface.cxx CbmKfTrackFitter.cxx CbmKfFitTracksTask.cxx @@ -28,11 +27,6 @@ set(SRCS Interface/CbmPVFinderKF.cxx Interface/CbmPVFinderKFGlobal.cxx Interface/CbmStsKFTrackFitter.cxx - # CbmKFParticleInterface.cxx - #CbmKFParticleFinder.cxx - #CbmKFParticleFinderPID.cxx - #CbmKFParticleFinderQa.cxx - #CbmKFParticleInterface.cxx ParticleFitter/CbmL1PFFitter.cxx ) diff --git a/reco/KF/KFLinkDef.h b/reco/KF/KFLinkDef.h index 9e60f8c556..3e05ec2fe7 100644 --- a/reco/KF/KFLinkDef.h +++ b/reco/KF/KFLinkDef.h @@ -14,7 +14,6 @@ #pragma link C++ class CbmKFFieldMath + ; #pragma link C++ class CbmKFHit + ; #pragma link C++ class CbmKFStsHit + ; -#pragma link C++ class CbmKFUMeasurement + ; #pragma link C++ class CbmKFPixelMeasurement + ; #pragma link C++ class CbmKFTrackInterface + ; #pragma link C++ class CbmKFVertexInterface + ; diff --git a/reco/L1/CMakeLists.txt b/reco/L1/CMakeLists.txt index 9b02fa975f..1eb1b6f2e0 100644 --- a/reco/L1/CMakeLists.txt +++ b/reco/L1/CMakeLists.txt @@ -38,9 +38,6 @@ set(SRCS CbmL1MCTrack.cxx CbmL1Track.cxx - L1Algo/utils/L1AlgoDraw.cxx - L1Algo/utils/L1AlgoEfficiencyPerformance.cxx - L1Algo/utils/L1AlgoPulls.cxx L1Algo/utils/CaUvConverter.cxx L1Algo/utils/CaAlgoRandom.cxx @@ -69,9 +66,6 @@ set(SRCS ) set(NO_DICT_SRCS - L1Algo/inactive/L1Event.cxx - L1Algo/inactive/L1MCEvent.cxx - L1Algo/inactive/L1EventMatch.cxx ) set(HEADERS @@ -88,7 +82,7 @@ set(HEADERS catools/CaToolsLinkKey.h catools/CaToolsHitRecord.h catools/CaToolsDef.h - #utils/CbmCaIdealHitProducer.h + utils/CbmCaIdealHitProducer.h catools/CaToolsMaterialHelper.h catools/CaToolsField.h qa/CbmCaInputQaBase.h diff --git a/reco/L1/L1Algo/inactive/L1Array.h b/reco/L1/L1Algo/inactive/L1Array.h deleted file mode 100644 index 2e1f3c75d4..0000000000 --- a/reco/L1/L1Algo/inactive/L1Array.h +++ /dev/null @@ -1,180 +0,0 @@ -/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Sergey Gorbunov, Sergei Zharko [committer] */ - -#ifndef L1Array_h -#define L1Array_h 1 - -#include "L1Assert.h" - -#include <Logger.h> - -#include <array> -#include <string> -#include <utility> - -/// 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) - -// TODO: What is better to be used here - std::size or int. Needs to be tested (S.Zharko) - -using namespace cbm::algo::ca; //TODO: remove - -template<class Tvalue, std::size_t MaxCapacity> -class L1Array : private std::array<Tvalue, MaxCapacity> { - public: - // Type definitions - using Tbase = std::array<Tvalue, MaxCapacity>; - using Tsize = typename Tbase::size_type; - using Tpointer = typename Tbase::pointer; - using Tcpointer = typename Tbase::const_pointer; - using Treference = typename Tbase::reference; - using Tcreference = typename Tbase::const_reference; - using Titerator = typename Tbase::iterator; - using Tciterator = typename Tbase::const_iterator; - using Tdifference = typename Tbase::difference_type; - using Triterator = typename Tbase::reverse_iterator; - using Tcriterator = typename Tbase::const_reverse_iterator; - using TarrayTraits = typename _GLIBCXX_STD_C::__array_traits<Tvalue, MaxCapacity>; - - template<typename... Tinput> - L1Array(Tinput... value) : Tbase(value...) - { - } - - template<typename... Tinput> - L1Array(int size, const char* name, Tinput... value) : Tbase(value...) - , fSize(static_cast<Tsize>(size)) - , fName(name) - { - } - - // TODO: Probably, there is a way to do this better... (S.Zharko) - L1Array(const char* name, std::initializer_list<Tvalue> init) : Tbase(), fName(name) - { -#ifndef FAST_CODE - if _GLIBCXX17_CONSTEXPR (L1Assert::kAssertionLevel >= 2 && Tbase::max_size() < init.size()) { - LOG(fatal) << '\n' - << " ***** Level 2 assertion failed: " << '\n' - << " ***** message: in L1Array with the name " << fName << ": the size of the initializer list (" - << init.size() << ") is larger then the maximum size of the array (" << Tbase::max_size() << ')'; - } -#endif // FAST_CODE - fSize = init.size(); - for (auto idx = 0; idx < fSize; ++idx) { - operator[](idx) = *(init.begin() + idx); - } - } - - L1Array(std::initializer_list<Tvalue> init) : L1Array("no name", init) {} - - /// Swap function - //friend void swap(L1Array<T, N>& lhs, L1Array<T, N>& rhs) - //{ - // std::swap(static_cast<Tbase&>(lhs), static_cast<Tbase&>(rhs)); - // std::swap(lhs.fName, rhs.fName); - // std::swap(lhs.fSize, rhs.fSize); - //} - - /// Gets name of the array - std::string GetName() const - { - std::string str = " L1Array<"; - str += fName + "> "; - return str; - } - - - /// Sets name of array from stringstream - void SetName(const std::basic_ostream<char>& name) { fName = dynamic_cast<const std::stringstream&>(name).str(); } - - /// Sets name of array from std::string parameters - void SetName(const std::string& name) { fName = name; } - - // - // BASE METHODS - // - // Element access - - Treference operator[](Tsize pos) noexcept - { -#ifndef FAST_CODE - if _GLIBCXX17_CONSTEXPR (L1Assert::kAssertionLevel >= 3 && pos >= fSize) { - LOG(fatal) << '\n' - << " ***** Level 3 assertion failed: " << '\n' - << " ***** message: in L1Array with the name " << fName << ": index out of range (pos = " << pos - << " >= size = " << fSize << ")"; - } - // TODO: do we need a simple assertion here to prevent the index out of range? (S.Zharko) -#endif // FAST_CODE - return Tbase::operator[](pos); - } - - Tcreference operator[](Tsize pos) const noexcept - { -#ifndef FAST_CODE - if _GLIBCXX17_CONSTEXPR (L1Assert::kAssertionLevel >= 3 && pos >= fSize) { - LOG(fatal) << '\n' - << " ***** Level 3 assertion failed: " << '\n' - << " ***** message: in L1Array with the name " << fName << ": index out of range (pos = " << pos - << " >= size = " << fSize << ")"; - } - // TODO: do we need a simple assertion here to prevent the index out of range? (S.Zharko) -#endif // FAST_CODE - return Tbase::operator[](pos); - } - - using Tbase::front; - - _GLIBCXX17_CONSTEXPR Treference back() noexcept { return fSize ? *(end() - 1) : *end(); } - - constexpr Tcreference back() const noexcept { return fSize ? *(end() - 1) : *end(); } - - using Tbase::data; - // Iterators - using Tbase::begin; - //using Tbase::end; - - // NOTE: _GLIBCXX17_CONSTEXPR is used in a base class and places constexpr for c++17+ and nothing instead - _GLIBCXX17_CONSTEXPR Titerator end() noexcept { return Titerator(data() + fSize); } - - _GLIBCXX17_CONSTEXPR Tciterator end() const noexcept { return Tciterator(data() + fSize); } - - _GLIBCXX17_CONSTEXPR Triterator rbegin() noexcept { return Triterator(end()); } - - _GLIBCXX17_CONSTEXPR Tcriterator rbegin() const noexcept { return Tcriterator(end()); } - - using Tbase::cbegin; - using Tbase::rend; - - _GLIBCXX17_CONSTEXPR Tciterator cend() const noexcept { return Tciterator(data() + fSize); } - - _GLIBCXX17_CONSTEXPR Tcriterator crbegin() const noexcept { return Tcriterator(end()); } - - using Tbase::crend; - - // Capasity - constexpr Tsize size() const noexcept { return fSize; } - - using Tbase::max_size; - constexpr bool empty(); - - // Operations - void fill(const Tvalue& val) { std::fill_n(begin(), size(), val); } - - void swap(L1Array& other) noexcept(TarrayTraits::_Is_nothrow_swappable::value) - { - std::swap(fName, other.fName); - std::swap(fSize, other.fSize); - std::swap_ranges(begin(), end(), other.begin()); - } - - private: - using Tbase::at; - - Tsize fSize{0}; - std::string fName{"no name"}; -}; - - -#endif // L1Array_h diff --git a/reco/L1/L1Algo/inactive/L1Assert.h b/reco/L1/L1Algo/inactive/L1Assert.h deleted file mode 100644 index b49f67afbe..0000000000 --- a/reco/L1/L1Algo/inactive/L1Assert.h +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Sergey Gorbunov, Sergei Zharko [committer] */ - -/// @file L1Assert.h -/// @author Sergei Zharko -/// @date 22.02.2022 -/// @brief Level-defined assertion functionality -/// -/// This file provides level-dependent assertion mechanism. Two defined macros L1ASSERT(LEVEL, COND) -/// and L1MASSERT(LEVEL, COND, MSG), which will do the assertion for LEVEL >= L1Assert::kAssertionLevel -/// and skip it otherwise. When L1ASSERT(LEVEL, COND) is called the COND expression is printed on the screen. -/// When L1MASSERT(LEVEL, COND, MSG) is called, the MSG will be printed instead of expression -/// -/// Assertion levels: -/// - 0: non-critical code (any kind of algorithm initialization checks, code, which is called once) -/// - 1: semi-critical code (may be called inside the L1 core, but a small number of times) -/// - 2: critical code (possibly called in large loops inside the algorithm) - -#ifndef L1Assert_h -#define L1Assert_h 1 - -#include "Logger.h" - -using namespace cbm::algo::ca; //TODO: remove - -#if defined(NDEBUG) || defined(L1_NO_ASSERT) // TODO: Do we need to add FAST_CODE here? (S.Zharko) -#define L1ASSERT(LEVEL, COND) -#define L1MASSERT(LEVEL, COND, MSG) -#else -#define L1ASSERT(LEVEL, COND) \ - L1Assert::DoAssertion<(LEVEL) <= L1Assert::kAssertionLevel>((LEVEL), (COND), (#COND), __FILE__, __LINE__) -#define L1MASSERT(LEVEL, COND, MSG) \ - L1Assert::DoAssertion<(LEVEL) <= L1Assert::kAssertionLevel>((LEVEL), (COND), (MSG), __FILE__, __LINE__) -#endif // defined(NDEBUG) || defined(L1_NO_ASSERT) - -namespace L1Assert -{ - constexpr int kAssertionLevel{3}; - - /// Basic template function. Usage: place "level <= L1Assert::kAssertionLevel" as a template parameter - template<bool IsAsserted> - void DoAssertion(int level, bool condition, const char* msg, const char* fileName, int lineNo) - { - if (!condition) { - LOG(fatal) << '\n' - << " ***** Level " << level << " assertion failed: " << '\n' - << " ***** message/condition : " << msg << '\n' - << " ***** file: " << fileName << '\n' - << " ***** line: " << lineNo; - std::abort(); // keep it here, because sometimes LOG(fatal) does not work (for example, in your unit testes) - } - } - - /// Specialization in case of IsAsserted = false, i.e. the assertion is not made - template<> - inline __attribute__((always_inline)) void DoAssertion<false>(int /*level*/, bool /*condition*/, const char* /*msg*/, - const char* /*fileName*/, int /*lineNo*/) - { - } -}; // namespace L1Assert - -#endif // L1Assert_h diff --git a/reco/L1/L1Algo/inactive/L1Event.cxx b/reco/L1/L1Algo/inactive/L1Event.cxx deleted file mode 100644 index 88e6ed56be..0000000000 --- a/reco/L1/L1Algo/inactive/L1Event.cxx +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Maksym Zyzak [committer] */ - -#include "L1Event.h" - -void L1Event::Clear() { fHit.clear(); } - -void L1Event::TopoReconstructor() -{ - - fTopoReconstructor.Init(fKFPTrack, fKFPTrack); - fTopoReconstructor.ReconstructPrimVertex(); - fTopoReconstructor.SortTracks(); - fTopoReconstructor.ReconstructParticles(); -} diff --git a/reco/L1/L1Algo/inactive/L1Event.h b/reco/L1/L1Algo/inactive/L1Event.h deleted file mode 100644 index a3a2e21d1a..0000000000 --- a/reco/L1/L1Algo/inactive/L1Event.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (C) 2017-2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Valentina Akishina [committer] */ - -#ifndef L1Event_H -#define L1Event_H - -#include "CbmL1Track.h" -#include "KFPTrackVector.h" -#include "KFParticleTopoReconstructor.h" -#include "KFTopoPerformance.h" - -#include <vector> - -using std::vector; - -class L1Event { - public: - L1Event() : fTopoReconstructor(), fKFPTrack(), fHit(0){}; - - void Clear(); - void TopoReconstructor(); - - const KFPTrackVector& getTracks() const { return fKFPTrack; } - KFPTrackVector& getTracks() { return fKFPTrack; } - const vector<int>& getHits() const { return fHit; } - vector<int>& getHits() { return fHit; } - const KFParticleTopoReconstructor* getTopoReconstructor() const { return &fTopoReconstructor; } - - L1Event(const L1Event& event) - : fTopoReconstructor(event.fTopoReconstructor) - , fKFPTrack(event.fKFPTrack) - , fHit(event.fHit) - { - fKFPTrack = event.fKFPTrack; - fHit = event.fHit; - } - - L1Event& operator=(const L1Event& event) - { - fTopoReconstructor = event.fTopoReconstructor; - fKFPTrack = event.fKFPTrack; - fHit = event.fHit; - - return *this; - } - - private: - KFParticleTopoReconstructor fTopoReconstructor; - - KFPTrackVector fKFPTrack; - vector<int> fHit; -}; - -#endif diff --git a/reco/L1/L1Algo/inactive/L1EventEfficiencies.h b/reco/L1/L1Algo/inactive/L1EventEfficiencies.h deleted file mode 100644 index 8079858d0b..0000000000 --- a/reco/L1/L1Algo/inactive/L1EventEfficiencies.h +++ /dev/null @@ -1,118 +0,0 @@ -/* Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Maksym Zyzak [committer] */ - -#include "CbmL1Counters.h" - -#include <cstring> -#include <iostream> -#include <sstream> - -class L1EventEfficiencies { - public: - L1EventEfficiencies() - : names() - , indices() - , ratio_reco() - , ratio_ghosts(0) - , mc() - , reco() - , ghosts(0) - , nEvents(0) - , ratio_clone() - , clone() - { - AddCounter("reconstructable", "Reconstructable tracks "); - AddCounter("reconstructed", "Reconstructed tracks "); - } - - ~L1EventEfficiencies(){}; - - void AddCounter(std::string shortname, std::string name) - { - indices[shortname] = names.size(); - names.push_back(name); - - ratio_reco.AddCounter(); - mc.AddCounter(); - reco.AddCounter(); - ratio_clone.AddCounter(); - clone.AddCounter(); - } - - L1EventEfficiencies& operator+=(L1EventEfficiencies& a) - { - mc += a.mc; - reco += a.reco; - clone += a.clone; - ghosts += a.ghosts; - nEvents += a.nEvents; - return *this; - } - - void CalcEff() - { - ratio_reco = reco / mc; - const double total = - reco.counters[indices["reconstructable"]] + ghosts + clone.counters[indices["reconstructable"]]; - if (total > 0) - ratio_ghosts = ghosts / total; - else - ratio_ghosts = -1; - ratio_clone = clone / mc; - } - - - void Inc(bool isReco, int _nclones, std::string name) - { - const int index = indices[name]; - mc.counters[index]++; - if (isReco) reco.counters[index]++; - clone.counters[index] += _nclones; - } - - void IncNEvents() { nEvents++; }; - - void AddGhost(int i) { ghosts += i; } - - std::string ToString() - { - std::stringstream ss; - ss.setf(std::ios::fixed); - ss.setf(std::ios::showpoint); - ss.precision(3); - ss << "Event category normalised to: " - << " Eff " - << " / " - << "Clones" - << " / " - << "All Reco" - << " | " - << "All MC \n"; - - int NCounters = mc.GetNcounters(); - for (int iC = 0; iC < NCounters; iC++) { - ss << names[iC] << " : " << ratio_reco.counters[iC] << " / " - << ratio_clone.counters[iC] // nCloneTracks/nMCTracks - << " / " << std::setw(8) << reco.counters[iC] / double(nEvents) << " | " << std::setw(8) - << mc.counters[iC] / double(nEvents) << "\n"; - } - ss << "Ghost probability : " << ratio_ghosts << " | " << ghosts << "\n"; - return ss.str(); - } - - 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 - - TL1TracksCatCounters<double> ratio_reco; - double ratio_ghosts; - - TL1TracksCatCounters<int> mc; - TL1TracksCatCounters<int> reco; - int ghosts; - int nEvents; - - TL1TracksCatCounters<double> ratio_clone; - TL1TracksCatCounters<int> clone; -}; diff --git a/reco/L1/L1Algo/inactive/L1EventMatch.cxx b/reco/L1/L1Algo/inactive/L1EventMatch.cxx deleted file mode 100644 index 9e57c874f8..0000000000 --- a/reco/L1/L1Algo/inactive/L1EventMatch.cxx +++ /dev/null @@ -1,11 +0,0 @@ -/* Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Maksym Zyzak [committer] */ - -#include "L1EventMatch.h" - -void L1EventMatch::Clear() -{ - fMCEvent.clear(); - fNTracks = 0; -} diff --git a/reco/L1/L1Algo/inactive/L1EventMatch.h b/reco/L1/L1Algo/inactive/L1EventMatch.h deleted file mode 100644 index a9723fe0b7..0000000000 --- a/reco/L1/L1Algo/inactive/L1EventMatch.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Maksym Zyzak [committer] */ - -#ifndef L1EventMatch_H -#define L1EventMatch_H - -#include "L1Event.h" -#include "L1MCEvent.h" - -#include <map> -#include <vector> - -using std::map; -using std::vector; - -class L1EventMatch { - public: - L1EventMatch() : fMCEvent(), fNTracks(0), fTracks(){}; - bool IsGhost() { return fMCEvent.size() == 0; } - void Clear(); - void AddTrack(int mcEventId) { fMCEvent[mcEventId]++; } - void SetNEventTracks(int ntracks) { fNTracks = ntracks; } - void SetTracks(vector<int> tracks) { fTracks = tracks; } - vector<int>& GetTracksId() { return fTracks; } - - int NRecoTracks() const { return fNTracks; } - int NMCEvents() const { return fMCEvent.size(); } - - map<int, int>& GetMCEvents() { return fMCEvent; } - - private: - map<int, int> fMCEvent; - int fNTracks; - vector<int> fTracks; -}; - -#endif diff --git a/reco/L1/L1Algo/inactive/L1MCEvent.cxx b/reco/L1/L1Algo/inactive/L1MCEvent.cxx deleted file mode 100644 index 98b7402b00..0000000000 --- a/reco/L1/L1Algo/inactive/L1MCEvent.cxx +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright (C) 2017-2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Maksym Zyzak [committer] */ - -#include "L1MCEvent.h" - -int L1MCEvent::IsReconstructed() -{ - if (fRecoEvents.size() > 0) - return 1; - else - return 0; -} - -int L1MCEvent::NClones() -{ - 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 deleted file mode 100644 index 75b7ff987b..0000000000 --- a/reco/L1/L1Algo/inactive/L1MCEvent.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 2017-2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Maksym Zyzak [committer] */ - -#ifndef L1MCEvent_H -#define L1MCEvent_H - -#include <vector> - -using std::vector; - -class L1MCEvent { - public: - L1MCEvent() : fMCEventId(-1), fRecoEvents(), fMCTrackId(0), fIsReconstructable(0){}; - - int IsReconstructed(); - int NClones(); - void SetReconstructable(bool IsReconstructable_) { fIsReconstructable = IsReconstructable_; } - void SetId(int mcEvId) { fMCEventId = mcEvId; } - - vector<int>& GetMCTrackIds() { return fMCTrackId; } - int NMCTracks() const { return fMCTrackId.size(); } - int& GetId() { return fMCEventId; } - bool IsReconstructable() const { return fIsReconstructable; } - - void AddRecoEvent(int iEvent) { fRecoEvents.push_back(iEvent); } - - const vector<int>& GetRecoEvents() const { return fRecoEvents; } - - private: - int fMCEventId; - vector<int> fRecoEvents; - vector<int> fMCTrackId; - bool fIsReconstructable; -}; - -#endif diff --git a/reco/L1/L1Algo/utils/L1AlgoDraw.cxx b/reco/L1/L1Algo/utils/L1AlgoDraw.cxx deleted file mode 100644 index 56e657724c..0000000000 --- a/reco/L1/L1Algo/utils/L1AlgoDraw.cxx +++ /dev/null @@ -1,846 +0,0 @@ -/* Copyright (C) 2010-2021 Frankfurt Institute for Advanced Studies, Goethe-Universität Frankfurt, Frankfurt - SPDX-License-Identifier: GPL-3.0-only - Authors: Sergey Gorbunov [committer] */ - -#include "L1AlgoDraw.h" - -#include "CaFramework.h" -#include "CaSimd.h" -#include "CbmL1.h" -#include "TApplication.h" -#include "TCanvas.h" -#include "TEllipse.h" -#include "TFrame.h" -#include "TLatex.h" -#include "TLine.h" -#include "TMarker.h" -#include "TPad.h" -#include "TPaveText.h" -#include "TPolyLine.h" -#include "TPolyLine3D.h" -#include "TPolyMarker.h" -#include "TStyle.h" -#include "TText.h" -#include "TView3D.h" - -using namespace cbm::algo::ca; - -// NOTE: using std::cout, std::endl were removed from one of the headers, and it -// caused errors. Please, don't use "using" in headers -using cbm::algo::ca::Track; -using std::cout; -using std::endl; -using std::map; -using std::vector; - -L1AlgoDraw::L1AlgoDraw() -{ - - gStyle->SetCanvasBorderMode(0); - gStyle->SetCanvasBorderSize(1); - gStyle->SetCanvasColor(0); - - YZ = new TCanvas("YZ", "YZ Side View", -1, 0, 500, 500); - YZ->Range(-5.0, -50.0, 105.0, 50.0); - YZ->Draw(); - YZ->Update(); - - XZ = new TCanvas("XZ", "XZ Top View", -1, 500, 500, 500); - XZ->Range(-5.0, -50.0, 105.0, 50.0); - XZ->Draw(); - XZ->Update(); - - YX = new TCanvas("YX", "YX Front View", -506, 0, 500, 500); - YX->Range(-50.0, -50.0, 50.0, 50.0); - YX->Draw(); - YX->Update(); - - // XYZ = new TCanvas ("XYZ", "XYZ 3D View", -0, 0, 1000, 1000); - XYZ = new TCanvas("XYZ", "XYZ 3D View", -500, 500, 500, 500); - XYZ->Range(-5.0, -50.0, 115.0, 60.0); - // TView3D *view = (TView3D*) XYZ->GetView3D(); - // view = (TView3D*) TView::CreateView(1); - // TView3D *view = new TView3D(); - // view->SetRange(-50.0, -50.0, -0.0, 50.0, 50.0, 110.0); - // view->SetRange(0,0,0,4,4,4); - // view->Draw(); - // XYZ->ResetView3D(view); - XYZ->Draw(); - XYZ->Update(); - - fVerbose = CbmL1::Instance()->fVerbose; - ask = true; -} - -void L1AlgoDraw::InitL1Draw(ca::Framework* algo_) -{ - // algo = CbmL1::Instance()->algo; - algo = algo_; - - vHits.clear(); - vHitsQa.clear(); - auto nHits = algo->GetWData()[0].Hits().size(); - vHits.reserve(nHits); - vHitsQa.reserve(nHits); - for (const auto& hit : algo->GetWData()[0].Hits()) { - vHits.push_back(hit); - int iQaHit = hit.Id(); - vHitsQa.push_back(CbmL1::Instance()->GetQaHits()[iQaHit]); - } - NStations = algo->GetParameters().GetNstationsActive(); - for (int i = 0; i < NStations; i++) { - HitsStartIndex[i] = algo->GetWData()[0].HitStartIndexOnStation(i); - HitsStopIndex[i] = HitsStartIndex[i] + algo->GetWData()[0].NofHitsOnStation(i); - vStations[i] = algo->GetParameters().GetStation(i); - } -} - -void L1AlgoDraw::DrawMCTracks() -{ - int NRegMCTracks = 0; - CbmL1& L1 = *CbmL1::Instance(); - TPolyLine pline; - if (fVerbose >= 10) { - cout << "Only reconstructable tracks are shown." << endl; - cout << "Red - primary p > 0.5 - (first iteration)" << endl; - cout << "Blue - primary p < 0.5 - (second iteration)" << endl; - cout << "Green - secondary p > 0.5 - (third\\first iteration)" << endl; - cout << "Gray - secondary p < 0.5 - (third\\second iteration)" << endl; - }; - - const auto& mcData = L1.GetMCData(); - for (const auto& mcTrk : mcData.GetTrackContainer()) { - //draw reconstructable tracks only - if (!mcTrk.IsReconstructable()) continue; - //if (( mcTrk.GetMotherId() < 0 )&&( mcTrk.GetNofConsStationsWithHit() < 3 )) continue; - //if (( mcTrk.GetMotherId()>=0 )&&( mcTrk.GetNofConsStationsWithHit() <4 )) continue; - //if( mcTrk.GetP()<.2 ) continue; - if (mcTrk.GetP() < 0.1) continue; - pline.SetLineColor(kRed); - if (mcTrk.GetP() < 0.5) pline.SetLineColor(kBlue); - if (mcTrk.GetMotherId() != -1) pline.SetLineColor(8); - if ((mcTrk.GetMotherId() != -1) && (mcTrk.GetMotherId() < 0.5)) pline.SetLineColor(12); - LOG_IF(info, fVerbose > 0) << "MC Track: p = " << mcTrk.GetP() << " mother_ID = " << mcTrk.GetMotherId() - << " PDG = " << mcTrk.GetPdgCode() << " x,y,z = (" << mcTrk.GetStartX() << ", " - << mcTrk.GetStartY() << ", " << mcTrk.GetStartZ() << ")"; - double par[6]; - par[0] = mcTrk.GetStartX(); - par[1] = mcTrk.GetStartY(); - //if( fabs(mcTrk.GetPz())<0.1 ) continue; - par[2] = mcTrk.GetTx(); - par[3] = mcTrk.GetTy(); - par[4] = mcTrk.GetCharge() / mcTrk.GetP(); - par[5] = mcTrk.GetStartZ(); - - int npoints = mcTrk.GetNofPoints(); - LOG_IF(info, fVerbose >= 10) << " NMCPoints = " << npoints; - if (npoints < 1) continue; - - vector<double> lx, ly, lz; - lx.push_back(par[0]); - ly.push_back(par[1]); - lz.push_back(par[5]); - - bool ok = true; - - if (fVerbose >= 4) { - std::stringstream msg; - msg << "hits = "; - for (unsigned int ih : mcTrk.GetHitIndexes()) - msg << ih << " "; - LOG(info) << msg.str(); - } - for (int ip : mcTrk.GetPointIndexes()) { - auto& point = mcData.GetPoint(ip); - double par1[6]; - //if( fabs(p.pz)<0.05 ) continue; - par1[0] = point.GetX(); - par1[1] = point.GetY(); - par1[2] = point.GetTx(); - par1[3] = point.GetTy(); - par1[4] = point.GetQp(); - par1[5] = point.GetZ(); - if (fVerbose >= 5) { - static fscal pz = -1; - LOG(info) << (fabs(pz - point.GetZ()) > 1.0 ? "-- " : "") << "point z = " << point.GetZ(); - pz = point.GetZ(); - } - - double Zfrst = par[5]; - double Zlast = par1[5]; - double step = .5; - if (step > fabs(Zfrst - Zlast) / 5) step = fabs(Zfrst - Zlast) / 5; - if (Zlast < par[5]) step = -step; - while (fabs(par[5] - Zlast) > fabs(step)) { - double znxt = par[5] + step; - //TODO: replace this part with some L1 utility - // CbmKF::Instance()->Propagate(par1, 0, znxt, par1[4]); - // CbmKF::Instance()->Propagate(par, 0, znxt, par[4]); - double w = fabs(znxt - Zfrst); - double w1 = fabs(znxt - Zlast); - if (w + w1 < 1.e-3) { - w = 1; - w1 = 0; - } - double xl = (w1 * par[0] + w * par1[0]) / (w + w1); - double yl = (w1 * par[1] + w * par1[1]) / (w + w1); - double zl = (w1 * par[5] + w * par1[5]) / (w + w1); - if ((fabs(xl) > 50.0) || (fabs(yl) > 50.0)) { - //cout << "*** track " << NRegMCTracks+1 << " xl = " << xl << ", zl = " << zl << endl; - //cout << "*** track " << NRegMCTracks+1 << " yl = " << yl << ", zl = " << zl << endl; - ok = false; - continue; - } - lx.push_back(xl); - ly.push_back(yl); - lz.push_back(zl); - } - - par[0] = point.GetX(); - par[1] = point.GetY(); - par[2] = point.GetTx(); - par[3] = point.GetTy(); - par[4] = point.GetQp(); - par[5] = point.GetZ(); - lx.push_back(par[0]); - ly.push_back(par[1]); - lz.push_back(par[5]); - } - - if (ok) { - - NRegMCTracks++; - - YZ->cd(); - pline.DrawPolyLine(lx.size(), &(lz[0]), &(ly[0])); - XZ->cd(); - pline.DrawPolyLine(lx.size(), &(lz[0]), &(lx[0])); - YX->cd(); - pline.DrawPolyLine(lx.size(), &(lx[0]), &(ly[0])); - - // YZ->cd(); YZ->Update(); - // XZ->cd(); XZ->Update(); - // YX->cd(); YX->Update(); - // DrawAsk(); - } - } - - cout << "L1CADraw: number of registered MC tracks: " << NRegMCTracks << endl; - - YZ->cd(); - YZ->Update(); - XZ->cd(); - XZ->Update(); - YX->cd(); - YX->Update(); -} - -void L1AlgoDraw::DrawRecoTracks() -{ - // XYZ->cd(); - // TView *view = TView::CreateView(1); - // view->SetRange(-100,-100,-100, 100, 100, 100); - - int NRecTracks = 0; - // CbmL1 &L1 = *CbmL1::Instance(); - - int curRecoHit = 0; - const cbm::algo::ca::Vector<ca::HitIndex_t>& recoHits = algo->GetWData()[0].RecoHitIndices(); - for (vector<Track>::const_iterator it = algo->GetWData()[0].RecoTracks().begin(); - it != algo->GetWData()[0].RecoTracks().end(); ++it) { - const Track& T = *it; - int nHits = T.fNofHits; - // if (nHits > 5) continue; // draw clones - // YZ->cd(); YZ->Update(); - // XZ->cd(); XZ->Update(); - // YX->cd(); YX->Update(); - // DrawAsk(); - vector<double> lx, ly, lz; - vector<double> lx_turned, ly_turned, lz_turned; - - TPolyLine pline; - pline.SetLineColor(kBlue); - // TPolyLine3D pline3D(nHits); - // pline3D.SetLineColor(kBlue); - if (fVerbose >= 4) { - cout << "hits = "; - } - for (int iHit = 0; iHit < nHits; iHit++) { - unsigned int ih = recoHits[curRecoHit++]; - if (fVerbose >= 4) { - cout << ih << " "; - } - - Point p = GetHitCoor(ih); - lx.push_back(p.x); - ly.push_back(p.y); - lz.push_back(p.z); - - TVector3 v3(p.x, p.y, p.z); - v3.RotateX(TMath::Pi() / 5); - v3.RotateY(TMath::Pi() / 20); - v3.RotateZ(TMath::Pi() / 100); - lx_turned.push_back(v3.x()); - ly_turned.push_back(v3.y()); - lz_turned.push_back(v3.z()); - // pline3D.SetPoint(iHit, p.x, p.y, p.z); - } - if (fVerbose >= 4) { - cout << endl; - } - if (1) { - - NRecTracks++; - - YZ->cd(); - pline.DrawPolyLine(lx.size(), &(lz[0]), &(ly[0])); - XZ->cd(); - pline.DrawPolyLine(lx.size(), &(lz[0]), &(lx[0])); - YX->cd(); - pline.DrawPolyLine(lx.size(), &(lx[0]), &(ly[0])); - XYZ->cd(); - pline.DrawPolyLine(lx_turned.size(), &(lz_turned[0]), &(lx_turned[0])); - // pline3D.Draw(); - } - } - - cout << "L1CADraw: number of reconstructed tracks: " << NRecTracks << endl; - - YZ->cd(); - YZ->Update(); - XZ->cd(); - XZ->Update(); - YX->cd(); - YX->Update(); - - XYZ->cd(); - XYZ->Update(); -} - -void L1AlgoDraw::DrawTriplets(vector<ca::Triplet>& triplets, const ca::HitIndex_t* realIHit) -{ - // vector <ca::Triplet> triplets = algo->vTriplets; - for (unsigned int iTrip = 0; iTrip < triplets.size(); iTrip++) { - ca::Triplet& trip = triplets[iTrip]; - - unsigned int iLHit = trip.GetLHit(); - iLHit = realIHit[iLHit]; - unsigned int iMHit = trip.GetMHit(); - iMHit = realIHit[iMHit]; - unsigned int iRHit = trip.GetRHit(); - iRHit = realIHit[iRHit]; - - DrawTriplet(iLHit, iMHit, iRHit); - } - - YZ->cd(); - YZ->Update(); - XZ->cd(); - XZ->Update(); - YX->cd(); - YX->Update(); -}; - -void L1AlgoDraw::DrawTriplet(int il, int im, int ir) -{ - TPolyLine pline; - pline.SetLineColor(kBlack); - TMarker marker; - marker.SetMarkerColor(kBlack); - marker.SetMarkerStyle(26); - marker.SetMarkerSize(HitSize * 2); - - vector<double> lx, ly, lz; - - Point coor; - - coor = GetHitCoor(il); - lx.push_back(coor.x); - ly.push_back(coor.y); - lz.push_back(coor.z); - - coor = GetHitCoor(im); - lx.push_back(coor.x); - ly.push_back(coor.y); - lz.push_back(coor.z); - - coor = GetHitCoor(ir); - lx.push_back(coor.x); - ly.push_back(coor.y); - lz.push_back(coor.z); - - const int nHits = 3; - YZ->cd(); - pline.DrawPolyLine(nHits, &(lz[0]), &(ly[0])); - marker.DrawMarker(lz[nHits - 1], ly[nHits - 1]); - XZ->cd(); - pline.DrawPolyLine(nHits, &(lz[0]), &(lx[0])); - marker.DrawMarker(lz[nHits - 1], lx[nHits - 1]); - YX->cd(); - pline.DrawPolyLine(nHits, &(lx[0]), &(ly[0])); - marker.DrawMarker(lx[nHits - 1], ly[nHits - 1]); -} - -void L1AlgoDraw::DrawDoublets(vector<ca::HitIndex_t>* Doublets_hits, - map<ca::HitIndex_t, ca::HitIndex_t>* Doublets_start, const int /*MaxArrSize*/, - ca::HitIndex_t* StsRestHitsStartIndex, unsigned int* realIHit) -{ - for (int iSta = 0; iSta < NStations - 1; iSta++) { - const int firstHitOnSta = StsRestHitsStartIndex[iSta]; - const int firstHitOnNextSta = StsRestHitsStartIndex[iSta + 1]; - ca::HitIndex_t* staDoubletsHits = &(Doublets_hits[iSta][0]); - map<ca::HitIndex_t, ca::HitIndex_t>& staDoubletsStart = Doublets_start[iSta]; - - for (int iRestLHit = firstHitOnSta; iRestLHit < firstHitOnNextSta; iRestLHit++) { - const int ilh = iRestLHit - firstHitOnSta; - const int iirhFirst = staDoubletsStart[ilh]; - const int iirhLast = staDoubletsStart[ilh + 1] - 1; - - for (int iirh = iirhFirst; iirh <= iirhLast; iirh++) { - const int iRestRHit = staDoubletsHits[iirh] + firstHitOnNextSta; - - const int iLHit = realIHit[iRestLHit]; - const int iRHit = realIHit[iRestRHit]; - - DrawDoublet(iLHit, iRHit); - } - } - } - - YZ->cd(); - YZ->Update(); - XZ->cd(); - XZ->Update(); - YX->cd(); - YX->Update(); -}; - -void L1AlgoDraw::DrawDoubletsOnSta(int iSta, ca::HitIndex_t* Doublets_hits, ca::HitIndex_t* Doublets_start, - const int MaxArrSize, ca::HitIndex_t* StsRestHitsStartIndex, unsigned int* realIHit) -{ - const int firstHitOnSta = StsRestHitsStartIndex[iSta]; - const int firstHitOnNextSta = StsRestHitsStartIndex[iSta + 1]; - ca::HitIndex_t* staDoubletsHits = Doublets_hits + MaxArrSize * iSta; - ca::HitIndex_t* staDoubletsStart = Doublets_start + MaxArrSize * iSta; - - for (int iRestLHit = firstHitOnSta; iRestLHit < firstHitOnNextSta; iRestLHit++) { - const int ilh = iRestLHit - firstHitOnSta; - const int iirhFirst = staDoubletsStart[ilh]; - const int iirhLast = staDoubletsStart[ilh + 1] - 1; - - for (int iirh = iirhFirst; iirh <= iirhLast; iirh++) { - const int iRestRHit = staDoubletsHits[iirh] + firstHitOnNextSta; - - const int iLHit = realIHit[iRestLHit]; - const int iRHit = realIHit[iRestRHit]; - - DrawDoublet(iLHit, iRHit); - } - } - - YZ->cd(); - YZ->Update(); - XZ->cd(); - XZ->Update(); - YX->cd(); - YX->Update(); -}; - -void L1AlgoDraw::DrawDoublet(int il, int ir) -{ - TPolyLine pline; - pline.SetLineColor(kBlue); - TMarker marker; - marker.SetMarkerColor(kBlue); - marker.SetMarkerStyle(27); - marker.SetMarkerSize(HitSize * 2); - - vector<double> lx, ly, lz; - - Point coor; - - coor = GetHitCoor(il); - lx.push_back(coor.x); - ly.push_back(coor.y); - lz.push_back(coor.z); - - coor = GetHitCoor(ir); - lx.push_back(coor.x); - ly.push_back(coor.y); - lz.push_back(coor.z); - - const int nHits = 2; - YZ->cd(); - pline.DrawPolyLine(nHits, &(lz[0]), &(ly[0])); - marker.DrawMarker(lz[nHits - 1], ly[nHits - 1]); - XZ->cd(); - pline.DrawPolyLine(nHits, &(lz[0]), &(lx[0])); - marker.DrawMarker(lz[nHits - 1], lx[nHits - 1]); - YX->cd(); - pline.DrawPolyLine(nHits, &(lx[0]), &(ly[0])); - marker.DrawMarker(lx[nHits - 1], ly[nHits - 1]); -} - - -void L1AlgoDraw::DrawInfo() -{ - cout << " vHits.size = " << algo->GetInputData().GetNhits() << endl; - cout << " vRecoHits.size = " << algo->GetWData()[0].RecoHitIndices().size() << endl; - cout << " vTracks.size = " << algo->GetWData()[0].RecoTracks().size() << endl; -} - -void L1AlgoDraw::DrawTarget() -{ - - double x = 0, y = 0, z = 0; - double x_t, z_t; - - TVector3 v3(x, y, z); - v3.RotateX(TMath::Pi() / 5); - v3.RotateY(TMath::Pi() / 20); - v3.RotateZ(TMath::Pi() / 100); - x_t = v3.x(); - z_t = v3.z(); - - { - YZ->cd(); - - TMarker* marker = new TMarker(z, y, targetMStyle); - marker->SetMarkerColor(kRed); - marker->SetMarkerStyle(targetMStyle); - marker->SetMarkerSize(HitSize); - marker->Draw(); - } - - { - XZ->cd(); - - TMarker* marker = new TMarker(z, x, targetMStyle); - marker->SetMarkerColor(kRed); - marker->SetMarkerStyle(targetMStyle); - marker->SetMarkerSize(HitSize); - marker->Draw(); - } - - { - YX->cd(); - - TMarker* marker = new TMarker(x, y, targetMStyle); - marker->SetMarkerColor(kRed); - marker->SetMarkerStyle(targetMStyle); - marker->SetMarkerSize(HitSize); - marker->Draw(); - } - - { - XYZ->cd(); - - TMarker* marker = new TMarker(z_t, x_t, targetMStyle); - marker->SetMarkerColor(kRed); - marker->SetMarkerStyle(targetMStyle); - marker->SetMarkerSize(HitSize); - marker->Draw(); - } -} - -void L1AlgoDraw::DrawInputHits() -{ - - TLatex latex; - latex.SetTextFont(132); - latex.SetTextAlign(12); - latex.SetTextSize(0.035); - - YZ->cd(); - latex.DrawLatex(0.0, 45.0, "YZ Side View"); - YZ->Draw(); - XZ->cd(); - latex.DrawLatex(0.0, 45.0, "XZ Top View"); - XZ->Draw(); - YX->cd(); - latex.DrawLatex(-45.0, 45.0, "YX Front View"); - YX->Draw(); - - - int nhits = vHits.size(); - Double_t x_poly[nhits], y_poly[nhits], z_poly[nhits]; - Double_t x_poly_fake[nhits], y_poly_fake[nhits], z_poly_fake[nhits]; - Double_t x_poly_turned[nhits], z_poly_turned[nhits]; - Double_t x_poly_fake_turned[nhits], z_poly_fake_turned[nhits]; - - - for (int ista = NStations - 1; ista >= 0; ista--) { // //start downstream chambers - ca::Station<ca::fvec>& st = vStations[ista]; - Int_t n_poly = 0; - Int_t n_poly_fake = 0; - for (int ih = HitsStartIndex[ista]; ih < HitsStopIndex[ista]; ih++) { - ca::Hit& h = vHits[ih]; - const auto& hQa = vHitsQa[ih]; - int iMC = hQa.GetBestMcPointId(); - //if( (vSFlag[h.f] | vSFlagB[h.b] )&0x02 ) continue; // if used - - fscal x = h.X(), y = h.Y(), z = h.Z(); - fscal x_t, z_t; - - TVector3 v3(x, y, z); - v3.RotateX(TMath::Pi() / 5); - v3.RotateY(TMath::Pi() / 20); - v3.RotateZ(TMath::Pi() / 100); - x_t = v3.x(); - z_t = v3.z(); - - if (iMC >= 0) { - x_poly[n_poly] = x; - y_poly[n_poly] = y; - z_poly[n_poly] = z; - x_poly_turned[n_poly] = x_t; - z_poly_turned[n_poly] = z_t; - n_poly++; - } - else { - x_poly_fake[n_poly_fake] = x; - y_poly_fake[n_poly_fake] = y; - z_poly_fake[n_poly_fake] = z; - x_poly_fake_turned[n_poly_fake] = x_t; - z_poly_fake_turned[n_poly_fake] = z_t; - n_poly_fake++; - } - } - - YZ->cd(); - - TLine* line = new TLine(); - line->SetLineColor(StaColor); - line->DrawLine(st.fZ[0], -st.Ymax[0], st.fZ[0], st.Ymax[0]); - - TPolyMarker* pmyz = new TPolyMarker(n_poly, z_poly, y_poly); - pmyz->SetMarkerColor(mcolor[ista]); - pmyz->SetMarkerStyle(hitsMStyle); - pmyz->SetMarkerSize(HitSize); - pmyz->Draw(); - - TPolyMarker* pmyz_fake = new TPolyMarker(n_poly_fake, z_poly_fake, y_poly_fake); - pmyz_fake->SetMarkerColor(mcolor[ista]); - pmyz_fake->SetMarkerStyle(fakesMStyle); - pmyz_fake->SetMarkerSize(HitSize); - pmyz_fake->Draw(); - - XZ->cd(); - - line->DrawLine(st.fZ[0], -st.Xmax[0], st.fZ[0], st.Xmax[0]); - - TPolyMarker* pmxz = new TPolyMarker(n_poly, z_poly, x_poly); - pmxz->SetMarkerColor(mcolor[ista]); - pmxz->SetMarkerStyle(hitsMStyle); - pmxz->SetMarkerSize(HitSize); - pmxz->Draw(); - - TPolyMarker* pmxz_fake = new TPolyMarker(n_poly_fake, z_poly_fake, x_poly_fake); - pmxz_fake->SetMarkerColor(mcolor[ista]); - pmxz_fake->SetMarkerStyle(fakesMStyle); - pmxz_fake->SetMarkerSize(HitSize); - pmxz_fake->Draw(); - - YX->cd(); - - TEllipse* ellipse = new TEllipse(0.0, 0.0, st.Xmax[0]); - ellipse->SetLineColor(StaColor); - ellipse->SetFillStyle(0); - ellipse->Draw(); - - TPolyMarker* pmyx = new TPolyMarker(n_poly, x_poly, y_poly); - pmyx->SetMarkerColor(mcolor[ista]); - pmyx->SetMarkerStyle(hitsMStyle); - pmyx->SetMarkerSize(HitSize); - pmyx->Draw(); - - TPolyMarker* pmyx_fake = new TPolyMarker(n_poly_fake, x_poly_fake, y_poly_fake); - pmyx_fake->SetMarkerColor(mcolor[ista]); - pmyx_fake->SetMarkerStyle(fakesMStyle); - pmyx_fake->SetMarkerSize(HitSize); - pmyx_fake->Draw(); - - XYZ->cd(); - - TPolyMarker* pmxyz = new TPolyMarker(n_poly, z_poly_turned, x_poly_turned); - pmxyz->SetMarkerColor(mcolor[ista]); - pmxyz->SetMarkerStyle(hitsMStyle); - pmxyz->SetMarkerSize(HitSize); - pmxyz->Draw(); - - TPolyMarker* pmxyz_fake = new TPolyMarker(n_poly_fake, z_poly_fake_turned, x_poly_fake_turned); - pmxyz_fake->SetMarkerColor(mcolor[ista]); - pmxyz_fake->SetMarkerStyle(fakesMStyle); - pmxyz_fake->SetMarkerSize(HitSize); - pmxyz_fake->Draw(); - } - -} // DrawInputHits - -void L1AlgoDraw::DrawRestHits(ca::HitIndex_t* StsRestHitsStartIndex, ca::HitIndex_t* StsRestHitsStopIndex, - unsigned int* realIHit) -{ - - TLatex latex; - latex.SetTextFont(132); - latex.SetTextAlign(12); - latex.SetTextSize(0.035); - - YZ->cd(); - latex.DrawLatex(0.0, 45.0, "YZ Side View"); - YZ->Draw(); - XZ->cd(); - latex.DrawLatex(0.0, 45.0, "XZ Top View"); - XZ->Draw(); - YX->cd(); - latex.DrawLatex(-45.0, 45.0, "YX Front View"); - YX->Draw(); - - - int nhits = vHits.size(); - Double_t x_poly[nhits], y_poly[nhits], z_poly[nhits]; - Double_t x_poly_fake[nhits], y_poly_fake[nhits], z_poly_fake[nhits]; - - - for (int ista = NStations - 1; ista >= 0; ista--) { // //start downstream chambers - ca::Station<ca::fvec>& st = vStations[ista]; - Int_t n_poly = 0; - Int_t n_poly_fake = 0; - for (ca::HitIndex_t iRestHit = StsRestHitsStartIndex[ista]; iRestHit < StsRestHitsStopIndex[ista]; iRestHit++) { - int ih = realIHit[iRestHit]; - ca::Hit& h = vHits[ih]; - const auto& qaHit = vHitsQa[ih]; - int iMC = qaHit.GetBestMcPointId(); - //if( (vSFlag[h.f] | vSFlagB[h.b] )&0x02 ) continue; // if used - - fscal x = h.X(), y = h.Y(), z = h.Z(); - - if (iMC >= 0) { - x_poly[n_poly] = x; - y_poly[n_poly] = y; - z_poly[n_poly] = z; - n_poly++; - } - else { - x_poly_fake[n_poly_fake] = x; - y_poly_fake[n_poly_fake] = y; - z_poly_fake[n_poly_fake] = z; - n_poly_fake++; - } - } - - YZ->cd(); - - TLine* line = new TLine(); - line->SetLineColor(StaColor); - line->DrawLine(st.fZ[0], -st.Ymax[0], st.fZ[0], st.Ymax[0]); - - TPolyMarker* pmyz = new TPolyMarker(n_poly, z_poly, y_poly); - pmyz->SetMarkerColor(mcolor[ista]); - pmyz->SetMarkerStyle(hitsMStyle); - pmyz->SetMarkerSize(HitSize); - pmyz->Draw(); - - TPolyMarker* pmyz_fake = new TPolyMarker(n_poly_fake, z_poly_fake, y_poly_fake); - pmyz_fake->SetMarkerColor(mcolor[ista]); - pmyz_fake->SetMarkerStyle(fakesMStyle); - pmyz_fake->SetMarkerSize(HitSize); - pmyz_fake->Draw(); - - XZ->cd(); - - line->DrawLine(st.fZ[0], -st.Xmax[0], st.fZ[0], st.Xmax[0]); - - TPolyMarker* pmxz = new TPolyMarker(n_poly, z_poly, x_poly); - pmxz->SetMarkerColor(mcolor[ista]); - pmxz->SetMarkerStyle(hitsMStyle); - pmxz->SetMarkerSize(HitSize); - pmxz->Draw(); - - TPolyMarker* pmxz_fake = new TPolyMarker(n_poly_fake, z_poly_fake, x_poly_fake); - pmxz_fake->SetMarkerColor(mcolor[ista]); - pmxz_fake->SetMarkerStyle(fakesMStyle); - pmxz_fake->SetMarkerSize(HitSize); - pmxz_fake->Draw(); - - YX->cd(); - - TEllipse* ellipse = new TEllipse(0.0, 0.0, st.Xmax[0]); - ellipse->SetLineColor(StaColor); - ellipse->SetFillStyle(0); - ellipse->Draw(); - - TPolyMarker* pmyx = new TPolyMarker(n_poly, x_poly, y_poly); - pmyx->SetMarkerColor(mcolor[ista]); - pmyx->SetMarkerStyle(hitsMStyle); - pmyx->SetMarkerSize(HitSize); - pmyx->Draw(); - - TPolyMarker* pmyx_fake = new TPolyMarker(n_poly_fake, x_poly_fake, y_poly_fake); - pmyx_fake->SetMarkerColor(mcolor[ista]); - pmyx_fake->SetMarkerStyle(fakesMStyle); - pmyx_fake->SetMarkerSize(HitSize); - pmyx_fake->Draw(); - } - -} // DrawCurHits - -void L1AlgoDraw::DrawAsk() -{ - char symbol; - if (ask) { - std::cout << "ask>"; - do { - std::cin.get(symbol); - if (symbol == 'r') ask = false; - if (symbol == 'q') exit(0); - } while (symbol != '\n'); - std::cout << endl; - } -} - -void L1AlgoDraw::ClearVeiw() -{ - YZ->Clear(); - XZ->Clear(); - YX->Clear(); - XYZ->Clear(); -} - -L1AlgoDraw::Point L1AlgoDraw::GetHitCoor(int ih) -{ - ca::Hit& hit = vHits[ih]; - return Point(hit.X(), hit.Y(), hit.Z()); -}; - -void L1AlgoDraw::SaveCanvas(TString name) -{ - system("mkdir L1CADraw -p"); - chdir("L1CADraw"); - TString tmp = name; - tmp += "YXView.pdf"; - YX->cd(); - // YX->SaveAs("YXView.eps"); - YX->SaveAs(tmp); - - tmp = name; - tmp += "XZView.pdf"; - XZ->cd(); - // XZ->SaveAs("XZView.eps"); - XZ->SaveAs(tmp); - - tmp = name; - tmp += "YZView.pdf"; - YZ->cd(); - // YZ->SaveAs("YZView.eps"); - YZ->SaveAs(tmp); - - tmp = name; - tmp += "XYZView.pdf"; - XYZ->cd(); - XYZ->SaveAs(tmp); - // XYZ->SaveAs("XYZView.eps"); - // XYZ->SaveAs("XYZView.png"); - // XYZ->SaveAs("XYZView.pdf"); - chdir(".."); -} diff --git a/reco/L1/L1Algo/utils/L1AlgoDraw.h b/reco/L1/L1Algo/utils/L1AlgoDraw.h deleted file mode 100644 index 4bbfbe7b87..0000000000 --- a/reco/L1/L1Algo/utils/L1AlgoDraw.h +++ /dev/null @@ -1,98 +0,0 @@ -/* Copyright (C) 2010-2012 Frankfurt Institute for Advanced Studies, Goethe-Universität Frankfurt, Frankfurt - SPDX-License-Identifier: GPL-3.0-only - Authors: Igor Kulakov [committer] */ - -#ifndef L1AlgoDraw_h -#define L1AlgoDraw_h 1 - -#include "CaHit.h" -#include "CaStation.h" -#include "CaTriplet.h" -#include "CbmL1Hit.h" - -#include <TString.h> - -#include <map> -#include <vector> - -namespace -{ - using namespace cbm::algo; -} - -class TCanvas; - -namespace cbm::algo::ca -{ - class Framework; -} - -class L1AlgoDraw { - struct Point { - double x{0}, y{0}, z{0}; - Point() = default; - Point(double _x, double _y, double _z) : x(_x), y(_y), z(_z){}; - }; - - public: - L1AlgoDraw(); - - void InitL1Draw(ca::Framework* algo_); - - void DrawMCTracks(); - void DrawRecoTracks(); - - void DrawTriplets(std::vector<ca::Triplet>& triplets, const ca::HitIndex_t* realIHit); - void DrawDoublets(std::vector<ca::HitIndex_t>* Doublets_hits, - std::map<ca::HitIndex_t, ca::HitIndex_t>* Doublets_start, const int MaxArrSize, - ca::HitIndex_t* HitsStartIndex, unsigned int* realIHit); - void DrawDoubletsOnSta(int iSta, ca::HitIndex_t* Doublets_hits, ca::HitIndex_t* Doublets_start, const int MaxArrSize, - ca::HitIndex_t* StsRestHitsStartIndex, unsigned int* realIHit); - - void DrawTarget(); - void DrawInputHits(); // draw all hits, which TF have gotten - void DrawRestHits(ca::HitIndex_t* StsRestHitsStartIndex, ca::HitIndex_t* StsRestHitsStopIndex, - unsigned int* realIHit); // draw only hits which leave on current iteration. - - void DrawInfo(); - void ClearVeiw(); - void SaveCanvas(TString name); - void DrawAsk(); - - private: - L1AlgoDraw(const L1AlgoDraw&); - L1AlgoDraw& operator=(const L1AlgoDraw&); - - Point GetHitCoor(int ih); - - void DrawTriplet(int il, int im, int ir); - void DrawDoublet(int il, int ir); - - ca::Framework* algo{nullptr}; - - std::vector<CbmL1HitDebugInfo> vHitsQa{}; - std::vector<ca::Hit> vHits{}; - int HitsStartIndex[20]{0}; - int HitsStopIndex[20]{0}; - - int NStations{0}; - ca::Station<ca::fvec> 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 - - double HitSize{1}; // size of hits - - int fVerbose{0}; - TCanvas* YZ{nullptr}; - TCanvas* YX{nullptr}; - TCanvas* XZ{nullptr}; - TCanvas* XYZ{nullptr}; - bool ask{true}; -}; - - -#endif diff --git a/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.cxx b/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.cxx deleted file mode 100644 index e090a46b72..0000000000 --- a/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.cxx +++ /dev/null @@ -1,8 +0,0 @@ -/* Copyright (C) 2010-2021 Frankfurt Institute for Advanced Studies, Goethe-Universität Frankfurt, Frankfurt - SPDX-License-Identifier: GPL-3.0-only - Authors: Sergey Gorbunov [committer] */ - -#include "L1AlgoEfficiencyPerformance.h" - -template class L1AlgoEfficiencyPerformance<2>; -template class L1AlgoEfficiencyPerformance<3>; diff --git a/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h b/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h deleted file mode 100644 index 05b4fa9a6d..0000000000 --- a/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h +++ /dev/null @@ -1,399 +0,0 @@ -/* Copyright (C) 2010-2017 Frankfurt Institute for Advanced Studies, Goethe-Universität Frankfurt, Frankfurt - SPDX-License-Identifier: GPL-3.0-only - Authors: Igor Kulakov [committer] */ - -#ifndef L1AlgoEfficiencyPerformance_h -#define L1AlgoEfficiencyPerformance_h - -/** -* Class for tracklets reconstruction efficiency calculation. Used for debug of CATrackFinder. -* -* Reconstructed tracklet is one, which has all 3 hits from one mcTrack. -* Reconstructable mcTracklet is one, which has all 3 hits and momentum bigger than fL1->MinRecoMom. -*/ - -#include "CbmL1.h" -#include "CbmL1Counters.h" -#include "CbmL1MCTrack.h" - -#include <Logger.h> - -#include <iostream> -#include <vector> - -using std::vector; - - -template<int NHits> -class L1Tracklet { - public: - L1Tracklet() = default; - - static bool compare(const L1Tracklet<NHits>& a, const L1Tracklet<NHits>& b) - { - return (a.mcTrackId < b.mcTrackId) || ((a.mcTrackId == b.mcTrackId) && (a.iStation < b.iStation)); - } - - bool operator==(const L1Tracklet<NHits>& a) { return ((a.mcTrackId == mcTrackId) && (a.iStation == iStation)); } - 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}; -}; - -// reconstructed Tracklet -template<int NHits> -class L1RTracklet : public L1Tracklet<NHits> { - public: - L1RTracklet() = default; - L1RTracklet(ca::HitIndex_t* ih_) : L1Tracklet<NHits>() - { - for (int iih = 0; iih < NHits; iih++) { - i[iih] = ih_[iih]; - } - }; - - bool IsGhost() { return L1Tracklet<NHits>::mcTrackId < 0; }; // is it ghost or reconstructed - - bool operator!=(const L1Tracklet<NHits>& a) { return L1Tracklet<NHits>::operator!=(a); } - - bool operator==(const L1RTracklet<NHits>& a) - { - bool flag = 1; - // flag &= L1Tracklet<NHits>::operator==(a); - for (int ih = 0; ih < NHits; ih++) { - flag &= (a.i[ih] == i[ih]); - } - return flag; - } - bool operator!=(const L1RTracklet<NHits>& a) { return !operator==(a); } - - ca::HitIndex_t i[NHits]{0}; // indices of left, middle and right hits -}; - -// MC Tracklet -template<int NHits> -class L1MTracklet : public L1Tracklet<NHits> { - public: - L1MTracklet() = default; - - void AddReconstructed(int recoId) { recoIds.push_back(recoId); }; - void SetAsReconstructable() { isReconstructable = true; }; - - int GetNClones() { return (recoIds.size() > 1) ? recoIds.size() - 1 : 0; }; // number of created clones - bool IsReconstructed() { return recoIds.size(); }; // is it reconstructed - 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 - - vector<int> hitIds[NHits]{}; // indices of hits in L1::vHits. Separated by stations - private: - bool isReconstructable{false}; // is it reconstructed -}; - -// tracklets categories -struct TL1AlgoEfficiencies : public TL1Efficiencies { - TL1AlgoEfficiencies() : TL1Efficiencies() - { - AddCounter("total", "Allset efficiency"); - AddCounter("fast", "Refset efficiency"); - AddCounter("fast_prim", "RefPrim efficiency"); - AddCounter("fast_sec", "RefSec efficiency"); - AddCounter("slow", "Extra efficiency"); - AddCounter("slow_prim", "ExtraPrim efficiency"); - AddCounter("slow_sec", "ExtraSec efficiency"); - } -}; - - -template<int NHits = 3> -class L1AlgoEfficiencyPerformance { - public: - typedef L1RTracklet<NHits> L1RecoTracklet; - typedef L1MTracklet<NHits> L1MCTracklet; - L1AlgoEfficiencyPerformance() = default; - void Init(); - - bool AddOne(ca::HitIndex_t* ih_); // add one recoTracklets. Return is it reconstructed or not - void CalculateEff(); - - void Print(TString title = "Triplets performance statistic", - bool station = 0) const; // Print efficiencies - - static constexpr int MaxNStations = 10; - - 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) - - vector<L1RecoTracklet> recoTracklets{}; - vector<L1MCTracklet> mcTracklets{}; - - TL1AlgoEfficiencies ntra{}; // current event efficiencies - TL1AlgoEfficiencies NTRA{}; // efficiencies statistic - - TL1AlgoEfficiencies ntra_sta[MaxNStations]{}; // for each station separately - TL1AlgoEfficiencies NTRA_STA[MaxNStations]{}; -}; - -// =================================================================================== - -template<int NHits> -void L1AlgoEfficiencyPerformance<NHits>::Init() -{ - fL1 = CbmL1::Instance(); - recoTracklets.clear(); - mcTracklets.clear(); - ntra = TL1AlgoEfficiencies(); - for (int iSta = 0; iSta < MaxNStations; iSta++) { - ntra_sta[iSta] = ntra; - } - - FillMC(); -}; - -template<int NHits> -void L1AlgoEfficiencyPerformance<NHits>::FillMC() -{ - const auto& mcData = fL1->GetMCData(); - for (const auto& mcTrk : mcData.GetTrackContainer()) { - const int NMCPoints = mcData.GetNofPoints(); - // const int NIter = mtra.NStations()-NHits+1; // number of possible tracklets - int lastIterSta = -1; - for (int iterOffset = 0; iterOffset < NMCPoints; iterOffset++) { // first mcPoint on the station - // const int iterMcId = mtra.Points[iterOffset]; - int iterSta = mcData.GetPoint(mcTrk.GetPointIndexes()[iterOffset]).GetStationId(); - - if (iterSta == lastIterSta) continue; // find offset for next station - lastIterSta = iterSta; - - // read hits - // take all points on each station - // TODO: Should we create all possible tracklets? - L1MCTracklet trlet; // TODO: don't use hits in mcTracklet - for (int is = 0, offset = iterOffset; ((offset < NMCPoints) && (is < NHits)); offset++) { - const int mcId = mcTrk.GetPointIndexes()[offset]; - const auto& mcPoint = mcData.GetPoint(mcId); - is = mcPoint.GetStationId() - iterSta; - - if (is < NHits) { - const int NPointHits = mcPoint.GetHitIndexes().size(); - for (int ih = 0; ih < NPointHits; ih++) { - trlet.hitIds[is].push_back(mcPoint.GetHitIndexes()[ih]); - } - } - } // for is - // check tracklet - bool good = 1; - for (int is = 0; is < NHits; is++) { - good &= trlet.hitIds[is].size(); - } - if (!good) continue; // can't create tracklet - - trlet.iStation = iterSta; - trlet.mcTrackId = mcTrk.GetId(); - trlet.mcMotherTrackId = mcTrk.GetMotherId(); - trlet.p = mcTrk.GetP(); - const fscal maxQp = 1.0 / 0.5; // NOTE: Default value from ca::Iteration - if (mcTrk.GetP() > 1. / maxQp) { - trlet.SetAsReconstructable(); - } - - mcTracklets.push_back(trlet); - } // for Iter = stations - } // for mcTracks -} // void L1AlgoEfficiencyPerformance::FillMC() - - -template<int NHits> -bool L1AlgoEfficiencyPerformance<NHits>::AddOne(ca::HitIndex_t* iHits) -{ - const auto& mcData = fL1->GetMCData(); - L1RecoTracklet trlet(iHits); - - // --- check if all hits belong to one mcTrack --- - vector<int> mcIds[NHits]; - - // obtain mc data - for (int iih = 0; iih < NHits; iih++) { - const int iMCP = fL1->fvHitDebugInfo[iHits[iih]].GetBestMcPointId(); - if (iMCP > -1) { - int mcId = mcData.GetPoint(iMCP).GetTrackId(); - mcIds[iih].push_back(mcId); - } - } // for hits - - // find all reconstructed track id-s - for (int level = 0; level < NHits - 1; level++) { - vector<int>& mcs1 = mcIds[level]; - vector<int>& mcs2 = mcIds[level + 1]; - - // leave only matched ID-s. - for (unsigned int i2 = 0; i2 < mcs2.size(); i2++) { - int& mc2 = mcs2[i2]; - bool flag = 0; - // is the same ID on prev station? - for (unsigned int i1 = 0; i1 < mcs1.size(); i1++) { - flag |= (mcs1[i1] == mc2); - } - if (!flag) mc2 = -2; - } // for i2 - } - - // use first found // TODO: save all!!! - // UPD: SZh 24.05.2023: We save only one point index (the best matched) - vector<int>& mcsN = mcIds[NHits - 1]; - for (unsigned int i = 0; i < mcsN.size(); i++) { - if (mcsN[i] >= 0) { - trlet.mcTrackId = mcsN[i]; - int iMCP = fL1->fvHitDebugInfo[iHits[0]].GetBestMcPointId(); - assert(iMCP > -1); - trlet.iStation = mcData.GetPoint(fL1->fvHitDebugInfo[iHits[0]].GetBestMcPointId()).GetStationId(); - break; - } - } - - // --- save --- - // if ( std::find(recoTracklets.begin(), recoTracklets.end(), trlet) == recoTracklets.end() ) - recoTracklets.push_back(trlet); - - return (trlet.mcTrackId >= 0); -}; // inline bool L1AlgoEfficiencyPerformance::AddOne(ca::HitIndex_t ihl, ca::HitIndex_t ihm, ca::HitIndex_t ihr) - - -template<int NHits> -void L1AlgoEfficiencyPerformance<NHits>::MatchTracks() -{ // TODO: If we create all possible tracklets on NHits station - addapt to it. - std::sort(recoTracklets.begin(), recoTracklets.end(), L1Tracklet<NHits>::compare); - std::sort(mcTracklets.begin(), mcTracklets.end(), L1Tracklet<NHits>::compare); - - const int NRecoTrlets = recoTracklets.size(); - const int NMCTrlets = mcTracklets.size(); - // LOG(info) << NMCTrlets << " " << NRecoTrlets; - for (int iReco = 0, iMC = 0; (iReco < NRecoTrlets) && (iMC < NMCTrlets);) { - L1MCTracklet& mcTrlet = mcTracklets[iMC]; - L1RecoTracklet& recoTrlet = recoTracklets[iReco]; - - // if (recoTrlet.mcTrackId >= 0) - // LOG(info) << iMC << " " << mcTrlet.iStation << " " << mcTrlet.mcTrackId << " " << mcTrlet.p << " | " - // << iReco << " " << recoTrlet.iStation << " " << recoTrlet.mcTrackId; - - if (recoTrlet != mcTrlet) { - if (recoTrlet < mcTrlet) - iReco++; - else - iMC++; - } - else { - // LOG(info) << iMC << " " << mcTrlet.iStation << " " << mcTrlet.mcTrackId << " " << mcTrlet.p << " | " - // << iReco << " " << recoTrlet.iStation << " " << recoTrlet.mcTrackId; - // check if same tracklet has been matched, and save it if not. - bool flag = 1; - const int nReco = mcTrlet.recoIds.size(); - for (int iR = 0; iR < nReco; iR++) { - flag &= (recoTrlet != recoTracklets[mcTrlet.recoIds[iR]]); - } - if (flag) mcTrlet.AddReconstructed(iReco); - - iReco++; // suppose we have only one tracklet with certain (Id,Station) - } - }; -} // void L1AlgoEfficiencyPerformance::MatchTracks() - -template<int NHits> -void L1AlgoEfficiencyPerformance<NHits>::CalculateEff() -{ - MatchTracks(); - - const int NRecoTrlets = recoTracklets.size(); - for (int iReco = 0; iReco < NRecoTrlets; iReco++) { - L1RecoTracklet& reco = recoTracklets[iReco]; - ntra /*_sta[reco.iStation]*/.ghosts += reco.IsGhost(); - } - - const int NMCTrlets = mcTracklets.size(); - for (int iMC = 0; iMC < NMCTrlets; iMC++) { - L1MCTracklet& mtra = mcTracklets[iMC]; - if (!mtra.IsReconstructable()) continue; - int iSta = mtra.iStation; - - // find used constans - const bool reco = mtra.IsReconstructed(); - - // count tracklets - ntra_sta[iSta].Inc(reco, "total"); - - if (mtra.p > 1.) { // reference tracks - ntra_sta[iSta].Inc(reco, "fast"); - if (mtra.IsPrimary()) { // reference primary - ntra_sta[iSta].Inc(reco, "fast_prim"); - - // // Debug - // if (!reco){ - // LOG(info) << "iMC/N " << iMC << "/" << NMCTrlets << " sta " << mtra.iStation << " trackId " << mtra.mcTrackId << " momentum " << mtra.p << ". MotherTrackId " << mtra.mcMotherTrackId; - // for (int iSta2 = 0; iSta2 < NHits; iSta2++){ - // LOG(info) << iSta2 << ": "; - // const int NPointHits = mtra.hitIds[iSta2].size(); - // for (int iH = 0; iH < NPointHits; iH++){ - // LOG(info) << mtra.hitIds[iSta2][iH] << ""; - // LOG(info) << "(" << fL1->fvHitDebugInfo[mtra.hitIds[iSta2][iH]].x << "\\" << fL1->fvHitDebugInfo[mtra.hitIds[iSta2][iH]].y << "= " << fL1->fvHitDebugInfo[mtra.hitIds[iSta2][iH]].x/fL1->fvHitDebugInfo[mtra.hitIds[iSta2][iH]].y << " ) "; - // } - // } - // } - } - else { // reference secondary - ntra_sta[iSta].Inc(reco, "fast_sec"); - } - } - else { // extra set of tracks - ntra_sta[iSta].Inc(reco, "slow"); - if (mtra.IsPrimary()) { // extra primary - ntra_sta[iSta].Inc(reco, "slow_prim"); - } - else { - ntra_sta[iSta].Inc(reco, "slow_sec"); - } - } // if extra - ntra_sta[iSta].clones += mtra.GetNClones(); // TODO:check if works - }; //for mcTracklets - - for (int iSta = 0; iSta < MaxNStations; iSta++) { - ntra += ntra_sta[iSta]; - NTRA_STA[iSta] += ntra_sta[iSta]; - ntra_sta[iSta].CalcEff(); - NTRA_STA[iSta].CalcEff(); - } - NTRA += ntra; - ntra.CalcEff(); - NTRA.CalcEff(); -} // void L1AlgoEfficiencyPerformance::CalculateEff() - - -template<int NHits> -inline void L1AlgoEfficiencyPerformance<NHits>::Print(TString title, bool stations) const -{ - LOG(info) << "\n-------- " << title << " ----------"; - LOG(info) << NTRA.ToString() << "\n"; - - if (stations) { - for (int iSta = 0; iSta < fL1->fNStations - NHits + 1; iSta++) { - TString title_sta = title; - title_sta += " station "; - title_sta += iSta; - LOG(info) << "\n-------- " << title_sta << " ----------"; - LOG(info) << NTRA_STA[iSta].ToString() << "\n"; - } - } -}; - - -#endif diff --git a/reco/L1/L1Algo/utils/L1AlgoPulls.cxx b/reco/L1/L1Algo/utils/L1AlgoPulls.cxx deleted file mode 100644 index b9a312b3cf..0000000000 --- a/reco/L1/L1Algo/utils/L1AlgoPulls.cxx +++ /dev/null @@ -1,268 +0,0 @@ -/* Copyright (C) 2010-2021 Frankfurt Institute for Advanced Studies, Goethe-Universität Frankfurt, Frankfurt - SPDX-License-Identifier: GPL-3.0-only - Authors: Sergey Gorbunov [committer] */ - -#include "L1AlgoPulls.h" - -#include <Logger.h> - -using namespace cbm::algo::ca; - -const TString L1TrackParametersNames[TL1TrackParameters::NParameters] = {"x", "y", "tx", "ty", "qp"}; - -void L1AlgoPulls::Init() -{ - fL1 = CbmL1::Instance(); - - static bool first_call = 1; - if (first_call) { - // TDirectory *curdir = gDirectory; - // fL1->histodir->cd(); - // gDirectory->mkdir("L1AlgoPulls"); - // gDirectory->cd("L1AlgoPulls"); - - // add global pulls - for (int i = 0; i < TL1TrackParameters::NParameters; i++) { - TString name = "pull_"; - name += L1TrackParametersNames[i]; - histoPull[i] = new TH1F(name, name, 50, -10, 10); - } - -#ifdef BUILD_HISTO_FOR_EACH_STANTION - // add station pulls - for (int i = TL1TrackParameters::NParameters; i < (NStations + 1) * TL1TrackParameters::NParameters; i++) { - int ista = i / TL1TrackParameters::NParameters - 1; - TString name = "pull_sta"; - name += ista; - name += "_"; - name += L1TrackParametersNames[i % TL1TrackParameters::NParameters]; - histoPull[i] = new TH1F(name, name, 50, -10, 10); - } -#endif - - // add global residuals - for (int i = 0; i < TL1TrackParameters::NParameters; i++) { - TString name = "residual_"; - name += L1TrackParametersNames[i]; - float size = 10; - switch (i) { - case 0: size = .01; break; - case 1: size = .01; break; - case 2: size = 0.003; break; - case 3: size = 0.003; break; - case 4: size = 0.1; break; - }; - histoRes[i] = new TH1F(name, name, 50, -size, size); - } - - // define style - histoStyle = new TStyle("histoStyle", "Plain Style(no colors/fill areas)"); - - histoStyle->SetTextFont(textFont); - histoStyle->SetPadColor(0); - histoStyle->SetCanvasColor(0); - histoStyle->SetTitleColor(0); - histoStyle->SetStatColor(0); - - histoStyle->SetOptTitle(0); // without main up title - histoStyle->SetOptStat(1000001010); - // The parameter mode can be = ksiourmen (default = 000001111) - // k = 1; kurtosis printed - // k = 2; kurtosis and kurtosis error printed - // s = 1; skewness printed - // s = 2; skewness and skewness error printed - // i = 1; integral of bins printed - // o = 1; number of overflows printed - // u = 1; number of underflows printed - // r = 1; rms printed - // r = 2; rms and rms error printed - // m = 1; mean value printed - // m = 2; mean and mean error values printed - // e = 1; number of entries printed - // n = 1; name of histogram is printed - - histoStyle->SetOptFit(10001); - // The parameter mode can be = pcev (default = 0111) - // p = 1; print Probability - // c = 1; print Chisquare/Number of degress of freedom - // e = 1; print errors (if e=1, v must be 1) - // v = 1; print name/values of parameters - - histoStyle->SetStatW(0.175); - histoStyle->SetStatH(0.02); - histoStyle->SetStatX(0.95); - histoStyle->SetStatY(0.97); - histoStyle->SetStatFontSize(0.05); - - histoStyle->SetStatFont(textFont); - - - // gDirectory->cd(".."); - // curdir->cd(); - first_call = 0; - } -}; - -// void L1AlgoPulls::AddVec(TrackParamV& T_, ca::HitIndex_t ih) -// { -// for (int i = 0; i < fvecLen; i++) -// AddOne(T_,i,ih); -// } - -void L1AlgoPulls::AddOne(TrackParamV& T_, int i, ca::HitIndex_t ih) -{ - fNAllPulls++; - TL1TrackParameters T(T_, i); - - if (T_.GetChiSq()[i] > csCut * T_.GetNdf()[i]) return; - // get error - TL1TrackParameters err; - const TrackParamV& tr = T_; - - if (!std::isfinite((fscal) tr.GetXError()[i])) return; - if (!std::isfinite((fscal) tr.GetYError()[i])) return; - if (!std::isfinite((fscal) tr.GetTxError()[i])) return; - if (!std::isfinite((fscal) tr.GetTyError()[i])) return; - if (!std::isfinite((fscal) tr.GetQpError()[i])) return; - - err.x = tr.GetXError()[i]; - err.y = tr.GetYError()[i]; - err.tx = tr.GetTxError()[i]; - err.ty = tr.GetTyError()[i]; - err.qp = tr.GetQpError()[i]; - - // mc data - int iMCP = fL1->GetQaHits()[ih].GetBestMcPointId(); - if (iMCP < 0) return; - const auto& mcP = fL1->GetMCData().GetPoint(iMCP); - TL1TrackParameters mc(mcP); - - // fill residuals - TL1TrackParameters res = (mc - T); - fGRes.push_back(res); - - // fill pulls - TL1TrackParameters P = res / err; - fGPulls.push_back(P); - -#ifdef BUILD_HISTO_FOR_EACH_STANTION - int ista = mcP.iStation - 2; // last hit - // int ista = fL1->algo->vSFlag[ fL1->algo->GetInputData()->GetHit(ih).f ]/4 - 2; // last hit - fStaPulls[ista].push_back(P); -#endif // BUILD_HISTO_FOR_EACH_STANTION -}; - -std::string L1AlgoPulls::ToString() const -{ // TODO: renew - std::stringstream ss; - ss << "All pulls: " << fNAllPulls << "\n"; - ss << "Correct pulls: " << fGPulls.size() << "\n"; - ss << "x y tx ty qp \n"; - for (unsigned int i = 0; i < fGPulls.size(); i++) { - ss << fGPulls[i].ToString() << "\n"; - } - return ss.str(); -}; - -void L1AlgoPulls::Build(bool draw) -{ - // --- fill histograms --- - // global pulls - for (unsigned int i = 0; i < fGPulls.size(); i++) { - TL1TrackParameters& pull = fGPulls[i]; - for (int ih = 0; ih < TL1TrackParameters::NParameters; ih++) { - if (TailCut > fabs(pull[ih])) histoPull[ih]->Fill(pull[ih]); - } - } -#ifdef BUILD_HISTO_FOR_EACH_STANTION - // station pulls - for (int iSta = 0; iSta < NStations; iSta++) { - vector<TL1TrackParameters>& Pulls = fStaPulls[iSta]; - for (int i = 0; i < Pulls.size(); i++) { - TL1TrackParameters& pull = Pulls[i]; - for (int ih = 0; ih < TL1TrackParameters::NParameters; ih++) { - if (TailCut > fabs(pull[ih])) histoPull[(iSta + 1) * TL1TrackParameters::NParameters + ih]->Fill(pull[ih]); - } - } - } -#endif // BUILD_HISTO_FOR_EACH_STANTION - - // global residuals - for (unsigned int i = 0; i < fGRes.size(); i++) { - TL1TrackParameters& res = fGRes[i]; - for (int ih = 0; ih < TL1TrackParameters::NParameters; ih++) { - if (TailCut > fabs(res[ih])) histoRes[ih]->Fill(res[ih]); - } - } - - // --- draw histograms --- and save info - float pulls[(NStations + 1) * TL1TrackParameters::NParameters][2], // 0 - sigma, 1 - RMS - residuals[(NStations + 1) * TL1TrackParameters::NParameters][2]; - - system("mkdir L1_Pulls -p"); - chdir("L1_Pulls"); - TCanvas* c2 = new TCanvas("c2", "c2", 0, 0, 600, 400); - c2->cd(); - histoStyle->cd(); - for (int ih = 0; ih < (NStations + 1) * TL1TrackParameters::NParameters; ih++) { - makeUpHisto(histoPull[ih], histoPull[ih]->GetName(), pulls[ih][0]); - pulls[ih][1] = histoPull[ih]->GetRMS(); - if (draw) { - histoPull[ih]->Draw(); - TString name = histoPull[ih]->GetName(); - name += ".pdf"; - c2->SaveAs(name); - } - } - for (int ih = 0; ih < (0 + 1) * TL1TrackParameters::NParameters; ih++) { - makeUpHisto(histoRes[ih], histoRes[ih]->GetName(), residuals[ih][0]); - residuals[ih][1] = histoRes[ih]->GetRMS(); - if (draw) { - histoRes[ih]->Draw(); - TString name = histoRes[ih]->GetName(); - name += ".pdf"; - c2->SaveAs(name); - } - } - chdir(".."); - - // --- print information --- - LOG(info) << "All entries: " << fNAllPulls; - LOG(info) << "Correct entries: " << fGPulls.size(); - LOG(info) << "Pulls sigma & RMS: "; - for (int ih = 0; ih < (NStations + 1) * TL1TrackParameters::NParameters; ih++) { - int ipar = ih % TL1TrackParameters::NParameters; - int ista = ih / TL1TrackParameters::NParameters; - if ((ista > 0) && (ipar == 0)) LOG(info) << "Station " << ista - 1; - LOG(info) << L1TrackParametersNames[ipar] << "\t" << pulls[ih][0] << "\t" << pulls[ih][1]; - } - LOG(info) << "Residuals sigma & RMS: "; - for (int ih = 0; ih < (0 + 1) * TL1TrackParameters::NParameters; ih++) { - int ipar = ih % TL1TrackParameters::NParameters; - LOG(info) << L1TrackParametersNames[ipar] << "\t" << residuals[ih][0] << "\t" << residuals[ih][1]; - } -} - -void L1AlgoPulls::makeUpHisto(TH1* hist, TString title, float& sigma) -{ - if (hist && (hist->GetEntries() != 0)) { - TF1* fit = new TF1("fit", "gaus"); - fit->SetLineColor(2); - fit->SetLineWidth(3); - hist->Fit("fit", "", "", hist->GetXaxis()->GetXmin(), hist->GetXaxis()->GetXmax()); - sigma = fit->GetParameter(2); - - hist->GetXaxis()->SetLabelFont(textFont); - hist->GetXaxis()->SetTitleFont(textFont); - hist->GetYaxis()->SetLabelFont(textFont); - hist->GetYaxis()->SetTitleFont(textFont); - - hist->GetXaxis()->SetTitle(title); - hist->GetXaxis()->SetTitleOffset(1); - hist->GetYaxis()->SetTitle("Entries"); - hist->GetYaxis()->SetTitleOffset(1.05); // good then entries per bit <= 9999 - } - else { - LOG(info) << " E: Read hists error! "; - } -} diff --git a/reco/L1/L1Algo/utils/L1AlgoPulls.h b/reco/L1/L1Algo/utils/L1AlgoPulls.h deleted file mode 100644 index 28fd094259..0000000000 --- a/reco/L1/L1Algo/utils/L1AlgoPulls.h +++ /dev/null @@ -1,128 +0,0 @@ -/* Copyright (C) 2010-2017 Frankfurt Institute for Advanced Studies, Goethe-Universität Frankfurt, Frankfurt - SPDX-License-Identifier: GPL-3.0-only - Authors: Igor Kulakov [committer] */ - -#ifndef L1AlgoPulls_h -#define L1AlgoPulls_h - -// #define BUILD_HISTO_FOR_EACH_STANTION - -#ifdef BUILD_HISTO_FOR_EACH_STANTION -const int NStations = 8; -#else -const int NStations = 0; -#endif // BUILD_HISTO_FOR_EACH_STANTION - - -#include "CbmL1.h" -#include "KfTrackParam.h" -#include "TCanvas.h" -#include "TF1.h" -#include "TStyle.h" - -#include <iostream> -#include <sstream> -#include <vector> - -using std::vector; - -struct TL1TrackParameters { - double x{0.}, y{0.}, tx{0.}, ty{0.}, qp{0.}; - - static constexpr int NParameters = 5; - - TL1TrackParameters(){}; - - TL1TrackParameters(cbm::algo::kf::TrackParamV& T, int i) - : x(T.GetX()[i]) - , y(T.GetY()[i]) - , tx(T.GetTx()[i]) - , ty(T.GetTy()[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(const cbm::ca::tools::MCPoint& T) - : x(T.GetX()) - , y(T.GetY()) - , tx(T.GetTx()) - , ty(T.GetTy()) - , qp(T.GetQp()){}; - - double operator[](int i) - { - switch (i) { - case 0: return x; - case 1: return y; - case 2: return tx; - case 3: return ty; - case 4: return qp; - default: return 0.f; - }; - } - - TL1TrackParameters operator-(TL1TrackParameters& b) - { - TL1TrackParameters c; - c.x = x - b.x; - c.y = y - b.y; - c.tx = tx - b.tx; - c.ty = ty - b.ty; - c.qp = qp - b.qp; - return c; - } - - TL1TrackParameters operator/(TL1TrackParameters& b) - { - TL1TrackParameters c; - c.x = x / b.x; - c.y = y / b.y; - c.tx = tx / b.tx; - c.ty = ty / b.ty; - c.qp = qp / b.qp; - return c; - } - - std::string ToString() const - { - std::stringstream ss; - ss << x << " " << y << " " << tx << " " << ty << " " << qp; - return ss.str(); - } -}; - -class L1AlgoPulls { - public: - L1AlgoPulls() = default; - - void Init(); - - // void AddVec(TrackParamV& T, ca::HitIndex_t ih); - void AddOne(cbm::algo::kf::TrackParamV& T, int i, ca::HitIndex_t ih); - std::string ToString() const; // fast method to see pulls :) - void Build(bool draw = 1); - - int fNAllPulls{0}; // number of AddOne calls - - 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}; - - 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}; -}; - - -#endif diff --git a/reco/littrack/cbm/qa/tof/CbmLitTofQa.cxx b/reco/littrack/cbm/qa/tof/CbmLitTofQa.cxx index b73a0e2b2c..05a80652cf 100644 --- a/reco/littrack/cbm/qa/tof/CbmLitTofQa.cxx +++ b/reco/littrack/cbm/qa/tof/CbmLitTofQa.cxx @@ -62,7 +62,6 @@ CbmLitTofQa::CbmLitTofQa() , fTofTracks(NULL) , fMCTracks(NULL) , fPrimVertex(NULL) - , fKFFitter() , fTrackCategories() , fTrackAcceptanceFunctions() , fMCTrackIdForTofHits() @@ -81,7 +80,6 @@ InitStatus CbmLitTofQa::Init() fHM = new CbmHistManager(); CreateHistograms(); ReadDataBranches(); - fKFFitter.Init(); return kSUCCESS; } @@ -259,8 +257,6 @@ void CbmLitTofQa::ProcessGlobalTracks() FairTrackParam vtxTrack; - // fKFFitter.FitToVertex(stsTrack, fPrimVertex, &vtxTrack); - // Double_t chiSqPrimary = fKFFitter.GetChiToVertex(stsTrack, fPrimVertex); float chiSqPrimary = 0.f; CbmKFParticleInterface::ExtrapolateTrackToPV(stsTrack, fPrimVertex, &vtxTrack, chiSqPrimary); diff --git a/reco/littrack/cbm/qa/tof/CbmLitTofQa.h b/reco/littrack/cbm/qa/tof/CbmLitTofQa.h index 86f9770d78..0c3068399e 100644 --- a/reco/littrack/cbm/qa/tof/CbmLitTofQa.h +++ b/reco/littrack/cbm/qa/tof/CbmLitTofQa.h @@ -12,8 +12,6 @@ #ifndef CBMLITTOFQA_H_ #define CBMLITTOFQA_H_ -#include "CbmStsKFTrackFitter.h" - #include "FairTask.h" #include <map> @@ -25,6 +23,7 @@ class CbmHistManager; class CbmVertex; class FairTrackParam; class CbmMCDataArray; +class TClonesArray; using std::map; using std::pair; @@ -128,7 +127,6 @@ private: CbmMCDataArray* fMCTracks; // CbmMCTrack array CbmVertex* fPrimVertex; // Pointer to the primary vertex - CbmStsKFTrackFitter fKFFitter; // Pointer to the Kalman Filter Fitter algorithm vector<string> fTrackCategories; // Vector of track category names -- GitLab