ATLAS Offline Software
TRT_LocalOccupancy.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // TRT_LocalOccupancy.h, (c) ATLAS Detector software
8 
9 #ifndef INDETTRT_LOCALOCCUPANCY_H
10 #define INDETTRT_LOCALOCCUPANCY_H
11 
13 #include "AthenaBaseComps/AthAlgTool.h" // Exchange IN
14 #include "GaudiKernel/AlgTool.h"
15 #include "GaudiKernel/ToolHandle.h"
16 
17 #include "TrkTrack/Track.h"
19 
21 #include "AthenaKernel/CLASS_DEF.h"
22 
28 #include <vector>
29 
30 class AtlasDetectorID;
31 class TRT_ID;
32 
33 namespace Trk{
34  class Track;
35 }
36 
37 namespace InDet
38 {
39 
52  class TRT_LocalOccupancy : public extends <AthAlgTool, ITRT_LocalOccupancy> {
53  public:
54  TRT_LocalOccupancy(const std::string&,const std::string&,const IInterface*);
55 
57  virtual StatusCode initialize() override;
58 
60  virtual float LocalOccupancy(const EventContext& ctx,
61  const Trk::Track& track) const override;
62  virtual float LocalOccupancy(const EventContext& ctx,
63  const double eta,
64  const double phi) const override;
65 
67  virtual std::map<int, double> getDetectorOccupancy(const EventContext& ctx,
68  const TRT_RDO_Container* p_trtRDOContainer) const override;
69 
72  virtual std::vector<float> GlobalOccupancy(const EventContext& ctx) const override;
73 
74  //Total TRT, (B, ECA, ECB)side C, (B, ECA, ECB)side A [7]
75  static const int NTOTAL = 7;
76  //(barrel, ECA, ECB)side C, (barrel, ECA, ECB)side A [6][32]
77  static const int NLOCAL = 6;
78  static const int NWHEEL = 34;
79  static const int NLOCALPHI = 32;
80  struct OccupancyData {
81  OccupancyData(const std::array<std::array<int,NLOCALPHI>,NLOCAL> &local)
83  {}
84  int m_occ_total[NTOTAL] = {0};
85  int m_hit_total[NTOTAL] = {0};
86  int m_occ_local[NLOCAL][NLOCALPHI] = {{0}};
87  int m_hit_local[NLOCAL][NLOCALPHI] = {{0}};
88  const std::array<std::array<int,NLOCALPHI>,NLOCAL> &m_stw_local;
89  float m_stws_ratio[2][NLOCALPHI] = {{0}};
90  };
91 
92 
93  private:
94  const OccupancyData* getData(const EventContext& ctx) const;
95  std::unique_ptr<OccupancyData> makeData(const EventContext& ctx) const;
96  std::unique_ptr<OccupancyData> makeDataTrigger(const EventContext &ctx) const;
97 
98  static bool isMiddleBXOn(unsigned int word) ;
99  bool passValidityGate(unsigned int word, float t0) const;
100 
101  void countHitsNearTrack (const EventContext &ctx,
102  OccupancyData& data,
103  int track_local[NLOCAL][NLOCALPHI]) const;
104 
106  int findArrayTotalIndex(const int det, const int lay) const;
107  static int mapPhiToPhisector(const double phi) ;
108  int mapEtaToPartition(const double eta) const;
109 
111  const TRT_ID *m_TRTHelper{};
112  ToolHandle< ITRT_CalDbTool > m_CalDbTool{this, "TRTCalDbTool", "TRT_CalDbTool", ""};
113  SG::ReadHandleKey<TRT_DriftCircleContainer> m_trt_driftcircles{ this, "TRT_DriftCircleCollection", "TRT_DriftCircles", "m_trt_driftcircles" };
114 
115  SG::ReadCondHandleKey<TRTCond::AliveStraws> m_strawReadKey{this,"AliveStraws","AliveStraws","AliveStraws in-key"};
116  SG::ReadCondHandleKey<TRTCond::StrawStatusData> m_strawStatusKey{this,"StrawStatus","StrawStatusData","StrawStatus key"};
117 
120 
121  Gaudi::Property<bool> m_isTrigger{this, "isTrigger", false, ""};
122  Gaudi::Property<bool> m_T0Shift{this, "includeT0Shift", true, "choice to use T0shift or not"};
123  Gaudi::Property<float> m_lowGate{this, "LowGate", 14.0625*Gaudi::Units::ns, ""};
124  Gaudi::Property<float> m_highGate{this, "HighGate", 42.1875*Gaudi::Units::ns, ""};
125  // use a wider validity gate if you're not using T0 shift:
126  Gaudi::Property<float> m_lowWideGate{this, "LowWideGate", 20.3125*Gaudi::Units::ns, ""};
127  Gaudi::Property<float> m_highWideGate{this, "HighWideGate", 54.6875*Gaudi::Units::ns, ""};
128 
129  };
130 }
131 
132 
134 #endif
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
InDet::TRT_LocalOccupancy::m_isTrigger
Gaudi::Property< bool > m_isTrigger
Definition: TRT_LocalOccupancy.h:121
InDet::TRT_LocalOccupancy::isMiddleBXOn
static bool isMiddleBXOn(unsigned int word)
Definition: TRT_LocalOccupancy.cxx:373
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
InDet::TRT_LocalOccupancy::mapEtaToPartition
int mapEtaToPartition(const double eta) const
Definition: TRT_LocalOccupancy.cxx:434
InDet::TRT_LocalOccupancy::getData
const OccupancyData * getData(const EventContext &ctx) const
Definition: TRT_LocalOccupancy.cxx:452
InDet::TRT_LocalOccupancy::m_strawReadKey
SG::ReadCondHandleKey< TRTCond::AliveStraws > m_strawReadKey
Definition: TRT_LocalOccupancy.h:115
TRT_RDO_Container.h
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
TRTCalib_Extractor.det
det
Definition: TRTCalib_Extractor.py:36
InDet::TRT_LocalOccupancy::m_T0Shift
Gaudi::Property< bool > m_T0Shift
Definition: TRT_LocalOccupancy.h:122
InDet::TRT_LocalOccupancy::m_highGate
Gaudi::Property< float > m_highGate
Definition: TRT_LocalOccupancy.h:124
InDet
Primary Vertex Finder.
Definition: VP1ErrorUtils.h:36
InDet::TRT_LocalOccupancy::m_occupancyCacheRead
SG::ReadHandleKey< OccupancyData > m_occupancyCacheRead
Definition: TRT_LocalOccupancy.h:118
InDet::TRT_LocalOccupancy::initialize
virtual StatusCode initialize() override
standard Athena-Algorithm method
Definition: TRT_LocalOccupancy.cxx:51
InDet::TRT_LocalOccupancy::GlobalOccupancy
virtual std::vector< float > GlobalOccupancy(const EventContext &ctx) const override
Return the global occupancy of the event.
Definition: TRT_LocalOccupancy.cxx:80
InDet::TRT_LocalOccupancy::m_highWideGate
Gaudi::Property< float > m_highWideGate
Definition: TRT_LocalOccupancy.h:127
InDet::TRT_LocalOccupancy::m_lowWideGate
Gaudi::Property< float > m_lowWideGate
Definition: TRT_LocalOccupancy.h:126
InDet::TRT_LocalOccupancy::OccupancyData::m_stw_local
const std::array< std::array< int, NLOCALPHI >, NLOCAL > & m_stw_local
Definition: TRT_LocalOccupancy.h:88
InDetRawDataContainer
Definition: InDetRawDataContainer.h:27
SG::ReadHandleKey< TRT_DriftCircleContainer >
InDet::TRT_LocalOccupancy::countHitsNearTrack
void countHitsNearTrack(const EventContext &ctx, OccupancyData &data, int track_local[NLOCAL][NLOCALPHI]) const
Definition: TRT_LocalOccupancy.cxx:262
ITRT_LocalOccupancy.h
InDet::TRT_LocalOccupancy::mapPhiToPhisector
static int mapPhiToPhisector(const double phi)
Definition: TRT_LocalOccupancy.cxx:421
InDet::TRT_LocalOccupancy::findArrayTotalIndex
int findArrayTotalIndex(const int det, const int lay) const
To convert from array index to det id and viceversa.
Definition: TRT_LocalOccupancy.cxx:403
Track.h
InDet::TRT_LocalOccupancy::makeData
std::unique_ptr< OccupancyData > makeData(const EventContext &ctx) const
Definition: TRT_LocalOccupancy.cxx:465
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
InDet::TRT_LocalOccupancy::NLOCALPHI
static const int NLOCALPHI
Definition: TRT_LocalOccupancy.h:79
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
InDet::TRT_LocalOccupancy::OccupancyData::m_occ_local
int m_occ_local[NLOCAL][NLOCALPHI]
Definition: TRT_LocalOccupancy.h:86
InDet::TRT_LocalOccupancy::m_trt_driftcircles
SG::ReadHandleKey< TRT_DriftCircleContainer > m_trt_driftcircles
Definition: TRT_LocalOccupancy.h:113
AthAlgTool.h
AliveStraws.h
InDet::TRT_LocalOccupancy::OccupancyData
Definition: TRT_LocalOccupancy.h:80
ITRT_CalDbTool.h
abstract interface to TRT calibration constants
InDet::TRT_LocalOccupancy::getDetectorOccupancy
virtual std::map< int, double > getDetectorOccupancy(const EventContext &ctx, const TRT_RDO_Container *p_trtRDOContainer) const override
Return a map of the occupancy in the barrel (-1,+1) and endcaps (-2,+2)
Definition: TRT_LocalOccupancy.cxx:191
InDet::TRT_LocalOccupancy::m_lowGate
Gaudi::Property< float > m_lowGate
Definition: TRT_LocalOccupancy.h:123
ReadCondHandleKey.h
InDetDD::local
@ local
Definition: InDetDD_Defs.h:16
lumiFormat.array
array
Definition: lumiFormat.py:91
TRT_DriftCircleContainer.h
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
InDet::TRT_LocalOccupancy::NWHEEL
static const int NWHEEL
Definition: TRT_LocalOccupancy.h:78
InDet::TRT_LocalOccupancy::OccupancyData::m_hit_total
int m_hit_total[NTOTAL]
Definition: TRT_LocalOccupancy.h:85
InDet::TRT_LocalOccupancy::makeDataTrigger
std::unique_ptr< OccupancyData > makeDataTrigger(const EventContext &ctx) const
Definition: TRT_LocalOccupancy.cxx:534
InDet::TRT_LocalOccupancy::OccupancyData::m_occ_total
int m_occ_total[NTOTAL]
Definition: TRT_LocalOccupancy.h:84
InDet::TRT_LocalOccupancy::TRT_LocalOccupancy
TRT_LocalOccupancy(const std::string &, const std::string &, const IInterface *)
Definition: TRT_LocalOccupancy.cxx:42
SG::ReadCondHandleKey< TRTCond::AliveStraws >
InDet::TRT_LocalOccupancy::passValidityGate
bool passValidityGate(unsigned int word, float t0) const
Definition: TRT_LocalOccupancy.cxx:384
TRT_ID
Definition: TRT_ID.h:84
InDet::TRT_LocalOccupancy::m_TRTHelper
const TRT_ID * m_TRTHelper
External tools:
Definition: TRT_LocalOccupancy.h:111
InDet::TRT_LocalOccupancy::LocalOccupancy
virtual float LocalOccupancy(const EventContext &ctx, const Trk::Track &track) const override
Return the local occupancy for the sectors crossed by a given track.
Definition: TRT_LocalOccupancy.cxx:111
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
InDet::TRT_LocalOccupancy::NLOCAL
static const int NLOCAL
Definition: TRT_LocalOccupancy.h:77
InDet::TRT_LocalOccupancy::m_occupancyCacheWrite
SG::WriteHandleKey< OccupancyData > m_occupancyCacheWrite
Definition: TRT_LocalOccupancy.h:119
python.SystemOfUnits.ns
int ns
Definition: SystemOfUnits.py:130
InDet::TRT_LocalOccupancy::OccupancyData::m_hit_local
int m_hit_local[NLOCAL][NLOCALPHI]
Definition: TRT_LocalOccupancy.h:87
Track
Definition: TriggerChamberClusterOnTrackCreator.h:21
InDet::TRT_LocalOccupancy::OccupancyData::OccupancyData
OccupancyData(const std::array< std::array< int, NLOCALPHI >, NLOCAL > &local)
Definition: TRT_LocalOccupancy.h:81
InDet::TRT_LocalOccupancy::m_strawStatusKey
SG::ReadCondHandleKey< TRTCond::StrawStatusData > m_strawStatusKey
Definition: TRT_LocalOccupancy.h:116
InDet::TRT_LocalOccupancy::NTOTAL
static const int NTOTAL
Definition: TRT_LocalOccupancy.h:75
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
InDet::TRT_LocalOccupancy::m_CalDbTool
ToolHandle< ITRT_CalDbTool > m_CalDbTool
Definition: TRT_LocalOccupancy.h:112
InDet::TRT_LocalOccupancy::OccupancyData::m_stws_ratio
float m_stws_ratio[2][NLOCALPHI]
Definition: TRT_LocalOccupancy.h:89
CLASS_DEF.h
macros to associate a CLID to a type
AtlasDetectorID
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Definition: AtlasDetectorID.h:57
InDet::TRT_LocalOccupancy
Definition: TRT_LocalOccupancy.h:52
StrawStatusData.h