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 *>,
120 <<
"observer of begin events and of G4step " 121 <<
"with Parameter values: \n\tLabel : " 122 << labelLayer_ <<
" and with " 123 << names_.size() <<
" detectors";
124 for (
unsigned int k=0;
k<names_.size(); ++
k)
126 <<
" Type " << types_[
k] <<
" DetType " 149 G4String nameX =
"HGCal";
162 if (detType == 0) nameX =
"HGCalEESensitive";
163 else if (detType == 1) nameX =
"HGCalHESiliconSensitive";
164 else nameX =
"HGCalHEScintillatorSensitive";
182 layers = hdc->
layers(
false);
184 edm::LogError(
"ValidHGCal") <<
"Cannot find HGCalDDDConstants for " 187 <<
"Cannot find HGCalDDDConstants for " << nameX <<
"\n";
190 nameX =
"HcalEndcap";
199 edm::LogError(
"ValidHGCal") <<
"Cannot find HcalDDDSimConstant";
201 <<
"Cannot find HcalDDDSimConstant\n";
206 }
else if (detType == 1) {
221 int iev = (*evt)()->GetEventID();
224 <<
"event = " << iev;
241 if (aStep !=
nullptr) {
242 G4VPhysicalVolume* curPV = aStep->GetPreStepPoint()->GetPhysicalVolume();
243 const G4String&
name = curPV->GetName();
244 G4VSensitiveDetector* curSD = aStep->GetPreStepPoint()->GetSensitiveDetector();
247 << aStep->GetPreStepPoint()->GetPosition();
250 if (curSD !=
nullptr) {
252 for (
unsigned int k=0;
k<
names_.size(); ++
k) {
253 if (name.find(
names_[
k].c_str()) != std::string::npos) {
257 int detType = (type >= 0) ?
detTypes_[type] : -1;
260 <<
" type " << type <<
":" << detType;
265 const G4TouchableHistory* touchable =
static_cast<const G4TouchableHistory*
>(aStep->GetPreStepPoint()->GetTouchable());
266 unsigned int index(0);
268 G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
271 G4ThreeVector localpos = touchable->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
272 float globalZ = touchable->GetTranslation(0).z();
273 int iz(globalZ>0 ? 1 : -1);
276 if (touchable->GetHistoryDepth() ==
levelT1_) {
277 layer = touchable->GetReplicaNumber(0);
279 layer = touchable->GetReplicaNumber(2);
280 module = touchable->GetReplicaNumber(1);
281 cell = touchable->GetReplicaNumber(0);
285 if ((touchable->GetHistoryDepth() ==
levelT1_) ||
286 (touchable->GetHistoryDepth() ==
levelT2_)) {
287 layer = touchable->GetReplicaNumber(0);
289 layer = touchable->GetReplicaNumber(3);
290 module = touchable->GetReplicaNumber(2);
291 cell = touchable->GetReplicaNumber(1);
299 << layer <<
" Module " <<
module 303 int depth = (touchable->GetReplicaNumber(0))%10 + 1;
304 int lay = (touchable->GetReplicaNumber(0)/10)%100 + 1;
305 int det = (touchable->GetReplicaNumber(1))/1000;
311 <<
":" << lay <<
" o/p " 313 <<
":" << tmp.
depth <<
":" 315 <<
":" << tmp.
lay <<
" point " 316 << hitPoint <<
" " << hitPoint.rho()
317 <<
":" << hitPoint.eta() <<
":" 321 double edeposit = aStep->GetTotalEnergyDeposit();
325 <<
" Edep " << edeposit <<
" hit at " 331 }
else if (detType == 1) {
340 G4String nextVolume(
"XXX");
341 if (aStep->GetTrack()->GetNextVolume()!=
nullptr)
342 nextVolume = aStep->GetTrack()->GetNextVolume()->GetName();
344 if (nextVolume.c_str()!=name.c_str()) {
364 <<
"deposit\n at EE : " << std::setw(6)
367 <<
"\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)
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_
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.
HcalID unitID(int det, const CLHEP::Hep3Vector &pos, int depth, int lay=-1) const
std::vector< double > hgchitX_
T const * product() const