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

#include <TrkMaterialProviderTool.h>

Inheritance diagram for Trk::TrkMaterialProviderTool:
Collaboration diagram for Trk::TrkMaterialProviderTool:

Public Member Functions

 TrkMaterialProviderTool (const std::string &, const std::string &, const IInterface *)
 AlgTool like constructor. More...
 
virtual ~TrkMaterialProviderTool ()=default
 Virtual destructor. More...
 
StatusCode initialize ()
 AlgTool initailize method. More...
 
StatusCode finalize ()
 AlgTool finalize method. More...
 
void updateCaloTSOS (const Trk::Track &idTrack, Trk::Track &extrapolatedTrack) const
 Update Calorimeter TSOS from input ID and MS tracks. More...
 
void updateCaloTSOS (Trk::Track &track, const Trk::TrackParameters *startParamaters=nullptr) const
 Update Calorimeter TSOS from input MS/CB track. More...
 
void getCaloMEOT (const Trk::Track &idTrack, const Trk::Track &msTrack, std::vector< MaterialEffectsOnTrack > &calomeots) const
 Get Calorimeter MEOT. More...
 
std::vector< const Trk::TrackStateOnSurface * > * getCaloTSOS (const Trk::TrackParameters &parm, const Trk::Track &muonTrack, const Trk::TrackParameters *parms=nullptr) const
 Retrieve Calorimeter TSOS from TG and apply corrections. More...
 
CaloEnergygetParamCaloELoss (Trk::Track *track) const
 Retrieve a clone of the parametrised energy loss. More...
 
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 ()
 

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::TrackStatesgetCaloTSOS (const Trk::TrackParameters &parm, const Trk::Track &muonTrack, const Trk::Surface &surf, Trk::PropDirection dir, Trk::ParticleHypothesis mateffects, double &Eloss, double &X0ScaleMS, double &ElossScaleMS, const Trk::TrackParameters *parms=nullptr, bool boundaryCheck=false, bool removeOoC=false) const
 Internal method to retrieve Calorimeter TSOS from TG and apply corrections. More...
 
const Trk::TrackStateOnSurfacegetCaloExitTSOS (const std::vector< const Trk::TrackStateOnSurface * > *caloTSOS, Trk::PropDirection dir) const
 Helper to get last calo TSOS with TP. More...
 
const Trk::TrackStateOnSurfacegetCaloEntryTSOS (const std::vector< const Trk::TrackStateOnSurface * > *caloTSOS, Trk::PropDirection dir) const
 Helper to get first calo TSOS with TP. More...
 
void removeOutOfCalo (std::vector< const Trk::TrackStateOnSurface * > *caloTSOS) const
 Helper to remove MS and ID TSOS. More...
 
void removeMS (std::vector< const Trk::TrackStateOnSurface * > *caloTSOS) const
 Helper to remove only MS TSOS. More...
 
void updateVectorMS (Trk::TrackStates *inputTSOS, const Trk::TrackStates::iterator &firstMS, double X0ScaleMS, double ElossScaleMS) const
 update the TSOS vector for the Muon Spectrometer applying X0 and Eloss scaling More...
 
unsigned int getVolumeByGeo (const Trk::TrackStateOnSurface *m) const
 
void printTSOS (const Trk::TrackStateOnSurface *m, const std::string &tag) const
 
Trk::TrackStatesmodifyTSOSvector (const std::vector< const Trk::TrackStateOnSurface * > *matvec, double scaleX0, double scaleEloss, bool reposition, bool aggregate, bool updateEloss, double caloEnergy, double caloEnergyError, double fsrCaloEnergy, double pCaloEntry, double momentumError, double &Eloss_tot, bool useMeasuredEnergy=true, double mopEloss=0., double meanElossIoni=0., double sigmaElossIoni=0.) const
 Function to modify TSOS doing repositioning, aggregation and corrections. More...
 
void getMopAndIoniEnergyLoss (const std::vector< const Trk::TrackStateOnSurface * > *matvec, double pCaloEntry, double scaleEloss, double &mopEloss, double &meanElossIoni, double &sigmaElossIoni) const
 Function to get mop and mean (ionization) energy loss. More...
 
bool isIsolatedTrack (double eta, double phi) const
 Function to check isolation. More...
 
double getCaloMeasuredEnergy (double eta, double phi, double mopEloss, double meanElossIoni, double &fsrCaloEnergy) const
 Function to get calorimeter measured energy loss. More...
 
double getFinalMeasuredEnergy (Rec::CaloMeas *caloMeas, double mopEloss, double meanElossIoni, double eta, double &fsrCaloEnergy) const
 Function to get corrected (final) calorimeter measured energy loss. More...
 
void throwFailedToGetTrackingGeomtry () const
 
const TrackingGeometryretrieveTrackingGeometry (const EventContext &ctx) 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...
 

Static Private Member Functions

static void updateVector (Trk::TrackStates *inputTSOS, Trk::TrackStates::iterator lastID, Trk::TrackStates::iterator firstMS, Trk::TrackStates *caloTSOS)
 Helper to update entries in the vector. More...
 
static void deleteTSOS (const std::vector< const Trk::TrackStateOnSurface * > *vecTSOS)
 
static void deleteTSOS (Trk::TrackStates *vecTSOS)
 

Private Attributes

PublicToolHandle< Trk::IExtrapolatorm_muonExtrapolator {this,"Extrapolator","Trk::Extrapolator/AtlasExtrapolator",""}
 
PublicToolHandle< Trk::IEnergyLossUpdatorm_elossupdator {this,"EnergyLossUpdator","Trk::EnergyLossUpdator/AtlasEnergyLossUpdator",""}
 
ServiceHandle< Trk::ITrackingVolumesSvcm_trackingVolumesSvc {this, "TrackingVolumeSvc", "TrackingVolumesSvc/TrackingVolumesSvc"}
 
ServiceHandle< ITrackingGeometrySvcm_trackingGeometrySvc {this, "TrackingGeometrySvc", "", ""}
 
SG::ReadCondHandleKey< TrackingGeometrym_trackingGeometryReadKey {this, "TrackingGeometryReadKey", "", "Key of the TrackingGeometry conditions data."}
 
ToolHandle< Trk::IMultipleScatteringUpdatorm_scattool
 
ToolHandle< Rec::IMuidCaloEnergyMeasm_caloMeasTool {this, "CaloMeasTool", "Rec::MuidCaloEnergyMeas/MuidCaloEnergyMeas"}
 
ToolHandle< Rec::IMuidCaloEnergyParamm_caloParamTool {this, "CaloParamTool", "Rec::MuidCaloEnergyParam/MuidCaloEnergyParam"}
 
ToolHandle< Rec::IMuidTrackIsolationm_trackIsolationTool {this, "TrackIsolationTool", "Rec::MuidTrackIsolation/MuidTrackIsolation"}
 
ToolHandle< Rec::IMuonCaloEnergyToolm_muonCaloEnergyTool
 
const AtlasDetectorIDm_DetID
 
const Trk::Volumem_calorimeterVolume
 
const Trk::Volumem_indetVolume
 
SG::ReadCondHandleKey< AtlasFieldCacheCondObjm_fieldCacheCondObjInputKey
 
bool m_applyTGScaling
 
bool m_repositionTSOS
 
bool m_aggregateTSOS
 
bool m_updateTSOS
 
int m_maxNTracksIso
 
double m_paramPtCut
 
bool m_useCaloEnergyMeasurement
 
bool m_useMuonCaloEnergyTool
 
bool m_overwriteElossParam
 
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 53 of file TrkMaterialProviderTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TrkMaterialProviderTool()

TrkMaterialProviderTool::TrkMaterialProviderTool ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

AlgTool like constructor.

Definition at line 39 of file TrkMaterialProviderTool.cxx.

40  : AthAlgTool(t,n,p),
41  m_DetID(nullptr),
42  m_calorimeterVolume(nullptr),
43  m_indetVolume(nullptr),
44  m_maxNTracksIso(2),
49 {
50  declareInterface<ITrkMaterialProviderTool>(this);
51 
52  declareProperty("ApplyTGScaling", m_applyTGScaling = true );
53  declareProperty("RpositionTSOS", m_repositionTSOS = true );
54  declareProperty("AggregateTSOS", m_aggregateTSOS = true );
55  declareProperty("UpdateTSOS", m_updateTSOS = true );
56  declareProperty("MaxNTracksIso", m_maxNTracksIso);
57  declareProperty("ParamPtCut", m_paramPtCut);
58  declareProperty("UseCaloEnergyMeasurement", m_useCaloEnergyMeasurement);
59  declareProperty("UseMuonCaloEnergyTool", m_useMuonCaloEnergyTool);
60 // this is a temporary solution to write Eloss information in the muon to validate the Eloss
61 // default value should be false
62  declareProperty("OverwriteElossParam", m_overwriteElossParam);
63 }

◆ ~TrkMaterialProviderTool()

virtual Trk::TrkMaterialProviderTool::~TrkMaterialProviderTool ( )
virtualdefault

Virtual destructor.

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  }

◆ deleteTSOS() [1/2]

void TrkMaterialProviderTool::deleteTSOS ( const std::vector< const Trk::TrackStateOnSurface * > *  vecTSOS)
staticprivate

Definition at line 1235 of file TrkMaterialProviderTool.cxx.

1236 {
1237  std::vector<const Trk::TrackStateOnSurface*>::const_iterator it = vecTSOS->begin();
1238  std::vector<const Trk::TrackStateOnSurface*>::const_iterator itEnd = vecTSOS->end();
1239  for (; it != itEnd; ++it) delete *it;
1240  delete vecTSOS;
1241 }

◆ deleteTSOS() [2/2]

void TrkMaterialProviderTool::deleteTSOS ( Trk::TrackStates vecTSOS)
staticprivate

Definition at line 1242 of file TrkMaterialProviderTool.cxx.

1243 {
1244  if(vecTSOS->ownPolicy()==SG::VIEW_ELEMENTS) {
1246  Trk::TrackStates::const_iterator itEnd = vecTSOS->end();
1247  for (; it != itEnd; ++it) delete *it;
1248  }
1249  delete vecTSOS;
1250 }

◆ 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

◆ finalize()

StatusCode TrkMaterialProviderTool::finalize ( )

AlgTool finalize method.

Definition at line 125 of file TrkMaterialProviderTool.cxx.

126 {
127  ATH_MSG_DEBUG( name() << " finalize() successful" );
128  return StatusCode::SUCCESS;
129 }

◆ getCaloEntryTSOS()

const Trk::TrackStateOnSurface * TrkMaterialProviderTool::getCaloEntryTSOS ( const std::vector< const Trk::TrackStateOnSurface * > *  caloTSOS,
Trk::PropDirection  dir 
) const
private

Helper to get first calo TSOS with TP.

Definition at line 981 of file TrkMaterialProviderTool.cxx.

982 {
983  const Trk::TrackStateOnSurface* tsosAtCaloEntry = nullptr;
984  if(dir==Trk::alongMomentum) {
985  std::vector<const Trk::TrackStateOnSurface*>::const_iterator it = caloTSOS->begin();
986  std::vector<const Trk::TrackStateOnSurface*>::const_iterator itEnd = caloTSOS->end();
987  for(; it!=itEnd; ++it) {
988  if((*it)->trackParameters()) {
989  ATH_MSG_DEBUG("Parameters at CALO entry found : "<< *((*it)->trackParameters()));
990  tsosAtCaloEntry = *it;
991  return tsosAtCaloEntry;
992  }
993  }
994  }else{
995  std::vector<const Trk::TrackStateOnSurface*>::const_reverse_iterator it = caloTSOS->rbegin();
996  std::vector<const Trk::TrackStateOnSurface*>::const_reverse_iterator itEnd = caloTSOS->rend();
997  for(; it!=itEnd; ++it) {
998  if((*it)->trackParameters()) {
999  ATH_MSG_DEBUG("Parameters at CALO entry found : "<< *((*it)->trackParameters()));
1000  tsosAtCaloEntry = *it;
1001  return tsosAtCaloEntry;
1002  }
1003  }
1004  }
1005  return tsosAtCaloEntry;
1006 }

◆ getCaloExitTSOS()

const Trk::TrackStateOnSurface * TrkMaterialProviderTool::getCaloExitTSOS ( const std::vector< const Trk::TrackStateOnSurface * > *  caloTSOS,
Trk::PropDirection  dir 
) const
private

Helper to get last calo TSOS with TP.

Definition at line 952 of file TrkMaterialProviderTool.cxx.

953 {
954  const Trk::TrackStateOnSurface* tsosAtCaloExit = nullptr;
955  if(dir==Trk::alongMomentum) {
956  std::vector<const Trk::TrackStateOnSurface*>::const_reverse_iterator it = caloTSOS->rbegin();
957  std::vector<const Trk::TrackStateOnSurface*>::const_reverse_iterator itEnd = caloTSOS->rend();
958  for(; it!=itEnd; ++it) {
959  if((*it)->trackParameters()) {
960  ATH_MSG_DEBUG("Parameters at CALO exit found : "<< *((*it)->trackParameters()));
961  tsosAtCaloExit = *it;
962  return tsosAtCaloExit;
963  }
964  }
965  }else{
966  std::vector<const Trk::TrackStateOnSurface*>::const_iterator it = caloTSOS->begin();
967  std::vector<const Trk::TrackStateOnSurface*>::const_iterator itEnd = caloTSOS->end();
968  for(; it!=itEnd; ++it) {
969  if((*it)->trackParameters()) {
970  ATH_MSG_DEBUG("Parameters at CALO exit found : "<< *((*it)->trackParameters()));
971  tsosAtCaloExit = *it;
972  return tsosAtCaloExit;
973  }
974  }
975  }
976  return tsosAtCaloExit;
977 }

◆ getCaloMeasuredEnergy()

double TrkMaterialProviderTool::getCaloMeasuredEnergy ( double  eta,
double  phi,
double  mopEloss,
double  meanElossIoni,
double &  fsrCaloEnergy 
) const
private

Function to get calorimeter measured energy loss.

Definition at line 1952 of file TrkMaterialProviderTool.cxx.

1956 {
1957  // Retrieve the measured energy from calorimeter
1958  std::unique_ptr<Rec::CaloMeas> caloMeas = m_caloMeasTool->energyMeasurement(Gaudi::Hive::currentContext(),eta,phi,eta,phi);
1959 
1960 
1961  // Sum-up components
1962  double FinalMeasuredEnergy = getFinalMeasuredEnergy(caloMeas.get(), totalEloss, meanElossIoni, eta, fsrCaloEnergy);
1963 
1964  return FinalMeasuredEnergy;
1965 }

◆ getCaloMEOT()

void TrkMaterialProviderTool::getCaloMEOT ( const Trk::Track idTrack,
const Trk::Track msTrack,
std::vector< MaterialEffectsOnTrack > &  calomeots 
) const
virtual

Get Calorimeter MEOT.

Implements Trk::ITrkMaterialProviderTool.

Definition at line 367 of file TrkMaterialProviderTool.cxx.

