ATLAS Offline Software
Namespaces | Classes | Typedefs | Enumerations | Functions
Prompt Namespace Reference

Namespaces

 Def
 

Classes

class  DecoratePromptLeptonImproved
 
class  DecoratePromptLeptonRNN
 
struct  FittingInput
 
class  IRNNTool
 
class  IVertexFittingTool
 
class  IVertexMergingTool
 
struct  MergeResult
 
struct  MergeResultNotOwner
 
class  NonPromptLeptonVertexingAlg
 
class  PrimaryVertexReFitter
 
class  RNNTool
 
struct  SortByIDTrackPt
 
struct  SortObjectByVar
 
struct  SortTracksByPt
 
struct  SortTwoTrackVtxByDistToSeed
 
struct  SortTwoTrackVtxBySumTrackPt
 
class  TimerScopeHelper
 
struct  TwoTrackVtx
 
class  VarEntry
 
class  VarHolder
 
class  VertexFittingTool
 
class  VertexIterativeFitMergingTool
 
class  VertexMergingTool
 
struct  VtxCluster
 

Typedefs

typedef std::vector< Prompt::VarEntryVarEntryVec
 
typedef std::map< Def::Var, std::string > VarMap
 

Enumerations

enum  VtxType {
  kTwoTrackVtx = 1, kSimpleMergedVtx = 2, kDeepMergedVtx = 3, kIterativeFitVtx = 4,
  kTwoTrackVtxWithoutLepton = 5, kIterativeFitVtxWithoutLepton = 6, kRefittedPriVtx = 7, kRefittedPriVtxWithoutLep = 8
}
 

Functions

double getVertexFitProb (const xAOD::Vertex *vtx)
 
std::string vtxAsStr (const xAOD::Vertex *vtx, bool print_tracks=false)
 
std::string trkAsStr (const xAOD::TrackParticle *trk)
 
std::string truthAsStr (const xAOD::IParticle &particle)
 
double getDistance (const xAOD::Vertex *vtx1, const xAOD::Vertex *vtx2)
 
double getDistance (const Amg::Vector3D &vtx1, const Amg::Vector3D &vtx2)
 
double getNormDist (const Amg::Vector3D &PrimVtx, const Amg::Vector3D &SecVtx, const std::vector< float > &ErrorMatrix, MsgStream &msg)
 
void fillTH1 (TH1 *h, double val, double weight=1.0)
 
std::string printPromptVertexAsStr (const xAOD::Vertex *vtx, MsgStream &msg)
 
template<class T1 , class T2 >
bool getVar (T1 &obj, T2 &value, const std::string &var_name)
 
template<class T1 , class T2 >
bool GetAuxVar (const T1 &obj, T2 &value, const std::string &var_name)
 
std::string PrintResetStopWatch (TStopwatch &watch)
 
bool operator== (const VarEntry &lhs, const VarEntry &rhs)
 
bool operator< (const VarEntry &lhs, const VarEntry &rhs)
 
bool operator== (const VarEntry &var, unsigned key)
 
bool operator== (unsigned key, const VarEntry &var)
 
bool operator< (const VarEntry &var, unsigned key)
 
bool operator< (unsigned key, const VarEntry &var)
 

Typedef Documentation

◆ VarEntryVec

typedef std::vector<Prompt::VarEntry> Prompt::VarEntryVec

Definition at line 107 of file VarHolder.h.

◆ VarMap

typedef std::map<Def::Var, std::string> Prompt::VarMap

Definition at line 108 of file VarHolder.h.

Enumeration Type Documentation

◆ VtxType

Enumerator
kTwoTrackVtx 
kSimpleMergedVtx 
kDeepMergedVtx 
kIterativeFitVtx 
kTwoTrackVtxWithoutLepton 
kIterativeFitVtxWithoutLepton 
kRefittedPriVtx 
kRefittedPriVtxWithoutLep 

