From 19215ab05896ba57767942d76dc68e91173cd75f Mon Sep 17 00:00:00 2001 From: Maximilian Goblirsch-Kolb <goblirsc@cern.ch> Date: Fri, 9 Oct 2020 11:46:18 +0200 Subject: [PATCH] replace "UsedFlag" by a simple book --- .../SiDetElementRoadMakerData_xk.h | 19 +------------------ .../src/SiDetElementRoadMakerData_xk.cxx | 2 +- .../SiDetElementsLayer_xk.h | 6 +++--- .../src/SiDetElementsLayer_xk.cxx | 14 +++++++------- .../src/SiDetElementsRoadMaker_xk.cxx | 2 -- 5 files changed, 12 insertions(+), 31 deletions(-) diff --git a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiDetElementRoadMakerData_xk.h b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiDetElementRoadMakerData_xk.h index f85a241ef31f..260bbdc0dd4a 100644 --- a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiDetElementRoadMakerData_xk.h +++ b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiDetElementRoadMakerData_xk.h @@ -28,23 +28,6 @@ namespace InDet { class SiDetElementRoadMakerData_xk { public: - /// This helper class is used to keep track of - /// which detector elements are already being - /// considered when forming a search road during - /// the extension of silicon seeds through the full - /// Si detectors. - class UsedFlag { - public: - UsedFlag() : m_used(false) {} - /// read the flag - bool used() const { return m_used; } - /// toggle the flag - void setUsed() { m_used=true; } - /// reset without having to overwrite the object - void reset(){ m_used=false;} - private: - bool m_used; - }; /// trivial constructor - the members of this event /// data struct need client tool information for @@ -69,7 +52,7 @@ namespace InDet { /// are already on a search road. Nested in the hierarchy of /// detector region - layer - module within layer. /// Dynamic to avoid hard-coding a certain geometry. - typedef std::array<std::vector<std::vector<UsedFlag> >,3> ElementUsageTracker; + typedef std::array<std::vector<std::vector<bool> >,3> ElementUsageTracker; ElementUsageTracker elementUsageTracker; /// Flag to check if the event data was already initialized by the client tool. diff --git a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/SiDetElementRoadMakerData_xk.cxx b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/SiDetElementRoadMakerData_xk.cxx index 56dc7e91c6d1..71c439d4e0cd 100644 --- a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/SiDetElementRoadMakerData_xk.cxx +++ b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/SiDetElementRoadMakerData_xk.cxx @@ -4,7 +4,7 @@ void InDet::SiDetElementRoadMakerData_xk::resetUsageTracker(){ for (auto & outerVec : elementUsageTracker){ /// loop over detector regions for (auto & innerVec : outerVec){ /// loop over layers in region - std::for_each(innerVec.begin(), innerVec.end(), [](InDet::SiDetElementRoadMakerData_xk::UsedFlag & flag){flag.reset();}); /// loop over elements on layer + std::fill(innerVec.begin(), innerVec.end(), false); /// loop over elements on layer } } } \ No newline at end of file diff --git a/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/SiDetElementsRoadTool_xk/SiDetElementsLayer_xk.h b/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/SiDetElementsRoadTool_xk/SiDetElementsLayer_xk.h index 0d80dff26644..915e3f65f3a0 100644 --- a/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/SiDetElementsRoadTool_xk/SiDetElementsLayer_xk.h +++ b/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/SiDetElementsRoadTool_xk/SiDetElementsLayer_xk.h @@ -81,13 +81,13 @@ namespace InDet{ (const std::array<float,6> & startingPoint, const std::array<float,3> & searchDirection, std::vector<InDet::SiDetElementLink_xk::ElementWay> &lDE, - std::vector<InDet::SiDetElementRoadMakerData_xk::UsedFlag> &used) const; + std::vector<bool> &used) const; void getEndcapDetElements (const std::array<float,6> & startingPoint, const std::array<float,3> & searchDirection, std::vector<InDet::SiDetElementLink_xk::ElementWay> &lDE, - std::vector<InDet::SiDetElementRoadMakerData_xk::UsedFlag> &used) const; + std::vector<bool> &used) const; void sortDetectorElements(); @@ -114,7 +114,7 @@ namespace InDet{ float phiCrossing, float reducedRoadWidth, std::vector<InDet::SiDetElementLink_xk::ElementWay> &lDE, - std::vector<InDet::SiDetElementRoadMakerData_xk::UsedFlag> &used) const; + std::vector<bool> &used) const; }; ///////////////////////////////////////////////////////////////////////////////// diff --git a/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/src/SiDetElementsLayer_xk.cxx b/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/src/SiDetElementsLayer_xk.cxx index 7c7e33ef81a6..f79ab320f6ec 100644 --- a/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/src/SiDetElementsLayer_xk.cxx +++ b/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/src/SiDetElementsLayer_xk.cxx @@ -31,7 +31,7 @@ void InDet::SiDetElementsLayer_xk::getBarrelDetElements (const std::array<float,6> & startingPoint, const std::array<float,3> & searchDirection, std::vector<InDet::SiDetElementLink_xk::ElementWay> &lDE, - std::vector<InDet::SiDetElementRoadMakerData_xk::UsedFlag> &used) const + std::vector<bool> &used) const { /// In the following, identify where we cross the layer in r @@ -99,7 +99,7 @@ void InDet::SiDetElementsLayer_xk::getEndcapDetElements (const std::array<float,6> & startingPoint, const std::array<float,3> & searchDirection, std::vector<InDet::SiDetElementLink_xk::ElementWay> &lDE, - std::vector<InDet::SiDetElementRoadMakerData_xk::UsedFlag> &used) const + std::vector<bool> &used) const { /// solve the linear equation /// z_layer = z_startingPont + s * z_searchDirection @@ -137,7 +137,7 @@ void InDet::SiDetElementsLayer_xk::getDetElements float phiCrossing, float reducedRoadWidth, std::vector<InDet::SiDetElementLink_xk::ElementWay> &lDE, - std::vector<InDet::SiDetElementRoadMakerData_xk::UsedFlag> &used) const + std::vector<bool> &used) const { constexpr float pi = M_PI; constexpr float pi2 = 2.*pi; @@ -166,7 +166,7 @@ void InDet::SiDetElementsLayer_xk::getDetElements while(1) { assert( static_cast<unsigned int>(i)<m_elements.size() ); /// if detector element i on this layer is not already used for this road - if(!used[i].used()) { + if(!used[i]) { /// float dPhi =std::abs(m_elements[i].phi()-phiCrossing); if(dPhi>pi) dPhi=std::abs(dPhi-pi2); /// project delta phi into -pi..pi @@ -187,7 +187,7 @@ void InDet::SiDetElementsLayer_xk::getDetElements ) { /// we found a compatible detector element - add to our list lDE.push_back(InDet::SiDetElementLink_xk::ElementWay(&m_elements[i],startingPoint[5]+intersectionOutcome[2],std::max(intersectionOutcome[0],intersectionOutcome[1]))); - used[i].setUsed(); + used[i]=true; } } ++i; @@ -204,7 +204,7 @@ void InDet::SiDetElementsLayer_xk::getDetElements /// stop at full circle if(i==i1) return; assert( static_cast<unsigned int>(i)<m_elements.size() ); - if(!used[i].used()) { + if(!used[i]) { float dPhi =std::abs(m_elements[i].phi()-phiCrossing); if(dPhi>pi) dPhi=std::abs(dPhi-pi2); if((dPhi-reducedRoadWidth)>m_dfe) return; @@ -212,7 +212,7 @@ void InDet::SiDetElementsLayer_xk::getDetElements if((intersectionOutcome[0]-startingPoint[4])<=0 && (intersectionOutcome[1]-startingPoint[4])<=0.) { lDE.push_back(InDet::SiDetElementLink_xk::ElementWay(&m_elements[i],startingPoint[5]+intersectionOutcome[2],std::max(intersectionOutcome[0],intersectionOutcome[1]))); - used[i].setUsed(); + used[i]=true; } } } diff --git a/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/src/SiDetElementsRoadMaker_xk.cxx b/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/src/SiDetElementsRoadMaker_xk.cxx index 1c39130f9942..76317bce2b51 100644 --- a/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/src/SiDetElementsRoadMaker_xk.cxx +++ b/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/src/SiDetElementsRoadMaker_xk.cxx @@ -43,8 +43,6 @@ InDet::SiDetElementsRoadMaker_xk::SiDetElementsRoadMaker_xk StatusCode InDet::SiDetElementsRoadMaker_xk::initialize() { //Class optimization checks - static_assert(std::is_trivially_copyable<SiDetElementRoadMakerData_xk::UsedFlag>::value); - static_assert(std::is_trivially_destructible<SiDetElementRoadMakerData_xk::UsedFlag>::value); static_assert(std::is_trivially_copyable<SiDetElementLink_xk::ElementWay>::value); static_assert(std::is_trivially_destructible<SiDetElementLink_xk::ElementWay>::value); static_assert(std::is_trivially_copyable<SiDetElementLink_xk>::value); -- GitLab