369 {
370  ATH_MSG_VERBOSE("getCaloMEOT(const Trk::Track& idTrack, const Trk::Track& msTrack, std::vector<MaterialEffectsOnTrack>& calomeots)");
371 
372  const Trk::TrackStates* inputTSOS_ID = idTrack.trackStateOnSurfaces();
373  const Trk::TrackStates* inputTSOS_MS = msTrack.trackStateOnSurfaces();
374 
375 #ifdef DEBUGON
376  for(auto m : *inputTSOS_ID) printTSOS(m, "TSOS ID TRACK");
377  for(auto m : *inputTSOS_MS) printTSOS(m, "TSOS MS TRACK");
378 #endif
379 
380  // find last ID TSOS
381  Trk::TrackStates::const_reverse_iterator lastIDwP = inputTSOS_ID->rbegin();
382  for (auto it = inputTSOS_ID->rbegin(); it != inputTSOS_ID->rend(); ++it) {
383  if(this->getVolumeByGeo(*it)==1 && (*it)->trackParameters()) {
384  lastIDwP = it;
385  break;
386  }
387  }
388 
389  if(lastIDwP == inputTSOS_ID->rend()) {
390  ATH_MSG_WARNING("Unable to find last ID TSOS with Track Parameters");
391  ATH_MSG_WARNING("Unable to update Calorimeter TSOS");
392  return;
393  }
394 
395  // find first MS TSOS
396  Trk::TrackStates::const_iterator firstMS = inputTSOS_MS->end();
397  Trk::TrackStates::const_iterator firstMSwP = inputTSOS_MS->end();
398  Trk::TrackStates::const_iterator itEnd = inputTSOS_MS->end();
399  for(auto it = inputTSOS_MS->begin(); it!=itEnd ; ++it) {
400  if(this->getVolumeByGeo(*it)==3) {// && !(*it)->type(Trk::TrackStateOnSurface::Perigee)) {
401  if(firstMS==itEnd)
402  firstMS = it;
403  if((*it)->trackParameters() && (*it)->trackParameters()->covariance()) {
404  firstMSwP = it;
405  break;
406  }
407  }
408  }
409 
410  if(firstMS == inputTSOS_MS->end()) {
411  ATH_MSG_WARNING("Unable to find first MS TSOS");
412  ATH_MSG_WARNING("Unable to update Calorimeter TSOS");
413  return;
414  }
415 
416  // check that first MS TSOS is not a PerigeeSurface
417  Trk::TrackStates::const_iterator firstMSnotPerigee = firstMS;
418  if( (*firstMS)->type(Trk::TrackStateOnSurface::Perigee) && (firstMS+1)!=inputTSOS_MS->end()) {
419  firstMSnotPerigee=firstMS+1;
420  }
421 
422 #ifdef DEBUGON
423  printTSOS(*lastIDwP, "LAST IDwP");
424  printTSOS(*firstMSnotPerigee, "FIRST MS");
425  if(firstMSwP != inputTSOS_MS->end())
426  printTSOS(*firstMSwP, "FIRST MSwP");
427  else
428  ATH_MSG_WARNING("Unable to find first MS TSOS with Track Parameters!");
429 #endif
430 
431  MagField::AtlasFieldCache fieldCache;
432  // Get field cache object
433  const EventContext& ctx = Gaudi::Hive::currentContext();
435  const AtlasFieldCacheCondObj* fieldCondObj{*readHandle};
436 
437  if (fieldCondObj == nullptr) {
438  ATH_MSG_ERROR("Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key());
439  return;
440  }
441  fieldCondObj->getInitializedCache (fieldCache);
442 
443  double Eloss = 0.;
444  double X0ScaleMS = 0.;
445  double ElossScaleMS = 0.;
446  // get calorimeter TSOS from TG
447  Trk::TrackStates* caloTSOS = this->getCaloTSOS (*(*lastIDwP)->trackParameters(),
448  // idTrack,
449  fieldCache.toroidOn() ? msTrack : idTrack,
450  (*firstMSnotPerigee)->surface(),
452  Trk::muon,
453  Eloss, X0ScaleMS, ElossScaleMS,
454  (firstMSwP == inputTSOS_MS->end()) ? nullptr : (*firstMSwP)->trackParameters(),
455  false,
456  true);
457 
458  if (!caloTSOS || caloTSOS->size() != 3)
459  {
460  double idqOverP = std::abs(idTrack.perigeeParameters()->parameters()[Trk::qOverP]);
461  double msqOverP = msTrack.perigeeParameters() ? msTrack.perigeeParameters()->parameters()[Trk::qOverP] : (*firstMS)->trackParameters()->parameters()[Trk::qOverP] ;
462 
463  if ((!fieldCache.toroidOn() && idqOverP * 4000. < 1) || (fieldCache.toroidOn() && msqOverP != 1 / 100000. && msqOverP != 0))
464  {
465  // Warnings only for high momentum ID tracks and MS tracks that have measured curvature (Straight track has pq= 100000)
466  if (!fieldCache.toroidOn())
467  ATH_MSG_WARNING(" Toroid off q*momentum of ID track " << 1. / idqOverP);
468  if (fieldCache.toroidOn())
469  ATH_MSG_WARNING(" Toroid on q*momentum of MS track " << 1. / msqOverP);
470  ATH_MSG_WARNING("Unable to retrieve Calorimeter TSOS from extrapolateM+aggregation (null or !=3)");
471  if (!caloTSOS) {
472  ATH_MSG_WARNING(" Zero Calorimeter TSOS from extrapolateM+aggregation");
473  } else {
474  ATH_MSG_WARNING(" nr Calorimeter TSOS from extrapolateM+aggregation not equal to 3 " << caloTSOS->size());
475  }
476  }
477 
478  if (caloTSOS) deleteTSOS(caloTSOS);
479 
480  return;
481  }
482 
483  for (auto && i : *caloTSOS){
484  const Trk::MaterialEffectsOnTrack *meot=dynamic_cast<const Trk::MaterialEffectsOnTrack *>(i->materialEffectsOnTrack());
485  if (!meot) {
486  throw std::logic_error("TrackStateOnSurface without material effects on track." );
487  }
488  double sintheta=std::sin(i->trackParameters()->parameters()[Trk::theta]);
489  double qoverp=i->trackParameters()->parameters()[Trk::qOverP];
490  const CaloEnergy *eloss=nullptr;
491  if (meot) eloss=dynamic_cast<const CaloEnergy *>(meot->energyLoss());
492 
493  std::unique_ptr<Trk::EnergyLoss> neweloss=nullptr;
494  std::optional<Trk::ScatteringAngles> newsa= std::nullopt;
495  if (eloss) neweloss = std::make_unique<CaloEnergy>(*eloss);
496  else{
497  Trk::MaterialProperties matprop(meot->thicknessInX0(),1.,0.,0.,0.,0.);
498  double sigmascat = std::abs(qoverp)>0.0 ? std::sqrt(m_scattool->sigmaSquare(matprop,std::abs(1./qoverp),1.,Trk::muon)) : 0.0;
499  newsa=Trk::ScatteringAngles(0,0,sigmascat/sintheta,sigmascat);
500  }
502  meot->thicknessInX0(),
503  newsa,
504  std::move(neweloss),
505  i->trackParameters()->associatedSurface());
506  calomeots.push_back(newmeot);
507  delete i;
508  }
509  delete caloTSOS;
510 }

◆ getCaloTSOS() [1/2]

Trk::TrackStates * TrkMaterialProviderTool::getCaloTSOS ( const Trk::TrackParameters parm,
const Trk::Track muonTrack,
const Trk::Surface surf,
Trk::PropDirection  dir,
Trk::ParticleHypothesis  mateffects,
double &  Eloss,
double &  X0ScaleMS,
double &  ElossScaleMS,
const Trk::TrackParameters parms = nullptr,
bool  boundaryCheck = false,
bool  removeOoC = false 
) const
private

Internal method to retrieve Calorimeter TSOS from TG and apply corrections.

Definition at line 664 of file TrkMaterialProviderTool.cxx.

675 {
676  const EventContext& ctx = Gaudi::Hive::currentContext();
677  bool fremoveMS = false;
678  if(!removeOoC) fremoveMS = true;
679 
680  ATH_MSG_DEBUG("Retrieving Calorimeter TSOS from extrapolateM (dir=" << dir << ") with starting parameters : "
681  << parm << " to surface "<<surf);
682  if(parms) ATH_MSG_DEBUG("Parameters in MS provided : "<< *parms);
683 
684  double pOri = parm.momentum().mag();
685 
686  // Get TSOS from extrapolateM (from TG)
687  std::vector<const Trk::TrackStateOnSurface*>* caloTSOS = m_muonExtrapolator->extrapolateM(ctx,
688  parm,
689  surf, dir,
690  boundaryCheck,
691  mateffects);
692 
693  ATH_MSG_DEBUG("Retrieved " << caloTSOS->size() << " Calorimeter TSOS from extrapolateM, no-removal");
694 
695 #ifdef DEBUGON
696  ATH_MSG_DEBUG("Retrieved " << caloTSOS->size() << " Calorimeter TSOS from extrapolateM, no-removal");
697  for(auto m : *caloTSOS) this->printTSOS(m, "BEFORE-REMOVAL CALO TSOS");
698 #endif
699 
700 
701  Eloss = 0.;
702  double ElossID = 0.;
703  double ElossCalo = 0.;
704  double ElossMS = 0.;
705  for(const auto *m : *caloTSOS) {
706  if(m->materialEffectsOnTrack()) {
707  const Trk::MaterialEffectsOnTrack* meot = dynamic_cast<const Trk::MaterialEffectsOnTrack*>(m->materialEffectsOnTrack());
708  if(meot) {
709  const Trk::EnergyLoss* energyLoss = meot->energyLoss();
710  if (energyLoss) {
711  ATH_MSG_DEBUG(" volume " << this->getVolumeByGeo(m) << " Eloss from extrapolateM TG " << energyLoss->deltaE());
712 
713  Eloss += std::abs(energyLoss->deltaE());
714  if(this->getVolumeByGeo(m)==1) ElossID += std::abs(energyLoss->deltaE());
715  if(this->getVolumeByGeo(m)==2) ElossCalo += std::abs(energyLoss->deltaE());
716  if(this->getVolumeByGeo(m)==3) ElossMS += std::abs(energyLoss->deltaE());
717  }
718  }
719  }
720  }
721 
722  ATH_MSG_DEBUG("Total Eloss on TSOS from extrapolateM " << Eloss << " ElossID " << ElossID << " ElossMS " << ElossMS <<" Elosscalo " << ElossCalo);
723  if(fremoveMS) ATH_MSG_DEBUG(" ID Eloss will be added to Calo Eloss " << ElossID+ElossCalo);
724 
725  Eloss = ElossCalo;
726 
727 // remove ID and MS TSOSs
728  if(removeOoC && !caloTSOS->empty()) removeOutOfCalo(caloTSOS);
729  ATH_MSG_DEBUG("Retrieved " << caloTSOS->size() << " Calorimeter TSOS from extrapolateM");
730 // remove MS TSOSs
731  if(fremoveMS && !caloTSOS->empty()) removeMS(caloTSOS);
732  ATH_MSG_DEBUG("Retrieved " << caloTSOS->size() << " Calorimeter TSOS from extrapolateM");
733 
734 #ifdef DEBUGON
735  for(auto m : *caloTSOS) this->printTSOS(m, "ORIGINAL CALO TSOS");
736 #endif
737 
738 
739  Trk::TrackStates* finalCaloTSOS = nullptr;
740  if(caloTSOS->empty() || Eloss<=0) {
741  if(dir==Trk::alongMomentum&&pOri>4000.) {
742  ATH_MSG_WARNING("Unable to retrieve Calorimeter TSOS from extrapolateM caloTSOS->size() "<< caloTSOS->size() << " Eloss " << Eloss );
743  ATH_MSG_WARNING(" momentum of track " << pOri);
744  ATH_MSG_WARNING(" momentum extrapolated of track " << parm.momentum().mag() << " radius " << parm.position().perp() << " z " << parm.position().z() );
745  ATH_MSG_WARNING(" surface radius " << surf.center().perp() << " z " << surf.center().z() );
746  if(parms) ATH_MSG_WARNING(" momentum of MS track " << parms->momentum().mag());
747  } // else track did not have enough momentum
748  deleteTSOS(caloTSOS);
749  return finalCaloTSOS;
750  }
751 
752  // Apply TG scaling to G4
753  double X0ScaleCALO=1.0;
754  double ElossScaleCALO=1.0;
755  X0ScaleMS=1.0;
756  ElossScaleMS=1.0;
757  const Trk::TrackStateOnSurface* tsosAtCaloExit = this->getCaloExitTSOS(caloTSOS, dir);
758  if(m_applyTGScaling) {
759  if(!tsosAtCaloExit) {
760  ATH_MSG_WARNING( name() << " Unable to find Calorimeter Exit TSOS with TrackParameters! No TG Scaling applied!" );
761  }else{
762  m_elossupdator->getX0ElossScales(1,
763  -log(tan(tsosAtCaloExit->trackParameters()->position().theta()/2)),
764  tsosAtCaloExit->trackParameters()->position().phi(),
765  X0ScaleCALO, ElossScaleCALO);
766  m_elossupdator->getX0ElossScales(0,
767  -log(tan(tsosAtCaloExit->trackParameters()->position().theta()/2)),
768  tsosAtCaloExit->trackParameters()->position().phi(),
769  X0ScaleMS, ElossScaleMS);
770  }
771  }
772  ATH_MSG_DEBUG("Eloss/X0 scaling corrections set to : " << ElossScaleCALO << " " << X0ScaleCALO);
773 
774  // Get momentum at calorimeter entrance
775  // Note that for SA fit i'm taking the pAtCaloEntry from the perigee parameters
776  double pAtCaloEntry = 0;
777  if(dir == Trk::alongMomentum) {
778  double OneOverP = std::abs(parm.parameters()[Trk::qOverP]);
779  if (OneOverP > 0.0)
780  pAtCaloEntry = 1./OneOverP;
781  else
782  pAtCaloEntry = parm.momentum().norm();
783  }else{
784  const Trk::TrackStateOnSurface* tsosAtCaloEntry = this->getCaloEntryTSOS(caloTSOS, dir);
785  if(!tsosAtCaloEntry) {
786  ATH_MSG_WARNING( name() << " Unable to find Calorimeter Entry TSOS with TrackParameters! Momentum at Calo Entry not available!" );
787  }else{
788  double OneOverP = std::abs(tsosAtCaloEntry->trackParameters()->parameters()[Trk::qOverP]);
789  if (OneOverP > 0.0)
790  pAtCaloEntry = 1./OneOverP;
791  else
792  pAtCaloEntry = tsosAtCaloEntry->trackParameters()->momentum().norm();
793  }
794  }
795 
796  ATH_MSG_DEBUG("Momentum at Calo Entry : " << pAtCaloEntry );
797 
798  // If parameters at MS are not provided then try to get them out of extrapolated Calo TSOSs (likely w/o covariance!)
799  if(!parms) {
800  if(!tsosAtCaloExit) {
801  ATH_MSG_DEBUG("Unable to find Calorimeter Exit TSOS with TrackParameters! Momentum at MS not available!" );
802  }else{
803  parms = tsosAtCaloExit->trackParameters();
804  ATH_MSG_DEBUG("MS track parameters taken from calorimeter TSOS");
805  }
806  }
807 
808  // Get momentum error in muon spectrometer
809  double pAtMuonEntryError = 0.0;
810  if(parms) {
811  if( std::abs(parms->parameters()[Trk::qOverP]) > 0.0 ) {
812  double pAtMuonEntry = std::abs(1./parms->parameters()[Trk::qOverP]);
813  if (!parms->covariance() ||
814  !Amg::hasPositiveDiagElems(*parms->covariance())) {
816  "MS track parameters without covariance, using 10% relative error!");
817  pAtMuonEntryError = pAtMuonEntry*0.1;
818  } else {
819  double qOverpAtMuonEntryError = Amg::error(*parms->covariance(),Trk::qOverP);
820  pAtMuonEntryError = pAtMuonEntry*pAtMuonEntry*qOverpAtMuonEntryError;
821  }
822  }
823  }
824 
825  ATH_MSG_DEBUG("Momentum Error at MS Entry : " << pAtMuonEntryError);
826 
827  // Get calorimeter measured energy for pT>m_paramPtCut (15 GeV)
828  double measCaloEnergy = 0.0;
829  double measCaloEnergyError = 0.0;
830  double fsrCaloEnergy = 0.0;
831  double eta = -log(tan(parm.parameters()[Trk::theta]/2));
832  double phi = parm.parameters()[Trk::phi0];
833  double totalEloss=0.0;
834  double meanElossIoni=0.0;
835  double sigmaElossIoni=0.0;
837 
838  // Get Mop and Mean (ionization) energy loss from TG after scaling
839  double e_exp=0.0;
840  this->getMopAndIoniEnergyLoss(caloTSOS,
841  pAtCaloEntry,
842  ElossScaleCALO,
843  totalEloss,
844  meanElossIoni,
845  sigmaElossIoni);
846 
847  double E_em_meas = 0.;
848  double E_em_exp = 0.;
849  double E_tile_meas = 0.;
850  double E_tile_exp = 0.;
851  double E_HEC_meas = 0.;
852  double E_HEC_exp = 0.;
853  double E_dead_exp = 0.;
854 
855  // Get measured energy in calorimeter (run2 tool)
857 //
858 // sigmaElossIoni should be scaled by 0.45 to go to Landau this is later done in updateEloss
859 //
860  if(muonTrack.trackParameters() && !muonTrack.trackParameters()->empty())
861  m_muonCaloEnergyTool->calculateMuonEnergies( &muonTrack,
862  totalEloss, meanElossIoni, 0.45*sigmaElossIoni,
863  measCaloEnergy, measCaloEnergyError, fsrCaloEnergy, e_exp,
864  E_em_meas,E_em_exp,E_tile_meas,E_tile_exp,E_HEC_meas,E_HEC_exp,E_dead_exp);
865 
866 
867  ATH_MSG_DEBUG(" eta " << eta << " Energy measurement from calorimeter: inputs totalEloss, meanElossIoni, sigmaElossIoni "
868  << totalEloss << " " << meanElossIoni << " " << sigmaElossIoni << " e_exp Ioni from TG " << e_exp << " e_exp original " << e_exp*totalEloss/(meanElossIoni+0.001));
869 
870  }
871  // (run1 tool) used for debugging purposes
872  else{
873  measCaloEnergy = this->getCaloMeasuredEnergy(eta,phi,
874  totalEloss,
875  meanElossIoni,
876  fsrCaloEnergy);
877  measCaloEnergyError = 0.50 * sqrt(measCaloEnergy/CLHEP::GeV) * CLHEP::GeV;
878  }
879 
880  ATH_MSG_DEBUG("Final measured energy in calorimeter : " << measCaloEnergy << " +- " << measCaloEnergyError << " MeV"
881  << " momentum fraction " << measCaloEnergy/pAtCaloEntry);
882  }
883 
884  // Check if we can use the measured eloss in the fit
885  bool useMeasuredEnergy = m_useCaloEnergyMeasurement;
886  if(pAtCaloEntry*sin(parm.parameters()[Trk::theta]) < m_paramPtCut) useMeasuredEnergy = false;
887  if(useMeasuredEnergy && !isIsolatedTrack(eta,phi)) useMeasuredEnergy = false;
888 
889  // Total eloss
890  double Eloss_tot=0.0;
891 
892  // Aggregate TSOS, applying scaling corrections (if available) and mean-to-mop correction (cloning!)
893  // This function checks if the measured energy loss has to be used assuming the track is isolated.
894  // Need to check for isolation before and pass 0 values for not-isolated tracks.
895  finalCaloTSOS = modifyTSOSvector(caloTSOS, X0ScaleCALO, ElossScaleCALO,
897  measCaloEnergy, measCaloEnergyError, fsrCaloEnergy,
898  pAtCaloEntry, pAtMuonEntryError,
899  Eloss_tot, useMeasuredEnergy,
900  totalEloss, meanElossIoni, sigmaElossIoni);
901 
902  ATH_MSG_DEBUG( " after modifyTSOSvector X0ScaleCALO " << X0ScaleCALO << " ElossScaleCALO " << ElossScaleCALO <<
903  " pAtCaloEntry " << pAtCaloEntry << " pAtMuonEntryError " << pAtMuonEntryError << " total Eloss from TG through MuonEnergyTool " << Eloss_tot );
904  ATH_MSG_DEBUG("Aggregating and correcting TSOS down to : " << finalCaloTSOS->size() << " with total Eloss " << Eloss_tot);
905 
906 #ifdef DEBUGON
907  ATH_MSG_VERBOSE("FINAL CALO TSOS multiplicity : " << finalCaloTSOS->size());
908  for(auto m : *finalCaloTSOS) this->printTSOS(m, "FINAL CALO TSOS");
909 #endif
910 
911  // delete tsos from extrapolator
912  deleteTSOS(caloTSOS);
913 
914  return finalCaloTSOS;
915 }

