ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | Static Private Attributes | List of all members
D3PD::CovarianceFillerTool Class Referenceabstract

Block filler tool for error and covariance matrix. More...

#include <CovarianceFillerTool.h>

Inheritance diagram for D3PD::CovarianceFillerTool:
Collaboration diagram for D3PD::CovarianceFillerTool:

Public Member Functions

 CovarianceFillerTool (const std::string &type, const std::string &name, const IInterface *parent)
 Standard Gaudi tool constructor. More...
 
virtual StatusCode book ()
 Book variables for this block. More...
 
virtual StatusCode fill (const AmgSymMatrix(5) &p)
 Fill one block — type-safe version. More...
 
virtual StatusCode fill (const AmgSymMatrix(3) &p)
 
virtual StatusCode fill (const Amg::MatrixX &p)
 
virtual StatusCode configureD3PD (IAddVariable *tree, const std::type_info &ti)
 Configure during initialization: type-check. More...
 
StatusCode configureD3PD (IAddVariable *tree)
 Configure the parent tree. More...
 
virtual StatusCode fillUntyped (const void *p, bool again=false)
 Fill one block. More...
 
virtual StatusCode fill (const Types< AmgSymMatrix(5), AmgSymMatrix(3), Amg::MatrixX > &p)=0
 Fill one block — type-safe version. More...
 
virtual StatusCode fillAgain (const Types< AmgSymMatrix(5), AmgSymMatrix(3), Amg::MatrixX > &p)
 Fill one block, after AGAIN has been returned (type-safe). More...
 
virtual StatusCode addVariable (const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
 Add a variable to the tuple. More...
 
template<class T >
StatusCode addVariable (const std::string &name, T *&ptr, const std::string &docstring="")
 Make the template implementation from IAddVariable visible. More...
 
template<class T , class U >
StatusCode addVariable (const std::string &name, T *&ptr, const std::string &docstring, const U &defval)
 Make the template implementation from IAddVariable visible. More...
 
virtual StatusCode addVariable (const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)=0
 Make the template implementation from IAddVariable visible. More...
 
template<class T >
StatusCode addVariable (const std::string &name, T *&ptr, const std::string &docstring="")
 Add a variable to the tuple. More...
 
template<class T , class U >
StatusCode addVariable (const std::string &name, T *&ptr, const std::string &docstring, const U &defval)
 Add a variable to the tuple. More...
 
virtual StatusCode addDimensionedVariable (const std::string &name, const std::type_info &ti, void *&ptr, const std::string &dim, const std::string &docstring="", const void *defval=0)
 Add a variable to the tuple. More...
 
template<class T >
StatusCode addDimensionedVariable (const std::string &name, T *&ptr, const std::string &dim, const std::string &docstring="")
 Add a variable to the tuple. More...
 
template<class T , class U >
StatusCode addDimensionedVariable (const std::string &name, T *&ptr, const std::string &dim, const std::string &docstring, const U &defval)
 Add a variable to the tuple. More...
 
virtual StatusCode addDimensionedVariable (const std::string &name, const std::type_info &ti, void *&ptr, const std::string &dim, const std::string &docstring="", const void *defval=0)=0
 Add a variable to the tuple. More...
 
template<class T >
StatusCode addDimensionedVariable (const std::string &name, T *&ptr, const std::string &dim, const std::string &docstring="")
 Add a variable to the tuple. More...
 
template<class T , class U >
StatusCode addDimensionedVariable (const std::string &name, T *&ptr, const std::string &dim, const std::string &docstring, const U &defval)
 Add a variable to the tuple. More...
 

Protected Member Functions

StatusCode configureImpl (IAddVariable *tree, const std::type_info &ti, const std::type_info &fill_ti)
 Configure during initialization: type-check. More...
 
StatusCode configureImpl (IAddVariable *tree, const std::type_info &ti, const std::vector< const std::type_info * > &tis, size_t &which)
 Configure during initialization: type-check. More...
 
StatusCode convert (void const *&p) const
 Do type conversion. More...
 

Protected Attributes

ObjectMetadata m_metadata
 Metadata about the variables created by this object. More...
 

Private Attributes

bool m_writeError
 parameters More...
 
bool m_writeDiagCovariance
 
bool m_writeOffDiagCovariance
 
bool m_isPosition
 
bool m_isTrackPerigee
 
int m_nParameters
 
std::vector< float * > m_err
 Variables: uncertainty. More...
 
std::vector< float * > m_cov
 Variables: covariance matrix. More...
 
std::string m_prefix
 Property: the variable prefix for this block. More...
 
std::string m_suffix
 Property: the variable prefix for this block. More...
 
std::string m_blockName
 Property: the name of this block. More...
 
TypeConverter m_converter
 Helper to do type conversions. More...
 
IAddVariablem_tree
 Reference to the block name. More...
 

Static Private Attributes

static const std::string s_emptyString
 Used to provide a default value for blockName. More...
 

Detailed Description

Block filler tool for error and covariance matrix.

Definition at line 29 of file CovarianceFillerTool.h.

Constructor & Destructor Documentation

◆ CovarianceFillerTool()

D3PD::CovarianceFillerTool::CovarianceFillerTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Standard Gaudi tool constructor.

Parameters
typeThe name of the tool type.
nameThe tool name.
parentThe tool's Gaudi parent.

Definition at line 31 of file CovarianceFillerTool.cxx.

36 {
37  declareProperty ("Error", m_writeError=true);
38  declareProperty ("DiagCovariance", m_writeDiagCovariance=false);
39  declareProperty ("OffDiagCovariance", m_writeOffDiagCovariance=false);
40  declareProperty ("IsPosition", m_isPosition=false);
41  declareProperty ("IsTrackPerigee", m_isTrackPerigee=false);
42  declareProperty ("NParameters", m_nParameters=0);
43 }

Member Function Documentation

◆ addDimensionedVariable() [1/6]

StatusCode D3PD::AddVariable::addDimensionedVariable ( const std::string &  name,
const std::type_info &  ti,
void *&  ptr,
const std::string &  dim,
const std::string &  docstring = "",
const void *  defval = 0 
)
virtualinherited

Add a variable to the tuple.

Parameters
nameThe name of the variable.
typeThe type of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
dimDimension for the variable. (Presently unimplemented!)
docstringDocumentation string for this variable.
defvalPointer to the default value to use for this variable. Null for no default (generally means to fill with zeros). Of the type given by ti. Only works for basic types.

If called from the constructor, the only effect is to clear ptr.

Implements D3PD::IAddVariable.

Definition at line 123 of file AddVariable.cxx.

129 {
130  if (!m_tree) {
131  // Called from constructor --- just initialize pointer.
132  ptr = 0;
133  return StatusCode::SUCCESS;
134  }
135 
137  ti, ptr, dim,
138  docstring, defval ) );
140  ti, ptr, dim,
141  docstring, defval);
142 }

