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

#include <JetConstituentModSequence.h>

Inheritance diagram for JetConstituentModSequence:

Public Member Functions

 JetConstituentModSequence (const std::string &name)
StatusCode initialize ()
 Dummy implementation of the initialisation function.
int execute () const
 Method to be called for each event.
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
virtual int inputContainerNames (std::vector< std::string > &connames)
 Method to return the list of input containers.
virtual int outputContainerNames (std::vector< std::string > &connames)
 Method to return the list of output containers.
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

template<class T>
StatusCode copyModRecord (const SG::ReadHandleKey< T > &, const SG::WriteHandleKey< T > &) const
 helper function to cast, shallow copy and record a container.
template<class T, class U>
StatusCode copyModRecordFlowLike (const SG::ReadHandleKey< T > &, const SG::ReadHandleKey< T > &, const SG::WriteHandleKey< T > &, const SG::WriteHandleKey< T > &, const SG::WriteHandleKey< T > &) 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

Gaudi::Property< std::string > m_inputContainer {this, "InputContainer", "", "The input container for the sequence"}
Gaudi::Property< std::string > m_outputContainer = {this, "OutputContainer", "", "The output container for the sequence"}
Gaudi::Property< bool > m_byVertex = {this, "DoByVertex", false, "True if we should match to each primary vertex, not just PV0"}
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainerKey {this, "VertexContainerKey", "PrimaryVertices", "Reconstructed primary vertex container name"}
unsigned short m_inputType
ToolHandleArray< IJetConstituentModifier > m_modifiers {this , "Modifiers" , {} , "List of constit modifier tools."}
ToolHandle< GenericMonitoringTool > m_monTool {this,"MonTool","","Monitoring tool"}
bool m_saveAsShallow = true
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_inClusterKey {this, "InClusterKey", "", "ReadHandleKey for unmodified CaloClusters"}
SG::WriteHandleKey< xAOD::CaloClusterContainer > m_outClusterKey {this, "OutClusterKey", "", "WriteHandleKey for modified CaloClusters"}
SG::ReadHandleKey< xAOD::TrackCaloClusterContainer > m_inTCCKey {this, "InTCCKey", "", "ReadHandleKey for unmodified TrackCaloClusters"}
SG::WriteHandleKey< xAOD::TrackCaloClusterContainer > m_outTCCKey {this, "OutTCCKey", "", "WriteHandleKey for modified TrackCaloClusters"}
SG::ReadHandleKey< xAOD::PFOContainer > m_inChargedPFOKey {this, "InChargedPFOKey", "", "ReadHandleKey for modified Charged PFlow Objects"}
SG::WriteHandleKey< xAOD::PFOContainer > m_outChargedPFOKey {this, "OutChargedPFOKey", "", "WriteHandleKey for modified Charged PFlow Objects"}
SG::ReadHandleKey< xAOD::PFOContainer > m_inNeutralPFOKey {this, "InNeutralPFOKey", "", "ReadHandleKey for modified Neutral PFlow Objects"}
SG::WriteHandleKey< xAOD::PFOContainer > m_outNeutralPFOKey {this, "OutNeutralPFOKey", "", "WriteHandleKey for modified Neutral PFlow Objects"}
SG::WriteHandleKey< xAOD::PFOContainer > m_outAllPFOKey {this, "OutAllPFOKey", "", "WriteHandleKey for all modified PFlow Objects"}
SG::ReadHandleKey< xAOD::FlowElementContainer > m_inChargedFEKey {this, "InChargedFEKey", "", "ReadHandleKey for modified Charged FlowElements"}
SG::WriteHandleKey< xAOD::FlowElementContainer > m_outChargedFEKey {this, "OutChargedFEKey", "", "WriteHandleKey for modified Charged FlowElements"}
SG::ReadHandleKey< xAOD::FlowElementContainer > m_inNeutralFEKey {this, "InNeutralFEKey", "", "ReadHandleKey for modified Neutral FlowElements"}
SG::WriteHandleKey< xAOD::FlowElementContainer > m_outNeutralFEKey {this, "OutNeutralFEKey", "", "WriteHandleKey for modified Neutral FlowElements"}
SG::WriteHandleKey< xAOD::FlowElementContainer > m_outAllFEKey {this, "OutAllFEKey", "", "WriteHandleKey for all modified FlowElements"}
SG::ReadDecorHandleKeyArray< xAOD::FlowElementContainer > m_inChargedFEDecorKeys {this, "InChargedFEDecorKeys", {}, "Dummy keys that force all neccessary charged FlowElement decorations to be applied before running this algorithm"}
SG::ReadDecorHandleKeyArray< xAOD::FlowElementContainer > m_inNeutralFEDecorKeys {this, "InNeutralFEDecorKeys", {}, "Dummy keys that force all neccessary neutral FlowElement decorations to be applied before running this algorithm"}
SG::WriteDecorHandleKey< xAOD::IParticleContainer > m_constituentCopyIndexKey {this, "ConstituentCopyIndexKey", "ConstituentCopyIndex", "WriteDecorHandleKey for the constituent copy index"}

