15 #include "G4SDManager.hh"
18 #include "G4VProcess.hh"
19 #include "G4ParticleDefinition.hh"
20 #include "G4ParticleTypes.hh"
22 #include "G4PhysicalConstants.hh"
23 #include "G4SystemOfUnits.hh"
33 numberingScheme_(nullptr),
40 preStepPoint_(nullptr),
41 postStepPoint_(nullptr),
47 LogDebug(
"PPSSimDiamond") <<
"*******************************************************\n"
49 <<
"* Constructing a PPSDiamondSD with name " << name_ <<
"\n"
51 <<
"*******************************************************"
56 if (name_ ==
"CTPPSTimingHits") {
58 edm::LogInfo(
"PPSSimDiamond") <<
"Find CTPPSDiamondHits as name";
60 edm::LogWarning(
"PPSSimDiamond") <<
"PPSDiamondSD: ReadoutName not supported\n";
63 edm::LogInfo(
"PPSSimDiamond") <<
"PPSDiamondSD: Instantiation completed";
69 LogDebug(
"PPSSimDiamond") <<
"PPSDiamondSD : Initialize called for " <<
name_;
79 LogDebug(
"PPSSimDiamond") <<
theTrack_->GetDefinition()->GetParticleName() <<
" PPS_Timing_SD CreateNewHit for"
85 printf(
" PreStepPoint(%10f,%10f,%10f)",
89 printf(
" PosStepPoint(%10f,%10f,%10f)\n",
93 LogDebug(
"PPSSimDiamond") <<
" positions "
96 <<
" For Track " <<
theTrack_->GetTrackID() <<
" which is a "
97 <<
theTrack_->GetDefinition()->GetParticleName() <<
" ParentID is "
101 LogDebug(
"PPSSimDiamond") <<
" primary particle ";
106 LogDebug(
"PPSSimDiamond") <<
" and created by ";
108 if (
theTrack_->GetCreatorProcess() !=
nullptr)
111 LogDebug(
"PPSSimDiamond") <<
"NO process";
117 if (aStep ==
nullptr) {
118 LogDebug(
"PPSSimDiamond") <<
" There is no hit to process ";
121 LogDebug(
"PPSSimDiamond") <<
"*******************************************************\n"
123 <<
"* PPS Diamond Hit initialized with name " <<
name_ <<
"\n"
125 <<
"*******************************************************"
130 if (
theTrack_->GetDefinition()->GetPDGEncoding() == 2212) {
132 LogDebug(
"PPSSimDiamond") <<
" information imported to the hit ";
158 Pabs_ = (aStep->GetPreStepPoint()->GetMomentum().mag()) / GeV;
159 thePx_ = (aStep->GetPreStepPoint()->GetMomentum().x()) / GeV;
160 thePy_ = (aStep->GetPreStepPoint()->GetMomentum().y()) / GeV;
161 thePz_ = (aStep->GetPreStepPoint()->GetMomentum().z()) / GeV;
162 Tof_ = aStep->GetPreStepPoint()->GetGlobalTime() / nanosecond;
163 Eloss_ = (aStep->GetPreStepPoint()->GetTotalEnergy() / eV);
167 G4ThreeVector gmd = aStep->GetPreStepPoint()->GetMomentumDirection();
169 G4ThreeVector lmd = ((G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable()))
192 if (hit ==
nullptr) {
194 LogDebug(
"PPSSimDiamond") <<
"PPSDiamond: hit to be stored is NULL !!"
232 G4ThreeVector localPoint;
234 localPoint = touch->GetHistory()->GetTopTransform().TransformPoint(global);
267 LogDebug(
"PPSSimDiamond") <<
"PPSDiamond: Collection " <<
theHC_->GetName() <<
"\n";
277 LogDebug(
"PPSDiamond") <<
"PPSDiamondSD: updates numbering scheme for " << GetName();
282 LogDebug(
"PPSSimDiamond") <<
" Dispatched BeginOfEvent !"
bool isPrimary(const G4Track *track)
G4VPhysicalVolume * currentPV_
G4ThreeVector setToLocal(const G4ThreeVector &globalPoint)
const edm::EventSetup & c
const G4ThreeVector & localEntry() const
PPSDiamondG4Hit * currentHit_
void stepInfo(const G4Step *aStep)
Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector &point) const
const G4ThreeVector & localExit() const
double energyLoss() const
unsigned int trackID() const
std::unique_ptr< TrackingSlaveSD > slave_
std::unique_ptr< PPSVDetectorOrganization > numberingScheme_
void setEntry(const G4ThreeVector &xyz)
Geom::Phi< T > phi() const
G4ThreeVector theLocalEntryPoint_
void fillHits(edm::PSimHitContainer &, const std::string &) override
PPSDiamondSD(const std::string &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
void setIncidentEnergy(double e)
void setThetaAtEntry(double t)
static constexpr unsigned int maxDiamondHits_
G4ThreeVector theLocalExitPoint_
void clearHits() override
bool ProcessHits(G4Step *step, G4TouchableHistory *tHistory) override
void EndOfEvent(G4HCofThisEvent *eventHC) override
uint32_t setDetUnitId(const G4Step *step) override
void Initialize(G4HCofThisEvent *HCE) override
Geom::Theta< T > theta() const
void setUnitID(unsigned int i)
void setEnergyLoss(double e)
void setExit(const G4ThreeVector &xyz)
std::string const collectionName[nCollections]
void update(const BeginOfEvent *) override
This routine will be called when the appropriate signal arrives.
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
void storeHit(PPSDiamondG4Hit *)
void setPhiAtEntry(double f)
PPSDiamondG4HitCollection * theHC_
void setParticleType(short i)
Log< level::Info, false > LogInfo
void setNumberingScheme(PPSVDetectorOrganization *scheme)
void setGlobalTimehit(double h)
void setLocalEntry(const G4ThreeVector &theLocalEntryPoint)
T getParameter(std::string const &) const
G4THitsCollection< PPSDiamondG4Hit > PPSDiamondG4HitCollection
G4StepPoint * postStepPoint_
G4StepPoint * preStepPoint_
double thetaAtEntry() const
std::vector< PSimHit > PSimHitContainer
Log< level::Warning, false > LogWarning
void setLocalExit(const G4ThreeVector &theLocalExitPoint)
double phiAtEntry() const
void clearTrack(G4Track *Track)
void setTimeSlice(double d)