◆ addDimensionedVariable() [2/6]

virtual StatusCode D3PD::IAddVariable::addDimensionedVariable
inherited

Add a variable to the tuple.

Parameters
nameThe name of the variable.
typeThe type of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
dimDimension for the variable. (Presently unimplemented!)
docstringDocumentation string for this variable.
defvalPointer to the default value to use for this variable. Null for no default (generally means to fill with zeros). Of the type given by ti. Only works for basic types.

If called from the constructor, the only effect is to clear ptr.

◆ addDimensionedVariable() [3/6]

template<class T , class U >
StatusCode D3PD::IAddVariable::addDimensionedVariable ( class T  ,
class U   
)
inherited

Add a variable to the tuple.

Parameters
nameThe name of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
dimDimension for the variable. (Presently unimplemented!)
docstringDocumentation string for this variable.
defvalPointer to the default value to use for this variable. Only works for basic types.

If called from the constructor, the only effect is to clear ptr.

◆ addDimensionedVariable() [4/6]

template<class T , class U >
StatusCode D3PD::IAddVariable::addDimensionedVariable ( const std::string &  name,
T *&  ptr,
const std::string &  dim,
const std::string &  docstring,
const U &  defval 
)
inherited

Add a variable to the tuple.

Parameters
nameThe name of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
dimDimension for the variable. (Presently unimplemented!)
docstringDocumentation string for this variable.
defvalPointer to the default value to use for this variable. Only works for basic types.

If called from the constructor, the only effect is to clear ptr.

◆ addDimensionedVariable() [5/6]

template<class T >
StatusCode D3PD::IAddVariable::addDimensionedVariable ( class T  )
inherited

Add a variable to the tuple.

Parameters
nameThe name of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
dimDimension for the variable. (Presently unimplemented!)
docstringDocumentation string for this variable.

If called from the constructor, the only effect is to clear ptr.

◆ addDimensionedVariable() [6/6]

template<class T >
StatusCode D3PD::IAddVariable::addDimensionedVariable ( const std::string &  name,
T *&  ptr,
const std::string &  dim,
const std::string &  docstring = "" 
)
inherited

Add a variable to the tuple.

Parameters
nameThe name of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
dimDimension for the variable. (Presently unimplemented!)
docstringDocumentation string for this variable.

If called from the constructor, the only effect is to clear ptr.

◆ addVariable() [1/6]

StatusCode D3PD::AddVariable::addVariable ( const std::string &  name,
const std::type_info &  ti,
void *&  ptr,
const std::string &  docstring = "",
const void *  defval = 0 
)
virtualinherited

Add a variable to the tuple.

Parameters
nameThe name of the variable.
typeThe type of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
docstringDocumentation string for this variable.
defvalPointer to the default value to use for this variable. Null for no default (generally means to fill with zeros). Of the type given by ti. Only works for basic types.

If called from the constructor, the only effect is to clear ptr.

