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;
138 std::pair< std::unique_ptr<T>, std::unique_ptr<xAOD::ShallowAuxContainer> > newconstit =
144 auto handle = makeHandle(outKey, ctx);
145 ATH_CHECK(handle.record(std::move(newconstit.first), std::move(newconstit.second)));
149 return StatusCode::SUCCESS;
154 const EventContext& ctx = Gaudi::Hive::currentContext();
170 if(!inNeutralHandle.
isValid()){
172 << inNeutralKey.
key() <<
"\" and \""
173 << inChargedKey.
key() <<
"\"");
174 return StatusCode::FAILURE;
177 unsigned numNeutralCopies = 1;
181 if (!handle.isValid()){
183 return StatusCode::FAILURE;
187 if(vertices->
empty()){
188 ATH_MSG_WARNING(
" Failed to retrieve valid primary vertex container" );
189 return StatusCode::FAILURE;
191 numNeutralCopies =
static_cast<unsigned>(vertices->
size());
198 std::pair<std::unique_ptr<T>, std::unique_ptr<xAOD::ShallowAuxContainer> > chargedCopy =
204 std::move(chargedCopy.second)));
212 std::pair<std::unique_ptr<T>, std::unique_ptr<xAOD::ShallowAuxContainer> > neutralCopy =
214 neutralCopy.second->setShallowIO(
true);
218 std::move(neutralCopy.second)));
227 auto neutralCopies = std::make_unique<T>();
228 auto neutralCopiesAux = std::make_unique<xAOD::AuxContainerBase>();
229 neutralCopies->setStore(neutralCopiesAux.get());
233 for (
unsigned i = 0; i < numNeutralCopies; i++){
234 for (
const U* fe : *inNeutralHandle) {
236 neutralCopies->push_back(copy);
238 copyIndex(*copy) = i;
244 std::move(neutralCopiesAux))
252 (*outAllHandle).assign((*outNeutralHandle).begin(), (*outNeutralHandle).end());
253 (*outAllHandle).insert((*outAllHandle).end(),
254 (*outChargedHandle).begin(),
255 (*outChargedHandle).end());
259 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
SG::Accessor< T, ALLOC > Accessor
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.
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())
std::pair< std::unique_ptr< T >, std::unique_ptr< ShallowAuxContainer > > shallowCopyContainer(const T &cont, const EventContext &ctx)
Function making a shallow copy of a constant container.
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
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...