Private Types

typedef ServiceHandle< StoreGateSvc > StoreGateSvc_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

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 54 of file JetConstituentModSequence.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 376 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ JetConstituentModSequence()

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

Definition at line 27 of file JetConstituentModSequence.cxx.

27 :
28 asg::AsgTool(name) {
29
30#ifdef ASG_TOOL_ATHENA
31 declareInterface<IJetConstituentModifier>(this);
32#endif
33 declareProperty("InputType", m_inputType, "The xAOD type name for the input container.");
34 declareProperty("SaveAsShallow", m_saveAsShallow=true, "Save as shallow copy");
35
36}
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

Member Function Documentation

◆ copyModRecord()

template<class T>
StatusCode JetConstituentModSequence::copyModRecord ( const SG::ReadHandleKey< T > & inKey,
const SG::WriteHandleKey< T > & outKey ) const
protected

helper function to cast, shallow copy and record a container.

Definition at line 126 of file JetConstituentModSequence.h.

127 {
128
129 const EventContext& ctx = Gaudi::Hive::currentContext();
130
131 /* Read in a container of (type is template parameter),
132 optionally modify the elements of this container, and store.
133 This puts a (modified) copy of the container into storegate.
134 */
135
136 auto inHandle = makeHandle(inKey, ctx);
137 if(!inHandle.isValid()){
138 ATH_MSG_WARNING("Unable to retrieve input container from " << inKey.key());
139 return StatusCode::FAILURE;
140 }
141
142 xAOD::ShallowCopyResult_t<T> newconstit = xAOD::shallowCopy(*inHandle);
143 newconstit.second->setShallowIO(m_saveAsShallow);
144
145 auto handle = makeHandle(outKey, ctx);
146 ATH_CHECK(handle.record(std::move(newconstit.first), std::move(newconstit.second)));
147
148 xAOD::setOriginalObjectLink(*inHandle, *handle);
149 T* outCont = handle.ptr();
150
151 for (auto t : m_modifiers) {
152 ATH_CHECK(t->process(outCont, ctx));
153 }
154
155 return StatusCode::SUCCESS;
156}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x,...)
ToolHandleArray< IJetConstituentModifier > m_modifiers
const std::string & key() const
Return the StoreGate ID for the referenced object.
virtual void handle(const Incident &inc)
Handle end of run incidents to save the metadata at that point.
unsigned long long T
auto makeHandle(const SG::View *view, const KEY &key, const EventContext &ctx)
Create a view handle from a handle key.
Definition ViewHelper.h:273
typename ShallowCopyResult< T >::type ShallowCopyResult_t
Return type of xAOD::shallowCopy.
Definition ShallowCopy.h:68
ShallowCopyResult_t< T > shallowCopy(const T &cont, const EventContext &ctx)
Create a shallow copy of an existing container.
bool setOriginalObjectLink(const IParticle &original, IParticle &copy)
This function should be used by CP tools when they make a deep copy of an object in their correctedCo...

◆ copyModRecordFlowLike()

template<class T, class U>
StatusCode JetConstituentModSequence::copyModRecordFlowLike ( const SG::ReadHandleKey< T > & inNeutralKey,
const SG::ReadHandleKey< T > & inChargedKey,
const SG::WriteHandleKey< T > & outNeutralKey,
const SG::WriteHandleKey< T > & outChargedKey,
const SG::WriteHandleKey< T > & outAllKey ) const
protected

Definition at line 158 of file JetConstituentModSequence.h.