Implements D3PD::IAddVariable.

Definition at line 85 of file AddVariable.cxx.

90 {
91  if (!m_tree) {
92  // Called from constructor --- just initialize pointer.
93  ptr = 0;
94  return StatusCode::SUCCESS;
95  }
96 
98  ti, ptr, docstring, defval ) );
100  ti, ptr, docstring, defval);
101 }

◆ addVariable() [2/6]

virtual StatusCode D3PD::IAddVariable::addVariable
inherited

Make the template implementation from IAddVariable visible.

◆ addVariable() [3/6]

template<class T , class U >
StatusCode D3PD::IAddVariable::addVariable ( class T  ,
class U   
)
inherited

Make the template implementation from IAddVariable visible.

◆ addVariable() [4/6]

template<class T , class U >
StatusCode D3PD::IAddVariable::addVariable ( const std::string &  name,
T *&  ptr,
const std::string &  docstring,
const U &  defval 
)
inherited

Add a variable to the tuple.

Parameters
nameThe name of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
docstringDocumentation string for this variable.
defvalPointer to the default value to use for this variable. Only works for basic types.

If called from the constructor, the only effect is to clear ptr.

◆ addVariable() [5/6]

template<class T >
StatusCode D3PD::IAddVariable::addVariable ( class T  )
inherited

Make the template implementation from IAddVariable visible.

◆ addVariable() [6/6]

template<class T >
StatusCode D3PD::IAddVariable::addVariable ( const std::string &  name,
T *&  ptr,
const std::string &  docstring = "" 
)
inherited

Add a variable to the tuple.

Parameters
nameThe name of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
docstringDocumentation string for this variable.

If called from the constructor, the only effect is to clear ptr.

◆ book()

StatusCode D3PD::CovarianceFillerTool::book ( )
virtual

Book variables for this block.

Implements D3PD::BlockFillerTool< Types< AmgSymMatrix(5), AmgSymMatrix(3), Amg::MatrixX > >.

Definition at line 49 of file CovarianceFillerTool.cxx.

50 {
51 
53  REPORT_MESSAGE (MSG::WARNING) << "CovarianceFillerTool is configured as a position and a track perigee error matrix filler"
54  << " ===> Filling a generic covariance matrix";
55  m_isPosition = false;
56  m_isTrackPerigee = false;
57  }
58 
59  if( m_isPosition ){
60  m_nParameters = 3;
61  }else if( m_isTrackPerigee ){
62  m_nParameters = 5;
63  }else{
64  //REPORT_MESSAGE (MSG::DEBUG) << "CovarianceFillerTool is filling a generic covariance matrix";
65  }
66 
67  if(m_nParameters<=0){
68  REPORT_MESSAGE (MSG::WARNING) << "CovarianceFillerTool is configured to fill a generic covariance matrix of size <= 0";
69  return StatusCode::SUCCESS;
70  }
71 
72  if( m_writeError )
73  m_err.resize (m_nParameters);
74 
75  int ncov = 0;
77  ncov = m_nParameters;
79  ncov += m_nParameters * (m_nParameters - 1) / 2;
80  m_cov.resize (ncov);
81 
82  if( m_isPosition ){
83  if( m_writeError ){
84  CHECK( addVariable ("err_x", m_err[0]) );
85  CHECK( addVariable ("err_y", m_err[1]) );
86  CHECK( addVariable ("err_z", m_err[2]) );
87  }
88  size_t icov = 0;
90  CHECK( addVariable ("cov_x", m_cov[icov++]) );
91  CHECK( addVariable ("cov_y", m_cov[icov++]) );
92  CHECK( addVariable ("cov_z", m_cov[icov++]) );
93  }
95  CHECK( addVariable ("cov_xy", m_cov[icov++]) );
96  CHECK( addVariable ("cov_xz", m_cov[icov++]) );
97  CHECK( addVariable ("cov_yz", m_cov[icov++]) );
98  }
99  }else if( m_isTrackPerigee ){
100  if( m_writeError ) {
101  CHECK( addVariable ("err_d0", m_err[0]) );
102  CHECK( addVariable ("err_z0", m_err[1]) );
103  CHECK( addVariable ("err_phi", m_err[2]) );
104  CHECK( addVariable ("err_theta", m_err[3]) );
105  CHECK( addVariable ("err_qoverp",m_err[4]) );
106  }
107 
108  size_t icov = 0;
109  if( m_writeDiagCovariance ){
110  CHECK( addVariable ("cov_d0", m_cov[icov++]) );
111  CHECK( addVariable ("cov_z0", m_cov[icov++]) );
112  CHECK( addVariable ("cov_phi", m_cov[icov++]) );
113  CHECK( addVariable ("cov_theta", m_cov[icov++]) );
114  CHECK( addVariable ("cov_qoverp", m_cov[icov++]) );
115  }
117  CHECK( addVariable ("cov_d0_z0", m_cov[icov++]) );
118  CHECK( addVariable ("cov_d0_phi", m_cov[icov++]) );
119  CHECK( addVariable ("cov_d0_theta", m_cov[icov++]) );
120  CHECK( addVariable ("cov_d0_qoverp", m_cov[icov++]) );
121  CHECK( addVariable ("cov_z0_phi", m_cov[icov++]) );
122  CHECK( addVariable ("cov_z0_theta", m_cov[icov++]) );
123  CHECK( addVariable ("cov_z0_qoverp", m_cov[icov++]) );
124  CHECK( addVariable ("cov_phi_theta", m_cov[icov++]) );
125  CHECK( addVariable ("cov_phi_qoverp", m_cov[icov++]) );
126  CHECK( addVariable ("cov_theta_qoverp",m_cov[icov++]) );
127  }
128  }else{
129  std::ostringstream str;
130  if( m_writeError ) {
131  for(int i=0; i<m_nParameters; i++){
132  str.str("");
133  str << "err_par" << i;
134  CHECK( addVariable (str.str().c_str(), m_err[i]) );
135  }
136  }
137  size_t icov = 0;
138  if( m_writeDiagCovariance) {
139  for(int i=0; i<m_nParameters; i++){
140  str.str("");
141  str << "cov_par" << i << "_par" << i;
142  CHECK( addVariable (str.str().c_str(), m_cov[icov++]) );
143  }
144  }
146  for(int i=0; i<m_nParameters; i++){
147  for(int j=i+1; j<m_nParameters; j++){
148  str.str("");
149  str << "cov_par" << i << "_par" << j;
150  CHECK( addVariable (str.str().c_str(), m_cov[icov++]) );
151  }
152  }
153  }
154  assert (icov == m_cov.size());
155  }
156 
157  return StatusCode::SUCCESS;
158 }

