ATLAS Offline Software
ElectronConstituent.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  ElectronConstituents.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 
22  : m_name (name)
23 {
24 }
25 
26 
27  void ElectronConstituent::setName(NameType& name) {m_name = name;}
28 
29  NameType ElectronConstituent::name() const { return m_name;}
30 
32  { return new ElectronConstituent( *this );}
33 
35  {
36  //get electron from Navigable
37  if (this->size() ==0)
38  return nullptr;
39  if (this->size() > 1)
40  return nullptr;
41  // this shouldn't happen
42  else
43  return getConstituentPtr((this->getConstituents()).begin());
44  }
45 
46  void ElectronConstituent::set_electron(const ElectronContainer* theContainer,
47  const Electron* the_electron,
48  double weight)
49  {
50  double newWeight = weight;
51  // electron already in collection
52  if ( this->contains(the_electron) )
53  {
54  // update weight
55  newWeight *= this->getElectronWeight(the_electron);
56  // remove the previous electron
57  this->remove(the_electron);
58  }
59 
60  // from Navigable base
61  this->putElement(theContainer,the_electron,newWeight);
62 
63  }
64 
65  void ElectronConstituent::set_electron(const ElectronContainer* theContainer,
66  index_type& theIndex,
67  double weight)
68  {
69  double newWeight = weight;
70  // electron already in collection
71  if ( this->contains(theContainer,theIndex) )
72  {
73  // update weight
74  newWeight *= this->getElectronWeight(theContainer,theIndex);
75  // remove the previous electron
76  this->remove(theContainer,theIndex);
77  }
78 
79  // from Navigable base
80  this->putElement(theContainer,theIndex,newWeight);
81 
82  }
83 
84  double ElectronConstituent::getElectronWeight(const Electron* the_electron) const
85  {
86  // from Navigable
87  return (this->contains(the_electron) )
88  ? this->getParameter(the_electron)
89  : 0.;
90  }
91 
92  double ElectronConstituent::getElectronWeight(const ElectronContainer* theContainer,
93  index_type& theIndex) const
94  {
95  // from Navigable
96  return (this->contains(theContainer,theIndex))
97  ? this->getParameter(theContainer,theIndex)
98  : 0.;
99  }
100 
101 
102 }
Analysis::IConstituent
Class IConstituent: This is the abstract base class for additional jet constituents to be put into th...
Definition: IConstituent.h:52
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
Analysis::Electron
Definition: Reconstruction/egamma/egammaEvent/egammaEvent/Electron.h:20
Analysis::ElectronConstituent::ElectronConstituent
ElectronConstituent()=default
Default constructor.
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
ElectronConstituent.h
Analysis::ElectronConstituent
Definition: ElectronConstituent.h:54
contains
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition: hcg.cxx:111
Analysis::ElectronConstituent::index_type
Navigable< ElectronContainer, double >::external_index_type index_type
Definition: ElectronConstituent.h:56
Analysis
The namespace of all packages in PhysicsAnalysis/JetTagging.
Definition: BTaggingCnvAlg.h:20
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Electron
Class describing an electron.
xAOD::EgammaParameters::electron
@ electron
Definition: EgammaEnums.h:18
ElectronContainer
Definition: Reconstruction/egamma/egammaEvent/egammaEvent/ElectronContainer.h:32
NameType
std::string NameType
Definition: JetINav4MomAssociation.h:29
index_type
unsigned int index_type
Definition: FPGATrackSimSGToRawHitsTool.h:37