|  | ATLAS Offline Software
    | 
 
 
 
a PileUpTool to merge MC truth collection in the overlay store  
 More...
#include <SimpleMergeMcEventCollTool.h>
|  | 
| ServiceHandle< PileUpMergeSvc > | m_pMergeSvc {this, "PileUpMergeSvc", "PileUpMergeSvc", ""} | 
|  | 
| StringProperty | m_truthCollOutputKey {this, "TruthCollOutputKey", "TruthEvent", "Name of output McEventCollection"} | 
|  | 
| McEventCollection * | m_outputMcEventCollection {} | 
|  | 
| StringProperty | m_truthCollInputKey {this, "TruthCollInputKey", "TruthEvent", ""} | 
|  | 
| BooleanProperty | m_overrideEventNumbers {this, "OverrideEventNumbers", false, ""} | 
|  | 
| BooleanProperty | m_onlySaveSignalTruth {this, "OnlySaveSignalTruth", false, "Just save the Signal GenEvent"} | 
|  | 
| bool | m_newevent {true} | 
|  | 
| unsigned int | m_nInputMcEventColls {0} | 
|  | 
| unsigned int | m_nBkgEventsReadSoFar {0} | 
|  | 
a PileUpTool to merge MC truth collection in the overlay store 
$Id: 
- Author
- jchap.nosp@m.man@.nosp@m.cern..nosp@m.ch 
Definition at line 26 of file SimpleMergeMcEventCollTool.h.
◆ SimpleMergeMcEventCollTool()
      
        
          | SimpleMergeMcEventCollTool::SimpleMergeMcEventCollTool | ( | const std::string & | type, | 
        
          |  |  | const std::string & | name, | 
        
          |  |  | const IInterface * | parent | 
        
          |  | ) |  |  | 
      
 
 
◆ filterPassed()
  
  | 
        
          | virtual bool PileUpToolBase::filterPassed | ( |  | ) | const |  | inlineoverridevirtualinherited | 
 
 
◆ initialize()
  
  | 
        
          | StatusCode SimpleMergeMcEventCollTool::initialize | ( |  | ) |  |  | finaloverridevirtual | 
 
 
◆ mergeEvent()
  
  | 
        
          | StatusCode SimpleMergeMcEventCollTool::mergeEvent | ( | const EventContext & | ctx | ) |  |  | finaloverridevirtual | 
 
called at the end of the subevts loop. 
Not (necessarily) able to access SubEvents 
Definition at line 77 of file SimpleMergeMcEventCollTool.cxx.
   83       return StatusCode::FAILURE;
 
   86   return StatusCode::SUCCESS;
 
 
 
 
◆ prepareEvent()
  
  | 
        
          | StatusCode SimpleMergeMcEventCollTool::prepareEvent | ( | const EventContext & | ctx, |  
          |  |  | unsigned int | nInputEvents |  
          |  | ) |  |  |  | finaloverridevirtual | 
 
called before the subevts loop. 
PileUpTools Approach.
Not (necessarily) able to access SubEvents 
Definition at line 29 of file SimpleMergeMcEventCollTool.cxx.
   41       return StatusCode::RECOVERABLE;
 
   46   return StatusCode::SUCCESS;
 
 
 
 
◆ printDetailsOfMergedMcEventCollection()
  
  | 
        
          | void SimpleMergeMcEventCollTool::printDetailsOfMergedMcEventCollection | ( | McEventCollection * | outputMcEventCollection | ) | const |  | private | 
 
