 |
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, V, H > &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 |
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKey> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyArrayType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleType &) |
| specialization for handling Gaudi::Property<SG::VarHandleBase> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T, V, H > &t, const SG::NotHandleType &) |
| specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
|
|
|
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 {this, "TRTStrawStatusSummaryTool", "TRT_StrawStatusSummaryTool"} |
|
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()
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 75 of file AthCommonReentrantAlgorithm.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 39 of file TRTActiveCondAlg.cxx.
48 if(writeHandle.isValid()) {
49 ATH_MSG_DEBUG(
"CondHandle " << writeHandle.fullKey() <<
" is already valid."
50 <<
". In theory this should not be called, but may happen"
51 <<
" if multiple concurrent events are being processed out of order.");
53 return StatusCode::SUCCESS;
59 std::unique_ptr<TRTCond::ActiveFraction> writeCdo{std::make_unique<TRTCond::ActiveFraction>()};
66 ATH_MSG_INFO(
" Initialize TRTCond::ActiveFraction table with number of phi, eta bins: "
67 << writeCdo->getPhiBins().size() <<
", " << writeCdo->getEtaBins().size() );
69 for (
unsigned int i=0;
i<writeCdo->getEtaBins().
size();
i++) {
70 float etaMin = writeCdo->getEtaBins()[
i].first;
71 float etaMax = writeCdo->getEtaBins()[
i].second;
75 for (
unsigned int j=0; j<writeCdo->getPhiBins().
size(); j++) {
76 float phiMin = writeCdo->getPhiBins()[j].first;
77 float phiMax = writeCdo->getPhiBins()[j].second;
78 int bin = writeCdo->findPhiBin( (phiMin+phiMax)/2. );
79 ATH_MSG_DEBUG(
"TRTCond::ActiveFraction: findPhiBin( " << phiMin <<
", " << phiMax <<
" ] = " <<
bin );
83 std::vector<int> dummyPhiVec( writeCdo->getPhiBins().size(), 0 );
84 std::vector<std::vector<int> > dummyTableCountAll( writeCdo->getEtaBins().size(), dummyPhiVec );
85 std::vector<std::vector<int> > dummyTableCountDead( writeCdo->getEtaBins().size(), dummyPhiVec );
89 if (not trtDetEleHandle.isValid() or elements==
nullptr) {
91 return StatusCode::FAILURE;
94 float rMinEndcap = 617.;
95 float rMaxEndcap = 1106.;
96 int countAll(0), countDead(0), countPhiSkipped(0), countEtaSkipped(0), countInvalidEtaValues(0);
99 for (
int i=0;
i<=nStrawsInLayer;
i++) {
108 countAll++;
if (
status) countDead++;
110 const Amg::Vector3D &strawPosition = elements->getDetectorElement(hashId)->center(
id);
111 double phi = std::atan2( strawPosition.y(), strawPosition.x() );
112 int phiBin = writeCdo->findPhiBin(
phi );
121 float z = std::abs( strawPosition.z() );
122 float thetaMin(0.), thetaMax(0.);
126 float r = std::sqrt(
std::pow(strawPosition.x(), 2) +
std::pow(strawPosition.y(), 2) );
128 thetaMax = ((
z-zRange)>0.) ?
std::atan(
r / (
z-zRange) ) : 1.57;
134 float thetaDummy = thetaMin;
135 thetaMin =
M_PI - thetaMax;
136 thetaMax =
M_PI - thetaDummy;
139 float thetaCheck[] = {thetaMax, thetaMin};
140 float etaCheck[] = {0., 0.};
141 for (
int ti=0; ti<2; ti++) {
142 if (thetaCheck[ti]<=0.||thetaCheck[ti]>=
M_PI)
ATH_MSG_DEBUG(
"TRTCond::ActiveFraction: theta " << ti <<
" " << thetaCheck[ti]);
143 float tanTheta =
std::tan(thetaCheck[ti]/2.);
145 ATH_MSG_DEBUG(
"TRTCond::ActiveFraction: theta tan " << ti <<
" " << tanTheta );
146 countInvalidEtaValues++;
149 etaCheck[ti] = -
std::log( tanTheta );
151 float etaMin = etaCheck[0];
152 float etaMax = etaCheck[1];
153 int etaMinBin = writeCdo->findEtaBin(
etaMin );
154 int etaMaxBin = writeCdo->findEtaBin(
etaMax );
156 if (etaMinBin<0 && etaMaxBin<0) {
157 ATH_MSG_WARNING(
"TRTCond::ActiveFraction: etaMaxBin<etaMinBin " << thetaMin <<
" " << thetaMax
158 <<
" " <<
etaMin <<
" " <<
etaMax <<
" " << etaMinBin <<
" " << etaMaxBin <<
", side: " <<
side);
162 if (etaMinBin<0) etaMinBin = 0;
163 if (etaMaxBin<0) etaMaxBin = writeCdo->getEtaBins().size() - 1;
164 if (etaMaxBin<etaMinBin)
ATH_MSG_WARNING(
"TRTCond::ActiveFraction: etaMaxBin<etaMinBin " << etaMinBin <<
" " << etaMaxBin <<
", side: " <<
side);
174 for (
unsigned int i = 0;
i < writeCdo->getEtaBins().
size(); ++
i) {
175 for (
unsigned int j = 0; j < writeCdo->getPhiBins().
size(); ++j) {
176 float deadFraction = 1. * dummyTableCountDead[
i][j];
177 if (dummyTableCountAll[
i][j]>0) deadFraction /= (1. * dummyTableCountAll[
i][j]);
178 writeCdo->setActiveFraction(
i, j, 1. - deadFraction);
179 ATH_MSG_DEBUG(
"dummyTableCountDead: " <<
i <<
", " << j <<
", count " << dummyTableCountAll[
i][j] <<
" dead " << deadFraction);
183 float deadStrawFraction = (1.*countDead) / (1.*countAll);
184 ATH_MSG_INFO(
" Initialize TRTCond::ActiveFraction table finished, count all TRT straws: " << countAll
185 <<
", count dead straws: " << countDead <<
" (" << deadStrawFraction
186 <<
"%), straws skipped due to invalid phi, eta range: " << countPhiSkipped <<
" " << countEtaSkipped );
188 if (countInvalidEtaValues)
ATH_MSG_WARNING(
"TRT_ActiveFraction: found invalid eta range, check: " << countInvalidEtaValues);
197 if(strawContainer==
nullptr) {
199 return StatusCode::FAILURE;
203 if(!strawReadHandle.range(rangeW)) {
204 ATH_MSG_ERROR(
"Failed to retrieve validity range for " << strawReadHandle.key());
205 return StatusCode::FAILURE;
210 if(writeHandle.record(rangeW,std::move(writeCdo)).isFailure()) {
211 ATH_MSG_ERROR(
"Could not record ActiveFraction " << writeHandle.key()
212 <<
" with EventRange " << rangeW
213 <<
" into Conditions Store");
214 return StatusCode::FAILURE;
218 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()
Return the list of extra output dependencies.
This list is extended to include symlinks implied by inheritance relations.
Definition at line 94 of file AthCommonReentrantAlgorithm.cxx.
◆ filterPassed()
◆ 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()
◆ 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()
◆ sysExecute()
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 85 of file AthCommonReentrantAlgorithm.cxx.
◆ sysInitialize()
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 61 of file AthCommonReentrantAlgorithm.cxx.
110 if (
sc.isFailure()) {
118 if ( cs.retrieve().isFailure() ) {
120 return StatusCode::SUCCESS;
122 if (cs->regHandle(
this,*
h).isFailure()) {
123 sc = StatusCode::FAILURE;
124 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
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
Empty if no symlinks were found.
Definition at line 114 of file AthCommonReentrantAlgorithm.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
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
An algorithm that can be simultaneously executed in multiple threads.
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
virtual const DataObjIDColl & extraOutputDeps() const override
Return the list of extra output dependencies.
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
::StatusCode StatusCode
StatusCode definition for legacy code.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
SG::ReadCondHandleKey< InDetDD::TRT_DetElementContainer > m_trtDetEleContKey
virtual StatusCode sysExecute(const EventContext &ctx) override
Execute an algorithm.
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
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
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
virtual StatusCode sysInitialize() override
Override sysInitialize.
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...
DataObjIDColl m_extendedExtraObjects
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
constexpr int pow(int base, int exp) noexcept
setScale setgFexType iEta
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