ATLAS Offline Software
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 
8 namespace Analysis
9 {
10 
11 
13  { }
14 
16  { this->setName(name); }
17 
19  { return new MuonAssociation( *this );}
20 
21  const Muon* MuonAssociation::muon() const
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 
79  double MuonAssociation::getMuonWeight(const MuonContainer* theContainer,
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 }
JetAssociationBase::NameType
name_t NameType
Definition: JetAssociationBase.h:29
Navigable< MuonContainer, double >::getConstituentPtr
virtual const constituent_type * getConstituentPtr(constituent_iter iter) const
Navigable< MuonContainer, double >::putElement
void putElement(const MuonContainer *objectContainer, const constituent_type *constituentObject, const double &objectParameter=double(), size_t sizeHint=0)
Analysis::MuonAssociation::MuonAssociation
MuonAssociation()
constructor
Definition: MuonAssociation.cxx:12
Navigable< MuonContainer, double >::begin
virtual object_iter begin() const
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:45
Navigable< MuonContainer, double >::contains
bool contains(const constituent_type *aConstituent) const
JetAssociationBase::setName
void setName(const name_t &name)
Definition: JetAssociationBase.cxx:15
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:190
Navigable< MuonContainer, double >::getConstituents
const constituent_coll & getConstituents() const
Definition: Navigable.h:290
Navigable< MuonContainer, double >::remove
bool remove(const constituent_type *aConstituent)
Analysis::MuonContainer
definition of StoreGate container holding a vector of Analysis::Muon
Definition: Reconstruction/MuonIdentification/muonEvent/muonEvent/MuonContainer.h:38
JetAssociationBase
Definition: JetAssociationBase.h:21
Analysis::MuonAssociation::index_type
Navigable< MuonContainer, double >::external_index_type index_type
Definition: MuonAssociation.h:27
Analysis::MuonAssociation::clone
virtual JetAssociationBase * clone() const
a clone method for the proper workings of the copy constructor
Definition: MuonAssociation.cxx:18
Analysis
The namespace of all packages in PhysicsAnalysis/JetTagging.
Definition: BTaggingCnvAlg.h:20
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
MuonAssociation.h
Navigable< MuonContainer, double >::getParameter
double getParameter(const constituent_type *aConstituent) const
Navigable< MuonContainer, double >::size
virtual unsigned int size() const
Analysis::MuonAssociation::set_muon
void set_muon(const MuonContainer *theContainer, const Muon *the_muon, double weight=1)
Definition: MuonAssociation.cxx:33
Analysis::MuonAssociation::muon
const Muon * muon() const
get muon directly without token
Definition: MuonAssociation.cxx:21
Analysis::MuonAssociation::getMuonWeight
double getMuonWeight(const Muon *the_muon) const
Definition: MuonAssociation.cxx:71