diff --git a/Geometry/HcalCommonData/interface/HcalDDDSimConstants.h b/Geometry/HcalCommonData/interface/HcalDDDSimConstants.h index db8a41bd30273..7f3b078fd59f0 100644 --- a/Geometry/HcalCommonData/interface/HcalDDDSimConstants.h +++ b/Geometry/HcalCommonData/interface/HcalDDDSimConstants.h @@ -39,12 +39,13 @@ class HcalDDDSimConstants { int getDepthEta16M(const int& det) const; int getDepthEta29(const int& phi, const int& zside, const int& i) const; int getDepthEta29M(const int& i, const bool& planOne) const; - std::pair getDetEta(const double& eta, const int& depth); - int getEta(const int& det, const int& lay, const double& hetaR); - std::pair getEtaDepth(const int& det, int etaR, const int& phi, - const int& zside, int depth, const int& lay); - double getEtaHO(const double& etaR, const double& x, const double& y, - const double& z) const; + std::pair getDetEta(const double& eta, const int& depth) const; + int getEta(const int& det, const int& lay, const double& hetaR) const; + std::pair getEtaDepth(const int& det, int etaR, + const int& phi, const int& zside, + int depth, const int& lay) const; + double getEtaHO(const double& etaR, const double& x, + const double& y, const double& z) const; std::pair getiEtaRange(const int& i) const {return std::pair(hpar->etaMin[i],hpar->etaMax[i]);} const std::vector & getEtaTableHF() const {return hpar->etaTableHF;} const std::vector & getGparHF() const {return hpar->gparHF;} diff --git a/Geometry/HcalCommonData/interface/HcalNumberingFromDDD.h b/Geometry/HcalCommonData/interface/HcalNumberingFromDDD.h index 4be86a1342647..f64b1f4a52424 100644 --- a/Geometry/HcalCommonData/interface/HcalNumberingFromDDD.h +++ b/Geometry/HcalCommonData/interface/HcalNumberingFromDDD.h @@ -17,7 +17,7 @@ class HcalNumberingFromDDD { public: - HcalNumberingFromDDD(HcalDDDSimConstants * hcons); + HcalNumberingFromDDD(const HcalDDDSimConstants * hcons); ~HcalNumberingFromDDD(); struct HcalID { @@ -35,7 +35,7 @@ class HcalNumberingFromDDD { private: - HcalDDDSimConstants *hcalConstants; + const HcalDDDSimConstants *hcalConstants; }; #endif diff --git a/Geometry/HcalCommonData/src/HcalDDDSimConstants.cc b/Geometry/HcalCommonData/src/HcalDDDSimConstants.cc index 76c6bf4c9cb49..90c2f126eefd1 100644 --- a/Geometry/HcalCommonData/src/HcalDDDSimConstants.cc +++ b/Geometry/HcalCommonData/src/HcalDDDSimConstants.cc @@ -207,7 +207,7 @@ int HcalDDDSimConstants::getDepthEta29M(const int& i, } std::pair HcalDDDSimConstants::getDetEta(const double& eta, - const int& depth) { + const int& depth) const { int hsubdet(0), ieta(0); double etaR(0); @@ -232,7 +232,7 @@ std::pair HcalDDDSimConstants::getDetEta(const double& eta, } int HcalDDDSimConstants::getEta(const int& det, const int& lay, - const double& hetaR) { + const double& hetaR) const { int ieta(0); if (det == static_cast(HcalForward)) { // Forward HCal @@ -256,8 +256,10 @@ int HcalDDDSimConstants::getEta(const int& det, const int& lay, } std::pair HcalDDDSimConstants::getEtaDepth(const int& det, int etaR, - const int& phi, const int& zside, - int depth, const int& lay) { + const int& phi, + const int& zside, + int depth, + const int& lay) const { #ifdef EDM_ML_DEBUG edm::LogVerbatim("HcalGeom") << "HcalDDDEsimConstants:getEtaDepth: I/P " diff --git a/Geometry/HcalCommonData/src/HcalNumberingFromDDD.cc b/Geometry/HcalCommonData/src/HcalNumberingFromDDD.cc index d0ffca25d41fc..e2eda949eb1dd 100644 --- a/Geometry/HcalCommonData/src/HcalNumberingFromDDD.cc +++ b/Geometry/HcalCommonData/src/HcalNumberingFromDDD.cc @@ -14,7 +14,7 @@ //#define EDM_ML_DEBUG -HcalNumberingFromDDD::HcalNumberingFromDDD(HcalDDDSimConstants *hcons) : +HcalNumberingFromDDD::HcalNumberingFromDDD(const HcalDDDSimConstants *hcons) : hcalConstants(hcons) { #ifdef EDM_ML_DEBUG edm::LogInfo("HCalGeom") << "Creating HcalNumberingFromDDD\n"; diff --git a/SimG4CMS/Calo/interface/HCalSD.h b/SimG4CMS/Calo/interface/HCalSD.h index 413c4362b19b0..304ce61343258 100644 --- a/SimG4CMS/Calo/interface/HCalSD.h +++ b/SimG4CMS/Calo/interface/HCalSD.h @@ -38,7 +38,8 @@ class HCalSD : public CaloSD, public Observer { public: - HCalSD(const std::string& , const DDCompactView &, const SensitiveDetectorCatalog &, + HCalSD(const std::string& , const DDCompactView &, + const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager*); ~HCalSD() override = default; uint32_t setDetUnitId(const G4Step* step) override; @@ -94,7 +95,7 @@ class HCalSD : public CaloSD, public Observer { std::unique_ptr showerPMT; std::unique_ptr showerBundle; - HcalDDDSimConstants* hcalConstants; + const HcalDDDSimConstants* hcalConstants; const HBHEDarkening* m_HBDarkening; const HBHEDarkening* m_HEDarkening; std::unique_ptr m_HFDarkening; diff --git a/SimG4CMS/Calo/interface/HcalTestAnalysis.h b/SimG4CMS/Calo/interface/HcalTestAnalysis.h index f04b3d9a788fc..65cf986f0a2c3 100644 --- a/SimG4CMS/Calo/interface/HcalTestAnalysis.h +++ b/SimG4CMS/Calo/interface/HcalTestAnalysis.h @@ -62,36 +62,36 @@ class HcalTestAnalysis : public SimWatcher, private: //Keep parameters to instantiate HcalTestHistoClass later - std::string fileName; + std::string fileName_; // Qie Analysis - HcalQie * myqie; - int addTower; + std::unique_ptr myqie_; + int addTower_; // Private Tuples - std::unique_ptr tuplesManager; - HcalTestHistoClass *tuples; + std::unique_ptr tuplesManager_; + HcalTestHistoClass* tuples_; // Numbering scheme - HcalNumberingFromDDD *numberingFromDDD; - HcalDDDSimConstants *hcons; - HcalTestNumberingScheme *org; + std::unique_ptr numberingFromDDD_; + const HcalDDDSimConstants* hcons_; + HcalTestNumberingScheme* org_; // Hits for qie analysis - std::vector caloHitCache; - std::vector group_, tower_; - int nGroup, nTower; + std::vector caloHitCache; + std::vector group_, tower_; + int nGroup, nTower; // to read from ParameterSet - std::vector names; - double eta0, phi0; - int centralTower; + std::vector names_; + double eta0_, phi0_; + int centralTower_; // some private members for ananlysis - unsigned int count; - double edepEB, edepEE, edepHB, edepHE, edepHO; - double edepl[20]; - double mudist[20]; // Distance of muon from central part + unsigned int count; + double edepEB, edepEE, edepHB, edepHE; + double edepHO, edepl[20]; + double mudist[20]; // Distance of muon from central part }; #endif diff --git a/SimG4CMS/Calo/interface/HcalTestNS.h b/SimG4CMS/Calo/interface/HcalTestNS.h index f6bf9d8ef7bb0..1c10dd597f451 100644 --- a/SimG4CMS/Calo/interface/HcalTestNS.h +++ b/SimG4CMS/Calo/interface/HcalTestNS.h @@ -16,7 +16,7 @@ class HcalTestNS { private: - HcalDDDRecConstants* hcons_; + const HcalDDDRecConstants* hcons_; }; diff --git a/SimG4CMS/Calo/src/CaloSD.cc b/SimG4CMS/Calo/src/CaloSD.cc index fb22c00fed8f4..5196c7626b714 100644 --- a/SimG4CMS/Calo/src/CaloSD.cc +++ b/SimG4CMS/Calo/src/CaloSD.cc @@ -142,16 +142,16 @@ G4bool CaloSD::ProcessHits(G4Step * aStep, G4TouchableHistory * ) { currentID.setID(unitID, time, primaryID, depth); } else { if(aStep->GetTotalEnergyDeposit() > 0.0) { - G4TouchableHistory* touch =(G4TouchableHistory*)(theTrack->GetTouchable()); + const G4TouchableHistory* touch = static_cast(theTrack->GetTouchable()); edm::LogInfo("CaloSim") << "CaloSD::ProcessHits: unitID= " << unitID - << " currUnit= " << currentID.unitID() - << " Detector: " << GetName() - << " trackID= " << theTrack->GetTrackID() - << " " << theTrack->GetDefinition()->GetParticleName() - << "\n Edep= " << aStep->GetTotalEnergyDeposit() - << " PV: " << touch->GetVolume(0)->GetName() - << " PVid= " << touch->GetReplicaNumber(0) - << " MVid= " << touch->GetReplicaNumber(1); + << " currUnit= " << currentID.unitID() + << " Detector: " << GetName() + << " trackID= " << theTrack->GetTrackID() << " " + << theTrack->GetDefinition()->GetParticleName() + << "\n Edep= " << aStep->GetTotalEnergyDeposit() + << " PV: " << touch->GetVolume(0)->GetName() + << " PVid= " << touch->GetReplicaNumber(0) + << " MVid= " << touch->GetReplicaNumber(1); } return false; } diff --git a/SimG4CMS/Calo/src/HCalSD.cc b/SimG4CMS/Calo/src/HCalSD.cc index ece33407c33b3..b6309f4452496 100644 --- a/SimG4CMS/Calo/src/HCalSD.cc +++ b/SimG4CMS/Calo/src/HCalSD.cc @@ -98,11 +98,11 @@ HCalSD::HCalSD(const std::string& name, const DDCompactView & cpv, applyFidCut = m_HF.getParameter("ApplyFiducialCut"); #ifdef EDM_ML_DEBUG - LogDebug("HcalSim") << "***************************************************" - << "\n" - << "* Constructing a HCalSD with name " << name << "\n" - << "\n" - << "***************************************************"; + edm::LogVerbatim("HcalSim") << "***************************************************" + << "\n" + << "* Constructing a HCalSD with name " << name << "\n" + << "\n" + << "***************************************************"; #endif edm::LogInfo("HcalSim") << "HCalSD:: Use of HF code is set to " << useHF << "\nUse of shower parametrization set to " @@ -337,9 +337,9 @@ bool HCalSD::getFromLibrary(const G4Step * aStep) { } } #ifdef EDM_ML_DEBUG - edm::LogInfo("HcalSim") << "HCalSD::getFromLibrary: HFLumiDarkening at r= " - << r << ", z= " << z << " Dose= " << dose_acquired - << " weight= " << weight_; + edm::LogInfo("HcalSim") << "HCalSD::getFromLibrary: HFLumiDarkening at " + << "r= " << r << ", z= " << z << " Dose= " + << dose_acquired << " weight= " << weight_; #endif } @@ -347,11 +347,12 @@ bool HCalSD::getFromLibrary(const G4Step * aStep) { getFromParam(aStep, kill); #ifdef EDM_ML_DEBUG G4String nameVolume = lv->GetName(); - LogDebug("HcalSim") << "HCalSD: " << getNumberOfHits() - << " hits from parametrization in " << nameVolume - << " for Track " << track->GetTrackID() - <<" (" << track->GetDefinition()->GetParticleName() - <<")"; + edm::LogVerbatim("HcalSim") << "HCalSD: " << getNumberOfHits() + << " hits from parametrization in " + << nameVolume << " for Track " + << track->GetTrackID() <<" (" + << track->GetDefinition()->GetParticleName() + <<")"; #endif } else if (useShowerLibrary && !G4TrackToParticleID::isMuon(track)) { if(G4TrackToParticleID::isGammaElectronPositron(track) || @@ -362,7 +363,8 @@ bool HCalSD::getFromLibrary(const G4Step * aStep) { edm::LogInfo("HcalSim") << "HCalSD: Starts shower library from " << nameVolume << " for Track " << track->GetTrackID() << " (" - << track->GetDefinition()->GetParticleName() << ")"; + << track->GetDefinition()->GetParticleName() + << ")"; #endif getFromHFLibrary(aStep, kill); @@ -387,9 +389,11 @@ double HCalSD::getEnergyDeposit(const G4Step* aStep) { if(isHF) { if (useShowerLibrary && G4TrackToParticleID::isMuon(theTrack) && isItFibre(lv)) { #ifdef EDM_ML_DEBUG - edm::LogInfo("HcalSim") << "HCalSD: Hit at Fibre in LV " << lv->GetName() - << " for track " << aStep->GetTrack()->GetTrackID() <<" (" - << aStep->GetTrack()->GetDefinition()->GetParticleName() << ")"; + edm::LogInfo("HcalSim") << "HCalSD: Hit at Fibre in LV " << lv->GetName() + << " for track " + << aStep->GetTrack()->GetTrackID() <<" (" + << aStep->GetTrack()->GetDefinition()->GetParticleName() + << ")"; #endif hitForFibre(aStep); } @@ -402,7 +406,8 @@ double HCalSD::getEnergyDeposit(const G4Step* aStep) { edm::LogInfo("HcalSim") << "HCalSD: Hit from PMT parametrization in LV " << lv->GetName() << " for Track " << aStep->GetTrack()->GetTrackID() << " (" - << aStep->GetTrack()->GetDefinition()->GetParticleName() << ")"; + << aStep->GetTrack()->GetDefinition()->GetParticleName() + << ")"; #endif return destep; @@ -412,7 +417,8 @@ double HCalSD::getEnergyDeposit(const G4Step* aStep) { edm::LogInfo("HcalSim") << "HCalSD: Hit from straight FibreBundle in LV: " << lv->GetName() << " for track " << aStep->GetTrack()->GetTrackID() << " (" - << aStep->GetTrack()->GetDefinition()->GetParticleName() << ")"; + << aStep->GetTrack()->GetDefinition()->GetParticleName() + << ")"; #endif return destep; @@ -422,7 +428,8 @@ double HCalSD::getEnergyDeposit(const G4Step* aStep) { edm::LogInfo("HcalSim") << "HCalSD: Hit from conical FibreBundle PV: " << lv->GetName() << " for track " << aStep->GetTrack()->GetTrackID() << " (" - << aStep->GetTrack()->GetDefinition()->GetParticleName() << ")"; + << aStep->GetTrack()->GetDefinition()->GetParticleName() + << ")"; #endif return destep; } @@ -461,7 +468,8 @@ double HCalSD::getEnergyDeposit(const G4Step* aStep) { weight_ *= dweight; #ifdef EDM_ML_DEBUG edm::LogInfo("HcalSim") << "HCalSD: HB Lumi: " << deliveredLumi - << " coefficient = " << dweight << " Weight= " << weight_; + << " coefficient = " << dweight << " Weight= " + << weight_; #endif } @@ -470,7 +478,8 @@ double HCalSD::getEnergyDeposit(const G4Step* aStep) { weight_ *= dweight; #ifdef EDM_ML_DEBUG edm::LogInfo("HcalSim") << "HCalSD: HB Lumi: " << deliveredLumi - << " coefficient = " << dweight << " Weight= " << weight_; + << " coefficient = " << dweight << " Weight= " + << weight_; #endif } @@ -518,7 +527,8 @@ uint32_t HCalSD::setDetUnitId(const G4Step * aStep) { void HCalSD::setNumberingScheme(HcalNumberingScheme * scheme) { if (scheme != nullptr) { - edm::LogInfo("HcalSim") << "HCalSD: updates numbering scheme for " << GetName(); + edm::LogInfo("HcalSim") << "HCalSD: updates numbering scheme for " + << GetName(); numberingScheme.reset(scheme); } } @@ -529,7 +539,7 @@ void HCalSD::update(const BeginOfJob * job) { edm::ESHandle hdc; es->get().get(hdc); if (hdc.isValid()) { - hcalConstants = (HcalDDDSimConstants*)(&(*hdc)); + hcalConstants = hdc.product(); } else { edm::LogError("HcalSim") << "HCalSD : Cannot find HcalDDDSimConstant"; throw cms::Exception("Unknown", "HCalSD") << "Cannot find HcalDDDSimConstant" << "\n"; @@ -543,7 +553,8 @@ void HCalSD::update(const BeginOfJob * job) { for (unsigned int ig=0; iggetMaxDepth(2) + edm::LogInfo("HcalSim") << "Maximum depth for HF " + << hcalConstants->getMaxDepth(2) << gpar.size()<< " gpar (cm)" << sss.str(); //Test Hcal Numbering Scheme if (testNS_) m_HcalTestNS.reset(new HcalTestNS(es)); @@ -615,12 +626,12 @@ uint32_t HCalSD::setDetUnitId (HcalNumberingFromDDD::HcalID& tmp) { std::vector HCalSD::getDDDArray(const std::string & str, const DDsvalues_type & sv) { #ifdef EDM_ML_DEBUG - LogDebug("HcalSim") << "HCalSD:getDDDArray called for " << str; + edm::LogVerbatim("HcalSim") << "HCalSD:getDDDArray called for " << str; #endif DDValue value(str); if (DDfetch(&sv,value)) { #ifdef EDM_ML_DEBUG - LogDebug("HcalSim") << value; + edm::LogVerbatim("HcalSim") << value; #endif const std::vector & fvec = value.doubles(); int nval = fvec.size(); @@ -886,7 +897,7 @@ void HCalSD::getHitPMT (const G4Step * aStep) { #endif #ifdef EDM_ML_DEBUG double beta = preStepPoint->GetBeta(); - LogDebug("HcalSim") << "HCalSD::getHitPMT 1 hit for " << GetName() + edm::LogVerbatim("HcalSim") << "HCalSD::getHitPMT 1 hit for " << GetName() << " of " << primaryID << " with " << theTrack->GetDefinition()->GetParticleName() << " of " << preStepPoint->GetKineticEnergy()/GeV @@ -927,8 +938,9 @@ void HCalSD::getHitFibreBundle (const G4Step* aStep, bool type) { } if (hitPoint.z() < 0.) etaR =-etaR; #ifdef EDM_ML_DEBUG - LogDebug("HcalSim") << "HCalSD::Hit for Detector " << det << " etaR " - << etaR << " phi " << phi/deg << " depth " <GetPostStepPoint()->GetGlobalTime()); uint32_t unitID = 0; @@ -946,12 +958,12 @@ void HCalSD::getHitFibreBundle (const G4Step* aStep, bool type) { #endif #ifdef EDM_ML_DEBUG double beta = preStepPoint->GetBeta(); - LogDebug("HcalSim") << "HCalSD::getHitFibreBundle 1 hit for " << GetName() - << " of " << primaryID << " with " - << theTrack->GetDefinition()->GetParticleName() - << " of " << preStepPoint->GetKineticEnergy()/GeV - << " GeV with velocity " << beta << " UnitID " - << std::hex << unitID << std::dec; + edm::LogVerbatim("HcalSim") << "HCalSD::getHitFibreBundle 1 hit for " + << GetName() << " of " << primaryID << " with " + << theTrack->GetDefinition()->GetParticleName() + << " of " << preStepPoint->GetKineticEnergy()/GeV + << " GeV with velocity " << beta << " UnitID " + << std::hex << unitID << std::dec; #endif processHit(aStep); } // non-zero energy deposit @@ -1018,7 +1030,8 @@ void HCalSD::plotProfile(const G4Step* aStep,const G4ThreeVector& global, double for (int n=0; nGetHistoryDepth(); ++n) { G4String name = touch->GetVolume(n)->GetName(); #ifdef EDM_ML_DEBUG - LogDebug("HcalSim") << "plotProfile Depth " << n << " Name " << name; + edm::LogVerbatim("HcalSim") << "plotProfile Depth " << n << " Name " + << name; #endif for (unsigned int ii=0; ii<8; ++ii) { if (name == modName[ii]) { @@ -1036,9 +1049,10 @@ void HCalSD::plotProfile(const G4Step* aStep,const G4ThreeVector& global, double } if (!found) depth = std::abs(global.z()) - 11500; #ifdef EDM_ML_DEBUG - LogDebug("HcalSim") << "plotProfile Found " << found << " Global " << global - << " Local " << local << " depth " << depth << " ID " - << id << " EDEP " << edep << " Time " << time; + edm::LogVerbatim("HcalSim") << "plotProfile Found " << found << " Global " + << global << " Local " << local << " depth " + << depth << " ID " << id << " EDEP " << edep + << " Time " << time; #endif if (hit_[idx] != nullptr) hit_[idx]->Fill(edep); if (time_[idx] != nullptr) time_[idx]->Fill(time,edep); diff --git a/SimG4CMS/Calo/src/HFFibreFiducial.cc b/SimG4CMS/Calo/src/HFFibreFiducial.cc index 67ff43d0f0181..64d7ba6f3a278 100644 --- a/SimG4CMS/Calo/src/HFFibreFiducial.cc +++ b/SimG4CMS/Calo/src/HFFibreFiducial.cc @@ -6,8 +6,6 @@ #include -//#define DebugLog - int HFFibreFiducial::PMTNumber(const G4ThreeVector& pe_effect) { double xv = pe_effect.x(); // X in global system @@ -17,10 +15,8 @@ int HFFibreFiducial::PMTNumber(const G4ThreeVector& pe_effect) double dph = CLHEP::pi/18; // 10 deg = a half sector width double sph = dph+dph; // 20 deg = a sector width int nphi = phi/dph; // 10 deg sector # -#ifdef DebugLog - edm::LogInfo("HFShower") <<"HFFibreFiducial:***> P = " << pe_effect - << ", phi = " << phi/CLHEP::deg; -#endif + edm::LogVerbatim("HFShower") <<"HFFibreFiducial:***> P = " << pe_effect + << ", phi = " << phi/CLHEP::deg; if (nphi > 35) nphi=35; // Just for security double xl=0.; // local sector coordinates (left/right) double yl=0.; // local sector coordinates (down/up) @@ -49,42 +45,35 @@ int HFFibreFiducial::PMTNumber(const G4ThreeVector& pe_effect) double sinr= sin(phir); yl= xv*cosr+yv*sinr; xl= yv*cosr-xv*sinr; -#ifdef DebugLog - edm::LogInfo("HFShower") << "HFFibreFiducial: nr " << nr << " phi " << phir/CLHEP::deg; -#endif + edm::LogVerbatim("HFShower") << "HFFibreFiducial: nr " << nr << " phi " + << phir/CLHEP::deg; } if (yl < 0) yl =-yl; -#ifdef DebugLog - edm::LogInfo("HFShower") << "HFFibreFiducial: Global Point " << pe_effect - << " nphi " << nphi << " Local Sector Coordinates (" - << xl << ", " << yl << "), widget # " << nwid; -#endif + edm::LogVerbatim("HFShower") << "HFFibreFiducial: Global Point " << pe_effect + << " nphi " << nphi + << " Local Sector Coordinates (" + << xl << ", " << yl << "), widget # " << nwid; // Provides a PMT # for the (x,y) hit in the widget # nwid (M. Kosov, 11.2010) // Send comments/questions to Mikhail.Kossov@cern.ch // nwid = 1-18 for Forward HF, 19-36 for Backward HF (all equal now) // npmt = 0 for No Hit, 1-24 for H(Long) PMT, 25-48 for E(Short) PMT, negative for souces static const int nWidM=36; - if (nwid > nWidM || nwid <= 0) - { -#ifdef DebugLog - edm::LogInfo("HFShower") << "-Warning-HFFibreFiducial::PMTNumber: " - << nwid << " == wrong widget number"; -#endif + if (nwid > nWidM || nwid <= 0) { + edm::LogVerbatim("HFShower") << "-Warning-HFFibreFiducial::PMTNumber: " + << nwid << " == wrong widget number"; return 0; } static const double yMin= 13.1*CLHEP::cm; // start of the active area (Conv to mm?) static const double yMax=129.6*CLHEP::cm; // finish of the active area (Conv to mm?) - if( yl < yMin || yl >= yMax ) - { -#ifdef DebugLog - edm::LogInfo("HFShower") << "-Warning-HFFibreFiducial::PMTNumber: Point " - << "with y = " << yl << " outside acceptance [" - << yMin << ":" << yMax << "], X = " << xv - << ", Y = " << yv << ", x = " << xl << ", nW = " - << nwid << ", phi = " << phi/CLHEP::deg - << ", phir = " << phir/CLHEP::deg; -#endif + if( yl < yMin || yl >= yMax ) { + edm::LogVerbatim("HFShower") << "-Warning-HFFibreFiducial::PMTNumber: " + << "Point with y = " << yl + << " outside acceptance [" << yMin << ":" + << yMax << "], X = " << xv << ", Y = " + << yv << ", x = " << xl << ", nW = " + << nwid << ", phi = " << phi/CLHEP::deg + << ", phir = " << phir/CLHEP::deg; return 0; // ===> out of the acceptance } bool left=true; // flag of the left part of the widget @@ -95,13 +84,11 @@ int HFFibreFiducial::PMTNumber(const G4ThreeVector& pe_effect) left=false; } static const double tg10=.17632698070847; // phi-angular acceptance of the widget - if (r > tg10) - { -#ifdef DebugLog - edm::LogInfo("HFShower") << "-Warning-HFFibreFiducial::PMTNumber: (x = " - << xl << ", y = " << yl << ", tg = " << r - << ") out of the widget acceptance tg(10) " << tg10; -#endif + if (r > tg10) { + edm::LogVerbatim("HFShower") <<"-Warning-HFFibreFiducial::PMTNumber: (x = " + << xl << ", y = " << yl << ", tg = " << r + << ") out of the widget acceptance tg(10) " + << tg10; return 0; } @@ -1523,33 +1510,26 @@ int HFFibreFiducial::PMTNumber(const G4ThreeVector& pe_effect) xl=-xl; double fx=xl/cellSize; int ny=static_cast((yl-yMin)/cellSize); // Layer number (starting from 0) - if (ny < 0 || ny >= nLay) // Sould never happen as was checked beforehand - { -#ifdef DebugLog - edm::LogInfo("HFShower") << "-Warning-HFFibreFiducial::PMTNumber: " - << "check limits y = " << yl << ", nL=" << nLay; -#endif + if (ny < 0 || ny >= nLay) {// Sould never happen as was checked beforehand + edm::LogVerbatim("HFShower") << "-Warning-HFFibreFiducial::PMTNumber: " + << "check limits y = " << yl << ", nL=" + << nLay; return 0; } int nx=static_cast(fx); // Cell number (starting from 0) -#ifdef DebugLog - double phis=atan2(xl, yl)/CLHEP::deg; - double zv = pe_effect.z(); // Z in global system - edm::LogInfo("HFShower") << "HFFibreFiducial::PMTNumber:X = " << xv - << ", Y = " << yv << ", Z = " << zv << ", fX = " - << fx << "-> nX = " << nx << ", nY = " << ny - << ", mX = " << nSL[ny] << ", x = " << xl << ", y = " - << yl << ", s = " << cellSize << ", nW = " - << nwid << ", phi = " << phi/CLHEP::deg - << ", phis = " << phis << ", phir = " - << phir/CLHEP::deg; -#endif - if (nx >= nSL[ny]) - { -#ifdef DebugLog - edm::LogInfo("HFShower") << "HFFibreFiducial::nx/ny (" << nx - << "," << ny <<") " << " above limit " << nSL[ny]; -#endif + edm::LogVerbatim("HFShower") << "HFFibreFiducial::PMTNumber:X = " << xv + << ", Y = " << yv << ", Z = " << pe_effect.z() + << ", fX = " << fx << "-> nX = " << nx + << ", nY = " << ny << ", mX = " << nSL[ny] + << ", x = " << xl << ", y = "<< yl << ", s = " + << cellSize << ", nW = " << nwid << ", phi = " + << phi/CLHEP::deg << ", phis = " + << atan2(xl, yl)/CLHEP::deg + << ", phir = " << phir/CLHEP::deg; + if (nx >= nSL[ny]) { + edm::LogVerbatim("HFShower") << "HFFibreFiducial::nx/ny (" << nx + << "," << ny <<") " << " above limit " + << nSL[ny]; return 0; // ===> out of the acceptance } int code=0; // a prototype @@ -1558,21 +1538,17 @@ int HFFibreFiducial::PMTNumber(const G4ThreeVector& pe_effect) int flag= code%10; int npmt= code/10; bool src= false; // by default: not a source-tube -#ifdef DebugLog - edm::LogInfo("HFShower") << "HFFibreFiducial::nx/ny (" << nx << "," - << ny << ") code/flag/npmt " << code << "/" << flag - << "/" << npmt; -#endif + edm::LogVerbatim("HFShower") << "HFFibreFiducial::nx/ny (" << nx << "," + << ny << ") code/flag/npmt " << code << "/" + << flag << "/" << npmt; if (!flag) return 0; // ===> no fiber in the cell else if (flag==1) npmt += 24; else if (flag==3 || flag==4) { src=true; } -#ifdef DebugLog - edm::LogInfo("HFShower") << "HFFibreFiducial::PMTNumber: src = " << src - << ", npmt =" << npmt; -#endif + edm::LogVerbatim("HFShower") << "HFFibreFiducial::PMTNumber: src = " << src + << ", npmt =" << npmt; if (src) return -npmt; // return the negative number for the source return npmt; } // End of PMTNumber diff --git a/SimG4CMS/Calo/src/HcalTestAnalysis.cc b/SimG4CMS/Calo/src/HcalTestAnalysis.cc index 928afa61679c3..ee5fcd24c4b13 100644 --- a/SimG4CMS/Calo/src/HcalTestAnalysis.cc +++ b/SimG4CMS/Calo/src/HcalTestAnalysis.cc @@ -30,17 +30,18 @@ #include HcalTestAnalysis::HcalTestAnalysis(const edm::ParameterSet &p): - addTower(3),tuples(nullptr),numberingFromDDD(nullptr),hcons(nullptr),org(nullptr) { + addTower_(3),tuples_(nullptr),hcons_(nullptr),org_(nullptr) { edm::ParameterSet m_Anal = p.getParameter("HcalTestAnalysis"); - eta0 = m_Anal.getParameter("Eta0"); - phi0 = m_Anal.getParameter("Phi0"); - int laygroup = m_Anal.getParameter("LayerGrouping"); - centralTower = m_Anal.getParameter("CentralTower"); - names = m_Anal.getParameter >("Names"); - fileName = m_Anal.getParameter("FileName"); - - tuplesManager.reset(nullptr); + eta0_ = m_Anal.getParameter("Eta0"); + phi0_ = m_Anal.getParameter("Phi0"); + int laygroup = m_Anal.getParameter("LayerGrouping"); + centralTower_ = m_Anal.getParameter("CentralTower"); + names_ = m_Anal.getParameter >("Names"); + fileName_ = m_Anal.getParameter("FileName"); + + tuplesManager_.reset(nullptr); + numberingFromDDD_.reset(nullptr); edm::LogInfo("HcalSim") << "HcalTestAnalysis:: Initialised as observer of " << "begin/end events and of G4step"; @@ -49,7 +50,7 @@ HcalTestAnalysis::HcalTestAnalysis(const edm::ParameterSet &p): nGroup = 0; for (unsigned int i=0; inGroup) nGroup = group_[i]; - tower_ = towersToAdd(centralTower, addTower); + tower_ = towersToAdd(centralTower_, addTower_); nTower = tower_.size()/2; edm::LogInfo("HcalSim") << "HcalTestAnalysis:: initialised for " << nGroup @@ -57,23 +58,14 @@ HcalTestAnalysis::HcalTestAnalysis(const edm::ParameterSet &p): << " towers"; // qie - myqie = new HcalQie(p); + myqie_.reset(new HcalQie(p)); } HcalTestAnalysis::~HcalTestAnalysis() { edm::LogInfo("HcalSim") << "HcalTestAnalysis: --------> Total number of " << "selected entries : " << count; - edm::LogInfo("HcalSim") << "HcalTestAnalysis: Pointers:: HcalQie " << myqie - << ", HistoClass " << tuples << ", Numbering Scheme " - << org << " and FromDDD " << numberingFromDDD; - if (myqie) { - edm::LogInfo("HcalSim") << "HcalTestAnalysis: Delete HcalQie"; - delete myqie; - } - if (numberingFromDDD) { - edm::LogInfo("HcalSim") << "HcalTestAnalysis: Delete HcalNumberingFromDDD"; - delete numberingFromDDD; - } + edm::LogInfo("HcalSim") << "HcalTestAnalysis: Pointers:: HistoClass " + << tuples_ << ", Numbering Scheme " << org_; } std::vector HcalTestAnalysis::layerGrouping(int group) { @@ -104,7 +96,7 @@ std::vector HcalTestAnalysis::layerGrouping(int group) { edm::LogInfo("HcalSim") << "HcalTestAnalysis:: Layer Grouping "; for (int i=0; i<19; i++) edm::LogInfo("HcalSim") << "HcalTestAnalysis: Group[" << i << "] = " - << temp[i]; + << temp[i]; return temp; } @@ -155,17 +147,16 @@ void HcalTestAnalysis::update(const BeginOfJob * job) { // Numbering From DDD edm::ESHandle hdc; (*job)()->get().get(hdc); - if(!hcons) { hcons = (HcalDDDSimConstants*)(&(*hdc)); } - //if(!hcons) { hcons = &(*hdc); } + hcons_ = hdc.product(); edm::LogInfo("HcalSim") << "HcalTestAnalysis:: Initialise " - << "HcalNumberingFromDDD for " << names[0]; - numberingFromDDD = new HcalNumberingFromDDD(hcons); + << "HcalNumberingFromDDD for " << names_[0]; + numberingFromDDD_.reset(new HcalNumberingFromDDD(hcons_)); // Ntuples - tuplesManager.reset(new HcalTestHistoManager(fileName)); + tuplesManager_.reset(new HcalTestHistoManager(fileName_)); // Numbering scheme - org = new HcalTestNumberingScheme(false); + org_ = new HcalTestNumberingScheme(false); } @@ -176,22 +167,22 @@ void HcalTestAnalysis::update(const BeginOfRun * run) { edm::LogInfo("HcalSim") << "HcalTestAnalysis:: Begin of Run = " << irun; bool loop = true, eta = true, phi = true; - int etac = (centralTower/100)%100; + int etac = (centralTower_/100)%100; if (etac == 0) { etac = 1; eta = false; } - int phic = (centralTower%100); + int phic = (centralTower_%100); if (phic == 0) { phic = 1; phi = false; } int idet = static_cast(HcalBarrel); while (loop) { - HcalCellType::HcalCell tmp = hcons->cell(idet,1,1,etac,phic); + HcalCellType::HcalCell tmp = hcons_->cell(idet,1,1,etac,phic); if (tmp.ok) { - if (eta) eta0 = tmp.eta; - if (phi) phi0 = tmp.phi; + if (eta) eta0_ = tmp.eta; + if (phi) phi0_ = tmp.phi; loop = false; } else if (idet == static_cast(HcalBarrel)) { idet = static_cast(HcalEndcap); @@ -203,10 +194,10 @@ void HcalTestAnalysis::update(const BeginOfRun * run) { } edm::LogInfo("HcalSim") << "HcalTestAnalysis:: Central Tower " - << centralTower << " corresponds to eta0 = " << eta0 - << " phi0 = " << phi0; + << centralTower_ << " corresponds to eta0 = " + << eta0_ << " phi0 = " << phi0_; - std::string sdname = names[0]; + std::string sdname = names_[0]; G4SDManager* sd = G4SDManager::GetSDMpointerIfExist(); if (sd != nullptr) { G4VSensitiveDetector* aSD = sd->FindSensitiveDetector(sdname); @@ -218,8 +209,8 @@ void HcalTestAnalysis::update(const BeginOfRun * run) { edm::LogInfo("HcalSim") << "HcalTestAnalysis::beginOfRun: Finds SD with " << "name " << theCaloSD->GetName() << " in this Setup"; - if (org) { - theCaloSD->setNumberingScheme(org); + if (org_) { + theCaloSD->setNumberingScheme(org_); edm::LogInfo("HcalSim") << "HcalTestAnalysis::beginOfRun: set a new " << "numbering scheme"; } @@ -235,17 +226,17 @@ void HcalTestAnalysis::update(const BeginOfRun * run) { void HcalTestAnalysis::update(const BeginOfEvent * evt) { // create tuple object - tuples = new HcalTestHistoClass(); + tuples_ = new HcalTestHistoClass(); // Reset counters - tuples->setCounters(); + tuples_->setCounters(); int i = 0; edepEB = edepEE = edepHB = edepHE = edepHO = 0.; for (i = 0; i < 20; i++) edepl[i] = 0.; for (i = 0; i < 20; i++) mudist[i] = -1.; - int iev = (*evt)()->GetEventID(); - LogDebug("HcalSim") <<"HcalTestAnalysis: Begin of event = " << iev; + edm::LogVerbatim("HcalSim") <<"HcalTestAnalysis: Begin of event = " + << (*evt)()->GetEventID(); } //=================================================================== each STEP @@ -301,15 +292,17 @@ void HcalTestAnalysis::update(const G4Step * aStep) { double theta = pos.theta(); double eta = -log(tan(theta * 0.5)); double phi = pos.phi(); - double dist = sqrt ((eta-eta0)*(eta-eta0) + (phi-phi0)*(phi-phi0)); + double dist = sqrt ((eta-eta0_)*(eta-eta0_) + + (phi-phi0_)*(phi-phi0_)); mudist[layer] = dist*std::sqrt(pos.perp2()); } } if (layer >= 0 && layer < 20) { - LogDebug("HcalSim") << "HcalTestAnalysis:: G4Step: " << name << " Layer " - << std::setw(3) << layer << " Edep " << std::setw(6) - << edeposit/MeV << " MeV"; + edm::LogVerbatim("HcalSim") << "HcalTestAnalysis:: G4Step: " << name + << " Layer " << std::setw(3) << layer + << " Edep " << std::setw(6) + << edeposit/MeV << " MeV"; } } else { edm::LogInfo("HcalSim") << "HcalTestAnalysis:: G4Step: Null Step"; @@ -322,29 +315,29 @@ void HcalTestAnalysis::update(const EndOfEvent * evt) { count++; // Fill event input fill(evt); - LogDebug("HcalSim") << "HcalTestAnalysis:: --- after Fill"; + edm::LogVerbatim("HcalSim") << "HcalTestAnalysis:: --- after Fill"; // Qie analysis CLHEP::HepRandomEngine* engine = G4Random::getTheEngine(); qieAnalysis(engine); - LogDebug("HcalSim") << "HcalTestAnalysis:: --- after QieAnalysis"; + edm::LogVerbatim("HcalSim") << "HcalTestAnalysis:: --- after QieAnalysis"; // Layers tuples filling layerAnalysis(); - LogDebug("HcalSim") << "HcalTestAnalysis:: --- after LayerAnalysis"; + edm::LogVerbatim("HcalSim") << "HcalTestAnalysis:: --- after LayerAnalysis"; // Writing the data to the Tree - tuplesManager.get()->fillTree(tuples); // (no need to delete it...) - tuples = nullptr; // but avoid to reuse it... - LogDebug("HcalSim") << "HcalTestAnalysis:: --- after fillTree"; + tuplesManager_.get()->fillTree(tuples_); // (no need to delete it...) + tuples_ = nullptr; // but avoid to reuse it... + edm::LogVerbatim("HcalSim") << "HcalTestAnalysis:: --- after fillTree"; } //--------------------------------------------------- void HcalTestAnalysis::fill(const EndOfEvent * evt) { - LogDebug("HcalSim") << "HcalTestAnalysis: Fill event " - << (*evt)()->GetEventID(); + edm::LogVerbatim("HcalSim") << "HcalTestAnalysis: Fill event " + << (*evt)()->GetEventID(); // access to the G4 hit collections G4HCofThisEvent* allHC = (*evt)()->GetHCofThisEvent(); @@ -353,10 +346,11 @@ void HcalTestAnalysis::fill(const EndOfEvent * evt) { caloHitCache.erase (caloHitCache.begin(), caloHitCache.end()); // Hcal - int HCHCid = G4SDManager::GetSDMpointer()->GetCollectionID(names[0]); + int HCHCid = G4SDManager::GetSDMpointer()->GetCollectionID(names_[0]); CaloG4HitCollection* theHCHC = (CaloG4HitCollection*) allHC->GetHC(HCHCid); - LogDebug("HcalSim") << "HcalTestAnalysis :: Hit Collection for " << names[0] - << " of ID " << HCHCid << " is obtained at " << theHCHC; + edm::LogVerbatim("HcalSim") << "HcalTestAnalysis :: Hit Collection for " + << names_[0] << " of ID " << HCHCid + << " is obtained at " << theHCHC; if (HCHCid >= 0 && theHCHC != nullptr) { for (j = 0; j < theHCHC->entries(); j++) { @@ -372,7 +366,7 @@ void HcalTestAnalysis::fill(const EndOfEvent * evt) { uint32_t unitID = aHit->getUnitID(); int subdet, zside, layer, etaIndex, phiIndex, lay; - org->unpackHcalIndex(unitID,subdet,zside,layer,etaIndex,phiIndex,lay); + org_->unpackHcalIndex(unitID,subdet,zside,layer,etaIndex,phiIndex,lay); double jitter = time-timeOfFlight(subdet,lay,eta); if (jitter<0) jitter = 0; CaloHit hit(subdet,lay,e,eta,phi,jitter,unitID); @@ -390,20 +384,23 @@ void HcalTestAnalysis::fill(const EndOfEvent * evt) { } } - LogDebug("HcalSim") << "HcalTest: " << det << " layer " << std::setw(2) - << layer << " time " << std::setw(6) << time - << " theta " << std::setw(8) << theta << " eta " - << std::setw(8) << eta << " phi " << std::setw(8) - << phi << " e " << std::setw(8) << e; + edm::LogVerbatim("HcalSim") << "HcalTest: " << det << " layer " + << std::setw(2) << layer << " time " + << std::setw(6) << time << " theta " + << std::setw(8) << theta << " eta " + << std::setw(8) << eta << " phi " + << std::setw(8) << phi << " e " + << std::setw(8) << e; } } - LogDebug("HcalSim") << "HcalTestAnalysis::HCAL hits : " << nhc << "\n"; + edm::LogVerbatim("HcalSim") << "HcalTestAnalysis::HCAL hits : " << nhc; // EB - int EBHCid = G4SDManager::GetSDMpointer()->GetCollectionID(names[1]); + int EBHCid = G4SDManager::GetSDMpointer()->GetCollectionID(names_[1]); CaloG4HitCollection* theEBHC = (CaloG4HitCollection*) allHC->GetHC(EBHCid); - LogDebug("HcalSim") << "HcalTestAnalysis :: Hit Collection for " << names[1] - << " of ID " << EBHCid << " is obtained at " << theEBHC; + edm::LogVerbatim("HcalSim") << "HcalTestAnalysis :: Hit Collection for " + << names_[1] << " of ID " << EBHCid + << " is obtained at " << theEBHC; if (EBHCid >= 0 && theEBHC != nullptr) { for (j = 0; j < theEBHC->entries(); j++) { @@ -418,30 +415,33 @@ void HcalTestAnalysis::fill(const EndOfEvent * evt) { double eta = -log(tan(theta/2.)); double phi = pos.phi(); - HcalNumberingFromDDD::HcalID id = numberingFromDDD->unitID(eta,phi,1,1); - uint32_t unitID = org->getUnitID(id); + HcalNumberingFromDDD::HcalID id = numberingFromDDD_->unitID(eta,phi,1,1); + uint32_t unitID = org_->getUnitID(id); int subdet, zside, layer, ieta, iphi, lay; - org->unpackHcalIndex(unitID,subdet,zside,layer,ieta,iphi,lay); + org_->unpackHcalIndex(unitID,subdet,zside,layer,ieta,iphi,lay); subdet = 10; layer = 0; - unitID = org->packHcalIndex(subdet,zside,layer,ieta,iphi,lay); + unitID = org_->packHcalIndex(subdet,zside,layer,ieta,iphi,lay); CaloHit hit(subdet,lay,e,eta,phi,time,unitID); caloHitCache.push_back(hit); neb++; - LogDebug("HcalSim") << "HcalTest: " << det << " layer " << std::setw(2) - << layer << " time " << std::setw(6) << time - << " theta " << std::setw(8) << theta << " eta " - << std::setw(8) << eta << " phi " << std::setw(8) - << phi << " e " << std::setw(8) << e; + edm::LogVerbatim("HcalSim") << "HcalTest: " << det << " layer " + << std::setw(2) << layer << " time " + << std::setw(6) << time << " theta " + << std::setw(8) << theta << " eta " + << std::setw(8) << eta << " phi " + << std::setw(8) << phi << " e " + << std::setw(8) << e; } } - LogDebug("HcalSim") << "HcalTestAnalysis::EB hits : " << neb << "\n"; + edm::LogVerbatim("HcalSim") << "HcalTestAnalysis::EB hits : " << neb; // EE - int EEHCid = G4SDManager::GetSDMpointer()->GetCollectionID(names[2]); + int EEHCid = G4SDManager::GetSDMpointer()->GetCollectionID(names_[2]); CaloG4HitCollection* theEEHC = (CaloG4HitCollection*) allHC->GetHC(EEHCid); - LogDebug("HcalSim") << "HcalTestAnalysis :: Hit Collection for " << names[2] - << " of ID " << EEHCid << " is obtained at " << theEEHC; + edm::LogVerbatim("HcalSim") << "HcalTestAnalysis :: Hit Collection for " + << names_[2] << " of ID " << EEHCid + << " is obtained at " << theEEHC; if (EEHCid >= 0 && theEEHC != nullptr) { for (j = 0; j < theEEHC->entries(); j++) { @@ -456,24 +456,26 @@ void HcalTestAnalysis::fill(const EndOfEvent * evt) { double eta = -log(tan(theta/2.)); double phi = pos.phi(); - HcalNumberingFromDDD::HcalID id = numberingFromDDD->unitID(eta,phi,1,1); - uint32_t unitID = org->getUnitID(id); + HcalNumberingFromDDD::HcalID id = numberingFromDDD_->unitID(eta,phi,1,1); + uint32_t unitID = org_->getUnitID(id); int subdet, zside, layer, ieta, iphi, lay; - org->unpackHcalIndex(unitID,subdet,zside,layer,ieta,iphi,lay); + org_->unpackHcalIndex(unitID,subdet,zside,layer,ieta,iphi,lay); subdet = 11; layer = 0; - unitID = org->packHcalIndex(subdet,zside,layer,ieta,iphi,lay); + unitID = org_->packHcalIndex(subdet,zside,layer,ieta,iphi,lay); CaloHit hit(subdet,lay,e,eta,phi,time,unitID); caloHitCache.push_back(hit); nef++; - LogDebug("HcalSim") << "HcalTest: " << det << " layer " << std::setw(2) - << layer << " time " << std::setw(6) << time - << " theta " << std::setw(8) << theta << " eta " - << std::setw(8) << eta << " phi " << std::setw(8) - << phi << " e " << std::setw(8) << e; + edm::LogVerbatim("HcalSim") << "HcalTest: " << det << " layer " + << std::setw(2) << layer << " time " + << std::setw(6) << time << " theta " + << std::setw(8) << theta << " eta " + << std::setw(8) << eta << " phi " + << std::setw(8) << phi << " e " + << std::setw(8) << e; } } - LogDebug("HcalSim") << "HcalTestAnalysis::EE hits : " << nef << "\n"; + edm::LogVerbatim("HcalSim") << "HcalTestAnalysis::EE hits : " << nef; } //----------------------------------------------------------------------------- @@ -481,13 +483,13 @@ void HcalTestAnalysis::qieAnalysis(CLHEP::HepRandomEngine* engine) { //Fill tuple with hit information int hittot = caloHitCache.size(); - tuples->fillHits(caloHitCache); + tuples_->fillHits(caloHitCache); //Get the index of the central tower - HcalNumberingFromDDD::HcalID id = numberingFromDDD->unitID(eta0,phi0,1,1); - uint32_t unitID = org->getUnitID(id); + HcalNumberingFromDDD::HcalID id = numberingFromDDD_->unitID(eta0_,phi0_,1,1); + uint32_t unitID = org_->getUnitID(id); int subdet, zside, layer, ieta, iphi, lay; - org->unpackHcalIndex(unitID,subdet,zside,layer,ieta,iphi,lay); + org_->unpackHcalIndex(unitID,subdet,zside,layer,ieta,iphi,lay); int laymax = 0; std::string det = "Unknown"; if (subdet == static_cast(HcalBarrel)) { @@ -495,16 +497,16 @@ void HcalTestAnalysis::qieAnalysis(CLHEP::HepRandomEngine* engine) { } else if (subdet == static_cast(HcalEndcap)) { laymax = 2; det = "HES"; } - LogDebug("HcalSim") << "HcalTestAnalysis::Qie: " << det << " Eta " << ieta - << " Phi " << iphi << " Laymax " << laymax << " Hits " - << hittot; + edm::LogVerbatim("HcalSim") << "HcalTestAnalysis::Qie: " << det << " Eta " + << ieta << " Phi " << iphi << " Laymax " + << laymax << " Hits " << hittot; if (laymax>0 && hittot>0) { std::vector hits(hittot); std::vector eqielay(80,0.0), esimlay(80,0.0), esimtot(4,0.0); std::vector eqietow(200,0.0), esimtow(200,0.0), eqietot(4,0.0); - int etac = (centralTower/100)%100; - int phic = (centralTower%100); + int etac = (centralTower_/100)%100; + int phic = (centralTower_%100); for (int layr=0; layrunpackHcalIndex(unitID,subdetc,zsidec,layer,ietac,iphic,lay); + org_->unpackHcalIndex(unitID,subdetc,zsidec,layer,ietac,iphic,lay); if (etac > 0 && phic > 0) { idx = ietac*100 + iphic; } else if (etac > 0) { @@ -545,18 +547,20 @@ void HcalTestAnalysis::qieAnalysis(CLHEP::HepRandomEngine* engine) { } if (zsidec==zside && idx==tower_[it]) { hits[nhit] = hit; - LogDebug("HcalSim") << "HcalTest: Hit " << nhit << " " << hit; + edm::LogVerbatim("HcalSim") << "HcalTest: Hit " << nhit << " " + << hit; nhit++; esim += hit.e(); } } } - std::vector cd = myqie->getCode(nhit, hits, engine); - double eqie = myqie->getEnergy(cd); + std::vector cd = myqie_->getCode(nhit, hits, engine); + double eqie = myqie_->getEnergy(cd); - LogDebug("HcalSim") << "HcalTestAnalysis::Qie: Energy in layer " - << layr << " Sim " << esim << " After QIE " < latphi(10); - int nt = 2*addTower + 1; + int nt = 2*addTower_ + 1; for (int it=0; it latfs(10,0.), latfq(10,0.), longs(20), longq(20); @@ -590,8 +595,8 @@ void HcalTestAnalysis::qieAnalysis(CLHEP::HepRandomEngine* engine) { longs[layr] = scals*esimlay[20*i+layr]; longq[layr] = scalq*eqielay[20*i+layr]; } - tuples->fillQie(i,esimtot[i],eqietot[i],nGroup,longs,longq, - nt,latphi,latfs,latfq); + tuples_->fillQie(i,esimtot[i],eqietot[i],nGroup,longs,longq, + nt,latphi,latfs,latfq); } } } @@ -600,18 +605,19 @@ void HcalTestAnalysis::qieAnalysis(CLHEP::HepRandomEngine* engine) { void HcalTestAnalysis::layerAnalysis(){ int i = 0; - LogDebug("HcalSim") << "\n ===>>> HcalTestAnalysis: Energy deposit in MeV " - << "\n at EB : " << std::setw(6) << edepEB/MeV - << "\n at EE : " << std::setw(6) << edepEE/MeV - << "\n at HB : " << std::setw(6) << edepHB/MeV - << "\n at HE : " << std::setw(6) << edepHE/MeV - << "\n at HO : " << std::setw(6) << edepHO/MeV - << "\n ---- HcalTestAnalysis: Energy deposit in Layers"; + edm::LogVerbatim("HcalSim") << "\n ===>>> HcalTestAnalysis: Energy deposit " + << "\n at EB : " << std::setw(6) << edepEB/MeV + << "\n at EE : " << std::setw(6) << edepEE/MeV + << "\n at HB : " << std::setw(6) << edepHB/MeV + << "\n at HE : " << std::setw(6) << edepHE/MeV + << "\n at HO : " << std::setw(6) << edepHO/MeV + << "\n ---- HcalTestAnalysis: Energy deposit " + << "in Layers"; for (i = 0; i < 20; i++) - LogDebug("HcalSim") << " Layer " << std::setw(2) << i << " E " - << std::setw(8) << edepl[i]/MeV << " MeV"; + edm::LogVerbatim("HcalSim") << " Layer " << std::setw(2) << i << " E " + << std::setw(8) << edepl[i]/MeV << " MeV"; - tuples->fillLayers(edepl, edepHO, edepHB+edepHE, mudist); + tuples_->fillLayers(edepl, edepHO, edepHB+edepHE, mudist); } @@ -634,9 +640,9 @@ double HcalTestAnalysis::timeOfFlight(int det, int layer, double eta) { if (layer>0 && layer<20) dist += zLay[layer-1]*mm/cos(theta); } double tmp = dist/c_light/ns; - LogDebug("HcalSim") << "HcalTestAnalysis::timeOfFlight " << tmp - << " for det/lay " << det << " " << layer - << " eta/theta " << eta << " " << theta/deg << " dist " - << dist; + edm::LogVerbatim("HcalSim") << "HcalTestAnalysis::timeOfFlight " << tmp + << " for det/lay " << det << " " << layer + << " eta/theta " << eta << " " << theta/deg + << " dist " << dist; return tmp; } diff --git a/SimG4CMS/Calo/src/HcalTestNS.cc b/SimG4CMS/Calo/src/HcalTestNS.cc index 30c5630f4ecc9..4fdd73abe2478 100644 --- a/SimG4CMS/Calo/src/HcalTestNS.cc +++ b/SimG4CMS/Calo/src/HcalTestNS.cc @@ -13,7 +13,7 @@ HcalTestNS::HcalTestNS(const edm::EventSetup* iSetup) { edm::ESHandle hdc; iSetup->get().get(hdc); if (hdc.isValid()) { - hcons_ = (HcalDDDRecConstants*)(&(*hdc)); + hcons_ = hdc.product(); } else { edm::LogError("HcalSim") << "HcalTestNS : Cannot find HcalDDDRecConstant"; hcons_ = nullptr; diff --git a/Validation/HcalHits/src/SimG4HcalValidation.cc b/Validation/HcalHits/src/SimG4HcalValidation.cc index 35add9a3a53ad..1cb9a8cef463d 100644 --- a/Validation/HcalHits/src/SimG4HcalValidation.cc +++ b/Validation/HcalHits/src/SimG4HcalValidation.cc @@ -155,7 +155,7 @@ void SimG4HcalValidation::update(const BeginOfJob * job) { // Numbering From DDD edm::ESHandle hdc; (*job)()->get().get(hdc); - HcalDDDSimConstants *hcons = (HcalDDDSimConstants*)(&(*hdc)); + const HcalDDDSimConstants *hcons = hdc.product(); edm::LogInfo("ValidHcal") << "HcalTestAnalysis:: Initialise " << "HcalNumberingFromDDD"; numberingFromDDD = new HcalNumberingFromDDD(hcons);