ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
GenericMuonSensitiveDetector Class Reference

#include <GenericMuonSensitiveDetector.h>

Inheritance diagram for GenericMuonSensitiveDetector:
Collaboration diagram for GenericMuonSensitiveDetector:

Public Member Functions

 GenericMuonSensitiveDetector (const std::string &name, const std::string &hitCollectionName)
 construction/destruction More...
 
 ~GenericMuonSensitiveDetector ()
 
void Initialize (G4HCofThisEvent *HCE) override final
 member functions More...
 
G4bool ProcessHits (G4Step *aStep, G4TouchableHistory *ROhist) override final
 

Private Member Functions

 FRIEND_TEST (GenericMuonSensitiveDetectortest, Initialize)
 
 FRIEND_TEST (GenericMuonSensitiveDetectortest, ProcessHits)
 

Private Attributes

SG::WriteHandle< GenericMuonSimHitCollectionm_GenericMuonHitCollection
 

Detailed Description

Definition at line 13 of file GenericMuonSensitiveDetector.h.

Constructor & Destructor Documentation

◆ GenericMuonSensitiveDetector()

GenericMuonSensitiveDetector::GenericMuonSensitiveDetector ( const std::string &  name,
const std::string &  hitCollectionName 
)

construction/destruction

Definition at line 15 of file GenericMuonSensitiveDetector.cxx.

16  : G4VSensitiveDetector( name )
17  , m_GenericMuonHitCollection( hitCollectionName )
18 {
19  G4cout << " creating a GenericMuonSensitiveDetector: "<<name << G4endl;
20 }

◆ ~GenericMuonSensitiveDetector()

GenericMuonSensitiveDetector::~GenericMuonSensitiveDetector ( )
inline

Definition at line 19 of file GenericMuonSensitiveDetector.h.

19 {}

Member Function Documentation

◆ FRIEND_TEST() [1/2]

GenericMuonSensitiveDetector::FRIEND_TEST ( GenericMuonSensitiveDetectortest  ,
Initialize   
)
private

◆ FRIEND_TEST() [2/2]

GenericMuonSensitiveDetector::FRIEND_TEST ( GenericMuonSensitiveDetectortest  ,
ProcessHits   
)
private

◆ Initialize()

void GenericMuonSensitiveDetector::Initialize ( G4HCofThisEvent *  HCE)
finaloverride

member functions

Definition at line 23 of file GenericMuonSensitiveDetector.cxx.

24 {
25  if (!m_GenericMuonHitCollection.isValid()) m_GenericMuonHitCollection = std::make_unique<GenericMuonSimHitCollection>();
26 }

◆ ProcessHits()

G4bool GenericMuonSensitiveDetector::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *  ROhist 
)
finaloverride

Definition at line 28 of file GenericMuonSensitiveDetector.cxx.

29 {
30  G4cout << "Hit in a sensitive layer!!!!! " << G4endl;
31  G4Track* currentTrack = aStep->GetTrack();
32  const G4AffineTransform trans = currentTrack->GetTouchable()->GetHistory()->GetTopTransform(); // from global to local
33  G4StepPoint* postStep=aStep->GetPostStepPoint();
34  G4StepPoint* preStep=aStep->GetPreStepPoint();
35  const G4Step* post_Step=aStep->GetTrack()->GetStep();
36 
37  Amg::Vector3D position = Amg::Hep3VectorToEigen( postStep->GetPosition() );
38  Amg::Vector3D preposition = Amg::Hep3VectorToEigen( preStep->GetPosition() );
39 
40  Amg::Vector3D local_position = Amg::Hep3VectorToEigen( trans.TransformPoint( postStep->GetPosition() ) ) ;
41  Amg::Vector3D local_preposition = Amg::Hep3VectorToEigen( trans.TransformPoint( preStep->GetPosition() ) );
42 
43  int pdgCode=currentTrack->GetDefinition()->GetPDGEncoding();
44 
45  float globalTime=postStep->GetGlobalTime();
46  float globalpreTime=preStep->GetGlobalTime();
47  float eKin=postStep->GetKineticEnergy();
48 
49  Amg::Vector3D direction = Amg::Hep3VectorToEigen( postStep->GetMomentumDirection() );
50  float depositEnergy=post_Step->GetTotalEnergyDeposit();
51  float StepLength=post_Step->GetStepLength();
52 
53  TrackHelper trHelp(aStep->GetTrack());
54 
55  //G4cout << aHit->print() << G4endl;
56  m_GenericMuonHitCollection->Emplace( 0 /* HitID id generic*/,globalTime,globalpreTime,position,local_position,preposition,local_preposition,pdgCode,eKin,direction,depositEnergy,StepLength,trHelp.GenerateParticleLink());
57 
58  return true;
59 }

Member Data Documentation

◆ m_GenericMuonHitCollection

SG::WriteHandle<GenericMuonSimHitCollection> GenericMuonSensitiveDetector::m_GenericMuonHitCollection
private

Definition at line 27 of file GenericMuonSensitiveDetector.h.


The documentation for this class was generated from the following files:
Amg::Hep3VectorToEigen
Amg::Vector3D Hep3VectorToEigen(const CLHEP::Hep3Vector &CLHEPvector)
Converts a CLHEP-based CLHEP::Hep3Vector into an Eigen-based Amg::Vector3D.
Definition: CLHEPtoEigenConverter.h:137
TrackHelper
Definition: TrackHelper.h:14
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
GenericMuonSensitiveDetector::m_GenericMuonHitCollection
SG::WriteHandle< GenericMuonSimHitCollection > m_GenericMuonHitCollection
Definition: GenericMuonSensitiveDetector.h:27
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::StepLength
@ StepLength
Definition: MaterialAssociationType.h:17