9#ifndef JETRECTOOLS_JETCONSTITUENTMODSEQUENCE_H
10#define JETRECTOOLS_JETCONSTITUENTMODSEQUENCE_H
61 Gaudi::Property<std::string>
m_inputContainer {
this,
"InputContainer",
"",
"The input container for the sequence"};
62 Gaudi::Property<std::string>
m_outputContainer = {
this,
"OutputContainer",
"",
"The output container for the sequence"};
63 Gaudi::Property<bool>
m_byVertex = {
this,
"DoByVertex",
false,
"True if we should match to each primary vertex, not just PV0"};
72 ToolHandleArray<IJetConstituentModifier>
m_modifiers{this ,
"Modifiers" , {} ,
"List of constit modifier tools."};
75 ToolHandle<GenericMonitoringTool>
m_monTool{
this,
"MonTool",
"",
"Monitoring tool"};
115 template<
class T,
class U>
125 const EventContext& ctx = Gaudi::Hive::currentContext();
132 auto inHandle = makeHandle(inKey, ctx);
133 if(!inHandle.isValid()){
135 return StatusCode::FAILURE;
143 auto handle = makeHandle(outKey, ctx);
144 ATH_CHECK(handle.record(std::move(newconstit.first), std::move(newconstit.second)));
148 return StatusCode::SUCCESS;
153 const EventContext& ctx = Gaudi::Hive::currentContext();
169 if(!inNeutralHandle.
isValid()){
171 << inNeutralKey.
key() <<
"\" and \""
172 << inChargedKey.
key() <<
"\"");
173 return StatusCode::FAILURE;
176 unsigned numNeutralCopies = 1;
180 if (!handle.isValid()){
182 return StatusCode::FAILURE;
186 if(vertices->
empty()){
187 ATH_MSG_WARNING(
" Failed to retrieve valid primary vertex container" );
188 return StatusCode::FAILURE;
190 numNeutralCopies =
static_cast<unsigned>(vertices->
size());
203 std::move(chargedCopy.second)));
213 neutralCopy.second->setShallowIO(
true);
217 std::move(neutralCopy.second)));
223 const SG::AuxElement::Accessor<unsigned> copyIndex(
"ConstituentCopyIndex");
226 auto neutralCopies = std::make_unique<T>();
227 auto neutralCopiesAux = std::make_unique<xAOD::AuxContainerBase>();
228 neutralCopies->setStore(neutralCopiesAux.get());
232 for (
unsigned i = 0; i < numNeutralCopies; i++){
233 for (
const U* fe : *inNeutralHandle) {
235 neutralCopies->push_back(copy);
237 copyIndex(*copy) = i;
243 std::move(neutralCopiesAux))
251 (*outAllHandle).assign((*outNeutralHandle).begin(), (*outNeutralHandle).end());
252 (*outAllHandle).insert((*outAllHandle).end(),
253 (*outChargedHandle).begin(),
254 (*outChargedHandle).end());
258 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
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
Gaudi::Property< bool > m_byVertex
SG::WriteHandleKey< xAOD::PFOContainer > m_outChargedPFOKey
Gaudi::Property< std::string > m_outputContainer
SG::WriteHandleKey< xAOD::PFOContainer > m_outNeutralPFOKey
SG::ReadHandleKey< xAOD::PFOContainer > m_inChargedPFOKey
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainerKey
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::ReadDecorHandleKeyArray< xAOD::FlowElementContainer > m_inChargedFEDecorKeys
SG::ReadHandleKey< xAOD::TrackCaloClusterContainer > m_inTCCKey
unsigned short m_inputType
int execute() const
Method to be called for each event.
JetConstituentModSequence(const std::string &name)
StatusCode initialize()
Dummy implementation of the initialisation function.
ToolHandleArray< IJetConstituentModifier > m_modifiers
Gaudi::Property< std::string > m_inputContainer
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::ReadDecorHandleKeyArray< xAOD::FlowElementContainer > m_inNeutralFEDecorKeys
SG::WriteHandleKey< xAOD::FlowElementContainer > m_outChargedFEKey
SG::ReadHandleKey< xAOD::FlowElementContainer > m_inNeutralFEKey
Property holding a SG store/key/clid from which a ReadHandle is made.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const std::string & key() const
Return the StoreGate ID for the referenced object.
Property holding a SG store/key/clid from which a WriteHandle is made.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
::StatusCode StatusCode
StatusCode definition for legacy code.
DecorHandleKeyArray< ReadDecorHandle< T, S >, ReadDecorHandleKey< T >, Gaudi::DataHandle::Reader > ReadDecorHandleKeyArray
@ 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())
typename ShallowCopyResult< T >::type ShallowCopyResult_t
Return type of xAOD::shallowCopy.
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
ShallowCopyResult_t< T > shallowCopy(const T &cont, const EventContext &ctx)
Create a shallow copy of an existing container.
bool setOriginalObjectLink(const IParticle &original, IParticle ©)
This function should be used by CP tools when they make a deep copy of an object in their correctedCo...