ATLAS Offline Software
Loading...
Searching...
No Matches
InDet::TRT_StrawStatus Class Reference

This algorithm finds dead or hot TRT straws / chips / boards based on
occupancy and hits on track. More...

#include <TRT_StrawStatus.h>

Inheritance diagram for InDet::TRT_StrawStatus:

Public Member Functions

 TRT_StrawStatus (const std::string &name, ISvcLocator *pSvcLocator)
 Standard Athena-Algorithm Constructor.
 ~TRT_StrawStatus ()
 Default Destructor.
StatusCode initialize ()
 standard Athena-Algorithm method
StatusCode execute ()
 standard Athena-Algorithm method
StatusCode finalize ()
 standard Athena-Algorithm method
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef std::array< std::array< std::array< std::array< int, 6 >, 5482 >, 32 >, 2 > ACCHITS_t
 accumulate hits, last index: 0 - all hits, 1 - hits on track, 2 - all HT (TR) hits, 3 - HT (TR) hits on track
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

void clear ()
StatusCode reportResults ()
void printDetailedInformation ()
void myStrawIndex (Identifier id, int *index)
 function that returns straw index (in range 0-5481; 0-1641 for barrel, the rest for endcap) same convention as for TRT_monitoring (copied from there)
int barrelStrawNumber (int strawNumber, int strawlayerNumber, int LayerNumber)
int endcapStrawNumber (int strawNumber, int strawLayerNumber, int LayerNumber)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ServiceHandle< ITRT_HWMappingSvcm_mapSvc {this,"HWMapSvc","TRT_HWMappingSvc","" }
ServiceHandle< ITRT_DCS_ConditionsSvcm_DCSSvc {this,"InDetTRT_DCS_ConditionsSvc","TRT_DCS_ConditionsSvc","" }
ServiceHandle< ITRT_StrawNeighbourSvcm_TRTStrawNeighbourSvc {this,"TRT_StrawNeighbourSvc","TRT_StrawNeighbourSvc","retrieve barrel and end-cap straw number later on, as well as DTMROC" }
ToolHandle< ITRT_StrawStatusSummaryToolm_TRTStrawStatusSummaryTool {this, "TRT_StrawStatusSummaryTool", "ITRT_StrawStatusSummaryTool", ""}
ToolHandle< Trk::ITrackHoleSearchToolm_trt_hole_finder {this, "trt_hole_finder", "Trk::ITrackHoleSearchTool", ""}
PublicToolHandle< Trk::IUpdatorm_updator {this, "KalmanUpdator", "Trk::KalmanUpdator/TrkKalmanUpdator",""}
Gaudi::Property< double > m_locR_cut {this, "locR_cut", 1.4, ""}
Gaudi::Property< int > m_skipBusyEvents {this, "skipBusyEvents", 0, ""}
Gaudi::Property< int > m_printDetailedInformation {this, "printDetailedInformation", 0, ""}
Gaudi::Property< std::string > m_fileName {this, "outputFileName", "TRT_StrawStatusOutput", ""}
SG::ReadHandleKey< xAOD::EventInfom_eventInfoKey {this,"EventInfoKey","EventInfo","RHK to retrieve xAOD::EventInfo"}
SG::ReadHandleKey< TRT_RDO_Containerm_rdoContainerKey {this,"RDO_ContainerKey","TRT_RDOs","RHK to retrieve TRT RDO's"}
SG::ReadHandleKey< DataVector< Trk::Track > > m_tracksName {this,"tracksCollectionKey","CombinedInDetTracks","RHK to retrieve CombinedInDetTracks"}
SG::ReadHandleKey< xAOD::VertexContainerm_vxContainerKey {this,"VxContainerKey","PrimaryVertices","RHK to retrieve VX Primary candidates"}
int m_nEvents
 returns index of hardware units: board, chip, pad private fix for now, will call TRTStrawNeighbourSvc when available number boards 0-9 barrel, 0-19 endcap (first 12 on A wheels, ordering from smaller to larger |z|) number chips 0-103 barrel, 0-239 endcap number pads: chips x 2
int m_runNumber
std::unique_ptr< ACCHITS_tm_accumulateHits
const TRT_IDm_TRTHelper
std::atomic< int > m_printStatusCount {0}
DataObjIDColl m_extendedExtraObjects
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

