43 #include "G4NavigationHistory.hh" 44 #include "G4TouchableHistory.hh" 46 #include "CLHEP/Units/GlobalSystemOfUnits.h" 47 #include "CLHEP/Units/GlobalPhysicalConstants.h" 58 public Observer<const BeginOfEvent*>,
117 if (verbosity_ > 0) {
119 <<
"observer of begin events and of G4step " 120 <<
"with Parameter values: \n\tLabel : " << labelLayer_ <<
" and with " 121 << names_.size() <<
" detectors";
122 for (
unsigned int k = 0;
k < names_.size(); ++
k)
123 edm::LogVerbatim(
"ValidHGCal") <<
" [" <<
k <<
"] " << names_[
k] <<
" Type " << types_[
k] <<
" DetType " 147 G4String nameX =
"HGCal";
153 else if (detType == 1)
161 else if (detType == 1)
167 nameX =
"HGCalEESensitive";
168 else if (detType == 1)
169 nameX =
"HGCalHESiliconSensitive";
171 nameX =
"HGCalHEScintillatorSensitive";
188 layers = hdc->
layers(
false);
190 edm::LogError(
"ValidHGCal") <<
"Cannot find HGCalDDDConstants for " << nameX;
191 throw cms::Exception(
"Unknown",
"ValidHGCal") <<
"Cannot find HGCalDDDConstants for " << nameX <<
"\n";
194 nameX =
"HcalEndcap";
203 edm::LogError(
"ValidHGCal") <<
"Cannot find HcalDDDSimConstant";
204 throw cms::Exception(
"Unknown",
"ValidHGCal") <<
"Cannot find HcalDDDSimConstant\n";
210 }
else if (detType == 1) {
219 <<
subdet_[
type] <<
" with " << layers <<
" layers";
225 int iev = (*evt)()->GetEventID();
228 <<
"event = " << iev;
247 if (aStep !=
nullptr) {
248 G4VPhysicalVolume* curPV = aStep->GetPreStepPoint()->GetPhysicalVolume();
249 const G4String&
name = curPV->GetName();
250 G4VSensitiveDetector* curSD = aStep->GetPreStepPoint()->GetSensitiveDetector();
253 << aStep->GetPreStepPoint()->GetPosition();
256 if (curSD !=
nullptr) {
258 for (
unsigned int k = 0;
k <
names_.size(); ++
k) {
259 if (name.find(
names_[
k].c_str()) != std::string::npos) {
264 int detType = (type >= 0) ?
detTypes_[type] : -1;
266 edm::LogVerbatim(
"ValidHGCal") <<
"ValidHGCal::In SD " << name <<
" type " << type <<
":" << detType;
271 const G4TouchableHistory* touchable =
272 static_cast<const G4TouchableHistory*
>(aStep->GetPreStepPoint()->GetTouchable());
273 unsigned int index(0);
275 G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
278 G4ThreeVector localpos = touchable->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
279 float globalZ = touchable->GetTranslation(0).z();
280 int iz(globalZ > 0 ? 1 : -1);
283 if (touchable->GetHistoryDepth() ==
levelT1_) {
284 layer = touchable->GetReplicaNumber(0);
286 layer = touchable->GetReplicaNumber(2);
287 module = touchable->GetReplicaNumber(1);
288 cell = touchable->GetReplicaNumber(0);
293 if ((touchable->GetHistoryDepth() ==
levelT1_) || (touchable->GetHistoryDepth() ==
levelT2_)) {
294 layer = touchable->GetReplicaNumber(0);
296 layer = touchable->GetReplicaNumber(3);
297 module = touchable->GetReplicaNumber(2);
298 cell = touchable->GetReplicaNumber(1);
305 <<
"HGCal: " << name <<
" Layer " << layer <<
" Module " <<
module <<
" Cell " << cell;
308 int depth = (touchable->GetReplicaNumber(0)) % 10 + 1;
309 int lay = (touchable->GetReplicaNumber(0) / 10) % 100 + 1;
310 int det = (touchable->GetReplicaNumber(1)) / 1000;
317 <<
"HCAL: " << det <<
":" << depth <<
":" << lay <<
" o/p " << tmp.
subdet <<
":" << tmp.
zside <<
":" 318 << tmp.
depth <<
":" << tmp.
etaR <<
":" << tmp.
phis <<
":" << tmp.
lay <<
" point " << hitPoint <<
" " 319 << hitPoint.rho() <<
":" << hitPoint.eta() <<
":" << hitPoint.phi();
322 double edeposit = aStep->GetTotalEnergyDeposit();
325 << edeposit <<
" hit at " << hitPoint;
330 }
else if (detType == 1) {
339 G4String nextVolume(
"XXX");
340 if (aStep->GetTrack()->GetNextVolume() !=
nullptr)
341 nextVolume = aStep->GetTrack()->GetNextVolume()->GetName();
343 if (nextVolume.c_str() != name.c_str()) {
std::vector< unsigned int > hgchitIndex_
T getParameter(std::string const &) const
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< HGCalNumberingScheme * > hgcalNumbering_
void produce(edm::Event &, const edm::EventSetup &) override
SimG4HGCalValidation(const edm::ParameterSet &p)
std::vector< double > hgchitZ_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< int > detTypes_
static uint32_t packHcalIndex(int det, int z, int depth, int eta, int phi, int lay)
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)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
unsigned int layers(bool reco) const
const SimG4HGCalValidation & operator=(const SimG4HGCalValidation &)
std::vector< unsigned int > dets_
HcalNumberingFromDDD * numberingFromDDD_
void layerAnalysis(PHGCalValidInfo &)
HGCalGeometryMode::GeometryMode geomMode() const
std::vector< unsigned int > hgchitDets_
std::vector< double > hgcHEFedep_
HcalID unitID(int det, const math::XYZVectorD &pos, int depth, int lay=-1) const
std::vector< HGCNumberingScheme * > hgcNumbering_
std::vector< std::string > names_
std::vector< double > hgcHEBedep_
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
int levelTop(int ind=0) const
void update(const BeginOfJob *job) override
This routine will be called when the appropriate signal arrives.
std::vector< double > hgchitX_
T const * product() const