Belle II Software  release-08-01-10
TrackExtrapolateG4e Class Reference

geant4e-based track extrapolation. More...

#include <TrackExtrapolateG4e.h>

Collaboration diagram for TrackExtrapolateG4e:

Public Member Functions

 ~TrackExtrapolateG4e ()
 destructor
 
void initialize (double minPt, double minKE, std::vector< Const::ChargedStable > &hypotheses)
 Initialize for track extrapolation by the EXT module. More...
 
void initialize (double meanDt, double maxDt, double maxSeparation, double maxKLMTrackClusterDistance, double maxECLTrackClusterDistance, double minPt, double minKE, bool addHitsToRecoTrack, std::vector< Const::ChargedStable > &hypotheses)
 Initialize for track extrapolation by the MUID module. More...
 
void beginRun (bool flag)
 Perform beginning-of-run actions. More...
 
void event (bool flag)
 Performs track extrapolation for all tracks in one event. More...
 
void endRun (bool flag)
 Perform end-of-run actions. More...
 
void terminate (bool flag)
 Terminates this singleton. More...
 
void extrapolate (int pdgCode, double tof, const G4ThreeVector &position, const G4ThreeVector &momentum, const G4ErrorSymMatrix &covariance)
 Performs track extrapolation for a single track (specified in genfit2 units). More...
 

Static Public Member Functions

static TrackExtrapolateG4egetInstance ()
 Get the singleton's address.
 

Private Member Functions

 TrackExtrapolateG4e ()
 constructor is hidden; user calls TrackExtrapolateG4e::getInstance() instead
 
 TrackExtrapolateG4e (TrackExtrapolateG4e &)
 copy constructor is hidden; user calls TrackExtrapolateG4e::getInstance() instead
 
void swim (ExtState &, G4ErrorFreeTrajState &, const std::vector< std::pair< ECLCluster *, G4ThreeVector > > *, const std::vector< std::pair< KLMCluster *, G4ThreeVector > > *, std::vector< std::map< const Track *, double > > *)
 Swim a single track (MUID) until it stops or leaves the target cylinder.
 
void swim (ExtState &, G4ErrorFreeTrajState &)
 Swim a single track (EXT) until it stops or leaves the target cylinder.
 
void registerVolumes ()
 Register the list of geant4 physical volumes whose entry/exit points will be saved during extrapolation.
 
void getVolumeID (const G4TouchableHandle &, Const::EDetector &, int &)
 Get the physical volume information for a geant4 physical volume.
 
void fromG4eToPhasespace (const G4ErrorFreeTrajState &, G4ErrorSymMatrix &)
 Convert the geant4e 5x5 covariance to phasespace 6x6 covariance.
 
void fromPhasespaceToG4e (const G4ThreeVector &, const G4ErrorSymMatrix &, G4ErrorTrajErr &)
 Convert the phasespace covariance to geant4e covariance.
 
void fromPhasespaceToG4e (const TVector3 &, const TMatrixDSym &, G4ErrorTrajErr &)
 Convert the phasespace covariance to geant4e covariance.
 
ExtState getStartPoint (const Track &, int, G4ErrorFreeTrajState &)
 Get the start point for a new reconstructed track with specific PDG hypothesis.
 
void createExtHit (ExtHitStatus, const ExtState &, const G4ErrorFreeTrajState &, const G4StepPoint *, const G4TouchableHandle &)
 Create another EXT extrapolation hit for a track candidate.
 
void createECLHit (const ExtState &, const G4ErrorFreeTrajState &, const G4StepPoint *, const G4StepPoint *, const G4TouchableHandle &, const std::pair< ECLCluster *, G4ThreeVector > &, double, double)
 Create another EXT ECL-crystal-crossing hit for a track candidate.
 
bool createMuidHit (ExtState &, G4ErrorFreeTrajState &, KLMMuidLikelihood *, std::vector< std::map< const Track *, double > > *)
 Create another MUID extrapolation hit for a track candidate.
 
bool findBarrelIntersection (ExtState &, const G4ThreeVector &, Intersection &)
 Find the intersection point of the track with the crossed BKLM plane.
 
bool findEndcapIntersection (ExtState &, const G4ThreeVector &, Intersection &)
 Find the intersection point of the track with the crossed EKLM plane.
 
bool findMatchingBarrelHit (Intersection &, const Track *)
 Find the matching BKLM 2D hit nearest the intersection point of the track with the crossed BKLM plane.
 
bool findMatchingEndcapHit (Intersection &, const Track *)
 Find the matching EKLM 2D hit nearest the intersection point of the track with the crossed EKLM plane.
 
void adjustIntersection (Intersection &, const double *, const G4ThreeVector &, const G4ThreeVector &)
 Nudge the track using the matching hit.
 
void finishTrack (const ExtState &, KLMMuidLikelihood *, bool)
 Complete muon identification after end of track extrapolation.
 

Private Attributes

bool m_ExtInitialized
 Flag to indicate that EXT initialize() has been called.
 
bool m_MuidInitialized
 Flag to indicate that MUID initialize() has been called.
 
double m_MeanDt
 Mean hit - trigger time (ns)
 
double m_MaxDt
 Coincidence window half-width for in-time KLM hits (ns)
 
double m_MagneticField
 Magnetic field z component (gauss) at origin.
 
double m_MaxDistSqInVariances
 user-defined maximum squared-distance (in number of variances) for matching hit to extrapolation
 
double m_MaxKLMTrackClusterDistance
 user-defined maximum distance (mm) between KLMCluster and associated track (for KLID)
 
double m_MaxECLTrackClusterDistance
 user-defined maximum distance (mm) between ECLCluster and associated track (for EID)
 
double m_MinPt
 Minimum transverse momentum in MeV/c for extrapolation to be started.
 
double m_MinKE
 Minimum kinetic energy in MeV for extrapolation to continue.
 
Simulation::ExtManagerm_ExtMgr
 Pointer to the ExtManager singleton.
 
const std::vector< Const::ChargedStable > * m_HypothesesExt
 ChargedStable hypotheses for EXT.
 
const std::vector< Const::ChargedStable > * m_HypothesesMuid
 ChargedStable hypotheses for MUID.
 
std::vector< Const::ChargedStable > * m_DefaultHypotheses
 Default ChargedStable hypotheses (needed as call argument but not used)
 
std::map< G4VPhysicalVolume *, enum VolTypes > * m_EnterExit
 Pointers to geant4 physical volumes whose entry/exit points will be saved.
 
std::vector< G4VPhysicalVolume * > * m_BKLMVolumes
 Pointers to BKLM geant4 sensitive (physical) volumes.
 
Simulation::ExtCylSurfaceTargetm_TargetExt
 virtual "target" cylinder for EXT (boundary beyond which extrapolation ends)
 
Simulation::ExtCylSurfaceTargetm_TargetMuid
 virtual "target" cylinder for MUID (boundary beyond which extrapolation ends)
 
DBObjPtr< COILGeometryParm_COILGeometryPar
 Conditions-database object for COIL geometry.
 
DBObjPtr< BeamPipeGeom_BeamPipeGeo
 Conditions-database object for beam pipe geometry.
 
double m_MinRadiusSq
 Minimum squared radius (cm) outside of which extrapolation will continue.
 
double m_OffsetZ
 offset (cm) along z axis of KLM midpoint from IP
 
int m_BarrelNSector
 Number of barrel sectors.
 
double m_BarrelMaxR
 maximum radius (cm) of the barrel
 
double m_BarrelMinR
 minimum radius (cm) of the barrel
 
double m_BarrelHalfLength
 half-length (cm) of the barrel
 
int m_OutermostActiveBarrelLayer
 outermost barrel layer that is active for muon identification (user-defined)
 
double m_BarrelPhiStripVariance [BKLMElementNumbers::getMaximalLayerNumber()+1]
 BKLM RPC phi-measuring strip position variance (cm^2) by layer.
 
double m_BarrelZStripVariance [BKLMElementNumbers::getMaximalLayerNumber()+1]
 BKLM RPC z-measuring strip position variance (cm^2) by layer.
 
double m_BarrelScintVariance
 BKLM scintillator strip position variance (cm^2)
 
double m_BarrelModuleMiddleRadius [2][BKLMElementNumbers::getMaximalSectorNumber()+1][BKLMElementNumbers::getMaximalLayerNumber()+1]
 hit-plane radius (cm) at closest distance to IP of each barrel end | sector | layer
 
G4ThreeVector m_BarrelSectorPerp [BKLMElementNumbers::getMaximalSectorNumber()+1]
 normal unit vector of each barrel sector
 
G4ThreeVector m_BarrelSectorPhi [BKLMElementNumbers::getMaximalSectorNumber()+1]
 azimuthal unit vector of each barrel sector
 
double m_EndcapMaxR
 maximum radius (cm) of the endcaps
 
double m_EndcapMinR
 minimum radius (cm) of the endcaps
 
double m_EndcapMiddleZ
 midpoint along z (cm) of the forward endcap from the KLM midpoint
 
double m_EndcapHalfLength
 half-length (cm) of either endcap
 
int m_OutermostActiveForwardEndcapLayer
 outermost forward-endcap layer that is active for muon identification (user-defined)
 
int m_OutermostActiveBackwardEndcapLayer
 outermost backward-endcap layer that is active for muon identification (user-defined)
 
double m_EndcapScintVariance
 EKLM scintillator strip position variance (cm^2)
 
double m_EndcapModuleMiddleZ [BKLMElementNumbers::getMaximalLayerNumber()+1]
 hit-plane z (cm) of each IP layer relative to KLM midpoint
 
bool m_addHitsToRecoTrack = false
 Parameter to add the found hits also to the reco tracks or not. Is turned off by default.
 
std::map< int, MuidBuilder * > m_MuidBuilderMap
 PDF for the charged final state particle hypotheses.
 
const EKLMElementNumbersm_eklmElementNumbers
 EKLM element numbers.
 
const KLMElementNumbersm_klmElementNumbers
 KLM element numbers.
 
const EKLM::TransformDataGlobalAlignedm_eklmTransformData
 EKLM transformation data.
 
DBObjPtr< KLMChannelStatusm_klmChannelStatus
 Conditions-database object for KLM channel status.
 
DBObjPtr< KLMStripEfficiencym_klmStripEfficiency
 Conditions-database object for KLM strip efficiency.
 
DBObjPtr< KLMLikelihoodParametersm_klmLikelihoodParameters
 Conditions-database object for KLM likelihood parameters.
 
StoreArray< ECLClusterm_eclClusters
 ECL clusters.
 
StoreArray< ExtHitm_extHits
 Ext hits.
 
StoreArray< KLMHit2dm_klmHit2ds
 KLM 2d hits.
 
StoreArray< KLMClusterm_klmClusters
 KLM clusters.
 
StoreArray< KLMMuidHitm_klmMuidHits
 KLM muid hits.
 
StoreArray< KLMMuidLikelihoodm_klmMuidLikelihoods
 KLM muid likelihoods.
 
StoreArray< RecoTrackm_recoTracks
 Reco tracks.
 
StoreArray< Trackm_tracks
 Tracks.
 
StoreArray< TrackClusterSeparationm_trackClusterSeparations
 Track cluster sepration.
 

Static Private Attributes

static TrackExtrapolateG4em_Singleton = nullptr
 Stores pointer to the singleton class.
 

Detailed Description

geant4e-based track extrapolation.

This class extrapolates tracks outward from the outer perimeter of the CDC using geant4e.

This class requires a valid geometry in memory (gGeoManager). Therefore, a geometry building module should have been executed before this module is called.

This class has the same functions as a module - and these are called from the ExtModule's so-named functions - but also has an entry that can be called to extrapolate a single user-defined track.

Definition at line 168 of file TrackExtrapolateG4e.h.

Member Function Documentation

◆ beginRun()

void beginRun ( bool  flag)

Perform beginning-of-run actions.

Parameters
flagTrue if called by Muid module, false if called by Ext module.

Definition at line 333 of file TrackExtrapolateG4e.cc.

334 {
335  B2DEBUG(20, (byMuid ? "muid" : "ext"));
336  if (byMuid) {
337  if (!m_klmChannelStatus.isValid())
338  B2FATAL("KLM channel status data are not available.");
339  if (!m_klmStripEfficiency.isValid())
340  B2FATAL("KLM strip efficiency data are not available.");
341  if (!m_klmLikelihoodParameters.isValid())
342  B2FATAL("KLM likelihood parameters are not available.");
343  std::vector<int> muidPdgCodes = MuidElementNumbers::getPDGVector();
344  if (!m_MuidBuilderMap.empty()) {
345  if (m_klmLikelihoodParameters.hasChanged()) { /* Clear m_MuidBuilderMap if KLMLikelihoodParameters payload changed. */
346  for (auto const& muidBuilder : m_MuidBuilderMap)
347  delete muidBuilder.second;
348  m_MuidBuilderMap.clear();
349  } else /* Return if m_MuidBuilderMap is already initialized. */
350  return;
351  }
352  for (int pdg : muidPdgCodes)
353  m_MuidBuilderMap.insert(std::pair<int, MuidBuilder*>(pdg, new MuidBuilder(pdg)));
354  }
355 }
Build the Muid likelihoods starting from the hit pattern and the transverse scattering in the KLM.
Definition: MuidBuilder.h:29
static std::vector< int > getPDGVector()
Get a vector with all the hypothesis PDG codes used for Muid.
DBObjPtr< KLMLikelihoodParameters > m_klmLikelihoodParameters
Conditions-database object for KLM likelihood parameters.
std::map< int, MuidBuilder * > m_MuidBuilderMap
PDF for the charged final state particle hypotheses.
DBObjPtr< KLMChannelStatus > m_klmChannelStatus
Conditions-database object for KLM channel status.
DBObjPtr< KLMStripEfficiency > m_klmStripEfficiency
Conditions-database object for KLM strip efficiency.

◆ endRun()

void endRun ( bool  flag)

Perform end-of-run actions.

Parameters
flagTrue if called by Muid module, false if called by Ext module.

Definition at line 413 of file TrackExtrapolateG4e.cc.

◆ event()

void event ( bool  flag)

Performs track extrapolation for all tracks in one event.

Parameters
flagTrue if called by Muid module, false if called by Ext module.

Definition at line 357 of file TrackExtrapolateG4e.cc.

◆ extrapolate()

void extrapolate ( int  pdgCode,
double  tof,
const G4ThreeVector &  position,
const G4ThreeVector &  momentum,
const G4ErrorSymMatrix &  covariance 
)

Performs track extrapolation for a single track (specified in genfit2 units).

Parameters
pdgCodeSigned PDG identifier of the particle hypothesis to be used for the extrapolation.
tofStarting time, i.e., time of flight from the IP, at the starting point (ns).
positionStarting point of the extrapolation (cm).
momentumMomentum of the track at the starting point (GeV/c).
covariancePhase-space covariance matrix (6x6) at the starting point (cm, GeV/c).

Definition at line 439 of file TrackExtrapolateG4e.cc.

◆ initialize() [1/2]

void initialize ( double  meanDt,
double  maxDt,
double  maxSeparation,
double  maxKLMTrackClusterDistance,
double  maxECLTrackClusterDistance,
double  minPt,
double  minKE,
bool  addHitsToRecoTrack,
std::vector< Const::ChargedStable > &  hypotheses 
)

Initialize for track extrapolation by the MUID module.

Parameters
meanDtMean value of the in-time window (ns).
maxDtHalf-width of the in-time window (ns).
maxSeparationMaximum separation between track crossing and matching hit in detector plane (number of sigmas).
maxKLMTrackClusterDistanceMaximum distance between associated track and KLMCluster (cm), criterion for matching relation Track->KLMCluster on MDST.
maxECLTrackClusterDistanceMaximum distance between associated track and ECLCluster (cm).
minPtMinimum transverse momentum to begin extrapolation (GeV/c).
minKEMinimum kinetic energy to continue extrapolation (GeV/c).
addHitsToRecoTrackParameter to add the found hits also to the reco tracks or not. Is turned off by default.
hypothesesVector of charged-particle hypotheses used in extrapolation of each track.

Definition at line 191 of file TrackExtrapolateG4e.cc.

◆ initialize() [2/2]

void initialize ( double  minPt,
double  minKE,
std::vector< Const::ChargedStable > &  hypotheses 
)

Initialize for track extrapolation by the EXT module.

Parameters
minPtMinimum transverse momentum to begin extrapolation (GeV/c).
minKEMinimum kinetic energy to continue extrapolation (GeV/c).
hypothesesVector of charged-particle hypotheses used in extrapolation of each track.

Definition at line 138 of file TrackExtrapolateG4e.cc.

◆ terminate()

void terminate ( bool  flag)

Terminates this singleton.

Parameters
flagTrue if called by Muid module, false if called by Ext module.

Definition at line 417 of file TrackExtrapolateG4e.cc.


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