|
ATLAS Offline Software
|
#include <BCMOverlay.h>
|
| BCMOverlay (const std::string &name, ISvcLocator *pSvcLocator) |
|
virtual StatusCode | initialize () override final |
|
virtual StatusCode | execute (const EventContext &ctx) const override final |
|
StatusCode | overlayContainer (const EventContext &ctx, const BCM_RDO_Container *bkgContainer, const BCM_RDO_Container *signalContainer, BCM_RDO_Container *outputContainer) const |
|
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 |
|
|
Gaudi::Property< bool > | m_dataOverlay { this, "isDataOverlay", false, "Flag to switch between MC and data overlay" } |
|
Gaudi::Property< bool > | m_storeAllBCID { this, "storeAllBCID", false, "Store all BCID" } |
|
SG::ReadHandleKey< BCM_RDO_Container > | m_bkgInputKey { this, "BkgInputKey", "Bkg_BCM_RDOs", "ReadHandleKey for Background Input BCM_RDO_Container" } |
|
SG::ReadHandleKey< BCM_RDO_Container > | m_signalInputKey { this, "SignalInputKey", "Sig_BCM_RDOs", "ReadHandleKey for Signal Input BCM_RDO_Container" } |
|
SG::WriteHandleKey< BCM_RDO_Container > | m_outputKey { this, "OutputKey", "BCM_RDOs", "WriteHandleKey for Output BCM_RDO_Container" } |
|
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 |
|
BCM overlay algorithm
- Author
- Jakob Novak jakob.nosp@m..nov.nosp@m.ak@ce.nosp@m.rn.c.nosp@m.h
Definition at line 24 of file BCMOverlay.h.
◆ StoreGateSvc_t
◆ BCMOverlay()
BCMOverlay::BCMOverlay |
( |
const std::string & |
name, |
|
|
ISvcLocator * |
pSvcLocator |
|
) |
| |
◆ 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.
◆ compare()
◆ 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 BCMOverlay::execute |
( |
const EventContext & |
ctx | ) |
const |
|
finaloverridevirtual |
Definition at line 31 of file BCMOverlay.cxx.
41 if (!bkgContainer.isValid()) {
42 ATH_MSG_ERROR(
"Could not get background BCM RDO container " << bkgContainer.name() <<
" from store " << bkgContainer.store());
43 return StatusCode::FAILURE;
45 bkgContainerPtr = bkgContainer.cptr();
47 ATH_MSG_DEBUG(
"Found background BCM RDO container " << bkgContainer.name() <<
" in store " << bkgContainer.store());
51 if (!signalContainer.isValid()) {
52 ATH_MSG_ERROR(
"Could not get signal BCM RDO container " << signalContainer.name() <<
" from store " << signalContainer.store());
53 return StatusCode::FAILURE;
55 ATH_MSG_DEBUG(
"Found signal BCM RDO container " << signalContainer.name() <<
" in store " << signalContainer.store());
59 ATH_CHECK(outputContainer.record(std::make_unique<BCM_RDO_Container>()));
60 if (!outputContainer.isValid()) {
61 ATH_MSG_ERROR(
"Could not record output BCM RDO container " << outputContainer.name() <<
" to store " << outputContainer.store());
62 return StatusCode::FAILURE;
64 ATH_MSG_DEBUG(
"Recorded output BCM RDO container " << outputContainer.name() <<
" in store " << outputContainer.store());
69 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 BCMOverlay::initialize |
( |
| ) |
|
|
finaloverridevirtual |
◆ 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.
◆ mergeChannel()
Definition at line 156 of file BCMOverlay.cxx.
161 return std::make_unique<BCM_RawData>(signalRDO->
getWord1(), signalRDO->
getWord2());
163 return std::make_unique<BCM_RawData>(bkgRDO->
getWord1(), bkgRDO->
getWord2());
175 std::vector<std::unique_ptr<BCM_Pulse>> merged_pulses;
177 if (bkg_w1 > 0) merged_pulses.push_back(std::make_unique<BCM_Pulse>(bkg_p1,bkg_w1));
178 if (bkg_w2 > 0) merged_pulses.push_back(std::make_unique<BCM_Pulse>(bkg_p2,bkg_w2));
179 if (sig_w1 > 0) merged_pulses.push_back(std::make_unique<BCM_Pulse>(sig_p1,sig_w1));
180 if (sig_w2 > 0) merged_pulses.push_back(std::make_unique<BCM_Pulse>(sig_p2,sig_w2));
186 for (
size_t i = 0;
i < merged_pulses.size()-1;
i++) {
189 BCM_Pulse *later = merged_pulses.at(
i+1).get();
191 if ( (early->
p + early->
w - 1) >= later->
p ) {
192 early->
w = later->
p - early->
p + later->
w;
193 merged_pulses.erase(merged_pulses.begin()+
i+1,
194 merged_pulses.begin()+
i+2);
199 unsigned int merged_p1;
200 unsigned int merged_w1;
201 unsigned int merged_p2;
202 unsigned int merged_w2;
204 if (!merged_pulses.empty()) {
205 merged_p1 = merged_pulses.at(0)->p;
206 merged_w1 = merged_pulses.at(0)->w;
212 if (merged_pulses.size() > 1) {
213 merged_p2 = merged_pulses.at(1)->p;
214 merged_w2 = merged_pulses.at(1)->w;
221 return std::make_unique<BCM_RawData>(bkgRDO->
getChannel(),
222 merged_p1, merged_w1,
223 merged_p2, merged_w2,
◆ 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.
◆ overlayContainer()
Definition at line 72 of file BCMOverlay.cxx.
81 std::unique_ptr<BCM_RDO_Collection> outputColl = std::make_unique<BCM_RDO_Collection>();
86 outputContainer->
push_back(outputColl.release());
89 return StatusCode::SUCCESS;
92 std::unordered_map<unsigned int, const BCM_RDO_Collection *> bkgChannelMap;
94 bkgChannelMap.emplace(bkgColl->getChannel(), bkgColl);
99 auto it = bkgChannelMap.find(sigColl->getChannel());
100 if (
it == bkgChannelMap.end()) {
101 ATH_MSG_ERROR (
"No BCM background collection with channel " << sigColl->getChannel());
102 return StatusCode::FAILURE;
106 bkgChannelMap.erase(
it);
107 std::unique_ptr<BCM_RDO_Collection> outputColl = std::make_unique<BCM_RDO_Collection>();
108 outputColl->
setChannel(sigColl->getChannel());
110 constexpr
size_t mcSize{1};
113 if (sigColl->size() != mcSize) {
115 return StatusCode::FAILURE;
119 size_t collectionSize = bkgColl->
size();
120 if (collectionSize != sigColl->size() && collectionSize != mcSize) {
121 ATH_MSG_ERROR (
"BCM signal and background collection size mismatch");
122 return StatusCode::FAILURE;
126 int currentBCID = ctx.eventID().bunch_crossing_id();
128 if (
m_dataOverlay.value() && bkgRDO->getBCID() != currentBCID) {
136 if (bkgRDO->getChannel() == sigRDO->
getChannel()) {
137 std::unique_ptr<BCM_RawData> mergedRDO =
mergeChannel(bkgRDO, sigRDO);
138 if (mergedRDO !=
nullptr) {
139 outputColl->
push_back(mergedRDO.release());
142 return StatusCode::FAILURE;
145 ATH_MSG_ERROR (
"BCM signal and background channel mismatch");
146 return StatusCode::FAILURE;
150 outputContainer->
push_back(outputColl.release());
153 return StatusCode::SUCCESS;
◆ overlayPulses()
void BCMOverlay::overlayPulses |
( |
std::vector< std::unique_ptr< BCM_Pulse >> & |
merged_pulses | ) |
|
|
staticprivate |
Definition at line 229 of file BCMOverlay.cxx.
232 constexpr
double fullPulseWidth{15.};
235 constexpr
double slopeUpFraction{1./3.};
238 constexpr
double slopeDownFraction{2./3.};
242 for (
size_t i = 0;
i < merged_pulses.size();
i++) {
243 BCM_Pulse* pulse_1 = merged_pulses.at(
i).get();
245 for (
size_t j = 0; j <
i; j++) {
246 BCM_Pulse* pulse_2 = merged_pulses.at(j).get();
247 auto[early,later] =
timeOrder(pulse_1, pulse_2);
249 int below_thr_later = fullPulseWidth - later->w;
250 int below_thr_early = fullPulseWidth - early->w;
251 double slope_up = 1./slopeUpFraction;
252 double slope_down = 1./slopeDownFraction;
253 if (below_thr_later != 0) slope_up /= below_thr_later;
254 if (below_thr_early != 0) slope_down /= below_thr_early;
256 int bin_min = early->p + early->w;
257 int bin_max = later->p;
260 for (
int bin_iter=bin_min; bin_iter < bin_max; bin_iter++) {
261 if (slope_up*(bin_iter - bin_max) - slope_down*(bin_iter - bin_min) > -1) {
266 for (
int bin_iter=bin_max-1; bin_iter >= bin_min; bin_iter--) {
267 if (slope_up*(bin_iter - bin_max) - slope_down*(bin_iter - bin_min) > -1) {
◆ 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.
◆ timeOrder()
Definition at line 279 of file BCMOverlay.cxx.
283 if (pulse2->
p > pulse1->
p)
return std::pair(pulse1,pulse2);
284 else return std::pair(pulse2,pulse1);
◆ updateVHKA()
◆ m_bkgInputKey
◆ m_dataOverlay
Gaudi::Property<bool> BCMOverlay::m_dataOverlay { this, "isDataOverlay", false, "Flag to switch between MC and data overlay" } |
|
private |
◆ 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_outputKey
◆ m_signalInputKey
◆ m_storeAllBCID
Gaudi::Property<bool> BCMOverlay::m_storeAllBCID { this, "storeAllBCID", false, "Store all BCID" } |
|
private |
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
int getPulse2Width() const
Gaudi::Property< bool > m_storeAllBCID
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
std::unique_ptr< BCM_RawData > mergeChannel(const BCM_RawData *bkgRDO, const BCM_RawData *signalRDO) const
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)
static std::pair< BCM_Pulse *, BCM_Pulse * > timeOrder(BCM_Pulse *pulse1, BCM_Pulse *pulse2)
std::vector< SG::VarHandleKeyArray * > m_vhka
#define ATH_MSG_VERBOSE(x)
bool empty() const
Test if the key is blank.
virtual void setOwner(IDataHandleHolder *o)=0
SG::ReadHandleKey< BCM_RDO_Container > m_bkgInputKey
virtual void setChannel(unsigned int chanId)
int getPulse1Position() const
AthReentrantAlgorithm()
Default constructor:
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
::StatusCode StatusCode
StatusCode definition for legacy code.
Gaudi::Property< bool > m_dataOverlay
static void overlayPulses(std::vector< std::unique_ptr< BCM_Pulse >> &merged_pulses)
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
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
StatusCode overlayContainer(const EventContext &ctx, const BCM_RDO_Container *bkgContainer, const BCM_RDO_Container *signalContainer, BCM_RDO_Container *outputContainer) const
virtual StatusCode sysInitialize() override
Override sysInitialize.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::WriteHandleKey< BCM_RDO_Container > m_outputKey
int getPulse2Position() const
int getPulse1Width() const
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
#define ATH_MSG_WARNING(x)
SG::ReadHandleKey< BCM_RDO_Container > m_signalInputKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
static bool compare(const std::unique_ptr< BCM_Pulse > &a, const std::unique_ptr< BCM_Pulse > &b)
size_type size() const noexcept
Returns the number of elements in the collection.
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>