ATLAS Offline Software
Loading...
Searching...
No Matches
PuppiWeightTool Class Reference

#include <PuppiWeightTool.h>

Inheritance diagram for PuppiWeightTool:
Collaboration diagram for PuppiWeightTool:

Public Member Functions

 PuppiWeightTool (const std::string &name)
virtual StatusCode initialize () override final
 Dummy implementation of the initialisation function.
virtual StatusCode finalize () override
virtual StatusCode process_impl (xAOD::IParticleContainer *cont) const override final
StatusCode applyPuppiWeights (xAOD::PFOContainer *cont) const
StatusCode applyPuppiWeights (xAOD::FlowElementContainer *cont) const
StatusCode process (xAOD::IParticleContainer *cont) const override final
virtual void print () const
 Print the state of the tool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Protected Member Functions

StatusCode setEtaPhi (xAOD::IParticle *obj, float eta, float phi) const
StatusCode setEnergyPt (xAOD::IParticle *obj, float e, float pt, const SG::AuxElement::Accessor< float > *weightAcc=nullptr) const
StatusCode setP4 (xAOD::IParticle *obj, const xAOD::JetFourMom_t &p4, const SG::AuxElement::Accessor< float > *weightAcc=nullptr) const
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Protected Attributes

unsigned int m_inputType =xAOD::Type::Other
bool m_applyToChargedPFO =true
bool m_applyToNeutralPFO =true

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

double m_R0
double m_Rmin
double m_beta
double m_centralPTCutOffset
double m_centralPTCutSlope
double m_forwardPTCutOffset
double m_forwardPTCutSlope
double m_etaBoundary
bool m_includeCentralNeutralsInAlpha
bool m_applyWeight
SG::ReadHandleKey< xAOD::VertexContainerm_vertexContainer_key {"PrimaryVertices"}
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 19 of file PuppiWeightTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ PuppiWeightTool()

PuppiWeightTool::PuppiWeightTool ( const std::string & name)

Definition at line 20 of file PuppiWeightTool.cxx.

20 :
22
23 declareProperty("R0", m_R0 = 0.3);
24 declareProperty("Rmin", m_Rmin = 0.001);
25 declareProperty("Beta", m_beta = 1);
26 declareProperty("CentralPTCutOffset", m_centralPTCutOffset = 0);
27 declareProperty("CentralPTCutSlope", m_centralPTCutSlope = 0);
28 declareProperty("ForwardPTCutOffset", m_forwardPTCutOffset = 0);
29 declareProperty("ForwardPTCutSlope", m_forwardPTCutSlope = 0);
30 declareProperty("EtaBoundary",m_etaBoundary = 2.5);
31
32 declareProperty("ApplyWeight",m_applyWeight=true);
33 declareProperty("IncludeCentralNeutralsInAlpha",m_includeCentralNeutralsInAlpha=false);
34}
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
JetConstituentModifierBase(const std::string &name)
double m_centralPTCutOffset
bool m_includeCentralNeutralsInAlpha
double m_forwardPTCutOffset

Member Function Documentation

◆ applyPuppiWeights() [1/2]

StatusCode PuppiWeightTool::applyPuppiWeights ( xAOD::FlowElementContainer * cont) const

Definition at line 158 of file PuppiWeightTool.cxx.