This algorithm finds dead or hot TRT straws / chips / boards based on
occupancy and hits on track.

To be used in calibration stream (to mask off dead regions before processing)

Author
Sasa Fratina sasa..nosp@m.frat.nosp@m.ina@c.nosp@m.ern..nosp@m.ch

Definition at line 56 of file TRT_StrawStatus.h.

Member Typedef Documentation

◆ ACCHITS_t

typedef std::array<std::array<std::array<std::array<int,6>,5482>,32>,2> InDet::TRT_StrawStatus::ACCHITS_t
private

accumulate hits, last index: 0 - all hits, 1 - hits on track, 2 - all HT (TR) hits, 3 - HT (TR) hits on track

Definition at line 113 of file TRT_StrawStatus.h.

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TRT_StrawStatus()

InDet::TRT_StrawStatus::TRT_StrawStatus ( const std::string & name,
ISvcLocator * pSvcLocator )

Standard Athena-Algorithm Constructor.

Definition at line 43 of file TRT_StrawStatus.cxx.

44:
45AthAlgorithm(name,pSvcLocator),
47m_TRTHelper(nullptr)
48{}
AthAlgorithm()
Default constructor:
int m_nEvents
returns index of hardware units: board, chip, pad private fix for now, will call TRTStrawNeighbourSvc...

◆ ~TRT_StrawStatus()

InDet::TRT_StrawStatus::~TRT_StrawStatus ( )

Default Destructor.

Definition at line 52 of file TRT_StrawStatus.cxx.

53{}

Member Function Documentation

◆ barrelStrawNumber()

int InDet::TRT_StrawStatus::barrelStrawNumber ( int strawNumber,
int strawlayerNumber,
int LayerNumber )
private

◆ clear()

void InDet::TRT_StrawStatus::clear ( )
private

Definition at line 284 of file TRT_StrawStatus.cxx.

284 {
285 m_nEvents = 0;
286 *m_accumulateHits = {};
287 return;
288}
std::unique_ptr< ACCHITS_t > m_accumulateHits

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ endcapStrawNumber()

int InDet::TRT_StrawStatus::endcapStrawNumber ( int strawNumber,
int strawLayerNumber,
int LayerNumber )
private

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode InDet::TRT_StrawStatus::execute ( )

standard Athena-Algorithm method

Definition at line 93 of file TRT_StrawStatus.cxx.

93 {
94
95 SG::ReadHandle<xAOD::EventInfo> eventInfo(m_eventInfoKey);
96 StatusCode sc = StatusCode::SUCCESS;
97 if (not eventInfo.isValid()) {
98 ATH_MSG_ERROR( "Unable to retrieve Event Info " );
99 return StatusCode::FAILURE;
100 }
101 int runNumber = (int) eventInfo->runNumber();
102 if (runNumber != m_runNumber) {
103 if (m_nEvents) { ATH_CHECK( reportResults() ); clear(); }
105 }
106 int lumiBlock0 =eventInfo->lumiBlock();
107 SG::ReadHandle<TRT_RDO_Container> rdoContainer(m_rdoContainerKey);
108
109 if (not rdoContainer.isValid()) {
110 ATH_MSG_ERROR( "no TRT_RDO container available " );
111 return StatusCode::FAILURE;
112 }
113 SG::ReadHandle<DataVector<Trk::Track>> trkCollection(m_tracksName);
114 if (not trkCollection.isValid()) {
115 ATH_MSG_ERROR( "Could not find Tracks Collection: " << m_tracksName );
116 return StatusCode::FAILURE;
117 }
118
119 //================ Event selection
120
121 SG::ReadHandle<xAOD::VertexContainer> vertices(m_vxContainerKey);
122 if (not vertices.isValid()) {
123 ATH_MSG_DEBUG ("Couldn't retrieve VertexContainer with key: PrimaryVertices");
124 return StatusCode::SUCCESS; // just skip to next event in case of no vertexcontainer
125 }
126
127 int countVertices(0);
128 for (const xAOD::Vertex* vx : *(vertices.cptr()) ) {
129 if (vx->vertexType() == xAOD::VxType::PriVtx) {
130 if ( vx-> nTrackParticles() >= 3) countVertices++;
131 }
132 }
133 if (countVertices < 1) {
134 ATH_MSG_INFO( "no vertices with at least 3 tracks found" );
135 return StatusCode::SUCCESS;
136 }
137
138 if (m_skipBusyEvents) { // cosmic running
139 int countRDOhitsInEvent(0);
140 for (TRT_RDO_Container::const_iterator rdoIt = rdoContainer->begin(); rdoIt != rdoContainer->end(); ++rdoIt) {
141 const InDetRawDataCollection<TRT_RDORawData>* TRTCollection(*rdoIt);
142 if (not TRTCollection) continue;
143 for (DataVector<TRT_RDORawData>::const_iterator trtIt = TRTCollection->begin(); trtIt != TRTCollection->end(); ++trtIt) {
144 countRDOhitsInEvent++;
145 }
146 }
147 if (countRDOhitsInEvent>100000) {
148 ATH_MSG_INFO( "N RDO hits in event greater than 100000: " << countRDOhitsInEvent << ", exiting" );
149 return sc;
150 }
151
152 if (trkCollection->size() > 10) {
153 ATH_MSG_INFO( "N tracks greater than 10: " << trkCollection->size() << ", exiting" );
154 return sc;
155 }
156 }
157
158 //================ End event selection
159
160 //================ Loop over all tracks, accumulate hits on track, also find holes on track
161
162 std::vector<Identifier> holeIdentifiers;
163 std::vector<Identifier> holeIdentifiersWithHits; // holes on straws that have hits, it is just that the hit was not associalted to a track
164 for ( DataVector<Trk::Track>::const_iterator trackIt = trkCollection->begin(); trackIt != trkCollection->end(); ++trackIt) {
165 const Trk::Track *track = *trackIt;
166 //=== select track
167 const Trk::Perigee* perigee = (*trackIt)->perigeeParameters();
168 if ( not perigee ) { ATH_MSG_ERROR( "Trk::Perigee missing" ); continue; }
169 if ( std::abs(perigee->pT())/CLHEP::GeV < 1. ) continue; // 1 GeV pT cut
170
171 const DataVector<const Trk::TrackStateOnSurface>* trackStates = (**trackIt).trackStateOnSurfaces();
172 if ( not trackStates ) { ATH_MSG_ERROR( "Trk::TrackStateOnSurface empty" ); continue; }
173
174 int n_pixel_hits(0), n_sct_hits(0), n_trt_hits(0); // count hits, require minimal number of all hits
175 for ( DataVector<const Trk::TrackStateOnSurface>::const_iterator trackStatesIt = trackStates->begin(); trackStatesIt != trackStates->end(); ++trackStatesIt ) {
176 if ( *trackStatesIt == nullptr ) { ATH_MSG_ERROR( "*trackStatesIt == 0" ); continue; }
177
178 if ( !((*trackStatesIt)->type(Trk::TrackStateOnSurface::Measurement)) ) continue; // this skips outliers
179
180 if ( dynamic_cast<const InDet::TRT_DriftCircleOnTrack*> ( (*trackStatesIt)->measurementOnTrack() ) ) n_trt_hits++;
181 else if ( dynamic_cast<const InDet::SCT_ClusterOnTrack*> ( (*trackStatesIt)->measurementOnTrack() ) ) n_sct_hits++;
182 else if( dynamic_cast<const InDet::PixelClusterOnTrack*> ( (*trackStatesIt)->measurementOnTrack() ) ) n_pixel_hits++;
183 }
184 if (n_pixel_hits<2 || n_sct_hits < 6 || n_trt_hits<15) continue; // end count hits
185
186 //=== end select track
187
188 //=== loop over all hits on track, accumulate them
189
190 for ( DataVector<const Trk::TrackStateOnSurface>::const_iterator trackStatesIt = trackStates->begin(); trackStatesIt != trackStates->end(); ++trackStatesIt ) {
191
192 if ( *trackStatesIt == nullptr ) { ATH_MSG_ERROR( "*trackStatesIt == 0" ); continue; }
193
194 if ( !((*trackStatesIt)->type(Trk::TrackStateOnSurface::Measurement)) ) continue; // this skips outliers
195
196 const InDet::TRT_DriftCircleOnTrack *driftCircleOnTrack = dynamic_cast<const InDet::TRT_DriftCircleOnTrack *>( (*trackStatesIt)->measurementOnTrack() );
197 if ( not driftCircleOnTrack ) continue; // not TRT measurement - this way, keep both hits and outliers
198
199 const Trk::TrackStateOnSurface& hit = **trackStatesIt;
200
201 const Trk::TrackParameters* unbiased_track_parameters = m_updator->removeFromState( *(hit.trackParameters()),
203 hit.measurementOnTrack()->localCovariance()).release();
204
205 double unbiased_locR = unbiased_track_parameters->parameters()[Trk::locR];
206 if ( std::abs(unbiased_locR) > m_locR_cut ) continue; // same cut as the default hole search cut
207
208 const InDet::TRT_DriftCircle *driftCircle = driftCircleOnTrack->prepRawData();
209 if ( driftCircle == nullptr ) { ATH_MSG_ERROR( "driftCircle == 0" ); continue; }
210
211 Identifier id = driftCircle->identify();
212 int index[6]; myStrawIndex(id, index); // side, layer, phi, straw_layer, straw_within_layer, straw_index
213 (*m_accumulateHits)[(index[0]>0)?0:1][index[2]][index[5]][1]++; // accumulate hits on track
214 if (driftCircle->highLevel()) (*m_accumulateHits)[(index[0]>0)?0:1][index[2]][index[5]][3]++; // accumulate hits on track
215
216 } // end trackStatesIt loop
217
218 // add holeIdentifiers - fill vector
219
220 std::unique_ptr<const Trk::TrackStates> holes (m_trt_hole_finder->getHolesOnTrack( *track ));
221 if ( holes==nullptr ) continue; // no holes found
222 for (const Trk::TrackStateOnSurface* trackStates : *holes) {
223
224 if ( !trackStates->type( Trk::TrackStateOnSurface::Hole ) ) { ATH_MSG_ERROR( "m_trt_hole_finder returned something that is not a hole" ); continue; }
225
226 const Trk::TrackParameters* track_parameters = trackStates->trackParameters();
227 if (!track_parameters) { ATH_MSG_WARNING( "m_trt_hole_finder track_parameters missing" ); continue; }
228
229 Identifier id = track_parameters->associatedSurface().associatedDetectorElementIdentifier();
230 if ( !(m_TRTHelper->is_trt(id)) ) { ATH_MSG_ERROR( "m_trt_hole_finder returned something that is not a TRT hole" ); continue; }
231
232 // add se same 1.4 mm locR selection, in case it is not on by default
233 if ( std::abs( track_parameters->parameters()[Trk::locR] ) > m_locR_cut ) continue;
234
235 holeIdentifiers.push_back( id );
236 } // end add holeIdentifiers
237
238 } // end trackIt loop
239
240 //================ End loop over all tracks
241
242 //================ Loop over all hits - it includes hits from dead straws that are masked off in drift circle creation
243
244 for (TRT_RDO_Container::const_iterator rdoIt = rdoContainer->begin(); rdoIt != rdoContainer->end(); ++rdoIt) {
245 const InDetRawDataCollection<TRT_RDORawData>* TRTCollection(*rdoIt);
246 if (TRTCollection==nullptr) continue;
247 for (DataVector<TRT_RDORawData>::const_iterator trtIt = TRTCollection->begin(); trtIt != TRTCollection->end(); ++trtIt) {
248 Identifier id = (*trtIt)->identify();
249 int index[6]; myStrawIndex(id, index); // side, layer, phi, straw_layer, straw_within_layer, straw_index
250 (*m_accumulateHits)[(index[0]>0)?0:1][index[2]][index[5]][0]++; // accumulate all hits
251 if ((*trtIt)->highLevel()) (*m_accumulateHits)[(index[0]>0)?0:1][index[2]][index[5]][2]++; // accumulate TR hits
252
253 if (std::find(holeIdentifiers.begin(), holeIdentifiers.end(), id) != holeIdentifiers.end()) // a hole was found on the same straw, but hits is there
254 holeIdentifiersWithHits.push_back( id );
255 }
256 }
257
258 //================ End loop over all hits
259
260 //================ End loop over all holes, each time also save whether the straw with a hole had a hit
261
262 for (unsigned int i=0; i<holeIdentifiers.size(); i++) {
263
264 Identifier id = holeIdentifiers[i];
265
266 int index[6]; myStrawIndex(id, index); // side, layer, phi, straw_layer, straw_within_layer, straw_index
267
268 (*m_accumulateHits)[(index[0]>0)?0:1][index[2]][index[5]][4]++;
269
270 if (std::find(holeIdentifiersWithHits.begin(), holeIdentifiersWithHits.end(), id) != holeIdentifiersWithHits.end())
271 (*m_accumulateHits)[(index[0]>0)?0:1][index[2]][index[5]][5]++;
272 }
273
274 //================ End loop over all hits
275
276 m_nEvents++;
277 last_lumiBlock0 = lumiBlock0;
278 if (m_nEvents%1000==0 && msgLvl(MSG::DEBUG)) ATH_CHECK( reportResults() );
279 return sc;
280}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
static Double_t sc
int last_lumiBlock0
bool msgLvl(const MSG::Level lvl) const
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
Definition DataVector.h:838
SG::ReadHandleKey< xAOD::VertexContainer > m_vxContainerKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
ToolHandle< Trk::ITrackHoleSearchTool > m_trt_hole_finder
void myStrawIndex(Identifier id, int *index)
function that returns straw index (in range 0-5481; 0-1641 for barrel, the rest for endcap) same conv...
Gaudi::Property< double > m_locR_cut
SG::ReadHandleKey< DataVector< Trk::Track > > m_tracksName
PublicToolHandle< Trk::IUpdator > m_updator
Gaudi::Property< int > m_skipBusyEvents
SG::ReadHandleKey< TRT_RDO_Container > m_rdoContainerKey
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
virtual const Surface & associatedSurface() const override=0
Access to the Surface associated to the Parameters.
Identifier associatedDetectorElementIdentifier() const
return Identifier of the associated Detector Element
const MeasurementBase * measurementOnTrack() const
returns MeasurementBase const overload
const TrackParameters * trackParameters() const
return ptr to trackparameters const overload
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
@ Hole
A hole on the track - this is defined in the following way.
str index
Definition DeMoScan.py:362
::StatusCode StatusCode
StatusCode definition for legacy code.
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
@ driftCircle
@ locR
Definition ParamDefs.h:44
ParametersBase< TrackParametersDim, Charged > TrackParameters
@ PriVtx
Primary vertex.
Vertex_v1 Vertex
Define the latest version of the vertex class.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ finalize()

