19 #include "G4LogicalVolumeStore.hh" 20 #include "G4LogicalVolume.hh" 23 #include "G4ParticleTable.hh" 24 #include "G4VProcess.hh" 62 if (storeAllG4Hits_) {
67 G4String myName =
name;
70 if (myName.find(
"HitsEE") != std::string::npos) {
72 nameX_ =
"HGCalEESensitive";
73 }
else if (myName.find(
"HitsHEfront") != std::string::npos) {
75 nameX_ =
"HGCalHESiliconSensitive";
76 }
else if (myName.find(
"HitsHEback") != std::string::npos) {
78 nameX_ =
"HGCalHEScintillatorSensitive";
82 edm::LogVerbatim(
"HGCSim") <<
"**************************************************" 86 <<
"* Constructing a HGCSD with name " << name <<
"\n" 89 <<
"**************************************************";
94 edm::LogVerbatim(
"HGCSim") <<
"Reject MosueBite Flag: " << rejectMB_ <<
" Size of wafer " << waferSize
95 <<
" Mouse Bite " << mouseBite <<
":" << mouseBiteCut_ <<
" along " << angles_.size()
100 double r = aStep->GetPreStepPoint()->GetPosition().perp();
101 double z =
std::abs(aStep->GetPreStepPoint()->GetPosition().z());
104 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
105 G4LogicalVolume* lv = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
106 edm::LogVerbatim(
"HGCSim") <<
"HGCSD: Hit from standard path from " << lv->GetName() <<
" for Track " 107 << aStep->GetTrack()->GetTrackID() <<
" (" 108 << aStep->GetTrack()->GetDefinition()->GetParticleName() <<
") R = " << r <<
" Z = " << z
109 <<
" slope = " << r / z <<
":" <<
slopeMin_;
113 if (r < z * slopeMin_) {
118 double wt2 = aStep->GetTrack()->GetWeight();
119 double destep = wt1 * aStep->GetTotalEnergyDeposit();
124 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
125 G4double tmptrackE = aStep->GetTrack()->GetKineticEnergy();
126 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
127 G4double
angle = (aStep->GetTrack()->GetMomentumDirection().theta()) / CLHEP::deg;
128 G4int layer = ((touch->GetHistoryDepth() ==
levelT_) ? touch->GetReplicaNumber(0) : touch->GetReplicaNumber(2));
129 G4int ilayer = (layer - 1) / 3;
130 if (aStep->GetTotalEnergyDeposit() > 0) {
133 t_dEStep1_.emplace_back(aStep->GetTotalEnergyDeposit());
144 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
145 const G4VTouchable* touch = preStepPoint->GetTouchable();
148 G4ThreeVector hitPoint = preStepPoint->GetPosition();
149 float globalZ = touch->GetTranslation(0).z();
150 int iz(globalZ > 0 ? 1 : -1);
153 G4ThreeVector localpos = touch->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
159 if (touch->GetHistoryDepth() ==
levelT_) {
160 layer = touch->GetReplicaNumber(0);
164 edm::LogVerbatim(
"HGCSim") <<
"Depths: " << touch->GetHistoryDepth() <<
" name " << touch->GetVolume(0)->GetName()
165 <<
" layer:module:cell " << layer <<
":" << module <<
":" << cell;
168 layer = touch->GetReplicaNumber(2);
169 module = touch->GetReplicaNumber(1);
170 cell = touch->GetReplicaNumber(0);
173 edm::LogVerbatim(
"HGCSim") <<
"Depths: " << touch->GetHistoryDepth() <<
" name " << touch->GetVolume(0)->GetName()
174 <<
":" << touch->GetReplicaNumber(0) <<
" " << touch->GetVolume(1)->GetName() <<
":" 175 << touch->GetReplicaNumber(1) <<
" " << touch->GetVolume(2)->GetName() <<
":" 176 << touch->GetReplicaNumber(2) <<
" " 177 <<
" layer:module:cell " << layer <<
":" << module <<
":" << cell <<
" Material " 178 << mat->GetName() <<
":" << aStep->GetPreStepPoint()->GetMaterial()->GetRadlen();
182 if (aStep->GetPreStepPoint()->GetMaterial()->GetRadlen() > 100000.)
185 uint32_t
id =
setDetUnitId(subdet, layer, module, cell, iz, localpos);
187 int det,
z, lay, wafer,
type, ic;
191 <<
":" << wafer <<
":" << type <<
":" << ic;
193 if (
mouseBite_->exclude(hitPoint, z, wafer, 0))
213 throw cms::Exception(
"Unknown",
"HGCSD") <<
"Cannot find HGCalDDDConstants for " <<
nameX_ <<
"\n";
225 tree_ = tfile->
make<TTree>(
"TreeHGCSD",
"TreeHGCSD");
238 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
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_
HGCSD(const std::string &, const edm::EventSetup &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
std::unique_ptr< HGCNumberingScheme > numberingScheme_
void initEvent(const BeginOfEvent *) override
std::vector< double > t_Angle_
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)