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(
nullptr) {
39 LogDebug(
"FiberSim") <<
"FiberSD : Initialize called for " << GetName();
50 double zoffset = 1000;
55 std::vector<HFShowerPhoton> thePE;
56 for (
unsigned int i=0;
i<hits.size();
i++) {
61 hits[
i].wavelength, hits[
i].time);
64 int trackID = aStep->GetTrack()->GetTrackID();
65 G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
66 const G4VTouchable* touch = preStepPoint->GetTouchable();
67 G4LogicalVolume* lv = touch->GetVolume(0)->GetLogicalVolume();
68 int depth = (touch->GetReplicaNumber(0))%10;
71 preStepPoint->GetPosition().y(),
72 preStepPoint->GetPosition().z());
76 std::cout<<
"hit size "<<hits.size()<<
" npe"<<aHit->npe()<<std::endl;
77 std::cout<<
"pre hit position "<<aHit->hitPos()<<std::endl;
78 aHit->setNpe(hits.size());
79 aHit->setPos(theHitPos);
80 aHit->setTime(preStepPoint->GetGlobalTime());
81 aHit->setPhoton(thePE);
82 std::cout<<
"ShowerPhoton position "<<thePE[0].x()<<
" "<<thePE[0].y()<<
" "<<thePE[0].z()<<std::endl;
84 LogDebug(
"FiberSim") <<
"FiberSD: Hit created at " << lv->GetName()
85 <<
" DetID: " << aHit->towerId() <<
" Depth: " 86 << aHit->depth() <<
" Track ID: " << aHit->trackId()
87 <<
" Nb. of Cerenkov Photons: " << aHit->npe()
88 <<
" Time: " << aHit->time() <<
" at " 90 for (
unsigned int i=0;
i<thePE.size();
i++)
91 LogDebug(
"FiberSim") <<
"FiberSD: PE[" <<
i <<
"] " << thePE[
i];
100 LogDebug(
"FiberSim") <<
"FiberSD: Sees" <<
theHC->entries() <<
" hits";
119 edm::LogError(
"HcalSim") <<
"HCalSD : Cannot find HcalDDDSimConstant";
120 throw cms::Exception(
"Unknown",
"HCalSD") <<
"Cannot find HcalDDDSimConstant" <<
"\n";
134 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
135 int fibre = (touch->GetReplicaNumber(1))%10;
136 int cell = (touch->GetReplicaNumber(2));
137 int tower = (touch->GetReplicaNumber(3));
138 return ((tower*1000+cell)*10+fibre);
uint32_t setDetUnitId(const G4Step *) override
void clearHits() override
std::vector< PCaloHit > PCaloHitContainer
Compact representation of the geometrical detector hierarchy.
std::vector< Hit > getHits(const G4Step *aStep, double weight)
void update(const BeginOfJob *) override
This routine will be called when the appropriate signal arrives.
std::string const collectionName[nCollections]
FiberSD(const std::string &, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
void Initialize(G4HCofThisEvent *HCE) override
void initRun(const HcalDDDSimConstants *)
G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist) override
XYZPointD XYZPoint
point in space with cartesian internal representation
FiberG4HitsCollection * theHC
G4THitsCollection< FiberG4Hit > FiberG4HitsCollection
void fillHits(edm::PCaloHitContainer &, const std::string &) override
static int position[264][3]
void EndOfEvent(G4HCofThisEvent *HCE) override