158 {
159
160 const static SG::AuxElement::Accessor<bool> PVMatchedAcc("matchedToPV");
161 const static SG::AuxElement::Accessor<double> alphaAcc("PUPPI_alpha");
162 const static SG::AuxElement::Accessor<double> weightAcc("PUPPI_weight");
163
164 std::vector<fastjet::PseudoJet> chargedHSVector;
165 std::vector<fastjet::PseudoJet> chargedPUVector;
166 std::vector<fastjet::PseudoJet> neutralVector;
167 std::vector<fastjet::PseudoJet> forwardVector;
168
169 // Fill input particle vectors for puppi
170 for ( xAOD::FlowElement* pfe : *cont ) {
171 if (!PVMatchedAcc.isAvailable(*pfe)){
172 ATH_MSG_ERROR("Not known if FlowElement is matched to primary vertex. Run CorrectPFOTool before ChargedHadronSubtractionTool");
173 return StatusCode::FAILURE;
174 }
175
176 if (pfe->pt()<=FLT_MIN) continue;
177
178 fastjet::PseudoJet pj(pfe->p4());
179
180 if(fabs(pfe->eta()) > m_etaBoundary) forwardVector.push_back(pj);
181 else{
182 if(pfe->isCharged()){
183 bool matchedToPrimaryVertex=PVMatchedAcc(*pfe);
184 if(matchedToPrimaryVertex) chargedHSVector.push_back(pj);
185 else chargedPUVector.push_back(pj);
186 }
187 else neutralVector.push_back(pj);
188 }
189 }
190
191 //Count the number of primary vertices
192 const xAOD::VertexContainer* pvtxs = nullptr;
194 if (!handle.isValid()){
195 ATH_MSG_WARNING(" This event has no primary vertices " );
196 return StatusCode::FAILURE;
197 }
198
199 pvtxs = handle.cptr();
200 if(pvtxs->empty()){
201 ATH_MSG_WARNING(" This event has no primary vertices " );
202 return StatusCode::FAILURE;
203 }
204
205 int nPV=0;
206 for( const auto *vtx_itr : *pvtxs ){
207 if((int)vtx_itr->nTrackParticles() < 2 ) continue;
208 ++nPV;
209 }
210
212 puppi.setParticles(chargedHSVector, chargedPUVector, neutralVector, forwardVector, nPV);
213
214 for ( xAOD::FlowElement* pfe : *cont ) {
215 bool isForward = (fabs(pfe->eta()) > m_etaBoundary);
216
217 fastjet::PseudoJet pj(pfe->p4());
218
219 double weight = puppi.getWeight(pj);
220 double alpha = puppi.getAlpha(pj);
221
222 if ((!(pfe->isCharged()) || isForward) && m_applyWeight) pfe->setP4(weight*pfe->p4());
223 alphaAcc(*pfe) = alpha;
224 weightAcc(*pfe) = weight;
225 }
226
227 ATH_MSG_DEBUG("Median: "<<puppi.getMedian());
228 ATH_MSG_DEBUG("RMS: "<<puppi.getRMS());
229
230 return StatusCode::SUCCESS;
231}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
bool empty() const noexcept
Returns true if the collection is empty.
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainer_key
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
FlowElement_v1 FlowElement
Definition of the current "pfo version".
Definition FlowElement.h:16
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".

◆ applyPuppiWeights() [2/2]

StatusCode PuppiWeightTool::applyPuppiWeights ( xAOD::PFOContainer * cont) const

Definition at line 77 of file PuppiWeightTool.cxx.

77 {
78
79 const static SG::AuxElement::Accessor<bool> PVMatchedAcc("matchedToPV");
80 const static SG::AuxElement::Accessor<double> alphaAcc("PUPPI_alpha");
81 const static SG::AuxElement::Accessor<double> weightAcc("PUPPI_weight");
82
83 std::vector<fastjet::PseudoJet> chargedHSVector;
84 std::vector<fastjet::PseudoJet> chargedPUVector;
85 std::vector<fastjet::PseudoJet> neutralVector;
86 std::vector<fastjet::PseudoJet> forwardVector;
87
88 // Fill input particle vectors for puppi
89 for ( xAOD::PFO* ppfo : *cont ) {
90 if (!PVMatchedAcc.isAvailable(*ppfo)){
91 ATH_MSG_ERROR("Not known if PFO is matched to primary vertex. Run CorrectPFOTool before ChargedHadronSubtractionTool");
92 return StatusCode::FAILURE;
93 }
94
95 if (ppfo->pt()<=FLT_MIN) continue;
96
97 fastjet::PseudoJet pj(ppfo->p4());
98 //pj.set_user_info(new PuppiUserInfo({someOtherChi2,yetAnotherChi2})); //example of how additional information could be exploited - needs to be calculated somewhere above
99
100 float charge = ppfo->charge();
101 bool isCharged = (fabs(charge) > FLT_MIN);
102
103 if(fabs(ppfo->eta()) > m_etaBoundary) forwardVector.push_back(pj);
104 else{
105 if(isCharged){
106 bool matchedToPrimaryVertex=PVMatchedAcc(*ppfo);
107 if(matchedToPrimaryVertex) chargedHSVector.push_back(pj);
108 else chargedPUVector.push_back(pj);
109 }
110 else neutralVector.push_back(pj);
111 }
112 }
113
114 //Count the number of primary vertices
115 const xAOD::VertexContainer* pvtxs = nullptr;
117 if (!handle.isValid()){
118 ATH_MSG_WARNING(" This event has no primary vertices " );
119 return StatusCode::FAILURE;
120 }
121
122 pvtxs = handle.cptr();
123 if(pvtxs->empty()){
124 ATH_MSG_WARNING(" This event has no primary vertices " );
125 return StatusCode::FAILURE;
126 }
127
128 int nPV=0;
129 for( const auto *vtx_itr : *pvtxs ){
130 if((int)vtx_itr->nTrackParticles() < 2 ) continue;
131 ++nPV;
132 }
133
135 puppi.setParticles(chargedHSVector, chargedPUVector, neutralVector, forwardVector, nPV);
136
137 for ( xAOD::PFO* ppfo : *cont ) {
138 float charge = ppfo->charge();
139 bool isCharged = (fabs(charge) > FLT_MIN);
140 bool isForward = (fabs(ppfo->eta()) > m_etaBoundary);
141
142 fastjet::PseudoJet pj(ppfo->p4());
143
144 double weight = puppi.getWeight(pj);
145 double alpha = puppi.getAlpha(pj);
146
147 if ((!isCharged || isForward) && m_applyWeight) ppfo->setP4(weight*ppfo->p4());
148 alphaAcc(*ppfo) = alpha;
149 weightAcc(*ppfo) = weight;
150 }
151
152 ATH_MSG_DEBUG("Median: "<<puppi.getMedian());
153 ATH_MSG_DEBUG("RMS: "<<puppi.getRMS());
154
155 return StatusCode::SUCCESS;
156}
bool isCharged(const T &p)
Definition AtlasPID.h:1004
double charge(const T &p)
Definition AtlasPID.h:997
PFO_v1 PFO
Definition of the current "pfo version".
Definition PFO.h:17

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

