30 #include "G4SDManager.hh" 31 #include "G4VProcess.hh" 32 #include "G4EventManager.hh" 34 #include "G4ParticleTable.hh" 36 #include "G4SystemOfUnits.hh" 52 currentPV(
nullptr), unitID(0), previousUnitID(0), preStepPoint(
nullptr),
53 postStepPoint(
nullptr), eventno(0){
60 SetVerboseLevel(verbn);
64 if (name ==
"FP420SI") {
66 edm::LogInfo(
"FP420Sim") <<
"name = FP420SI and new FP420NumberingSchem";
80 return aStep->GetTotalEnergyDeposit();
85 LogDebug(
"FP420Sim") <<
"FP420SD : Initialize called for " <<
name << std::endl;
103 if (aStep ==
nullptr) {
111 LogDebug(
"FP420Sim") <<
"FP420SD : number of hits = " <<
theHC->entries() << std::endl;
135 G4int particleCode =
theTrack->GetDefinition()->GetPDGEncoding();
136 if (particleCode ==
emPDG ||
137 particleCode ==
epPDG ||
143 edeposit = aStep->GetTotalEnergyDeposit();
152 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;
178 <<
" maybe detector name changed";
195 G4bool
found =
false;
199 for (
int j=0; j<
theHC->entries()&&!
found; j++) {
232 if (hit ==
nullptr ) {
237 theHC->insert( hit );
245 LogDebug(
"FP420Sim") <<
"FP420SD CreateNewHit for" 248 <<
" Unit " <<
unitID <<std::endl;
251 <<
" For Track " <<
theTrack->GetTrackID()
252 <<
" which is a " <<
theTrack->GetDefinition()->GetParticleName();
260 LogDebug(
"FP420Sim") <<
" and created by " ;
264 LogDebug(
"FP420Sim") <<
"NO process";
313 LogDebug(
"FP420Sim") <<
"updateHit: add eloss " <<
Eloss <<std::endl;
315 <<
", PostStepPoint=" <<
postStepPoint->GetPosition() << std::endl;
333 const G4VTouchable* touch=
preStepPoint->GetTouchable();
334 theEntryPoint = touch->GetHistory()->GetTopTransform().TransformPoint(global);
342 theExitPoint = touch->GetHistory()->GetTopTransform().TransformPoint(globalPoint);
357 for (
int j=0; j<
theHC->entries(); j++) {
359 if((fabs(aHit->
getTof())> 780. && fabs(aHit->
getTof())< 840.)) ++nhitsHPS240;
360 if((fabs(aHit->
getTof())>1380. && fabs(aHit->
getTof())<1450.)) ++nhitsFP420;
362 if((fabs(aHit->
getTof())>780. && fabs(aHit->
getTof())<840. && nhitsHPS240<200.) || ( fabs(aHit->
getTof())>1380. && fabs(aHit->
getTof())<1450. && nhitsFP420<200.)) {
367 LogDebug(
"FP420Sim") <<
"hit number" << j <<
"unit ID = "<<aHit->
getUnitID()<<
"\n";
438 LogDebug(
"FP420Sim") <<
"FP420SD: Collection " <<
theHC->GetName() <<
"\n";
439 theHC->PrintAllHits();
456 LogDebug(
"ForwardSim") <<
" Dispatched BeginOfEvent for " << GetName()
459 eventno = (*i)()->GetEventID();
464 G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
466 emPDG = theParticleTable->FindParticle(particleName=
"e-")->GetPDGEncoding();
467 epPDG = theParticleTable->FindParticle(particleName=
"e+")->GetPDGEncoding();
468 gammaPDG = theParticleTable->FindParticle(particleName=
"gamma")->GetPDGEncoding();
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
G4ThreeVector theExitPoint
G4ThreeVector SetToLocalExit(const G4ThreeVector &globalPoint)
void setPhiAtEntry(float f)
void setEntry(const G4ThreeVector &xyz)
virtual double getEnergyDeposit(G4Step *step)
G4ThreeVector hitPointExit
G4ThreeVector getExitLocalP() const
G4StepPoint * preStepPoint
void ResetForNewPrimary()
Compact representation of the geometrical detector hierarchy.
unsigned int getTrackID() const
void addEnergyDeposit(double em, double hd)
static TrackerG4SimHitNumberingScheme & numberingScheme(const DDCompactView &cpv, const GeometricDet &det)
float getPhiAtEntry() const
unsigned int getUnitID() const
void setEnergyLoss(float e)
std::vector< PSimHit > & hits()
void clearHits() override
std::string const collectionName[nCollections]
G4ThreeVector theEntryPoint
virtual void Initialize()
void GetStepInfo(G4Step *aStep)
void fillHits(edm::PSimHitContainer &, const std::string &) override
FP420G4HitCollection * theHC
G4ThreeVector getEntryLocalP() const
void update(const BeginOfRun *) override
This routine will be called when the appropriate signal arrives.
void setTimeSlice(double d)
virtual unsigned int getUnitID(const G4Step *aStep) const
float getEnergyLoss() const
void setEntryLocalP(const G4ThreeVector &xyz1)
uint32_t setDetUnitId(const G4Step *) override
G4THitsCollection< FP420G4Hit > FP420G4HitCollection
void setIncidentEnergy(double e)
int getTimeSliceID() const
G4VPhysicalVolume * currentPV
void Initialize(G4HCofThisEvent *HCE) override
FP420SD(const std::string &, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
void setExitLocalP(const G4ThreeVector &xyz1)
int getParticleType() const
void setParticleType(short i)
void setThetaAtEntry(float t)
G4ThreeVector hitPointLocalExit
FP420NumberingScheme * numberingScheme
bool ProcessHits(G4Step *, G4TouchableHistory *) override
G4ThreeVector SetToLocal(const G4ThreeVector &global)
void setUnitID(unsigned int i)
G4ThreeVector entrancePoint
virtual bool processHits(const PSimHit &)
std::vector< PSimHit > PSimHitContainer
G4ThreeVector getEntry() const
G4StepPoint * postStepPoint
G4ThreeVector hitPointLocal
void addEnergyLoss(float e)
float getThetaAtEntry() const
void StoreHit(FP420G4Hit *)
void EndOfEvent(G4HCofThisEvent *eventHC) override