ATLAS Offline Software
StripSegmentTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef STRIPSEGMENTTOOL_H
6 #define STRIPSEGMENTTOOL_H
7 
10 #include "CLHEP/Random/RandFlat.h"
11 #include "CLHEP/Random/RandGauss.h"
13 #include "GaudiKernel/ServiceHandle.h"
14 #include "GaudiKernel/ToolHandle.h"
15 #include "GaudiKernel/ITHistSvc.h"
16 #include "GaudiKernel/IIncidentSvc.h"
17 #include "GaudiKernel/IIncidentListener.h"
18 
27 
28 #include "RegSelLUT/RegSelSiLUT.h"
31 
37 
38 #include "TTree.h"
39 #include <Math/Vector3D.h>
40 #include <functional>
41 #include <algorithm>
42 #include <map>
43 #include <utility>
44 #include <cmath>
45 
46 struct Envelope_t{
47  float lower_r{FLT_MIN};
48  float upper_r{FLT_MAX};
49  float lower_eta{FLT_MIN};
50  float upper_eta{FLT_MAX};
51  float lower_z{FLT_MIN};
52  float upper_z{FLT_MAX};
53 };
54 
55 // namespace for the NSW LVL1 related classes
56 namespace NSWL1 {
57 
70  class StripSegmentTool: virtual public IStripSegmentTool,
71  public AthAlgTool,
72  public IIncidentListener {
73 
74  public:
75  StripSegmentTool(const std::string& type,
76  const std::string& name,
77  const IInterface* parent);
78  virtual ~StripSegmentTool()=default;
79  virtual StatusCode initialize() override;
80  virtual void handle (const Incident& inc) override;
81  virtual StatusCode find_segments( std::vector< std::unique_ptr<StripClusterData> >& ,const std::unique_ptr<Muon::NSW_TrigRawDataContainer>& ) const override;
83 
84  private:
85  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
86  SG::ReadCondHandleKey<IRegSelLUTCondData> m_regSelTableKey{this, "RegSelLUT", "RegSelLUTCondData_sTGC", "sTGC Region Selector lookup table"};
87 
88  // methods implementing the internal data processing
90  void clear_ntuple_variables();
91 
92  // needed Services, Tools and Helpers
93  ServiceHandle<IIncidentSvc> m_incidentSvc {this, "IncidentSvc", "IncidentSvc"};
94  Gaudi::Property<std::string> m_sTgcSdoContainer{this, "sTGC_SdoContainerName", "sTGC_SDO", "Name of the sTGC SDO digit container"};
95  Gaudi::Property<bool> m_doNtuple {this, "DoNtuple", false, "Input StripTds branches into the analysis ntuple"};
96  Gaudi::Property<int> m_rIndexBits {this, "rIndexBits", 8, "Number bits in R-index calculation"};
97  Gaudi::Property<int> m_dThetaBits {this, "dthetaBits", 5, "Number bits in dTheta calculation"};
98  Gaudi::Property<float> m_dtheta_min {this, "dthetaMin", -15., "Minimum allowed value for dtheta in mrad"};
99  Gaudi::Property<float> m_dtheta_max {this, "dthetaMax", 15., "Maximum allowed value for dtheta in mrad"};
100  Gaudi::Property<int> m_ridxScheme {this, "rIndexScheme", 1, "rIndex slicing scheme/ 0-->R / 1-->eta"};
101 
102  /* None of the TTree filling is thread-safe and should really be refactored.
103  * But we check in initialize() that this is only used in single-threaded mode.
104  */
105  TTree* m_tree{nullptr};
106  std::vector<int> *m_seg_wedge1_size ATLAS_THREAD_SAFE{nullptr};
107  std::vector<int> *m_seg_wedge2_size ATLAS_THREAD_SAFE{nullptr};
108  std::vector<float> *m_seg_theta ATLAS_THREAD_SAFE{nullptr};
109  std::vector<float> *m_seg_dtheta ATLAS_THREAD_SAFE{nullptr};
110  std::vector<uint8_t> *m_seg_dtheta_int ATLAS_THREAD_SAFE{nullptr};
111  std::vector<float> *m_seg_eta ATLAS_THREAD_SAFE{nullptr};
112  std::vector<float> *m_seg_eta_inf ATLAS_THREAD_SAFE{nullptr};
113  std::vector<float> *m_seg_phi ATLAS_THREAD_SAFE{nullptr};
114  std::vector<int> *m_seg_bandId ATLAS_THREAD_SAFE{nullptr};
115  std::vector<int> *m_seg_phiId ATLAS_THREAD_SAFE{nullptr};
116  std::vector<int> *m_seg_rIdx ATLAS_THREAD_SAFE{nullptr};
117  std::vector<float> *m_seg_global_x ATLAS_THREAD_SAFE{nullptr};
118  std::vector<float> *m_seg_global_y ATLAS_THREAD_SAFE{nullptr};
119  std::vector<float> *m_seg_global_z ATLAS_THREAD_SAFE{nullptr};
120 
121  uint8_t findRIdx(const float val, const Envelope_t &env) const;
122  uint8_t findDtheta(const float) const;
123  }; // end of StripSegmentTool class
124 } // namespace NSWL1
125 #endif
NSWL1::StripSegmentTool
interface for the StripTDS tools
Definition: StripSegmentTool.h:72
NSWL1::StripSegmentTool::m_sTgcSdoContainer
Gaudi::Property< std::string > m_sTgcSdoContainer
Definition: StripSegmentTool.h:94
TriggerTypes.h
NSWL1::StripSegmentTool::findRIdx
uint8_t findRIdx(const float val, const Envelope_t &env) const
Definition: StripSegmentTool.cxx:95
NSWL1::StripSegmentTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: StripSegmentTool.h:85
tdr_compat_enum.h
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:575
NSWL1::StripSegmentTool::~StripSegmentTool
virtual ~StripSegmentTool()=default
IStripSegmentTool.h
sTgcReadoutElement.h
NSWL1::StripSegmentTool::m_ridxScheme
Gaudi::Property< int > m_ridxScheme
Definition: StripSegmentTool.h:100
NSWL1::StripSegmentTool::clear_ntuple_variables
void clear_ntuple_variables()
clear the variables used in the analysis ntuple
Definition: StripSegmentTool.cxx:349
RegSelSiLUT.h
emacs: this is -*- c++ -*-
NSWL1::StripSegmentTool::initialize
virtual StatusCode initialize() override
Definition: StripSegmentTool.cxx:18
NSWL1::StripSegmentTool::m_dtheta_max
Gaudi::Property< float > m_dtheta_max
Definition: StripSegmentTool.h:99
NSWL1::StripSegmentTool::m_incidentSvc
ServiceHandle< IIncidentSvc > m_incidentSvc
Athena/Gaudi incident Service.
Definition: StripSegmentTool.h:93
Envelope_t::upper_r
float upper_r
Definition: StripSegmentTool.h:48
NSWL1::StripSegmentTool::m_doNtuple
Gaudi::Property< bool > m_doNtuple
Definition: StripSegmentTool.h:95
NSWL1::StripSegmentTool::StripSegmentTool
StripSegmentTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: StripSegmentTool.cxx:11
NSWL1::StripSegmentTool::FetchDetectorEnvelope
StatusCode FetchDetectorEnvelope(Envelope_t &env) const
Definition: StripSegmentTool.cxx:54
NSWL1::StripSegmentTool::m_rIndexBits
Gaudi::Property< int > m_rIndexBits
Definition: StripSegmentTool.h:96
NSWL1::StripSegmentTool::handle
virtual void handle(const Incident &inc) override
Definition: StripSegmentTool.cxx:48
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
Envelope_t::upper_z
float upper_z
Definition: StripSegmentTool.h:52
StripOfflineData.h
IRegSelLUTCondData.h
NSWL1::StripSegmentTool::m_dThetaBits
Gaudi::Property< int > m_dThetaBits
Definition: StripSegmentTool.h:97
IAtRndmGenSvc.h
Envelope_t::lower_r
float lower_r
Definition: StripSegmentTool.h:47
NSWL1::StripSegmentTool::m_dtheta_min
Gaudi::Property< float > m_dtheta_min
Definition: StripSegmentTool.h:98
IRegionIDLUT_Creator.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
NSWL1::StripSegmentTool::find_segments
virtual StatusCode find_segments(std::vector< std::unique_ptr< StripClusterData > > &, const std::unique_ptr< Muon::NSW_TrigRawDataContainer > &) const override
Definition: StripSegmentTool.cxx:127
MuonDetectorManager.h
NSWL1::StripSegmentTool::findDtheta
uint8_t findDtheta(const float) const
Definition: StripSegmentTool.cxx:118
SG::ReadCondHandleKey
Definition: ReadCondHandleKey.h:20
Envelope_t::upper_eta
float upper_eta
Definition: StripSegmentTool.h:50
NSWL1::IStripSegmentTool
interface for the Strip Cluster Tools
Definition: IStripSegmentTool.h:30
NSWL1::StripSegmentTool::ATLAS_THREAD_SAFE
std::vector< int > *m_seg_wedge1_size ATLAS_THREAD_SAFE
theta
Definition: StripSegmentTool.h:106
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
NSW_TrigRawDataContainer.h
NSWL1::StripSegmentTool::m_tree
TTree * m_tree
ntuple for analysis
Definition: StripSegmentTool.h:105
Envelope_t::lower_eta
float lower_eta
Definition: StripSegmentTool.h:49
sTgcDigit.h
sTgcDigitContainer.h
PadTrigger.h
Envelope_t
Definition: StripSegmentTool.h:46
AthAlgTool
Definition: AthAlgTool.h:26
NSWL1::StripSegmentTool::book_branches
StatusCode book_branches()
book the branches to analyze the StripTds behavior
Definition: StripSegmentTool.cxx:311
MuonSimDataCollection.h
python.DataFormatRates.env
env
Definition: DataFormatRates.py:32
Envelope_t::lower_z
float lower_z
Definition: StripSegmentTool.h:51
checker_macros.h
Define macros for attributes used to control the static checker.
NSWL1
A trigger trigger candidate for a stgc sector.
Definition: NSWL1Simulation.cxx:9
NSWL1::StripSegmentTool::m_regSelTableKey
SG::ReadCondHandleKey< IRegSelLUTCondData > m_regSelTableKey
Definition: StripSegmentTool.h:86
IMuonIdHelperSvc.h
MuonSimData.h
ServiceHandle< Muon::IMuonIdHelperSvc >