Skip to content

Commit

Permalink
Avoid raw 'new' in EcalMixingModuleValidation
Browse files Browse the repository at this point in the history
  • Loading branch information
makortel committed Aug 17, 2021
1 parent 97ef3d8 commit 2c94140
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 29 deletions.
14 changes: 7 additions & 7 deletions Validation/EcalDigis/interface/EcalMixingModuleValidation.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,16 @@ class EcalMixingModuleValidation : public DQMOneEDAnalyzer<> {
MonitorElement* meEEShapeRatio_;
MonitorElement* meESShapeRatio_;

const EcalSimParameterMap* theParameterMap;
std::unique_ptr<const EcalSimParameterMap> theParameterMap;
//const CaloVShape * theEcalShape;
ESShape* theESShape;
EBShape* theEBShape;
EEShape* theEEShape;
std::unique_ptr<ESShape> theESShape;
std::unique_ptr<EBShape> theEBShape;
std::unique_ptr<EEShape> theEEShape;

//CaloHitResponse * theEcalResponse;
CaloHitResponse* theESResponse;
CaloHitResponse* theEBResponse;
CaloHitResponse* theEEResponse;
std::unique_ptr<CaloHitResponse> theESResponse;
std::unique_ptr<CaloHitResponse> theEBResponse;
std::unique_ptr<CaloHitResponse> theEEResponse;

void computeSDBunchDigi(const edm::EventSetup& eventSetup,
const MixCollection<PCaloHit>& theHits,
Expand Down
42 changes: 20 additions & 22 deletions Validation/EcalDigis/src/EcalMixingModuleValidation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ EcalMixingModuleValidation::EcalMixingModuleValidation(const edm::ParameterSet&

doPhotostatistics = false;

theParameterMap = new EcalSimParameterMap(simHitToPhotoelectronsBarrel,
simHitToPhotoelectronsEndcap,
photoelectronsToAnalogBarrel,
photoelectronsToAnalogEndcap,
samplingFactor,
timePhase,
readoutFrameSize,
binOfMaximum,
doPhotostatistics,
syncPhase);
theParameterMap = std::make_unique<EcalSimParameterMap>(simHitToPhotoelectronsBarrel,
simHitToPhotoelectronsEndcap,
photoelectronsToAnalogBarrel,
photoelectronsToAnalogEndcap,
samplingFactor,
timePhase,
readoutFrameSize,
binOfMaximum,
doPhotostatistics,
syncPhase);
//theEcalShape = new EcalShape(timePhase);

//theEcalResponse = new CaloHitResponse(theParameterMap, theEcalShape);
Expand All @@ -71,13 +71,13 @@ EcalMixingModuleValidation::EcalMixingModuleValidation(const edm::ParameterSet&
double ESMIPkeV = ps.getParameter<double>("ESMIPkeV");
*/

theESShape = new ESShape();
theEBShape = new EBShape(consumesCollector());
theEEShape = new EEShape(consumesCollector());
theESShape = std::make_unique<ESShape>();
theEBShape = std::make_unique<EBShape>(consumesCollector());
theEEShape = std::make_unique<EEShape>(consumesCollector());

theESResponse = new CaloHitResponse(theParameterMap, theESShape);
theEBResponse = new CaloHitResponse(theParameterMap, theEBShape);
theEEResponse = new CaloHitResponse(theParameterMap, theEEShape);
theESResponse = std::make_unique<CaloHitResponse>(theParameterMap.get(), theESShape.get());
theEBResponse = std::make_unique<CaloHitResponse>(theParameterMap.get(), theEBShape.get());
theEEResponse = std::make_unique<CaloHitResponse>(theParameterMap.get(), theEEShape.get());

// double effwei = 1.;

Expand Down Expand Up @@ -614,21 +614,19 @@ void EcalMixingModuleValidation::checkCalibrations(edm::EventSetup const& eventS
// ADC -> GeV Scale
const EcalADCToGeVConstant* agc = &eventSetup.getData(pAgc);

EcalMGPAGainRatio* defaultRatios = new EcalMGPAGainRatio();
EcalMGPAGainRatio defaultRatios;

gainConv_[1] = 1.;
gainConv_[2] = defaultRatios->gain12Over6();
gainConv_[3] = gainConv_[2] * (defaultRatios->gain6Over1());
gainConv_[0] = gainConv_[2] * (defaultRatios->gain6Over1());
gainConv_[2] = defaultRatios.gain12Over6();
gainConv_[3] = gainConv_[2] * (defaultRatios.gain6Over1());
gainConv_[0] = gainConv_[2] * (defaultRatios.gain6Over1());

LogDebug("EcalDigi") << " Gains conversions: "
<< "\n"
<< " g1 = " << gainConv_[1] << "\n"
<< " g2 = " << gainConv_[2] << "\n"
<< " g3 = " << gainConv_[3];

delete defaultRatios;

const double barrelADCtoGeV_ = agc->getEBValue();
LogDebug("EcalDigi") << " Barrel GeV/ADC = " << barrelADCtoGeV_;
const double endcapADCtoGeV_ = agc->getEEValue();
Expand Down

0 comments on commit 2c94140

Please sign in to comment.