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")),
57 if (myName.find(
"HitsEE")!=std::string::npos) {
59 nameX =
"HGCalEESensitive";
60 }
else if (myName.find(
"HitsHEfront")!=std::string::npos) {
62 nameX =
"HGCalHESiliconSensitive";
63 }
else if (myName.find(
"HitsHEback")!=std::string::npos) {
65 nameX =
"HGCalHEScintillatorSensitive";
69 edm::LogInfo(
"HGCSim")<<
"**************************************************" 73 <<
"* Constructing a HGCSD with name " << name <<
"\n" 76 <<
"**************************************************";
78 edm::LogInfo(
"HGCSim") <<
"HGCSD:: Threshold for storing hits: " << eminHit
80 edm::LogInfo(
"HGCSim") <<
"Reject MosueBite Flag: " << rejectMB_
81 <<
" Size of wafer " << waferSize <<
" Mouse Bite " 82 << mouseBite <<
":" << mouseBiteCut_ <<
" along " 83 << angles_.size() <<
" axes";
98 double r = aStep->GetPreStepPoint()->GetPosition().perp();
99 double z =
std::abs(aStep->GetPreStepPoint()->GetPosition().z());
101 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
102 bool notaMuon = (parCode ==
mupPDG || parCode ==
mumPDG ) ?
false :
true;
103 G4LogicalVolume* lv =
104 aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
105 edm::LogInfo(
"HGCSim") <<
"HGCSD: Hit from standard path from " 106 << lv->GetName() <<
" for Track " 107 << aStep->GetTrack()->GetTrackID() <<
" (" 108 << aStep->GetTrack()->GetDefinition()->GetParticleName()
109 <<
":" << notaMuon <<
") R = " << r <<
" Z = " << z
110 <<
" slope = " << r/z <<
":" <<
slopeMin_;
113 if (r/z >= slopeMin_) {
125 double wt2 = aStep->GetTrack()->GetWeight();
126 double destep = wt1*(aStep->GetTotalEnergyDeposit());
127 if (wt2 > 0) destep *= wt2;
134 const G4VTouchable* touch = preStepPoint->GetTouchable();
137 G4ThreeVector hitPoint = preStepPoint->GetPosition();
138 float globalZ=touch->GetTranslation(0).z();
139 int iz( globalZ>0 ? 1 : -1);
142 G4ThreeVector localpos = touch->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
147 int layer(0),
module(0), cell(0);
149 layer = touch->GetReplicaNumber(0);
150 module = touch->GetReplicaNumber(1);
152 if (touch->GetHistoryDepth() ==
levelT_) {
153 layer = touch->GetReplicaNumber(0);
157 edm::LogInfo(
"HGCSim") <<
"Depths: " << touch->GetHistoryDepth()
158 <<
" name " << touch->GetVolume(0)->GetName()
159 <<
" layer:module:cell " << layer <<
":" 160 <<
module <<
":" << cell << std::endl;
163 layer = touch->GetReplicaNumber(2);
164 module = touch->GetReplicaNumber(1);
165 cell = touch->GetReplicaNumber(0);
168 edm::LogInfo(
"HGCSim") <<
"Depths: " << touch->GetHistoryDepth() <<
" name " 169 << touch->GetVolume(0)->GetName()
170 <<
":" << touch->GetReplicaNumber(0) <<
" " 171 << touch->GetVolume(1)->GetName()
172 <<
":" << touch->GetReplicaNumber(1) <<
" " 173 << touch->GetVolume(2)->GetName()
174 <<
":" << touch->GetReplicaNumber(2) <<
" " 175 <<
" layer:module:cell " << layer <<
":" <<
module 176 <<
":" << cell <<
" Material " << mat->GetName()<<
":" 177 << aStep->GetPreStepPoint()->GetMaterial()->GetRadlen()
180 if (aStep->GetPreStepPoint()->GetMaterial()->GetRadlen() > 100000.)
return 0;
185 int det,
z, lay, wafer,
type, ic;
189 << det <<
":" << z <<
":" << lay <<
":" << wafer
190 <<
":" << type <<
":" << ic << std::endl;
210 edm::LogError(
"HGCSim") <<
"HCalSD : Cannot find HGCalDDDConstants for " 212 throw cms::Exception(
"Unknown",
"HGCSD") <<
"Cannot find HGCalDDDConstants for " <<
nameX <<
"\n";
216 <<
" Slope cut " <<
slopeMin_ <<
" top Level " 222 G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
224 mumPDG = theParticleTable->FindParticle(particleName=
"mu-")->GetPDGEncoding();
225 mupPDG = theParticleTable->FindParticle(particleName=
"mu+")->GetPDGEncoding();
228 <<
" for mu+ = " <<
mupPDG;
237 int cell,
int iz, G4ThreeVector &
pos) {
249 if (primaryID == 0) {
251 edm::LogInfo(
"HGCSim") <<
"HGCSD: Problem with primaryID **** set by " 252 <<
"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_