ATLAS Offline Software
Loading...
Searching...
No Matches
TrackAssociation.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
9namespace Analysis
10{
11
14
17
19 {
20 return new TrackAssociation( *this );
21 }
22
24 const Rec::TrackParticle* theTrack, double weight)
25 {
26 double newWeight = weight;
27 // track already in collection
28 if ( this->contains(theTrack) )
29 {
30 // update weight
31 newWeight *= this->getTrackWeight(theTrack);
32 // remove the previous track
33 this->remove(theTrack);
34 }
35
36 // from Navigable base
37 this->putElement(theContainer,theTrack,newWeight);
38 }
39
41 const index_type& theIndex, double weight)
42 {
43 double newWeight = weight;
44 // track already in collection
45 if ( this->contains(theContainer,theIndex) )
46 {
47 // update weight
48 newWeight *= this->getTrackWeight(theContainer,theIndex);
49 // remove the previous track
50 this->remove(theContainer,theIndex);
51 }
52
53 // from Navigable base
54 this->putElement(theContainer,theIndex,newWeight);
55 }
56
58 const Rec::TrackParticle* theTrack, double weight)
59 {
60 this->set_track(theContainer, theTrack, weight);
61 }
62
64 const index_type& theIndex, double weight)
65 {
66 this->set_track(theContainer, theIndex, weight);
67 }
68
70 {
71 // from Navigable
72 return (this->contains(theTrack) )
73 ? this->getParameter(theTrack)
74 : 0.;
75 }
76
78 const index_type& theIndex) const
79 {
80 // from Navigable
81 return (this->contains(theContainer,theIndex))
82 ? this->getParameter(theContainer,theIndex)
83 : 0.;
84 }
85
86 std::vector<const Rec::TrackParticle*>* TrackAssociation::tracks() const
87 {
88 std::vector<const Rec::TrackParticle*>* tracks =
89 new std::vector<const Rec::TrackParticle*>();
90
91 for(iterator it = begin(); it!= end(); ++it)
92 tracks->push_back(*it);
93
94 return tracks;
95 }
96}
Navigable< Rec::TrackParticleContainer, double >::object_iter iterator
void set_association(const Rec::TrackParticleContainer *, const Rec::TrackParticle *, double weight=0.)
void set_track(const Rec::TrackParticleContainer *, const Rec::TrackParticle *, double weight=0.)
set method for tracks.
Navigable< Rec::TrackParticleContainer, double >::external_index_type index_type
JetAssociationBase * clone() const
double getTrackWeight(const Rec::TrackParticle *) const
std::vector< const Rec::TrackParticle * > * tracks() const
get a vector of trackparticles. user must delete the vector, but not constituents
void setName(const name_t &name)
const name_t & name() const
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.