38 #include "G4NavigationHistory.hh"
39 #include "G4TouchableHistory.hh"
41 #include "CLHEP/Units/GlobalSystemOfUnits.h"
42 #include "CLHEP/Units/GlobalPhysicalConstants.h"
76 std::vector<edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord> >
ddconsToken_;
108 if (verbosity_ > 0) {
110 <<
"observer of begin events and of G4step "
111 <<
"with Parameter values: \n\tLabel : " << labelLayer_ <<
" and with "
112 << names_.size() <<
" detectors";
113 for (
unsigned int k = 0;
k < names_.size(); ++
k)
114 edm::LogVerbatim(
"ValidHGCal") <<
" [" <<
k <<
"] " << names_[
k] <<
" Type " << types_[
k] <<
" DetType "
129 G4String nameX =
"HGCal";
135 else if (detType == 1)
143 else if (detType == 1)
149 nameX =
"HGCalEESensitive";
150 else if (detType == 1)
151 nameX =
"HGCalHESiliconSensitive";
153 nameX =
"HGCalHEScintillatorSensitive";
158 <<
subdet_.back() <<
":" << nameX;
180 if (hdc->tileTrapezoid()) {
183 }
else if (hdc->waferHexagon6()) {
190 layers = hdc->layers(
false);
198 }
else if (detType == 1) {
207 <<
subdet_[
type] <<
" with " << layers <<
" layers";
213 int iev = (*evt)()->GetEventID();
216 <<
"event = " <<
iev;
235 if (aStep !=
nullptr) {
236 G4VPhysicalVolume* curPV = aStep->GetPreStepPoint()->GetPhysicalVolume();
237 const G4String&
name = curPV->GetName();
238 G4VSensitiveDetector* curSD = aStep->GetPreStepPoint()->GetSensitiveDetector();
241 << aStep->GetPreStepPoint()->GetPosition();
244 if (curSD !=
nullptr) {
246 for (
unsigned int k = 0;
k <
names_.size(); ++
k) {
247 if (name.find(
names_[
k].c_str()) != std::string::npos) {
252 int detType = (type >= 0) ?
detTypes_[type] : -1;
254 edm::LogVerbatim(
"ValidHGCal") <<
"ValidHGCal::In SD " << name <<
" type " << type <<
":" << detType;
259 const G4TouchableHistory* touchable =
260 static_cast<const G4TouchableHistory*
>(aStep->GetPreStepPoint()->GetTouchable());
261 unsigned int index(0);
263 G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
265 G4ThreeVector localpos = touchable->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
266 float globalZ = touchable->GetTranslation(0).z();
267 int iz(globalZ > 0 ? 1 : -1);
270 if (touchable->GetHistoryDepth() ==
levelT1_) {
271 layer = touchable->GetReplicaNumber(0);
273 layer = touchable->GetReplicaNumber(2);
274 module = touchable->GetReplicaNumber(1);
275 cell = touchable->GetReplicaNumber(0);
280 if ((touchable->GetHistoryDepth() ==
levelT1_) || (touchable->GetHistoryDepth() ==
levelT2_)) {
281 layer = touchable->GetReplicaNumber(0);
283 layer = touchable->GetReplicaNumber(3);
284 module = touchable->GetReplicaNumber(2);
285 cell = touchable->GetReplicaNumber(1);
291 edm::LogVerbatim(
"ValidHGCal") <<
"HGCal: " << name <<
" Layer " << layer <<
" Module " <<
module <<
" Cell "
294 double edeposit = aStep->GetTotalEnergyDeposit();
297 << edeposit <<
" hit at " << hitPoint;
302 }
else if (detType == 1) {
311 G4String nextVolume(
"XXX");
312 if (aStep->GetTrack()->GetNextVolume() !=
nullptr)
313 nextVolume = aStep->GetTrack()->GetNextVolume()->GetName();
315 if (nextVolume.c_str() != name.c_str()) {
319 hgchitX_.emplace_back(hitPoint.x());
320 hgchitY_.emplace_back(hitPoint.y());
321 hgchitZ_.emplace_back(hitPoint.z());
std::vector< unsigned int > hgchitIndex_
Log< level::Info, true > LogVerbatim
std::vector< double > hgchitY_
T getUntrackedParameter(std::string const &, T const &) const
std::vector< int > subdet_
#define DEFINE_SIMWATCHER(type)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
std::vector< HGCalNumberingScheme * > hgcalNumbering_
void produce(edm::Event &, const edm::EventSetup &) override
SimG4HGCalValidation(const edm::ParameterSet &p)
std::vector< std::string > nameXs_
std::vector< double > hgchitZ_
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< int > detTypes_
constexpr std::array< uint8_t, layerIndexSize > layer
void beginRun(edm::EventSetup const &) override
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 &)
std::vector< unsigned int > hgchitDets_
std::vector< double > hgcHEFedep_
std::vector< HGCNumberingScheme * > hgcNumbering_
std::vector< std::string > names_
std::vector< edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > > ddconsToken_
std::vector< double > hgcHEBedep_
T getParameter(std::string const &) const
std::vector< int > types_
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)
~SimG4HGCalValidation() override
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
HitContainer const *__restrict__ TkSoA const *__restrict__ Quality const *__restrict__ CAHitNtupletGeneratorKernelsGPU::HitToTuple const *__restrict__ int32_t int iev
std::vector< double > hgchitX_