158 {
159
160 const EventContext& ctx = Gaudi::Hive::currentContext();
161
162 // Cannot be handled the same way as other objects (e.g. clusters),
163 // because the data is split between two containers, but we need
164 // information from both to do the modifications.
165 //
166 // The logic is:
167 // 1. Copy the charged container via a shallow copy
168 // 2. Create N copies of neutral container for by-vertex reconstruction OR
169 // Create a single copy of neutral container for regular jet reconstruction
170 // 3. Merge into a combined view container
171 // 4. Modify the combined container
172
173 // 1. Retrieve the input containers
174 SG::ReadHandle<T> inNeutralHandle = makeHandle(inNeutralKey, ctx);
175 SG::ReadHandle<T> inChargedHandle = makeHandle(inChargedKey, ctx);
176 if(!inNeutralHandle.isValid()){
177 ATH_MSG_WARNING("Unable to retrieve input containers \""
178 << inNeutralKey.key() << "\" and \""
179 << inChargedKey.key() << "\"");
180 return StatusCode::FAILURE;
181 }
182
183 unsigned numNeutralCopies = 1;
184 if (m_byVertex){
185 // Retrieve Primary Vertices
187 if (!handle.isValid()){
188 ATH_MSG_WARNING(" This event has no primary vertex container" );
189 return StatusCode::FAILURE;
190 }
191
192 const xAOD::VertexContainer* vertices = handle.cptr();
193 if(vertices->empty()){
194 ATH_MSG_WARNING(" Failed to retrieve valid primary vertex container" );
195 return StatusCode::FAILURE;
196 }
197 numNeutralCopies = static_cast<unsigned>(vertices->size());
198 }
199
200 // Copy the input containers individually, set I/O option and record
201 // Charged elements
202 SG::WriteHandle<T> outChargedHandle = makeHandle(outChargedKey, ctx);
203
204 xAOD::ShallowCopyResult_t<T> chargedCopy =
205 xAOD::shallowCopy(*inChargedHandle, ctx);
206 chargedCopy.second->setShallowIO(m_saveAsShallow);
207 xAOD::setOriginalObjectLink(*inChargedHandle, *chargedCopy.first);
208
209 ATH_CHECK(outChargedHandle.record(std::move(chargedCopy.first),
210 std::move(chargedCopy.second)));
211
212 // Neutral elements
213 SG::WriteHandle<T> outNeutralHandle = makeHandle(outNeutralKey, ctx);
214
215 // Shallow copy
216 if (m_saveAsShallow){
217
218 xAOD::ShallowCopyResult_t<T> neutralCopy =
219 xAOD::shallowCopy(*inNeutralHandle, ctx);
220 neutralCopy.second->setShallowIO(true);
221 xAOD::setOriginalObjectLink(*inNeutralHandle, *neutralCopy.first);
222
223 ATH_CHECK(outNeutralHandle.record(std::move(neutralCopy.first),
224 std::move(neutralCopy.second)));
225
226 }
227 // Deep copy
228 else{
229
230 // Create the new container and its auxiliary store.
231 auto neutralCopies = std::make_unique<T>();
232 auto neutralCopiesAux = std::make_unique<xAOD::AuxContainerBase>();
233 neutralCopies->setStore(neutralCopiesAux.get()); //< Connect the two
234
235 ATH_CHECK(outNeutralHandle.record(std::move(neutralCopies),
236 std::move(neutralCopiesAux))
237 );
238
239 SG::WriteDecorHandle<xAOD::IParticleContainer, unsigned> copyIndexHandle(m_constituentCopyIndexKey, ctx);
240
241 T* outNeutralCont = outNeutralHandle.ptr();
242
243 // Create N copies and set copy index
244 // Necessary for by-vertex jet reconstruction
245 for (unsigned i = 0; i < numNeutralCopies; i++){
246 for (const U* fe : *inNeutralHandle) {
247 U* copy = new U();
248 outNeutralCont->push_back(copy);
249 *copy = *fe;
250 copyIndexHandle(*copy) = i;
251 xAOD::setOriginalObjectLink(*fe, *copy);
252 }
253 }
254
255
256 }
257
258
259 // 2. Set up output handle for merged (view) container and record
260 SG::WriteHandle<T> outAllHandle = makeHandle(outAllKey, ctx);
261 ATH_CHECK(outAllHandle.record(std::make_unique<T>(SG::VIEW_ELEMENTS)));
262 (*outAllHandle).assign((*outNeutralHandle).begin(), (*outNeutralHandle).end());
263 (*outAllHandle).insert((*outAllHandle).end(),
264 (*outChargedHandle).begin(),
265 (*outChargedHandle).end());
266
267 // 3. Now process modifications on all elements
268 for (auto t : m_modifiers) {ATH_CHECK(t->process(&*outAllHandle, ctx));}
269 return StatusCode::SUCCESS;
270}
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
Gaudi::Property< bool > m_byVertex
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainerKey
SG::WriteDecorHandleKey< xAOD::IParticleContainer > m_constituentCopyIndexKey
virtual bool isValid() override final
Can the handle be successfully dereferenced?
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
bool copy
Definition calibdata.py:26
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".

◆ 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.

◆ execute()

int JetConstituentModSequence::execute ( ) const
virtual

Method to be called for each event.

Returns 0 for success.

Implements IJetExecuteTool.

Definition at line 232 of file JetConstituentModSequence.cxx.

232 {
233
234#ifndef XAOD_ANALYSIS
235 // Define monitored quantities
236 auto t_exec = Monitored::Timer<std::chrono::milliseconds>( "TIME_constitmod" );
237#endif
238
239 // Create the shallow copy according to the input type
240 switch(m_inputType){
241
245 if(!sc.isSuccess()) return 1;
246 break;
247 }
248
251 if(!sc.isSuccess()) return 1;
252 break;
253 }
256 if(!sc.isSuccess()) return 1;
257 break;
258 }
259
263 if(!sc.isSuccess()){return 1;}
264 break;
265 }
266
267 default: {
268 ATH_MSG_WARNING( "Unsupported input type " << m_inputType );
269 }
270
271 }
272
273 #ifndef XAOD_ANALYSIS
274 auto mon = Monitored::Group(m_monTool, t_exec);
275 #endif
276 return 0;
277}
static Double_t sc
SG::ReadHandleKey< xAOD::FlowElementContainer > m_inChargedFEKey
StatusCode copyModRecord(const SG::ReadHandleKey< T > &, const SG::WriteHandleKey< T > &) const
helper function to cast, shallow copy and record a container.
ToolHandle< GenericMonitoringTool > m_monTool
SG::WriteHandleKey< xAOD::PFOContainer > m_outChargedPFOKey
SG::WriteHandleKey< xAOD::PFOContainer > m_outNeutralPFOKey
SG::ReadHandleKey< xAOD::PFOContainer > m_inChargedPFOKey
SG::WriteHandleKey< xAOD::PFOContainer > m_outAllPFOKey
SG::WriteHandleKey< xAOD::TrackCaloClusterContainer > m_outTCCKey
SG::WriteHandleKey< xAOD::FlowElementContainer > m_outAllFEKey
SG::WriteHandleKey< xAOD::FlowElementContainer > m_outNeutralFEKey
SG::ReadHandleKey< xAOD::TrackCaloClusterContainer > m_inTCCKey
SG::WriteHandleKey< xAOD::CaloClusterContainer > m_outClusterKey
SG::ReadHandleKey< xAOD::PFOContainer > m_inNeutralPFOKey
StatusCode copyModRecordFlowLike(const SG::ReadHandleKey< T > &, const SG::ReadHandleKey< T > &, const SG::WriteHandleKey< T > &, const SG::WriteHandleKey< T > &, const SG::WriteHandleKey< T > &) const
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_inClusterKey
SG::WriteHandleKey< xAOD::FlowElementContainer > m_outChargedFEKey
SG::ReadHandleKey< xAOD::FlowElementContainer > m_inNeutralFEKey
@ ParticleFlow
The object is a particle-flow object.
Definition ObjectType.h:41
@ FlowElement
The object is a track-calo-cluster.
Definition ObjectType.h:52
@ CaloCluster
The object is a calorimeter cluster.
Definition ObjectType.h:39
@ TrackCaloCluster
The object is a track-calo-cluster.
Definition ObjectType.h:51

◆ 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

◆ 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::Event 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::Event, 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::Event 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::Event, 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 JetConstituentModSequence::initialize ( void )
virtual

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 JetConstituentModSequence.cxx.

