ATLAS Offline Software
Loading...
Searching...
No Matches
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
18namespace Analysis
19{
20
25
26
28
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
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
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
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}
virtual NameType name() const
returns the infoType of the info objects.
virtual void setName(NameType &name)
method to set the name
virtual IConstituent * clone() const
a clone method for the proper workings of the copy constructor
const Electron * electron() const
get electron directly without token
Navigable< ElectronContainer, double >::external_index_type index_type
void set_electron(const ElectronContainer *theContainer, const Electron *the_electron, double weight=1)
double getElectronWeight(const Electron *the_electron) const
ElectronConstituent()=default
Default constructor.
Class IConstituent: This is the abstract base class for additional jet constituents to be put into th...
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 ElectronContainer *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