◆ getCaloTSOS() [2/2]

std::vector< const Trk::TrackStateOnSurface * > * TrkMaterialProviderTool::getCaloTSOS ( const Trk::TrackParameters parm,
const Trk::Track muonTrack,
const Trk::TrackParameters parms = nullptr 
) const
virtual

Retrieve Calorimeter TSOS from TG and apply corrections.

Implements Trk::ITrkMaterialProviderTool.

Definition at line 516 of file TrkMaterialProviderTool.cxx.

518 {
519  std::vector<const Trk::TrackStateOnSurface*>* caloTSOS = new std::vector<const Trk::TrackStateOnSurface*>();
520  const Trk::TrackingVolume* targetVolume;
522  const EventContext& ctx = Gaudi::Hive::currentContext();
523 
524  const Trk::TrackingGeometry* trackingGeometry = retrieveTrackingGeometry( ctx );
525  if(!trackingGeometry) {
526  ATH_MSG_WARNING("Unable to retrieve tracking geometry");
527  return caloTSOS;
528  }
529 
530  // check if parm is expressed at ID or MS and set extrapolation direction and target volume
531  // ID
532  if( m_indetVolume->inside(parm.position()) ) {
534  targetVolume = trackingGeometry->trackingVolume("MuonSpectrometerEntrance");
535  if(!targetVolume) {
536  ATH_MSG_WARNING("Unable to get target volume for calo material collection!");
537  return caloTSOS;
538  }
539  ATH_MSG_VERBOSE("TP inside ID -> extrapolating TP "<<parm<<" to MS entry volume "<<*targetVolume);
540  }
541  // MS
542  else if( !m_calorimeterVolume->inside(parm.position()) ) {
544  targetVolume = trackingGeometry->trackingVolume("InDet::Containers::InnerDetector");
545  if(!targetVolume) {
546  ATH_MSG_WARNING("Unable to get target volume for calo material collection!");
547  return caloTSOS;
548  }
549  ATH_MSG_VERBOSE("TP inside MS -> extrapolating TP "<<parm<<" to ID exit volume "<<*targetVolume);
550  }
551  // CALO, it happens when called leadingTSOS from MS, backward extrapolation ok
552  else{
554  targetVolume = trackingGeometry->trackingVolume("InDet::Containers::InnerDetector");
555  if(!targetVolume) {
556  ATH_MSG_WARNING("Unable to get target volume for calo material collection!");
557  return caloTSOS;
558  }
559  ATH_MSG_DEBUG("TP inside CALO or between CALO and MS -> assuming ID as target : "<<*targetVolume);
560  }
561 
562  // When doing backward extrapolation the starting TP are defined at MS entrance
563  // so we use them to get the MS momentum error needed later on when doing TSOS aggregation
564  if(!parms) {
565  if(dir == Trk::oppositeMomentum && parm.covariance())
566  parms = &parm;
567  else{
570  for(; it!=itEnd; ++it) {
571  if(this->getVolumeByGeo(*it)==3) //&& !(*it)->type(Trk::TrackStateOnSurface::Perigee)) {
572  if((*it)->trackParameters() && (*it)->trackParameters()->covariance()) {
573  parms = (*it)->trackParameters();
574  break;
575  }
576  }
577  }
578  }
579 
580  if(dir == Trk::oppositeMomentum) {
581 //
582 // go to Beam line
583 //
584  Amg::Vector3D globPos(0.,0.,0.);
585  PerigeeSurface surface(globPos);
586  double Eloss = 0.;
587  double X0ScaleMS = 0.;
588  double ElossScaleMS = 0.;
589  // Collect calorimeter TSOS
590  Trk::TrackStates* caloTSOSdv = this->getCaloTSOS (parm,
591  muonTrack,
592  surface,
593  dir,
594  Trk::muon,
595  Eloss, X0ScaleMS, ElossScaleMS,
596  parms,
597  true,
598  false); // remove only MS TSOS and keep ID+CALO
599 
600  if(parms) ATH_MSG_DEBUG(" go to Beam Line parms position radius " << parms->position().perp() << " z " << parms->position().z());
601  ATH_MSG_DEBUG(" go to Beam Line destination surface position radius " << surface.center().perp() << " z " << surface.center().z());
602 
603  if(caloTSOSdv) {
604  for(unsigned int i=0; i<caloTSOSdv->size(); ++i)
605  caloTSOS->push_back(caloTSOSdv->get(i));
606  delete caloTSOSdv;
607  }
608  return caloTSOS;
609 
610  }
611 
612  // get boundary surfaces of the target volume
613  auto boundaryIntersections = targetVolume->boundarySurfacesOrdered<Trk::TrackParameters>(parm,dir,false);
614 
615  // loop over surfaces
616  double Eloss_previous = 0.;
617  for (auto& boundaryCandidate : boundaryIntersections){
618 
619  // get the surface object at the boundary
620  const Trk::BoundarySurface<Trk::TrackingVolume>* surfaceTV = boundaryCandidate.object;
621  if(!surfaceTV) continue;
622 
623  // get the Trk::Surface
624  const Trk::Surface& surface = surfaceTV->surfaceRepresentation();
625  double Eloss = 0.;
626  double X0ScaleMS = 0.;
627  double ElossScaleMS = 0.;
628  // Collect calorimeter TSOS
629  Trk::TrackStates* caloTSOSdv = this->getCaloTSOS (parm,
630  muonTrack,
631  surface,
632  dir,
633  Trk::muon,
634  Eloss, X0ScaleMS, ElossScaleMS,
635  parms,
636  true,
637  true);
638  // hack to convert DataVector to stl vector and delete the DataVector ...
639  if(caloTSOSdv&&Eloss>Eloss_previous) {
640 //
641 // keep the TSOS vector with the largest Eloss
642 // only one of the surfaces gives the rights intersection
643 // partial crossing with a plane or a cylinder give less Eloss
644 //
645  ATH_MSG_DEBUG(" getCaloTSOS: Previous solution had Eloss " << Eloss_previous << " latest " << Eloss);
646  if(parms) ATH_MSG_DEBUG(" parms position radius " << parms->position().perp() << " z " << parms->position().z());
647  ATH_MSG_DEBUG(" destination surface position radius " << surface.center().perp() << " z " << surface.center().z());
648 
649  for(unsigned int i=0; i<caloTSOSdv->size(); ++i)
650  caloTSOS->push_back(caloTSOSdv->get(i));
651  delete caloTSOSdv;
652  return caloTSOS;
653  }
654  }
655 
656 
657  return caloTSOS;
658 }

◆ getFinalMeasuredEnergy()

double TrkMaterialProviderTool::getFinalMeasuredEnergy ( Rec::CaloMeas caloMeas,
double  mopEloss,
double  meanElossIoni,
double  eta,
double &  fsrCaloEnergy 
) const
private

Function to get corrected (final) calorimeter measured energy loss.

Function to get corrected calorimeter measured energy loss.

Definition at line 1968 of file TrkMaterialProviderTool.cxx.

1973 {
1974  double MopLossCorrected = totalEloss;
1975  double MopLoss = totalEloss;
1976 
1977  // FSR candidate energy
1978  fsrCaloEnergy = MopLoss*m_caloParamTool->emMopFraction(eta);
1979 
1980  // percentage of inert material
1981  const double InertMaterial = m_caloParamTool->x0mapInertMaterial(eta);
1982  // percentage of em calorimeter material
1983  const double EmMaterial = m_caloParamTool->x0mapEmMaterial(eta);
1984  // percentage of hec calorimeter material
1985  const double HECMaterial = m_caloParamTool->x0mapHecMaterial(eta);
1986  // correction for the inert material
1987  double MaterialCorrection = InertMaterial * MopLossCorrected;
1988 
1989  // fraction of Tile used for the measurement
1990  const double TileMeasurementMaterial = caloMeas->Tile_SamplingFraction();
1991  // fraction of LArHEC used for the measurement
1992  const double LArHECMeasurementMaterial = caloMeas->LArHEC_SamplingFraction();
1993  // fraction of LArEM used for the measurement
1994  const double LArEmMeasurementMaterial = caloMeas->LArEM_SamplingFraction();
1995  // Measured energy deposition in Tile
1996  const double TileEnergy = caloMeas->Tile_EnergyMeasured();
1997  // Measured energy deposition in E/M
1998  const double EmEnergy = caloMeas->LArEM_EnergyMeasured();
1999 
2000  // Correction for forward calorimetry
2001  double ForwardHECCorrection = 0.;
2002  if (std::abs(eta)>2. && caloMeas->LArHEC_EnergyMeasured()>100.)
2003  ForwardHECCorrection = (1. - LArHECMeasurementMaterial) * HECMaterial * MopLossCorrected;
2004  const double LArHECEnergy = caloMeas->LArHEC_EnergyMeasured() + ForwardHECCorrection; // Measured energy deposition in LArHEC
2005 
2006  double TotalMeasuredEnergy = TileEnergy + EmEnergy + LArHECEnergy;
2007 
2008  ATH_MSG_VERBOSE( "Energy Deposition:Tile " << TileEnergy
2009  << " LArHEC " << LArHECEnergy
2010  << " EM " << EmEnergy);
2011  ATH_MSG_VERBOSE("ForwardHECCorrection " << ForwardHECCorrection
2012  << " HECMaterial " << HECMaterial
2013  << " MopLossCorrected " << MopLossCorrected );
2014 
2015  bool bHEC = false; // performed HEC measurement?
2016  bool bEM = false; // performed Em measurement?
2017 
2018  // If muon isolated, and no significant measurement is made then use the mop parameterization, else the mean
2019  if (std::abs(eta)<1.4) {
2020  if (LArHECEnergy + TileEnergy > 0.1 * MopLoss * HECMaterial) bHEC= true;
2021  }
2022  else if (std::abs(eta)>1.8) {
2023  if (LArHECEnergy + TileEnergy > 0.2 * MopLoss * HECMaterial) bHEC= true;
2024  }else{
2025  if (LArHECEnergy + TileEnergy > 0.25 * MopLoss * HECMaterial) bHEC= true;
2026  }
2027  if (EmEnergy > 0.5 * MopLoss * EmMaterial) bEM = true;
2028 
2029  double MeasCorrected = TotalMeasuredEnergy + MaterialCorrection;
2030  // Need to calculate the corresponding mip energy deposition
2031  // Muons of 10 GeV are already in the relativistic rise region
2032  // in order to obtain the mip deposition from the mean energy deposition of 10 GeV muons
2033  // should divide by approximately 1.4 (Review of Particle Physics Figure 27.3 p.243)
2034  const double IonizationLoss = (1./1.4) * meanElossIoni;
2035  double eOverMipCorrectionEm = 0.;
2036  double eOverMipCorrectionHEC = 0.;
2037  // Etrue = emip * Emeas
2038  // -DE = Emeas - Etrue = Etrue ( 1./emip -1.)
2039  if (bEM) {
2040  const double emipEM = 0.78;
2041  eOverMipCorrectionEm = - (1./emipEM-1.) * IonizationLoss * EmMaterial * LArEmMeasurementMaterial;
2042  if (EmEnergy + eOverMipCorrectionEm<0.)eOverMipCorrectionEm=0.;
2043  }
2044  if (bHEC) {
2045  const double emipTile = 0.86;
2046  const double emipLAr = 0.94;
2047  const double HECEnergy = TileEnergy + LArHECEnergy;
2048  const double eOverMipCorrectionTile = - (1./emipTile-1.) * TileEnergy / HECEnergy * IonizationLoss * HECMaterial * TileMeasurementMaterial;
2049  const double eOverMipCorrectionLAr = - (1./emipLAr-1.) * LArHECEnergy / HECEnergy * IonizationLoss * HECMaterial * LArHECMeasurementMaterial;
2050  eOverMipCorrectionHEC = eOverMipCorrectionTile + eOverMipCorrectionLAr;
2051  if (LArHECEnergy + TileEnergy + eOverMipCorrectionHEC < 0.0) eOverMipCorrectionHEC=0.;
2052  }
2053  const double eOverMipCorrection = eOverMipCorrectionEm + eOverMipCorrectionHEC;
2054 
2055  // // additional offset from high-statistics Z->mumu MC (measured by Peter K 30/11/2011)
2056  // double fix1FromPeter[26] = { 0.424104 , 0.479637 , 0.483419 , 0.490242 , 0.52806 ,
2057  // 0.573582 , 0.822098 , 0.767301 , 0.809919 , 0.658745 ,
2058  // 0.157187 , 0.413214 , 0.771074 , 0.61815 , 0.350113 ,
2059  // 0.322785 , 0.479294 , 0.806183 , 0.822161 , 0.757731 ,
2060  // -0.0857186, -0.0992693, -0.0492252, 0.0650174, 0.261538 ,
2061  // 0.360413 };
2062  // // (update from Peter K 09/12/2011)
2063  // double fix2FromPeter[26] = { -0.647703 , -0.303498 , -0.268645 , -0.261292 , -0.260152 ,
2064  // -0.269253 , -0.266212 , -0.240837 , -0.130172 , -0.111638 ,
2065  // -0.329423 , -0.321011 , -0.346050 , -0.305592 , -0.313293 ,
2066  // -0.317111 , -0.428393 , -0.524839 , -0.599547 , -0.464013 ,
2067  // -0.159663 , -0.140879 , -0.0975618, 0.0225352, 0.0701925,
2068  // -0.24778 };
2069  // int ieta = static_cast<int> (std::abs(eta)/0.10);
2070  // if (ieta > 25) ieta = 25;
2071 
2072  double FinalMeasuredEnergy = MeasCorrected + eOverMipCorrection;// + (fix1FromPeter[ieta] + fix2FromPeter[ieta])*CLHEP::GeV;
2073 
2074  return FinalMeasuredEnergy;
2075 }

◆ getMopAndIoniEnergyLoss()

void TrkMaterialProviderTool::getMopAndIoniEnergyLoss ( const std::vector< const Trk::TrackStateOnSurface * > *  matvec,
double  pCaloEntry,
double  scaleEloss,
double &  mopEloss,
double &  meanElossIoni,
double &  sigmaElossIoni 
) const
private

Function to get mop and mean (ionization) energy loss.

Definition at line 1865 of file TrkMaterialProviderTool.cxx.

1871 {
1872 // routine calculates the totalEloss = meanIoni + meanRad
1873 // meanElossIoni = meanIoni
1874 // sigmaElossIoni = sigmaIoni
1875 //
1876 
1877 // Be carefull with using deltaE() that number starts as totalEloss but is updated to values close to meanIoni depending on the fit
1878 
1879  double deltaE_tot = 0.;
1880  double sigmaDeltaE_tot = 0.;
1881  double sigmaPlusDeltaE_tot = 0.;
1882  double sigmaMinusDeltaE_tot = 0.;
1883  double deltaE_ioni_tot = 0.;
1884  double sigmaDeltaE_ioni_tot=0.;
1885  double deltaE_rad_tot = 0.;
1886  double sigmaDeltaE_rad_tot =0.;
1887 
1888  for(const auto *m : *matvec) {
1889  if(!m->trackParameters()) {
1890  ATH_MSG_WARNING("No trackparameters on TrackStateOnSurface ");
1891  continue;
1892  }
1893  if(m->materialEffectsOnTrack()) {
1894  const Trk::MaterialEffectsOnTrack* meot = dynamic_cast<const Trk::MaterialEffectsOnTrack*>(m->materialEffectsOnTrack());
1895  const Trk::EnergyLoss* energyLoss = nullptr;
1896  if(meot) {
1897  energyLoss = meot->energyLoss();
1898  if (!energyLoss) {
1899  ATH_MSG_WARNING("No energyLoss on TrackStateOnSurface ");
1900  continue;
1901  }
1902  } else {
1903  ATH_MSG_WARNING("No materialEffectsOnTrack on TrackStateOnSurface ");
1904  continue;
1905  }
1906  deltaE_tot += std::abs(scaleEloss*energyLoss->deltaE());
1907  sigmaDeltaE_tot += std::abs(scaleEloss*energyLoss->sigmaDeltaE());
1908  sigmaPlusDeltaE_tot += std::abs(scaleEloss*energyLoss->sigmaPlusDeltaE());
1909  sigmaMinusDeltaE_tot += std::abs(scaleEloss*energyLoss->sigmaMinusDeltaE());
1910  deltaE_ioni_tot += std::abs(scaleEloss*energyLoss->meanIoni());
1911  sigmaDeltaE_ioni_tot += std::abs(scaleEloss*energyLoss->sigmaIoni());
1912  deltaE_rad_tot += std::abs(scaleEloss*energyLoss->meanRad());
1913  sigmaDeltaE_rad_tot += std::abs(scaleEloss*energyLoss->sigmaRad());
1914 
1915  ATH_MSG_DEBUG(" position x " << m->trackParameters()->position().x() << " y " << m->trackParameters()->position().y() << " perp " << m->trackParameters()->position().perp() << " z " << m->trackParameters()->position().z() );
1916  ATH_MSG_DEBUG(" deltaE " << (scaleEloss*energyLoss->deltaE()) << " deltaE_ioni " << (scaleEloss*energyLoss->meanIoni()) << " sigmaDeltaE_ioni " << (scaleEloss*energyLoss->sigmaIoni()));
1917  ATH_MSG_DEBUG(" deltaE_tot " << deltaE_tot << " deltaE_ioni_tot " << deltaE_ioni_tot << " sigmaDeltaE_ioni_tot " << sigmaDeltaE_ioni_tot);
1918  if(energyLoss->sigmaIoni()<0) ATH_MSG_DEBUG(" ALARM sigmaIoni negative " << scaleEloss*energyLoss->sigmaIoni());
1919  if(energyLoss->sigmaRad()<0) ATH_MSG_DEBUG(" ALARM sigmaRad negative " << scaleEloss*energyLoss->sigmaRad());
1920 
1921  }
1922  }
1923 
1924  EnergyLoss eLoss = EnergyLoss(deltaE_tot, sigmaDeltaE_tot, sigmaMinusDeltaE_tot, sigmaPlusDeltaE_tot,
1925  deltaE_ioni_tot, sigmaDeltaE_ioni_tot,
1926  deltaE_rad_tot, sigmaDeltaE_rad_tot, 0.) ;
1927 
1928  int elossFlag=0;
1929 
1930  EnergyLoss eLoss2 ( m_elossupdator->updateEnergyLoss(eLoss, 0, 0, pCaloEntry, 0, elossFlag) );
1931 
1932  totalEloss = eLoss2.meanIoni() + eLoss2.meanRad();
1933  meanElossIoni = eLoss2.meanIoni();
1934  sigmaElossIoni = eLoss2.sigmaIoni();
1935 
1936  ATH_MSG_DEBUG("Mop Energy Loss " << totalEloss << " mean ionization energy loss " << meanElossIoni << " sigmaElossIoni " << sigmaElossIoni);
1937 }

