16 #include "G4SDManager.hh" 17 #include "G4VProcess.hh" 18 #include "G4EventManager.hh" 20 #include "G4ParticleTable.hh" 35 currentPV(
nullptr), unitID(0), previousUnitID(0), preStepPoint(
nullptr),
36 postStepPoint(
nullptr), eventno(0){
43 SetVerboseLevel(verbn);
48 edm::LogInfo(
"BHMSim") <<
"name = " <<name <<
" and new BHMNumberingScheme";
60 return aStep->GetTotalEnergyDeposit();
65 LogDebug(
"BHMSim") <<
"BHMSD : Initialize called for " << GetName();
80 if (aStep ==
nullptr) {
85 LogDebug(
"BHMSim") <<
"BHMSD : number of hits = " <<
theHC->entries() << std::endl;
108 G4int particleCode =
theTrack->GetDefinition()->GetPDGEncoding();
109 LogDebug(
"BHMSim") <<
" BHMSD :particleType = " <<
theTrack->GetDefinition()->GetParticleName() <<std::endl;
110 if (particleCode ==
emPDG ||
111 particleCode ==
epPDG ||
117 edeposit = aStep->GetTotalEnergyDeposit();
127 Tof = aStep->GetPostStepPoint()->GetGlobalTime()/CLHEP::nanosecond;
130 ThetaAtEntry = aStep->GetPreStepPoint()->GetPosition().theta()/CLHEP::deg;
131 PhiAtEntry = aStep->GetPreStepPoint()->GetPosition().phi()/CLHEP::deg;
150 <<
" maybe detector name changed";
165 G4bool
found =
false;
167 for (
int j=0; j<
theHC->entries()&&!
found; j++) {
168 BscG4Hit* aPreviousHit = (*theHC)[j];
195 if (hit ==
nullptr ) {
200 theHC->insert( hit );
206 LogDebug(
"BHMSim") <<
"BHMSD CreateNewHit for" 209 <<
" Unit " <<
unitID <<std::endl;
212 <<
" For Track " <<
theTrack->GetTrackID()
213 <<
" which is a " <<
theTrack->GetDefinition()->GetParticleName();
221 LogDebug(
"BHMSim") <<
" and created by " ;
222 if (
theTrack->GetCreatorProcess()!=
nullptr)
267 LogDebug(
"BHMSim") <<
"updateHit: add eloss " <<
Eloss <<std::endl;
282 const G4VTouchable* touch=
preStepPoint->GetTouchable();
283 theEntryPoint = touch->GetHistory()->GetTopTransform().TransformPoint(global);
290 theExitPoint = touch->GetHistory()->GetTopTransform().TransformPoint(globalPoint);
297 for (
int j=0; j<
theHC->entries(); j++) {
299 LogDebug(
"BHMSim") <<
"hit number" << j <<
"unit ID = "<<aHit->
getUnitID()<<
"\n";
330 LogDebug(
"BHMSim") <<
"BHMSD: Collection " <<
theHC->GetName() <<
"\n";
331 theHC->PrintAllHits();
339 LogDebug(
"BHMSim") <<
" Dispatched BeginOfEvent for " << GetName()
342 eventno = (*i)()->GetEventID();
347 G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
349 emPDG = theParticleTable->FindParticle(particleName=
"e-")->GetPDGEncoding();
350 epPDG = theParticleTable->FindParticle(particleName=
"e+")->GetPDGEncoding();
351 gammaPDG = theParticleTable->FindParticle(particleName=
"gamma")->GetPDGEncoding();
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
G4ThreeVector hitPointExit
void setEntry(const G4ThreeVector &xyz)
void ResetForNewPrimary()
float getPhiAtEntry() const
BHMSD(const std::string &, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
int getParticleType() const
void Initialize(G4HCofThisEvent *HCE) override
G4ThreeVector theEntryPoint
void setEnergyLoss(float e)
BHMNumberingScheme * numberingScheme
G4StepPoint * preStepPoint
void setUnitID(unsigned int i)
G4ThreeVector hitPointLocal
type of data representation of DDCompactView
unsigned int getUnitID() const
static TrackerG4SimHitNumberingScheme & numberingScheme(const DDCompactView &cpv, const GeometricDet &det)
void EndOfEvent(G4HCofThisEvent *eventHC) override
int getTimeSliceID() const
void setThetaAtEntry(float t)
void setEntryLocalP(const G4ThreeVector &xyz1)
std::vector< PSimHit > & hits()
std::string const collectionName[nCollections]
G4ThreeVector SetToLocalExit(const G4ThreeVector &globalPoint)
virtual void Initialize()
void setPhiAtEntry(float f)
void update(const BeginOfRun *) override
This routine will be called when the appropriate signal arrives.
G4ThreeVector theExitPoint
virtual unsigned int getUnitID(const G4Step *aStep) const
float getThetaAtEntry() const
void addEnergyDeposit(double em, double hd)
void setTimeSlice(double d)
G4ThreeVector entrancePoint
void setParticleType(short i)
void clearHits() override
G4StepPoint * postStepPoint
BscG4HitCollection * theHC
void fillHits(edm::PSimHitContainer &, const std::string &) override
G4ThreeVector SetToLocal(const G4ThreeVector &global)
G4ThreeVector getEntry() const
void GetStepInfo(G4Step *aStep)
uint32_t setDetUnitId(const G4Step *) override
double getEnergyDeposit(const G4Step *step)
virtual bool processHits(const PSimHit &)
G4ThreeVector hitPointLocalExit
std::vector< PSimHit > PSimHitContainer
G4VPhysicalVolume * currentPV
void setExitLocalP(const G4ThreeVector &xyz1)
G4THitsCollection< BscG4Hit > BscG4HitCollection
void setIncidentEnergy(double e)
void StoreHit(BscG4Hit *)
bool ProcessHits(G4Step *, G4TouchableHistory *) override
float getEnergyLoss() const