diff --git a/CalibCalorimetry/EcalCorrelatedNoiseAnalysisModules/interface/EcnaAnalyzer.h b/CalibCalorimetry/EcalCorrelatedNoiseAnalysisModules/interface/EcnaAnalyzer.h index 2028fd1778325..b6201fb4b3e71 100644 --- a/CalibCalorimetry/EcalCorrelatedNoiseAnalysisModules/interface/EcnaAnalyzer.h +++ b/CalibCalorimetry/EcalCorrelatedNoiseAnalysisModules/interface/EcnaAnalyzer.h @@ -145,7 +145,7 @@ class EcnaAnalyzer : public edm::one::EDAnalyzer<> { Bool_t AnalysisOutcome(const TString &); private: - Int_t fgMaxCar; // Max nb of caracters for char* + constexpr static Int_t fgMaxCar = 512; // Max nb of caracters for char* TString fTTBELL; // ----------member data --------------------------- @@ -214,16 +214,16 @@ class EcnaAnalyzer : public edm::one::EDAnalyzer<> { Int_t fTreatedFedOrder; std::vector fFedStatusOrder; Int_t fFedId; - std::vector fDeeNumberString; + std::vector fDeeNumberString; - Int_t fMaxTreatedStexCounter; + Int_t fMaxTreatedStexCounter = 0; Int_t fDeeDS5Memo1; Int_t fDeeDS5Memo2; std::vector fStexDigiOK; std::vector fStexNbOfTreatedEvents; std::vector fStexStatus; - Int_t fMaxFedUnitCounter; + Int_t fMaxFedUnitCounter = 0; std::vector fFedStatus; std::vector fFedDigiOK; std::vector fFedNbOfTreatedEvents; @@ -247,32 +247,29 @@ class EcnaAnalyzer : public edm::one::EDAnalyzer<> { std::vector fMemoDateFirstEvent; - TEcnaObject *fMyEcnaEBObjectManager; - TEcnaObject *fMyEcnaEEObjectManager; + TEcnaObject fMyEcnaEBObjectManager; + TEcnaObject fMyEcnaEEObjectManager; - TEcnaRun **fMyCnaEBSM; - TEcnaRun **fMyCnaEEDee; + std::vector> fMyCnaEBSM; + std::vector> fMyCnaEEDee; - TEcnaNumbering *fMyEBNumbering; - TEcnaParEcal *fMyEBEcal; + TEcnaNumbering fMyEBNumbering; + TEcnaParEcal fMyEBEcal; - TEcnaNumbering *fMyEENumbering; - TEcnaParEcal *fMyEEEcal; + TEcnaNumbering fMyEENumbering; + TEcnaParEcal fMyEEEcal; // Int_t** fT2d_LastEvt; // 2D array[channel][sample] max nb of evts read for // a given (channel,sample) Int_t* fT1d_LastEvt; - Int_t fMaxRunTypeCounter; - std::vector fRunTypeCounter; + constexpr static Int_t fMaxRunTypeCounter = 26; + std::array fRunTypeCounter; - Int_t fMaxMgpaGainCounter; - std::vector fMgpaGainCounter; + constexpr static Int_t fMaxMgpaGainCounter = 4; // Because chozen gain = 0,1,2,3 + std::array fMgpaGainCounter; - Int_t fMaxFedIdCounter; - std::vector fFedIdCounter; - - Int_t fMaxCounterQuad; - std::vector fCounterQuad; + constexpr static Int_t fMaxFedIdCounter = 54; + std::array fFedIdCounter; }; #endif diff --git a/CalibCalorimetry/EcalCorrelatedNoiseAnalysisModules/src/EcnaAnalyzer.cc b/CalibCalorimetry/EcalCorrelatedNoiseAnalysisModules/src/EcnaAnalyzer.cc index 72429e643eeb6..ae0c95df6d1ae 100644 --- a/CalibCalorimetry/EcalCorrelatedNoiseAnalysisModules/src/EcnaAnalyzer.cc +++ b/CalibCalorimetry/EcalCorrelatedNoiseAnalysisModules/src/EcnaAnalyzer.cc @@ -46,25 +46,14 @@ EcnaAnalyzer::EcnaAnalyzer(const edm::ParameterSet &pSet) : verbosity_(pSet.getUntrackedParameter("verbosity", 1U)), nChannels_(0), iEvent_(0), - fMyCnaEBSM(nullptr), - fMyCnaEEDee(nullptr), - fMyEBNumbering(nullptr), - fMyEBEcal(nullptr), - fMyEENumbering(nullptr), - fMyEEEcal(nullptr), - fMaxRunTypeCounter(26), - fRunTypeCounter(fMaxRunTypeCounter, 0), - fMaxMgpaGainCounter(4), // Because chozen gain = 0,1,2,3 - fMgpaGainCounter(fMaxMgpaGainCounter, 0), - fMaxFedIdCounter(54), - fFedIdCounter(fMaxFedIdCounter, 0) { + fMyEBNumbering(&fMyEcnaEBObjectManager, "EB"), + fMyEBEcal(&fMyEcnaEBObjectManager, "EB"), + fMyEENumbering(&fMyEcnaEEObjectManager, "EE"), + fMyEEEcal(&fMyEcnaEEObjectManager, "EE") { // now do what ever initialization is needed - fMyEcnaEBObjectManager = new TEcnaObject(); - fMyEcnaEEObjectManager = new TEcnaObject(); - - std::unique_ptr myPathEB = std::make_unique(fMyEcnaEBObjectManager); - std::unique_ptr myPathEE = std::make_unique(fMyEcnaEEObjectManager); + std::unique_ptr myPathEB = std::make_unique(&fMyEcnaEBObjectManager); + std::unique_ptr myPathEE = std::make_unique(&fMyEcnaEEObjectManager); edm::LogVerbatim("ecnaAnal") << "*EcnaAnalyzer-constructor> Check path for resultsq Root files."; @@ -86,16 +75,9 @@ EcnaAnalyzer::EcnaAnalyzer(const edm::ParameterSet &pSet) edm::LogVerbatim("ecnaAnal") << "*EcnaAnalyzer-constructor> Parameter initialization."; - fgMaxCar = (Int_t)512; fTTBELL = '\007'; fOutcomeError = kFALSE; - fMyEBEcal = new TEcnaParEcal(fMyEcnaEBObjectManager, "EB"); - fMyEBNumbering = new TEcnaNumbering(fMyEcnaEBObjectManager, "EB"); - - fMyEEEcal = new TEcnaParEcal(fMyEcnaEEObjectManager, "EE"); - fMyEENumbering = new TEcnaNumbering(fMyEcnaEEObjectManager, "EE"); - //========================================================================================== //.................................. Get parameter values from python file eventHeaderProducer_ = pSet.getParameter("eventHeaderProducer"); @@ -138,6 +120,10 @@ EcnaAnalyzer::EcnaAnalyzer(const edm::ParameterSet &pSet) return; //=========================================================================================== + std::fill(fRunTypeCounter.begin(), fRunTypeCounter.end(), 0); + std::fill(fMgpaGainCounter.begin(), fMgpaGainCounter.end(), 0); + std::fill(fFedIdCounter.begin(), fFedIdCounter.end(), 0); + fEvtNumber = 0; fEvtNumberMemo = -1; fRecNumber = 0; @@ -154,10 +140,10 @@ EcnaAnalyzer::EcnaAnalyzer(const edm::ParameterSet &pSet) //-------------- Fed if (fStexName == "SM") { - fMaxFedUnitCounter = fMyEBEcal->MaxSMInEB(); + fMaxFedUnitCounter = fMyEBEcal.MaxSMInEB(); } // EB: FED Unit = SM if (fStexName == "Dee") { - fMaxFedUnitCounter = fMyEEEcal->MaxDSInEE(); + fMaxFedUnitCounter = fMyEEEcal.MaxDSInEE(); } // EE: FED Unit = Data Sector fFedDigiOK = std::vector(fMaxFedUnitCounter, 0); @@ -166,7 +152,7 @@ EcnaAnalyzer::EcnaAnalyzer(const edm::ParameterSet &pSet) fFedStatusOrder = std::vector(fMaxFedUnitCounter, 0); if (fStexName != "Dee") { - fDeeNumberString = std::vector(fMaxFedUnitCounter, "SM"); + fDeeNumberString = std::vector(fMaxFedUnitCounter, "SM"); } else { fDeeNumberString = {"Sector1 Dee4", "Sector2 Dee4", @@ -210,7 +196,7 @@ EcnaAnalyzer::EcnaAnalyzer(const edm::ParameterSet &pSet) // DS: 7 8 9 1 2 3 4 5 6 // ES: 16 17 18 10 11 12 13 14 15 (ES = DS + 9) - Int_t MaxSMAndDS = fMyEBEcal->MaxSMInEB() + fMyEEEcal->MaxDSInEE(); + const Int_t MaxSMAndDS = fMyEBEcal.MaxSMInEB() + fMyEEEcal.MaxDSInEE(); fSMFromFedTcc = std::vector(MaxSMAndDS, -1); fESFromFedTcc = std::vector(MaxSMAndDS, -1); @@ -240,10 +226,10 @@ EcnaAnalyzer::EcnaAnalyzer(const edm::ParameterSet &pSet) //"AdcSPeg12" analysis //-------------- Stex if (fStexName == "SM") { - fMaxTreatedStexCounter = fMyEBEcal->MaxSMInEB(); + fMaxTreatedStexCounter = fMyEBEcal.MaxSMInEB(); } // EB: Stex = SM if (fStexName == "Dee") { - fMaxTreatedStexCounter = fMyEEEcal->MaxDeeInEE(); + fMaxTreatedStexCounter = fMyEEEcal.MaxDeeInEE(); } // EE: Stex = Dee fStexNbOfTreatedEvents = std::vector(fMaxTreatedStexCounter, 0); @@ -386,7 +372,7 @@ EcnaAnalyzer::EcnaAnalyzer(const edm::ParameterSet &pSet) if (fStexNumber == 0) { if (fStexName == "SM") { fSMIndexBegin = 0; - fSMIndexStop = fMyEBEcal->MaxSMInEB(); + fSMIndexStop = fMyEBEcal.MaxSMInEB(); fStexIndexBegin = fSMIndexBegin; fStexIndexStop = fSMIndexStop; fDeeIndexBegin = 0; @@ -396,7 +382,7 @@ EcnaAnalyzer::EcnaAnalyzer(const edm::ParameterSet &pSet) fSMIndexBegin = 0; fSMIndexStop = 0; fDeeIndexBegin = 0; - fDeeIndexStop = fMyEEEcal->MaxDeeInEE(); + fDeeIndexStop = fMyEEEcal.MaxDeeInEE(); fStexIndexBegin = fDeeIndexBegin; fStexIndexStop = fDeeIndexStop; } @@ -422,9 +408,6 @@ EcnaAnalyzer::EcnaAnalyzer(const edm::ParameterSet &pSet) //......... DATA DEPENDENT PARAMETERS fRunNumber = 0; - fMyCnaEBSM = nullptr; - fMyCnaEEDee = nullptr; - fRunTypeNumber = -1; fMgpaGainNumber = -1; @@ -454,17 +437,14 @@ EcnaAnalyzer::~EcnaAnalyzer() { //..................................... format numerical values edm::LogVerbatim("ecnaAnal") << "EcnaAnalyzer::~EcnaAnalyzer()> destructor is going to be executed." << std::endl; - delete fMyEcnaEBObjectManager; - delete fMyEcnaEEObjectManager; - if (fOutcomeError == kTRUE) return; //------------------------------------------------------------------------------- //....................................................... EB (SM) - if (fMyCnaEBSM == nullptr && fStexName == "SM") { - edm::LogVerbatim("ecnaAnal") << "\n!EcnaAnalyzer-destructor> **** ERROR **** fMyCnaEBSM = " << fMyCnaEBSM + if (fMyCnaEBSM.empty() && fStexName == "SM") { + edm::LogVerbatim("ecnaAnal") << "\n!EcnaAnalyzer-destructor> **** ERROR **** fMyCnaEBSM is empty" << ". !===> ECNA HAS NOT BEEN INITIALIZED." << "\n Last event run type = " << runtype(fRunTypeNumber) << ", fRunTypeNumber = " << fRunTypeNumber @@ -473,7 +453,7 @@ EcnaAnalyzer::~EcnaAnalyzer() { << ", last event fFedId(+601) = " << fFedId + 601 << std::endl; } else { for (Int_t iSM = fSMIndexBegin; iSM < fSMIndexStop; iSM++) { - if (fMyCnaEBSM[iSM] != nullptr) { + if (fMyCnaEBSM[iSM].get() != nullptr) { //........................................ register dates 1 and 2 fMyCnaEBSM[iSM]->StartStopDate(fDateFirst[iSM], fDateLast[iSM]); fMyCnaEBSM[iSM]->StartStopTime(fTimeFirst[iSM], fTimeLast[iSM]); @@ -493,12 +473,11 @@ EcnaAnalyzer::~EcnaAnalyzer() { << "*EcnaAnalyzer-destructor> Calculations and writing on file already done for SM " << iSM + 1; } } - delete fMyCnaEBSM; } //....................................................... EE (Dee) - if (fMyCnaEEDee == nullptr && fStexName == "Dee") { - edm::LogVerbatim("ecnaAnal") << "\n!EcnaAnalyzer-destructor> **** ERROR **** fMyCnaEEDee = " << fMyCnaEEDee + if (fMyCnaEEDee.empty() && fStexName == "Dee") { + edm::LogVerbatim("ecnaAnal") << "\n!EcnaAnalyzer-destructor> **** ERROR **** fMyCnaEEDee is empty" << ". !===> ECNA HAS NOT BEEN INITIALIZED." << "\n Last event run type = " << runtype(fRunTypeNumber) << ", fRunTypeNumber = " << fRunTypeNumber @@ -507,7 +486,7 @@ EcnaAnalyzer::~EcnaAnalyzer() { << ", last event fFedId(+601) = " << fFedId + 601 << std::endl; } else { for (Int_t iDee = fDeeIndexBegin; iDee < fDeeIndexStop; iDee++) { - if (fMyCnaEEDee[iDee] != nullptr) { + if (fMyCnaEEDee[iDee].get() != nullptr) { //........................................ register dates 1 and 2 fMyCnaEEDee[iDee]->StartStopDate(fDateFirst[iDee], fDateLast[iDee]); fMyCnaEEDee[iDee]->StartStopTime(fTimeFirst[iDee], fTimeLast[iDee]); @@ -527,7 +506,6 @@ EcnaAnalyzer::~EcnaAnalyzer() { << "*EcnaAnalyzer-destructor> Calculations and writing on file already done for Dee " << iDee + 1; } } - delete fMyCnaEEDee; } edm::LogVerbatim("ecnaAnal") << std::endl; @@ -583,12 +561,6 @@ EcnaAnalyzer::~EcnaAnalyzer() { Int_t n0 = 0; CheckMsg(n0); - delete fMyEBNumbering; - delete fMyEENumbering; - - delete fMyEBEcal; - delete fMyEEEcal; - edm::LogVerbatim("ecnaAnal") << "*EcnaAnalyzer-destructor> End of execution."; } // end of destructor @@ -614,7 +586,7 @@ void EcnaAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSet iFreq = 10000; } - Int_t MaxSMAndDS = fMyEBEcal->MaxSMInEB() + fMyEEEcal->MaxDSInEE(); + Int_t MaxSMAndDS = fMyEBEcal.MaxSMInEB() + fMyEEEcal.MaxDSInEE(); //********************************************* EVENT TREATMENT //******************************** @@ -701,7 +673,7 @@ void EcnaAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSet if (fFedTcc < 10 || fFedTcc > 45) return; - if (fSMFromFedTcc[fFedTcc - 1] >= 1 && fSMFromFedTcc[fFedTcc - 1] <= fMyEBEcal->MaxSMInEB() && + if (fSMFromFedTcc[fFedTcc - 1] >= 1 && fSMFromFedTcc[fFedTcc - 1] <= fMyEBEcal.MaxSMInEB() && fStexNbOfTreatedEvents[fSMFromFedTcc[fFedTcc - 1] - 1] >= fReqNbOfEvts) return; } @@ -710,7 +682,7 @@ void EcnaAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSet if (fFedTcc >= 10 && fFedTcc <= 45) return; - if (fESFromFedTcc[fFedTcc - 1] >= 1 && fESFromFedTcc[fFedTcc - 1] <= fMyEEEcal->MaxDSInEE() && + if (fESFromFedTcc[fFedTcc - 1] >= 1 && fESFromFedTcc[fFedTcc - 1] <= fMyEEEcal.MaxDSInEE() && fFedNbOfTreatedEvents[fESFromFedTcc[fFedTcc - 1] - 1] >= fReqNbOfEvts) return; } @@ -740,27 +712,21 @@ void EcnaAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSet //============================ Ecna init for the pointers array //================================= //.................................................................. EB (SM) - if (fMyCnaEBSM == nullptr && fStexName == "SM") { - fMyCnaEBSM = new TEcnaRun *[fMyEBEcal->MaxSMInEB()]; - for (Int_t i0SM = 0; i0SM < fMyEBEcal->MaxSMInEB(); i0SM++) { - fMyCnaEBSM[i0SM] = nullptr; - } + if (fMyCnaEBSM.empty() && fStexName == "SM") { + fMyCnaEBSM.resize(fMyEBEcal.MaxSMInEB()); } //.................................................................. EE (Dee) - if (fMyCnaEEDee == nullptr && fStexName == "Dee") { - fMyCnaEEDee = new TEcnaRun *[fMyEEEcal->MaxDeeInEE()]; - for (Int_t iDee = 0; iDee < fMyEEEcal->MaxDeeInEE(); iDee++) { - fMyCnaEEDee[iDee] = nullptr; - } + if (fMyCnaEEDee.empty() && fStexName == "Dee") { + fMyCnaEEDee.resize(fMyEEEcal.MaxDeeInEE()); } //============================ EVENT TREATMENT ============================== Int_t MaxNbOfStex = 0; if (fStexName == "SM") { - MaxNbOfStex = fMyEBEcal->MaxSMInEB(); + MaxNbOfStex = fMyEBEcal.MaxSMInEB(); } if (fStexName == "Dee") { - MaxNbOfStex = fMyEEEcal->MaxDeeInEE(); + MaxNbOfStex = fMyEEEcal.MaxDeeInEE(); } if ((fStexNumber > 0 && fNbOfTreatedStexs == 0) || (fStexNumber == 0 && fNbOfTreatedStexs < MaxNbOfStex)) { @@ -798,10 +764,10 @@ void EcnaAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSet Int_t i0SM = id_crystal.ism() - 1; // <============== GET the SM number - 1 here if (i0SM >= 0 && i0SM < fMaxTreatedStexCounter) { - if (fMyCnaEBSM[i0SM] == nullptr && fStexStatus[i0SM] != 2) { + if (fMyCnaEBSM[i0SM].get() == nullptr && fStexStatus[i0SM] != 2) { //=============================== Init Ecna EB //=============================== - fMyCnaEBSM[i0SM] = new TEcnaRun(fMyEcnaEBObjectManager, "EB", fNbOfSamples); + fMyCnaEBSM[i0SM] = std::make_unique(&fMyEcnaEBObjectManager, "EB", fNbOfSamples); fMyCnaEBSM[i0SM]->GetReadyToReadData( fAnalysisName, fRunNumber, fFirstReqEvent, fLastReqEvent, fReqNbOfEvts, i0SM + 1, fRunTypeNumber); @@ -858,16 +824,16 @@ void EcnaAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSet Int_t iEta = id_crystal.ietaSM(); // ietaSM() : range = [1,85] Int_t iPhi = id_crystal.iphiSM(); // iphiSM() : range = [1,20] - Int_t n1SMCrys = (iEta - 1) * (fMyEBEcal->MaxTowPhiInSM() * fMyEBEcal->MaxCrysPhiInTow()) + - iPhi; // range = [1,1700] - Int_t n1SMTow = fMyEBNumbering->Get1SMTowFrom1SMCrys(n1SMCrys); // range = [1,68] - Int_t i0TowEcha = fMyEBNumbering->Get0TowEchaFrom1SMCrys(n1SMCrys); // range = [0,24] + Int_t n1SMCrys = (iEta - 1) * (fMyEBEcal.MaxTowPhiInSM() * fMyEBEcal.MaxCrysPhiInTow()) + + iPhi; // range = [1,1700] + Int_t n1SMTow = fMyEBNumbering.Get1SMTowFrom1SMCrys(n1SMCrys); // range = [1,68] + Int_t i0TowEcha = fMyEBNumbering.Get0TowEchaFrom1SMCrys(n1SMCrys); // range = [0,24] Int_t NbOfSamplesFromDigis = digiItr->size(); EBDataFrame df(*digiItr); - if (NbOfSamplesFromDigis > 0 && NbOfSamplesFromDigis <= fMyEBEcal->MaxSampADC()) { + if (NbOfSamplesFromDigis > 0 && NbOfSamplesFromDigis <= fMyEBEcal.MaxSampADC()) { Double_t adcDBLS = (Double_t)0; // Three 1st samples mean value for Dynamic Base Line // Substraction (DBLS) @@ -959,7 +925,7 @@ void EcnaAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSet } // iX_data : range = [50,1], iX : range = [1,50] Int_t n1DeeCrys = - (iX - 1) * (fMyEEEcal->MaxSCIYInDee() * fMyEEEcal->MaxCrysIYInSC()) + iY; // n1DeeCrys: range = [1,5000] + (iX - 1) * (fMyEEEcal.MaxSCIYInDee() * fMyEEEcal.MaxCrysIYInSC()) + iY; // n1DeeCrys: range = [1,5000] Int_t n1DeeNumber = 0; if (i_quad == 1 && i_sgnZ == 1) { @@ -990,10 +956,10 @@ void EcnaAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSet Int_t i0Dee = n1DeeNumber - 1; // <============== GET the Dee number - 1 here if (i0Dee >= 0 && i0Dee < fMaxTreatedStexCounter) { - if (fMyCnaEEDee[i0Dee] == nullptr && fStexStatus[i0Dee] != 2) { + if (fMyCnaEEDee[i0Dee].get() == nullptr && fStexStatus[i0Dee] != 2) { //=============================== Init Ecna EE //=============================== - fMyCnaEEDee[i0Dee] = new TEcnaRun(fMyEcnaEEObjectManager, "EE", fNbOfSamples); + fMyCnaEEDee[i0Dee] = std::make_unique(&fMyEcnaEEObjectManager, "EE", fNbOfSamples); fMyCnaEEDee[i0Dee]->GetReadyToReadData( fAnalysisName, fRunNumber, fFirstReqEvent, fLastReqEvent, fReqNbOfEvts, i0Dee + 1, fRunTypeNumber); @@ -1099,15 +1065,15 @@ void EcnaAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSet //=============================================> cut on i0Dee // value if ((fStexNumber > 0 && i0Dee == fStexNumber - 1) || (fStexNumber == 0)) { - TString sDir = fMyEENumbering->GetDeeDirViewedFromIP(n1DeeNumber); - Int_t n1DeeSCEcna = fMyEENumbering->Get1DeeSCEcnaFrom1DeeCrys(n1DeeCrys, sDir); - Int_t i0SCEcha = fMyEENumbering->Get1SCEchaFrom1DeeCrys(n1DeeCrys, sDir) - 1; + TString sDir = fMyEENumbering.GetDeeDirViewedFromIP(n1DeeNumber); + Int_t n1DeeSCEcna = fMyEENumbering.Get1DeeSCEcnaFrom1DeeCrys(n1DeeCrys, sDir); + Int_t i0SCEcha = fMyEENumbering.Get1SCEchaFrom1DeeCrys(n1DeeCrys, sDir) - 1; Int_t NbOfSamplesFromDigis = digiItr->size(); EEDataFrame df(*digiItr); - if (NbOfSamplesFromDigis > 0 && NbOfSamplesFromDigis <= fMyEEEcal->MaxSampADC()) { + if (NbOfSamplesFromDigis > 0 && NbOfSamplesFromDigis <= fMyEEEcal.MaxSampADC()) { Double_t adcDBLS = (Double_t)0; // Three 1st samples mean value for Dynamic Base Line // Substraction (DBLS) @@ -1310,7 +1276,7 @@ void EcnaAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSet //================================= WRITE RESULTS FILE if (fStexName == "SM") { - if (fMyCnaEBSM[i0Stex] != nullptr) { + if (fMyCnaEBSM[i0Stex].get() != nullptr) { //........................................ register dates 1 and 2 fMyCnaEBSM[i0Stex]->StartStopDate(fDateFirst[i0Stex], fDateLast[i0Stex]); fMyCnaEBSM[i0Stex]->StartStopTime(fTimeFirst[i0Stex], fTimeLast[i0Stex]); @@ -1328,13 +1294,12 @@ void EcnaAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSet } // set pointer to zero in order to avoid recalculation and rewriting at // the destructor level - delete fMyCnaEBSM[i0Stex]; - fMyCnaEBSM[i0Stex] = nullptr; + fMyCnaEBSM[i0Stex].reset(); edm::LogVerbatim("ecnaAnal") << "!EcnaAnalyzer::analyze> Set memory free: delete done for SM " << i0Stex + 1; } if (fStexName == "Dee") { - if (fMyCnaEEDee[i0Stex] != nullptr) { + if (fMyCnaEEDee[i0Stex].get() != nullptr) { //........................................ register dates 1 and 2 fMyCnaEEDee[i0Stex]->StartStopDate(fDateFirst[i0Stex], fDateLast[i0Stex]); fMyCnaEEDee[i0Stex]->StartStopTime(fTimeFirst[i0Stex], fTimeLast[i0Stex]); @@ -1352,8 +1317,7 @@ void EcnaAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSet } // set pointer to zero in order to avoid recalculation and rewriting at // the destructor level - delete fMyCnaEEDee[i0Stex]; - fMyCnaEEDee[i0Stex] = nullptr; + fMyCnaEEDee[i0Stex].reset(); edm::LogVerbatim("ecnaAnal") << "!EcnaAnalyzer::analyze> Set memory free: delete done for Dee " << i0Stex + 1; } @@ -1373,10 +1337,10 @@ Bool_t EcnaAnalyzer::AnalysisOutcome(const TString &s_opt) { if (s_opt == "EVT") { Int_t MaxNbOfStex = 0; if (fStexName == "SM") { - MaxNbOfStex = fMyEBEcal->MaxSMInEB(); + MaxNbOfStex = fMyEBEcal.MaxSMInEB(); } if (fStexName == "Dee") { - MaxNbOfStex = fMyEEEcal->MaxDeeInEE(); + MaxNbOfStex = fMyEEEcal.MaxDeeInEE(); } if (((fStexNumber > 0 && fNbOfTreatedStexs == 1) || (fStexNumber == 0 && fNbOfTreatedStexs == MaxNbOfStex)) &&