ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
PESA::T2TrackClusterer Class Reference

#include <T2TrackClusterer.h>

Collaboration diagram for PESA::T2TrackClusterer:

Public Types

enum  TrackPerigee { perigee_original, perigee_beamspot, perigee_beamline }
 
using TrackVector = std::vector< const Trk::Track * >
 

Public Member Functions

 T2TrackClusterer (double deltaZ=10.*Gaudi::Units::mm, double minPT=1.*Gaudi::Units::GeV, bool weightedZ=true, unsigned maxSize=10000., TrackPerigee trackPerigee=perigee_original)
 
const TrackVectorcluster (const TrackVector &tracks, const InDet::BeamSpotData *beamspot=nullptr)
 Find one cluster in a set of tracks. More...
 
double seedZ0 () const
 Z0 position of a seed track that was used for clustering. More...
 
double totalZ0Err () const
 Uncertainty of Z0 position of a cluster. More...
 
const TrackVectorclusterTracks () const
 This is the same vector as returned from clustering method, have to be called after return from a clustering method. More...
 
const TrackVectorunusedTracks () const
 Tracks that were not included into cluster, have to be called after return from a clustering method. More...
 

Static Public Member Functions

static TrackPerigee trackPerigeeFromString (const std::string &perigeeStr)
 

Private Member Functions

double trackWeight (const Trk::Track &track) const
 
double trackPerigeeZ0 (const Trk::Track &track, const InDet::BeamSpotData *beamspot) const
 

Private Attributes

const double m_deltaZ
 
const double m_minPT
 
const bool m_weightedZ
 
const unsigned m_maxSize
 
const TrackPerigee m_trackPerigee = perigee_original
 
double m_seedZ0 = 0.
 
double m_totalZ0Err = 0.
 
TrackVector m_cluster
 
TrackVector m_unusedTracks
 

Detailed Description

Definition at line 41 of file T2TrackClusterer.h.

Member Typedef Documentation

◆ TrackVector

Definition at line 45 of file T2TrackClusterer.h.

Member Enumeration Documentation

◆ TrackPerigee

Enumerator
perigee_original 
perigee_beamspot 
perigee_beamline 

Definition at line 48 of file T2TrackClusterer.h.

48  {
49  perigee_original, // Use original track perigee parameters, usually means
50  // perigee w.r.t. coordinate system origin x,y=0,0
51  perigee_beamspot, // Perigee to a beamspot position, ignoring tilt
52  perigee_beamline, // Perigee to a beam line, including tilt
53  };

Constructor & Destructor Documentation

◆ T2TrackClusterer()

PESA::T2TrackClusterer::T2TrackClusterer ( double  deltaZ = 10.*Gaudi::Units::mm,
double  minPT = 1.*Gaudi::Units::GeV,
bool  weightedZ = true,
unsigned  maxSize = 10000.,
TrackPerigee  trackPerigee = perigee_original 
)
inline

Definition at line 59 of file T2TrackClusterer.h.

62  : m_deltaZ ( deltaZ )
63  , m_minPT ( minPT )
64  , m_weightedZ ( weightedZ )
65  , m_maxSize ( maxSize )
66  , m_trackPerigee( trackPerigee )
67  {}

Member Function Documentation

◆ cluster()

const T2TrackClusterer::TrackVector & T2TrackClusterer::cluster ( const TrackVector tracks,
const InDet::BeamSpotData beamspot = nullptr 
)

Find one cluster in a set of tracks.

If beamspot is nullptr then clustering is done with "perigee_original" option, otherwise perigee option provided in a constructor is used.

Definition at line 50 of file T2TrackClusterer.cxx.

