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 *>,
119 if (verbosity_ > 0) {
121 <<
"observer of begin events and of G4step " 122 <<
"with Parameter values: \n\tLabel : " 123 << labelLayer_ <<
" and with " 124 << names_.size() <<
" detectors";
125 for (
unsigned int k=0;
k<names_.size(); ++
k)
127 <<
" Type " << types_[
k] <<
" DetType " 151 G4String nameX =
"HGCal";
164 if (detType == 0) nameX =
"HGCalEESensitive";
165 else if (detType == 1) nameX =
"HGCalHESiliconSensitive";
166 else nameX =
"HGCalHEScintillatorSensitive";
184 layers = hdc->
layers(
false);
186 edm::LogError(
"ValidHGCal") <<
"Cannot find HGCalDDDConstants for " 189 <<
"Cannot find HGCalDDDConstants for " << nameX <<
"\n";
192 nameX =
"HcalEndcap";
201 edm::LogError(
"ValidHGCal") <<
"Cannot find HcalDDDSimConstant";
203 <<
"Cannot find HcalDDDSimConstant\n";
208 }
else if (detType == 1) {
224 int iev = (*evt)()->GetEventID();
227 <<
"event = " << iev;
244 if (aStep !=
nullptr) {
245 G4VPhysicalVolume* curPV = aStep->GetPreStepPoint()->GetPhysicalVolume();
246 const G4String&
name = curPV->GetName();
247 G4VSensitiveDetector* curSD = aStep->GetPreStepPoint()->GetSensitiveDetector();
250 << aStep->GetPreStepPoint()->GetPosition();
253 if (curSD !=
nullptr) {
255 for (
unsigned int k=0;
k<
names_.size(); ++
k) {
256 if (name.find(
names_[
k].c_str()) != std::string::npos) {
260 int detType = (type >= 0) ?
detTypes_[type] : -1;
263 <<
" type " << type <<
":" << detType;
268 const G4TouchableHistory* touchable =
static_cast<const G4TouchableHistory*
>(aStep->GetPreStepPoint()->GetTouchable());
269 unsigned int index(0);
271 G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
274 G4ThreeVector localpos = touchable->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
275 float globalZ = touchable->GetTranslation(0).z();
276 int iz(globalZ>0 ? 1 : -1);
279 if (touchable->GetHistoryDepth() ==
levelT1_) {
280 layer = touchable->GetReplicaNumber(0);
282 layer = touchable->GetReplicaNumber(2);
283 module = touchable->GetReplicaNumber(1);
284 cell = touchable->GetReplicaNumber(0);
288 if ((touchable->GetHistoryDepth() ==
levelT1_) ||
289 (touchable->GetHistoryDepth() ==
levelT2_)) {
290 layer = touchable->GetReplicaNumber(0);
292 layer = touchable->GetReplicaNumber(3);
293 module = touchable->GetReplicaNumber(2);
294 cell = touchable->GetReplicaNumber(1);
302 << layer <<
" Module " <<
module 306 int depth = (touchable->GetReplicaNumber(0))%10 + 1;
307 int lay = (touchable->GetReplicaNumber(0)/10)%100 + 1;
308 int det = (touchable->GetReplicaNumber(1))/1000;
312 hitPoint.z()), depth, lay);
317 <<
":" << lay <<
" o/p " 319 <<
":" << tmp.
depth <<
":" 321 <<
":" << tmp.
lay <<
" point " 322 << hitPoint <<
" " << hitPoint.rho()
323 <<
":" << hitPoint.eta() <<
":" 327 double edeposit = aStep->GetTotalEnergyDeposit();
331 <<
" Edep " << edeposit <<
" hit at " 337 }
else if (detType == 1) {
346 G4String nextVolume(
"XXX");
347 if (aStep->GetTrack()->GetNextVolume()!=
nullptr)
348 nextVolume = aStep->GetTrack()->GetNextVolume()->GetName();
350 if (nextVolume.c_str()!=name.c_str()) {
370 <<
"deposit\n at EE : " << std::setw(6)
373 <<
"\n at HEB: " << std::setw(6)
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< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
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_
std::vector< std::vector< double > > tmp
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