diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/MMClusterization/IMMClusterBuilderTool.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/MMClusterization/IMMClusterBuilderTool.h index cca0eb4e3960c30598cc14b7f5eb27dd2ea12bf9..ef3f3efc665745bde86a4c41f7b4da7d2a804637 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/MMClusterization/IMMClusterBuilderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/MMClusterization/IMMClusterBuilderTool.h @@ -27,7 +27,7 @@ namespace Muon { public: // interface methods virtual StatusCode getClusters(std::vector<Muon::MMPrepData>& stripsVect, - std::vector<Muon::MMPrepData*>& clustersVect)=0; + std::vector<Muon::MMPrepData*>& clustersVect)const =0; }; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ConstraintAngleMMClusterBuilderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ConstraintAngleMMClusterBuilderTool.cxx index 26da87841cf86c1b88e080361289ba63494396ae..5ce28622b55d6885c51b6d9b1f82087b03abe7d9 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ConstraintAngleMMClusterBuilderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ConstraintAngleMMClusterBuilderTool.cxx @@ -99,7 +99,7 @@ StatusCode Muon::ConstraintAngleMMClusterBuilderTool::initialize(){ StatusCode Muon::ConstraintAngleMMClusterBuilderTool::getClusters(std::vector<Muon::MMPrepData>& MMprds, - std::vector<Muon::MMPrepData*>& clustersVec) + std::vector<Muon::MMPrepData*>& clustersVec) const { ATH_MSG_DEBUG("Running constraint angle MM cluster builder with: "<< MMprds.size() <<" MMprds"); std::vector<std::vector<Muon::MMPrepData>> prdsPerLayer(8,std::vector<Muon::MMPrepData>(0)); diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ConstraintAngleMMClusterBuilderTool.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ConstraintAngleMMClusterBuilderTool.h index c702c0fd38edd2fc5bedfbe73a8b637e87e632de..fc5ef04b82e14194f075432fda7b3540d0549f07 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ConstraintAngleMMClusterBuilderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ConstraintAngleMMClusterBuilderTool.h @@ -28,7 +28,7 @@ namespace Muon{ StatusCode getClusters(std::vector<Muon::MMPrepData>& MMprds, - std::vector<Muon::MMPrepData*>& clustersVec); + std::vector<Muon::MMPrepData*>& clustersVec) const; private: diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ProjectionMMClusterBuilderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ProjectionMMClusterBuilderTool.cxx index 3f7c645588a08e657fd23d11ee3585958feb402e..80a09166f9a9e404a7d4e7f85a20936d43447d07 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ProjectionMMClusterBuilderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ProjectionMMClusterBuilderTool.cxx @@ -57,7 +57,7 @@ StatusCode Muon::ProjectionMMClusterBuilderTool::initialize() StatusCode Muon::ProjectionMMClusterBuilderTool::getClusters(std::vector<Muon::MMPrepData>& MMprds, - std::vector<Muon::MMPrepData*>& clustersVect) + std::vector<Muon::MMPrepData*>& clustersVect) const { std::vector<std::vector<Muon::MMPrepData>> prdsPerLayer(8,std::vector<Muon::MMPrepData>(0)); @@ -137,7 +137,7 @@ return StatusCode::SUCCESS; StatusCode Muon::ProjectionMMClusterBuilderTool::calculateCorrection( - const std::vector<Muon::MMPrepData> &prdsOfLayer,std::vector<double>& v_posxc,std::vector<double>& v_cor){ + const std::vector<Muon::MMPrepData> &prdsOfLayer,std::vector<double>& v_posxc,std::vector<double>& v_cor)const { for(const auto& prd : prdsOfLayer){ double posx = prd.localPosition().x(); double posz = std::fabs(prd.globalPosition().z()); // use std::fabs of z to not break symetrie for A and C side @@ -158,7 +158,7 @@ StatusCode Muon::ProjectionMMClusterBuilderTool::calculateCorrection( } StatusCode Muon::ProjectionMMClusterBuilderTool::doFineScan(std::vector<int>& flag,const std::vector<double>& v_posxc, - const std::vector<double>& v_cor, std::vector<int>& idx_selected){ + const std::vector<double>& v_cor, std::vector<int>& idx_selected)const { double xmin = *std::min_element(v_posxc.begin(),v_posxc.end()); double xmax = *std::max_element(v_posxc.begin(),v_posxc.end()); double stepSize = 0.1; @@ -195,7 +195,7 @@ StatusCode Muon::ProjectionMMClusterBuilderTool::doFineScan(std::vector<int>& fl } StatusCode Muon::ProjectionMMClusterBuilderTool::doPositionCalculation(std::vector<double>& v_posxc, - const std::vector<double>& v_cor,const std::vector<int> idx_selected, double& xmean, double& xmeanErr,double& qtot,const std::vector<Muon::MMPrepData>& prdsOfLayer){ + const std::vector<double>& v_cor,const std::vector<int> idx_selected, double& xmean, double& xmeanErr,double& qtot,const std::vector<Muon::MMPrepData>& prdsOfLayer)const { //determine cluster charge qtot=0; for(const auto& idx:idx_selected) qtot+=prdsOfLayer.at(idx).charge(); @@ -214,7 +214,7 @@ StatusCode Muon::ProjectionMMClusterBuilderTool::doPositionCalculation(std::vec } -StatusCode Muon::ProjectionMMClusterBuilderTool::writeNewPrd(std::vector<Muon::MMPrepData*>& clustersVect,double xmean, double xerr,double qtot,const std::vector<int>& idx_selected,const std::vector<Muon::MMPrepData>& prdsOfLayer){ +StatusCode Muon::ProjectionMMClusterBuilderTool::writeNewPrd(std::vector<Muon::MMPrepData*>& clustersVect,double xmean, double xerr,double qtot,const std::vector<int>& idx_selected,const std::vector<Muon::MMPrepData>& prdsOfLayer)const { Amg::MatrixX* covN = new Amg::MatrixX(1,1); covN->coeffRef(0,0)=xerr; // TODO set proper uncertainty ATH_MSG_VERBOSE("Did set covN Matrix"); @@ -260,6 +260,6 @@ StatusCode Muon::ProjectionMMClusterBuilderTool::writeNewPrd(std::vector<Muon::M } -double Muon::ProjectionMMClusterBuilderTool::getSigma(double correction){ +double Muon::ProjectionMMClusterBuilderTool::getSigma(double correction)const { return stripErrorIntercept+stripErrorSlope*std::fabs(correction); } diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ProjectionMMClusterBuilderTool.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ProjectionMMClusterBuilderTool.h index 663153aed10a4e848885e69a417cb31ed7a29076..8084bdef6bd9ba46250cf1a1abdcd8d4df880058 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ProjectionMMClusterBuilderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ProjectionMMClusterBuilderTool.h @@ -40,8 +40,8 @@ namespace Muon virtual StatusCode initialize() override; /**Interface fuction to IMMClusterBuilderTool; calling function manages the pointers inside clustersVec */ - virtual - StatusCode getClusters(std::vector<Muon::MMPrepData>& MMprds, std::vector<Muon::MMPrepData*>& clustersVec) override; + + virtual StatusCode getClusters(std::vector<Muon::MMPrepData>& MMprds, std::vector<Muon::MMPrepData*>& clustersVec) const override; private: @@ -55,13 +55,13 @@ namespace Muon uint m_minClusterSize; - StatusCode calculateCorrection(const std::vector<Muon::MMPrepData> &prdsOfLayer,std::vector<double>& v_posxc,std::vector<double>& v_cor); - StatusCode doFineScan(std::vector<int>& flag,const std::vector<double>& v_posxc, const std::vector<double>& v_cor, std::vector<int>& idx_selected); - StatusCode doPositionCalculation(std::vector<double>& v_posxc, const std::vector<double>& v_cor, const std::vector<int> idx_selected,double& xmean, double& xmeanErr, double & qtot,const std::vector<Muon::MMPrepData>& prdsOfLayer); + StatusCode calculateCorrection(const std::vector<Muon::MMPrepData> &prdsOfLayer,std::vector<double>& v_posxc,std::vector<double>& v_cor) const ; + StatusCode doFineScan(std::vector<int>& flag,const std::vector<double>& v_posxc, const std::vector<double>& v_cor, std::vector<int>& idx_selected) const ; + StatusCode doPositionCalculation(std::vector<double>& v_posxc, const std::vector<double>& v_cor, const std::vector<int> idx_selected,double& xmean, double& xmeanErr, double & qtot,const std::vector<Muon::MMPrepData>& prdsOfLayer) const; - StatusCode writeNewPrd(std::vector<Muon::MMPrepData*>& clustersVect,double xmean, double xerr,double qtot,const std::vector<int>& idx_selected,const std::vector<Muon::MMPrepData>& prdsOfLayer); + StatusCode writeNewPrd(std::vector<Muon::MMPrepData*>& clustersVect,double xmean, double xerr,double qtot,const std::vector<int>& idx_selected,const std::vector<Muon::MMPrepData>& prdsOfLayer) const ; - double getSigma(double correction); + double getSigma(double correction)const; }; diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.cxx index f3987e5f8fc6849535b4ccf4a6b3ea6b15dbf7b9..64e04e587cb822f23aa76533a9f91d1bc29c6acc 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.cxx @@ -37,7 +37,7 @@ StatusCode Muon::SimpleMMClusterBuilderTool::finalize() } StatusCode Muon::SimpleMMClusterBuilderTool::getClusters(std::vector<Muon::MMPrepData>& MMprds, - std::vector<Muon::MMPrepData*>& clustersVect) + std::vector<Muon::MMPrepData*>& clustersVect) const { ATH_MSG_DEBUG("Size of the input vector: " << MMprds.size()); diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.h index 4ceab490661729739730e6bd9c43463efb79f685..07bee397ee57047a71d73412a88341c39ae2cfac 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.h @@ -35,7 +35,7 @@ namespace Muon virtual StatusCode finalize(); StatusCode getClusters(std::vector<Muon::MMPrepData>& stripsVect, - std::vector<Muon::MMPrepData*>& clustersVect); + std::vector<Muon::MMPrepData*>& clustersVect) const; private: /// Muon Detector Descriptor diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/UTPCMMClusterBuilderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/UTPCMMClusterBuilderTool.cxx index fd8d487b2896f89e72c37d547a94a11f3980a976..7f71354cd957c5c8661be1e4bf1f56136fa9f156 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/UTPCMMClusterBuilderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/UTPCMMClusterBuilderTool.cxx @@ -72,7 +72,8 @@ StatusCode Muon::UTPCMMClusterBuilderTool::initialize(){ } -StatusCode Muon::UTPCMMClusterBuilderTool::getClusters(std::vector<Muon::MMPrepData>& MMprds, std::vector<Muon::MMPrepData*>& clustersVect){ +StatusCode Muon::UTPCMMClusterBuilderTool::getClusters(std::vector<Muon::MMPrepData>& MMprds, + std::vector<Muon::MMPrepData*>& clustersVect)const { std::vector<std::vector<Muon::MMPrepData>> MMprdsPerLayer(8,std::vector<Muon::MMPrepData>(0)); for (const auto& MMprd:MMprds){ Identifier id = MMprd.identify(); @@ -207,7 +208,7 @@ StatusCode Muon::UTPCMMClusterBuilderTool::getClusters(std::vector<Muon::MMPrepD return StatusCode::SUCCESS; } -StatusCode Muon::UTPCMMClusterBuilderTool::runHoughTrafo(std::vector<int>& flag,std::vector<double>& xpos, std::vector<double>& time,std::vector<int>& idx_selected){ +StatusCode Muon::UTPCMMClusterBuilderTool::runHoughTrafo(std::vector<int>& flag,std::vector<double>& xpos, std::vector<double>& time,std::vector<int>& idx_selected)const{ ATH_MSG_DEBUG("beginning of runHoughTrafo() with: " << xpos.size() <<" hits" ); double maxX = *std::max_element(xpos.begin(),xpos.end()); double minX = *std::min_element(xpos.begin(),xpos.end()); @@ -229,7 +230,7 @@ StatusCode Muon::UTPCMMClusterBuilderTool::runHoughTrafo(std::vector<int>& flag, if(sc.isFailure()) return sc; return StatusCode::SUCCESS; } -StatusCode Muon::UTPCMMClusterBuilderTool::houghInitCummulator(std::unique_ptr<TH2D>& h_hough,double xmax,double xmin){ +StatusCode Muon::UTPCMMClusterBuilderTool::houghInitCummulator(std::unique_ptr<TH2D>& h_hough,double xmax,double xmin)const{ ATH_MSG_VERBOSE("xmax: "<< xmax <<" xmin: "<< xmin <<" m_dResolution "<< m_dResolution <<" m_alphaMin "<< m_alphaMin <<" m_alphaMax: "<< m_alphaMax <<" toRad: "<< toRad <<" m_alphaResolution: "<<m_alphaResolution); double dmax=std::max(std::fabs(xmin),std::fabs(xmax)); dmax=std::sqrt(std::pow(dmax,2)+std::pow(m_driftRange,2)); // rspace =sqrt(xmax*xmax+driftrange*driftrange) where driftrange is assumed to be 6mm @@ -243,7 +244,7 @@ StatusCode Muon::UTPCMMClusterBuilderTool::houghInitCummulator(std::unique_ptr<T return StatusCode::SUCCESS; } -StatusCode Muon::UTPCMMClusterBuilderTool::fillHoughTrafo(std::unique_ptr<TH2D>& h_hough,std::vector<int>& flag,std::vector<double>& xpos, std::vector<double>& time){ +StatusCode Muon::UTPCMMClusterBuilderTool::fillHoughTrafo(std::unique_ptr<TH2D>& h_hough,std::vector<int>& flag,std::vector<double>& xpos, std::vector<double>& time)const{ for(size_t i_hit=0; i_hit<xpos.size(); i_hit++){ if(flag.at(i_hit)!=0) continue; //skip hits which have been already used or been rejected as cross talk double x=xpos.at(i_hit); @@ -258,7 +259,7 @@ StatusCode Muon::UTPCMMClusterBuilderTool::fillHoughTrafo(std::unique_ptr<TH2D>& return StatusCode::SUCCESS; } -StatusCode Muon::UTPCMMClusterBuilderTool::findAlphaMax(std::unique_ptr<TH2D>& h_hough, std::vector<std::tuple<double,double>> &maxPos){ +StatusCode Muon::UTPCMMClusterBuilderTool::findAlphaMax(std::unique_ptr<TH2D>& h_hough, std::vector<std::tuple<double,double>> &maxPos)const{ int cmax = h_hough->GetMaximum(); if (cmax<m_houghMinCounts){ ATH_MSG_DEBUG("cmax "<< cmax<< "smaller then m_houghMinCounts "<<m_houghMinCounts); @@ -277,7 +278,7 @@ StatusCode Muon::UTPCMMClusterBuilderTool::findAlphaMax(std::unique_ptr<TH2D>& h } StatusCode Muon::UTPCMMClusterBuilderTool::selectTrack(std::vector<std::tuple<double,double>> &tracks,std::vector<double>& xpos, std::vector<double>& time, - std::vector<int>& flag, std::vector<int> &idxGoodStrips){ + std::vector<int>& flag, std::vector<int> &idxGoodStrips)const{ std::vector<double> chi2; std::vector<std::vector<int>> allGoodStrips; std::vector<int> ngoodStrips; @@ -333,7 +334,7 @@ StatusCode Muon::UTPCMMClusterBuilderTool::selectTrack(std::vector<std::tuple<do StatusCode Muon::UTPCMMClusterBuilderTool::transformParameters(double alpha, double d, double dRMS, double& slope, - double& intercept, double& interceptRMS){ + double& intercept, double& interceptRMS)const{ slope=1./std::tan(alpha); intercept=-d/std::sin(alpha); interceptRMS=std::fabs(dRMS); @@ -341,7 +342,7 @@ StatusCode Muon::UTPCMMClusterBuilderTool::transformParameters(double alpha, dou return StatusCode::SUCCESS; } -StatusCode Muon::UTPCMMClusterBuilderTool::applyCrossTalkCut(std::vector<int> &idxSelected,const std::vector<MMPrepData> &MMPrdsOfLayer,std::vector<int> &flag, int &nStripsCut){ +StatusCode Muon::UTPCMMClusterBuilderTool::applyCrossTalkCut(std::vector<int> &idxSelected,const std::vector<MMPrepData> &MMPrdsOfLayer,std::vector<int> &flag, int &nStripsCut)const{ int N=idxSelected.size(); bool removedStrip=false; if (N<3 || nStripsCut>=m_maxStripsCut ) return StatusCode::FAILURE; @@ -365,7 +366,7 @@ StatusCode Muon::UTPCMMClusterBuilderTool::applyCrossTalkCut(std::vector<int> &i } -StatusCode Muon::UTPCMMClusterBuilderTool::finalFit(const std::vector<Muon::MMPrepData> &mmPrd, std::vector<double>& time, std::vector<int>& idxSelected, double& x0, double &sigmaX0 ,double &fitAngle, double &chiSqProb){ +StatusCode Muon::UTPCMMClusterBuilderTool::finalFit(const std::vector<Muon::MMPrepData> &mmPrd, std::vector<double>& time, std::vector<int>& idxSelected, double& x0, double &sigmaX0 ,double &fitAngle, double &chiSqProb)const{ std::unique_ptr<TGraphErrors> fitGraph=std::unique_ptr<TGraphErrors>(new TGraphErrors()); std::unique_ptr<TF1> ffit=std::unique_ptr<TF1>(new TF1("ffit","pol1")); diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/UTPCMMClusterBuilderTool.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/UTPCMMClusterBuilderTool.h index e5507daf6df7becc38e60060192d9e91fe774497..81073b0dce2029315d8702cd84da97f7b77fb1d5 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/UTPCMMClusterBuilderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/UTPCMMClusterBuilderTool.h @@ -41,7 +41,7 @@ namespace Muon virtual StatusCode getClusters(std::vector<Muon::MMPrepData>& MMprds, - std::vector<Muon::MMPrepData*>& clustersVec) override; + std::vector<Muon::MMPrepData*>& clustersVec) const override; private: @@ -60,16 +60,16 @@ namespace Muon bool m_digiHasNegativeAngles; float m_scaleClusterError; - StatusCode runHoughTrafo(std::vector<int>& flag,std::vector<double>& xpos, std::vector<double>& time,std::vector<int>& idx_selected); - StatusCode fillHoughTrafo(std::unique_ptr<TH2D>& cummulator,std::vector<int>& flag, std::vector<double>& xpos, std::vector<double>& time); - StatusCode houghInitCummulator(std::unique_ptr<TH2D>& cummulator,double xmax,double xmin); + StatusCode runHoughTrafo(std::vector<int>& flag,std::vector<double>& xpos, std::vector<double>& time,std::vector<int>& idx_selected)const; + StatusCode fillHoughTrafo(std::unique_ptr<TH2D>& cummulator,std::vector<int>& flag, std::vector<double>& xpos, std::vector<double>& time)const; + StatusCode houghInitCummulator(std::unique_ptr<TH2D>& cummulator,double xmax,double xmin)const; - StatusCode findAlphaMax(std::unique_ptr<TH2D>& h_hough, std::vector<std::tuple<double,double>> &maxPos); - StatusCode selectTrack(std::vector<std::tuple<double,double>> &tracks,std::vector<double>& xpos, std::vector<double>& time,std::vector<int>& flag,std::vector<int>& idx_selected); + StatusCode findAlphaMax(std::unique_ptr<TH2D>& h_hough, std::vector<std::tuple<double,double>> &maxPos)const; + StatusCode selectTrack(std::vector<std::tuple<double,double>> &tracks,std::vector<double>& xpos, std::vector<double>& time,std::vector<int>& flag,std::vector<int>& idx_selected)const; - StatusCode transformParameters(double alpha, double d, double dRMS, double& slope,double& intercept, double& interceptRMS); - StatusCode applyCrossTalkCut(std::vector<int> &idxSelected,const std::vector<MMPrepData> &MMPrdsOfLayer,std::vector<int> &flag,int &nStripsCut); - StatusCode finalFit(const std::vector<Muon::MMPrepData> &mmPrd, std::vector<double>& time, std::vector<int>& idxSelected,double& x0, double &sigmaX0, double &fitAngle, double &chiSqProb); + StatusCode transformParameters(double alpha, double d, double dRMS, double& slope,double& intercept, double& interceptRMS)const; + StatusCode applyCrossTalkCut(std::vector<int> &idxSelected,const std::vector<MMPrepData> &MMPrdsOfLayer,std::vector<int> &flag,int &nStripsCut)const; + StatusCode finalFit(const std::vector<Muon::MMPrepData> &mmPrd, std::vector<double>& time, std::vector<int>& idxSelected,double& x0, double &sigmaX0, double &fitAngle, double &chiSqProb)const; }; diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/STgcClusterization/ISTgcClusterBuilderTool.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/STgcClusterization/ISTgcClusterBuilderTool.h index bfd45ffd843110657ee082a808478c3dba403cf9..593ca2176aec1ef6aae616c4c231f5dadb60f794 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/STgcClusterization/ISTgcClusterBuilderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/STgcClusterization/ISTgcClusterBuilderTool.h @@ -32,7 +32,7 @@ namespace Muon { // resolution of the single channel, and the vector of firing strips // virtual StatusCode getClusters(std::vector<Muon::sTgcPrepData>& stripsVect, - std::vector<Muon::sTgcPrepData*>& clustersVect)=0; + std::vector<Muon::sTgcPrepData*>& clustersVect)const=0; }; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/src/SimpleSTgcClusterBuilderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/src/SimpleSTgcClusterBuilderTool.cxx index 4b58b4a61ed862d574c9012cf0446d570dcbd074..e20d63c559797f55ae6f3120719e9127b0a25699 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/src/SimpleSTgcClusterBuilderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/src/SimpleSTgcClusterBuilderTool.cxx @@ -17,7 +17,7 @@ Muon::SimpleSTgcClusterBuilderTool::SimpleSTgcClusterBuilderTool(const std::stri AthAlgTool(t,n,p) { declareProperty("ChargeCut", m_chargeCut=0.0); - declareProperty("AllowHoles",m_allowHoles=true); + declareProperty("maxHoleSize",m_maxHoleSize=1); } Muon::SimpleSTgcClusterBuilderTool::~SimpleSTgcClusterBuilderTool() @@ -42,7 +42,7 @@ StatusCode Muon::SimpleSTgcClusterBuilderTool::finalize() // Build the clusters given a vector of single-hit PRD // StatusCode Muon::SimpleSTgcClusterBuilderTool::getClusters(std::vector<Muon::sTgcPrepData>& stripsVect, - std::vector<Muon::sTgcPrepData*>& clustersVect) + std::vector<Muon::sTgcPrepData*>& clustersVect) const { ATH_MSG_DEBUG("Size of the input vector: " << stripsVect.size()); @@ -62,17 +62,13 @@ StatusCode Muon::SimpleSTgcClusterBuilderTool::getClusters(std::vector<Muon::sTg else { ATH_MSG_DEBUG("Size of the channel vectors is zero"); return StatusCode::SUCCESS; - } - // clear the clusters vector - for ( unsigned int multilayer =0 ; multilayer<3 ; ++multilayer ) { - for ( unsigned int gasGap=0 ; gasGap<5 ; ++gasGap ) { - m_clusters[multilayer][gasGap].clear(); - m_clustersStripNum[multilayer][gasGap].clear(); - } } + std::vector<std::set<unsigned int>> clustersStripNum[2][4]; + std::vector<std::vector<Muon::sTgcPrepData>> clusters[2][4]; + for ( auto& it : stripsVect ) { - if ( !addStrip(it) ) { + if ( !addStrip(it,clustersStripNum,clusters) ) { ATH_MSG_ERROR("Could not add a strip to the sTGC clusters"); return StatusCode::FAILURE; } @@ -82,14 +78,14 @@ StatusCode Muon::SimpleSTgcClusterBuilderTool::getClusters(std::vector<Muon::sTg // clustersVect.clear(); - for ( unsigned int multilayer =0 ; multilayer<3 ; ++multilayer ) { - for ( unsigned int gasGap=0 ; gasGap<5 ; ++gasGap ) { + for ( unsigned int multilayer=0 ; multilayer<2 ; ++multilayer ) { + for ( unsigned int gasGap=0 ; gasGap<4 ; ++gasGap ) { // // loop on the clusters of that gap // - for ( unsigned int i=0 ; i<m_clusters[multilayer][gasGap].size() ; ++i ) { + for ( unsigned int i=0 ; i<clusters[multilayer][gasGap].size() ; ++i ) { // get the cluster - std::vector<Muon::sTgcPrepData> const &cluster = m_clusters[multilayer][gasGap].at(i); + std::vector<Muon::sTgcPrepData> const &cluster = clusters[multilayer][gasGap].at(i); // // loop on the strips and set the cluster weighted position and charge // @@ -169,13 +165,14 @@ StatusCode Muon::SimpleSTgcClusterBuilderTool::getClusters(std::vector<Muon::sTg } -bool Muon::SimpleSTgcClusterBuilderTool::addStrip(Muon::sTgcPrepData& strip) +bool Muon::SimpleSTgcClusterBuilderTool::addStrip(const Muon::sTgcPrepData& strip, std::vector<std::set<unsigned int>> clustersStripNum[2][4], + std::vector<std::vector<Muon::sTgcPrepData>> clusters[2][4])const { Identifier prd_id = strip.identify(); int channelType = m_idHelperSvc->stgcIdHelper().channelType(prd_id); - int multilayer = m_idHelperSvc->stgcIdHelper().multilayer(prd_id); - int gasGap = m_idHelperSvc->stgcIdHelper().gasGap(prd_id); + int multilayer = m_idHelperSvc->stgcIdHelper().multilayer(prd_id)-1; + int gasGap = m_idHelperSvc->stgcIdHelper().gasGap(prd_id)-1; unsigned int stripNum = m_idHelperSvc->stgcIdHelper().channel(prd_id); ATH_MSG_DEBUG(">>>>>>>>>>>>>> In addStrip: channelType, multilayer, gasGap, stripNum: " << channelType @@ -183,7 +180,7 @@ bool Muon::SimpleSTgcClusterBuilderTool::addStrip(Muon::sTgcPrepData& strip) << gasGap << " " << stripNum); // if no cluster is present start creating a new one - if ( m_clustersStripNum[multilayer][gasGap].size()==0 ) { + if (clustersStripNum[multilayer][gasGap].size()==0 ) { ATH_MSG_DEBUG( ">>> No strip present in this gap: adding it as first cluster " ); set<unsigned int> clusterStripNum; @@ -192,13 +189,13 @@ bool Muon::SimpleSTgcClusterBuilderTool::addStrip(Muon::sTgcPrepData& strip) clusterStripNum.insert(stripNum); cluster.push_back(strip); - std::vector<std::set<unsigned int>> &clustersStripNum = m_clustersStripNum[multilayer][gasGap]; - std::vector<std::vector<Muon::sTgcPrepData>> &clusters = m_clusters[multilayer][gasGap]; + std::vector<std::set<unsigned int>> &clustersOfLayerStripNum = clustersStripNum[multilayer][gasGap]; + std::vector<std::vector<Muon::sTgcPrepData>> &clustersOfLayer = clusters[multilayer][gasGap]; - clustersStripNum.emplace_back(); - clustersStripNum.back().insert(stripNum); - clusters.emplace_back(); - clusters.back().push_back(strip); + clustersOfLayerStripNum.emplace_back(); + clustersOfLayerStripNum.back().insert(stripNum); + clustersOfLayer.emplace_back(); + clustersOfLayer.back().push_back(strip); return true; } @@ -207,28 +204,26 @@ bool Muon::SimpleSTgcClusterBuilderTool::addStrip(Muon::sTgcPrepData& strip) // // check if the strip can be added to a cluster // - for ( unsigned int i=0 ; i<m_clustersStripNum[multilayer][gasGap].size() ; ++i ) { + for ( unsigned int i=0 ; i<clustersStripNum[multilayer][gasGap].size() ; ++i ) { - set<unsigned int> &clusterStripNum = m_clustersStripNum[multilayer][gasGap].at(i); + set<unsigned int> &clusterStripNum = clustersStripNum[multilayer][gasGap].at(i); unsigned int firstStrip = *(clusterStripNum.begin()); unsigned int lastStrip = *(--clusterStripNum.end()); - ATH_MSG_DEBUG("First strip and last strip are: " << firstStrip << " " << lastStrip); unsigned int diffFirst = (stripNum-firstStrip) > 0 ? stripNum - firstStrip : firstStrip-stripNum ; unsigned int diffLast = (stripNum-lastStrip) > 0 ? stripNum - lastStrip : lastStrip-stripNum ; - if ( (stripNum==lastStrip+1 || stripNum==firstStrip-1) - || (m_allowHoles && ( diffFirst<=2 || diffLast<=2 ))) { - + if ( diffFirst<=m_maxHoleSize + 1 || diffLast<=m_maxHoleSize + 1) { + ATH_MSG_DEBUG(">> inserting a new strip"); - m_clustersStripNum[multilayer][gasGap].at(i).insert(stripNum); - m_clusters[multilayer][gasGap].at(i).push_back(strip); + clustersStripNum[multilayer][gasGap].at(i).insert(stripNum); + clusters[multilayer][gasGap].at(i).push_back(strip); - ATH_MSG_DEBUG("size after inserting is: " << m_clustersStripNum[multilayer][gasGap].at(i).size()); + ATH_MSG_DEBUG("size after inserting is: " << clustersStripNum[multilayer][gasGap].at(i).size()); ATH_MSG_DEBUG("and the first and last strip are: " - << *(m_clustersStripNum[multilayer][gasGap].at(i).begin()) << " " - << *(--m_clustersStripNum[multilayer][gasGap].at(i).end())); - return true; + << *(clustersStripNum[multilayer][gasGap].at(i).begin()) << " " + << *(--clustersStripNum[multilayer][gasGap].at(i).end())); + return true; } } // if not, build a new cluster starting from it @@ -239,8 +234,8 @@ bool Muon::SimpleSTgcClusterBuilderTool::addStrip(Muon::sTgcPrepData& strip) clusterStripNum.insert(stripNum); cluster.push_back(strip); - m_clustersStripNum[multilayer][gasGap].push_back(clusterStripNum); - m_clusters[multilayer][gasGap].push_back(cluster); + clustersStripNum[multilayer][gasGap].push_back(clusterStripNum); + clusters[multilayer][gasGap].push_back(cluster); return true; } @@ -251,7 +246,7 @@ bool Muon::SimpleSTgcClusterBuilderTool::addStrip(Muon::sTgcPrepData& strip) /// /// sort the strips if needed void SimpleSTgcClusterBuilderTool::dumpStrips( std::vector<Muon::sTgcPrepData>& stripsVect, - std::vector<Muon::sTgcPrepData*>& clustersVect ) + std::vector<Muon::sTgcPrepData*>& clustersVect ) const { ATH_MSG_INFO("====> Dumping all strips: "); diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/src/SimpleSTgcClusterBuilderTool.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/src/SimpleSTgcClusterBuilderTool.h index 1587d8ff3cdb1f06c73d1c390f023c4c76c5c486..0e0e4c8f4ae2bd1498d66911515ce217d37e7b87 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/src/SimpleSTgcClusterBuilderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/src/SimpleSTgcClusterBuilderTool.h @@ -43,23 +43,21 @@ namespace Muon virtual StatusCode finalize(); StatusCode getClusters(std::vector<Muon::sTgcPrepData>& stripsVect, - std::vector<Muon::sTgcPrepData*>& clustersVect); + std::vector<Muon::sTgcPrepData*>& clustersVect)const; private: double m_chargeCut; - bool m_allowHoles; + unsigned int m_maxHoleSize; ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - std::vector<std::set<unsigned int>> m_clustersStripNum[3][5]; - std::vector<std::vector<Muon::sTgcPrepData>> m_clusters[3][5]; - /// private functions void dumpStrips( std::vector<Muon::sTgcPrepData>& stripsVect, - std::vector<Muon::sTgcPrepData*>& clustersVect ); + std::vector<Muon::sTgcPrepData*>& clustersVect )const; - bool addStrip(Muon::sTgcPrepData& strip); + bool addStrip(const Muon::sTgcPrepData& strip,std::vector<std::set<unsigned int>> clustersStripNum[2][4], + std::vector<std::vector<Muon::sTgcPrepData>> clusters[2][4])const; };