32 #include "G4SDManager.hh" 33 #include "G4VProcess.hh" 34 #include "G4EventManager.hh" 36 #include "G4ParticleTable.hh" 38 #include "G4SystemOfUnits.hh" 47 #include "G4VProcess.hh" 61 hcID(-1), theHC(0), theManager(manager), currentHit(0), theTrack(0),
62 currentPV(0), unitID(0), previousUnitID(0), preStepPoint(0),
63 postStepPoint(0), eventno(0){
85 SetVerboseLevel(verbn);
87 <<
"*******************************************************\n" 89 <<
"* Constructing a FP420SD with name " << name <<
"\n" 91 <<
"*******************************************************";
99 const std::vector<std::string>& lvNames = clg.
logicalNames(name);
103 for (std::vector<std::string>::const_iterator it=lvNames.begin();
104 it !=lvNames.end(); it++) {
106 edm::LogInfo(
"FP420Sim") <<
"FP420SD : Assigns SD to LV " << (*it);
109 if (name ==
"FP420SI") {
111 edm::LogInfo(
"FP420Sim") <<
"name = FP420SI and new FP420NumberingSchem";
112 std::cout <<
"name = FP420SI and new FP420NumberingSchem"<< std::endl;
117 std::cout <<
"FP420SD: ReadoutName not supported"<< std::endl;
120 edm::LogInfo(
"FP420Sim") <<
"FP420SD: Instantiation completed";
121 std::cout <<
"FP420SD: Instantiation completed"<< std::endl;
137 return aStep->GetTotalEnergyDeposit();
142 LogDebug(
"FP420Sim") <<
"FP420SD : Initialize called for " <<
name << std::endl;
168 LogDebug(
"FP420Sim") <<
"FP420SD : number of hits = " <<
theHC->entries() << std::endl;
192 G4int particleCode =
theTrack->GetDefinition()->GetPDGEncoding();
193 if (particleCode ==
emPDG ||
194 particleCode ==
epPDG ||
200 edeposit = aStep->GetTotalEnergyDeposit();
209 Pabs = aStep->GetPreStepPoint()->GetMomentum().mag()/
GeV;
211 Tof = aStep->GetPostStepPoint()->GetGlobalTime()/nanosecond;
212 Eloss = aStep->GetTotalEnergyDeposit()/
GeV;
214 ThetaAtEntry = aStep->GetPreStepPoint()->GetPosition().theta()/deg;
215 PhiAtEntry = aStep->GetPreStepPoint()->GetPosition().phi()/deg;
236 <<
" maybe detector name changed";
253 G4bool
found =
false;
257 for (
int j=0; j<
theHC->entries()&&!
found; j++) {
295 theHC->insert( hit );
303 LogDebug(
"FP420Sim") <<
"FP420SD CreateNewHit for" 306 <<
" Unit " <<
unitID <<std::endl;
309 <<
" For Track " <<
theTrack->GetTrackID()
310 <<
" which is a " <<
theTrack->GetDefinition()->GetParticleName();
318 LogDebug(
"FP420Sim") <<
" and created by " ;
322 LogDebug(
"FP420Sim") <<
"NO process";
371 LogDebug(
"FP420Sim") <<
"updateHit: add eloss " <<
Eloss <<std::endl;
373 <<
", PostStepPoint=" <<
postStepPoint->GetPosition() << std::endl;
391 const G4VTouchable* touch=
preStepPoint->GetTouchable();
392 theEntryPoint = touch->GetHistory()->GetTopTransform().TransformPoint(global);
400 theExitPoint = touch->GetHistory()->GetTopTransform().TransformPoint(globalPoint);
415 for (
int j=0; j<
theHC->entries(); j++) {
417 if((fabs(aHit->
getTof())> 780. && fabs(aHit->
getTof())< 840.)) ++nhitsHPS240;
418 if((fabs(aHit->
getTof())>1380. && fabs(aHit->
getTof())<1450.)) ++nhitsFP420;
420 if((fabs(aHit->
getTof())>780. && fabs(aHit->
getTof())<840. && nhitsHPS240<200.) || ( fabs(aHit->
getTof())>1380. && fabs(aHit->
getTof())<1450. && nhitsFP420<200.)) {
425 LogDebug(
"FP420Sim") <<
"hit number" << j <<
"unit ID = "<<aHit->
getUnitID()<<
"\n";
496 LogDebug(
"FP420Sim") <<
"FP420SD: Collection " <<
theHC->GetName() <<
"\n";
497 theHC->PrintAllHits();
512 std::cout <<
"FP420SD: fillHits to PSimHitContainer for name= " <<
name << std::endl;
517 LogDebug(
"ForwardSim") <<
" Dispatched BeginOfEvent for " << GetName()
520 eventno = (*i)()->GetEventID();
525 G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
527 emPDG = theParticleTable->FindParticle(particleName=
"e-")->GetPDGEncoding();
528 epPDG = theParticleTable->FindParticle(particleName=
"e+")->GetPDGEncoding();
529 gammaPDG = theParticleTable->FindParticle(particleName=
"gamma")->GetPDGEncoding();
542 std::vector<std::string>
temp;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
G4ThreeVector theExitPoint
std::vector< std::string > getNames()
G4ThreeVector SetToLocalExit(const G4ThreeVector &globalPoint)
void setPhiAtEntry(float f)
virtual void Initialize(G4HCofThisEvent *HCE)
void setEntry(const G4ThreeVector &xyz)
virtual double getEnergyDeposit(G4Step *step)
G4ThreeVector hitPointExit
G4ThreeVector getExitLocalP() const
virtual bool ProcessHits(G4Step *, G4TouchableHistory *)
G4StepPoint * preStepPoint
void ResetForNewPrimary()
const std::vector< std::string > & logicalNames(const std::string &readoutName) const
type of data representation of DDCompactView
virtual void AssignSD(const std::string &vname)
unsigned int getTrackID() const
void addEnergyDeposit(double em, double hd)
static TrackerG4SimHitNumberingScheme & numberingScheme(const DDCompactView &cpv, const GeometricDet &det)
virtual uint32_t setDetUnitId(G4Step *)
float getPhiAtEntry() const
virtual void EndOfEvent(G4HCofThisEvent *eventHC)
void update(const BeginOfRun *)
This routine will be called when the appropriate signal arrives.
unsigned int getUnitID() const
void setEnergyLoss(float e)
std::vector< PSimHit > & hits()
std::string const collectionName[nCollections]
G4ThreeVector theEntryPoint
virtual void Initialize()
FP420SD(std::string, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
void GetStepInfo(G4Step *aStep)
FP420G4HitCollection * theHC
G4ThreeVector getEntryLocalP() const
void fillHits(edm::PSimHitContainer &, std::string use)
void setTimeSlice(double d)
virtual unsigned int getUnitID(const G4Step *aStep) const
float getEnergyLoss() const
void setEntryLocalP(const G4ThreeVector &xyz1)
G4THitsCollection< FP420G4Hit > FP420G4HitCollection
void setIncidentEnergy(double e)
int getTimeSliceID() const
G4VPhysicalVolume * currentPV
void setExitLocalP(const G4ThreeVector &xyz1)
int getParticleType() const
void setParticleType(short i)
void setThetaAtEntry(float t)
G4ThreeVector hitPointLocalExit
FP420NumberingScheme * numberingScheme
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 *)