21 #include "G4SDManager.hh"
24 #include "G4VProcess.hh"
26 #include "G4PhysicalConstants.hh"
27 #include "G4SystemOfUnits.hh"
38 numberingScheme_(nullptr),
45 preStepPoint_(nullptr),
46 postStepPoint_(nullptr),
55 if (name_ ==
"TotemHitsRP") {
61 edm::LogInfo(
"TotemRP") <<
"TotemRPSD: Instantiation completed";
67 LogDebug(
"TotemRP") <<
"TotemRPSD : Initialize called for " <<
name_;
78 LogDebug(
"TotemRP") <<
theTrack_->GetDefinition()->GetParticleName() <<
" TotemRPSD CreateNewHit for"
82 <<
theTrack_->GetTotalEnergy() <<
" Eloss_ " <<
Eloss_ <<
" positions ";
94 <<
" For Track " <<
theTrack_->GetTrackID() <<
" which is a "
95 <<
theTrack_->GetDefinition()->GetParticleName();
98 LogDebug(
"TotemRP") <<
" primary particle ";
103 LogDebug(
"TotemRP") <<
" and created by ";
105 if (
theTrack_->GetCreatorProcess() !=
nullptr)
108 LogDebug(
"TotemRP") <<
"NO process";
114 if (aStep ==
nullptr) {
135 name_.assign(name_, 0, 4);
146 Pabs_ = (aStep->GetPreStepPoint()->GetMomentum().mag()) /
GeV;
147 thePx_ = (aStep->GetPreStepPoint()->GetMomentum().x()) /
GeV;
148 thePy_ = (aStep->GetPreStepPoint()->GetMomentum().y()) /
GeV;
149 thePz_ = (aStep->GetPreStepPoint()->GetMomentum().z()) /
GeV;
151 Tof_ = aStep->GetPostStepPoint()->GetGlobalTime() / nanosecond;
152 Eloss_ = aStep->GetTotalEnergyDeposit() /
GeV;
156 G4ThreeVector gmd = aStep->GetPreStepPoint()->GetMomentumDirection();
158 G4ThreeVector lmd = ((G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable()))
181 if (hit ==
nullptr) {
183 LogDebug(
"TotemRP") <<
"TotemRPSD: hit to be stored is NULL !!" << std::endl;
230 G4ThreeVector localPoint;
232 localPoint = touch->GetHistory()->GetTopTransform().TransformPoint(global);
264 LogDebug(
"TotemRP") <<
"TotemRPSD: Collection " <<
theHC_->GetName() << std::endl;
275 LogDebug(
"TotemRP") <<
"TotemRPSD: updates numbering scheme for " << GetName();
void setEntry(G4ThreeVector xyz)
G4ThreeVector localEntry() const
void fillHits(edm::PSimHitContainer &, const std::string &) override
unsigned int trackID() const
const edm::EventSetup & c
G4THitsCollection< TotemRPG4Hit > TotemRPG4HitCollection
Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector &point) const
G4ThreeVector setToLocal(const G4ThreeVector &globalPoint)
void setIncidentEnergy(double e)
G4VPhysicalVolume * currentPV_
std::unique_ptr< TotemRPVDetectorOrganization > numberingScheme_
void storeHit(TotemRPG4Hit *)
Geom::Phi< T > phi() const
bool ProcessHits(G4Step *step, G4TouchableHistory *tHistory) override
TotemRPG4HitCollection * theHC_
Geom::Theta< T > theta() const
static constexpr double rp_garage_position_
void setLocalEntry(const G4ThreeVector &theLocalEntryPoint)
void stepInfo(const G4Step *aStep)
void clearHits() override
void Initialize(G4HCofThisEvent *HCE) override
void EndOfEvent(G4HCofThisEvent *eventHC) override
double phiAtEntry() const
std::string const collectionName[nCollections]
void setExit(G4ThreeVector xyz)
G4ThreeVector theLocalEntryPoint_
uint32_t setDetUnitId(const G4Step *step) override
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
G4StepPoint * postStepPoint_
void setLocalExit(const G4ThreeVector &theLocalExitPoint)
void setThetaAtEntry(double t)
void setNumberingScheme(TotemRPVDetectorOrganization *scheme)
G4StepPoint * preStepPoint_
void setUnitID(unsigned int i)
double energyLoss() const
Log< level::Info, false > LogInfo
G4ThreeVector theLocalExitPoint_
double thetaAtEntry() const
void setPhiAtEntry(double f)
T getParameter(std::string const &) const
static constexpr unsigned int maxTotemHits_
G4ThreeVector localExit() const
TotemRPSD(const std::string &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
void update(const BeginOfEvent *) override
This routine will be called when the appropriate signal arrives.
void setParticleType(short i)
std::vector< PSimHit > PSimHitContainer
bool isPrimary(const G4Track *track)
Log< level::Warning, false > LogWarning
void setEnergyLoss(double e)
std::unique_ptr< TrackingSlaveSD > slave_
TotemRPG4Hit * currentHit_
void setTimeSlice(double d)