ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
MuonSegmentExtractor Class Reference

#include <MuonSegmentExtractor.h>

Inheritance diagram for MuonSegmentExtractor:
Collaboration diagram for MuonSegmentExtractor:

Public Member Functions

 MuonSegmentExtractor (const xAOD::MuonSegmentContainer *, const std::string &label="")
 
virtual ~MuonSegmentExtractor ()
 
virtual MuonSegmentExtractorclone () const override
 
virtual MuonSegmentExtractorghostClone () const override
 
virtual void addToJet (xAOD::Jet &, const std::vector< int > &indices) const override
 
virtual std::string toString (int level) const override
 
virtual bool checkIntegrity () const override
 

Private Attributes

const xAOD::MuonSegmentContainerm_originalParticles
 
std::string m_label
 

Detailed Description

Definition at line 17 of file MuonSegmentExtractor.h.

Constructor & Destructor Documentation

◆ MuonSegmentExtractor()

MuonSegmentExtractor::MuonSegmentExtractor ( const xAOD::MuonSegmentContainer ms,
const std::string &  label = "" 
)

Definition at line 11 of file MuonSegmentExtractor.cxx.

12  :
14 }

◆ ~MuonSegmentExtractor()

MuonSegmentExtractor::~MuonSegmentExtractor ( )
virtualdefault

Member Function Documentation

◆ addToJet()

void MuonSegmentExtractor::addToJet ( xAOD::Jet jet,
const std::vector< int > &  indices 
) const
overridevirtual

Implements IConstituentExtractor.

Definition at line 28 of file MuonSegmentExtractor.cxx.

29  {
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 }

◆ checkIntegrity()

bool MuonSegmentExtractor::checkIntegrity ( ) const
overridevirtual

Implements IConstituentExtractor.

Definition at line 62 of file MuonSegmentExtractor.cxx.

62  {
63  for(const auto *const ip: *m_originalParticles){
64  try{
65  ip->pz();
66  } catch(...) {
67  return false;
68  }
69  }
70  return true;
71 }

◆ clone()

MuonSegmentExtractor * MuonSegmentExtractor::clone ( ) const
overridevirtual

Implements IConstituentExtractor.

Definition at line 18 of file MuonSegmentExtractor.cxx.

18  {
19  // who is going to delete this?
20  return new MuonSegmentExtractor(*this);
21 }

◆ ghostClone()

MuonSegmentExtractor * MuonSegmentExtractor::ghostClone ( ) const
overridevirtual

Implements IConstituentExtractor.

Definition at line 23 of file MuonSegmentExtractor.cxx.

23  {
24  // who is going to delete this?
25  return new MuonSegmentExtractor(*this);
26 }

◆ toString()

std::string MuonSegmentExtractor::toString ( int  level) const
overridevirtual

Implements IConstituentExtractor.

Definition at line 42 of file MuonSegmentExtractor.cxx.

42  {
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 }

Member Data Documentation

◆ m_label

std::string MuonSegmentExtractor::m_label
private

Definition at line 35 of file MuonSegmentExtractor.h.

◆ m_originalParticles

const xAOD::MuonSegmentContainer* MuonSegmentExtractor::m_originalParticles
private

Definition at line 34 of file MuonSegmentExtractor.h.


The documentation for this class was generated from the following files:
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
Trk::indices
std::pair< long int, long int > indices
Definition: AlSymMatBase.h:24
xAOD::MuonSegment_v1
Class describing a MuonSegment.
Definition: MuonSegment_v1.h:33
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
MuonSegmentExtractor::m_originalParticles
const xAOD::MuonSegmentContainer * m_originalParticles
Definition: MuonSegmentExtractor.h:34
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
lumiFormat.i
int i
Definition: lumiFormat.py:85
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
MuonSegmentExtractor::MuonSegmentExtractor
MuonSegmentExtractor(const xAOD::MuonSegmentContainer *, const std::string &label="")
Definition: MuonSegmentExtractor.cxx:11
MuonSegmentExtractor::m_label
std::string m_label
Definition: MuonSegmentExtractor.h:35
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.