16 #include "G4LogicalVolumeStore.hh" 17 #include "G4LogicalVolume.hh" 20 #include "G4ParticleTable.hh" 21 #include "G4VProcess.hh" 65 G4String myName =
name;
68 if (myName.find(
"HitsEE") != std::string::npos) {
70 nameX_ =
"HGCalEESensitive";
71 }
else if (myName.find(
"HitsHEfront") != std::string::npos) {
73 nameX_ =
"HGCalHESiliconSensitive";
74 }
else if (myName.find(
"HitsHEback") != std::string::npos) {
76 nameX_ =
"HGCalHEScintillatorSensitive";
80 edm::LogVerbatim(
"HGCSim") <<
"**************************************************" 84 <<
"* Constructing a HGCSD with name " <<
name <<
"\n" 87 <<
"**************************************************";
98 double r = aStep->GetPreStepPoint()->GetPosition().perp();
99 double z =
std::abs(aStep->GetPreStepPoint()->GetPosition().z());
102 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
103 G4LogicalVolume* lv = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
104 edm::LogVerbatim(
"HGCSim") <<
"HGCSD: Hit from standard path from " << lv->GetName() <<
" for Track " 105 << aStep->GetTrack()->GetTrackID() <<
" (" 106 << aStep->GetTrack()->GetDefinition()->GetParticleName() <<
":" << parCode <<
") R = " <<
r 107 <<
" Z = " <<
z <<
" slope = " <<
r /
z <<
":" <<
slopeMin_;
116 double wt2 = aStep->GetTrack()->GetWeight();
117 double destep = wt1 * aStep->GetTotalEnergyDeposit();
122 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
123 G4double tmptrackE = aStep->GetTrack()->GetKineticEnergy();
124 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
125 G4double
angle = (aStep->GetTrack()->GetMomentumDirection().theta()) / CLHEP::deg;
126 G4int
layer = ((touch->GetHistoryDepth() ==
levelT_) ? touch->GetReplicaNumber(0) : touch->GetReplicaNumber(2));
127 G4int ilayer = (
layer - 1) / 3;
128 if (aStep->GetTotalEnergyDeposit() > 0) {
131 t_dEStep1_.emplace_back(aStep->GetTotalEnergyDeposit());
142 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
143 const G4VTouchable* touch = preStepPoint->GetTouchable();
146 G4ThreeVector hitPoint = preStepPoint->GetPosition();
147 float globalZ = touch->GetTranslation(0).z();
148 int iz(globalZ > 0 ? 1 : -1);
151 G4ThreeVector localpos = touch->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
157 if (touch->GetHistoryDepth() ==
levelT_) {
158 layer = touch->GetReplicaNumber(0);
162 edm::LogVerbatim(
"HGCSim") <<
"Depths: " << touch->GetHistoryDepth() <<
" name " << touch->GetVolume(0)->GetName()
163 <<
" layer:module:cell " <<
layer <<
":" <<
module <<
":" << cell;
166 layer = touch->GetReplicaNumber(2);
167 module = touch->GetReplicaNumber(1);
168 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 <<
":" <<
module <<
":" 176 << cell <<
" Material " << mat->GetName() <<
":" << mat->GetRadlen();
182 if (aStep->GetPreStepPoint()->GetMaterial()->GetRadlen() > 100000.)
187 int det,
z, lay, wafer,
type, ic;
191 <<
module <<
":" << cell <<
":" << iz << localpos.x() <<
":" << localpos.y()
192 <<
" Decode " << det <<
":" <<
z <<
":" << lay <<
":" << wafer <<
":" <<
type <<
":" 211 throw cms::Exception(
"Unknown",
"HGCSD") <<
"Cannot find HGCalDDDConstants for " <<
nameX_ <<
"\n";
222 if (
tfile.isAvailable()) {
223 tree_ =
tfile->make<TTree>(
"TreeHGCSD",
"TreeHGCSD");
236 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
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
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)