ATLAS Offline Software
Loading...
Searching...
No Matches
MuonSegmentExtractor.cxx
Go to the documentation of this file.
1// this file is -*- C++ -*-
2
3/*
4 Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
5*/
6
9#include <vector>
10
15
17
19 // who is going to delete this?
20 return new MuonSegmentExtractor(*this);
21}
22
24 // who is going to delete this?
25 return new MuonSegmentExtractor(*this);
26}
27
29 const std::vector<int>& indices) const{
30
31 std::vector<const xAOD::MuonSegment*> constituents;
32 constituents.reserve(indices.size());
33 for(auto i : indices){constituents.push_back((*m_originalParticles)[i]);}
34
35 // MuonSegments are always ghosts
36
37 jet.setAssociatedObjects(m_label, constituents);
38 jet.setAttribute<int>(m_label+"Count", constituents.size());
39}
40
41
42std::string MuonSegmentExtractor::toString(int level) const {
43 std::ostringstream oss{"", std::ios::ate};
44 oss << "MuonSegmentExtractor dump level(" << level << ")"
45 << " label " << m_label
46 << " isGhost " << std::boolalpha << true // muon segments ar always ghost
47 << " No of MuonSegments: " << m_originalParticles->size();
48
49 if (level > 0){
50 oss << "\n MuonSegment momenta\n";
51 std::for_each(m_originalParticles->begin(),
53 [&oss](const xAOD::MuonSegment* p){
54 oss << p->px() << " " << p->py() << " " << p->pz() << '\n';});
55 }
56
57 return oss.str();
58}
59
60
61
63 for(const auto *const ip: *m_originalParticles){
64 try{
65 ip->pz();
66 } catch(...) {
67 return false;
68 }
69 }
70 return true;
71}
virtual bool checkIntegrity() const override
const xAOD::MuonSegmentContainer * m_originalParticles
virtual MuonSegmentExtractor * ghostClone() const override
virtual void addToJet(xAOD::Jet &, const std::vector< int > &indices) const override
virtual MuonSegmentExtractor * clone() const override
virtual ~MuonSegmentExtractor()
MuonSegmentExtractor(const xAOD::MuonSegmentContainer *, const std::string &label="")
virtual std::string toString(int level) const override
std::string label(const std::string &format, int i)
Definition label.h:19
Jet_v1 Jet
Definition of the current "jet version".
MuonSegmentContainer_v1 MuonSegmentContainer
Definition of the current "MuonSegment container version".
MuonSegment_v1 MuonSegment
Reference the current persistent version: