|
ATLAS Offline Software
|
a PileUpTool to merge MC truth collection in the overlay store
More...
#include <NewMergeMcEventCollTool.h>
|
ServiceHandle< PileUpMergeSvc > | m_pMergeSvc {this, "PileUpMergeSvc", "PileUpMergeSvc", ""} |
|
StringProperty | m_truthCollInputKey {this,"TruthCollInputKey", "TruthEvent", ""} |
|
Gaudi::Property< int > | m_pileUpType {this, "PileUpType", -1, ""} |
|
SG::WriteHandle< McEventCollection > | m_outputMcEventCollection {} |
|
SG::WriteHandleKey< McEventCollection > | m_truthCollOutputKey {this, "TruthCollOutputKey","TruthEvent",""} |
|
a PileUpTool to merge MC truth collection in the overlay store
Definition at line 24 of file NewMergeMcEventCollTool.h.
◆ NewMergeMcEventCollTool()
NewMergeMcEventCollTool::NewMergeMcEventCollTool |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
◆ filterPassed()
virtual bool PileUpToolBase::filterPassed |
( |
| ) |
const |
|
inlineoverridevirtualinherited |
◆ initialize()
StatusCode NewMergeMcEventCollTool::initialize |
( |
| ) |
|
|
finaloverridevirtual |
◆ mergeEvent()
StatusCode NewMergeMcEventCollTool::mergeEvent |
( |
const EventContext & |
ctx | ) |
|
|
finaloverridevirtual |
called at the end of the subevts loop.
Not (necessarily) able to access SubEvents
Definition at line 72 of file NewMergeMcEventCollTool.cxx.
76 return StatusCode::SUCCESS;
◆ prepareEvent()
StatusCode NewMergeMcEventCollTool::prepareEvent |
( |
const EventContext & |
ctx, |
|
|
unsigned int |
nInputEvents |
|
) |
| |
|
finaloverridevirtual |
called before the subevts loop.
PileUpTools Approach.
Not (necessarily) able to access SubEvents
Definition at line 24 of file NewMergeMcEventCollTool.cxx.
29 if (0 == nInputEvents) {
32 return StatusCode::RECOVERABLE;
34 ATH_MSG_VERBOSE( this->
name()<<
"::prepareEvent: there are " << nInputEvents <<
" subevents in this event.");
46 return StatusCode::FAILURE;
49 return StatusCode::SUCCESS;
◆ printDetailsOfMergedMcEventCollection()
void NewMergeMcEventCollTool::printDetailsOfMergedMcEventCollection |
( |
McEventCollection * |
outputMcEventCollection | ) |
const |
|
private |
Definition at line 153 of file NewMergeMcEventCollTool.cxx.
157 ATH_MSG_INFO (
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" );
159 ATH_MSG_INFO (
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" );
161 while(outputEventItr!=endOfEvents) {
163 const int event_number((*outputEventItr)->event_number());
164 ATH_MSG_INFO (
"GenEvent #"<<event_number<<
", signal_process_id="<<
signal_process_id<<
", number of Vertices="<<(*outputEventItr)->vertices_size() );
167 std::ofstream of(
fname);
168 const HepMC::GenEvent *
evt=(*outputEventItr);
173 ATH_MSG_INFO (
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" );
◆ processAllSubEvents() [1/2]
StatusCode NewMergeMcEventCollTool::processAllSubEvents |
( |
const EventContext & |
ctx | ) |
|
|
finaloverridevirtual |
Algorithm Approach.
Reimplemented from PileUpToolBase.
Definition at line 80 of file NewMergeMcEventCollTool.cxx.
84 ATH_CHECK(outputMcEventCollection.record(std::make_unique<McEventCollection>()));
88 TimedTruthList truthList;
92 const unsigned int nInputMcEventColls=truthList.size();
93 if (0 == nInputMcEventColls) {
95 return StatusCode::SUCCESS;
98 ATH_MSG_DEBUG(
"execute: there are " << nInputMcEventColls <<
" subevents in this event.");
102 while (timedTruthListIter != endOfTimedTruthList) {
103 ATH_MSG_VERBOSE( this->
name()<<
"::processBunchXing: SubEvt McEventCollection of PileUpType " << timedTruthListIter->first.type() );
106 ATH_CHECK(this->
processEvent(pBackgroundMcEvtColl, outputMcEventCollection.ptr(),
static_cast<int>(timedTruthListIter->first.type()), timedTruthListIter->first.time()));
108 ++timedTruthListIter;
112 return StatusCode::SUCCESS;
◆ processAllSubEvents() [2/2]
virtual StatusCode IPileUpTool::processAllSubEvents |
|
inherited |
dummy implementation to allow compilation while all Digitization packages are migrated to use this new interface.
◆ processBunchXing()
called for each active bunch-crossing to process current SubEvents bunchXing is in ns
Reimplemented from PileUpToolBase.
Definition at line 52 of file NewMergeMcEventCollTool.cxx.
58 while (iEvt != eSubEvents){
62 ATH_MSG_VERBOSE( this->
name()<<
"::processBunchXing: SubEvt McEventCollection from StoreGate " << seStore.name() <<
" of PileUpType " << iEvt->type() );
65 static_cast<int>(iEvt->type()), iEvt->time()));
69 return StatusCode::SUCCESS;
◆ processEvent()
Definition at line 115 of file NewMergeMcEventCollTool.cxx.
118 if (!outputMcEventCollection) {
119 ATH_MSG_ERROR( this->
name()<<
"::processEvent() was passed an null output McEventCollection pointer." );
120 return StatusCode::FAILURE;
123 ATH_MSG_ERROR( this->
name()<<
"::processEvent() was passed an null input McEventCollection pointer." );
124 return StatusCode::FAILURE;
126 if (!pMcEvtColl->
empty()) {
127 for (
unsigned int iEv=0; iEv<pMcEvtColl->
size(); iEv++) {
128 const HepMC::GenEvent& c_evt(*((*pMcEvtColl)[iEv]));
130 HepMC::GenEvent *
evt =
new HepMC::GenEvent(c_evt);
132 const int bunchCrossingTime=
static_cast<int>(timeOffset);
133 evt->add_attribute(
"BunchCrossingTime",std::make_shared<HepMC3::IntAttribute>(bunchCrossingTime));
134 evt->add_attribute(
"PileUpType",std::make_shared<HepMC3::IntAttribute>(pileupType));
135 for (
const auto& itVer:
evt->vertices()) {
136 HepMC::FourVector newPos(itVer->position().x(),itVer->position().y(),itVer->position().z(),itVer->position().t()+timeOffset);
137 itVer->set_position(newPos);
141 HepMC::GenEvent *
evt =
new HepMC::GenEvent(c_evt);
142 for (HepMC::GenEvent::vertex_iterator itVer=
evt->vertices_begin(); itVer!=
evt->vertices_end(); ++itVer) {
143 HepMC::FourVector newPos((*itVer)->position().x(),(*itVer)->position().y(),(*itVer)->position().z(),(*itVer)->position().t()+timeOffset);
144 (*itVer)->set_position(newPos);
150 return StatusCode::SUCCESS;
◆ resetFilter()
virtual void PileUpToolBase::resetFilter |
( |
| ) |
|
|
inlineoverridevirtualinherited |
◆ toProcess()
virtual bool PileUpToolBase::toProcess |
( |
int |
bunchXing | ) |
const |
|
inlineoverridevirtualinherited |
◆ m_filterPassed
bool PileUpToolBase::m_filterPassed {true} |
|
protectedinherited |
◆ m_firstXing
Gaudi::Property<int> PileUpToolBase::m_firstXing |
|
protectedinherited |
Initial value:{this, "FirstXing", -999,
"First bunch-crossing in which det is live"}
Definition at line 54 of file PileUpToolBase.h.
◆ m_lastXing
Gaudi::Property<int> PileUpToolBase::m_lastXing |
|
protectedinherited |
Initial value:{this, "LastXing", 999,
"Last bunch-crossing in which det is live"}
Definition at line 56 of file PileUpToolBase.h.
◆ m_outputMcEventCollection
◆ m_pileUpType
Gaudi::Property<int> NewMergeMcEventCollTool::m_pileUpType {this, "PileUpType", -1, ""} |
|
private |
◆ m_pMergeSvc
◆ m_truthCollInputKey
StringProperty NewMergeMcEventCollTool::m_truthCollInputKey {this,"TruthCollInputKey", "TruthEvent", ""} |
|
private |
◆ m_truthCollOutputKey
◆ m_vetoPileUpTruthLinks
Gaudi::Property<int> PileUpToolBase::m_vetoPileUpTruthLinks |
|
protectedinherited |
Initial value:{this, "VetoPileUpTruthLinks", true,
"Ignore links to suppressed pile-up truth"}
Definition at line 58 of file PileUpToolBase.h.
The documentation for this class was generated from the following files:
JetConstituentVector::iterator iterator
int signal_process_id(const GenEvent &e)
#define ATH_MSG_VERBOSE(x)
void line(std::ostream &os, const GenEvent &e)
void fillBarcodesAttribute(GenEvent *)
std::list< value_t > type
type of the collection of timed data object
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
The Athena Transient Store API.
pointer_type ptr()
Dereference the pointer.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
#define ATH_MSG_WARNING(x)
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.