LHCb Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TupleToolGeometry Class Reference

Fill geometry related information for DecayTreeTuple. More...

#include <jborel/TupleToolGeometry.h>

Inheritance diagram for TupleToolGeometry:
Inheritance graph
[legend]
Collaboration diagram for TupleToolGeometry:
Collaboration graph
[legend]

Public Member Functions

 TupleToolGeometry (const std::string &type, const std::string &name, const IInterface *parent)
 Standard constructor. More...
 
StatusCode initialize () override
 
StatusCode fill (const LHCb::Particle *, const LHCb::Particle *, const std::string &, Tuples::Tuple &) override
 Fill the tuple. More...
 
- Public Member Functions inherited from IParticleTupleTool
 DeclareInterfaceID (IParticleTupleTool, 2, 0)
 
- Public Member Functions inherited from extend_interfaces< IAlgTool >
 ~extend_interfaces () override=default
 Virtual destructor. More...
 

Private Member Functions

StatusCode fillVertexFull (const LHCb::VertexBase *vtx, const LHCb::Particle *P, const std::string &head, const std::string &vtx_name, Tuples::Tuple &) const
 fill end vertex stuff More...
 
const LHCb::VertexBaseoriginVertex (const LHCb::Particle *top, const LHCb::Particle *P) const
 origin vertex More...
 
StatusCode fillBPV (const LHCb::VertexBase *primVtx, const LHCb::Particle *P, const std::string &prefix, Tuples::Tuple &tuple, const std::string &trail="") const
 fill related pV stuff More...
 
StatusCode fillMinIP (const LHCb::Particle *P, const std::string &prefix, Tuples::Tuple &tuple) const
 fill min IP More...
 
StatusCode fillVertex (const LHCb::VertexBase *vtx, const std::string &vtx_name, Tuples::Tuple &) const
 fill end vertex stuff More...
 
StatusCode fillFlight (const LHCb::VertexBase *oriVtx, const LHCb::Particle *P, const std::string &prefix, Tuples::Tuple &tuple, const std::string &trail="") const
 fill flight More...
 
double dira (const LHCb::VertexBase *oriVtx, const LHCb::Particle *P) const
 Compute DIRA. More...
 

Private Attributes

const IDistanceCalculatorm_dist = nullptr
 
bool m_refitPVs
 
bool m_fillMultiPV
 fill multiPV variables More...
 
IDVAlgorithmm_dva = nullptr
 
IPVReFitterm_pvReFitter = nullptr
 
std::string m_pvReFitterName
 

Additional Inherited Members

- Public Types inherited from extend_interfaces< IAlgTool >
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
 take union of the ext_iids of all Interfaces... More...
 

Detailed Description

Fill geometry related information for DecayTreeTuple.

Finally some arrays with FillMultiPV

See also
DecayTreeTuple
Author
Jeremie Borel
Date
2007-11-07

Definition at line 73 of file TupleToolGeometry.h.

Constructor & Destructor Documentation

TupleToolGeometry::TupleToolGeometry ( const std::string type,
const std::string name,
const IInterface parent 
)

Standard constructor.

Definition at line 32 of file TupleToolGeometry.cpp.

35  : TupleToolBase ( type, name , parent )
36 {
37  declareInterface<IParticleTupleTool>(this);
38  declareProperty("RefitPVs",m_refitPVs=false,
39  "Refit PVs when doing next best PV checks");
40  declareProperty("PVReFitter", m_pvReFitterName = "LoKi::PVReFitter:PUBLIC",
41  "PV refitter algorithm name (':PUBLIC' at end of algo name makes sure a public instance is used)" );
42  declareProperty("FillMultiPV",m_fillMultiPV=false,
43  "Fill Multi PV arrays");
44 
45  //declareProperty("FillMother",m_fillMother=true,
46  // "Turn false if the mother is expected to be NULL, will not fill mother PV info");
47  // replaced by Verbose
48 
49  //setProperty( "OutputLevel", 1 );
50 
51 }
std::string m_pvReFitterName
Gaudi::Details::PropertyBase * declareProperty(const std::string &name, TYPE &value, const std::string &doc="none")
Declare a property (templated)
Decoder::CommonBase< GaudiTupleTool > TupleToolBase
bool m_fillMultiPV
fill multiPV variables

Member Function Documentation

