ATLAS Offline Software
Loading...
Searching...
No Matches
MuonConstituent.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5/***************************************************************************
6 MuonConstituents.h - Description
7 -------------------
8 begin : January, 2005
9 authors : Kyle Cranmer, Andreas Wildauer
10 email : cranmer@cern.ch, andreas.wildauer@cern.ch
11
12 changes :
13
14***************************************************************************/
15
17
18namespace Analysis
19{
20
21
24
28
30
32
34 { return new MuonConstituent( *this );}
35
37 {
38 //get muon from Navigable
39 if (this->size() ==0)
40 return 0;
41 else if (this->size() > 1)
42 return 0;
43 // this shouldn't happen
44 else
45 return getConstituentPtr((this->getConstituents()).begin());
46 }
47
48 void MuonConstituent::set_muon(const MuonContainer* theContainer,
49 const Muon* the_muon,
50 double weight)
51 {
52 double newWeight = weight;
53 // muon already in collection
54 if ( this->contains(the_muon) )
55 {
56 // update weight
57 newWeight *= this->getMuonWeight(the_muon);
58 // remove the previous muon
59 this->remove(the_muon);
60 }
61
62 // from Navigable base
63 this->putElement(theContainer,the_muon,newWeight);
64
65 }
66
67 void MuonConstituent::set_muon(const MuonContainer* theContainer,
68 index_type& theIndex,
69 double weight)
70 {
71 double newWeight = weight;
72 // muon already in collection
73 if ( this->contains(theContainer,theIndex) )
74 {
75 // update weight
76 newWeight *= this->getMuonWeight(theContainer,theIndex);
77 // remove the previous muon
78 this->remove(theContainer,theIndex);
79 }
80
81 // from Navigable base
82 this->putElement(theContainer,theIndex,newWeight);
83
84 }
85
86 double MuonConstituent::getMuonWeight(const Muon* the_muon) const
87 {
88 // from Navigable
89 return (this->contains(the_muon) )
90 ? this->getParameter(the_muon)
91 : 0.;
92 }
93
95 index_type& theIndex) const
96 {
97 // from Navigable
98 return (this->contains(theContainer,theIndex))
99 ? this->getParameter(theContainer,theIndex)
100 : 0.;
101 }
102
103
104}
Class IConstituent: This is the abstract base class for additional jet constituents to be put into th...
const Muon * muon() const
get muon directly without token
virtual void setName(NameType &name)
to set the name
virtual IConstituent * clone() const
a clone method for the proper workings of the copy constructor
double getMuonWeight(const Muon *the_muon) const
virtual NameType name() const
returns the infoType of the info objects.
void set_muon(const MuonContainer *theContainer, const Muon *the_muon, double weight=1)
Navigable< MuonContainer, double >::external_index_type index_type
definition of StoreGate container holding a vector of Analysis::Muon
const constituent_coll & getConstituents() const
Definition Navigable.h:290
virtual unsigned int size() const
virtual object_iter begin() const
bool remove(const constituent_type *aConstituent)
void putElement(const MuonContainer *objectContainer, const constituent_type *constituentObject, const double &objectParameter=double(), size_t sizeHint=0)
double getParameter(const constituent_type *aConstituent) const
bool contains(const constituent_type *aConstituent) const
virtual const constituent_type * getConstituentPtr(constituent_iter iter) const
The namespace of all packages in PhysicsAnalysis/JetTagging.
std::string NameType
string to identify the constituent
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.