StatusCode InDet::TRT_StrawStatus::finalize ( )

standard Athena-Algorithm method

Definition at line 83 of file TRT_StrawStatus.cxx.

83 {
86 // Code entered here will be executed once at the end of the program run.
87 m_accumulateHits.reset();
88 return StatusCode::SUCCESS;
89}
Gaudi::Property< int > m_printDetailedInformation

◆ initialize()

StatusCode InDet::TRT_StrawStatus::initialize ( )

standard Athena-Algorithm method

Definition at line 58 of file TRT_StrawStatus.cxx.

59{
60
61 m_accumulateHits = std::make_unique<ACCHITS_t>();
62 assert( (*m_accumulateHits)[0][0].size() == nAllStraws );
63 clear();
64
65 // Code entered here will be executed once at program start.
66 // Initialize ReadHandleKey
67 ATH_CHECK(m_eventInfoKey.initialize());
68 ATH_CHECK(m_rdoContainerKey.initialize());
69 ATH_CHECK(m_tracksName.initialize());
70 ATH_CHECK(m_vxContainerKey.initialize());
71 ATH_CHECK( detStore()->retrieve(m_TRTHelper, "TRT_ID"));
73 ATH_CHECK( m_trt_hole_finder.retrieve() );
74 ATH_CHECK(m_updator.retrieve());
75 ATH_CHECK( m_mapSvc.retrieve());
76 ATH_CHECK( m_DCSSvc.retrieve());
77 ATH_MSG_DEBUG( "initialize() successful in " << name() << ", retrieved: ..., locR_cut = " << m_locR_cut << " mm." );
78 return StatusCode::SUCCESS;
79}
const size_t nAllStraws
const ServiceHandle< StoreGateSvc > & detStore() const
ServiceHandle< ITRT_DCS_ConditionsSvc > m_DCSSvc
ServiceHandle< ITRT_HWMappingSvc > m_mapSvc
ServiceHandle< ITRT_StrawNeighbourSvc > m_TRTStrawNeighbourSvc

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ myStrawIndex()