◆ configureD3PD() [1/2]

StatusCode D3PD::AddVariable::configureD3PD ( IAddVariable tree)
inherited

Configure the parent tree.

Parameters
treeThe parent IAddVariable instance.

Definition at line 61 of file AddVariable.cxx.

62 {
63  m_tree = tree;
64  m_metadata.clear();
65  return StatusCode::SUCCESS;
66 }

◆ configureD3PD() [2/2]

virtual StatusCode D3PD::BlockFillerTool< Types< AmgSymMatrix(5), AmgSymMatrix(3), Amg::MatrixX > >::configureD3PD ( IAddVariable tree,
const std::type_info &  ti 
)
virtualinherited

Configure during initialization: type-check.

Parameters
treeOur parent for tuple making.
tiGives the type of the object being passed to fillUntyped.

configureD3PD should check that the type of the object coming as input is compatible with what it expects, and raise an error otherwise.

◆ configureImpl() [1/2]

StatusCode D3PD::BlockFillerToolImpl::configureImpl ( IAddVariable tree,
const std::type_info &  ti,
const std::type_info &  fill_ti 
)
protectedinherited

Configure during initialization: type-check.

Parameters
treeOur parent for tuple making.
tiGives the type of the object being passed to fillUntyped.
fill_tiis the type of object that the user code will expect.

This is the common implementation for the configureD3PD method of IBlockFillerTool. It checks that the type of the object coming as input is compatible with what the user code is expecting, and raises an error otherwise.

Definition at line 55 of file BlockFillerToolImpl.cxx.

58 {
60  CHECK( m_converter.init (ti, fill_ti) );
61 
62  return StatusCode::SUCCESS;
63 }

◆ configureImpl() [2/2]

StatusCode D3PD::BlockFillerToolImpl::configureImpl ( IAddVariable tree,
const std::type_info &  ti,
const std::vector< const std::type_info * > &  tis,
size_t &  which 
)
protectedinherited

Configure during initialization: type-check.

Parameters
treeOur parent for tuple making.
tiGives the type of the object being passed to fillUntyped.
tisList of possible input types that we can accept.
[out]whichIndex of the accepted type.

This is the common implementation for the configureD3PD method of IBlockFillerTool. It checks that the type of the object coming as input is compatible with what the user code is expecting, and raises an error otherwise.

This version allows for one of a set of types to match. If successful, WHICH is set to the index (0-based) of the matching type.

Definition at line 83 of file BlockFillerToolImpl.cxx.

87 {
89  CHECK( m_converter.init (ti, tis, which) );
90  return StatusCode::SUCCESS;
91 }

◆ convert()

StatusCode D3PD::BlockFillerToolImpl::convert ( void const *&  p) const
protectedinherited

Do type conversion.

Parameters
p[in,out]Pointer to convert.

On entry, p is a pointer to an object of the type that was passed into configureImpl as ti. Convert the pointer to point to an object of the type that was given as fill_ti. If the conversion fails, the pointer is set to 0 (and FAILURE is returned).

Definition at line 105 of file BlockFillerToolImpl.cxx.

106 {
108  if (!p) {
109  REPORT_MESSAGE (MSG::ERROR)
110  << "Pointer conversion from " << m_converter.srcName() << " to "
111  << m_converter.dstName() << "failed.";
112  return StatusCode::FAILURE;
113  }
114  return StatusCode::SUCCESS;
115 }

◆ fill() [1/4]

StatusCode D3PD::CovarianceFillerTool::fill ( const Amg::MatrixX p)
virtual

Definition at line 282 of file CovarianceFillerTool.cxx.

283 {
284 
285  if(m_nParameters<=0){
286  return StatusCode::SUCCESS;
287  }
288 
289  if( m_isTrackPerigee ) {
290  if (m.rows() > 0) {
291  if( m_writeError ) {
292  *m_err[0] = Amg::error(m,Trk::d0);
293  *m_err[1] = Amg::error(m,Trk::z0);
294  *m_err[2] = Amg::error(m,Trk::phi0);
295  *m_err[3] = Amg::error(m,Trk::theta);
296  *m_err[4] = Amg::error(m,Trk::qOverP);
297  }
298  size_t icov = 0;
299  if( m_writeDiagCovariance ) {
300  *m_cov[icov++] = m(Trk::d0,Trk::d0);
301  *m_cov[icov++] = m(Trk::z0,Trk::z0);
302  *m_cov[icov++] = m(Trk::phi0,Trk::phi0);
303  *m_cov[icov++] = m(Trk::theta,Trk::theta);
304  *m_cov[icov++] = m(Trk::qOverP,Trk::qOverP);
305  }
307  *m_cov[icov++] = m(Trk::d0,Trk::z0);
308  *m_cov[icov++] = m(Trk::d0,Trk::phi0);
309  *m_cov[icov++] = m(Trk::d0,Trk::theta);
310  *m_cov[icov++] = m(Trk::d0,Trk::qOverP);
311  *m_cov[icov++] = m(Trk::z0,Trk::phi0);
312  *m_cov[icov++] = m(Trk::z0,Trk::theta);
313  *m_cov[icov++] = m(Trk::z0,Trk::qOverP);
314  *m_cov[icov++] = m(Trk::phi0,Trk::theta);
315  *m_cov[icov++] = m(Trk::phi0,Trk::qOverP);
316  *m_cov[icov++] = m(Trk::theta,Trk::qOverP);
317  }
318  assert (icov == m_cov.size());
319  }
320  } else if( m_isPosition ){
321  if( m_writeError ) {
322  *m_err[0] = Amg::error(m,Trk::x);
323  *m_err[1] = Amg::error(m,Trk::y);
324  *m_err[2] = Amg::error(m,Trk::z);
325  }
326 
327  size_t icov = 0;
328  if( m_writeDiagCovariance ) {
329  *m_cov[icov++] = m(Trk::x,Trk::x);
330  *m_cov[icov++] = m(Trk::y,Trk::y);
331  *m_cov[icov++] = m(Trk::z,Trk::z);
332  }
334  *m_cov[icov++] = m(Trk::x,Trk::y);
335  *m_cov[icov++] = m(Trk::x,Trk::z);
336  *m_cov[icov++] = m(Trk::y,Trk::z);
337  }
338  assert (icov == m_cov.size());
339  }else{
340  if( m_writeError ) {
341  for(int i=0; i<m_nParameters; i++){
343  }
344  }
345 
346  size_t icov = 0;
347  if( m_writeDiagCovariance ) {
348  for(int i=0; i<m_nParameters; i++)
349  *m_cov[icov++] = m((Trk::ParamDefs)i,(Trk::ParamDefs)i);
350  }
352  for(int i=0; i<m_nParameters; i++) {
353  for(int j=i+1; j<m_nParameters; j++)
354  *m_cov[icov++] = m((Trk::ParamDefs)i,(Trk::ParamDefs)j);
355  }
356  }
357  assert (icov == m_cov.size());
358  }
359 
360  return StatusCode::SUCCESS;
361 }

◆ fill() [2/4]

StatusCode D3PD::CovarianceFillerTool::fill ( const AmgSymMatrix(3) &  p)
virtual

Definition at line 232 of file CovarianceFillerTool.cxx.

233 {
234 
235  if(m_nParameters<=0){
236  return StatusCode::SUCCESS;
237  }
238 
239  if( m_isPosition ){
240  if( m_writeError ) {
241  *m_err[0] = sqrt(m(Trk::x,Trk::x));
242  *m_err[1] = sqrt(m(Trk::y,Trk::y));
243  *m_err[2] = sqrt(m(Trk::z,Trk::z));
244  }
245 
246  size_t icov = 0;
247  if( m_writeDiagCovariance ) {
248  *m_cov[icov++] = m(Trk::x,Trk::x);
249  *m_cov[icov++] = m(Trk::y,Trk::y);
250  *m_cov[icov++] = m(Trk::z,Trk::z);
251  }
253  *m_cov[icov++] = m(Trk::x,Trk::y);
254  *m_cov[icov++] = m(Trk::x,Trk::z);
255  *m_cov[icov++] = m(Trk::y,Trk::z);
256  }
257  assert (icov == m_cov.size());
258  }else{
259  if( m_writeError ) {
260  for(int i=0; i<m_nParameters; i++){
261  *m_err[i] = sqrt(m((Trk::ParamDefs)i,(Trk::ParamDefs)i));
262  }
263  }
264 
265  size_t icov = 0;
266  if( m_writeDiagCovariance ) {
267  for(int i=0; i<m_nParameters; i++)
268  *m_cov[icov++] = m((Trk::ParamDefs)i,(Trk::ParamDefs)i);
269  }
271  for(int i=0; i<m_nParameters; i++) {
272  for(int j=i+1; j<m_nParameters; j++)
273  *m_cov[icov++] = m((Trk::ParamDefs)i,(Trk::ParamDefs)j);
274  }
275  }
276  assert (icov == m_cov.size());
277  }
278 
279  return StatusCode::SUCCESS;
280 }

◆ fill() [3/4]

StatusCode D3PD::CovarianceFillerTool::fill ( const AmgSymMatrix(5) &  m)
virtual

Fill one block — type-safe version.

Parameters
pThe input object.

This is called once per object. The caller is responsible for arranging that all the pointers for booked variables are set appropriately upon entry.

Parameters
mThe input object.

This is called once per object. The caller is responsible for arranging that all the pointers for booked variables are set appropriately upon entry.

Definition at line 169 of file CovarianceFillerTool.cxx.

170 {
171 
172  if(m_nParameters<=0){
173  return StatusCode::SUCCESS;
174  }
175 
176  if( m_isTrackPerigee ) {
177  if (m.rows() > 0) {
178  if( m_writeError ) {
179  *m_err[0] = Amg::error(m,Trk::d0);
180  *m_err[1] = Amg::error(m,Trk::z0);
181  *m_err[2] = Amg::error(m,Trk::phi0);
182  *m_err[3] = Amg::error(m,Trk::theta);
183  *m_err[4] = Amg::error(m,Trk::qOverP);
184  }
185  size_t icov = 0;
186  if( m_writeDiagCovariance ) {
187  *m_cov[icov++] = m(Trk::d0,Trk::d0);
188  *m_cov[icov++] = m(Trk::z0,Trk::z0);
189  *m_cov[icov++] = m(Trk::phi0,Trk::phi0);
190  *m_cov[icov++] = m(Trk::theta,Trk::theta);
191  *m_cov[icov++] = m(Trk::qOverP,Trk::qOverP);
192  }
194  *m_cov[icov++] = m(Trk::d0,Trk::z0);
195  *m_cov[icov++] = m(Trk::d0,Trk::phi0);
196  *m_cov[icov++] = m(Trk::d0,Trk::theta);
197  *m_cov[icov++] = m(Trk::d0,Trk::qOverP);
198  *m_cov[icov++] = m(Trk::z0,Trk::phi0);
199  *m_cov[icov++] = m(Trk::z0,Trk::theta);
200  *m_cov[icov++] = m(Trk::z0,Trk::qOverP);
201  *m_cov[icov++] = m(Trk::phi0,Trk::theta);
202  *m_cov[icov++] = m(Trk::phi0,Trk::qOverP);
203  *m_cov[icov++] = m(Trk::theta,Trk::qOverP);
204  }
205  assert (icov == m_cov.size());
206  }
207  }
208  else{
209  if( m_writeError ) {
210  for(int i=0; i<m_nParameters; i++){
212  }
213  }
214 
215  size_t icov = 0;
216  if( m_writeDiagCovariance ) {
217  for(int i=0; i<m_nParameters; i++)
218  *m_cov[icov++] = m((Trk::ParamDefs)i,(Trk::ParamDefs)i);
219  }
221  for(int i=0; i<m_nParameters; i++) {
222  for(int j=i+1; j<m_nParameters; j++)
223  *m_cov[icov++] = m((Trk::ParamDefs)i,(Trk::ParamDefs)j);
224  }
225  }
226  assert (icov == m_cov.size());
227  }
228 
229  return StatusCode::SUCCESS;
230 }

◆ fill() [4/4]

virtual StatusCode D3PD::BlockFillerTool< Types< AmgSymMatrix(5), AmgSymMatrix(3), Amg::MatrixX > >::fill ( const Types< AmgSymMatrix(5), AmgSymMatrix(3), Amg::MatrixX > &  p)
pure virtualinherited

Fill one block — type-safe version.

Parameters
pThe input object.

This is called once per object. The caller is responsible for arranging that all the pointers for booked variables are set appropriately upon entry.

◆ fillAgain()

virtual StatusCode D3PD::BlockFillerTool< Types< AmgSymMatrix(5), AmgSymMatrix(3), Amg::MatrixX > >::fillAgain ( const Types< AmgSymMatrix(5), AmgSymMatrix(3), Amg::MatrixX > &  p)
virtualinherited

