22 #include "G4LogicalVolumeStore.hh" 23 #include "G4LogicalVolume.hh" 26 #include "G4ParticleTable.hh" 27 #include "G4VProcess.hh" 39 CaloSD(name, cpv, clg, p, manager,
41 p.getParameter<
edm::
ParameterSet>(
"HGCSD").getParameter<bool>(
"IgnoreTrackID")),
58 if (myName.find(
"HitsEE")!=std::string::npos) {
60 nameX =
"HGCalEESensitive";
61 }
else if (myName.find(
"HitsHEfront")!=std::string::npos) {
63 nameX =
"HGCalHESiliconSensitive";
64 }
else if (myName.find(
"HitsHEback")!=std::string::npos) {
66 nameX =
"HGCalHEScintillatorSensitive";
70 edm::LogInfo(
"HGCSim")<<
"**************************************************" 74 <<
"* Constructing a HGCSD with name " << name <<
"\n" 77 <<
"**************************************************";
79 edm::LogInfo(
"HGCSim") <<
"HGCSD:: Threshold for storing hits: " << eminHit
81 edm::LogInfo(
"HGCSim") <<
"Flag for storing individual Geant4 Hits " 83 edm::LogInfo(
"HGCSim") <<
"Reject MosueBite Flag: " << rejectMB_
84 <<
" Size of wafer " << waferSize <<
" Mouse Bite " 85 << mouseBite <<
":" << mouseBiteCut_ <<
" along " 86 << angles_.size() <<
" axes";
101 double r = aStep->GetPreStepPoint()->GetPosition().perp();
102 double z =
std::abs(aStep->GetPreStepPoint()->GetPosition().z());
104 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
105 bool notaMuon = (parCode ==
mupPDG || parCode ==
mumPDG ) ?
false :
true;
106 G4LogicalVolume* lv =
107 aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
108 edm::LogInfo(
"HGCSim") <<
"HGCSD: Hit from standard path from " 109 << lv->GetName() <<
" for Track " 110 << aStep->GetTrack()->GetTrackID() <<
" (" 111 << aStep->GetTrack()->GetDefinition()->GetParticleName()
112 <<
":" << notaMuon <<
") R = " << r <<
" Z = " << z
113 <<
" slope = " << r/z <<
":" <<
slopeMin_;
116 if (r/z >= slopeMin_) {
128 double wt2 = aStep->GetTrack()->GetWeight();
129 double destep = wt1*(aStep->GetTotalEnergyDeposit());
130 if (wt2 > 0) destep *= wt2;
137 const G4VTouchable* touch = preStepPoint->GetTouchable();
140 G4ThreeVector hitPoint = preStepPoint->GetPosition();
141 float globalZ=touch->GetTranslation(0).z();
142 int iz( globalZ>0 ? 1 : -1);
145 G4ThreeVector localpos = touch->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
150 int layer(0),
module(0), cell(0);
152 layer = touch->GetReplicaNumber(0);
153 module = touch->GetReplicaNumber(1);
155 if (touch->GetHistoryDepth() ==
levelT_) {
156 layer = touch->GetReplicaNumber(0);
160 edm::LogInfo(
"HGCSim") <<
"Depths: " << touch->GetHistoryDepth()
161 <<
" name " << touch->GetVolume(0)->GetName()
162 <<
" layer:module:cell " << layer <<
":" 163 <<
module <<
":" << cell << std::endl;
166 layer = touch->GetReplicaNumber(2);
167 module = touch->GetReplicaNumber(1);
168 cell = touch->GetReplicaNumber(0);
171 edm::LogInfo(
"HGCSim") <<
"Depths: " << touch->GetHistoryDepth() <<
" name " 172 << touch->GetVolume(0)->GetName()
173 <<
":" << touch->GetReplicaNumber(0) <<
" " 174 << touch->GetVolume(1)->GetName()
175 <<
":" << touch->GetReplicaNumber(1) <<
" " 176 << touch->GetVolume(2)->GetName()
177 <<
":" << touch->GetReplicaNumber(2) <<
" " 178 <<
" layer:module:cell " << layer <<
":" <<
module 179 <<
":" << cell <<
" Material " << mat->GetName()<<
":" 180 << aStep->GetPreStepPoint()->GetMaterial()->GetRadlen()
183 if (aStep->GetPreStepPoint()->GetMaterial()->GetRadlen() > 100000.)
return 0;
188 int det,
z, lay, wafer,
type, ic;
192 << det <<
":" << z <<
":" << lay <<
":" << wafer
193 <<
":" << type <<
":" << ic << std::endl;
213 edm::LogError(
"HGCSim") <<
"HCalSD : Cannot find HGCalDDDConstants for " 215 throw cms::Exception(
"Unknown",
"HGCSD") <<
"Cannot find HGCalDDDConstants for " <<
nameX <<
"\n";
219 <<
" Slope cut " <<
slopeMin_ <<
" top Level " 225 G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
227 mumPDG = theParticleTable->FindParticle(particleName=
"mu-")->GetPDGEncoding();
228 mupPDG = theParticleTable->FindParticle(particleName=
"mu+")->GetPDGEncoding();
231 <<
" for mu+ = " <<
mupPDG;
240 int cell,
int iz, G4ThreeVector &
pos) {
252 if (primaryID == 0) {
254 edm::LogInfo(
"HGCSim") <<
"HGCSD: Problem with primaryID **** set by " 255 <<
"force to TkID **** " <<
theTrack->GetTrackID();
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
HGCSD(G4String, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
HGCalGeometryMode::GeometryMode m_mode
HGCNumberingScheme * numberingScheme
virtual bool ProcessHits(G4Step *, G4TouchableHistory *)
std::vector< double > angles_
uint32_t getUnitID(ForwardSubdetector subdet, int layer, int module, int cell, int iz, const G4ThreeVector &pos)
assigns the det id to a hit
virtual void update(const BeginOfJob *)
This routine will be called when the appropriate signal arrives.
type of data representation of DDCompactView
static TrackerG4SimHitNumberingScheme & numberingScheme(const DDCompactView &cpv, const GeometricDet &det)
void resetForNewPrimary(const G4ThreeVector &, double)
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
HGCalGeometryMode::GeometryMode geomMode() const
void NaNTrap(G4Step *step)
virtual G4bool getStepInfo(G4Step *aStep)
bool exclude(G4ThreeVector &point, int zside, int wafer)
G4StepPoint * preStepPoint
virtual double getEnergyDeposit(G4Step *)
virtual bool filterHit(CaloG4Hit *, double)
int setTrackID(G4Step *step)
double getResponseWt(G4Track *)
ForwardSubdetector myFwdSubdet_
virtual uint32_t setDetUnitId(G4Step *step)
static void unpackHexagonIndex(const uint32_t &idx, int &subdet, int &z, int &lay, int &wafer, int &celltyp, int &cell)
CaloG4Hit * createNewHit()
double getEnergyDeposit() const
HGCMouseBite * mouseBite_