ATLAS Offline Software
Loading...
Searching...
No Matches
MuonAssociation.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7
8namespace Analysis
9{
10
11
14
17
19 { return new MuonAssociation( *this );}
20
22 {
23 //get muon from Navigable
24 if (this->size() ==0)
25 return 0;
26 else if (this->size() > 1)
27 return 0;
28 // this shouldn't happen
29 else
30 return getConstituentPtr((this->getConstituents()).begin());
31 }
32
33 void MuonAssociation::set_muon(const MuonContainer* theContainer,
34 const Muon* the_muon,
35 double weight)
36 {
37 double newWeight = weight;
38 // muon already in collection
39 if ( this->contains(the_muon) )
40 {
41 // update weight
42 newWeight *= this->getMuonWeight(the_muon);
43 // remove the previous muon
44 this->remove(the_muon);
45 }
46
47 // from Navigable base
48 this->putElement(theContainer,the_muon,newWeight);
49
50 }
51
52 void MuonAssociation::set_muon(const MuonContainer* theContainer,
53 const index_type& theIndex,
54 double weight)
55 {
56 double newWeight = weight;
57 // muon already in collection
58 if ( this->contains(theContainer,theIndex) )
59 {
60 // update weight
61 newWeight *= this->getMuonWeight(theContainer,theIndex);
62 // remove the previous muon
63 this->remove(theContainer,theIndex);
64 }
65
66 // from Navigable base
67 this->putElement(theContainer,theIndex,newWeight);
68
69 }
70
71 double MuonAssociation::getMuonWeight(const Muon* the_muon) const
72 {
73 // from Navigable
74 return (this->contains(the_muon) )
75 ? this->getParameter(the_muon)
76 : 0.;
77 }
78
80 const index_type& theIndex) const
81 {
82 // from Navigable
83 return (this->contains(theContainer,theIndex))
84 ? this->getParameter(theContainer,theIndex)
85 : 0.;
86 }
87
88
89}
Navigable< MuonContainer, double >::external_index_type index_type
const Muon * muon() const
get muon directly without token
void set_muon(const MuonContainer *theContainer, const Muon *the_muon, double weight=1)
double getMuonWeight(const Muon *the_muon) const
virtual JetAssociationBase * clone() const
a clone method for the proper workings of the copy constructor
definition of StoreGate container holding a vector of Analysis::Muon
void setName(const name_t &name)
const name_t & name() const
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.
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.