StatusCode PuppiWeightTool::finalize ( )
overridevirtual

Definition at line 58 of file PuppiWeightTool.cxx.

58 {
59 ATH_MSG_INFO("Finializing tool " << name() << "...");
60
61 return StatusCode::SUCCESS;
62}
#define ATH_MSG_INFO(x)

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::TEvent, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::TEvent, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ initialize()

StatusCode PuppiWeightTool::initialize ( void )
finaloverridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from asg::AsgTool.

Definition at line 38 of file PuppiWeightTool.cxx.

38 {
39 ATH_MSG_INFO("Initializing tool " << name() << "...");
40
41 ATH_CHECK(m_vertexContainer_key.initialize());
42
45 ATH_MSG_ERROR("Incompatible configuration: ApplyToNeutralPFO=False -- what kind of pileup do you wish to suppress?");
46 return StatusCode::FAILURE;
47 }
48 } else {
49 ATH_MSG_ERROR("Incompatible configuration: PUPPI canot be used for inputs of type " << m_inputType);
50 return StatusCode::FAILURE;
51 }
52
53 return StatusCode::SUCCESS;
54}
#define ATH_CHECK
Evaluate an expression and check for errors.
@ ParticleFlow
The object is a particle-flow object.
Definition ObjectType.h:41
@ FlowElement
The object is a track-calo-cluster.
Definition ObjectType.h:52

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ print()

◆ process()

StatusCode JetConstituentModifierBase::process ( xAOD::IParticleContainer * cont) const
finaloverridevirtualinherited

Implements IJetConstituentModifier.

Definition at line 23 of file JetConstituentModifierBase.cxx.

24{
25 // Test that we are operating on the type of object that
26 // we will be writing out.
27 // By implication, any supporting containers should not
28 // be the ones passed to this method...
29 if(!cont->empty() && cont->front()->type() != m_inputType) {
30 ATH_MSG_ERROR("Object type mismatch! This tool expects " << m_inputType
31 << ", but received " << cont->front()->type());
32 return StatusCode::FAILURE;
33 }
34
36
37 return StatusCode::SUCCESS;
38}
const T * front() const
Access the first element in the collection as an rvalue.
virtual StatusCode process_impl(xAOD::IParticleContainer *) const

◆ process_impl()

StatusCode PuppiWeightTool::process_impl ( xAOD::IParticleContainer * cont) const
finaloverridevirtual

Reimplemented from JetConstituentModifierBase.

Definition at line 66 of file PuppiWeightTool.cxx.

66 {
68 xAOD::FlowElementContainer* feCont = static_cast<xAOD::FlowElementContainer*> (cont);
69 return applyPuppiWeights(feCont);
70 }
71 xAOD::PFOContainer* pfoCont = static_cast<xAOD::PFOContainer*> (cont);
72 return applyPuppiWeights(pfoCont);
73}
StatusCode applyPuppiWeights(xAOD::PFOContainer *cont) const
FlowElementContainer_v1 FlowElementContainer
Definition of the current "pfo container version".
PFOContainer_v1 PFOContainer
Definition of the current "pfo container version".

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setEnergyPt()

StatusCode JetConstituentModifierBase::setEnergyPt ( xAOD::IParticle * obj,
float e,
float pt,
const SG::AuxElement::Accessor< float > * weightAcc = nullptr ) const
protectedinherited

Definition at line 61 of file JetConstituentModifierBase.cxx.

63{
64 switch(m_inputType) {
66 {
67 xAOD::CaloCluster* clus = static_cast<xAOD::CaloCluster*>(obj);
68 // Clusters get pt via the energy
69 // This currently leaves the mass unaltered.
70 if(weightAcc) (*weightAcc)(*clus) = clus->calE() > 0. ? e / clus->calE() : 0.;
71 clus->setCalE(e);
72 }
73 break;
75 {
76 xAOD::PFO* pfo = static_cast<xAOD::PFO*>(obj);
77 if( (m_applyToChargedPFO && pfo->isCharged()) ||
78 (m_applyToNeutralPFO && !pfo->isCharged()) ) {
79 if(weightAcc) (*weightAcc)(*pfo) = pfo->pt() > 0. ? pt / pfo->pt() : 0.;
80 // KTJ: Temporary fix
81 // Defeats the purpose, but we need to use this to reset the 4-vec cache
82 pfo->setP4(pt, pfo->eta(), pfo->phi());
83 }
84 }
85 break;
87 {
88 xAOD::FlowElement* pfo = static_cast<xAOD::FlowElement*>(obj);
89 if( (m_applyToChargedPFO && pfo->isCharged()) ||
90 (m_applyToNeutralPFO && !pfo->isCharged()) ) {
91 if(weightAcc) (*weightAcc)(*pfo) = pfo->pt() > 0. ? pt / pfo->pt() : 0.;
92 pfo->setP4(pt, pfo->eta(), pfo->phi(), 0.);
93 }
94 }
95 break;
97 {
99 if( tcc->taste() != 0) {
100 if(weightAcc) (*weightAcc)(*tcc) = tcc->pt() > 0. ? pt / tcc->pt() : 0.;
101 tcc->setParameters(pt, tcc->eta(), tcc->phi(), tcc->m(), xAOD::TrackCaloCluster::Taste(tcc->taste()), tcc->trackParticleLink(), tcc->caloClusterLinks());
102 }
103 }
104 break;
105 default:
106 // Should not get here, because type-checking should happen in process()
107 ATH_MSG_ERROR("No specialisation for object type " << m_inputType);
108 return StatusCode::FAILURE;
109 }
110 return StatusCode::SUCCESS;
111}
flt_t calE() const
Geet Energy in signal state CALIBRATED.
bool isCharged() const
is a charged PFO
Definition PFO_v1.cxx:251
virtual int taste() const
The taste of the particle.
Taste
Type of TrackCaloCluster - Charged - Neutral - Combined.
@ CaloCluster
The object is a calorimeter cluster.
Definition ObjectType.h:39
@ TrackCaloCluster
The object is a track-calo-cluster.
Definition ObjectType.h:51
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
TrackCaloCluster_v1 TrackCaloCluster
Reference the current persistent version:

◆ setEtaPhi()

StatusCode JetConstituentModifierBase::setEtaPhi ( xAOD::IParticle * obj,
float eta,
float phi ) const
protectedinherited

Definition at line 41 of file JetConstituentModifierBase.cxx.

42{
43 switch(m_inputType) {
44 // The main (only?) application is origin-correcting LC topoclusters
45 // By convention we leave the raw p4 unmodified
47 {
48 xAOD::CaloCluster* clus = static_cast<xAOD::CaloCluster*>(obj);
49 clus->setCalEta(eta);
50 clus->setCalPhi(phi);
51 }
52 break;
53 default:
54 // Should not get here, because type-checking should happen in process()
55 ATH_MSG_ERROR("No specialisation for object type " << m_inputType);
56 return StatusCode::FAILURE;
57 }
58 return StatusCode::SUCCESS;
59}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
void setCalPhi(flt_t)
Set for signal state CALIBRATED.
void setCalEta(flt_t)
Set for signal state CALIBRATED.

◆ setP4()

StatusCode JetConstituentModifierBase::setP4 ( xAOD::IParticle * obj,
const xAOD::JetFourMom_t & p4,
const SG::AuxElement::Accessor< float > * weightAcc = nullptr ) const
protectedinherited

Definition at line 113 of file JetConstituentModifierBase.cxx.

