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 const std::vector<std::string>& lvNames = clg.
logicalNames(name);
40 for (std::vector<std::string>::const_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();
66 double zoffset = 1000;
70 if (hits.size() > 0) {
71 std::vector<HFShowerPhoton> thePE;
72 for (
unsigned int i=0;
i<hits.size();
i++) {
77 hits[
i].wavelength, hits[
i].time);
80 int trackID = aStep->GetTrack()->GetTrackID();
81 G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
82 const G4VTouchable* touch = preStepPoint->GetTouchable();
83 G4LogicalVolume* lv = touch->GetVolume(0)->GetLogicalVolume();
84 int depth = (touch->GetReplicaNumber(0))%10;
87 preStepPoint->GetPosition().y(),
88 preStepPoint->GetPosition().z());
92 std::cout<<
"hit size "<<hits.size()<<
" npe"<<aHit->npe()<<std::endl;
93 std::cout<<
"pre hit position "<<aHit->hitPos()<<std::endl;
94 aHit->setNpe(hits.size());
95 aHit->setPos(theHitPos);
96 aHit->setTime(preStepPoint->GetGlobalTime());
97 aHit->setPhoton(thePE);
98 std::cout<<
"ShowerPhoton position "<<thePE[0].x()<<
" "<<thePE[0].y()<<
" "<<thePE[0].z()<<std::endl;
100 LogDebug(
"FiberSim") <<
"FiberSD: Hit created at " << lv->GetName()
101 <<
" DetID: " << aHit->towerId() <<
" Depth: "
102 << aHit->depth() <<
" Track ID: " << aHit->trackId()
103 <<
" Nb. of Cerenkov Photons: " << aHit->npe()
104 <<
" Time: " << aHit->time() <<
" at "
106 for (
unsigned int i=0;
i<thePE.size();
i++)
107 LogDebug(
"FiberSim") <<
"FiberSD: PE[" <<
i <<
"] " << thePE[
i];
116 LogDebug(
"FiberSim") <<
"FiberSD: Sees" <<
theHC->entries() <<
" hits";
136 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
137 int fibre = (touch->GetReplicaNumber(1))%10;
138 int cell = (touch->GetReplicaNumber(2));
139 int tower = (touch->GetReplicaNumber(3));
140 return ((tower*1000+cell)*10+fibre);
std::vector< PCaloHit > PCaloHitContainer
const std::vector< std::string > & logicalNames(const std::string &readoutName) const
type of data representation of DDCompactView
virtual void AssignSD(const std::string &vname)
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]
std::vector< Hit > getHits(G4Step *aStep, double weight)
virtual uint32_t setDetUnitId(G4Step *)
FiberSD(std::string, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
XYZPointD XYZPoint
point in space with cartesian internal representation
FiberG4HitsCollection * theHC
G4THitsCollection< FiberG4Hit > FiberG4HitsCollection
static int position[264][3]
virtual void Initialize(G4HCofThisEvent *HCE)
virtual void EndOfEvent(G4HCofThisEvent *HCE)
virtual G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist)