diff --git a/macro/mcbm/mcbm_reco_event.C b/macro/mcbm/mcbm_reco_event.C index db3ceb89e86cfac5f192aca6f3f6c8931225b967..6d09f3debbc41640e063459359e83d605fa697b8 100644 --- a/macro/mcbm/mcbm_reco_event.C +++ b/macro/mcbm/mcbm_reco_event.C @@ -18,7 +18,8 @@ void mcbm_reco_event(Int_t nEvents = 10, TString dataset = "data/test", - const char* setupName = "mcbm_beam_2022_03_09_carbon") + const char* setupName = "mcbm_beam_2022_03_09_carbon", + Bool_t debugWithMC = false) { // ======================================================================== // Adjust this part according to your requirements @@ -39,10 +40,13 @@ void mcbm_reco_event(Int_t nEvents = 10, TString dataset = "data/test", TString rawFile = dataset + ".event.raw.root"; TString parFile = dataset + ".par.root"; TString recFile = dataset + ".rec.root"; + TString traFile = dataset + ".tra.root"; // ------------------------------------------------------------------------ Int_t iTofCluMode = 1; - + if (debugWithMC) { + Int_t iTrackMode = 1; + } // ----- Load the geometry setup ------------------------------------- std::cout << std::endl; TString setupFile = srcDir + "/geometry/setup/setup_" + setupName + ".C"; @@ -102,6 +106,7 @@ void mcbm_reco_event(Int_t nEvents = 10, TString dataset = "data/test", FairRunAna* run = new FairRunAna(); FairFileSource* inputSource = new FairFileSource(rawFile); + if (debugWithMC) { inputSource->AddFriend(traFile); } run->SetSource(inputSource); @@ -110,6 +115,14 @@ void mcbm_reco_event(Int_t nEvents = 10, TString dataset = "data/test", Bool_t hasFairMonitor = kFALSE; //Has_Fair_Monitor(); if (hasFairMonitor) FairMonitor::GetMonitor()->EnableMonitor(kTRUE); // ------------------------------------------------------------------------ + + // ----- MCDataManager ------------------------------------------------- + if (debugWithMC) { + CbmMCDataManager* mcManager = new CbmMCDataManager("MCDataManager", 1); + mcManager->AddFile(traFile); + run->AddTask(mcManager); + } + // ------------------------------------------------------------------------ // ----- Logger settings ---------------------------------------------- FairLogger::GetLogger()->SetLogScreenLevel(logLevel.Data()); @@ -164,6 +177,11 @@ void mcbm_reco_event(Int_t nEvents = 10, TString dataset = "data/test", std::cout << "Using parameter file " << parFile << std::endl; } + // --- Initialization of the digi scheme + auto muchGeoScheme = CbmMuchGeoScheme::Instance(); + if (!muchGeoScheme->IsInitialized()) { + muchGeoScheme->Init(parFile, muchFlag); + } // --- Hit finder for GEMs FairTask* muchHitGem = new CbmMuchFindHitsGem(parFile.Data(), muchFlag); @@ -346,14 +364,22 @@ void mcbm_reco_event(Int_t nEvents = 10, TString dataset = "data/test", // run->AddTask(tofFindTracks); // ------------------------------------------------------------------------ - + if (debugWithMC) { + CbmMatchRecoToMC* match1 = new CbmMatchRecoToMC(); + run->AddTask(match1); + } // ------------------------------------------------------------------------ // -------- L1 CA Track Finder --------------------------------------- - CbmKF* kalman = new CbmKF(); - run->AddTask(kalman); - CbmL1* l1 = new CbmL1(); + // Geometry interface initializer for tracker + auto trackerIF = new CbmTrackerDetInitializer(); + + // Kalman filter + auto kalman = new CbmKF(); + + // L1 tracking + auto l1 = (debugWithMC) ? new CbmL1("L1", 1, 3) : new CbmL1(); l1->SetLegacyEventMode(1); l1->SetMcbmMode(); l1->SetUseHitErrors(1); @@ -412,6 +438,8 @@ void mcbm_reco_event(Int_t nEvents = 10, TString dataset = "data/test", l1->SetTofMaterialBudgetFileName(parFile.Data()); } + run->AddTask(trackerIF); + run->AddTask(kalman); run->AddTask(l1); CbmL1GlobalTrackFinder* globalTrackFinder = new CbmL1GlobalTrackFinder(); diff --git a/macro/run/run_reco.C b/macro/run/run_reco.C index 8b4368d6922459134b70b5a3a950297999cad568..b7125d5336c81b8b76f0aa855af55d00130a7051 100644 --- a/macro/run/run_reco.C +++ b/macro/run/run_reco.C @@ -374,10 +374,11 @@ void run_reco(TString input = "", Int_t nTimeSlices = -1, Int_t firstTimeSlice = // ----- Track finding in STS (+ MVD) -------------------------------- if (useMvd || useSts) { // Geometry interface initializer for tracker - auto trackerIF = new CbmTrackerDetInitializer(); + run->AddTask(new CbmTrackerDetInitializer()); // Kalman filter auto kalman = new CbmKF(); + run->AddTask(kalman); // L1 tracking auto l1 = (debugWithMC) ? new CbmL1("L1", 2, 3) : new CbmL1("L1", 0); @@ -398,8 +399,6 @@ void run_reco(TString input = "", Int_t nTimeSlices = -1, Int_t firstTimeSlice = l1->SetStsMaterialBudgetFileName(parFile.Data()); } - run->AddTask(trackerIF); - run->AddTask(kalman); run->AddTask(l1); std::cout << "-I- " << myName << ": Added task " << l1->GetName() << std::endl; diff --git a/reco/L1/CbmMuchTrackerIF.cxx b/reco/KF/CbmMuchTrackerIF.cxx similarity index 96% rename from reco/L1/CbmMuchTrackerIF.cxx rename to reco/KF/CbmMuchTrackerIF.cxx index d605c605c087bc89bacb2aefb7266d0f3bac589b..0566beeb055d8dbcf37835805655241cbade5a45 100644 --- a/reco/L1/CbmMuchTrackerIF.cxx +++ b/reco/KF/CbmMuchTrackerIF.cxx @@ -10,7 +10,6 @@ ***************************************************************************************************/ #include "CbmMuchTrackerIF.h" -#include "CbmMuchGeoScheme.h" #include "CbmMuchModuleGem.h" #include "CbmMuchPad.h" #include "CbmMuchStation.h" @@ -46,7 +45,7 @@ double CbmMuchTrackerIF::GetTimeResolution(int /*stationId*/) const { return 3.9 // double CbmMuchTrackerIF::GetZ(int stationId) const { - return fGeoScheme->GetStation(GetMuchStationId(stationId))->GetLayer(GetMuchLayerId(stationId))->GetZ(); + return GetMuchLayer(stationId)->GetZ(); } //------------------------------------------------------------------------------------------------------------------------------------- @@ -94,7 +93,7 @@ int CbmMuchTrackerIF::GetNtrackingStations() const // double CbmMuchTrackerIF::GetThickness(int stationId) const { - return fGeoScheme->GetStation(GetMuchStationId(stationId))->GetLayer(GetMuchLayerId(stationId))->GetDz(); + return GetMuchLayer(stationId)->GetDz(); } //------------------------------------------------------------------------------------------------------------------------------------- diff --git a/reco/L1/CbmMuchTrackerIF.h b/reco/KF/CbmMuchTrackerIF.h similarity index 93% rename from reco/L1/CbmMuchTrackerIF.h rename to reco/KF/CbmMuchTrackerIF.h index d593aacc7f563924b8c17f2e2c005cddbf5aaded..04b43a04a26a4f78b9ca4de3a8902f1bfeae3ab0 100644 --- a/reco/L1/CbmMuchTrackerIF.h +++ b/reco/KF/CbmMuchTrackerIF.h @@ -13,13 +13,14 @@ #define CbmMuchTrackerIF_h 1 #include "L1TrackerInterfaceBase.h" +#include "CbmMuchGeoScheme.h" #include "FairTask.h" #include <iostream> #include <vector> #include "TString.h" -class CbmMuchGeoScheme; +class CbmMuchLayer; /// Class CbmMuchTrackerIF is a CbmL1 subtask, which provides necessary methods for L1 tracker /// to access the geometry and dataflow settings. @@ -127,6 +128,12 @@ private: /// Calculates MuCh layer ID from tracker station ID __attribute__((always_inline)) int GetMuchLayerId(int stationId) const { return stationId % 3; } + /// Gets pointer to the TRD module + /// \param stationId Tracking staton ID + /// \return Pointer to the particular CbmTrdParModDigi object + __attribute__((always_inline)) CbmMuchLayer* GetMuchLayer(int stationId) const { + return fGeoScheme->GetLayer(GetMuchStationId(stationId), GetMuchLayerId(stationId)); + } static CbmMuchTrackerIF* fpInstance; ///< Instance of the class diff --git a/reco/L1/CbmMvdTrackerIF.cxx b/reco/KF/CbmMvdTrackerIF.cxx similarity index 100% rename from reco/L1/CbmMvdTrackerIF.cxx rename to reco/KF/CbmMvdTrackerIF.cxx diff --git a/reco/L1/CbmMvdTrackerIF.h b/reco/KF/CbmMvdTrackerIF.h similarity index 100% rename from reco/L1/CbmMvdTrackerIF.h rename to reco/KF/CbmMvdTrackerIF.h diff --git a/reco/L1/CbmStsTrackerIF.cxx b/reco/KF/CbmStsTrackerIF.cxx similarity index 94% rename from reco/L1/CbmStsTrackerIF.cxx rename to reco/KF/CbmStsTrackerIF.cxx index 9b8b8f492996e6746408065f701ad865001862c2..efb623a5a01f7aaca0069a0a833371b2b5cf9f84 100644 --- a/reco/L1/CbmStsTrackerIF.cxx +++ b/reco/KF/CbmStsTrackerIF.cxx @@ -164,11 +164,13 @@ InitStatus CbmStsTrackerIF::ReInit() // void CbmStsTrackerIF::SetParContainers() { - LOG(info) << "\033[1;33mCALL CbmStsTrackerIF::SetParContainer()\033[0m"; auto runtimeDb = FairRunAna::Instance()->GetRuntimeDb(); fStsParSetModule = dynamic_cast<CbmStsParSetModule*>(runtimeDb->getContainer("CbmStsParSetModule")); fStsParSetSensor = dynamic_cast<CbmStsParSetSensor*>(runtimeDb->getContainer("CbmStsParSetSensor")); fStsParSetSensorCond = dynamic_cast<CbmStsParSetSensorCond*>(runtimeDb->getContainer("CbmStsParSetSensorCond")); + if (!fStsParSetModule) { LOG(fatal) << "CbmStsTrackerIF::SetParContainers: error accessing to CbmStsParSetModule container"; } + if (!fStsParSetSensor) { LOG(fatal) << "CbmStsTrackerIF::SetParContainers: error accessing to CbmStsParSetSensor container"; } + if (!fStsParSetSensorCond) { LOG(fatal) << "CbmStsTrackerIF::SetParContainers: error accessing to CbmStsParSetSensorCond container"; } } //------------------------------------------------------------------------------------------------------------------------------------- diff --git a/reco/L1/CbmStsTrackerIF.h b/reco/KF/CbmStsTrackerIF.h similarity index 100% rename from reco/L1/CbmStsTrackerIF.h rename to reco/KF/CbmStsTrackerIF.h diff --git a/reco/L1/CbmTrackerDetInitializer.cxx b/reco/KF/CbmTrackerDetInitializer.cxx similarity index 94% rename from reco/L1/CbmTrackerDetInitializer.cxx rename to reco/KF/CbmTrackerDetInitializer.cxx index ec138b0432bb4723acf08d992dc9133ca2eaac5c..d11a6fb03953b5b54dfba01f4cfd5f7cabc179a2 100644 --- a/reco/L1/CbmTrackerDetInitializer.cxx +++ b/reco/KF/CbmTrackerDetInitializer.cxx @@ -15,6 +15,7 @@ #include "CbmSetup.h" #include "CbmStsTrackerIF.h" #include "CbmTrackerDetInitializer.h" +#include "CbmTrdTrackerIF.h" #include <FairLogger.h> ClassImp(CbmTrackerDetInitializer) @@ -40,11 +41,13 @@ CbmTrackerDetInitializer::CbmTrackerDetInitializer() if (useMvd) { fpMvdTrackerIF = new CbmMvdTrackerIF(); } if (useSts) { fpStsTrackerIF = new CbmStsTrackerIF(); } if (useMuch) { fpMuchTrackerIF = new CbmMuchTrackerIF(); } + if (useTrd) { fpTrdTrackerIF = new CbmTrdTrackerIF(); } /** Add subtasks - tracker detector interfaces **/ if (useMvd) { this->Add(fpMvdTrackerIF); } if (useSts) { this->Add(fpStsTrackerIF); } if (useMuch) { this->Add(fpMuchTrackerIF); } + if (useTrd) { this->Add(fpTrdTrackerIF); } } } diff --git a/reco/L1/CbmTrackerDetInitializer.h b/reco/KF/CbmTrackerDetInitializer.h similarity index 95% rename from reco/L1/CbmTrackerDetInitializer.h rename to reco/KF/CbmTrackerDetInitializer.h index 0758482e17b81e86d2410716337f9fad4ee03fd7..2d4f76a066d2783338b747b0dadb63054a6b0919 100644 --- a/reco/L1/CbmTrackerDetInitializer.h +++ b/reco/KF/CbmTrackerDetInitializer.h @@ -16,6 +16,7 @@ class FairTask; class CbmMvdTrackerIF; class CbmStsTrackerIF; class CbmMuchTrackerIF; +class CbmTrdTrackerIF; /// Class CbmTrackerDetInitializer implements a task for the tracking detector interfaces initialization. /// The tracking detector interfaces are added as subtasks. The CbmTrackerDetInitializer class instance is to @@ -49,6 +50,7 @@ private: CbmMvdTrackerIF* fpMvdTrackerIF {nullptr}; ///< Instance of the MVD tracker interface CbmStsTrackerIF* fpStsTrackerIF {nullptr}; ///< Instance of the STS tracker interface CbmMuchTrackerIF* fpMuchTrackerIF {nullptr}; ///< Instance of the MuCh tracker interface + CbmTrdTrackerIF* fpTrdTrackerIF {nullptr}; ///< Instance of the TRD tracker interface ClassDef(CbmTrackerDetInitializer, 0); }; diff --git a/reco/KF/CbmTrdTrackerIF.cxx b/reco/KF/CbmTrdTrackerIF.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0478b18b43ada1a47d8a1e3fbc62929ca43b783e --- /dev/null +++ b/reco/KF/CbmTrdTrackerIF.cxx @@ -0,0 +1,179 @@ +/* Copyright (C) 2016-2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: Sergey Gorbunov, Sergei Zharko [committer] */ + +/*************************************************************************************************** + * @file CbmTrdTrackerIF.cxx + * @brief Input data and parameters interface from STS subsystem used in L1 tracker (definition) + * @since 31.05.2022 + * @author S.Zharko <s.zharko@gsi.de> + ***************************************************************************************************/ + +#include "CbmTrdTrackerIF.h" +#include "FairDetector.h" +#include "FairRunAna.h" +#include <FairLogger.h> +#include "TMath.h" +#include "TFile.h" +#include "TGeoManager.h" +#include "TString.h" + +ClassImp(CbmTrdTrackerIF) + +CbmTrdTrackerIF* CbmTrdTrackerIF::fpInstance = nullptr; + +//------------------------------------------------------------------------------------------------------------------------------------- +// +CbmTrdTrackerIF::CbmTrdTrackerIF() : FairTask("CbmTrdTrackerIF") +{ + if (!fpInstance) { fpInstance = this; } +} + +//------------------------------------------------------------------------------------------------------------------------------------- +// +CbmTrdTrackerIF::~CbmTrdTrackerIF() +{ + if (fpInstance == this) { fpInstance = nullptr; } +} + +//------------------------------------------------------------------------------------------------------------------------------------- +// +double CbmTrdTrackerIF::GetTimeResolution(int /*stationId*/) const { return 10.; } + +//------------------------------------------------------------------------------------------------------------------------------------- +// +double CbmTrdTrackerIF::GetZ(int stationId) const +{ + return GetTrdModulePar(stationId)->GetZ(); +} + +//------------------------------------------------------------------------------------------------------------------------------------- +// +double CbmTrdTrackerIF::GetXmax(int stationId) const +{ + return GetTrdModulePar(stationId)->GetSizeX(); +} + +//------------------------------------------------------------------------------------------------------------------------------------- +// +double CbmTrdTrackerIF::GetYmax(int stationId) const +{ + return GetTrdModulePar(stationId)->GetSizeY(); +} + +//------------------------------------------------------------------------------------------------------------------------------------- +// +double CbmTrdTrackerIF::GetRmin(int /*stationId*/) const +{ + return 0.; +} + +//------------------------------------------------------------------------------------------------------------------------------------- +// +double CbmTrdTrackerIF::GetRmax(int stationId) const +{ + return 2. * this->GetXmax(stationId); +} + +//------------------------------------------------------------------------------------------------------------------------------------- +// +int CbmTrdTrackerIF::GetNtrackingStations() const +{ + // NOTE: For TRD detector subsystem, a TRD layer is assigned as a tracking station: + int nTrdLayers = 0; + auto topNodes = gGeoManager->GetTopNode()->GetNodes(); + for (int iTopNode = 0; iTopNode < topNodes->GetEntriesFast(); ++iTopNode) { + auto topNode = static_cast<TGeoNode*>(topNodes->At(iTopNode)); + if (TString(topNode->GetName()).Contains("trd")) { + auto layers = topNode->GetNodes(); + for (int iLayer = 0; iLayer < layers->GetEntriesFast(); ++iLayer) { + auto layer = static_cast<TGeoNode*>(layers->At(iLayer)); + if (TString(layer->GetName()).Contains("layer")) { ++nTrdLayers; } + } + } + } + return nTrdLayers; +} + +//------------------------------------------------------------------------------------------------------------------------------------- +// +double CbmTrdTrackerIF::GetThickness(int stationId) const +{ + return 2. * GetTrdModulePar(stationId)->GetSizeZ(); +} + +//------------------------------------------------------------------------------------------------------------------------------------- +// +double CbmTrdTrackerIF::GetRadLength(int /*stationId*/) const +{ + return 1.6; +} + +//------------------------------------------------------------------------------------------------------------------------------------- +// +double CbmTrdTrackerIF::GetStripsStereoAngleFront(int /*stationId*/) const +{ + return 0.; +} + +//------------------------------------------------------------------------------------------------------------------------------------- +// +double CbmTrdTrackerIF::GetStripsStereoAngleBack(int /*stationId*/) const +{ + return TMath::Pi() / 2.; +} + +//------------------------------------------------------------------------------------------------------------------------------------- +// +double CbmTrdTrackerIF::GetStripsSpatialRmsFront(int /*stationId*/) const +{ + return 0.15; +} + + +//------------------------------------------------------------------------------------------------------------------------------------- +// +double CbmTrdTrackerIF::GetStripsSpatialRmsBack(int /*stationId*/) const +{ + return 0.15; +} + +//------------------------------------------------------------------------------------------------------------------------------------- +// +bool CbmTrdTrackerIF::IsTimeInfoProvided(int /*stationId*/) const { return true; } + + +//------------------------------------------------------------------------------------------------------------------------------------- +// +InitStatus CbmTrdTrackerIF::Init() +{ + // Check access to TRD modules + for (int iSt = 0; iSt < this->GetNtrackingStations(); ++iSt) { + if (!dynamic_cast<CbmTrdParModDigi*>(fTrdDigiPar->GetModulePar(fTrdDigiPar->GetModuleId(iSt)))) { + LOG(fatal) << "CbmTrdTrackerIF::Init: error accessing the TRD tracking station " << iSt + << " (failed dynamic cast to CbmTrdParModDigi)"; + } + } + + return kSUCCESS; +} + +//------------------------------------------------------------------------------------------------------------------------------------- +// +InitStatus CbmTrdTrackerIF::ReInit() +{ + this->SetParContainers(); + return Init(); +} + +//------------------------------------------------------------------------------------------------------------------------------------- +// +void CbmTrdTrackerIF::SetParContainers() +{ + auto runtimeDb = FairRunAna::Instance()->GetRuntimeDb(); + fTrdDigiPar = dynamic_cast<CbmTrdParSetDigi*>(runtimeDb->getContainer("CbmTrdParSetDigi")); + if (!fTrdDigiPar) { LOG(fatal) << "CbmTrdTrackerIF::SetParContainers: error accessing to CbmTrdParSetDigi container"; } +} + +//------------------------------------------------------------------------------------------------------------------------------------- +// diff --git a/reco/KF/CbmTrdTrackerIF.h b/reco/KF/CbmTrdTrackerIF.h new file mode 100644 index 0000000000000000000000000000000000000000..a7bac2b465e55da3893681e2e03e74e17bb55230 --- /dev/null +++ b/reco/KF/CbmTrdTrackerIF.h @@ -0,0 +1,139 @@ +/* Copyright (C) 2016-2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: Sergey Gorbunov, Sergei Zharko [committer] */ + +/*************************************************************************************************** + * @file CbmTrdTrackerIF.h + * @brief Input data and parameters interface from MVD subsystem used in L1 tracker (declaration) + * @since 31.05.2022 + * @author S.Zharko <s.zharko@gsi.de> + ***************************************************************************************************/ + +#ifndef CbmTrdTrackerIF_h +#define CbmTrdTrackerIF_h 1 + +#include "CbmTrdParModDigi.h" +#include "CbmTrdParSetDigi.h" +#include "L1TrackerInterfaceBase.h" +#include "FairTask.h" + +#include <iostream> +#include <vector> +#include "TString.h" + +/// Class CbmTrdTrackerIF is a CbmL1 subtask, which provides necessary methods for L1 tracker +/// to access the geometry and dataflow settings. +/// +/// NOTE: For TRD one tracking station is a TRD module! +/// +class CbmTrdTrackerIF: public FairTask, public L1TrackerInterfaceBase { +public: + /// Default constructor + CbmTrdTrackerIF(); + + /// Destructor + ~CbmTrdTrackerIF(); + + /// FairTask: Init method + InitStatus Init(); + + /// FairTask: ReInit method + InitStatus ReInit(); + + /// Gets pointer to the instance of the CbmTrdTrackerIF + static CbmTrdTrackerIF* Instance() { return fpInstance; } + + /// Gets actual number of tracking stations, provided by the current geometry setup + int GetNtrackingStations() const; + + /// Gets time resolution for a station + /// \param stationId Tracking station ID in the setup (NOTE: must be in range [0..GetNstations()-1]) + /// \return Time resolution [ns] + double GetTimeResolution(int stationId) const; + + /// Gets z component of the station position + /// \param stationId Tracking station ID in the setup (NOTE: must be in range [0..GetNstations()-1]) + /// \return Z position of station [cm] + double GetZ(int stationId) const; + + /// Gets max size of a station along the X-axis + /// \param stationId Tracking station ID in the setup (NOTE: must be in range [0..GetNstations()-1]) + /// \return Size of station along the X-axis [cm] + double GetXmax(int stationId) const; + + /// Gets max size of a station along the Y-axis + /// \param stationId Tracking station ID in the setup (NOTE: must be in range [0..GetNstations()-1]) + /// \return Size of station along the Y-axis [cm] + double GetYmax(int stationId) const; + + /// Gets size of inner radius of station + /// \param stationId Tracking station ID in the setup (NOTE: must be in range [0..GetNstations()-1]) + /// \return Size of station inner radius [cm] + double GetRmin(int stationId) const; + + /// Gets size of outer radius of station + /// \param stationId Tracking station ID in the setup (NOTE: must be in range [0..GetNstations()-1]) + /// \return Size of station outer radius [cm] + double GetRmax(int stationId) const; + + /// Gets station thickness along the Z-axis + /// \param stationId Tracking station ID in the setup (NOTE: must be in range [0..GetNstations()-1]) + /// \return Station thickness [cm] + double GetThickness(int stationId) const; + + /// Gets station radiation length + /// \param stationId Tracking station ID in the setup (NOTE: must be in range [0..GetNstations()-1]) + /// \return Radiation length [cm] + double GetRadLength(int stationId) const; + + /// Gets front strips stereo angle + /// \param stationId Tracking station ID in the setup (NOTE: must be in range [0..GetNstations()-1]) + /// \return Absolute stereo angle for front strips [rad] + double GetStripsStereoAngleFront(int stationId) const; + + /// Gets back strips stereo angle + /// \param stationId Tracking station ID in the setup (NOTE: must be in range [0..GetNstations()-1]) + /// \return Absolute stereo angle for back strips [rad] + double GetStripsStereoAngleBack(int stationId) const; + + /// Gets spatial resolution (RMS) for front strips + /// \param stationId Tracking station ID in the setup (NOTE: must be in range [0..GetNstations()-1]) + /// \return Spatial resolution (RMS) for front strips [cm] + double GetStripsSpatialRmsFront(int stationId) const; + + /// Gets spatial resolution (RMS) for back strips + /// \param stationId Tracking station ID in the setup (NOTE: must be in range [0..GetNstations()-1]) + /// \return Spatial resolution (RMS) for front strips [cm] + double GetStripsSpatialRmsBack(int stationId) const; + + /// Check if station provides time measurements + /// \param stationId Tracking station ID in the setup (NOTE: must be in range [0..GetNstations()-1]) + /// \return Flag: true - station provides time measurements, false - station does not provide time measurements + bool IsTimeInfoProvided(int stationId) const; + + /// FairTask: sets parameter containers up + void SetParContainers(); + + /// Copy and move constructers and assign operators are prohibited + CbmTrdTrackerIF(const CbmTrdTrackerIF&) = delete; + CbmTrdTrackerIF(CbmTrdTrackerIF&&) = delete; + CbmTrdTrackerIF& operator=(const CbmTrdTrackerIF&) = delete; + CbmTrdTrackerIF& operator=(CbmTrdTrackerIF&&) = delete; + +private: + /// Gets pointer to the TRD module + /// \param moduleId Id of the Trd module + /// \return Pointer to the particular CbmTrdParModDigi object + __attribute__((always_inline)) CbmTrdParModDigi* GetTrdModulePar(int moduleId) const { + return static_cast<CbmTrdParModDigi*>(fTrdDigiPar->GetModulePar(fTrdDigiPar->GetModuleId(moduleId))); + } + + static CbmTrdTrackerIF* fpInstance; ///< Instance of the class + + CbmTrdParSetDigi* fTrdDigiPar {nullptr}; + //CbmTrdParModDigi* fTrdModuleInfo {nullptr}; + + ClassDef(CbmTrdTrackerIF, 0); +}; + +#endif // CbmTrdTrackerIF diff --git a/reco/KF/KF.cmake b/reco/KF/KF.cmake index 53477deb37f0a6c28dd744143e52a9b9897fa3d2..667ac72c63501eba166e5444f20f12ad764f3f09 100644 --- a/reco/KF/KF.cmake +++ b/reco/KF/KF.cmake @@ -28,6 +28,11 @@ ${CBMDETECTORBASE_DIR}/sts #${CBMROOT_SOURCE_DIR}/reco/L1/ParticleFinder ${CBMROOT_SOURCE_DIR}/mvd + +${CBMDETECTORBASE_DIR}/much # TMP for tracker interface +${CBMDETECTORBASE_DIR}/trd # TMP for tracker interface +${CBMROOT_SOURCE_DIR}/sim/transport/steer # TMP for tracker interface +${CBMROOT_SOURCE_DIR}/sim/transport/geosetup # TMP for tracker interface ) Include_Directories( ${INCLUDE_DIRECTORIES}) @@ -60,6 +65,15 @@ CbmKFSecondaryVertexFinder.cxx CbmKFTrackInterface.cxx CbmKFUMeasurement.cxx CbmKFVertexInterface.cxx + +#### Tracker interfaces (will be moved to core/detector/*) ################ +CbmStsTrackerIF.cxx # TMP: Should be placed to the detector directory! +CbmMvdTrackerIF.cxx # TMP: Should be placed to the detector directory! +CbmMuchTrackerIF.cxx # TMP: Should be placed to the detector directory! +CbmTrdTrackerIF.cxx # TMP: Should be placed to the detector directory! +CbmTrackerDetInitializer.cxx +########################################################################### + #Interface/CbmEcalTrackExtrapolationKF.cxx Interface/CbmKFStsHit.cxx Interface/CbmKFTrack.cxx @@ -98,6 +112,16 @@ CbmKFSecondaryVertexFinder.h CbmKFTrackInterface.h CbmKFUMeasurement.h CbmKFVertexInterface.h + +#### Tracker interfaces (will be moved to core/detector/*) ################ +CbmStsTrackerIF.h # TMP: Should be placed to the detector directory! +CbmMvdTrackerIF.h # TMP: Should be placed to the detector directory! +CbmMuchTrackerIF.h # TMP: Should be placed to the detector directory! +CbmTrdTrackerIF.h # TMP: Should be placed to the detector directory! +CbmTrackerDetInitializer.h +L1TrackerInterfaceBase.h # TMP: Should be placed to the detector directory! +########################################################################### + #Interface/CbmEcalTrackExtrapolationKF.h Interface/CbmKFStsHit.h Interface/CbmKFTrack.h @@ -159,7 +183,7 @@ ENDIF (SSE_FOUND) set(LINKDEF KFLinkDef.h) Set(LIBRARY_NAME KF) Set(DEPENDENCIES - CbmStsBase CbmMvd CbmBase CbmRecoBase CbmData Base Vc.a Minuit2 + CbmStsBase CbmMvd CbmBase CbmRecoBase CbmMuchBase CbmData Base Vc.a Minuit2 ) Set(DEFINITIONS -DDO_TPCCATRACKER_EFF_PERFORMANCE -DNonhomogeneousField -DCBM -DUSE_TIMERS) diff --git a/reco/KF/KFLinkDef.h b/reco/KF/KFLinkDef.h index ee46f84a6f7ccc7429d30978d0e626fa25cfe286..a8f93ff1843f94299cc64370bbab54bcb2f76cd7 100644 --- a/reco/KF/KFLinkDef.h +++ b/reco/KF/KFLinkDef.h @@ -37,6 +37,11 @@ #pragma link C++ class CbmTofTrackFitterKF + ; #pragma link C++ class CbmGlobalTrackFitterKF + ; +#pragma link C++ class CbmTrackerDetInitializer + ; +#pragma link C++ class CbmMvdTrackerIF + ; +#pragma link C++ class CbmStsTrackerIF + ; +#pragma link C++ class CbmMuchTrackerIF + ; +#pragma link C++ class CbmTrdTrackerIF + ; //KFQA /* #pragma link C++ class CbmKFPartEfficiencies + ; diff --git a/reco/L1/L1TrackerInterfaceBase.h b/reco/KF/L1TrackerInterfaceBase.h similarity index 100% rename from reco/L1/L1TrackerInterfaceBase.h rename to reco/KF/L1TrackerInterfaceBase.h diff --git a/reco/L1/CMakeLists.txt b/reco/L1/CMakeLists.txt index 57d905c8fe69aeda69b88fcfe62c06c6a48912c6..879ca5f061fc35292d9503540a4f3cfd1e86bbb4 100644 --- a/reco/L1/CMakeLists.txt +++ b/reco/L1/CMakeLists.txt @@ -110,10 +110,6 @@ CbmL1.cxx #CbmL1TrdTrackFinderSts.cxx CbmL1TrackMerger.cxx CbmL1TofMerger.cxx -CbmStsTrackerIF.cxx # TMP: Should be placed to the detector directory! -CbmMvdTrackerIF.cxx # TMP: Should be placed to the detector directory! -CbmMuchTrackerIF.cxx # TMP: Should be placed to the detector directory! -CbmTrackerDetInitializer.cxx L1AlgoInputData.cxx OffLineInterface/CbmL1RichENNRingFinder.cxx OffLineInterface/CbmL1RichENNRingFinderParallel.cxx @@ -175,11 +171,6 @@ CbmL1TrackMerger.h CbmL1TrackPar.h CbmL1TrdHit.h #CbmL1TrdTrackFinderSts.h -L1TrackerInterfaceBase.h # TMP: Should be placed to the detector directory! -CbmStsTrackerIF.h # TMP: Should be placed to the detector directory! -CbmMvdTrackerIF.h # TMP: Should be placed to the detector directory! -CbmMuchTrackerIF.h # TMP: Should be placed to the detector directory! -CbmTrackerDetInitializer.h CbmL1TrdTracklet4.h CbmL1TrdTracklet.h CbmL1Vtx.h @@ -197,7 +188,6 @@ OffLineInterface/CbmL1GlobalFindTracksEvents.h #OffLineInterface / CbmL1SttTrack.h L1Algo/L1Def.h L1Algo/L1Vector.h - qa/CbmTrackerInputQaTrd.h ) diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index a70ed82e20a0152b577bb140093e0c1bde469ce3..596035d88e5a950ea4a9659165917a931c019a3b 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -24,14 +24,11 @@ #include "CbmKFVertex.h" #include "CbmL1PFFitter.h" #include "CbmMCDataManager.h" -#include "CbmMuchGeoScheme.h" -#include "CbmMuchModuleGem.h" -#include "CbmMuchPad.h" -#include "CbmMuchStation.h" #include "CbmSetup.h" #include "CbmMvdTrackerIF.h" #include "CbmStsTrackerIF.h" #include "CbmMuchTrackerIF.h" +#include "CbmTrdTrackerIF.h" #include <boost/filesystem.hpp> // TODO: include of CbmSetup.h creates problems on Mac @@ -42,8 +39,6 @@ #include "CbmTofCell.h" #include "CbmTofDigiBdfPar.h" #include "CbmTofDigiPar.h" // in tof/TofParam -#include "CbmTrdParModDigi.h" // for CbmTrdModule -#include "CbmTrdParSetDigi.h" // for CbmTrdParSetDigi #include "CbmTrackerDetInitializer.h" #include "FairEventHeader.h" @@ -137,8 +132,6 @@ void CbmL1::SetParContainers() FairRuntimeDb* rtdb = ana->GetRuntimeDb(); fDigiPar = (CbmTofDigiPar*) (rtdb->getContainer("CbmTofDigiPar")); // fTrdDigiPar = (CbmTrdDigiPar*)(FairRunAna::Instance()->GetRuntimeDb()->getContainer("CbmTrdDigiPar")); - fTrdDigiPar = (CbmTrdParSetDigi*) (rtdb->getContainer("CbmTrdParSetDigi")); - fTofDigiBdfPar = (CbmTofDigiBdfPar*) (rtdb->getContainer("CbmTofDigiBdfPar")); rtdb->initContainers(ana->GetRunId()); // needed to get tracking stations for ToF hits @@ -426,23 +419,23 @@ InitStatus CbmL1::Init() //} /*** TRD ***/ - if (fUseTRD) { - Int_t layerCounter = 0; - TObjArray* topNodes = gGeoManager->GetTopNode()->GetNodes(); - for (Int_t iTopNode = 0; iTopNode < topNodes->GetEntriesFast(); iTopNode++) { - TGeoNode* topNode = static_cast<TGeoNode*>(topNodes->At(iTopNode)); - if (TString(topNode->GetName()).Contains("trd")) { - 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++; } - } - } - } - NTrdStationsGeom = layerCounter; - //if ((fTrackingMode == L1Algo::TrackingMode::kMcbm) && (fMissingHits)) { NTrdStationsGeom = NTrdStationsGeom - 1; } - LOG(info) << " NTrdStations " << NTrdStationsGeom; - } + //if (fUseTRD) { + // Int_t layerCounter = 0; + // TObjArray* topNodes = gGeoManager->GetTopNode()->GetNodes(); + // for (Int_t iTopNode = 0; iTopNode < topNodes->GetEntriesFast(); iTopNode++) { + // TGeoNode* topNode = static_cast<TGeoNode*>(topNodes->At(iTopNode)); + // if (TString(topNode->GetName()).Contains("trd")) { + // 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++; } + // } + // } + // } + // NTrdStationsGeom = layerCounter; + // //if ((fTrackingMode == L1Algo::TrackingMode::kMcbm) && (fMissingHits)) { NTrdStationsGeom = NTrdStationsGeom - 1; } + // LOG(info) << " NTrdStations " << NTrdStationsGeom; + //} /*** ToF ***/ vector<float> TofStationZ; @@ -480,14 +473,16 @@ InitStatus CbmL1::Init() /*** MVD and STS ***/ - auto mvdInterface = CbmMvdTrackerIF::Instance(); - auto stsInterface = CbmStsTrackerIF::Instance(); + auto mvdInterface = CbmMvdTrackerIF::Instance(); + auto stsInterface = CbmStsTrackerIF::Instance(); auto muchInterface = CbmMuchTrackerIF::Instance(); + auto trdInterface = CbmTrdTrackerIF::Instance(); - NMvdStationsGeom = (fUseMVD) ? mvdInterface->GetNtrackingStations() : 0; - NStsStationsGeom = (fUseSTS) ? stsInterface->GetNtrackingStations() : 0; + NMvdStationsGeom = (fUseMVD) ? mvdInterface->GetNtrackingStations() : 0; + NStsStationsGeom = (fUseSTS) ? stsInterface->GetNtrackingStations() : 0; NMuchStationsGeom = (fUseMUCH) ? muchInterface->GetNtrackingStations() : 0; - NStationGeom = NMvdStationsGeom + NStsStationsGeom + NMuchStationsGeom + NTrdStationsGeom + NTOFStationGeom; + NTrdStationsGeom = (fUseTRD) ? trdInterface->GetNtrackingStations() : 0; + NStationGeom = NMvdStationsGeom + NStsStationsGeom + NMuchStationsGeom + NTrdStationsGeom + NTOFStationGeom; // Provide crosscheck number of stations for the fpInitManagera fpInitManager->SetNstations(L1DetectorID::kMvd, NMvdStationsGeom); @@ -612,11 +607,11 @@ InitStatus CbmL1::Init() /*** MuCh stations info ***/ if (fUseMUCH) { for (int iSt = 0; iSt < NMuchStationsGeom; ++iSt) { - auto stationInfo = L1BaseStationInfo(L1DetectorID::kSts, iSt); + auto stationInfo = L1BaseStationInfo(L1DetectorID::kMuch, iSt); stationInfo.SetStationType(2); // MuCh stationInfo.SetTimeInfo(muchInterface->IsTimeInfoProvided(iSt)); stationInfo.SetTimeResolution(muchInterface->GetTimeResolution(iSt)); - stationInfo.SetFieldStatus(L1Algo::TrackingMode::kMcbm == fTrackingMode? 0 : 1); + stationInfo.SetFieldStatus(0); stationInfo.SetZ(muchInterface->GetZ(iSt)); stationInfo.SetXmax(muchInterface->GetXmax(iSt)); stationInfo.SetYmax(muchInterface->GetYmax(iSt)); @@ -640,27 +635,22 @@ InitStatus CbmL1::Init() /*** TRD stations info ***/ if (fUseTRD) { for (int iSt = 0; iSt < NTrdStationsGeom; ++iSt) { - int trdModuleID = fTrdDigiPar->GetModuleId(iSt); - CbmTrdParModDigi* module = (CbmTrdParModDigi*) fTrdDigiPar->GetModulePar(trdModuleID); - auto stationInfo = L1BaseStationInfo(L1DetectorID::kTrd, iSt); - int stationType = (iSt == 1 || iSt == 3) ? 6 : 3; // Is used somewhere?? - stationInfo.SetStationType(stationType); - stationInfo.SetTimeInfo(1); - stationInfo.SetTimeResolution(10.); + auto stationInfo = L1BaseStationInfo(L1DetectorID::kTrd, iSt); + stationInfo.SetStationType((iSt == 1 || iSt == 3) ? 6 : 3); // MuCh + stationInfo.SetTimeInfo(trdInterface->IsTimeInfoProvided(iSt)); + stationInfo.SetTimeResolution(trdInterface->GetTimeResolution(iSt)); stationInfo.SetFieldStatus(0); - stationInfo.SetZ(module->GetZ()); - auto thickness = 2. * module->GetSizeZ(); - auto radLength = 1.6; - stationInfo.SetMaterialSimple(thickness, radLength); + stationInfo.SetZ(trdInterface->GetZ(iSt)); + stationInfo.SetXmax(trdInterface->GetXmax(iSt)); + stationInfo.SetYmax(trdInterface->GetYmax(iSt)); + stationInfo.SetRmin(trdInterface->GetRmin(iSt)); + stationInfo.SetRmax(trdInterface->GetRmax(iSt)); + stationInfo.SetMaterialSimple(trdInterface->GetThickness(iSt), trdInterface->GetRadLength(iSt)); stationInfo.SetMaterialMap(std::move(materialTableTrd[iSt]), correctionTrd); - stationInfo.SetXmax(module->GetSizeX()); - stationInfo.SetYmax(module->GetSizeY()); - stationInfo.SetRmin(0.); - stationInfo.SetRmax(2. * module->GetSizeX()); // TODO: Why multiplied with 2.? - fscal trdFrontPhi = 0; - fscal trdBackPhi = TMath::Pi() / 2.; - fscal trdFrontSigma = 0.15; - fscal trdBackSigma = 0.15; + fscal trdFrontPhi = trdInterface->GetStripsStereoAngleFront(iSt); + fscal trdBackPhi = trdInterface->GetStripsStereoAngleBack(iSt); + fscal trdFrontSigma = trdInterface->GetStripsSpatialRmsFront(iSt); + fscal trdBackSigma = trdInterface->GetStripsSpatialRmsBack(iSt); if (L1Algo::TrackingMode::kGlobal == fTrackingMode) { //SGtrd2D!! trdFrontSigma = 1.1; trdBackSigma = 1.1; diff --git a/reco/L1/CbmL1.h b/reco/L1/CbmL1.h index 194bdf5da0a44bfdcae9032f7b7f641be02e2b21..eb4a137877b4300c4c53335e38e8d92248db700f 100644 --- a/reco/L1/CbmL1.h +++ b/reco/L1/CbmL1.h @@ -65,8 +65,6 @@ class CbmMCDataObject; class CbmEvent; class CbmTofDigiBdfPar; -class CbmTrdParSetDigi; -class CbmTrdParModDigi; class CbmTofDigiPar; class TProfile2D; @@ -467,9 +465,6 @@ private: //TRD - CbmTrdParSetDigi* fTrdDigiPar {nullptr}; //! - CbmTrdParModDigi* fTrdModuleInfo {nullptr}; //! - CbmMCDataArray* fTrdPoints {nullptr}; TClonesArray* listTrdHits {nullptr}; TClonesArray* fTrdHitMatches {nullptr}; diff --git a/reco/L1/L1LinkDef.h b/reco/L1/L1LinkDef.h index fe09c1a7ce7a75447ae892769dd30ee587730c60..aa220f0e37adf8e97793ad0b8fcfa29813bd9769 100644 --- a/reco/L1/L1LinkDef.h +++ b/reco/L1/L1LinkDef.h @@ -30,9 +30,5 @@ //#pragma link C++ class CbmL1SttTrackFinder+; //#pragma link C++ class CbmL1SttTrack+; #pragma link C++ class CbmTrackerInputQaTrd + ; -#pragma link C++ class CbmTrackerDetInitializer + ; -#pragma link C++ class CbmMvdTrackerIF + ; -#pragma link C++ class CbmStsTrackerIF + ; -#pragma link C++ class CbmMuchTrackerIF + ; #endif