Skip to content

Commit 0f24a5d

Browse files
committed
Removed deprecated methods
1 parent ed67ffc commit 0f24a5d

File tree

13 files changed

+81
-117
lines changed

13 files changed

+81
-117
lines changed

CalibMuon/DTCalibration/interface/DTCalibDBUtils.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ class DTCalibDBUtils {
2525
/// Write the payload to the DB using PoolDBOutputService.
2626
/// New payload are created in the DB, existing payload are appended.
2727
template <typename T>
28-
static void writeToDB(std::string record, T* payload) {
28+
static void writeToDB(std::string record, const T& payload) {
2929
// Write the ttrig object to DB
3030
edm::Service<cond::service::PoolDBOutputService> dbOutputSvc;
3131
if (dbOutputSvc.isAvailable()) {
3232
try {
3333
if (dbOutputSvc->isNewTagRequest(record)) {
3434
//create mode
35-
dbOutputSvc->writeOne<T>(payload, dbOutputSvc->beginOfTime(), record);
35+
dbOutputSvc->writeOneIOV<T>(payload, dbOutputSvc->beginOfTime(), record);
3636
} else {
3737
//append mode. Note: correct PoolDBESSource must be loaded
38-
dbOutputSvc->writeOne<T>(payload, dbOutputSvc->currentTime(), record);
38+
dbOutputSvc->writeOneIOV<T>(payload, dbOutputSvc->currentTime(), record);
3939
}
4040
} catch (const cond::Exception& er) {
4141
std::cout << er.what() << std::endl;

CalibMuon/DTCalibration/plugins/DTNoiseCalibration.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ void DTNoiseCalibration::endJob() {
356356
}
357357

358358
// Save on file the occupancy histos and write the list of noisy cells
359-
DTStatusFlag* statusMap = new DTStatusFlag();
359+
DTStatusFlag statusMap;
360360
for (map<DTLayerId, TH1F*>::const_iterator lHisto = theHistoOccupancyMap_.begin();
361361
lHisto != theHistoOccupancyMap_.end();
362362
++lHisto) {
@@ -405,7 +405,7 @@ void DTNoiseCalibration::endJob() {
405405
double rateOffset = (useAbsoluteRate_) ? 0. : averageRate;
406406
if ((channelRate - rateOffset) > maximumNoiseRate_) {
407407
DTWireId wireID((*lHisto).first, i_wire);
408-
statusMap->setCellNoise(wireID, true);
408+
statusMap.setCellNoise(wireID, true);
409409
LogVerbatim("Calibration") << ">>> Channel noisy: " << wireID;
410410
}
411411
}

CalibMuon/DTCalibration/plugins/DTT0Correction.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void DTT0Correction::beginRun(const edm::Run& run, const edm::EventSetup& setup)
5555

5656
void DTT0Correction::endJob() {
5757
// Create the object to be written to DB
58-
DTT0* t0NewMap = new DTT0();
58+
DTT0 t0NewMap;
5959

6060
// Loop over all channels
6161
for (vector<const DTSuperLayer*>::const_iterator sl = muonGeom_->superLayers().begin();
@@ -82,15 +82,15 @@ void DTT0Correction::endJob() {
8282
dtCalibration::DTT0Data t0Corr = correctionAlgo_->correction(wireId);
8383
float t0MeanNew = t0Corr.mean;
8484
float t0RMSNew = t0Corr.rms;
85-
t0NewMap->set(wireId, t0MeanNew, t0RMSNew, DTTimeUnits::counts);
85+
t0NewMap.set(wireId, t0MeanNew, t0RMSNew, DTTimeUnits::counts);
8686

8787
LogVerbatim("Calibration") << "New t0 for: " << wireId << " mean from " << t0Mean << " to " << t0MeanNew
8888
<< " rms from " << t0RMS << " to " << t0RMSNew << endl;
8989
} catch (cms::Exception& e) {
9090
LogError("Calibration") << e.explainSelf();
9191
// Set db to the old value, if it was there in the first place
9292
if (!status) {
93-
t0NewMap->set(wireId, t0Mean, t0RMS, DTTimeUnits::counts);
93+
t0NewMap.set(wireId, t0Mean, t0RMS, DTTimeUnits::counts);
9494
LogVerbatim("Calibration") << "Keep old t0 for: " << wireId << " mean " << t0Mean << " rms " << t0RMS
9595
<< endl;
9696
}

CalibMuon/DTCalibration/plugins/DTTTrigCorrection.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void DTTTrigCorrection::beginRun(const edm::Run& run, const edm::EventSetup& set
6363

6464
void DTTTrigCorrection::endJob() {
6565
// Create the object to be written to DB
66-
DTTtrig* tTrigNewMap = new DTTtrig();
66+
DTTtrig tTrigNewMap;
6767

6868
for (vector<const DTSuperLayer*>::const_iterator sl = muonGeom_->superLayers().begin();
6969
sl != muonGeom_->superLayers().end();
@@ -78,7 +78,7 @@ void DTTTrigCorrection::endJob() {
7878
float tTrigMeanNew = tTrigCorr.mean;
7979
float tTrigSigmaNew = tTrigCorr.sigma;
8080
float kFactorNew = tTrigCorr.kFactor;
81-
tTrigNewMap->set((*sl)->id(), tTrigMeanNew, tTrigSigmaNew, kFactorNew, DTTimeUnits::ns);
81+
tTrigNewMap.set((*sl)->id(), tTrigMeanNew, tTrigSigmaNew, kFactorNew, DTTimeUnits::ns);
8282

8383
LogVerbatim("Calibration") << "New tTrig for: " << (*sl)->id() << " mean from " << tTrigMean << " to "
8484
<< tTrigMeanNew << " sigma from " << tTrigSigma << " to " << tTrigSigmaNew
@@ -87,7 +87,7 @@ void DTTTrigCorrection::endJob() {
8787
LogError("Calibration") << e.explainSelf();
8888
// Set db to the old value, if it was there in the first place
8989
if (!status) {
90-
tTrigNewMap->set((*sl)->id(), tTrigMean, tTrigSigma, kFactor, DTTimeUnits::ns);
90+
tTrigNewMap.set((*sl)->id(), tTrigMean, tTrigSigma, kFactor, DTTimeUnits::ns);
9191
LogVerbatim("Calibration") << "Keep old tTrig for: " << (*sl)->id() << " mean " << tTrigMean << " sigma "
9292
<< tTrigSigma << " kFactor " << kFactor << endl;
9393
}

CalibMuon/DTCalibration/plugins/DTTTrigCorrectionFirst.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void DTTTrigCorrectionFirst::beginRun(const edm::Run& run, const edm::EventSetup
4747

4848
void DTTTrigCorrectionFirst::endJob() {
4949
// Create the object to be written to DB
50-
DTTtrig* tTrigNewMap = new DTTtrig();
50+
DTTtrig tTrigNewMap;
5151
//Get the superlayers list
5252
vector<const DTSuperLayer*> dtSupLylist = muonGeom->superLayers();
5353

@@ -225,7 +225,7 @@ void DTTTrigCorrectionFirst::endJob() {
225225
}
226226

227227
//Store new ttrig in the new map
228-
tTrigNewMap->set((*sl)->id(), newTTrigMean, newTTrigSigma, newkfactor, DTTimeUnits::ns);
228+
tTrigNewMap.set((*sl)->id(), newTTrigMean, newTTrigSigma, newkfactor, DTTimeUnits::ns);
229229
if (debug) {
230230
cout << "New tTrig: " << (*sl)->id() << " from " << ttrigMean << " to " << newTTrigMean << endl;
231231
cout << "New tTrigSigma: " << (*sl)->id() << " from " << ttrigSigma << " to " << newTTrigSigma << endl;

CalibMuon/DTCalibration/plugins/DTVDriftCalibration.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,12 @@ void DTVDriftCalibration::endJob() {
280280
// Instantiate a DTCalibrationMap object if you want to calculate the calibration constants
281281
DTCalibrationMap calibValuesFile(theCalibFilePar);
282282
// Create the object to be written to DB
283-
DTMtime* mTime = nullptr;
284-
DTRecoConditions* vDrift = nullptr;
283+
std::unique_ptr<DTMtime> mTime;
284+
std::unique_ptr<DTRecoConditions> vDrift;
285285
if (writeLegacyVDriftDB) {
286-
mTime = new DTMtime();
286+
mTime = std::make_unique<DTMtime>();
287287
} else {
288-
vDrift = new DTRecoConditions();
288+
vDrift = std::make_unique<DTRecoConditions>();
289289
vDrift->setFormulaExpr("[0]");
290290
//vDriftNewMap->setFormulaExpr("[0]*(1-[1]*x)"); // add parametrization for dependency along Y
291291
vDrift->setVersion(1);
@@ -381,9 +381,9 @@ void DTVDriftCalibration::endJob() {
381381
// Write the vdrift object to DB
382382
if (writeLegacyVDriftDB) {
383383
string record = "DTMtimeRcd";
384-
DTCalibDBUtils::writeToDB<DTMtime>(record, mTime);
384+
DTCalibDBUtils::writeToDB<DTMtime>(record, *mTime);
385385
} else {
386-
DTCalibDBUtils::writeToDB<DTRecoConditions>("DTRecoConditionsVdriftRcd", vDrift);
386+
DTCalibDBUtils::writeToDB<DTRecoConditions>("DTRecoConditionsVdriftRcd", *vDrift);
387387
}
388388
}
389389

CalibMuon/DTCalibration/plugins/DTVDriftWriter.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ void DTVDriftWriter::beginRun(const edm::Run& run, const edm::EventSetup& setup)
7676

7777
void DTVDriftWriter::endJob() {
7878
// Create the object to be written to DB
79-
DTMtime* mTimeNewMap = nullptr;
80-
DTRecoConditions* vDriftNewMap = nullptr;
79+
std::unique_ptr<DTMtime> mTimeNewMap;
80+
std::unique_ptr<DTRecoConditions> vDriftNewMap;
8181
if (writeLegacyVDriftDB) {
82-
mTimeNewMap = new DTMtime();
82+
mTimeNewMap = std::make_unique<DTMtime>();
8383
} else {
84-
vDriftNewMap = new DTRecoConditions();
84+
vDriftNewMap = std::make_unique<DTRecoConditions>();
8585
vDriftNewMap->setFormulaExpr("[0]");
8686
//vDriftNewMap->setFormulaExpr("[0]*(1-[1]*x)"); // add parametrization for dependency along Y
8787
vDriftNewMap->setVersion(1);
@@ -137,8 +137,8 @@ void DTVDriftWriter::endJob() {
137137
LogVerbatim("Calibration") << "[DTVDriftWriter]Writing vdrift object to DB!";
138138
if (writeLegacyVDriftDB) {
139139
string record = "DTMtimeRcd";
140-
DTCalibDBUtils::writeToDB<DTMtime>(record, mTimeNewMap);
140+
DTCalibDBUtils::writeToDB<DTMtime>(record, *mTimeNewMap);
141141
} else {
142-
DTCalibDBUtils::writeToDB<DTRecoConditions>("DTRecoConditionsVdriftRcd", vDriftNewMap);
142+
DTCalibDBUtils::writeToDB<DTRecoConditions>("DTRecoConditionsVdriftRcd", *vDriftNewMap);
143143
}
144144
}

CalibMuon/DTCalibration/test/DBTools/DumpFileToDB.cc

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -72,26 +72,26 @@ void DumpFileToDB::endJob() {
7272
//---------- VDrift
7373
if (dbToDump == "VDriftDB") {
7474
if (format == "Legacy") {
75-
DTMtime* mtime = new DTMtime();
75+
DTMtime mtime;
7676
for (DTCalibrationMap::const_iterator keyAndCalibs = theCalibFile->keyAndConsts_begin();
7777
keyAndCalibs != theCalibFile->keyAndConsts_end();
7878
++keyAndCalibs) {
7979
// cout << "key: " << (*keyAndCalibs).first
8080
// << " vdrift (cm/ns): " << theCalibFile->meanVDrift((*keyAndCalibs).first)
8181
// << " hit reso (cm): " << theCalibFile->sigma_meanVDrift((*keyAndCalibs).first) << endl;
8282
// vdrift is cm/ns , resolution is cm
83-
mtime->set((*keyAndCalibs).first.superlayerId(),
84-
theCalibFile->meanVDrift((*keyAndCalibs).first),
85-
theCalibFile->sigma_meanVDrift((*keyAndCalibs).first),
86-
DTVelocityUnits::cm_per_ns);
83+
mtime.set((*keyAndCalibs).first.superlayerId(),
84+
theCalibFile->meanVDrift((*keyAndCalibs).first),
85+
theCalibFile->sigma_meanVDrift((*keyAndCalibs).first),
86+
DTVelocityUnits::cm_per_ns);
8787
}
8888
DTCalibDBUtils::writeToDB<DTMtime>("DTMtimeRcd", mtime);
8989
} else if (format == "DTRecoConditions") {
90-
DTRecoConditions* conds = new DTRecoConditions();
91-
conds->setFormulaExpr("[0]");
92-
// conds->setFormulaExpr("[0]*(1-[1]*x)");
90+
DTRecoConditions conds;
91+
conds.setFormulaExpr("[0]");
92+
// conds.setFormulaExpr("[0]*(1-[1]*x)");
9393
int version = 1;
94-
conds->setVersion(version);
94+
conds.setVersion(version);
9595
for (DTCalibrationMap::const_iterator keyAndCalibs = theCalibFile->keyAndConsts_begin();
9696
keyAndCalibs != theCalibFile->keyAndConsts_end();
9797
++keyAndCalibs) {
@@ -107,15 +107,15 @@ void DumpFileToDB::endJob() {
107107
throw cms::Exception("IncorrectSetup") << "Inconsistent version of file";
108108

109109
vector<double> params(values.begin() + 11, values.begin() + 11 + nfields);
110-
conds->set((*keyAndCalibs).first, params);
110+
conds.set((*keyAndCalibs).first, params);
111111
}
112112
DTCalibDBUtils::writeToDB<DTRecoConditions>("DTRecoConditionsVdriftRcd", conds);
113113
}
114114

115115
//---------- TTrig
116116
} else if (dbToDump == "TTrigDB") {
117117
if (format == "Legacy") {
118-
DTTtrig* tTrig = new DTTtrig();
118+
DTTtrig tTrig;
119119
for (DTCalibrationMap::const_iterator keyAndCalibs = theCalibFile->keyAndConsts_begin();
120120
keyAndCalibs != theCalibFile->keyAndConsts_end();
121121
++keyAndCalibs) {
@@ -131,11 +131,11 @@ void DumpFileToDB::endJob() {
131131
<< "The differentialMode can only be used with kFactor = 0, old: " << kFactor
132132
<< " new: " << theCalibFile->kFactor((*keyAndCalibs).first);
133133
}
134-
tTrig->set((*keyAndCalibs).first.superlayerId(),
135-
theCalibFile->tTrig((*keyAndCalibs).first) + tmean,
136-
theCalibFile->sigma_tTrig((*keyAndCalibs).first),
137-
theCalibFile->kFactor((*keyAndCalibs).first),
138-
DTTimeUnits::ns);
134+
tTrig.set((*keyAndCalibs).first.superlayerId(),
135+
theCalibFile->tTrig((*keyAndCalibs).first) + tmean,
136+
theCalibFile->sigma_tTrig((*keyAndCalibs).first),
137+
theCalibFile->kFactor((*keyAndCalibs).first),
138+
DTTimeUnits::ns);
139139
// cout << "key: " << (*keyAndCalibs).first
140140
// << " ttrig_mean (ns): " << theCalibFile->tTrig((*keyAndCalibs).first) + tmean
141141
// << " ttrig_sigma(ns): " << theCalibFile->sigma_tTrig((*keyAndCalibs).first)
@@ -146,20 +146,20 @@ void DumpFileToDB::endJob() {
146146
// << " ttrig_mean (ns): " << theCalibFile->tTrig((*keyAndCalibs).first)
147147
// << " ttrig_sigma(ns): " << theCalibFile->sigma_tTrig((*keyAndCalibs).first)
148148
// << " kFactor: " << theCalibFile->kFactor((*keyAndCalibs).first) << endl;
149-
tTrig->set((*keyAndCalibs).first.superlayerId(),
150-
theCalibFile->tTrig((*keyAndCalibs).first),
151-
theCalibFile->sigma_tTrig((*keyAndCalibs).first),
152-
theCalibFile->kFactor((*keyAndCalibs).first),
153-
DTTimeUnits::ns);
149+
tTrig.set((*keyAndCalibs).first.superlayerId(),
150+
theCalibFile->tTrig((*keyAndCalibs).first),
151+
theCalibFile->sigma_tTrig((*keyAndCalibs).first),
152+
theCalibFile->kFactor((*keyAndCalibs).first),
153+
DTTimeUnits::ns);
154154
}
155155
}
156156
DTCalibDBUtils::writeToDB<DTTtrig>("DTTtrigRcd", tTrig);
157157

158158
} else if (format == "DTRecoConditions") {
159-
DTRecoConditions* conds = new DTRecoConditions();
160-
conds->setFormulaExpr("[0]");
159+
DTRecoConditions conds;
160+
conds.setFormulaExpr("[0]");
161161
int version = 1;
162-
conds->setVersion(version);
162+
conds.setVersion(version);
163163

164164
for (DTCalibrationMap::const_iterator keyAndCalibs = theCalibFile->keyAndConsts_begin();
165165
keyAndCalibs != theCalibFile->keyAndConsts_end();
@@ -177,15 +177,15 @@ void DumpFileToDB::endJob() {
177177
throw cms::Exception("IncorrectSetup") << "Inconsistent version of file";
178178

179179
vector<double> params(values.begin() + 11, values.begin() + 11 + nfields);
180-
conds->set((*keyAndCalibs).first, params);
180+
conds.set((*keyAndCalibs).first, params);
181181
}
182182
DTCalibDBUtils::writeToDB<DTRecoConditions>("DTRecoConditionsTtrigRcd", conds);
183183
}
184184

185185
} else if (dbToDump == "TZeroDB") { // Write the T0
186186

187187
// Create the object to be written to DB
188-
DTT0* tZeroMap = new DTT0();
188+
DTT0 tZeroMap;
189189

190190
// Loop over file entries
191191
for (DTCalibrationMap::const_iterator keyAndCalibs = theCalibFile->keyAndConsts_begin();
@@ -195,40 +195,40 @@ void DumpFileToDB::endJob() {
195195
float t0rms = (*keyAndCalibs).second[6];
196196
cout << "key: " << (*keyAndCalibs).first << " T0 mean (TDC counts): " << t0mean
197197
<< " T0_rms (TDC counts): " << t0rms << endl;
198-
tZeroMap->set((*keyAndCalibs).first, t0mean, t0rms, DTTimeUnits::counts);
198+
tZeroMap.set((*keyAndCalibs).first, t0mean, t0rms, DTTimeUnits::counts);
199199
}
200200

201201
DTCalibDBUtils::writeToDB<DTT0>("DTT0Rcd", tZeroMap);
202202

203203
} else if (dbToDump == "NoiseDB") { // Write the Noise
204-
DTStatusFlag* statusMap = new DTStatusFlag();
204+
DTStatusFlag statusMap;
205205

206206
// Loop over file entries
207207
for (DTCalibrationMap::const_iterator keyAndCalibs = theCalibFile->keyAndConsts_begin();
208208
keyAndCalibs != theCalibFile->keyAndConsts_end();
209209
++keyAndCalibs) {
210210
cout << "key: " << (*keyAndCalibs).first << " Noisy flag: " << (*keyAndCalibs).second[7] << endl;
211-
statusMap->setCellNoise((*keyAndCalibs).first, (*keyAndCalibs).second[7]);
211+
statusMap.setCellNoise((*keyAndCalibs).first, (*keyAndCalibs).second[7]);
212212
}
213213

214214
DTCalibDBUtils::writeToDB<DTStatusFlag>("DTStatusFlagRcd", statusMap);
215215

216216
} else if (dbToDump == "DeadDB") { // Write the tp-dead
217-
DTDeadFlag* deadMap = new DTDeadFlag();
217+
DTDeadFlag deadMap;
218218

219219
// Loop over file entries
220220
for (DTCalibrationMap::const_iterator keyAndCalibs = theCalibFile->keyAndConsts_begin();
221221
keyAndCalibs != theCalibFile->keyAndConsts_end();
222222
++keyAndCalibs) {
223223
cout << "key: " << (*keyAndCalibs).first << " dead flag: " << (*keyAndCalibs).second[7] << endl;
224-
deadMap->setCellDead_TP((*keyAndCalibs).first, (*keyAndCalibs).second[7]);
224+
deadMap.setCellDead_TP((*keyAndCalibs).first, (*keyAndCalibs).second[7]);
225225
}
226226

227227
DTCalibDBUtils::writeToDB<DTDeadFlag>("DTDeadFlagRcd", deadMap);
228228

229229
} else if (dbToDump == "ChannelsDB") { //Write channels map
230230

231-
DTReadOutMapping* ro_map = new DTReadOutMapping("cmssw_ROB", "cmssw_ROS");
231+
DTReadOutMapping ro_map("cmssw_ROB", "cmssw_ROS");
232232
//Loop over file entries
233233
string line;
234234
ifstream file(mapFileName.c_str());
@@ -238,17 +238,17 @@ void DumpFileToDB::endJob() {
238238
stringstream linestr;
239239
linestr << line;
240240
vector<int> channelMap = readChannelsMap(linestr);
241-
int status = ro_map->insertReadOutGeometryLink(channelMap[0],
242-
channelMap[1],
243-
channelMap[2],
244-
channelMap[3],
245-
channelMap[4],
246-
channelMap[5],
247-
channelMap[6],
248-
channelMap[7],
249-
channelMap[8],
250-
channelMap[9],
251-
channelMap[10]);
241+
int status = ro_map.insertReadOutGeometryLink(channelMap[0],
242+
channelMap[1],
243+
channelMap[2],
244+
channelMap[3],
245+
channelMap[4],
246+
channelMap[5],
247+
channelMap[6],
248+
channelMap[7],
249+
channelMap[8],
250+
channelMap[9],
251+
channelMap[10]);
252252
cout << "ddu " << channelMap[0] << " "
253253
<< "ros " << channelMap[1] << " "
254254
<< "rob " << channelMap[2] << " "
@@ -268,10 +268,10 @@ void DumpFileToDB::endJob() {
268268
//---------- Uncertainties
269269
} else if (dbToDump == "RecoUncertDB") { // Write the Uncertainties
270270

271-
DTRecoConditions* conds = new DTRecoConditions();
272-
conds->setFormulaExpr("par[step]");
271+
DTRecoConditions conds;
272+
conds.setFormulaExpr("par[step]");
273273
int version = 1; // Uniform uncertainties per SL and step; parameters 0-3 are for steps 1-4.
274-
conds->setVersion(version);
274+
conds.setVersion(version);
275275

276276
for (DTCalibrationMap::const_iterator keyAndCalibs = theCalibFile->keyAndConsts_begin();
277277
keyAndCalibs != theCalibFile->keyAndConsts_end();
@@ -288,7 +288,7 @@ void DumpFileToDB::endJob() {
288288
throw cms::Exception("IncorrectSetup") << "Inconsistent version of file";
289289

290290
vector<double> params(values.begin() + 11, values.begin() + 11 + nfields);
291-
conds->set((*keyAndCalibs).first, params);
291+
conds.set((*keyAndCalibs).first, params);
292292
DTCalibDBUtils::writeToDB<DTRecoConditions>("DTRecoConditionsUncertRcd", conds);
293293
}
294294
}

0 commit comments

Comments
 (0)