16 #include "G4LogicalVolumeStore.hh" 17 #include "G4LogicalVolume.hh" 20 #include "G4ParticleTable.hh" 21 #include "G4VProcess.hh" 59 dd4hep_ =
p.getParameter<
bool>(
"g4GeometryDD4hepSource");
66 G4String myName =
name;
69 if (myName.find(
"HitsEE") != std::string::npos) {
71 nameX_ =
"HGCalEESensitive";
72 }
else if (myName.find(
"HitsHEfront") != std::string::npos) {
74 nameX_ =
"HGCalHESiliconSensitive";
75 }
else if (myName.find(
"HitsHEback") != std::string::npos) {
77 nameX_ =
"HGCalHEScintillatorSensitive";
81 edm::LogVerbatim(
"HGCSim") <<
"**************************************************" 85 <<
"* Constructing a HGCSD with name " <<
name <<
"\n" 88 <<
"**************************************************";
99 double r = aStep->GetPreStepPoint()->GetPosition().perp();
100 double z =
std::abs(aStep->GetPreStepPoint()->GetPosition().z());
103 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
104 G4LogicalVolume* lv = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
105 edm::LogVerbatim(
"HGCSim") <<
"HGCSD: Hit from standard path from " << lv->GetName() <<
" for Track " 106 << aStep->GetTrack()->GetTrackID() <<
" (" 107 << aStep->GetTrack()->GetDefinition()->GetParticleName() <<
":" << parCode <<
") R = " <<
r 108 <<
" Z = " <<
z <<
" slope = " <<
r /
z <<
":" <<
slopeMin_;
117 double wt2 = aStep->GetTrack()->GetWeight();
118 double destep = wt1 * aStep->GetTotalEnergyDeposit();
123 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
124 G4double tmptrackE = aStep->GetTrack()->GetKineticEnergy();
125 G4int parCodex = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
126 G4double
angle = (aStep->GetTrack()->GetMomentumDirection().theta()) / CLHEP::deg;
127 G4int
layer = ((touch->GetHistoryDepth() ==
levelT_) ? touch->GetReplicaNumber(0) : touch->GetReplicaNumber(2));
128 G4int ilayer = (
layer - 1) / 3;
129 if (aStep->GetTotalEnergyDeposit() > 0) {
132 t_dEStep1_.emplace_back(aStep->GetTotalEnergyDeposit());
143 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
144 const G4VTouchable* touch = preStepPoint->GetTouchable();
147 G4ThreeVector hitPoint = preStepPoint->GetPosition();
148 float globalZ = touch->GetTranslation(0).z();
149 int iz(globalZ > 0 ? 1 : -1);
152 G4ThreeVector localpos = touch->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
157 int layer(-1), moduleLev(-1),
module(-1), cell(-1);
158 if (touch->GetHistoryDepth() ==
levelT_) {
159 layer = touch->GetReplicaNumber(0);
161 edm::LogVerbatim(
"HGCSim") <<
"Depths: " << touch->GetHistoryDepth() <<
" name " << touch->GetVolume(0)->GetName()
162 <<
" layer:module:cell " <<
layer <<
":" << moduleLev <<
":" <<
module <<
":" << cell;
165 layer = touch->GetReplicaNumber(2);
166 module = touch->GetReplicaNumber(1);
167 cell = touch->GetReplicaNumber(0);
171 const G4Material* mat = aStep->GetPreStepPoint()->GetMaterial();
172 edm::LogVerbatim(
"HGCSim") <<
"Depths: " << touch->GetHistoryDepth() <<
" name " << touch->GetVolume(0)->GetName()
173 <<
":" << touch->GetReplicaNumber(0) <<
" " << touch->GetVolume(1)->GetName() <<
":" 174 << touch->GetReplicaNumber(1) <<
" " << touch->GetVolume(2)->GetName() <<
":" 175 << touch->GetReplicaNumber(2) <<
" layer:module:cell " <<
layer <<
":" << moduleLev
176 <<
":" <<
module <<
":" << cell <<
" Material " << mat->GetName() <<
":" 178 for (
int k = 0;
k < touch->GetHistoryDepth(); ++
k)
179 edm::LogVerbatim(
"HGCSim") <<
"Level [" <<
k <<
"] " << touch->GetVolume(
k)->GetName() <<
":" 180 << touch->GetReplicaNumber(
k);
184 if (aStep->GetPreStepPoint()->GetMaterial()->GetRadlen() > 100000.)
189 int det,
z, lay, wafer,
type, ic;
193 <<
module <<
":" << cell <<
":" << iz << localpos.x() <<
":" << localpos.y()
194 <<
" Decode " << det <<
":" <<
z <<
":" << lay <<
":" << wafer <<
":" <<
type <<
":" 197 G4ThreeVector
local =
198 ((moduleLev >= 0) ? (touch->GetHistory()->GetTransform(moduleLev).TransformPoint(hitPoint)) : G4ThreeVector());
217 throw cms::Exception(
"Unknown",
"HGCSD") <<
"Cannot find HGCalDDDConstants for " <<
nameX_ <<
"\n";
228 if (
tfile.isAvailable()) {
229 tree_ =
tfile->make<TTree>(
"TreeHGCSD",
"TreeHGCSD");
242 const G4Event* evt = (*g4Event)();
std::vector< double > t_TrackE_
Log< level::Info, true > LogVerbatim
double getEnergyDeposit(const G4Step *) override
std::vector< double > t_dEStep1_
T getParameter(std::string const &) const
void setNumberCheckedHits(int val)
std::vector< double > t_dEStep2_
std::vector< int > t_Layer_
std::vector< double > angles_
Log< level::Error, false > LogError
HGCalGeometryMode::GeometryMode geomMode() const
T getUntrackedParameter(std::string const &, T const &) const
HGCalGeometryMode::GeometryMode geom_mode_
std::unique_ptr< HGCMouseBite > mouseBite_
const HGCalDDDConstants * hgcons_
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
std::vector< int > t_Parcode_
std::unique_ptr< HGCNumberingScheme > numberingScheme_
void initEvent(const BeginOfEvent *) override
std::vector< double > t_Angle_
double getEnergyDeposit() const
HGCSD(const std::string &, const HGCalDDDConstants *, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
uint32_t setDetUnitId(const G4Step *step) override
void update(const BeginOfJob *) override
This routine will be called when the appropriate signal arrives.
bool filterHit(CaloG4Hit *, double) override
double getResponseWt(const G4Track *)
int levelTop(int ind=0) const
ForwardSubdetector myFwdSubdet_
static void unpackHexagonIndex(const uint32_t &idx, int &subdet, int &z, int &lay, int &wafer, int &celltyp, int &cell)
T angle(T x1, T y1, T z1, T x2, T y2, T z2)