Definition at line 189 of file SimpleMergeMcEventCollTool.cxx.
  191   if (outputMcEventCollection->
empty()) { 
return; }
 
  194   ATH_MSG_INFO ( 
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" );
 
  196   while(outputEventItr!=endOfEvents)
 
  199       const int event_number((*outputEventItr)->event_number());
 
  200       ATH_MSG_INFO ( 
"GenEvent #"<<event_number<<
", signal_process_id="<<
signal_process_id<<
", number of Vertices="<<(*outputEventItr)->vertices_size() );
 
  203       std::ofstream of(
fname);
 
  208   ATH_MSG_INFO ( 
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" );
 
 
 
 
◆ processAllSubEvents() [1/2]
  
  | 
        
          | StatusCode SimpleMergeMcEventCollTool::processAllSubEvents | ( | const EventContext & | ctx | ) |  |  | finaloverridevirtual | 
 
return false if not interested in certain xing times (in ns) implemented by default in PileUpToolBase as FirstXing<=bunchXing<=LastXing 
Algorithm Approach. 
Reimplemented from PileUpToolBase.
Definition at line 90 of file SimpleMergeMcEventCollTool.cxx.
   94   ATH_CHECK(outputMcEventCollection.record(std::make_unique<McEventCollection>()));
 
   98   TimedTruthList truthList;
 
  109       return StatusCode::RECOVERABLE;
 
  116   while (timedTruthListIter != endOfTimedTruthList)
 
  121                                    pBackgroundMcEvtColl,
 
  122                                    outputMcEventCollection.ptr(),
 
  123                                    currentPileUpTimeEventIndex.index(),
 
  124                                    static_cast<int>(currentPileUpTimeEventIndex.time()),
 
  125                                    static_cast<int>(currentPileUpTimeEventIndex.type())
 
  127       ++timedTruthListIter;
 
  131   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 49 of file SimpleMergeMcEventCollTool.cxx.
   55   while (iEvt != eSubEvents)
 
   60       ATH_MSG_DEBUG (
"processBunchXing: SubEvt McEventCollection from StoreGate " << seStore.name() );
 
   69                                    static_cast<int>(iEvt->time()),
 
   70                                    static_cast<int>(iEvt->type())
 
   74   return StatusCode::SUCCESS;
 
 
 
 
◆ processEvent()
Definition at line 152 of file SimpleMergeMcEventCollTool.cxx.
  154   ATH_MSG_VERBOSE ( 
"processEvent() Event Type: " << pileupType << 
", BunchCrossingTime: " << bunchCrossingTime );
 
  155   if (!outputMcEventCollection) {
 
  156     ATH_MSG_ERROR( this->
name()<<
"::processEvent() was passed an null output McEventCollection pointer." );
 
  157     return StatusCode::FAILURE;
 
  160     ATH_MSG_ERROR( this->
name()<<
"::processEvent() was passed an null input McEventCollection pointer." );
 
  161     return StatusCode::FAILURE;
 
  166     return StatusCode::SUCCESS;
 
  171   const HepMC::GenEvent& currentBackgroundEvent(**(pMcEvtColl->
begin()));
 
  173   HepMC::GenEvent* copiedEvent = 
new HepMC::GenEvent(currentBackgroundEvent);
 
  175     copiedEvent->set_event_number(currentBkgEventIndex);
 
  179   copiedEvent->add_attribute(
"BunchCrossingTime",std::make_shared<HepMC3::IntAttribute>(bunchCrossingTime));
 
  180   copiedEvent->add_attribute(
"PileUpType",std::make_shared<HepMC3::IntAttribute>(pileupType));
 
  182    outputMcEventCollection->
push_back(copiedEvent);
 
  186   return StatusCode::SUCCESS;
 
 
 
 
◆ resetFilter()
  
  | 
        
          | virtual void PileUpToolBase::resetFilter | ( |  | ) |  |  | inlineoverridevirtualinherited | 
 
 
◆ saveHeavyIonInfo()
Common methods. 
Definition at line 136 of file SimpleMergeMcEventCollTool.cxx.
  138   if (outputMcEventCollection->
at(0)->heavy_ion()) 
return StatusCode::SUCCESS;
 
  139   if (pMcEvtColl->
at(0)->heavy_ion())
 
  143      HepMC::GenHeavyIonPtr hinew=std::make_shared<HepMC::GenHeavyIon>(*(pMcEvtColl->
at(0)->heavy_ion()));
 
  144      outputMcEventCollection->
at(0)->set_heavy_ion(hinew);
 
  146       outputMcEventCollection->
at(0)->set_heavy_ion(*(pMcEvtColl->
at(0)->heavy_ion()));
 
  149   return StatusCode::SUCCESS;
 
 
 
 
◆ 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_nBkgEventsReadSoFar
  
  | 
        
          | unsigned int SimpleMergeMcEventCollTool::m_nBkgEventsReadSoFar {0} |  | private | 
 
 
◆ m_newevent
  
  | 
        
          | bool SimpleMergeMcEventCollTool::m_newevent {true} |  | private | 
 
 
◆ m_nInputMcEventColls
  
  | 
        
          | unsigned int SimpleMergeMcEventCollTool::m_nInputMcEventColls {0} |  | private | 
 
 
◆ m_onlySaveSignalTruth
  
  | 
        
          | BooleanProperty SimpleMergeMcEventCollTool::m_onlySaveSignalTruth {this, "OnlySaveSignalTruth", false, "Just save the Signal GenEvent"} |  | private | 
 
 
◆ m_outputMcEventCollection
◆ m_overrideEventNumbers
  
  | 
        
          | BooleanProperty SimpleMergeMcEventCollTool::m_overrideEventNumbers {this, "OverrideEventNumbers", false, ""} |  | private | 
 
 
◆ m_pMergeSvc
◆ m_truthCollInputKey
  
  | 
        
          | StringProperty SimpleMergeMcEventCollTool::m_truthCollInputKey {this, "TruthCollInputKey", "TruthEvent", ""} |  | private | 
 
 
◆ m_truthCollOutputKey
  
  | 
        
          | StringProperty SimpleMergeMcEventCollTool::m_truthCollOutputKey {this, "TruthCollOutputKey", "TruthEvent", "Name of output McEventCollection"} |  | private | 
 
 
◆ 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
The Athena Transient Store API.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
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.
#define ATH_MSG_WARNING(x)
const T * at(size_type n) const
Access an element, as an rvalue.
a struct encapsulating the identifier of a pile-up event
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.