ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Trk::ElectronMaterialMixtureConvolution Class Referencefinal

#include <ElectronMaterialMixtureConvolution.h>

Inheritance diagram for Trk::ElectronMaterialMixtureConvolution:
Collaboration diagram for Trk::ElectronMaterialMixtureConvolution:

Public Types

enum  MaterialUpdateType { Normal = 0, Preupdate = 1, Postupdate = 2 }
 

Public Member Functions

 ElectronMaterialMixtureConvolution (const std::string &, const std::string &, const IInterface *)
 Destructor. More...
 
virtual ~ElectronMaterialMixtureConvolution ()
 AlgTool initialise method. More...
 
virtual StatusCode initialize () override final
 Convolution with full material properties. More...
 
virtual MultiComponentState update (std::vector< GsfMaterial::Combined > &, const MultiComponentState &, const Layer &, PropDirection direction=anyDirection, ParticleHypothesis particleHypothesis=nonInteracting) const override final
 Convolution with pre-measurement-update material properties. More...
 
virtual MultiComponentState preUpdate (std::vector< GsfMaterial::Combined > &, const MultiComponentState &, const Layer &, PropDirection direction=anyDirection, ParticleHypothesis particleHypothesis=nonInteracting) const override final
 Convolution with post-measurement-update material properties. More...
 
virtual MultiComponentState postUpdate (std::vector< GsfMaterial::Combined > &, const MultiComponentState &, const Layer &, PropDirection direction=anyDirection, ParticleHypothesis particleHypothesis=nonInteracting) const override final
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 < IAlgTool and AlgTool interface method More...
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

Trk::MultiComponentState update (std::vector< GsfMaterial::Combined > &, const Trk::MultiComponentState &inputState, const Trk::Layer &layer, Trk::PropDirection direction, Trk::ParticleHypothesis particleHypothesis, MaterialUpdateType updateType) const
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

ElectronCombinedMaterialEffects m_materialEffects {}
 
Gaudi::Property< unsigned int > m_maximumNumberOfComponents
 
Gaudi::Property< std::string > m_parameterisationFileName
 
Gaudi::Property< std::string > m_parameterisationFileNameHighX0
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 28 of file ElectronMaterialMixtureConvolution.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ MaterialUpdateType

Enumerator
Normal 
Preupdate 
Postupdate 

Definition at line 34 of file ElectronMaterialMixtureConvolution.h.

35  {
36  Normal = 0,
37  Preupdate = 1,
38  Postupdate = 2
39  };

Constructor & Destructor Documentation

◆ ElectronMaterialMixtureConvolution()

Trk::ElectronMaterialMixtureConvolution::ElectronMaterialMixtureConvolution ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Destructor.

Definition at line 98 of file ElectronMaterialMixtureConvolution.cxx.

103 {
104  declareInterface<IMaterialMixtureConvolution>(this);
105 }

◆ ~ElectronMaterialMixtureConvolution()

Trk::ElectronMaterialMixtureConvolution::~ElectronMaterialMixtureConvolution ( )
virtualdefault

AlgTool initialise method.

Member Function Documentation

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ initialize()

StatusCode Trk::ElectronMaterialMixtureConvolution::initialize ( )
finaloverridevirtual

Convolution with full material properties.

Definition at line 111 of file ElectronMaterialMixtureConvolution.cxx.

112 {
114  ATH_MSG_FATAL("Requested MaximumNumberOfComponents > "
116  return StatusCode::FAILURE;
117  }
118 
119  m_materialEffects = ElectronCombinedMaterialEffects(
121  return StatusCode::SUCCESS;
122 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

static const InterfaceID& Trk::IMaterialMixtureConvolution::interfaceID ( )
inlinestaticinherited

< IAlgTool and AlgTool interface method

Definition at line 34 of file IMaterialMixtureConvolution.h.

35  {
36  return IID_IMaterialMixtureConvolution;
37  };

◆ msg() [1/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ postUpdate()

Trk::MultiComponentState Trk::ElectronMaterialMixtureConvolution::postUpdate ( std::vector< GsfMaterial::Combined > &  caches,
const MultiComponentState multiComponentState,
const Layer layer,
Trk::PropDirection  direction = anyDirection,
Trk::ParticleHypothesis  particleHypothesis = nonInteracting 
) const
finaloverridevirtual

Implements Trk::IMaterialMixtureConvolution.

Definition at line 184 of file ElectronMaterialMixtureConvolution.cxx.

190 {
191 
192  /* -------------------------------------
193  Preliminary checks
194  ------------------------------------- */
195 
196  Trk::MultiComponentState updatedMergedState = update(caches,
197  multiComponentState,
198  layer,
199  direction,
200  particleHypothesis,
201  Postupdate);
202 
203  if (updatedMergedState.empty()) {
204  return {};
205  }
206  // Renormalise state
208 
209  return updatedMergedState;
210 }

◆ preUpdate()

Trk::MultiComponentState Trk::ElectronMaterialMixtureConvolution::preUpdate ( std::vector< GsfMaterial::Combined > &  caches,
const MultiComponentState multiComponentState,
const Layer layer,
Trk::PropDirection  direction = anyDirection,
Trk::ParticleHypothesis  particleHypothesis = nonInteracting 
) const
finaloverridevirtual

Convolution with post-measurement-update material properties.

Implements Trk::IMaterialMixtureConvolution.

Definition at line 154 of file ElectronMaterialMixtureConvolution.cxx.

160 {
161  /* -------------------------------------
162  Preliminary checks
163  ------------------------------------- */
164  Trk::MultiComponentState updatedMergedState = update(caches,
165  multiComponentState,
166  layer,
167  direction,
168  particleHypothesis,
169  Preupdate);
170  if (updatedMergedState.empty()) {
171  return {};
172  }
173  // Renormalise state
175 
176  return updatedMergedState;
177 }

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ update() [1/2]

Trk::MultiComponentState Trk::ElectronMaterialMixtureConvolution::update ( std::vector< GsfMaterial::Combined > &  caches,
const MultiComponentState multiComponentState,
const Layer layer,
Trk::PropDirection  direction = anyDirection,
Trk::ParticleHypothesis  particleHypothesis = nonInteracting 
) const
finaloverridevirtual

Convolution with pre-measurement-update material properties.

Implements Trk::IMaterialMixtureConvolution.

Definition at line 129 of file ElectronMaterialMixtureConvolution.cxx.

135 {
136 
137  Trk::MultiComponentState updatedMergedState = update(
138  caches, multiComponentState, layer, direction, particleHypothesis, Normal);
139 
140  if (updatedMergedState.empty()) {
141  return {};
142  }
143  // Renormalise state
145 
146  return updatedMergedState;
147 }

◆ update() [2/2]

Trk::MultiComponentState Trk::ElectronMaterialMixtureConvolution::update ( std::vector< GsfMaterial::Combined > &  caches,
const Trk::MultiComponentState inputState,
const Trk::Layer layer,
Trk::PropDirection  direction,
Trk::ParticleHypothesis  particleHypothesis,
MaterialUpdateType  updateType 
) const
private

Definition at line 213 of file ElectronMaterialMixtureConvolution.cxx.

220 {
221 
222  // Check the multi-component state is populated
223  if (inputState.empty()) {
224  return {};
225  }
226 
227  double updateFactor(1.);
228  // Full method does this for each component which i don't think this is needed
229  if (updateType == Preupdate) {
230  updateFactor =
231  layer.preUpdateMaterialFactor(*inputState.front().params, direction);
232  } else if (updateType == Postupdate) {
233  updateFactor =
234  layer.postUpdateMaterialFactor(*inputState.front().params, direction);
235  }
236 
237  if (updateFactor < 0.01) {
238  // Bail out as factor is too small to bother about
239  return {};
240  }
241 
242  caches.resize(inputState.size());
243 
244  // Fill cache and work out how many final components there should be
245  size_t n(0);
246  for (size_t i(0); i < inputState.size(); ++i) {
247  const AmgSymMatrix(5)* measuredCov = inputState[i].params->covariance();
248  // If the momentum is too dont apply material effects
249  if (inputState[i].params->momentum().mag() <= 250. * Gaudi::Units::MeV) {
250  dummyCacheElement(caches[i]);
251  updateCacheElement(
252  caches[i], 0, inputState[i].params->parameters(), measuredCov);
253  caches[i].weights[0] = inputState[i].weight;
254  n += caches[i].numEntries;
255  continue;
256  }
257 
258  // Get the material effects and store them in the cache
259  std::pair<const Trk::MaterialProperties*, double> matPropPair =
260  getMaterialProperties(inputState[i].params.get(), layer);
261 
262  if (!matPropPair.first) {
263  dummyCacheElement(caches[i]);
264  updateCacheElement(
265  caches[i], 0, inputState[i].params->parameters(), measuredCov);
266  caches[i].weights[0] = inputState[i].weight;
267  n += caches[i].numEntries;
268  continue;
269  }
270  // Now we can compute/apply actual material effects
271  // Apply the update factor
272  matPropPair.second *= updateFactor;
273  m_materialEffects.compute(caches[i],
274  inputState[i],
275  *matPropPair.first,
276  matPropPair.second,
277  direction);
278 
279  // Apply material effects to input state and store results in cache
280  for (size_t j(0); j < caches[i].numEntries; ++j) {
281  updateCacheElement(
282  caches[i], j, inputState[i].params->parameters(), measuredCov);
283  // Adjust q/p of the (delta) Parameters
284  // make sure update is good.
285  if (!updateP(caches[i].deltaParameters[j][Trk::qOverP],
286  caches[i].deltaPs[j])) {
287  ATH_MSG_ERROR("Cannot update state vector momentum!!!");
288  return {};
289  }
290  // Store component weight
291  caches[i].weights[j] *= inputState[i].weight;
292  // Ensure weight of component is not too small to save us from potential
293  // FPE's Value. Weights are double so the min of float should
294  // be small enough and should be handled
295  if (caches[i].weights[j] < std::numeric_limits<float>::min()) {
296  caches[i].weights[j] = std::numeric_limits<float>::min();
297  }
298  }
299  n += caches[i].numEntries;
300  } // End of loop filling the cache
301 
302  // Fill information for calculating which components to merge
303  // In addition scan all components for covariance matrices. If one or more
304  // component is missing an error matrix, component reduction is impossible.
305  bool componentWithoutMeasurement = false;
306 
307  GSFUtils::Component1DArray componentsArray;
308  componentsArray.numComponents = n;
309  std::array<std::pair<size_t, size_t>,
311  indices{};
312 
313  size_t k(0);
314  for (size_t i(0); i < inputState.size(); ++i) {
315  for (size_t j(0); j < caches[i].numEntries; ++j) {
316  const AmgSymMatrix(5)* measuredCov = inputState[i].params->covariance();
317  // Fill in infomation
318  const double cov =
319  measuredCov ? caches[i].deltaCovariances[j](Trk::qOverP, Trk::qOverP)
320  : -1.;
321  if (!measuredCov) {
322  componentWithoutMeasurement = true;
323  }
324 
325  componentsArray.components[k].mean =
326  caches[i].deltaParameters[j][Trk::qOverP];
327  componentsArray.components[k].cov = cov;
328  componentsArray.components[k].invCov = cov > 0 ? 1. / cov : 1e10;
329  componentsArray.components[k].weight = caches[i].weights[j];
330  indices[k] = { i, j };
331  ++k;
332  }
333  }
334 
335  // fallback if we have a component without measurement
336  if (componentWithoutMeasurement) {
337  auto* result = std::max_element(
338  componentsArray.components.data(),
339  componentsArray.components.data() + componentsArray.numComponents,
340  [](const auto& a, const auto& b) { return a.weight < b.weight; });
341  auto index = std::distance(componentsArray.components.data(), result);
342 
343  // Build the first TP
344  size_t stateIndex = indices[index].first;
345  size_t materialIndex = indices[index].second;
346 
347  AmgVector(5)& updatedStateVector =
348  caches[stateIndex].deltaParameters[materialIndex];
349  const AmgSymMatrix(5)* measuredCov =
350  inputState[stateIndex].params->covariance();
351  std::optional<AmgSymMatrix(5)> updatedCovariance = std::nullopt;
352  if (measuredCov &&
353  caches[stateIndex].deltaCovariances.size() > materialIndex) {
354  updatedCovariance =
355  AmgSymMatrix(5)(caches[stateIndex].deltaCovariances[materialIndex]);
356  }
357  std::unique_ptr<Trk::TrackParameters> updatedTrackParameters =
358  inputState[stateIndex]
359  .params->associatedSurface()
360  .createUniqueTrackParameters(updatedStateVector[Trk::loc1],
361  updatedStateVector[Trk::loc2],
362  updatedStateVector[Trk::phi],
363  updatedStateVector[Trk::theta],
364  updatedStateVector[Trk::qOverP],
365  std::move(updatedCovariance));
366 
367  Trk::ComponentParameters dummyCompParams = {std::move(updatedTrackParameters),
368  1.};
369  Trk::MultiComponentState returnMultiState;
370  returnMultiState.push_back(std::move(dummyCompParams));
371  return returnMultiState;
372  }
373 
374  // Gather the merges we need
377  KL = findMerges(componentsArray, m_maximumNumberOfComponents);
378  }
379 
380  // Merge components "From" to components "To"
381  MultiComponentStateAssembler::Cache assemblerCache;
382  std::array<bool, GSFConstants::maxComponentsAfterConvolution> isMerged = {};
383  int returnedMerges = KL.numMerges;
384 
385  for (int i = 0; i < returnedMerges; ++i) {
386  const int8_t mini = KL.merges[i].To;
387  const int8_t minj = KL.merges[i].From;
388  if (isMerged[minj]) {
389  ATH_MSG_WARNING("Component is already merged " << static_cast<int>(minj));
390  continue;
391  }
392  // Get the first TP
393  size_t stateIndex = indices[mini].first;
394  size_t materialIndex = indices[mini].second;
395  // Copy weight and first parameters as they are needed later on
396  // for updating the covariance
397  AmgVector(5) firstParameters =
398  caches[stateIndex].deltaParameters[materialIndex];
399  double firstWeight = caches[stateIndex].weights[materialIndex];
400 
401  // Get the second TP
402  size_t stateIndex2 = indices[minj].first;
403  size_t materialIndex2 = indices[minj].second;
404 
405  // Some values for sanity checks
406  isMerged[minj] = true;
407 
408  // Update first parameters and weight
409  Trk::MultiComponentStateCombiner::combineParametersWithWeight(
410  caches[stateIndex].deltaParameters[materialIndex],
411  caches[stateIndex].weights[materialIndex],
412  caches[stateIndex2].deltaParameters[materialIndex2],
413  caches[stateIndex2].weights[materialIndex2]);
414 
415  // Update covariance
416  Trk::MultiComponentStateCombiner::combineCovWithWeight(
417  firstParameters,
418  caches[stateIndex].deltaCovariances[materialIndex],
419  firstWeight,
420  caches[stateIndex2].deltaParameters[materialIndex2],
421  caches[stateIndex2].deltaCovariances[materialIndex2],
422  caches[stateIndex2].weights[materialIndex2]);
423 
424  // Reset 2nd parameters values just for clarity
425  caches[stateIndex2].deltaParameters[materialIndex2].setZero();
426  caches[stateIndex2].deltaCovariances[materialIndex2].setZero();
427  }
428 
429  // Loop over remaining unmerged components
430  for (size_t i(0); i < n; ++i) {
431  if (isMerged[i]) {
432  continue;
433  }
434 
435  // Build the TP
436  size_t stateIndex = indices[i].first;
437  size_t materialIndex = indices[i].second;
438  AmgVector(5)& stateVector =
439  caches[stateIndex].deltaParameters[materialIndex];
440  AmgSymMatrix(5)& measuredCov =
441  caches[stateIndex].deltaCovariances[materialIndex];
442 
443  std::unique_ptr<Trk::TrackParameters> updatedTrackParameters =
444  inputState[stateIndex]
445  .params->associatedSurface()
447  stateVector[Trk::loc2],
448  stateVector[Trk::phi],
449  stateVector[Trk::theta],
450  stateVector[Trk::qOverP],
451  measuredCov);
452 
453  double updatedWeight = caches[stateIndex].weights[materialIndex];
454 
455  assemblerCache.multiComponentState.push_back({
456  std::move(updatedTrackParameters), updatedWeight});
457  assemblerCache.validWeightSum += updatedWeight;
458  }
459 
460  // Check all weights
461  Trk::MultiComponentState mergedState =
462  MultiComponentStateAssembler::assembledState(std::move(assemblerCache));
463 
464  if (mergedState.size() > m_maximumNumberOfComponents)
465  ATH_MSG_ERROR("Merging failed, target size: " << m_maximumNumberOfComponents
466  << " final size: "
467  << mergedState.size());
468  return mergedState;
469 }

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_materialEffects

ElectronCombinedMaterialEffects Trk::ElectronMaterialMixtureConvolution::m_materialEffects {}
private

Definition at line 84 of file ElectronMaterialMixtureConvolution.h.

◆ m_maximumNumberOfComponents

Gaudi::Property<unsigned int> Trk::ElectronMaterialMixtureConvolution::m_maximumNumberOfComponents
private
Initial value:
{
this,
"MaximumNumberOfComponents",
12,
"Maximum number of components"
}

Definition at line 86 of file ElectronMaterialMixtureConvolution.h.

◆ m_parameterisationFileName

Gaudi::Property<std::string> Trk::ElectronMaterialMixtureConvolution::m_parameterisationFileName
private
Initial value:
{
this,
"BetheHeitlerParameterisationFileName",
"GeantSim_LT01_cdf_nC6_O5.par",
"Parametrization of Bethe Heitler material effects"
}

Definition at line 93 of file ElectronMaterialMixtureConvolution.h.

◆ m_parameterisationFileNameHighX0

Gaudi::Property<std::string> Trk::ElectronMaterialMixtureConvolution::m_parameterisationFileNameHighX0
private
Initial value:
{
this,
"BetheHeitlerParameterisationFileNameHighX0",
"GeantSim_GT01_cdf_nC6_O5.par",
"Parametrization of Bethe Heitler material effects for high X0"
}

Definition at line 100 of file ElectronMaterialMixtureConvolution.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
get_generator_info.result
result
Definition: get_generator_info.py:21
GSFUtils::MergeArray
struct representing an array or the merges.
Definition: KLGaussianMixtureReduction.h:54
Trk::MultiComponentStateAssembler::assembledState
MultiComponentState assembledState(MultiComponentStateAssembler::Cache &&cache)
Method to return the cached state object - it performs a reweighting before returning the object base...
Definition: MultiComponentStateAssembler.cxx:120
GSFUtils::Component1DArray::numComponents
int numComponents
Definition: KLGaussianMixtureReduction.h:46
Trk::ElectronMaterialMixtureConvolution::Normal
@ Normal
Definition: ElectronMaterialMixtureConvolution.h:36
index
Definition: index.py:1
Trk::ParametersBase::associatedSurface
virtual const Surface & associatedSurface() const override=0
Access to the Surface associated to the Parameters.
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Trk::indices
std::pair< long int, long int > indices
Definition: AlSymMatBase.h:24
python.SystemOfUnits.MeV
int MeV
Definition: SystemOfUnits.py:154
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:201
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
InDetSecVtxTruthMatchUtils::isMerged
bool isMerged(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:52
Trk::loc2
@ loc2
generic first and second local coordinate
Definition: ParamDefs.h:35
Trk::ElectronMaterialMixtureConvolution::m_maximumNumberOfComponents
Gaudi::Property< unsigned int > m_maximumNumberOfComponents
Definition: ElectronMaterialMixtureConvolution.h:86
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Trk::ElectronMaterialMixtureConvolution::update
virtual MultiComponentState update(std::vector< GsfMaterial::Combined > &, const MultiComponentState &, const Layer &, PropDirection direction=anyDirection, ParticleHypothesis particleHypothesis=nonInteracting) const override final
Convolution with pre-measurement-update material properties.
Definition: ElectronMaterialMixtureConvolution.cxx:129
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
Trk::MultiComponentStateCombiner::combineCovWithWeight
void combineCovWithWeight(const AmgVector(5) &firstParameters, AmgSymMatrix(5) &firstMeasuredCov, const double firstWeight, const AmgVector(5) &secondParameters, const AmgSymMatrix(5) &secondMeasuredCov, const double secondWeight)
Update cov matrix.
Definition: MultiComponentStateCombiner.cxx:385
GSFConstants::maxNumberofStateComponents
constexpr int8_t maxNumberofStateComponents
Note the Gaussian sum approach as describe e.g in " Optimal Filtering" Anderson and Moore "Track Fitt...
Definition: GsfConstants.h:47
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
Trk::ElectronCombinedMaterialEffects::compute
void compute(GsfMaterial::Combined &, const Trk::ComponentParameters &, const Trk::MaterialProperties &, double, Trk::PropDirection=anyDirection) const
Definition: ElectronCombinedMaterialEffects.cxx:322
Trk::AmgSymMatrix
AmgSymMatrix(5) &GXFTrackState
Definition: GXFTrackState.h:156
Trk::ElectronMaterialMixtureConvolution::m_materialEffects
ElectronCombinedMaterialEffects m_materialEffects
Definition: ElectronMaterialMixtureConvolution.h:84
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
Trk::Surface::createUniqueTrackParameters
virtual ChargedTrackParametersUniquePtr createUniqueTrackParameters(double l1, double l2, double phi, double theat, double qop, std::optional< AmgSymMatrix(5)> cov=std::nullopt) const =0
Use the Surface as a ParametersBase constructor, from local parameters - charged.
beamspotman.n
n
Definition: beamspotman.py:731
Trk::theta
@ theta
Definition: ParamDefs.h:66
GSFConstants::maxComponentsAfterConvolution
constexpr int8_t maxComponentsAfterConvolution
The maximum size State x Bethe-Heitler components The typical number we use is the max 6x12 = 72 i....
Definition: GsfConstants.h:61
AmgVector
AmgVector(4) T2BSTrackFilterTool
Definition: T2BSTrackFilterTool.cxx:114
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
test_pyathena.parent
parent
Definition: test_pyathena.py:15
Trk::MultiComponentState
std::vector< ComponentParameters > MultiComponentState
Definition: ComponentParameters.h:27
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
min
#define min(a, b)
Definition: cfImp.cxx:40
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::MultiComponentStateCombiner::combineParametersWithWeight
void combineParametersWithWeight(AmgVector(5) &firstParameters, double &firstWeight, const AmgVector(5) &secondParameters, const double secondWeight)
Update parameters.
Definition: MultiComponentStateCombiner.cxx:358
Trk::ElectronMaterialMixtureConvolution::Postupdate
@ Postupdate
Definition: ElectronMaterialMixtureConvolution.h:38
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
Trk::MultiComponentStateHelpers::renormaliseState
void renormaliseState(MultiComponentState &, double norm=1)
Performing renormalisation of total state weighting to one.
Definition: ComponentParameters.cxx:80
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
weights
Definition: herwig7_interface.h:44
GSFUtils::Component1DArray::components
std::array< Component1D, GSFConstants::maxComponentsAfterConvolution > components
Definition: KLGaussianMixtureReduction.h:45
Trk::ComponentParameters
Definition: ComponentParameters.h:22
DeMoScan.index
string index
Definition: DeMoScan.py:364
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DeMoScan.first
bool first
Definition: DeMoScan.py:536
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:67
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
Trk::phi
@ phi
Definition: ParamDefs.h:75
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
Trk::ElectronMaterialMixtureConvolution::m_parameterisationFileNameHighX0
Gaudi::Property< std::string > m_parameterisationFileNameHighX0
Definition: ElectronMaterialMixtureConvolution.h:100
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
Trk::loc1
@ loc1
Definition: ParamDefs.h:34
GSFUtils::MergeArray::numMerges
int numMerges
Definition: KLGaussianMixtureReduction.h:61
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
Trk::ElectronMaterialMixtureConvolution::m_parameterisationFileName
Gaudi::Property< std::string > m_parameterisationFileName
Definition: ElectronMaterialMixtureConvolution.h:93
Trk::ElectronMaterialMixtureConvolution::Preupdate
@ Preupdate
Definition: ElectronMaterialMixtureConvolution.h:37
fitman.k
k
Definition: fitman.py:528
GSFUtils::findMerges
MergeArray findMerges(const Component1DArray &componentsIn, const int8_t reducedSize)
Find the order in which the components need to be merged.
Definition: KLGaussianMixtureReduction.cxx:391
GSFUtils::Component1DArray
struct representing an array of 1D component.
Definition: KLGaussianMixtureReduction.h:42
GSFUtils::MergeArray::merges
std::array< merge, GSFConstants::maxComponentsAfterConvolution > merges
Definition: KLGaussianMixtureReduction.h:60