ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
BCMOverlay Class Reference

#include <BCMOverlay.h>

Inheritance diagram for BCMOverlay:
Collaboration diagram for BCMOverlay:

Public Member Functions

 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
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
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. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

std::unique_ptr< BCM_RawDatamergeChannel (const BCM_RawData *bkgRDO, const BCM_RawData *signalRDO) const
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Static Private Member Functions

static void overlayPulses (std::vector< std::unique_ptr< BCM_Pulse >> &merged_pulses)
 
static std::pair< BCM_Pulse *, BCM_Pulse * > timeOrder (BCM_Pulse *pulse1, BCM_Pulse *pulse2)
 
static bool compare (const std::unique_ptr< BCM_Pulse > &a, const std::unique_ptr< BCM_Pulse > &b)
 

Private Attributes

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_Containerm_bkgInputKey { this, "BkgInputKey", "Bkg_BCM_RDOs", "ReadHandleKey for Background Input BCM_RDO_Container" }
 
SG::ReadHandleKey< BCM_RDO_Containerm_signalInputKey { this, "SignalInputKey", "Sig_BCM_RDOs", "ReadHandleKey for Signal Input BCM_RDO_Container" }
 
SG::WriteHandleKey< BCM_RDO_Containerm_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
 

Detailed Description

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.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ BCMOverlay()

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

Definition at line 11 of file BCMOverlay.cxx.

12  : AthReentrantAlgorithm(name, pSvcLocator)
13 {
14 }

Member Function Documentation

◆ 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.

56 {
57  return 0;
58 }

◆ compare()

bool BCMOverlay::compare ( const std::unique_ptr< BCM_Pulse > &  a,
const std::unique_ptr< BCM_Pulse > &  b 
)
staticprivate

Definition at line 288 of file BCMOverlay.cxx.

290 {
291 
292  return a->p < b->p;
293 
294 }

◆ declareGaudiProperty() [1/4]

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

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

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

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

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

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

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

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

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation 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.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation 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.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation 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.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation 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.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

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

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

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

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

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

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

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

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

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

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

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ execute()

StatusCode BCMOverlay::execute ( const EventContext &  ctx) const
finaloverridevirtual

Definition at line 31 of file BCMOverlay.cxx.

32 {
33  ATH_MSG_DEBUG("execute() begin");
34 
35  // Reading the input RDOs
36  ATH_MSG_VERBOSE("Retrieving input RDO containers");
37 
38  const BCM_RDO_Container *bkgContainerPtr = nullptr;
39  if (!m_bkgInputKey.empty()) {
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;
44  }
45  bkgContainerPtr = bkgContainer.cptr();
46 
47  ATH_MSG_DEBUG("Found background BCM RDO container " << bkgContainer.name() << " in store " << bkgContainer.store());
48  }
49 
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;
54  }
55  ATH_MSG_DEBUG("Found signal BCM RDO container " << signalContainer.name() << " in store " << signalContainer.store());
56 
57  // Creating output RDO container
58  SG::WriteHandle<BCM_RDO_Container> outputContainer(m_outputKey, ctx);
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;
63  }
64  ATH_MSG_DEBUG("Recorded output BCM RDO container " << outputContainer.name() << " in store " << outputContainer.store());
65 
66  ATH_CHECK(overlayContainer(ctx, bkgContainerPtr, signalContainer.cptr(), outputContainer.ptr()));
67 
68  ATH_MSG_DEBUG("execute() end");
69  return StatusCode::SUCCESS;
70 }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::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 & 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.

80 {
81  // If we didn't find any symlinks to add, just return the collection
82  // from the base class. Otherwise, return the extended collection.
83  if (!m_extendedExtraObjects.empty()) {
85  }
86  return Algorithm::extraOutputDeps();
87 }

◆ filterPassed()

virtual bool AthReentrantAlgorithm::filterPassed ( const EventContext &  ctx) const
inlinevirtualinherited

Definition at line 135 of file AthReentrantAlgorithm.h.

135  {
136  return execState( ctx ).filterPassed();
137  }

◆ initialize()

StatusCode BCMOverlay::initialize ( )
finaloverridevirtual

Definition at line 16 of file BCMOverlay.cxx.

17 {
18  ATH_MSG_DEBUG("Initializing...");
19 
20  // Check and initialize keys
22  ATH_MSG_VERBOSE("Initialized ReadHandleKey: " << m_bkgInputKey);
24  ATH_MSG_VERBOSE("Initialized ReadHandleKey: " << m_signalInputKey);
26  ATH_MSG_VERBOSE("Initialized WriteHandleKey: " << m_outputKey);
27 
28  return StatusCode::SUCCESS;
29 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Gaudi::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.

◆ isClonable()

bool AthReentrantAlgorithm::isClonable ( ) const
overridevirtualinherited

◆ mergeChannel()

std::unique_ptr< BCM_RawData > BCMOverlay::mergeChannel ( const BCM_RawData bkgRDO,
const BCM_RawData signalRDO 
) const
private

Definition at line 156 of file BCMOverlay.cxx.

158 {
159 
160  if (bkgRDO->getPulse1Width()==0) {
161  return std::make_unique<BCM_RawData>(signalRDO->getWord1(), signalRDO->getWord2());
162  } else if (signalRDO->getPulse1Width()==0) {
163  return std::make_unique<BCM_RawData>(bkgRDO->getWord1(), bkgRDO->getWord2());
164  }
165 
166  unsigned int bkg_p1 = bkgRDO->getPulse1Position();
167  unsigned int bkg_w1 = bkgRDO->getPulse1Width();
168  unsigned int bkg_p2 = bkgRDO->getPulse2Position();
169  unsigned int bkg_w2 = bkgRDO->getPulse2Width();
170  unsigned int sig_p1 = signalRDO->getPulse1Position();
171  unsigned int sig_w1 = signalRDO->getPulse1Width();
172  unsigned int sig_p2 = signalRDO->getPulse2Position();
173  unsigned int sig_w2 = signalRDO->getPulse2Width();
174 
175  std::vector<std::unique_ptr<BCM_Pulse>> merged_pulses;
176 
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));
181 
182  overlayPulses(merged_pulses);
183  std::sort(merged_pulses.begin(), merged_pulses.end(), compare);
184 
185  // Check whether some of the pulses merged
186  for (size_t i = 0; i < merged_pulses.size()-1; i++) {
187 
188  BCM_Pulse *early = merged_pulses.at(i).get();
189  BCM_Pulse *later = merged_pulses.at(i+1).get();
190 
191  if ( (early->p + early->w - 1) >= later->p ) {
192  early->w = later->p - early->p + later->w; // Enlarge early pulse
193  merged_pulses.erase(merged_pulses.begin()+i+1,
194  merged_pulses.begin()+i+2); // Omit later pulse
195  i--;
196  }
197  }
198 
199  unsigned int merged_p1;
200  unsigned int merged_w1;
201  unsigned int merged_p2;
202  unsigned int merged_w2;
203 
204  if (!merged_pulses.empty()) {
205  merged_p1 = merged_pulses.at(0)->p;
206  merged_w1 = merged_pulses.at(0)->w;
207  } else {
208  merged_p1 = 0;
209  merged_w1 = 0;
210  }
211 
212  if (merged_pulses.size() > 1) {
213  merged_p2 = merged_pulses.at(1)->p;
214  merged_w2 = merged_pulses.at(1)->w;
215  } else {
216  merged_p2 = 0;
217  merged_w2 = 0;
218  }
219 
220  // Record two earliest pulses into the output RDO
221  return std::make_unique<BCM_RawData>(bkgRDO->getChannel(),
222  merged_p1, merged_w1,
223  merged_p2, merged_w2,
224  bkgRDO->getLVL1A(),
225  bkgRDO->getBCID(),
226  bkgRDO->getLVL1ID());
227 }

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

MsgStream& AthCommonMsg< Gaudi::Algorithm >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

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

Definition at line 30 of file AthCommonMsg.h.

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

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Gaudi::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.

◆ overlayContainer()

StatusCode BCMOverlay::overlayContainer ( const EventContext &  ctx,
const BCM_RDO_Container bkgContainer,
const BCM_RDO_Container signalContainer,
BCM_RDO_Container outputContainer 
) const

Definition at line 72 of file BCMOverlay.cxx.

76 {
77 
78  if (!bkgContainer) {
79  for (const BCM_RDO_Collection *coll : *signalContainer) {
80 
81  std::unique_ptr<BCM_RDO_Collection> outputColl = std::make_unique<BCM_RDO_Collection>();
82 
83  for (const BCM_RawData *rdo : *coll) {
84  outputColl->push_back(new BCM_RawData(rdo->getWord1(), rdo->getWord2()));
85  }
86  outputContainer->push_back(outputColl.release());
87  }
88 
89  return StatusCode::SUCCESS;
90  }
91 
92  std::unordered_map<unsigned int, const BCM_RDO_Collection *> bkgChannelMap;
93  for (const BCM_RDO_Collection *bkgColl : *bkgContainer) {
94  bkgChannelMap.emplace(bkgColl->getChannel(), bkgColl);
95  }
96 
97  for (const BCM_RDO_Collection *sigColl : *signalContainer) {
98 
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;
103  }
104 
105  const BCM_RDO_Collection *bkgColl = it->second;
106  bkgChannelMap.erase(it);
107  std::unique_ptr<BCM_RDO_Collection> outputColl = std::make_unique<BCM_RDO_Collection>();
108  outputColl->setChannel(sigColl->getChannel());
109 
110  constexpr size_t mcSize{1}; // MC always has exactly one RDO
111  if (m_dataOverlay.value()) {
112  // Data has RDOs from more BCIDs, check MC size
113  if (sigColl->size() != mcSize) {
114  ATH_MSG_ERROR ("BCM signal collection size mismatch");
115  return StatusCode::FAILURE;
116  }
117  } else {
118  // In case of MC+MC overlay collection sizes are the same
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;
123  }
124  }
125 
126  int currentBCID = ctx.eventID().bunch_crossing_id();
127  for (const BCM_RawData *bkgRDO : *bkgColl) {
128  if (m_dataOverlay.value() && bkgRDO->getBCID() != currentBCID) {
129  if (m_storeAllBCID.value()) {
130  outputColl->push_back(new BCM_RawData(bkgRDO->getWord1(), bkgRDO->getWord2()));
131  }
132  continue;
133  }
134 
135  const BCM_RawData *sigRDO = sigColl->front();
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());
140  } else {
141  ATH_MSG_ERROR ("BCM channel merging failed");
142  return StatusCode::FAILURE;
143  }
144  } else {
145  ATH_MSG_ERROR ("BCM signal and background channel mismatch");
146  return StatusCode::FAILURE;
147  }
148 
149  }
150  outputContainer->push_back(outputColl.release());
151  }
152 
153  return StatusCode::SUCCESS;
154 }

◆ overlayPulses()

void BCMOverlay::overlayPulses ( std::vector< std::unique_ptr< BCM_Pulse >> &  merged_pulses)
staticprivate

Definition at line 229 of file BCMOverlay.cxx.

230 {
231 
232  constexpr double fullPulseWidth{15.}; // Analogue pulse width
233  // before application of
234  // time over threshold
235  constexpr double slopeUpFraction{1./3.}; // Pulse rise time,
236  // expressed in the fraction
237  // of full pulse width
238  constexpr double slopeDownFraction{2./3.}; // Pulse fall time,
239  // expressed in the fraction
240  // of full pulse width
241 
242  for (size_t i = 0; i < merged_pulses.size(); i++) {
243  BCM_Pulse* pulse_1 = merged_pulses.at(i).get();
244 
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);
248 
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;
255 
256  int bin_min = early->p + early->w;
257  int bin_max = later->p;
258 
259  // Widen the pulses, if they lie close enough to each other
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) {
262  early->w++;
263  }
264  else break;
265  }
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) {
268  later->p = bin_iter;
269  later->w++;
270  }
271  else break;
272  }
273 
274  }
275  }
276 
277 }

◆ 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< Gaudi::Algorithm > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

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

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ setFilterPassed()

virtual void AthReentrantAlgorithm::setFilterPassed ( bool  state,
const EventContext &  ctx 
) const
inlinevirtualinherited

Definition at line 139 of file AthReentrantAlgorithm.h.

139  {
140  execState( ctx ).setFilterPassed( state );
141  }

◆ 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.

68 {
69  return Gaudi::Algorithm::sysExecute (ctx);
70 }

◆ 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.

96  {
98 
99  if (sc.isFailure()) {
100  return sc;
101  }
102 
103  ServiceHandle<ICondSvc> cs("CondSvc",name());
104  for (auto h : outputHandles()) {
105  if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
106  // do this inside the loop so we don't create the CondSvc until needed
107  if ( cs.retrieve().isFailure() ) {
108  ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
109  return StatusCode::SUCCESS;
110  }
111  if (cs->regHandle(this,*h).isFailure()) {
112  sc = StatusCode::FAILURE;
113  ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
114  << " with CondSvc");
115  }
116  }
117  }
118  return sc;
119 }

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::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.

◆ timeOrder()

std::pair< BCM_Pulse *, BCM_Pulse * > BCMOverlay::timeOrder ( BCM_Pulse pulse1,
BCM_Pulse pulse2 
)
staticprivate

Definition at line 279 of file BCMOverlay.cxx.

281 {
282 
283  if (pulse2->p > pulse1->p) return std::pair(pulse1,pulse2);
284  else return std::pair(pulse2,pulse1);
285 
286 }

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::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) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_bkgInputKey

SG::ReadHandleKey<BCM_RDO_Container> BCMOverlay::m_bkgInputKey { this, "BkgInputKey", "Bkg_BCM_RDOs", "ReadHandleKey for Background Input BCM_RDO_Container" }
private

Definition at line 52 of file BCMOverlay.h.

◆ m_dataOverlay

Gaudi::Property<bool> BCMOverlay::m_dataOverlay { this, "isDataOverlay", false, "Flag to switch between MC and data overlay" }
private

Definition at line 49 of file BCMOverlay.h.

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ 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

SG::WriteHandleKey<BCM_RDO_Container> BCMOverlay::m_outputKey { this, "OutputKey", "BCM_RDOs", "WriteHandleKey for Output BCM_RDO_Container" }
private

Definition at line 54 of file BCMOverlay.h.

◆ m_signalInputKey

SG::ReadHandleKey<BCM_RDO_Container> BCMOverlay::m_signalInputKey { this, "SignalInputKey", "Sig_BCM_RDOs", "ReadHandleKey for Signal Input BCM_RDO_Container" }
private

Definition at line 53 of file BCMOverlay.h.

◆ m_storeAllBCID

Gaudi::Property<bool> BCMOverlay::m_storeAllBCID { this, "storeAllBCID", false, "Store all BCID" }
private

Definition at line 50 of file BCMOverlay.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
BCM_RawData::getPulse2Width
int getPulse2Width() const
Definition: BCM_RawData.h:84
BCM_Pulse::p
unsigned int p
Definition: BCMOverlay.h:19
BCMOverlay::m_storeAllBCID
Gaudi::Property< bool > m_storeAllBCID
Definition: BCMOverlay.h:50
BCM_Pulse::w
unsigned int w
Definition: BCMOverlay.h:21
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
BCMOverlay::mergeChannel
std::unique_ptr< BCM_RawData > mergeChannel(const BCM_RawData *bkgRDO, const BCM_RawData *signalRDO) const
Definition: BCMOverlay.cxx:156
AthCommonDataStore::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 > renounce(T &h)
Definition: AthCommonDataStore.h:380
skel.it
it
Definition: skel.GENtoEVGEN.py:396
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
BCMOverlay::timeOrder
static std::pair< BCM_Pulse *, BCM_Pulse * > timeOrder(BCM_Pulse *pulse1, BCM_Pulse *pulse2)
Definition: BCMOverlay.cxx:279
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
BCM_RawData::getLVL1ID
int getLVL1ID() const
Definition: BCM_RawData.h:87
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
BCM_RawData::getChannel
int getChannel() const
Definition: BCM_RawData.h:80
BCM_Pulse
Definition: BCMOverlay.h:18
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
BCMOverlay::m_bkgInputKey
SG::ReadHandleKey< BCM_RDO_Container > m_bkgInputKey
Definition: BCMOverlay.h:52
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
BCM_RDO_Collection::setChannel
virtual void setChannel(unsigned int chanId)
Definition: BCM_RDO_Collection.h:34
BCM_RawData::getPulse1Position
int getPulse1Position() const
Definition: BCM_RawData.h:81
AthCommonDataStore
Definition: AthCommonDataStore.h:52
AthReentrantAlgorithm::AthReentrantAlgorithm
AthReentrantAlgorithm()
Default constructor:
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
lumiFormat.i
int i
Definition: lumiFormat.py:85
BCM_RDO_Container
Definition: BCM_RDO_Container.h:27
BCM_RawData::getWord2
int getWord2() const
Definition: BCM_RawData.h:79
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
BCM_RawData
Definition: BCM_RawData.h:36
BCMOverlay::m_dataOverlay
Gaudi::Property< bool > m_dataOverlay
Definition: BCMOverlay.h:49
BCMOverlay::overlayPulses
static void overlayPulses(std::vector< std::unique_ptr< BCM_Pulse >> &merged_pulses)
Definition: BCMOverlay.cxx:229
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
AthReentrantAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
Definition: AthReentrantAlgorithm.h:153
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
BCMOverlay::overlayContainer
StatusCode overlayContainer(const EventContext &ctx, const BCM_RDO_Container *bkgContainer, const BCM_RDO_Container *signalContainer, BCM_RDO_Container *outputContainer) const
Definition: BCMOverlay.cxx:72
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
AthReentrantAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthReentrantAlgorithm.cxx:96
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
BCMOverlay::m_outputKey
SG::WriteHandleKey< BCM_RDO_Container > m_outputKey
Definition: BCMOverlay.h:54
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
a
TList * a
Definition: liststreamerinfos.cxx:10
BCM_RawData::getPulse2Position
int getPulse2Position() const
Definition: BCM_RawData.h:83
h
BCM_RawData::getPulse1Width
int getPulse1Width() const
Definition: BCM_RawData.h:82
std::sort
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.
Definition: DVL_algorithms.h:623
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
BCM_RawData::getWord1
int getWord1() const
Definition: BCM_RawData.h:78
BCM_RawData::getLVL1A
int getLVL1A() const
Definition: BCM_RawData.h:85
BCMOverlay::m_signalInputKey
SG::ReadHandleKey< BCM_RDO_Container > m_signalInputKey
Definition: BCMOverlay.h:53
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
BCM_RDO_Collection
Definition: BCM_RDO_Collection.h:27
BCMOverlay::compare
static bool compare(const std::unique_ptr< BCM_Pulse > &a, const std::unique_ptr< BCM_Pulse > &b)
Definition: BCMOverlay.cxx:288
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
BCM_RawData::getBCID
int getBCID() const
Definition: BCM_RawData.h:86
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
fitman.k
k
Definition: fitman.py:528
ServiceHandle< ICondSvc >