32 #include "G4SDManager.hh"
33 #include "G4VProcess.hh"
34 #include "G4EventManager.hh"
36 #include "G4ParticleTable.hh"
45 #include "G4VProcess.hh"
59 hcID(-1), theHC(0), theManager(manager), currentHit(0), theTrack(0),
60 currentPV(0), unitID(0), previousUnitID(0), preStepPoint(0),
61 postStepPoint(0), eventno(0){
83 SetVerboseLevel(verbn);
85 <<
"*******************************************************\n"
87 <<
"* Constructing a FP420SD with name " << name <<
"\n"
89 <<
"*******************************************************";
97 std::vector<std::string> lvNames = clg.
logicalNames(name);
101 for (std::vector<std::string>::iterator it=lvNames.begin();
102 it !=lvNames.end(); it++) {
104 edm::LogInfo(
"FP420Sim") <<
"FP420SD : Assigns SD to LV " << (*it);
107 if (name ==
"FP420SI") {
109 edm::LogInfo(
"FP420Sim") <<
"name = FP420SI and new FP420NumberingSchem";
110 std::cout <<
"name = FP420SI and new FP420NumberingSchem"<< std::endl;
115 std::cout <<
"FP420SD: ReadoutName not supported"<< std::endl;
118 edm::LogInfo(
"FP420Sim") <<
"FP420SD: Instantiation completed";
119 std::cout <<
"FP420SD: Instantiation completed"<< std::endl;
135 return aStep->GetTotalEnergyDeposit();
140 LogDebug(
"FP420Sim") <<
"FP420SD : Initialize called for " <<
name << std::endl;
166 LogDebug(
"FP420Sim") <<
"FP420SD : number of hits = " <<
theHC->entries() << std::endl;
190 G4int particleCode =
theTrack->GetDefinition()->GetPDGEncoding();
191 if (particleCode ==
emPDG ||
192 particleCode ==
epPDG ||
198 edeposit = aStep->GetTotalEnergyDeposit();
207 Pabs = aStep->GetPreStepPoint()->GetMomentum().mag()/GeV;
209 Tof = aStep->GetPostStepPoint()->GetGlobalTime()/nanosecond;
210 Eloss = aStep->GetTotalEnergyDeposit()/GeV;
212 ThetaAtEntry = aStep->GetPreStepPoint()->GetPosition().theta()/deg;
213 PhiAtEntry = aStep->GetPreStepPoint()->GetPosition().phi()/deg;
234 <<
" maybe detector name changed";
251 G4bool
found =
false;
293 theHC->insert( hit );
301 LogDebug(
"FP420Sim") <<
"FP420SD CreateNewHit for"
304 <<
" Unit " <<
unitID <<std::endl;
307 <<
" For Track " <<
theTrack->GetTrackID()
308 <<
" which is a " <<
theTrack->GetDefinition()->GetParticleName();
316 LogDebug(
"FP420Sim") <<
" and created by " ;
320 LogDebug(
"FP420Sim") <<
"NO process";
369 LogDebug(
"FP420Sim") <<
"updateHit: add eloss " <<
Eloss <<std::endl;
371 <<
", PostStepPoint=" <<
postStepPoint->GetPosition() << std::endl;
389 const G4VTouchable* touch=
preStepPoint->GetTouchable();
390 theEntryPoint = touch->GetHistory()->GetTopTransform().TransformPoint(global);
398 theExitPoint = touch->GetHistory()->GetTopTransform().TransformPoint(globalPoint);
413 for (
int j=0;
j<
theHC->entries();
j++) {
415 if((fabs(aHit->
getTof())> 780. && fabs(aHit->
getTof())< 840.)) ++nhitsHPS240;
416 if((fabs(aHit->
getTof())>1380. && fabs(aHit->
getTof())<1450.)) ++nhitsFP420;
418 if((fabs(aHit->
getTof())>780. && fabs(aHit->
getTof())<840. && nhitsHPS240<200.) || ( fabs(aHit->
getTof())>1380. && fabs(aHit->
getTof())<1450. && nhitsFP420<200.)) {
494 LogDebug(
"FP420Sim") <<
"FP420SD: Collection " <<
theHC->GetName() <<
"\n";
495 theHC->PrintAllHits();
510 std::cout <<
"FP420SD: fillHits to PSimHitContainer for name= " <<
name << std::endl;
515 LogDebug(
"ForwardSim") <<
" Dispatched BeginOfEvent for " << GetName()
518 eventno = (*i)()->GetEventID();
523 G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
524 G4String particleName;
525 emPDG = theParticleTable->FindParticle(particleName=
"e-")->GetPDGEncoding();
526 epPDG = theParticleTable->FindParticle(particleName=
"e+")->GetPDGEncoding();
527 gammaPDG = theParticleTable->FindParticle(particleName=
"gamma")->GetPDGEncoding();
540 std::vector<std::string>
temp;
FP420SD(std::string, const DDCompactView &, SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
G4ThreeVector theExitPoint
std::vector< std::string > getNames()
std::vector< std::string > logicalNames(std::string &readoutName)
void setEntry(G4ThreeVector xyz)
void setPhiAtEntry(float f)
virtual void Initialize(G4HCofThisEvent *HCE)
virtual double getEnergyDeposit(G4Step *step)
G4ThreeVector hitPointExit
G4ThreeVector SetToLocal(G4ThreeVector global)
G4ThreeVector getExitLocalP() const
virtual bool ProcessHits(G4Step *, G4TouchableHistory *)
G4StepPoint * preStepPoint
void ResetForNewPrimary()
type of data representation of DDCompactView
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()
G4ThreeVector SetToLocalExit(G4ThreeVector globalPoint)
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
G4THitsCollection< FP420G4Hit > FP420G4HitCollection
void setIncidentEnergy(double e)
int getTimeSliceID() const
G4VPhysicalVolume * currentPV
int getParticleType() const
void setExitLocalP(G4ThreeVector xyz1)
void setParticleType(short i)
void setThetaAtEntry(float t)
G4ThreeVector hitPointLocalExit
virtual void AssignSD(std::string &vname)
FP420NumberingScheme * numberingScheme
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 *)
void setEntryLocalP(G4ThreeVector xyz1)