double TupleToolGeometry::dira ( const LHCb::VertexBase oriVtx,
const LHCb::Particle P 
) const
private

Compute DIRA.

Definition at line 486 of file TupleToolGeometry.cpp.

488 {
489  if ( !P || !oriVtx )
490  {
491  Exception("Wrong use of dira");
492  return -1501. ;
493  }
494  const auto evtx = P->endVertex();
495  if ( !evtx )
496  {
497  Warning("Cannot find end vertex",StatusCode::SUCCESS,1).ignore();
498  return -999.;
499  }
500  const auto A = P->momentum().Vect();
501  const auto B = evtx->position() - oriVtx->position();
502  return A.Dot( B ) / std::sqrt( A.Mag2()*B.Mag2() );
503 }
const LHCb::Vertex * endVertex() const
Retrieve (const) Reference to end vertex (ex. decay)
Definition: Particle.h:723
Templated base algorithm for checking data packing.
const Gaudi::XYZPoint & position() const
Retrieve const Position in LHCb reference system.
Definition: VertexBase.h:218
const Gaudi::LorentzVector & momentum() const
Retrieve const Momentum four vector.
Definition: Particle.h:668
T sqrt(T...args)
StatusCode TupleToolGeometry::fill ( const LHCb::Particle top,
const LHCb::Particle part,
const std::string head,
Tuples::Tuple tuple 
)
overridevirtual

Fill the tuple.

  • top : may be used to provide additional information about part, like the top particle of the decay.
  • part : the particle about which some info are filled.
  • head : prefix for the tuple column name.
  • tuple: the tuple to fill

Implements IParticleTupleTool.

Definition at line 79 of file TupleToolGeometry.cpp.

