31 #include "G4NavigationHistory.hh" 32 #include "G4TouchableHistory.hh" 34 #include "CLHEP/Units/GlobalSystemOfUnits.h" 35 #include "CLHEP/Units/GlobalPhysicalConstants.h" 69 std::vector<edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord>>
ddconsToken_;
74 const std::vector<std::string>
names_;
96 detTypes_(m_Anal.getParameter<
std::
vector<
int>>(
"DetTypes")),
97 labelLayer_(m_Anal.getParameter<
std::
string>(
"LabelLayerInfo")),
98 verbosity_(m_Anal.getUntrackedParameter<
int>(
"Verbosity", 0)),
106 <<
"observer of begin events and of G4step " 107 <<
"with Parameter values: \n\tLabel : " <<
labelLayer_ <<
" and with " 108 <<
names_.size() <<
" detectors";
109 for (
unsigned int k = 0;
k <
names_.size(); ++
k)
118 G4String
nameX =
"HGCal";
123 else if (detType == 1)
128 nameX =
"HGCalEESensitive";
129 else if (detType == 1)
130 nameX =
"HGCalHESiliconSensitive";
132 nameX =
"HGCalHEScintillatorSensitive";
160 std::make_unique<HGCalNumberingScheme>(*hdc, static_cast<DetId::Detector>(
dets_[
type]),
nameXs_[
type],
""));
169 }
else if (detType == 1) {
184 int iev = (*evt)()->GetEventID();
187 <<
"event = " <<
iev;
206 if (aStep !=
nullptr) {
207 G4VPhysicalVolume* curPV = aStep->GetPreStepPoint()->GetPhysicalVolume();
208 const G4String&
name = curPV->GetName();
209 G4VSensitiveDetector* curSD = aStep->GetPreStepPoint()->GetSensitiveDetector();
212 << aStep->GetPreStepPoint()->GetPosition();
215 if (curSD !=
nullptr) {
217 for (
unsigned int k = 0;
k <
names_.size(); ++
k) {
218 if (
name.find(
names_[
k].c_str()) != std::string::npos) {
230 const G4TouchableHistory* touchable =
231 static_cast<const G4TouchableHistory*
>(aStep->GetPreStepPoint()->GetTouchable());
232 unsigned int index(0);
234 G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
236 G4ThreeVector localpos = touchable->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
237 float globalZ = touchable->GetTranslation(0).z();
238 int iz(globalZ > 0 ? 1 : -1);
240 if ((touchable->GetHistoryDepth() ==
levelT1_) || (touchable->GetHistoryDepth() ==
levelT2_)) {
241 layer = touchable->GetReplicaNumber(0);
243 layer = touchable->GetReplicaNumber(3);
244 module = touchable->GetReplicaNumber(2);
245 cell = touchable->GetReplicaNumber(1);
253 double edeposit = aStep->GetTotalEnergyDeposit();
256 << edeposit <<
" hit at " << hitPoint;
261 }
else if (detType == 1) {
270 G4String nextVolume(
"XXX");
271 if (aStep->GetTrack()->GetNextVolume() !=
nullptr)
272 nextVolume = aStep->GetTrack()->GetNextVolume()->GetName();
274 if (nextVolume.c_str() !=
name.c_str()) {
278 hgchitX_.emplace_back(hitPoint.x());
279 hgchitY_.emplace_back(hitPoint.y());
280 hgchitZ_.emplace_back(hitPoint.z());
293 <<
"deposit\n at EE : " << std::setw(6) <<
edepEE_ / CLHEP::MeV
294 <<
"\n at HEF: " << std::setw(6) <<
edepHEF_ / CLHEP::MeV
295 <<
"\n at HEB: " << std::setw(6) <<
edepHEB_ / CLHEP::MeV;
std::vector< unsigned int > hgchitIndex_
Log< level::Info, true > LogVerbatim
std::vector< double > hgchitY_
std::vector< int > subdet_
#define DEFINE_SIMWATCHER(type)
~SimG4HGCalValidation() override=default
void produce(edm::Event &, const edm::EventSetup &) override
SimG4HGCalValidation(const edm::ParameterSet &p)
std::vector< std::string > nameXs_
const std::vector< int > detTypes_
uint32_t cc[maxCellsPerHit]
std::vector< double > hgchitZ_
TkSoAView< TrackerTraits > HitToTuple< TrackerTraits > const *__restrict__ int32_t int32_t int iev
const std::vector< int > types_
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void beginRun(edm::EventSetup const &) override
const std::vector< std::string > names_
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
void update(const BeginOfEvent *evt) override
This routine will be called when the appropriate signal arrives.
void fillhgcLayers(const double edepEE, const double edepHEF, const double edepHEB, const std::vector< double > &eedep, const std::vector< double > &hefdep, const std::vector< double > &hebdep)
void registerConsumes(edm::ConsumesCollector) override
const SimG4HGCalValidation & operator=(const SimG4HGCalValidation &)
std::vector< unsigned int > dets_
void layerAnalysis(PHGCalValidInfo &)
unsigned int layers(bool reco) const
std::vector< unsigned int > hgchitDets_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
std::vector< double > hgcHEFedep_
std::vector< edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > > ddconsToken_
std::vector< double > hgcHEBedep_
std::vector< double > hgcEEedep_
void fillhgcHits(const std::vector< unsigned int > &hitdets, const std::vector< unsigned int > &hitindex, const std::vector< double > &hitvtxX, const std::vector< double > &hitvtxY, const std::vector< double > &hitvtxZ)
const std::string labelLayer_
const edm::ParameterSet m_Anal
int levelTop(int ind=0) const
std::vector< double > hgchitX_
std::vector< std::unique_ptr< HGCalNumberingScheme > > hgcalNumbering_