9 #include "G4VPhysicalVolume.hh" 10 #include "G4PVPlacement.hh" 11 #include "G4HCofThisEvent.hh" 12 #include "G4TouchableHistory.hh" 15 #include "G4VSolid.hh" 16 #include "G4DynamicParticle.hh" 17 #include "G4ParticleDefinition.hh" 18 #include "G4SDManager.hh" 25 m_trackManager(manager), theHCID(-1), theHC(0) {
28 LogDebug(
"FiberSim") <<
"***************************************************" 32 <<
"* Constructing a FiberSD with name " << GetName()
36 <<
"***************************************************";
42 const std::vector<std::string>& lvNames = clg.
logicalNames(name);
44 for (std::vector<std::string>::const_iterator it=lvNames.begin();
45 it !=lvNames.end(); it++){
47 LogDebug(
"FiberSim") <<
"FiberSD : Assigns SD to LV " << (*it);
59 LogDebug(
"FiberSim") <<
"FiberSD : Initialize called for " << GetName();
70 double zoffset = 1000;
74 if (hits.size() > 0) {
75 std::vector<HFShowerPhoton> thePE;
76 for (
unsigned int i=0;
i<hits.size();
i++) {
81 hits[
i].wavelength, hits[
i].time);
84 int trackID = aStep->GetTrack()->GetTrackID();
85 G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
86 const G4VTouchable* touch = preStepPoint->GetTouchable();
87 G4LogicalVolume* lv = touch->GetVolume(0)->GetLogicalVolume();
88 int depth = (touch->GetReplicaNumber(0))%10;
91 preStepPoint->GetPosition().y(),
92 preStepPoint->GetPosition().z());
96 std::cout<<
"hit size "<<hits.size()<<
" npe"<<aHit->npe()<<std::endl;
97 std::cout<<
"pre hit position "<<aHit->hitPos()<<std::endl;
98 aHit->setNpe(hits.size());
99 aHit->setPos(theHitPos);
100 aHit->setTime(preStepPoint->GetGlobalTime());
101 aHit->setPhoton(thePE);
102 std::cout<<
"ShowerPhoton position "<<thePE[0].x()<<
" "<<thePE[0].y()<<
" "<<thePE[0].z()<<std::endl;
104 LogDebug(
"FiberSim") <<
"FiberSD: Hit created at " << lv->GetName()
105 <<
" DetID: " << aHit->towerId() <<
" Depth: " 106 << aHit->depth() <<
" Track ID: " << aHit->trackId()
107 <<
" Nb. of Cerenkov Photons: " << aHit->npe()
108 <<
" Time: " << aHit->time() <<
" at " 110 for (
unsigned int i=0;
i<thePE.size();
i++)
111 LogDebug(
"FiberSim") <<
"FiberSD: PE[" <<
i <<
"] " << thePE[
i];
120 LogDebug(
"FiberSim") <<
"FiberSD: Sees" <<
theHC->entries() <<
" hits";
140 edm::LogError(
"HcalSim") <<
"HCalSD : Cannot find HcalDDDSimConstant";
141 throw cms::Exception(
"Unknown",
"HCalSD") <<
"Cannot find HcalDDDSimConstant" <<
"\n";
155 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
156 int fibre = (touch->GetReplicaNumber(1))%10;
157 int cell = (touch->GetReplicaNumber(2));
158 int tower = (touch->GetReplicaNumber(3));
159 return ((tower*1000+cell)*10+fibre);
std::vector< PCaloHit > PCaloHitContainer
void initRun(G4ParticleTable *, HcalDDDSimConstants *)
const std::vector< std::string > & logicalNames(const std::string &readoutName) const
virtual void update(const BeginOfJob *)
This routine will be called when the appropriate signal arrives.
type of data representation of DDCompactView
virtual void AssignSD(const std::string &vname)
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)