diff --git a/algo/CMakeLists.txt b/algo/CMakeLists.txt index 2841c8f7e2f44a43f9e988a7d8d537694afe5e15..d66378af48aa36385b2c27a201dcaee99be8c3e3 100644 --- a/algo/CMakeLists.txt +++ b/algo/CMakeLists.txt @@ -35,7 +35,7 @@ set(SRCS detectors/much/ReadoutConfig.cxx detectors/much/Unpack.cxx detectors/tof/HitFinder.cxx - detectors/tof/ClusterizerTof.cxx + detectors/tof/Clusterizer.cxx detectors/tof/ReadoutConfig.cxx detectors/tof/Unpack.cxx detectors/bmon/ReadoutConfig.cxx diff --git a/algo/detectors/tof/ClusterizerTof.cxx b/algo/detectors/tof/Clusterizer.cxx similarity index 95% rename from algo/detectors/tof/ClusterizerTof.cxx rename to algo/detectors/tof/Clusterizer.cxx index 7f12af2f7dc79036e9aec95ad723ed2703de136f..62f7bef70c441e0d6b7e53112cb75786af8e426f 100644 --- a/algo/detectors/tof/ClusterizerTof.cxx +++ b/algo/detectors/tof/Clusterizer.cxx @@ -2,7 +2,7 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Dominik Smith [committer], Pierre-Alain Loizeau */ -#include "ClusterizerTof.h" +#include "Clusterizer.h" // TOF Classes and includes #include "CbmTofDigi.h" @@ -13,17 +13,17 @@ #include <iostream> #include <map> -namespace cbm::algo +namespace cbm::algo::tof { - ClusterizerTof::resultType ClusterizerTof::operator()(inputType digisIn) + Clusterizer::resultType Clusterizer::operator()(inputType digisIn) { //std::vector<inputType> input = calibrateDigis(digisIn); std::vector<inputType> input = chanSortDigis(digisIn); return buildClusters(input); } - std::vector<ClusterizerTof::inputType> ClusterizerTof::chanSortDigis(inputType& digisIn) + std::vector<Clusterizer::inputType> Clusterizer::chanSortDigis(inputType& digisIn) { std::vector<inputType> result(fParams.fChanPar.size()); //[nbCh][nDigis] @@ -38,7 +38,7 @@ namespace cbm::algo //This calibration cannot reproduce the non RPC-parallel version, as the digi indices //will be invalidated whenever digis are discarded in the dead-time check. - std::vector<ClusterizerTof::inputType> ClusterizerTof::calibrateDigis(inputType& digisIn) + std::vector<Clusterizer::inputType> Clusterizer::calibrateDigis(inputType& digisIn) { std::vector<inputType> result(fParams.fChanPar.size()); const int32_t numClWalkBinX = fParams.numClWalkBinX; @@ -117,7 +117,7 @@ namespace cbm::algo } - ClusterizerTof::resultType ClusterizerTof::buildClusters(std::vector<inputType>& input) + Clusterizer::resultType Clusterizer::buildClusters(std::vector<inputType>& input) { // Hit variables TofCluster cluster; @@ -258,8 +258,8 @@ namespace cbm::algo } - bool ClusterizerTof::AddNextChan(std::vector<inputType>& input, int32_t lastChan, TofCluster& cluster, - std::vector<TofCluster>& clustersOut) + bool Clusterizer::AddNextChan(std::vector<inputType>& input, int32_t lastChan, TofCluster& cluster, + std::vector<TofCluster>& clustersOut) { //D.Smith 25.8.23: Why are "C" digis (position "2") not considered here? @@ -328,7 +328,7 @@ namespace cbm::algo /* - ClusterizerTof::resultType ClusterizerTof::buildClusters(inputType& input) + Clusterizer::resultType Clusterizer::buildClusters(inputType& input) { // Intermediate storage variables std::vector<std::vector<CbmTofDigi*>>& digisExp = input.first; //[nbCh][nDigis] @@ -354,7 +354,7 @@ namespace cbm::algo std::vector<CbmTofDigi*>& storDigiExp = digisExp[chan]; std::vector<int32_t>& storDigiInd = digisInd[chan]; - ClusterizerTofChanPar& chanPar = fParams.fChanPar[chan]; + ClusterizerChanPar& chanPar = fParams.fChanPar[chan]; auto digiExpIt = storDigiExp.begin(); auto digiIndIt = storDigiInd.begin(); @@ -442,4 +442,4 @@ namespace cbm::algo return clustersOut; } */ -} /* namespace cbm::algo */ +} // namespace cbm::algo::tof diff --git a/algo/detectors/tof/ClusterizerTof.h b/algo/detectors/tof/Clusterizer.h similarity index 85% rename from algo/detectors/tof/ClusterizerTof.h rename to algo/detectors/tof/Clusterizer.h index 33f254da5c019cf974f2dc207c271723c1bcd78d..ac2776002e2d37e804d626d3a7965dd9694e278c 100644 --- a/algo/detectors/tof/ClusterizerTof.h +++ b/algo/detectors/tof/Clusterizer.h @@ -3,12 +3,7 @@ Authors: Dominik Smith [committer], Pierre-Alain Loizeau */ /* - This algo was based on CbmTofSimpClusterizer, which can be used only for simulation of the main setup and - is as the name implies a simplified solution. - A later step will be the replacement with a version based on CbmTofEventClusterizer, which is the version - currently maintained, based on what we learned from real data at mCBM. - This step will be required to apply the algo to real/online data and to prepare - our simulations for first CBM beam + This algo was based on CbmTofEventClusterizer */ #ifndef CLUSTERIZERTOF_H @@ -27,7 +22,7 @@ class CbmTofDigi; #include <cmath> -namespace cbm::algo +namespace cbm::algo::tof { struct TofCell { double sizeX, sizeY; @@ -35,7 +30,7 @@ namespace cbm::algo ROOT::Math::Rotation3D rotation; }; - struct ClusterizerTofChanPar { + struct ClusterizerChanPar { std::vector<double> fvCPTOff; //[nbSide] std::vector<double> fvCPTotGain; //[nbSide] std::vector<double> fvCPTotOff; //[nbSide] @@ -44,7 +39,7 @@ namespace cbm::algo TofCell cell; }; - struct ClusterizerTofRpcPar { + struct ClusterizerRpcPar { uint32_t fDeadStrips; double fPosYMaxScal; double fdMaxTimeDist; @@ -59,7 +54,7 @@ namespace cbm::algo double fCPTOffYBinWidth; double fCPTOffYRange; std::vector<double> fCPTOffY; //[nBin] - std::vector<ClusterizerTofChanPar> fChanPar = {}; + std::vector<ClusterizerChanPar> fChanPar = {}; }; struct TofCluster { @@ -115,7 +110,7 @@ namespace cbm::algo weightedTimeErr = timeErr; } - void finalize(const TofCell& trafoCell, const ClusterizerTofRpcPar& par) + void finalize(const TofCell& trafoCell, const ClusterizerRpcPar& par) { // prepare local->global trafo ROOT::Math::Rotation3D rotMatrix = trafoCell.rotation; @@ -150,7 +145,7 @@ namespace cbm::algo } }; - class ClusterizerTof { + class Clusterizer { public: typedef std::vector<TofCluster> resultType; typedef std::vector<std::pair<CbmTofDigi*, int32_t>> inputType; @@ -158,12 +153,12 @@ namespace cbm::algo /** ** @brief Constructor. **/ - ClusterizerTof() {}; + Clusterizer() {}; /** ** @brief Destructor. **/ - ~ClusterizerTof() {}; + ~Clusterizer() {}; /** ** @brief Build clusters out of ToF Digis and store the resulting info in a TofHit. @@ -173,10 +168,10 @@ namespace cbm::algo /** @brief Set the parameter container ** @param params Vectorer to parameter container **/ - void SetParams(std::unique_ptr<ClusterizerTofRpcPar> params) { fParams = *(std::move(params)); } + void SetParams(std::unique_ptr<ClusterizerRpcPar> params) { fParams = *(std::move(params)); } private: - ClusterizerTofRpcPar fParams = {}; ///< Parameter container + ClusterizerRpcPar fParams = {}; ///< Parameter container std::vector<inputType> calibrateDigis(inputType& digisIn); std::vector<inputType> chanSortDigis(inputType& digisIn); @@ -189,6 +184,6 @@ namespace cbm::algo int32_t numSameSide; // Digis quality }; -} /* namespace cbm::algo */ +} // namespace cbm::algo::tof #endif // CLUSTERIZERTOF_H diff --git a/reco/tasks/CbmTaskTofClusterizer.cxx b/reco/tasks/CbmTaskTofClusterizer.cxx index 7e90676aeb616eea7f229eb15efc6219098d6238..edf3d2271682d9dd09d62ac967b290798a20fdf8 100644 --- a/reco/tasks/CbmTaskTofClusterizer.cxx +++ b/reco/tasks/CbmTaskTofClusterizer.cxx @@ -694,7 +694,7 @@ bool CbmTaskTofClusterizer::InitAlgos() int32_t iNbRpc = fDigiBdfPar->GetNbRpc(iSmType); for (int32_t iSm = 0; iSm < iNbSm; iSm++) { for (int32_t iRpc = 0; iRpc < iNbRpc; iRpc++) { - std::unique_ptr<cbm::algo::ClusterizerTofRpcPar> par(new cbm::algo::ClusterizerTofRpcPar()); + std::unique_ptr<cbm::algo::tof::ClusterizerRpcPar> par(new cbm::algo::tof::ClusterizerRpcPar()); const int32_t iDetId = CbmTofAddress::GetUniqueAddress(iSm, iRpc, 0, 0, iSmType); const int32_t iDetIndx = detIdIndexMap[iDetId]; @@ -725,8 +725,8 @@ bool CbmTaskTofClusterizer::InitAlgos() const double* tra_ptr = gGeoManager->MakePhysicalNode()->GetMatrix()->GetTranslation(); //init Tof cell - cbm::algo::TofCell& cell = par->fChanPar[iCh].cell; - cell.pos = ROOT::Math::XYZVector(tra_ptr[0], tra_ptr[1], tra_ptr[2]); + cbm::algo::tof::TofCell& cell = par->fChanPar[iCh].cell; + cell.pos = ROOT::Math::XYZVector(tra_ptr[0], tra_ptr[1], tra_ptr[2]); /* why doesn't this variant work? cell.pos.SetX(channelInfo->GetX()); @@ -921,7 +921,7 @@ bool CbmTaskTofClusterizer::BuildClusters() std::vector<std::pair<CbmTofDigi*, int32_t>>& digiExp = fStorDigi[iSmType][rpcIdx]; //call cluster finder - std::vector<cbm::algo::TofCluster> clusters = fAlgo[iSmType][rpcIdx](digiExp); + std::vector<cbm::algo::tof::TofCluster> clusters = fAlgo[iSmType][rpcIdx](digiExp); //Store hits and match for (auto const& cluster : clusters) { @@ -959,7 +959,7 @@ void CbmTaskTofClusterizer::StoreHit(TofCluster& cluster, int32_t iSmType, int32 double* tra_ptr = fCellIdGeoMap[iChId]->GetMatrix()->GetTranslation(); double* rot_ptr = fCellIdGeoMap[iChId]->GetMatrix()->GetRotationMatrix(); - TofCell cell; + tof::TofCell cell; cell.pos = ROOT::Math::XYZVector(tra_ptr[0], tra_ptr[1], tra_ptr[2]); cell.rotation = ROOT::Math::Rotation3D(&rot_ptr[0], &rot_ptr[9]); cell.sizeX = fDigiPar->GetCell(iChId)->GetSizex(); @@ -969,7 +969,7 @@ void CbmTaskTofClusterizer::StoreHit(TofCluster& cluster, int32_t iSmType, int32 //int32_t iChm = floor(cluster.weightedPos.X() / fChannelInfo->GetSizex()) + iNbCh / 2; //D.Smith 15.8.23: Can we drop the condition? - if (5 != iSmType) { cluster.finalize(cell, iNbCh, ClusterizerTofRpcPar()); } + if (5 != iSmType) { cluster.finalize(cell, iNbCh, tof::ClusterizerRpcPar()); } TVector3 hitPos(cluster.globalPos.X(), cluster.globalPos.Y(), cluster.globalPos.Z()); TVector3 hitPosErr(cluster.globalErr.X(), cluster.globalErr.Y(), cluster.globalErr.Z()); diff --git a/reco/tasks/CbmTaskTofClusterizer.h b/reco/tasks/CbmTaskTofClusterizer.h index d5e9df9cd4d064e17fee69ca48357140f782b953..e599f6dd7f4fe1366e17dac06f4bc6f6f4faa522 100644 --- a/reco/tasks/CbmTaskTofClusterizer.h +++ b/reco/tasks/CbmTaskTofClusterizer.h @@ -19,7 +19,7 @@ class CbmTsEventHeader; #include "CbmMatch.h" #include "CbmTofDigi.h" -#include "tof/ClusterizerTof.h" +#include "tof/Clusterizer.h" // ROOT Classes and includes #include "Math/Rotation3D.h" @@ -149,7 +149,7 @@ private: bool InitAlgos(); // Hit finder algo - std::map<uint32_t, std::map<uint32_t, cbm::algo::ClusterizerTof>> fAlgo = {}; //[nbType][nbSm*nbRpc] + std::map<uint32_t, std::map<uint32_t, cbm::algo::tof::Clusterizer>> fAlgo = {}; //[nbType][nbSm*nbRpc] // ToF geometry variables CbmTofDetectorId* fTofId;