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) 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) 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) const override final
 The particle hypothesis we implement material effects for. More...
 
virtual Trk::ParticleHypothesis particleHypothesis () 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, V, H > &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, double updateFactor) const
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

std::unique_ptr< ElectronCombinedMaterialEffectsm_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 173 of file ElectronMaterialMixtureConvolution.cxx.

178 {
179  declareInterface<IMaterialMixtureConvolution>(this);
180 }

◆ ~ElectronMaterialMixtureConvolution()

Trk::ElectronMaterialMixtureConvolution::~ElectronMaterialMixtureConvolution ( )
virtualdefault

AlgTool initialise method.

Member Function Documentation

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > &  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, V, H > &  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, V, H > &  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, V, H > &  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, V, H > &  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 185 of file ElectronMaterialMixtureConvolution.cxx.

186 {
188  ATH_MSG_FATAL("Requested MaximumNumberOfComponents > "
190  return StatusCode::FAILURE;
191  }
192 
193  m_materialEffects = std::make_unique<ElectronCombinedMaterialEffects>(
195  return StatusCode::SUCCESS;
196 }

◆ 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.

◆ particleHypothesis()

virtual Trk::ParticleHypothesis Trk::ElectronMaterialMixtureConvolution::particleHypothesis ( ) const
inlinefinaloverridevirtual

Implements Trk::IMaterialMixtureConvolution.

Definition at line 70 of file ElectronMaterialMixtureConvolution.h.

70  {
71  return Trk::electron;
72  }

◆ postUpdate()

Trk::MultiComponentState Trk::ElectronMaterialMixtureConvolution::postUpdate ( std::vector< GsfMaterial::Combined > &  ,
const MultiComponentState ,
const Layer ,
PropDirection  direction = anyDirection 
) const
finaloverridevirtual

The particle hypothesis we implement material effects for.

Implements Trk::IMaterialMixtureConvolution.

Definition at line 248 of file ElectronMaterialMixtureConvolution.cxx.

253 {
254  const double updateFactor = layer.postUpdateMaterialFactor(
255  *multiComponentState.front().params, direction);
256 
257  Trk::MultiComponentState updatedMergedState =
258  update(caches, multiComponentState, layer, direction, updateFactor);
259 
260  if (updatedMergedState.empty()) {
261  return {};
262  }
264  return updatedMergedState;
265 }

◆ preUpdate()

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

Convolution with post-measurement-update material properties.

Implements Trk::IMaterialMixtureConvolution.

Definition at line 223 of file ElectronMaterialMixtureConvolution.cxx.

228 {
229  const double updateFactor =
230  layer.preUpdateMaterialFactor(*multiComponentState.front().params, direction);
231 
232  Trk::MultiComponentState updatedMergedState = update(caches,
233  multiComponentState,
234  layer,
235  direction,
236  updateFactor);
237  if (updatedMergedState.empty()) {
238  return {};
239  }
241  return updatedMergedState;
242 }

◆ 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 
) const
finaloverridevirtual

Convolution with pre-measurement-update material properties.

Implements Trk::IMaterialMixtureConvolution.

Definition at line 202 of file ElectronMaterialMixtureConvolution.cxx.

207 {
208  const double updateFactor = 1.0;
209  Trk::MultiComponentState updatedMergedState = update(
210  caches, multiComponentState, layer, direction, updateFactor);
211 
212  if (updatedMergedState.empty()) {
213  return {};
214  }
216  return updatedMergedState;
217 }

◆ update() [2/2]

Trk::MultiComponentState Trk::ElectronMaterialMixtureConvolution::update ( std::vector< GsfMaterial::Combined > &  caches,
const Trk::MultiComponentState inputState,
const Trk::Layer layer,
Trk::PropDirection  direction,
double  updateFactor 
) const
private

Definition at line 268 of file ElectronMaterialMixtureConvolution.cxx.

274 {
275 
276  // Check the multi-component state is populated
277  if (inputState.empty()) {
278  return {};
279  }
280  if (updateFactor < 0.01) {
281  // Bail out as factor is too small to bother about
282  return {};
283  }
284  caches.resize(inputState.size());
285 
286  // Fill cache and work out how many final components there should be
287  size_t numComponents(0);
288  for (size_t i(0); i < inputState.size(); ++i) {
289  const AmgSymMatrix(5)* measuredCov = inputState[i].params->covariance();
290  // If the momentum is too dont apply material effects
291  if (inputState[i].params->momentum().mag() <= 250. * Gaudi::Units::MeV) {
292  dummyCacheElement(caches[i]);
293  updateCacheElement(caches[i], 0, inputState[i].params->parameters(), measuredCov);
294  caches[i].weights[0] = inputState[i].weight;
295  numComponents += caches[i].numEntries;
296  continue;
297  }
298  // Get the material effects and store them in the cache
299  std::pair<const Trk::MaterialProperties*, double> matPropPair =
300  getMaterialProperties(inputState[i].params.get(), layer);
301 
302  if (!matPropPair.first) {
303  dummyCacheElement(caches[i]);
304  updateCacheElement(caches[i], 0, inputState[i].params->parameters(), measuredCov);
305  caches[i].weights[0] = inputState[i].weight;
306  numComponents += caches[i].numEntries;
307  continue;
308  }
309  // Now we can compute/apply actual material effects
310  // Apply the update factor
311  matPropPair.second *= updateFactor;
312  m_materialEffects->compute(caches[i],
313  inputState[i],
314  *matPropPair.first,
315  matPropPair.second,
316  direction);
317 
318  // Apply material effects to input state and store results in cache
319  // We have i material caches , one for each input state.
320  // Each cache has j entries. They correspond to each
321  // Gausian used to describe the Bethe Heitler.
322  for (size_t j(0); j < caches[i].numEntries; ++j) {
323  updateCacheElement(caches[i], j, inputState[i].params->parameters(), measuredCov);
324  // Adjust q/p of the (delta) Parameters
325  // make sure update is good.
326  if (!updateP(caches[i].parameters[j][Trk::qOverP],
327  caches[i].deltaPs[j])) {
328  ATH_MSG_ERROR("Cannot update state vector momentum!!!");
329  return {};
330  }
331  // Store component weight
332  caches[i].weights[j] *= inputState[i].weight;
333  // Ensure weight of component is not too small to save us from potential
334  // FPE's Value. Weights are double so the min of float should
335  // be small enough and should be handled
336  if (caches[i].weights[j] < std::numeric_limits<float>::min()) {
337  caches[i].weights[j] = std::numeric_limits<float>::min();
338  }
339  }
340  numComponents += caches[i].numEntries;
341  } // End of loop filling the cache
342 
343  // Fill information for calculating which components to merge
344  // In addition scan all components for covariance matrices.
345  // If one component is missing its error matrix,
346  // component reduction is impossible.
347  //
348  bool componentWithoutMeasurement = false;
349  // keep track of the state component and material effects indices
350  // Effectively here we have M state X N Material effects
351  // MXN components.
352  std::vector<std::pair<size_t, size_t>> indices{};
353  indices.resize(numComponents);
354  GSFUtils::Component1DArray componentsArray(numComponents);
355  size_t k(0);
356  for (size_t i(0); i < inputState.size(); ++i) {
357  for (size_t j(0); j < caches[i].numEntries; ++j) {
358  const AmgSymMatrix(5)* measuredCov = inputState[i].params->covariance();
359  // Fill in infomation
360  const double cov =
361  measuredCov ? caches[i].covariances[j](Trk::qOverP, Trk::qOverP)
362  : -1.;
363  if (!measuredCov) {
364  componentWithoutMeasurement = true;
365  }
366  componentsArray[k].mean = caches[i].parameters[j][Trk::qOverP];
367  componentsArray[k].cov = cov;
368  componentsArray[k].invCov = cov > 0 ? 1. / cov : 1e10;
369  componentsArray[k].weight = caches[i].weights[j];
370  indices[k] = {i, j};
371  ++k;
372  }
373  }
374 
375  // fallback if we have a component without measurement
376  if (componentWithoutMeasurement) {
377  auto* result = std::max_element(
378  componentsArray.begin(), componentsArray.end(),
379  [](const auto& a, const auto& b) { return a.weight < b.weight; });
380  auto index = std::distance(componentsArray.begin(), result);
381  const size_t stateIndex = indices[index].first;
382  const size_t materialIndex = indices[index].second;
383 
384  AmgVector(5)& updatedStateVector = caches[stateIndex].parameters[materialIndex];
385  const AmgSymMatrix(5)* measuredCov = inputState[stateIndex].params->covariance();
386  std::optional<AmgSymMatrix(5)> updatedCovariance = std::nullopt;
387  if (measuredCov && caches[stateIndex].covariances.size() > materialIndex) {
388  updatedCovariance =
389  AmgSymMatrix(5)(caches[stateIndex].covariances[materialIndex]);
390  }
391  std::unique_ptr<Trk::TrackParameters> updatedTrackParameters =
392  inputState[stateIndex]
393  .params->associatedSurface()
394  .createUniqueTrackParameters(
395  updatedStateVector[Trk::loc1], updatedStateVector[Trk::loc2],
396  updatedStateVector[Trk::phi], updatedStateVector[Trk::theta],
397  updatedStateVector[Trk::qOverP], std::move(updatedCovariance));
398 
399  Trk::ComponentParameters dummyCompParams = {
400  std::move(updatedTrackParameters), 1.};
401  Trk::MultiComponentState returnMultiState;
402  returnMultiState.push_back(std::move(dummyCompParams));
403  return returnMultiState;
404  }
405 
406  //Create the state to rerurn accounting for any needed merges.
407  GSFUtils::MergeArray merges;
408  if (numComponents > m_maximumNumberOfComponents) {
409  merges = findMerges(std::move(componentsArray), m_maximumNumberOfComponents);
410  }
411  auto mergedState = createMergedState(merges, caches, indices, inputState);
412 
413  if (mergedState.size() > m_maximumNumberOfComponents) {
414  ATH_MSG_ERROR("Merging failed, target size: " << m_maximumNumberOfComponents
415  << " final size: "
416  << mergedState.size());
417  }
418  return mergedState;
419 }

◆ 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

std::unique_ptr<ElectronCombinedMaterialEffects> Trk::ElectronMaterialMixtureConvolution::m_materialEffects
private

Definition at line 82 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 84 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 91 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 98 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:
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
get_generator_info.result
result
Definition: get_generator_info.py:21
Trk::ElectronMaterialMixtureConvolution::Normal
@ Normal
Definition: ElectronMaterialMixtureConvolution.h:36
index
Definition: index.py:1
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
Trk::indices
std::pair< long int, long int > indices
Definition: AlSymMatBase.h:24
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:200
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
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:84
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
GSFUtils::MergeArray
std::vector< Merge > MergeArray
Definition: KLGaussianMixtureReduction.h:47
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
python.SystemOfUnits.MeV
float MeV
Definition: SystemOfUnits.py:172
GSFConstants::maxNumberofStateComponents
constexpr int8_t maxNumberofStateComponents
The state is described by N Gaussian components The Beth Heitler Material effect are also described b...
Definition: GsfConstants.h:43
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
Trk::AmgSymMatrix
AmgSymMatrix(5) &GXFTrackState
Definition: GXFTrackState.h:156
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
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::theta
@ theta
Definition: ParamDefs.h:66
Trk::electron
@ electron
Definition: ParticleHypothesis.h:30
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition: AthCommonDataStore.h:145
AmgVector
AmgVector(4) T2BSTrackFilterTool
Definition: T2BSTrackFilterTool.cxx:114
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
Trk::ElectronMaterialMixtureConvolution::m_materialEffects
std::unique_ptr< ElectronCombinedMaterialEffects > m_materialEffects
Definition: ElectronMaterialMixtureConvolution.h:82
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:
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::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:240
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:76
weights
Definition: herwig7_interface.h:38
Trk::ComponentParameters
Definition: ComponentParameters.h:22
GSFUtils::findMerges
MergeArray findMerges(Component1DArray &&componentsIn, const int reducedSize)
Return which components need to be merged.
Definition: KLGaussianMixtureReduction.cxx:305
DeMoScan.index
string index
Definition: DeMoScan.py:362
a
TList * a
Definition: liststreamerinfos.cxx:10
h
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:629
physics_parameters.parameters
parameters
Definition: physics_parameters.py:144
Trk::phi
@ phi
Definition: ParamDefs.h:75
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:801
Trk::ElectronMaterialMixtureConvolution::m_parameterisationFileNameHighX0
Gaudi::Property< std::string > m_parameterisationFileNameHighX0
Definition: ElectronMaterialMixtureConvolution.h:98
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
Trk::loc1
@ loc1
Definition: ParamDefs.h:34
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
Trk::ElectronMaterialMixtureConvolution::update
virtual MultiComponentState update(std::vector< GsfMaterial::Combined > &, const MultiComponentState &, const Layer &, PropDirection direction=anyDirection) const override final
Convolution with pre-measurement-update material properties.
Definition: ElectronMaterialMixtureConvolution.cxx:202
Trk::ElectronMaterialMixtureConvolution::m_parameterisationFileName
Gaudi::Property< std::string > m_parameterisationFileName
Definition: ElectronMaterialMixtureConvolution.h:91
Trk::ElectronMaterialMixtureConvolution::Preupdate
@ Preupdate
Definition: ElectronMaterialMixtureConvolution.h:37
fitman.k
k
Definition: fitman.py:528
GSFUtils::AlignedDynArray
A wrapper around std::aligned_alloc.
Definition: AlignedDynArray.h:30