114 {
115 switch(m_inputType) {
117 {
118 xAOD::CaloCluster* clus = static_cast<xAOD::CaloCluster*>(obj);
119 // This currently leaves the mass unaltered
120 if(weightAcc) (*weightAcc)(*clus) = clus->calE() > 0. ? p4.e() / clus->calE() : 0.;
121 clus->setCalE(p4.e());
122 clus->setCalEta(p4.eta());
123 clus->setCalPhi(p4.phi());
124 }
125 break;
127 {
128 xAOD::PFO* pfo = static_cast<xAOD::PFO*>(obj);
129 // The PFO setter defaults to m=0
130 if( (m_applyToChargedPFO && pfo->isCharged()) ||
131 (m_applyToNeutralPFO && !pfo->isCharged()) ) {
132 if(weightAcc) (*weightAcc)(*pfo) = pfo->pt() > 0. ? p4.pt() / pfo->pt() : 0.;
133 pfo->setP4(p4.pt(),p4.eta(),p4.phi(),p4.mass());
134 }
135 }
136 break;
138 {
139 xAOD::FlowElement* pfo = static_cast<xAOD::FlowElement*>(obj);
140 if( (m_applyToChargedPFO && pfo->isCharged()) ||
141 (m_applyToNeutralPFO && !pfo->isCharged()) ) {
142 if(weightAcc) (*weightAcc)(*pfo) = pfo->pt() > 0. ? p4.pt() / pfo->pt() : 0.;
143 pfo->setP4(p4.pt(),p4.eta(),p4.phi(),p4.mass());
144 }
145 }
146 break;
148 {
150 if( tcc->taste() != 0) {
151 if(weightAcc) (*weightAcc)(*tcc) = tcc->pt() > 0. ? p4.pt() / tcc->pt() : 0.;
152 tcc->setParameters(p4.pt(), p4.eta(), p4.phi(), p4.mass(), xAOD::TrackCaloCluster::Taste(tcc->taste()), tcc->trackParticleLink(), tcc->caloClusterLinks());
153 }
154 break;
155 }
156
157 default:
158 // Should not get here, because type-checking should happen in process()
159 ATH_MSG_ERROR("No specialisation for object type " << m_inputType);
160 return StatusCode::FAILURE;
161 }
162 return StatusCode::SUCCESS;
163}

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_applyToChargedPFO

bool JetConstituentModifierBase::m_applyToChargedPFO =true
protectedinherited

Definition at line 62 of file JetConstituentModifierBase.h.

◆ m_applyToNeutralPFO

bool JetConstituentModifierBase::m_applyToNeutralPFO =true
protectedinherited

Definition at line 63 of file JetConstituentModifierBase.h.

◆ m_applyWeight

bool PuppiWeightTool::m_applyWeight
private

Definition at line 46 of file PuppiWeightTool.h.

◆ m_beta

double PuppiWeightTool::m_beta
private

Definition at line 38 of file PuppiWeightTool.h.

◆ m_centralPTCutOffset

double PuppiWeightTool::m_centralPTCutOffset
private

Definition at line 39 of file PuppiWeightTool.h.

◆ m_centralPTCutSlope

double PuppiWeightTool::m_centralPTCutSlope
private

Definition at line 40 of file PuppiWeightTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_etaBoundary

double PuppiWeightTool::m_etaBoundary
private

Definition at line 43 of file PuppiWeightTool.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_forwardPTCutOffset

double PuppiWeightTool::m_forwardPTCutOffset
private

Definition at line 41 of file PuppiWeightTool.h.

◆ m_forwardPTCutSlope

double PuppiWeightTool::m_forwardPTCutSlope
private

Definition at line 42 of file PuppiWeightTool.h.

◆ m_includeCentralNeutralsInAlpha

bool PuppiWeightTool::m_includeCentralNeutralsInAlpha
private

Definition at line 45 of file PuppiWeightTool.h.

◆ m_inputType

unsigned int JetConstituentModifierBase::m_inputType =xAOD::Type::Other
protectedinherited

Definition at line 60 of file JetConstituentModifierBase.h.

◆ m_R0

double PuppiWeightTool::m_R0
private

Definition at line 36 of file PuppiWeightTool.h.

◆ m_Rmin

double PuppiWeightTool::m_Rmin
private

Definition at line 37 of file PuppiWeightTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vertexContainer_key

SG::ReadHandleKey<xAOD::VertexContainer> PuppiWeightTool::m_vertexContainer_key {"PrimaryVertices"}
private

Definition at line 48 of file PuppiWeightTool.h.

48{"PrimaryVertices"};

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: