ATLAS Offline Software
Loading...
Searching...
No Matches
TrackConstituents.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 TrackConstituent.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
19namespace Analysis
20{
21
22
25
29
31
33
35 { return new TrackConstituents( *this );}
36
37
39 const Rec::TrackParticle* theTrack, double weight)
40 {
41 double newWeight = weight;
42 // track already in collection
43 if ( this->contains(theTrack) )
44 {
45 // update weight
46 newWeight *= this->getTrackWeight(theTrack);
47 // remove the previous track
48 this->remove(theTrack);
49 }
50
51 // from Navigable base
52 this->putElement(theContainer,theTrack,newWeight);
53
54
55 }
56
58 index_type& theIndex, double weight)
59 {
60 double newWeight = weight;
61 // track already in collection
62 if ( this->contains(theContainer,theIndex) )
63 {
64 // update weight
65 newWeight *= this->getTrackWeight(theContainer,theIndex);
66 // remove the previous track
67 this->remove(theContainer,theIndex);
68 }
69
70 // from Navigable base
71 this->putElement(theContainer,theIndex,newWeight);
72
73 }
74
76 const Rec::TrackParticle* theTrack, double weight)
77 { this->set_track(theContainer, theTrack, weight); }
78
80 index_type& theIndex, double weight)
81 { this->set_track(theContainer, theIndex, weight); }
82
83/* void TrackConstituents::set_track(const INavigable4MomentumCollection* theContainer,
84 const INavigable4Momentum* theTrack, double weight)
85 {
86 double newWeight = weight;
87 // track already in collection
88 if ( this->contains(theTrack) )
89 {
90 // update weight
91 newWeight *= this->getTrackWeight(theTrack);
92 // remove the previous track
93 this->remove(theTrack);
94 }
95
96 // from Navigable base
97 this->putElement(theContainer,theTrack,newWeight);
98
99
100 }*/
101
103 {
104 // from Navigable
105 return (this->contains(theTrack) )
106 ? this->getParameter(theTrack)
107 : 0.;
108 }
109
111 index_type& theIndex) const
112 {
113 // from Navigable
114 return (this->contains(theContainer,theIndex))
115 ? this->getParameter(theContainer,theIndex)
116 : 0.;
117 }
118
119 std::vector<const Rec::TrackParticle*>* TrackConstituents::tracks() const
120 {
121 std::vector<const Rec::TrackParticle*>* tracks =
122 new std::vector<const Rec::TrackParticle*>();
123
124 for(iterator it = begin(); it!= end(); ++it)
125 tracks->push_back(*it);
126
127 return tracks;
128 }
129
130}
Class IConstituent: This is the abstract base class for additional jet constituents to be put into th...
virtual void setName(NameType &name)
to set the name
virtual NameType name() const
returns the infoType of the info objects.
std::vector< const Rec::TrackParticle * > * tracks() const
get a vector of trackparticles. user must delete the vector, but not constituents
double getTrackWeight(const Rec::TrackParticle *) const
virtual IConstituent * clone() const
a clone method for the proper workings of the copy constructor
Navigable< Rec::TrackParticleContainer, double >::external_index_type index_type
Navigable< Rec::TrackParticleContainer, double >::object_iter iterator
void set_constituent(const Rec::TrackParticleContainer *, const Rec::TrackParticle *, double weight=0.)
set method for tracks.
void set_track(const Rec::TrackParticleContainer *, const Rec::TrackParticle *, double weight=0.)
set method for tracks.
bool remove(const constituent_type *aConstituent)
void putElement(const Rec::TrackParticleContainer *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
The namespace of all packages in PhysicsAnalysis/JetTagging.
std::string NameType
string to identify the constituent