Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
the preferred mechanism to access information from the different event stores in a pileup job.
More...
#include <PileUpMergeSvc.h>
|
class | Range |
| the active crossing range for a data object (CLID/key combination) More...
|
|
struct | TimedList |
| generate the types of the timed data objects More...
|
|
|
| PileUpMergeSvc (const std::string &name, ISvcLocator *svc) |
| Standard Gaudi Constructor. More...
|
|
virtual | ~PileUpMergeSvc () |
|
virtual StatusCode | initialize () override |
| Service initialisation. More...
|
|
template<typename KEY , typename DATA > |
StatusCode | retrieveOriginal (const KEY &dataKey, const DATA *&data) |
| retrieve keyed DATA objs for the original event only More...
|
|
template<typename KEY , typename DATA > |
StatusCode | retrieveSingleSubEvtData (const KEY &dataKey, const DATA *&data, int bunchXing, SubEventIterator iEvt) |
|
template<typename KEY , typename TIMEDDATA > |
StatusCode | retrieveSubEvtsData (const KEY &dataKey, TIMEDDATA &timedData) |
| retrieve keyed DATA objs for all sub-events and attach a time to them More...
|
|
template<typename KEY , typename TIMEDDATA > |
StatusCode | retrieveSubSetEvtData (const KEY &dataKey, TIMEDDATA &timedData, int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents) |
|
template<typename KEY , typename TIMEDDATA > |
StatusCode | retrieveSubEvtsData (const KEY &dataKey, TIMEDDATA &timedData, unsigned int &numberOfSimHits) |
| retrieve keyed DATA objs for all sub-events and attach a time to them More...
|
|
StatusCode | clearDataCaches () |
| clear bkg event caches from unneeded data objects (as configured using PileUpXingFolder CacheRefreshFrequency property) More...
|
|
const xAOD::EventInfo * | getPileUpEvent (StoreGateSvc *sg, const std::string &einame) const |
| get EventInfo from SG, by default using p_overStore More...
|
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
the preferred mechanism to access information from the different event stores in a pileup job.
access PileUpEventInfo to locate data objects (typically hit collections) to be merged attaching sub-evt time offsets
- Author
- Paolo Calafiura
Definition at line 56 of file PileUpMergeSvc.h.
◆ RangeContainer
◆ PileUpMergeSvc()
PileUpMergeSvc::PileUpMergeSvc |
( |
const std::string & |
name, |
|
|
ISvcLocator * |
svc |
|
) |
| |
Standard Gaudi Constructor.
Standard Constructor.
Definition at line 38 of file PileUpMergeSvc.cxx.
45 m_xAODCnvTool(
"xAODMaker::EventInfoCnvTool/EventInfoCnvTool",
this)
47 declareProperty(
"Intervals",
m_intervals,
"Folders specifying bunch xing intervals for different data objects");
48 declareProperty(
"TriggerTimeTool",
m_pITriggerTime,
"allows to apply a trigger time offset");
50 "determine whether the TimedData returned by retrieveSubEvts have non trivial PileUpTimeEventIndex. May be set to false for overlay with real events ");
◆ ~PileUpMergeSvc()
virtual PileUpMergeSvc::~PileUpMergeSvc |
( |
| ) |
|
|
inlinevirtual |
◆ clearDataCaches()
StatusCode PileUpMergeSvc::clearDataCaches |
( |
| ) |
|
clear bkg event caches from unneeded data objects (as configured using PileUpXingFolder CacheRefreshFrequency property)
Definition at line 271 of file PileUpMergeSvc.cxx.
287 proxy->setObject ((DataObject*)0);
290 <<
"clearDataCachesByFolder: object with clid "
291 <<
item.first.first <<
" and key " <<
item.first.second
292 <<
" removed from cache "
293 << pSubEvtSG->name() <<
endmsg;
298 pSubEvtSG->emptyTrash();
302 <<
"clearDataCachesByFolder: done with store " << pSubEvtSG->name()
307 sc=StatusCode::SUCCESS;
◆ decodeIntervals()
void PileUpMergeSvc::decodeIntervals |
( |
| ) |
|
|
private |
setup PileUpIntervals
Definition at line 56 of file PileUpMergeSvc.cxx.
58 ToolHandleArray<IPileUpXingFolder>::const_iterator
60 while (iXing != iEnd) {
63 msg() <<
MSG::DEBUG <<
"decodeIntervals: adding IPileUpXingFolder "
67 item(xing.begin()), endItem(xing.end());
68 while(
item != endItem) {
70 Range(xing.firstXing(), xing.lastXing(), xing.cacheRefreshFrequency());
73 <<
"decodeInterval: accepting objects of CLID " <<
item->id()
74 <<
" key " <<
item->key() <<
" in the Xing range ["
75 << xing.firstXing() <<
", " << xing.lastXing() <<
']'
76 <<
" with cache refresh frequency "
77 << xing.cacheRefreshFrequency() <<
endmsg;
◆ doRefresh()
bool PileUpMergeSvc::doRefresh |
( |
const Range & |
r, |
|
|
int |
iXing |
|
) |
| |
|
private |
Definition at line 263 of file PileUpMergeSvc.cxx.
267 return (
r.contains(iXing) &&
r.doRefresh(
double(random())*(1./RAND_MAX)));
◆ getPileUpEvent()
get EventInfo from SG, by default using p_overStore
Definition at line 122 of file PileUpMergeSvc.cxx.
128 if( xAODEventInfo ) {
129 ATH_MSG_DEBUG(
"Found xAOD::EventInfo="<<xAODEventInfo<<
" SG="<<sg<<
" : "<<*xAODEventInfo);
137 std::lock_guard<std::mutex> lock (*m_slotMutex);
140 const EventInfo* pEvent = einame.empty()?
144 ATH_MSG_DEBUG(
"Converting (PileUp)EventInfo "<<pEvent<<
" SG="<<sg<<
" to xAOD::EventInfo");
146 std::unique_ptr< xAOD::EventInfo > pxAODEventInfo(
new xAOD::EventInfo() );
148 pxAODEventInfo->setStore( pxAODEventAuxInfo.get() );
149 pxAODEventInfo->setEvtStore( sg );
150 if( !
m_xAODCnvTool->convert( pEvent, pxAODEventInfo.get(),
true,
false ).isSuccess() ) {
160 puei->setStore( puaux.get() );
163 std::vector< xAOD::EventInfo::SubEvent > subEvents;
168 #define DECLARE_SE_TYPE( TYPE ) \
169 { PileUpTimeEventIndex::TYPE, xAOD::EventInfo::TYPE },
178 #undef DECLARE_SE_TYPE
185 auto pu_itr = pileupEvent->beginSubEvt();
186 auto pu_end = pileupEvent->endSubEvt();
187 const unsigned int countEvents =
std::distance(pu_itr,pu_end);
188 ATH_MSG_VERBOSE(
"CHECKING: There are " << countEvents <<
" subevents in this Event." );
189 for( ; pu_itr != pu_end; ++pu_itr ) {
193 if( !
m_xAODCnvTool->convert( pu_itr->pSubEvt, ei.get(),
true,
false ).isSuccess() ) {
194 ATH_MSG_ERROR(
"Failed to convert EventInfo to xAOD::EventInfo");
200 ei->setEvtStore(tmpSG);
206 puei->push_back( ei.release() );
209 auto typeItr = pileupTypeMap.find( pu_itr->type() );
211 if( typeItr == pileupTypeMap.end() ) {
214 type = typeItr->second;
216 ATH_MSG_VERBOSE(
"PileUpEventInfo: time = " << pu_itr->time() <<
", index = " << pu_itr->index());
220 EiLink(
"PileUpEventInfo", puei->size()-1, sg )));
221 ATH_MSG_VERBOSE(
"PileUpEventInfo: time = " << subEvents.back().time() <<
", index = " << subEvents.back().index());
224 if( subEvents.size() ) {
226 pxAODEventInfo->setSubEvents( subEvents );
229 if( !sg->
record( std::move( puaux ),
"PileUpEventInfoAux." ).isSuccess()
230 || !sg->
record( std::move( puei ),
"PileUpEventInfo" ).isSuccess() ) {
231 ATH_MSG_ERROR(
"Failed to record xAOD::EventInfoContainer in SG");
238 xAODEventInfo = std::launder(pxAODEventInfo.get());
240 const auto ptrVal = pxAODEventInfo.get();
241 if( ! sg->
record( std::move( pxAODEventAuxInfo ),
"EventInfoAux." ).isSuccess()
242 || ! sg->
record( std::move( pxAODEventInfo ),
"EventInfo" ).isSuccess() ) {
243 ATH_MSG_ERROR(
"Failed to record the new xAOD::EventInfo in SG");
244 xAODEventInfo =
nullptr;
246 ATH_MSG_DEBUG(
"Record the new xAOD::EventInfo "<<ptrVal<<
" in SG="<<sg);
250 if( !xAODEventInfo ) {
251 ATH_MSG_DEBUG(
"Could not find EventInfo '" << einame <<
"' in store " << sg->name());
253 return xAODEventInfo;
◆ initialize()
StatusCode PileUpMergeSvc::initialize |
( |
| ) |
|
|
overridevirtual |
Service initialisation.
Definition at line 89 of file PileUpMergeSvc.cxx.
93 m_autoRetrieveTools =
false;
94 m_checkToolDeps =
false;
100 <<
"Could not locate default store"
102 return StatusCode::FAILURE;
107 <<
"Could not locate ITriggerTime tool"
109 return StatusCode::FAILURE;
117 return StatusCode::SUCCESS;
◆ isLive() [1/2]
bool PileUpMergeSvc::isLive |
( |
CLID |
id, |
|
|
const std::string & |
dataKey, |
|
|
int |
iXing |
|
) |
| |
|
private |
◆ isLive() [2/2]
template<typename DATA , typename KEY >
bool PileUpMergeSvc::isLive |
( |
const KEY & |
key, |
|
|
int |
iXing |
|
) |
| |
|
private |
is iXing live for DATA/key?
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ retrieveOriginal()
template<typename KEY , typename DATA >
StatusCode PileUpMergeSvc::retrieveOriginal |
( |
const KEY & |
dataKey, |
|
|
const DATA *& |
data |
|
) |
| |
retrieve keyed DATA objs for the original event only
◆ retrieveSingleSubEvtData()
template<typename KEY , typename DATA >
StatusCode PileUpMergeSvc::retrieveSingleSubEvtData |
( |
const KEY & |
dataKey, |
|
|
const DATA *& |
data, |
|
|
int |
bunchXing, |
|
|
SubEventIterator |
iEvt |
|
) |
| |
◆ retrieveSubEvtsData() [1/2]
template<typename KEY , typename TIMEDDATA >
StatusCode PileUpMergeSvc::retrieveSubEvtsData |
( |
const KEY & |
dataKey, |
|
|
TIMEDDATA & |
timedData |
|
) |
| |
retrieve keyed DATA objs for all sub-events and attach a time to them
◆ retrieveSubEvtsData() [2/2]
template<typename KEY , typename TIMEDDATA >
StatusCode PileUpMergeSvc::retrieveSubEvtsData |
( |
const KEY & |
dataKey, |
|
|
TIMEDDATA & |
timedData, |
|
|
unsigned int & |
numberOfSimHits |
|
) |
| |
retrieve keyed DATA objs for all sub-events and attach a time to them
◆ retrieveSubSetEvtData()
template<typename KEY , typename TIMEDDATA >
◆ ATLAS_THREAD_SAFE
◆ m_EventInfoKeyName
std::string PileUpMergeSvc::m_EventInfoKeyName |
|
private |
◆ m_intervals
◆ m_pITriggerTime
allows to apply a trigger time offset
controls PileUpTimedEventIndex for TimedData returned by retrieveSubEvts
Definition at line 172 of file PileUpMergeSvc.h.
◆ m_ranges
◆ m_returnTimedData
BooleanProperty PileUpMergeSvc::m_returnTimedData |
|
private |
◆ m_xAODCnvTool
◆ p_overStore
The documentation for this class was generated from the following files:
StatusCode record(T *p2BRegistered, const TKEY &key)
Record an object with a key.
const xAOD::EventInfo * getPileUpEvent(StoreGateSvc *sg, const std::string &einame) const
get EventInfo from SG, by default using p_overStore
Auxiliary information about the event.
PileUpType
Enumerator describing the types of pileup events.
bool doRefresh(const Range &r, int iXing)
#define ATH_MSG_VERBOSE(x)
std::string m_EventInfoKeyName
The Athena Transient Store API.
ServiceHandle< StoreGateSvc > p_overStore
overlaid SG (default)
@ Unknown
Type not known/specified.
::StatusCode StatusCode
StatusCode definition for legacy code.
an interface to SG::Folder with an attached bunch crossing interval
#define CHECK(...)
Evaluate an expression and check for errors.
AthROOTErrorHandlerSvc * svc
void decodeIntervals()
setup PileUpIntervals
ElementLink implementation for ROOT usage.
Auxiliary information about the pileup events.
ToolHandleArray< IPileUpXingFolder > m_intervals
Property: bunch xing intervals.
SG::IFolder::const_iterator const_iterator
This class provides general information about an event. Event information is provided by the accessor...
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
const T * tryConstRetrieve() const
Class describing the basic event information.
This class provides information about an overlaid event. It extends EventInfo with a list of sub-evts...
#define ATH_MSG_WARNING(x)
const std::vector< SubEvent > & subEvents() const
Get the pileup events that were used in the simulation.
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
PileUpTimeEventIndex::PileUpType pileup_type
#define DECLARE_SE_TYPE(TYPE)
ToolHandle< xAODMaker::IEventInfoCnvTool > m_xAODCnvTool
property: Handle to the EventInfo -> xAOD::EventInfo converter tool
ToolHandle< ITriggerTime > m_pITriggerTime
allows to apply a trigger time offset
Class describing the properties of one pileup sub-event.
BooleanProperty m_returnTimedData