void InDet::TRT_StrawStatus::myStrawIndex ( Identifier id,
int * index )
private

function that returns straw index (in range 0-5481; 0-1641 for barrel, the rest for endcap) same convention as for TRT_monitoring (copied from there)

Definition at line 360 of file TRT_StrawStatus.cxx.

360 {
361 int side = m_TRTHelper->barrel_ec(id);
362 int layerNumber = m_TRTHelper->layer_or_wheel(id);
363 int strawLayerNumber = m_TRTHelper->straw_layer(id);
364 int strawNumber = m_TRTHelper->straw(id);
365 int straw(0);
366
367 const int numberOfStraws[74] = { 0, 15, 31, 47, 63, 79, 96, 113, 130, 147, 164, 182, 200, 218, 236, 254, 273, 292, 311, 329, // layer 0, 329 straws, strawlayers 0-18
368 348, 368, 388, 408, 428, 448, 469, 490, 511, 532, 553, 575, 597, 619, 641, 663, 686, 709, 732, 755, 778, 802, 826, 849, // layer 1, 520 straws, strawLayers 0-23
369 872, 896, 920, 944, 968, 993, 1018, 1043, 1068, 1093, 1119, 1145, 1171, 1197, 1223, 1250, 1277, 1304, 1331, 1358, 1386, 1414, 1442, 1470, 1498, 1527, 1556, 1585, 1614, 1642 }; // layer 2
370
371 if (abs(side)==1) { // barrel unique straw number
372 if (layerNumber==1) strawLayerNumber+= 19;
373 else if (layerNumber==2) strawLayerNumber+= 43;
374 straw = ( numberOfStraws[strawLayerNumber+1] - strawNumber -1 );
375 } else { // end-cap unique straw number
376 int board = layerNumber;
377 if (board<6) { board *= 2; if (strawLayerNumber>7) board++; }
378 else { board += 6; }
379 straw = board * 192 + strawNumber * 8 + strawLayerNumber % 8 ;
380 straw += 1642;
381 }
382 index[0] = side;
383 index[1] = layerNumber;
384 index[2] = m_TRTHelper->phi_module(id);
385 index[3] = strawLayerNumber;
386 index[4] = strawNumber;
387 index[5] = straw;
388 return;
389}
@ straw
Definition HitInfo.h:82

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ printDetailedInformation()

void InDet::TRT_StrawStatus::printDetailedInformation ( )
private

Definition at line 312 of file TRT_StrawStatus.cxx.

312 {
313 ATH_MSG_INFO("InDet::TRT_StrawStatus::printDetailedInformation()");
314 const std::string fileName =
315 std::format("{}.{}{}_printDetailedInformation.txt",
316 m_fileName.value(),
317 std::string(7 - std::min<std::size_t>(7, std::to_string(m_runNumber).size()), '0'),
319 std::ofstream out(fileName, std::ios::out | std::ios::trunc);
320 if (!out) {
321 ATH_MSG_ERROR(std::format("Failed to open '{}' for writing", fileName));
322 return;
323 }
324
325 // Iterate over straw layers
326 for (auto it = m_TRTHelper->straw_layer_begin(); it != m_TRTHelper->straw_layer_end(); ++it) {
327 const Identifier layerId = *it;
328 const int maxStraw = m_TRTHelper->straw_max(layerId);
329
330 for (int i = 0; i <= maxStraw; ++i) {
331 const Identifier id = m_TRTHelper->straw_id(layerId, i);
332 std::array<int, 6> index{};
333 myStrawIndex(id, index.data());
334 int chip = 0;
335 int HVpad = 0;
336 m_TRTStrawNeighbourSvc->getChip(id, chip);
337 m_TRTStrawNeighbourSvc->getPad(id, HVpad);
338 if (!m_printStatusCount) {
339 ATH_MSG_INFO("if the code crashes on the next line, there is a problem with "
340 "m_TRTStrawStatusSummarySvc not being loaded ");
341 ATH_MSG_INFO("in that case, running with reco turned on normally solves the problem, "
342 "know of no better solution at the moment");
343 ATH_MSG_INFO("if you do not need the detailed print information, you can also just set "
344 "printDetailedInformation to 0 to avoid this crash");
346 }
347 const auto& ctx = Gaudi::Hive::currentContext();
348 const int status = m_TRTStrawStatusSummaryTool->get_status(id, ctx);
349 const int statusTemporary = m_TRTStrawStatusSummaryTool->getStatus(id, ctx);
350 const int statusPermanent = m_TRTStrawStatusSummaryTool->getStatusPermanent(id, ctx);
351 // Write: six indices, then chip/HVpad/status trio
352 for (int j = 0; j < 6; ++j) out << index[j] << ' ';
353 out << chip << ' ' << HVpad << ' ' << status << ' '
354 << statusTemporary << ' ' << statusPermanent << '\n';
355 }
356 }
357}
ToolHandle< ITRT_StrawStatusSummaryTool > m_TRTStrawStatusSummaryTool
std::atomic< int > m_printStatusCount
Gaudi::Property< std::string > m_fileName
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)
status
Definition merge.py:16

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ reportResults()