◆ getParamCaloELoss()

CaloEnergy * TrkMaterialProviderTool::getParamCaloELoss ( Trk::Track track) const
virtual

Retrieve a clone of the parametrised energy loss.

Implements Trk::ITrkMaterialProviderTool.

Definition at line 917 of file TrkMaterialProviderTool.cxx.

918 {
919  for (const Trk::TrackStateOnSurface* tsos : *track->trackStateOnSurfaces()) {
920  if(tsos->materialEffectsOnTrack()) {
921  const Trk::MaterialEffectsOnTrack* meot = dynamic_cast<const Trk::MaterialEffectsOnTrack*>(tsos->materialEffectsOnTrack());
922  if(meot) {
923  const Trk::EnergyLoss* energyLoss = meot->energyLoss();
924  if (energyLoss) {
925  const CaloEnergy* caloEnergy = dynamic_cast<const CaloEnergy*>(meot->energyLoss());
926  if(caloEnergy) {
927  if(caloEnergy->energyLossType()==CaloEnergy::Tail) {
928  CaloEnergy* paramCaloEnergy = new CaloEnergy(caloEnergy->deltaEParam(),
929  0.5*(caloEnergy->sigmaMinusDeltaEParam()+caloEnergy->sigmaPlusDeltaEParam()),
930  caloEnergy->sigmaMinusDeltaEParam(),
931  caloEnergy->sigmaPlusDeltaEParam(),
933  caloEnergy->caloLRLikelihood(),
934  caloEnergy->caloMuonIdTag());
935  paramCaloEnergy->set_measEnergyLoss(caloEnergy->deltaEMeas(), caloEnergy->sigmaDeltaEMeas());
936  paramCaloEnergy->set_paramEnergyLoss(caloEnergy->deltaEParam(), caloEnergy->sigmaMinusDeltaEParam(), caloEnergy->sigmaPlusDeltaEParam());
937  return paramCaloEnergy;
938  }
939  return caloEnergy->clone();
940  }
941  }
942  }
943  }
944  }
945  return (CaloEnergy*)nullptr;
946 }

◆ getVolumeByGeo()

unsigned int TrkMaterialProviderTool::getVolumeByGeo ( const Trk::TrackStateOnSurface m) const
private

Definition at line 1213 of file TrkMaterialProviderTool.cxx.

1214 {
1215  unsigned int vol = 0;
1216  const Trk::MeasurementBase* mot = m->measurementOnTrack();
1217  if(mot) {
1219  if(id.is_valid()) {
1220  if(m_DetID->is_indet(id)) vol=1;
1221  else if(m_DetID->is_muon(id)) vol=3;
1222  else vol=2;
1223  }
1224  }
1225  if(!vol) {
1226  vol=3;
1227  if(m_indetVolume->inside(m->surface().globalReferencePoint())) vol=1;
1228  else if(m_calorimeterVolume->inside(m->surface().globalReferencePoint())) vol=2;
1229  }
1230  return vol;
1231 }

◆ initialize()

StatusCode TrkMaterialProviderTool::initialize ( )

AlgTool initailize method.

handle to the magnetic field cache

Definition at line 68 of file TrkMaterialProviderTool.cxx.

69 {
70  ATH_CHECK(m_muonExtrapolator.retrieve());
71  ATH_CHECK(m_elossupdator.retrieve());
72  ATH_CHECK(m_scattool.retrieve());
74  ATH_CHECK(m_trackIsolationTool.retrieve());
76  ATH_CHECK(m_muonCaloEnergyTool.retrieve());
77  m_caloMeasTool.disable();
78  m_caloParamTool.disable();
79  }else{
80  ATH_CHECK(m_caloMeasTool.retrieve());
81  ATH_CHECK(m_caloParamTool.retrieve());
82  m_muonCaloEnergyTool.disable();
83  }
84  }
85  else{
86  m_caloMeasTool.disable();
87  m_caloParamTool.disable();
88  m_muonCaloEnergyTool.disable();
89  m_trackIsolationTool.disable();
90  }
91 
94 
95  // need an Atlas id-helper to identify sub-detectors, take the one from detStore
96  if (detStore()->retrieve(m_DetID, "AtlasID").isFailure()) {
97  ATH_MSG_ERROR ("Could not get AtlasDetectorID helper" );
98  return StatusCode::FAILURE;
99  }
100 
101  ATH_CHECK(m_trackingVolumesSvc.retrieve());
102 
104  if(!m_calorimeterVolume) {
105  ATH_MSG_ERROR("Unable to retrieve MuonSpectrometerEntryLayer volume");
106  return StatusCode::FAILURE;
107  }
108 
110  if(!m_indetVolume) {
111  ATH_MSG_ERROR("Unable to retrieve CalorimeterEntryLayer volume");
112  return StatusCode::FAILURE;
113  }
114 
115  if (m_trackingGeometryReadKey.key().empty()) {
116  ATH_CHECK(m_trackingGeometrySvc.retrieve());
117  } else
118  ATH_CHECK( m_trackingGeometryReadKey.initialize() );
119 
120  return StatusCode::SUCCESS;
121 }

◆ 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()

const InterfaceID & Trk::ITrkMaterialProviderTool::interfaceID ( )
inlinestaticinherited

Definition at line 54 of file ITrkMaterialProviderTool.h.

55 {
56  return IID_ITrkMaterialProviderTool;
57 }

◆ isIsolatedTrack()

bool TrkMaterialProviderTool::isIsolatedTrack ( double  eta,
double  phi 
) const
private

Function to check isolation.

Definition at line 1940 of file TrkMaterialProviderTool.cxx.

1941 {
1942  int nTracks = 0;
1943  std::pair<int,double> inner = m_trackIsolationTool->trackIsolation(Gaudi::Hive::currentContext(),eta,phi);
1944  nTracks = inner.first;
1945 
1946  ATH_MSG_VERBOSE("Isolation : Number of tracks in cone " << nTracks << " cut < " << m_maxNTracksIso);
1947 
1948  return nTracks <= m_maxNTracksIso;
1949 }

◆ modifyTSOSvector()

Trk::TrackStates * TrkMaterialProviderTool::modifyTSOSvector ( const std::vector< const Trk::TrackStateOnSurface * > *  matvec,
double  scaleX0,
double  scaleEloss,
bool  reposition,
bool  aggregate,
bool  updateEloss,
double  caloEnergy,
double  caloEnergyError,
double  fsrCaloEnergy,
double  pCaloEntry,
double  momentumError,
double &  Eloss_tot,
bool  useMeasuredEnergy = true,
double  mopEloss = 0.,
double  meanElossIoni = 0.,
double  sigmaElossIoni = 0. 
) const
private

Function to modify TSOS doing repositioning, aggregation and corrections.

Definition at line 1301 of file TrkMaterialProviderTool.cxx.

1315 {
1316  //
1317  // inputs: TSOSs for material (matvec) and scale factors for X0 (scaleX0) and Eloss (scaleEloss)
1318  //
1319  // returns: new vector of TSOSs including scaling of X0 and Eloss;
1320  //
1321  // options:
1322  // bool reposition correct repositioning of the scattering centers in space
1323  // bool aggregate put scattering centra together in two planes
1324  // bool update Eloss correct energy loss 1) including the measured calorimeter Eloss 2) include smearing of the muon momentum
1325  //
1326  // the routine should NOT be called for the ID
1327  // for best use in the Calorimeter: bool reposition = true, bool aggregate = true and updateEloss = true (measured caloEnergy and caloEnergyError should be passed)
1328  // note that the updateEloss is only active with aggregate = true
1329  // current version will NOT run correctly for MS (because the Eloss is made positive in the Calorimeter) needs fixing!
1330  // for best use in the Muon Specrometer: bool reposition = true, bool aggregate = true and updateEloss = false
1331  //
1332  // if one runs with reposition = false the scattering centra are kept at the END of the thick/dense material: that is not right for thick material for thin it is OK
1333  ATH_MSG_VERBOSE("Modifying TSOS vector size " << matvec->size()
1334  << " with X0, Eloss scales " << scaleX0 << " " << scaleEloss
1335  << " rep agg upd " << reposition << " " << aggregate << " " << updateEloss
1336  << " caloE " << caloEnergy << " +- " << caloEnergyError
1337  << " fsrCaloEnergy "<< fsrCaloEnergy
1338  << " p " << pCaloEntry << " dp " << momentumError);
1339 
1340  //
1341  Trk::TrackStates* newTSOSvector = new Trk::TrackStates(SG::VIEW_ELEMENTS);
1342 
1343  // initialize total sum variables
1344  //
1345  //
1346  Eloss_tot = 0.;
1347 
1348  double X0_tot = 0.;
1349 
1350  double sigmaDeltaPhi2_tot = 0.;
1351  double sigmaDeltaTheta2_tot = 0.;
1352  double deltaE_tot = 0.;
1353  double sigmaDeltaE_tot = 0.;
1354  double sigmaPlusDeltaE_tot = 0.;
1355  double sigmaMinusDeltaE_tot = 0.;
1356  double deltaE_ioni_tot = 0.;
1357  double sigmaDeltaE_ioni_tot=0.;
1358  double deltaE_rad_tot = 0.;
1359  double sigmaDeltaE_rad_tot =0.;
1360 
1361  const Trk::TrackStateOnSurface* mprevious = nullptr;
1362  const Trk::TrackStateOnSurface* mfirst = nullptr;
1363  const Trk::TrackStateOnSurface* mlast = nullptr;
1364  Amg::Vector3D posFirst(0.,0.,0.);
1365  double deltaEFirst = 0.;
1366 
1367  double deltaPhi = 0.;
1368  double deltaTheta = 0.;
1369 
1370  int n_tot = 0;
1371 
1372  double w_tot = 0.;
1373  double wdist2 = 0.;
1374  Amg::Vector3D wdir(0.,0.,0.);
1375  Amg::Vector3D wpos(0.,0.,0.);
1376 
1377  std::bitset<Trk::MaterialEffectsBase::NumberOfMaterialEffectsTypes> meotPattern(0);
1380 
1381  std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern(0);
1382  typePattern.set(Trk::TrackStateOnSurface::InertMaterial);
1383  typePattern.set(Trk::TrackStateOnSurface::Scatterer);
1384 
1385  std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePatternScat(0);
1386  typePatternScat.set(Trk::TrackStateOnSurface::Scatterer);
1387 
1388  std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePatternDeposit(0);
1389  typePatternDeposit.set(Trk::TrackStateOnSurface::CaloDeposit);
1390  const auto sqrt12=std::sqrt(12.);
1391  for(const auto *m : *matvec) {
1392 
1393  if(!m->trackParameters()) {
1394  ATH_MSG_WARNING("No trackparameters on TrackStateOnSurface ");
1395  continue;
1396  }
1397  if(m->materialEffectsOnTrack()) {
1398  double X0 = m->materialEffectsOnTrack()->thicknessInX0();
1399  const Trk::MaterialEffectsOnTrack* meot = dynamic_cast<const Trk::MaterialEffectsOnTrack*>(m->materialEffectsOnTrack());
1400  const Trk::EnergyLoss* energyLoss = nullptr;
1401  const Trk::ScatteringAngles* scat = nullptr;
1402  if(meot) {
1403  energyLoss = meot->energyLoss();
1404  if (!energyLoss) {
1405  ATH_MSG_WARNING("No energyLoss on TrackStateOnSurface ");
1406  continue;
1407  }
1408  scat = meot->scatteringAngles();
1409  if(!scat) {
1410  ATH_MSG_WARNING("No scatteringAngles on TrackStateOnSurface ");
1411  continue;
1412  }
1413  } else {
1414  ATH_MSG_WARNING("No materialEffectsOnTrack on TrackStateOnSurface ");
1415  continue;
1416  }
1417 
1418  double depth = energyLoss->length();
1419  X0_tot += std::abs(scaleX0 * X0);
1420 
1421  sigmaDeltaTheta2_tot += scaleX0*scat->sigmaDeltaTheta()*scat->sigmaDeltaTheta();
1422  sigmaDeltaPhi2_tot += scaleX0*scat->sigmaDeltaPhi()*scat->sigmaDeltaPhi();
1423 
1424  // Eloss sigma values add up linearly for Landau and exponential distributions
1425  deltaE_tot += std::abs(scaleEloss*energyLoss->deltaE());
1426  sigmaDeltaE_tot += std::abs(scaleEloss*energyLoss->sigmaDeltaE());
1427  sigmaPlusDeltaE_tot += std::abs(scaleEloss*energyLoss->sigmaPlusDeltaE());
1428  sigmaMinusDeltaE_tot += std::abs(scaleEloss*energyLoss->sigmaMinusDeltaE());
1429  deltaE_ioni_tot += std::abs(scaleEloss*energyLoss->meanIoni());
1430  sigmaDeltaE_ioni_tot += std::abs(scaleEloss*energyLoss->sigmaIoni());
1431  deltaE_rad_tot += std::abs(scaleEloss*energyLoss->meanRad());
1432  sigmaDeltaE_rad_tot += std::abs(scaleEloss*energyLoss->sigmaRad());
1433 
1434  n_tot++;
1435 
1436  Amg::Vector3D dir = m->trackParameters()->momentum().unit();
1437  Amg::Vector3D pos = m->trackParameters()->position();
1438  if(mprevious) {
1439  dir += mprevious->trackParameters()->momentum().unit();
1440  }
1441 
1442  dir = dir/dir.mag();
1443  Amg::Vector3D pos0 = pos - (depth/2.+depth/sqrt12)*dir;
1444  Amg::Vector3D posNew = pos - (depth/2.-depth/sqrt12)*dir;
1445  if(!mfirst) {
1446  mfirst = m;
1447  posFirst = pos0;
1448  deltaEFirst = energyLoss->deltaE();
1449  }
1450  mlast = m;
1451 
1452  double w = scat->sigmaDeltaTheta()*scat->sigmaDeltaTheta();
1453 
1454  w_tot += w;
1455  wpos += w*pos0/2.;
1456  wpos += w*posNew/2.;
1457  wdir += w*dir;
1458 
1459  wdist2 += w*(pos0-posFirst).mag2()/2.;
1460  wdist2 += w*(posNew-posFirst).mag2()/2.;
1461 
1462  if (!aggregate&&!reposition) {
1463 
1464  auto scatNew = ScatteringAngles(deltaPhi,
1465  deltaTheta,
1466  std::sqrt(sigmaDeltaPhi2_tot),
1467  std::sqrt(sigmaDeltaTheta2_tot));
1468  auto energyLossNew = Trk::EnergyLoss(deltaE_tot,
1469  sigmaDeltaE_tot,
1470  sigmaMinusDeltaE_tot,
1471  sigmaPlusDeltaE_tot,
1472  deltaE_ioni_tot,
1473  sigmaDeltaE_ioni_tot,
1474  deltaE_rad_tot,
1475  sigmaDeltaE_rad_tot,
1476  depth);
1477  auto caloEnergyNew = std::make_unique<CaloEnergy>(energyLossNew);
1478  Eloss_tot += caloEnergyNew->deltaE();
1479  const Trk::Surface& surf = meot->associatedSurface();
1480  auto meotLast =
1481  std::make_unique<Trk::MaterialEffectsOnTrack>(
1482  X0_tot, scatNew, std::move(caloEnergyNew), surf, meotPattern);
1483  auto pars = m->trackParameters()->uniqueClone();
1484 
1485  // make new TSOS
1487  nullptr, std::move(pars), std::move(meotLast), typePattern);
1488 
1489  newTSOSvector->push_back(newTSOS);
1490 
1491  X0_tot = 0.;
1492  sigmaDeltaTheta2_tot = 0.;
1493  sigmaDeltaPhi2_tot = 0.;
1494  deltaE_tot = 0.;
1495  sigmaDeltaE_tot = 0;
1496  sigmaPlusDeltaE_tot = 0.;
1497  sigmaMinusDeltaE_tot = 0.;
1498  deltaE_ioni_tot = 0.;
1499  sigmaDeltaE_ioni_tot = 0.;
1500  deltaE_rad_tot = 0.;
1501  sigmaDeltaE_rad_tot = 0.;
1502 
1503 
1504  } else if(!aggregate&&reposition) {
1505 
1506  if(std::abs(depth)<10.) {
1507 
1508  // Thin scatterer: make only one TSOS
1509 
1510  auto scatNew =
1511  ScatteringAngles(deltaPhi,
1512  deltaTheta,
1513  sqrt(sigmaDeltaPhi2_tot),
1514  sqrt(sigmaDeltaTheta2_tot));
1515  auto energyLossNew = Trk::EnergyLoss(deltaE_tot,
1516  sigmaDeltaE_tot,
1517  sigmaMinusDeltaE_tot,
1518  sigmaPlusDeltaE_tot,
1519  deltaE_ioni_tot,
1520  sigmaDeltaE_ioni_tot,
1521  deltaE_rad_tot,
1522  sigmaDeltaE_rad_tot,
1523  depth);
1524  auto caloEnergyNew = std::make_unique<CaloEnergy>(energyLossNew);
1525  Eloss_tot += caloEnergyNew->deltaE();
1526  const Trk::Surface& surf = meot->associatedSurface();
1527  auto meotLast =
1528  std::make_unique<Trk::MaterialEffectsOnTrack>(
1529  X0_tot, scatNew, std::move(caloEnergyNew), surf, meotPattern);
1530  auto pars = m->trackParameters()->uniqueClone();
1531  // make new TSOS
1532  const Trk::TrackStateOnSurface* newTSOS =
1534  nullptr, std::move(pars), std::move(meotLast), typePattern);
1535  newTSOSvector->push_back(newTSOS);
1536 
1537  X0_tot = 0.;
1538  sigmaDeltaTheta2_tot = 0.;
1539  sigmaDeltaPhi2_tot = 0.;
1540  deltaE_tot = 0.;
1541  sigmaDeltaE_tot = 0;
1542  sigmaPlusDeltaE_tot = 0.;
1543  sigmaMinusDeltaE_tot = 0.;
1544  deltaE_ioni_tot = 0.;
1545  sigmaDeltaE_ioni_tot = 0.;
1546  deltaE_rad_tot = 0.;
1547  sigmaDeltaE_rad_tot = 0.;
1548 
1549  } else {
1550  //
1551  // Thick scatterer: make two TSOSs
1552  //
1553  // prepare for first MaterialEffectsOnTrack with X0 = X0/2 Eloss = 0 and scattering2 = total2 / 2. depth = 0
1554  auto energyLoss0 = std::make_unique<Trk::EnergyLoss>(0.,0.,0.,0.);
1555  auto scatFirst = ScatteringAngles(deltaPhi,
1556  deltaTheta,
1557  std::sqrt(sigmaDeltaPhi2_tot / 2.),
1558  std::sqrt(sigmaDeltaTheta2_tot / 2.));
1559 
1560  // prepare for second MaterialEffectsOnTrack with X0 = X0/2 Eloss = Eloss total and scattering2 = total2 / 2. depth = 0
1561  auto scatNew =
1562  ScatteringAngles(deltaPhi,
1563  deltaTheta,
1564  std::sqrt(sigmaDeltaPhi2_tot / 2.),
1565  std::sqrt(sigmaDeltaTheta2_tot / 2.));
1566  auto energyLossNew = Trk::EnergyLoss(deltaE_tot,
1567  sigmaDeltaE_tot,
1568  sigmaMinusDeltaE_tot,
1569  sigmaPlusDeltaE_tot,
1570  deltaE_ioni_tot,
1571  sigmaDeltaE_ioni_tot,
1572  deltaE_rad_tot,
1573  sigmaDeltaE_rad_tot,
1574  0.);
1575  auto caloEnergyNew = std::make_unique<CaloEnergy>(energyLossNew);
1576  Eloss_tot += caloEnergyNew->deltaE();
1577  double norm = dir.perp();
1578  // Rotation matrix representation
1579  Amg::Vector3D colx(-dir.y() / norm, dir.x() / norm, 0);
1580  Amg::Vector3D coly(
1581  -dir.x() * dir.z() / norm, -dir.y() * dir.z() / norm, norm);
1582  Amg::Vector3D colz(dir.x(), dir.y(), dir.z());
1583 
1584  Amg::Transform3D surfaceTransformFirst(colx, coly, colz, pos0);
1585  Amg::Transform3D surfaceTransformLast(colx, coly, colz, posNew);
1586  auto surfFirst =
1587  Trk::PlaneSurface(surfaceTransformFirst);
1588  auto surfLast =
1589  Trk::PlaneSurface(surfaceTransformLast);
1590  // make MaterialEffectsOnTracks
1591  auto meotFirst =
1592  std::make_unique<Trk::MaterialEffectsOnTrack>(
1593  X0_tot / 2., scatFirst, std::move(energyLoss0), surfFirst, meotPattern);
1594  auto meotLast =
1595  std::make_unique<Trk::MaterialEffectsOnTrack>(
1596  X0_tot / 2., scatNew, std::move(caloEnergyNew), surfLast, meotPattern);
1597 
1598 
1599  // calculate TrackParameters at first surface
1600  double qOverP0 = m->trackParameters()->charge()/ (m->trackParameters()->momentum().mag()-std::abs(energyLoss->deltaE()));
1601  if(mprevious) qOverP0 = mprevious->trackParameters()->charge()/mprevious->trackParameters()->momentum().mag();
1602 
1603  std::unique_ptr<Trk::TrackParameters> parsFirst =
1604  surfFirst.createUniqueParameters<5, Trk::Charged>(
1605  0., 0., dir.phi(), dir.theta(), qOverP0);
1606  // calculate TrackParameters at second surface
1607  double qOverPNew = m->trackParameters()->charge() /
1608  m->trackParameters()->momentum().mag();
1609  std::unique_ptr<Trk::TrackParameters> parsLast =
1610  surfLast.createUniqueParameters<5, Trk::Charged>(
1611  0., 0., dir.phi(), dir.theta(), qOverPNew);
1612  // make TSOS
1613  //
1614  const Trk::TrackStateOnSurface* newTSOSFirst =
1616  nullptr, std::move(parsFirst), std::move(meotFirst), typePattern);
1617  const Trk::TrackStateOnSurface* newTSOS =
1619  nullptr, std::move(parsLast), std::move(meotLast), typePattern);
1620 
1621 
1622  newTSOSvector->push_back(newTSOSFirst);
1623  newTSOSvector->push_back(newTSOS);
1624 
1625  X0_tot = 0.;
1626  sigmaDeltaTheta2_tot = 0.;
1627  sigmaDeltaPhi2_tot = 0.;
1628  deltaE_tot = 0.;
1629  sigmaDeltaE_tot = 0;
1630  sigmaPlusDeltaE_tot = 0.;
1631  sigmaMinusDeltaE_tot = 0.;
1632  deltaE_ioni_tot = 0.;
1633  sigmaDeltaE_ioni_tot = 0.;
1634  deltaE_rad_tot = 0.;
1635  sigmaDeltaE_rad_tot = 0.;
1636  }
1637  }
1638 
1639  mprevious = m;
1640 
1641 
1642  }
1643  }
1644  if (aggregate&&reposition) {
1645 
1646  if (n_tot>0) {
1647  //
1648  // Make three scattering planes in Calorimeter else make two
1649  //
1650  Amg::Vector3D pos = wpos/w_tot;
1651  bool threePlanes = false;
1652  if (std::abs(pos.z()) < 6700 && pos.perp() < 4200)
1653  threePlanes = true; // always 3 planes in calo
1654  //
1655  auto scatFirst =
1656  ScatteringAngles(deltaPhi,
1657  deltaTheta,
1658  std::sqrt(sigmaDeltaPhi2_tot / 2.),
1659  std::sqrt(sigmaDeltaTheta2_tot / 2.));
1660  auto scatNew =
1661  ScatteringAngles(deltaPhi,
1662  deltaTheta,
1663  std::sqrt(sigmaDeltaPhi2_tot / 2.),
1664  std::sqrt(sigmaDeltaTheta2_tot / 2.));
1665  Trk::EnergyLoss energyLoss2 = EnergyLoss(deltaE_tot,
1666  sigmaDeltaE_tot,
1667  sigmaMinusDeltaE_tot,
1668  sigmaPlusDeltaE_tot,
1669  deltaE_ioni_tot,
1670  sigmaDeltaE_ioni_tot,
1671  deltaE_rad_tot,
1672  sigmaDeltaE_rad_tot,
1673  0.);
1674  if (threePlanes)
1675  ATH_MSG_VERBOSE(" Calorimeter energyLoss2 delta E "
1676  << energyLoss2.deltaE() << " meanIoni "
1677  << energyLoss2.meanIoni() << " sigmaIoni "
1678  << energyLoss2.sigmaIoni() << " X0_tot " << X0_tot);
1679 
1680  int elossFlag =
1681  0; // return Flag for updateEnergyLoss Calorimeter energy (0 = not used)
1682 
1683  double calE = caloEnergy;
1684  double calEr = caloEnergyError;
1685 
1686  // if(!useMeasuredEnergy) calE = 0.;
1687  if (!useMeasuredEnergy)
1688  calEr = 0.;
1689 
1690  Trk::EnergyLoss energyLossNew =
1691  (updateEloss
1692  ? m_elossupdator->updateEnergyLoss(
1693  energyLoss2, calE, calEr, pCaloEntry, momentumError, elossFlag)
1694  : EnergyLoss(deltaE_tot,
1695  sigmaDeltaE_tot,
1696  sigmaMinusDeltaE_tot,
1697  sigmaPlusDeltaE_tot,
1698  deltaE_ioni_tot,
1699  sigmaDeltaE_ioni_tot,
1700  deltaE_rad_tot,
1701  sigmaDeltaE_rad_tot,
1702  0.));
1703  auto caloEnergyNew = std::make_unique<CaloEnergy>(energyLossNew);
1704  if (threePlanes)
1705  ATH_MSG_VERBOSE(" After update Calorimeter energyLossNew "
1706  << energyLossNew.deltaE() << " meanIoni "
1707  << energyLossNew.meanIoni() << " sigmaIoni "
1708  << energyLossNew.sigmaIoni());
1709 
1710  caloEnergyNew->set_measEnergyLoss(caloEnergy, caloEnergyError);
1711  // Store FSR calo energy
1712  caloEnergyNew->set_fsrCandidateEnergy(fsrCaloEnergy);
1713  // Store both measured and parametrised eloss on CaloEnergy object
1714  if(elossFlag!=0) {
1715  caloEnergyNew->set_energyLossType(CaloEnergy::Tail);
1716  } else {
1717  if(!useMeasuredEnergy) caloEnergyNew->set_energyLossType(CaloEnergy::NotIsolated);
1718  }
1719 
1720  int eLossFlagTmp = 0;
1721  Trk::EnergyLoss energyLossParam = m_elossupdator->updateEnergyLoss(energyLoss2, 0.0, 0.0, pCaloEntry, 0., eLossFlagTmp);
1722 
1723  caloEnergyNew->set_paramEnergyLoss(energyLossParam.deltaE(), energyLossParam.sigmaMinusDeltaE(), energyLossParam.sigmaPlusDeltaE());
1724  if(m_overwriteElossParam&&m_useCaloEnergyMeasurement) caloEnergyNew->set_paramEnergyLoss(totalEloss,meanElossIoni,0.45*sigmaElossIoni);
1725  ATH_MSG_DEBUG( " modifyTSOSvector energyLossParam Eloss " << energyLossParam.deltaE() << " on TSOS " << energyLossNew.deltaE() << " calE " << calE);
1726  Eloss_tot += caloEnergyNew->deltaE();
1727 
1728  // direction of plane
1729  Amg::Vector3D dir = wdir/w_tot;
1730  dir = dir/dir.mag();
1731  double norm = dir.perp();
1732  // Rotation matrix representation
1733  Amg::Vector3D colx(-dir.y()/norm, dir.x()/norm, 0);
1734  Amg::Vector3D coly(-dir.x()*dir.z()/norm, -dir.y()*dir.z()/norm, norm);
1735  Amg::Vector3D colz( dir.x(), dir.y(), dir.z());
1736  // Centre position of the two planes
1737  double halflength2 = wdist2/w_tot - (pos-posFirst).mag()*(pos-posFirst).mag();
1738  double halflength = 0.;
1739  if(halflength2>0) halflength = sqrt(halflength2);
1740  Amg::Vector3D pos0 = pos - halflength*dir;
1741  Amg::Vector3D posNew = pos + halflength*dir;
1742 //
1743 // force the planes to be inside the Calorimeter
1744 //
1745  double scaleCalo = 1.;
1746  double scaleCaloNew = std::abs(pos0.z())/6700;
1747  if(scaleCaloNew>scaleCalo) scaleCalo = scaleCaloNew;
1748  scaleCaloNew = std::abs(posNew.z())/6700;
1749  if(scaleCaloNew>scaleCalo) scaleCalo = scaleCaloNew;
1750  scaleCaloNew = std::abs(pos0.perp())/4200;
1751  if(scaleCaloNew>scaleCalo) scaleCalo = scaleCaloNew;
1752  scaleCaloNew = std::abs(posNew.perp())/4200;
1753  if(scaleCaloNew>scaleCalo) scaleCalo = scaleCaloNew;
1754 
1755  if(scaleCalo>1.) {
1756  pos0 = pos0/scaleCalo;
1757  pos = pos/scaleCalo;
1758  posNew = posNew/scaleCalo;
1759  halflength = halflength/scaleCalo;
1760  ATH_MSG_VERBOSE(" position scattering planes inside calo scale factor " << scaleCalo);
1761  }
1762 
1763  if(updateEloss) ATH_MSG_VERBOSE("WITH updateEloss");
1764  Amg::Transform3D surfaceTransformFirst(colx,coly,colz,pos0);
1765  Amg::Transform3D surfaceTransformLast(colx,coly,colz,posNew);
1766  auto surfFirst = Trk::PlaneSurface( surfaceTransformFirst );
1767  auto surfLast= Trk::PlaneSurface( surfaceTransformLast );
1768  // calculate TrackParameters at first surface
1769  double qOverP0 = mfirst->trackParameters()->charge()/(mfirst->trackParameters()->momentum().mag()+std::abs(deltaEFirst));
1770  // calculate TrackParameters at last surface
1771  double qOverPNew = mlast->trackParameters()->charge()/mlast->trackParameters()->momentum().mag();
1772  std::unique_ptr<Trk::TrackParameters> parsFirst =
1773  surfFirst.createUniqueParameters<5, Trk::Charged>(
1774  0., 0., dir.phi(), dir.theta(), qOverP0);
1775  std::unique_ptr<Trk::TrackParameters> parsLast =
1776  surfLast.createUniqueParameters<5, Trk::Charged>(
1777  0., 0., dir.phi(), dir.theta(), qOverPNew);
1778 
1779  if(!threePlanes) {
1780  //
1781  // make two scattering planes and TSOS
1782  //
1783  // prepare for first MaterialEffectsOnTrack with X0 = X0/2
1784  // Eloss = 0 and scattering2 = total2 / 2. depth = 0
1785  auto meotFirst =
1786  std::make_unique<Trk::MaterialEffectsOnTrack>(X0_tot / 2.,
1787  scatFirst,
1788  nullptr,
1789  surfFirst,
1790  meotPattern);
1791  // prepare for second MaterialEffectsOnTrack with X0 = X0/2
1792  // Eloss = Eloss total and scattering2 = total2 / 2. depth = 0
1793  auto meotLast =
1794  std::make_unique<Trk::MaterialEffectsOnTrack>(X0_tot / 2.,
1795  scatNew,
1796  std::move(caloEnergyNew),
1797  surfLast,
1798  meotPattern);
1799  //
1800  //
1801  const Trk::TrackStateOnSurface* newTSOSFirst =
1803  nullptr, std::move(parsFirst), std::move(meotFirst), typePattern);
1804  const Trk::TrackStateOnSurface* newTSOS =
1805  (elossFlag != 0
1807  nullptr, std::move(parsLast), std::move(meotLast), typePatternDeposit)
1808  : new Trk::TrackStateOnSurface(
1809  nullptr, std::move(parsLast), std::move(meotLast), typePattern));
1810  newTSOSvector->push_back(newTSOSFirst);
1811  newTSOSvector->push_back(newTSOS);
1812  } else {
1813  //
1814  // make three scattering planes and TSOS in Calorimeter
1815  //
1816  Amg::Transform3D surfaceTransform(colx, coly, colz, pos);
1817  auto surf = Trk::PlaneSurface(surfaceTransform);
1818  std::unique_ptr<Trk::TrackParameters> pars =
1819  surf.createUniqueParameters<5, Trk::Charged>(
1820  0., 0., dir.phi(), dir.theta(), qOverPNew);
1821 
1822  // prepare for first MaterialEffectsOnTrack with X0 = X0/2 Eloss
1823  // = 0 and scattering2 = total2 / 2. depth = 0
1824  auto meotFirst =
1825  std::make_unique<Trk::MaterialEffectsOnTrack>(
1826  X0_tot / 2., scatFirst, nullptr, surfFirst, meotPattern);
1827 
1828  // prepare for middle MaterialEffectsOnTrack with X0 = 0 Eloss =
1829  // ElossNew and scattering2 = 0. depth = 0
1830  auto meot =
1831  std::make_unique<Trk::MaterialEffectsOnTrack>(
1832  0.,std::nullopt, std::move(caloEnergyNew), surf, meotPattern);
1833 
1834  // prepare for last MaterialEffectsOnTrack with X0 = X0/2 Eloss
1835  // = 0 total and scattering2 = total2 / 2. depth = 0
1836  auto meotLast =
1837  std::make_unique<Trk::MaterialEffectsOnTrack>(
1838  X0_tot / 2., scatNew, nullptr, surfLast, meotPattern);
1839 
1840 
1841  const Trk::TrackStateOnSurface* newTSOSFirst =
1843  nullptr, std::move(parsFirst), std::move(meotFirst), typePatternScat);
1845  nullptr, std::move(pars), std::move(meot), typePatternDeposit);
1846  const Trk::TrackStateOnSurface* newTSOSLast =
1848  nullptr, std::move(parsLast), std::move(meotLast), typePatternScat);
1849 
1850  newTSOSvector->push_back(newTSOSFirst);
1851  newTSOSvector->push_back(newTSOS);
1852  newTSOSvector->push_back(newTSOSLast);
1853  }
1854 
1855 
1856  }
1857 
1858  }
1859 
1860  return newTSOSvector;
1861 }

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

◆ printTSOS()

void TrkMaterialProviderTool::printTSOS ( const Trk::TrackStateOnSurface m,
const std::string &  tag 
) const
private

Definition at line 1254 of file TrkMaterialProviderTool.cxx.

1255 {
1256  unsigned int ivolGeo = getVolumeByGeo(m);
1257  std::string volGeo="ID";
1258  if(ivolGeo==2) volGeo="CALO";
1259  else if(ivolGeo==3) volGeo="MS";
1260  ATH_MSG_VERBOSE(tag<<" Type "<<std::left<<std::setw(35)<<m->dumpType()
1261  <<" Volume "<<std::left<<std::setw(5)<<volGeo
1262  <<" r "<<std::left<<std::setw(10)<<m->surface().globalReferencePoint().perp()
1263  <<" z "<<std::left<<std::setw(10)<<m->surface().globalReferencePoint().z());
1264  if(m->materialEffectsOnTrack()) {
1265  ATH_MSG_VERBOSE(" -> Material: X0 "<<std::left<<std::setw(10)<<m->materialEffectsOnTrack()->thicknessInX0());
1266  const Trk::MaterialEffectsOnTrack* meot = dynamic_cast<const Trk::MaterialEffectsOnTrack*>(m->materialEffectsOnTrack());
1267  if(meot) {
1268  const Trk::EnergyLoss* energyLoss = meot->energyLoss();
1269  if (energyLoss) {
1270  ATH_MSG_DEBUG(" geo " << volGeo << " radius " << m->surface().globalReferencePoint().perp() << " z " << m->surface().globalReferencePoint().z() << " TSOS Eloss " <<energyLoss->deltaE());
1271  std::string type="P";
1272  const CaloEnergy* caloEnergy = dynamic_cast<const CaloEnergy*>(meot->energyLoss());
1273  if(caloEnergy && caloEnergy->energyLossType()==CaloEnergy::Tail) type="M";
1274  ATH_MSG_VERBOSE(" -> Eloss "<<type<<" "<<std::left<<std::setw(10)<<energyLoss->deltaE()<<" +- "<<std::left<<std::setw(10)<<energyLoss->sigmaDeltaE()
1275  <<" + "<<energyLoss->sigmaPlusDeltaE()<<" - "<<energyLoss->sigmaMinusDeltaE()
1276  <<" MopIoni "<<std::left<<std::setw(10)<<energyLoss->meanIoni()<<" +- "<<std::left<<std::setw(10)<<energyLoss->sigmaIoni()
1277  <<" MeanRad "<<std::left<<std::setw(10)<<energyLoss->meanRad()<<" +- "<<std::left<<std::setw(10)<<energyLoss->sigmaRad() );
1278  }
1279  const Trk::ScatteringAngles* scatAngles = meot->scatteringAngles();
1280  if(scatAngles) {
1281  ATH_MSG_VERBOSE(" -> Scattering: dPhi "<<std::left<<std::setw(10)<<scatAngles->deltaPhi()<<" +- "<<std::left<<std::setw(10)<<scatAngles->sigmaDeltaPhi()<<
1282  " dTheta "<<std::left<<std::setw(10)<<scatAngles->deltaTheta()<<" +- "<<std::left<<std::setw(10)<<scatAngles->sigmaDeltaTheta());
1283  }
1284  }
1285  }
1286  if(m->trackParameters()) {
1287  ATH_MSG_VERBOSE(" -> TP: r "<<std::left<<std::setw(10)<<m->trackParameters()->position().perp()
1288  <<" z "<<std::left<<std::setw(10)<<m->trackParameters()->position().z()
1289  <<" phi0 "<<std::left<<std::setw(10)<<m->trackParameters()->parameters()[Trk::phi0]
1290  <<" eta "<<std::left<<std::setw(10)<<-std::log(std::tan(m->trackParameters()->parameters()[Trk::theta]/2)));
1291  if(m->trackParameters()->covariance()) {
1292  ATH_MSG_VERBOSE(" -> Errors: qOverP "<<std::left<<std::setw(10)<<Amg::error(*m->trackParameters()->covariance(),Trk::qOverP)
1293  <<" phi0 "<<std::left<<std::setw(10)<<Amg::error(*m->trackParameters()->covariance(),Trk::phi0)
1294  <<" theta "<<std::left<<std::setw(10)<<Amg::error(*m->trackParameters()->covariance(),Trk::theta));
1295  }
1296  }
1297 }

◆ removeMS()

void TrkMaterialProviderTool::removeMS ( std::vector< const Trk::TrackStateOnSurface * > *  caloTSOS) const
private

Helper to remove only MS TSOS.

Helper to remove MS TSOS.

Definition at line 1034 of file TrkMaterialProviderTool.cxx.

1035 {
1036  // remove all track states on surface with getVolumeByGeo(state)==3 ( ID = 1 Calo = 2 MS = 3)
1037  // and group all other track states at the beginning of the vector.
1038  // finally erase from the vector all track state pointer of the
1039  // deleted objects, which are after remove_if at the end of the vector.
1040  const TrkMaterialProviderTool *this_=this;
1041  caloTSOS->erase( std::remove_if(caloTSOS->begin(),
1042  caloTSOS->end(),
1043  [this_](const Trk::TrackStateOnSurface *&state) {
1044  if (state && this_->getVolumeByGeo(state)==3) {
1045  delete state;
1046  state=nullptr;
1047  return true;
1048  }
1049 
1050  return false;
1051 
1052  } ),
1053  caloTSOS->end());
1054 
1055 }

◆ removeOutOfCalo()

void TrkMaterialProviderTool::removeOutOfCalo ( std::vector< const Trk::TrackStateOnSurface * > *  caloTSOS) const
private

Helper to remove MS and ID TSOS.

Definition at line 1010 of file TrkMaterialProviderTool.cxx.

1011 {
1012  // remove all track states on surface with getVolumeByGeo(state)!=2 ( ID = 1 Calo = 2 MS = 3)
1013  // and group all other track states at the beginning of the vector.
1014  // finally erase from the vector all track state pointer of the
1015  // deleted objects, which are after remove_if at the end of the vector.
1016  const TrkMaterialProviderTool *this_=this;
1017  caloTSOS->erase( std::remove_if(caloTSOS->begin(),
1018  caloTSOS->end(),
1019  [this_](const Trk::TrackStateOnSurface *&state) {
1020  if (state && this_->getVolumeByGeo(state)!=2) {
1021  delete state;
1022  state=nullptr;
1023  return true;
1024  }
1025 
1026  return false;
1027 
1028  } ),
1029  caloTSOS->end());
1030 
1031 }

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

◆ retrieveTrackingGeometry()

const TrackingGeometry* Trk::TrkMaterialProviderTool::retrieveTrackingGeometry ( const EventContext &  ctx) const
inlineprivate

Definition at line 176 of file TrkMaterialProviderTool.h.

176  {
177 
178  if (m_trackingGeometryReadKey.key().empty()) {
179  return m_trackingGeometrySvc->trackingGeometry();
180  }
182  ctx);
183  if (!handle.isValid()) {
185  }
186  return handle.cptr();
187  }

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

◆ throwFailedToGetTrackingGeomtry()

void TrkMaterialProviderTool::throwFailedToGetTrackingGeomtry ( ) const
private

Definition at line 2077 of file TrkMaterialProviderTool.cxx.

2077  {
2078  std::stringstream msg;
2079  msg << "Failed to get conditions data " << m_trackingGeometryReadKey.key() << ".";
2080  throw std::runtime_error(msg.str());
2081 }

◆ updateCaloTSOS() [1/2]

void TrkMaterialProviderTool::updateCaloTSOS ( const Trk::Track idTrack,
Trk::Track extrapolatedTrack 
) const
virtual

Update Calorimeter TSOS from input ID and MS tracks.

Implements Trk::ITrkMaterialProviderTool.

Definition at line 245 of file TrkMaterialProviderTool.cxx.

246 {
247  ATH_MSG_VERBOSE("updateCaloTSOS(Trk::Track& idTrack, Trk::Track& extrapolatedTrack)");
248 
249  const Trk::TrackStates* inputTSOS_ID = idTrack.trackStateOnSurfaces();
250  const Trk::TrackStates* inputTSOS_MS_orig = extrapolatedTrack.trackStateOnSurfaces();
251 
252  auto inputTSOS_MS = std::make_unique<Trk::TrackStates>();
253  for (const Trk::TrackStateOnSurface* tsos : *inputTSOS_MS_orig) {
254  inputTSOS_MS->push_back (tsos->clone());
255  }
256 
257 
258  // find last ID TSOS
259  Trk::TrackStates::const_iterator lastIDwP = inputTSOS_ID->end();
260  Trk::TrackStates::const_iterator itID = inputTSOS_ID->end()-1;
261  Trk::TrackStates::const_iterator itFront = inputTSOS_ID->begin();
262  while(*itID) {
263  if(this->getVolumeByGeo(*itID)==1 && (*itID)->trackParameters()) {
264  lastIDwP = itID;
265  break;
266  }
267  if(itID==itFront) break;
268  --itID;
269  }
270 
271  // find first MS TSOS
272  Trk::TrackStates::iterator firstCALO = inputTSOS_MS->end();
273  Trk::TrackStates::iterator firstMS = inputTSOS_MS->end();
274  Trk::TrackStates::iterator firstMSwP = inputTSOS_MS->end();
275  Trk::TrackStates::iterator itEnd = inputTSOS_MS->end();
276  Trk::TrackStates::iterator it = inputTSOS_MS->begin();
277  for(; it!=itEnd; ++it) {
278 
279 #ifdef DEBUGON
280  printTSOS(*it, "TSOS ON TRACK");
281 #endif
282 
283  if(firstCALO==inputTSOS_MS->end() && this->getVolumeByGeo(*it)==2)
284  firstCALO = it;
285  if(this->getVolumeByGeo(*it)==3) {// && !(*it)->type(Trk::TrackStateOnSurface::Perigee)) {
286  if(firstMS==itEnd)
287  firstMS = it;
288  if((*it)->trackParameters() && (*it)->trackParameters()->covariance()) {
289  firstMSwP = it;
290  break;
291  }
292  }
293  }
294 
295  if(firstCALO == inputTSOS_MS->end()) {
296  ATH_MSG_DEBUG("Track without CALO TSOS!");
297  firstCALO = firstMS;
298  }
299  if(lastIDwP == inputTSOS_ID->end()) {
300  ATH_MSG_WARNING("Unable to find last ID TSOS with Track Parameters");
301  ATH_MSG_WARNING("Unable to update Calorimeter TSOS" );
302  return;
303  }
304  if(firstMS == inputTSOS_MS->end()) {
305  ATH_MSG_WARNING("Unable to find first MS TSOS!");
306  ATH_MSG_WARNING("Unable to update Calorimeter TSOS");
307  return;
308  }
309 
310  // check that first MS TSOS is not a PerigeeSurface
311  //bool removeOoC = false;
312  Trk::TrackStates::const_iterator firstMSnotPerigee = firstMS;
313  if( (*firstMS)->type(Trk::TrackStateOnSurface::Perigee) && (firstMS+1)!=inputTSOS_MS->end()) {
314  firstMSnotPerigee=firstMS+1;
315  //removeOoC = true;
316  }
317 
318 #ifdef DEBUGON
319  printTSOS(*lastIDwP, "LAST IDwP");
320  printTSOS(*firstCALO, "FIRST CALO");
321  printTSOS(*firstMSnotPerigee, "FIRST MS");
322  if(firstMSwP != inputTSOS_MS->end())
323  printTSOS(*firstMSwP, "FIRST MSwP");
324  else
325  ATH_MSG_WARNING("Unable to find first MS TSOS with Track Parameters");
326 #endif
327  double Eloss = 0.;
328  double X0ScaleMS = 0.;
329  double ElossScaleMS = 0.;
330  // get calorimeter TSOS from TG
331  Trk::TrackStates* caloTSOS = this->getCaloTSOS (*(*lastIDwP)->trackParameters(),
332  extrapolatedTrack,
333  (*firstMSnotPerigee)->surface(),
335  Trk::muon,
336  Eloss, X0ScaleMS, ElossScaleMS,
337  (firstMSwP == inputTSOS_MS->end()) ? nullptr : (*firstMSwP)->trackParameters(),
338  false,
339  true);
340 
341 
342  if(!caloTSOS || caloTSOS->size()!=3) {
343  ATH_MSG_WARNING("Unable to retrieve Calorimeter TSOS from extrapolateM (null or <3)");
344  if(caloTSOS) deleteTSOS(caloTSOS);
345  return;
346  }
347 
348 #ifdef DEBUGON
349  ATH_MSG_VERBOSE("ID TSOS multiplicity : " << inputTSOS_ID->size());
350  for(auto m : *inputTSOS_ID) printTSOS(m, "ID TSOS");
351  ATH_MSG_VERBOSE("OLD-MS TSOS multiplicity : " << inputTSOS_MS->size());
352  for(auto m : *inputTSOS_MS) printTSOS(m, "OLD-MS TSOS");
353 #endif
354 
355  // apply X0 and Eloss scale to MuonSpectrometer
356  this->updateVectorMS(inputTSOS_MS.get(),firstMS,X0ScaleMS,ElossScaleMS);
357  // update the original vector
358  Trk::TrkMaterialProviderTool::updateVector(inputTSOS_MS.get(), firstCALO, firstMS, caloTSOS);
359 
360  extrapolatedTrack.setTrackStateOnSurfaces (std::move (inputTSOS_MS));
361  myLocal_resetTrack(extrapolatedTrack);
362 }

◆ updateCaloTSOS() [2/2]

void TrkMaterialProviderTool::updateCaloTSOS ( Trk::Track track,
const Trk::TrackParameters startParamaters = nullptr 
) const
virtual

Update Calorimeter TSOS from input MS/CB track.

Implements Trk::ITrkMaterialProviderTool.

Definition at line 133 of file TrkMaterialProviderTool.cxx.

134 {
135  ATH_MSG_VERBOSE("updateCaloTSOS(Trk::Track& track, const Trk::TrackParameters* startParameters)");
136 
137  // back extrapolate to perigee, get pAtCaloEntry from list of TSOSs
138  // and update/add calo+ID material to mstrack to be refitted.
139  const Trk::TrackStates* inputTSOS_orig = track.trackStateOnSurfaces();
140 
141  auto inputTSOS = std::make_unique<Trk::TrackStates>();
142  for (const Trk::TrackStateOnSurface* tsos : *inputTSOS_orig) {
143  inputTSOS->push_back (tsos->clone());
144  }
145 
146  // Iterators
147  Trk::TrackStates::iterator lastIDwP = inputTSOS->end();
148  Trk::TrackStates::iterator firstCALO = inputTSOS->end();
149  Trk::TrackStates::iterator firstMS = inputTSOS->end();
150  Trk::TrackStates::iterator firstMSwP = inputTSOS->end();
151 
152  // find first MS TSOS (handling the case of TSOS w/o TP) and the last ID (or perigee)
153  Trk::TrackStates::iterator it = inputTSOS->begin();
154  Trk::TrackStates::iterator itEnd = inputTSOS->end();
155  for(; it!=itEnd; ++it) {
156 
157 #ifdef DEBUGON
158  printTSOS(*it, "TSOS ON TRACK");
159 #endif
160 
161  if(this->getVolumeByGeo(*it)==1 && (*it)->trackParameters())
162  lastIDwP = it;
163  if(firstCALO==inputTSOS->end() && this->getVolumeByGeo(*it)==2 && firstMS==itEnd)
164  firstCALO = it;
165  else if(this->getVolumeByGeo(*it)==3 && firstCALO!=inputTSOS->end()) {//&& !(*it)->type(Trk::TrackStateOnSurface::Perigee)) {
166  if(firstMS==itEnd)
167  firstMS = it;
168  if((*it)->trackParameters() && (*it)->trackParameters()->covariance()) {
169  firstMSwP = it;
170  break;
171  }
172  }
173  }
174 
175  // if we have last ID TSOS from the list on track (i.e. combined muon) then use this as start parameters
176  if(lastIDwP != inputTSOS->end()) {
177 #ifdef DEBUGON
178  printTSOS(*lastIDwP, "LAST IDwP");
179 #endif
180  startParameters = (*lastIDwP)->trackParameters();
181  }
182 
183  if(lastIDwP == inputTSOS->end() && !startParameters) {
184  ATH_MSG_WARNING("Unable to find starting parameters for extrapolation");
185  ATH_MSG_WARNING("Unable to update Calorimeter TSOS");
186  return;
187  }
188  if(firstCALO == inputTSOS->end()) {
189  ATH_MSG_DEBUG("Track without CALO TSOS!");
190  firstCALO = firstMS;
191  }
192  if(firstMS == inputTSOS->end()) {
193  ATH_MSG_WARNING("Unable to find first MS TSOS");
194  ATH_MSG_WARNING("Unable to update Calorimeter TSOS");
195  return;
196  }
197 
198  // check that first MS TSOS is not a PerigeeSurface
199  //bool removeOoC = false;
200  Trk::TrackStates::const_iterator firstMSnotPerigee = firstMS;
201  if( (*firstMS)->type(Trk::TrackStateOnSurface::Perigee) && (firstMS+1)!=inputTSOS->end()) {
202  firstMSnotPerigee=firstMS+1;
203  //removeOoC = true;
204  }
205 
206 #ifdef DEBUGON
207  printTSOS(*firstCALO, "FIRST CALO");
208  printTSOS(*firstMSnotPerigee, "FIRST MS");
209 #endif
210  double Eloss = 0.;
211  double X0ScaleMS = 0.;
212  double ElossScaleMS = 0.;
213  // get calorimeter TSOS from TG extrapolating from last ID to MS
214  Trk::TrackStates* caloTSOS = this->getCaloTSOS (*startParameters,
215  track,
216  (*firstMSnotPerigee)->surface(),
218  Trk::muon,
219  Eloss, X0ScaleMS, ElossScaleMS,
220  (firstMSwP == inputTSOS->end()) ? nullptr : (*firstMSwP)->trackParameters(),
221  false,
222  true);
223 
224  if(!caloTSOS || caloTSOS->size()!=3) {
225  ATH_MSG_WARNING("Unable to retrieve Calorimeter TSOS from extrapolateM (null or <3)");
226  if(caloTSOS) deleteTSOS(caloTSOS);
227  return;
228  }
229 
230 #ifdef DEBUGON
231  ATH_MSG_VERBOSE("OLD TSOS multiplicity : " << inputTSOS->size());
232  for(auto m : *inputTSOS) this->printTSOS(m, "OLD TSOS");
233 #endif
234 
235  // apply X0 and Eloss scale to MuonSpectrometer
236  this->updateVectorMS(inputTSOS.get(),firstMS,X0ScaleMS,ElossScaleMS);
237  // update the original vector
238  Trk::TrkMaterialProviderTool::updateVector(inputTSOS.get(), firstCALO, firstMS, caloTSOS);
239  track.setTrackStateOnSurfaces (std::move (inputTSOS));
241 }

◆ updateVector()

void TrkMaterialProviderTool::updateVector ( Trk::TrackStates inputTSOS,
Trk::TrackStates::iterator  lastID,
Trk::TrackStates::iterator  firstMS,
Trk::TrackStates caloTSOS 
)
staticprivate

Helper to update entries in the vector.

Definition at line 1059 of file TrkMaterialProviderTool.cxx.

1063 {
1064  //printTSOS(*firstCALO, "UPD->FIRST CALO");
1065  //printTSOS(*firstMS, "UPD->FIRST MS");
1066  unsigned int ntoupdate=0;
1067  Trk::TrackStates::iterator it = firstCALO;
1068  while(it!=firstMS) {
1069  ++it;
1070  ntoupdate++;
1071  }
1072 
1073  // replace calo TSOS elements in input vector
1074  if(ntoupdate==caloTSOS->size()) {
1075  std::copy(caloTSOS->begin(), caloTSOS->end(), firstCALO);
1076  }else{
1077  it = firstCALO;
1078  unsigned int i=0;
1079  while(i<ntoupdate) {
1080  it = inputTSOS->erase(it);
1081  ++i;
1082  --firstMS;
1083  }
1084  inputTSOS->insert(firstMS, caloTSOS->begin(), caloTSOS->end());
1085  }
1086  // delete the view container
1087  delete caloTSOS;
1088 }

◆ updateVectorMS()

void TrkMaterialProviderTool::updateVectorMS ( Trk::TrackStates inputTSOS,
const Trk::TrackStates::iterator firstMS,
double  X0ScaleMS,
double  ElossScaleMS 
) const
private

update the TSOS vector for the Muon Spectrometer applying X0 and Eloss scaling

Definition at line 1089 of file TrkMaterialProviderTool.cxx.

1092 {
1093 
1094  bool debug = false;
1095 
1096 // Scale the X0 and Energy loss in the Muon Spectrometer
1097 
1098  std::bitset<Trk::MaterialEffectsBase::NumberOfMaterialEffectsTypes> meotPattern(0);
1101  std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern(0);
1102  typePattern.set(Trk::TrackStateOnSurface::InertMaterial);
1103  typePattern.set(Trk::TrackStateOnSurface::Scatterer);
1104 
1105  if(X0ScaleMS<0.5||ElossScaleMS<0.5||X0ScaleMS>2.||ElossScaleMS>2.) {
1106  ATH_MSG_WARNING("Too large or too small X0ScaleMS " << X0ScaleMS << " ElossScaleMS " << ElossScaleMS);
1107  }
1108 
1109  Trk::TrackStates::iterator it = firstMS;
1110  int msStates = 0;
1111  int msMatStates = 0;
1112  int msMatParStates = 0;
1113 
1114 // In the MuonSpectrometer the TSOS for the MaterialEffectsOnTrack do NOT have trackParameters
1115 
1116  for(;it!= inputTSOS->end();++it) {
1117  msStates++;
1118  if((*it)->materialEffectsOnTrack()) {
1119  msMatStates++;
1120 // if((*it)->trackParameters()) {
1121 // ATH_MSG_WARNING("No trackparameters on TrackStateOnSurface ");
1122 // continue;
1123 // }
1124  const Trk::MaterialEffectsOnTrack* meot = dynamic_cast<const Trk::MaterialEffectsOnTrack*>((*it)->materialEffectsOnTrack());
1125  if(meot) {
1126  msMatParStates++;
1127  const Trk::EnergyLoss* energyLoss = meot->energyLoss();
1128  if(energyLoss) {
1129  const Trk::ScatteringAngles* scatAngles = meot->scatteringAngles();
1130  if(scatAngles) {
1131  auto scatNew = Trk::ScatteringAngles(
1132  0,
1133  0,
1134  std::sqrt(X0ScaleMS) * scatAngles->sigmaDeltaTheta(),
1135  std::sqrt(X0ScaleMS) * scatAngles->sigmaDeltaPhi());
1136  double deltaE = (ElossScaleMS * energyLoss->deltaE());
1137  double sigmaDeltaE = (ElossScaleMS * energyLoss->sigmaDeltaE());
1138  double sigmaPlusDeltaE =
1139  (ElossScaleMS * energyLoss->sigmaPlusDeltaE());
1140  double sigmaMinusDeltaE =
1141  (ElossScaleMS * energyLoss->sigmaMinusDeltaE());
1142  double deltaE_ioni = (ElossScaleMS * energyLoss->meanIoni());
1143  double sigmaDeltaE_ioni = (ElossScaleMS * energyLoss->sigmaIoni());
1144  double deltaE_rad = (ElossScaleMS * energyLoss->meanRad());
1145  double sigmaDeltaE_rad = (ElossScaleMS * energyLoss->sigmaRad());
1146  double depth = energyLoss->length();
1147 
1148  if (debug)
1149  std::cout << " updateVectorMS Old Eloss " << energyLoss->deltaE()
1150  << " new Eloss " << deltaE << std::endl;
1151 
1152  auto energyLossNew = std::make_unique<Trk::EnergyLoss>(deltaE,
1153  sigmaDeltaE,
1154  sigmaMinusDeltaE,
1155  sigmaPlusDeltaE,
1156  deltaE_ioni,
1157  sigmaDeltaE_ioni,
1158  deltaE_rad,
1159  sigmaDeltaE_rad,
1160  depth);
1161  const Trk::Surface& surf = meot->associatedSurface();
1162  auto newMeot =
1163  std::make_unique<Trk::MaterialEffectsOnTrack>(X0ScaleMS * meot->thicknessInX0(),
1164  scatNew,
1165  std::move(energyLossNew),
1166  surf,
1167  meotPattern);
1168  std::unique_ptr<Trk::TrackParameters> pars{};
1169  if ((*it)->trackParameters())
1170  pars = (*it)->trackParameters()->uniqueClone();
1171  // make new TSOS
1172  const Trk::TrackStateOnSurface* newTSOS =
1174  nullptr, std::move(pars), std::move(newMeot), typePattern);
1175  Trk::TrackStates* newTSOSvector =
1177  newTSOSvector->push_back(&(*newTSOS));
1178  // replace TSOS in MS with new one
1179  std::copy(newTSOSvector->begin(), newTSOSvector->end(), it);
1180  delete newTSOSvector;
1181  }
1182  }
1183  }
1184  }
1185  }
1186 
1187 
1188  if(debug) {
1189  std::cout << " msStates " << msStates << " msMatStates " << msMatStates << " msMatParStates " << msMatParStates << std::endl;
1190 
1191 // dump (new) energy loss
1192  for(it = firstMS;it!= inputTSOS->end();++it) {
1193  if((*it)->materialEffectsOnTrack()) {
1194  const Trk::MaterialEffectsOnTrack* meot = dynamic_cast<const Trk::MaterialEffectsOnTrack*>((*it)->materialEffectsOnTrack());
1195  if(meot) {
1196  const Trk::EnergyLoss* energyLoss = meot->energyLoss();
1197  if(energyLoss) {
1198  const Trk::ScatteringAngles* scatAngles = meot->scatteringAngles();
1199  if(scatAngles) {
1200  std::cout << " updateVectorMS dump NEW Eloss " << energyLoss->deltaE() << std::endl;
1201  }
1202  }
1203  }
1204  }
1205  }
1206 
1207  } // end debug
1208 
1209 
1210 }

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

bool Trk::TrkMaterialProviderTool::m_aggregateTSOS
private

Definition at line 223 of file TrkMaterialProviderTool.h.

◆ m_applyTGScaling

bool Trk::TrkMaterialProviderTool::m_applyTGScaling
private

Definition at line 221 of file TrkMaterialProviderTool.h.

◆ m_caloMeasTool

ToolHandle<Rec::IMuidCaloEnergyMeas> Trk::TrkMaterialProviderTool::m_caloMeasTool {this, "CaloMeasTool", "Rec::MuidCaloEnergyMeas/MuidCaloEnergyMeas"}
private

Definition at line 204 of file TrkMaterialProviderTool.h.

◆ m_caloParamTool

ToolHandle<Rec::IMuidCaloEnergyParam> Trk::TrkMaterialProviderTool::m_caloParamTool {this, "CaloParamTool", "Rec::MuidCaloEnergyParam/MuidCaloEnergyParam"}
private

Definition at line 206 of file TrkMaterialProviderTool.h.

◆ m_calorimeterVolume

const Trk::Volume* Trk::TrkMaterialProviderTool::m_calorimeterVolume
private

Definition at line 214 of file TrkMaterialProviderTool.h.

◆ m_DetID

const AtlasDetectorID* Trk::TrkMaterialProviderTool::m_DetID
private

Definition at line 213 of file TrkMaterialProviderTool.h.

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

PublicToolHandle<Trk::IEnergyLossUpdator> Trk::TrkMaterialProviderTool::m_elossupdator {this,"EnergyLossUpdator","Trk::EnergyLossUpdator/AtlasEnergyLossUpdator",""}
private

Definition at line 191 of file TrkMaterialProviderTool.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_fieldCacheCondObjInputKey

SG::ReadCondHandleKey<AtlasFieldCacheCondObj> Trk::TrkMaterialProviderTool::m_fieldCacheCondObjInputKey
private
Initial value:
{this, "AtlasFieldCacheCondObj", "fieldCondObj",
"Name of the Magnetic Field conditions object key"}

Definition at line 218 of file TrkMaterialProviderTool.h.

◆ m_indetVolume

const Trk::Volume* Trk::TrkMaterialProviderTool::m_indetVolume
private

Definition at line 215 of file TrkMaterialProviderTool.h.

◆ m_maxNTracksIso

int Trk::TrkMaterialProviderTool::m_maxNTracksIso
private

Definition at line 226 of file TrkMaterialProviderTool.h.

◆ m_muonCaloEnergyTool

ToolHandle<Rec::IMuonCaloEnergyTool> Trk::TrkMaterialProviderTool::m_muonCaloEnergyTool
private
Initial value:
{this,
"MuonCaloEnergyTool", ""}

Definition at line 210 of file TrkMaterialProviderTool.h.

◆ m_muonExtrapolator

PublicToolHandle<Trk::IExtrapolator> Trk::TrkMaterialProviderTool::m_muonExtrapolator {this,"Extrapolator","Trk::Extrapolator/AtlasExtrapolator",""}
private

Definition at line 189 of file TrkMaterialProviderTool.h.

◆ m_overwriteElossParam

bool Trk::TrkMaterialProviderTool::m_overwriteElossParam
private

Definition at line 230 of file TrkMaterialProviderTool.h.

◆ m_paramPtCut

double Trk::TrkMaterialProviderTool::m_paramPtCut
private

Definition at line 227 of file TrkMaterialProviderTool.h.

◆ m_repositionTSOS

bool Trk::TrkMaterialProviderTool::m_repositionTSOS
private

Definition at line 222 of file TrkMaterialProviderTool.h.

◆ m_scattool

ToolHandle< Trk::IMultipleScatteringUpdator > Trk::TrkMaterialProviderTool::m_scattool
private
Initial value:
{this, "MultipleScatteringTool",
"Trk::MultipleScatteringUpdator/AtlasMultipleScatteringUpdator"}

Definition at line 200 of file TrkMaterialProviderTool.h.

◆ m_trackingGeometryReadKey

SG::ReadCondHandleKey<TrackingGeometry> Trk::TrkMaterialProviderTool::m_trackingGeometryReadKey {this, "TrackingGeometryReadKey", "", "Key of the TrackingGeometry conditions data."}
private

Definition at line 197 of file TrkMaterialProviderTool.h.

◆ m_trackingGeometrySvc

ServiceHandle<ITrackingGeometrySvc> Trk::TrkMaterialProviderTool::m_trackingGeometrySvc {this, "TrackingGeometrySvc", "", ""}
private

Definition at line 195 of file TrkMaterialProviderTool.h.

◆ m_trackingVolumesSvc

ServiceHandle<Trk::ITrackingVolumesSvc> Trk::TrkMaterialProviderTool::m_trackingVolumesSvc {this, "TrackingVolumeSvc", "TrackingVolumesSvc/TrackingVolumesSvc"}
private

Definition at line 193 of file TrkMaterialProviderTool.h.

◆ m_trackIsolationTool

ToolHandle<Rec::IMuidTrackIsolation> Trk::TrkMaterialProviderTool::m_trackIsolationTool {this, "TrackIsolationTool", "Rec::MuidTrackIsolation/MuidTrackIsolation"}
private

Definition at line 208 of file TrkMaterialProviderTool.h.

◆ m_updateTSOS

bool Trk::TrkMaterialProviderTool::m_updateTSOS
private

Definition at line 224 of file TrkMaterialProviderTool.h.

◆ m_useCaloEnergyMeasurement

bool Trk::TrkMaterialProviderTool::m_useCaloEnergyMeasurement
private

Definition at line 228 of file TrkMaterialProviderTool.h.

◆ m_useMuonCaloEnergyTool

bool Trk::TrkMaterialProviderTool::m_useMuonCaloEnergyTool
private

Definition at line 229 of file TrkMaterialProviderTool.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.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
CaloEnergy::Tail
@ Tail
Definition: CaloEnergy.h:43
Trk::ScatteringAngles::deltaPhi
double deltaPhi() const
returns the
Definition: ScatteringAngles.h:82
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
Trk::EnergyLoss::sigmaMinusDeltaE
double sigmaMinusDeltaE() const
returns the negative side
Trk::TrackStateOnSurface::trackParameters
const TrackParameters * trackParameters() const
return ptr to trackparameters const overload
Trk::TrackStateOnSurface::CaloDeposit
@ CaloDeposit
This TSOS contains a CaloEnergy object.
Definition: TrackStateOnSurface.h:135
Trk::TrkMaterialProviderTool::m_caloParamTool
ToolHandle< Rec::IMuidCaloEnergyParam > m_caloParamTool
Definition: TrkMaterialProviderTool.h:207
Trk::TrackStateOnSurface::Perigee
@ Perigee
This represents a perigee, and so will contain a Perigee object only.
Definition: TrackStateOnSurface.h:117
PlotCalibFromCool.norm
norm
Definition: PlotCalibFromCool.py:100
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
egammaParameters::depth
@ depth
pointing depth of the shower as calculated in egammaqgcld
Definition: egammaParamDefs.h:276
Trk::BoundarySurface
Definition: BoundarySurface.h:50
Trk::TrkMaterialProviderTool::m_paramPtCut
double m_paramPtCut
Definition: TrkMaterialProviderTool.h:227
Amg::hasPositiveDiagElems
bool hasPositiveDiagElems(const AmgSymMatrix(N) &mat)
Returns true if all diagonal elements of the covariance matrix are finite aka sane in the above defin...
Definition: EventPrimitivesCovarianceHelpers.h:96
Trk::TrkMaterialProviderTool::getMopAndIoniEnergyLoss
void getMopAndIoniEnergyLoss(const std::vector< const Trk::TrackStateOnSurface * > *matvec, double pCaloEntry, double scaleEloss, double &mopEloss, double &meanElossIoni, double &sigmaElossIoni) const
Function to get mop and mean (ionization) energy loss.
Definition: TrkMaterialProviderTool.cxx:1865
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
CaloEnergy::clone
CaloEnergy * clone() const
Virtual constructor.
Definition: CaloEnergy.h:165
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
Trk::TrkMaterialProviderTool::m_aggregateTSOS
bool m_aggregateTSOS
Definition: TrkMaterialProviderTool.h:223
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
CaloEnergy
class extending the basic Trk::EnergyLoss to describe the measured or parameterised muon energy loss ...
Definition: CaloEnergy.h:28
Trk::ParametersBase::charge
double charge() const
Returns the charge.
AtlasFieldCacheCondObj
Definition: AtlasFieldCacheCondObj.h:19
CaloEnergy::set_paramEnergyLoss
void set_paramEnergyLoss(const double deltaE, const double sigmaMinusDeltaE, const double sigmaPlusDeltaE)
set parametrised energy loss
Definition: CaloEnergy.h:133
Trk::TrkMaterialProviderTool::m_trackingVolumesSvc
ServiceHandle< Trk::ITrackingVolumesSvc > m_trackingVolumesSvc
Definition: TrkMaterialProviderTool.h:194
Trk::TrkMaterialProviderTool::removeOutOfCalo
void removeOutOfCalo(std::vector< const Trk::TrackStateOnSurface * > *caloTSOS) const
Helper to remove MS and ID TSOS.
Definition: TrkMaterialProviderTool.cxx:1010
OfflineHitType::InertMaterial
@ InertMaterial
Trk::Volume::inside
bool inside(const Amg::Vector3D &gp, double tol=0.) const
Inside() method for checks.
Definition: Volume.cxx:90
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
Trk::ParametersBase::position
const Amg::Vector3D & position() const
Access method for the position.
Trk::oppositeMomentum
@ oppositeMomentum
Definition: PropDirection.h:21
Trk::TrkMaterialProviderTool::m_calorimeterVolume
const Trk::Volume * m_calorimeterVolume
Definition: TrkMaterialProviderTool.h:214
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Trk::Track::trackStateOnSurfaces
const Trk::TrackStates * trackStateOnSurfaces() const
return a pointer to a const DataVector of const TrackStateOnSurfaces.
xAOD::deltaPhi
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap setEtaBin setIsTgcFailure setDeltaPt deltaPhi
Definition: L2StandAloneMuon_v1.cxx:160
Rec::CaloMeas::LArEM_EnergyMeasured
double LArEM_EnergyMeasured(void) const
Definition: CaloMeas.h:84
Trk::TrkMaterialProviderTool::m_trackingGeometrySvc
ServiceHandle< ITrackingGeometrySvc > m_trackingGeometrySvc
Definition: TrkMaterialProviderTool.h:195
Trk::TrkMaterialProviderTool::m_caloMeasTool
ToolHandle< Rec::IMuidCaloEnergyMeas > m_caloMeasTool
Definition: TrkMaterialProviderTool.h:205
Trk::TrkMaterialProviderTool::updateVectorMS
void updateVectorMS(Trk::TrackStates *inputTSOS, const Trk::TrackStates::iterator &firstMS, double X0ScaleMS, double ElossScaleMS) const
update the TSOS vector for the Muon Spectrometer applying X0 and Eloss scaling
Definition: TrkMaterialProviderTool.cxx:1089
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
skel.it
it
Definition: skel.GENtoEVGEN.py:423
CaloEnergy::deltaEMeas
double deltaEMeas() const
get measured energy loss
Definition: CaloEnergy.h:127
Trk::ITrackingVolumesSvc::MuonSpectrometerEntryLayer
@ MuonSpectrometerEntryLayer
Tracking Volume which defines the entrance surfaces of the MS.
Definition: ITrackingVolumesSvc.h:41
Trk::EnergyLoss::sigmaDeltaE
double sigmaDeltaE() const
returns the symmatric error
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::TrkMaterialProviderTool::getCaloExitTSOS
const Trk::TrackStateOnSurface * getCaloExitTSOS(const std::vector< const Trk::TrackStateOnSurface * > *caloTSOS, Trk::PropDirection dir) const
Helper to get last calo TSOS with TP.
Definition: TrkMaterialProviderTool.cxx:952
Trk::TrkMaterialProviderTool::m_repositionTSOS
bool m_repositionTSOS
Definition: TrkMaterialProviderTool.h:222
DataVector::get
const T * get(size_type n) const
Access an element, as an rvalue.
Trk::ScatteringAngles
represents a deflection of the track caused through multiple scattering in material.
Definition: ScatteringAngles.h:26
Trk::MaterialEffectsBase::thicknessInX0
double thicknessInX0() const
returns the actually traversed material .
CaloEnergy::deltaEParam
double deltaEParam() const
get parametrised energy loss
Definition: CaloEnergy.h:137
Trk::alongMomentum
@ alongMomentum
Definition: PropDirection.h:20
Trk::TrkMaterialProviderTool::updateVector
static void updateVector(Trk::TrackStates *inputTSOS, Trk::TrackStates::iterator lastID, Trk::TrackStates::iterator firstMS, Trk::TrackStates *caloTSOS)
Helper to update entries in the vector.
Definition: TrkMaterialProviderTool.cxx:1059
Trk::EnergyLoss::sigmaRad
double sigmaRad() const
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
Trk::EnergyLoss::meanIoni
double meanIoni() const
Trk::TrkMaterialProviderTool::retrieveTrackingGeometry
const TrackingGeometry * retrieveTrackingGeometry(const EventContext &ctx) const
Definition: TrkMaterialProviderTool.h:176
Trk::Surface::center
const Amg::Vector3D & center() const
Returns the center position of the Surface.
MagField::AtlasFieldCache::toroidOn
bool toroidOn() const
Trk::TrkMaterialProviderTool::m_useMuonCaloEnergyTool
bool m_useMuonCaloEnergyTool
Definition: TrkMaterialProviderTool.h:229
Rec::CaloMeas::LArHEC_EnergyMeasured
double LArHEC_EnergyMeasured(void) const
Definition: CaloMeas.h:72
CaloEnergy::set_measEnergyLoss
void set_measEnergyLoss(const double deltaE, const double sigmaDeltaE)
set measured energy loss
Definition: CaloEnergy.h:124
CaloEnergy::sigmaDeltaEMeas
double sigmaDeltaEMeas() const
get measured energy loss error
Definition: CaloEnergy.h:130
Trk::TrkMaterialProviderTool::m_muonExtrapolator
PublicToolHandle< Trk::IExtrapolator > m_muonExtrapolator
Definition: TrkMaterialProviderTool.h:190
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
Trk::TrkMaterialProviderTool::m_overwriteElossParam
bool m_overwriteElossParam
Definition: TrkMaterialProviderTool.h:230
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
Trk::TrkMaterialProviderTool::getCaloTSOS
std::vector< const Trk::TrackStateOnSurface * > * getCaloTSOS(const Trk::TrackParameters &parm, const Trk::Track &muonTrack, const Trk::TrackParameters *parms=nullptr) const
Retrieve Calorimeter TSOS from TG and apply corrections.
Definition: TrkMaterialProviderTool.cxx:516
Trk::Charged
Definition: Charged.h:27
Trk::TrkMaterialProviderTool::deleteTSOS
static void deleteTSOS(const std::vector< const Trk::TrackStateOnSurface * > *vecTSOS)
Definition: TrkMaterialProviderTool.cxx:1235
pdg_comparison.X0
X0
Definition: pdg_comparison.py:314
Trk::MaterialEffectsOnTrack
represents the full description of deflection and e-loss of a track in material.
Definition: MaterialEffectsOnTrack.h:40
Trk::EnergyLoss::length
double length() const
Trk::TrkMaterialProviderTool::m_scattool
ToolHandle< Trk::IMultipleScatteringUpdator > m_scattool
Definition: TrkMaterialProviderTool.h:201
Trk::PropDirection
PropDirection
Definition: PropDirection.h:19
Trk::ScatteringAngles::sigmaDeltaTheta
double sigmaDeltaTheta() const
returns the
Definition: ScatteringAngles.h:100
CaloEnergy::energyLossType
CaloEnergy::EnergyLossType energyLossType(void) const
Accessor methods.
Definition: CaloEnergy.h:162
Trk::BoundarySurface::surfaceRepresentation
virtual const Surface & surfaceRepresentation() const =0
The Surface Representation of this.
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Trk::TrkMaterialProviderTool::throwFailedToGetTrackingGeomtry
void throwFailedToGetTrackingGeomtry() const
Definition: TrkMaterialProviderTool.cxx:2077
Trk::TrkMaterialProviderTool::getFinalMeasuredEnergy
double getFinalMeasuredEnergy(Rec::CaloMeas *caloMeas, double mopEloss, double meanElossIoni, double eta, double &fsrCaloEnergy) const
Function to get corrected (final) calorimeter measured energy loss.
Definition: TrkMaterialProviderTool.cxx:1968
updateDocumentation.wdir
wdir
Definition: updateDocumentation.py:8
Trk::TrkMaterialProviderTool::m_useCaloEnergyMeasurement
bool m_useCaloEnergyMeasurement
Definition: TrkMaterialProviderTool.h:228
Trk::TrackStates
DataVector< const Trk::TrackStateOnSurface > TrackStates
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:30
Trk::TrkMaterialProviderTool::isIsolatedTrack
bool isIsolatedTrack(double eta, double phi) const
Function to check isolation.
Definition: TrkMaterialProviderTool.cxx:1940
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
lumiFormat.i
int i
Definition: lumiFormat.py:92
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
beamspotman.n
n
Definition: beamspotman.py:731
Trk::theta
@ theta
Definition: ParamDefs.h:72
Trk::TrackingGeometry
Definition: TrackingGeometry.h:67
Trk::TrkMaterialProviderTool::m_elossupdator
PublicToolHandle< Trk::IEnergyLossUpdator > m_elossupdator
Definition: TrkMaterialProviderTool.h:192
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Trk::TrkMaterialProviderTool::m_muonCaloEnergyTool
ToolHandle< Rec::IMuonCaloEnergyTool > m_muonCaloEnergyTool
Definition: TrkMaterialProviderTool.h:210
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
perfmonmt-refit.n_tot
n_tot
Definition: perfmonmt-refit.py:104
Trk::EnergyLoss::deltaE
double deltaE() const
returns the
Trk::MaterialEffectsBase::ScatteringEffects
@ ScatteringEffects
contains material effects due to multiple scattering
Definition: MaterialEffectsBase.h:45
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DataVector::insert
iterator insert(iterator position, value_type pElem)
Add a new element to the collection.
Trk::TrkMaterialProviderTool::m_trackingGeometryReadKey
SG::ReadCondHandleKey< TrackingGeometry > m_trackingGeometryReadKey
Definition: TrkMaterialProviderTool.h:198
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
Trk::ParametersBase
Definition: ParametersBase.h:55
Trk::muon
@ muon
Definition: ParticleHypothesis.h:28
DataVector< const Trk::TrackStateOnSurface >
Trk::EnergyLoss::meanRad
double meanRad() const
Trk::TrkMaterialProviderTool::removeMS
void removeMS(std::vector< const Trk::TrackStateOnSurface * > *caloTSOS) const
Helper to remove only MS TSOS.
Definition: TrkMaterialProviderTool.cxx:1034
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
Trk::TrkMaterialProviderTool::m_applyTGScaling
bool m_applyTGScaling
Definition: TrkMaterialProviderTool.h:221
beamspotman.dir
string dir
Definition: beamspotman.py:623
Trk::ITrackingVolumesSvc::CalorimeterEntryLayer
@ CalorimeterEntryLayer
Tracking Volume which defines the entrance srufaces of the calorimeter.
Definition: ITrackingVolumesSvc.h:40
myLocal_resetTrack
void myLocal_resetTrack(Trk::Track &track)
Definition: TrkMaterialProviderTool.cxx:33
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::MeasurementBase
Definition: MeasurementBase.h:58
Trk::Track::trackParameters
const DataVector< const TrackParameters > * trackParameters() const
Return a pointer to a vector of TrackParameters.
Definition: Tracking/TrkEvent/TrkTrack/src/Track.cxx:97
Trk::TrkMaterialProviderTool::m_maxNTracksIso
int m_maxNTracksIso
Definition: TrkMaterialProviderTool.h:226
Trk::Track::perigeeParameters
const Perigee * perigeeParameters() const
return Perigee.
Definition: Tracking/TrkEvent/TrkTrack/src/Track.cxx:163
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
Trk::TrackStateOnSurface
represents the track state (measurement, material, fit parameters and quality) at a surface.
Definition: TrackStateOnSurface.h:71
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
debug
const bool debug
Definition: MakeUncertaintyPlots.cxx:53
DataVector< const Trk::TrackStateOnSurface >::const_reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
Standard const_reverse_iterator.
Definition: DataVector.h:846
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
Trk::TrackStateOnSurface::InertMaterial
@ InertMaterial
This represents inert material, and so will contain MaterialEffectsBase.
Definition: TrackStateOnSurface.h:105
Rec::CaloMeas::Tile_EnergyMeasured
double Tile_EnergyMeasured(void) const
Definition: CaloMeas.h:60
Trk::Track::setTrackStateOnSurfaces
void setTrackStateOnSurfaces(std::unique_ptr< Trk::TrackStates > input)
Set the TrackStateOnSurfaces.
CaloEnergy::caloMuonIdTag
unsigned short caloMuonIdTag() const
the Calo Muon Identification tag
Definition: CaloEnergy.h:85
Trk::EnergyLoss
This class describes energy loss material effects in the ATLAS tracking EDM.
Definition: EnergyLoss.h:34
CaloEnergy::sigmaPlusDeltaEParam
double sigmaPlusDeltaEParam() const
get parametrised energy loss plus error
Definition: CaloEnergy.h:143
AtlasDetectorID::is_indet
bool is_indet(Identifier id) const
Definition: AtlasDetectorID.h:683
Trk::TrackingVolume::boundarySurfacesOrdered
std::vector< BoundaryIntersection< T > > boundarySurfacesOrdered(const T &parameters, PropDirection pDir=alongMomentum, bool startOffBoundary=false) const
Returns the boundary surfaces ordered in probability to hit them based on straight line intersection.
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
Trk::TrkMaterialProviderTool::m_indetVolume
const Trk::Volume * m_indetVolume
Definition: TrkMaterialProviderTool.h:215
CaloEnergy::sigmaMinusDeltaEParam
double sigmaMinusDeltaEParam() const
get parametrised energy loss minus error
Definition: CaloEnergy.h:140
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
TrkMaterialProviderTool
Definition: TrkMaterialProviderTool.h:47
Rec::CaloMeas::Tile_SamplingFraction
double Tile_SamplingFraction(void) const
Definition: CaloMeas.h:68
Trk::MaterialEffectsBase::EnergyLossEffects
@ EnergyLossEffects
contains energy loss corrections
Definition: MaterialEffectsBase.h:48
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
Trk::TrkMaterialProviderTool::printTSOS
void printTSOS(const Trk::TrackStateOnSurface *m, const std::string &tag) const
Definition: TrkMaterialProviderTool.cxx:1254
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
Trk::IdentifierExtractor::extract
static void extract(std::vector< Identifier > &ids, const std::vector< const MeasurementBase * > &measurements)
Definition: IdentifierExtractor.cxx:13
Trk::ParametersBase::momentum
const Amg::Vector3D & momentum() const
Access method for the momentum.
Trk::MaterialProperties
Definition: MaterialProperties.h:40
a
TList * a
Definition: liststreamerinfos.cxx:10
Trk::MaterialEffectsOnTrack::energyLoss
const EnergyLoss * energyLoss() const
returns the energy loss object.
h
AtlasDetectorID::is_muon
bool is_muon(Identifier id) const
Definition: AtlasDetectorID.h:701
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Trk::PlaneSurface
Definition: PlaneSurface.h:64
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Trk::TrkMaterialProviderTool::m_updateTSOS
bool m_updateTSOS
Definition: TrkMaterialProviderTool.h:224
CaloEnergy::NotIsolated
@ NotIsolated
Definition: CaloEnergy.h:43
Trk::MaterialEffectsOnTrack::scatteringAngles
const ScatteringAngles * scatteringAngles() const
returns the MCS-angles object.
Trk::TrkMaterialProviderTool::m_fieldCacheCondObjInputKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
Definition: TrkMaterialProviderTool.h:218
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
MagField::AtlasFieldCache
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h)
Definition: AtlasFieldCache.h:43
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:73
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
Trk::TrackingGeometry::trackingVolume
const TrackingVolume * trackingVolume(const std::string &name) const
return the tracking Volume by name, 0 if it doesn't exist
Trk::ScatteringAngles::sigmaDeltaPhi
double sigmaDeltaPhi() const
returns the
Definition: ScatteringAngles.h:94
Trk::TrackStateOnSurface::Scatterer
@ Scatterer
This represents a scattering point on the track, and so will contain TrackParameters and MaterialEffe...
Definition: TrackStateOnSurface.h:113
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
DataVector::ownPolicy
SG::OwnershipPolicy ownPolicy() const
Return the ownership policy setting for this container.
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
Trk::phi
@ phi
Definition: ParamDefs.h:81
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
Trk::TrkMaterialProviderTool::getCaloMeasuredEnergy
double getCaloMeasuredEnergy(double eta, double phi, double mopEloss, double meanElossIoni, double &fsrCaloEnergy) const
Function to get calorimeter measured energy loss.
Definition: TrkMaterialProviderTool.cxx:1952
Trk::TrkMaterialProviderTool::m_DetID
const AtlasDetectorID * m_DetID
Definition: TrkMaterialProviderTool.h:213
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
calibdata.copy
bool copy
Definition: calibdata.py:27
Trk::TrkMaterialProviderTool::getVolumeByGeo
unsigned int getVolumeByGeo(const Trk::TrackStateOnSurface *m) const
Definition: TrkMaterialProviderTool.cxx:1213
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
Trk::ScatteringAngles::deltaTheta
double deltaTheta() const
returns the
Definition: ScatteringAngles.h:88
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
Trk::TrkMaterialProviderTool::modifyTSOSvector
Trk::TrackStates * modifyTSOSvector(const std::vector< const Trk::TrackStateOnSurface * > *matvec, double scaleX0, double scaleEloss, bool reposition, bool aggregate, bool updateEloss, double caloEnergy, double caloEnergyError, double fsrCaloEnergy, double pCaloEntry, double momentumError, double &Eloss_tot, bool useMeasuredEnergy=true, double mopEloss=0., double meanElossIoni=0., double sigmaElossIoni=0.) const
Function to modify TSOS doing repositioning, aggregation and corrections.
Definition: TrkMaterialProviderTool.cxx:1301
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
DataVector::erase
iterator erase(iterator position)
Remove element at a given position.
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:75
mag2
Scalar mag2() const
mag2 method - forward to squaredNorm()
Definition: AmgMatrixBasePlugin.h:30
Trk::Volume
Definition: Volume.h:35
Trk::TrkMaterialProviderTool::m_trackIsolationTool
ToolHandle< Rec::IMuidTrackIsolation > m_trackIsolationTool
Definition: TrkMaterialProviderTool.h:209
Rec::CaloMeas::LArEM_SamplingFraction
double LArEM_SamplingFraction(void) const
Definition: CaloMeas.h:96
Trk::TrackingVolume
Definition: TrackingVolume.h:121
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
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::MaterialEffectsBase::associatedSurface
const Surface & associatedSurface() const
returns the surface to which these m.eff. are associated.
Trk::EnergyLoss::sigmaPlusDeltaE
double sigmaPlusDeltaE() const
returns the positive side
mag
Scalar mag() const
mag method
Definition: AmgMatrixBasePlugin.h:25
Trk::TrkMaterialProviderTool::getCaloEntryTSOS
const Trk::TrackStateOnSurface * getCaloEntryTSOS(const std::vector< const Trk::TrackStateOnSurface * > *caloTSOS, Trk::PropDirection dir) const
Helper to get first calo TSOS with TP.
Definition: TrkMaterialProviderTool.cxx:981
Trk::phi0
@ phi0
Definition: ParamDefs.h:71
CaloEnergy::caloLRLikelihood
double caloLRLikelihood() const
the calo Muon Identification likehood
Definition: CaloEnergy.h:88
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
fitman.k
k
Definition: fitman.py:528
Trk::EnergyLoss::sigmaIoni
double sigmaIoni() const
Rec::CaloMeas::LArHEC_SamplingFraction
double LArHEC_SamplingFraction(void) const
Definition: CaloMeas.h:80