38 {
39 ATH_MSG_INFO("Initializing tool " << name() << "...");
40 ATH_MSG_DEBUG("initializing version with data handles");
41
42 ATH_CHECK( m_modifiers.retrieve() );
44
45 // Shallow copies are not supported for by-vertex jet reconstruction
46 if (m_byVertex){
47 m_saveAsShallow = false;
48 }
49
50#ifndef XAOD_ANALYSIS
51 ATH_CHECK( m_monTool.retrieve( DisableTool{m_monTool.empty()} ) );
52#endif
53
54 // Set and initialise DataHandleKeys only for the correct input type
55 // Die if the input type is unsupported
56 switch(m_inputType) {
58 {
61
62 ATH_CHECK(m_inClusterKey.initialize());
63 ATH_CHECK(m_outClusterKey.initialize());
64
65 for (auto& tool : m_modifiers) {
66 auto* base = dynamic_cast<JetConstituentModifierBase*>(tool.get());
67 if (base) {
68 base->setInputContainer(m_inClusterKey.key());
69 base->setOutputContainer(m_outClusterKey.key());
70 ATH_CHECK(base->configure_decor_handle_keys());
71 }
72 }
73
74 break;
75 }
77 {
78 std::string inputContainerBase = m_inputContainer;
79 std::string outputContainerBase = m_outputContainer;
80
81 // Know what the user means if they give the full input/output container name in this format
82 size_t pos = inputContainerBase.find("ParticleFlowObjects");
83 if(pos != std::string::npos) inputContainerBase.erase(pos);
84
85 pos = outputContainerBase.find("ParticleFlowObjects");
86 if(pos != std::string::npos) outputContainerBase.erase(pos);
87
88 m_inChargedPFOKey = inputContainerBase + "ChargedParticleFlowObjects";
89 m_inNeutralPFOKey = inputContainerBase + "NeutralParticleFlowObjects";
90
91 m_outChargedPFOKey = outputContainerBase + "ChargedParticleFlowObjects";
92 m_outNeutralPFOKey = outputContainerBase + "NeutralParticleFlowObjects";
93 m_outAllPFOKey = outputContainerBase + "ParticleFlowObjects";
94
95 ATH_CHECK(m_inChargedPFOKey.initialize());
96 ATH_CHECK(m_inNeutralPFOKey.initialize());
97 ATH_CHECK(m_outChargedPFOKey.initialize());
98 ATH_CHECK(m_outNeutralPFOKey.initialize());
99 ATH_CHECK(m_outAllPFOKey.initialize());
100
101 for (auto& tool : m_modifiers) {
102 auto* base = dynamic_cast<JetConstituentModifierBase*>(tool.get());
103 if (base) {
104 base->setInputChargedContainer(m_inChargedPFOKey.key());
105 base->setOutputChargedContainer(m_outChargedPFOKey.key());
106 base->setInputNeutralContainer(m_inNeutralPFOKey.key());
107 base->setOutputNeutralContainer(m_outNeutralPFOKey.key());
108 ATH_CHECK(base->configure_decor_handle_keys());
109 }
110 }
111
113
114 break;
115 }
116 break;
120
121 ATH_CHECK(m_inTCCKey.initialize());
122 ATH_CHECK(m_outTCCKey.initialize());
123 for (auto& tool : m_modifiers) {
124 auto* base = dynamic_cast<JetConstituentModifierBase*>(tool.get());
125 if (base) {
126 base->setInputContainer(m_inTCCKey.key());
127 base->setOutputContainer(m_outTCCKey.key());
128 ATH_CHECK(base->configure_decor_handle_keys());
129 }
130 }
131 break;
133 {
134 // TODO: This assumes a PFlow-style neutral and charged collection.
135 // More general FlowElements (e.g. CaloClusters) may necessitate a rework here later.
136
137 const std::string subString = "ParticleFlowObjects";
138 const std::string subStringCharged = "ChargedParticleFlowObjects";
139 const std::string subStringNeutral = "NeutralParticleFlowObjects";
140
141 std::string inputContainerBase = m_inputContainer;
142 std::string outputContainerBase = m_outputContainer;
143
144 m_inChargedFEKey = inputContainerBase;
145 m_inNeutralFEKey = inputContainerBase;
146
147 m_outChargedFEKey = outputContainerBase;
148 m_outNeutralFEKey = outputContainerBase;
149
150 //For both the input and output container basenames we first check if the string
151 //contains "ParticleFlowObjects". If it does we swap this for "ChargedParticleFlowObjects"
152 //and "NeutralParticleFlowObjects" respectively. If it doesn't we just append these two
153 //substrings to the end of the strings.
154
155 size_t pos = inputContainerBase.find(subString);
156 if(pos != std::string::npos) {
157 std::string inChargedString = m_inChargedFEKey.key();
158 m_inChargedFEKey = inChargedString.replace(pos,subString.size(),subStringCharged);
159 std::string inNeutralString = m_inNeutralFEKey.key();
160 m_inNeutralFEKey = inNeutralString.replace(pos,subString.size(),subStringNeutral);
161 }
162 else {
163 m_inChargedFEKey = inputContainerBase + subStringCharged;
164 m_inNeutralFEKey = inputContainerBase + subStringNeutral;
165 }
166
167 pos = outputContainerBase.find(subString);
168 if(pos != std::string::npos) {
169 std::string outChargedString = m_outChargedFEKey.key();
170 m_outChargedFEKey = outChargedString.replace(pos,subString.size(),subStringCharged);
171 std::string outNeutralString = m_outNeutralFEKey.key();
172 m_outNeutralFEKey = outNeutralString.replace(pos,subString.size(),subStringNeutral);
173 }
174 else{
175 m_outChargedFEKey = outputContainerBase + subStringCharged;
176 m_outNeutralFEKey = outputContainerBase + subStringNeutral;
177 }
178
179 //The all FE container is a bit different. If the input container base contains
180 //"ParticleFlowObjects" we do nothing, otherwise we add this string onto the end.
181 pos = outputContainerBase.find(subString);
182 if(pos == std::string::npos) m_outAllFEKey = outputContainerBase + subString;
183 else m_outAllFEKey = outputContainerBase;
184
185 ATH_CHECK(m_inChargedFEKey.initialize());
186 ATH_CHECK(m_inNeutralFEKey.initialize());
187
188 ATH_CHECK(m_outChargedFEKey.initialize());
189 ATH_CHECK(m_outNeutralFEKey.initialize());
190 ATH_CHECK(m_outAllFEKey.initialize());
191
192 for (auto& tool : m_modifiers) {
193 auto* base = dynamic_cast<JetConstituentModifierBase*>(tool.get());
194 if (base) {
195 base->setInputChargedContainer(m_inChargedFEKey.key());
196 base->setOutputChargedContainer(m_outChargedFEKey.key());
197 base->setInputNeutralContainer(m_inNeutralFEKey.key());
198 base->setOutputNeutralContainer(m_outNeutralFEKey.key());
199 ATH_CHECK(base->configure_decor_handle_keys());
200 }
201 }
202
203 // Prepend the FE input container name to the decorations
204 for (auto& key : m_inChargedFEDecorKeys) {
205 const std::string keyString = m_inChargedFEKey.key() + "." + key.key();
206 ATH_CHECK(key.assign(keyString));
207
208 }
209
210 for (auto& key : m_inNeutralFEDecorKeys) {
211 const std::string keyString = m_inNeutralFEKey.key() + "." + key.key();
212 ATH_CHECK(key.assign(keyString));
213 }
214
215 ATH_CHECK(m_inChargedFEDecorKeys.initialize());
216 ATH_CHECK(m_inNeutralFEDecorKeys.initialize());
217
219
220 break;
221 }
222 default:
223 ATH_MSG_ERROR(" Unsupported input type "<< m_inputType );
224 return StatusCode::FAILURE;
225 }
226
228
229 return StatusCode::SUCCESS;
230}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_INFO(x,...)
Gaudi::Property< std::string > m_outputContainer
SG::ReadDecorHandleKeyArray< xAOD::FlowElementContainer > m_inChargedFEDecorKeys
Gaudi::Property< std::string > m_inputContainer
SG::ReadDecorHandleKeyArray< xAOD::FlowElementContainer > m_inNeutralFEDecorKeys
std::string base
Definition hcg.cxx:83