Fill one block, after AGAIN has been returned (type-safe).

Parameters
pThe input object.

Once fill returns AGAIN, the parent should call fillAgain with the same arguments. This continues until fillAgain returns something other than AGAIN.

By default, this just calls fill().

◆ fillUntyped()

virtual StatusCode D3PD::BlockFillerTool< Types< AmgSymMatrix(5), AmgSymMatrix(3), Amg::MatrixX > >::fillUntyped ( const void *  p,
bool  again = false 
)
virtualinherited

Fill one block.

Parameters
pThe input object.
againSet if this is a subsequent call requested by an AGAIN return

This is called once per object. The type of the object at which p points is given by the ti argument to configureD3PD. The caller is responsible for arranging that all the pointers for booked variables are set appropriately upon entry.

If the return status is the special code AGAIN (defined above), then this filler tool wants to make multiple entries. The parent should set up to capture a new ‘row’ and run through the list of block filler tools again, but for this tool call fillAgainUntyped instead of fillUntyped. This should be repeated as long as fillAgainUntyped returns AGAIN.

Once fillUntyped returns AGAIN, the parent should call fillUntyped with the same p argument and again set to true. This continues until fillUntyped returns something other than AGAIN.

Not all parents may support this. In that case, returning AGAIN will be treated as an error.

Member Data Documentation

◆ m_blockName

std::string D3PD::BlockFillerToolImpl::m_blockName
privateinherited

Property: the name of this block.

Definition at line 118 of file BlockFillerToolImpl.h.

◆ m_converter

TypeConverter D3PD::BlockFillerToolImpl::m_converter
privateinherited

Helper to do type conversions.

Definition at line 121 of file BlockFillerToolImpl.h.

◆ m_cov

std::vector<float*> D3PD::CovarianceFillerTool::m_cov
private

Variables: covariance matrix.

Definition at line 76 of file CovarianceFillerTool.h.

◆ m_err

std::vector<float*> D3PD::CovarianceFillerTool::m_err
private

Variables: uncertainty.

Definition at line 73 of file CovarianceFillerTool.h.

◆ m_isPosition

bool D3PD::CovarianceFillerTool::m_isPosition
private

Definition at line 68 of file CovarianceFillerTool.h.

◆ m_isTrackPerigee

bool D3PD::CovarianceFillerTool::m_isTrackPerigee
private

Definition at line 69 of file CovarianceFillerTool.h.

◆ m_metadata

ObjectMetadata D3PD::AddVariable::m_metadata
protectedinherited

Metadata about the variables created by this object.

Definition at line 129 of file AddVariable.h.

◆ m_nParameters

int D3PD::CovarianceFillerTool::m_nParameters
private

Definition at line 70 of file CovarianceFillerTool.h.

◆ m_prefix

std::string D3PD::BlockFillerToolImpl::m_prefix
privateinherited

Property: the variable prefix for this block.

Definition at line 112 of file BlockFillerToolImpl.h.

◆ m_suffix

std::string D3PD::BlockFillerToolImpl::m_suffix
privateinherited

Property: the variable prefix for this block.

Definition at line 115 of file BlockFillerToolImpl.h.

◆ m_tree

IAddVariable* D3PD::AddVariable::m_tree
privateinherited

Reference to the block name.

The parent IAddVariable instance.

Definition at line 143 of file AddVariable.h.

◆ m_writeDiagCovariance

bool D3PD::CovarianceFillerTool::m_writeDiagCovariance
private

Definition at line 66 of file CovarianceFillerTool.h.

◆ m_writeError

bool D3PD::CovarianceFillerTool::m_writeError
private

parameters

Definition at line 65 of file CovarianceFillerTool.h.

◆ m_writeOffDiagCovariance

bool D3PD::CovarianceFillerTool::m_writeOffDiagCovariance
private

Definition at line 67 of file CovarianceFillerTool.h.

◆ s_emptyString

const std::string D3PD::AddVariable::s_emptyString
staticprivateinherited

Used to provide a default value for blockName.

Definition at line 41 of file AddVariable.h.


