ATLAS Offline Software
Loading...
Searching...
No Matches
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
22
28#include <vector>
29
30class AtlasDetectorID;
31class TRT_ID;
32
33namespace Trk{
34 class Track;
35}
36
37namespace InDet
38{
39
51
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;
81 OccupancyData(const std::array<std::array<int,NLOCALPHI>,NLOCAL> &local)
82 : m_stw_local(local)
83 {}
84 int m_occ_total[NTOTAL] = {0};
85 int m_hit_total[NTOTAL] = {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
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
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
abstract interface to TRT calibration constants
static Double_t t0
Property holding a SG store/key/clid from which a ReadHandle is made.
InDetRawDataContainer< InDetRawDataCollection< TRT_RDORawData > > TRT_RDO_Container
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
std::unique_ptr< OccupancyData > makeData(const EventContext &ctx) const
SG::ReadCondHandleKey< TRTCond::AliveStraws > m_strawReadKey
SG::ReadHandleKey< TRT_DriftCircleContainer > m_trt_driftcircles
Gaudi::Property< bool > m_T0Shift
TRT_LocalOccupancy(const std::string &, const std::string &, const IInterface *)
std::unique_ptr< OccupancyData > makeDataTrigger(const EventContext &ctx) const
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)
Gaudi::Property< float > m_lowWideGate
SG::WriteHandleKey< OccupancyData > m_occupancyCacheWrite
static bool isMiddleBXOn(unsigned int word)
Gaudi::Property< float > m_highWideGate
virtual float LocalOccupancy(const EventContext &ctx, const Trk::Track &track) const override
Return the local occupancy for the sectors crossed by a given track.
const TRT_ID * m_TRTHelper
External tools:
static int mapPhiToPhisector(const double phi)
virtual StatusCode initialize() override
standard Athena-Algorithm method
Gaudi::Property< float > m_lowGate
SG::ReadHandleKey< OccupancyData > m_occupancyCacheRead
const OccupancyData * getData(const EventContext &ctx) const
int mapEtaToPartition(const double eta) const
bool passValidityGate(unsigned int word, float t0) const
ToolHandle< ITRT_CalDbTool > m_CalDbTool
Gaudi::Property< float > m_highGate
SG::ReadCondHandleKey< TRTCond::StrawStatusData > m_strawStatusKey
int findArrayTotalIndex(const int det, const int lay) const
To convert from array index to det id and viceversa.
virtual std::vector< float > GlobalOccupancy(const EventContext &ctx) const override
Return the global occupancy of the event.
void countHitsNearTrack(const EventContext &ctx, OccupancyData &data, int track_local[NLOCAL][NLOCALPHI]) const
Gaudi::Property< bool > m_isTrigger
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
This is an Identifier helper class for the TRT subdetector.
Definition TRT_ID.h:82
Primary Vertex Finder.
Ensure that the ATLAS eigen extensions are properly loaded.
const std::array< std::array< int, NLOCALPHI >, NLOCAL > & m_stw_local
OccupancyData(const std::array< std::array< int, NLOCALPHI >, NLOCAL > &local)