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

#include <HGTDSensorGmxSD.h>

Inheritance diagram for HGTDSensorGmxSD:
Collaboration diagram for HGTDSensorGmxSD:

Public Member Functions

 HGTDSensorGmxSD (const std::string &name, const std::string &hitCollectionName, GeoModelIO::ReadGeoModel *sqlreader=nullptr)
 
virtual ~HGTDSensorGmxSD ()
 
G4bool ProcessHits (G4Step *, G4TouchableHistory *) override final
 
void Initialize (G4HCofThisEvent *) override final
 

Private Attributes

SG::WriteHandle< SiHitCollectionm_HitColl
 
GeoModelIO::ReadGeoModel * m_sqlreader
 

Detailed Description

Definition at line 33 of file HGTDSensorGmxSD.h.

Constructor & Destructor Documentation

◆ HGTDSensorGmxSD()

HGTDSensorGmxSD::HGTDSensorGmxSD ( const std::string &  name,
const std::string &  hitCollectionName,
GeoModelIO::ReadGeoModel *  sqlreader = nullptr 
)

Definition at line 35 of file HGTDSensorGmxSD.cxx.

36  : G4VSensitiveDetector( name ),
37  m_HitColl( hitCollectionName ),
38  m_sqlreader( sqlreader )
39 {
40 
41 }

◆ ~HGTDSensorGmxSD()

virtual HGTDSensorGmxSD::~HGTDSensorGmxSD ( )
inlinevirtual

Definition at line 42 of file HGTDSensorGmxSD.h.

42 {}

Member Function Documentation

◆ Initialize()

void HGTDSensorGmxSD::Initialize ( G4HCofThisEvent *  )
finaloverride

Definition at line 44 of file HGTDSensorGmxSD.cxx.

45 {
46  if (!m_HitColl.isValid()) m_HitColl = std::make_unique<SiHitCollection>();
47 }

◆ ProcessHits()

G4bool HGTDSensorGmxSD::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *   
)
finaloverride

Definition at line 49 of file HGTDSensorGmxSD.cxx.

50 {
51  if (verboseLevel>5) G4cout << "Process Hit" << G4endl;
52 
53  G4double edep = aStep->GetTotalEnergyDeposit();
54  edep *= CLHEP::MeV;
55 
56  if (edep==0.) {
57  if (aStep->GetTrack()->GetDefinition() != G4Geantino::GeantinoDefinition() &&
58  aStep->GetTrack()->GetDefinition() != G4ChargedGeantino::ChargedGeantinoDefinition())
59  return false;
60  }
61 
62  //
63  // Get the Touchable History:
64  //
65  const G4TouchableHistory* myTouch = dynamic_cast<const G4TouchableHistory*>(aStep->GetPreStepPoint()->GetTouchable());
66 
67  if(verboseLevel>5){
68  for (int i=0;i<myTouch->GetHistoryDepth();i++){
69  std::string detname = myTouch->GetVolume(i)->GetLogicalVolume()->GetName();
70  int copyno = myTouch->GetVolume(i)->GetCopyNo();
71  G4cout << "Volume " << detname << " Copy Nr. " << copyno << G4endl;
72  }
73  }
74 
75  //
76  // Get the hit coordinates. Start and End Point
77  //
78  G4ThreeVector startCoord = aStep->GetPreStepPoint()->GetPosition();
79  G4ThreeVector endCoord = aStep->GetPostStepPoint()->GetPosition();
80 
81  // Create the SiHits
82 
83  const G4AffineTransform transformation = myTouch->GetHistory()->GetTopTransform();
84 
85  G4ThreeVector localPosition1 = transformation.TransformPoint(startCoord);
86  G4ThreeVector localPosition2 = transformation.TransformPoint(endCoord);
87 
88  HepGeom::Point3D<double> lP1,lP2;
89  //TODO need to check
90  lP1[SiHit::xEta] = localPosition1[1]*CLHEP::mm; //long edge of the module
91  lP1[SiHit::xPhi] = localPosition1[0]*CLHEP::mm; //short edge of the module
92  lP1[SiHit::xDep] = localPosition1[2]*CLHEP::mm; //depth (z)
93 
94  lP2[SiHit::xEta] = localPosition2[1]*CLHEP::mm;
95  lP2[SiHit::xPhi] = localPosition2[0]*CLHEP::mm;
96  lP2[SiHit::xDep] = localPosition2[2]*CLHEP::mm;
97 
98  // get the HepMcParticleLink from the TrackHelper
99  TrackHelper trHelp(aStep->GetTrack());
100 
101  if(m_sqlreader){
102  // if sqlite inputs, Identifier indices come from PhysVol Name
103  std::string physVolName = myTouch->GetVolume()->GetName();
104 
105  int hitIdOfWafer = SiHitIdHelper::GetHelper()->buildHitIdFromStringHGTD(2,physVolName);
106 
107  m_HitColl->Emplace(lP1,
108  lP2,
109  edep,
110  aStep->GetPreStepPoint()->GetGlobalTime(),
111  trHelp.GenerateParticleLink(),
112  hitIdOfWafer);
113 
114  return true;
115  }
116 
117  // if not from SQLite, we assume that the Identifier has already been written in as the copy number
118  // (it should hsave done if GeoModel building ran within Athena)
119  //
120  // Get the indexes of which detector the hit is in
121  //
122  const int id = myTouch->GetVolume()->GetCopyNo();
123 
124  m_HitColl->Emplace(lP1,
125  lP2,
126  edep,
127  aStep->GetPreStepPoint()->GetGlobalTime(),
128  trHelp.GenerateParticleLink(),
129  id);
130 
131  return true;
132 }

Member Data Documentation

◆ m_HitColl

SG::WriteHandle<SiHitCollection> HGTDSensorGmxSD::m_HitColl
private

Definition at line 52 of file HGTDSensorGmxSD.h.

◆ m_sqlreader

GeoModelIO::ReadGeoModel* HGTDSensorGmxSD::m_sqlreader
private

Definition at line 53 of file HGTDSensorGmxSD.h.


The documentation for this class was generated from the following files:
SiHit::xPhi
@ xPhi
Definition: SiHit.h:162
HGTDSensorGmxSD::m_sqlreader
GeoModelIO::ReadGeoModel * m_sqlreader
Definition: HGTDSensorGmxSD.h:53
SiHitIdHelper::buildHitIdFromStringHGTD
int buildHitIdFromStringHGTD(int part, const std::string &) const
Definition: SiHitIdHelper.cxx:149
python.SystemOfUnits.MeV
int MeV
Definition: SystemOfUnits.py:154
TrackHelper
Definition: TrackHelper.h:14
lumiFormat.i
int i
Definition: lumiFormat.py:92
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
SiHit::xDep
@ xDep
Definition: SiHit.h:162
SiHit::xEta
@ xEta
Definition: SiHit.h:162
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
SiHitIdHelper::GetHelper
static const SiHitIdHelper * GetHelper()
Definition: SiHitIdHelper.cxx:19
HGTDSensorGmxSD::m_HitColl
SG::WriteHandle< SiHitCollection > m_HitColl
Definition: HGTDSensorGmxSD.h:52