5 #include "G4VPhysicalVolume.hh"
6 #include "G4PVPlacement.hh"
7 #include "G4HCofThisEvent.hh"
8 #include "G4TouchableHistory.hh"
11 #include "G4VSolid.hh"
12 #include "G4DynamicParticle.hh"
13 #include "G4ParticleDefinition.hh"
14 #include "G4SDManager.hh"
21 m_trackManager(manager), theHCID(-1), theHC(0) {
24 LogDebug(
"FiberSim") <<
"***************************************************"
28 <<
"* Constructing a FiberSD with name " << GetName()
32 <<
"***************************************************";
38 std::vector<std::string> lvNames = clg.
logicalNames(name);
40 for (std::vector<std::string>::iterator it=lvNames.begin();
41 it !=lvNames.end(); it++){
43 LogDebug(
"FiberSim") <<
"FiberSD : Assigns SD to LV " << (*it);
55 LogDebug(
"FiberSim") <<
"FiberSD : Initialize called for " << GetName();
67 if (hits.size() > 0) {
68 std::vector<HFShowerPhoton> thePE;
69 for (
unsigned int i=0;
i<hits.size();
i++) {
73 hits[
i].wavelength, hits[
i].time);
76 int trackID = aStep->GetTrack()->GetTrackID();
77 G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
78 const G4VTouchable* touch = preStepPoint->GetTouchable();
79 G4LogicalVolume* lv = touch->GetVolume(0)->GetLogicalVolume();
80 int depth = (touch->GetReplicaNumber(0))%10;
83 preStepPoint->GetPosition().y(),
84 preStepPoint->GetPosition().z());
87 aHit->setNpe(hits.size());
88 aHit->setPos(theHitPos);
89 aHit->setTime(preStepPoint->GetGlobalTime());
90 aHit->setPhoton(thePE);
92 LogDebug(
"FiberSim") <<
"FiberSD: Hit created at " << lv->GetName()
93 <<
" DetID: " << aHit->towerId() <<
" Depth: "
94 << aHit->depth() <<
" Track ID: " << aHit->trackId()
95 <<
" Nb. of Cerenkov Photons: " << aHit->npe()
96 <<
" Time: " << aHit->time() <<
" at "
98 for (
unsigned int i=0;
i<thePE.size();
i++)
99 LogDebug(
"FiberSim") <<
"FiberSD: PE[" <<
i <<
"] " << thePE[
i];
108 LogDebug(
"FiberSim") <<
"FiberSD: Sees" <<
theHC->entries() <<
" hits";
127 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
128 int fibre = (touch->GetReplicaNumber(1))%10;
129 int cell = (touch->GetReplicaNumber(2));
130 int tower = (touch->GetReplicaNumber(3));
131 return ((tower*1000+cell)*10+fibre);
std::vector< PCaloHit > PCaloHitContainer
std::vector< std::string > logicalNames(std::string &readoutName)
type of data representation of DDCompactView
static int position[TOTALCHAMBERS][3]
std::vector< Hit > getHits(G4Step *aStep)
virtual void update(const BeginOfRun *)
This routine will be called when the appropriate signal arrives.
virtual void fillHits(edm::PCaloHitContainer &, std::string)
std::string const collectionName[nCollections]
FiberSD(std::string, const DDCompactView &, SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
virtual uint32_t setDetUnitId(G4Step *)
XYZPointD XYZPoint
point in space with cartesian internal representation
FiberG4HitsCollection * theHC
G4THitsCollection< FiberG4Hit > FiberG4HitsCollection
virtual void AssignSD(std::string &vname)
virtual void Initialize(G4HCofThisEvent *HCE)
virtual void EndOfEvent(G4HCofThisEvent *HCE)
virtual G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist)