28 #include "G4SDManager.hh" 29 #include "G4VProcess.hh" 30 #include "G4EventManager.hh" 32 #include "G4ParticleTable.hh" 34 #include "G4PhysicalConstants.hh" 35 #include "G4SystemOfUnits.hh" 50 currentPV(
nullptr), unitID(0), previousUnitID(0), preStepPoint(
nullptr),
51 postStepPoint(
nullptr), eventno(0){
58 SetVerboseLevel(verbn);
62 if (name ==
"BSCHits") {
64 edm::LogInfo(
"BscSim") <<
"name = BSCHits and new BscNumberingSchem";
68 edm::LogWarning(
"BscSim") <<
"BscSD: ReadoutName "<<name<<
" not supported";
82 return aStep->GetTotalEnergyDeposit();
87 LogDebug(
"BscSim") <<
"BscSD : Initialize called for " << GetName();
103 if (aStep ==
nullptr) {
111 LogDebug(
"BscSim") <<
"BscSD : number of hits = " <<
theHC->entries() << std::endl;
135 G4int particleCode =
theTrack->GetDefinition()->GetPDGEncoding();
136 LogDebug(
"BscSim") <<
" BscSD :particleType = " <<
theTrack->GetDefinition()->GetParticleName() <<std::endl;
137 if (particleCode ==
emPDG ||
138 particleCode ==
epPDG ||
144 edeposit = aStep->GetTotalEnergyDeposit();
153 Pabs = aStep->GetPreStepPoint()->GetMomentum().mag()/
GeV;
154 Tof = aStep->GetPostStepPoint()->GetGlobalTime()/nanosecond;
155 Eloss = aStep->GetTotalEnergyDeposit()/
GeV;
157 ThetaAtEntry = aStep->GetPreStepPoint()->GetPosition().theta()/deg;
158 PhiAtEntry = aStep->GetPreStepPoint()->GetPosition().phi()/deg;
177 <<
" maybe detector name changed";
194 G4bool
found =
false;
198 for (
int j=0; j<
theHC->entries()&&!
found; j++) {
199 BscG4Hit* aPreviousHit = (*theHC)[j];
229 if (hit ==
nullptr ) {
234 theHC->insert( hit );
240 LogDebug(
"BscSim") <<
"BscSD CreateNewHit for" 243 <<
" Unit " <<
unitID <<std::endl;
246 <<
" For Track " <<
theTrack->GetTrackID()
247 <<
" which is a " <<
theTrack->GetDefinition()->GetParticleName();
255 LogDebug(
"BscSim") <<
" and created by " ;
256 if (
theTrack->GetCreatorProcess()!=
nullptr)
301 LogDebug(
"BscSim") <<
"updateHit: add eloss " <<
Eloss <<std::endl;
317 const G4VTouchable* touch=
preStepPoint->GetTouchable();
318 theEntryPoint = touch->GetHistory()->GetTopTransform().TransformPoint(global);
325 theExitPoint = touch->GetHistory()->GetTopTransform().TransformPoint(globalPoint);
333 for (
int j=0; j<
theHC->entries(); j++) {
336 LogDebug(
"BscSim") <<
"hit number" << j <<
"unit ID = "<<aHit->
getUnitID()<<
"\n";
367 LogDebug(
"BscSim") <<
"BscSD: Collection " <<
theHC->GetName() <<
"\n";
368 theHC->PrintAllHits();
376 LogDebug(
"BscSim") <<
" Dispatched BeginOfEvent for " << GetName()
379 eventno = (*i)()->GetEventID();
384 G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
386 emPDG = theParticleTable->FindParticle(particleName=
"e-")->GetPDGEncoding();
387 epPDG = theParticleTable->FindParticle(particleName=
"e+")->GetPDGEncoding();
388 gammaPDG = theParticleTable->FindParticle(particleName=
"gamma")->GetPDGEncoding();
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void setEntry(const G4ThreeVector &xyz)
float getPhiAtEntry() const
G4ThreeVector SetToLocal(const G4ThreeVector &global)
int getParticleType() const
void setEnergyLoss(float e)
void GetStepInfo(G4Step *aStep)
void setUnitID(unsigned int i)
BscG4HitCollection * theHC
G4ThreeVector hitPointLocalExit
type of data representation of DDCompactView
unsigned int getUnitID() const
static TrackerG4SimHitNumberingScheme & numberingScheme(const DDCompactView &cpv, const GeometricDet &det)
virtual unsigned int getUnitID(const G4Step *aStep) const
int getTimeSliceID() const
G4VPhysicalVolume * currentPV
void setThetaAtEntry(float t)
void setEntryLocalP(const G4ThreeVector &xyz1)
std::vector< PSimHit > & hits()
void update(const BeginOfRun *) override
This routine will be called when the appropriate signal arrives.
double getEnergyDeposit(const G4Step *step)
std::string const collectionName[nCollections]
virtual void Initialize()
void setPhiAtEntry(float f)
G4StepPoint * preStepPoint
bool ProcessHits(G4Step *, G4TouchableHistory *) override
void fillHits(edm::PSimHitContainer &, const std::string &) override
float getThetaAtEntry() const
void addEnergyDeposit(double em, double hd)
void setTimeSlice(double d)
void setParticleType(short i)
void StoreHit(BscG4Hit *)
G4ThreeVector theEntryPoint
void clearHits() override
G4StepPoint * postStepPoint
G4ThreeVector hitPointExit
BscNumberingScheme * numberingScheme
G4ThreeVector theExitPoint
G4ThreeVector SetToLocalExit(const G4ThreeVector &globalPoint)
void EndOfEvent(G4HCofThisEvent *eventHC) override
G4ThreeVector getEntry() const
G4ThreeVector entrancePoint
void Initialize(G4HCofThisEvent *HCE) override
virtual bool processHits(const PSimHit &)
std::vector< PSimHit > PSimHitContainer
void setExitLocalP(const G4ThreeVector &xyz1)
BscSD(const std::string &, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
G4THitsCollection< BscG4Hit > BscG4HitCollection
void setIncidentEnergy(double e)
uint32_t setDetUnitId(const G4Step *) override
float getEnergyLoss() const
G4ThreeVector hitPointLocal
void ResetForNewPrimary()