ATLAS Offline Software
Loading...
Searching...
No Matches
Prompt Namespace Reference

Namespaces

namespace  Def

Classes

class  DecoratePLIT
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 TLorentzVector FourMom_t
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

static const InterfaceID IID_IRNNTool ("Prompt::IRNNTool", 1, 0)
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

◆ FourMom_t

typedef TLorentzVector Prompt::FourMom_t

Definition at line 32 of file DecoratePLIT.h.

◆ VarEntryVec

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

Definition at line 97 of file VarHolder.h.

◆ VarMap

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

Definition at line 98 of file VarHolder.h.

Enumeration Type Documentation

◆ VtxType

Enumerator
kTwoTrackVtx 
kSimpleMergedVtx 
kDeepMergedVtx 
kIterativeFitVtx 
kTwoTrackVtxWithoutLepton 
kIterativeFitVtxWithoutLepton 
kRefittedPriVtx 
kRefittedPriVtxWithoutLep 

Definition at line 38 of file IVertexFittingTool.h.

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}
#define x
Header file for AthHistogramAlgorithm.
double xmax
Definition listroot.cxx:61
double xmin
Definition listroot.cxx:60

◆ GetAuxVar()

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

Definition at line 83 of file PromptUtils.h.

84 {
85 //
86 // get the int aux-variable
87 //
88 typename SG::AuxElement::Accessor<T2> acc(var_name);
89
90 if(!acc.isAvailable(obj)) {
91 return false;
92 }
93
94 value = acc(obj);
95 return true;
96 }
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572

◆ 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}
const Amg::Vector3D & position() const
Returns the 3-pos.
double getDistance(const xAOD::Vertex *vtx1, const xAOD::Vertex *vtx2)

◆ 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}
Eigen::Matrix< double, 3, 1 > Vector3D
MsgStream & msg
Definition testRead.cxx:32

◆ getVar()

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

Definition at line 62 of file PromptUtils.h.

63 {
64 if (!obj) {
65 std::cerr << "getVar - received a null object" << std::endl;
66 return false;
67 }
68
69 //
70 // get the int aux-variable
71 //
72 typename SG::AuxElement::Accessor<T2> acc(var_name);
73
74 if(!acc.isAvailable(*obj)) {
75 return false;
76 }
77
78 value = acc(*obj);
79 return true;
80 }

◆ 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}
float numberDoF() const
Returns the number of degrees of freedom of the vertex fit as float.
float chiSquared() const
Returns the of the vertex fit as float.

◆ IID_IRNNTool()

const InterfaceID Prompt::IID_IRNNTool ( "Prompt::IRNNTool" ,
1 ,
0  )
static

◆ operator<() [1/3]

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

Definition at line 164 of file VarHolder.h.

165 {
166 return lhs.getKey() < rhs.getKey();
167 }
unsigned getKey() const
Definition VarHolder.h:87

◆ operator<() [2/3]

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

Definition at line 172 of file VarHolder.h.

172{ return var.getKey() < key; }

◆ operator<() [3/3]

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

Definition at line 173 of file VarHolder.h.

173{ return key < var.getKey(); }

◆ operator==() [1/3]

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

Definition at line 160 of file VarHolder.h.

161 {
162 return lhs.getKey() == rhs.getKey();
163 }

◆ operator==() [2/3]

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

Definition at line 169 of file VarHolder.h.

169{ return var.getKey() == key; }

◆ operator==() [3/3]

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

Definition at line 170 of file VarHolder.h.

170{ return var.getKey() == key; }

◆ 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}
float z() const
Returns the z position.
float y() const
Returns the y position.
float x() const
Returns the x position.
const std::vector< float > & covariance() const
Returns the covariance matrix as a simple vector of values.
str index
Definition DeMoScan.py:362
bool getVar(T1 &obj, T2 &value, const std::string &var_name)
Definition PromptUtils.h:62
Definition index.py:1

◆ 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}
#define min(a, b)
Definition cfImp.cxx:40

◆ 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}
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.

◆ 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}
bool GetAuxVar(const T1 &obj, T2 &value, const std::string &var_name)
Definition PromptUtils.h:83

◆ 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}
size_t nTrackParticles() const
Get the number of tracks associated with this vertex.
const TrackParticle * trackParticle(size_t i) const
Get the pointer to a given track that was used in vertex reco.
std::string trkAsStr(const xAOD::TrackParticle *trk)
double getVertexFitProb(const xAOD::Vertex *vtx)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.