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";
200 edm::LogError(
"ValidHGCal") <<
"Cannot find HcalDDDSimConstant";
202 <<
"Cannot find HcalDDDSimConstant\n";
207 }
else if (detType == 1) {
222 int iev = (*evt)()->GetEventID();
225 <<
"event = " << iev;
242 if (aStep !=
nullptr) {
243 G4VPhysicalVolume* curPV = aStep->GetPreStepPoint()->GetPhysicalVolume();
244 const G4String&
name = curPV->GetName();
245 G4VSensitiveDetector* curSD = aStep->GetPreStepPoint()->GetSensitiveDetector();
248 << aStep->GetPreStepPoint()->GetPosition();
251 if (curSD !=
nullptr) {
253 for (
unsigned int k=0;
k<
names_.size(); ++
k) {
254 if (name.find(
names_[
k].c_str()) != std::string::npos) {
258 int detType = (type >= 0) ?
detTypes_[type] : -1;
261 <<
" type " << type <<
":" << detType;
266 G4TouchableHistory* touchable = (G4TouchableHistory*)aStep->GetPreStepPoint()->GetTouchable();
267 unsigned int index(0);
269 G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
272 G4ThreeVector localpos = touchable->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
273 float globalZ = touchable->GetTranslation(0).z();
274 int iz(globalZ>0 ? 1 : -1);
277 if (touchable->GetHistoryDepth() ==
levelT1_) {
278 layer = touchable->GetReplicaNumber(0);
280 layer = touchable->GetReplicaNumber(2);
281 module = touchable->GetReplicaNumber(1);
282 cell = touchable->GetReplicaNumber(0);
286 if ((touchable->GetHistoryDepth() ==
levelT1_) ||
287 (touchable->GetHistoryDepth() ==
levelT2_)) {
288 layer = touchable->GetReplicaNumber(0);
290 layer = touchable->GetReplicaNumber(3);
291 module = touchable->GetReplicaNumber(2);
292 cell = touchable->GetReplicaNumber(1);
300 << layer <<
" Module " <<
module 304 int depth = (touchable->GetReplicaNumber(0))%10 + 1;
305 int lay = (touchable->GetReplicaNumber(0)/10)%100 + 1;
306 int det = (touchable->GetReplicaNumber(1))/1000;
312 <<
":" << lay <<
" o/p " 314 <<
":" << tmp.
depth <<
":" 316 <<
":" << tmp.
lay <<
" point " 317 << hitPoint <<
" " << hitPoint.rho()
318 <<
":" << hitPoint.eta() <<
":" 322 double edeposit = aStep->GetTotalEnergyDeposit();
326 <<
" Edep " << edeposit <<
" hit at " 332 }
else if (detType == 1) {
341 G4String nextVolume(
"XXX");
342 if (aStep->GetTrack()->GetNextVolume()!=
nullptr)
343 nextVolume = aStep->GetTrack()->GetNextVolume()->GetName();
345 if (nextVolume.c_str()!=name.c_str()) {
365 <<
"deposit\n at EE : " << std::setw(6)
368 <<
"\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_