ATLAS Offline Software
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 
19 namespace Analysis
20 {
21 
22 
24  { }
25 
27  : m_name (name)
28  { }
29 
30  void TrackConstituents::setName(NameType& name) {m_name = name;}
31 
32  NameType TrackConstituents::name() const { return m_name;}
33 
35  { return new TrackConstituents( *this );}
36 
37 
38  void TrackConstituents::set_track(const Rec::TrackParticleContainer* theContainer,
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 
57  void TrackConstituents::set_track(const Rec::TrackParticleContainer* theContainer,
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 
75  void TrackConstituents::set_constituent(const Rec::TrackParticleContainer* theContainer,
76  const Rec::TrackParticle* theTrack, double weight)
77  { this->set_track(theContainer, theTrack, weight); }
78 
79  void TrackConstituents::set_constituent(const Rec::TrackParticleContainer* theContainer,
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 
102  double TrackConstituents::getTrackWeight(const Rec::TrackParticle* theTrack) const
103  {
104  // from Navigable
105  return (this->contains(theTrack) )
106  ? this->getParameter(theTrack)
107  : 0.;
108  }
109 
110  double TrackConstituents::getTrackWeight(const Rec::TrackParticleContainer* theContainer,
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 }
Analysis::NameType
std::string NameType
string to identify the constituent
Definition: IConstituent.h:39
INavigable4Momentum.h
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
skel.it
it
Definition: skel.GENtoEVGEN.py:423
Analysis::TrackConstituents::index_type
Navigable< Rec::TrackParticleContainer, double >::external_index_type index_type
Definition: TrackConstituents.h:57
python.Utilities.clone
clone
Definition: Utilities.py:134
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
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
Analysis::TrackConstituents::TrackConstituents
TrackConstituents()
constructor
Definition: TrackConstituents.cxx:32
INavigable4MomentumCollection.h
contains
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition: hcg.cxx:111
TrackConstituents.h
Analysis::TrackConstituents::iterator
Navigable< Rec::TrackParticleContainer, double >::object_iter iterator
Definition: TrackConstituents.h:66
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::TrackConstituents
Class TrackConstituent: This is the implemntation of the TrackConstituents class for ParticleJet.
Definition: TrackConstituents.h:47
NameType
std::string NameType
Definition: JetINav4MomAssociation.h:29
index_type
unsigned int index_type
Definition: FPGATrackSimSGToRawHitsTool.h:37