51 {
52  m_seedZ0 = 0.;
53  m_totalZ0Err = 0.;
54  m_cluster.clear();
55  m_unusedTracks.clear();
56 
57  if ( tracks.empty() ) {
58  return m_cluster;
59  }
60 
61  const Trk::Track* seedTrack = *tracks.begin();
62 
63  auto& params = seedTrack->perigeeParameters()->parameters();
64  const double seedPT = std::abs(sin(params[Trk::theta])/params[Trk::qOverP]);
65 
66  if ( seedPT < m_minPT ) {
67  m_unusedTracks.assign(tracks.begin(), tracks.end());
68  return m_cluster;
69  }
70 
71  double sumWeight = trackWeight(*seedTrack);
72  m_seedZ0 = trackPerigeeZ0(*seedTrack, beamspot);
73 
74  m_cluster.push_back(seedTrack);
75 
76  for (auto track_itr = tracks.begin() + 1; track_itr != tracks.end(); ++track_itr) {
77  const double trackZ0 = trackPerigeeZ0(**track_itr, beamspot);
78  const double deltaZ = trackZ0 - m_seedZ0;
79  const double weight = trackWeight( **track_itr );
80 
81  if (abs(deltaZ) <= m_deltaZ && m_cluster.size() < m_maxSize) {
82  m_cluster.push_back(*track_itr);
83 
84  m_seedZ0 = ( m_seedZ0 * sumWeight + trackZ0 * weight ) / ( sumWeight + weight );
85  sumWeight += weight;
86  } else {
87  m_unusedTracks.push_back(*track_itr);
88  }
89  }
90 
91  m_totalZ0Err = sqrt( 1. / sumWeight );
92 
93  return m_cluster;
94 }

◆ clusterTracks()

const TrackVector& PESA::T2TrackClusterer::clusterTracks ( ) const
inline

This is the same vector as returned from clustering method, have to be called after return from a clustering method.

Definition at line 85 of file T2TrackClusterer.h.

85 { return m_cluster; }

◆ seedZ0()

double PESA::T2TrackClusterer::seedZ0 ( ) const
inline

Z0 position of a seed track that was used for clustering.

Definition at line 78 of file T2TrackClusterer.h.

78 { return m_seedZ0 ; }

◆ totalZ0Err()

double PESA::T2TrackClusterer::totalZ0Err ( ) const
inline

Uncertainty of Z0 position of a cluster.

Definition at line 81 of file T2TrackClusterer.h.

81 { return m_totalZ0Err; }

◆ trackPerigeeFromString()

T2TrackClusterer::TrackPerigee T2TrackClusterer::trackPerigeeFromString ( const std::string &  perigeeStr)
static

Definition at line 28 of file T2TrackClusterer.cxx.

29 {
30  if (perigeeStr == "original") {
31  return perigee_original;
32  } else if (perigeeStr == "beamspot") {
33  return perigee_beamspot;
34  } else if (perigeeStr == "beamline") {
35  return perigee_beamline;
36  } else {
37  throw std::runtime_error("Invalid value of ClusterPerigee parameter: " + perigeeStr);
38  }
39 }

◆ trackPerigeeZ0()

double T2TrackClusterer::trackPerigeeZ0 ( const Trk::Track track,
const InDet::BeamSpotData beamspot 
) const
private

Definition at line 97 of file T2TrackClusterer.cxx.

98 {
99  auto& params0 = track.perigeeParameters()->parameters();
100  if (m_trackPerigee == perigee_original or beamspot == nullptr) {
101  return params0[Trk::z0];
103  // TODO: beamline is doing the same as beamspot for now, I think it should be OK
104  // with our track resolution, somethig to check in the future (when I retire)
105 
106  // This assumes that track perigee is defined at 0,0, transform is:
107  // z = z_0 + (B_x*cos(phi) + B_y*sin(phi)) / tan(theta)
108 
109  double z_0 = params0[Trk::z0];
110  double phi = params0[Trk::phi];
111  double theta = params0[Trk::theta];
112  auto& beamPos = beamspot->beamPos();
113  double B_x = beamPos[0];
114  double B_y = beamPos[1];
115 
116  double z = z_0 + (B_x*cos(phi) + B_y*sin(phi)) / tan(theta);
117  return z;
118 
119  } else {
120  // fallback to "original"
121  return params0[Trk::z0];
122  }
123 }

◆ trackWeight()

double T2TrackClusterer::trackWeight ( const Trk::Track track) const
private

Definition at line 42 of file T2TrackClusterer.cxx.

43 {
44  const double trackZ0Err = Amg::error(*(track.perigeeParameters()->covariance()),Trk::z0);
45  const double weight = ( m_weightedZ ) ? 1. / ( trackZ0Err*trackZ0Err ) : 1.;
46  return weight;
47 }

◆ unusedTracks()

const TrackVector& PESA::T2TrackClusterer::unusedTracks ( ) const
inline