Definition at line 48 of file IVertexFittingTool.h.

50  {
51  FittingInput() = default;
52 
53  FittingInput(const xAOD::TrackParticleContainer *inDetTracks_p,
54  const xAOD::Vertex *priVtx_p,
55  const xAOD::Vertex *refittedPriVtx_p):
56  inDetTracks (inDetTracks_p),
57  priVtx (priVtx_p),

Function Documentation

◆ fillTH1()

void Prompt::fillTH1 ( TH1 h,
double  val,
double  weight = 1.0 
)

Definition at line 104 of file PromptUtils.cxx.

105 {
106  //
107  // Read new event entry
108  //
109  if(!h) {
110  return;
111  }
112 
113  const double xmax = h->GetXaxis()->GetXmax();
114  const double xmin = h->GetXaxis()->GetXmin();
115 
116  double x = val;
117  if (!(val < xmax)){
118  x = h->GetXaxis()->GetBinCenter(h->GetNbinsX());
119  } else if (!(val > xmin)) {
120  x = h->GetXaxis()->GetBinCenter(1);
121  }
122 
123  h->Fill(x, weight);
124 }

◆ GetAuxVar()

template<class T1 , class T2 >
bool Prompt::GetAuxVar ( const T1 &  obj,
T2 &  value,
const std::string &  var_name 
)

Definition at line 93 of file PromptUtils.h.

102  {
103  public:
104 
105  explicit TimerScopeHelper(TStopwatch &timer)
106  :m_fTimer(timer) { m_fTimer.Start(false); }

◆ getDistance() [1/2]

double Prompt::getDistance ( const Amg::Vector3D vtx1,
const Amg::Vector3D vtx2 
)

Definition at line 51 of file PromptUtils.cxx.

52 {
53  return (vtx2 - vtx1).mag();
54 }

◆ getDistance() [2/2]

double Prompt::getDistance ( const xAOD::Vertex vtx1,
const xAOD::Vertex vtx2 
)

Definition at line 41 of file PromptUtils.cxx.

42 {
43  if((!vtx1) || (!vtx2)) {
44  return 9999.0;
45  }
46 
47  return Prompt::getDistance(vtx1->position(), vtx2->position());
48 }

◆ getNormDist()

double Prompt::getNormDist ( const Amg::Vector3D PrimVtx,
const Amg::Vector3D SecVtx,
const std::vector< float > &  ErrorMatrix,
MsgStream &  msg 
)

Definition at line 57 of file PromptUtils.cxx.

58 {
59  double significance = -10;
60 
61  Eigen::Matrix<double, 3, 3, 0, 3, 3> PrimCovMtx; //Create matrix
62 
63  if(errorMatrix.empty()) {
64  msg << "getNormDist - Error matrix is empty" << std::endl;
65  return significance;
66  }
67 
68  PrimCovMtx(0,0) = static_cast<double> (errorMatrix[0]);
69  PrimCovMtx(0,1) = static_cast<double> (errorMatrix[1]);
70  PrimCovMtx(1,0) = static_cast<double> (errorMatrix[1]);
71  PrimCovMtx(1,1) = static_cast<double> (errorMatrix[2]);
72  PrimCovMtx(0,2) = static_cast<double> (errorMatrix[3]);
73  PrimCovMtx(2,0) = static_cast<double> (errorMatrix[3]);
74  PrimCovMtx(1,2) = static_cast<double> (errorMatrix[4]);
75  PrimCovMtx(2,1) = static_cast<double> (errorMatrix[4]);
76  PrimCovMtx(2,2) = static_cast<double> (errorMatrix[5]);
77 
78  if(PrimCovMtx.determinant() == 0) {
79  msg << "getNormDist - Matrix can not be inversed" << std::endl;
80  return significance;
81  }
82 
83  Eigen::Matrix<double, 3, 3,0, 3, 3> WgtMtx = PrimCovMtx.inverse();
84 
85  Eigen::Vector3d dist;
86  Amg::Vector3D vtxDiff = vtx1 - vtx2;
87  dist[0] = vtxDiff.x();
88  dist[1] = vtxDiff.y();
89  dist[2] = vtxDiff.z();
90 
91  significance = dist.transpose() * WgtMtx * dist;
92 
93  if(significance < 0) {
94  msg << "getNormDist - significance is negative" << std::endl;
95  return significance;
96  }
97 
98  significance = std::sqrt(significance);
99 
100  return significance;
101 }

◆ getVar()

template<class T1 , class T2 >
bool Prompt::getVar ( T1 &  obj,
T2 &  value,
const std::string &  var_name 
)

Definition at line 72 of file PromptUtils.h.

74  {
75  return false;
76  }
77 
78  value = acc(*obj);
79  return true;
80  }
81 
82  //=============================================================================
83  template<class T1, class T2> bool GetAuxVar(const T1 &obj, T2 &value, const std::string &var_name)
84  {
85  //
86  // get the int aux-variable
87  //
89 
90  if(!acc.isAvailable(obj)) {

◆ getVertexFitProb()

double Prompt::getVertexFitProb ( const xAOD::Vertex vtx)

Definition at line 21 of file PromptUtils.cxx.

22 {
23  //
24  // Get xAOD::Vertex fit probability
25  //
26  double fit_prob = -1;
27 
28  if(!vtx) {
29  return fit_prob;
30  }
31 
32  if(vtx->numberDoF() > 0 && vtx->chiSquared() > 0) {
33  fit_prob = TMath::Prob(vtx->chiSquared(), vtx->numberDoF());
34  }
35 
36  return fit_prob;
37 }

◆ operator<() [1/3]

bool Prompt::operator< ( const VarEntry lhs,
const VarEntry rhs 
)
inline

Definition at line 174 of file VarHolder.h.

◆ operator<() [2/3]

bool Prompt::operator< ( const VarEntry var,
unsigned  key 
)
inline

Definition at line 182 of file VarHolder.h.

184 {

◆ operator<() [3/3]

bool Prompt::operator< ( unsigned  key,
const VarEntry var 
)
inline

Definition at line 183 of file VarHolder.h.

184 {

◆ operator==() [1/3]

bool Prompt::operator== ( const VarEntry lhs,
const VarEntry rhs 
)
inline

Definition at line 170 of file VarHolder.h.

170  { return var.getKey() == key; }
171 
172  inline bool operator<(const VarEntry &var, unsigned key) { return var.getKey() < key; }
173  inline bool operator<(unsigned key, const VarEntry &var) { return key < var.getKey(); }

◆ operator==() [2/3]

bool Prompt::operator== ( const VarEntry var,
unsigned  key 
)
inline

Definition at line 179 of file VarHolder.h.

179 {

◆ operator==() [3/3]

bool Prompt::operator== ( unsigned  key,
const VarEntry var 
)
inline

Definition at line 180 of file VarHolder.h.

180 {

◆ printPromptVertexAsStr()

std::string Prompt::printPromptVertexAsStr ( const xAOD::Vertex vtx,
MsgStream &  msg 
)

Definition at line 127 of file PromptUtils.cxx.

128 {
129  std::stringstream str;
130 
131  str << "xAOD::Vertex pointer = " << vtx<< std::endl;
132 
133  if(vtx) {
134  float chisquared = -9999;
135  float numberdof = -9999;
136  int index = -999;
137 
138  if(!getVar(vtx, index, "SecondaryVertexIndex")) {
139  msg << "printPromptVertexAsStr -- not valid vtx SecondaryVertexIndex!!!" << std::endl;
140  }
141 
142  if(!getVar(vtx, chisquared, "chiSquared")) {
143  msg << "printPromptVertexAsStr -- not valid vtx chiSquared!!!" << std::endl;
144  }
145 
146  if(!getVar(vtx, numberdof, "numberDoF")) {
147  msg << "printPromptVertexAsStr -- not valid vtx numberDoF!!!" << std::endl;
148  }
149 
150  str << " index " << index << std::endl;
151  str << " position " << vtx->position () << std::endl;
152  str << " x " << vtx->x () << std::endl;
153  str << " y " << vtx->y () << std::endl;
154  str << " z " << vtx->z () << std::endl;
155  str << " chiSquared " << chisquared << std::endl;
156  str << " numberDoF " << numberdof << std::endl;
157 
158  str << " covariance.size() = " << vtx->covariance().size() << std::endl;
159  str << " covariance = [";
160 
161  for(const float val: vtx->covariance()) {
162  str << val << ", ";
163  }
164 
165  str << "]";
166  }
167 
168  return str.str();
169 }

◆ PrintResetStopWatch()

std::string Prompt::PrintResetStopWatch ( TStopwatch &  watch)

Definition at line 244 of file PromptUtils.cxx.

245 {
246  watch.Stop();
247 
248  double realt = watch.RealTime();
249  double cput = watch.CpuTime();
250 
251  watch.Reset();
252  watch.Start();
253 
254  const int hours = static_cast<int>(realt/3600.0);
255  const int min = static_cast<int>(realt/60.0) - 60*hours;
256 
257  realt -= hours * 3600;
258  realt -= min * 60;
259 
260  if (realt < 0) realt = 0;
261  if (cput < 0) cput = 0;
262 
263  const int sec = static_cast<int>(realt);
264 
265  std::stringstream str;
266  str << "Real time "
267  << setw(2) << setfill('0') << hours
268  << ":" << setw(2) << setfill('0') << min
269  << ":" << setw(2) << setfill('0') << sec
270  << " CPU time " << setprecision(3) << fixed << cput;
271 
272  return str.str();
273 }

◆ trkAsStr()

std::string Prompt::trkAsStr ( const xAOD::TrackParticle trk)

Definition at line 228 of file PromptUtils.cxx.

229 {
230  if(!trk) {
231  return "trkAsStr - null pointer";
232  }
233 
234  stringstream str;
235 
236  str << "xAOD::TrackParticle - " << trk << ": pT=" << trk->pt()
237  << ", eta=" << trk->eta()
238  << ", phi=" << trk->phi();
239 
240  return str.str();
241 }

◆ truthAsStr()

std::string Prompt::truthAsStr ( const xAOD::IParticle particle)

Definition at line 213 of file PromptUtils.cxx.

214 {
215  int truthOrigin = -1;
216  int truthType = -1;
217 
218  Prompt::GetAuxVar(particle, truthOrigin, "truthOrigin");
219  Prompt::GetAuxVar(particle, truthType, "truthType");
220 
221  std::stringstream str;
222  str << "truthType=" << truthType << ", truthOrigin=" << truthOrigin;
223 
224  return str.str();
225 }

◆ vtxAsStr()

std::string Prompt::vtxAsStr ( const xAOD::Vertex vtx,
bool  print_tracks = false 
)

Definition at line 172 of file PromptUtils.cxx.

173 {
174  if(!vtx) {
175  return "vtxAsStr - null pointer";
176  }
177 
178  stringstream str;
179 
180  float distToPV = -1;
181  float sigToPV = -1;
182 
183  Prompt::GetAuxVar(*vtx, distToPV, "distToPriVtx");
184  Prompt::GetAuxVar(*vtx, sigToPV, "normDistToPriVtx");
185 
186  str << "xAOD::Vertex - " << vtx << ": ntrack=" << vtx->nTrackParticles()
187  << ", chi2/ndof=" << vtx->chiSquared() << "/" << vtx->numberDoF()
188  << ", prob=" << Prompt::getVertexFitProb(vtx)
189  << ", (x, y, z)=(" << vtx->x() << ", " << vtx->y() << ", " << vtx->z() << ")"
190  << ", distToPV=" << distToPV
191  << ", sigToPV=" << sigToPV;
192 
193  if(print_tracks) {
194  str << endl;
195 
196  std::vector<const xAOD::TrackParticle *> tracks;
197 
198  for(unsigned i = 0; i < vtx->nTrackParticles(); ++i) {
199  tracks.push_back(vtx->trackParticle(i));
200  }
201 
202  std::sort(tracks.begin(), tracks.end(), Prompt::SortByIDTrackPt());
203 
204  for(unsigned i = 0; i < tracks.size(); ++i) {
205  str << " xAOD::Vertex track[" << i << "] " << trkAsStr(tracks.at(i)) << endl;
206  }
207  }
208 
209  return str.str();
210 }
xAOD::TrackParticle_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: TrackParticle_v1.cxx:73
xAOD::Vertex_v1::x
float x() const
Returns the x position.
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
xAOD::Vertex_v1::nTrackParticles
size_t nTrackParticles() const
Get the number of tracks associated with this vertex.
Definition: Vertex_v1.cxx:270
Prompt::GetAuxVar
bool GetAuxVar(const T1 &obj, T2 &value, const std::string &var_name)
Definition: PromptUtils.h:93
Prompt::getVertexFitProb
double getVertexFitProb(const xAOD::Vertex *vtx)
Definition: PromptUtils.cxx:21
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:66
CheckAppliedSFs.var_name
var_name
Definition: CheckAppliedSFs.py:241
index
Definition: index.py:1
xAOD::TrackParticle_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition: TrackParticle_v1.cxx:77
Prompt::getVar
bool getVar(T1 &obj, T2 &value, const std::string &var_name)
Definition: PromptUtils.h:72
Prompt::trkAsStr
std::string trkAsStr(const xAOD::TrackParticle *trk)
Definition: PromptUtils.cxx:228
athena.value
value
Definition: athena.py:122
xAOD::Vertex_v1::position
const Amg::Vector3D & position() const
Returns the 3-pos.
x
#define x
python.utils.AtlRunQueryTimer.timer
def timer(name, disabled=False)
Definition: AtlRunQueryTimer.py:86
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
Prompt::getDistance
double getDistance(const xAOD::Vertex *vtx1, const xAOD::Vertex *vtx2)
Definition: PromptUtils.cxx:41
lumiFormat.i
int i
Definition: lumiFormat.py:92
xmin
double xmin
Definition: listroot.cxx:60
h
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
xAOD::Vertex_v1::trackParticle
const TrackParticle * trackParticle(size_t i) const
Get the pointer to a given track that was used in vertex reco.
Definition: Vertex_v1.cxx:249
xAOD::Vertex_v1::z
float z() const
Returns the z position.
DataVector< xAOD::TrackParticle_v1 >
min
#define min(a, b)
Definition: cfImp.cxx:40
Prompt::SortByIDTrackPt
Definition: PromptUtils.h:67
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
taskman.hours
hours
Definition: taskman.py:650
Prompt::operator<
bool operator<(unsigned key, const VarEntry &var)
Definition: VarHolder.h:183
xAOD::Vertex_v1::numberDoF
float numberDoF() const
Returns the number of degrees of freedom of the vertex fit as float.
xAOD::Vertex_v1::covariance
const std::vector< float > & covariance() const
Returns the covariance matrix as a simple vector of values.
xAOD::Vertex_v1::chiSquared
float chiSquared() const
Returns the of the vertex fit as float.
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
python.CaloScaleNoiseConfig.str
str
Definition: CaloScaleNoiseConfig.py:78
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
xAOD::Vertex_v1::y
float y() const
Returns the y position.
xmax
double xmax
Definition: listroot.cxx:61
str
Definition: BTagTrackIpAccessor.cxx:11
python.PyAthena.obj
obj
Definition: PyAthena.py:135
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
xAOD::TrackParticle_v1::phi
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37