Skip to content

Commit

Permalink
Merge branch 'master' into phaseII_patatrack_local_123X
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianoDee authored Dec 22, 2021
2 parents 702f4bd + 5c1509a commit e63524a
Show file tree
Hide file tree
Showing 294 changed files with 110,443 additions and 4,117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3431,9 +3431,9 @@ void GlobalTrackerMuonAlignment::writeGlPosRcd(CLHEP::HepVector& paramVec) {
throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";

// if (poolDbService->isNewTagRequest("GlobalPositionRcd")) {
// poolDbService->createNewIOV<Alignments>(&(*globalPositions), poolDbService->endOfTime(), "GlobalPositionRcd");
// poolDbService->createOneIOV<Alignments>(globalPositions, poolDbService->endOfTime(), "GlobalPositionRcd");
// } else {
// poolDbService->appendSinceTime<Alignments>(&(*globalPositions), poolDbService->currentTime(), "GlobalPositionRcd");
// poolDbService->appendOneIOV<Alignments>(globalPositions, poolDbService->currentTime(), "GlobalPositionRcd");
// }
poolDbService->writeOneIOV<Alignments>(globalPositions, poolDbService->currentTime(), "GlobalPositionRcd");
std::cout << "done!" << std::endl;
Expand Down
8 changes: 4 additions & 4 deletions Alignment/LaserAlignment/plugins/LaserAlignment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -909,18 +909,18 @@ void LaserAlignment::endRunProduce(edm::Run& theRun, const edm::EventSetup& theS
// Store

// if ( poolDbService->isNewTagRequest(theAlignRecordName) ) {
// poolDbService->createNewIOV<Alignments>( alignments, poolDbService->currentTime(), poolDbService->endOfTime(), theAlignRecordName );
// poolDbService->createOneIOV<Alignments>( alignments, poolDbService->currentTime(), theAlignRecordName );
// }
// else {
// poolDbService->appendSinceTime<Alignments>( alignments, poolDbService->currentTime(), theAlignRecordName );
// poolDbService->appendOneIOV<Alignments>( alignments, poolDbService->currentTime(), theAlignRecordName );
// }
poolDbService->writeOneIOV<Alignments>(alignments, poolDbService->beginOfTime(), theAlignRecordName);

// if ( poolDbService->isNewTagRequest(theErrorRecordName) ) {
// poolDbService->createNewIOV<AlignmentErrorsExtended>( alignmentErrors, poolDbService->currentTime(), poolDbService->endOfTime(), theErrorRecordName );
// poolDbService->createOneIOV<AlignmentErrorsExtended>( alignmentErrors, poolDbService->currentTime(), poolDbService->endOfTime(), theErrorRecordName );
// }
// else {
// poolDbService->appendSinceTime<AlignmentErrorsExtended>( alignmentErrors, poolDbService->currentTime(), theErrorRecordName );
// poolDbService->appendOneIOV<AlignmentErrorsExtended>( alignmentErrors, poolDbService->currentTime(), theErrorRecordName );
// }
poolDbService->writeOneIOV<AlignmentErrorsExtended>(
alignmentErrors, poolDbService->beginOfTime(), theErrorRecordName);
Expand Down
8 changes: 4 additions & 4 deletions Alignment/TrackerAlignment/src/TrackerAlignment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,19 +242,19 @@ void TrackerAlignment::saveToDB(void) {
AlignmentErrorsExtended alignmentErrors = *(theAlignableTracker->alignmentErrors());

// if ( poolDbService->isNewTagRequest(theAlignRecordName) )
// poolDbService->createNewIOV<Alignments>( alignments, poolDbService->endOfTime(),
// poolDbService->createOneIOV<Alignments>( alignments, poolDbService->endOfTime(),
// theAlignRecordName );
// else
// poolDbService->appendSinceTime<Alignments>( alignments, poolDbService->currentTime(),
// poolDbService->appendOneIOV<Alignments>( alignments, poolDbService->currentTime(),
// theAlignRecordName );
// In the two calls below it is assumed that the delete of "theAlignableTracker" is also deleting the two concerned payloads...
poolDbService->writeOneIOV<Alignments>(alignments, poolDbService->currentTime(), theAlignRecordName);
// if ( poolDbService->isNewTagRequest(theErrorRecordName) )
// poolDbService->createNewIOV<AlignmentErrorsExtended>( alignmentErrors,
// poolDbService->createOneIOV<AlignmentErrorsExtended>( alignmentErrors,
// poolDbService->endOfTime(),
// theErrorRecordName );
// else
// poolDbService->appendSinceTime<AlignmentErrorsExtended>( alignmentErrors,
// poolDbService->appendOneIOV<AlignmentErrorsExtended>( alignmentErrors,
// poolDbService->currentTime(),
// theErrorRecordName );
poolDbService->writeOneIOV<AlignmentErrorsExtended>(
Expand Down
6 changes: 6 additions & 0 deletions CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,12 @@ void HcaluLUTTPGCoder::update(const HcalDbService& conditions) {
else if (adc >= mipMax)
lut[adc] |= QIE11_LUT_MSB1;
}

//Zeroing the 4th depth in the trigger towers where |ieta| = 16 to match the behavior in the uHTR firmware in Run3, where the 4th depth is not included in the sum over depths when constructing the TP energy for this tower.
if (abs(cell.ieta()) == 16 && cell.depth() == 4 &&
topo_->triggerMode() >= HcalTopologyMode::TriggerMode_2021) {
lut[adc] = 0;
}
}
}
} else if (subdet == HcalForward) {
Expand Down
6 changes: 3 additions & 3 deletions CalibMuon/DTCalibration/interface/DTCalibDBUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ class DTCalibDBUtils {
/// Write the payload to the DB using PoolDBOutputService.
/// New payload are created in the DB, existing payload are appended.
template <typename T>
static void writeToDB(std::string record, T* payload) {
static void writeToDB(std::string record, const T& payload) {
// Write the ttrig object to DB
edm::Service<cond::service::PoolDBOutputService> dbOutputSvc;
if (dbOutputSvc.isAvailable()) {
try {
if (dbOutputSvc->isNewTagRequest(record)) {
//create mode
dbOutputSvc->writeOne<T>(payload, dbOutputSvc->beginOfTime(), record);
dbOutputSvc->writeOneIOV<T>(payload, dbOutputSvc->beginOfTime(), record);
} else {
//append mode. Note: correct PoolDBESSource must be loaded
dbOutputSvc->writeOne<T>(payload, dbOutputSvc->currentTime(), record);
dbOutputSvc->writeOneIOV<T>(payload, dbOutputSvc->currentTime(), record);
}
} catch (const cond::Exception& er) {
std::cout << er.what() << std::endl;
Expand Down
5 changes: 1 addition & 4 deletions CalibMuon/DTCalibration/plugins/DTMapGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ DTMapGenerator::DTMapGenerator(const ParameterSet& pset) {
}
}

DTMapGenerator::~DTMapGenerator() {}

void DTMapGenerator::endJob() {
cout << "DTMapGenerator: Output Map: " << outputMapName << " ROS Type: " << rosType << endl;

Expand Down Expand Up @@ -130,8 +128,7 @@ void DTMapGenerator::endJob() {
} else {
outRob = robCounter + 21;
}
}
if (sector == 4) {
} else if (sector == 4) {
if (robCounter == 3 || robCounter == 4) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion CalibMuon/DTCalibration/plugins/DTMapGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DTMapGenerator : public edm::one::EDAnalyzer<> {
DTMapGenerator(const edm::ParameterSet& pset);

/// Destructor
~DTMapGenerator() override;
~DTMapGenerator() override = default;

// Operations

Expand Down
4 changes: 2 additions & 2 deletions CalibMuon/DTCalibration/plugins/DTNoiseCalibration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ void DTNoiseCalibration::endJob() {
}

// Save on file the occupancy histos and write the list of noisy cells
DTStatusFlag* statusMap = new DTStatusFlag();
DTStatusFlag statusMap;
for (map<DTLayerId, TH1F*>::const_iterator lHisto = theHistoOccupancyMap_.begin();
lHisto != theHistoOccupancyMap_.end();
++lHisto) {
Expand Down Expand Up @@ -405,7 +405,7 @@ void DTNoiseCalibration::endJob() {
double rateOffset = (useAbsoluteRate_) ? 0. : averageRate;
if ((channelRate - rateOffset) > maximumNoiseRate_) {
DTWireId wireID((*lHisto).first, i_wire);
statusMap->setCellNoise(wireID, true);
statusMap.setCellNoise(wireID, true);
LogVerbatim("Calibration") << ">>> Channel noisy: " << wireID;
}
}
Expand Down
6 changes: 3 additions & 3 deletions CalibMuon/DTCalibration/plugins/DTT0Correction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void DTT0Correction::beginRun(const edm::Run& run, const edm::EventSetup& setup)

void DTT0Correction::endJob() {
// Create the object to be written to DB
DTT0* t0NewMap = new DTT0();
DTT0 t0NewMap;

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

LogVerbatim("Calibration") << "New t0 for: " << wireId << " mean from " << t0Mean << " to " << t0MeanNew
<< " rms from " << t0RMS << " to " << t0RMSNew << endl;
} catch (cms::Exception& e) {
LogError("Calibration") << e.explainSelf();
// Set db to the old value, if it was there in the first place
if (!status) {
t0NewMap->set(wireId, t0Mean, t0RMS, DTTimeUnits::counts);
t0NewMap.set(wireId, t0Mean, t0RMS, DTTimeUnits::counts);
LogVerbatim("Calibration") << "Keep old t0 for: " << wireId << " mean " << t0Mean << " rms " << t0RMS
<< endl;
}
Expand Down
6 changes: 3 additions & 3 deletions CalibMuon/DTCalibration/plugins/DTTTrigCorrection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void DTTTrigCorrection::beginRun(const edm::Run& run, const edm::EventSetup& set

void DTTTrigCorrection::endJob() {
// Create the object to be written to DB
DTTtrig* tTrigNewMap = new DTTtrig();
DTTtrig tTrigNewMap;

for (vector<const DTSuperLayer*>::const_iterator sl = muonGeom_->superLayers().begin();
sl != muonGeom_->superLayers().end();
Expand All @@ -77,7 +77,7 @@ void DTTTrigCorrection::endJob() {
float tTrigMeanNew = tTrigCorr.mean;
float tTrigSigmaNew = tTrigCorr.sigma;
float kFactorNew = tTrigCorr.kFactor;
tTrigNewMap->set((*sl)->id(), tTrigMeanNew, tTrigSigmaNew, kFactorNew, DTTimeUnits::ns);
tTrigNewMap.set((*sl)->id(), tTrigMeanNew, tTrigSigmaNew, kFactorNew, DTTimeUnits::ns);

LogVerbatim("Calibration") << "New tTrig for: " << (*sl)->id() << " mean from " << tTrigMean << " to "
<< tTrigMeanNew << " sigma from " << tTrigSigma << " to " << tTrigSigmaNew
Expand All @@ -86,7 +86,7 @@ void DTTTrigCorrection::endJob() {
LogError("Calibration") << e.explainSelf();
// Set db to the old value, if it was there in the first place
if (!status) {
tTrigNewMap->set((*sl)->id(), tTrigMean, tTrigSigma, kFactor, DTTimeUnits::ns);
tTrigNewMap.set((*sl)->id(), tTrigMean, tTrigSigma, kFactor, DTTimeUnits::ns);
LogVerbatim("Calibration") << "Keep old tTrig for: " << (*sl)->id() << " mean " << tTrigMean << " sigma "
<< tTrigSigma << " kFactor " << kFactor << endl;
}
Expand Down
7 changes: 2 additions & 5 deletions CalibMuon/DTCalibration/plugins/DTTTrigCorrectionFirst.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void DTTTrigCorrectionFirst::beginRun(const edm::Run& run, const edm::EventSetup

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

Expand All @@ -57,7 +57,6 @@ void DTTTrigCorrectionFirst::endJob() {
double rms = 0.;
double averageSigma = 0.;
double average2Sigma = 0.;
double rmsSigma = 0.;
double counter = 0.;
double averagekfactor = 0;
float kfactor = 0;
Expand Down Expand Up @@ -92,9 +91,7 @@ void DTTTrigCorrectionFirst::endJob() {
} //End of loop on superlayers

rms = average2 / (counter - 1);
rmsSigma = average2Sigma / (counter - 1);
rms = sqrt(rms);
rmsSigma = sqrt(rmsSigma);
cout << "average averageSigma counter rms " << average << " " << averageSigma << " " << counter << " " << rms << endl;

for (auto sl = dtSupLylist.begin(); sl != dtSupLylist.end(); sl++) {
Expand Down Expand Up @@ -225,7 +222,7 @@ void DTTTrigCorrectionFirst::endJob() {
}

//Store new ttrig in the new map
tTrigNewMap->set((*sl)->id(), newTTrigMean, newTTrigSigma, newkfactor, DTTimeUnits::ns);
tTrigNewMap.set((*sl)->id(), newTTrigMean, newTTrigSigma, newkfactor, DTTimeUnits::ns);
if (debug) {
cout << "New tTrig: " << (*sl)->id() << " from " << ttrigMean << " to " << newTTrigMean << endl;
cout << "New tTrigSigma: " << (*sl)->id() << " from " << ttrigSigma << " to " << newTTrigSigma << endl;
Expand Down
12 changes: 6 additions & 6 deletions CalibMuon/DTCalibration/plugins/DTVDriftCalibration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,12 @@ void DTVDriftCalibration::endJob() {
// Instantiate a DTCalibrationMap object if you want to calculate the calibration constants
DTCalibrationMap calibValuesFile(theCalibFilePar);
// Create the object to be written to DB
DTMtime* mTime = nullptr;
DTRecoConditions* vDrift = nullptr;
std::unique_ptr<DTMtime> mTime;
std::unique_ptr<DTRecoConditions> vDrift;
if (writeLegacyVDriftDB) {
mTime = new DTMtime();
mTime = std::make_unique<DTMtime>();
} else {
vDrift = new DTRecoConditions();
vDrift = std::make_unique<DTRecoConditions>();
vDrift->setFormulaExpr("[0]");
//vDriftNewMap->setFormulaExpr("[0]*(1-[1]*x)"); // add parametrization for dependency along Y
vDrift->setVersion(1);
Expand Down Expand Up @@ -381,9 +381,9 @@ void DTVDriftCalibration::endJob() {
// Write the vdrift object to DB
if (writeLegacyVDriftDB) {
string record = "DTMtimeRcd";
DTCalibDBUtils::writeToDB<DTMtime>(record, mTime);
DTCalibDBUtils::writeToDB<DTMtime>(record, *mTime);
} else {
DTCalibDBUtils::writeToDB<DTRecoConditions>("DTRecoConditionsVdriftRcd", vDrift);
DTCalibDBUtils::writeToDB<DTRecoConditions>("DTRecoConditionsVdriftRcd", *vDrift);
}
}

Expand Down
12 changes: 6 additions & 6 deletions CalibMuon/DTCalibration/plugins/DTVDriftWriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ void DTVDriftWriter::beginRun(const edm::Run& run, const edm::EventSetup& setup)

void DTVDriftWriter::endJob() {
// Create the object to be written to DB
DTMtime* mTimeNewMap = nullptr;
DTRecoConditions* vDriftNewMap = nullptr;
std::unique_ptr<DTMtime> mTimeNewMap;
std::unique_ptr<DTRecoConditions> vDriftNewMap;
if (writeLegacyVDriftDB) {
mTimeNewMap = new DTMtime();
mTimeNewMap = std::make_unique<DTMtime>();
} else {
vDriftNewMap = new DTRecoConditions();
vDriftNewMap = std::make_unique<DTRecoConditions>();
vDriftNewMap->setFormulaExpr("[0]");
//vDriftNewMap->setFormulaExpr("[0]*(1-[1]*x)"); // add parametrization for dependency along Y
vDriftNewMap->setVersion(1);
Expand Down Expand Up @@ -137,8 +137,8 @@ void DTVDriftWriter::endJob() {
LogVerbatim("Calibration") << "[DTVDriftWriter]Writing vdrift object to DB!";
if (writeLegacyVDriftDB) {
string record = "DTMtimeRcd";
DTCalibDBUtils::writeToDB<DTMtime>(record, mTimeNewMap);
DTCalibDBUtils::writeToDB<DTMtime>(record, *mTimeNewMap);
} else {
DTCalibDBUtils::writeToDB<DTRecoConditions>("DTRecoConditionsVdriftRcd", vDriftNewMap);
DTCalibDBUtils::writeToDB<DTRecoConditions>("DTRecoConditionsVdriftRcd", *vDriftNewMap);
}
}
Loading

0 comments on commit e63524a

Please sign in to comment.