24 #include "G4LogicalVolumeStore.hh" 25 #include "G4LogicalVolume.hh" 28 #include "G4ParticleTable.hh" 29 #include "G4VProcess.hh" 67 if (storeAllG4Hits_) {
72 G4String myName =
name;
75 if (myName.find(
"HitsEE") != std::string::npos) {
77 nameX_ =
"HGCalEESensitive";
78 }
else if (myName.find(
"HitsHEfront") != std::string::npos) {
80 nameX_ =
"HGCalHESiliconSensitive";
81 }
else if (myName.find(
"HitsHEback") != std::string::npos) {
83 nameX_ =
"HGCalHEScintillatorSensitive";
87 edm::LogVerbatim(
"HGCSim") <<
"**************************************************" 91 <<
"* Constructing a HGCSD with name " << name <<
"\n" 94 <<
"**************************************************";
99 edm::LogVerbatim(
"HGCSim") <<
"Reject MosueBite Flag: " << rejectMB_ <<
" Size of wafer " << waferSize
100 <<
" Mouse Bite " << mouseBite <<
":" << mouseBiteCut_ <<
" along " << angles_.size()
105 double r = aStep->GetPreStepPoint()->GetPosition().perp();
106 double z =
std::abs(aStep->GetPreStepPoint()->GetPosition().z());
109 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
110 G4LogicalVolume* lv = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
111 edm::LogVerbatim(
"HGCSim") <<
"HGCSD: Hit from standard path from " << lv->GetName() <<
" for Track " 112 << aStep->GetTrack()->GetTrackID() <<
" (" 113 << aStep->GetTrack()->GetDefinition()->GetParticleName() <<
") R = " << r <<
" Z = " << z
114 <<
" slope = " << r / z <<
":" <<
slopeMin_;
118 if (r < z * slopeMin_) {
123 double wt2 = aStep->GetTrack()->GetWeight();
124 double destep = wt1 * aStep->GetTotalEnergyDeposit();
129 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
130 G4double tmptrackE = aStep->GetTrack()->GetKineticEnergy();
131 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
132 G4double
angle = (aStep->GetTrack()->GetMomentumDirection().theta()) / CLHEP::deg;
133 G4int layer = ((touch->GetHistoryDepth() ==
levelT_) ? touch->GetReplicaNumber(0) : touch->GetReplicaNumber(2));
134 G4int ilayer = (layer - 1) / 3;
135 if (aStep->GetTotalEnergyDeposit() > 0) {
138 t_dEStep1_.emplace_back(aStep->GetTotalEnergyDeposit());
149 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
150 const G4VTouchable* touch = preStepPoint->GetTouchable();
153 G4ThreeVector hitPoint = preStepPoint->GetPosition();
154 float globalZ = touch->GetTranslation(0).z();
155 int iz(globalZ > 0 ? 1 : -1);
158 G4ThreeVector localpos = touch->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
164 if (touch->GetHistoryDepth() ==
levelT_) {
165 layer = touch->GetReplicaNumber(0);
169 edm::LogVerbatim(
"HGCSim") <<
"Depths: " << touch->GetHistoryDepth() <<
" name " << touch->GetVolume(0)->GetName()
170 <<
" layer:module:cell " << layer <<
":" << module <<
":" << cell;
173 layer = touch->GetReplicaNumber(2);
174 module = touch->GetReplicaNumber(1);
175 cell = touch->GetReplicaNumber(0);
178 edm::LogVerbatim(
"HGCSim") <<
"Depths: " << touch->GetHistoryDepth() <<
" name " << touch->GetVolume(0)->GetName()
179 <<
":" << touch->GetReplicaNumber(0) <<
" " << touch->GetVolume(1)->GetName() <<
":" 180 << touch->GetReplicaNumber(1) <<
" " << touch->GetVolume(2)->GetName() <<
":" 181 << touch->GetReplicaNumber(2) <<
" " 182 <<
" layer:module:cell " << layer <<
":" << module <<
":" << cell <<
" Material " 183 << mat->GetName() <<
":" << aStep->GetPreStepPoint()->GetMaterial()->GetRadlen();
187 if (aStep->GetPreStepPoint()->GetMaterial()->GetRadlen() > 100000.)
190 uint32_t
id =
setDetUnitId(subdet, layer, module, cell, iz, localpos);
192 int det,
z, lay, wafer,
type, ic;
196 <<
":" << wafer <<
":" << type <<
":" << ic;
198 if (
mouseBite_->exclude(hitPoint, z, wafer, 0))
218 throw cms::Exception(
"Unknown",
"HGCSD") <<
"Cannot find HGCalDDDConstants for " <<
nameX_ <<
"\n";
230 tree_ = tfile->
make<TTree>(
"TreeHGCSD",
"TreeHGCSD");
243 const G4Event* evt = (*g4Event)();
std::vector< double > t_TrackE_
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
double getEnergyDeposit(const G4Step *) override
std::vector< double > t_dEStep1_
void setNumberCheckedHits(int val)
std::vector< double > t_dEStep2_
std::vector< int > t_Layer_
std::vector< double > angles_
T * make(const Args &...args) const
make new ROOT object
Compact representation of the geometrical detector hierarchy.
HGCalGeometryMode::GeometryMode geom_mode_
std::unique_ptr< HGCMouseBite > mouseBite_
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
HGCalGeometryMode::GeometryMode geomMode() const
std::vector< int > t_Parcode_
std::unique_ptr< HGCNumberingScheme > numberingScheme_
void initEvent(const BeginOfEvent *) override
std::vector< double > t_Angle_
HGCSD(const std::string &, const DDCompactView &, 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
int levelTop(int ind=0) const
double getResponseWt(const G4Track *)
ForwardSubdetector myFwdSubdet_
static void unpackHexagonIndex(const uint32_t &idx, int &subdet, int &z, int &lay, int &wafer, int &celltyp, int &cell)
double getEnergyDeposit() const
T angle(T x1, T y1, T z1, T x2, T y2, T z2)