ATLAS Offline Software
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 
18 namespace Analysis
19 {
20 
21 
23  { }
24 
26  : m_name (name)
27  { }
28 
29  void MuonConstituent::setName(NameType& name) {m_name = name;}
30 
31  NameType MuonConstituent::name() const { return m_name;}
32 
34  { return new MuonConstituent( *this );}
35 
36  const Muon* MuonConstituent::muon() const
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 
94  double MuonConstituent::getMuonWeight(const MuonContainer* theContainer,
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 }
Analysis::NameType
std::string NameType
string to identify the constituent
Definition: IConstituent.h:39
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:195
MuonConstituent.h
Analysis::MuonConstituent::MuonConstituent
MuonConstituent()
constructor
Definition: MuonConstituent.cxx:31
xAOD::MuonContainer
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
Definition: Event/xAOD/xAODMuon/xAODMuon/MuonContainer.h:14
Analysis::IConstituent
Class IConstituent: This is the abstract base class for additional jet constituents to be put into th...
Definition: IConstituent.h:52
Analysis::MuonConstituent
Class MuonConstituent: This is the implemntation of the MuonConstituent class for ParticleJet.
Definition: MuonConstituent.h:53
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:45
python.Utilities.clone
clone
Definition: Utilities.py:134
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
PixelConditionsData::getParameter
std::vector< T > getParameter(const std::string &varName, const std::vector< std::string > &buffer)
Definition: PixelConditionsDataStringUtils.h:51
PixelModuleFeMask_create_db.remove
string remove
Definition: PixelModuleFeMask_create_db.py:83
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
contains
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition: hcg.cxx:111
Analysis::MuonContainer
definition of StoreGate container holding a vector of Analysis::Muon
Definition: Reconstruction/MuonIdentification/muonEvent/muonEvent/MuonContainer.h:38
Analysis::MuonConstituent::index_type
Navigable< MuonContainer, double >::external_index_type index_type
Definition: MuonConstituent.h:55
Analysis
The namespace of all packages in PhysicsAnalysis/JetTagging.
Definition: BTaggingCnvAlg.h:20
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
NameType
std::string NameType
Definition: JetINav4MomAssociation.h:29
index_type
unsigned int index_type
Definition: FPGATrackSimSGToRawHitsTool.h:37