|
ATLAS Offline Software
|
#include <TRTActiveCondAlg.h>
|
| TRTActiveCondAlg (const std::string &name, ISvcLocator *pSvcLocator) |
|
virtual | ~TRTActiveCondAlg () override |
|
virtual StatusCode | initialize () override |
|
virtual StatusCode | execute (const EventContext &ctx) const override |
|
virtual bool | isReEntrant () const override final |
|
virtual StatusCode | sysInitialize () override |
| Override sysInitialize. More...
|
|
virtual bool | isClonable () const override |
| Specify if the algorithm is clonable. More...
|
|
virtual unsigned int | cardinality () const override |
| Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant. More...
|
|
virtual StatusCode | sysExecute (const EventContext &ctx) override |
| Execute an algorithm. More...
|
|
virtual const DataObjIDColl & | extraOutputDeps () const override |
| Return the list of extra output dependencies. More...
|
|
virtual bool | filterPassed (const EventContext &ctx) const |
|
virtual void | setFilterPassed (bool state, const EventContext &ctx) const |
|
ServiceHandle< StoreGateSvc > & | evtStore () |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | evtStore () const |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | detStore () const |
| The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
virtual StatusCode | sysStart () override |
| Handle START transition. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. More...
|
|
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T > &t) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc="none") |
| Declare a new Gaudi property. More...
|
|
void | updateVHKA (Gaudi::Details::PropertyBase &) |
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
|
SG::ReadCondHandleKey< StrawStatusContainer > | m_strawReadKey {this,"StrawReadKey","/TRT/Cond/Status","Straw Status in-key"} |
|
SG::ReadCondHandleKey< InDetDD::TRT_DetElementContainer > | m_trtDetEleContKey {this, "TRTDetEleContKey", "TRT_DetElementContainer", "Key of TRT_DetElementContainer for TRT"} |
|
SG::WriteCondHandleKey< TRTCond::ActiveFraction > | m_strawWriteKey {this,"ActiveWriteKey","ActiveFraction","ActiveFraction out-key"} |
|
ToolHandle< ITRT_StrawStatusSummaryTool > | m_strawStatus |
|
const TRT_ID * | m_trtId {} |
|
DataObjIDColl | m_extendedExtraObjects |
| Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks. More...
|
|
StoreGateSvc_t | m_evtStore |
| Pointer to StoreGate (event store by default) More...
|
|
StoreGateSvc_t | m_detStore |
| Pointer to StoreGate (detector store by default) More...
|
|
std::vector< SG::VarHandleKeyArray * > | m_vhka |
|
bool | m_varHandleArraysDeclared |
|
Definition at line 20 of file TRTActiveCondAlg.h.
◆ StoreGateSvc_t
◆ StrawStatusContainer
◆ TRTActiveCondAlg()
TRTActiveCondAlg::TRTActiveCondAlg |
( |
const std::string & |
name, |
|
|
ISvcLocator * |
pSvcLocator |
|
) |
| |
◆ ~TRTActiveCondAlg()
TRTActiveCondAlg::~TRTActiveCondAlg |
( |
| ) |
|
|
overridevirtualdefault |
◆ cardinality()
unsigned int AthReentrantAlgorithm::cardinality |
( |
| ) |
const |
|
overridevirtualinherited |
Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.
Override this to return 0 for reentrant algorithms.
Override this to return 0 for reentrant algorithms.
Definition at line 55 of file AthReentrantAlgorithm.cxx.
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleBase
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 245 of file AthCommonDataStore.h.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleKey
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 221 of file AthCommonDataStore.h.
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This is the generic version, for types that do not derive from SG::VarHandleKey
. It just forwards to the base class version of declareProperty
.
Definition at line 333 of file AthCommonDataStore.h.
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This dispatches to either the generic declareProperty
or the one for VarHandle/Key/KeyArray.
Definition at line 352 of file AthCommonDataStore.h.
◆ declareProperty() [6/6]
◆ detStore()
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ execute()
StatusCode TRTActiveCondAlg::execute |
( |
const EventContext & |
ctx | ) |
const |
|
overridevirtual |
Definition at line 41 of file TRTActiveCondAlg.cxx.
50 if(writeHandle.isValid()) {
51 ATH_MSG_DEBUG(
"CondHandle " << writeHandle.fullKey() <<
" is already valid."
52 <<
". In theory this should not be called, but may happen"
53 <<
" if multiple concurrent events are being processed out of order.");
55 return StatusCode::SUCCESS;
61 std::unique_ptr<TRTCond::ActiveFraction> writeCdo{std::make_unique<TRTCond::ActiveFraction>()};
68 ATH_MSG_INFO(
" Initialize TRTCond::ActiveFraction table with number of phi, eta bins: "
69 << writeCdo->getPhiBins().size() <<
", " << writeCdo->getEtaBins().size() );
71 for (
unsigned int i=0;
i<writeCdo->getEtaBins().
size();
i++) {
72 float etaMin = writeCdo->getEtaBins()[
i].first;
73 float etaMax = writeCdo->getEtaBins()[
i].second;
77 for (
unsigned int j=0; j<writeCdo->getPhiBins().
size(); j++) {
78 float phiMin = writeCdo->getPhiBins()[j].first;
79 float phiMax = writeCdo->getPhiBins()[j].second;
80 int bin = writeCdo->findPhiBin( (phiMin+phiMax)/2. );
81 ATH_MSG_DEBUG(
"TRTCond::ActiveFraction: findPhiBin( " << phiMin <<
", " << phiMax <<
" ] = " <<
bin );
85 std::vector<int> dummyPhiVec( writeCdo->getPhiBins().size(), 0 );
86 std::vector<std::vector<int> > dummyTableCountAll( writeCdo->getEtaBins().size(), dummyPhiVec );
87 std::vector<std::vector<int> > dummyTableCountDead( writeCdo->getEtaBins().size(), dummyPhiVec );
91 if (not trtDetEleHandle.isValid() or elements==
nullptr) {
93 return StatusCode::FAILURE;
96 float rMinEndcap = 617.;
97 float rMaxEndcap = 1106.;
98 int countAll(0), countDead(0), countPhiSkipped(0), countEtaSkipped(0), countInvalidEtaValues(0);
101 for (
int i=0;
i<=nStrawsInLayer;
i++) {
110 countAll++;
if (
status) countDead++;
112 const Amg::Vector3D &strawPosition = elements->getDetectorElement(hashId)->center(
id);
113 double phi = std::atan2( strawPosition.y(), strawPosition.x() );
114 int phiBin = writeCdo->findPhiBin(
phi );
123 float z = std::abs( strawPosition.z() );
124 float thetaMin(0.), thetaMax(0.);
128 float r = std::sqrt(
std::pow(strawPosition.x(), 2) +
std::pow(strawPosition.y(), 2) );
130 thetaMax = ((
z-zRange)>0.) ?
std::atan(
r / (
z-zRange) ) : 1.57;
136 float thetaDummy = thetaMin;
137 thetaMin =
M_PI - thetaMax;
138 thetaMax =
M_PI - thetaDummy;
141 float thetaCheck[] = {thetaMax, thetaMin};
142 float etaCheck[] = {0., 0.};
143 for (
int ti=0; ti<2; ti++) {
144 if (thetaCheck[ti]<=0.||thetaCheck[ti]>=
M_PI)
ATH_MSG_DEBUG(
"TRTCond::ActiveFraction: theta " << ti <<
" " << thetaCheck[ti]);
145 float tanTheta =
std::tan(thetaCheck[ti]/2.);
147 ATH_MSG_DEBUG(
"TRTCond::ActiveFraction: theta tan " << ti <<
" " << tanTheta );
148 countInvalidEtaValues++;
151 etaCheck[ti] = -
std::log( tanTheta );
153 float etaMin = etaCheck[0];
154 float etaMax = etaCheck[1];
155 int etaMinBin = writeCdo->findEtaBin(
etaMin );
156 int etaMaxBin = writeCdo->findEtaBin(
etaMax );
158 if (etaMinBin<0 && etaMaxBin<0) {
159 ATH_MSG_WARNING(
"TRTCond::ActiveFraction: etaMaxBin<etaMinBin " << thetaMin <<
" " << thetaMax
160 <<
" " <<
etaMin <<
" " <<
etaMax <<
" " << etaMinBin <<
" " << etaMaxBin <<
", side: " <<
side);
164 if (etaMinBin<0) etaMinBin = 0;
165 if (etaMaxBin<0) etaMaxBin = writeCdo->getEtaBins().size() - 1;
166 if (etaMaxBin<etaMinBin)
ATH_MSG_WARNING(
"TRTCond::ActiveFraction: etaMaxBin<etaMinBin " << etaMinBin <<
" " << etaMaxBin <<
", side: " <<
side);
176 for (
unsigned int i = 0;
i < writeCdo->getEtaBins().
size(); ++
i) {
177 for (
unsigned int j = 0; j < writeCdo->getPhiBins().
size(); ++j) {
178 float deadFraction = 1. * dummyTableCountDead[
i][j];
179 if (dummyTableCountAll[
i][j]>0) deadFraction /= (1. * dummyTableCountAll[
i][j]);
180 writeCdo->setActiveFraction(
i, j, 1. - deadFraction);
181 ATH_MSG_DEBUG(
"dummyTableCountDead: " <<
i <<
", " << j <<
", count " << dummyTableCountAll[
i][j] <<
" dead " << deadFraction);
185 float deadStrawFraction = (1.*countDead) / (1.*countAll);
186 ATH_MSG_INFO(
" Initialize TRTCond::ActiveFraction table finished, count all TRT straws: " << countAll
187 <<
", count dead straws: " << countDead <<
" (" << deadStrawFraction
188 <<
"%), straws skipped due to invalid phi, eta range: " << countPhiSkipped <<
" " << countEtaSkipped );
190 if (countInvalidEtaValues)
ATH_MSG_WARNING(
"TRT_ActiveFraction: found invalid eta range, check: " << countInvalidEtaValues);
199 if(strawContainer==
nullptr) {
201 return StatusCode::FAILURE;
205 if(!strawReadHandle.range(rangeW)) {
206 ATH_MSG_ERROR(
"Failed to retrieve validity range for " << strawReadHandle.key());
207 return StatusCode::FAILURE;
212 if(writeHandle.record(rangeW,std::move(writeCdo)).isFailure()) {
213 ATH_MSG_ERROR(
"Could not record ActiveFraction " << writeHandle.key()
214 <<
" with EventRange " << rangeW
215 <<
" into Conditions Store");
216 return StatusCode::FAILURE;
220 return StatusCode::SUCCESS;
◆ extraDeps_update_handler()
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 & AthReentrantAlgorithm::extraOutputDeps |
( |
| ) |
const |
|
overridevirtualinherited |
Return the list of extra output dependencies.
This list is extended to include symlinks implied by inheritance relations.
Definition at line 79 of file AthReentrantAlgorithm.cxx.
86 return Algorithm::extraOutputDeps();
◆ filterPassed()
virtual bool AthReentrantAlgorithm::filterPassed |
( |
const EventContext & |
ctx | ) |
const |
|
inlinevirtualinherited |
◆ initialize()
StatusCode TRTActiveCondAlg::initialize |
( |
| ) |
|
|
overridevirtual |
◆ inputHandles()
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.
◆ isClonable()
bool AthReentrantAlgorithm::isClonable |
( |
| ) |
const |
|
overridevirtualinherited |
Specify if the algorithm is clonable.
Reentrant algorithms are clonable.
Reimplemented in Simulation::BeamEffectsAlg, InDet::SiTrackerSpacePointFinder, InDet::SCT_Clusterization, InDet::SiSPSeededTrackFinder, SCTRawDataProvider, InDet::GNNSeedingTrackMaker, SCT_PrepDataToxAOD, RoIBResultToxAOD, SCT_CablingCondAlgFromCoraCool, SCT_ReadCalibDataTestAlg, SCT_CablingCondAlgFromText, InDet::SiSPGNNTrackMaker, SCT_ReadCalibChipDataTestAlg, SCT_TestCablingAlg, SCT_ConfigurationConditionsTestAlg, ITkPixelCablingAlg, ITkStripCablingAlg, SCTEventFlagWriter, SCT_ConditionsSummaryTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_TdaqEnabledTestAlg, SCT_SiliconConditionsTestAlg, SCTSiLorentzAngleTestAlg, SCT_ByteStreamErrorsTestAlg, SCT_ConditionsParameterTestAlg, SCT_FlaggedConditionTestAlg, SCT_StripVetoTestAlg, SCT_RawDataToxAOD, and SCTSiPropertiesTestAlg.
Definition at line 44 of file AthReentrantAlgorithm.cxx.
◆ isReEntrant()
virtual bool TRTActiveCondAlg::isReEntrant |
( |
| ) |
const |
|
inlinefinaloverridevirtual |
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ outputHandles()
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.
◆ renounce()
◆ renounceArray()
◆ setFilterPassed()
virtual void AthReentrantAlgorithm::setFilterPassed |
( |
bool |
state, |
|
|
const EventContext & |
ctx |
|
) |
| const |
|
inlinevirtualinherited |
◆ sysExecute()
StatusCode AthReentrantAlgorithm::sysExecute |
( |
const EventContext & |
ctx | ) |
|
|
overridevirtualinherited |
Execute an algorithm.
We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.
Definition at line 67 of file AthReentrantAlgorithm.cxx.
69 return Gaudi::Algorithm::sysExecute (ctx);
◆ sysInitialize()
StatusCode AthReentrantAlgorithm::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< Gaudi::Algorithm > >.
Reimplemented in InputMakerBase, and HypoBase.
Definition at line 96 of file AthReentrantAlgorithm.cxx.
107 if ( cs.retrieve().isFailure() ) {
109 return StatusCode::SUCCESS;
111 if (cs->regHandle(
this,*
h).isFailure()) {
112 sc = StatusCode::FAILURE;
113 ATH_MSG_ERROR(
"unable to register WriteCondHandle " <<
h->fullKey()
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateVHKA()
◆ m_detStore
◆ m_evtStore
◆ m_extendedExtraObjects
DataObjIDColl AthReentrantAlgorithm::m_extendedExtraObjects |
|
privateinherited |
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
Empty if no symlinks were found.
Definition at line 153 of file AthReentrantAlgorithm.h.
◆ m_strawReadKey
◆ m_strawStatus
◆ m_strawWriteKey
◆ m_trtDetEleContKey
◆ m_trtId
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
def retrieve(aClass, aKey=None)
Identifier layer_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer) const
For an individual straw layer.
int straw_max(const Identifier &id) const
Scalar phi() const
phi method
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
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)
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
SG::ReadCondHandleKey< StrawStatusContainer > m_strawReadKey
const_id_iterator straw_layer_end(void) const
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual void setOwner(IDataHandleHolder *o)=0
AthReentrantAlgorithm()
Default constructor:
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
::StatusCode StatusCode
StatusCode definition for legacy code.
SG::ReadCondHandleKey< InDetDD::TRT_DetElementContainer > m_trtDetEleContKey
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
int straw_layer(const Identifier &id) const
int layer_or_wheel(const Identifier &id) const
DataObjIDColl m_extendedExtraObjects
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setPhiMap phiBin
virtual StatusCode sysInitialize() override
Override sysInitialize.
StatusCode initialize(bool used=true)
Eigen::Matrix< double, 3, 1 > Vector3D
TRTCond::StrawStatusMultChanContainer StrawStatusContainer
#define ATH_MSG_WARNING(x)
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
SG::WriteCondHandleKey< TRTCond::ActiveFraction > m_strawWriteKey
const_id_iterator straw_layer_begin(void) const
Iterators over full set of straw_layer ids. Straw_layer ids are sorted.
Class to hold collection of TRT detector elements.
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
setScale setgFexType iEta
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
IdentifierHash straw_layer_hash(Identifier straw_layer_id) const
straw_layer hash from id - optimized
Identifier straw_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer, int straw) const
Three ways of getting id for a single straw:
ToolHandle< ITRT_StrawStatusSummaryTool > m_strawStatus