StatusCode InDet::TRT_StrawStatus::reportResults ( )
private

Definition at line 290 of file TRT_StrawStatus.cxx.

290 {
291 ATH_MSG_INFO( "InDet::TRT_StrawStatus::reportResults() for " << m_nEvents << " events." );
292 char fileName[300];
293 snprintf(fileName, 299,"%s.%07d_newFormat.txt", m_fileName.value().c_str(), m_runNumber);
294 FILE *f = fopen(fileName, "w");
295 if (!f) {
296 ATH_MSG_ERROR( "InDet::TRT_StrawStatus::reportResults: Cannot open " << fileName << " for write" );
297 return StatusCode::FAILURE;
298 }
299 fprintf(f, "%d %d %d %d %d %d %d %d %d \n", 0, 0, 0, 0, 0, 0, 0, 0, m_nEvents);
300 for (size_t i=0; i<2; i++) for (size_t j=0; j<32; j++) for (size_t k=0; k<nAllStraws; k++) {
301 int side = (i>0)?-1:1;
302 if (k>=1642) side *= 2;
303 fprintf(f, "%d %zu %zu", side, j, k);
304 for (int m=0; m<6; m++) fprintf(f, " %d", (*m_accumulateHits)[i][j][k][m]);
305 fprintf(f, "\n");
306 }
307 fclose(f);
308 return StatusCode::SUCCESS;
309}

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_accumulateHits

std::unique_ptr<ACCHITS_t> InDet::TRT_StrawStatus::m_accumulateHits
private

Definition at line 114 of file TRT_StrawStatus.h.

◆ m_DCSSvc

ServiceHandle<ITRT_DCS_ConditionsSvc> InDet::TRT_StrawStatus::m_DCSSvc {this,"InDetTRT_DCS_ConditionsSvc","TRT_DCS_ConditionsSvc","" }
private

Definition at line 76 of file TRT_StrawStatus.h.

76{this,"InDetTRT_DCS_ConditionsSvc","TRT_DCS_ConditionsSvc","" };

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_eventInfoKey

SG::ReadHandleKey<xAOD::EventInfo> InDet::TRT_StrawStatus::m_eventInfoKey {this,"EventInfoKey","EventInfo","RHK to retrieve xAOD::EventInfo"}
private

Definition at line 88 of file TRT_StrawStatus.h.

