diff --git a/Geometry/HcalCommonData/src/CaloSimulationConstants.cc b/Geometry/HcalCommonData/src/CaloSimulationConstants.cc index 747b6da3f74f4..97bedcbd7fea7 100644 --- a/Geometry/HcalCommonData/src/CaloSimulationConstants.cc +++ b/Geometry/HcalCommonData/src/CaloSimulationConstants.cc @@ -5,13 +5,13 @@ CaloSimulationConstants::CaloSimulationConstants(const CaloSimulationParameters* csp) : calospar_(csp) { #ifdef EDM_ML_DEBUG - edm::LogInfo("HCalGeom") - << "CaloSimulationConstants::CaloSimulationConstants (const CaloSimulationParameters* csp) constructor\n"; + edm::LogVerbatim("HCalGeom") + << "CaloSimulationConstants::CaloSimulationConstants (const CaloSimulationParameters* csp) constructor"; #endif } CaloSimulationConstants::~CaloSimulationConstants() { #ifdef EDM_ML_DEBUG - edm::LogInfo("HCalGeom") << "CaloSimulationConstants::destructed!!!\n"; + edm::LogVerbatim("HCalGeom") << "CaloSimulationConstants::destructed!!!"; #endif } diff --git a/Geometry/HcalCommonData/src/HcalDDDSimConstants.cc b/Geometry/HcalCommonData/src/HcalDDDSimConstants.cc index ca00ded74cd9b..0179463958cca 100644 --- a/Geometry/HcalCommonData/src/HcalDDDSimConstants.cc +++ b/Geometry/HcalCommonData/src/HcalDDDSimConstants.cc @@ -9,19 +9,19 @@ using namespace geant_units::operators; HcalDDDSimConstants::HcalDDDSimConstants(const HcalParameters* hp) : hpar(hp) { #ifdef EDM_ML_DEBUG - edm::LogInfo("HCalGeom") << "HcalDDDSimConstants::HcalDDDSimConstants (const HcalParameters* hp) constructor\n"; + edm::LogVerbatim("HCalGeom") << "HcalDDDSimConstants::HcalDDDSimConstants (const HcalParameters* hp) constructor"; #endif initialize(); #ifdef EDM_ML_DEBUG std::vector cellTypes = HcalCellTypes(); - edm::LogVerbatim("HCalGeom") << "HcalDDDSimConstants: " << cellTypes.size() << " cells of type HCal (All)\n"; + edm::LogVerbatim("HCalGeom") << "HcalDDDSimConstants: " << cellTypes.size() << " cells of type HCal (All)"; #endif } HcalDDDSimConstants::~HcalDDDSimConstants() { #ifdef EDM_ML_DEBUG - edm::LogInfo("HCalGeom") << "HcalDDDSimConstants::destructed!!!\n"; + edm::LogVerbatim("HCalGeom") << "HcalDDDSimConstants::destructed!!!"; #endif } @@ -76,8 +76,8 @@ HcalCellType::HcalCell HcalDDDSimConstants::cell( } else { ok = false; #ifdef EDM_ML_DEBUG - edm::LogInfo("HCalGeom") << "HcalDDDSimConstants: wrong eta " << etaR << " (" << ir << "/" << nR - << ") Detector " << idet << std::endl; + edm::LogVerbatim("HCalGeom") << "HcalDDDSimConstants: wrong eta " << etaR << " (" << ir << "/" << nR + << ") Detector " << idet; #endif } } else if (etaR <= nEta) { @@ -308,9 +308,8 @@ double HcalDDDSimConstants::getEtaHO(const double& etaR, const double& x, const } eta = (z >= 0. ? eta : -eta); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HCalGeom") << "R " << r << " Z " << z << " eta " << etaR << ":" << eta; - if (eta != etaR) - edm::LogInfo("HCalGeom") << "**** Check *****"; + std::string chk = (eta != etaR) ? " **** Check *****" : " "; + edm::LogVerbatim("HCalGeom") << "R " << r << " Z " << z << " eta " << etaR << ":" << eta << chk; #endif return eta; } else { @@ -505,32 +504,32 @@ std::vector > HcalDDDSimConstants::getPhis(const int& sub std::vector HcalDDDSimConstants::HcalCellTypes() const { std::vector cellTypes = HcalCellTypes(HcalBarrel); #ifdef EDM_ML_DEBUG - edm::LogInfo("HCalGeom") << "HcalDDDSimConstants: " << cellTypes.size() << " cells of type HCal Barrel\n"; + edm::LogVerbatim("HCalGeom") << "HcalDDDSimConstants: " << cellTypes.size() << " cells of type HCal Barrel"; for (unsigned int i = 0; i < cellTypes.size(); i++) - edm::LogInfo("HCalGeom") << "Cell " << i << " " << cellTypes[i] << "\n"; + edm::LogVerbatim("HCalGeom") << "Cell " << i << " " << cellTypes[i]; #endif std::vector hoCells = HcalCellTypes(HcalOuter); #ifdef EDM_ML_DEBUG - edm::LogInfo("HCalGeom") << "HcalDDDSimConstants: " << hoCells.size() << " cells of type HCal Outer\n"; + edm::LogVerbatim("HCalGeom") << "HcalDDDSimConstants: " << hoCells.size() << " cells of type HCal Outer"; for (unsigned int i = 0; i < hoCells.size(); i++) - edm::LogInfo("HCalGeom") << "Cell " << i << " " << hoCells[i] << "\n"; + edm::LogVerbatim("HCalGeom") << "Cell " << i << " " << hoCells[i]; #endif cellTypes.insert(cellTypes.end(), hoCells.begin(), hoCells.end()); std::vector heCells = HcalCellTypes(HcalEndcap); #ifdef EDM_ML_DEBUG - edm::LogInfo("HCalGeom") << "HcalDDDSimConstants: " << heCells.size() << " cells of type HCal Endcap\n"; + edm::LogVerbatim("HCalGeom") << "HcalDDDSimConstants: " << heCells.size() << " cells of type HCal Endcap"; for (unsigned int i = 0; i < heCells.size(); i++) - edm::LogInfo("HCalGeom") << "Cell " << i << " " << heCells[i] << "\n"; + edm::LogVerbatim("HCalGeom") << "Cell " << i << " " << heCells[i]; #endif cellTypes.insert(cellTypes.end(), heCells.begin(), heCells.end()); std::vector hfCells = HcalCellTypes(HcalForward); #ifdef EDM_ML_DEBUG - edm::LogInfo("HCalGeom") << "HcalDDDSimConstants: " << hfCells.size() << " cells of type HCal Forward\n"; + edm::LogVerbatim("HCalGeom") << "HcalDDDSimConstants: " << hfCells.size() << " cells of type HCal Forward"; for (unsigned int i = 0; i < hfCells.size(); i++) - edm::LogInfo("HCalGeom") << "Cell " << i << " " << hfCells[i] << "\n"; + edm::LogVerbatim("HCalGeom") << "Cell " << i << " " << hfCells[i]; #endif cellTypes.insert(cellTypes.end(), hfCells.begin(), hfCells.end()); @@ -698,8 +697,7 @@ void HcalDDDSimConstants::printTiles() const { int kphi = (detsp > 0) ? phis[0] : 1; int zside = (kphi > 0) ? 1 : -1; int iphi = (kphi > 0) ? kphi : -kphi; - edm::LogVerbatim("HCalGeom") << "Tile Information for HB from " << hpar->etaMin[0] << " to " << hpar->etaMax[0] - << "\n"; + edm::LogVerbatim("HCalGeom") << "Tile Information for HB from " << hpar->etaMin[0] << " to " << hpar->etaMax[0]; for (int eta = hpar->etaMin[0]; eta <= hpar->etaMax[0]; eta++) { int dmax = getMaxDepth(1, eta, iphi, -zside, false); for (int depth = 1; depth <= dmax; depth++) @@ -711,8 +709,7 @@ void HcalDDDSimConstants::printTiles() const { } } - edm::LogVerbatim("HCalGeom") << "\nTile Information for HE from " << hpar->etaMin[1] << " to " << hpar->etaMax[1] - << "\n"; + edm::LogVerbatim("HCalGeom") << "\nTile Information for HE from " << hpar->etaMin[1] << " to " << hpar->etaMax[1]; for (int eta = hpar->etaMin[1]; eta <= hpar->etaMax[1]; eta++) { int dmin = (eta == hpar->etaMin[1]) ? getDepthEta16(2, iphi, -zside) : 1; int dmax = getMaxDepth(2, eta, iphi, -zside, false); diff --git a/Geometry/HcalCommonData/src/HcalNumberingFromDDD.cc b/Geometry/HcalCommonData/src/HcalNumberingFromDDD.cc index c28915d897cf7..b047c97ba0ecd 100644 --- a/Geometry/HcalCommonData/src/HcalNumberingFromDDD.cc +++ b/Geometry/HcalCommonData/src/HcalNumberingFromDDD.cc @@ -17,13 +17,13 @@ using namespace geant_units::operators; HcalNumberingFromDDD::HcalNumberingFromDDD(const HcalDDDSimConstants* hcons) : hcalConstants(hcons) { #ifdef EDM_ML_DEBUG - edm::LogInfo("HCalGeom") << "Creating HcalNumberingFromDDD\n"; + edm::LogVerbatim("HCalGeom") << "Creating HcalNumberingFromDDD"; #endif } HcalNumberingFromDDD::~HcalNumberingFromDDD() { #ifdef EDM_ML_DEBUG - edm::LogInfo("HCalGeom") << "Deleting HcalNumberingFromDDD\n"; + edm::LogVerbatim("HCalGeom") << "Deleting HcalNumberingFromDDD"; #endif } @@ -86,7 +86,7 @@ HcalNumberingFromDDD::HcalID HcalNumberingFromDDD::unitID(int det, double etaR, #ifdef EDM_ML_DEBUG edm::LogVerbatim("HCalGeom") << "HcalNumberingFromDDD: etaR = " << etaR << " : " << zside << "/" << ieta << " phi " - << hphi << " : " << iphi << std::endl; + << hphi << " : " << iphi; #endif return unitID(det, zside, depth, ieta, iphi, lay); } @@ -99,6 +99,9 @@ HcalNumberingFromDDD::HcalID HcalNumberingFromDDD::unitID( int units = hcalConstants->unitPhi(det, etaR); int iphi_skip = hcalConstants->phiNumber(phi, units); + if ((lay == 1) && (etaR == 16)) + etaR = 15; + std::pair etaDepth = hcalConstants->getEtaDepth(det, etaR, iphi_skip, zside, depth, lay); #ifdef EDM_ML_DEBUG diff --git a/Geometry/HcalCommonData/src/HcalSimulationConstants.cc b/Geometry/HcalCommonData/src/HcalSimulationConstants.cc index 3d978a46ab8e2..9ca8a76241f3c 100644 --- a/Geometry/HcalCommonData/src/HcalSimulationConstants.cc +++ b/Geometry/HcalCommonData/src/HcalSimulationConstants.cc @@ -6,13 +6,13 @@ HcalSimulationConstants::HcalSimulationConstants(const HcalSimulationParameters* hsp) : hspar_(hsp) { #ifdef EDM_ML_DEBUG - edm::LogInfo("HCalGeom") - << "HcalSimulationConstants::HcalSimulationConstants (const HcalSimulationParameters* hsp) constructor\n"; + edm::LogVerbatim("HCalGeom") + << "HcalSimulationConstants::HcalSimulationConstants (const HcalSimulationParameters* hsp) constructor"; #endif } HcalSimulationConstants::~HcalSimulationConstants() { #ifdef EDM_ML_DEBUG - edm::LogInfo("HCalGeom") << "HcalSimulationConstants::destructed!!!\n"; + edm::LogVerbatim("HCalGeom") << "HcalSimulationConstants::destructed!!!"; #endif } diff --git a/SimG4CMS/Calo/interface/HCalSD.h b/SimG4CMS/Calo/interface/HCalSD.h index 778a9f37dfd46..b8558e0764c11 100644 --- a/SimG4CMS/Calo/interface/HCalSD.h +++ b/SimG4CMS/Calo/interface/HCalSD.h @@ -83,6 +83,7 @@ class HCalSD : public CaloSD, public Observer { void plotProfile(const G4Step* step, const G4ThreeVector& pos, double edep, double time, int id); void plotHF(const G4ThreeVector& pos, bool emType); void modifyDepth(HcalNumberingFromDDD::HcalID& id); + void printVolume(const G4VTouchable* touch) const; std::unique_ptr numberingFromDDD; std::unique_ptr numberingScheme; diff --git a/SimG4CMS/Calo/src/HCalSD.cc b/SimG4CMS/Calo/src/HCalSD.cc index aed5cad4c1ccf..7bfb6ae9ad1e5 100644 --- a/SimG4CMS/Calo/src/HCalSD.cc +++ b/SimG4CMS/Calo/src/HCalSD.cc @@ -539,7 +539,28 @@ uint32_t HCalSD::setDetUnitId(const G4Step* aStep) { int lay = (touch->GetReplicaNumber(0) / 10) % 100 + 1; int det = (touch->GetReplicaNumber(1)) / 1000; - return setDetUnitId(det, hitPoint, depth, lay); + uint32_t idx = setDetUnitId(det, hitPoint, depth, lay); +#ifdef EDM_ML_DEBUG + if (depth == 1) { + edm::LogVerbatim("HcalSim") << "HCalSD: Check for " << det << ":" << depth << ":" << lay << " ID " << std::hex + << idx << std::dec; + int det0, z0, depth0, eta0, phi0, lay0(-1); + if (testNumber) { + HcalTestNumbering::unpackHcalIndex(idx, det0, z0, depth0, eta0, phi0, lay0); + } else { + HcalDetId hcid0(idx); + det0 = hcid0.subdetId(); + eta0 = hcid0.ietaAbs(); + phi0 = hcid0.iphi(); + z0 = hcid0.zside(); + depth0 = hcid0.depth(); + } + edm::LogVerbatim("HcalSim") << "HCalSD: det|z|depth|eta|phi|lay " << det0 << ":" << z0 << ":" << depth0 << ":" + << eta0 << ":" << phi0 << ":" << lay0; + printVolume(touch); + } +#endif + return idx; } void HCalSD::setNumberingScheme(HcalNumberingScheme* scheme) { @@ -1096,3 +1117,21 @@ void HCalSD::endEvent() { << detNull_[3] << " " << (static_cast(sum) / (sum + detNull_[3])); #endif } + +void HCalSD::printVolume(const G4VTouchable* touch) const { + if (touch) { +#ifdef EDM_ML_DEBUG + int level = ((touch->GetHistoryDepth()) + 1); + edm::LogVerbatim("CaloSimX") << "HCalSD::printVolume with " << level << " levels"; + static const std::string unknown("Unknown"); + //Get name and copy numbers + for (int ii = 0; ii < level; ii++) { + int i = level - ii - 1; + G4VPhysicalVolume* pv = touch->GetVolume(i); + G4String name = (pv != nullptr) ? pv->GetName() : unknown; + G4int copyno = touch->GetReplicaNumber(i); + edm::LogVerbatim("HcalSim") << "[" << ii << "] " << name << ":" << copyno; + } +#endif + } +} diff --git a/SimG4CMS/Calo/test/python/ttbar.py b/SimG4CMS/Calo/test/python/ttbar.py index 247f179266c46..09cc43c67d691 100644 --- a/SimG4CMS/Calo/test/python/ttbar.py +++ b/SimG4CMS/Calo/test/python/ttbar.py @@ -122,8 +122,8 @@ process.generator.pythiaHepMCVerbosity = False process.generator.pythiaPylistVerbosity = 0 process.g4SimHits.Physics.type = 'SimG4Core/Physics/FTFP_BERT_EMM' -process.g4SimHits.HCalSD.TestNumberingScheme = False -process.CaloSimHitStudy.TestNumbering = False +#process.g4SimHits.HCalSD.TestNumberingScheme = False +process.CaloSimHitStudy.TestNumbering = True # Schedule definition process.schedule = cms.Schedule(process.generation_step,