16 #include "G4SDManager.hh"
17 #include "G4VProcess.hh"
18 #include "G4EventManager.hh"
20 #include "G4ParticleTable.hh"
34 hcID(-1), theHC(0), theManager(manager), currentHit(0), theTrack(0),
35 currentPV(0), unitID(0), previousUnitID(0), preStepPoint(0),
36 postStepPoint(0), eventno(0){
47 SetVerboseLevel(verbn);
49 <<
"*******************************************************\n"
51 <<
"* Constructing a BHMSD with name " << name <<
"\n"
53 <<
"*******************************************************";
61 std::vector<std::string> lvNames = clg.
logicalNames(name);
65 for (std::vector<std::string>::iterator it=lvNames.begin();
66 it !=lvNames.end(); it++) {
68 edm::LogInfo(
"BHMSim") <<
"BHMSD : Assigns SD to LV " << (*it);
72 edm::LogInfo(
"BHMSim") <<
"name = " <<name <<
" and new BHMNumberingScheme";
76 edm::LogInfo(
"BHMSim") <<
"BHMSD: Instantiation completed";
87 return aStep->GetTotalEnergyDeposit();
92 LogDebug(
"BHMSim") <<
"BHMSD : Initialize called for " <<
name << std::endl;
112 LogDebug(
"BHMSim") <<
"BHMSD : number of hits = " <<
theHC->entries() << std::endl;
135 G4int particleCode =
theTrack->GetDefinition()->GetPDGEncoding();
136 LogDebug(
"BHMSim") <<
" BHMSD :particleType = " <<
theTrack->GetDefinition()->GetParticleName() <<std::endl;
137 if (particleCode ==
emPDG ||
138 particleCode ==
epPDG ||
144 edeposit = aStep->GetTotalEnergyDeposit();
154 Tof = aStep->GetPostStepPoint()->GetGlobalTime()/CLHEP::nanosecond;
157 ThetaAtEntry = aStep->GetPreStepPoint()->GetPosition().theta()/CLHEP::deg;
158 PhiAtEntry = aStep->GetPreStepPoint()->GetPosition().phi()/CLHEP::deg;
178 <<
" maybe detector name changed";
193 G4bool
found =
false;
230 theHC->insert( hit );
237 LogDebug(
"BHMSim") <<
"BHMSD CreateNewHit for"
240 <<
" Unit " <<
unitID <<std::endl;
243 <<
" For Track " <<
theTrack->GetTrackID()
244 <<
" which is a " <<
theTrack->GetDefinition()->GetParticleName();
252 LogDebug(
"BHMSim") <<
" and created by " ;
299 LogDebug(
"BHMSim") <<
"updateHit: add eloss " <<
Eloss <<std::endl;
315 const G4VTouchable* touch=
preStepPoint->GetTouchable();
316 theEntryPoint = touch->GetHistory()->GetTopTransform().TransformPoint(global);
324 theExitPoint = touch->GetHistory()->GetTopTransform().TransformPoint(globalPoint);
332 for (
int j=0;
j<
theHC->entries();
j++) {
369 LogDebug(
"BHMSim") <<
"BHMSD: Collection " <<
theHC->GetName() <<
"\n";
370 theHC->PrintAllHits();
379 LogDebug(
"BHMSim") <<
" Dispatched BeginOfEvent for " << GetName()
382 eventno = (*i)()->GetEventID();
387 G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
388 G4String particleName;
389 emPDG = theParticleTable->FindParticle(particleName=
"e-")->GetPDGEncoding();
390 epPDG = theParticleTable->FindParticle(particleName=
"e+")->GetPDGEncoding();
391 gammaPDG = theParticleTable->FindParticle(particleName=
"gamma")->GetPDGEncoding();
403 std::vector<std::string>
temp;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
G4ThreeVector hitPointExit
void setEntry(const G4ThreeVector &xyz)
void ResetForNewPrimary()
float getPhiAtEntry() const
virtual void Initialize(G4HCofThisEvent *HCE)
int getParticleType() const
virtual bool ProcessHits(G4Step *, G4TouchableHistory *)
G4ThreeVector theEntryPoint
void setEnergyLoss(float e)
BHMNumberingScheme * numberingScheme
G4StepPoint * preStepPoint
void setUnitID(unsigned int i)
BHMSD(std::string, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
std::vector< std::string > getNames()
const std::vector< std::string > & logicalNames(const std::string &readoutName) const
G4ThreeVector hitPointLocal
type of data representation of DDCompactView
unsigned int getUnitID() const
virtual void AssignSD(const std::string &vname)
virtual double getEnergyDeposit(G4Step *step)
static TrackerG4SimHitNumberingScheme & numberingScheme(const DDCompactView &cpv, const GeometricDet &det)
int getTimeSliceID() const
void setThetaAtEntry(float t)
void setEntryLocalP(const G4ThreeVector &xyz1)
std::vector< PSimHit > & hits()
std::string const collectionName[nCollections]
G4ThreeVector SetToLocalExit(const G4ThreeVector &globalPoint)
virtual void Initialize()
void setPhiAtEntry(float f)
virtual void EndOfEvent(G4HCofThisEvent *eventHC)
G4ThreeVector theExitPoint
virtual unsigned int getUnitID(const G4Step *aStep) const
float getThetaAtEntry() const
void addEnergyDeposit(double em, double hd)
void setTimeSlice(double d)
G4ThreeVector entrancePoint
void setParticleType(short i)
void update(const BeginOfRun *)
This routine will be called when the appropriate signal arrives.
G4StepPoint * postStepPoint
void fillHits(edm::PSimHitContainer &, std::string use)
BscG4HitCollection * theHC
G4ThreeVector SetToLocal(const G4ThreeVector &global)
G4ThreeVector getEntry() const
void GetStepInfo(G4Step *aStep)
virtual bool processHits(const PSimHit &)
G4ThreeVector hitPointLocalExit
std::vector< PSimHit > PSimHitContainer
G4VPhysicalVolume * currentPV
void setExitLocalP(const G4ThreeVector &xyz1)
G4THitsCollection< BscG4Hit > BscG4HitCollection
void setIncidentEnergy(double e)
virtual uint32_t setDetUnitId(G4Step *)
void StoreHit(BscG4Hit *)
float getEnergyLoss() const