◆ inputContainerNames()

int IJetExecuteTool::inputContainerNames ( std::vector< std::string > & connames)
virtualinherited

Method to return the list of input containers.

The names of required input containers are appended to connames. Returns nonzero for error. Default returns 0 and adds no names.

Definition at line 11 of file IJetExecuteTool.cxx.

11 {
12 return 0;
13}

◆ 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 }

◆ outputContainerNames()

int IJetExecuteTool::outputContainerNames ( std::vector< std::string > & connames)
virtualinherited

Method to return the list of output containers.

The names of produced output containers are appended to connames. Returns nonzero for error. Default returns 0 and adds no names.

Definition at line 17 of file IJetExecuteTool.cxx.

17 {
18 return 0;
19}

◆ 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()

void asg::AsgTool::print ( ) const
virtualinherited

Print the state of the tool.

Implements asg::IAsgTool.

Reimplemented in AsgHelloTool, HI::HIPileupTool, JetFromPseudojet, JetPileupLabelingTool, JetPseudojetRetriever, JetSubStructureMomentToolsBase, JetTruthLabelingTool, and KtDeltaRTool.

Definition at line 131 of file AsgTool.cxx.

131 {
132
133 ATH_MSG_INFO( "AsgTool " << name() << " @ " << this );
134 return;
135 }

◆ 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 368 of file AthCommonDataStore.h.

369 {
370 h.renounce();
372 }
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 352 of file AthCommonDataStore.h.

352 {
354 }

◆ 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 >, and AthCheckedComponent<::AthAlgTool >.

◆ 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 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_byVertex

Gaudi::Property<bool> JetConstituentModSequence::m_byVertex = {this, "DoByVertex", false, "True if we should match to each primary vertex, not just PV0"}
protected

Definition at line 65 of file JetConstituentModSequence.h.

65{this, "DoByVertex", false, "True if we should match to each primary vertex, not just PV0"};

◆ m_constituentCopyIndexKey

SG::WriteDecorHandleKey<xAOD::IParticleContainer> JetConstituentModSequence::m_constituentCopyIndexKey {this, "ConstituentCopyIndexKey", "ConstituentCopyIndex", "WriteDecorHandleKey for the constituent copy index"}
protected

Definition at line 110 of file JetConstituentModSequence.h.

110{this, "ConstituentCopyIndexKey", "ConstituentCopyIndex", "WriteDecorHandleKey for the constituent copy index"};

◆ m_detStore

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

Pointer to StoreGate (detector store by default).

Definition at line 381 of file AthCommonDataStore.h.

◆ m_evtStore

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

Pointer to StoreGate (event store by default).

Definition at line 378 of file AthCommonDataStore.h.

◆ m_inChargedFEDecorKeys

SG::ReadDecorHandleKeyArray<xAOD::FlowElementContainer> JetConstituentModSequence::m_inChargedFEDecorKeys {this, "InChargedFEDecorKeys", {}, "Dummy keys that force all neccessary charged FlowElement decorations to be applied before running this algorithm"}
protected

Definition at line 107 of file JetConstituentModSequence.h.

107{this, "InChargedFEDecorKeys", {}, "Dummy keys that force all neccessary charged FlowElement decorations to be applied before running this algorithm"};

◆ m_inChargedFEKey

SG::ReadHandleKey<xAOD::FlowElementContainer> JetConstituentModSequence::m_inChargedFEKey {this, "InChargedFEKey", "", "ReadHandleKey for modified Charged FlowElements"}
protected

Definition at line 97 of file JetConstituentModSequence.h.

97{this, "InChargedFEKey", "", "ReadHandleKey for modified Charged FlowElements"};

◆ m_inChargedPFOKey

SG::ReadHandleKey<xAOD::PFOContainer> JetConstituentModSequence::m_inChargedPFOKey {this, "InChargedPFOKey", "", "ReadHandleKey for modified Charged PFlow Objects"}
protected

Definition at line 89 of file JetConstituentModSequence.h.

89{this, "InChargedPFOKey", "", "ReadHandleKey for modified Charged PFlow Objects"};

◆ m_inClusterKey

SG::ReadHandleKey<xAOD::CaloClusterContainer> JetConstituentModSequence::m_inClusterKey {this, "InClusterKey", "", "ReadHandleKey for unmodified CaloClusters"}
protected

Definition at line 83 of file JetConstituentModSequence.h.

83{this, "InClusterKey", "", "ReadHandleKey for unmodified CaloClusters"};

◆ m_inNeutralFEDecorKeys

SG::ReadDecorHandleKeyArray<xAOD::FlowElementContainer> JetConstituentModSequence::m_inNeutralFEDecorKeys {this, "InNeutralFEDecorKeys", {}, "Dummy keys that force all neccessary neutral FlowElement decorations to be applied before running this algorithm"}
protected

Definition at line 108 of file JetConstituentModSequence.h.

108{this, "InNeutralFEDecorKeys", {}, "Dummy keys that force all neccessary neutral FlowElement decorations to be applied before running this algorithm"};

◆ m_inNeutralFEKey

SG::ReadHandleKey<xAOD::FlowElementContainer> JetConstituentModSequence::m_inNeutralFEKey {this, "InNeutralFEKey", "", "ReadHandleKey for modified Neutral FlowElements"}
protected

Definition at line 100 of file JetConstituentModSequence.h.

100{this, "InNeutralFEKey", "", "ReadHandleKey for modified Neutral FlowElements"};

◆ m_inNeutralPFOKey

SG::ReadHandleKey<xAOD::PFOContainer> JetConstituentModSequence::m_inNeutralPFOKey {this, "InNeutralPFOKey", "", "ReadHandleKey for modified Neutral PFlow Objects"}
protected

Definition at line 92 of file JetConstituentModSequence.h.

92{this, "InNeutralPFOKey", "", "ReadHandleKey for modified Neutral PFlow Objects"};

◆ m_inputContainer

Gaudi::Property<std::string> JetConstituentModSequence::m_inputContainer {this, "InputContainer", "", "The input container for the sequence"}
protected

Definition at line 63 of file JetConstituentModSequence.h.

63{this, "InputContainer", "", "The input container for the sequence"};

◆ m_inputType

unsigned short JetConstituentModSequence::m_inputType
protected

Definition at line 71 of file JetConstituentModSequence.h.

◆ m_inTCCKey

SG::ReadHandleKey<xAOD::TrackCaloClusterContainer> JetConstituentModSequence::m_inTCCKey {this, "InTCCKey", "", "ReadHandleKey for unmodified TrackCaloClusters"}
protected

Definition at line 86 of file JetConstituentModSequence.h.

86{this, "InTCCKey", "", "ReadHandleKey for unmodified TrackCaloClusters"};

◆ m_modifiers

ToolHandleArray<IJetConstituentModifier> JetConstituentModSequence::m_modifiers {this , "Modifiers" , {} , "List of constit modifier tools."}
protected

Definition at line 74 of file JetConstituentModSequence.h.

74{this , "Modifiers" , {} , "List of constit modifier tools."};

◆ m_monTool

ToolHandle<GenericMonitoringTool> JetConstituentModSequence::m_monTool {this,"MonTool","","Monitoring tool"}
protected

Definition at line 77 of file JetConstituentModSequence.h.

77{this,"MonTool","","Monitoring tool"};

◆ m_outAllFEKey

SG::WriteHandleKey<xAOD::FlowElementContainer> JetConstituentModSequence::m_outAllFEKey {this, "OutAllFEKey", "", "WriteHandleKey for all modified FlowElements"}
protected

Definition at line 103 of file JetConstituentModSequence.h.

103{this, "OutAllFEKey", "", "WriteHandleKey for all modified FlowElements"};

◆ m_outAllPFOKey

SG::WriteHandleKey<xAOD::PFOContainer> JetConstituentModSequence::m_outAllPFOKey {this, "OutAllPFOKey", "", "WriteHandleKey for all modified PFlow Objects"}
protected

Definition at line 95 of file JetConstituentModSequence.h.

95{this, "OutAllPFOKey", "", "WriteHandleKey for all modified PFlow Objects"};

◆ m_outChargedFEKey

SG::WriteHandleKey<xAOD::FlowElementContainer> JetConstituentModSequence::m_outChargedFEKey {this, "OutChargedFEKey", "", "WriteHandleKey for modified Charged FlowElements"}
protected

Definition at line 98 of file JetConstituentModSequence.h.

98{this, "OutChargedFEKey", "", "WriteHandleKey for modified Charged FlowElements"};

◆ m_outChargedPFOKey

SG::WriteHandleKey<xAOD::PFOContainer> JetConstituentModSequence::m_outChargedPFOKey {this, "OutChargedPFOKey", "", "WriteHandleKey for modified Charged PFlow Objects"}
protected

Definition at line 90 of file JetConstituentModSequence.h.

90{this, "OutChargedPFOKey", "", "WriteHandleKey for modified Charged PFlow Objects"};

◆ m_outClusterKey

SG::WriteHandleKey<xAOD::CaloClusterContainer> JetConstituentModSequence::m_outClusterKey {this, "OutClusterKey", "", "WriteHandleKey for modified CaloClusters"}
protected

Definition at line 84 of file JetConstituentModSequence.h.

84{this, "OutClusterKey", "", "WriteHandleKey for modified CaloClusters"};

◆ m_outNeutralFEKey

SG::WriteHandleKey<xAOD::FlowElementContainer> JetConstituentModSequence::m_outNeutralFEKey {this, "OutNeutralFEKey", "", "WriteHandleKey for modified Neutral FlowElements"}
protected

Definition at line 101 of file JetConstituentModSequence.h.

101{this, "OutNeutralFEKey", "", "WriteHandleKey for modified Neutral FlowElements"};

◆ m_outNeutralPFOKey

SG::WriteHandleKey<xAOD::PFOContainer> JetConstituentModSequence::m_outNeutralPFOKey {this, "OutNeutralPFOKey", "", "WriteHandleKey for modified Neutral PFlow Objects"}
protected

Definition at line 93 of file JetConstituentModSequence.h.

93{this, "OutNeutralPFOKey", "", "WriteHandleKey for modified Neutral PFlow Objects"};

◆ m_outputContainer

Gaudi::Property<std::string> JetConstituentModSequence::m_outputContainer = {this, "OutputContainer", "", "The output container for the sequence"}
protected

Definition at line 64 of file JetConstituentModSequence.h.

64{this, "OutputContainer", "", "The output container for the sequence"};

◆ m_outTCCKey

SG::WriteHandleKey<xAOD::TrackCaloClusterContainer> JetConstituentModSequence::m_outTCCKey {this, "OutTCCKey", "", "WriteHandleKey for modified TrackCaloClusters"}
protected

Definition at line 87 of file JetConstituentModSequence.h.

87{this, "OutTCCKey", "", "WriteHandleKey for modified TrackCaloClusters"};

◆ m_saveAsShallow

bool JetConstituentModSequence::m_saveAsShallow = true
protected

Definition at line 80 of file JetConstituentModSequence.h.

◆ m_varHandleArraysDeclared

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

Definition at line 387 of file AthCommonDataStore.h.

◆ m_vertexContainerKey

SG::ReadHandleKey<xAOD::VertexContainer> JetConstituentModSequence::m_vertexContainerKey {this, "VertexContainerKey", "PrimaryVertices", "Reconstructed primary vertex container name"}
protected

Definition at line 66 of file JetConstituentModSequence.h.

66{this, "VertexContainerKey", "PrimaryVertices", "Reconstructed primary vertex container name"};

◆ m_vhka

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

Definition at line 386 of file AthCommonDataStore.h.


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