|
|
Go to the documentation of this file.
21 #include "G4StepPoint.hh"
23 #include "G4VPhysicalVolume.hh"
24 #include "G4SDManager.hh"
25 #include "G4VProcess.hh"
27 #include "G4PhysicalConstants.hh"
28 #include "G4SystemOfUnits.hh"
36 static const double invns = 1.0 / CLHEP::nanosecond;
37 static const double invdeg = 1.0 / CLHEP::deg;
50 preStepPoint(nullptr),
51 postStepPoint(nullptr),
61 energyHistoryCut(1.
e+9) {
72 edm::LogVerbatim(
"TimingSim") <<
"TimingSD : Initialize called for " << GetName() <<
" time slice factor "
100 if (historyCut > 0.) {
110 edeposit = aStep->GetTotalEnergyDeposit();
125 const G4Track* newTrack = aStep->GetTrack();
129 if (newTrack->GetDefinition()->GetPDGCharge() == 0.0) {
146 LogDebug(
"TimingSim") <<
"TimingSD:"
148 <<
"\n Global step length: " << distGlobal <<
"\n Local entry point: " <<
hitPointLocal
149 <<
"\n Local exit point: " <<
hitPointLocalExit <<
"\n Local step length: " << distLocal;
150 if (std::fabs(distGlobal - distLocal) > 1.
e-6) {
151 LogDebug(
"TimingSim") <<
"DIFFERENCE IN DISTANCE \n";
163 info->storeTrack(
true);
169 info->putInHistory();
204 int thehc_entries =
theHC->entries();
205 for (
int j = 0;
j < thehc_entries; ++
j) {
223 if (tof < hit->getTof()) {
228 hit->setParticleType(
theTrack->GetDefinition()->GetPDGEncoding());
233 hit->setThetaAtEntry(ThetaAtEntry);
234 hit->setPhiAtEntry(PhiAtEntry);
243 hit->setVertexPosition(
theTrack->GetVertexPosition());
251 if (
hit ==
nullptr) {
261 const G4VPhysicalVolume* currentPV =
preStepPoint->GetPhysicalVolume();
262 edm::LogVerbatim(
"TimingSim") <<
"TimingSD CreateNewHit for " << GetName() <<
" PV " << currentPV->GetName()
263 <<
" PVid = " << currentPV->GetCopyNo() <<
" Unit " <<
unitID <<
"\n primary "
266 <<
theTrack->GetDefinition()->GetParticleName() <<
" parentID "
269 if (
theTrack->GetCreatorProcess() !=
nullptr) {
319 void TimingSD::setToLocal(
const G4StepPoint* stepPoint,
const G4ThreeVector& globalPoint, G4ThreeVector& localPoint) {
320 const G4VTouchable* touch = stepPoint->GetTouchable();
321 localPoint = touch->GetHistory()->GetTopTransform().TransformPoint(globalPoint);
336 edm::LogInfo(
"TimingSim") <<
"TimingSD: Hit for storage \n"
337 << *aHit <<
"\n Entry point: " << locEntryPoint <<
"\n Exit point: " << locExitPoint
356 LogDebug(
"TimingSim") <<
"TimingSD: Collection " <<
theHC->GetName() <<
"\n";
357 theHC->PrintAllHits();
367 LogDebug(
"TimingSim") <<
" Dispatched BeginOfEvent for " << GetName();
unsigned int processId(const G4VProcess *p) const
G4ThreeVector hitPointLocal
float getEnergyLoss() const
void setVertexPosition(const G4ThreeVector &)
static const float invgev
void setTimeFactor(double)
bool hitExists(const G4Step *)
void fillHits(edm::PSimHitContainer &, const std::string &) override
void setTimeSlice(double d)
const G4ThreeVector & getEntryLocalP() const
void storeHit(BscG4Hit *)
TimingSD(const std::string &, const edm::EventSetup &, const SensitiveDetectorCatalog &, const edm::ParameterSet &, const SimTrackManager *)
static const double invns
void addEnergyDeposit(float em, float hd)
int getParticleType() const
float getPhiAtEntry() const
void clearHits() override
virtual bool checkHit(const G4Step *, BscG4Hit *)
static bool isGammaElectronPositron(int pdgCode)
G4ThreeVector hitPointLocalExit
void createNewHit(const G4Step *)
virtual uint32_t setDetUnitId(const G4Step *step)=0
void Initialize(G4HCofThisEvent *HCE) override
void setExitLocalP(const G4ThreeVector &xyz)
int getTimeSliceID() const
G4ProcessTypeEnumerator * theEnumerator
void setPhiAtEntry(float f)
virtual void Initialize()
float getThetaAtEntry() const
G4THitsCollection< BscG4Hit > BscG4HitCollection
virtual bool processHits(const PSimHit &)
Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector &point) const
void EndOfEvent(G4HCofThisEvent *eventHC) override
const G4StepPoint * preStepPoint
void setToLocal(const G4StepPoint *stepPoint, const G4ThreeVector &globalPoint, G4ThreeVector &localPoint)
uint32_t getUnitID() const
void setIncidentEnergy(float e)
void setEntryLocalP(const G4ThreeVector &xyz)
TrackInformation * cmsTrackInformation(const G4Track *aTrack)
const G4StepPoint * postStepPoint
static const double invdeg
const G4ThreeVector & getExitLocalP() const
void setThetaAtEntry(float t)
void getStepInfo(const G4Step *)
BscG4HitCollection * theHC
void setCuts(double eCut, double historyCut)
void setEntry(const G4ThreeVector &xyz)
Power< A, B >::type pow(const A &a, const B &b)
void setParticleType(int i)
std::vector< PSimHit > & hits()
std::vector< PSimHit > PSimHitContainer
bool ProcessHits(G4Step *, G4TouchableHistory *) override
void setUnitID(uint32_t id)
G4ThreeVector hitPointExit
void update(const BeginOfEvent *) override
This routine will be called when the appropriate signal arrives.