Tracks that were not included into cluster, have to be called after return from a clustering method.

Definition at line 89 of file T2TrackClusterer.h.

89 { return m_unusedTracks; }

Member Data Documentation

◆ m_cluster

TrackVector PESA::T2TrackClusterer::m_cluster
private

Definition at line 108 of file T2TrackClusterer.h.

◆ m_deltaZ

const double PESA::T2TrackClusterer::m_deltaZ
private

Definition at line 99 of file T2TrackClusterer.h.

◆ m_maxSize

const unsigned PESA::T2TrackClusterer::m_maxSize
private

Definition at line 102 of file T2TrackClusterer.h.

◆ m_minPT

const double PESA::T2TrackClusterer::m_minPT
private

Definition at line 100 of file T2TrackClusterer.h.

◆ m_seedZ0

double PESA::T2TrackClusterer::m_seedZ0 = 0.
private

Definition at line 105 of file T2TrackClusterer.h.

◆ m_totalZ0Err

double PESA::T2TrackClusterer::m_totalZ0Err = 0.
private

Definition at line 106 of file T2TrackClusterer.h.

◆ m_trackPerigee

const TrackPerigee PESA::T2TrackClusterer::m_trackPerigee = perigee_original
private

Definition at line 103 of file T2TrackClusterer.h.

◆ m_unusedTracks

TrackVector PESA::T2TrackClusterer::m_unusedTracks
private

Definition at line 109 of file T2TrackClusterer.h.

◆ m_weightedZ

const bool PESA::T2TrackClusterer::m_weightedZ
private

Definition at line 101 of file T2TrackClusterer.h.


The documentation for this class was generated from the following files:
PESA::T2TrackClusterer::m_seedZ0
double m_seedZ0
Definition: T2TrackClusterer.h:105
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:75
PESA::T2TrackClusterer::m_deltaZ
const double m_deltaZ
Definition: T2TrackClusterer.h:99
PESA::T2TrackClusterer::m_trackPerigee
const TrackPerigee m_trackPerigee
Definition: T2TrackClusterer.h:103
PESA::T2TrackClusterer::m_maxSize
const unsigned m_maxSize
Definition: T2TrackClusterer.h:102
PESA::T2TrackClusterer::trackWeight
double trackWeight(const Trk::Track &track) const
Definition: T2TrackClusterer.cxx:42
PESA::T2TrackClusterer::m_totalZ0Err
double m_totalZ0Err
Definition: T2TrackClusterer.h:106
Trk::z0
@ z0
Definition: ParamDefs.h:64
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
PESA::T2TrackClusterer::m_unusedTracks
TrackVector m_unusedTracks
Definition: T2TrackClusterer.h:109
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
PESA::T2TrackClusterer::m_minPT
const double m_minPT
Definition: T2TrackClusterer.h:100
PESA::T2TrackClusterer::m_cluster
TrackVector m_cluster
Definition: T2TrackClusterer.h:108
PESA::T2TrackClusterer::perigee_original
@ perigee_original
Definition: T2TrackClusterer.h:49
z
#define z
Trk::theta
@ theta
Definition: ParamDefs.h:66
PESA::T2TrackClusterer::perigee_beamspot
@ perigee_beamspot
Definition: T2TrackClusterer.h:51
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
InDet::BeamSpotData::beamPos
const Amg::Vector3D & beamPos() const noexcept
Definition: BeamSpotData.h:68
PESA::T2TrackClusterer::trackPerigeeZ0
double trackPerigeeZ0(const Trk::Track &track, const InDet::BeamSpotData *beamspot) const
Definition: T2TrackClusterer.cxx:97
Trk::Track::perigeeParameters
const Perigee * perigeeParameters() const
return Perigee.
Definition: Tracking/TrkEvent/TrkTrack/src/Track.cxx:163
PESA::T2TrackClusterer::perigee_beamline
@ perigee_beamline
Definition: T2TrackClusterer.h:52
Amg::error
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
Definition: EventPrimitivesHelpers.h:40
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:67
PESA::T2TrackClusterer::m_weightedZ
const bool m_weightedZ
Definition: T2TrackClusterer.h:101
Trk::phi
@ phi
Definition: ParamDefs.h:75
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
makeComparison.deltaZ
int deltaZ
Definition: makeComparison.py:46