ATLAS Offline Software
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 
9 namespace Analysis
10 {
11 
13  { }
14 
16  { this->setName(name); }
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 }
Analysis::TrackAssociation::index_type
Navigable< Rec::TrackParticleContainer, double >::external_index_type index_type
Definition: TrackAssociation.h:20
Analysis::TrackAssociation::set_association
void set_association(const Rec::TrackParticleContainer *, const Rec::TrackParticle *, double weight=0.)
Definition: TrackAssociation.cxx:57
Navigable< Rec::TrackParticleContainer, double >::putElement
void putElement(const Rec::TrackParticleContainer *objectContainer, const constituent_type *constituentObject, const double &objectParameter=double(), size_t sizeHint=0)
INavigable4Momentum.h
TrackAssociation.h
Analysis::TrackAssociation::tracks
std::vector< const Rec::TrackParticle * > * tracks() const
get a vector of trackparticles. user must delete the vector, but not constituents
Definition: TrackAssociation.cxx:86
skel.it
it
Definition: skel.GENtoEVGEN.py:423
Navigable< Rec::TrackParticleContainer, double >::begin
virtual object_iter begin() const
Navigable< Rec::TrackParticleContainer, double >::contains
bool contains(const constituent_type *aConstituent) const
Navigable< Rec::TrackParticleContainer, double >::end
virtual object_iter end() const
Analysis::TrackAssociation::clone
JetAssociationBase * clone() const
Definition: TrackAssociation.cxx:18
JetAssociationBase::setName
void setName(const name_t &name)
Definition: JetAssociationBase.cxx:15
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
Navigable< Rec::TrackParticleContainer, double >::remove
bool remove(const constituent_type *aConstituent)
INavigable4MomentumCollection.h
Analysis::TrackAssociation::TrackAssociation
TrackAssociation()
constructor
Definition: TrackAssociation.cxx:12
JetAssociationBase
Definition: JetAssociationBase.h:21
Analysis::TrackAssociation::set_track
void set_track(const Rec::TrackParticleContainer *, const Rec::TrackParticle *, double weight=0.)
set method for tracks.
Definition: TrackAssociation.cxx:23
Analysis
The namespace of all packages in PhysicsAnalysis/JetTagging.
Definition: BTaggingCnvAlg.h:20
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
Rec::TrackParticleContainer
Definition: Reconstruction/Particle/Particle/TrackParticleContainer.h:33
Rec::TrackParticle
Definition: Reconstruction/Particle/Particle/TrackParticle.h:47
Analysis::TrackAssociation::getTrackWeight
double getTrackWeight(const Rec::TrackParticle *) const
Definition: TrackAssociation.cxx:69
Navigable< Rec::TrackParticleContainer, double >::getParameter
double getParameter(const constituent_type *aConstituent) const
Analysis::TrackAssociation::iterator
Navigable< Rec::TrackParticleContainer, double >::object_iter iterator
Definition: TrackAssociation.h:30
Analysis::TrackAssociation::NameType
std::string NameType
Definition: TrackAssociation.h:23