83 {
84  const auto prefix = fullName(head);
85 
87 
88  Assert( P && m_dist && m_dva
89  , "No mother or particle, or tools misconfigured." );
90 
91  if ( isPureNeutralCalo(P) )
92  return Warning( "Will not fill geometry tuple for neutral Calo particles. No worry",
94  if ( msgLevel(MSG::VERBOSE) )
95  verbose() << "TupleToolGeometry::fill " << mother << " " << P << " " << prefix
96  << endmsg ;
97 
98  //fill min IP
99  if ( isVerbose() || m_fillMultiPV )
100  {
101  sc = fillMinIP(P,prefix,tuple);
102  if ( sc.isFailure() )
103  {
104  return Warning("Could not fill minimum IP",1,StatusCode::FAILURE);
105  }
106  }
107  //=========================================================================
108  //fill end vertex info
109  //=========================================================================
110  if( P->isBasicParticle() )
111  {
112  if (msgLevel(MSG::VERBOSE))
113  verbose() << "No need to look for endVertex of " << prefix << endmsg ;
114  }
115  else
116  {
117  //=========================================================================
118  if ( msgLevel(MSG::VERBOSE) && P->endVertex() )
119  { // https://savannah.cern.ch/bugs/?92524
120  verbose() << "Before cast : " << P->endVertex() << endmsg ;
121  verbose() << "Container " << P->endVertex()->parent()->registry()->identifier()
122  << " key " << P->endVertex()->key() << endmsg ;
123  }
124 
125  const auto evtx = P->endVertex();
126  if ( !evtx )
127  {
128  fatal() << "Can't retrieve the end vertex for " << prefix
129  << ". TupleToolGeometry cannot act on such a particle. Define a branch" << endmsg ;
130  fatal() << "See https://twiki.cern.ch/twiki/bin/view/LHCb/DaVinciTutorial7#Branches" << endmsg ;
131  return StatusCode::FAILURE ;
132  }
133 
134  if ( msgLevel(MSG::VERBOSE) )
135  { // https://savannah.cern.ch/bugs/?92524
136  verbose() << "End Vertex : " << *evtx << endmsg ;
137  verbose() << "Container " << evtx->parent()->registry()->identifier()
138  << " key " << evtx->key() << endmsg ;
139  }
140  // end vertex
141  sc = fillVertex(evtx,prefix+"_ENDVERTEX",tuple);
142  if ( sc.isFailure() )
143  {
144  return Warning("Could not fill Endvertex "+prefix,1,sc);
145  }
146  }
147 
148  const VertexBase* aPV = nullptr;
149 
150  //=========================================================================
151  // fill IP for Particles's Own BPV.. if it isn't the mother!
152  //=========================================================================
153  if ( true )
154  {
155  aPV = m_dva->bestVertex ( P );
156  if ( aPV && msgLevel(MSG::VERBOSE) )
157  verbose() << "Got best PV of particle : " << *aPV << endmsg ;
158  sc = fillVertexFull(aPV,P,prefix,"_OWNPV",tuple);
159  if ( sc.isFailure() )
160  {
161  return Warning("Could not fill best PV",1,sc);
162  }
163  }
164  //=========================================================================
165  // fill IP for head of chain's own BPV
166  //=========================================================================
167  if ( mother && isVerbose() )
168  {
169  aPV = m_dva->bestVertex ( mother );
170  if ( aPV && msgLevel(MSG::VERBOSE))
171  verbose() << "Got best PV of mother : " << *aPV << endmsg ;
172  sc = fillVertexFull(aPV,P,prefix,"_TOPPV",tuple);
173  if ( sc.isFailure() )
174  {
175  return Warning("Could not fill TOP PV",1,sc);
176  }
177  }
178  //=========================================================================
179  // fill IP wrt Mother's decay vertex, if it isn't the mother!
180  //=========================================================================
181  if ( mother && mother != P)
182  {
183  aPV = originVertex( mother, P );
184  if(aPV && msgLevel(MSG::VERBOSE))
185  verbose() << "Got originVertex of mother : " << *aPV << endmsg ;
186  if ( isVerbose() )
187  {
188  sc = fillVertexFull(aPV,P,prefix,"_ORIVX",tuple);
189  if ( sc.isFailure() )
190  {
191  return Warning("Could not fill VertexFull "+prefix,1,sc);
192  }
193  }
194  else
195  {
196  sc = fillVertex(aPV,prefix+"_ORIVX",tuple);
197  if ( sc.isFailure() )
198  {
199  return Warning("Could not fill ORIVX",1,sc);
200  }
201  if( !P->isBasicParticle() ) sc = fillFlight(aPV,P,prefix,tuple,"_ORIVX");
202  if ( sc.isFailure() )
203  {
204  return Warning("Could not fill Flight",1,sc);
205  }
206 
207  }
208 
209  if ( sc.isFailure() ) return sc;
210  }
211  //=========================================================================
212 
213  return sc ;
214 }
StatusCode fillMinIP(const LHCb::Particle *P, const std::string &prefix, Tuples::Tuple &tuple) const
fill min IP
IDVAlgorithm * m_dva
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:61
bool Assert(const bool assertion, const std::string &message, const std::string &tag="Ostap", const StatusCode &sc=StatusCode::FAILURE)
Definition: OstapFixes.h:17
Templated base algorithm for checking data packing.
virtual const LHCb::VertexBase * bestVertex(const LHCb::Particle *) const =0
Return the best primary vertex for a given LHCb::Particle.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode fillVertexFull(const LHCb::VertexBase *vtx, const LHCb::Particle *P, const std::string &head, const std::string &vtx_name, Tuples::Tuple &) const
fill end vertex stuff
StatusCode fillFlight(const LHCb::VertexBase *oriVtx, const LHCb::Particle *P, const std::string &prefix, Tuples::Tuple &tuple, const std::string &trail="") const
fill flight
const IDistanceCalculator * m_dist
const LHCb::VertexBase * originVertex(const LHCb::Particle *top, const LHCb::Particle *P) const
origin vertex
bool m_fillMultiPV
fill multiPV variables
Base class from which all vertices are derived.
Definition: VertexBase.h:49
GAUDI_API const LHCb::MCParticle * mother(const LHCb::MCParticle *particle)
get the mother particle (just for completeness of interface)
Definition: MCChild.cpp:185
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode fillVertex(const LHCb::VertexBase *vtx, const std::string &vtx_name, Tuples::Tuple &) const
fill end vertex stuff
StatusCode TupleToolGeometry::fillBPV ( const LHCb::VertexBase primVtx,
const LHCb::Particle P,
const std::string prefix,
Tuples::Tuple tuple,
const std::string trail = "" 
) const
private

fill related pV stuff

Definition at line 247 of file TupleToolGeometry.cpp.

251  {
252  bool test = true ;
253 
254  double ip{-999}, chi2{-999};
255 
256  if ( !primVtx )
257  {
258  ++counter("No BPV for "+prefix);
259  }
260  else
261  {
262  test &= m_dist->distance ( P, primVtx, ip, chi2 );
263  if ( !test ) { ip = chi2 = -1; }
264  }
265 
266  test &= tuple->column( prefix + "_IP"+trail, ip );
267  test &= tuple->column( prefix + "_IPCHI2"+trail, chi2 );
268 
269  if (!test) Warning("Error in fillBPV "+prefix,1).ignore();
270  return StatusCode(test) ;
271 }
StatusCode column(const std::string &name, float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:315
GAUDI_API double chi2(const Entries &entries)
calculate the chi2
Definition: VertexFit.cpp:1259
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
const IDistanceCalculator * m_dist
virtual StatusCode distance(const LHCb::Particle *particle, const LHCb::VertexBase *vertex, double &imppar, const bool allow=false) const =0
The method for the evaluation of the impact parameter ("distance") vector of the particle with respec...
void ignore() const
Definition: StatusCode.h:84
StatusCode TupleToolGeometry::fillFlight ( const LHCb::VertexBase oriVtx,
const LHCb::Particle P,
const std::string prefix,
Tuples::Tuple tuple,
const std::string trail = "" 
) const
private

fill flight

Definition at line 413 of file TupleToolGeometry.cpp.

418 {
419  bool test = true ;
420  // --------------------------------------------------
421  if ( !oriVtx )
422  {
423  test &= tuple->column( prefix + "_FD"+trail, -999. );
424  test &= tuple->column( prefix + "_FDCHI2"+trail, -999. );
425  test &= tuple->column( prefix + "_DIRA"+trail, -999.);
426  }
427  else
428  {
429 
430  // flight distance
431  double dist{0}, chi2{0};
432  const StatusCode sc = m_dist->distance( oriVtx, P->endVertex(), dist, chi2 );
433 
434  // always fill variables to make sure branches do not change ...
435  test &= tuple->column( prefix + "_FD"+trail, sc ? dist : -999 );
436  test &= tuple->column( prefix + "_FDCHI2"+trail, sc ? chi2 : -999 );
437  // --------------------------------------------------
438  // cosine of (flight distance) dot (momentum):
439  // find the origin vertex. Either the primary or the origin in the
440  // decay
441  test &= tuple->column( prefix + "_DIRA"+trail, sc ? dira(oriVtx,P) : -999 );
442 
443  if ( sc.isFailure() ) return sc ;
444  }
445 
446  if (!test) Warning("Error in fillFlight "+prefix,1).ignore();
447  return StatusCode(test);
448 }
StatusCode column(const std::string &name, float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:315
GAUDI_API double chi2(const Entries &entries)
calculate the chi2
Definition: VertexFit.cpp:1259
const LHCb::Vertex * endVertex() const
Retrieve (const) Reference to end vertex (ex. decay)
Definition: Particle.h:723
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:61
double dira(const LHCb::VertexBase *oriVtx, const LHCb::Particle *P) const
Compute DIRA.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
const IDistanceCalculator * m_dist
virtual StatusCode distance(const LHCb::Particle *particle, const LHCb::VertexBase *vertex, double &imppar, const bool allow=false) const =0
The method for the evaluation of the impact parameter ("distance") vector of the particle with respec...
void ignore() const
Definition: StatusCode.h:84
StatusCode TupleToolGeometry::fillMinIP ( const LHCb::Particle P,
const std::string prefix,
Tuples::Tuple tuple 
) const
private

fill min IP

Definition at line 275 of file TupleToolGeometry.cpp.

278 {
279  bool test = true ;
280  // minimum IP
281  double ipmin = -1;
282  double minchi2 = -1 ;
283 
284  double ipminnextbest = -1;
285  double minchi2nextbest = -1;
286 
287  if(msgLevel(MSG::VERBOSE)) verbose() << "Looking for Min IP" << endmsg ;
288  const auto PVS = m_dva->primaryVertices();
289  if(msgLevel(MSG::VERBOSE)) verbose() << "PV size: " << PVS.size() << endmsg ;
290 
291  std::vector<double> ips, ipchi2s, diras;
292  if ( !PVS.empty() )
293  {
294  if(msgLevel(MSG::VERBOSE)) verbose() << "Filling IP " << prefix + "_MINIP : "
295  << P << " PVs:" << PVS.size() << endmsg ;
296 
297  for ( const auto& pv : PVS )
298  {
299  RecVertex newPV(*pv);
300  if (m_refitPVs)
301  {
302 
303  StatusCode scfit = m_pvReFitter->remove(P, &newPV);
304  if(!scfit) { Warning("ReFitter fails!",StatusCode::SUCCESS,10).ignore(); continue; }
305  }
306 
307  double ip{0}, chi2{0};
308  //StatusCode test2 = m_dist->distance ( P, *pv, ip, chi2 );
309 
310  auto newPVPtr = (LHCb::VertexBase*)&newPV;
311  const auto test2 = m_dist->distance ( P, newPVPtr, ip, chi2 );
312  ips.push_back(ip);
313  ipchi2s.push_back(chi2);
314  if ( P->endVertex()) { diras.push_back(dira(newPVPtr,P)); }
315  if ( test2 && isVerbose() )
316  {
317  if ( ip<ipmin || ipmin<0. )
318  {
319  ipminnextbest = ipmin;
320  ipmin = ip ;
321  }
322  else
323  {
324  if( ip < ipminnextbest || ipminnextbest < 0 )
325  {
326  ipminnextbest = ip;
327  }
328  }
329 
330  if ( chi2<minchi2 || minchi2<0. )
331  {
332  minchi2nextbest = minchi2;
333  minchi2 = chi2 ;
334  }
335  else
336  {
337  if( chi2 < minchi2nextbest || minchi2nextbest < 0 )
338  {
339  minchi2nextbest = chi2;
340  }
341  }
342  }
343  }
344  }
345  if ( isVerbose() )
346  {
347  if ( msgLevel(MSG::VERBOSE) )
348  {
349  verbose() << "Filling IP " << prefix + "_MINIP " << ipmin << " at " << minchi2 << endmsg ;
350  verbose() << "Filling IP next best " << prefix + "_MINIP " << ipminnextbest << " at "
351  << minchi2nextbest << endmsg ;
352  }
353  test &= tuple->column( prefix + "_MINIP", ipmin );
354  test &= tuple->column( prefix + "_MINIPCHI2", minchi2 );
355 
356  test &= tuple->column( prefix + "_MINIPNEXTBEST", ipminnextbest );
357  test &= tuple->column( prefix + "_MINIPCHI2NEXTBEST", minchi2nextbest );
358  }
359  if (m_fillMultiPV)
360  {
361  test &= tuple->farray( prefix + "_AllIP", ips, "nPV", m_maxPV );
362  test &= tuple->farray( prefix + "_AllIPchi2", ipchi2s, "nPV", m_maxPV );
363  if (!diras.empty()) test &= tuple->farray( prefix + "_AllDIRA", diras, "nPV", m_maxPV );
364  // --------------------------------------------------
365  }
366 
367  if(msgLevel(MSG::VERBOSE))
368  verbose() << "Return from fillMinIP: " << prefix << " " << test << endmsg;
369  if (!test) Warning("Error in fillMinIP",1,StatusCode::FAILURE);
370  return StatusCode(test) ;
371 }
T empty(T...args)
IPVReFitter * m_pvReFitter
StatusCode column(const std::string &name, float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:315
GAUDI_API double chi2(const Entries &entries)
calculate the chi2
Definition: VertexFit.cpp:1259
const LHCb::Vertex * endVertex() const
Retrieve (const) Reference to end vertex (ex. decay)
Definition: Particle.h:723
IDVAlgorithm * m_dva
StatusCode farray(const std::string &name, ITERATOR1 &&first, ITERATOR2 &&last, const std::string &length, size_t maxv)
Add an indexed array (of type float) to N-tuple.
Definition: TupleObj.h:892
double dira(const LHCb::VertexBase *oriVtx, const LHCb::Particle *P) const
Compute DIRA.
T push_back(T...args)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Reconstructed Vertices.
Definition: RecVertex.h:56
virtual StatusCode remove(const LHCb::Particle *, LHCb::VertexBase *) const =0
remove track used for a (B) LHCb::Particle and refit PV
virtual const LHCb::RecVertex::Range primaryVertices() const =0
Return a container of LHCb::RecVertex*, containing primary vertices.
const IDistanceCalculator * m_dist
virtual StatusCode distance(const LHCb::Particle *particle, const LHCb::VertexBase *vertex, double &imppar, const bool allow=false) const =0
The method for the evaluation of the impact parameter ("distance") vector of the particle with respec...
bool m_fillMultiPV
fill multiPV variables
Base class from which all vertices are derived.
Definition: VertexBase.h:49
void ignore() const
Definition: StatusCode.h:84
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode TupleToolGeometry::fillVertex ( const LHCb::VertexBase vtx,
const std::string vtx_name,
Tuples::Tuple tuple 
) const
private

fill end vertex stuff

Definition at line 375 of file TupleToolGeometry.cpp.

378 {
379  bool test = true ;
380 
381  // decay vertex information:
382  if ( !vtx )
383  {
384  Gaudi::XYZPoint pt(-999.,-999.,-999.) ; // arbitrary point
385  test &= tuple->column( vtx_name+"_", pt );
386  test &= tuple->column( vtx_name + "_XERR", -999. );
387  test &= tuple->column( vtx_name + "_YERR", -999. );
388  test &= tuple->column( vtx_name + "_ZERR", -999. );
389  test &= tuple->column( vtx_name + "_CHI2", -999. );
390  test &= tuple->column( vtx_name + "_NDOF", -1 );
391  test &= tuple->matrix( vtx_name + "_COV_", Gaudi::SymMatrix3x3() );
392  }
393  else
394  {
395  const auto & m = vtx->covMatrix ();
396  test &= tuple->column( vtx_name+"_", vtx->position() );
397  test &= tuple->column( vtx_name + "_XERR", std::sqrt( m(0,0) ) );
398  test &= tuple->column( vtx_name + "_YERR", std::sqrt( m(1,1) ) );
399  test &= tuple->column( vtx_name + "_ZERR", std::sqrt( m(2,2) ) );
400  test &= tuple->column( vtx_name + "_CHI2", vtx->chi2() );
401  test &= tuple->column( vtx_name + "_NDOF", vtx->nDoF() );
402  test &= tuple->matrix( vtx_name + "_COV_", m );
403  }
404 
405  // --------------------------------------------------
406  if (!test) Warning("Error in fillVertex "+vtx_name,1).ignore();
407  return StatusCode(test) ;
408 
409 }
StatusCode matrix(const std::string &name, const MATRIX &data, const MIndex &rows, const MIndex &cols)
fill N-Tuple with fixed-size matrix
Definition: TupleObj.h:1764
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > SymMatrix3x3
Symmetrix 3x3 matrix (double)
StatusCode column(const std::string &name, float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:315
double chi2() const
Retrieve const Chi square of vertex fit.
Definition: VertexBase.h:238
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
constexpr double m
Definition: SystemOfUnits.h:94
const Gaudi::XYZPoint & position() const
Retrieve const Position in LHCb reference system.
Definition: VertexBase.h:218
int nDoF() const
Retrieve const Number of degree of freedom.
Definition: VertexBase.h:248
T sqrt(T...args)
void ignore() const
Definition: StatusCode.h:84
const Gaudi::SymMatrix3x3 & covMatrix() const
Retrieve const Covariance matrix containing errors on vertex position.
Definition: VertexBase.h:228
StatusCode TupleToolGeometry::fillVertexFull ( const LHCb::VertexBase vtx,
const LHCb::Particle P,
const std::string head,
const std::string vtx_name,
Tuples::Tuple tuple 
) const
private

fill end vertex stuff

Definition at line 219 of file TupleToolGeometry.cpp.

224 {
225  if ( !vtx ) ++counter("Can't retrieve the " +vtx_name+ " vertex for " + prefix );
226  auto sc = fillVertex(vtx,prefix+vtx_name,tuple);
227  if ( sc.isFailure() )
228  {
229  return Warning("Could not fill Endvertex "+prefix,1,sc);
230  }
231  sc = fillBPV(vtx,P,prefix,tuple,vtx_name);
232  if ( sc.isFailure() )
233  {
234  return Warning("Could not fillBPV "+prefix,1,sc);
235  }
236  if( !P->isBasicParticle() )
237  {
238  sc = fillFlight(vtx,P,prefix,tuple,vtx_name);
239  if ( sc.isFailure() ) Warning("Error in fillFlight "+prefix,1).ignore();
240  }
241  return sc;
242 }
StatusCode fillBPV(const LHCb::VertexBase *primVtx, const LHCb::Particle *P, const std::string &prefix, Tuples::Tuple &tuple, const std::string &trail="") const
fill related pV stuff
bool isBasicParticle() const
a basic particle has no daughters
Definition: Particle.h:863
StatusCode fillFlight(const LHCb::VertexBase *oriVtx, const LHCb::Particle *P, const std::string &prefix, Tuples::Tuple &tuple, const std::string &trail="") const
fill flight
StatusCode fillVertex(const LHCb::VertexBase *vtx, const std::string &vtx_name, Tuples::Tuple &) const
fill end vertex stuff
StatusCode TupleToolGeometry::initialize ( void  )
override

Definition at line 55 of file TupleToolGeometry.cpp.

56 {
58  if ( sc.isFailure() ) return sc;
59 
60  m_dva = Gaudi::Utils::getIDVAlgorithm ( contextSvc(), this ) ;
61  if (!m_dva) return Error("Couldn't get parent DVAlgorithm");
62 
64  if ( !m_dist )
65  {
66  return Error("Unable to retrieve the IDistanceCalculator tool");
67  }
68 
69  m_pvReFitter = tool<IPVReFitter>( m_pvReFitterName, this );
70  if ( !m_pvReFitter )
71  {
72  return Error( "Unable to retrieve IPVReFitter instance" );
73  }
74 
75  return sc;
76 }
IPVReFitter * m_pvReFitter
std::string m_pvReFitterName
StatusCode initialize() override
standard initialization method
IDVAlgorithm * m_dva
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:61
IDVAlgorithm * getIDVAlgorithm(const IAlgContextSvc *svc)
get the pointer to the "current" IDVAlgorithm
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
const IDistanceCalculator * m_dist
virtual const IDistanceCalculator * distanceCalculator(const std::string &nickname="") const =0
get the distance calculator tool
const VertexBase * TupleToolGeometry::originVertex ( const LHCb::Particle top,
const LHCb::Particle P 
) const
private

origin vertex

Definition at line 452 of file TupleToolGeometry.cpp.

454 {
455  //this used to pass back zero if P was a basic particle.
456  //I don't think that's necessary. R Lambert 2009-08-14
457  if ( top == P || top->isBasicParticle() ) return nullptr;
458 
459  const auto & dau = top->daughters();
460  if ( dau.empty() ) return nullptr;
461 
462  for ( const auto d : dau )
463  {
464  if( P == d )
465  { // I found the daughter
466  if(msgLevel(MSG::VERBOSE))
467  verbose() << "It's a daughter, retrning mother's endvertex : "
468  << endmsg;
469  return top->endVertex();
470  }
471  }
472 
473  // vertex not yet found, get deeper in the decay:
474  for ( const auto d : dau )
475  {
476  if ( P != d && !d->isBasicParticle() )
477  {
478  const auto vv = originVertex( d, P );
479  if ( msgLevel(MSG::VERBOSE) ) verbose() << "Went up : " << vv << endmsg ;
480  if ( vv ) return vv;
481  }
482  }
483  return nullptr;
484 }
bool isBasicParticle() const
a basic particle has no daughters
Definition: Particle.h:863
const LHCb::Vertex * endVertex() const
Retrieve (const) Reference to end vertex (ex. decay)
Definition: Particle.h:723
const SmartRefVector< LHCb::Particle > & daughters() const
Retrieve (const) Reference to daughter particles. Users are strongly discouraged to use setDaughters ...
Definition: Particle.h:758
const LHCb::VertexBase * originVertex(const LHCb::Particle *top, const LHCb::Particle *P) const
origin vertex
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209

Member Data Documentation

const IDistanceCalculator* TupleToolGeometry::m_dist = nullptr
private

Definition at line 132 of file TupleToolGeometry.h.

IDVAlgorithm* TupleToolGeometry::m_dva = nullptr
private

Definition at line 139 of file TupleToolGeometry.h.

bool TupleToolGeometry::m_fillMultiPV
private

fill multiPV variables

Definition at line 135 of file TupleToolGeometry.h.

IPVReFitter* TupleToolGeometry::m_pvReFitter = nullptr
private

Definition at line 141 of file TupleToolGeometry.h.

std::string TupleToolGeometry::m_pvReFitterName
private

Definition at line 142 of file TupleToolGeometry.h.

bool TupleToolGeometry::m_refitPVs
private

Definition at line 134 of file TupleToolGeometry.h.


The documentation for this class was generated from the following files: