ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
PileUpTools
src
PileUpMisc.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
PileUpTools/PileUpMisc.h
"
6
7
8
#include "
StoreGate/ActiveStoreSvc.h
"
9
#include "
StoreGate/StoreGateSvc.h
"
/*to print name() */
10
#include "
AthContainers/ConstAccessor.h
"
11
#include "GaudiKernel/IEvtSelector.h"
12
13
#include "
xAODEventInfo/EventInfoContainer.h
"
14
15
#include "
PileUpTools/IBeamIntensity.h
"
16
17
18
xAOD::EventInfo
*
addSubEvent
(
xAOD::EventInfo
* targetEv,
19
const
xAOD::EventInfo::SubEvent
& subev,
20
xAOD::EventInfoContainer
* eiContainer,
21
const
std::string& eiContKey,
22
StoreGateSvc
* subev_store )
23
{
24
// add a EI copy to the EI container
25
xAOD::EventInfo
* newEv;
26
eiContainer->
push_back
( newEv=
new
xAOD::EventInfo
( * subev.
ptr
() ) );
27
if
(newEv->evtStore()==
nullptr
&& subev_store!=
nullptr
) newEv->
setEvtStore
(subev_store);
28
29
// link to the fresh EI added to the container:
30
ElementLink< xAOD::EventInfoContainer >
eilink( eiContKey, eiContainer->
size
()-1, targetEv->evtStore() );
31
xAOD::EventInfo::SubEvent
newsubev( subev.
time
(), subev.
index
(), subev.
type
(), eilink );
32
targetEv->
addSubEvent
( newsubev );
33
34
// copy subevents recursively
35
for
(
const
auto
& se: subev.
ptr
()->
subEvents
() ) {
36
addSubEvent
( targetEv, se, eiContainer, eiContKey );
37
}
38
39
return
newEv;
40
}
41
42
43
xAOD::EventInfo
*
addSubEvent
(
xAOD::EventInfo
* targetEv,
44
const
xAOD::EventInfo
* ev2add,
45
int16_t subev_time,
46
xAOD::EventInfo::PileUpType
subev_type,
47
xAOD::EventInfoContainer
* eiContainer,
48
const
std::string& eiContKey,
49
StoreGateSvc
* ev2add_store )
50
{
51
// add a EI copy to the EI container
52
xAOD::EventInfo
* newEv;
53
eiContainer->
push_back
( newEv=
new
xAOD::EventInfo
( *ev2add ) );
54
// Need to copy this explicitly as it may be marked as a decoration.
55
static
const
SG::ConstAccessor<std::vector<float>
> mcEventWeightsAcc (
"mcEventWeights"
);
56
if
(mcEventWeightsAcc.
isAvailable
(*ev2add)) {
57
eiContainer->
back
()->setMCEventWeights(ev2add->
mcEventWeights
());
58
}
59
60
if
(newEv->evtStore()==
nullptr
&& ev2add_store!=
nullptr
) newEv->
setEvtStore
(ev2add_store);
61
62
// link to the fresh EI added to the container:
63
ElementLink< xAOD::EventInfoContainer >
eilink( eiContKey, eiContainer->
size
()-1, targetEv->evtStore() );
64
xAOD::EventInfo::SubEvent
newsubev( subev_time, targetEv->
subEvents
().size(), subev_type, eilink );
65
targetEv->
addSubEvent
( newsubev );
66
67
// copy subevents recursively
68
for
(
const
auto
& subev: ev2add->
subEvents
() ) {
69
addSubEvent
( targetEv, subev, eiContainer, eiContKey );
70
}
71
72
return
newEv;
73
}
74
ActiveStoreSvc.h
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
EventInfoContainer.h
IBeamIntensity.h
provides the relative beam intensity as a function of the bunch xing.
addSubEvent
xAOD::EventInfo * addSubEvent(xAOD::EventInfo *targetEv, const xAOD::EventInfo::SubEvent &subev, xAOD::EventInfoContainer *eiContainer, const std::string &eiContKey, StoreGateSvc *subev_store)
Definition
PileUpMisc.cxx:18
PileUpMisc.h
StoreGateSvc.h
DataVector::back
const T * back() const
Access the last element in the collection as an rvalue.
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
ElementLink
ElementLink implementation for ROOT usage.
Definition
A/AthLinks/ElementLink.h:40
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition
ConstAccessor.h:55
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
StoreGateSvc
The Athena Transient Store API.
Definition
StoreGateSvc.h:120
xAOD::EventInfo_v1::SubEvent
Class describing the properties of one pileup sub-event.
Definition
EventInfo_v1.h:286
xAOD::EventInfo_v1::SubEvent::index
uint16_t index() const
Get the index of the sub-event.
Definition
EventInfo_v1.cxx:455
xAOD::EventInfo_v1::SubEvent::time
int16_t time() const
Get the time wrt. the signal event (which has time() == 0).
Definition
EventInfo_v1.cxx:450
xAOD::EventInfo_v1::SubEvent::ptr
const EventInfo_v1 * ptr() const
Get a pointer to the EventInfo object describing the pileup event.
Definition
EventInfo_v1.cxx:501
xAOD::EventInfo_v1::SubEvent::type
PileUpType type() const
Get the type of the pileup event.
Definition
EventInfo_v1.cxx:460
xAOD::EventInfo_v1::mcEventWeights
const std::vector< float > & mcEventWeights() const
The weights of all the MC events used in the simulation.
xAOD::EventInfo_v1::addSubEvent
void addSubEvent(const SubEvent &subEvent)
Add one sub-event to the existing list.
Definition
EventInfo_v1.cxx:629
xAOD::EventInfo_v1::subEvents
const std::vector< SubEvent > & subEvents() const
Get the pileup events that were used in the simulation.
Definition
EventInfo_v1.cxx:596
xAOD::EventInfo_v1::setEvtStore
void setEvtStore(StoreGateSvc *svc)
Set the pointer to the event store associated with this event.
Definition
EventInfo_v1.cxx:990
xAOD::EventInfo_v1::PileUpType
PileUpType
Enumerator describing the types of pileup events.
Definition
EventInfo_v1.h:264
xAOD::EventInfoContainer
EventInfoContainer_v1 EventInfoContainer
Define the latest version of the container.
Definition
EventInfoContainer.h:17
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition
IEventInfoCnvTool.h:16
Generated on
for ATLAS Offline Software by
1.17.0