The documentation for this class was generated from the following files:
Trk::y
@ y
Definition: ParamDefs.h:56
D3PD::ObjectMetadata::addDimensionedVariable
virtual StatusCode addDimensionedVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &dim, const std::string &docstring="", const void *defval=0)
The object doesn't support dimensioned variables at the moment, like most of the D3PDMaker code doesn...
Definition: ObjectMetadata.cxx:157
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
yodamerge_tmp.dim
dim
Definition: yodamerge_tmp.py:239
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
D3PD::CovarianceFillerTool::m_writeError
bool m_writeError
parameters
Definition: CovarianceFillerTool.h:65
Trk::z
@ z
global position (cartesian)
Definition: ParamDefs.h:57
D3PD::CovarianceFillerTool::m_err
std::vector< float * > m_err
Variables: uncertainty.
Definition: CovarianceFillerTool.h:73
D3PD::TypeConverter::dstName
std::string dstName() const
Return the name of the destination type, or an empty string.
Definition: TypeConverter.cxx:151
D3PD::AddVariable::configureD3PD
StatusCode configureD3PD(IAddVariable *tree)
Configure the parent tree.
Definition: AddVariable.cxx:61
D3PD::AddVariable::m_suffix
const std::string & m_suffix
Reference to the variable suffix.
Definition: AddVariable.h:137
Trk::ParamDefs
ParamDefs
Definition: ParamDefs.h:32
tree
TChain * tree
Definition: tile_monitor.h:30
D3PD::CovarianceFillerTool::m_writeOffDiagCovariance
bool m_writeOffDiagCovariance
Definition: CovarianceFillerTool.h:67
D3PD::AddVariable::m_prefix
const std::string & m_prefix
Reference to the variable prefix.
Definition: AddVariable.h:134
Trk::z0
@ z0
Definition: ParamDefs.h:64
D3PD::AddVariable::addVariable
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
Add a variable to the tuple.
Definition: AddVariable.cxx:85
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
D3PD::Types
std::tuple< WrapType< TYPES >... > Types
A simple tuple of multiple types.
Definition: PhysicsAnalysis/D3PDMaker/D3PDMakerUtils/D3PDMakerUtils/Types.h:61
D3PD::AddVariable::m_tree
IAddVariable * m_tree
Reference to the block name.
Definition: AddVariable.h:143
D3PD::TypeConverter::init
StatusCode init(const std::type_info &src_ti, const std::type_info &dst_ti)
Initialize the converter.
Definition: TypeConverter.cxx:51
D3PD::AmgSymMatrix
const AmgSymMatrix(5) *PerigeeCovarianceAssociationTool
Return the target object.
Definition: PerigeeCovarianceAssociationTool.cxx:43
D3PD::TypeConverter::srcName
std::string srcName() const
Return the name of the source type, or an empty string.
Definition: TypeConverter.cxx:141
D3PD::AddVariable::m_metadata
ObjectMetadata m_metadata
Metadata about the variables created by this object.
Definition: AddVariable.h:129
D3PD::TypeConverter::convertUntyped
const void * convertUntyped(const void *p) const
Convert pointer.
Definition: TypeConverter.cxx:116
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
lumiFormat.i
int i
Definition: lumiFormat.py:85
Trk::theta
@ theta
Definition: ParamDefs.h:66
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
D3PD::ObjectMetadata::clear
void clear()
Function clearing the object.
Definition: ObjectMetadata.cxx:352
python.Utils.unixtools.which
def which(filename, env=os.environ)
UNIX-style which ---------------------------------------------------------—.
Definition: unixtools.py:39
D3PD::CovarianceFillerTool::m_nParameters
int m_nParameters
Definition: CovarianceFillerTool.h:70
D3PD::BlockFillerToolImpl::m_converter
TypeConverter m_converter
Helper to do type conversions.
Definition: BlockFillerToolImpl.h:121
D3PD::CovarianceFillerTool::m_writeDiagCovariance
bool m_writeDiagCovariance
Definition: CovarianceFillerTool.h:66
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
Trk::d0
@ d0
Definition: ParamDefs.h:63
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
D3PD::ObjectMetadata::addVariable
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
This function can be used to save the metadata about a D3PD variable.
Definition: ObjectMetadata.cxx:109
D3PD::CovarianceFillerTool::m_cov
std::vector< float * > m_cov
Variables: covariance matrix.
Definition: CovarianceFillerTool.h:76
D3PD::BlockFillerTool< Types< AmgSymMatrix(5), AmgSymMatrix(3), Amg::MatrixX > >::BlockFillerTool
BlockFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
REPORT_MESSAGE
#define REPORT_MESSAGE(LVL)
Report a message.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:365
D3PD::CovarianceFillerTool::m_isTrackPerigee
bool m_isTrackPerigee
Definition: CovarianceFillerTool.h:69
python.CaloScaleNoiseConfig.str
str
Definition: CaloScaleNoiseConfig.py:78
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:67
D3PD::IAddVariable::addVariable
StatusCode addVariable(const std::string &name, T *&ptr, const std::string &docstring="")
Add a variable to the tuple.
D3PD::IAddVariable::addDimensionedVariable
StatusCode addDimensionedVariable(const std::string &name, T *&ptr, const std::string &dim, const std::string &docstring="")
Add a variable to the tuple.
str
Definition: BTagTrackIpAccessor.cxx:11
D3PD::CovarianceFillerTool::m_isPosition
bool m_isPosition
Definition: CovarianceFillerTool.h:68
Trk::x
@ x
Definition: ParamDefs.h:55
Trk::phi0
@ phi0
Definition: ParamDefs.h:65