diff --git a/InnerDetector/InDetConfig/python/TRT_TrackHoleSearchConfig.py b/InnerDetector/InDetConfig/python/TRT_TrackHoleSearchConfig.py index 8e58ecc9c34bdfb40822fcfeb51a02bf07858228..053efc0443d925cf3194782ec98a8f084eb7b698 100644 --- a/InnerDetector/InDetConfig/python/TRT_TrackHoleSearchConfig.py +++ b/InnerDetector/InDetConfig/python/TRT_TrackHoleSearchConfig.py @@ -9,8 +9,8 @@ def TRTTrackHoleSearchToolCfg(flags, name="TRTTrackHoleSearchTool", **kwargs): if "extrapolator" not in kwargs: from TrkConfig.AtlasExtrapolatorConfig import AtlasExtrapolatorCfg - kwargs.setdefault("extrapolator", acc.addPublicTool( - acc.popToolsAndMerge(AtlasExtrapolatorCfg(flags)))) + kwargs.setdefault("extrapolator", acc.popToolsAndMerge( + AtlasExtrapolatorCfg(flags))) acc.setPrivateTools(CompFactory.TRTTrackHoleSearchTool(name, **kwargs)) return acc diff --git a/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/TRT_TrackHoleSearch/TRTStrawEfficiency.h b/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/TRT_TrackHoleSearch/TRTStrawEfficiency.h index b9a89c616ac59fa94b80c854a0b1b4a6cadf6dbb..5ea2ed14e542fab984cb23af8f2e37f407ffd077 100644 --- a/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/TRT_TrackHoleSearch/TRTStrawEfficiency.h +++ b/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/TRT_TrackHoleSearch/TRTStrawEfficiency.h @@ -1,6 +1,6 @@ // this is c++ file -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ // TRTStrawEfficiency.h @@ -24,13 +24,15 @@ #include "StoreGate/ReadHandleKey.h" +#include "CLHEP/Units/SystemOfUnits.h" + #include <string> #include <vector> namespace Trk { - class ITrackHoleSearchTool; - class TrackStateOnSurface; + class ITrackHoleSearchTool; + class TrackStateOnSurface; } class TRT_ID; @@ -39,113 +41,115 @@ class TTree; class TRTStrawEfficiency : public AthAlgorithm { - public: - TRTStrawEfficiency(const std::string& name, ISvcLocator* pSvcLocator); - - StatusCode initialize(); - StatusCode finalize(); - StatusCode execute(); - - private: - // configurables - //---------------------------------- - ToolHandle<Trk::ITrackHoleSearchTool> m_trt_hole_finder; - float m_max_abs_d0; - float m_max_abs_z0; - float m_min_pT; - float m_min_p; /* added by dan */ - float m_max_abs_eta; - int m_min_pixel_hits; - int m_min_sct_hits; - int m_min_trt_hits; - ServiceHandle<ITHistSvc> m_hist_svc; - ServiceHandle<ITRT_StrawNeighbourSvc> m_TRTStrawNeighbourSvc; - std::string m_tree_name; - std::string m_stream_name; - std::string m_required_trigger; - - // private data - //---------------------------------- - TTree* m_tree; - const TRT_ID* m_TRT_ID; - PublicToolHandle<Trk::IUpdator> m_updator - {this,"KalmanUpdator","Trk::KalmanUpdator/TrkKalmanUpdator",""}; - PublicToolHandle<Trig::ITrigDecisionTool> m_trigDec - {this,"ITrigDecisionTool","Trig::ITrigDecisionTool/TrigDecisionTool",""}; - - // Data handles - SG::ReadHandleKey<TrackCollection> m_tracksKey{this, "track_collection", "CombinedInDetTracks", "Tracks container key"}; - SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this, "event_info_key", "EventInfo", "Event info key"}; - SG::ReadHandleKey<xAOD::VertexContainer> m_vertexContainerKey{this, "VertexContainerName", "PrimaryVertices", "Vertex container key"}; - - unsigned int m_num_events; - unsigned int m_num_tracks; - unsigned int m_num_preselected_tracks; - - // ntuple branches - unsigned int m_event_number; - unsigned int m_run_number; - unsigned int m_lumi_block; - float m_track_pt; - float m_track_eta; - float m_track_phi; - float m_track_d0; - float m_track_z0; - int m_n_pixel_hits; - int m_n_sct_hits; - int m_n_trt_hits; - std::vector<int> m_hit_bec; - std::vector<int> m_hit_phi; - std::vector<int> m_hit_layer; - std::vector<int> m_hit_strawlayer; - std::vector<int> m_hit_straw; - std::vector<int> m_hit_chip; - std::vector<int> m_hit_pad; - std::vector<float> m_hit_x; - std::vector<float> m_hit_y; - std::vector<float> m_hit_z; - std::vector<float> m_hit_center_x; - std::vector<float> m_hit_center_y; - std::vector<float> m_hit_center_z; - std::vector<float> m_hit_R; - std::vector<float> m_hit_locR; - std::vector<int> m_hit_HL; - std::vector<int> m_hit_det; - std::vector<float> m_hit_ub_locR; - std::vector<float> m_hit_ub_x; - std::vector<float> m_hit_ub_y; - std::vector<float> m_hit_ub_z; - int m_n_pixel_holes; - int m_n_sct_holes; - int m_n_trt_holes; - std::vector<int> m_hole_bec; - std::vector<int> m_hole_phi; - std::vector<int> m_hole_layer; - std::vector<int> m_hole_strawlayer; - std::vector<int> m_hole_straw; - std::vector<int> m_hole_chip; - std::vector<int> m_hole_pad; - std::vector<float> m_hole_x; - std::vector<float> m_hole_y; - std::vector<float> m_hole_z; - std::vector<float> m_hole_center_x; - std::vector<float> m_hole_center_y; - std::vector<float> m_hole_center_z; - std::vector<float> m_hole_locR; - std::vector<float> m_hole_locR_error; - std::vector<int> m_hole_det; - - //---- branches added by dan ------- - std::vector<int> m_hit_tube_hit; - int m_n_primary_vertex; - int m_n_tube_hits; - - // private methods - //---------------------------------- - void make_branches(); - void clear_branches(); - int fill_hit_data(const Trk::TrackStateOnSurface& hit); - int fill_hole_data(const Trk::TrackStateOnSurface& hole); + public: + TRTStrawEfficiency(const std::string& name, ISvcLocator* pSvcLocator); + + StatusCode initialize(); + StatusCode finalize(); + StatusCode execute(); + + private: + // configurables + //---------------------------------- + ToolHandle<Trk::ITrackHoleSearchTool> m_trt_hole_finder + {this, "trt_hole_finder","TRTTrackHoleSearchTool"}; + FloatProperty m_max_abs_d0{this, "max_abs_d0", 600*CLHEP::mm}; + FloatProperty m_max_abs_z0{this, "max_abs_z0", 600*CLHEP::mm}; + FloatProperty m_min_pT{this, "min_pT", 1.0*CLHEP::GeV}; + FloatProperty m_min_p{this, "min_p", 2.0*CLHEP::GeV}; + FloatProperty m_max_abs_eta{this, "max_abs_eta", 2.5}; + IntegerProperty m_min_pixel_hits{this, "min_pixel_hits", 0}; + IntegerProperty m_min_sct_hits{this, "min_sct_hits", 2}; + IntegerProperty m_min_trt_hits{this, "min_trt_hits", 15}; + ServiceHandle<ITHistSvc> m_hist_svc{this, "hist_svc", "THistSvc"}; + ServiceHandle<ITRT_StrawNeighbourSvc> m_TRTStrawNeighbourSvc + {this, "straw_neighbour_svc", "TRT_StrawNeighbourSvc"}; + StringProperty m_tree_name{this, "tree_name", "trt_eff"}; + StringProperty m_stream_name{this, "stream_name", "TRTEffStream"}; + StringProperty m_required_trigger{this, "required_trigger", ""}; + + // private data + //---------------------------------- + TTree* m_tree{nullptr}; + const TRT_ID* m_TRT_ID{nullptr}; + PublicToolHandle<Trk::IUpdator> m_updator + {this,"KalmanUpdator","Trk::KalmanUpdator/TrkKalmanUpdator",""}; + PublicToolHandle<Trig::ITrigDecisionTool> m_trigDec + {this,"ITrigDecisionTool","Trig::ITrigDecisionTool/TrigDecisionTool",""}; + + // Data handles + SG::ReadHandleKey<TrackCollection> m_tracksKey{this, "track_collection", "CombinedInDetTracks", "Tracks container key"}; + SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this, "event_info_key", "EventInfo", "Event info key"}; + SG::ReadHandleKey<xAOD::VertexContainer> m_vertexContainerKey{this, "VertexContainerName", "PrimaryVertices", "Vertex container key"}; + + unsigned int m_num_events{0}; + unsigned int m_num_tracks{0}; + unsigned int m_num_preselected_tracks{0}; + + // ntuple branches + unsigned int m_event_number{0}; + unsigned int m_run_number{0}; + unsigned int m_lumi_block{0}; + float m_track_pt{0.}; + float m_track_eta{0.}; + float m_track_phi{0.}; + float m_track_d0{0.}; + float m_track_z0{0.}; + int m_n_pixel_hits{0}; + int m_n_sct_hits{0}; + int m_n_trt_hits{0}; + std::vector<int> m_hit_bec; + std::vector<int> m_hit_phi; + std::vector<int> m_hit_layer; + std::vector<int> m_hit_strawlayer; + std::vector<int> m_hit_straw; + std::vector<int> m_hit_chip; + std::vector<int> m_hit_pad; + std::vector<float> m_hit_x; + std::vector<float> m_hit_y; + std::vector<float> m_hit_z; + std::vector<float> m_hit_center_x; + std::vector<float> m_hit_center_y; + std::vector<float> m_hit_center_z; + std::vector<float> m_hit_R; + std::vector<float> m_hit_locR; + std::vector<int> m_hit_HL; + std::vector<int> m_hit_det; + std::vector<float> m_hit_ub_locR; + std::vector<float> m_hit_ub_x; + std::vector<float> m_hit_ub_y; + std::vector<float> m_hit_ub_z; + int m_n_pixel_holes{0}; + int m_n_sct_holes{0}; + int m_n_trt_holes{0}; + std::vector<int> m_hole_bec; + std::vector<int> m_hole_phi; + std::vector<int> m_hole_layer; + std::vector<int> m_hole_strawlayer; + std::vector<int> m_hole_straw; + std::vector<int> m_hole_chip; + std::vector<int> m_hole_pad; + std::vector<float> m_hole_x; + std::vector<float> m_hole_y; + std::vector<float> m_hole_z; + std::vector<float> m_hole_center_x; + std::vector<float> m_hole_center_y; + std::vector<float> m_hole_center_z; + std::vector<float> m_hole_locR; + std::vector<float> m_hole_locR_error; + std::vector<int> m_hole_det; + + //---- branches added by dan ------- + std::vector<int> m_hit_tube_hit; + int m_n_primary_vertex{0}; + int m_n_tube_hits{0}; + + // private methods + //---------------------------------- + void make_branches(); + void clear_branches(); + int fill_hit_data(const Trk::TrackStateOnSurface& hit); + int fill_hole_data(const Trk::TrackStateOnSurface& hole); }; #endif // TRT_TrackHoleSearch_TRTStrawEfficiency_h diff --git a/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/TRT_TrackHoleSearch/TRTTrackHoleSearchTool.h b/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/TRT_TrackHoleSearch/TRTTrackHoleSearchTool.h index d6e007a152e001c7376ea21af4bd4333104d8776..b2e3d8c8846596db73572028574fd7cab7151fae 100644 --- a/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/TRT_TrackHoleSearch/TRTTrackHoleSearchTool.h +++ b/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/TRT_TrackHoleSearch/TRTTrackHoleSearchTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ // TRTTrackHoleSearchTool.h @@ -18,6 +18,8 @@ #include "TrkExInterfaces/IExtrapolator.h" #include "InDetConditionsSummaryService/IInDetConditionsSvc.h" +#include "CLHEP/Units/SystemOfUnits.h" + #include <atomic> #include <string> #include <vector> @@ -78,46 +80,49 @@ class TRTTrackHoleSearchTool : public Trk::ITrackHoleSearchTool, public AthAlgTo private: - // configurables - //---------------------------------- - ToolHandle<Trk::IExtrapolator> m_extrapolator; - ServiceHandle<IInDetConditionsSvc> m_conditions_svc; - bool m_use_conditions_svc; - float m_outer_radius; - float m_max_z; - int m_max_trailing_holes; - bool m_begin_at_first_trt_hit; - bool m_end_at_last_trt_hit; - bool m_bcheck; - bool m_do_dump_bad_straw_log; - float m_locR_cut; - float m_locR_sigma_cut; - float m_locZ_cut; + // configurables + //---------------------------------- + ToolHandle<Trk::IExtrapolator> m_extrapolator + {this, "extrapolator", "Trk::Extrapolator"}; + ServiceHandle<IInDetConditionsSvc> m_conditions_svc + {this, "conditions_svc", "TRT_ConditionsSummarySvc"}; + BooleanProperty m_use_conditions_svc{this, "use_conditions_svc", true}; + // barrel 1075.0, EC 1010.0 + FloatProperty m_outer_radius{this, "outer_radius", 1075.0*CLHEP::mm}; + // barrel 715.0, EC 2715.0 + FloatProperty m_max_z{this, "max_z", 2715.0*CLHEP::mm}; + IntegerProperty m_max_trailing_holes{this, "max_trailing_holes", 1}; // only used if not end_at_last_trt_hit + BooleanProperty m_begin_at_first_trt_hit{this, "begin_at_first_trt_hit", false}; // if not, extrapolate from last Si hit + BooleanProperty m_end_at_last_trt_hit{this, "end_at_last_trt_hit", false}; // if not, continue hole search to the edge of the TRT + BooleanProperty m_bcheck{this, "bcheck", false}; + BooleanProperty m_do_dump_bad_straw_log{this, "do_dump_bad_straw_log", false}; + FloatProperty m_locR_cut{this, "locR_cut", -1.}; // 1.4*CLHEP::mm // negative means no cut + FloatProperty m_locR_sigma_cut{this, "locR_sigma_cut", -1.}; + FloatProperty m_locZ_cut{this, "locZ_cut", 5.0*CLHEP::mm}; - // private data - //---------------------------------- - mutable std::atomic_bool m_has_been_called; - const TRT_ID* m_TRT_ID; - Trk::CylinderSurface* m_trt_outer_surf; - - // private methods - //---------------------------------- - int extrapolateBetweenHits(const Trk::TrackParameters* start_parameters, - const Trk::Surface& end_surf, - Trk::TrackStates* holes, - const Trk::ParticleHypothesis partHyp = Trk::pion) const; - - void dump_bad_straw_log() const; - - Trk::TrackStates::const_iterator - find_first_trt_hit(const Trk::TrackStates& track_states) const; + // private data + //---------------------------------- + mutable std::atomic_bool m_has_been_called{false}; + const TRT_ID* m_TRT_ID{nullptr}; + Trk::CylinderSurface* m_trt_outer_surf{nullptr}; + + // private methods + //---------------------------------- + int extrapolateBetweenHits(const Trk::TrackParameters* start_parameters, + const Trk::Surface& end_surf, + Trk::TrackStates* holes, + const Trk::ParticleHypothesis partHyp = Trk::pion) const; + + void dump_bad_straw_log() const; + + Trk::TrackStates::const_iterator + find_first_trt_hit(const Trk::TrackStates& track_states) const; - Trk::TrackStates::const_iterator - find_last_hit_before_trt(const Trk::TrackStates& track_states) const; + Trk::TrackStates::const_iterator + find_last_hit_before_trt(const Trk::TrackStates& track_states) const; - const Trk::Track* addHolesToTrack( - const Trk::Track& track, - const Trk::TrackStates* holes) const; + const Trk::Track* addHolesToTrack(const Trk::Track& track, + const Trk::TrackStates* holes) const; }; #endif // TRT_TrackHoleSearch_TRTTrackHoleSearchTool_h diff --git a/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/src/TRTStrawEfficiency.cxx b/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/src/TRTStrawEfficiency.cxx index 10d367fdcfd10442f6cd870c9972aca801441967..e8921196b95ae9409b83e0daae48f73c2ada130c 100644 --- a/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/src/TRTStrawEfficiency.cxx +++ b/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/src/TRTStrawEfficiency.cxx @@ -13,11 +13,8 @@ #include "TRT_TrackHoleSearch/TRTStrawEfficiency.h" #include "TRT_TrackHoleSearch/TRTTrackHoleSearchTool.h" -//#include "TrkParameters/Perigee.h" #include "TrkParameters/TrackParameters.h" -//#include "TrkParameters/MeasuredTrackParameters.h" #include "TrkTrack/TrackStateOnSurface.h" -#include "CLHEP/Units/SystemOfUnits.h" #include "Identifier/Identifier.h" #include "InDetIdentifier/TRT_ID.h" #include "InDetRIO_OnTrack/PixelClusterOnTrack.h" @@ -34,48 +31,7 @@ #include "TTree.h" -TRTStrawEfficiency::TRTStrawEfficiency(const std::string& name, ISvcLocator* pSvcLocator) - : AthAlgorithm(name, pSvcLocator), - m_trt_hole_finder("TRTTrackHoleSearchTool"), - m_hist_svc("THistSvc", name), - m_TRTStrawNeighbourSvc("TRT_StrawNeighbourSvc", name), - m_tree(nullptr), - m_TRT_ID(nullptr), - m_num_events(0), - m_num_tracks(0), - m_num_preselected_tracks(0), - m_event_number(0), - m_run_number(0), - m_lumi_block(0), - m_track_pt(0.), - m_track_eta(0.), - m_track_phi(0.), - m_track_d0(0.), - m_track_z0(0.), - m_n_pixel_hits(0), - m_n_sct_hits(0), - m_n_trt_hits(0), - m_n_pixel_holes(0), - m_n_sct_holes(0), - m_n_trt_holes(0), - m_n_primary_vertex(0), - m_n_tube_hits(0) -{ - declareProperty("trt_hole_finder", m_trt_hole_finder); - declareProperty("max_abs_d0", m_max_abs_d0 = 600*CLHEP::mm ); - declareProperty("max_abs_z0", m_max_abs_z0 = 600*CLHEP::mm ); - declareProperty("min_pT", m_min_pT = 1.0*CLHEP::GeV ); - declareProperty("min_p", m_min_p = 2.0*CLHEP::GeV ); // added by dan - declareProperty("max_abs_eta", m_max_abs_eta = 2.5 ); - declareProperty("min_pixel_hits", m_min_pixel_hits = 0 ); - declareProperty("min_sct_hits", m_min_sct_hits = 2 ); - declareProperty("min_trt_hits", m_min_trt_hits = 15 ); - declareProperty("hist_svc", m_hist_svc ); - declareProperty("straw_neighbour_svc", m_TRTStrawNeighbourSvc ); - declareProperty("tree_name", m_tree_name = "trt_eff" ); - declareProperty("stream_name", m_stream_name = "TRTEffStream" ); - declareProperty("required_trigger", m_required_trigger = "" ); -} +TRTStrawEfficiency::TRTStrawEfficiency(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator) {} //____________________________________________________________________________ @@ -101,7 +57,7 @@ StatusCode TRTStrawEfficiency::initialize() { } // ntuple - m_tree = new TTree(m_tree_name.c_str(), m_tree_name.c_str()); + m_tree = new TTree(m_tree_name.value().c_str(), m_tree_name.value().c_str()); ATH_CHECK(m_hist_svc->regTree(std::string("/") + m_stream_name + std::string("/") + m_tree_name, m_tree)); // Read handles diff --git a/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/src/TRTTrackHoleSearchTool.cxx b/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/src/TRTTrackHoleSearchTool.cxx index 7bf2f2fd9a4faef5e373134a25faeca9b01ff29a..dd55a7882e227c6854e135ba654a3df52418d994 100644 --- a/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/src/TRTTrackHoleSearchTool.cxx +++ b/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/src/TRTTrackHoleSearchTool.cxx @@ -37,28 +37,9 @@ //____________________________________________________________________________ TRTTrackHoleSearchTool::TRTTrackHoleSearchTool(const std::string& type, const std::string& name, const IInterface* parent) - : AthAlgTool(type, name, parent), - m_extrapolator("Trk::Extrapolator"), - m_conditions_svc("TRT_ConditionsSummarySvc", name), - m_has_been_called(false), - m_TRT_ID(nullptr), - m_trt_outer_surf(nullptr) + : AthAlgTool(type, name, parent) { declareInterface<ITrackHoleSearchTool>(this); - - declareProperty("extrapolator", m_extrapolator ); - declareProperty("conditions_svc", m_conditions_svc); - declareProperty("use_conditions_svc", m_use_conditions_svc = true); - declareProperty("outer_radius", m_outer_radius = 1075.0*CLHEP::mm ); // barrel 1075.0, EC 1010.0 - declareProperty("max_z", m_max_z = 2715.0*CLHEP::mm ); // barrel 715.0, EC 2715.0 - declareProperty("max_trailing_holes", m_max_trailing_holes = 1 ); // only used if not end_at_last_trt_hit - declareProperty("begin_at_first_trt_hit", m_begin_at_first_trt_hit = false ); // if not, extrapolate from last Si hit - declareProperty("end_at_last_trt_hit", m_end_at_last_trt_hit = false ); // if not, continue hole search to the edge of the TRT - declareProperty("bcheck", m_bcheck = false ); - declareProperty("do_dump_bad_straw_log", m_do_dump_bad_straw_log = false ); - declareProperty("locR_cut", m_locR_cut = -1.0 ); // 1.4*CLHEP::mm // negative means no cut - declareProperty("locR_sigma_cut", m_locR_sigma_cut = -1.0 ); - declareProperty("locZ_cut", m_locZ_cut = 5.0*CLHEP::mm ); // 5.0*CLHEP::mm ); } @@ -260,7 +241,8 @@ int TRTTrackHoleSearchTool::extrapolateBetweenHits(const Trk::TrackParameters* s m_extrapolator->extrapolateStepwise(Gaudi::Hive::currentContext(), *start_parameters, end_surf, - Trk::alongMomentum, m_bcheck, partHyp); + Trk::alongMomentum, m_bcheck.value(), + partHyp); if(steps.empty()) { ATH_MSG_DEBUG("extrapolateBetweenHits: extrapolateStepwise returned null");