diff --git a/core/detectors/tof/CMakeLists.txt b/core/detectors/tof/CMakeLists.txt index 913ecf876ce22cd5d041980a1287b9b25fa95fd4..8691eaa5cde62c235c29861fbb5a62157ac86612 100644 --- a/core/detectors/tof/CMakeLists.txt +++ b/core/detectors/tof/CMakeLists.txt @@ -1,6 +1,6 @@ set(INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR} - + ${CBMBASE_DIR} ${CBMDATA_DIR} ${CBMDATA_DIR}/tof ${CBMDATA_DIR}/raw @@ -30,6 +30,7 @@ set(SRCS CbmTofDigiPar.cxx CbmMcbm2018TofPar.cxx CbmTofGeoHandler.cxx + CbmTofTrackingInterface.cxx TTrbHeader.cxx ) diff --git a/core/detectors/tof/CbmTofBaseLinkDef.h b/core/detectors/tof/CbmTofBaseLinkDef.h index 302372dec126c60f1c962c8305f46eb076d2dc1f..7e799a3a83e432716ed6e511642c8c2ca4ba9f8b 100644 --- a/core/detectors/tof/CbmTofBaseLinkDef.h +++ b/core/detectors/tof/CbmTofBaseLinkDef.h @@ -16,6 +16,7 @@ #pragma link C++ class CbmMcbm2018TofPar + ; #pragma link C++ class CbmTofGeoHandler + ; #pragma link C++ class CbmMcbm2018BmonPar + ; +#pragma link C++ class CbmTofTrackingInterface + ; #pragma link C++ class TTrbHeader + ; #endif diff --git a/core/detectors/tof/CbmTofTrackingInterface.cxx b/core/detectors/tof/CbmTofTrackingInterface.cxx new file mode 100644 index 0000000000000000000000000000000000000000..4f5a4dfc8a5734d673f307d6fa6cbc6d429a8ed9 --- /dev/null +++ b/core/detectors/tof/CbmTofTrackingInterface.cxx @@ -0,0 +1,119 @@ +/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: Sergey Gorbunov, Sergei Zharko [committer] */ + +/*************************************************************************************************** + * @file CbmTofTrackingInterface.cxx + * @brief Input data and parameters interface from TOF subsystem used in L1 tracker (definition) + * @since 23.06.2022 + * @author S.Zharko <s.zharko@gsi.de> + ***************************************************************************************************/ + +#include "CbmTofTrackingInterface.h" + +#include "CbmTofCell.h" +#include "CbmTofDigiPar.h" + +#include "FairDetector.h" +#include "FairRunAna.h" +#include <FairLogger.h> + +ClassImp(CbmTofTrackingInterface) + + CbmTofTrackingInterface* CbmTofTrackingInterface::fpInstance = nullptr; + +//------------------------------------------------------------------------------------------------------------------------------------- +// +CbmTofTrackingInterface::CbmTofTrackingInterface() : FairTask("CbmTofTrackingInterface") +{ + if (!fpInstance) { fpInstance = this; } +} + +//------------------------------------------------------------------------------------------------------------------------------------- +// +CbmTofTrackingInterface::~CbmTofTrackingInterface() +{ + if (fpInstance == this) { fpInstance = nullptr; } +} + +//------------------------------------------------------------------------------------------------------------------------------------- +// +InitStatus CbmTofTrackingInterface::Init() +{ + // ** ToF tracking station position z-components initialization ** + + // Init ToF stations position z-components. For each ToF tracking station the position z-component is calculated + // as an average of the components for each ToF module inside the tracking station. + std::vector<int> nTofStationModules(this->GetNtrackingStations(), + 0); // Number of ToF modules for a given tracking station + + fTofStationZ.clear(); + fTofStationZ.resize(this->GetNtrackingStations(), 0); + + for (int iSmType = 0; iSmType < fDigiBdfPar->GetNbSmTypes(); iSmType++) { + for (int iSm = 0; iSm < fDigiBdfPar->GetNbSm(iSmType); iSm++) { + for (int iRpc = 0; iRpc < fDigiBdfPar->GetNbRpc(iSmType); iRpc++) { + int iAddr = CbmTofAddress::GetUniqueAddress(iSm, iRpc, 0, 0, iSmType); + int station = fDigiBdfPar->GetTrackingStation(iSmType, iSm, iRpc); + auto* channelInfo = dynamic_cast<CbmTofCell*>(fDigiPar->GetCell(iAddr)); + + if (nullptr == channelInfo) { break; } + + float z = channelInfo->GetZ(); + float x = channelInfo->GetX(); + //float y = channelInfo->GetY(); + + if (station < 0) { continue; } + + // NOTE: the hack for fixing stations hits in "mcbm_beam_2021_07_surveyed" + if (fIfMissingHits) { + if ((x > 20.) && (z > 270.) && (station == 1)) { station = 2; } + if (z > 400) { continue; } + } + fTofStationZ[station] += z; + nTofStationModules[station] += 1; + } + } + } + + /// Get the average values + for (int iSt = 0; iSt < this->GetNtrackingStations(); ++iSt) { + fTofStationZ[iSt] = fTofStationZ[iSt] / nTofStationModules[iSt]; + } + + return kSUCCESS; +} + +//------------------------------------------------------------------------------------------------------------------------------------- +// +InitStatus CbmTofTrackingInterface::ReInit() +{ + this->SetParContainers(); + return Init(); +} + +//------------------------------------------------------------------------------------------------------------------------------------- +// +void CbmTofTrackingInterface::SetParContainers() +{ + auto runtimeDb = FairRunAna::Instance()->GetRuntimeDb(); + fDigiPar = dynamic_cast<CbmTofDigiPar*>(runtimeDb->getContainer("CbmTofDigiPar")); + fDigiBdfPar = dynamic_cast<CbmTofDigiBdfPar*>(runtimeDb->getContainer("CbmTofDigiBdfPar")); + if (!fDigiPar) { + LOG(fatal) << "CbmTofTrackingInterface::SetParContainers: error accessing to CbmTofDigiPar container"; + } + if (!fDigiBdfPar) { + LOG(fatal) << "CbmTofTrackingInterface::SetParContainers: error accessing to CbmTofDigiBdfPar container"; + } + runtimeDb->initContainers(FairRunAna::Instance()->GetRunId()); +} + +//------------------------------------------------------------------------------------------------------------------------------------- +// +void CbmTofTrackingInterface::FixHitsStationsMismatch() +{ + LOG(warn) << "CbmTofTrackingInterface::FixHitsStationsMismatch was invoked (please, be sure that you are running " + << "the mcbm_beam_2021_07_surveyed setup at the moment)"; + fIfMissingHits = true; + this->ReInit(); +} diff --git a/core/detectors/tof/CbmTofTrackingInterface.h b/core/detectors/tof/CbmTofTrackingInterface.h new file mode 100644 index 0000000000000000000000000000000000000000..8a7e4eb480c390aa95a875430ad44d5b47946adb --- /dev/null +++ b/core/detectors/tof/CbmTofTrackingInterface.h @@ -0,0 +1,158 @@ +/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: Sergey Gorbunov, Sergei Zharko [committer] */ + +/*************************************************************************************************** + * @file CbmTofTrackingInterface.h + * @brief Input data and parameters interface from TOF subsystem used in L1 tracker (declaration) + * @since 23.06.2022 + * @author S.Zharko <s.zharko@gsi.de> + ***************************************************************************************************/ + +#ifndef CbmTofTrackingInterface_h +#define CbmTofTrackingInterface_h 1 + +#include "CbmTofDigiBdfPar.h" +#include "CbmTofHit.h" +#include "CbmTrackingDetectorInterfaceBase.h" + +#include "FairTask.h" + +#include "TMath.h" + +#include <iostream> +#include <vector> + +class CbmTofDigiPar; + +/// Class CbmTofTrackingInterface is a CbmTrackingDetetorInterfaceInit subtask, which provides necessary methods for L1 tracker +/// to access the geometry and dataflow settings. +/// +class CbmTofTrackingInterface : public FairTask, public CbmTrackingDetectorInterfaceBase { +public: + /// Default constructor + CbmTofTrackingInterface(); + + /// Destructor + ~CbmTofTrackingInterface(); + + /// FairTask: Init method + InitStatus Init(); + + /// FairTask: ReInit method + InitStatus ReInit(); + + /// Gets pointer to the instance of the CbmTofTrackingInterface + static CbmTofTrackingInterface* Instance() { return fpInstance; } + + /// Gets actual number of tracking stations, provided by the current geometry setup + int GetNtrackingStations() const { return fDigiBdfPar->GetNbTrackingStations(); } + + /// 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 { return 2.; } + + /// 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 { return 150.; } + + /// 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 { return 0.; } + + /// 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 { return 0.5 * TMath::Pi(); } + + /// 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 { return 0.; } + + /// 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 { return 0.23; } + + /// 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 { return 0.42; } + + /// 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 { return 10.; } + + /// 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 { return 0.075; } + + /// Gets a tracking station of a ToF hit + /// \param hit A pointer to ToF hit + __attribute__((always_inline)) int GetTrackingStation(CbmTofHit* hit) const + { + int iSt = fDigiBdfPar->GetTrackingStation(hit); + if (fIfMissingHits) { + /// Recalculate station index for inconsistent hits + if (hit->GetX() > 20. && hit->GetZ() > 270. && 1 == iSt) { iSt = 2; } + } + return iSt; + } + + + /// 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 { return 20.; } + + /// 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 { return 20.; } + + /// 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 { return fTofStationZ[stationId]; } + + /// 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 { return true; } + + /// FairTask: sets parameter containers up + void SetParContainers(); + + /// Copy and move constructers and assign operators are prohibited + CbmTofTrackingInterface(const CbmTofTrackingInterface&) = delete; + CbmTofTrackingInterface(CbmTofTrackingInterface&&) = delete; + CbmTofTrackingInterface& operator=(const CbmTofTrackingInterface&) = delete; + CbmTofTrackingInterface& operator=(CbmTofTrackingInterface&&) = delete; + + // This is a temporary hack for incorrect parameters at "mcbm_beam_2021_07_surveyed" setup. In the TOF parameters + // file there is a mismatch in indeces of tracking stations of hits. At the moment, we introduced a method, which + // runs CbmTofTrackingInterface::ReInit and recalculates z-component positions for this particular case. The method + // should be invoked inside CbmL1::Init() function ONLY for the "mcbm_beam_2021_07_surveyed" setup until the + // corresponding parameter file is not fixed. + void FixHitsStationsMismatch(); + +private: + static CbmTofTrackingInterface* fpInstance; ///< Instance of the class + + CbmTofDigiPar* fDigiPar {nullptr}; + CbmTofDigiBdfPar* fDigiBdfPar {nullptr}; + + std::vector<float> fTofStationZ {}; ///< ToF stations position z-component [cm] + + bool fIfMissingHits {false}; ///< Temporary flag, which is used to fix hits stations indexes mismatch + + ClassDef(CbmTofTrackingInterface, 0); +}; + +#endif // CbmTofTrackingInterface diff --git a/reco/KF/CbmTrackingDetectorInterfaceInit.cxx b/reco/KF/CbmTrackingDetectorInterfaceInit.cxx index 8ee39c2367d3d1c6b6f8791430bd8d7127351ab1..759b78b803f3017581b91434ff7d22a02b82c5c6 100644 --- a/reco/KF/CbmTrackingDetectorInterfaceInit.cxx +++ b/reco/KF/CbmTrackingDetectorInterfaceInit.cxx @@ -15,6 +15,7 @@ #include "CbmMvdTrackingInterface.h" #include "CbmSetup.h" #include "CbmStsTrackingInterface.h" +#include "CbmTofTrackingInterface.h" #include "CbmTrdTrackingInterface.h" #include <FairLogger.h> @@ -42,12 +43,14 @@ CbmTrackingDetectorInterfaceInit::CbmTrackingDetectorInterfaceInit() : FairTask( if (useSts) { fpStsTrackingInterface = new CbmStsTrackingInterface(); } if (useMuch) { fpMuchTrackingInterface = new CbmMuchTrackingInterface(); } if (useTrd) { fpTrdTrackingInterface = new CbmTrdTrackingInterface(); } + if (useTof) { fpTofTrackingInterface = new CbmTofTrackingInterface(); } /** Add subtasks - tracker detector interfaces **/ if (useMvd) { this->Add(fpMvdTrackingInterface); } if (useSts) { this->Add(fpStsTrackingInterface); } if (useMuch) { this->Add(fpMuchTrackingInterface); } if (useTrd) { this->Add(fpTrdTrackingInterface); } + if (useTof) { this->Add(fpTofTrackingInterface); } } } diff --git a/reco/KF/CbmTrackingDetectorInterfaceInit.h b/reco/KF/CbmTrackingDetectorInterfaceInit.h index 80026259af3122dfb3c97941978c695b7f56194e..0c488d65d6d6cbbbbdb5d4054731e77d37e6993d 100644 --- a/reco/KF/CbmTrackingDetectorInterfaceInit.h +++ b/reco/KF/CbmTrackingDetectorInterfaceInit.h @@ -18,6 +18,7 @@ class CbmMvdTrackingInterface; class CbmStsTrackingInterface; class CbmMuchTrackingInterface; class CbmTrdTrackingInterface; +class CbmTofTrackingInterface; /// Class CbmTrackingDetectorInterfaceInit implements a task for the tracking detector interfaces initialization. /// The tracking detector interfaces are added as subtasks. The CbmTrackingDetectorInterfaceInit class instance is to @@ -45,6 +46,7 @@ public: CbmStsTrackingInterface* GetStsTrackingInterface() { return fpStsTrackingInterface; } CbmMuchTrackingInterface* GetMuchTrackingInterface() { return fpMuchTrackingInterface; } CbmTrdTrackingInterface* GetTrdTrackingInterface() { return fpTrdTrackingInterface; } + CbmTofTrackingInterface* GetTofTrackingInterface() { return fpTofTrackingInterface; } private: static CbmTrackingDetectorInterfaceInit* fpInstance; ///< Instance of the class @@ -53,6 +55,7 @@ private: CbmStsTrackingInterface* fpStsTrackingInterface {nullptr}; ///< Instance of the STS tracker interface CbmMuchTrackingInterface* fpMuchTrackingInterface {nullptr}; ///< Instance of the MuCh tracker interface CbmTrdTrackingInterface* fpTrdTrackingInterface {nullptr}; ///< Instance of the TRD tracker interface + CbmTofTrackingInterface* fpTofTrackingInterface {nullptr}; ///< Instance of the TOF tracker interface ClassDef(CbmTrackingDetectorInterfaceInit, 0); }; diff --git a/reco/KF/KF.cmake b/reco/KF/KF.cmake index 6a816dba51d504a3314a7735621ff585063dd575..5307a31576137af26c90c6aa7b1f3cf965d110cf 100644 --- a/reco/KF/KF.cmake +++ b/reco/KF/KF.cmake @@ -30,7 +30,8 @@ ${CBMDETECTORBASE_DIR}/sts ${CBMROOT_SOURCE_DIR}/mvd ${CBMDETECTORBASE_DIR}/much # TMP for tracker interface -${CBMDETECTORBASE_DIR}/trd # TMP for tracker interface +${CBMDETECTORBASE_DIR}/trd # TMP for tracker interface +${CBMDETECTORBASE_DIR}/tof # TMP for tracker interface ${CBMROOT_SOURCE_DIR}/sim/transport/steer # TMP for tracker interface ${CBMROOT_SOURCE_DIR}/sim/transport/geosetup # TMP for tracker interface ) @@ -174,7 +175,7 @@ ENDIF (SSE_FOUND) set(LINKDEF KFLinkDef.h) Set(LIBRARY_NAME KF) Set(DEPENDENCIES - CbmRecoBase CbmSimSteer CbmStsBase CbmMvd CbmMuchBase CbmTrdBase CbmBase CbmData Base Vc.a Minuit2 + CbmRecoBase CbmSimSteer CbmStsBase CbmMvd CbmMuchBase CbmTrdBase CbmTofBase CbmBase CbmData Base Vc.a Minuit2 ) Set(DEFINITIONS -DDO_TPCCATRACKER_EFF_PERFORMANCE -DNonhomogeneousField -DCBM -DUSE_TIMERS) diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index 833a97b03875f4f9c2517bd1a20917816969f29d..d9bbb550d6b2d18f36e876166fe9d3b9ab56730b 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -28,6 +28,7 @@ #include "CbmMvdTrackingInterface.h" #include "CbmSetup.h" #include "CbmStsTrackingInterface.h" +#include "CbmTofTrackingInterface.h" #include "CbmTrdTrackingInterface.h" #include <boost/filesystem.hpp> @@ -36,9 +37,6 @@ #include "CbmMCDataObject.h" #include "CbmStsFindTracks.h" #include "CbmStsHit.h" -#include "CbmTofCell.h" -#include "CbmTofDigiBdfPar.h" -#include "CbmTofDigiPar.h" // in tof/TofParam #include "CbmTrackingDetectorInterfaceInit.h" #include "FairEventHeader.h" @@ -121,18 +119,7 @@ void CbmL1::CheckDetectorPresence() } -void CbmL1::SetParContainers() -{ - LOG(warn) << "(!) \033[1;32mCALL CbmL1::SetParContainers\033[0m"; - FairRunAna* ana = FairRunAna::Instance(); - FairRuntimeDb* rtdb = ana->GetRuntimeDb(); - fDigiPar = (CbmTofDigiPar*) (rtdb->getContainer("CbmTofDigiPar")); - // fTrdDigiPar = (CbmTrdDigiPar*)(FairRunAna::Instance()->GetRuntimeDb()->getContainer("CbmTrdDigiPar")); - - fTofDigiBdfPar = (CbmTofDigiBdfPar*) (rtdb->getContainer("CbmTofDigiBdfPar")); - rtdb->initContainers(ana->GetRunId()); // needed to get tracking stations for ToF hits -} - +void CbmL1::SetParContainers() {} InitStatus CbmL1::ReInit() { @@ -404,84 +391,22 @@ InitStatus CbmL1::Init() ** Counting numbers of stations for different detector subsystems ** *********************************************************************/ - //CbmMuchGeoScheme* fGeoScheme = CbmMuchGeoScheme::Instance(); - - /*** MuCh ***/ - //if (fUseMUCH) { - // /// Save old global file and folder pointer to avoid messing with FairRoot - // fGeoScheme->Init(fMuchDigiFile, 0); - // for (int iStation = 0; iStation < fGeoScheme->GetNStations(); iStation++) { - // const CbmMuchStation* station = fGeoScheme->GetStation(iStation); - // int nLayers = station->GetNLayers(); - // NMuchStationsGeom += nLayers; - // std::cout << "\033[1;31mMUCH: station " << iStation << " layer\033[0m\n"; - // } - //} - - /*** 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; - //} - - /*** ToF ***/ - vector<float> TofStationZ; - vector<int> TofStationN; - if (fUseTOF) { - NTOFStationGeom = fTofDigiBdfPar->GetNbTrackingStations(); - TofStationZ.resize(NTOFStationGeom, 0); - TofStationN.resize(NTOFStationGeom, 0); - - for (int iSmType = 0; iSmType < fTofDigiBdfPar->GetNbSmTypes(); iSmType++) { - for (int iSm = 0; iSm < fTofDigiBdfPar->GetNbSm(iSmType); iSm++) { - for (int iRpc = 0; iRpc < fTofDigiBdfPar->GetNbRpc(iSmType); iRpc++) { - int iAddr = CbmTofAddress::GetUniqueAddress(iSm, iRpc, 0, 0, iSmType); - int station = fTofDigiBdfPar->GetTrackingStation(iSmType, iSm, iRpc); - CbmTofCell* fChannelInfo = fDigiPar->GetCell(iAddr); - if (NULL == fChannelInfo) break; - float z = fChannelInfo->GetZ(); - float x = fChannelInfo->GetX(); - //float y = fChannelInfo->GetY(); - - if (station < 0) continue; - - if (fMissingHits) { - if ((x > 20) && (z > 270) && (station == 1)) station = 2; - if (z > 400) continue; - } - TofStationZ[station] += z; - TofStationN[station] += 1; - } - } - } - for (Int_t i = 0; i < NTOFStationGeom; i++) - TofStationZ[i] = TofStationZ[i] / TofStationN[i]; - } - - /*** MVD and STS ***/ auto mvdInterface = CbmMvdTrackingInterface::Instance(); auto stsInterface = CbmStsTrackingInterface::Instance(); auto muchInterface = CbmMuchTrackingInterface::Instance(); auto trdInterface = CbmTrdTrackingInterface::Instance(); + auto tofInterface = CbmTofTrackingInterface::Instance(); + + // NOTE: hack for "mcbm_beam_2021_07_surveyed" to account for a mismactch in the station + // indeces of hits in TOF + if (fMissingHits) { tofInterface->FixHitsStationsMismatch(); } NMvdStationsGeom = (fUseMVD) ? mvdInterface->GetNtrackingStations() : 0; NStsStationsGeom = (fUseSTS) ? stsInterface->GetNtrackingStations() : 0; NMuchStationsGeom = (fUseMUCH) ? muchInterface->GetNtrackingStations() : 0; NTrdStationsGeom = (fUseTRD) ? trdInterface->GetNtrackingStations() : 0; + NTOFStationGeom = (fUseTOF) ? tofInterface->GetNtrackingStations() : 0; NStationGeom = NMvdStationsGeom + NStsStationsGeom + NMuchStationsGeom + NTrdStationsGeom + NTOFStationGeom; // Provide crosscheck number of stations for the fpInitManagera @@ -663,22 +588,22 @@ InitStatus CbmL1::Init() for (int iSt = 0; iSt < NTOFStationGeom; ++iSt) { auto stationInfo = L1BaseStationInfo(L1DetectorID::kTof, iSt); stationInfo.SetStationType(4); - stationInfo.SetTimeInfo(1); - stationInfo.SetTimeResolution(0.075); + stationInfo.SetTimeInfo(tofInterface->IsTimeInfoProvided(iSt)); + stationInfo.SetTimeResolution(tofInterface->GetTimeResolution(iSt)); stationInfo.SetFieldStatus(0); - stationInfo.SetZ(TofStationZ[iSt]); - auto thickness = 10.; - auto radLength = 2.; + stationInfo.SetZ(tofInterface->GetZ(iSt)); + auto thickness = tofInterface->GetThickness(iSt); + auto radLength = tofInterface->GetRadLength(iSt); stationInfo.SetMaterialSimple(thickness, radLength); stationInfo.SetMaterialMap(std::move(materialTableTof[iSt]), correctionTof); - stationInfo.SetXmax(20.); - stationInfo.SetYmax(20.); - stationInfo.SetRmin(0.); - stationInfo.SetRmax(150.); - fscal tofFrontPhi = 0; - fscal tofBackPhi = TMath::Pi() / 2.; - fscal tofFrontSigma = 0.42; - fscal tofBackSigma = 0.23; + stationInfo.SetXmax(tofInterface->GetXmax(iSt)); + stationInfo.SetYmax(tofInterface->GetYmax(iSt)); + stationInfo.SetRmin(tofInterface->GetRmin(iSt)); + stationInfo.SetRmax(tofInterface->GetRmax(iSt)); + fscal tofFrontPhi = tofInterface->GetStripsStereoAngleFront(iSt); + fscal tofBackPhi = tofInterface->GetStripsStereoAngleBack(iSt); + fscal tofFrontSigma = tofInterface->GetStripsSpatialRmsFront(iSt); + fscal tofBackSigma = tofInterface->GetStripsSpatialRmsBack(iSt); stationInfo.SetFrontBackStripsGeometry(tofFrontPhi, tofFrontSigma, tofBackPhi, tofBackSigma); stationInfo.SetTrackingStatus(target.z < stationInfo.GetZdouble() ? true : false); fpInitManager->AddStation(stationInfo); diff --git a/reco/L1/CbmL1.h b/reco/L1/CbmL1.h index 97d3e23f9c104bde32a9438d0cf822365525a353..b0e37ea5103a6d23713dd3fc18dd00107b6600f2 100644 --- a/reco/L1/CbmL1.h +++ b/reco/L1/CbmL1.h @@ -63,9 +63,6 @@ class KFTopoPerformance; class CbmMCDataObject; class CbmEvent; -class CbmTofDigiBdfPar; - -class CbmTofDigiPar; class TProfile2D; class CbmL1HitStore { @@ -477,8 +474,6 @@ private: CbmMCDataArray* fTofPoints {nullptr}; TClonesArray* fTofHitDigiMatches {nullptr}; // CbmMatches array TClonesArray* fTofHits {nullptr}; // CbmMatches array - CbmTofDigiPar* fDigiPar {nullptr}; - CbmTofDigiBdfPar* fTofDigiBdfPar {nullptr}; vector<vector<int>> TofPointToTrack; TFile* fPerfFile {nullptr}; diff --git a/reco/L1/CbmL1ReadEvent.cxx b/reco/L1/CbmL1ReadEvent.cxx index b9e2aaea24054de7567a9261a91be23ee1986c65..b0b2f9178cd66e5d96f5b4c0cfeaebb7a79d44e7 100644 --- a/reco/L1/CbmL1ReadEvent.cxx +++ b/reco/L1/CbmL1ReadEvent.cxx @@ -33,9 +33,9 @@ #include "CbmStsHit.h" #include "CbmStsPoint.h" #include "CbmStsSetup.h" -#include "CbmTofDigiBdfPar.h" #include "CbmTofHit.h" #include "CbmTofPoint.h" +#include "CbmTofTrackingInterface.h" #include "CbmTrdHit.h" #include "CbmTrdPoint.h" @@ -1002,20 +1002,10 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, if (0x00202806 == mh->GetAddress() || 0x00002806 == mh->GetAddress()) continue; - int sttof = -1; - - sttof = fTofDigiBdfPar->GetTrackingStation(mh); + int sttof = CbmTofTrackingInterface::Instance()->GetTrackingStation(mh); if (sttof < 0) continue; - // if (fTofDigiBdfPar->GetTrackingStation(mh) == 0) sttof = 0; - // if (fTofDigiBdfPar->GetTrackingStation(mh) == 1) sttof = 0; - // if (fTofDigiBdfPar->GetTrackingStation(mh) == 2) sttof = 1; - // if (fTofDigiBdfPar->GetTrackingStation(mh) == 3) sttof = 1; - // if (fTofDigiBdfPar->GetTrackingStation(mh) == 4) sttof = 2; - // if (fTofDigiBdfPar->GetTrackingStation(mh) == 5) sttof = 2; - - th.time = mh->GetTime(); th.dt = mh->GetTimeError(); @@ -1039,9 +1029,7 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, th.y = pos.Y(); th.z = pos.Z(); - if (fMissingHits) - if ((th.x > 20) && (th.z > 270) && (fTofDigiBdfPar->GetTrackingStation(mh) == 1)) sttof = 2; - if (th.z > 400) continue; + if (th.z > 400) continue; // is it still needed here? (S.Zharko) int stIdx = algo->GetParameters()->GetStationIndexActive(sttof, L1DetectorID::kTof); if (stIdx == -1) continue; diff --git a/reco/L1/L1Algo/L1Algo.h b/reco/L1/L1Algo/L1Algo.h index 0084cc1387f53de440efe66da139c3dd3febbab1..59df2b427ec02fe2befcbe004df6fd55b89a133a 100644 --- a/reco/L1/L1Algo/L1Algo.h +++ b/reco/L1/L1Algo/L1Algo.h @@ -312,7 +312,7 @@ public: /// --- data used during finding iterations - int isec {0}; // iteration TODO: to be dispatched (S.Zharko, 21.06.2022) + int isec {0}; // iteration TODO: to be dispatched (S.Zharko, 21.06.2022) const L1CAIteration* fpCurrentIteration {nullptr}; ///< pointer to the current CA track finder iteration L1Vector<L1Hit>* vHitsUnused {nullptr}; diff --git a/reco/L1/L1Algo/L1CAIteration.h b/reco/L1/L1Algo/L1CAIteration.h index 455d124eba1560a002a080a76d6de7c5a0879d0f..42ffe9563de6a35443e39ad5dd633466389ab985 100644 --- a/reco/L1/L1Algo/L1CAIteration.h +++ b/reco/L1/L1Algo/L1CAIteration.h @@ -26,71 +26,71 @@ class L1CAIteration { public: /// Default constructor L1CAIteration() noexcept; - + /// Copy constructor L1CAIteration(const L1CAIteration& other) noexcept; - + /// Move constructor L1CAIteration(L1CAIteration&& other) noexcept; - + /// Constructor from L1CAIteration type L1CAIteration(const std::string& name) noexcept; - + /// Destructor ~L1CAIteration() noexcept; - + /// Copy assignment operator L1CAIteration& operator=(const L1CAIteration& other) noexcept; - + /// Move assignment operator L1CAIteration& operator=(L1CAIteration&& other) noexcept; /// Gets doublet chi2 upper cut float GetDoubletChi2Cut() const { return fDoubletChi2Cut; } - + /// Gets station index of the first station used in tracking int GetFirstStationIndex() const { return fFirstStationIndex; } /// Gets correction for accounting overlaping and iff z float GetMaxDZ() const { return fMaxDZ; } - + /// Gets max considered q/p for tracks float GetMaxInvMom() const { return fMaxInvMom; } - + /// Gets max slope (tx\ty) in 3D hit position of a triplet float GetMaxSlope() const { return fMaxSlope; } - + /// Gets max slope (tx\ty) in primary vertex float GetMaxSlopePV() const { return fMaxSlopePV; } - + /// Gets min level of the triplet start int GetMinLevelTripletStart() const { return fMinLevelTripletStart; } - + /// Gets the name of the iteration const std::string& GetName() const { return fName; } - + /// Gets size of region [TODO: units??] to attach new hits to the created track float GetPickGather() const { return fPickGather; } - + /// Gets min value of dp/dp_error, for which two tiplets are neighbours float GetPickNeighbour() const { return fPickNeighbour; } - + /// Gets sigma target position in X direction [cm] float GetTargetPosSigmaX() const { return fTargetPosSigmaX; } - + /// Gets sigma target position in Y direction [cm] float GetTargetPosSigmaY() const { return fTargetPosSigmaY; } - + /// Gets track chi2 upper cut float GetTrackChi2Cut() const { return fTrackChi2Cut; } - + /// Gets triplet chi2 upper cut float GetTripletChi2Cut() const { return fTripletChi2Cut; } /// flag check: electrons/positrons - true, heavy charged - false bool GetElectronFlag() const { return fIsElectron; } - /// Checks flag: true - only primary tracks are searched, false - [all or only secondary?] + /// Checks flag: true - only primary tracks are searched, false - [all or only secondary?] bool GetPrimaryFlag() const { return fIsPrimary; } /// Prints iteration options @@ -98,54 +98,54 @@ public: /// Sets doublet chi2 upper cut void SetDoubletChi2Cut(float input) { fDoubletChi2Cut = input; } - + /// Sets flag: electron tracks - true, heavy ion tracks - false void SetElectronFlag(bool flag) { fIsElectron = flag; } /// Sets index of first station used in tracking - void SetFirstStationIndex(int index) { fFirstStationIndex = index; } + void SetFirstStationIndex(int index) { fFirstStationIndex = index; } /// Sets correction for accounting overlaping and iff z void SetMaxDZ(float input) { fMaxDZ = input; } - + /// Sets max considered q/p for tracks void SetMaxInvMom(float input) { fMaxInvMom = input; } - + /// Sets max slope (tx\ty) in 3D hit position of a triplet void SetMaxSlope(float input) { fMaxSlope = input; } - + /// Sets max slope (tx\ty) in primary vertex void SetMaxSlopePV(float input) { fMaxSlopePV = input; } - + /// Sets min level of the triplet start void SetMinLevelTripletStart(int input) { fMinLevelTripletStart = input; } - + /// Sets name of the iteration void SetName(const std::string& name) { fName = name; } - + /// Sets size of region [TODO: units??] to attach new hits to the created track void SetPickGather(float input) { fPickGather = input; } - + /// Sets min value of dp/dp_error, for which two tiplets are neighbours void SetPickNeighbour(float input) { fPickNeighbour = input; } - + /// Sets flag: primary tracks - true, secondary tracks - false void SetPrimaryFlag(bool flag) { fIsPrimary = flag; } - + /// Sets sigma of target positions in XY plane /// \param sigmaX Sigma value in X direction [cm] /// \param sigmaX Sigma value in Y direction [cm] void SetTargetPosSigmaXY(float sigmaX, float sigmaY); - + /// Sets track chi2 upper cut void SetTrackChi2Cut(float input) { fTrackChi2Cut = input; } - + /// Sets triplet chi2 upper cut void SetTripletChi2Cut(float input) { fTripletChi2Cut = input; } /// Swap method void Swap(L1CAIteration& other) noexcept; - + /// String representation of the class contents /// \param indentLevel Level of indentation for the text (in terms of \t symbols) std::string ToString(int indentLevel = 0) const; @@ -162,19 +162,19 @@ private: float fTrackChi2Cut {10.f}; ///< Track chi2 upper cut float fTripletChi2Cut {21.1075f}; ///< Triplet chi2 upper cut float fDoubletChi2Cut {11.3449 * 2.f / 3.f}; ///< Doublet chi2 upper cut - float fPickGather {3.0}; ///< Size of region to attach new hits to the created track [TODO: units??] - float fPickNeighbour {5.0}; ///< Min value of dp/dp_error, for which two tiplets are neighbours - float fMaxInvMom {1.0 / 0.5}; ///< Max considered q/p for tracks - float fMaxSlopePV {1.1}; ///< Max slope (tx\ty) in primary vertex - float fMaxSlope {2.748}; ///< Max slope (tx\ty) in 3D hit position of a triplet - float fMaxDZ {0.f}; ///< Correction for accounting overlaping and iff z [TODO: units??] - float fTargetPosSigmaX {0}; ///< Constraint on target position in X direction [cm] - float fTargetPosSigmaY {0}; ///< Constraint on target position in Y direction [cm] - int fMinLevelTripletStart {0}; ///< Min level for starting a triplet. Track length = fMinLevelTripletStart + 3 - int fFirstStationIndex {0}; ///< First station, used for tracking - - bool fIsPrimary {false}; ///< Flag: true - only primary tracks are searched for - bool fIsElectron {false}; ///< Flag: true - only electrons are searched for + float fPickGather {3.0}; ///< Size of region to attach new hits to the created track [TODO: units??] + float fPickNeighbour {5.0}; ///< Min value of dp/dp_error, for which two tiplets are neighbours + float fMaxInvMom {1.0 / 0.5}; ///< Max considered q/p for tracks + float fMaxSlopePV {1.1}; ///< Max slope (tx\ty) in primary vertex + float fMaxSlope {2.748}; ///< Max slope (tx\ty) in 3D hit position of a triplet + float fMaxDZ {0.f}; ///< Correction for accounting overlaping and iff z [TODO: units??] + float fTargetPosSigmaX {0}; ///< Constraint on target position in X direction [cm] + float fTargetPosSigmaY {0}; ///< Constraint on target position in Y direction [cm] + int fMinLevelTripletStart {0}; ///< Min level for starting a triplet. Track length = fMinLevelTripletStart + 3 + int fFirstStationIndex {0}; ///< First station, used for tracking + + bool fIsPrimary {false}; ///< Flag: true - only primary tracks are searched for + bool fIsElectron {false}; ///< Flag: true - only electrons are searched for // ^ TODO: invent more proper name diff --git a/reco/L1/L1Algo/L1CATrackFinder.cxx b/reco/L1/L1Algo/L1CATrackFinder.cxx index 5b461674dcf2955ab4b91567c93f75666bca0c85..032aed08a5dcf156fe9c4d3566f6d643f34b4420 100644 --- a/reco/L1/L1Algo/L1CATrackFinder.cxx +++ b/reco/L1/L1Algo/L1CATrackFinder.cxx @@ -154,9 +154,7 @@ inline void L1Algo::findSingletsStep1( /// input 1st stage of singlet search L1Fit fit; - if (fpCurrentIteration->GetElectronFlag()) { - fit.SetParticleMass(L1Constants::phys::kElectronMass); - } + if (fpCurrentIteration->GetElectronFlag()) { fit.SetParticleMass(L1Constants::phys::kElectronMass); } else { fit.SetParticleMass(fDefaultMass); } @@ -1278,19 +1276,10 @@ inline void L1Algo::f5( // input inline void L1Algo::DupletsStaPort( /// input: - int istal, - int istam, - Tindex ip, - L1Vector<Tindex>& n_g, - Tindex* portionStopIndex_, + int istal, int istam, Tindex ip, L1Vector<Tindex>& n_g, Tindex* portionStopIndex_, /// output: - L1TrackPar* T_1, - L1FieldRegion* fld_1, - L1HitIndex_t* hitsl_1, - L1Vector<char>& lmDuplets, - Tindex& n_2, - L1Vector<L1HitIndex_t>& i1_2, - L1Vector<L1HitIndex_t>& hitsm_2 + L1TrackPar* T_1, L1FieldRegion* fld_1, L1HitIndex_t* hitsl_1, L1Vector<char>& lmDuplets, Tindex& n_2, + L1Vector<L1HitIndex_t>& i1_2, L1Vector<L1HitIndex_t>& hitsm_2 /// ) { @@ -1384,43 +1373,35 @@ inline void L1Algo::DupletsStaPort( /// ------------------- Triplets on station ---------------------- -inline void -L1Algo::TripletsStaPort( /// creates triplets: - /// input: - /// @istal - start station number, - /// @istam - middle station number, - /// @istar - last station number, - /// @ip - index of portion, - /// @&n_g - numer of elements in portion, +inline void L1Algo::TripletsStaPort( /// creates triplets: + /// input: + /// @istal - start station number, + /// @istam - middle station number, + /// @istar - last station number, + /// @ip - index of portion, + /// @&n_g - numer of elements in portion, /// @*portionStopIndex - int istal, - int istam, - int istar, - - /// @nstaltriplets - , - /// @*portionStopIndex, - /// @*T_1 - track parameters for singlets, - /// @*fld_1 - field approximation for singlets, + int istal, int istam, int istar, + + /// @nstaltriplets - , + /// @*portionStopIndex, + /// @*T_1 - track parameters for singlets, + /// @*fld_1 - field approximation for singlets, /// @&n_2 - number of doublets in portion /// @&n_2 - number of douplets, - /// @&i1_2 - index of 1st hit in portion indexed by doublet index, + /// @&i1_2 - index of 1st hit in portion indexed by doublet index, /// @&hitsm_2 - index of middle hit in hits array indexed by doublet index - Tindex& nstaltriplets, - L1TrackPar* T_1, - L1FieldRegion* fld_1, - L1HitIndex_t* hitsl_1, + Tindex& nstaltriplets, L1TrackPar* T_1, L1FieldRegion* fld_1, L1HitIndex_t* hitsl_1, - Tindex& n_2, - L1Vector<L1HitIndex_t>& i1_2, - L1Vector<L1HitIndex_t>& hitsm_2, + Tindex& n_2, L1Vector<L1HitIndex_t>& i1_2, L1Vector<L1HitIndex_t>& hitsm_2, const L1Vector<char>& mrDuplets - /// output: - // @*vTriplets_part - array of triplets, - // @*TripStartIndexH, + /// output: + // @*vTriplets_part - array of triplets, + // @*TripStartIndexH, // @*TripStopIndexH - start/stop index of a triplet in the array ) @@ -1765,7 +1746,7 @@ void L1Algo::CATrackFinder() // ---- Loop over Track Finder iterations ----------------------------------------------------------------// L1ASSERT(0, fNFindIterations == fParameters.GetCAIterations().size()); isec = 0; // TODO: temporary! (S.Zharko) - + for (const auto& caIteration : fParameters.GetCAIterations()) // all finder { fpCurrentIteration = &caIteration; // select current iteration @@ -1917,20 +1898,20 @@ void L1Algo::CATrackFinder() L1HitIndex_t hitslG_1[Portion]; /// middle hits indexed by number of doublets in portion(i2) - L1Vector<L1HitIndex_t> hitsm_2("L1CATrackFinder::hitsm_2"); - + L1Vector<L1HitIndex_t> hitsm_2("L1CATrackFinder::hitsm_2"); + /// index in portion of singlets(i1) indexed by index in portion of doublets(i2) L1Vector<L1HitIndex_t> i1_2("L1CATrackFinder::i1_2"); /// middle hits indexed by number of doublets in portion(i2) L1Vector<L1HitIndex_t> hitsmG_2("L1CATrackFinder::hitsmG_2"); - + /// index in portion of singlets(i1) indexed by index in portion of doublets(i2) L1Vector<L1HitIndex_t> i1G_2("L1CATrackFinder::i1G_2"); - + /// is exist a doublet started from indexed by left hit L1Vector<char> lmDuplets[L1Constants::size::kMaxNstations] {"L1CATrackFinder::lmDuplets"}; - + /// is exist a doublet started from indexed by left hit L1Vector<char> lmDupletsG[L1Constants::size::kMaxNstations] {"L1CATrackFinder::lmDupletsG"}; diff --git a/reco/L1/L1Algo/L1Constants.h b/reco/L1/L1Algo/L1Constants.h index ad695f2e159d943b543ac95fe5db20281bd1246c..2f3f86f0a8c73cadeee81a90140fd0855dd8fb15 100644 --- a/reco/L1/L1Algo/L1Constants.h +++ b/reco/L1/L1Algo/L1Constants.h @@ -64,9 +64,9 @@ namespace L1Constants namespace phys { /* Particle masses used for track fit */ - constexpr float kMuonMass {0.10565800f}; ///< Muon mass [GeV/c2] - constexpr float kElectronMass {0.000511f}; ///< Electron mass [GeV/c2] - } + constexpr float kMuonMass {0.10565800f}; ///< Muon mass [GeV/c2] + constexpr float kElectronMass {0.000511f}; ///< Electron mass [GeV/c2] + } // namespace phys /// Miscellaneous constants namespace misc @@ -78,11 +78,11 @@ namespace L1Constants /// NoInit constants (aliasses) namespace noin { - constexpr float kF { L1NaN::SetNaN<float>() }; - constexpr double kD { L1NaN::SetNaN<double>() }; - constexpr int k32I { L1NaN::SetNaN<int>() }; - constexpr unsigned int k32U { L1NaN::SetNaN<unsigned int>() }; - } + constexpr float kF {L1NaN::SetNaN<float>()}; + constexpr double kD {L1NaN::SetNaN<double>()}; + constexpr int k32I {L1NaN::SetNaN<int>()}; + constexpr unsigned int k32U {L1NaN::SetNaN<unsigned int>()}; + } // namespace noin } // end namespace L1Constants diff --git a/reco/L1/L1Algo/L1Extrapolation.h b/reco/L1/L1Algo/L1Extrapolation.h index ce60235c5d52320b99a8342ff9174c0140a46cee..d71177c41d50b50ca03cf602d3bfeba9e1654527 100644 --- a/reco/L1/L1Algo/L1Extrapolation.h +++ b/reco/L1/L1Algo/L1Extrapolation.h @@ -598,9 +598,9 @@ inline void L1Extrapolate // extrapolates track parameters and returns jacobian } #endif //ANALYTICEXTRAPOLATION -inline void L1Extrapolate0(L1TrackPar& T, // input track parameters (x,y,tx,ty,Q/p) and cov.matrix - fvec z_out, // extrapolate to this z position - L1FieldRegion& F) // magneti +inline void L1Extrapolate0(L1TrackPar& T, // input track parameters (x,y,tx,ty,Q/p) and cov.matrix + fvec z_out, // extrapolate to this z position + L1FieldRegion& F) // magneti { // // Part of the analytic extrapolation formula with error (c_light*B*dz)^4/4! diff --git a/reco/L1/L1Algo/L1Fit.h b/reco/L1/L1Algo/L1Fit.h index f600a632d65321468a2a808ce23f2109532cb38d..7577d1df009a0c76f7ec6a753498d0ff650acc5e 100644 --- a/reco/L1/L1Algo/L1Fit.h +++ b/reco/L1/L1Algo/L1Fit.h @@ -10,10 +10,10 @@ #ifndef L1Fit_H #define L1Fit_H +#include "L1Constants.h" #include "L1Def.h" #include "L1MaterialInfo.h" #include "L1TrackPar.h" -#include "L1Constants.h" /// /// A collection of fit routines used by the CA tracker @@ -80,7 +80,7 @@ public: const fvec TargetRadThick = 3.73e-2f * 2; // 250 mum Gold // TODO: ! private: - fvec fMass {L1Constants::phys::kMuonMass}; // muon mass by default + fvec fMass {L1Constants::phys::kMuonMass}; // muon mass by default fvec fMass2 {fMass * fMass}; //ClassDefNV(L1Fit, 0) diff --git a/reco/L1/L1Algo/L1MaterialInfo.cxx b/reco/L1/L1Algo/L1MaterialInfo.cxx index 13878ccbe467f226f9e3d364be2ec24fc970c1e7..267d97ca3d8f798fdb3ac3c13ecfd56df2790304 100644 --- a/reco/L1/L1Algo/L1MaterialInfo.cxx +++ b/reco/L1/L1Algo/L1MaterialInfo.cxx @@ -3,13 +3,15 @@ Authors: Sergey Gorbunov, Sergei Zharko [committer] */ #include "L1MaterialInfo.h" -#include "L1Utils.h" + #include <FairLogger.h> #include <iomanip> #include <sstream> #include <vector> +#include "L1Utils.h" + /************************ * L1MaterialInfo class * ************************/ diff --git a/reco/L1/L1Algo/L1MaterialInfo.h b/reco/L1/L1Algo/L1MaterialInfo.h index 4f357f7e4a09c48692b34fe536d9ea3de4ecf884..ef4ea8a9f89461ab04357e2dc9d56fd49187948b 100644 --- a/reco/L1/L1Algo/L1MaterialInfo.h +++ b/reco/L1/L1Algo/L1MaterialInfo.h @@ -20,12 +20,12 @@ struct L1MaterialInfo { fvec thick {L1NaN::SetNaN<decltype(thick)>()}; ///< Average thickness of the station in arbitary length units /// Average radiation length (X0) of the station material in THE SAME UNITS as the thickness fvec RL {L1NaN::SetNaN<decltype(RL)>()}; - fvec RadThick {L1NaN::SetNaN<decltype(RadThick)>()}; ///< Average thickness in units of radiation length (X/X0) - fvec logRadThick {L1NaN::SetNaN<decltype(logRadThick)>()}; ///< Log of average thickness in units of radiation length + fvec RadThick {L1NaN::SetNaN<decltype(RadThick)>()}; ///< Average thickness in units of radiation length (X/X0) + fvec logRadThick {L1NaN::SetNaN<decltype(logRadThick)>()}; ///< Log of average thickness in units of radiation length /// Verifies class invariant consistency void CheckConsistency() const; - + /// Checks, if the fields are NaN bool IsNaN() const { @@ -77,12 +77,9 @@ public: /// \param x X coordinate of the point [cm] (SIMDized vector) /// \param y Y coordinate of the point [cm] (SIMDized veotor) fvec GetRadThick(fvec x, fvec y) const; - + /// Checks, if the fields are NaN - bool IsNaN() const - { - return L1NaN::IsNaN(fNbins) || L1NaN::IsNaN(fRmax) || L1NaN::IsNaN(fFactor); - } + bool IsNaN() const { return L1NaN::IsNaN(fNbins) || L1NaN::IsNaN(fRmax) || L1NaN::IsNaN(fFactor); } /// Verifies class invariant consistency void CheckConsistency() const; @@ -105,9 +102,10 @@ public: void Swap(L1Material& other) noexcept; private: - int fNbins {L1NaN::SetNaN<decltype(fNbins)>()}; ///< Number of rows (columns) in the material budget table - float fRmax {L1NaN::SetNaN<decltype(fRmax)>()}; ///< Size of the station in x and y dimensions [cm] - float fFactor {L1NaN::SetNaN<decltype(fFactor)>()}; ///< Factor used in the recalculation of point coordinates to row/column id + int fNbins {L1NaN::SetNaN<decltype(fNbins)>()}; ///< Number of rows (columns) in the material budget table + float fRmax {L1NaN::SetNaN<decltype(fRmax)>()}; ///< Size of the station in x and y dimensions [cm] + float fFactor { + L1NaN::SetNaN<decltype(fFactor)>()}; ///< Factor used in the recalculation of point coordinates to row/column id std::vector<float> fTable {}; ///< Material budget table } _fvecalignment; diff --git a/reco/L1/L1Algo/L1NaN.h b/reco/L1/L1Algo/L1NaN.h index b5a2349c13075a0204a348935ed7ff6cae339b6d..eadd05ef677ed359e441dc7e5d8bc72a1565c18a 100644 --- a/reco/L1/L1Algo/L1NaN.h +++ b/reco/L1/L1Algo/L1NaN.h @@ -12,55 +12,61 @@ #ifndef L1NaN_h #define L1NaN_h 1 -#include <limits> #include <type_traits> + +#include <limits> + #include <cmath> + #include "vectors/P4_F32vec4.h" /// Namespace L1NaN defines functions to set variables to NaN and check wether they are NaN or not /// -namespace L1NaN { +namespace L1NaN +{ /// Returns NaN value for a floating point variable - template <typename T, typename std::enable_if<std::is_floating_point<T>::value, T>::type* = nullptr> + template<typename T, typename std::enable_if<std::is_floating_point<T>::value, T>::type* = nullptr> constexpr auto SetNaN() { return std::numeric_limits<T>::signaling_NaN(); } /// Returns MaN value for an intergral variable - template <typename T, typename std::enable_if<std::is_integral<T>::value && !std::is_same<T, bool>::value, T>::type* = nullptr> + template<typename T, + typename std::enable_if<std::is_integral<T>::value && !std::is_same<T, bool>::value, T>::type* = nullptr> constexpr auto SetNaN() { - return T(-1); // -1 for signed integers and MAX_INT for unsigned integers + return T(-1); // -1 for signed integers and MAX_INT for unsigned integers } - + /// Returns MaN value for fvec variable - template <typename T, typename std::enable_if<std::is_same<T, fvec>::value, T>::type* = nullptr> + template<typename T, typename std::enable_if<std::is_same<T, fvec>::value, T>::type* = nullptr> constexpr auto SetNaN() { return fvec(SetNaN<fscal>()); } /// Checks, if the floating point variable is NaN - template <typename T, typename std::enable_if<std::is_floating_point<T>::value, T>::type* = nullptr> + template<typename T, typename std::enable_if<std::is_floating_point<T>::value, T>::type* = nullptr> bool IsNaN(T value) { return std::isnan(value); } /// Checks, if the integral variable is NaN - template <typename T, typename std::enable_if<std::is_integral<T>::value && !std::is_same<T, bool>::value, T>::type* = nullptr> + template<typename T, + typename std::enable_if<std::is_integral<T>::value && !std::is_same<T, bool>::value, T>::type* = nullptr> bool IsNaN(T value) { return T(-1) == value; } /// Checks, if the fvec variable is NaN - template <typename T, typename std::enable_if<std::is_same<T, fvec>::value, T>::type* = nullptr> - bool IsNaN(T value) + template<typename T, typename std::enable_if<std::is_same<T, fvec>::value, T>::type* = nullptr> + bool IsNaN(T value) { - return value.IsNanAny(); // NOTE: Here we consider fvec a NaN if at least one of its words is NaN + return value.IsNanAny(); // NOTE: Here we consider fvec a NaN if at least one of its words is NaN } -}; +}; // namespace L1NaN -#endif // L1NaN_h +#endif // L1NaN_h diff --git a/reco/L1/L1Algo/L1Station.h b/reco/L1/L1Algo/L1Station.h index 083c5a35ba4ea4820a35e465c726589de3b94947..565d76c4e45b382a44c35c3e5fb36ae4c130e24a 100644 --- a/reco/L1/L1Algo/L1Station.h +++ b/reco/L1/L1Algo/L1Station.h @@ -19,13 +19,14 @@ /// class L1Station { public: - int type {L1NaN::SetNaN<decltype(type)>()}; - int timeInfo {L1NaN::SetNaN<decltype(timeInfo)>()}; ///< flag: if time information can be used - int fieldStatus {L1NaN::SetNaN<decltype(fieldStatus)>()}; ///< flag: 1 - station is INSIDE the field, 0 - station is OUTSIDE the field (replace with enum) - fvec z {L1NaN::SetNaN<decltype(z)>()}; ///< z position of station [cm] - fvec Rmin {L1NaN::SetNaN<decltype(Rmin)>()}; ///< min radius of the station [cm] - fvec Rmax {L1NaN::SetNaN<decltype(Rmax)>()}; ///< max radius of the station [cm] - fvec dt {L1NaN::SetNaN<decltype(dt)>()}; ///< time resolution [ns] + int type {L1NaN::SetNaN<decltype(type)>()}; + int timeInfo {L1NaN::SetNaN<decltype(timeInfo)>()}; ///< flag: if time information can be used + int fieldStatus {L1NaN::SetNaN<decltype( + fieldStatus)>()}; ///< flag: 1 - station is INSIDE the field, 0 - station is OUTSIDE the field (replace with enum) + fvec z {L1NaN::SetNaN<decltype(z)>()}; ///< z position of station [cm] + fvec Rmin {L1NaN::SetNaN<decltype(Rmin)>()}; ///< min radius of the station [cm] + fvec Rmax {L1NaN::SetNaN<decltype(Rmax)>()}; ///< max radius of the station [cm] + fvec dt {L1NaN::SetNaN<decltype(dt)>()}; ///< time resolution [ns] /// structure containing station thickness(X), rad. length (X0), X/X0 and log(X/X0) values L1MaterialInfo materialInfo {}; L1FieldSlice fieldSlice {}; diff --git a/reco/L1/L1Algo/L1UMeasurementInfo.h b/reco/L1/L1Algo/L1UMeasurementInfo.h index 6383eebceee9df1e5cc98f20d30577f8acb5787a..8f87f798cda6a96464015282285e368365231438 100644 --- a/reco/L1/L1Algo/L1UMeasurementInfo.h +++ b/reco/L1/L1Algo/L1UMeasurementInfo.h @@ -16,7 +16,7 @@ class L1UMeasurementInfo { public: fvec cos_phi {L1NaN::SetNaN<decltype(cos_phi)>()}; fvec sin_phi {L1NaN::SetNaN<decltype(sin_phi)>()}; - fvec sigma2 {L1NaN::SetNaN<decltype(sigma2)>()}; + fvec sigma2 {L1NaN::SetNaN<decltype(sigma2)>()}; /// String representation of class contents /// \param indentLevel number of indent characters in the output @@ -26,10 +26,7 @@ public: void CheckConsistency() const; /// Checks, if the fields are NaN - bool IsNaN() const - { - return L1NaN::IsNaN(cos_phi) || L1NaN::IsNaN(sin_phi) || L1NaN::IsNaN(sigma2); - } + bool IsNaN() const { return L1NaN::IsNaN(cos_phi) || L1NaN::IsNaN(sin_phi) || L1NaN::IsNaN(sigma2); } } _fvecalignment; diff --git a/reco/L1/L1Algo/L1Utils.h b/reco/L1/L1Algo/L1Utils.h index 22c69e5720c4fe198a600697bab9b4118bd31b0a..6770f4fb8f6f22737eb4b17a42f608513bc7d597 100644 --- a/reco/L1/L1Algo/L1Utils.h +++ b/reco/L1/L1Algo/L1Utils.h @@ -10,12 +10,13 @@ #ifndef L1Utils_h #define L1Utils_h 1 +#include <type_traits> + #include <iomanip> #include <limits> #include <map> #include <sstream> #include <string> -#include <type_traits> #include <unordered_map> #include <cmath> @@ -32,7 +33,7 @@ struct L1Utils { /// \param lhs Left floating point to compare /// \param rhs Right floating point to compare /// \return Comparison result: true - equals within epsilon - template <typename T, typename std::enable_if<std::is_floating_point<T>::value, T>::type* = nullptr> + template<typename T, typename std::enable_if<std::is_floating_point<T>::value, T>::type* = nullptr> static bool CmpFloats(T lhs, T rhs) { return fabs(lhs - rhs) < 2. * std::numeric_limits<T>::epsilon() * fabs(lhs + rhs) diff --git a/reco/L1/L1Algo/L1XYMeasurementInfo.h b/reco/L1/L1Algo/L1XYMeasurementInfo.h index 85cdd745ea1661a793d336a49e787133de509dfb..6af76f89ec5835b1acc47d01d453b08dba973d9b 100644 --- a/reco/L1/L1Algo/L1XYMeasurementInfo.h +++ b/reco/L1/L1Algo/L1XYMeasurementInfo.h @@ -25,10 +25,7 @@ public: std::string ToString(int indentLevel = 0) const; /// Checks, if the fields are NaN - bool IsNaN() const - { - return L1NaN::IsNaN(C00) || L1NaN::IsNaN(C10) || L1NaN::IsNaN(C11); - } + bool IsNaN() const { return L1NaN::IsNaN(C00) || L1NaN::IsNaN(C10) || L1NaN::IsNaN(C11); } } _fvecalignment; diff --git a/reco/L1/L1AlgoInputData.h b/reco/L1/L1AlgoInputData.h index cee3944be1dd616ca30a676b5501f8d1b9af2242..088e95f7c63775ceb5546bbbb1ed998282054082 100644 --- a/reco/L1/L1AlgoInputData.h +++ b/reco/L1/L1AlgoInputData.h @@ -26,21 +26,21 @@ struct L1AlgoInputData { /// Default constructor L1AlgoInputData() = default; - + /// Default destructor ~L1AlgoInputData() = default; /// Resets the object /// For all the vectors the clear method is called, all other fields are set to zero void Clear(); - + /// Gets number of the station strips int GetNstrips() const { return fNstrips; } /// Gives an access to the underlying vector of L1Hit objects L1Vector<L1Hit>& GetHits() { return vHits; } /// Gives an access to the vector of the strip flags L1Vector<unsigned char>& GetSFlag() { return fStripFlag; } - + /// Gets an access of the start indexes for different stations /// \return pointer to the first element of the array over the stations const L1HitIndex_t* GetHitsStartIndex() const { return HitsStartIndex; } @@ -65,27 +65,27 @@ struct L1AlgoInputData { // /// Placement new operator for single element void* operator new(size_t size, void* ptr) { return ::operator new(size, ptr); } - + /// Placement new operator for multiple elements void* operator new[](size_t size, void* ptr) { return ::operator new(size, ptr); } - + /// New operator for single element void* operator new(size_t size) { return _mm_malloc(size, 16); } - + /// New operator for multiple elements void* operator new[](size_t size) { return _mm_malloc(size, 16); } - + /// Delete operator for single element void operator delete(void* ptr, size_t) { _mm_free(ptr); } - + /// Delete operator for multiple elements void operator delete[](void* ptr, size_t) { _mm_free(ptr); } // TODO: Where are the definitions? (S.Zharko) - + /// Copy constructor L1AlgoInputData(const L1AlgoInputData& a); - + /// Copy assignment operator const L1AlgoInputData& operator=(const L1AlgoInputData& a);