88{this,"EventInfoKey","EventInfo","RHK to retrieve xAOD::EventInfo"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_fileName

Gaudi::Property<std::string> InDet::TRT_StrawStatus::m_fileName {this, "outputFileName", "TRT_StrawStatusOutput", ""}
private

Definition at line 85 of file TRT_StrawStatus.h.

85{this, "outputFileName", "TRT_StrawStatusOutput", ""};

◆ m_locR_cut

Gaudi::Property<double> InDet::TRT_StrawStatus::m_locR_cut {this, "locR_cut", 1.4, ""}
private

Definition at line 82 of file TRT_StrawStatus.h.

82{this, "locR_cut", 1.4, ""};

◆ m_mapSvc

ServiceHandle<ITRT_HWMappingSvc> InDet::TRT_StrawStatus::m_mapSvc {this,"HWMapSvc","TRT_HWMappingSvc","" }
private

Definition at line 75 of file TRT_StrawStatus.h.

75{this,"HWMapSvc","TRT_HWMappingSvc","" };

◆ m_nEvents

int InDet::TRT_StrawStatus::m_nEvents
private

returns index of hardware units: board, chip, pad private fix for now, will call TRTStrawNeighbourSvc when available number boards 0-9 barrel, 0-19 endcap (first 12 on A wheels, ordering from smaller to larger |z|) number chips 0-103 barrel, 0-239 endcap number pads: chips x 2

Definition at line 109 of file TRT_StrawStatus.h.

◆ m_printDetailedInformation

Gaudi::Property<int> InDet::TRT_StrawStatus::m_printDetailedInformation {this, "printDetailedInformation", 0, ""}
private

Definition at line 84 of file TRT_StrawStatus.h.

84{this, "printDetailedInformation", 0, ""};

◆ m_printStatusCount

std::atomic<int> InDet::TRT_StrawStatus::m_printStatusCount {0}
mutableprivate

Definition at line 117 of file TRT_StrawStatus.h.

117{0};

◆ m_rdoContainerKey

SG::ReadHandleKey<TRT_RDO_Container> InDet::TRT_StrawStatus::m_rdoContainerKey {this,"RDO_ContainerKey","TRT_RDOs","RHK to retrieve TRT RDO's"}
private

Definition at line 89 of file TRT_StrawStatus.h.

89{this,"RDO_ContainerKey","TRT_RDOs","RHK to retrieve TRT RDO's"};

◆ m_runNumber

int InDet::TRT_StrawStatus::m_runNumber
private

Definition at line 110 of file TRT_StrawStatus.h.

◆ m_skipBusyEvents

Gaudi::Property<int> InDet::TRT_StrawStatus::m_skipBusyEvents {this, "skipBusyEvents", 0, ""}
private

Definition at line 83 of file TRT_StrawStatus.h.

83{this, "skipBusyEvents", 0, ""};

◆ m_tracksName

SG::ReadHandleKey<DataVector<Trk::Track> > InDet::TRT_StrawStatus::m_tracksName {this,"tracksCollectionKey","CombinedInDetTracks","RHK to retrieve CombinedInDetTracks"}
private

Definition at line 90 of file TRT_StrawStatus.h.

90{this,"tracksCollectionKey","CombinedInDetTracks","RHK to retrieve CombinedInDetTracks"};

◆ m_trt_hole_finder

ToolHandle<Trk::ITrackHoleSearchTool> InDet::TRT_StrawStatus::m_trt_hole_finder {this, "trt_hole_finder", "Trk::ITrackHoleSearchTool", ""}
private

Definition at line 79 of file TRT_StrawStatus.h.

79{this, "trt_hole_finder", "Trk::ITrackHoleSearchTool", ""};

◆ m_TRTHelper

const TRT_ID* InDet::TRT_StrawStatus::m_TRTHelper
private

Definition at line 116 of file TRT_StrawStatus.h.

◆ m_TRTStrawNeighbourSvc

ServiceHandle<ITRT_StrawNeighbourSvc> InDet::TRT_StrawStatus::m_TRTStrawNeighbourSvc {this,"TRT_StrawNeighbourSvc","TRT_StrawNeighbourSvc","retrieve barrel and end-cap straw number later on, as well as DTMROC" }
private

Definition at line 77 of file TRT_StrawStatus.h.

77{this,"TRT_StrawNeighbourSvc","TRT_StrawNeighbourSvc","retrieve barrel and end-cap straw number later on, as well as DTMROC" };

◆ m_TRTStrawStatusSummaryTool

ToolHandle<ITRT_StrawStatusSummaryTool> InDet::TRT_StrawStatus::m_TRTStrawStatusSummaryTool {this, "TRT_StrawStatusSummaryTool", "ITRT_StrawStatusSummaryTool", ""}
private

Definition at line 78 of file TRT_StrawStatus.h.

78{this, "TRT_StrawStatusSummaryTool", "ITRT_StrawStatusSummaryTool", ""};

◆ m_updator

PublicToolHandle<Trk::IUpdator> InDet::TRT_StrawStatus::m_updator {this, "KalmanUpdator", "Trk::KalmanUpdator/TrkKalmanUpdator",""}
private

Definition at line 80 of file TRT_StrawStatus.h.

80{this, "KalmanUpdator", "Trk::KalmanUpdator/TrkKalmanUpdator",""};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ m_vxContainerKey

SG::ReadHandleKey<xAOD::VertexContainer> InDet::TRT_StrawStatus::m_vxContainerKey {this,"VxContainerKey","PrimaryVertices","RHK to retrieve VX Primary candidates"}
private

Definition at line 91 of file TRT_StrawStatus.h.

91{this,"VxContainerKey","PrimaryVertices","RHK to retrieve VX Primary candidates"};

The documentation for this class was generated from the following files: