11 #include <framework/core/Module.h>
12 #include <framework/datastore/StoreArray.h>
13 #include <framework/dataobjects/DigitBase.h>
54 virtual void event()
override;
80 template <
class Digit>
89 B2DEBUG(20,
"optional input: " << digits.getName() <<
" " << bgDigits.
getName());
96 template <
class Digit>
101 if (!digits.isValid()) {
102 B2DEBUG(20, digits.getName() <<
" are not valid");
111 B2DEBUG(20, bgDigits.
getName() <<
" are not valid");
116 std::multimap<unsigned, Digit*> multimap;
117 for (
auto& digit : digits) {
118 unsigned id = digit.getUniqueChannelID();
120 multimap.insert(std::pair<unsigned, Digit*>(
id, &digit));
123 int size = digits.getEntries();
126 typedef typename std::multimap<unsigned, Digit*>::iterator
Iterator;
127 for (
const auto& bgDigit : bgDigits) {
129 unsigned id = bgDigit.getUniqueChannelID();
130 std::pair<Iterator, Iterator> range = multimap.equal_range(
id);
131 for (
Iterator it = range.first; it != range.second; ++it) {
132 auto* digit = it->second;
136 if (!pileup) digits.appendNew(bgDigit)->adjustAppendedBGDigit();
140 int diff = size + bgDigits.
getEntries() - digits.getEntries();
141 B2DEBUG(20, digits.getName() <<
": before " << size
143 <<
", after " << digits.getEntries()
144 <<
", merged " << diff);
Overlay of measured background with simulated data (Digits or Clusters)
std::string m_CDCHitsName
name of CDC collection to overlay with BG
std::string m_KLMDigitsName
name of KLM collection to overlay with BG
bool m_addCDC
if true add BG digits of CDC
std::vector< std::string > m_components
detector components included in overlay
std::string m_BackgroundInfoInstanceName
name BackgroundInfo name
bool m_addKLM
if true add BG digits of KLM
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
bool m_addSVD
if true add BG digits of SVD
std::string m_ARICHDigitsName
name of ARICH collection to overlay with BG
virtual ~BGOverlayExecutorModule()
Destructor.
bool m_addTOP
if true add BG digits of TOP
void registerDigits(const std::string &name)
Register simulated and BG digits (both as optional input)
std::string m_extensionName
name added to default branch names
void addBGDigits(const std::string &name)
Add BG digits to simulated ones.
bool m_addPXD
if true add BG digits of PXD
BGOverlayExecutorModule()
Constructor.
std::string m_TOPDigitsName
name of TOP collection to overlay with BG
bool m_addARICH
if true add BG digits of ARICH
std::string m_PXDDigitsName
name of PXD collection to overlay with BG
std::string m_SVDShaperDigitsName
name of SVD collection to overlay with BG
@ c_DontAppend
do not append BG digit to digits
bool isOptional(const std::string &name="")
Tell the DataStore about an optional input.
const std::string & getName() const
Return name under which the object is saved in the DataStore.
Accessor to arrays stored in the data store.
bool isValid() const
Check wether the array was registered.
int getEntries() const
Get the number of objects in the array.
map< unsigned, size_t >::const_iterator Iterator
Iteratior for m_map.
Abstract base class for different kinds of events.