diff --git a/Alignment/MuonAlignment/test/BuildFile.xml b/Alignment/MuonAlignment/test/BuildFile.xml deleted file mode 100644 index 49ff1177511b4..0000000000000 --- a/Alignment/MuonAlignment/test/BuildFile.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/Alignment/MuonAlignment/test/ComputeTransformation.cpp b/Alignment/MuonAlignment/test/ComputeTransformation.cpp deleted file mode 100644 index 06a11fe27f594..0000000000000 --- a/Alignment/MuonAlignment/test/ComputeTransformation.cpp +++ /dev/null @@ -1,86 +0,0 @@ -#include - -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "Geometry/DTGeometry/interface/DTGeometry.h" -#include "Geometry/CSCGeometry/interface/CSCGeometry.h" -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "DataFormats/MuonDetId/interface/DTChamberId.h" -#include "DataFormats/MuonDetId/interface/CSCDetId.h" - -// -// -// class declaration -// - -class ComputeTransformation : public edm::EDAnalyzer { -public: - explicit ComputeTransformation(const edm::ParameterSet&); - ~ComputeTransformation(); - - virtual void analyze(const edm::Event&, const edm::EventSetup&); - -private: - // ----------member data --------------------------- - std::string m_fileName; -}; - -// -// constructors and destructor -// -ComputeTransformation::ComputeTransformation(const edm::ParameterSet& iConfig) - : m_fileName(iConfig.getParameter("fileName")) {} - -ComputeTransformation::~ComputeTransformation() {} - -void ComputeTransformation::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - edm::ESHandle dtGeometry; - iSetup.get().get(dtGeometry); - - edm::ESHandle cscGeometry; - iSetup.get().get(cscGeometry); - - std::ofstream output; - output.open(m_fileName.c_str()); - output << "rotation = {}" << std::endl; - - for (int wheel = -2; wheel <= 2; wheel++) { - for (int station = 1; station <= 4; station++) { - for (int sector = 1; sector <= 14; sector++) { - if (station != 4 and sector > 12) - continue; - DTChamberId id(wheel, station, sector); - // globalcoords = rot * localcoords - Surface::RotationType rot = dtGeometry->idToDet(id)->surface().rotation(); - output << "rotation[\"DT\", " << wheel << ", " << station << ", 0, " << sector << "] = [[" << rot.xx() << ", " - << rot.xy() << ", " << rot.xz() << "], [" << rot.yx() << ", " << rot.yy() << ", " << rot.yz() << "], [" - << rot.zx() << ", " << rot.zy() << ", " << rot.zz() << "]]" << std::endl; - } - } - } - - for (int endcap = 1; endcap <= 2; endcap++) { - for (int station = 1; station <= 4; station++) { - for (int ring = 1; ring <= 3; ring++) { - if (station > 1 and ring == 3) - continue; - for (int sector = 1; sector <= 36; sector++) { - if (station > 1 && ring == 1 && sector > 18) - continue; - CSCDetId id(endcap, station, ring, sector); - // globalcoords = rot * localcoords - Surface::RotationType rot = cscGeometry->idToDet(id)->surface().rotation(); - output << "rotation[\"CSC\", " << endcap << ", " << station << ", " << ring << ", " << sector << "] = [[" - << rot.xx() << ", " << rot.xy() << ", " << rot.xz() << "], [" << rot.yx() << ", " << rot.yy() << ", " - << rot.yz() << "], [" << rot.zx() << ", " << rot.zy() << ", " << rot.zz() << "]]" << std::endl; - } - } - } - } -} - -//define this as a plug-in -DEFINE_FWK_MODULE(ComputeTransformation); diff --git a/Alignment/MuonAlignment/test/MuonGeometryArrange.py b/Alignment/MuonAlignment/test/MuonGeometryArrange.py deleted file mode 100644 index c2395db06fede..0000000000000 --- a/Alignment/MuonAlignment/test/MuonGeometryArrange.py +++ /dev/null @@ -1,106 +0,0 @@ -import FWCore.ParameterSet.Config as cms -process =cms.Process("TEST") - -#Ideal geometry -process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi") -process.load('Configuration.Geometry.GeometryExtended2021_cff') -process.load("Geometry.MuonNumbering.muonNumberingInitialization_cfi") -process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") - -from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, "auto:phase1_2021_design") - -import Geometry.DTGeometryBuilder.dtGeometryDB_cfi -import Geometry.CSCGeometryBuilder.cscGeometryDB_cfi -import Geometry.GEMGeometryBuilder.gemGeometryDB_cfi - -process.DTGeometryIdeal = Geometry.DTGeometryBuilder.dtGeometryDB_cfi.DTGeometryESModule.clone() -process.DTGeometryIdeal.appendToDataLabel = 'MuonGeometryArrangeGeomIdeal' -process.DTGeometryIdeal.applyAlignment = cms.bool(False) -process.CSCGeometryIdeal = Geometry.CSCGeometryBuilder.cscGeometryDB_cfi.CSCGeometryESModule.clone() -process.CSCGeometryIdeal.appendToDataLabel = 'MuonGeometryArrangeGeomIdeal' -process.CSCGeometryIdeal.applyAlignment = cms.bool(False) -process.GEMGeometryIdeal = Geometry.GEMGeometryBuilder.gemGeometryDB_cfi.GEMGeometryESModule.clone() -process.GEMGeometryIdeal.appendToDataLabel = 'MuonGeometryArrangeGeomIdeal' -process.GEMGeometryIdeal.applyAlignment = cms.bool(False) - -process.DTGeometryMuonGeometryArrange1 = Geometry.DTGeometryBuilder.dtGeometryDB_cfi.DTGeometryESModule.clone() -process.DTGeometryMuonGeometryArrange1.appendToDataLabel = 'MuonGeometryArrangeLabel1' -process.DTGeometryMuonGeometryArrange1.applyAlignment = cms.bool(False) -process.CSCGeometryMuonGeometryArrange1 = Geometry.CSCGeometryBuilder.cscGeometryDB_cfi.CSCGeometryESModule.clone() -process.CSCGeometryMuonGeometryArrange1.appendToDataLabel = 'MuonGeometryArrangeLabel1' -process.CSCGeometryMuonGeometryArrange1.applyAlignment = cms.bool(False) -process.GEMGeometryMuonGeometryArrange1 = Geometry.GEMGeometryBuilder.gemGeometryDB_cfi.GEMGeometryESModule.clone() -process.GEMGeometryMuonGeometryArrange1.appendToDataLabel = 'MuonGeometryArrangeLabel1' -process.GEMGeometryMuonGeometryArrange1.applyAlignment = cms.bool(False) - -process.DTGeometryMuonGeometryArrange2 = Geometry.DTGeometryBuilder.dtGeometryDB_cfi.DTGeometryESModule.clone() -process.DTGeometryMuonGeometryArrange2.appendToDataLabel = 'MuonGeometryArrangeLabel2' -process.DTGeometryMuonGeometryArrange2.applyAlignment = cms.bool(False) -process.CSCGeometryMuonGeometryArrange2 = Geometry.CSCGeometryBuilder.cscGeometryDB_cfi.CSCGeometryESModule.clone() -process.CSCGeometryMuonGeometryArrange2.appendToDataLabel = 'MuonGeometryArrangeLabel2' -process.CSCGeometryMuonGeometryArrange2.applyAlignment = cms.bool(False) -process.GEMGeometryMuonGeometryArrange2 = Geometry.GEMGeometryBuilder.gemGeometryDB_cfi.GEMGeometryESModule.clone() -process.GEMGeometryMuonGeometryArrange2.appendToDataLabel = 'MuonGeometryArrangeLabel2' -process.GEMGeometryMuonGeometryArrange2.applyAlignment = cms.bool(False) - -process.DTGeometryMuonGeometryArrange2a = Geometry.DTGeometryBuilder.dtGeometryDB_cfi.DTGeometryESModule.clone() -process.DTGeometryMuonGeometryArrange2a.appendToDataLabel = 'MuonGeometryArrangeLabel2a' -process.DTGeometryMuonGeometryArrange2a.applyAlignment = cms.bool(False) -process.CSCGeometryMuonGeometryArrange2a = Geometry.CSCGeometryBuilder.cscGeometryDB_cfi.CSCGeometryESModule.clone() -process.CSCGeometryMuonGeometryArrange2a.appendToDataLabel = 'MuonGeometryArrangeLabel2a' -process.CSCGeometryMuonGeometryArrange2a.applyAlignment = cms.bool(False) -process.GEMGeometryMuonGeometryArrange2a = Geometry.GEMGeometryBuilder.gemGeometryDB_cfi.GEMGeometryESModule.clone() -process.GEMGeometryMuonGeometryArrange2a.appendToDataLabel = 'MuonGeometryArrangeLabel2a' -process.GEMGeometryMuonGeometryArrange2a.applyAlignment = cms.bool(False) - -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - threshold = cms.untracked.string('INFO') - ), - files = cms.untracked.PSet( - info_txt = cms.untracked.PSet( - threshold = cms.untracked.string('INFO') - ) - ) -) - - -process.source = cms.Source("EmptySource") -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(1) - ) - - -# Full configuration for Muon Geometry Comparison Tool -#process.MuonGeometryCompare = cms.EDFilter("MuonGeometryArrange", -process.MuonGeometryCompare = cms.EDAnalyzer("MuonGeometryArrange", - outputFile = cms.untracked.string('output.root'), - - detIdFlag = cms.untracked.bool(False), - detIdFlagFile = cms.untracked.string('blah.txt'), - weightById = cms.untracked.bool(False), - levels = cms.untracked.vstring('Det'), - weightBy = cms.untracked.string('SELF'), - weightByIdFile = cms.untracked.string('blah2.txt'), - treeName = cms.untracked.string('alignTree'), -# Root input files are not used yet. - inputROOTFile1 = cms.untracked.string('IDEAL'), - inputROOTFile2 = cms.untracked.string('idealmuon2.root'), -# Geometries are read from xml files -# inputXMLCurrent = cms.untracked.string('B.xml'), -# inputXMLCurrent = cms.untracked.string('A.xml'), -# inputXMLCurrent = cms.untracked.string('moveRing.xml'), -# inputXMLCurrent = cms.untracked.string('movedRing.xml'), -# inputXMLCurrent = cms.untracked.string('fiddleMuon.xml'), -# inputXMLCurrent = cms.untracked.string('fiddle2Muon.xml'), - inputXMLCurrent = cms.untracked.string('fiddle3Muon.xml'), - inputXMLReference = cms.untracked.string('idealMuon.xml'), -# A few defaults. You pick. - endcapNumber = cms.untracked.int32(2), - stationNumber = cms.untracked.int32(3), - ringNumber = cms.untracked.int32(2) -) - -process.p = cms.Path( process.MuonGeometryCompare ) - diff --git a/Alignment/MuonAlignment/test/TestMisalign.cpp b/Alignment/MuonAlignment/test/TestMisalign.cpp deleted file mode 100644 index 8b96e0605940b..0000000000000 --- a/Alignment/MuonAlignment/test/TestMisalign.cpp +++ /dev/null @@ -1,130 +0,0 @@ -// -*- C++ -*- -// -// Package: TestMisalign -// Class: TestMisalign -// -// -// Description: Module to test the Alignment software -// -// - -// system include files -#include -#include -#include -#include - -// user include files -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" - -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include - -#include "Geometry/DTGeometry/interface/DTGeometry.h" -#include "Geometry/CSCGeometry/interface/CSCGeometry.h" - -// -// -// class declaration -// - -class TestMisalign : public edm::EDAnalyzer { -public: - explicit TestMisalign(const edm::ParameterSet&); - ~TestMisalign(); - - virtual void analyze(const edm::Event&, const edm::EventSetup&); - -private: - void fillTree(const GeomDet* geomDet); - - // ----------member data --------------------------- - TTree* theTree; - TFile* theFile; - float x, y, z, phi, theta, length, thick, width; - int Id_; - TRotMatrix* rot; -}; - -// -// constructors and destructor -// -TestMisalign::TestMisalign(const edm::ParameterSet& iConfig) { - // Open root file and define tree - std::string fileName = iConfig.getUntrackedParameter("fileName", "test.root"); - theFile = new TFile(fileName.c_str(), "RECREATE"); - theTree = new TTree("theTree", "Detector units positions"); - - theTree->Branch("Id", &Id_, "Id/I"); - theTree->Branch("x", &x, "x/F"); - theTree->Branch("y", &y, "y/F"); - theTree->Branch("z", &z, "z/F"); - theTree->Branch("phi", &phi, "phi/F"); - theTree->Branch("theta", &theta, "theta/F"); - theTree->Branch("length", &length, "length/F"); - theTree->Branch("width", &width, "width/F"); - theTree->Branch("thick", &thick, "thick/F"); - rot = 0; - theTree->Branch("rot", "TRotMatrix", &rot); -} - -TestMisalign::~TestMisalign() { - theTree->Write(); - theFile->Close(); -} - -void TestMisalign::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - edm::LogInfo("MuonAlignment") << "Starting!"; - - // - // Retrieve muon geometry from event setup - // - edm::ESHandle pDT; - edm::ESHandle pCSC; - - iSetup.get().get(pDT); - iSetup.get().get(pCSC); - - // Now loop on detector units, and store position and orientation - for (auto iGeomDet = pDT->dets().begin(); iGeomDet != pDT->dets().end(); iGeomDet++) - this->fillTree(*iGeomDet); - for (auto iGeomDet = pCSC->dets().begin(); iGeomDet != pCSC->dets().end(); iGeomDet++) - this->fillTree(*iGeomDet); - - edm::LogInfo("MuonAlignment") << "Done!"; -} - -//__________________________________________________________________________________________________ -void TestMisalign::fillTree(const GeomDet* geomDet) { - Id_ = geomDet->geographicalId().rawId(); - x = geomDet->position().x(); - y = geomDet->position().y(); - z = geomDet->position().z(); - phi = geomDet->surface().normalVector().phi(); - theta = geomDet->surface().normalVector().theta(); - length = geomDet->surface().bounds().length(); - width = geomDet->surface().bounds().width(); - thick = geomDet->surface().bounds().thickness(); - - double matrix[9] = {geomDet->rotation().xx(), - geomDet->rotation().xy(), - geomDet->rotation().xz(), - geomDet->rotation().yx(), - geomDet->rotation().yy(), - geomDet->rotation().yz(), - geomDet->rotation().zx(), - geomDet->rotation().zy(), - geomDet->rotation().zz()}; - rot = new TRotMatrix("rot", "rot", matrix); - - theTree->Fill(); -} - -//define this as a plug-in -DEFINE_FWK_MODULE(TestMisalign); diff --git a/Alignment/MuonAlignment/test/TestMuonAnalyzer.cpp b/Alignment/MuonAlignment/test/TestMuonAnalyzer.cpp deleted file mode 100644 index 674fbe1cc5cbf..0000000000000 --- a/Alignment/MuonAlignment/test/TestMuonAnalyzer.cpp +++ /dev/null @@ -1,137 +0,0 @@ -// -*- C++ -*- -// -// Package: TestMuonAnalyzer -// Class: TestMuonAnalyzer -// -// -// Description: Module to test the Alignment software -// -// - -// system include files -#include -#include -#include -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "Alignment/MuonAlignment/interface/AlignableMuon.h" -#include "Alignment/MuonAlignment/interface/AlignableDTChamber.h" -#include "Alignment/MuonAlignment/interface/AlignableCSCChamber.h" - -#include "Geometry/DTGeometry/interface/DTGeometry.h" -#include "Geometry/DTGeometry/interface/DTChamber.h" -#include "Geometry/CSCGeometry/interface/CSCGeometry.h" -#include "Geometry/CSCGeometry/interface/CSCChamber.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "Geometry/Records/interface/MuonGeometryRecord.h" -// -// -// class declaration -// - -class TestMuonAnalyzer : public edm::EDAnalyzer { -public: - explicit TestMuonAnalyzer(const edm::ParameterSet&); - ~TestMuonAnalyzer(); - - virtual void analyze(const edm::Event&, const edm::EventSetup&); - -private: - void fillTree(const GeomDet* geomDet); - - // ----------member data --------------------------- - TTree* theTree; - TFile* theFile; - float x, y, z, phi, theta, length, thick, width; - int Id_; - TRotMatrix* rot; -}; - -// -// constructors and destructor -// -TestMuonAnalyzer::TestMuonAnalyzer(const edm::ParameterSet& iConfig) { - // Open root file and define tree - std::string fileName = iConfig.getUntrackedParameter("fileName", "test.root"); - theFile = new TFile(fileName.c_str(), "RECREATE"); - theTree = new TTree("theTree", "Detector units positions"); - - theTree->Branch("Id", &Id_, "Id/I"); - theTree->Branch("x", &x, "x/F"); - theTree->Branch("y", &y, "y/F"); - theTree->Branch("z", &z, "z/F"); - theTree->Branch("phi", &phi, "phi/F"); - theTree->Branch("theta", &theta, "theta/F"); - theTree->Branch("length", &length, "length/F"); - theTree->Branch("width", &width, "width/F"); - theTree->Branch("thick", &thick, "thick/F"); - rot = 0; - theTree->Branch("rot", "TRotMatrix", &rot); -} - -TestMuonAnalyzer::~TestMuonAnalyzer() { - theTree->Write(); - theFile->Close(); -} - -void TestMuonAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - edm::LogInfo("MuonAlignment") << "Starting!"; - - // - // Retrieve muon geometry from event setup - // - edm::ESHandle pDT; - edm::ESHandle pCSC; - - iSetup.get().get(pDT); - iSetup.get().get(pCSC); - - // Now loop on detector units, and store position and orientation - for (auto iGeomDet = pDT->dets().begin(); iGeomDet != pDT->dets().end(); iGeomDet++) - this->fillTree(*iGeomDet); - for (auto iGeomDet = pCSC->dets().begin(); iGeomDet != pCSC->dets().end(); iGeomDet++) - this->fillTree(*iGeomDet); - - edm::LogInfo("MuonAlignment") << "Done!"; -} - -//__________________________________________________________________________________________________ -void TestMuonAnalyzer::fillTree(const GeomDet* geomDet) { - Id_ = geomDet->geographicalId().rawId(); - x = geomDet->position().x(); - y = geomDet->position().y(); - z = geomDet->position().z(); - phi = geomDet->surface().normalVector().phi(); - theta = geomDet->surface().normalVector().theta(); - length = geomDet->surface().bounds().length(); - width = geomDet->surface().bounds().width(); - thick = geomDet->surface().bounds().thickness(); - - double matrix[9] = {geomDet->rotation().xx(), - geomDet->rotation().xy(), - geomDet->rotation().xz(), - geomDet->rotation().yx(), - geomDet->rotation().yy(), - geomDet->rotation().yz(), - geomDet->rotation().zx(), - geomDet->rotation().zy(), - geomDet->rotation().zz()}; - rot = new TRotMatrix("rot", "rot", matrix); // mem. leak? - - theTree->Fill(); -} - -//define this as a plug-in -DEFINE_FWK_MODULE(TestMuonAnalyzer); diff --git a/Alignment/MuonAlignment/test/TestMuonHierarchy.cpp b/Alignment/MuonAlignment/test/TestMuonHierarchy.cpp deleted file mode 100644 index 6e2360a419706..0000000000000 --- a/Alignment/MuonAlignment/test/TestMuonHierarchy.cpp +++ /dev/null @@ -1,114 +0,0 @@ -// -*- C++ -*- -// -// Package: TestMuonHierarchy -// Class: TestMuonHierarchy -// -// -// Description: Module to test the Alignment software -// -// -// Original Author: Frederic Ronga -// Created: March 16, 2006 -// - -// system include files -#include -#include -#include - -// user include files -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include "Geometry/Records/interface/MuonGeometryRecord.h" - -#include "Alignment/MuonAlignment/interface/AlignableMuon.h" -#include "Alignment/CommonAlignment/interface/AlignableObjectId.h" - -static const int kLEAD_WIDTH = 40; // First field width - -// -// class declaration -// -class TestMuonHierarchy : public edm::EDAnalyzer { -public: - explicit TestMuonHierarchy(const edm::ParameterSet&) {} - - virtual void analyze(const edm::Event&, const edm::EventSetup&); - -private: - // ----------member data --------------------------- - void dumpAlignable(const Alignable*, unsigned int, unsigned int); - void printInfo(const Alignable*, unsigned int); - - std::unique_ptr alignableMuon_; - std::string leaders_, blank_, filled_; - - edm::ESGetToken esTokenDT_; - edm::ESGetToken esTokenCSC_; - edm::ESGetToken esTokenGEM_; -}; - -void TestMuonHierarchy::analyze(const edm::Event&, const edm::EventSetup& setup) { - edm::LogInfo("MuonHierarchy") << "Starting!"; - edm::ESHandle dtGeometry = setup.getHandle(esTokenDT_); - edm::ESHandle cscGeometry = setup.getHandle(esTokenCSC_); - edm::ESHandle gemGeometry = setup.getHandle(esTokenGEM_); - - alignableMuon_ = std::make_unique(&(*dtGeometry), &(*cscGeometry), &(*gemGeometry)); - - leaders_ = ""; - blank_ = " "; // These two... - filled_ = "| "; // ... must have the same length - - // Now dump mother of each alignable - //const Alignable* alignable = (&(*theAlignableMuon))->pixelHalfBarrels()[0]; - dumpAlignable(alignableMuon_.get(), 1, 1); - - edm::LogInfo("MuonAlignment") << "Done!"; -} - -//__________________________________________________________________________________________________ -// Recursive loop on alignable hierarchy -void TestMuonHierarchy::dumpAlignable(const Alignable* alignable, unsigned int idau, unsigned int ndau) { - printInfo(alignable, idau); - - if (ndau != idau) - leaders_ += filled_; - else - leaders_ += blank_; - - const align::Alignables& comps = alignable->components(); - if (unsigned int ndau_ = comps.size()) { - unsigned int idau_ = 0; - for (align::Alignables::const_iterator iter = comps.begin(); iter != comps.end(); ++iter) - dumpAlignable(*iter, ++idau_, ndau_); - } - - leaders_ = leaders_.substr(0, leaders_.length() - blank_.length()); -} - -//__________________________________________________________________________________________________ -// Do the actual printout -void TestMuonHierarchy::printInfo(const Alignable* alignable, unsigned int idau) { - int width = kLEAD_WIDTH - leaders_.length(); - - std::ostringstream name, pos, rot; - - name << alignableMuon_->objectIdProvider().idToString(alignable->alignableObjectId()) << idau; - - // Position - pos.setf(std::ios::fixed); - pos << "(" << std::right << std::setw(8) << std::setprecision(4) << alignable->globalPosition().x() << "," - << std::setw(8) << std::setprecision(4) << alignable->globalPosition().y() << "," << std::setw(8) - << std::setprecision(4) << alignable->globalPosition().z() << ")"; - - edm::LogVerbatim("DumpAlignable") << leaders_ << "+-> " << std::setw(width) << std::left << name.str() << " | " - << std::setw(3) << std::left << alignable->components().size() << " | " - << std::setw(11) << std::left << alignable->id() << " | " << pos.str(); -} -//define this as a plug-in -DEFINE_FWK_MODULE(TestMuonHierarchy); diff --git a/Alignment/MuonAlignment/test/TestReader.cpp b/Alignment/MuonAlignment/test/TestReader.cpp deleted file mode 100644 index ba4b9a43633c2..0000000000000 --- a/Alignment/MuonAlignment/test/TestReader.cpp +++ /dev/null @@ -1,263 +0,0 @@ -// -*- C++ -*- -// -// -// Description: Module to test the Alignment software -// -// - -// system include files -#include -#include -#include -#include - -// user include files -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" - -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/ESTransientHandle.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "CondFormats/Alignment/interface/Alignments.h" -#include "CondFormats/Alignment/interface/AlignTransform.h" -#include "CondFormats/AlignmentRecord/interface/DTAlignmentRcd.h" -#include "CondFormats/AlignmentRecord/interface/CSCAlignmentRcd.h" -#include "CondFormats/Alignment/interface/AlignmentErrorsExtended.h" -#include "CondFormats/Alignment/interface/AlignTransformErrorExtended.h" -#include "CondFormats/AlignmentRecord/interface/DTAlignmentErrorExtendedRcd.h" -#include "CondFormats/AlignmentRecord/interface/CSCAlignmentErrorExtendedRcd.h" - -#include "Geometry/DTGeometry/interface/DTGeometry.h" -#include "Geometry/CSCGeometry/interface/CSCGeometry.h" -#include "Geometry/Records/interface/MuonGeometryRecord.h" - -#include "Alignment/MuonAlignment/interface/AlignableMuon.h" -#include "Alignment/CommonAlignment/interface/Utilities.h" -#include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentParameterBuilder.h" - -#include "DataFormats/MuonDetId/interface/CSCDetId.h" - -// -// -// class declaration -// - -class TestMuonReader : public edm::EDAnalyzer { -public: - explicit TestMuonReader(const edm::ParameterSet&); - ~TestMuonReader(); - - void recursiveGetMuChambers(const align::Alignables& composite, align::Alignables& chambers, int kind); - align::EulerAngles toPhiXYZ(const align::RotationType&); - virtual void analyze(const edm::Event&, const edm::EventSetup&); - -private: - // ----------member data --------------------------- - TTree* theTree; - TFile* theFile; - float x, y, z, phi, theta, length, thick, width; - TRotMatrix* rot; - - edm::ESGetToken esTokenDT_; - edm::ESGetToken esTokenCSC_; - edm::ESGetToken esTokenGEM_; -}; - -// -// constructors and destructor -// -TestMuonReader::TestMuonReader(const edm::ParameterSet& iConfig) - : theTree(0), - theFile(0), - x(0.), - y(0.), - z(0.), - phi(0.), - theta(0.), - length(0.), - thick(0.), - width(0.), - rot(0), - esTokenDT_(esConsumes(edm::ESInputTag("", "idealForTestReader"))), - esTokenCSC_(esConsumes(edm::ESInputTag("", "idealForTestReader"))), - esTokenGEM_(esConsumes(edm::ESInputTag("", "idealForTestReader"))) {} - -TestMuonReader::~TestMuonReader() {} - -void TestMuonReader::recursiveGetMuChambers(const align::Alignables& composites, - align::Alignables& chambers, - int kind) { - for (const auto& cit : composites) { - if (cit->alignableObjectId() == kind) { - chambers.push_back(cit); - continue; - } else { - const auto& components = cit->components(); - recursiveGetMuChambers(components, chambers, kind); - } - } -} - -align::EulerAngles TestMuonReader::toPhiXYZ(const align::RotationType& rot) { - align::EulerAngles angles(3); - angles(1) = std::atan2(rot.yz(), rot.zz()); - angles(2) = std::asin(-rot.xz()); - angles(3) = std::atan2(rot.xy(), rot.xx()); - return angles; -} - -void TestMuonReader::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - // first, get chamber alignables from ideal geometry: - edm::ESHandle dtGeometry = iSetup.getHandle(esTokenDT_); - edm::ESHandle cscGeometry = iSetup.getHandle(esTokenCSC_); - edm::ESHandle gemGeometry = iSetup.getHandle(esTokenGEM_); - - AlignableMuon ideal_alignableMuon(&(*dtGeometry), &(*cscGeometry), &(*gemGeometry)); - - const auto& ideal_barrels = ideal_alignableMuon.DTBarrel(); - const auto& ideal_endcaps = ideal_alignableMuon.CSCEndcaps(); - - align::Alignables ideal_mb_chambers, ideal_me_chambers; - recursiveGetMuChambers(ideal_barrels, ideal_mb_chambers, align::AlignableDTChamber); - recursiveGetMuChambers(ideal_endcaps, ideal_me_chambers, align::AlignableCSCChamber); - //std::cout<<" #ideals dts="< dtAlignments; - iSetup.get().get( dtAlignments ); - edm::ESHandle dtAlignmentErrorsExtended; - iSetup.get().get( dtAlignmentErrorsExtended ); - - for ( std::vector::const_iterator it = dtAlignments->m_align.begin(); - it != dtAlignments->m_align.end(); it++ ) - { - CLHEP::HepRotation rot( (*it).rotation() ); - align::RotationType rotation( rot.xx(), rot.xy(), rot.xz(), - rot.yx(), rot.yy(), rot.yz(), - rot.zx(), rot.zy(), rot.zz() ); - - std::cout << (*it).rawId() - << " " << (*it).translation().x() - << " " << (*it).translation().y() - << " " << (*it).translation().z() - << " " << rotation.xx() << " " << rotation.xy() << " " << rotation.xz() - << " " << rotation.yx() << " " << rotation.yy() << " " << rotation.yz() - << " " << rotation.zx() << " " << rotation.zy() << " " << rotation.zz() - << std::endl; - - } - std::cout << std::endl << "----------------------" << std::endl; - - for ( std::vector::const_iterator it = dtAlignmentErrorsExtended->m_alignError.begin(); - it != dtAlignmentErrorsExtended->m_alignError.end(); it++ ) - { - CLHEP::HepSymMatrix error = (*it).matrix(); - std::cout << (*it).rawId() << " "; - for ( int i=0; i cscAlignments; - iSetup.get().get(cscAlignments); - //edm::ESHandle cscAlignmentErrorsExtended; - //iSetup.get().get( cscAlignmentErrorsExtended ); - - //align::Alignables::const_iterator csc_ideal = ideal_endcaps.begin(); - std::cout << std::setprecision(3) << std::fixed; - //std::cout<<" lens : "<m_align.size()<::const_iterator it = cscAlignments->m_align.begin(); - it != cscAlignments->m_align.end(); - it++) { - CSCDetId id((*it).rawId()); - if (id.layer() > 0) - continue; // look at chambers only, skip layers - - if (id.station() == 1 && id.ring() == 4) - continue; // not interested in duplicated ME1/4 - - char nme[100]; - sprintf(nme, "%d/%d/%02d", id.station(), id.ring(), id.chamber()); - std::string me = "ME+"; - if (id.endcap() == 2) - me = "ME-"; - me += nme; - - // find this chamber in ideal geometry - const Alignable* ideal{nullptr}; - for (const auto& cideal : ideal_me_chambers) - if (cideal->geomDetId().rawId() == (*it).rawId()) { - ideal = cideal; - break; - } - if (ideal == nullptr) { - std::cout << " no ideal chamber for " << id << std::endl; - continue; - } - - //if (ideal->geomDetId().rawId() != (*it).rawId()) std::cout<<" badid : "<<(*csc_ideal)->geomDetId().rawId()<<" "<<(*it).rawId()<globalPosition(); - align::RotationType idealRotation = ideal->globalRotation(); - //align::EulerAngles abg = align::toAngles(idealRotation); - //std::cout << me <<" "<< (*it).rawId()<<" "<0.00001 || fabs(rabg[1]-rxyz[1])>0.00001 ||fabs(rabg[1]-rxyz[1])>0.00001) - // std::cout << me <<" large angle diff = "<::const_iterator it = cscAlignmentErrorsExtended->m_alignError.begin(); - it != cscAlignmentErrorsExtended->m_alignError.end(); it++ ) - { - CLHEP::HepSymMatrix error = (*it).matrix(); - std::cout << (*it).rawId() << " "; - for ( int i=0; i -#include -#include -#include - -// user include files -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" - -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESTransientHandle.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "Alignment/MuonAlignment/interface/AlignableMuon.h" -#include - -#include "Geometry/DTGeometry/interface/DTGeometry.h" - -#include "DataFormats/GeometrySurface/interface/Surface.h" - -#include - -// -// -// class declaration -// - -class TestRotation : public edm::EDAnalyzer { -public: - explicit TestRotation(const edm::ParameterSet&); - ~TestRotation(); - - virtual void analyze(const edm::Event&, const edm::EventSetup&); - -private: - // ----------member data --------------------------- - TTree* theTree; - TFile* theFile; - float x, y, z, phi, theta, length, thick, width; - TRotMatrix* dir; - - edm::ESGetToken esTokenDT_; - edm::ESGetToken esTokenCSC_; - edm::ESGetToken esTokenGEM_; -}; - -// -// constructors and destructor -// -TestRotation::TestRotation(const edm::ParameterSet& iConfig) { - // Open root file and define tree - std::string fileName = iConfig.getUntrackedParameter("fileName", "test.root"); - theFile = new TFile(fileName.c_str(), "RECREATE"); - theTree = new TTree("theTree", "Detector units positions"); - - theTree->Branch("x", &x, "x/F"); - theTree->Branch("y", &y, "y/F"); - theTree->Branch("z", &z, "z/F"); - theTree->Branch("phi", &phi, "phi/F"); - theTree->Branch("theta", &theta, "theta/F"); - theTree->Branch("length", &length, "length/F"); - theTree->Branch("width", &width, "width/F"); - theTree->Branch("thick", &thick, "thick/F"); - dir = 0; - theTree->Branch("dir", "TRotMatrix", &dir); -} - -TestRotation::~TestRotation() { - theTree->Write(); - theFile->Close(); -} - -void TestRotation::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - edm::LogInfo("MuonAlignment") << "Starting!"; - - /* - // - // Build alignable muon geometry from event setup - // - - edm::ESTransientHandle cpv; - iRecord.getRecord().get( cpv ); - - DTGeometryBuilderFromDDD DTGeometryBuilder; - CSCGeometryBuilderFromDDD CSCGeometryBuilder; - - theDTGeometry = std::shared_ptr( DTGeometryBuilder.build( &(*cpv) ) ); - theCSCGeometry = std::shared_ptr( CSCGeometryBuilder.build( &(*cpv) ) ); - - AlignableMuon* theAlignableMuon = new AlignableMuon( &(*theDTGeometry) , &(*theCSCGeometry) ); -*/ - - // - // Retrieve ideal geometry from event setup - // - edm::ESHandle dtGeometry = iSetup.getHandle(esTokenDT_); - edm::ESHandle cscGeometry = iSetup.getHandle(esTokenCSC_); - edm::ESHandle gemGeometry = iSetup.getHandle(esTokenGEM_); - - AlignableMuon* theAlignableMuon = new AlignableMuon(&(*dtGeometry), &(*cscGeometry), &(*gemGeometry)); - - // Apply alignment - - const auto& theDTWheels = theAlignableMuon->DTWheels(); - std::cout << "Number of wheels=" << theDTWheels.size() << std::endl; - - for (const auto& iter : theDTWheels) { - std::cout << "------------------------" << std::endl << " BEFORE ROTATION " << std::endl; - - align::GlobalPoint pos_i = iter->globalPosition(); - align::RotationType dir_i = iter->globalRotation(); - - std::cout << "x=" << pos_i.x() << ", y=" << pos_i.y() << ", z=" << pos_i.z() << std::endl; - std::cout << "xx=" << dir_i.xx() << ", yx=" << dir_i.yx() << ", zx=" << dir_i.zx() << std::endl; - std::cout << "xy=" << dir_i.xy() << ", yy=" << dir_i.yy() << ", zy=" << dir_i.zy() << std::endl; - std::cout << "xz=" << dir_i.xz() << ", yz=" << dir_i.yz() << ", zz=" << dir_i.zz() << std::endl; - - // x = iter->surface().position().x(); - // y = iter->surface().position().y(); - // z = iter->surface().position().z(); - // std::cout << "X=" << x << ", Y= " << y << ", Z=" << z << std::endl ; - - double deltaPhi = 3.1415926 / 180 * 45; - - iter->rotateAroundGlobalZ(deltaPhi); - - std::cout << "------------------------" << std::endl << " AFTER ROTATION " << std::endl; - - align::GlobalPoint pos_f = iter->globalPosition(); - align::RotationType dir_f = iter->globalRotation(); - - std::cout << "x=" << pos_f.x() << ", y=" << pos_f.y() << ", z=" << pos_f.z() << std::endl; - std::cout << "xx=" << dir_f.xx() << ", yx=" << dir_f.yx() << ", zx=" << dir_f.zx() << std::endl; - std::cout << "xy=" << dir_f.xy() << ", yy=" << dir_f.yy() << ", zy=" << dir_f.zy() << std::endl; - std::cout << "xz=" << dir_f.xz() << ", yz=" << dir_f.yz() << ", zz=" << dir_f.zz() << std::endl; - std::cout << "------------------------" << std::endl; - } - - // delete theAlignableMuon ; - - edm::LogInfo("MuonAlignment") << "Done!"; -} - -//define this as a plug-in -DEFINE_FWK_MODULE(TestRotation); diff --git a/Alignment/MuonAlignment/test/TestTranslation.cpp b/Alignment/MuonAlignment/test/TestTranslation.cpp deleted file mode 100644 index 758d445308924..0000000000000 --- a/Alignment/MuonAlignment/test/TestTranslation.cpp +++ /dev/null @@ -1,155 +0,0 @@ -// -*- C++ -*- -// -// Package: TestTranslation -// Class: TestTranslation -// -// -// Description: Module to test the Alignment software -// -// - -// system include files -#include -#include -#include -#include - -// user include files -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" - -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESTransientHandle.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "Alignment/MuonAlignment/interface/AlignableMuon.h" -#include - -#include "Geometry/DTGeometry/interface/DTGeometry.h" - -#include "DataFormats/GeometrySurface/interface/Surface.h" - -#include - -// -// -// class declaration -// - -class TestTranslation : public edm::EDAnalyzer { -public: - explicit TestTranslation(const edm::ParameterSet&); - ~TestTranslation(); - - virtual void analyze(const edm::Event&, const edm::EventSetup&); - -private: - // ----------member data --------------------------- - TTree* theTree; - TFile* theFile; - float x, y, z, phi, theta, length, thick, width; - TRotMatrix* dir; - - typedef Surface::RotationType RotationType; - typedef Surface::PositionType PositionType; - - void apply(Alignable*); -}; - -// -// constructors and destructor -// -TestTranslation::TestTranslation(const edm::ParameterSet& iConfig) { - // Open root file and define tree - std::string fileName = iConfig.getUntrackedParameter("fileName", "test.root"); - theFile = new TFile(fileName.c_str(), "RECREATE"); - theTree = new TTree("theTree", "Detector units positions"); - - theTree->Branch("x", &x, "x/F"); - theTree->Branch("y", &y, "y/F"); - theTree->Branch("z", &z, "z/F"); - theTree->Branch("phi", &phi, "phi/F"); - theTree->Branch("theta", &theta, "theta/F"); - theTree->Branch("length", &length, "length/F"); - theTree->Branch("width", &width, "width/F"); - theTree->Branch("thick", &thick, "thick/F"); - dir = 0; - theTree->Branch("dir", "TRotMatrix", &dir); -} - -TestTranslation::~TestTranslation() { - theTree->Write(); - theFile->Close(); -} - -void TestTranslation::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - edm::LogInfo("MuonAlignment") << "Starting!"; - - /* - // - // Build alignable muon geometry from event setup - // - edm::ESTransientHandle cpv; - iRecord.getRecord().get( cpv ); - - DTGeometryBuilderFromDDD DTGeometryBuilder; - CSCGeometryBuilderFromDDD CSCGeometryBuilder; - - theDTGeometry = std::shared_ptr( DTGeometryBuilder.build( &(*cpv) ) ); - theCSCGeometry = std::shared_ptr( CSCGeometryBuilder.build( &(*cpv) ) ); - - AlignableMuon* theAlignableMuon = new AlignableMuon( &(*theDTGeometry) , &(*theCSCGeometry) ); -*/ - - // - // Retrieve ideal geometry from event setup - // - edm::ESHandle dtGeometry; - edm::ESHandle cscGeometry; - edm::ESHandle gemGeometry; - iSetup.get().get(dtGeometry); - iSetup.get().get(cscGeometry); - iSetup.get().get(gemGeometry); - - AlignableMuon* theAlignableMuon = new AlignableMuon(&(*dtGeometry), &(*cscGeometry), &(*gemGeometry)); - - // Apply alignment - for (const auto& iter : theAlignableMuon->DTChambers()) - apply(iter); - for (const auto& iter : theAlignableMuon->CSCEndcaps()) - apply(iter); - - edm::LogInfo("MuonAlignment") << "Done!"; -} - -void TestTranslation::apply(Alignable* it) { - std::cout << "------------------------" << std::endl << " BEFORE TRANSLATION " << std::endl; - - align::GlobalPoint pos_i = (it)->globalPosition(); - // RotationType dir_i = (it)->globalRotation(); - - std::cout << "x=" << pos_i.x() << ", y=" << pos_i.y() << ", z=" << pos_i.z() << std::endl; - - double dx = 1.0; - double dy = 2.0; - double dz = 3.0; - align::GlobalVector dr(dx, dy, dz); - it->move(dr); - - std::cout << "------------------------" << std::endl << " AFTER TRANSLATION " << std::endl; - - align::GlobalPoint pos_f = (it)->globalPosition(); - // RotationType dir_f = (it)->globalRotation(); - - std::cout << "x=" << pos_f.x() << ", y=" << pos_f.y() << ", z=" << pos_f.z() << std::endl; - - std::cout << "------------------------" << std::endl; -} - -// delete theAlignableMuon ; - -//define this as a plug-in -DEFINE_FWK_MODULE(TestTranslation); diff --git a/Alignment/MuonAlignment/test/computeIdealTransformation_cfg.py b/Alignment/MuonAlignment/test/computeIdealTransformation_cfg.py deleted file mode 100644 index ea4f76282d831..0000000000000 --- a/Alignment/MuonAlignment/test/computeIdealTransformation_cfg.py +++ /dev/null @@ -1,35 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("COMPUTEIDEAL") -process.source = cms.Source("EmptySource") -process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1)) - -process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi") -process.load("Geometry.MuonNumbering.muonNumberingInitialization_cfi") -process.load("Geometry.DTGeometry.dtGeometry_cfi") -process.load("Geometry.CSCGeometry.cscGeometry_cfi") - -# Ideal records -# frontier://FrontierProd/CMS_COND_31X_FROM21X DTAlignmentRcd DTIdealGeometry200_mc -# frontier://FrontierProd/CMS_COND_31X_FROM21X DTAlignmentErrorExtendedRcd DTIdealGeometryErrors200_mc -# frontier://FrontierProd/CMS_COND_31X_ALIGNMENT CSCAlignmentRcd CSCIdealGeometry310me42_mc -# frontier://FrontierProd/CMS_COND_31X_ALIGNMENT CSCAlignmentErrorExtendedRcd CSCIdealGeometryErrors310me42_mc -# frontier://FrontierProd/CMS_COND_31X_FROM21X GlobalPositionRcd IdealGeometry -# frontier://FrontierProd/CMS_COND_31X_FROM21X TrackerAlignmentRcd TrackerIdealGeometry210_mc -# frontier://FrontierProd/CMS_COND_31X_FROM21X TrackerAlignmentErrorExtendedRcd TrackerIdealGeometryErrors210_mc - -process.load("CondCore.DBCommon.CondDBSetup_cfi") -process.ideal31Xfrom21X = cms.ESSource("PoolDBESSource", - process.CondDBSetup, - connect = cms.string("frontier://FrontierProd/CMS_COND_31X_FROM21X"), - toGet = cms.VPSet(cms.PSet(record = cms.string("DTAlignmentRcd"), tag = cms.string("DTIdealGeometry200_mc")), - cms.PSet(record = cms.string("DTAlignmentErrorExtendedRcd"), tag = cms.string("DTIdealGeometryErrors200_mc")), - cms.PSet(record = cms.string("GlobalPositionRcd"), tag = cms.string("IdealGeometry")))) -process.ideal31X = cms.ESSource("PoolDBESSource", - process.CondDBSetup, - connect = cms.string("frontier://FrontierProd/CMS_COND_31X_ALIGNMENT"), - toGet = cms.VPSet(cms.PSet(record = cms.string("CSCAlignmentRcd"), tag = cms.string("CSCIdealGeometry310me42_mc")), - cms.PSet(record = cms.string("CSCAlignmentErrorExtendedRcd"), tag = cms.string("CSCIdealGeometryErrors310me42_mc")))) - -process.ComputeTransformation = cms.EDAnalyzer("ComputeTransformation", fileName = cms.string("Alignment/MuonAlignment/data/idealTransformation.py")) -process.Path = cms.Path(process.ComputeTransformation) diff --git a/Alignment/MuonAlignment/test/test-db-read_cfg.py b/Alignment/MuonAlignment/test/test-db-read_cfg.py deleted file mode 100644 index 48981077b91fe..0000000000000 --- a/Alignment/MuonAlignment/test/test-db-read_cfg.py +++ /dev/null @@ -1,67 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("TEST") -# Message logger service -process.load("FWCore.MessageService.MessageLogger_cfi") - -# DT and CSC geometry -process.load("Geometry.MuonCommonData.muonIdealGeometryXML_cfi") -process.load("Geometry.MuonNumbering.muonNumberingInitialization_cfi") - -# Reading misalignments from DB -process.load("CondCore.DBCommon.CondDBSetup_cfi") - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(1) -) -process.source = cms.Source("EmptySource") - - -process.DTGeometryMisalignedMuonProducer = cms.ESProducer("DTGeometryESModule", - appendToDataLabel = cms.string('idealForTestReader'), - applyAlignment = cms.bool(False), - alignmentsLabel = cms.string(''), - fromDDD = cms.bool(True) -) - -process.CSCGeometryMisalignedMuonProducer = cms.ESProducer("CSCGeometryESModule", - appendToDataLabel = cms.string('idealForTestReader'), - debugV = cms.untracked.bool(False), - useGangedStripsInME1a = cms.bool(False), - alignmentsLabel = cms.string(''), - useOnlyWiresInME1a = cms.bool(False), - useRealWireGeometry = cms.bool(True), - useCentreTIOffsets = cms.bool(False), - applyAlignment = cms.bool(False), - fromDDD = cms.bool(True), - fromDD4hep = cms.bool(False) -) - - -from CondCore.DBCommon.CondDBSetup_cfi import CondDBSetup -process.PoolDBESSource = cms.ESSource("PoolDBESSource", - process.CondDBSetup, - toGet = cms.VPSet(cms.PSet( - record = cms.string('DTAlignmentRcd'), - tag = cms.string('DT100InversepbScenario') - ), - cms.PSet( - record = cms.string('DTAlignmentErrorExtendedRcd'), - tag = cms.string('DT100InversepbScenarioErrors') - ), - cms.PSet( - record = cms.string('CSCAlignmentRcd'), - tag = cms.string('CSC100InversepbScenario') - ), - cms.PSet( - record = cms.string('CSCAlignmentErrorExtendedRcd'), - tag = cms.string('CSC100InversepbScenarioErrors') - )), - connect = cms.string('sqlite_file:Alignments.db') -) - -process.prod = cms.EDAnalyzer("TestMuonReader") - -process.p1 = cms.Path(process.prod) - - diff --git a/Alignment/MuonAlignment/test/test-hierarchy_cfg.py b/Alignment/MuonAlignment/test/test-hierarchy_cfg.py deleted file mode 100644 index bac775160ae86..0000000000000 --- a/Alignment/MuonAlignment/test/test-hierarchy_cfg.py +++ /dev/null @@ -1,64 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("TEST") -# Message logger service -process.load("FWCore.MessageService.MessageLogger_cfi") - -# Ideal geometry producer -process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi") -process.load("Geometry.MuonNumbering.muonNumberingInitialization_cfi") - -# testing ideal geometry from Fake... -#process.load("Geometry.DTGeometry.dtGeometry_cfi") -#process.load("Geometry.CSCGeometry.cscGeometry_cfi") -#process.load("CalibMuon.Configuration.Muon_FakeAlignment_cff") - -## ...or testing geometry from DB/sqlite... -#process.load("Geometry.DTGeometry.dtGeometry_cfi") -#process.load("Geometry.CSCGeometry.cscGeometry_cfi") -#process.load("Alignment.CommonAlignmentProducer.GlobalPosition_Frontier_cff") -# -#from CondCore.DBCommon.CondDBSetup_cfi import * -#process.PoolDBESSource = cms.ESSource( -# "PoolDBESSource", -# CondDBSetup, -# #connect = cms.string('frontier://FrontierProd/CMS_COND_31X_ALIGNMENT'), -# connect = cms.string('sqlite_file:Alignments.db'), -# toGet = cms.VPSet(cms.PSet(record = cms.string('DTAlignmentRcd'), -# tag = cms.string('DT100InversepbScenario') -# ), -# cms.PSet(record = cms.string('DTAlignmentErrorExtendedRcd'), -# tag = cms.string('DT100InversepbScenarioErrors') -# ), -# cms.PSet(record = cms.string('CSCAlignmentRcd'), -# tag = cms.string('CSC100InversepbScenario') -# ), -# cms.PSet(record = cms.string('CSCAlignmentErrorExtendedRcd'), -# tag = cms.string('CSC100InversepbScenarioErrors') -# ) -# ) -# ) - -## ... or testing any of the scenarios from cff -process.load("Alignment.MuonAlignment.MisalignedMuon_cfi") -import Alignment.MuonAlignment.Scenarios_cff as _Scenarios -#process.MisalignedMuon.scenario = _Scenarios.MuonNoMovementsScenario -#process.MisalignedMuon.scenario = _Scenarios.Muon10InversepbScenario -process.MisalignedMuon.scenario = _Scenarios.Muon10inversePbScenario2008 - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(1) -) -process.source = cms.Source("EmptySource") - -process.prod = cms.EDAnalyzer("TestMuonHierarchy") - -process.p1 = cms.Path(process.prod) -process.MessageLogger.cout = cms.untracked.PSet( - threshold = cms.untracked.string('INFO'), - default = cms.untracked.PSet( - limit = cms.untracked.int32(10000000) - ) -) - - diff --git a/Alignment/MuonAlignment/test/test-rotation_cfg.py b/Alignment/MuonAlignment/test/test-rotation_cfg.py deleted file mode 100644 index d258cc38b7fc3..0000000000000 --- a/Alignment/MuonAlignment/test/test-rotation_cfg.py +++ /dev/null @@ -1,41 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("TEST") -process.load("Geometry.MuonCommonData.muonIdealGeometryXML_cfi") - -process.load("Geometry.MuonNumbering.muonNumberingInitialization_cfi") - -# DT geometry -# include "Geometry/DTGeometry/data/dtGeometry.cfi" -# CSC geometry -# include "Geometry/CSCGeometry/data/cscGeometry.cfi" -# Misalignment example scenario producer -process.load("Alignment.MuonAlignment.MisalignedMuon_cfi") - -process.MessageLogger = cms.Service("MessageLogger", - info_txt = cms.untracked.PSet( - threshold = cms.untracked.string('INFO') - ), - cerr = cms.untracked.PSet( - threshold = cms.untracked.string('ERROR') - ), - destinations = cms.untracked.vstring('info_txt', - 'cerr') -) - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(1) -) -process.source = cms.Source("EmptySource") - -process.MisalignedTracker = cms.ESProducer("MisalignedTrackerESProducer", - process.MuonNoMovementsScenario -) - -process.prod = cms.EDAnalyzer("TestRotation", - fileName = cms.untracked.string('misaligned-2.root') -) - -process.p1 = cms.Path(process.prod) - - diff --git a/Alignment/MuonAlignment/test/test-translation_cfg.py b/Alignment/MuonAlignment/test/test-translation_cfg.py deleted file mode 100644 index 78cf7b7ae491e..0000000000000 --- a/Alignment/MuonAlignment/test/test-translation_cfg.py +++ /dev/null @@ -1,41 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("TEST") -process.load("Geometry.MuonCommonData.muonIdealGeometryXML_cfi") - -process.load("Geometry.MuonNumbering.muonNumberingInitialization_cfi") - -# DT geometry -# include "Geometry/DTGeometry/data/dtGeometry.cfi" -# -# CSC geometry -# include "Geometry/CSCGeometry/data/cscGeometry.cfi" -process.load("Alignment.MuonAlignment.MisalignedMuon_cfi") - -process.MessageLogger = cms.Service("MessageLogger", - info_txt = cms.untracked.PSet( - threshold = cms.untracked.string('INFO') - ), - cerr = cms.untracked.PSet( - threshold = cms.untracked.string('ERROR') - ), - destinations = cms.untracked.vstring('info_txt', - 'cerr') -) - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(1) -) -process.source = cms.Source("EmptySource") - -process.MisalignedTracker = cms.ESProducer("MisalignedTrackerESProducer", - process.MuonNoMovementsScenario -) - -process.prod = cms.EDAnalyzer("TestTranslation", - fileName = cms.untracked.string('misaligned-2.root') -) - -process.p1 = cms.Path(process.prod) - - diff --git a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGDBCopy.cc b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGDBCopy.cc index 7a9acc35ed156..b71c487f8190f 100644 --- a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGDBCopy.cc +++ b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGDBCopy.cc @@ -148,119 +148,80 @@ void EcalTPGDBCopy::copyToDB(const edm::EventSetup& evtSetup, const std::string& std::string recordName = m_records[container]; if (container == "EcalTPGPedestals") { - const auto handle = evtSetup.getHandle(pedestalsToken_); - const EcalTPGPedestals* obj = handle.product(); - dbOutput->createNewIOV( - new EcalTPGPedestals(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(pedestalsToken_); + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTPGLinearizationConst") { - const auto handle = evtSetup.getHandle(linearizationConstToken_); - const EcalTPGLinearizationConst* obj = handle.product(); - dbOutput->createNewIOV( - new EcalTPGLinearizationConst(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(linearizationConstToken_); + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTPGSlidingWindow") { - const auto handle = evtSetup.getHandle(slidingWindowToken_); - const EcalTPGSlidingWindow* obj = handle.product(); - dbOutput->createNewIOV( - new EcalTPGSlidingWindow(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(slidingWindowToken_); + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTPGFineGrainEBIdMap") { - const auto handle = evtSetup.getHandle(fineGrainEBIdMapToken_); - const EcalTPGFineGrainEBIdMap* obj = handle.product(); - dbOutput->createNewIOV( - new EcalTPGFineGrainEBIdMap(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(fineGrainEBIdMapToken_); + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTPGFineGrainStripEE") { - const auto handle = evtSetup.getHandle(fineGrainStripEEToken_); - const EcalTPGFineGrainStripEE* obj = handle.product(); - dbOutput->createNewIOV( - new EcalTPGFineGrainStripEE(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(fineGrainStripEEToken_); + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTPGFineGrainTowerEE") { - const auto handle = evtSetup.getHandle(fineGrainTowerEEToken_); - const EcalTPGFineGrainTowerEE* obj = handle.product(); - dbOutput->createNewIOV( - new EcalTPGFineGrainTowerEE(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(fineGrainTowerEEToken_); + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTPGLutIdMap") { - const auto handle = evtSetup.getHandle(lutIdMapToken_); - const EcalTPGLutIdMap* obj = handle.product(); - dbOutput->createNewIOV( - new EcalTPGLutIdMap(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(lutIdMapToken_); + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTPGWeightIdMap") { - const auto handle = evtSetup.getHandle(weightIdMapToken_); - const EcalTPGWeightIdMap* obj = handle.product(); - dbOutput->createNewIOV( - new EcalTPGWeightIdMap(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(weightIdMapToken_); + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTPGWeightGroup") { - const auto handle = evtSetup.getHandle(weightGroupToken_); - const EcalTPGWeightGroup* obj = handle.product(); - dbOutput->createNewIOV( - new EcalTPGWeightGroup(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(weightGroupToken_); + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTPGOddWeightIdMap") { - const auto handle = evtSetup.getHandle(oddWeightIdMapToken_); - const EcalTPGOddWeightIdMap* obj = handle.product(); - dbOutput->createNewIOV( - new EcalTPGOddWeightIdMap(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(oddWeightIdMapToken_); + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTPGOddWeightGroup") { - const auto handle = evtSetup.getHandle(oddWeightGroupToken_); - const EcalTPGOddWeightGroup* obj = handle.product(); - dbOutput->createNewIOV( - new EcalTPGOddWeightGroup(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(oddWeightGroupToken_); + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTPGTPMode") { - const auto handle = evtSetup.getHandle(tpModeToken_); - const EcalTPGTPMode* obj = handle.product(); - dbOutput->createNewIOV( - new EcalTPGTPMode(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(tpModeToken_); + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTPGLutGroup") { - const auto handle = evtSetup.getHandle(lutGroupToken_); - const EcalTPGLutGroup* obj = handle.product(); - dbOutput->createNewIOV( - new EcalTPGLutGroup(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(lutGroupToken_); + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTPGFineGrainEBGroup") { - const auto handle = evtSetup.getHandle(fineGrainEBGroupToken_); - const EcalTPGFineGrainEBGroup* obj = handle.product(); - dbOutput->createNewIOV( - new EcalTPGFineGrainEBGroup(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(fineGrainEBGroupToken_); + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTPGPhysicsConst") { - const auto handle = evtSetup.getHandle(physicsConstToken_); - const EcalTPGPhysicsConst* obj = handle.product(); - dbOutput->createNewIOV( - new EcalTPGPhysicsConst(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(physicsConstToken_); + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTPGCrystalStatus") { - const auto handle = evtSetup.getHandle(crystalStatusToken_); - const EcalTPGCrystalStatus* obj = handle.product(); - dbOutput->createNewIOV( - new EcalTPGCrystalStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(crystalStatusToken_); + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTPGTowerStatus") { - const auto handle = evtSetup.getHandle(towerStatusToken_); - const EcalTPGTowerStatus* obj = handle.product(); - dbOutput->createNewIOV( - new EcalTPGTowerStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(towerStatusToken_); + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTPGSpike") { - const auto handle = evtSetup.getHandle(spikeToken_); - const EcalTPGSpike* obj = handle.product(); - - dbOutput->createNewIOV( - new EcalTPGSpike(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(spikeToken_); + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTPGStripStatus") { - const auto handle = evtSetup.getHandle(stripStatusToken_); - const EcalTPGStripStatus* obj = handle.product(); - dbOutput->createNewIOV( - new EcalTPGStripStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(stripStatusToken_); + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else { throw cms::Exception("Unknown container"); diff --git a/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py index 1c6ecf70c86a7..c4d3106a70710 100644 --- a/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py +++ b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py @@ -1,5 +1,5 @@ import FWCore.ParameterSet.Config as cms - +from DQMServices.Components.EDMtoMEConverter_cfi import EDMtoMEConverter from Geometry.VeryForwardGeometry.geometryRPFromDB_cfi import * from CalibPPS.TimingCalibration.PPSDiamondSampicTimingCalibrationPCLHarvester_cfi import * @@ -9,5 +9,11 @@ from DQMServices.Core.DQMEDHarvester import DQMEDHarvester dqmEnv = DQMEDHarvester('DQMHarvestingMetadata', subSystemFolder=cms.untracked.string('AlCaReco/PPSDiamondSampicTimingCalibrationPCL/AlignedChannels')) - -ALCAHARVESTPPSDiamondSampicTimingCalibration = cms.Sequence(PPSDiamondSampicTimingCalibrationPCLHarvester + dqmEnv) + +EDMtoMEConvertPPSTimingSampicCalibration = EDMtoMEConverter.clone() +EDMtoMEConvertPPSTimingSampicCalibration.lumiInputTag = cms.InputTag("EDMtoMEConvertPPSTimingSampicCalibration", "MEtoEDMConverterLumi") +EDMtoMEConvertPPSTimingSampicCalibration.runInputTag = cms.InputTag("EDMtoMEConvertPPSTimingSampicCalibration", "MEtoEDMConverterRun") + +ALCAHARVESTPPSDiamondSampicTimingCalibration = cms.Sequence(EDMtoMEConvertPPSTimingSampicCalibration + + PPSDiamondSampicTimingCalibrationPCLHarvester + + dqmEnv) diff --git a/CalibPPS/TimingCalibration/python/PPSTimingCalibrationHarvester_cff.py b/CalibPPS/TimingCalibration/python/PPSTimingCalibrationHarvester_cff.py index 5fcabfa63217e..d9ac61918802f 100644 --- a/CalibPPS/TimingCalibration/python/PPSTimingCalibrationHarvester_cff.py +++ b/CalibPPS/TimingCalibration/python/PPSTimingCalibrationHarvester_cff.py @@ -2,3 +2,14 @@ from Geometry.VeryForwardGeometry.geometryRPFromDB_cfi import * from CalibPPS.TimingCalibration.ppsTimingCalibrationPCLHarvester_cfi import * +from DQMServices.Components.EDMtoMEConverter_cfi import EDMtoMEConverter + +EDMtoMEConvertPPSTimingCalibration = EDMtoMEConverter.clone() +EDMtoMEConvertPPSTimingCalibration.lumiInputTag = cms.InputTag("EDMtoMEConvertPPSTimingCalibration", "MEtoEDMConverterLumi") +EDMtoMEConvertPPSTimingCalibration.runInputTag = cms.InputTag("EDMtoMEConvertPPSTimingCalibration", "MEtoEDMConverterRun") + + +ALCAHARVESTPPSTimingCalibration = cms.Task( + EDMtoMEConvertPPSTimingCalibration, + ppsTimingCalibrationPCLHarvester +) diff --git a/CalibTracker/SiPixelConnectivity/test/SiPixelFedCablingMapWriter.cc b/CalibTracker/SiPixelConnectivity/test/SiPixelFedCablingMapWriter.cc index 2211cf59282cb..ea608d10459b6 100644 --- a/CalibTracker/SiPixelConnectivity/test/SiPixelFedCablingMapWriter.cc +++ b/CalibTracker/SiPixelConnectivity/test/SiPixelFedCablingMapWriter.cc @@ -70,7 +70,7 @@ void SiPixelFedCablingMapWriter::analyze(const edm::Event& iEvent, const edm::Ev void SiPixelFedCablingMapWriter::beginJob() {} void SiPixelFedCablingMapWriter::endJob() { - SiPixelFedCablingMap* result = new SiPixelFedCablingMap(cabling); + SiPixelFedCablingMap result(cabling); LogInfo("Now NEW writing to DB"); edm::Service mydbservice; if (!mydbservice.isAvailable()) { @@ -84,10 +84,9 @@ void SiPixelFedCablingMapWriter::endJob() { try { if (mydbservice->isNewTagRequest(record_)) { - mydbservice->createNewIOV( - result, mydbservice->beginOfTime(), mydbservice->endOfTime(), record_); + mydbservice->createOneIOV(result, mydbservice->beginOfTime(), record_); } else { - mydbservice->appendSinceTime(result, mydbservice->currentTime(), record_); + mydbservice->appendOneIOV(result, mydbservice->currentTime(), record_); } } catch (std::exception& e) { LogError("std::exception: ") << e.what(); diff --git a/CalibTracker/SiPixelGainCalibration/plugins/SiPixelGainCalibrationAnalysis.cc b/CalibTracker/SiPixelGainCalibration/plugins/SiPixelGainCalibrationAnalysis.cc index 3072ffa6a0f45..ac1d63c186b09 100644 --- a/CalibTracker/SiPixelGainCalibration/plugins/SiPixelGainCalibrationAnalysis.cc +++ b/CalibTracker/SiPixelGainCalibration/plugins/SiPixelGainCalibrationAnalysis.cc @@ -17,8 +17,6 @@ Description: // // user include files -#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" - #include "SiPixelGainCalibrationAnalysis.h" #include #include diff --git a/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAnglePCLHarvester.cc b/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAnglePCLHarvester.cc index a4ee5adcf7cfc..97adca6e609d1 100644 --- a/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAnglePCLHarvester.cc +++ b/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAnglePCLHarvester.cc @@ -412,7 +412,7 @@ void SiPixelLorentzAnglePCLHarvester::dqmEndJob(DQMStore::IBooker& iBooker, DQMS edm::Service mydbservice; if (mydbservice.isAvailable()) { try { - mydbservice->writeOneIOV(LorentzAngle.get(), mydbservice->currentTime(), recordName_); + mydbservice->writeOneIOV(*LorentzAngle, mydbservice->currentTime(), recordName_); } catch (const cond::Exception& er) { edm::LogError("SiPixelLorentzAngleDB") << er.what() << std::endl; } catch (const std::exception& er) { diff --git a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc index b4dc6f87d6684..0dc7621c6b37f 100644 --- a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc +++ b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc @@ -174,10 +174,10 @@ void SiPixelStatusHarvester::dqmEndRun(const edm::Run& iRun, const edm::EventSet if (poolDbService.isAvailable()) { // if(poolDbService.isAvailable() ) // start producing tag for permanent component removed - SiPixelQuality* siPixelQualityPermBad = new SiPixelQuality(); + SiPixelQuality siPixelQualityPermBad; const std::vector badComponentList = badPixelInfo_->getBadComponentList(); for (unsigned int i = 0; i < badComponentList.size(); i++) { - siPixelQualityPermBad->addDisabledModule(badComponentList[i]); + siPixelQualityPermBad.addDisabledModule(badComponentList[i]); uint32_t detId = badComponentList[i].DetID; int detid = int(detId); @@ -194,7 +194,7 @@ void SiPixelStatusHarvester::dqmEndRun(const edm::Run& iRun, const edm::EventSet } if (debug_ == true) { // only produced for debugging reason cond::Time_t thisIOV = (cond::Time_t)iRun.id().run(); - poolDbService->writeOneIOV(*siPixelQualityPermBad, thisIOV, recordName_ + "_permanentBad"); + poolDbService->writeOneIOV(siPixelQualityPermBad, thisIOV, recordName_ + "_permanentBad"); } // IOV for final payloads. FEDerror25 and pcl @@ -203,7 +203,7 @@ void SiPixelStatusHarvester::dqmEndRun(const edm::Run& iRun, const edm::EventSet std::map pclIOV; // container for SiPixelQuality for the whole run - std::map siPixelQualityStuckTBM_Tag; + std::map siPixelQualityStuckTBM_Tag; // stuckTBM tag from FED error 25 with permanent component removed for (SiPixelStatusManager::FEDerror25Map_iterator it = FEDerror25Map.begin(); it != FEDerror25Map.end(); it++) { @@ -219,8 +219,8 @@ void SiPixelStatusHarvester::dqmEndRun(const edm::Run& iRun, const edm::EventSet else interval = int(endLumiBlock_ - it->first + 1); // +1 because need to include the last lumi section - SiPixelQuality* siPixelQuality_stuckTBM = new SiPixelQuality(); - SiPixelQuality* siPixelQuality_FEDerror25 = new SiPixelQuality(); + SiPixelQuality siPixelQuality_stuckTBM; + SiPixelQuality siPixelQuality_FEDerror25; std::map> tmpFEDerror25 = it->second; for (std::map>::iterator ilist = tmpFEDerror25.begin(); ilist != tmpFEDerror25.end(); @@ -272,7 +272,7 @@ void SiPixelStatusHarvester::dqmEndRun(const edm::Run& iRun, const edm::EventSet // fill the badmodule only if there is(are) bad ROC(s) in it if (badrocs_stuckTBM != 0) { BadModule_stuckTBM.BadRocs = badrocs_stuckTBM; - siPixelQuality_stuckTBM->addDisabledModule(BadModule_stuckTBM); + siPixelQuality_stuckTBM.addDisabledModule(BadModule_stuckTBM); } // change module error type if all ROCs are bad @@ -287,7 +287,7 @@ void SiPixelStatusHarvester::dqmEndRun(const edm::Run& iRun, const edm::EventSet // fill the badmodule only if there is(are) bad ROC(s) in it if (badrocs_FEDerror25 != 0) { BadModule_FEDerror25.BadRocs = badrocs_FEDerror25; - siPixelQuality_FEDerror25->addDisabledModule(BadModule_FEDerror25); + siPixelQuality_FEDerror25.addDisabledModule(BadModule_FEDerror25); } } // loop over modules @@ -298,9 +298,7 @@ void SiPixelStatusHarvester::dqmEndRun(const edm::Run& iRun, const edm::EventSet fedError25IOV[it->first] = it->first; if (debug_ == true) // only produced for debugging reason - poolDbService->writeOneIOV(*siPixelQuality_FEDerror25, thisIOV, recordName_ + "_FEDerror25"); - - delete siPixelQuality_FEDerror25; + poolDbService->writeOneIOV(siPixelQuality_FEDerror25, thisIOV, recordName_ + "_FEDerror25"); } // IOV for PCL output tags that "combines" permanent bad/stuckTBM/other @@ -314,9 +312,9 @@ void SiPixelStatusHarvester::dqmEndRun(const edm::Run& iRun, const edm::EventSet std::map::iterator itIOV; // container for SiPixelQuality for the whole run - std::map siPixelQualityPCL_Tag; - std::map siPixelQualityPrompt_Tag; - std::map siPixelQualityOther_Tag; + std::map siPixelQualityPCL_Tag; + std::map siPixelQualityPrompt_Tag; + std::map siPixelQualityOther_Tag; for (itIOV = finalIOV.begin(); itIOV != finalIOV.end(); itIOV++) { int interval = 0; @@ -371,17 +369,17 @@ void SiPixelStatusHarvester::dqmEndRun(const edm::Run& iRun, const edm::EventSet // add empty bad components to "other" tag edm::LogInfo("SiPixelStatusHarvester") << "Tag requested for other in low statistics IOV in the " << outputBase_ << " harvester" << std::endl; - siPixelQualityOther_Tag[itIOV->first] = new SiPixelQuality(); + siPixelQualityOther_Tag[itIOV->first] = SiPixelQuality(); continue; } // create the DB object // payload including all : PCL = permanent bad (low DIGI ROC) + other + stuckTBM - SiPixelQuality* siPixelQualityPCL = new SiPixelQuality(); - SiPixelQuality* siPixelQualityOther = new SiPixelQuality(); + SiPixelQuality siPixelQualityPCL; + SiPixelQuality siPixelQualityOther; // Prompt = permanent bad(low DIGI + low eff/damaged ROCs + other) - SiPixelQuality* siPixelQualityPrompt = new SiPixelQuality(); + SiPixelQuality siPixelQualityPrompt; // loop over modules std::map detectorStatus = tmpSiPixelStatus.getDetectorStatus(); @@ -472,7 +470,7 @@ void SiPixelStatusHarvester::dqmEndRun(const edm::Run& iRun, const edm::EventSet } if (badrocsPCL != 0) { BadModulePCL.BadRocs = badrocsPCL; - siPixelQualityPCL->addDisabledModule(BadModulePCL); + siPixelQualityPCL.addDisabledModule(BadModulePCL); } // Other @@ -483,7 +481,7 @@ void SiPixelStatusHarvester::dqmEndRun(const edm::Run& iRun, const edm::EventSet } if (badrocsOther != 0) { BadModuleOther.BadRocs = badrocsOther; - siPixelQualityOther->addDisabledModule(BadModuleOther); + siPixelQualityOther.addDisabledModule(BadModuleOther); } // start constructing bad components for prompt = "other" + permanent @@ -519,7 +517,7 @@ void SiPixelStatusHarvester::dqmEndRun(const edm::Run& iRun, const edm::EventSet } if (badrocsPrompt != 0) { BadModulePrompt.BadRocs = badrocsPrompt; - siPixelQualityPrompt->addDisabledModule(BadModulePrompt); + siPixelQualityPrompt.addDisabledModule(BadModulePrompt); } } // end module loop @@ -549,25 +547,20 @@ void SiPixelStatusHarvester::dqmEndRun(const edm::Run& iRun, const edm::EventSet // Add a dummy IOV starting from last lumisection+1 to close the tag for the run if ((outputBase_ == "nLumibased" || outputBase_ == "dynamicLumibased") && !finalIOV.empty()) { itIOV = std::prev(finalIOV.end()); // go to last element in the pixel quality tag - SiPixelQuality* lastPrompt = siPixelQualityPrompt_Tag[itIOV->first]; - SiPixelQuality* lastOther = siPixelQualityOther_Tag[itIOV->first]; + SiPixelQuality lastPrompt = siPixelQualityPrompt_Tag[itIOV->first]; + SiPixelQuality lastOther = siPixelQualityOther_Tag[itIOV->first]; // add permanent bad components to last lumi+1 IF AND ONLY IF the last payload of prompt is not equal to permanent bad components edm::LuminosityBlockID lu(iRun.id().run(), endLumiBlock_ + 1); cond::Time_t thisIOV = (cond::Time_t)(lu.value()); if (!SiPixelStatusHarvester::equal(lastPrompt, siPixelQualityPermBad)) - poolDbService->writeOneIOV(*siPixelQualityPermBad, thisIOV, recordName_ + "_prompt"); + poolDbService->writeOneIOV(siPixelQualityPermBad, thisIOV, recordName_ + "_prompt"); // add empty bad components to last lumi+1 IF AND ONLY IF the last payload of other is not equal to empty - SiPixelQuality* siPixelQualityDummy = new SiPixelQuality(); + SiPixelQuality siPixelQualityDummy; if (!SiPixelStatusHarvester::equal(lastOther, siPixelQualityDummy)) - poolDbService->writeOneIOV(*siPixelQualityDummy, thisIOV, recordName_ + "_other"); - - delete siPixelQualityDummy; + poolDbService->writeOneIOV(siPixelQualityDummy, thisIOV, recordName_ + "_other"); } - - delete siPixelQualityPermBad; - } // end of if(poolDbService.isAvailable() ) } @@ -609,15 +602,15 @@ edm::LuminosityBlockNumber_t SiPixelStatusHarvester::stepIOV( } //-------------------------------------------------------------------------------------------------- -bool SiPixelStatusHarvester::equal(SiPixelQuality* a, SiPixelQuality* b) { +bool SiPixelStatusHarvester::equal(SiPixelQuality a, SiPixelQuality b) { std::vector badRocListA; std::vector badRocListB; - for (unsigned int ia = 0; ia < (a->getBadComponentList()).size(); ia++) { - badRocListA.push_back((a->getBadComponentList())[ia]); + for (unsigned int ia = 0; ia < (a.getBadComponentList()).size(); ia++) { + badRocListA.push_back((a.getBadComponentList())[ia]); } - for (unsigned int ib = 0; ib < (b->getBadComponentList()).size(); ib++) { - badRocListB.push_back((b->getBadComponentList())[ib]); + for (unsigned int ib = 0; ib < (b.getBadComponentList()).size(); ib++) { + badRocListB.push_back((b.getBadComponentList())[ib]); } if (badRocListA.size() != badRocListB.size()) @@ -646,23 +639,22 @@ bool SiPixelStatusHarvester::equal(SiPixelQuality* a, SiPixelQuality* b) { } //-------------------------------------------------------------------------------------------------- -void SiPixelStatusHarvester::constructTag(std::map siPixelQualityTag, +void SiPixelStatusHarvester::constructTag(std::map siPixelQualityTag, edm::Service& poolDbService, std::string tagName, edm::Run const& iRun) { - for (std::map::iterator qIt = siPixelQualityTag.begin(); qIt != siPixelQualityTag.end(); - ++qIt) { + for (std::map::iterator qIt = siPixelQualityTag.begin(); qIt != siPixelQualityTag.end(); ++qIt) { edm::LuminosityBlockID lu(iRun.id().run(), qIt->first); cond::Time_t thisIOV = (cond::Time_t)(lu.value()); - SiPixelQuality* thisPayload = qIt->second; + SiPixelQuality thisPayload = qIt->second; if (qIt == siPixelQualityTag.begin()) - poolDbService->writeOneIOV(*thisPayload, thisIOV, recordName_ + "_" + tagName); + poolDbService->writeOneIOV(thisPayload, thisIOV, recordName_ + "_" + tagName); else { - SiPixelQuality* prevPayload = (std::prev(qIt))->second; + SiPixelQuality prevPayload = (std::prev(qIt))->second; if (!SiPixelStatusHarvester::equal(thisPayload, prevPayload)) // only append newIOV if this payload differs wrt last - poolDbService->writeOneIOV(*thisPayload, thisIOV, recordName_ + "_" + tagName); + poolDbService->writeOneIOV(thisPayload, thisIOV, recordName_ + "_" + tagName); } } } diff --git a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.h b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.h index c2fb7a437125f..c669bc29c4aca 100644 --- a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.h +++ b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.h @@ -97,10 +97,10 @@ class SiPixelStatusHarvester : public DQMOneEDAnalyzer IOV); // boolean function to check whether two SiPixelQualitys (pyloads) are identical - bool equal(SiPixelQuality* a, SiPixelQuality* b); + bool equal(SiPixelQuality a, SiPixelQuality b); // Tag constructor - void constructTag(std::map siPixelQualityTag, + void constructTag(std::map siPixelQualityTag, edm::Service& poolDbService, std::string tagName, edm::Run const& iRun); diff --git a/Calibration/LumiAlCaRecoProducers/plugins/RawPCCProducer.cc b/Calibration/LumiAlCaRecoProducers/plugins/RawPCCProducer.cc index 0f19a9a862d41..e73ff7fa0c9a7 100644 --- a/Calibration/LumiAlCaRecoProducers/plugins/RawPCCProducer.cc +++ b/Calibration/LumiAlCaRecoProducers/plugins/RawPCCProducer.cc @@ -41,6 +41,7 @@ class RawPCCProducer : public edm::global::EDProducer pccToken_; + const edm::ESGetToken lumiCorrectionsToken_; const edm::EDPutTokenT putToken_; const std::string takeAverageValue_; //Output average values @@ -55,7 +56,8 @@ class RawPCCProducer : public edm::global::EDProducer( + : lumiCorrectionsToken_(esConsumes()), + putToken_{produces( iConfig.getParameter("RawPCCProducerParameters") .getUntrackedParameter("outputProductName", "alcaLumi"))}, takeAverageValue_{iConfig.getParameter("RawPCCProducerParameters") @@ -123,9 +125,8 @@ void RawPCCProducer::globalEndLuminosityBlockProduce(edm::LuminosityBlock& lumiS std::vector correctionScaleFactors; if (applyCorr_) { - edm::ESHandle corrHandle; - iSetup.get().get(corrHandle); - const LumiCorrections* pccCorrections = corrHandle.product(); + //Get PCC corrections from the event setup through a token + const auto pccCorrections = &iSetup.getData(lumiCorrectionsToken_); correctionScaleFactors = pccCorrections->getCorrectionsBX(); } else { correctionScaleFactors.resize(LumiConstants::numBX, 1.0); diff --git a/Calibration/TkAlCaRecoProducers/plugins/AlcaBeamSpotHarvester.cc b/Calibration/TkAlCaRecoProducers/plugins/AlcaBeamSpotHarvester.cc index d1a1408c72f07..bacf8be8fccf0 100644 --- a/Calibration/TkAlCaRecoProducers/plugins/AlcaBeamSpotHarvester.cc +++ b/Calibration/TkAlCaRecoProducers/plugins/AlcaBeamSpotHarvester.cc @@ -75,30 +75,30 @@ void AlcaBeamSpotHarvester::endRun(const edm::Run &iRun, const edm::EventSetup & if (poolDbService.isAvailable()) { for (AlcaBeamSpotManager::bsMap_iterator it = beamSpotMap.begin(); it != beamSpotMap.end(); it++) { - BeamSpotObjects *aBeamSpot = new BeamSpotObjects(); - aBeamSpot->SetType(it->second.second.type()); - aBeamSpot->SetPosition(it->second.second.x0(), it->second.second.y0(), it->second.second.z0()); + BeamSpotObjects aBeamSpot; + aBeamSpot.SetType(it->second.second.type()); + aBeamSpot.SetPosition(it->second.second.x0(), it->second.second.y0(), it->second.second.z0()); if (sigmaZValue_ == -1) { - aBeamSpot->SetSigmaZ(it->second.second.sigmaZ()); + aBeamSpot.SetSigmaZ(it->second.second.sigmaZ()); } else { - aBeamSpot->SetSigmaZ(sigmaZValue_); + aBeamSpot.SetSigmaZ(sigmaZValue_); } - aBeamSpot->Setdxdz(it->second.second.dxdz()); - aBeamSpot->Setdydz(it->second.second.dydz()); - aBeamSpot->SetBeamWidthX(it->second.second.BeamWidthX()); - aBeamSpot->SetBeamWidthY(it->second.second.BeamWidthY()); - aBeamSpot->SetEmittanceX(it->second.second.emittanceX()); - aBeamSpot->SetEmittanceY(it->second.second.emittanceY()); - aBeamSpot->SetBetaStar(it->second.second.betaStar()); + aBeamSpot.Setdxdz(it->second.second.dxdz()); + aBeamSpot.Setdydz(it->second.second.dydz()); + aBeamSpot.SetBeamWidthX(it->second.second.BeamWidthX()); + aBeamSpot.SetBeamWidthY(it->second.second.BeamWidthY()); + aBeamSpot.SetEmittanceX(it->second.second.emittanceX()); + aBeamSpot.SetEmittanceY(it->second.second.emittanceY()); + aBeamSpot.SetBetaStar(it->second.second.betaStar()); for (int i = 0; i < 7; ++i) { for (int j = 0; j < 7; ++j) { - aBeamSpot->SetCovariance(i, j, it->second.second.covariance(i, j)); + aBeamSpot.SetCovariance(i, j, it->second.second.covariance(i, j)); } } if (sigmaZValue_ > 0) { - aBeamSpot->SetCovariance(3, 3, 0.000025); + aBeamSpot.SetCovariance(3, 3, 0.000025); } cond::Time_t thisIOV = 1; @@ -130,12 +130,7 @@ void AlcaBeamSpotHarvester::endRun(const edm::Run &iRun, const edm::EventSetup & } if (poolDbService->isNewTagRequest(outputrecordName_)) { edm::LogInfo("AlcaBeamSpotHarvester") << "new tag requested" << std::endl; - // poolDbService->createNewIOV(aBeamSpot, - // poolDbService->beginOfTime(),poolDbService->endOfTime(),"BeamSpotObjectsRcd"); - // poolDbService->createNewIOV(aBeamSpot, - // poolDbService->currentTime(), - // poolDbService->endOfTime(),"BeamSpotObjectsRcd"); - poolDbService->writeOne(aBeamSpot, thisIOV, outputrecordName_); + poolDbService->writeOneIOV(aBeamSpot, thisIOV, outputrecordName_); if (dumpTxt_ && beamSpotOutputBase_ == "lumibased") { beamspot::dumpBeamSpotTxt(outFile, currentBS); @@ -149,9 +144,7 @@ void AlcaBeamSpotHarvester::endRun(const edm::Run &iRun, const edm::EventSetup & } } else { edm::LogInfo("AlcaBeamSpotHarvester") << "no new tag requested, appending IOV" << std::endl; - // poolDbService->appendSinceTime(aBeamSpot, - // poolDbService->currentTime(),"BeamSpotObjectsRcd"); - poolDbService->writeOne(aBeamSpot, thisIOV, outputrecordName_); + poolDbService->writeOneIOV(aBeamSpot, thisIOV, outputrecordName_); if (dumpTxt_ && beamSpotOutputBase_ == "lumibased") { beamspot::dumpBeamSpotTxt(outFile, currentBS); } diff --git a/CondFormats/Common/test/BeamSpotObjectsRcdByLumi_prep.json b/CondFormats/Common/data/BeamSpotObjectsRcdByLumi_prep.json similarity index 100% rename from CondFormats/Common/test/BeamSpotObjectsRcdByLumi_prep.json rename to CondFormats/Common/data/BeamSpotObjectsRcdByLumi_prep.json diff --git a/CondFormats/Common/test/BeamSpotObjectsRcdByLumi_prod.json b/CondFormats/Common/data/BeamSpotObjectsRcdByLumi_prod.json similarity index 100% rename from CondFormats/Common/test/BeamSpotObjectsRcdByLumi_prod.json rename to CondFormats/Common/data/BeamSpotObjectsRcdByLumi_prod.json diff --git a/CondFormats/Common/test/BeamSpotObjectsRcdByRun_prep.json b/CondFormats/Common/data/BeamSpotObjectsRcdByRun_prep.json similarity index 100% rename from CondFormats/Common/test/BeamSpotObjectsRcdByRun_prep.json rename to CondFormats/Common/data/BeamSpotObjectsRcdByRun_prep.json diff --git a/CondFormats/Common/test/BeamSpotObjectsRcdByRun_prod.json b/CondFormats/Common/data/BeamSpotObjectsRcdByRun_prod.json similarity index 100% rename from CondFormats/Common/test/BeamSpotObjectsRcdByRun_prod.json rename to CondFormats/Common/data/BeamSpotObjectsRcdByRun_prod.json diff --git a/CondFormats/Common/test/BeamSpotObjectsRcdHPbyLumi_prep.json b/CondFormats/Common/data/BeamSpotObjectsRcdHPbyLumi_prep.json similarity index 100% rename from CondFormats/Common/test/BeamSpotObjectsRcdHPbyLumi_prep.json rename to CondFormats/Common/data/BeamSpotObjectsRcdHPbyLumi_prep.json diff --git a/CondFormats/Common/test/BeamSpotObjectsRcdHPbyLumi_prod.json b/CondFormats/Common/data/BeamSpotObjectsRcdHPbyLumi_prod.json similarity index 100% rename from CondFormats/Common/test/BeamSpotObjectsRcdHPbyLumi_prod.json rename to CondFormats/Common/data/BeamSpotObjectsRcdHPbyLumi_prod.json diff --git a/CondFormats/Common/test/BeamSpotObjectsRcdHPbyRun_prep.json b/CondFormats/Common/data/BeamSpotObjectsRcdHPbyRun_prep.json similarity index 100% rename from CondFormats/Common/test/BeamSpotObjectsRcdHPbyRun_prep.json rename to CondFormats/Common/data/BeamSpotObjectsRcdHPbyRun_prep.json diff --git a/CondFormats/Common/test/BeamSpotObjectsRcdHPbyRun_prod.json b/CondFormats/Common/data/BeamSpotObjectsRcdHPbyRun_prod.json similarity index 100% rename from CondFormats/Common/test/BeamSpotObjectsRcdHPbyRun_prod.json rename to CondFormats/Common/data/BeamSpotObjectsRcdHPbyRun_prod.json diff --git a/CondFormats/Common/test/CTPPSRPAlignmentCorrectionsDataRcd_prep.json b/CondFormats/Common/data/CTPPSRPAlignmentCorrectionsDataRcd_prep.json similarity index 100% rename from CondFormats/Common/test/CTPPSRPAlignmentCorrectionsDataRcd_prep.json rename to CondFormats/Common/data/CTPPSRPAlignmentCorrectionsDataRcd_prep.json diff --git a/CondFormats/Common/test/CTPPSRPAlignmentCorrectionsDataRcd_prod.json b/CondFormats/Common/data/CTPPSRPAlignmentCorrectionsDataRcd_prod.json similarity index 100% rename from CondFormats/Common/test/CTPPSRPAlignmentCorrectionsDataRcd_prod.json rename to CondFormats/Common/data/CTPPSRPAlignmentCorrectionsDataRcd_prod.json diff --git a/CondFormats/Common/test/DropBoxMetadata_example.txt b/CondFormats/Common/data/DropBoxMetadata_example.txt similarity index 100% rename from CondFormats/Common/test/DropBoxMetadata_example.txt rename to CondFormats/Common/data/DropBoxMetadata_example.txt diff --git a/CondFormats/Common/test/EcalPedestal_prep.json b/CondFormats/Common/data/EcalPedestal_prep.json similarity index 100% rename from CondFormats/Common/test/EcalPedestal_prep.json rename to CondFormats/Common/data/EcalPedestal_prep.json diff --git a/CondFormats/Common/test/EcalPedestal_prod.json b/CondFormats/Common/data/EcalPedestal_prod.json similarity index 100% rename from CondFormats/Common/test/EcalPedestal_prod.json rename to CondFormats/Common/data/EcalPedestal_prod.json diff --git a/CondFormats/Common/test/LumiCorrections_prep.json b/CondFormats/Common/data/LumiCorrections_prep.json similarity index 100% rename from CondFormats/Common/test/LumiCorrections_prep.json rename to CondFormats/Common/data/LumiCorrections_prep.json diff --git a/CondFormats/Common/test/LumiCorrections_prod.json b/CondFormats/Common/data/LumiCorrections_prod.json similarity index 100% rename from CondFormats/Common/test/LumiCorrections_prod.json rename to CondFormats/Common/data/LumiCorrections_prod.json diff --git a/CondFormats/Common/test/PPSTimingCalibrationRcd_Sampic_prep.json b/CondFormats/Common/data/PPSTimingCalibrationRcd_Sampic_prep.json similarity index 100% rename from CondFormats/Common/test/PPSTimingCalibrationRcd_Sampic_prep.json rename to CondFormats/Common/data/PPSTimingCalibrationRcd_Sampic_prep.json diff --git a/CondFormats/Common/test/PPSTimingCalibrationRcd_Sampic_prod.json b/CondFormats/Common/data/PPSTimingCalibrationRcd_Sampic_prod.json similarity index 100% rename from CondFormats/Common/test/PPSTimingCalibrationRcd_Sampic_prod.json rename to CondFormats/Common/data/PPSTimingCalibrationRcd_Sampic_prod.json diff --git a/CondFormats/Common/test/PPSTimingCalibrationRcd_prep.json b/CondFormats/Common/data/PPSTimingCalibrationRcd_prep.json similarity index 100% rename from CondFormats/Common/test/PPSTimingCalibrationRcd_prep.json rename to CondFormats/Common/data/PPSTimingCalibrationRcd_prep.json diff --git a/CondFormats/Common/test/PPSTimingCalibrationRcd_prod.json b/CondFormats/Common/data/PPSTimingCalibrationRcd_prod.json similarity index 100% rename from CondFormats/Common/test/PPSTimingCalibrationRcd_prod.json rename to CondFormats/Common/data/PPSTimingCalibrationRcd_prod.json diff --git a/CondFormats/Common/test/SiPixelAliRcd_prep.json b/CondFormats/Common/data/SiPixelAliRcd_prep.json similarity index 100% rename from CondFormats/Common/test/SiPixelAliRcd_prep.json rename to CondFormats/Common/data/SiPixelAliRcd_prep.json diff --git a/CondFormats/Common/test/SiPixelAliRcd_prod.json b/CondFormats/Common/data/SiPixelAliRcd_prod.json similarity index 100% rename from CondFormats/Common/test/SiPixelAliRcd_prod.json rename to CondFormats/Common/data/SiPixelAliRcd_prod.json diff --git a/CondFormats/Common/test/SiPixelLorentzAngleRcd_multirun_prep.json b/CondFormats/Common/data/SiPixelLorentzAngleRcd_multirun_prep.json similarity index 100% rename from CondFormats/Common/test/SiPixelLorentzAngleRcd_multirun_prep.json rename to CondFormats/Common/data/SiPixelLorentzAngleRcd_multirun_prep.json diff --git a/CondFormats/Common/test/SiPixelLorentzAngleRcd_multirun_prod.json b/CondFormats/Common/data/SiPixelLorentzAngleRcd_multirun_prod.json similarity index 100% rename from CondFormats/Common/test/SiPixelLorentzAngleRcd_multirun_prod.json rename to CondFormats/Common/data/SiPixelLorentzAngleRcd_multirun_prod.json diff --git a/CondFormats/Common/test/SiPixelLorentzAngleRcd_prep.json b/CondFormats/Common/data/SiPixelLorentzAngleRcd_prep.json similarity index 100% rename from CondFormats/Common/test/SiPixelLorentzAngleRcd_prep.json rename to CondFormats/Common/data/SiPixelLorentzAngleRcd_prep.json diff --git a/CondFormats/Common/test/SiPixelLorentzAngleRcd_prod.json b/CondFormats/Common/data/SiPixelLorentzAngleRcd_prod.json similarity index 100% rename from CondFormats/Common/test/SiPixelLorentzAngleRcd_prod.json rename to CondFormats/Common/data/SiPixelLorentzAngleRcd_prod.json diff --git a/CondFormats/Common/test/SiPixelQualityFromDbRcd_other_prep.json b/CondFormats/Common/data/SiPixelQualityFromDbRcd_other_prep.json similarity index 100% rename from CondFormats/Common/test/SiPixelQualityFromDbRcd_other_prep.json rename to CondFormats/Common/data/SiPixelQualityFromDbRcd_other_prep.json diff --git a/CondFormats/Common/test/SiPixelQualityFromDbRcd_other_prod.json b/CondFormats/Common/data/SiPixelQualityFromDbRcd_other_prod.json similarity index 100% rename from CondFormats/Common/test/SiPixelQualityFromDbRcd_other_prod.json rename to CondFormats/Common/data/SiPixelQualityFromDbRcd_other_prod.json diff --git a/CondFormats/Common/test/SiPixelQualityFromDbRcd_prompt_prep.json b/CondFormats/Common/data/SiPixelQualityFromDbRcd_prompt_prep.json similarity index 100% rename from CondFormats/Common/test/SiPixelQualityFromDbRcd_prompt_prep.json rename to CondFormats/Common/data/SiPixelQualityFromDbRcd_prompt_prep.json diff --git a/CondFormats/Common/test/SiPixelQualityFromDbRcd_prompt_prod.json b/CondFormats/Common/data/SiPixelQualityFromDbRcd_prompt_prod.json similarity index 100% rename from CondFormats/Common/test/SiPixelQualityFromDbRcd_prompt_prod.json rename to CondFormats/Common/data/SiPixelQualityFromDbRcd_prompt_prod.json diff --git a/CondFormats/Common/test/SiPixelQualityFromDbRcd_stuckTBM_prep.json b/CondFormats/Common/data/SiPixelQualityFromDbRcd_stuckTBM_prep.json similarity index 100% rename from CondFormats/Common/test/SiPixelQualityFromDbRcd_stuckTBM_prep.json rename to CondFormats/Common/data/SiPixelQualityFromDbRcd_stuckTBM_prep.json diff --git a/CondFormats/Common/test/SiPixelQualityFromDbRcd_stuckTBM_prod.json b/CondFormats/Common/data/SiPixelQualityFromDbRcd_stuckTBM_prod.json similarity index 100% rename from CondFormats/Common/test/SiPixelQualityFromDbRcd_stuckTBM_prod.json rename to CondFormats/Common/data/SiPixelQualityFromDbRcd_stuckTBM_prod.json diff --git a/CondFormats/Common/test/SiStripApvGainRcdAAG_multirun_prep.json b/CondFormats/Common/data/SiStripApvGainRcdAAG_multirun_prep.json similarity index 100% rename from CondFormats/Common/test/SiStripApvGainRcdAAG_multirun_prep.json rename to CondFormats/Common/data/SiStripApvGainRcdAAG_multirun_prep.json diff --git a/CondFormats/Common/test/SiStripApvGainRcdAAG_multirun_prod.json b/CondFormats/Common/data/SiStripApvGainRcdAAG_multirun_prod.json similarity index 100% rename from CondFormats/Common/test/SiStripApvGainRcdAAG_multirun_prod.json rename to CondFormats/Common/data/SiStripApvGainRcdAAG_multirun_prod.json diff --git a/CondFormats/Common/test/SiStripApvGainRcdAAG_prep.json b/CondFormats/Common/data/SiStripApvGainRcdAAG_prep.json similarity index 100% rename from CondFormats/Common/test/SiStripApvGainRcdAAG_prep.json rename to CondFormats/Common/data/SiStripApvGainRcdAAG_prep.json diff --git a/CondFormats/Common/test/SiStripApvGainRcdAAG_prod.json b/CondFormats/Common/data/SiStripApvGainRcdAAG_prod.json similarity index 100% rename from CondFormats/Common/test/SiStripApvGainRcdAAG_prod.json rename to CondFormats/Common/data/SiStripApvGainRcdAAG_prod.json diff --git a/CondFormats/Common/test/SiStripApvGainRcdAfterAbortGap_prep.json b/CondFormats/Common/data/SiStripApvGainRcdAfterAbortGap_prep.json similarity index 100% rename from CondFormats/Common/test/SiStripApvGainRcdAfterAbortGap_prep.json rename to CondFormats/Common/data/SiStripApvGainRcdAfterAbortGap_prep.json diff --git a/CondFormats/Common/test/SiStripApvGainRcdAfterAbortGap_prod.json b/CondFormats/Common/data/SiStripApvGainRcdAfterAbortGap_prod.json similarity index 100% rename from CondFormats/Common/test/SiStripApvGainRcdAfterAbortGap_prod.json rename to CondFormats/Common/data/SiStripApvGainRcdAfterAbortGap_prod.json diff --git a/CondFormats/Common/test/SiStripApvGainRcd_multirun_prep.json b/CondFormats/Common/data/SiStripApvGainRcd_multirun_prep.json similarity index 100% rename from CondFormats/Common/test/SiStripApvGainRcd_multirun_prep.json rename to CondFormats/Common/data/SiStripApvGainRcd_multirun_prep.json diff --git a/CondFormats/Common/test/SiStripApvGainRcd_multirun_prod.json b/CondFormats/Common/data/SiStripApvGainRcd_multirun_prod.json similarity index 100% rename from CondFormats/Common/test/SiStripApvGainRcd_multirun_prod.json rename to CondFormats/Common/data/SiStripApvGainRcd_multirun_prod.json diff --git a/CondFormats/Common/test/SiStripApvGainRcd_prep.json b/CondFormats/Common/data/SiStripApvGainRcd_prep.json similarity index 100% rename from CondFormats/Common/test/SiStripApvGainRcd_prep.json rename to CondFormats/Common/data/SiStripApvGainRcd_prep.json diff --git a/CondFormats/Common/test/SiStripApvGainRcd_prod.json b/CondFormats/Common/data/SiStripApvGainRcd_prod.json similarity index 100% rename from CondFormats/Common/test/SiStripApvGainRcd_prod.json rename to CondFormats/Common/data/SiStripApvGainRcd_prod.json diff --git a/CondFormats/Common/test/SiStripBadStripRcd_prep.json b/CondFormats/Common/data/SiStripBadStripRcd_prep.json similarity index 100% rename from CondFormats/Common/test/SiStripBadStripRcd_prep.json rename to CondFormats/Common/data/SiStripBadStripRcd_prep.json diff --git a/CondFormats/Common/test/SiStripBadStripRcd_prod.json b/CondFormats/Common/data/SiStripBadStripRcd_prod.json similarity index 100% rename from CondFormats/Common/test/SiStripBadStripRcd_prod.json rename to CondFormats/Common/data/SiStripBadStripRcd_prod.json diff --git a/CondFormats/Common/plugins/BuildFile.xml b/CondFormats/Common/plugins/BuildFile.xml new file mode 100644 index 0000000000000..8ae323b027886 --- /dev/null +++ b/CondFormats/Common/plugins/BuildFile.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/CondFormats/Common/test/ProduceDropBoxMetadata.cc b/CondFormats/Common/plugins/ProduceDropBoxMetadata.cc similarity index 52% rename from CondFormats/Common/test/ProduceDropBoxMetadata.cc rename to CondFormats/Common/plugins/ProduceDropBoxMetadata.cc index e1d2744e2afeb..0b42cc343bb54 100644 --- a/CondFormats/Common/test/ProduceDropBoxMetadata.cc +++ b/CondFormats/Common/plugins/ProduceDropBoxMetadata.cc @@ -1,33 +1,58 @@ -/* - * See header file for a description of this class. +/** \class ProduceDropBoxMetadata + * Create an sqlite file containing the + * DropBoxMetadata needed for the PCL uploads * - * $Date: 2012/02/15 14:07:10 $ - * $Revision: 1.3 $ + * $Date: 2011/02/22 11:05:16 $ + * $Revision: 1.4 $ * \author G. Cerminara - CERN + * Modifications T. Vami - JHU */ -#include "ProduceDropBoxMetadata.h" - #include #include +#include + +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "CondFormats/DataRecord/interface/DropBoxMetadataRcd.h" #include "CondFormats/Common/interface/DropBoxMetadata.h" - #include "CondFormats/Common/src/headers.h" -#include +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +class ProduceDropBoxMetadata : public edm::one::EDAnalyzer<> { +public: + /// Constructor + explicit ProduceDropBoxMetadata(const edm::ParameterSet&); + + /// Destructor + ~ProduceDropBoxMetadata() override; + +private: + // Operations + void analyze(const edm::Event&, const edm::EventSetup&) override; + + bool read; + bool write; + + std::vector fToWrite; + std::vector fToRead; + + const edm::ESGetToken dropBoxMetadataToken_; +}; using namespace std; using namespace edm; -ProduceDropBoxMetadata::ProduceDropBoxMetadata(const edm::ParameterSet& pSet) { +ProduceDropBoxMetadata::ProduceDropBoxMetadata(const edm::ParameterSet& pSet) : dropBoxMetadataToken_(esConsumes()) { read = pSet.getUntrackedParameter("read"); write = pSet.getUntrackedParameter("write"); @@ -35,67 +60,56 @@ ProduceDropBoxMetadata::ProduceDropBoxMetadata(const edm::ParameterSet& pSet) { fToRead = pSet.getUntrackedParameter >("toRead"); } -ProduceDropBoxMetadata::~ProduceDropBoxMetadata() {} +ProduceDropBoxMetadata::~ProduceDropBoxMetadata() = default; -// void ProduceDropBoxMetadata::beginJob() { -void ProduceDropBoxMetadata::beginRun(const edm::Run& run, const edm::EventSetup& eSetup) { - cout << "[ProduceDropBoxMetadata] beginJob" << endl; - - string plRecord = "DropBoxMetadataRcd"; +void ProduceDropBoxMetadata::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { // --------------------------------------------------------------------------------- // Write the payload - if (write) { - cout << "\n\n[ProduceDropBoxMetadata] entering write, to loop over toWrite\n" << endl; - DropBoxMetadata* metadata = new DropBoxMetadata; + DropBoxMetadata metadata; + edm::LogPrint("ProduceDropBoxMetadata") << "Entering write, to loop over toWrite"; // loop over all the pSets for the TF1 that we want to write to DB for (vector::const_iterator fSetup = fToWrite.begin(); fSetup != fToWrite.end(); ++fSetup) { string record = (*fSetup).getUntrackedParameter("record"); - cout << "\n--- record: " << record << endl; + edm::LogPrint("ProduceDropBoxMetadata") << "\n--- record: " << record; DropBoxMetadata::Parameters params; vector paramKeys = (*fSetup).getParameterNames(); for (vector::const_iterator key = paramKeys.begin(); key != paramKeys.end(); ++key) { if (*key != "record") { string value = (*fSetup).getUntrackedParameter(*key); params.addParameter(*key, value); - cout << " key: " << *key << " value: " << value << endl; + edm::LogPrint("ProduceDropBoxMetadata") << " key: " << *key << " value: " << value; } } - metadata->addRecordParameters(record, params); + metadata.addRecordParameters(record, params); } // actually write to DB edm::Service dbOut; if (dbOut.isAvailable()) { - dbOut->writeOne(metadata, 1, plRecord); + dbOut->writeOneIOV(metadata, 1, "DropBoxMetadataRcd"); } } if (read) { // Read the objects - cout << "\n\n[ProduceDropBoxMetadata] entering read, to loop over toRead\n" << endl; - edm::ESHandle mdPayload; - eSetup.get().get(mdPayload); - - const DropBoxMetadata* metadata = mdPayload.product(); + edm::LogPrint("ProduceDropBoxMetadata") << "Entering read, to loop over toRead"; + const auto& mdPayload = iSetup.getData(dropBoxMetadataToken_); // loop for (vector::const_iterator name = fToRead.begin(); name != fToRead.end(); ++name) { - cout << "\n--- record: " << *name << endl; - if (metadata->knowsRecord(*name)) { - const map& params = metadata->getRecordParameters(*name).getParameterMap(); + edm::LogPrint("ProduceDropBoxMetadata") << "\n--- record: " << *name; + if (mdPayload.knowsRecord(*name)) { + const map& params = mdPayload.getRecordParameters(*name).getParameterMap(); for (map::const_iterator par = params.begin(); par != params.end(); ++par) { - cout << " key: " << par->first << " value: " << par->second << endl; + edm::LogPrint("ProduceDropBoxMetadata") << " key: " << par->first << " value: " << par->second; } } else { - cout << " not in the payload!" << endl; + edm::LogPrint("ProduceDropBoxMetadata") << " not in the payload!"; } } } } -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/MakerMacros.h" - DEFINE_FWK_MODULE(ProduceDropBoxMetadata); diff --git a/CondFormats/Common/test/BuildFile.xml b/CondFormats/Common/test/BuildFile.xml index 515a88c443e45..29524c55620a1 100644 --- a/CondFormats/Common/test/BuildFile.xml +++ b/CondFormats/Common/test/BuildFile.xml @@ -15,9 +15,13 @@ - - - + + + + + + + diff --git a/CondFormats/Common/test/DropBoxMetadataReader.py b/CondFormats/Common/test/DropBoxMetadataReader.py new file mode 100644 index 0000000000000..b619ea989eb07 --- /dev/null +++ b/CondFormats/Common/test/DropBoxMetadataReader.py @@ -0,0 +1,67 @@ +# documentation: https://twiki.cern.ch/twiki/bin/view/CMS/AlCaDBPCL#Drop_box_metadata_management + +import FWCore.ParameterSet.Config as cms + +process = cms.Process("myprocess") + +process.load("CondCore.CondDB.CondDB_cfi") +process.load("FWCore.MessageService.MessageLogger_cfi") + +process.CondDB.connect = 'sqlite_file:DropBoxMetadata.db' + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1) +) +process.source = cms.Source("EmptySource", + firstRun = cms.untracked.uint32(300000) + ) + + +# given a set of .json files in the current dir, ProduceDropBoxMetadata produces a sqlite containign the payload with the prod/and/prep metadata +process.myReader = cms.EDAnalyzer("ProduceDropBoxMetadata", + # set to True if you want to write out a sqlite.db translating the json's into a payload + write = cms.untracked.bool(False), + toWrite = cms.VPSet(), + + # this boolean will read the content of whichever payload is available and print its content to stoutput + # set this to false if you write out a sqlite.db translating the json's into a payload + read = cms.untracked.bool(True), + # toRead lists of record names to be sought inside the DropBoxMetadataRcd payload avaialble to the ProduceDropBoxMetadata; + # for instance, if write is True, you're reading back the metadata you've just entered in the payload from the .json files + toRead = cms.untracked.vstring( + 'BeamSpotObjectsRcdByRun', + 'BeamSpotObjectsRcdByLumi', + 'BeamSpotObjectsRcdHPByLumi', + 'BeamSpotObjectsRcdHPByRun', + 'SiStripBadStripRcd', + 'SiStripApvGainRcd', + 'TrackerAlignmentRcd', + 'SiStripApvGainRcdAfterAbortGap', + 'SiStripApvGainRcdAAG', + 'EcalPedestalsRcd', + "LumiCorrectionsRcd", + "SiPixelQualityFromDbRcd_prompt", + "SiPixelQualityFromDbRcd_stuckTBM", + "SiPixelQualityFromDbRcd_other", + "SiPixelLorentzAngleRcd", + "CTPPSRPAlignmentCorrectionsDataRcd", + "PPSTimingCalibrationRcd", + "PPSTimingCalibrationRcd_Sampic" + ) # same strings as fType + ) + +process.p = cms.Path(process.myReader) + +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +process.GlobalTag.globaltag = '121X_dataRun3_Express_Queue' + +# Set to True if you want to read a DropBoxMetadata payload from a local sqlite +# specify the name of the sqlitefile.db and the tag name; the payload loaded will be for run 300000 +readsqlite = True +if readsqlite: + process.GlobalTag.toGet = cms.VPSet( + cms.PSet(record = cms.string("DropBoxMetadataRcd"), + tag = cms.string("DropBoxMetadata"), + connect = cms.string("sqlite_file:DropBoxMetadata.db") + ) + ) diff --git a/CondFormats/Common/test/ProduceDropBoxMetadata.h b/CondFormats/Common/test/ProduceDropBoxMetadata.h deleted file mode 100644 index d97cf71a162c7..0000000000000 --- a/CondFormats/Common/test/ProduceDropBoxMetadata.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef ProduceDropBoxMetadata_H -#define ProduceDropBoxMetadata_H - -/** \class ProduceDropBoxMetadata - * No description available. - * - * $Date: 2011/02/22 11:05:16 $ - * $Revision: 1.1 $ - * \author G. Cerminara - CERN - */ -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include -#include - -class ProduceDropBoxMetadata : public edm::EDAnalyzer { -public: - /// Constructor - ProduceDropBoxMetadata(const edm::ParameterSet&); - - /// Destructor - virtual ~ProduceDropBoxMetadata(); - - // Operations - // virtual void beginJob(); - virtual void beginRun(const edm::Run& run, const edm::EventSetup& eSetup); - - virtual void analyze(const edm::Event&, const edm::EventSetup&) {} - virtual void endJob() {} - -protected: -private: - bool read; - bool write; - - std::vector fToWrite; - std::vector fToRead; -}; -#endif diff --git a/CondFormats/Common/test/ProduceDropBoxMetadata.py b/CondFormats/Common/test/ProduceDropBoxMetadata.py index 98e22e0705e06..e33956c14acff 100644 --- a/CondFormats/Common/test/ProduceDropBoxMetadata.py +++ b/CondFormats/Common/test/ProduceDropBoxMetadata.py @@ -5,6 +5,7 @@ process = cms.Process("myprocess") process.load("CondCore.CondDB.CondDB_cfi") +process.load("FWCore.MessageService.MessageLogger_cfi") process.CondDB.connect = 'sqlite_file:DropBoxMetadata.db' @@ -20,7 +21,7 @@ def encodeJsonInString(filename): """This function open the json file and encodes it in a string replacing probelamtic characters""" - thefile = open(filename) + thefile = open("../data/"+filename) thejson = json.load(thefile) thefile.close() return json.JSONEncoder().encode(thejson).replace('"',""") @@ -98,7 +99,8 @@ def encodeJsonInString(filename): # set to True if you want to write out a sqlite.db translating the json's into a payload write = cms.untracked.bool(True), - # toWrite holds a list of Pset's, one for each workflow you want to produce DropBoxMetadata for; you need to have 2 .json files for each PSet + # toWrite holds a list of Pset's, one for each workflow you want to produce DropBoxMetadata for; + # you need to have 2 .json files for each PSet toWrite = cms.VPSet(cms.PSet(record = cms.untracked.string("BeamSpotObjectsRcdByRun"), Source = cms.untracked.string("AlcaHarvesting"), FileClass = cms.untracked.string("ALCA"), @@ -217,9 +219,7 @@ def encodeJsonInString(filename): # this boolean will read the content of whichever payload is available and print its content to stoutput # set this to false if you write out a sqlite.db translating the json's into a payload read = cms.untracked.bool(False), - - # toRead lists of record names to be sought inside the DropBoxMetadataRcd payload avaialble to the ProduceDropBoxMetadata; for instance, if write is True, you're reading back the metadata you've just entered in the payload from the .json files - toRead = cms.untracked.vstring('BeamSpotObjectsRcdByRun','BeamSpotObjectsRcdByLumi','BeamSpotObjectsRcdHPByLumi','BeamSpotObjectsRcdHPByRun','SiStripBadStripRcd','SiStripApvGainRcd','TrackerAlignmentRcd','SiStripApvGainRcdAfterAbortGap','SiStripApvGainRcdAAG','EcalPedestalsRcd',"LumiCorrectionsRcd","SiPixelQualityFromDbRcd_prompt","SiPixelQualityFromDbRcd_stuckTBM","SiPixelQualityFromDbRcd_other","SiPixelLorentzAngleRcd","CTPPSRPAlignmentCorrectionsDataRcd","PPSTimingCalibrationRcd","PPSTimingCalibrationRcd_Sampic") # same strings as fType + toRead = cms.untracked.vstring() ) process.p = cms.Path(process.mywriter) @@ -244,13 +244,3 @@ def encodeJsonInString(filename): process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') process.GlobalTag.globaltag = '121X_dataRun3_Express_Queue' -# Set to True if you want to read a DropBoxMetadata payload from a local sqlite -# specify the name of the sqlitefile.db and the tag name; the payload loaded will be for run 300000 -readsqlite = False -if readsqlite: - process.GlobalTag.toGet = cms.VPSet( - cms.PSet(record = cms.string("DropBoxMetadataRcd"), - tag = cms.string("DropBoxMetadata"), - connect = cms.string("sqlite_file:DropBoxMetadata_addHPbyRun.db") - ) - ) diff --git a/CondFormats/Common/test/createTestDBObjects.sh b/CondFormats/Common/test/createTestDBObjects.sh new file mode 100755 index 0000000000000..55945c9e8034d --- /dev/null +++ b/CondFormats/Common/test/createTestDBObjects.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +function die { echo $1: status $2 ; exit $2; } + +echo -e "TESTING Dropbox Metadata DB codes ...\n\n" +cd ${LOCAL_TEST_DIR}/ +cmsRun ProduceDropBoxMetadata.py || die "Failure running ProduceDropBoxMetadata.py" $? + +echo -e "TESTING Dropbox Metadata DB Reader code ...\n Reading local sqlite DropBoxMetadata.db \n\n " +cmsRun DropBoxMetadataReader.py || die "Failure running DropBoxMetadataReader.py" $? + diff --git a/CondFormats/Common/test/testDropboxMetadataDB.cpp b/CondFormats/Common/test/testDropboxMetadataDB.cpp new file mode 100644 index 0000000000000..2f0e0c40064da --- /dev/null +++ b/CondFormats/Common/test/testDropboxMetadataDB.cpp @@ -0,0 +1,2 @@ +#include "FWCore/Utilities/interface/TestHelper.h" +RUNTEST() diff --git a/CondFormats/DTObjects/test/stubs/DTConfigPrint.cc b/CondFormats/DTObjects/test/stubs/DTConfigPrint.cc index 09787b45ea574..7dbb7933a6c42 100644 --- a/CondFormats/DTObjects/test/stubs/DTConfigPrint.cc +++ b/CondFormats/DTObjects/test/stubs/DTConfigPrint.cc @@ -12,8 +12,6 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/MakerMacros.h" #include "CondFormats/DTObjects/test/stubs/DTConfigPrint.h" -#include "CondFormats/DTObjects/interface/DTCCBConfig.h" -#include "CondFormats/DataRecord/interface/DTCCBConfigRcd.h" namespace edmtest { @@ -27,6 +25,7 @@ namespace edmtest { catalog = ""; else catalog = p.getParameter("catalog"); + es_token = esConsumes(); } DTConfigPrint::DTConfigPrint(int i) {} @@ -40,13 +39,12 @@ namespace edmtest { std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl; // get configuration for current run - edm::ESHandle conf; - context.get().get(conf); - std::cout << conf->version() << std::endl; - std::cout << std::distance(conf->begin(), conf->end()) << " data in the container" << std::endl; + const auto& conf = context.getData(es_token); + std::cout << conf.version() << std::endl; + std::cout << std::distance(conf.begin(), conf.end()) << " data in the container" << std::endl; // loop over chambers - DTCCBConfig::ccb_config_map configKeys(conf->configKeyMap()); + DTCCBConfig::ccb_config_map configKeys(conf.configKeyMap()); DTCCBConfig::ccb_config_iterator iter = configKeys.begin(); DTCCBConfig::ccb_config_iterator iend = configKeys.end(); while (iter != iend) { diff --git a/CondFormats/DTObjects/test/stubs/DTConfigPrint.h b/CondFormats/DTObjects/test/stubs/DTConfigPrint.h index 4b83b5df199f7..bbd9d83b7ae45 100644 --- a/CondFormats/DTObjects/test/stubs/DTConfigPrint.h +++ b/CondFormats/DTObjects/test/stubs/DTConfigPrint.h @@ -11,6 +11,9 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CondFormats/DTObjects/interface/DTCCBConfig.h" +#include "CondFormats/DataRecord/interface/DTCCBConfigRcd.h" + //#include "CondFormats/DTObjects/interface/DTConfigList.h" //#include "CondTools/DT/interface/DTConfigHandler.h" //#include "CondTools/DT/interface/DTDBSession.h" @@ -31,6 +34,7 @@ namespace edmtest { std::string catalog; std::string token; bool local; + edm::ESGetToken es_token; // DTDBSession* session; // const DTConfigList* rs; // DTConfigHandler* ri; diff --git a/CondFormats/DTObjects/test/stubs/DTDeadPrint.cc b/CondFormats/DTObjects/test/stubs/DTDeadPrint.cc index 19a480c7c710d..75dde732e8a6d 100644 --- a/CondFormats/DTObjects/test/stubs/DTDeadPrint.cc +++ b/CondFormats/DTObjects/test/stubs/DTDeadPrint.cc @@ -13,12 +13,10 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/MakerMacros.h" #include "CondFormats/DTObjects/test/stubs/DTDeadPrint.h" -#include "CondFormats/DTObjects/interface/DTDeadFlag.h" -#include "CondFormats/DataRecord/interface/DTDeadFlagRcd.h" namespace edmtest { - DTDeadPrint::DTDeadPrint(edm::ParameterSet const& p) {} + DTDeadPrint::DTDeadPrint(edm::ParameterSet const& p) : es_token(esConsumes()) {} DTDeadPrint::DTDeadPrint(int i) {} @@ -29,12 +27,11 @@ namespace edmtest { // Context is not used. std::cout << " I AM IN RUN NUMBER " << e.id().run() << std::endl; std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl; - edm::ESHandle dList; - context.get().get(dList); - std::cout << dList->version() << std::endl; - std::cout << std::distance(dList->begin(), dList->end()) << " data in the container" << std::endl; - DTDeadFlag::const_iterator iter = dList->begin(); - DTDeadFlag::const_iterator iend = dList->end(); + const auto& dList = context.getData(es_token); + std::cout << dList.version() << std::endl; + std::cout << std::distance(dList.begin(), dList.end()) << " data in the container" << std::endl; + DTDeadFlag::const_iterator iter = dList.begin(); + DTDeadFlag::const_iterator iend = dList.end(); while (iter != iend) { const std::pair& data = *iter++; const DTDeadFlagId& id = data.first; diff --git a/CondFormats/DTObjects/test/stubs/DTDeadPrint.h b/CondFormats/DTObjects/test/stubs/DTDeadPrint.h index ae68ae42d980e..e12fd4df5b379 100644 --- a/CondFormats/DTObjects/test/stubs/DTDeadPrint.h +++ b/CondFormats/DTObjects/test/stubs/DTDeadPrint.h @@ -11,6 +11,9 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CondFormats/DTObjects/interface/DTDeadFlag.h" +#include "CondFormats/DataRecord/interface/DTDeadFlagRcd.h" + namespace edmtest { class DTDeadPrint : public edm::EDAnalyzer { public: @@ -20,5 +23,6 @@ namespace edmtest { virtual void analyze(const edm::Event& e, const edm::EventSetup& c); private: + edm::ESGetToken es_token; }; } // namespace edmtest diff --git a/CondFormats/DTObjects/test/stubs/DTDeadUpdate.cc b/CondFormats/DTObjects/test/stubs/DTDeadUpdate.cc index 53f3b97ec314b..576e35d3e6a0d 100644 --- a/CondFormats/DTObjects/test/stubs/DTDeadUpdate.cc +++ b/CondFormats/DTObjects/test/stubs/DTDeadUpdate.cc @@ -17,12 +17,10 @@ Toy EDAnalyzer for testing purposes only. #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" #include "CondFormats/DTObjects/test/stubs/DTDeadUpdate.h" -#include "CondFormats/DTObjects/interface/DTDeadFlag.h" -#include "CondFormats/DataRecord/interface/DTDeadFlagRcd.h" namespace edmtest { - DTDeadUpdate::DTDeadUpdate(edm::ParameterSet const& p) : dSum(0) {} + DTDeadUpdate::DTDeadUpdate(edm::ParameterSet const& p) : dSum(0), es_token(esConsumes()) {} DTDeadUpdate::DTDeadUpdate(int i) : dSum(0) {} @@ -35,12 +33,11 @@ namespace edmtest { // Context is not used. std::cout << " I AM IN RUN NUMBER " << e.id().run() << std::endl; std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl; - edm::ESHandle dList; - context.get().get(dList); - std::cout << dList->version() << std::endl; - std::cout << std::distance(dList->begin(), dList->end()) << " data in the container" << std::endl; - DTDeadFlag::const_iterator iter = dList->begin(); - DTDeadFlag::const_iterator iend = dList->end(); + const auto& dList = context.getData(es_token); + std::cout << dList.version() << std::endl; + std::cout << std::distance(dList.begin(), dList.end()) << " data in the container" << std::endl; + DTDeadFlag::const_iterator iter = dList.begin(); + DTDeadFlag::const_iterator iend = dList.end(); while (iter != iend) { const std::pair& data = *iter++; const DTDeadFlagId& id = data.first; diff --git a/CondFormats/DTObjects/test/stubs/DTDeadUpdate.h b/CondFormats/DTObjects/test/stubs/DTDeadUpdate.h index d26665941f0ef..34dd43dd5ea35 100644 --- a/CondFormats/DTObjects/test/stubs/DTDeadUpdate.h +++ b/CondFormats/DTObjects/test/stubs/DTDeadUpdate.h @@ -11,7 +11,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -class DTDeadFlag; +#include "CondFormats/DTObjects/interface/DTDeadFlag.h" +#include "CondFormats/DataRecord/interface/DTDeadFlagRcd.h" namespace edmtest { class DTDeadUpdate : public edm::EDAnalyzer { @@ -28,5 +29,6 @@ namespace edmtest { void fill_dead_RO(const char* file, DTDeadFlag* deadList); void fill_discCat(const char* file, DTDeadFlag* deadList); DTDeadFlag* dSum; + edm::ESGetToken es_token; }; } // namespace edmtest diff --git a/CondFormats/DTObjects/test/stubs/DTFullMapPrint.cc b/CondFormats/DTObjects/test/stubs/DTFullMapPrint.cc index 0f171d122b0d3..ef710430d1d20 100644 --- a/CondFormats/DTObjects/test/stubs/DTFullMapPrint.cc +++ b/CondFormats/DTObjects/test/stubs/DTFullMapPrint.cc @@ -14,12 +14,10 @@ It gets a compact map from the EventSetup and dumps it as a full map. #include "FWCore/Framework/interface/MakerMacros.h" #include "CondFormats/DTObjects/test/stubs/DTFullMapPrint.h" -#include "CondFormats/DTObjects/interface/DTReadOutMapping.h" -#include "CondFormats/DataRecord/interface/DTReadOutMappingRcd.h" namespace edmtest { - DTFullMapPrint::DTFullMapPrint(edm::ParameterSet const& p) {} + DTFullMapPrint::DTFullMapPrint(edm::ParameterSet const& p) : es_token(esConsumes()) {} DTFullMapPrint::DTFullMapPrint(int i) {} @@ -30,9 +28,8 @@ namespace edmtest { // Context is not used. std::cout << " I AM IN RUN NUMBER " << e.id().run() << std::endl; std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl; - edm::ESHandle dbMap; - context.get().get(dbMap); - const DTReadOutMapping* ro_map = dbMap->fullMap(); + const auto& dbMap = context.getData(es_token); + const DTReadOutMapping* ro_map = dbMap.fullMap(); std::cout << ro_map->mapCellTdc() << " - " << ro_map->mapRobRos() << std::endl; std::cout << std::distance(ro_map->begin(), ro_map->end()) << " connections in the map" << std::endl; DTReadOutMapping::const_iterator iter = ro_map->begin(); diff --git a/CondFormats/DTObjects/test/stubs/DTFullMapPrint.h b/CondFormats/DTObjects/test/stubs/DTFullMapPrint.h index 014c43400af13..1b2b77927440f 100644 --- a/CondFormats/DTObjects/test/stubs/DTFullMapPrint.h +++ b/CondFormats/DTObjects/test/stubs/DTFullMapPrint.h @@ -11,6 +11,9 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CondFormats/DTObjects/interface/DTReadOutMapping.h" +#include "CondFormats/DataRecord/interface/DTReadOutMappingRcd.h" + namespace edmtest { class DTFullMapPrint : public edm::EDAnalyzer { public: @@ -20,5 +23,6 @@ namespace edmtest { virtual void analyze(const edm::Event& e, const edm::EventSetup& c); private: + edm::ESGetToken es_token; }; } // namespace edmtest diff --git a/CondFormats/DTObjects/test/stubs/DTMapPrint.cc b/CondFormats/DTObjects/test/stubs/DTMapPrint.cc index 1c5c47f10b247..6dbe147ca6ba0 100644 --- a/CondFormats/DTObjects/test/stubs/DTMapPrint.cc +++ b/CondFormats/DTObjects/test/stubs/DTMapPrint.cc @@ -13,12 +13,10 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/MakerMacros.h" #include "CondFormats/DTObjects/test/stubs/DTMapPrint.h" -#include "CondFormats/DTObjects/interface/DTReadOutMapping.h" -#include "CondFormats/DataRecord/interface/DTReadOutMappingRcd.h" namespace edmtest { - DTMapPrint::DTMapPrint(edm::ParameterSet const& p) {} + DTMapPrint::DTMapPrint(edm::ParameterSet const& p) : es_token(esConsumes()) {} DTMapPrint::DTMapPrint(int i) {} @@ -29,12 +27,11 @@ namespace edmtest { // Context is not used. std::cout << " I AM IN RUN NUMBER " << e.id().run() << std::endl; std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl; - edm::ESHandle ro_map; - context.get().get(ro_map); - std::cout << ro_map->mapCellTdc() << " - " << ro_map->mapRobRos() << std::endl; - std::cout << std::distance(ro_map->begin(), ro_map->end()) << " connections in the map" << std::endl; - DTReadOutMapping::const_iterator iter = ro_map->begin(); - DTReadOutMapping::const_iterator iend = ro_map->end(); + const auto& ro_map = context.getData(es_token); + std::cout << ro_map.mapCellTdc() << " - " << ro_map.mapRobRos() << std::endl; + std::cout << std::distance(ro_map.begin(), ro_map.end()) << " connections in the map" << std::endl; + DTReadOutMapping::const_iterator iter = ro_map.begin(); + DTReadOutMapping::const_iterator iend = ro_map.end(); while (iter != iend) { const DTReadOutGeometryLink& link = *iter++; std::cout << link.dduId << " " << link.rosId << " " << link.robId << " " << link.tdcId << " " << link.channelId diff --git a/CondFormats/DTObjects/test/stubs/DTMapPrint.h b/CondFormats/DTObjects/test/stubs/DTMapPrint.h index 992c4ff2363ef..23429a7900f47 100644 --- a/CondFormats/DTObjects/test/stubs/DTMapPrint.h +++ b/CondFormats/DTObjects/test/stubs/DTMapPrint.h @@ -11,6 +11,9 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CondFormats/DTObjects/interface/DTReadOutMapping.h" +#include "CondFormats/DataRecord/interface/DTReadOutMappingRcd.h" + namespace edmtest { class DTMapPrint : public edm::EDAnalyzer { public: @@ -20,5 +23,6 @@ namespace edmtest { virtual void analyze(const edm::Event& e, const edm::EventSetup& c); private: + edm::ESGetToken es_token; }; } // namespace edmtest diff --git a/CondFormats/DTObjects/test/stubs/DTRangeT0Print.cc b/CondFormats/DTObjects/test/stubs/DTRangeT0Print.cc index d10f845d59618..ca7ef0b3abf45 100644 --- a/CondFormats/DTObjects/test/stubs/DTRangeT0Print.cc +++ b/CondFormats/DTObjects/test/stubs/DTRangeT0Print.cc @@ -13,12 +13,10 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/MakerMacros.h" #include "CondFormats/DTObjects/test/stubs/DTRangeT0Print.h" -#include "CondFormats/DTObjects/interface/DTRangeT0.h" -#include "CondFormats/DataRecord/interface/DTRangeT0Rcd.h" namespace edmtest { - DTRangeT0Print::DTRangeT0Print(edm::ParameterSet const& p) {} + DTRangeT0Print::DTRangeT0Print(edm::ParameterSet const& p) : es_token(esConsumes()) {} DTRangeT0Print::DTRangeT0Print(int i) {} @@ -29,10 +27,9 @@ namespace edmtest { // Context is not used. std::cout << " I AM IN RUN NUMBER " << e.id().run() << std::endl; std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl; - edm::ESHandle t0; - context.get().get(t0); - std::cout << t0->version() << std::endl; - std::cout << std::distance(t0->begin(), t0->end()) << " data in the container" << std::endl; + const auto& t0 = context.getData(es_token); + std::cout << t0.version() << std::endl; + std::cout << std::distance(t0.begin(), t0.end()) << " data in the container" << std::endl; } DEFINE_FWK_MODULE(DTRangeT0Print); } // namespace edmtest diff --git a/CondFormats/DTObjects/test/stubs/DTRangeT0Print.h b/CondFormats/DTObjects/test/stubs/DTRangeT0Print.h index cb906e0120fff..a157c2b4dea5c 100644 --- a/CondFormats/DTObjects/test/stubs/DTRangeT0Print.h +++ b/CondFormats/DTObjects/test/stubs/DTRangeT0Print.h @@ -11,6 +11,9 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CondFormats/DTObjects/interface/DTRangeT0.h" +#include "CondFormats/DataRecord/interface/DTRangeT0Rcd.h" + namespace edmtest { class DTRangeT0Print : public edm::EDAnalyzer { public: @@ -20,5 +23,6 @@ namespace edmtest { virtual void analyze(const edm::Event& e, const edm::EventSetup& c); private: + edm::ESGetToken es_token; }; } // namespace edmtest diff --git a/CondFormats/DTObjects/test/stubs/DTT0Print.cc b/CondFormats/DTObjects/test/stubs/DTT0Print.cc index 585ad57a023cc..3cc4dd2cee7ef 100644 --- a/CondFormats/DTObjects/test/stubs/DTT0Print.cc +++ b/CondFormats/DTObjects/test/stubs/DTT0Print.cc @@ -13,12 +13,10 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/MakerMacros.h" #include "CondFormats/DTObjects/test/stubs/DTT0Print.h" -#include "CondFormats/DTObjects/interface/DTT0.h" -#include "CondFormats/DataRecord/interface/DTT0Rcd.h" namespace edmtest { - DTT0Print::DTT0Print(edm::ParameterSet const& p) {} + DTT0Print::DTT0Print(edm::ParameterSet const& p) : es_token(esConsumes()) {} DTT0Print::DTT0Print(int i) {} @@ -29,14 +27,13 @@ namespace edmtest { // Context is not used. std::cout << " I AM IN RUN NUMBER " << e.id().run() << std::endl; std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl; - edm::ESHandle t0; - context.get().get(t0); - std::cout << t0->version() << std::endl; - std::cout << std::distance(t0->begin(), t0->end()) << " data in the container" << std::endl; + const auto& t0 = context.getData(es_token); + std::cout << t0.version() << std::endl; + std::cout << std::distance(t0.begin(), t0.end()) << " data in the container" << std::endl; float t0mean; float t0rms; - DTT0::const_iterator iter = t0->begin(); - DTT0::const_iterator iend = t0->end(); + DTT0::const_iterator iter = t0.begin(); + DTT0::const_iterator iend = t0.end(); while (iter != iend) { const DTT0Data& t0Data = *iter++; int channelId = t0Data.channelId; @@ -48,7 +45,7 @@ namespace edmtest { DTChamberId cc(id.chamberId()); std::cout << channelId << " " << id.rawId() << " " << cp->rawId() << " " << ch.rawId() << " " << cc.rawId() << std::endl; - t0->get(id, t0mean, t0rms, DTTimeUnits::counts); + t0.get(id, t0mean, t0rms, DTTimeUnits::counts); std::cout << id.wheel() << " " << id.station() << " " << id.sector() << " " << id.superlayer() << " " << id.layer() << " " << id.wire() << " -> " << t0Data.t0mean << " " << t0Data.t0rms << " -> " << t0mean << " " << t0rms << std::endl; diff --git a/CondFormats/DTObjects/test/stubs/DTT0Print.h b/CondFormats/DTObjects/test/stubs/DTT0Print.h index 05e3baf666f78..0b57eae258819 100644 --- a/CondFormats/DTObjects/test/stubs/DTT0Print.h +++ b/CondFormats/DTObjects/test/stubs/DTT0Print.h @@ -11,6 +11,9 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CondFormats/DTObjects/interface/DTT0.h" +#include "CondFormats/DataRecord/interface/DTT0Rcd.h" + namespace edmtest { class DTT0Print : public edm::EDAnalyzer { public: @@ -20,5 +23,6 @@ namespace edmtest { virtual void analyze(const edm::Event& e, const edm::EventSetup& c); private: + edm::ESGetToken es_token; }; } // namespace edmtest diff --git a/CondFormats/DTObjects/test/stubs/DTTtrigPrint.cc b/CondFormats/DTObjects/test/stubs/DTTtrigPrint.cc index e7851e62f40b2..797d6ba0e435f 100644 --- a/CondFormats/DTObjects/test/stubs/DTTtrigPrint.cc +++ b/CondFormats/DTObjects/test/stubs/DTTtrigPrint.cc @@ -13,12 +13,10 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/MakerMacros.h" #include "CondFormats/DTObjects/test/stubs/DTTtrigPrint.h" -#include "CondFormats/DTObjects/interface/DTTtrig.h" -#include "CondFormats/DataRecord/interface/DTTtrigRcd.h" namespace edmtest { - DTTtrigPrint::DTTtrigPrint(edm::ParameterSet const& p) {} + DTTtrigPrint::DTTtrigPrint(edm::ParameterSet const& p) : es_token(esConsumes()) {} DTTtrigPrint::DTTtrigPrint(int i) {} @@ -29,12 +27,11 @@ namespace edmtest { // Context is not used. std::cout << " I AM IN RUN NUMBER " << e.id().run() << std::endl; std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl; - edm::ESHandle tTrig; - context.get().get(tTrig); - std::cout << tTrig->version() << std::endl; - std::cout << std::distance(tTrig->begin(), tTrig->end()) << " data in the container" << std::endl; - DTTtrig::const_iterator iter = tTrig->begin(); - DTTtrig::const_iterator iend = tTrig->end(); + const auto& tTrig = context.getData(es_token); + std::cout << tTrig.version() << std::endl; + std::cout << std::distance(tTrig.begin(), tTrig.end()) << " data in the container" << std::endl; + DTTtrig::const_iterator iter = tTrig.begin(); + DTTtrig::const_iterator iend = tTrig.end(); while (iter != iend) { const DTTtrigId& trigId = iter->first; const DTTtrigData& trigData = iter->second; @@ -42,24 +39,24 @@ namespace edmtest { float trigTrms; float trigKfac; float trigComp; - tTrig->get(trigId.wheelId, - trigId.stationId, - trigId.sectorId, - trigId.slId, - trigId.layerId, - trigId.cellId, - trigTime, - trigTrms, - trigKfac, - DTTimeUnits::counts); - tTrig->get(trigId.wheelId, - trigId.stationId, - trigId.sectorId, - trigId.slId, - trigId.layerId, - trigId.cellId, - trigComp, - DTTimeUnits::counts); + tTrig.get(trigId.wheelId, + trigId.stationId, + trigId.sectorId, + trigId.slId, + trigId.layerId, + trigId.cellId, + trigTime, + trigTrms, + trigKfac, + DTTimeUnits::counts); + tTrig.get(trigId.wheelId, + trigId.stationId, + trigId.sectorId, + trigId.slId, + trigId.layerId, + trigId.cellId, + trigComp, + DTTimeUnits::counts); std::cout << trigId.wheelId << " " << trigId.stationId << " " << trigId.sectorId << " " << trigId.slId << " " << trigId.layerId << " " << trigId.cellId << " -> " << trigData.tTrig << " " << trigData.tTrms << " " << trigData.kFact << " -> " << trigTime << " " << trigTrms << " " << trigKfac << " -> " << trigComp diff --git a/CondFormats/DTObjects/test/stubs/DTTtrigPrint.h b/CondFormats/DTObjects/test/stubs/DTTtrigPrint.h index 55706d9629177..4cd38dd570e62 100644 --- a/CondFormats/DTObjects/test/stubs/DTTtrigPrint.h +++ b/CondFormats/DTObjects/test/stubs/DTTtrigPrint.h @@ -11,6 +11,9 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CondFormats/DTObjects/interface/DTTtrig.h" +#include "CondFormats/DataRecord/interface/DTTtrigRcd.h" + namespace edmtest { class DTTtrigPrint : public edm::EDAnalyzer { public: @@ -20,5 +23,6 @@ namespace edmtest { virtual void analyze(const edm::Event& e, const edm::EventSetup& c); private: + edm::ESGetToken es_token; }; } // namespace edmtest diff --git a/CondFormats/EcalObjects/test/stubs/EcalTimeBiasCorrectionsFillInitial.cc b/CondFormats/EcalObjects/test/stubs/EcalTimeBiasCorrectionsFillInitial.cc index a7d9a8d1d59b5..83ea7f800e87d 100644 --- a/CondFormats/EcalObjects/test/stubs/EcalTimeBiasCorrectionsFillInitial.cc +++ b/CondFormats/EcalObjects/test/stubs/EcalTimeBiasCorrectionsFillInitial.cc @@ -12,7 +12,7 @@ #include "FWCore/Framework/interface/ModuleFactory.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/ESProducts.h" #include "CondFormats/EcalObjects/interface/EcalTimeBiasCorrections.h" @@ -27,7 +27,7 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" -class EcalTimeBiasCorrectionsFillInitial : public edm::EDAnalyzer { +class EcalTimeBiasCorrectionsFillInitial : public edm::one::EDAnalyzer<> { public: explicit EcalTimeBiasCorrectionsFillInitial(const edm::ParameterSet &); ~EcalTimeBiasCorrectionsFillInitial(); @@ -41,7 +41,7 @@ class EcalTimeBiasCorrectionsFillInitial : public edm::EDAnalyzer { std::vector EEtimeCorrAmplitudeBins_; std::vector EEtimeCorrShiftBins_; - EcalTimeBiasCorrections *bias_; + EcalTimeBiasCorrections bias_; }; EcalTimeBiasCorrectionsFillInitial::EcalTimeBiasCorrectionsFillInitial(const edm::ParameterSet &ps) { @@ -60,15 +60,13 @@ EcalTimeBiasCorrectionsFillInitial::EcalTimeBiasCorrectionsFillInitial(const edm "different from EEtimeCorrShiftBins."; } - bias_ = new EcalTimeBiasCorrections(); + copy(EBtimeCorrAmplitudeBins_.begin(), EBtimeCorrAmplitudeBins_.end(), back_inserter(bias_.EBTimeCorrAmplitudeBins)); - copy(EBtimeCorrAmplitudeBins_.begin(), EBtimeCorrAmplitudeBins_.end(), back_inserter(bias_->EBTimeCorrAmplitudeBins)); + copy(EBtimeCorrShiftBins_.begin(), EBtimeCorrShiftBins_.end(), back_inserter(bias_.EBTimeCorrShiftBins)); - copy(EBtimeCorrShiftBins_.begin(), EBtimeCorrShiftBins_.end(), back_inserter(bias_->EBTimeCorrShiftBins)); + copy(EEtimeCorrAmplitudeBins_.begin(), EEtimeCorrAmplitudeBins_.end(), back_inserter(bias_.EETimeCorrAmplitudeBins)); - copy(EEtimeCorrAmplitudeBins_.begin(), EEtimeCorrAmplitudeBins_.end(), back_inserter(bias_->EETimeCorrAmplitudeBins)); - - copy(EEtimeCorrShiftBins_.begin(), EEtimeCorrShiftBins_.end(), back_inserter(bias_->EETimeCorrShiftBins)); + copy(EEtimeCorrShiftBins_.begin(), EEtimeCorrShiftBins_.end(), back_inserter(bias_.EETimeCorrShiftBins)); } EcalTimeBiasCorrectionsFillInitial::~EcalTimeBiasCorrectionsFillInitial() {} @@ -77,7 +75,7 @@ void EcalTimeBiasCorrectionsFillInitial::analyze(const edm::Event &iEvent, const void EcalTimeBiasCorrectionsFillInitial::endJob() { edm::Service poolDbService; if (poolDbService.isAvailable()) { - poolDbService->writeOne(this->bias_, poolDbService->beginOfTime(), "EcalTimeBiasCorrectionsRcd"); + poolDbService->writeOneIOV(bias_, poolDbService->beginOfTime(), "EcalTimeBiasCorrectionsRcd"); } } diff --git a/CondFormats/PhysicsToolsObjects/interface/MVAComputer.h b/CondFormats/PhysicsToolsObjects/interface/MVAComputer.h index df6589e6a922d..394d09d39a4ff 100644 --- a/CondFormats/PhysicsToolsObjects/interface/MVAComputer.h +++ b/CondFormats/PhysicsToolsObjects/interface/MVAComputer.h @@ -226,7 +226,8 @@ namespace PhysicsTools { MVAComputer &operator=(const MVAComputer &orig); - virtual std::vector getProcessors() const; + virtual std::vector getProcessors(); + virtual std::vector getProcessors() const; void addProcessor(const VarProcessor *proc); // cacheId stuff to detect changes diff --git a/CondFormats/PhysicsToolsObjects/src/MVAComputer.cc b/CondFormats/PhysicsToolsObjects/src/MVAComputer.cc index 977d983c6038a..82337e27a5ca9 100644 --- a/CondFormats/PhysicsToolsObjects/src/MVAComputer.cc +++ b/CondFormats/PhysicsToolsObjects/src/MVAComputer.cc @@ -138,7 +138,13 @@ namespace PhysicsTools { return *this; } - std::vector MVAComputer::getProcessors() const { return processors; } + std::vector MVAComputer::getProcessors() { return processors; } + + std::vector MVAComputer::getProcessors() const { + std::vector ret(processors.size()); + std::copy(processors.begin(), processors.end(), ret.begin()); + return ret; + } void MVAComputer::addProcessor(const VarProcessor *proc) { cacheId = getNextMVAComputerCacheId(); diff --git a/CondFormats/PhysicsToolsObjects/test/TFormulaWriter.cc b/CondFormats/PhysicsToolsObjects/test/TFormulaWriter.cc index b45d67ed59e25..cb32477aa651e 100644 --- a/CondFormats/PhysicsToolsObjects/test/TFormulaWriter.cc +++ b/CondFormats/PhysicsToolsObjects/test/TFormulaWriter.cc @@ -1,11 +1,10 @@ -#include "CondFormats/PhysicsToolsObjects/test/TFormulaWriter.h" - -#include "FWCore/Utilities/interface/Exception.h" - -#include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" #include "CondFormats/PhysicsToolsObjects/interface/PhysicsTFormulaPayload.h" +#include "CondFormats/PhysicsToolsObjects/test/TFormulaWriter.h" + +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Utilities/interface/Exception.h" #include #include @@ -48,9 +47,9 @@ void TFormulaWriter::analyze(const edm::Event&, const edm::EventSetup&) { limits.push_back(vfloat(0., 1.e+6)); std::vector formulas; formulas.push_back((formula->GetExpFormula("p")).Data()); - PhysicsTFormulaPayload* formulaPayload = new PhysicsTFormulaPayload(limits, formulas); + PhysicsTFormulaPayload formulaPayload(limits, formulas); delete formula; - dbService->writeOne(formulaPayload, dbService->beginOfTime(), (*job)->outputRecord_); + dbService->writeOneIOV(formulaPayload, dbService->beginOfTime(), (*job)->outputRecord_); } std::cout << "done." << std::endl; diff --git a/CondFormats/PhysicsToolsObjects/test/TGraphWriter.cc b/CondFormats/PhysicsToolsObjects/test/TGraphWriter.cc index 81dcb74f5aff5..430ad3ea42b01 100644 --- a/CondFormats/PhysicsToolsObjects/test/TGraphWriter.cc +++ b/CondFormats/PhysicsToolsObjects/test/TGraphWriter.cc @@ -1,11 +1,10 @@ -#include "CondFormats/PhysicsToolsObjects/test/TGraphWriter.h" - -#include "FWCore/Utilities/interface/Exception.h" - -#include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" #include "CondFormats/PhysicsToolsObjects/interface/PhysicsTGraphPayload.h" +#include "CondFormats/PhysicsToolsObjects/test/TGraphWriter.h" + +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Utilities/interface/Exception.h" #include #include @@ -42,9 +41,9 @@ void TGraphWriter::analyze(const edm::Event&, const edm::EventSetup&) { throw cms::Exception("TGraphWriter") << " Failed to access PoolDBOutputService !!\n"; std::cout << " writing TGraph = " << (*job)->graphName_ << " to SQLlite file, record = " << (*job)->outputRecord_ << "." << std::endl; - PhysicsTGraphPayload* graphPayload = new PhysicsTGraphPayload(*graph); + PhysicsTGraphPayload graphPayload(*graph); delete graph; - dbService->writeOne(graphPayload, dbService->beginOfTime(), (*job)->outputRecord_); + dbService->writeOneIOV(graphPayload, dbService->beginOfTime(), (*job)->outputRecord_); } std::cout << "done." << std::endl; diff --git a/CondFormats/RecoMuonObjects/test/ProduceAgingObject.cc b/CondFormats/RecoMuonObjects/test/ProduceAgingObject.cc index 7e2e6ac60f0d2..01f9a763b6cb0 100644 --- a/CondFormats/RecoMuonObjects/test/ProduceAgingObject.cc +++ b/CondFormats/RecoMuonObjects/test/ProduceAgingObject.cc @@ -51,19 +51,21 @@ class ProduceAgingObject : public edm::one::EDAnalyzer { virtual void endJob() override{}; void createRpcAgingMap(); - void createDtAgingMap(const edm::ESHandle& dtGeom); - void createCscAgingMap(const edm::ESHandle& cscGeom); + void createDtAgingMap(const DTGeometry& dtGeom); + void createCscAgingMap(const CSCGeometry& cscGeom); void printAgingMap(const std::map& map, const std::string& type) const; // -- member data -- - std::vector m_RPCRegEx; - std::map m_RPCChambEffs; + edm::ESGetToken m_dtGeomToken; + edm::ESGetToken m_cscGeomToken; std::vector m_DTRegEx; - std::map m_DTChambEffs; - + std::vector m_RPCRegEx; std::vector m_CSCRegEx; + + std::map m_DTChambEffs; + std::map m_RPCChambEffs; std::map> m_CSCChambEffs; std::map m_GEMChambEffs; @@ -75,12 +77,11 @@ class ProduceAgingObject : public edm::one::EDAnalyzer { // ProduceAgingObject::ProduceAgingObject(const edm::ParameterSet& iConfig) - -{ - m_DTRegEx = iConfig.getParameter>("dtRegEx"); - m_RPCRegEx = iConfig.getParameter>("rpcRegEx"); - m_CSCRegEx = iConfig.getParameter>("cscRegEx"); - + : m_dtGeomToken(esConsumes()), + m_cscGeomToken(esConsumes()), + m_DTRegEx(iConfig.getParameter>("dtRegEx")), + m_RPCRegEx(iConfig.getParameter>("rpcRegEx")), + m_CSCRegEx(iConfig.getParameter>("cscRegEx")) { for (auto gemId : iConfig.getParameter>("maskedGEMIDs")) { m_GEMChambEffs[gemId] = 0.; } @@ -114,11 +115,8 @@ void ProduceAgingObject::analyze(const edm::Event& iEvent, const edm::EventSetup // -- Called at the beginning of each run -- void ProduceAgingObject::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { - edm::ESHandle dtGeom; - iSetup.get().get(dtGeom); - - edm::ESHandle cscGeom; - iSetup.get().get(cscGeom); + auto const& dtGeom = iSetup.getData(m_dtGeomToken); + auto const& cscGeom = iSetup.getData(m_cscGeomToken); createDtAgingMap(dtGeom); createCscAgingMap(cscGeom); @@ -141,8 +139,8 @@ void ProduceAgingObject::createRpcAgingMap() { } /// -- Create DT aging map ------------ -void ProduceAgingObject::createDtAgingMap(const edm::ESHandle& dtGeom) { - const std::vector chambers = dtGeom->chambers(); +void ProduceAgingObject::createDtAgingMap(const DTGeometry& dtGeom) { + const std::vector chambers = dtGeom.chambers(); std::cout << "[ProduceAgingObject] List of aged DT chambers (ChamberID, efficiency)" << std::endl; for (const DTChamber* ch : chambers) { @@ -175,8 +173,8 @@ void ProduceAgingObject::createDtAgingMap(const edm::ESHandle& dtGeo } /// -- Create CSC aging map ------------ -void ProduceAgingObject::createCscAgingMap(const edm::ESHandle& cscGeom) { - const auto chambers = cscGeom->chambers(); +void ProduceAgingObject::createCscAgingMap(const CSCGeometry& cscGeom) { + const auto chambers = cscGeom.chambers(); std::cout << "[ProduceAgingObject] List of aged CSC chambers (ChamberID, efficiency, type)" << std::endl; diff --git a/CondFormats/RecoMuonObjects/test/produceAgingObject_cfg.py b/CondFormats/RecoMuonObjects/test/produceAgingObject_cfg.py index e48beac01fa16..3a27767a9e6fd 100644 --- a/CondFormats/RecoMuonObjects/test/produceAgingObject_cfg.py +++ b/CondFormats/RecoMuonObjects/test/produceAgingObject_cfg.py @@ -5,7 +5,7 @@ process.load('Configuration.StandardSequences.GeometryDB_cff') process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") from Configuration.AlCa.autoCond import autoCond -process.GlobalTag.globaltag = autoCond['run2_design'] +process.GlobalTag.globaltag = autoCond['phase2_realistic'] process.CondDB.connect = 'sqlite_file:MuonSystemAging.db' diff --git a/CondFormats/SiPixelObjects/test/FastSiPixelFEDChannelContainerFromQuality.cc b/CondFormats/SiPixelObjects/test/FastSiPixelFEDChannelContainerFromQuality.cc index 2e29e68fde135..bed012d5ae0e5 100644 --- a/CondFormats/SiPixelObjects/test/FastSiPixelFEDChannelContainerFromQuality.cc +++ b/CondFormats/SiPixelObjects/test/FastSiPixelFEDChannelContainerFromQuality.cc @@ -85,7 +85,7 @@ class FastSiPixelFEDChannelContainerFromQuality : public edm::one::EDAnalyzer<> const bool isMC_; const bool removeEmptyPayloads_; - SiPixelFEDChannelContainer* myQualities; + std::unique_ptr myQualities; inline unsigned int closest_from_above(std::vector const& vec, unsigned int value) { auto const it = std::lower_bound(vec.begin(), vec.end(), value); @@ -115,10 +115,10 @@ FastSiPixelFEDChannelContainerFromQuality::FastSiPixelFEDChannelContainerFromQua m_connectionPool.configure(); //now do what ever initialization is needed - myQualities = new SiPixelFEDChannelContainer(); + myQualities = std::make_unique(); } -FastSiPixelFEDChannelContainerFromQuality::~FastSiPixelFEDChannelContainerFromQuality() { delete myQualities; } +FastSiPixelFEDChannelContainerFromQuality::~FastSiPixelFEDChannelContainerFromQuality() = default; void FastSiPixelFEDChannelContainerFromQuality::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) { std::stringstream ss; diff --git a/CondFormats/SiPixelObjects/test/SiPixelFEDChannelContainerFromQualityConverter.cc b/CondFormats/SiPixelObjects/test/SiPixelFEDChannelContainerFromQualityConverter.cc index dee1a2897e48b..69e5e99204d31 100644 --- a/CondFormats/SiPixelObjects/test/SiPixelFEDChannelContainerFromQualityConverter.cc +++ b/CondFormats/SiPixelObjects/test/SiPixelFEDChannelContainerFromQualityConverter.cc @@ -60,7 +60,7 @@ class SiPixelFEDChannelContainerFromQualityConverter : public edm::one::EDAnalyz const bool printdebug_; const bool isMC_; const bool removeEmptyPayloads_; - SiPixelFEDChannelContainer* myQualities; + std::unique_ptr myQualities; int IOVcount_; edm::ESWatcher SiPixelQualityWatcher_; @@ -78,12 +78,10 @@ SiPixelFEDChannelContainerFromQualityConverter::SiPixelFEDChannelContainerFromQu isMC_(iConfig.getUntrackedParameter("isMC", true)), removeEmptyPayloads_(iConfig.getUntrackedParameter("removeEmptyPayloads", false)) { //now do what ever initialization is needed - myQualities = new SiPixelFEDChannelContainer(); + myQualities = std::make_unique(); } -SiPixelFEDChannelContainerFromQualityConverter::~SiPixelFEDChannelContainerFromQualityConverter() { - delete myQualities; -} +SiPixelFEDChannelContainerFromQualityConverter::~SiPixelFEDChannelContainerFromQualityConverter() = default; // // member functions diff --git a/CondFormats/SiPixelObjects/test/SiPixelFedCablingMapTestWriter.cc b/CondFormats/SiPixelObjects/test/SiPixelFedCablingMapTestWriter.cc index acc81ce54f361..0c231b6ed670a 100644 --- a/CondFormats/SiPixelObjects/test/SiPixelFedCablingMapTestWriter.cc +++ b/CondFormats/SiPixelObjects/test/SiPixelFedCablingMapTestWriter.cc @@ -45,7 +45,7 @@ SiPixelFedCablingMapTestWriter::SiPixelFedCablingMapTestWriter(const edm::Parame void SiPixelFedCablingMapTestWriter::endJob() { cout << "Convert Tree to Map"; - SiPixelFedCablingMap* cablingMap = new SiPixelFedCablingMap(cablingTree); + const auto& cablingMap = SiPixelFedCablingMap(cablingTree); cout << "Now writing to DB" << endl; edm::Service mydbservice; if (!mydbservice.isAvailable()) { @@ -57,10 +57,9 @@ void SiPixelFedCablingMapTestWriter::endJob() { try { if (mydbservice->isNewTagRequest(m_record)) { - mydbservice->createNewIOV( - cablingMap, mydbservice->beginOfTime(), mydbservice->endOfTime(), m_record); + mydbservice->createOneIOV(cablingMap, mydbservice->beginOfTime(), m_record); } else { - mydbservice->appendSinceTime(cablingMap, mydbservice->currentTime(), m_record); + mydbservice->appendOneIOV(cablingMap, mydbservice->currentTime(), m_record); } } catch (std::exception& e) { cout << "std::exception: " << e.what(); diff --git a/CondFormats/SiPixelObjects/test/SiPixelQualityProbabilitiesTestWriter.cc b/CondFormats/SiPixelObjects/test/SiPixelQualityProbabilitiesTestWriter.cc index a658b8c2296f5..dcef640554127 100644 --- a/CondFormats/SiPixelObjects/test/SiPixelQualityProbabilitiesTestWriter.cc +++ b/CondFormats/SiPixelObjects/test/SiPixelQualityProbabilitiesTestWriter.cc @@ -51,7 +51,7 @@ class SiPixelQualityProbabilitiesTestWriter : public edm::one::EDAnalyzer<> { const std::string m_SnapshotInputs; const std::string m_record; const bool printdebug_; - SiPixelQualityProbabilities* myProbabilities; + std::unique_ptr myProbabilities; }; // @@ -63,10 +63,10 @@ SiPixelQualityProbabilitiesTestWriter::SiPixelQualityProbabilitiesTestWriter(con m_record(iConfig.getParameter("record")), printdebug_(iConfig.getUntrackedParameter("printDebug", false)) { //now do what ever initialization is needed - myProbabilities = new SiPixelQualityProbabilities(); + myProbabilities = std::make_unique(); } -SiPixelQualityProbabilitiesTestWriter::~SiPixelQualityProbabilitiesTestWriter() { delete myProbabilities; } +SiPixelQualityProbabilitiesTestWriter::~SiPixelQualityProbabilitiesTestWriter() = default; // // member functions diff --git a/CondFormats/SiPixelObjects/test/SiPixelQualityProbabilitiesWriteFromASCII.cc b/CondFormats/SiPixelObjects/test/SiPixelQualityProbabilitiesWriteFromASCII.cc index 408ce03785691..75e6601686afa 100644 --- a/CondFormats/SiPixelObjects/test/SiPixelQualityProbabilitiesWriteFromASCII.cc +++ b/CondFormats/SiPixelObjects/test/SiPixelQualityProbabilitiesWriteFromASCII.cc @@ -50,7 +50,7 @@ class SiPixelQualityProbabilitiesWriteFromASCII : public edm::one::EDAnalyzer<> const std::string m_ProbInputs; const std::string m_record; const bool printdebug_; - SiPixelQualityProbabilities* myProbabilities; + std::unique_ptr myProbabilities; }; // @@ -61,10 +61,10 @@ SiPixelQualityProbabilitiesWriteFromASCII::SiPixelQualityProbabilitiesWriteFromA m_record(iConfig.getParameter("record")), printdebug_(iConfig.getUntrackedParameter("printDebug", false)) { //now do what ever initialization is needed - myProbabilities = new SiPixelQualityProbabilities(); + myProbabilities = std::make_unique(); } -SiPixelQualityProbabilitiesWriteFromASCII::~SiPixelQualityProbabilitiesWriteFromASCII() { delete myProbabilities; } +SiPixelQualityProbabilitiesWriteFromASCII::~SiPixelQualityProbabilitiesWriteFromASCII() = default; // // member functions diff --git a/CondTools/Ecal/interface/EcalTestDevDB.h b/CondTools/Ecal/interface/EcalTestDevDB.h index 44eb48d2b013a..942086781a1f1 100644 --- a/CondTools/Ecal/interface/EcalTestDevDB.h +++ b/CondTools/Ecal/interface/EcalTestDevDB.h @@ -1,7 +1,7 @@ -#ifndef ECALTESTDEVDB_H -#define ECALTESTDEVDB_H +#ifndef CondTools_Ecal_EcalTestDevDB_h +#define CondTools_Ecal_EcalTestDevDB_h -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "CondCore/CondDB/interface/Exception.h" #include "FWCore/Framework/interface/IOVSyncValue.h" @@ -30,6 +30,7 @@ #include #include +#include namespace edm { class ParameterSet; @@ -37,23 +38,23 @@ namespace edm { class EventSetup; } // namespace edm -class EcalTestDevDB : public edm::EDAnalyzer { +class EcalTestDevDB : public edm::one::EDAnalyzer<> { public: explicit EcalTestDevDB(const edm::ParameterSet& iConfig); ~EcalTestDevDB() override; void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) override; - EcalPedestals* generateEcalPedestals(); - EcalADCToGeVConstant* generateEcalADCToGeVConstant(); - EcalIntercalibConstants* generateEcalIntercalibConstants(); - EcalLinearCorrections* generateEcalLinearCorrections(); - EcalGainRatios* generateEcalGainRatios(); - EcalWeightXtalGroups* generateEcalWeightXtalGroups(); - EcalTBWeights* generateEcalTBWeights(); - EcalLaserAPDPNRatios* generateEcalLaserAPDPNRatios(uint32_t i_run); - EcalLaserAlphas* generateEcalLaserAlphas(); - EcalLaserAPDPNRatiosRef* generateEcalLaserAPDPNRatiosRef(); + std::shared_ptr generateEcalPedestals(); + std::shared_ptr generateEcalADCToGeVConstant(); + std::shared_ptr generateEcalIntercalibConstants(); + std::shared_ptr generateEcalLinearCorrections(); + std::shared_ptr generateEcalGainRatios(); + std::shared_ptr generateEcalWeightXtalGroups(); + std::shared_ptr generateEcalTBWeights(); + std::shared_ptr generateEcalLaserAPDPNRatios(uint32_t i_run); + std::shared_ptr generateEcalLaserAlphas(); + std::shared_ptr generateEcalLaserAPDPNRatiosRef(); private: std::string m_timetype; diff --git a/CondTools/Ecal/plugins/StoreESCondition.cc b/CondTools/Ecal/plugins/StoreESCondition.cc index 6e0e25fb82060..85ae02da22807 100644 --- a/CondTools/Ecal/plugins/StoreESCondition.cc +++ b/CondTools/Ecal/plugins/StoreESCondition.cc @@ -7,7 +7,6 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include -#include #include #include #include @@ -65,94 +64,86 @@ void StoreESCondition::endJob() { << newTime << "\n"; if (objectName_[i] == "ESChannelStatus") { edm::LogInfo("StoreESCondition") << " ESChannelStatus file " << inpFileName_[i] << "\n"; - ESChannelStatus* mycali = readESChannelStatusFromFile(inpFileName_[i].c_str()); + const auto mycali = readESChannelStatusFromFile(inpFileName_[i].c_str()); edm::LogInfo("StoreESCondition") << " ESChannelStatus file read " << "\n"; if (!toAppend) { edm::LogInfo("StoreESCondition") << " before create " << "\n"; - mydbservice->createNewIOV(mycali, newTime, mydbservice->endOfTime(), "ESChannelStatusRcd"); + mydbservice->createOneIOV(*mycali, newTime, "ESChannelStatusRcd"); edm::LogInfo("StoreESCondition") << " after create " << "\n"; } else { edm::LogInfo("StoreESCondition") << " before append " << "\n"; - mydbservice->appendSinceTime(mycali, newTime, "ESChannelStatusRcd"); + mydbservice->appendOneIOV(*mycali, newTime, "ESChannelStatusRcd"); edm::LogInfo("StoreESCondition") << " after append " << "\n"; } } else if (objectName_[i] == "ESIntercalibConstants") { - ESIntercalibConstants* myintercalib = readESIntercalibConstantsFromFile(inpFileName_[i].c_str()); + const auto myintercalib = readESIntercalibConstantsFromFile(inpFileName_[i].c_str()); if (!toAppend) { - mydbservice->createNewIOV( - myintercalib, newTime, mydbservice->endOfTime(), "ESIntercalibConstantsRcd"); + mydbservice->createOneIOV(*myintercalib, newTime, "ESIntercalibConstantsRcd"); } else { - mydbservice->appendSinceTime(myintercalib, newTime, "ESIntercalibConstantsRcd"); + mydbservice->appendOneIOV(*myintercalib, newTime, "ESIntercalibConstantsRcd"); } } else if (objectName_[i] == "ESTimeSampleWeights") { - ESTimeSampleWeights* myintercalib = readESTimeSampleWeightsFromFile(inpFileName_[i].c_str()); + const auto myintercalib = readESTimeSampleWeightsFromFile(inpFileName_[i].c_str()); if (!toAppend) { - mydbservice->createNewIOV( - myintercalib, newTime, mydbservice->endOfTime(), "ESTimeSampleWeightsRcd"); + mydbservice->createOneIOV(*myintercalib, newTime, "ESTimeSampleWeightsRcd"); } else { - mydbservice->appendSinceTime(myintercalib, newTime, "ESTimeSampleWeightsRcd"); + mydbservice->appendOneIOV(*myintercalib, newTime, "ESTimeSampleWeightsRcd"); } } else if (objectName_[i] == "ESGain") { - ESGain* myintercalib = readESGainFromFile(inpFileName_[i].c_str()); + const auto myintercalib = readESGainFromFile(inpFileName_[i].c_str()); if (!toAppend) { - mydbservice->createNewIOV(myintercalib, newTime, mydbservice->endOfTime(), "ESGainRcd"); + mydbservice->createOneIOV(*myintercalib, newTime, "ESGainRcd"); } else { - mydbservice->appendSinceTime(myintercalib, newTime, "ESGainRcd"); + mydbservice->appendOneIOV(*myintercalib, newTime, "ESGainRcd"); } } else if (objectName_[i] == "ESMissingEnergyCalibration") { - ESMissingEnergyCalibration* myintercalib = readESMissingEnergyFromFile(inpFileName_[i].c_str()); + const auto myintercalib = readESMissingEnergyFromFile(inpFileName_[i].c_str()); if (!toAppend) { - mydbservice->createNewIOV( - myintercalib, newTime, mydbservice->endOfTime(), "ESMissingEnergyCalibrationRcd"); + mydbservice->createOneIOV(*myintercalib, newTime, "ESMissingEnergyCalibrationRcd"); } else { - mydbservice->appendSinceTime( - myintercalib, newTime, "ESMissingEnergyCalibrationRcd"); + mydbservice->appendOneIOV(*myintercalib, newTime, "ESMissingEnergyCalibrationRcd"); } } else if (objectName_[i] == "ESRecHitRatioCuts") { - ESRecHitRatioCuts* myintercalib = readESRecHitRatioCutsFromFile(inpFileName_[i].c_str()); + const auto myintercalib = readESRecHitRatioCutsFromFile(inpFileName_[i].c_str()); if (!toAppend) { - mydbservice->createNewIOV( - myintercalib, newTime, mydbservice->endOfTime(), "ESRecHitRatioCutsRcd"); + mydbservice->createOneIOV(*myintercalib, newTime, "ESRecHitRatioCutsRcd"); } else { - mydbservice->appendSinceTime(myintercalib, newTime, "ESRecHitRatioCutsRcd"); + mydbservice->appendOneIOV(*myintercalib, newTime, "ESRecHitRatioCutsRcd"); } } else if (objectName_[i] == "ESThresholds") { - ESThresholds* myintercalib = readESThresholdsFromFile(inpFileName_[i].c_str()); + const auto myintercalib = readESThresholdsFromFile(inpFileName_[i].c_str()); if (!toAppend) { - mydbservice->createNewIOV(myintercalib, newTime, mydbservice->endOfTime(), "ESThresholdsRcd"); + mydbservice->createOneIOV(*myintercalib, newTime, "ESThresholdsRcd"); } else { - mydbservice->appendSinceTime(myintercalib, newTime, "ESThresholdsRcd"); + mydbservice->appendOneIOV(*myintercalib, newTime, "ESThresholdsRcd"); } } else if (objectName_[i] == "ESPedestals") { - ESPedestals* myintercalib = readESPedestalsFromFile(inpFileName_[i].c_str()); + const auto myintercalib = readESPedestalsFromFile(inpFileName_[i].c_str()); if (!toAppend) { - mydbservice->createNewIOV(myintercalib, newTime, mydbservice->endOfTime(), "ESPedestalsRcd"); + mydbservice->createOneIOV(*myintercalib, newTime, "ESPedestalsRcd"); } else { - mydbservice->appendSinceTime(myintercalib, newTime, "ESPedestalsRcd"); + mydbservice->appendOneIOV(*myintercalib, newTime, "ESPedestalsRcd"); } } else if (objectName_[i] == "ESEEIntercalibConstants") { - ESEEIntercalibConstants* myintercalib = readESEEIntercalibConstantsFromFile(inpFileName_[i].c_str()); + const auto myintercalib = readESEEIntercalibConstantsFromFile(inpFileName_[i].c_str()); if (!toAppend) { - mydbservice->createNewIOV( - myintercalib, newTime, mydbservice->endOfTime(), "ESEEIntercalibConstantsRcd"); + mydbservice->createOneIOV(*myintercalib, newTime, "ESEEIntercalibConstantsRcd"); } else { - mydbservice->appendSinceTime(myintercalib, newTime, "ESEEIntercalibConstantsRcd"); + mydbservice->appendOneIOV(*myintercalib, newTime, "ESEEIntercalibConstantsRcd"); } } else { - edm::LogError("StoreESCondition") << "Object " << objectName_[i] << " is not supported by this program." - << "\n"; + edm::LogError("StoreESCondition") << "Object " << objectName_[i] << " is not supported by this program."; } // if more records write here else if .... writeToLogFileResults(messChar); - edm::LogInfo("StoreESCondition") << "Finished endJob" - << "\n"; + edm::LogInfo("StoreESCondition") << "Finished endJob"; } delete[] messChar; @@ -207,25 +198,20 @@ void StoreESCondition::fillHeader(char* header) { strcpy(header, user); } -ESThresholds* StoreESCondition::readESThresholdsFromFile(const char* inputFile) { +std::shared_ptr StoreESCondition::readESThresholdsFromFile(const char* inputFile) { std::ifstream ESThresholdsFile(edm::FileInPath(inputFile).fullPath().c_str()); float ts2, zs; //2nd time sample, ZS threshold ESThresholdsFile >> ts2; ESThresholdsFile >> zs; - ESThresholds* esThresholds = new ESThresholds(ts2, zs); + auto esThresholds = std::make_shared(ts2, zs); return esThresholds; } -ESEEIntercalibConstants* StoreESCondition::readESEEIntercalibConstantsFromFile(const char* inputFile) { +std::shared_ptr StoreESCondition::readESEEIntercalibConstantsFromFile(const char* inputFile) { std::ifstream ESEEIntercalibFile(edm::FileInPath(inputFile).fullPath().c_str()); float gammaLow0, alphaLow0, gammaHigh0, alphaHigh0, gammaLow1, alphaLow1, gammaHigh1, alphaHigh1, gammaLow2, alphaLow2, gammaHigh2, alphaHigh2, gammaLow3, alphaLow3, gammaHigh3, alphaHigh3; - // const float ESEEIntercalibValue[16]; - // for (int i = 0; i < 16; ++i) { - // ESEEIntercalibFile >> ESEEIntercalibValue[i]; - // } - // ESEEIntercalibConstants* eseeIntercalibConstants = new ESEEIntercalibConstants(ESEEIntercalibValue); ESEEIntercalibFile >> gammaLow0; ESEEIntercalibFile >> alphaLow0; ESEEIntercalibFile >> gammaHigh0; @@ -242,27 +228,27 @@ ESEEIntercalibConstants* StoreESCondition::readESEEIntercalibConstantsFromFile(c ESEEIntercalibFile >> alphaLow3; ESEEIntercalibFile >> gammaHigh3; ESEEIntercalibFile >> alphaHigh3; - ESEEIntercalibConstants* eseeIntercalibConstants = new ESEEIntercalibConstants(gammaLow0, - alphaLow0, - gammaHigh0, - alphaHigh0, - gammaLow1, - alphaLow1, - gammaHigh1, - alphaHigh1, - gammaLow2, - alphaLow2, - gammaHigh2, - alphaHigh2, - gammaLow3, - alphaLow3, - gammaHigh3, - alphaHigh3); + auto eseeIntercalibConstants = std::make_shared(gammaLow0, + alphaLow0, + gammaHigh0, + alphaHigh0, + gammaLow1, + alphaLow1, + gammaHigh1, + alphaHigh1, + gammaLow2, + alphaLow2, + gammaHigh2, + alphaHigh2, + gammaLow3, + alphaLow3, + gammaHigh3, + alphaHigh3); return eseeIntercalibConstants; } -ESMissingEnergyCalibration* StoreESCondition::readESMissingEnergyFromFile(const char* inputFile) { +std::shared_ptr StoreESCondition::readESMissingEnergyFromFile(const char* inputFile) { std::ifstream ESMissingEnergyFile(edm::FileInPath(inputFile).fullPath().c_str()); float ConstAEta0, ConstBEta0, ConstAEta1, ConstBEta1, ConstAEta2, ConstBEta2, ConstAEta3, ConstBEta3; ESMissingEnergyFile >> ConstAEta0; @@ -273,14 +259,14 @@ ESMissingEnergyCalibration* StoreESCondition::readESMissingEnergyFromFile(const ESMissingEnergyFile >> ConstBEta2; ESMissingEnergyFile >> ConstAEta3; ESMissingEnergyFile >> ConstBEta3; - ESMissingEnergyCalibration* esMissingEnergy = new ESMissingEnergyCalibration( + auto esMissingEnergy = std::make_shared( ConstAEta0, ConstBEta0, ConstAEta1, ConstBEta1, ConstAEta2, ConstBEta2, ConstAEta3, ConstBEta3); return esMissingEnergy; } -ESPedestals* StoreESCondition::readESPedestalsFromFile(const char* inputFile) { - ESPedestals* esPedestals = new ESPedestals(); +std::shared_ptr StoreESCondition::readESPedestalsFromFile(const char* inputFile) { + auto esPedestals = std::make_shared(); // int ped[2][2][40][40][32]; // for (int i=0; i<2; ++i) @@ -325,7 +311,7 @@ ESPedestals* StoreESCondition::readESPedestalsFromFile(const char* inputFile) { return esPedestals; } -ESRecHitRatioCuts* StoreESCondition::readESRecHitRatioCutsFromFile(const char* inputFile) { +std::shared_ptr StoreESCondition::readESRecHitRatioCutsFromFile(const char* inputFile) { std::ifstream ESRecHitRatioCutsFile(edm::FileInPath(inputFile).fullPath().c_str()); float r12Low, r23Low, r12High, r23High; @@ -333,33 +319,23 @@ ESRecHitRatioCuts* StoreESCondition::readESRecHitRatioCutsFromFile(const char* i ESRecHitRatioCutsFile >> r23Low; ESRecHitRatioCutsFile >> r12High; ESRecHitRatioCutsFile >> r23High; - ESRecHitRatioCuts* esRecHitRatioCuts = new ESRecHitRatioCuts(r12Low, r23Low, r12High, r23High); - // cout<<"We are in RH ratio cut : gain : " << esgain_<(r12Low, r23Low, r12High, r23High); return esRecHitRatioCuts; } -ESGain* StoreESCondition::readESGainFromFile(const char* inputFile) { +std::shared_ptr StoreESCondition::readESGainFromFile(const char* inputFile) { std::ifstream amplFile(edm::FileInPath(inputFile).fullPath().c_str()); int gain; amplFile >> gain; edm::LogInfo("StoreESCondition") << "gain : " << gain << "\n"; - ESGain* esGain = new ESGain(gain); // 1: LG, 2: HG + auto esGain = std::make_shared(gain); // 1: LG, 2: HG return esGain; } -ESTimeSampleWeights* StoreESCondition::readESTimeSampleWeightsFromFile(const char* inputFile) { +std::shared_ptr StoreESCondition::readESTimeSampleWeightsFromFile(const char* inputFile) { std::ifstream amplFile(edm::FileInPath(inputFile).fullPath().c_str()); float w[3]; @@ -370,12 +346,12 @@ ESTimeSampleWeights* StoreESCondition::readESTimeSampleWeightsFromFile(const cha edm::LogInfo("StoreESCondition") << "weight : " << k << " " << w[k] << "\n"; } - ESTimeSampleWeights* esWeights = new ESTimeSampleWeights(w[0], w[1], w[2]); + auto esWeights = std::make_shared(w[0], w[1], w[2]); return esWeights; } -ESIntercalibConstants* StoreESCondition::readESIntercalibConstantsFromFile(const char* inputFile) { - ESIntercalibConstants* ical = new ESIntercalibConstants(); +std::shared_ptr StoreESCondition::readESIntercalibConstantsFromFile(const char* inputFile) { + auto ical = std::make_shared(); std::ifstream mipFile(edm::FileInPath(inputFile).fullPath().c_str()); @@ -402,7 +378,7 @@ ESIntercalibConstants* StoreESCondition::readESIntercalibConstantsFromFile(const return ical; } -ESChannelStatus* StoreESCondition::readESChannelStatusFromFile(const char* inputFile) { +std::shared_ptr StoreESCondition::readESChannelStatusFromFile(const char* inputFile) { int z[1000], p[1000], x[1000], y[1000], nsensors; std::ifstream statusFile(edm::FileInPath(inputFile).fullPath().c_str()); statusFile >> nsensors; @@ -415,7 +391,7 @@ ESChannelStatus* StoreESCondition::readESChannelStatusFromFile(const char* input for (int i = 0; i < nsensors; ++i) { statusFile >> z[i] >> p[i] >> x[i] >> y[i]; } - ESChannelStatus* ecalStatus = new ESChannelStatus(); + auto ecalStatus = std::make_shared(); int Nbstatus = 0, Nbstrip = 0; for (int istrip = ESDetId::ISTRIP_MIN; istrip <= ESDetId::ISTRIP_MAX; istrip++) { for (int ix = ESDetId::IX_MIN; ix <= ESDetId::IX_MAX; ix++) { diff --git a/CondTools/Ecal/plugins/StoreESCondition.h b/CondTools/Ecal/plugins/StoreESCondition.h index 128fe80cb7a8f..0ba96ec24e795 100644 --- a/CondTools/Ecal/plugins/StoreESCondition.h +++ b/CondTools/Ecal/plugins/StoreESCondition.h @@ -1,11 +1,11 @@ -#ifndef StoreESCondition_h -#define StoreESCondition_h +#ifndef CondTools_Ecal_StoreESCondition_h +#define CondTools_Ecal_StoreESCondition_h -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include #include -#include +#include #include #include #include @@ -28,17 +28,17 @@ namespace edm { class EventSetup; } // namespace edm -class StoreESCondition : public edm::EDAnalyzer { +class StoreESCondition : public edm::one::EDAnalyzer<> { public: - ESThresholds* readESThresholdsFromFile(const char*); - ESPedestals* readESPedestalsFromFile(const char*); - ESRecHitRatioCuts* readESRecHitRatioCutsFromFile(const char*); - ESGain* readESGainFromFile(const char*); - ESTimeSampleWeights* readESTimeSampleWeightsFromFile(const char*); - ESChannelStatus* readESChannelStatusFromFile(const char*); - ESIntercalibConstants* readESIntercalibConstantsFromFile(const char*); - ESMissingEnergyCalibration* readESMissingEnergyFromFile(const char*); - ESEEIntercalibConstants* readESEEIntercalibConstantsFromFile(const char*); + std::shared_ptr readESThresholdsFromFile(const char*); + std::shared_ptr readESPedestalsFromFile(const char*); + std::shared_ptr readESRecHitRatioCutsFromFile(const char*); + std::shared_ptr readESGainFromFile(const char*); + std::shared_ptr readESTimeSampleWeightsFromFile(const char*); + std::shared_ptr readESChannelStatusFromFile(const char*); + std::shared_ptr readESIntercalibConstantsFromFile(const char*); + std::shared_ptr readESMissingEnergyFromFile(const char*); + std::shared_ptr readESEEIntercalibConstantsFromFile(const char*); void writeToLogFile(std::string, std::string, unsigned long long); void writeToLogFileResults(char*); diff --git a/CondTools/Ecal/plugins/StoreEcalCondition.cc b/CondTools/Ecal/plugins/StoreEcalCondition.cc index 8916c3a868ab8..d8e198870f2b8 100644 --- a/CondTools/Ecal/plugins/StoreEcalCondition.cc +++ b/CondTools/Ecal/plugins/StoreEcalCondition.cc @@ -8,14 +8,11 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include -#include #include #include #include #include -using std::cout; -using std::endl; using std::string; StoreEcalCondition::StoreEcalCondition(const edm::ParameterSet& iConfig) { @@ -39,7 +36,7 @@ StoreEcalCondition::StoreEcalCondition(const edm::ParameterSet& iConfig) { void StoreEcalCondition::endJob() { edm::Service mydbservice; if (!mydbservice.isAvailable()) { - edm::LogError("StoreEcalCondition") << "PoolDBOutputService is unavailable" << std::endl; + edm::LogError("StoreEcalCondition") << "PoolDBOutputService is unavailable"; return; } @@ -66,83 +63,73 @@ void StoreEcalCondition::endJob() { newTime = (cond::Time_t)since_[i]; } edm::LogInfo("StoreEcalCondition") << "Reading " << objectName_[i] << " from file and writing to DB with newTime " - << newTime << endl; - std::cout << "Reading " << objectName_[i] << " from file and writing to DB with newTime " << newTime << endl; + << newTime; if (objectName_[i] == "EcalWeightXtalGroups") { - EcalWeightXtalGroups* mycali = readEcalWeightXtalGroupsFromFile(inpFileName_[i].c_str()); + const auto mycali = readEcalWeightXtalGroupsFromFile(inpFileName_[i].c_str()); if (!toAppend) { - mydbservice->createNewIOV( - mycali, newTime, mydbservice->endOfTime(), "EcalWeightXtalGroupsRcd"); + mydbservice->createOneIOV(*mycali, newTime, "EcalWeightXtalGroupsRcd"); } else { - mydbservice->appendSinceTime(mycali, newTime, "EcalWeightXtalGroupsRcd"); + mydbservice->appendOneIOV(*mycali, newTime, "EcalWeightXtalGroupsRcd"); } } else if (objectName_[i] == "EcalTBWeights") { - EcalTBWeights* mycali = readEcalTBWeightsFromFile(inpFileName_[i].c_str()); + const auto mycali = readEcalTBWeightsFromFile(inpFileName_[i].c_str()); if (!toAppend) { - mydbservice->createNewIOV(mycali, newTime, mydbservice->endOfTime(), "EcalTBWeightsRcd"); + mydbservice->createOneIOV(*mycali, newTime, "EcalTBWeightsRcd"); } else { - mydbservice->appendSinceTime(mycali, newTime, "EcalTBWeightsRcd"); + mydbservice->appendOneIOV(*mycali, newTime, "EcalTBWeightsRcd"); } } else if (objectName_[i] == "EcalADCToGeVConstant") { - EcalADCToGeVConstant* mycali = readEcalADCToGeVConstantFromFile(inpFileName_[i].c_str()); + const auto mycali = readEcalADCToGeVConstantFromFile(inpFileName_[i].c_str()); if (!toAppend) { - mydbservice->createNewIOV( - mycali, newTime, mydbservice->endOfTime(), "EcalADCToGeVConstantRcd"); + mydbservice->createOneIOV(*mycali, newTime, "EcalADCToGeVConstantRcd"); } else { - mydbservice->appendSinceTime(mycali, newTime, "EcalADCToGeVConstantRcd"); + mydbservice->appendOneIOV(*mycali, newTime, "EcalADCToGeVConstantRcd"); } } else if (objectName_[i] == "EcalIntercalibConstants") { - EcalIntercalibConstants* mycali = - readEcalIntercalibConstantsFromFile(inpFileName_[i].c_str(), inpFileNameEE_[i].c_str()); + const auto mycali = readEcalIntercalibConstantsFromFile(inpFileName_[i].c_str(), inpFileNameEE_[i].c_str()); if (!toAppend) { - mydbservice->createNewIOV( - mycali, newTime, mydbservice->endOfTime(), "EcalIntercalibConstantsRcd"); + mydbservice->createOneIOV(*mycali, newTime, "EcalIntercalibConstantsRcd"); } else { - mydbservice->appendSinceTime(mycali, newTime, "EcalIntercalibConstantsRcd"); + mydbservice->appendOneIOV(*mycali, newTime, "EcalIntercalibConstantsRcd"); } } else if (objectName_[i] == "EcalPFRecHitThresholds") { - EcalPFRecHitThresholds* mycali = - readEcalPFRecHitThresholdsFromFile(inpFileName_[i].c_str(), inpFileNameEE_[i].c_str()); + const auto mycali = readEcalPFRecHitThresholdsFromFile(inpFileName_[i].c_str(), inpFileNameEE_[i].c_str()); if (!toAppend) { - mydbservice->createNewIOV( - mycali, newTime, mydbservice->endOfTime(), "EcalPFRecHitThresholdsRcd"); + mydbservice->createOneIOV(*mycali, newTime, "EcalPFRecHitThresholdsRcd"); } else { - mydbservice->appendSinceTime(mycali, newTime, "EcalPFRecHitThresholdsRcd"); + mydbservice->appendOneIOV(*mycali, newTime, "EcalPFRecHitThresholdsRcd"); } } else if (objectName_[i] == "EcalIntercalibConstantsMC") { - EcalIntercalibConstantsMC* mycali = - readEcalIntercalibConstantsMCFromFile(inpFileName_[i].c_str(), inpFileNameEE_[i].c_str()); + const auto mycali = readEcalIntercalibConstantsMCFromFile(inpFileName_[i].c_str(), inpFileNameEE_[i].c_str()); if (!toAppend) { - mydbservice->createNewIOV( - mycali, newTime, mydbservice->endOfTime(), "EcalIntercalibConstantsMCRcd"); + mydbservice->createOneIOV(*mycali, newTime, "EcalIntercalibConstantsMCRcd"); } else { - mydbservice->appendSinceTime(mycali, newTime, "EcalIntercalibConstantsMCRcd"); + mydbservice->appendOneIOV(*mycali, newTime, "EcalIntercalibConstantsMCRcd"); } } else if (objectName_[i] == "EcalGainRatios") { - EcalGainRatios* mycali = readEcalGainRatiosFromFile(inpFileName_[i].c_str()); + const auto mycali = readEcalGainRatiosFromFile(inpFileName_[i].c_str()); if (!toAppend) { - mydbservice->createNewIOV(mycali, newTime, mydbservice->endOfTime(), "EcalGainRatiosRcd"); + mydbservice->createOneIOV(*mycali, newTime, "EcalGainRatiosRcd"); } else { - mydbservice->appendSinceTime(mycali, newTime, "EcalGainRatiosRcd"); + mydbservice->appendOneIOV(*mycali, newTime, "EcalGainRatiosRcd"); } } else if (objectName_[i] == "EcalChannelStatus") { - EcalChannelStatus* mycali = readEcalChannelStatusFromFile(inpFileName_[i].c_str()); + const auto mycali = readEcalChannelStatusFromFile(inpFileName_[i].c_str()); if (!toAppend) { - mydbservice->createNewIOV(mycali, newTime, mydbservice->endOfTime(), "EcalChannelStatusRcd"); + mydbservice->createOneIOV(*mycali, newTime, "EcalChannelStatusRcd"); } else { - mydbservice->appendSinceTime(mycali, newTime, "EcalChannelStatusRcd"); + mydbservice->appendOneIOV(*mycali, newTime, "EcalChannelStatusRcd"); } } else { - edm::LogError("StoreEcalCondition") - << "Object " << objectName_[i] << " is not supported by this program." << endl; + edm::LogError("StoreEcalCondition") << "Object " << objectName_[i] << " is not supported by this program."; } // writeToLogFile(objectName_[i], inpFileName_[i], since_[i]); //writeToLogFileResults("finished OK\n"); writeToLogFileResults(messChar); - edm::LogInfo("StoreEcalCondition") << "Finished endJob" << endl; + edm::LogInfo("StoreEcalCondition") << "Finished endJob"; } delete[] messChar; @@ -246,12 +233,12 @@ void StoreEcalCondition::fillHeader(char* header) */ //------------------------------------------------------------- -EcalWeightXtalGroups* StoreEcalCondition::readEcalWeightXtalGroupsFromFile(const char* inputFile) { +std::shared_ptr StoreEcalCondition::readEcalWeightXtalGroupsFromFile(const char* inputFile) { //------------------------------------------------------------- // Code taken from EcalWeightTools/test/MakeOfflineDbFromAscii.cpp - EcalWeightXtalGroups* xtalGroups = new EcalWeightXtalGroups(); + auto xtalGroups = std::make_shared(); std::ifstream groupid_in(inputFile); if (!groupid_in.is_open()) { @@ -264,22 +251,22 @@ EcalWeightXtalGroups* StoreEcalCondition::readEcalWeightXtalGroupsFromFile(const std::ostringstream str; groupid_in >> smnumber; if (smnumber == -99999) { - edm::LogError("StoreEcalCondition") << "ERROR: SM number not found in file" << endl; + edm::LogError("StoreEcalCondition") << "ERROR: SM number not found in file"; return nullptr; } - str << "sm= " << smnumber << endl; + str << "sm= " << smnumber << "\n"; sm_constr_ = smnumber; char temp[256]; //Reading the other 5 header lines containing various informations for (int i = 0; i <= 5; i++) { groupid_in.getline(temp, 255); - str << temp << endl; + str << temp << "\n"; } // Skip the nGroup/Mean line groupid_in.getline(temp, 255); - str << temp << endl; + str << temp << "\n"; edm::LogInfo("StoreEcalCondition") << "GROUPID file " << str.str(); @@ -301,7 +288,7 @@ EcalWeightXtalGroups* StoreEcalCondition::readEcalWeightXtalGroupsFromFile(const } //loop iphi if (xtals != 1700) { - edm::LogError("StoreEcalCondition") << "ERROR: GROUPID file did not contain data for 1700 crystals" << endl; + edm::LogError("StoreEcalCondition") << "ERROR: GROUPID file did not contain data for 1700 crystals"; return nullptr; } @@ -312,12 +299,12 @@ EcalWeightXtalGroups* StoreEcalCondition::readEcalWeightXtalGroupsFromFile(const } //------------------------------------------------------------- -EcalTBWeights* StoreEcalCondition::readEcalTBWeightsFromFile(const char* inputFile) { +std::shared_ptr StoreEcalCondition::readEcalTBWeightsFromFile(const char* inputFile) { //------------------------------------------------------------- // Zabi code to be written here - EcalTBWeights* tbwgt = new EcalTBWeights(); + auto tbwgt = std::make_shared(); std::ifstream WeightsFileTB(inputFile); if (!WeightsFileTB.is_open()) { @@ -332,13 +319,13 @@ EcalTBWeights* StoreEcalCondition::readEcalTBWeightsFromFile(const char* inputFi if (smnumber == -99999) return nullptr; - str << "sm= " << smnumber << endl; + str << "sm= " << smnumber << "\n"; char temp[256]; //Reading the other 5 header lines containing various informations for (int i = 0; i <= 5; i++) { WeightsFileTB.getline(temp, 255); - str << temp << endl; + str << temp << "\n"; } edm::LogInfo("StoreEcalCondition") << "Weights file " << str.str(); @@ -374,7 +361,7 @@ EcalTBWeights* StoreEcalCondition::readEcalTBWeightsFromFile(const char* inputFi wgt1(0, j) = ww; str << ww << " "; } // loop Samples - str << std::endl; + str << "\n"; //Pedestal weights for (int j = 0; j < nSamples; ++j) { @@ -383,7 +370,7 @@ EcalTBWeights* StoreEcalCondition::readEcalTBWeightsFromFile(const char* inputFi wgt1(1, j) = ww; str << ww << " "; } //loop Samples - str << std::endl; + str << "\n"; //Timing weights for (int j = 0; j < nSamples; ++j) { @@ -392,7 +379,7 @@ EcalTBWeights* StoreEcalCondition::readEcalTBWeightsFromFile(const char* inputFi wgt1(2, j) = ww; str << ww << " "; } //loop Samples - str << std::endl; + str << "\n"; for (int j = 0; j < nSamples; ++j) { // fill chi2 matrix @@ -403,7 +390,7 @@ EcalTBWeights* StoreEcalCondition::readEcalTBWeightsFromFile(const char* inputFi chisq1(j, k) = ww; str << ww << " "; } //loop samples - str << std::endl; + str << "\n"; } //loop lines //WEIGHTS AFTER GAIN SWITCH @@ -413,7 +400,7 @@ EcalTBWeights* StoreEcalCondition::readEcalTBWeightsFromFile(const char* inputFi wgt2(0, j) = ww; str << ww << " "; } // loop Samples - str << std::endl; + str << "\n"; //Pedestal weights for (int j = 0; j < nSamples; ++j) { @@ -422,7 +409,7 @@ EcalTBWeights* StoreEcalCondition::readEcalTBWeightsFromFile(const char* inputFi wgt2(1, j) = ww; str << ww << " "; } //loop Samples - str << std::endl; + str << "\n"; //Timing weights for (int j = 0; j < nSamples; ++j) { @@ -431,7 +418,7 @@ EcalTBWeights* StoreEcalCondition::readEcalTBWeightsFromFile(const char* inputFi wgt2(2, j) = ww; str << ww << " "; } //loop Samples - str << std::endl; + str << "\n"; for (int j = 0; j < nSamples; ++j) { // fill chi2 matrix @@ -442,7 +429,7 @@ EcalTBWeights* StoreEcalCondition::readEcalTBWeightsFromFile(const char* inputFi chisq2(j, k) = ww; str << ww << " "; } //loop samples - str << std::endl; + str << "\n"; } //loop lines LogDebug("StoreEcalCondition") << str.str(); @@ -460,7 +447,7 @@ EcalTBWeights* StoreEcalCondition::readEcalTBWeightsFromFile(const char* inputFi } //------------------------------------------------------------- -EcalADCToGeVConstant* StoreEcalCondition::readEcalADCToGeVConstantFromFile(const char* inputFile) { +std::shared_ptr StoreEcalCondition::readEcalADCToGeVConstantFromFile(const char* inputFile) { //------------------------------------------------------------- FILE* inpFile; // input file @@ -476,26 +463,26 @@ EcalADCToGeVConstant* StoreEcalCondition::readEcalADCToGeVConstantFromFile(const fgets(line, 255, inpFile); int sm_number = atoi(line); - str << "sm= " << sm_number << endl; + str << "sm= " << sm_number << "\n"; fgets(line, 255, inpFile); //int nevents=atoi(line); // not necessary here just for online conddb fgets(line, 255, inpFile); string gen_tag = to_string(line); - str << "gen tag " << gen_tag << endl; // should I use this? + str << "gen tag " << gen_tag << "\n"; // should I use this? fgets(line, 255, inpFile); string cali_method = to_string(line); - str << "cali method " << cali_method << endl; // not important + str << "cali method " << cali_method << "\n"; // not important fgets(line, 255, inpFile); string cali_version = to_string(line); - str << "cali version " << cali_version << endl; // not important + str << "cali version " << cali_version << "\n"; // not important fgets(line, 255, inpFile); string cali_type = to_string(line); - str << "cali type " << cali_type << endl; // not important + str << "cali type " << cali_type << "\n"; // not important edm::LogInfo("StoreEcalCondition") << "ADCToGeV file " << str.str(); @@ -513,17 +500,17 @@ EcalADCToGeVConstant* StoreEcalCondition::readEcalADCToGeVConstantFromFile(const sm_constr_ = sm_number; // barrel and endcaps the same - EcalADCToGeVConstant* agc = new EcalADCToGeVConstant(adc_to_gev, adc_to_gev_ee); + auto agc = std::make_shared(adc_to_gev, adc_to_gev_ee); edm::LogInfo("StoreEcalCondition") << "ADCtoGeV scale written into the DB"; return agc; } //------------------------------------------------------------- -EcalPFRecHitThresholds* StoreEcalCondition::readEcalPFRecHitThresholdsFromFile(const char* inputFile, - const char* inputFileEE) { +std::shared_ptr StoreEcalCondition::readEcalPFRecHitThresholdsFromFile( + const char* inputFile, const char* inputFileEE) { //------------------------------------------------------------- - EcalPFRecHitThresholds* ical = new EcalPFRecHitThresholds(); + auto ical = std::make_shared(); FILE* inpFile; // input file inpFile = fopen(inputFile, "r"); @@ -546,7 +533,7 @@ EcalPFRecHitThresholds* StoreEcalCondition::readEcalPFRecHitThresholdsFromFile(c while (fgets(line, 255, inpFile)) { sscanf(line, "%d %d %f ", &ieta, &iphi, &thresh); if (ii == 0) - cout << "crystal " << ieta << "/" << iphi << " Thresh= " << thresh << endl; + edm::LogVerbatim("StoreEcalCondition") << "crystal " << ieta << "/" << iphi << " Thresh= " << thresh << "\n"; if (EBDetId::validDetId(ieta, iphi)) { EBDetId ebid(ieta, iphi); @@ -560,8 +547,6 @@ EcalPFRecHitThresholds* StoreEcalCondition::readEcalPFRecHitThresholdsFromFile(c edm::LogInfo("StoreEcalCondition") << "Read PF RecHits for " << ii << " xtals "; - cout << " I read the thresholds for " << ii << " crystals " << endl; - FILE* inpFileEE; // input file inpFileEE = fopen(inputFileEE, "r"); if (!inpFileEE) { @@ -572,7 +557,8 @@ EcalPFRecHitThresholds* StoreEcalCondition::readEcalPFRecHitThresholdsFromFile(c while (fgets(line, 255, inpFileEE)) { sscanf(line, "%d %d %d %f ", &ix, &iy, &iz, &thresh); if (ii == 0) - cout << "crystal " << ix << "/" << iy << "/" << iz << " Thresh= " << thresh << endl; + edm::LogVerbatim("StoreEcalCondition") + << "crystal " << ix << "/" << iy << "/" << iz << " Thresh= " << thresh << "\n"; if (EEDetId::validDetId(ix, iy, iz)) { EEDetId eeid(ix, iy, iz); ical->setValue(eeid.rawId(), thresh); @@ -583,16 +569,17 @@ EcalPFRecHitThresholds* StoreEcalCondition::readEcalPFRecHitThresholdsFromFile(c // inf.close(); // close inp. file fclose(inpFileEE); // close inp. file - cout << "loop on EE channels done - number of crystals =" << ii << std::endl; + edm::LogInfo("StoreEcalCondition") << "loop on EE channels done - number of crystals =" << ii; return ical; } + //------------------------------------------------------------- -EcalIntercalibConstants* StoreEcalCondition::readEcalIntercalibConstantsFromFile(const char* inputFile, - const char* inputFileEE) { +std::shared_ptr StoreEcalCondition::readEcalIntercalibConstantsFromFile( + const char* inputFile, const char* inputFileEE) { //------------------------------------------------------------- - EcalIntercalibConstants* ical = new EcalIntercalibConstants(); + auto ical = std::make_shared(); FILE* inpFile; // input file inpFile = fopen(inputFile, "r"); @@ -610,7 +597,7 @@ EcalIntercalibConstants* StoreEcalCondition::readEcalIntercalibConstantsFromFile int sm_number = 0; int nchan = 1700; sm_number = atoi(line); - str << "sm= " << sm_number << endl; + str << "sm= " << sm_number << "\n"; if (sm_number != -1) { nchan = 1700; } else { @@ -622,19 +609,19 @@ EcalIntercalibConstants* StoreEcalCondition::readEcalIntercalibConstantsFromFile fgets(line, 255, inpFile); string gen_tag = to_string(line); - str << "gen tag " << gen_tag << endl; // should I use this? + str << "gen tag " << gen_tag << "\n"; // should I use this? fgets(line, 255, inpFile); string cali_method = to_string(line); - str << "cali method " << cali_method << endl; // not important + str << "cali method " << cali_method << "\n"; // not important fgets(line, 255, inpFile); string cali_version = to_string(line); - str << "cali version " << cali_version << endl; // not important + str << "cali version " << cali_version << "\n"; // not important fgets(line, 255, inpFile); string cali_type = to_string(line); - str << "cali type " << cali_type << endl; // not important + str << "cali type " << cali_type << "\n"; // not important edm::LogInfo("StoreEcalCondition") << "Intercalibration file " << str.str(); @@ -657,11 +644,12 @@ EcalIntercalibConstants* StoreEcalCondition::readEcalIntercalibConstantsFromFile } } else { // this is for the whole Barrel - cout << "mode ALL BARREL" << endl; + edm::LogInfo("StoreEcalCondition") << "mode ALL BARREL"; while (fgets(line, 255, inpFile)) { sscanf(line, "%d %d %f %f %d", &sm_num[ii], &cry_num[ii], &calib[ii], &calib_rms[ii], &calib_status[ii]); if (ii == 0) - cout << "crystal " << cry_num[ii] << " of sm " << sm_num[ii] << " cali= " << calib[ii] << endl; + edm::LogVerbatim("StoreEcalCondition") + << "crystal " << cry_num[ii] << " of sm " << sm_num[ii] << " cali= " << calib[ii] << "\n"; ii++; } } @@ -671,9 +659,8 @@ EcalIntercalibConstants* StoreEcalCondition::readEcalIntercalibConstantsFromFile edm::LogInfo("StoreEcalCondition") << "Read intercalibrations for " << ii << " xtals "; - cout << " I read the calibrations for " << ii << " crystals " << endl; if (ii != nchan) - edm::LogWarning("StoreEcalCondition") << "Some crystals missing. Missing channels will be set to 0" << endl; + edm::LogWarning("StoreEcalCondition") << "Some crystals missing. Missing channels will be set to 0"; // Get channel ID @@ -690,12 +677,12 @@ EcalIntercalibConstants* StoreEcalCondition::readEcalIntercalibConstantsFromFile ical->setValue(ebid.rawId(), calib[i]); if (i == 0) - cout << "crystal " << cry_num[i] << " of sm " << sm_num[i] << " in slot " << slot_num << " calib= " << calib[i] - << endl; + edm::LogVerbatim("StoreEcalCondition") << "crystal " << cry_num[i] << " of sm " << sm_num[i] << " in slot " + << slot_num << " calib= " << calib[i] << "\n"; } // loop over channels - cout << "loop on channels done" << endl; + edm::LogInfo("StoreEcalCondition") << "loop on channels done"; FILE* inpFileEE; // input file inpFileEE = fopen(inputFileEE, "r"); @@ -719,7 +706,7 @@ EcalIntercalibConstants* StoreEcalCondition::readEcalIntercalibConstantsFromFile } } else { - cout << "... now reading EE file ..." << endl; + edm::LogInfo("StoreEcalCondition") << "... now reading EE file ..."; int ii = 0; while (fgets(line, 255, inpFileEE)) { @@ -727,7 +714,8 @@ EcalIntercalibConstants* StoreEcalCondition::readEcalIntercalibConstantsFromFile float calibee; sscanf(line, "%d %d %d %f", &iz, &ix, &iy, &calibee); if (ii <= 0) - cout << "crystal " << iz << "/" << ix << "/" << iy << " cali=" << calibee << endl; + edm::LogVerbatim("StoreEcalCondition") + << "crystal " << iz << "/" << ix << "/" << iy << " cali=" << calibee << "\n"; if (EEDetId::validDetId(ix, iy, iz)) { EEDetId eedetid(ix, iy, iz); @@ -740,17 +728,17 @@ EcalIntercalibConstants* StoreEcalCondition::readEcalIntercalibConstantsFromFile fclose(inpFileEE); // close inp. file } - cout << "loop on EE channels done" << endl; + edm::LogInfo("StoreEcalCondition") << "loop on EE channels done"; return ical; } //------------------------------------------------------------- -EcalIntercalibConstantsMC* StoreEcalCondition::readEcalIntercalibConstantsMCFromFile(const char* inputFile, - const char* inputFileEE) { +std::shared_ptr StoreEcalCondition::readEcalIntercalibConstantsMCFromFile( + const char* inputFile, const char* inputFileEE) { //------------------------------------------------------------- - EcalIntercalibConstantsMC* ical = new EcalIntercalibConstantsMC(); + auto ical = std::make_shared(); FILE* inpFile; // input file inpFile = fopen(inputFile, "r"); @@ -768,7 +756,7 @@ EcalIntercalibConstantsMC* StoreEcalCondition::readEcalIntercalibConstantsMCFrom int sm_number = 0; int nchan = 1700; sm_number = atoi(line); - str << "sm= " << sm_number << endl; + str << "sm= " << sm_number << "\n"; if (sm_number != -1) { nchan = 1700; } else { @@ -780,19 +768,19 @@ EcalIntercalibConstantsMC* StoreEcalCondition::readEcalIntercalibConstantsMCFrom fgets(line, 255, inpFile); string gen_tag = to_string(line); - str << "gen tag " << gen_tag << endl; // should I use this? + str << "gen tag " << gen_tag << "\n"; // should I use this? fgets(line, 255, inpFile); string cali_method = to_string(line); - str << "cali method " << cali_method << endl; // not important + str << "cali method " << cali_method << "\n"; // not important fgets(line, 255, inpFile); string cali_version = to_string(line); - str << "cali version " << cali_version << endl; // not important + str << "cali version " << cali_version << "\n"; // not important fgets(line, 255, inpFile); string cali_type = to_string(line); - str << "cali type " << cali_type << endl; // not important + str << "cali type " << cali_type << "\n"; // not important edm::LogInfo("StoreEcalCondition") << "Intercalibration file " << str.str(); @@ -815,11 +803,12 @@ EcalIntercalibConstantsMC* StoreEcalCondition::readEcalIntercalibConstantsMCFrom } } else { // this is for the whole Barrel - cout << "mode ALL BARREL" << endl; + edm::LogInfo("StoreEcalCondition") << "mode ALL BARREL"; while (fgets(line, 255, inpFile)) { sscanf(line, "%d %d %f %f %d", &sm_num[ii], &cry_num[ii], &calib[ii], &calib_rms[ii], &calib_status[ii]); if (ii == 0) - cout << "crystal " << cry_num[ii] << " of sm " << sm_num[ii] << " cali= " << calib[ii] << endl; + edm::LogVerbatim("StoreEcalCondition") + << "crystal " << cry_num[ii] << " of sm " << sm_num[ii] << " cali= " << calib[ii] << "\n"; ii++; } } @@ -829,9 +818,8 @@ EcalIntercalibConstantsMC* StoreEcalCondition::readEcalIntercalibConstantsMCFrom edm::LogInfo("StoreEcalCondition") << "Read intercalibrations for " << ii << " xtals "; - cout << " I read the calibrations for " << ii << " crystals " << endl; if (ii != nchan) - edm::LogWarning("StoreEcalCondition") << "Some crystals missing. Missing channels will be set to 0" << endl; + edm::LogWarning("StoreEcalCondition") << "Some crystals missing. Missing channels will be set to 0"; // Get channel ID @@ -848,12 +836,12 @@ EcalIntercalibConstantsMC* StoreEcalCondition::readEcalIntercalibConstantsMCFrom ical->setValue(ebid.rawId(), calib[i]); if (i == 0) - cout << "crystal " << cry_num[i] << " of sm " << sm_num[i] << " in slot " << slot_num << " calib= " << calib[i] - << endl; + edm::LogVerbatim("StoreEcalCondition") << "crystal " << cry_num[i] << " of sm " << sm_num[i] << " in slot " + << slot_num << " calib= " << calib[i] << "\n"; } // loop over channels - cout << "loop on channels done" << endl; + edm::LogInfo("StoreEcalCondition") << "loop on channels done"; FILE* inpFileEE; // input file inpFileEE = fopen(inputFileEE, "r"); @@ -877,7 +865,7 @@ EcalIntercalibConstantsMC* StoreEcalCondition::readEcalIntercalibConstantsMCFrom } } else { - cout << "... now reading EE file ..." << endl; + edm::LogInfo("StoreEcalCondition") << "... now reading EE file ..."; int ii = 0; while (fgets(line, 255, inpFileEE)) { @@ -885,7 +873,8 @@ EcalIntercalibConstantsMC* StoreEcalCondition::readEcalIntercalibConstantsMCFrom float calibee; sscanf(line, "%d %d %d %f", &iz, &ix, &iy, &calibee); if (ii <= 0) - cout << "crystal " << iz << "/" << ix << "/" << iy << " cali=" << calibee << endl; + edm::LogVerbatim("StoreEcalCondition") + << "crystal " << iz << "/" << ix << "/" << iy << " cali=" << calibee << "\n"; if (EEDetId::validDetId(ix, iy, iz)) { EEDetId eedetid(ix, iy, iz); @@ -898,7 +887,7 @@ EcalIntercalibConstantsMC* StoreEcalCondition::readEcalIntercalibConstantsMCFrom fclose(inpFileEE); // close inp. file } - cout << "loop on EE channels done" << endl; + edm::LogInfo("StoreEcalCondition") << "loop on EE channels done"; return ical; } @@ -924,11 +913,11 @@ int StoreEcalCondition::convertFromConstructionSMToSlot(int sm_constr, int sm_sl } //------------------------------------------------------------- -EcalGainRatios* StoreEcalCondition::readEcalGainRatiosFromFile(const char* inputFile) { +std::shared_ptr StoreEcalCondition::readEcalGainRatiosFromFile(const char* inputFile) { //------------------------------------------------------------- // create gain ratios - EcalGainRatios* gratio = new EcalGainRatios; + auto gratio = std::make_shared(); FILE* inpFile; // input file inpFile = fopen(inputFile, "r"); @@ -944,27 +933,27 @@ EcalGainRatios* StoreEcalCondition::readEcalGainRatiosFromFile(const char* input string sm_or_all = to_string(line); int sm_number = 0; sm_number = atoi(line); - str << "sm= " << sm_number << endl; + str << "sm= " << sm_number << "\n"; fgets(line, 255, inpFile); //int nevents=atoi(line); fgets(line, 255, inpFile); string gen_tag = to_string(line); - str << "gen tag " << gen_tag << endl; + str << "gen tag " << gen_tag << "\n"; fgets(line, 255, inpFile); string cali_method = to_string(line); - str << "cali method " << cali_method << endl; + str << "cali method " << cali_method << "\n"; fgets(line, 255, inpFile); string cali_version = to_string(line); - str << "cali version " << cali_version << endl; + str << "cali version " << cali_version << "\n"; fgets(line, 255, inpFile); string cali_type = to_string(line); - str << "cali type " << cali_type << endl; + str << "cali type " << cali_type << "\n"; edm::LogInfo("StoreEcalCondition") << "GainRatio file " << str.str(); @@ -988,7 +977,7 @@ EcalGainRatios* StoreEcalCondition::readEcalGainRatiosFromFile(const char* input edm::LogInfo("StoreEcalCondition") << "Read gainRatios for " << ii << " xtals "; if (ii != 1700) - edm::LogWarning("StoreEcalCondition") << " Missing crystals:: missing channels will be set to 0" << endl; + edm::LogWarning("StoreEcalCondition") << " Missing crystals:: missing channels will be set to 0"; // Get channel ID sm_constr_ = sm_number; @@ -997,7 +986,6 @@ EcalGainRatios* StoreEcalCondition::readEcalGainRatiosFromFile(const char* input // EBDetId(int index1, int index2, int mode = ETAPHIMODE) // sm and crys index SMCRYSTALMODE index1 is SM index2 is crystal number a la H4 EBDetId ebid(sm_slot_, cry_num[i], EBDetId::SMCRYSTALMODE); - // cout << "ebid.rawId()"<< ebid.rawId()<< endl; EcalMGPAGainRatio gr; gr.setGain12Over6(g6_g12[i]); gr.setGain6Over1(g1_g12[i] / g6_g12[i]); @@ -1006,13 +994,14 @@ EcalGainRatios* StoreEcalCondition::readEcalGainRatiosFromFile(const char* input } else { // this is for the whole Barrel - cout << "mode ALL BARREL" << endl; + edm::LogInfo("StoreEcalCondition") << "mode ALL BARREL"; while (fgets(line, 255, inpFile)) { int eta = 0; int phi = 0; sscanf(line, "%d %d %d %f %f", &hash1, &eta, &phi, &g1_g12[ii], &g6_g12[ii]); if (ii < 20) - cout << "crystal eta/phi=" << eta << "/" << phi << " g1_12/g6_12= " << g1_g12[ii] << "/" << g6_g12[ii] << endl; + edm::LogVerbatim("StoreEcalCondition") + << "crystal eta/phi=" << eta << "/" << phi << " g1_12/g6_12= " << g1_g12[ii] << "/" << g6_g12[ii] << "\n"; if (g1_g12[ii] < 9 || g1_g12[ii] > 15) g1_g12[ii] = 12.0; @@ -1020,9 +1009,9 @@ EcalGainRatios* StoreEcalCondition::readEcalGainRatiosFromFile(const char* input g6_g12[ii] = 2.0; if (eta < -85 || eta > 85 || eta == 0) - std::cout << "error!!!" << endl; + edm::LogVerbatim("StoreEcalCondition") << "error!!!\n"; if (phi < 1 || phi > 360) - std::cout << "error!!!" << endl; + edm::LogVerbatim("StoreEcalCondition") << "error!!!\n"; EBDetId ebid(eta, phi, EBDetId::ETAPHIMODE); EcalMGPAGainRatio gr; @@ -1035,9 +1024,9 @@ EcalGainRatios* StoreEcalCondition::readEcalGainRatiosFromFile(const char* input fclose(inpFile); // close inp. file if (ii != 61200) - edm::LogWarning("StoreEcalCondition") << " Missing crystals !!!!!!!" << endl; + edm::LogWarning("StoreEcalCondition") << " Missing crystals !!!!!!!"; - std::cout << "number of crystals read:" << ii << endl; + edm::LogInfo("StoreEcalCondition") << "number of crystals read:" << ii; } for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) { @@ -1058,15 +1047,15 @@ EcalGainRatios* StoreEcalCondition::readEcalGainRatiosFromFile(const char* input } } - std::cout << " gratio pointer=" << gratio << endl; + edm::LogInfo("StoreEcalCondition") << " gratio pointer=" << gratio; - std::cout << "now leaving" << endl; + edm::LogInfo("StoreEcalCondition") << "now leaving"; return gratio; } -EcalChannelStatus* StoreEcalCondition::readEcalChannelStatusFromFile(const char* inputFile) { - EcalChannelStatus* status = new EcalChannelStatus(); +std::shared_ptr StoreEcalCondition::readEcalChannelStatusFromFile(const char* inputFile) { + auto status = std::make_shared(); // barrel for (int ieta = -EBDetId::MAX_IETA; ieta <= EBDetId::MAX_IETA; ++ieta) { if (ieta == 0) @@ -1093,8 +1082,7 @@ EcalChannelStatus* StoreEcalCondition::readEcalChannelStatusFromFile(const char* } } - // edm::LogInfo("EcalTrivialConditionRetriever") << "Reading channel status from file " << edm::FileInPath(channelStatusFile_).fullPath().c_str() ; - std::cout << "Reading channel status from file " << inputFile << std::endl; + edm::LogInfo("StoreEcalCondition") << "Reading channel status from file " << inputFile; FILE* ifile = fopen(inputFile, "r"); if (!ifile) throw cms::Exception("Cannot open ECAL channel status file"); @@ -1103,22 +1091,22 @@ EcalChannelStatus* StoreEcalCondition::readEcalChannelStatusFromFile(const char* fgets(line, 255, ifile); std::string gen_tag = line; - std::cout << "Gen tag " << gen_tag << std::endl; + edm::LogVerbatim("StoreEcalCondition") << "Gen tag " << gen_tag << "\n"; fgets(line, 255, ifile); std::string comment = line; - std::cout << "Gen comment " << comment << std::endl; + edm::LogVerbatim("StoreEcalCondition") << "Gen comment " << comment << "\n"; int iovRunStart(0); fgets(line, 255, ifile); sscanf(line, "%d", &iovRunStart); - std::cout << "IOV START " << iovRunStart << std::endl; + edm::LogVerbatim("StoreEcalCondition") << "IOV START " << iovRunStart << "\n"; //if -1 start of time int iovRunEnd(0); fgets(line, 255, ifile); sscanf(line, "%d", &iovRunEnd); - std::cout << "IOV END " << iovRunEnd << std::endl; + edm::LogVerbatim("StoreEcalCondition") << "IOV END " << iovRunEnd << "\n"; //if -1 end of time int ii = 0; @@ -1130,7 +1118,8 @@ EcalChannelStatus* StoreEcalCondition::readEcalChannelStatusFromFile(const char* aStrStream << line; aStrStream >> EBorEE >> hashedIndex >> chStatus; // if(ii==0) - std::cout << EBorEE << " hashedIndex " << hashedIndex << " status " << chStatus << std::endl; + edm::LogVerbatim("StoreEcalCondition") + << EBorEE << " hashedIndex " << hashedIndex << " status " << chStatus << "\n"; if (EBorEE == "EB") { EBDetId aEBDetId = EBDetId::unhashIndex(hashedIndex); @@ -1152,7 +1141,7 @@ EcalChannelStatus* StoreEcalCondition::readEcalChannelStatusFromFile(const char* for (int ieta = iymin; ieta <= iymax; ieta++) { for (int iphi = ixmin; iphi <= ixmax; iphi++) { int ixt = ieta * 20 + iphi + 1; - std::cout << "killing crystal " << ism << "/" << ixt << endl; + edm::LogVerbatim("StoreEcalCondition") << "killing crystal " << ism << "/" << ixt << "\n"; EBDetId ebid(ism, ixt, EBDetId::SMCRYSTALMODE); status->setValue(ebid, 1); } diff --git a/CondTools/Ecal/plugins/StoreEcalCondition.h b/CondTools/Ecal/plugins/StoreEcalCondition.h index 353683015577e..2c0ebfe22d8b8 100644 --- a/CondTools/Ecal/plugins/StoreEcalCondition.h +++ b/CondTools/Ecal/plugins/StoreEcalCondition.h @@ -1,11 +1,11 @@ -#ifndef StoreEcalCondition_h -#define StoreEcalCondition_h +#ifndef CondTools_Ecal_StoreEcalCondition_h +#define CondTools_Ecal_StoreEcalCondition_h -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include #include -#include +#include #include #include #include @@ -36,16 +36,16 @@ namespace edm { // class decleration // -class StoreEcalCondition : public edm::EDAnalyzer { +class StoreEcalCondition : public edm::one::EDAnalyzer<> { public: - EcalWeightXtalGroups* readEcalWeightXtalGroupsFromFile(const char*); - EcalTBWeights* readEcalTBWeightsFromFile(const char*); - EcalADCToGeVConstant* readEcalADCToGeVConstantFromFile(const char*); - EcalIntercalibConstants* readEcalIntercalibConstantsFromFile(const char*, const char*); - EcalPFRecHitThresholds* readEcalPFRecHitThresholdsFromFile(const char*, const char*); - EcalIntercalibConstantsMC* readEcalIntercalibConstantsMCFromFile(const char*, const char*); - EcalGainRatios* readEcalGainRatiosFromFile(const char*); - EcalChannelStatus* readEcalChannelStatusFromFile(const char*); + std::shared_ptr readEcalWeightXtalGroupsFromFile(const char*); + std::shared_ptr readEcalTBWeightsFromFile(const char*); + std::shared_ptr readEcalADCToGeVConstantFromFile(const char*); + std::shared_ptr readEcalIntercalibConstantsFromFile(const char*, const char*); + std::shared_ptr readEcalPFRecHitThresholdsFromFile(const char*, const char*); + std::shared_ptr readEcalIntercalibConstantsMCFromFile(const char*, const char*); + std::shared_ptr readEcalGainRatiosFromFile(const char*); + std::shared_ptr readEcalChannelStatusFromFile(const char*); void writeToLogFile(std::string, std::string, unsigned long long); void writeToLogFileResults(char*); int convertFromConstructionSMToSlot(int, int); diff --git a/CondTools/Ecal/src/ESDBCopy.cc b/CondTools/Ecal/src/ESDBCopy.cc index b3fbfa4a9c5c1..1bcc1e6460fbb 100644 --- a/CondTools/Ecal/src/ESDBCopy.cc +++ b/CondTools/Ecal/src/ESDBCopy.cc @@ -75,40 +75,34 @@ void ESDBCopy::copyToDB(const edm::EventSetup& evtSetup, const std::string& cont std::string recordName = m_records[container]; if (container == "ESPedestals") { - const auto* obj = &evtSetup.getData(esPedestalsToken_); - edm::LogInfo("ESDBCopy") << "ped pointer is: " << obj; - dbOutput->createNewIOV( - new ESPedestals(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(esPedestalsToken_); + edm::LogInfo("ESDBCopy") << "ped pointer is: " << &obj; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "ESADCToGeVConstant") { - const auto* obj = &evtSetup.getData(esADCToGeVConstantToken_); - edm::LogInfo("ESDBCopy") << "adc pointer is: " << obj; - dbOutput->createNewIOV( - new ESADCToGeVConstant(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(esADCToGeVConstantToken_); + edm::LogInfo("ESDBCopy") << "adc pointer is: " << &obj; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "ESChannelStatus") { - const auto* obj = &evtSetup.getData(esChannelStatusToken_); - edm::LogInfo("ESDBCopy") << "channel status pointer is: " << obj; - dbOutput->createNewIOV( - new ESChannelStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(esChannelStatusToken_); + edm::LogInfo("ESDBCopy") << "channel status pointer is: " << &obj; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "ESIntercalibConstants") { - const auto* obj = &evtSetup.getData(esIntercalibConstantsToken_); - edm::LogInfo("ESDBCopy") << "inter pointer is: " << obj; - dbOutput->createNewIOV( - new ESIntercalibConstants(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(esIntercalibConstantsToken_); + edm::LogInfo("ESDBCopy") << "inter pointer is: " << &obj; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "ESWeightStripGroups") { - const auto* obj = &evtSetup.getData(esWeightStripGroupsToken_); - edm::LogInfo("ESDBCopy") << "weight pointer is: " << obj; - dbOutput->createNewIOV( - new ESWeightStripGroups(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(esWeightStripGroupsToken_); + edm::LogInfo("ESDBCopy") << "weight pointer is: " << &obj; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "ESTBWeights") { - const auto* obj = &evtSetup.getData(esTBWeightsToken_); - edm::LogInfo("ESDBCopy") << "tbweight pointer is: " << obj; - dbOutput->createNewIOV( - new ESTBWeights(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(esTBWeightsToken_); + edm::LogInfo("ESDBCopy") << "tbweight pointer is: " << &obj; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else { throw cms::Exception("Unknown container"); diff --git a/CondTools/Ecal/src/EcalDBCopy.cc b/CondTools/Ecal/src/EcalDBCopy.cc index 1f04ce036df8e..587c6172a03c2 100644 --- a/CondTools/Ecal/src/EcalDBCopy.cc +++ b/CondTools/Ecal/src/EcalDBCopy.cc @@ -209,240 +209,196 @@ void EcalDBCopy::copyToDB(const edm::EventSetup& evtSetup, const std::string& co std::string recordName = m_records[container]; if (container == "EcalPedestals") { - const EcalPedestals* obj = &evtSetup.getData(ecalPedestalToken_); - edm::LogInfo("EcalDBCopy") << "ped pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new EcalPedestals(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalPedestalToken_); + edm::LogInfo("EcalDBCopy") << "ped pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalADCToGeVConstant") { - const EcalADCToGeVConstant* obj = &evtSetup.getData(ecalADCtoGeVToken_); - edm::LogInfo("EcalDBCopy") << "adc pointer is: " << obj << std::endl; - - dbOutput->createNewIOV( - new EcalADCToGeVConstant(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalADCtoGeVToken_); + edm::LogInfo("EcalDBCopy") << "adc pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTimeCalibConstants") { - const EcalTimeCalibConstants* obj = &evtSetup.getData(ecalTimeCalibToken_); - edm::LogInfo("EcalDBCopy") << "adc pointer is: " << obj << std::endl; - - dbOutput->createNewIOV( - new EcalTimeCalibConstants(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalTimeCalibToken_); + edm::LogInfo("EcalDBCopy") << "adc pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalChannelStatus") { - const EcalChannelStatus* obj = &evtSetup.getData(ecalChannelStatusToken_); - edm::LogInfo("EcalDBCopy") << "channel status pointer is: " << obj << std::endl; - - dbOutput->createNewIOV( - new EcalChannelStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalChannelStatusToken_); + edm::LogInfo("EcalDBCopy") << "channel status pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalDQMChannelStatus") { - const EcalDQMChannelStatus* obj = &evtSetup.getData(ecalDQMChannelStatusToken_); - edm::LogInfo("EcalDBCopy") << "DQM channel status pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new EcalDQMChannelStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalDQMChannelStatusToken_); + edm::LogInfo("EcalDBCopy") << "DQM channel status pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalDQMTowerStatus") { - const EcalDQMTowerStatus* obj = &evtSetup.getData(ecalDQMTowerStatusToken_); - edm::LogInfo("EcalDBCopy") << "DQM Tower status pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new EcalDQMTowerStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalDQMTowerStatusToken_); + edm::LogInfo("EcalDBCopy") << "DQM Tower status pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalDCSTowerStatus") { - const EcalDCSTowerStatus* obj = &evtSetup.getData(ecalDCSTowerStatusToken_); - edm::LogInfo("EcalDBCopy") << "channel status pointer is: " << obj << std::endl; - - dbOutput->createNewIOV( - new EcalDCSTowerStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalDCSTowerStatusToken_); + edm::LogInfo("EcalDBCopy") << "channel status pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalDAQTowerStatus") { - const EcalDAQTowerStatus* obj = &evtSetup.getData(ecalDAQTowerStatusToken_); - edm::LogInfo("EcalDBCopy") << "DAQ channel status pointer is: " << obj << std::endl; - - dbOutput->createNewIOV( - new EcalDAQTowerStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalDAQTowerStatusToken_); + edm::LogInfo("EcalDBCopy") << "DAQ channel status pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTPGCrystalStatus") { - const EcalTPGCrystalStatus* obj = &evtSetup.getData(ecalTPGCrystalStatusToken_); - edm::LogInfo("EcalDBCopy") << "TPG channel status pointer is: " << obj << std::endl; - - dbOutput->createNewIOV( - new EcalTPGCrystalStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalTPGCrystalStatusToken_); + edm::LogInfo("EcalDBCopy") << "TPG channel status pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTPGTowerStatus") { - const EcalTPGTowerStatus* obj = &evtSetup.getData(ecalTPGTowerStatusToken_); - edm::LogInfo("EcalDBCopy") << "TPG tower status pointer is: " << obj << std::endl; - - dbOutput->createNewIOV( - new EcalTPGTowerStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalTPGTowerStatusToken_); + edm::LogInfo("EcalDBCopy") << "TPG tower status pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalIntercalibConstants") { - const EcalIntercalibConstants* obj = &evtSetup.getData(ecalIntercalibConstantsToken_); - edm::LogInfo("EcalDBCopy") << "inter pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new EcalIntercalibConstants(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalIntercalibConstantsToken_); + edm::LogInfo("EcalDBCopy") << "inter pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalLinearCorrections") { - const EcalLinearCorrections* obj = &evtSetup.getData(ecalLinearCorrectionsToken_); - edm::LogInfo("EcalDBCopy") << "inter pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new EcalLinearCorrections(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalLinearCorrectionsToken_); + edm::LogInfo("EcalDBCopy") << "inter pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalIntercalibConstantsMC") { - const EcalIntercalibConstantsMC* obj = &evtSetup.getData(ecalIntercalibConstantsMCToken_); - edm::LogInfo("EcalDBCopy") << "intercalib MC pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new EcalIntercalibConstantsMC(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalIntercalibConstantsMCToken_); + edm::LogInfo("EcalDBCopy") << "intercalib MC pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalIntercalibErrors") { - const EcalIntercalibErrors* obj = &evtSetup.getData(ecalIntercalibErrorsToken_); - edm::LogInfo("EcalDBCopy") << "inter pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new EcalIntercalibErrors(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalIntercalibErrorsToken_); + edm::LogInfo("EcalDBCopy") << "inter pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalGainRatios") { - const EcalGainRatios* obj = &evtSetup.getData(ecalGainRatiosToken_); - edm::LogInfo("EcalDBCopy") << "gain pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new EcalGainRatios(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalGainRatiosToken_); + edm::LogInfo("EcalDBCopy") << "gain pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalWeightXtalGroups") { - const EcalWeightXtalGroups* obj = &evtSetup.getData(ecalWeightXtalGroupsToken_); - edm::LogInfo("EcalDBCopy") << "weight pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new EcalWeightXtalGroups(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalWeightXtalGroupsToken_); + edm::LogInfo("EcalDBCopy") << "weight pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTBWeights") { - const EcalTBWeights* obj = &evtSetup.getData(ecalTBWeightsToken_); - edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new EcalTBWeights(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalTBWeightsToken_); + edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalLaserAlphas") { - const EcalLaserAlphas* obj = &evtSetup.getData(ecalLaserAlphasToken_); - edm::LogInfo("EcalDBCopy") << "ecalLaserAlpha pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new EcalLaserAlphas(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalLaserAlphasToken_); + edm::LogInfo("EcalDBCopy") << "ecalLaserAlpha pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalLaserAPDPNRatios") { - const EcalLaserAPDPNRatios* obj = &evtSetup.getData(ecalLaserAPDPNRatiosToken_); - edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new EcalLaserAPDPNRatios(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalLaserAPDPNRatiosToken_); + edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalLaserAPDPNRatiosRef") { - const EcalLaserAPDPNRatiosRef* obj = &evtSetup.getData(ecalLaserAPDPNRatiosRefToken_); - edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new EcalLaserAPDPNRatiosRef(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalLaserAPDPNRatiosRefToken_); + edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalClusterCrackCorrParameters") { - const EcalClusterCrackCorrParameters* obj = &evtSetup.getData(ecalClusterCrackCorrParametersToken_); - edm::LogInfo("EcalDBCopy") << "cluster crack pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new EcalClusterCrackCorrParameters(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalClusterCrackCorrParametersToken_); + edm::LogInfo("EcalDBCopy") << "cluster crack pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalPFRecHitThresholds") { - const EcalPFRecHitThresholds* obj = &evtSetup.getData(ecalPFRecHitThresholdsToken_); - edm::LogInfo("EcalDBCopy") << "Ecal PF rec hit thresholds pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new EcalPFRecHitThresholds(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalPFRecHitThresholdsToken_); + edm::LogInfo("EcalDBCopy") << "Ecal PF rec hit thresholds pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalClusterEnergyUncertaintyParameters") { - const EcalClusterEnergyUncertaintyParameters* obj = &evtSetup.getData(ecalClusterEnergyUncertaintyParametersToken_); - edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new EcalClusterEnergyUncertaintyParameters(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalClusterEnergyUncertaintyParametersToken_); + edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalClusterEnergyCorrectionParameters") { - const EcalClusterEnergyCorrectionParameters* obj = &evtSetup.getData(ecalClusterEnergyCorrectionParametersToken_); - edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new EcalClusterEnergyCorrectionParameters(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalClusterEnergyCorrectionParametersToken_); + edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalClusterEnergyCorrectionObjectSpecificParameters") { - const EcalClusterEnergyCorrectionObjectSpecificParameters* obj = - &evtSetup.getData(ecalClusterEnergyCorrectionObjectSpecificParametersToken_); - edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new EcalClusterEnergyCorrectionObjectSpecificParameters(*obj), - dbOutput->beginOfTime(), - dbOutput->endOfTime(), - recordName); + const auto& obj = evtSetup.getData(ecalClusterEnergyCorrectionObjectSpecificParametersToken_); + edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << &obj << std::endl; + dbOutput->createOneIOV( + obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalClusterLocalContCorrParameters") { - const EcalClusterLocalContCorrParameters* obj = &evtSetup.getData(ecalClusterLocalContCorrParametersToken_); - edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new EcalClusterLocalContCorrParameters(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalClusterLocalContCorrParametersToken_); + edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EBAlignment") { - const Alignments* obj = &evtSetup.getData(ebAlignmentToken_); - edm::LogInfo("EcalDBCopy") << "EB alignment pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new Alignments(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ebAlignmentToken_); + edm::LogInfo("EcalDBCopy") << "EB alignment pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EEAlignment") { - const Alignments* obj = &evtSetup.getData(eeAlignmentToken_); - edm::LogInfo("EcalDBCopy") << "EE alignment pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new Alignments(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(eeAlignmentToken_); + edm::LogInfo("EcalDBCopy") << "EE alignment pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "ESAlignment") { - const Alignments* obj = &evtSetup.getData(esAlignmentToken_); - edm::LogInfo("EcalDBCopy") << "ES alignment pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new Alignments(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(esAlignmentToken_); + edm::LogInfo("EcalDBCopy") << "ES alignment pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTimeOffsetConstant") { - const EcalTimeOffsetConstant* obj = &evtSetup.getData(ecalTimeOffsetConstantToken_); - edm::LogInfo("EcalDBCopy") << "TimeOffset pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new EcalTimeOffsetConstant(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalTimeOffsetConstantToken_); + edm::LogInfo("EcalDBCopy") << "TimeOffset pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalSampleMask") { - const EcalSampleMask* obj = &evtSetup.getData(ecalSampleMaskToken_); - edm::LogInfo("EcalDBCopy") << "sample mask pointer is: " << obj << std::endl; - dbOutput->createNewIOV( - new EcalSampleMask(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalSampleMaskToken_); + edm::LogInfo("EcalDBCopy") << "sample mask pointer is: " << &obj << std::endl; + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalSimPulseShape") { - const EcalSimPulseShape* obj = &evtSetup.getData(ecalSimPulseShapeToken_); - dbOutput->createNewIOV( - new EcalSimPulseShape(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + const auto& obj = evtSetup.getData(ecalSimPulseShapeToken_); + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); } else if (container == "EcalTimeBiasCorrections") { - const EcalTimeBiasCorrections* obj = &evtSetup.getData(ecalTimeBiasCorrectionsToken_); - edm::LogInfo("EcalDBCopy") << "TimeBiasCorrections pointer is: " << obj << std::endl; - EcalTimeBiasCorrections* bias_; - bias_ = new EcalTimeBiasCorrections(); - std::vector vect = obj->EBTimeCorrAmplitudeBins; - copy(vect.begin(), vect.end(), back_inserter(bias_->EBTimeCorrAmplitudeBins)); - vect = obj->EBTimeCorrShiftBins; - copy(vect.begin(), vect.end(), back_inserter(bias_->EBTimeCorrShiftBins)); - vect = obj->EETimeCorrAmplitudeBins; - copy(vect.begin(), vect.end(), back_inserter(bias_->EETimeCorrAmplitudeBins)); - vect = obj->EETimeCorrShiftBins; - copy(vect.begin(), vect.end(), back_inserter(bias_->EETimeCorrShiftBins)); - dbOutput->writeOne(bias_, dbOutput->beginOfTime(), "EcalTimeBiasCorrectionsRcd"); + const auto& obj = evtSetup.getData(ecalTimeBiasCorrectionsToken_); + edm::LogInfo("EcalDBCopy") << "TimeBiasCorrections pointer is: " << &obj << std::endl; + EcalTimeBiasCorrections bias_; + std::vector vect = obj.EBTimeCorrAmplitudeBins; + copy(vect.begin(), vect.end(), back_inserter(bias_.EBTimeCorrAmplitudeBins)); + vect = obj.EBTimeCorrShiftBins; + copy(vect.begin(), vect.end(), back_inserter(bias_.EBTimeCorrShiftBins)); + vect = obj.EETimeCorrAmplitudeBins; + copy(vect.begin(), vect.end(), back_inserter(bias_.EETimeCorrAmplitudeBins)); + vect = obj.EETimeCorrShiftBins; + copy(vect.begin(), vect.end(), back_inserter(bias_.EETimeCorrShiftBins)); + dbOutput->writeOneIOV(bias_, dbOutput->beginOfTime(), "EcalTimeBiasCorrectionsRcd"); } else if (container == "EcalSamplesCorrelation") { - const EcalSamplesCorrelation* obj = &evtSetup.getData(ecalSamplesCorrelationToken_); - edm::LogInfo("EcalDBCopy") << "SamplesCorrelation pointer is: " << obj << std::endl; - EcalSamplesCorrelation* correl_; - correl_ = new EcalSamplesCorrelation(); - std::vector vect = obj->EBG12SamplesCorrelation; - copy(vect.begin(), vect.end(), back_inserter(correl_->EBG12SamplesCorrelation)); - vect = obj->EBG6SamplesCorrelation; - copy(vect.begin(), vect.end(), back_inserter(correl_->EBG6SamplesCorrelation)); - vect = obj->EBG1SamplesCorrelation; - copy(vect.begin(), vect.end(), back_inserter(correl_->EBG1SamplesCorrelation)); - vect = obj->EEG12SamplesCorrelation; - copy(vect.begin(), vect.end(), back_inserter(correl_->EEG12SamplesCorrelation)); - vect = obj->EEG6SamplesCorrelation; - copy(vect.begin(), vect.end(), back_inserter(correl_->EEG6SamplesCorrelation)); - vect = obj->EEG1SamplesCorrelation; - copy(vect.begin(), vect.end(), back_inserter(correl_->EEG1SamplesCorrelation)); - dbOutput->writeOne(correl_, dbOutput->beginOfTime(), "EcalSamplesCorrelationRcd"); + const auto& obj = evtSetup.getData(ecalSamplesCorrelationToken_); + edm::LogInfo("EcalDBCopy") << "SamplesCorrelation pointer is: " << &obj << std::endl; + EcalSamplesCorrelation correl_; + std::vector vect = obj.EBG12SamplesCorrelation; + copy(vect.begin(), vect.end(), back_inserter(correl_.EBG12SamplesCorrelation)); + vect = obj.EBG6SamplesCorrelation; + copy(vect.begin(), vect.end(), back_inserter(correl_.EBG6SamplesCorrelation)); + vect = obj.EBG1SamplesCorrelation; + copy(vect.begin(), vect.end(), back_inserter(correl_.EBG1SamplesCorrelation)); + vect = obj.EEG12SamplesCorrelation; + copy(vect.begin(), vect.end(), back_inserter(correl_.EEG12SamplesCorrelation)); + vect = obj.EEG6SamplesCorrelation; + copy(vect.begin(), vect.end(), back_inserter(correl_.EEG6SamplesCorrelation)); + vect = obj.EEG1SamplesCorrelation; + copy(vect.begin(), vect.end(), back_inserter(correl_.EEG1SamplesCorrelation)); + dbOutput->writeOneIOV(correl_, dbOutput->beginOfTime(), "EcalSamplesCorrelationRcd"); } else { throw cms::Exception("Unknown container"); diff --git a/CondTools/Ecal/src/EcalPFRecHitThresholdsMaker.cc b/CondTools/Ecal/src/EcalPFRecHitThresholdsMaker.cc index e897c83b43209..781745bb451dc 100644 --- a/CondTools/Ecal/src/EcalPFRecHitThresholdsMaker.cc +++ b/CondTools/Ecal/src/EcalPFRecHitThresholdsMaker.cc @@ -44,7 +44,7 @@ void EcalPFRecHitThresholdsMaker::analyze(const edm::Event& evt, const edm::Even const auto laser = evtSetup.getHandle(ecalLaserDbServiceToken_); - EcalPFRecHitThresholds* pfthresh = new EcalPFRecHitThresholds(); + EcalPFRecHitThresholds pfthresh; // const EcalIntercalibConstantMap& icalMap = ical_db->getMap(); @@ -75,7 +75,7 @@ void EcalPFRecHitThresholdsMaker::analyze(const edm::Event& evt, const edm::Even if (iPhi == 100) edm::LogInfo("EcalPFRecHitThresholdsMaker") << "Thresh(GeV)=" << thresh << std::endl; - pfthresh->insert(std::make_pair(ebdetid.rawId(), thresh)); + pfthresh.insert(std::make_pair(ebdetid.rawId(), thresh)); } } } @@ -97,7 +97,7 @@ void EcalPFRecHitThresholdsMaker::analyze(const edm::Event& evt, const edm::Even lasercalib = laser->getLaserCorrection(eedetid, evt.time()); // TODO correct time EcalPFRecHitThreshold thresh = aped.rms_x12 * calib * adc_EE * lasercalib * m_nsigma; - pfthresh->insert(std::make_pair(eedetid.rawId(), thresh)); + pfthresh.insert(std::make_pair(eedetid.rawId(), thresh)); } if (EEDetId::validDetId(iX, iY, -1)) { EEDetId eedetid(iX, iY, -1); @@ -113,7 +113,7 @@ void EcalPFRecHitThresholdsMaker::analyze(const edm::Event& evt, const edm::Even lasercalib = laser->getLaserCorrection(eedetid, evt.time()); // TODO correct time EcalPFRecHitThreshold thresh = aped.rms_x12 * calib * adc_EE * lasercalib * m_nsigma; - pfthresh->insert(std::make_pair(eedetid.rawId(), thresh)); + pfthresh.insert(std::make_pair(eedetid.rawId(), thresh)); if (iX == 50) edm::LogInfo("EcalPFRecHitThresholdsMaker") << "Thresh(GeV)=" << thresh << std::endl; @@ -121,8 +121,7 @@ void EcalPFRecHitThresholdsMaker::analyze(const edm::Event& evt, const edm::Even } } - dbOutput->createNewIOV( - pfthresh, dbOutput->beginOfTime(), dbOutput->endOfTime(), "EcalPFRecHitThresholdsRcd"); + dbOutput->createOneIOV(pfthresh, dbOutput->beginOfTime(), "EcalPFRecHitThresholdsRcd"); edm::LogInfo("EcalPFRecHitThresholdsMaker") << "EcalPFRecHitThresholdsMaker wrote it " << std::endl; } diff --git a/CondTools/Ecal/src/EcalTestDevDB.cc b/CondTools/Ecal/src/EcalTestDevDB.cc index 1ec7687f609cc..875621d0333dc 100644 --- a/CondTools/Ecal/src/EcalTestDevDB.cc +++ b/CondTools/Ecal/src/EcalTestDevDB.cc @@ -17,7 +17,6 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include #include using namespace std; @@ -74,151 +73,140 @@ void EcalTestDevDB::analyze(const edm::Event& evt, const edm::EventSetup& evtSet // Arguments 0 0 mean infinite IOV if (m_firstRun == 0 && m_lastRun == 0) { - std::cout << "Infinite IOV mode" << std::endl; + edm::LogInfo("EcalTestDevDB") << "Infinite IOV mode"; irun = edm::IOVSyncValue::endOfTime().eventID().run(); } - std::cout << "Starting Transaction for run " << irun << "..." << std::flush; + edm::LogInfo("EcalTestDevDB") << "Starting Transaction for run " << irun << "..."; if (container == "EcalPedestals") { - EcalPedestals* condObject = generateEcalPedestals(); - + const auto condObject = generateEcalPedestals(); if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) { // create new - std::cout << "First One " << std::endl; - dbOutput->createNewIOV( - condObject, dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + edm::LogInfo("EcalTestDevDB") << "First One "; + dbOutput->createOneIOV(*condObject, dbOutput->beginOfTime(), recordName); } else { // append - std::cout << "Old One " << std::endl; - dbOutput->appendSinceTime(condObject, irun, recordName); + edm::LogInfo("EcalTestDevDB") << "Old One "; + dbOutput->appendOneIOV(*condObject, irun, recordName); } } else if (container == "EcalADCToGeVConstant") { - EcalADCToGeVConstant* condObject = generateEcalADCToGeVConstant(); + const auto condObject = generateEcalADCToGeVConstant(); if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) { // create new - std::cout << "First One " << std::endl; - dbOutput->createNewIOV( - condObject, dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + edm::LogInfo("EcalTestDevDB") << "First One "; + dbOutput->createOneIOV(*condObject, dbOutput->beginOfTime(), recordName); } else { // append - std::cout << "Old One " << std::endl; - dbOutput->appendSinceTime(condObject, irun, recordName); + edm::LogInfo("EcalTestDevDB") << "Old One "; + dbOutput->appendOneIOV(*condObject, irun, recordName); } } else if (container == "EcalIntercalibConstants") { - EcalIntercalibConstants* condObject = generateEcalIntercalibConstants(); + const auto condObject = generateEcalIntercalibConstants(); if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) { // create new - std::cout << "First One " << std::endl; - dbOutput->createNewIOV( - condObject, dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + edm::LogInfo("EcalTestDevDB") << "First One "; + dbOutput->createOneIOV(*condObject, dbOutput->beginOfTime(), recordName); } else { // append - std::cout << "Old One " << std::endl; - dbOutput->appendSinceTime(condObject, irun, recordName); + edm::LogInfo("EcalTestDevDB") << "Old One "; + dbOutput->appendOneIOV(*condObject, irun, recordName); } } else if (container == "EcalLinearCorrections") { - EcalLinearCorrections* condObject = generateEcalLinearCorrections(); + const auto condObject = generateEcalLinearCorrections(); if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) { // create new - std::cout << "First One " << std::endl; - dbOutput->createNewIOV( - condObject, dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + edm::LogInfo("EcalTestDevDB") << "First One "; + dbOutput->createOneIOV(*condObject, dbOutput->beginOfTime(), recordName); } else { // append - std::cout << "Old One " << std::endl; - dbOutput->appendSinceTime(condObject, irun, recordName); + edm::LogInfo("EcalTestDevDB") << "Old One "; + dbOutput->appendOneIOV(*condObject, irun, recordName); } } else if (container == "EcalGainRatios") { - EcalGainRatios* condObject = generateEcalGainRatios(); + const auto condObject = generateEcalGainRatios(); if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) { // create new - std::cout << "First One " << std::endl; - dbOutput->createNewIOV( - condObject, dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + edm::LogInfo("EcalTestDevDB") << "First One "; + dbOutput->createOneIOV(*condObject, dbOutput->beginOfTime(), recordName); } else { // append - std::cout << "Old One " << std::endl; - dbOutput->appendSinceTime(condObject, irun, recordName); + edm::LogInfo("EcalTestDevDB") << "Old One "; + dbOutput->appendOneIOV(*condObject, irun, recordName); } } else if (container == "EcalWeightXtalGroups") { - EcalWeightXtalGroups* condObject = generateEcalWeightXtalGroups(); + const auto condObject = generateEcalWeightXtalGroups(); if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) { // create new - std::cout << "First One " << std::endl; - dbOutput->createNewIOV( - condObject, dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + edm::LogInfo("EcalTestDevDB") << "First One "; + dbOutput->createOneIOV(*condObject, dbOutput->beginOfTime(), recordName); } else { // append - std::cout << "Old One " << std::endl; - dbOutput->appendSinceTime(condObject, irun, recordName); + edm::LogInfo("EcalTestDevDB") << "Old One "; + dbOutput->appendOneIOV(*condObject, irun, recordName); } } else if (container == "EcalTBWeights") { - EcalTBWeights* condObject = generateEcalTBWeights(); + const auto condObject = generateEcalTBWeights(); if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) { // create new - std::cout << "First One " << std::endl; - dbOutput->createNewIOV( - condObject, dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + edm::LogInfo("EcalTestDevDB") << "First One "; + dbOutput->createOneIOV(*condObject, dbOutput->beginOfTime(), recordName); } else { // append - std::cout << "Old One " << std::endl; - dbOutput->appendSinceTime(condObject, irun, recordName); + edm::LogInfo("EcalTestDevDB") << "Old One "; + dbOutput->appendOneIOV(*condObject, irun, recordName); } } else if (container == "EcalLaserAPDPNRatios") { - EcalLaserAPDPNRatios* condObject = generateEcalLaserAPDPNRatios(irun); + const auto condObject = generateEcalLaserAPDPNRatios(irun); if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) { // create new - std::cout << "First One " << std::endl; - dbOutput->createNewIOV( - condObject, dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + edm::LogInfo("EcalTestDevDB") << "First One "; + dbOutput->createOneIOV(*condObject, dbOutput->beginOfTime(), recordName); } else { // append - std::cout << "Old One " << std::endl; - dbOutput->appendSinceTime(condObject, irun, recordName); + edm::LogInfo("EcalTestDevDB") << "Old One "; + dbOutput->appendOneIOV(*condObject, irun, recordName); } } else if (container == "EcalLaserAPDPNRatiosRef") { - EcalLaserAPDPNRatiosRef* condObject = generateEcalLaserAPDPNRatiosRef(); + const auto condObject = generateEcalLaserAPDPNRatiosRef(); if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) { // create new - std::cout << "First One " << std::endl; - dbOutput->createNewIOV( - condObject, dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + edm::LogInfo("EcalTestDevDB") << "First One "; + dbOutput->createOneIOV(*condObject, dbOutput->beginOfTime(), recordName); } else { // append - std::cout << "Old One " << std::endl; - dbOutput->appendSinceTime(condObject, irun, recordName); + edm::LogInfo("EcalTestDevDB") << "Old One "; + dbOutput->appendOneIOV(*condObject, irun, recordName); } } else if (container == "EcalLaserAlphas") { - EcalLaserAlphas* condObject = generateEcalLaserAlphas(); + const auto condObject = generateEcalLaserAlphas(); if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) { // create new - std::cout << "First One " << std::endl; - dbOutput->createNewIOV( - condObject, dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); + edm::LogInfo("EcalTestDevDB") << "First One "; + dbOutput->createOneIOV(*condObject, dbOutput->beginOfTime(), recordName); } else { // append - std::cout << "Old One " << std::endl; - dbOutput->appendSinceTime(condObject, irun, recordName); + edm::LogInfo("EcalTestDevDB") << "Old One "; + dbOutput->appendOneIOV(*condObject, irun, recordName); } } else { - std::cout << "it does not work yet for " << container << "..." << std::flush; + edm::LogWarning("EcalTestDevDB") << "it does not work yet for " << container << "..."; } } } } //------------------------------------------------------------- -EcalPedestals* EcalTestDevDB::generateEcalPedestals() { +std::shared_ptr EcalTestDevDB::generateEcalPedestals() { //------------------------------------------------------------- - EcalPedestals* peds = new EcalPedestals(); + auto peds = std::make_shared(); EcalPedestals::Item item; for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) { if (iEta == 0) @@ -239,19 +227,19 @@ EcalPedestals* EcalTestDevDB::generateEcalPedestals() { } //------------------------------------------------------------- -EcalADCToGeVConstant* EcalTestDevDB::generateEcalADCToGeVConstant() { +std::shared_ptr EcalTestDevDB::generateEcalADCToGeVConstant() { //------------------------------------------------------------- double r = (double)std::rand() / (double(RAND_MAX) + double(1)); - EcalADCToGeVConstant* agc = new EcalADCToGeVConstant(36. + r * 4., 60. + r * 4); + auto agc = std::make_shared(36. + r * 4., 60. + r * 4); return agc; } //------------------------------------------------------------- -EcalIntercalibConstants* EcalTestDevDB::generateEcalIntercalibConstants() { +std::shared_ptr EcalTestDevDB::generateEcalIntercalibConstants() { //------------------------------------------------------------- - EcalIntercalibConstants* ical = new EcalIntercalibConstants(); + auto ical = std::make_shared(); for (int ieta = -EBDetId::MAX_IETA; ieta <= EBDetId::MAX_IETA; ++ieta) { if (ieta == 0) @@ -267,10 +255,10 @@ EcalIntercalibConstants* EcalTestDevDB::generateEcalIntercalibConstants() { } //------------------------------------------------------------- -EcalLinearCorrections* EcalTestDevDB::generateEcalLinearCorrections() { +std::shared_ptr EcalTestDevDB::generateEcalLinearCorrections() { //------------------------------------------------------------- - EcalLinearCorrections* ical = new EcalLinearCorrections(); + auto ical = std::make_shared(); for (int ieta = -EBDetId::MAX_IETA; ieta <= EBDetId::MAX_IETA; ++ieta) { if (ieta == 0) @@ -328,11 +316,11 @@ EcalLinearCorrections* EcalTestDevDB::generateEcalLinearCorrections() { } //------------------------------------------------------------- -EcalGainRatios* EcalTestDevDB::generateEcalGainRatios() { +std::shared_ptr EcalTestDevDB::generateEcalGainRatios() { //------------------------------------------------------------- // create gain ratios - EcalGainRatios* gratio = new EcalGainRatios; + auto gratio = std::make_shared(); for (int ieta = -EBDetId::MAX_IETA; ieta <= EBDetId::MAX_IETA; ++ieta) { if (ieta == 0) @@ -354,10 +342,10 @@ EcalGainRatios* EcalTestDevDB::generateEcalGainRatios() { } //------------------------------------------------------------- -EcalWeightXtalGroups* EcalTestDevDB::generateEcalWeightXtalGroups() { +std::shared_ptr EcalTestDevDB::generateEcalWeightXtalGroups() { //------------------------------------------------------------- - EcalWeightXtalGroups* xtalGroups = new EcalWeightXtalGroups(); + auto xtalGroups = std::make_shared(); for (int ieta = -EBDetId::MAX_IETA; ieta <= EBDetId::MAX_IETA; ++ieta) { if (ieta == 0) continue; @@ -370,10 +358,10 @@ EcalWeightXtalGroups* EcalTestDevDB::generateEcalWeightXtalGroups() { } //------------------------------------------------------------- -EcalTBWeights* EcalTestDevDB::generateEcalTBWeights() { +std::shared_ptr EcalTestDevDB::generateEcalTBWeights() { //------------------------------------------------------------- - EcalTBWeights* tbwgt = new EcalTBWeights(); + auto tbwgt = std::make_shared(); // create weights for each distinct group ID int nMaxTDC = 10; @@ -392,7 +380,6 @@ EcalTBWeights* EcalTestDevDB::generateEcalTBWeights() { for (size_t i = 0; i < 3; ++i) { for (size_t j = 0; j < 10; ++j) { double ww = igrp * itdc * r + i * 10. + j; - //std::cout << "row: " << i << " col: " << j << " - val: " << ww << std::endl; mat1(i, j) = ww; mat2(i, j) = 100 + ww; } @@ -418,22 +405,22 @@ EcalTBWeights* EcalTestDevDB::generateEcalTBWeights() { } //-------------------------------------------------------------- -EcalLaserAPDPNRatios* EcalTestDevDB::generateEcalLaserAPDPNRatios(uint32_t i_run) { +std::shared_ptr EcalTestDevDB::generateEcalLaserAPDPNRatios(uint32_t i_run) { //-------------------------------------------------------------- - EcalLaserAPDPNRatios* laser = new EcalLaserAPDPNRatios(); + auto laser = std::make_shared(); EcalLaserAPDPNRatios::EcalLaserAPDPNpair APDPNpair; EcalLaserAPDPNRatios::EcalLaserTimeStamp TimeStamp; // if((m_firstRun == 0 && i_run == 0) || (m_firstRun == 1 && i_run == 1)){ - std::cout << "First & last run: " << i_run << " " << m_firstRun << " " << m_lastRun << " " << std::endl; + edm::LogInfo("EcalTestDevDB") << "First & last run: " << i_run << " " << m_firstRun << " " << m_lastRun; if (m_firstRun == i_run && (i_run == 0 || i_run == 1)) { APDPNpair.p1 = (double(1) + 1 / double(log(exp(1) + double((i_run - m_firstRun) * 10)))) / double(2); APDPNpair.p2 = (double(1) + 1 / double(log(exp(1) + double((i_run - m_firstRun) * 10) + double(10)))) / double(2); APDPNpair.p3 = double(0); - std::cout << i_run << " " << m_firstRun << " " << APDPNpair.p1 << " " << APDPNpair.p2 << std::endl; + edm::LogInfo("EcalTestDevDB") << i_run << " " << m_firstRun << " " << APDPNpair.p1 << " " << APDPNpair.p2; for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) { if (iEta == 0) @@ -448,7 +435,7 @@ EcalLaserAPDPNRatios* EcalTestDevDB::generateEcalLaserAPDPNRatios(uint32_t i_run if (hi < static_cast(laser->getLaserMap().size())) { laser->setValue(hi, APDPNpair); } else { - edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << std::endl; + edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!"; continue; } } @@ -469,7 +456,7 @@ EcalLaserAPDPNRatios* EcalTestDevDB::generateEcalLaserAPDPNRatios(uint32_t i_run if (hi < static_cast(laser->getLaserMap().size())) { laser->setValue(hi, APDPNpair); } else { - edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << std::endl; + edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!"; continue; } @@ -483,21 +470,19 @@ EcalLaserAPDPNRatios* EcalTestDevDB::generateEcalLaserAPDPNRatios(uint32_t i_run if (hi < static_cast(laser->getLaserMap().size())) { laser->setValue(hi, APDPNpair); } else { - edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << std::endl; + edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!"; continue; } } } - std::cout << std::endl; for (int i = 0; i < 92; i++) { if (i < static_cast(laser->getTimeMap().size())) { TimeStamp.t1 = edm::Timestamp(1380 * (i_run - m_firstRun) + 15 * i); TimeStamp.t2 = edm::Timestamp(1380 * (i_run - m_firstRun + 1) + 15 * i); laser->setTime(i, TimeStamp); - //std::cout << " Timestamp for " << i << " : " << TimeStamp.t1.value() << " , " << TimeStamp.t2.value() << std::endl; } else { - edm::LogError("EcalTestDevDB") << "error with laser Map (time)!" << std::endl; + edm::LogError("EcalTestDevDB") << "error with laser Map (time)!"; continue; } } @@ -506,7 +491,7 @@ EcalLaserAPDPNRatios* EcalTestDevDB::generateEcalLaserAPDPNRatios(uint32_t i_run APDPNpair.p1 = (double(1) + 1 / double(log(exp(1) + double((i_run - m_firstRun) * 10)))) / double(2); APDPNpair.p2 = (double(1) + 1 / double(log(exp(1) + double((i_run - m_firstRun) * 10) + double(10)))) / double(2); APDPNpair.p3 = double(0); - std::cout << i_run << " " << m_firstRun << " " << APDPNpair.p1 << " " << APDPNpair.p2 << std::endl; + edm::LogInfo("EcalTestDevDB") << i_run << " " << m_firstRun << " " << APDPNpair.p1 << " " << APDPNpair.p2; for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) { if (iEta == 0) @@ -518,7 +503,7 @@ EcalLaserAPDPNRatios* EcalTestDevDB::generateEcalLaserAPDPNRatios(uint32_t i_run if (hi < static_cast(laser->getLaserMap().size())) { laser->setValue(hi, APDPNpair); } else { - edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << std::endl; + edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!"; } } } @@ -534,7 +519,7 @@ EcalLaserAPDPNRatios* EcalTestDevDB::generateEcalLaserAPDPNRatios(uint32_t i_run if (hi < static_cast(laser->getLaserMap().size())) { laser->setValue(hi, APDPNpair); } else { - edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << std::endl; + edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!"; continue; } @@ -546,21 +531,19 @@ EcalLaserAPDPNRatios* EcalTestDevDB::generateEcalLaserAPDPNRatios(uint32_t i_run if (hi < static_cast(laser->getLaserMap().size())) { laser->setValue(hi, APDPNpair); } else { - edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << std::endl; + edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!"; continue; } } } - std::cout << std::endl; for (int i = 0; i < 92; i++) { if (i < static_cast(laser->getTimeMap().size())) { TimeStamp.t1 = edm::Timestamp(1380 * (i_run - m_firstRun) + 15 * i); TimeStamp.t2 = edm::Timestamp(1380 * (i_run - m_firstRun + 1) + 15 * i); laser->setTime(i, TimeStamp); - //std::cout << " Timestamp for " << i << " : " << TimeStamp.t1.value() << " , " << TimeStamp.t2.value() << std::endl; } else { - edm::LogError("EcalTestDevDB") << "error with laser Map (time)!" << std::endl; + edm::LogError("EcalTestDevDB") << "error with laser Map (time)!"; continue; } } @@ -570,10 +553,10 @@ EcalLaserAPDPNRatios* EcalTestDevDB::generateEcalLaserAPDPNRatios(uint32_t i_run } //-------------------------------------------------------------- -EcalLaserAPDPNRatiosRef* EcalTestDevDB::generateEcalLaserAPDPNRatiosRef() { +std::shared_ptr EcalTestDevDB::generateEcalLaserAPDPNRatiosRef() { //-------------------------------------------------------------- - EcalLaserAPDPNRatiosRef* laser = new EcalLaserAPDPNRatiosRef(); + auto laser = std::make_shared(); EcalLaserAPDPNref APDPNref; @@ -588,7 +571,7 @@ EcalLaserAPDPNRatiosRef* EcalTestDevDB::generateEcalLaserAPDPNRatiosRef() { if (hi < static_cast(laser->getMap().size())) { laser->setValue(hi, APDPNref); } else { - edm::LogError("EcalTestDevDB") << "error with laser Map (ref)!" << std::endl; + edm::LogError("EcalTestDevDB") << "error with laser Map (ref)!"; } } } @@ -605,7 +588,7 @@ EcalLaserAPDPNRatiosRef* EcalTestDevDB::generateEcalLaserAPDPNRatiosRef() { if (hi < static_cast(laser->getMap().size())) { laser->setValue(hi, APDPNref); } else { - edm::LogError("EcalTestDevDB") << "error with laser Map (ref)!" << std::endl; + edm::LogError("EcalTestDevDB") << "error with laser Map (ref)!"; } if (!EEDetId::validDetId(iX, iY, -1)) @@ -618,7 +601,7 @@ EcalLaserAPDPNRatiosRef* EcalTestDevDB::generateEcalLaserAPDPNRatiosRef() { if (hi < static_cast(laser->getMap().size())) { laser->setValue(hi, APDPNref); } else { - edm::LogError("EcalTestDevDB") << "error with laser Map (ref)!" << std::endl; + edm::LogError("EcalTestDevDB") << "error with laser Map (ref)!"; } } } @@ -627,10 +610,10 @@ EcalLaserAPDPNRatiosRef* EcalTestDevDB::generateEcalLaserAPDPNRatiosRef() { } //-------------------------------------------------------------- -EcalLaserAlphas* EcalTestDevDB::generateEcalLaserAlphas() { +std::shared_ptr EcalTestDevDB::generateEcalLaserAlphas() { //-------------------------------------------------------------- - EcalLaserAlphas* laser = new EcalLaserAlphas(); + auto laser = std::make_shared(); EcalLaserAlpha Alpha; @@ -645,7 +628,7 @@ EcalLaserAlphas* EcalTestDevDB::generateEcalLaserAlphas() { if (hi < static_cast(laser->getMap().size())) { laser->setValue(hi, Alpha); } else { - edm::LogError("EcalTestDevDB") << "error with laser Map (alpha)!" << std::endl; + edm::LogError("EcalTestDevDB") << "error with laser Map (alpha)!"; } } } @@ -662,7 +645,7 @@ EcalLaserAlphas* EcalTestDevDB::generateEcalLaserAlphas() { if (hi < static_cast(laser->getMap().size())) { laser->setValue(hi, Alpha); } else { - edm::LogError("EcalTestDevDB") << "error with laser Map (alpha)!" << std::endl; + edm::LogError("EcalTestDevDB") << "error with laser Map (alpha)!"; } if (!EEDetId::validDetId(iX, iY, -1)) @@ -674,7 +657,7 @@ EcalLaserAlphas* EcalTestDevDB::generateEcalLaserAlphas() { if (hi < static_cast(laser->getMap().size())) { laser->setValue(hi, Alpha); } else { - edm::LogError("EcalTestDevDB") << "error with laser Map (alpha)!" << std::endl; + edm::LogError("EcalTestDevDB") << "error with laser Map (alpha)!"; } } } diff --git a/CondTools/Geometry/plugins/GEMRecoIdealDBLoader.cc b/CondTools/Geometry/plugins/GEMRecoIdealDBLoader.cc index 94b202b17defe..599ceda3f6917 100644 --- a/CondTools/Geometry/plugins/GEMRecoIdealDBLoader.cc +++ b/CondTools/Geometry/plugins/GEMRecoIdealDBLoader.cc @@ -36,7 +36,7 @@ class GEMRecoIdealDBLoader : public edm::one::EDAnalyzer { }; GEMRecoIdealDBLoader::GEMRecoIdealDBLoader(const edm::ParameterSet& iC) { - fromDD4hep_ = iC.getUntrackedParameter("fromDD4hep", false); // set true for DD4HEP + fromDD4hep_ = iC.getUntrackedParameter("fromDD4hep", false); // set true for DD4hep dd4HepCompactViewToken_ = esConsumes(); compactViewToken_ = esConsumes(); muonGeomConstantsToken_ = esConsumes(); @@ -58,7 +58,7 @@ void GEMRecoIdealDBLoader::beginRun(const edm::Run&, edm::EventSetup const& es) RecoIdealGeometry* rig = new RecoIdealGeometry; if (fromDD4hep_) { - edm::LogVerbatim("GEMRecoIdealDBLoader") << "(0) GEMRecoIdealDBLoader - DD4HEP "; + edm::LogVerbatim("GEMRecoIdealDBLoader") << "(0) GEMRecoIdealDBLoader - DD4hep "; auto pDD = es.getTransientHandle(dd4HepCompactViewToken_); const cms::DDCompactView& cpv = *pDD; rpcpd.build(&cpv, *pMNDC, *rig); diff --git a/CondTools/Geometry/plugins/ME0RecoIdealDBLoader.cc b/CondTools/Geometry/plugins/ME0RecoIdealDBLoader.cc index b1573895d1afe..89de15af570f1 100644 --- a/CondTools/Geometry/plugins/ME0RecoIdealDBLoader.cc +++ b/CondTools/Geometry/plugins/ME0RecoIdealDBLoader.cc @@ -34,7 +34,7 @@ class ME0RecoIdealDBLoader : public edm::one::EDAnalyzer { }; ME0RecoIdealDBLoader::ME0RecoIdealDBLoader(const edm::ParameterSet& iC) { - fromDD4hep_ = iC.getUntrackedParameter("fromDD4hep", false); // set true for DD4HEP + fromDD4hep_ = iC.getUntrackedParameter("fromDD4hep", false); // set true for DD4hep dd4HepCompactViewToken_ = esConsumes(); compactViewToken_ = esConsumes(); muonGeomConstantsToken_ = esConsumes(); @@ -54,7 +54,7 @@ void ME0RecoIdealDBLoader::beginRun(const edm::Run&, edm::EventSetup const& es) ME0GeometryParsFromDD me0pd; RecoIdealGeometry* rig = new RecoIdealGeometry; if (fromDD4hep_) { - edm::LogVerbatim("ME0RecoIdealDBLoader") << "(0) ME0RecoIdealDBLoader - DD4HEP "; + edm::LogVerbatim("ME0RecoIdealDBLoader") << "(0) ME0RecoIdealDBLoader - DD4hep "; auto pDD = es.getTransientHandle(dd4HepCompactViewToken_); const cms::DDCompactView& cpv = *pDD; me0pd.build(&cpv, *pMNDC, *rig); diff --git a/CondTools/Geometry/test/GeometryTester.cc b/CondTools/Geometry/test/GeometryTester.cc index c6b1927626980..2e8a1a8e0ac32 100644 --- a/CondTools/Geometry/test/GeometryTester.cc +++ b/CondTools/Geometry/test/GeometryTester.cc @@ -6,7 +6,6 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/PluginManager/interface/ModuleDef.h" @@ -87,30 +86,57 @@ namespace { bool m_castortest, m_zdctest, m_csctest; bool m_dttest, m_rpctest; std::string m_geomLabel; + edm::ESGetToken m_xmlGeoToken; + edm::ESGetToken m_tkGeoToken; + edm::ESGetToken m_ebGeoToken; + edm::ESGetToken m_eeGeoToken; + edm::ESGetToken m_epGeoToken; + edm::ESGetToken m_hGeoToken; + edm::ESGetToken m_hgcGeoToken; + edm::ESGetToken m_ctGeoToken; + edm::ESGetToken m_castGeoToken; + edm::ESGetToken m_zdcGeoToken; + edm::ESGetToken m_cscDigiGeoToken; + edm::ESGetToken m_cscGeoToken; + edm::ESGetToken m_dtGeoToken; + edm::ESGetToken m_rpcGeoToken; }; } // namespace -GeometryTester::GeometryTester(const edm::ParameterSet &iConfig) { - m_xmltest = iConfig.getUntrackedParameter("XMLTest", true); - m_tktest = iConfig.getUntrackedParameter("TrackerTest", true); - m_ecaltest = iConfig.getUntrackedParameter("EcalTest", true); - m_hcaltest = iConfig.getUntrackedParameter("HcalTest", true); - m_hgcaltest = iConfig.getUntrackedParameter("HGCalTest", true); - m_calotowertest = iConfig.getUntrackedParameter("CaloTowerTest", true); - m_castortest = iConfig.getUntrackedParameter("CastorTest", true); - m_zdctest = iConfig.getUntrackedParameter("ZDCTest", true); - m_csctest = iConfig.getUntrackedParameter("CSCTest", true); - m_dttest = iConfig.getUntrackedParameter("DTTest", true); - m_rpctest = iConfig.getUntrackedParameter("RPCTest", true); - m_geomLabel = iConfig.getUntrackedParameter("geomLabel", "Extended"); -} +GeometryTester::GeometryTester(const edm::ParameterSet &iConfig) + : m_xmltest(iConfig.getUntrackedParameter("XMLTest", true)), + m_tktest(iConfig.getUntrackedParameter("TrackerTest", true)), + m_ecaltest(iConfig.getUntrackedParameter("EcalTest", true)), + m_hcaltest(iConfig.getUntrackedParameter("HcalTest", true)), + m_hgcaltest(iConfig.getUntrackedParameter("HGCalTest", true)), + m_calotowertest(iConfig.getUntrackedParameter("CaloTowerTest", true)), + m_castortest(iConfig.getUntrackedParameter("CastorTest", true)), + m_zdctest(iConfig.getUntrackedParameter("ZDCTest", true)), + m_csctest(iConfig.getUntrackedParameter("CSCTest", true)), + m_dttest(iConfig.getUntrackedParameter("DTTest", true)), + m_rpctest(iConfig.getUntrackedParameter("RPCTest", true)), + m_geomLabel(iConfig.getUntrackedParameter("geomLabel", "Extended")), + m_xmlGeoToken(esConsumes(edm::ESInputTag("", m_geomLabel))), + m_tkGeoToken(esConsumes()), + m_ebGeoToken(esConsumes()), + m_eeGeoToken(esConsumes()), + m_epGeoToken(esConsumes()), + m_hGeoToken(esConsumes()), + m_hgcGeoToken(esConsumes()), + m_ctGeoToken(esConsumes()), + m_castGeoToken(esConsumes()), + m_zdcGeoToken(esConsumes()), + m_cscDigiGeoToken(esConsumes()), + m_cscGeoToken(esConsumes()), + m_dtGeoToken(esConsumes()), + m_rpcGeoToken(esConsumes()) {} void GeometryTester::analyze(const edm::Event &, const edm::EventSetup &iSetup) { if (m_xmltest) { - edm::ESHandle xmlgeo; - iSetup.get().get(m_geomLabel, xmlgeo); + auto const &xmlGeo = iSetup.getData(m_xmlGeoToken); + std::cout << "XML FILE\n"; - std::unique_ptr > tb = (*xmlgeo).getUncompressedBlob(); + std::unique_ptr > tb = xmlGeo.getUncompressedBlob(); std::cout << "SIZE FILE = " << tb->size() << "\n"; for (auto it : *tb) { std::cout << it; @@ -120,11 +146,10 @@ void GeometryTester::analyze(const edm::Event &, const edm::EventSetup &iSetup) FmtOstream outStream; if (m_tktest) { - edm::ESHandle tkGeo; - iSetup.get().get(tkGeo); + auto const &tkGeo = iSetup.getData(m_tkGeoToken); std::cout << "TRACKER\n"; - for (auto it : tkGeo->pgeomdets_) { + for (auto it : tkGeo.pgeomdets_) { std::cout << "trk "; outStream << it._params0 << it._params1 << it._params2 << it._params3 << it._params4 << it._params5 << it._params6 << it._params7 << it._params8 << it._params9 << it._params10 << it._x << it._y << it._z << it._phi @@ -137,12 +162,11 @@ void GeometryTester::analyze(const edm::Event &, const edm::EventSetup &iSetup) } if (m_ecaltest) { - edm::ESHandle ebgeo; - iSetup.get().get(ebgeo); + auto const &ebGeo = iSetup.getData(m_ebGeoToken); std::cout << "ECAL BARREL\n"; - auto tseb = ebgeo->getTranslation(); - auto dimeb = ebgeo->getDimension(); - auto indeb = ebgeo->getIndexes(); + auto tseb = ebGeo.getTranslation(); + auto dimeb = ebGeo.getDimension(); + auto indeb = ebGeo.getIndexes(); std::cout << "Translations " << tseb.size() << "\n"; std::cout << "Dimensions " << dimeb.size() << "\n"; std::cout << "Indices " << indeb.size() << "\n"; @@ -159,12 +183,11 @@ void GeometryTester::analyze(const edm::Event &, const edm::EventSetup &iSetup) outStream << it; std::cout << "\n"; - edm::ESHandle eegeo; - iSetup.get().get(eegeo); + auto const &eeGeo = iSetup.getData(m_eeGeoToken); std::cout << "ECAL ENDCAP\n"; - auto tsee = eegeo->getTranslation(); - auto dimee = eegeo->getDimension(); - auto indee = eegeo->getIndexes(); + auto tsee = eeGeo.getTranslation(); + auto dimee = eeGeo.getDimension(); + auto indee = eeGeo.getIndexes(); std::cout << "Translations " << tsee.size() << "\n"; std::cout << "Dimensions " << dimee.size() << "\n"; std::cout << "Indices " << indee.size() << "\n"; @@ -181,12 +204,11 @@ void GeometryTester::analyze(const edm::Event &, const edm::EventSetup &iSetup) outStream << it; std::cout << "\n"; - edm::ESHandle epgeo; - iSetup.get().get(epgeo); + auto const &epGeo = iSetup.getData(m_epGeoToken); std::cout << "ECAL PRESHOWER\n"; - auto tsep = epgeo->getTranslation(); - auto dimep = epgeo->getDimension(); - auto indep = epgeo->getIndexes(); + auto tsep = epGeo.getTranslation(); + auto dimep = epGeo.getDimension(); + auto indep = epGeo.getIndexes(); std::cout << "Translations " << tsep.size() << "\n"; std::cout << "Dimensions " << dimep.size() << "\n"; std::cout << "Indices " << indep.size() << "\n"; @@ -205,13 +227,12 @@ void GeometryTester::analyze(const edm::Event &, const edm::EventSetup &iSetup) } if (m_hcaltest) { - edm::ESHandle hgeo; - iSetup.get().get(hgeo); + auto const &hGeo = iSetup.getData(m_hGeoToken); std::cout << "HCAL\n"; - auto tsh = hgeo->getTranslation(); - auto dimh = hgeo->getDimension(); - auto indh = hgeo->getIndexes(); - auto dindh = hgeo->getDenseIndices(); + auto tsh = hGeo.getTranslation(); + auto dimh = hGeo.getDimension(); + auto indh = hGeo.getIndexes(); + auto dindh = hGeo.getDenseIndices(); std::cout << "Translations " << tsh.size() << "\n"; std::cout << "Dimensions " << dimh.size() << "\n"; std::cout << "Indices " << indh.size() << "\n"; @@ -234,13 +255,12 @@ void GeometryTester::analyze(const edm::Event &, const edm::EventSetup &iSetup) } if (m_hgcaltest) { - edm::ESHandle hgcgeo; - iSetup.get().get(hgcgeo); + auto const &hgcGeo = iSetup.getData(m_hgcGeoToken); std::cout << "HGCAL\n"; - auto tsh = hgcgeo->getTranslation(); - auto dimh = hgcgeo->getDimension(); - auto indh = hgcgeo->getIndexes(); - auto dindh = hgcgeo->getDenseIndices(); + auto tsh = hgcGeo.getTranslation(); + auto dimh = hgcGeo.getDimension(); + auto indh = hgcGeo.getIndexes(); + auto dindh = hgcGeo.getDenseIndices(); std::cout << "Translations " << tsh.size() << "\n"; std::cout << "Dimensions " << dimh.size() << "\n"; std::cout << "Indices " << indh.size() << "\n"; @@ -264,12 +284,11 @@ void GeometryTester::analyze(const edm::Event &, const edm::EventSetup &iSetup) } if (m_calotowertest) { - edm::ESHandle ctgeo; - iSetup.get().get(ctgeo); + auto const &ctGeo = iSetup.getData(m_ctGeoToken); std::cout << "CALO TOWER:\n"; - auto tsct = ctgeo->getTranslation(); - auto dimct = ctgeo->getDimension(); - auto indct = ctgeo->getIndexes(); + auto tsct = ctGeo.getTranslation(); + auto dimct = ctGeo.getDimension(); + auto indct = ctGeo.getIndexes(); std::cout << "Translations " << tsct.size() << "\n"; std::cout << "Dimensions " << dimct.size() << "\n"; std::cout << "Indices " << indct.size() << "\n"; @@ -288,74 +307,70 @@ void GeometryTester::analyze(const edm::Event &, const edm::EventSetup &iSetup) } if (m_castortest) { - edm::ESHandle castgeo; - iSetup.get().get(castgeo); + auto const &castGeo = iSetup.getData(m_castGeoToken); std::cout << "CASTOR\n"; std::cout << "castor "; - for (auto it : castgeo->getTranslation()) + for (auto it : castGeo.getTranslation()) outStream << it; std::cout << "\n"; std::cout << "castor "; - for (auto it : castgeo->getDimension()) + for (auto it : castGeo.getDimension()) outStream << it; std::cout << "\n"; std::cout << "castor "; - for (auto it : castgeo->getIndexes()) + for (auto it : castGeo.getIndexes()) outStream << it; std::cout << "\n"; } if (m_zdctest) { - edm::ESHandle zdcgeo; - iSetup.get().get(zdcgeo); + auto const &zdcGeo = iSetup.getData(m_zdcGeoToken); std::cout << "ZDC\n"; std::cout << "zdc "; - for (auto it : zdcgeo->getTranslation()) + for (auto it : zdcGeo.getTranslation()) outStream << it; std::cout << "\n"; std::cout << "zdc "; - for (auto it : zdcgeo->getDimension()) + for (auto it : zdcGeo.getDimension()) outStream << it; std::cout << "\n"; std::cout << "zdc "; - for (auto it : zdcgeo->getIndexes()) + for (auto it : zdcGeo.getIndexes()) outStream << it; std::cout << "\n"; } if (m_csctest) { - edm::ESHandle cscgeo; - iSetup.get().get(cscgeo); + auto const &cscGeo = iSetup.getData(m_cscGeoToken); - edm::ESHandle cscdigigeo; - iSetup.get().get(cscdigigeo); + auto const &cscDigiGeo = iSetup.getData(m_cscDigiGeoToken); std::cout << "CSC\n"; - std::vector obj1(cscdigigeo->pUserParOffset); + std::vector obj1(cscDigiGeo.pUserParOffset); std::cout << "csc "; for (auto it : obj1) outStream << it; std::cout << "\n"; - std::vector obj2(cscdigigeo->pUserParSize); + std::vector obj2(cscDigiGeo.pUserParSize); std::cout << "csc "; for (auto it : obj2) outStream << it; std::cout << "\n"; - std::vector obj3(cscdigigeo->pChamberType); + std::vector obj3(cscDigiGeo.pChamberType); std::cout << "csc "; for (auto it : obj3) outStream << it; std::cout << "\n"; - std::vector obj4(cscdigigeo->pfupars); + std::vector obj4(cscDigiGeo.pfupars); std::cout << "csc "; for (auto it : obj4) outStream << it; std::cout << "\n"; - std::vector myIdcsc(cscgeo->detIds()); + std::vector myIdcsc(cscGeo.detIds()); std::cout << "csc "; for (auto it : myIdcsc) outStream << it; @@ -363,19 +378,19 @@ void GeometryTester::analyze(const edm::Event &, const edm::EventSetup &iSetup) uint32_t cscsize = myIdcsc.size(); for (uint32_t i = 0; i < cscsize; i++) { - std::vector trcsc(cscgeo->tranStart(i), cscgeo->tranEnd(i)); + std::vector trcsc(cscGeo.tranStart(i), cscGeo.tranEnd(i)); std::cout << "csc "; for (auto it : trcsc) outStream << it; std::cout << "\n"; - std::vector rotcsc(cscgeo->rotStart(i), cscgeo->rotEnd(i)); + std::vector rotcsc(cscGeo.rotStart(i), cscGeo.rotEnd(i)); std::cout << "csc "; for (auto it : rotcsc) outStream << it; std::cout << "\n"; - std::vector shapecsc(cscgeo->shapeStart(i), cscgeo->shapeEnd(i)); + std::vector shapecsc(cscGeo.shapeStart(i), cscGeo.shapeEnd(i)); std::cout << "csc "; for (auto it : shapecsc) outStream << it; @@ -384,10 +399,9 @@ void GeometryTester::analyze(const edm::Event &, const edm::EventSetup &iSetup) } if (m_dttest) { - edm::ESHandle dtgeo; - iSetup.get().get(dtgeo); + auto const &dtGeo = iSetup.getData(m_dtGeoToken); std::cout << "DT\n"; - std::vector myIddt(dtgeo->detIds()); + std::vector myIddt(dtGeo.detIds()); std::cout << "dt "; for (auto it : myIddt) std::cout << " " << it; // DetId @@ -396,18 +410,18 @@ void GeometryTester::analyze(const edm::Event &, const edm::EventSetup &iSetup) uint32_t dtsize = myIddt.size(); std::cout << "dt "; for (uint32_t i = 0; i < dtsize; i++) { - std::vector trdt(dtgeo->tranStart(i), dtgeo->tranEnd(i)); + std::vector trdt(dtGeo.tranStart(i), dtGeo.tranEnd(i)); for (auto it : trdt) outStream << it; std::cout << "\n"; - std::vector rotdt(dtgeo->rotStart(i), dtgeo->rotEnd(i)); + std::vector rotdt(dtGeo.rotStart(i), dtGeo.rotEnd(i)); std::cout << "dt "; for (auto it : rotdt) outStream << it; std::cout << "\n"; - std::vector shapedt(dtgeo->shapeStart(i), dtgeo->shapeEnd(i)); + std::vector shapedt(dtGeo.shapeStart(i), dtGeo.shapeEnd(i)); std::cout << "dt "; for (auto it : shapedt) outStream << it; @@ -416,36 +430,35 @@ void GeometryTester::analyze(const edm::Event &, const edm::EventSetup &iSetup) } if (m_rpctest) { - edm::ESHandle rpcgeo; - iSetup.get().get(rpcgeo); + auto const &rpcGeo = iSetup.getData(m_rpcGeoToken); std::cout << "RPC\n"; - std::vector myIdrpc(rpcgeo->detIds()); + std::vector myIdrpc(rpcGeo.detIds()); std::cout << "rpc "; for (auto it : myIdrpc) std::cout << " " << it; // DetId std::cout << "\n"; uint32_t rpcsize = myIdrpc.size(); for (uint32_t i = 0; i < rpcsize; i++) { - std::vector trrpc(rpcgeo->tranStart(i), rpcgeo->tranEnd(i)); + std::vector trrpc(rpcGeo.tranStart(i), rpcGeo.tranEnd(i)); std::cout << "rpc "; for (auto it : trrpc) outStream << it; std::cout << "\n"; - std::vector rotrpc(rpcgeo->rotStart(i), rpcgeo->rotEnd(i)); + std::vector rotrpc(rpcGeo.rotStart(i), rpcGeo.rotEnd(i)); std::cout << "rpc "; for (auto it : rotrpc) outStream << it; std::cout << "\n"; - std::vector shaperpc(rpcgeo->shapeStart(i), rpcgeo->shapeEnd(i)); + std::vector shaperpc(rpcGeo.shapeStart(i), rpcGeo.shapeEnd(i)); std::cout << "rpc "; for (auto it : shaperpc) outStream << it; std::cout << "\n"; - std::vector strrpc(rpcgeo->strStart(i), rpcgeo->strEnd(i)); + std::vector strrpc(rpcGeo.strStart(i), rpcGeo.strEnd(i)); std::cout << "rpc "; for (auto it : strrpc) outStream << it; diff --git a/CondTools/HLT/src/AlCaRecoTriggerBitsRcdUpdate.cc b/CondTools/HLT/src/AlCaRecoTriggerBitsRcdUpdate.cc index 62daca69ce119..b1b898aa2d07c 100644 --- a/CondTools/HLT/src/AlCaRecoTriggerBitsRcdUpdate.cc +++ b/CondTools/HLT/src/AlCaRecoTriggerBitsRcdUpdate.cc @@ -37,12 +37,10 @@ class AlCaRecoTriggerBitsRcdUpdate : public edm::EDAnalyzer { private: typedef std::map TriggerMap; - AlCaRecoTriggerBits *createStartTriggerBits(bool startEmpty, const edm::EventSetup &evtSetup) const; bool removeKeysFromMap(const std::vector &keys, TriggerMap &triggerMap) const; bool replaceKeysFromMap(const std::vector &alcarecoReplace, TriggerMap &triggerMap) const; bool addTriggerLists(const std::vector &triggerListsAdd, AlCaRecoTriggerBits &bits) const; - /// Takes over memory uresponsibility for 'bitsToWrite'. - void writeBitsToDB(AlCaRecoTriggerBits *bitsToWrite) const; + void writeBitsToDB(const AlCaRecoTriggerBits &bitsToWrite) const; edm::ESGetToken triggerBitsToken_; unsigned int nEventCalls_; @@ -78,8 +76,13 @@ void AlCaRecoTriggerBitsRcdUpdate::analyze(const edm::Event &evt, const edm::Eve return; } - // create what to write - starting from empty or existing list (auto_ptr?) - AlCaRecoTriggerBits *bitsToWrite = this->createStartTriggerBits(startEmpty_, iSetup); + // create what to write - starting from empty or existing list + std::unique_ptr bitsToWrite; + if (startEmpty_) { + bitsToWrite = std::make_unique(); + } else { + bitsToWrite = std::make_unique(iSetup.getData(triggerBitsToken_)); + } // remove some existing entries in map this->removeKeysFromMap(listNamesRemove_, bitsToWrite->m_alcarecoToTrig); @@ -91,18 +94,7 @@ void AlCaRecoTriggerBitsRcdUpdate::analyze(const edm::Event &evt, const edm::Eve this->replaceKeysFromMap(alcarecoReplace_, bitsToWrite->m_alcarecoToTrig); // finally write to DB - this->writeBitsToDB(bitsToWrite); -} - -/////////////////////////////////////////////////////////////////////// -AlCaRecoTriggerBits * // auto_ptr? -AlCaRecoTriggerBitsRcdUpdate::createStartTriggerBits(bool startEmpty, const edm::EventSetup &evtSetup) const { - if (startEmpty) { - return new AlCaRecoTriggerBits; - } else { - const auto &triggerBits = &evtSetup.getData(triggerBitsToken_); - return new AlCaRecoTriggerBits(*triggerBits); // copy old one - } + this->writeBitsToDB(*bitsToWrite); } /////////////////////////////////////////////////////////////////////// @@ -179,7 +171,7 @@ bool AlCaRecoTriggerBitsRcdUpdate::addTriggerLists(const std::vector poolDbService; @@ -187,20 +179,7 @@ void AlCaRecoTriggerBitsRcdUpdate::writeBitsToDB(AlCaRecoTriggerBits *bitsToWrit throw cms::Exception("NotAvailable") << "PoolDBOutputService not available.\n"; } - // ownership of bitsToWrite transferred - // FIXME: Have to check that timetype is run number! How? - const std::string recordName("AlCaRecoTriggerBitsRcd"); - if (poolDbService->isNewTagRequest(recordName)) { // tag not yet existing - // lastRunIOV_ = -1 means infinity: - const cond::Time_t lastRun = (lastRunIOV_ < 0 ? poolDbService->endOfTime() : lastRunIOV_); - poolDbService->createNewIOV(bitsToWrite, firstRunIOV_, lastRun, recordName); - } else { // tag exists, can only append - if (lastRunIOV_ >= 0) { - throw cms::Exception("BadConfig") << "Tag already exists, can only append until infinity," - << " but lastRunIOV = " << lastRunIOV_ << ".\n"; - } - poolDbService->appendSinceTime(bitsToWrite, firstRunIOV_, recordName); - } + poolDbService->writeOneIOV(bitsToWrite, firstRunIOV_, "AlCaRecoTriggerBitsRcd"); edm::LogInfo("") << "...done for runs " << firstRunIOV_ << " to " << lastRunIOV_ << " (< 0 meaning infinity)!"; } diff --git a/CondTools/SiPixel/plugins/SiPixel2DTemplateDBObjectUploader.cc b/CondTools/SiPixel/plugins/SiPixel2DTemplateDBObjectUploader.cc index a90e3588ae701..ba68348626847 100644 --- a/CondTools/SiPixel/plugins/SiPixel2DTemplateDBObjectUploader.cc +++ b/CondTools/SiPixel/plugins/SiPixel2DTemplateDBObjectUploader.cc @@ -79,7 +79,6 @@ void SiPixel2DTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const SiPixel2DTemplateDBObject obj; // Local variables - const char* tempfile; int m; // Set the number of templates to be passed to the dbobject @@ -90,8 +89,7 @@ void SiPixel2DTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const // Open the template file(s) for (m = 0; m < obj.numOfTempl(); ++m) { edm::FileInPath file(theTemplateCalibrations[m].c_str()); - tempfile = (file.fullPath()).c_str(); - std::ifstream in_file(tempfile, std::ios::in); + std::ifstream in_file(file.fullPath().c_str(), std::ios::in); if (in_file.is_open()) { edm::LogInfo("Template Info") << "Opened Template File: " << file.fullPath().c_str(); @@ -131,7 +129,7 @@ void SiPixel2DTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const in_file.close(); } else { // If file didn't open, report this - edm::LogError("SiPixel2DTemplateDBObjectUploader") << "Error opening File" << tempfile; + edm::LogError("SiPixel2DTemplateDBObjectUploader") << "Error opening File " << (file.fullPath()).c_str(); } } diff --git a/CondTools/SiPixel/plugins/SiPixelCalibConfigurationObjectMaker.cc b/CondTools/SiPixel/plugins/SiPixelCalibConfigurationObjectMaker.cc index b083f78870262..4fe71a2508765 100644 --- a/CondTools/SiPixel/plugins/SiPixelCalibConfigurationObjectMaker.cc +++ b/CondTools/SiPixel/plugins/SiPixelCalibConfigurationObjectMaker.cc @@ -76,7 +76,7 @@ SiPixelCalibConfigurationObjectMaker::~SiPixelCalibConfigurationObjectMaker() = void SiPixelCalibConfigurationObjectMaker::analyze(const edm::Event&, const edm::EventSetup&) { pos::PixelCalibConfiguration fancyCalib(inputfilename); - SiPixelCalibConfiguration* myCalib = new SiPixelCalibConfiguration(fancyCalib); + SiPixelCalibConfiguration myCalib(fancyCalib); std::string fixedmode = fancyCalib.mode(); std::string tobereplaced = "WithSLink"; @@ -84,16 +84,16 @@ void SiPixelCalibConfigurationObjectMaker::analyze(const edm::Event&, const edm: if (fixedmode.find(tobereplaced) != std::string::npos) fixedmode.erase(fixedmode.find(tobereplaced), tobereplaced.length()); edm::LogPrint("SiPixelCalibConfigurationObjectMaker") << "mode = " << fixedmode << std::endl; - myCalib->setCalibrationMode(fixedmode); + myCalib.setCalibrationMode(fixedmode); edm::Service poolDbService; if (poolDbService.isAvailable()) { if (poolDbService->isNewTagRequest("SiPixelCalibConfigurationRcd")) { - poolDbService->createNewIOV( - myCalib, poolDbService->beginOfTime(), poolDbService->endOfTime(), "SiPixelCalibConfigurationRcd"); + poolDbService->createOneIOV( + myCalib, poolDbService->beginOfTime(), "SiPixelCalibConfigurationRcd"); } else { - poolDbService->appendSinceTime( + poolDbService->appendOneIOV( myCalib, poolDbService->currentTime(), "SiPixelCalibConfigurationRcd"); } } diff --git a/CondTools/SiPixel/plugins/SiPixelCondObjBuilder.cc b/CondTools/SiPixel/plugins/SiPixelCondObjBuilder.cc index 5a7147d91a4a2..7113a2bd331f9 100644 --- a/CondTools/SiPixel/plugins/SiPixelCondObjBuilder.cc +++ b/CondTools/SiPixel/plugins/SiPixelCondObjBuilder.cc @@ -49,7 +49,7 @@ namespace cms { float maxgain = 10; float minped = 0; float maxped = 255; - SiPixelGainCalibration_ = new SiPixelGainCalibration(minped, maxped, mingain, maxgain); + SiPixelGainCalibration_ = std::make_unique(minped, maxped, mingain, maxgain); const TrackerGeometry* pDD = &iSetup.getData(pddToken_); edm::LogInfo("SiPixelCondObjBuilder") << " There are " << pDD->dets().size() << " detectors" << std::endl; @@ -185,11 +185,11 @@ namespace cms { // SiPixelGainCalibration_, tillTime , callbackToken); if (mydbservice->isNewTagRequest(recordName_)) { - mydbservice->createNewIOV( - SiPixelGainCalibration_, mydbservice->beginOfTime(), mydbservice->endOfTime(), recordName_); + mydbservice->createOneIOV( + *SiPixelGainCalibration_, mydbservice->beginOfTime(), recordName_); } else { - mydbservice->appendSinceTime( - SiPixelGainCalibration_, mydbservice->currentTime(), recordName_); + mydbservice->appendOneIOV( + *SiPixelGainCalibration_, mydbservice->currentTime(), recordName_); } edm::LogInfo(" --- all OK"); } catch (const cond::Exception& er) { diff --git a/CondTools/SiPixel/plugins/SiPixelCondObjBuilder.h b/CondTools/SiPixel/plugins/SiPixelCondObjBuilder.h index a129c7a2d0bcf..577c83f36d34d 100644 --- a/CondTools/SiPixel/plugins/SiPixelCondObjBuilder.h +++ b/CondTools/SiPixel/plugins/SiPixelCondObjBuilder.h @@ -45,7 +45,7 @@ namespace cms { edm::ParameterSet conf_; bool appendMode_; edm::ESGetToken pddToken_; - SiPixelGainCalibration* SiPixelGainCalibration_; + std::unique_ptr SiPixelGainCalibration_; SiPixelGainCalibrationService SiPixelGainCalibrationService_; std::string recordName_; diff --git a/CondTools/SiPixel/plugins/SiPixelCondObjForHLTBuilder.cc b/CondTools/SiPixel/plugins/SiPixelCondObjForHLTBuilder.cc index 64b06906f0549..43658a5ddf2ac 100644 --- a/CondTools/SiPixel/plugins/SiPixelCondObjForHLTBuilder.cc +++ b/CondTools/SiPixel/plugins/SiPixelCondObjForHLTBuilder.cc @@ -62,7 +62,7 @@ namespace cms { float maxgain = 10; float minped = 0; float maxped = 255; - SiPixelGainCalibration_ = new SiPixelGainCalibrationForHLT(minped, maxped, mingain, maxgain); + SiPixelGainCalibration_ = std::make_unique(minped, maxped, mingain, maxgain); const TrackerGeometry* pDD = &iSetup.getData(tkGeometryToken_); edm::LogInfo("SiPixelCondObjForHLTBuilder") << " There are " << pDD->dets().size() << " detectors" << std::endl; @@ -246,11 +246,11 @@ namespace cms { // SiPixelGainCalibration_, tillTime , callbackToken); if (mydbservice->isNewTagRequest(recordName_)) { - mydbservice->createNewIOV( - SiPixelGainCalibration_, mydbservice->beginOfTime(), mydbservice->endOfTime(), recordName_); + mydbservice->createOneIOV( + *SiPixelGainCalibration_, mydbservice->beginOfTime(), recordName_); } else { - mydbservice->appendSinceTime( - SiPixelGainCalibration_, mydbservice->currentTime(), recordName_); + mydbservice->appendOneIOV( + *SiPixelGainCalibration_, mydbservice->currentTime(), recordName_); } edm::LogInfo(" --- all OK"); } catch (const cond::Exception& er) { diff --git a/CondTools/SiPixel/plugins/SiPixelCondObjForHLTBuilder.h b/CondTools/SiPixel/plugins/SiPixelCondObjForHLTBuilder.h index da1a4bb31412e..2a664786c9bc2 100644 --- a/CondTools/SiPixel/plugins/SiPixelCondObjForHLTBuilder.h +++ b/CondTools/SiPixel/plugins/SiPixelCondObjForHLTBuilder.h @@ -46,7 +46,7 @@ namespace cms { edm::ParameterSet conf_; bool appendMode_; - SiPixelGainCalibrationForHLT* SiPixelGainCalibration_; + std::unique_ptr SiPixelGainCalibration_; SiPixelGainCalibrationForHLTService SiPixelGainCalibrationService_; std::string recordName_; diff --git a/CondTools/SiPixel/plugins/SiPixelCondObjOfflineBuilder.cc b/CondTools/SiPixel/plugins/SiPixelCondObjOfflineBuilder.cc index c34b53e679c94..4454878b9d99c 100644 --- a/CondTools/SiPixel/plugins/SiPixelCondObjOfflineBuilder.cc +++ b/CondTools/SiPixel/plugins/SiPixelCondObjOfflineBuilder.cc @@ -61,7 +61,7 @@ namespace cms { float maxped = 100.; float mingain = 0.; float maxgain = 10.; - SiPixelGainCalibration_ = new SiPixelGainCalibrationOffline(minped, maxped, mingain, maxgain); + SiPixelGainCalibration_ = std::make_unique(minped, maxped, mingain, maxgain); const TrackerGeometry* pDD = &iSetup.getData(pddToken_); edm::LogInfo("SiPixelCondObjOfflineBuilder") << " There are " << pDD->dets().size() << " detectors" << std::endl; @@ -232,11 +232,11 @@ namespace cms { try { if (mydbservice->isNewTagRequest(recordName_)) { - mydbservice->createNewIOV( - SiPixelGainCalibration_, mydbservice->beginOfTime(), mydbservice->endOfTime(), recordName_); + mydbservice->createOneIOV( + *SiPixelGainCalibration_, mydbservice->beginOfTime(), recordName_); } else { - mydbservice->appendSinceTime( - SiPixelGainCalibration_, mydbservice->currentTime(), recordName_); + mydbservice->appendOneIOV( + *SiPixelGainCalibration_, mydbservice->currentTime(), recordName_); } edm::LogInfo(" --- all OK"); } catch (const cond::Exception& er) { diff --git a/CondTools/SiPixel/plugins/SiPixelCondObjOfflineBuilder.h b/CondTools/SiPixel/plugins/SiPixelCondObjOfflineBuilder.h index 4c4cd72e30fac..eb5d17b012a49 100644 --- a/CondTools/SiPixel/plugins/SiPixelCondObjOfflineBuilder.h +++ b/CondTools/SiPixel/plugins/SiPixelCondObjOfflineBuilder.h @@ -44,7 +44,7 @@ namespace cms { edm::ParameterSet conf_; bool appendMode_; edm::ESGetToken pddToken_; - SiPixelGainCalibrationOffline* SiPixelGainCalibration_; + std::unique_ptr SiPixelGainCalibration_; SiPixelGainCalibrationOfflineService SiPixelGainCalibrationService_; std::string recordName_; diff --git a/CondTools/SiPixel/plugins/SiPixelDynamicInefficiencyDB.cc b/CondTools/SiPixel/plugins/SiPixelDynamicInefficiencyDB.cc index a3b4bb7c5b3c0..fdeaa6c98d691 100644 --- a/CondTools/SiPixel/plugins/SiPixelDynamicInefficiencyDB.cc +++ b/CondTools/SiPixel/plugins/SiPixelDynamicInefficiencyDB.cc @@ -34,7 +34,7 @@ SiPixelDynamicInefficiencyDB::~SiPixelDynamicInefficiencyDB() = default; // Analyzer: Functions that gets called by framework every event void SiPixelDynamicInefficiencyDB::analyze(const edm::Event& e, const edm::EventSetup& es) { - SiPixelDynamicInefficiency* DynamicInefficiency = new SiPixelDynamicInefficiency(); + SiPixelDynamicInefficiency DynamicInefficiency; //Retrieve tracker topology from geometry const TrackerTopology* const tTopo = &es.getData(tkTopoToken_); @@ -51,22 +51,22 @@ void SiPixelDynamicInefficiencyDB::analyze(const edm::Event& e, const edm::Event //Put BPix masks mask = tTopo->pxbDetId(max, LADDER, MODULE).rawId(); - DynamicInefficiency->putDetIdmask(mask); + DynamicInefficiency.putDetIdmask(mask); mask = tTopo->pxbDetId(LAYER, max, MODULE).rawId(); - DynamicInefficiency->putDetIdmask(mask); + DynamicInefficiency.putDetIdmask(mask); mask = tTopo->pxbDetId(LAYER, LADDER, max).rawId(); - DynamicInefficiency->putDetIdmask(mask); + DynamicInefficiency.putDetIdmask(mask); //Put FPix masks mask = tTopo->pxfDetId(max, DISK, BLADE, PANEL, MODULE).rawId(); - DynamicInefficiency->putDetIdmask(mask); + DynamicInefficiency.putDetIdmask(mask); mask = tTopo->pxfDetId(SIDE, max, BLADE, PANEL, MODULE).rawId(); - DynamicInefficiency->putDetIdmask(mask); + DynamicInefficiency.putDetIdmask(mask); mask = tTopo->pxfDetId(SIDE, DISK, max, PANEL, MODULE).rawId(); - DynamicInefficiency->putDetIdmask(mask); + DynamicInefficiency.putDetIdmask(mask); mask = tTopo->pxfDetId(SIDE, DISK, BLADE, max, MODULE).rawId(); - DynamicInefficiency->putDetIdmask(mask); + DynamicInefficiency.putDetIdmask(mask); mask = tTopo->pxfDetId(SIDE, DISK, BLADE, PANEL, max).rawId(); - DynamicInefficiency->putDetIdmask(mask); + DynamicInefficiency.putDetIdmask(mask); //Put PixelGeomFactors for (Parameters::iterator it = thePixelGeomFactors_.begin(); it != thePixelGeomFactors_.end(); ++it) { @@ -83,13 +83,13 @@ void SiPixelDynamicInefficiencyDB::analyze(const edm::Event& e, const edm::Event DetId detID = tTopo->pxbDetId(layer, ladder, module); edm::LogPrint("SiPixelDynamicInefficiencyDB") << "Putting Pixel geom BPix layer " << layer << " ladder " << ladder << " module " << module << " factor " << factor << std::endl; - DynamicInefficiency->putPixelGeomFactor(detID.rawId(), factor); + DynamicInefficiency.putPixelGeomFactor(detID.rawId(), factor); } else if (det == "fpix") { DetId detID = tTopo->pxfDetId(side, disk, blade, panel, module); edm::LogPrint("SiPixelDynamicInefficiencyDB") << "Putting Pixel geom FPix side " << side << " disk " << disk << " blade " << blade << " panel " << panel << " module " << module << " factor " << factor << std::endl; - DynamicInefficiency->putPixelGeomFactor(detID.rawId(), factor); + DynamicInefficiency.putPixelGeomFactor(detID.rawId(), factor); } else edm::LogError("SiPixelDynamicInefficiencyDB") << "SiPixelDynamicInefficiencyDB input detector part is neither bpix nor fpix" << std::endl; @@ -111,13 +111,13 @@ void SiPixelDynamicInefficiencyDB::analyze(const edm::Event& e, const edm::Event edm::LogPrint("SiPixelDynamicInefficiencyDB") << "Putting Column geom BPix layer " << layer << " ladder " << ladder << " module " << module << " factor " << factor << std::endl; - DynamicInefficiency->putColGeomFactor(detID.rawId(), factor); + DynamicInefficiency.putColGeomFactor(detID.rawId(), factor); } else if (det == "fpix") { DetId detID = tTopo->pxfDetId(side, disk, blade, panel, module); edm::LogPrint("SiPixelDynamicInefficiencyDB") << "Putting Column geom FPix side " << side << " disk " << disk << " blade " << blade << " panel " << panel << " module " << module << " factor " << factor << std::endl; - DynamicInefficiency->putColGeomFactor(detID.rawId(), factor); + DynamicInefficiency.putColGeomFactor(detID.rawId(), factor); } else edm::LogError("SiPixelDynamicInefficiencyDB") << "SiPixelDynamicInefficiencyDB input detector part is neither bpix nor fpix" << std::endl; @@ -138,13 +138,13 @@ void SiPixelDynamicInefficiencyDB::analyze(const edm::Event& e, const edm::Event DetId detID = tTopo->pxbDetId(layer, ladder, module); edm::LogPrint("SiPixelDynamicInefficiencyDB") << "Putting Chip geom BPix layer " << layer << " ladder " << ladder << " module " << module << " factor " << factor << std::endl; - DynamicInefficiency->putChipGeomFactor(detID.rawId(), factor); + DynamicInefficiency.putChipGeomFactor(detID.rawId(), factor); } else if (det == "fpix") { DetId detID = tTopo->pxfDetId(side, disk, blade, panel, module); edm::LogPrint("SiPixelDynamicInefficiencyDB") << "Putting Chip geom FPix side " << side << " disk " << disk << " blade " << blade << " panel " << panel << " module " << module << " factor " << factor << std::endl; - DynamicInefficiency->putChipGeomFactor(detID.rawId(), factor); + DynamicInefficiency.putChipGeomFactor(detID.rawId(), factor); } else edm::LogError("SiPixelDynamicInefficiencyDB") << "SiPixelDynamicInefficiencyDB input detector part is neither bpix nor fpix" << std::endl; @@ -166,26 +166,26 @@ void SiPixelDynamicInefficiencyDB::analyze(const edm::Event& e, const edm::Event edm::LogPrint("SiPixelDynamicInefficiencyDB") << "Putting PU efficiency BPix layer " << layer << " ladder " << ladder << " module " << module << " factor size " << factor.size() << std::endl; - DynamicInefficiency->putPUFactor(detID.rawId(), factor); + DynamicInefficiency.putPUFactor(detID.rawId(), factor); } else if (det == "fpix") { DetId detID = tTopo->pxfDetId(side, disk, blade, panel, module); edm::LogPrint("SiPixelDynamicInefficiencyDB") << "Putting PU efficiency FPix side " << side << " disk " << disk << " blade " << blade << " panel " << panel << " module " << module << " factor size " << factor.size() << std::endl; - DynamicInefficiency->putPUFactor(detID.rawId(), factor); + DynamicInefficiency.putPUFactor(detID.rawId(), factor); } } //Put theInstLumiScaleFactor - DynamicInefficiency->puttheInstLumiScaleFactor(theInstLumiScaleFactor_); + DynamicInefficiency.puttheInstLumiScaleFactor(theInstLumiScaleFactor_); edm::Service mydbservice; if (mydbservice.isAvailable()) { try { if (mydbservice->isNewTagRequest(recordName_)) { - mydbservice->createNewIOV( - DynamicInefficiency, mydbservice->beginOfTime(), mydbservice->endOfTime(), recordName_); + mydbservice->createOneIOV( + DynamicInefficiency, mydbservice->beginOfTime(), recordName_); } else { - mydbservice->appendSinceTime( + mydbservice->appendOneIOV( DynamicInefficiency, mydbservice->currentTime(), recordName_); } } catch (const cond::Exception& er) { diff --git a/CondTools/SiPixel/plugins/SiPixelDynamicInefficiencyReader.cc b/CondTools/SiPixel/plugins/SiPixelDynamicInefficiencyReader.cc index 181a4b4107068..d492233517312 100644 --- a/CondTools/SiPixel/plugins/SiPixelDynamicInefficiencyReader.cc +++ b/CondTools/SiPixel/plugins/SiPixelDynamicInefficiencyReader.cc @@ -156,6 +156,7 @@ void SiPixelDynamicInefficiencyReader::analyze(const edm::Event& e, const edm::E continue; scale_db *= it_colgeom->second; } + //DB PU factor calculation unsigned int pu_iterator = 0; for (it_pu = map_pufactor.begin(); it_pu != map_pufactor.end(); it_pu++, pu_iterator++) { @@ -181,8 +182,9 @@ void SiPixelDynamicInefficiencyReader::analyze(const edm::Event& e, const edm::E instlumi_pow *= instlumi; } } + //Config PU factor calculation - for (size_t i = 0; i < 5; i++) { + for (size_t i = 0; i < pu_det; i++) { double instlumi = 30 * theInstLumiScaleFactor; double instlumi_pow = 1.; _pu_scale_conf[i] = 0; @@ -191,6 +193,7 @@ void SiPixelDynamicInefficiencyReader::analyze(const edm::Event& e, const edm::E instlumi_pow *= instlumi; } } + //Config geom factor calculation double columnEfficiency = 1; if (detid.subdetId() == static_cast(PixelSubdetector::PixelBarrel)) { @@ -206,6 +209,7 @@ void SiPixelDynamicInefficiencyReader::analyze(const edm::Event& e, const edm::E columnEfficiency *= theLadderEfficiency_BPix[layerIndex - 1][ladder - 1] * theModuleEfficiency_BPix[layerIndex - 1][module - 1]; } + if (detid.subdetId() == static_cast(PixelSubdetector::PixelEndcap)) { unsigned int diskIndex = tTopo->layer(detid) + 3; // Use diskIndex-1 later to stay consistent with BPix unsigned int panelIndex = tTopo->pxfPanel(detid); @@ -218,6 +222,7 @@ void SiPixelDynamicInefficiencyReader::analyze(const edm::Event& e, const edm::E columnEfficiency *= theOuterEfficiency_FPix[diskIndex - 1]; } } + if (scale_db == columnEfficiency) { //printf("Config match, detid %x\tfactor %f\n",detid.rawId(),columnEfficiency); match++; diff --git a/CondTools/SiPixel/plugins/SiPixelGainCalibScaler.cc b/CondTools/SiPixel/plugins/SiPixelGainCalibScaler.cc index f6db922b29a11..fffe50128f500 100644 --- a/CondTools/SiPixel/plugins/SiPixelGainCalibScaler.cc +++ b/CondTools/SiPixel/plugins/SiPixelGainCalibScaler.cc @@ -218,7 +218,7 @@ void SiPixelGainCalibScaler::computeAndStorePalyoads(const edm::EventSetup& iSet float minped = payload->getPedLow(); float maxped = payload->getPedHigh() * 1.10; - auto SiPixelGainCalibration_ = new PayloadType(minped, maxped, mingain, maxgain); + PayloadType SiPixelGainCalibration_(minped, maxped, mingain, maxgain); //Retrieve tracker topology from geometry const TrackerTopology* tTopo = &iSetup.getData(tkTopoToken_); @@ -299,18 +299,18 @@ void SiPixelGainCalibScaler::computeAndStorePalyoads(const edm::EventSetup& iSet edm::LogInfo("SiPixelGainCalibScaler") << "post-change gain: " << gain << " pede:" << ped << std::endl; if constexpr (std::is_same_v) { - SiPixelGainCalibration_->setData(ped, gain, theSiPixelGainCalibration, false, false); + SiPixelGainCalibration_.setData(ped, gain, theSiPixelGainCalibration, false, false); } else { - SiPixelGainCalibration_->setDataPedestal(ped, theSiPixelGainCalibration); + SiPixelGainCalibration_.setDataPedestal(ped, theSiPixelGainCalibration); if ((row + 1) % numberOfRowsToAverageOver == 0) { // fill the column average after every ROC! - SiPixelGainCalibration_->setDataGain(gain, numberOfRowsToAverageOver, theSiPixelGainCalibration); + SiPixelGainCalibration_.setDataGain(gain, numberOfRowsToAverageOver, theSiPixelGainCalibration); } } } // loop on rows } // loop on columns typename PayloadType::Range outrange(theSiPixelGainCalibration.begin(), theSiPixelGainCalibration.end()); - if (!SiPixelGainCalibration_->put(d, outrange, ncols)) + if (!SiPixelGainCalibration_.put(d, outrange, ncols)) edm::LogError("SiPixelGainCalibScaler") << "[SiPixelGainCalibScaler::analyze] detid already exists" << std::endl; } // loop on DetIds @@ -326,10 +326,9 @@ void SiPixelGainCalibScaler::computeAndStorePalyoads(const edm::EventSetup& iSet try { if (mydbservice->isNewTagRequest(recordName_)) { - mydbservice->createNewIOV( - SiPixelGainCalibration_, mydbservice->beginOfTime(), mydbservice->endOfTime(), recordName_); + mydbservice->createOneIOV(SiPixelGainCalibration_, mydbservice->beginOfTime(), recordName_); } else { - mydbservice->appendSinceTime(SiPixelGainCalibration_, mydbservice->currentTime(), recordName_); + mydbservice->appendOneIOV(SiPixelGainCalibration_, mydbservice->currentTime(), recordName_); } edm::LogInfo(" --- all OK"); } catch (const cond::Exception& er) { diff --git a/CondTools/SiPixel/plugins/SiPixelGainCalibrationReadDQMFile.cc b/CondTools/SiPixel/plugins/SiPixelGainCalibrationReadDQMFile.cc index a54533f81bf43..2ad0fb6e6608d 100644 --- a/CondTools/SiPixel/plugins/SiPixelGainCalibrationReadDQMFile.cc +++ b/CondTools/SiPixel/plugins/SiPixelGainCalibrationReadDQMFile.cc @@ -115,11 +115,10 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet } } - auto theGainCalibrationDbInput = - std::make_unique(pedlow_ * 0.999, pedhi_ * 1.001, gainlow_ * 0.999, gainhi_ * 1.001); - auto theGainCalibrationDbInputHLT = std::make_unique( + SiPixelGainCalibration theGainCalibrationDbInput(pedlow_ * 0.999, pedhi_ * 1.001, gainlow_ * 0.999, gainhi_ * 1.001); + SiPixelGainCalibrationForHLT theGainCalibrationDbInputHLT( pedlow_ * 0.999, pedhi_ * 1.001, gainlow_ * 0.999, gainhi_ * 1.001); - auto theGainCalibrationDbInputOffline = std::make_unique( + SiPixelGainCalibrationOffline theGainCalibrationDbInputOffline( pedlow_ * 0.999, pedhi_ * 1.001, gainlow_ * 0.999, gainhi_ * 1.001); uint32_t nchannels = 0; @@ -205,13 +204,13 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet // int nrows=tempgain->GetNbinsY(); // int ncols=tempgain->GetNbinsX(); // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << "next histo " << tempgain->GetTitle() << " has nrow,ncol:" << nrows << ","<< ncols << std::endl; - size_t nrowsrocsplit = theGainCalibrationDbInputHLT->getNumberOfRowsToAverageOver(); - if (theGainCalibrationDbInputOffline->getNumberOfRowsToAverageOver() != nrowsrocsplit) + size_t nrowsrocsplit = theGainCalibrationDbInputHLT.getNumberOfRowsToAverageOver(); + if (theGainCalibrationDbInputOffline.getNumberOfRowsToAverageOver() != nrowsrocsplit) throw cms::Exception("GainCalibration Payload configuration error") << "[SiPixelGainCalibrationAnalysis::fillDatabase] ERROR the SiPixelGainCalibrationOffline and " "SiPixelGainCalibrationForHLT database payloads have different settings for the number of rows per roc: " - << theGainCalibrationDbInputHLT->getNumberOfRowsToAverageOver() << "(HLT), " - << theGainCalibrationDbInputOffline->getNumberOfRowsToAverageOver() << "(offline)"; + << theGainCalibrationDbInputHLT.getNumberOfRowsToAverageOver() << "(HLT), " + << theGainCalibrationDbInputOffline.getNumberOfRowsToAverageOver() << "(offline)"; std::vector theSiPixelGainCalibrationPerPixel; std::vector theSiPixelGainCalibrationPerColumn; std::vector theSiPixelGainCalibrationGainPerColPedPerPixel; @@ -325,11 +324,11 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet float gain = gains[jrow]; if (ped > pedlow_ && gain > gainlow_ && ped < pedhi_ && gain < gainhi_) { - theGainCalibrationDbInput->setData(ped, gain, theSiPixelGainCalibrationPerPixel); - theGainCalibrationDbInputOffline->setDataPedestal(ped, theSiPixelGainCalibrationGainPerColPedPerPixel); + theGainCalibrationDbInput.setData(ped, gain, theSiPixelGainCalibrationPerPixel); + theGainCalibrationDbInputOffline.setDataPedestal(ped, theSiPixelGainCalibrationGainPerColPedPerPixel); } else { - theGainCalibrationDbInput->setDeadPixel(theSiPixelGainCalibrationPerPixel); - theGainCalibrationDbInputOffline->setDeadPixel(theSiPixelGainCalibrationGainPerColPedPerPixel); + theGainCalibrationDbInput.setDeadPixel(theSiPixelGainCalibrationPerPixel); + theGainCalibrationDbInputOffline.setDeadPixel(theSiPixelGainCalibrationGainPerColPedPerPixel); } if (jrow % nrowsrocsplit == 0) { @@ -360,15 +359,15 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet if (gainforthiscol[iglobalrow] > gainlow_ && gainforthiscol[iglobalrow] < gainhi_ && pedforthiscol[iglobalrow] > pedlow_ && pedforthiscol[iglobalrow] < pedhi_) { - theGainCalibrationDbInputOffline->setDataGain( + theGainCalibrationDbInputOffline.setDataGain( gainforthiscol[iglobalrow], nrowsrocsplit, theSiPixelGainCalibrationGainPerColPedPerPixel); - theGainCalibrationDbInputHLT->setData( + theGainCalibrationDbInputHLT.setData( pedforthiscol[iglobalrow], gainforthiscol[iglobalrow], theSiPixelGainCalibrationPerColumn); } else { // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << pedforthiscol[iglobalrow] << " " << gainforthiscol[iglobalrow] << std::endl; - theGainCalibrationDbInputOffline->setDeadColumn(nrowsrocsplit, - theSiPixelGainCalibrationGainPerColPedPerPixel); - theGainCalibrationDbInputHLT->setDeadColumn(nrowsrocsplit, theSiPixelGainCalibrationPerColumn); + theGainCalibrationDbInputOffline.setDeadColumn(nrowsrocsplit, + theSiPixelGainCalibrationGainPerColPedPerPixel); + theGainCalibrationDbInputHLT.setDeadColumn(nrowsrocsplit, theSiPixelGainCalibrationPerColumn); } } } @@ -384,15 +383,15 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") <<"putting things in db..." << std::endl; // now start creating the various database objects - if (!theGainCalibrationDbInput->put(detid, range, ncols)) + if (!theGainCalibrationDbInput.put(detid, range, ncols)) edm::LogError("SiPixelGainCalibrationAnalysis") << "warning: detid already exists for Offline (gain per col, ped per pixel) calibration database" << std::endl; - if (!theGainCalibrationDbInputOffline->put(detid, offlinerange, ncols)) + if (!theGainCalibrationDbInputOffline.put(detid, offlinerange, ncols)) edm::LogError("SiPixelGainCalibrationAnalysis") << "warning: detid already exists for Offline (gain per col, ped per pixel) calibration database" << std::endl; - if (!theGainCalibrationDbInputHLT->put(detid, hltrange, ncols)) + if (!theGainCalibrationDbInputHLT.put(detid, hltrange, ncols)) edm::LogError("SiPixelGainCalibrationAnalysis") << "warning: detid already exists for HLT (pedestal and gain per column) calibration database" << std::endl; @@ -451,20 +450,20 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet << "now doing SiPixelGainCalibrationForHLTRcd payload..." << std::endl; if (mydbservice->isNewTagRequest(record_)) { mydbservice->createOneIOV( - *theGainCalibrationDbInputHLT, mydbservice->beginOfTime(), "SiPixelGainCalibrationForHLTRcd"); + theGainCalibrationDbInputHLT, mydbservice->beginOfTime(), "SiPixelGainCalibrationForHLTRcd"); } else { mydbservice->appendOneIOV( - *theGainCalibrationDbInputHLT, mydbservice->currentTime(), "SiPixelGainCalibrationForHLTRcd"); + theGainCalibrationDbInputHLT, mydbservice->currentTime(), "SiPixelGainCalibrationForHLTRcd"); } } else if (record_ == "SiPixelGainCalibrationOfflineRcd") { edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << "now doing SiPixelGainCalibrationOfflineRcd payload..." << std::endl; if (mydbservice->isNewTagRequest(record_)) { mydbservice->createOneIOV( - *theGainCalibrationDbInputOffline, mydbservice->beginOfTime(), "SiPixelGainCalibrationOfflineRcd"); + theGainCalibrationDbInputOffline, mydbservice->beginOfTime(), "SiPixelGainCalibrationOfflineRcd"); } else { mydbservice->appendOneIOV( - *theGainCalibrationDbInputOffline, mydbservice->currentTime(), "SiPixelGainCalibrationOfflineRcd"); + theGainCalibrationDbInputOffline, mydbservice->currentTime(), "SiPixelGainCalibrationOfflineRcd"); } } edm::LogInfo(" --- all OK"); diff --git a/CondTools/SiPixel/plugins/SiPixelGainCalibrationRejectNoisyAndDead.cc b/CondTools/SiPixel/plugins/SiPixelGainCalibrationRejectNoisyAndDead.cc index d0feb5259045a..4959d3a184eb7 100644 --- a/CondTools/SiPixel/plugins/SiPixelGainCalibrationRejectNoisyAndDead.cc +++ b/CondTools/SiPixel/plugins/SiPixelGainCalibrationRejectNoisyAndDead.cc @@ -86,9 +86,11 @@ void SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase(const edm::EventSetu << "New payload will have pedlow,hi " << pedlow_ << "," << pedhi_ << " and gainlow,hi " << gainlow_ << "," << gainhi_ << endl; if (record_ == "SiPixelGainCalibrationOfflineRcd") - theGainCalibrationDbInputOffline_ = new SiPixelGainCalibrationOffline(pedlow_, pedhi_, gainlow_, gainhi_); + theGainCalibrationDbInputOffline_ = + std::make_unique(pedlow_, pedhi_, gainlow_, gainhi_); if (record_ == "SiPixelGainCalibrationForHLTRcd") - theGainCalibrationDbInputForHLT_ = new SiPixelGainCalibrationForHLT(pedlow_, pedhi_, gainlow_, gainhi_); + theGainCalibrationDbInputForHLT_ = + std::make_unique(pedlow_, pedhi_, gainlow_, gainhi_); int nnoisy = 0; int ndead = 0; @@ -361,26 +363,22 @@ void SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase(const edm::EventSetu edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "now doing SiPixelGainCalibrationOfflineRcd payload..." << std::endl; if (mydbservice->isNewTagRequest("SiPixelGainCalibrationOfflineRcd")) { - mydbservice->createNewIOV(theGainCalibrationDbInputOffline_, - mydbservice->beginOfTime(), - mydbservice->endOfTime(), - "SiPixelGainCalibrationOfflineRcd"); + mydbservice->createOneIOV( + *theGainCalibrationDbInputOffline_, mydbservice->beginOfTime(), "SiPixelGainCalibrationOfflineRcd"); } else { - mydbservice->appendSinceTime( - theGainCalibrationDbInputOffline_, mydbservice->currentTime(), "SiPixelGainCalibrationOfflineRcd"); + mydbservice->appendOneIOV( + *theGainCalibrationDbInputOffline_, mydbservice->currentTime(), "SiPixelGainCalibrationOfflineRcd"); } } if (record_ == "SiPixelGainCalibrationForHLTRcd") { edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "now doing SiPixelGainCalibrationForHLTRcd payload..." << std::endl; if (mydbservice->isNewTagRequest("SiPixelGainCalibrationForHLTRcd")) { - mydbservice->createNewIOV(theGainCalibrationDbInputForHLT_, - mydbservice->beginOfTime(), - mydbservice->endOfTime(), - "SiPixelGainCalibrationForHLTRcd"); + mydbservice->createOneIOV( + *theGainCalibrationDbInputForHLT_, mydbservice->beginOfTime(), "SiPixelGainCalibrationForHLTRcd"); } else { - mydbservice->appendSinceTime( - theGainCalibrationDbInputForHLT_, mydbservice->currentTime(), "SiPixelGainCalibrationForHLTRcd"); + mydbservice->appendOneIOV( + *theGainCalibrationDbInputForHLT_, mydbservice->currentTime(), "SiPixelGainCalibrationForHLTRcd"); } } } diff --git a/CondTools/SiPixel/plugins/SiPixelGainCalibrationRejectNoisyAndDead.h b/CondTools/SiPixel/plugins/SiPixelGainCalibrationRejectNoisyAndDead.h index b37a1d467511f..4b62e4c612164 100644 --- a/CondTools/SiPixel/plugins/SiPixelGainCalibrationRejectNoisyAndDead.h +++ b/CondTools/SiPixel/plugins/SiPixelGainCalibrationRejectNoisyAndDead.h @@ -43,10 +43,10 @@ class SiPixelGainCalibrationRejectNoisyAndDead : public edm::one::EDAnalyzer<> { edm::ESGetToken pddToken_; SiPixelGainCalibrationOfflineService SiPixelGainCalibrationOfflineService_; //SiPixelGainCalibrationForHLTService SiPixelGainCalibrationService_; - SiPixelGainCalibrationOffline *theGainCalibrationDbInputOffline_; + std::unique_ptr theGainCalibrationDbInputOffline_; SiPixelGainCalibrationForHLTService SiPixelGainCalibrationForHLTService_; - SiPixelGainCalibrationForHLT *theGainCalibrationDbInputForHLT_; + std::unique_ptr theGainCalibrationDbInputForHLT_; void analyze(const edm::Event &, const edm::EventSetup &) override; diff --git a/CondTools/SiPixel/plugins/SiPixelGenErrorDBObjectUploader.cc b/CondTools/SiPixel/plugins/SiPixelGenErrorDBObjectUploader.cc index 0ed5eb2fc2332..e5c9e46c449ad 100644 --- a/CondTools/SiPixel/plugins/SiPixelGenErrorDBObjectUploader.cc +++ b/CondTools/SiPixel/plugins/SiPixelGenErrorDBObjectUploader.cc @@ -78,7 +78,6 @@ void SiPixelGenErrorDBObjectUploader::analyze(const edm::Event& iEvent, const ed SiPixelGenErrorDBObject obj; // Local variables - const char* tempfile; int m; // Set the number of GenErrors to be passed to the dbobject @@ -90,8 +89,7 @@ void SiPixelGenErrorDBObjectUploader::analyze(const edm::Event& iEvent, const ed // Open the GenError file(s) for (m = 0; m < obj.numOfTempl(); ++m) { edm::FileInPath file(theGenErrorCalibrations[m].c_str()); - tempfile = (file.fullPath()).c_str(); - std::ifstream in_file(tempfile, std::ios::in); + std::ifstream in_file(file.fullPath().c_str(), std::ios::in); if (in_file.is_open()) { edm::LogInfo("GenError Info") << "Opened GenError File: " << file.fullPath().c_str(); @@ -145,7 +143,7 @@ void SiPixelGenErrorDBObjectUploader::analyze(const edm::Event& iEvent, const ed in_file.close(); } else { // If file didn't open, report this - edm::LogError("SiPixelGenErrorDBObjectUploader") << "Error opening File" << tempfile; + edm::LogError("SiPixelGenErrorDBObjectUploader") << "Error opening File " << file.fullPath().c_str(); } } diff --git a/CondTools/SiPixel/plugins/SiPixelLorentzAngleDB.cc b/CondTools/SiPixel/plugins/SiPixelLorentzAngleDB.cc index db92cb1443540..f886a1e049d28 100644 --- a/CondTools/SiPixel/plugins/SiPixelLorentzAngleDB.cc +++ b/CondTools/SiPixel/plugins/SiPixelLorentzAngleDB.cc @@ -35,7 +35,7 @@ SiPixelLorentzAngleDB::~SiPixelLorentzAngleDB() = default; // Analyzer: Functions that gets called by framework every event void SiPixelLorentzAngleDB::analyze(const edm::Event& e, const edm::EventSetup& es) { - SiPixelLorentzAngle* LorentzAngle = new SiPixelLorentzAngle(); + SiPixelLorentzAngle LorentzAngle; //Retrieve tracker topology from geometry const TrackerTopology* tTopo = &es.getData(tkTopoToken_); @@ -62,7 +62,7 @@ void SiPixelLorentzAngleDB::analyze(const edm::Event& e, const edm::EventSetup& for (Parameters::iterator it = ModuleParameters_.begin(); it != ModuleParameters_.end(); ++it) { if (it->getParameter("rawid") == detidc.rawId()) { float lorentzangle = (float)it->getParameter("angle"); - LorentzAngle->putLorentzAngle(detid.rawId(), lorentzangle); + LorentzAngle.putLorentzAngle(detid.rawId(), lorentzangle); edm::LogPrint("SiPixelLorentzAngleDB") << " individual value=" << lorentzangle << " put into rawid=" << detid.rawId() << endl; } @@ -73,7 +73,7 @@ void SiPixelLorentzAngleDB::analyze(const edm::Event& e, const edm::EventSetup& if (it->getParameter("module") == tTopo->pxbModule(detidc.rawId()) && it->getParameter("layer") == tTopo->pxbLayer(detidc.rawId())) { float lorentzangle = (float)it->getParameter("angle"); - LorentzAngle->putLorentzAngle(detid.rawId(), lorentzangle); + LorentzAngle.putLorentzAngle(detid.rawId(), lorentzangle); } } @@ -94,7 +94,7 @@ void SiPixelLorentzAngleDB::analyze(const edm::Event& e, const edm::EventSetup& for (Parameters::iterator it = ModuleParameters_.begin(); it != ModuleParameters_.end(); ++it) { if (it->getParameter("rawid") == detidc.rawId()) { float lorentzangle = (float)it->getParameter("angle"); - LorentzAngle->putLorentzAngle(detid.rawId(), lorentzangle); + LorentzAngle.putLorentzAngle(detid.rawId(), lorentzangle); edm::LogPrint("SiPixelLorentzAngleDB") << " individual value=" << lorentzangle << " put into rawid=" << detid.rawId() << endl; } @@ -107,7 +107,7 @@ void SiPixelLorentzAngleDB::analyze(const edm::Event& e, const edm::EventSetup& it->getParameter("HVgroup") == HVgroup(tTopo->pxfPanel(detidc.rawId()), tTopo->pxfModule(detidc.rawId()))) { float lorentzangle = (float)it->getParameter("angle"); - LorentzAngle->putLorentzAngle(detid.rawId(), lorentzangle); + LorentzAngle.putLorentzAngle(detid.rawId(), lorentzangle); } } @@ -122,10 +122,9 @@ void SiPixelLorentzAngleDB::analyze(const edm::Event& e, const edm::EventSetup& if (mydbservice.isAvailable()) { try { if (mydbservice->isNewTagRequest(recordName_)) { - mydbservice->createNewIOV( - LorentzAngle, mydbservice->beginOfTime(), mydbservice->endOfTime(), recordName_); + mydbservice->createOneIOV(LorentzAngle, mydbservice->beginOfTime(), recordName_); } else { - mydbservice->appendSinceTime(LorentzAngle, mydbservice->currentTime(), recordName_); + mydbservice->appendOneIOV(LorentzAngle, mydbservice->currentTime(), recordName_); } } catch (const cond::Exception& er) { edm::LogError("SiPixelLorentzAngleDB") << er.what() << std::endl; diff --git a/CondTools/SiPixel/plugins/SiPixelPerformanceSummaryBuilder.cc b/CondTools/SiPixel/plugins/SiPixelPerformanceSummaryBuilder.cc index 831f4de2511d7..a0e7160b05b9d 100644 --- a/CondTools/SiPixel/plugins/SiPixelPerformanceSummaryBuilder.cc +++ b/CondTools/SiPixel/plugins/SiPixelPerformanceSummaryBuilder.cc @@ -34,7 +34,7 @@ void SiPixelPerformanceSummaryBuilder::analyze(const edm::Event& iEvent, const e } edm::LogInfo("Modules") << "detectorModules_.size() = " << detectorModules_.size(); - SiPixelPerformanceSummary* performanceSummary = new SiPixelPerformanceSummary(); + SiPixelPerformanceSummary performanceSummary; for (std::vector::const_iterator iDet = detectorModules_.begin(); // fill object iDet != detectorModules_.end(); @@ -43,24 +43,22 @@ void SiPixelPerformanceSummaryBuilder::analyze(const edm::Event& iEvent, const e float nDigisRMS = (float)CLHEP::RandGauss::shoot(20., 4.); float emptyFraction = (float)CLHEP::RandGauss::shoot(.5, .2); - performanceSummary->setNumberOfDigis(*iDet, nDigisMean, nDigisRMS, emptyFraction); // set values + performanceSummary.setNumberOfDigis(*iDet, nDigisMean, nDigisRMS, emptyFraction); // set values } clock_t presentTime = clock(); - performanceSummary->setTimeStamp((unsigned long long)presentTime); - performanceSummary->print(); + performanceSummary.setTimeStamp((unsigned long long)presentTime); + performanceSummary.print(); edm::Service poolDBService; // write to DB if (poolDBService.isAvailable()) { try { if (poolDBService->isNewTagRequest("SiPixelPerformanceSummaryRcd")) { edm::LogInfo("Tag") << " is a new tag request."; - poolDBService->createNewIOV(performanceSummary, - poolDBService->beginOfTime(), - poolDBService->endOfTime(), - "SiPixelPerformanceSummaryRcd"); + poolDBService->createOneIOV( + performanceSummary, poolDBService->beginOfTime(), "SiPixelPerformanceSummaryRcd"); } else { edm::LogInfo("Tag") << " tag exists already"; - poolDBService->appendSinceTime( + poolDBService->appendOneIOV( performanceSummary, poolDBService->currentTime(), "SiPixelPerformanceSummaryRcd"); } } catch (const cond::Exception& err) { diff --git a/CondTools/SiPixel/plugins/SiPixelTemplateDBObjectUploader.cc b/CondTools/SiPixel/plugins/SiPixelTemplateDBObjectUploader.cc index e24b48b2228a0..272a3decc4ead 100644 --- a/CondTools/SiPixel/plugins/SiPixelTemplateDBObjectUploader.cc +++ b/CondTools/SiPixel/plugins/SiPixelTemplateDBObjectUploader.cc @@ -87,8 +87,7 @@ void SiPixelTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const ed // Open the template file(s) for (int m = 0; m < obj.numOfTempl(); ++m) { edm::FileInPath file(theTemplateCalibrations[m].c_str()); - auto tempfile = (file.fullPath()); - std::ifstream in_file(tempfile.c_str(), std::ios::in); + std::ifstream in_file(file.fullPath().c_str(), std::ios::in); if (in_file.is_open()) { edm::LogInfo("SiPixelTemplateDBObjectUploader") << "Opened Template File: " << file.fullPath().c_str(); @@ -141,7 +140,7 @@ void SiPixelTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const ed in_file.close(); } else { // If file didn't open, report this - edm::LogError("SiPixelTemplateDBObjectUploader") << "Error opening File" << tempfile; + edm::LogError("SiPixelTemplateDBObjectUploader") << "Error opening File: " << file.fullPath().c_str(); } } diff --git a/CondTools/SiPixel/plugins/SiPixelVCalDB.cc b/CondTools/SiPixel/plugins/SiPixelVCalDB.cc index fb545ca674843..c08570c528c75 100644 --- a/CondTools/SiPixel/plugins/SiPixelVCalDB.cc +++ b/CondTools/SiPixel/plugins/SiPixelVCalDB.cc @@ -14,7 +14,7 @@ SiPixelVCalDB::~SiPixelVCalDB() = default; // Analyzer: Functions that gets called by framework every event void SiPixelVCalDB::analyze(const edm::Event& e, const edm::EventSetup& iSetup) { - SiPixelVCal* vcal = new SiPixelVCal(); + SiPixelVCal vcal; bool phase1 = true; // Retrieve tracker topology from geometry @@ -43,7 +43,7 @@ void SiPixelVCalDB::analyze(const edm::Event& e, const edm::EventSetup& iSetup) edm::LogPrint("SiPixelVCalDB") << "; VCal slope " << slope << ", offset " << offset; // edm::LogInfo("SiPixelVCalDB") << " detId " << rawDetId << " \t // VCal slope " << slope << ", offset " << offset; - vcal->putSlopeAndOffset(detid, slope, offset); + vcal.putSlopeAndOffset(detid, slope, offset); } } edm::LogPrint("SiPixelVCalDB") << std::endl; @@ -70,7 +70,7 @@ void SiPixelVCalDB::analyze(const edm::Event& e, const edm::EventSetup& iSetup) edm::LogPrint("SiPixelVCalDB") << "; VCal slope " << slope << ", offset " << offset; // edm::LogInfo("SiPixelVCalDB") << " detId " << rawDetId << " \t // VCal slope " << slope << ", offset " << offset; - vcal->putSlopeAndOffset(rawDetId, slope, offset); + vcal.putSlopeAndOffset(rawDetId, slope, offset); } } edm::LogPrint("SiPixelVCalDB") << std::endl; @@ -86,9 +86,9 @@ void SiPixelVCalDB::analyze(const edm::Event& e, const edm::EventSetup& iSetup) if (mydbservice.isAvailable()) { try { if (mydbservice->isNewTagRequest(recordName_)) { - mydbservice->createNewIOV(vcal, mydbservice->beginOfTime(), mydbservice->endOfTime(), recordName_); + mydbservice->createOneIOV(vcal, mydbservice->beginOfTime(), recordName_); } else { - mydbservice->appendSinceTime(vcal, mydbservice->currentTime(), recordName_); + mydbservice->appendOneIOV(vcal, mydbservice->currentTime(), recordName_); } } catch (const cond::Exception& er) { edm::LogError("SiPixelVCalDB") << er.what() << std::endl; diff --git a/CondTools/SiPixel/plugins/SiPixelVCalDB.h b/CondTools/SiPixel/plugins/SiPixelVCalDB.h index 68f96c3452f3e..c98318bb96129 100644 --- a/CondTools/SiPixel/plugins/SiPixelVCalDB.h +++ b/CondTools/SiPixel/plugins/SiPixelVCalDB.h @@ -5,8 +5,8 @@ #include #include #include -#include "CondFormats/SiPixelObjects/interface/SiPixelVCal.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelVCal.h" #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/TrackerCommon/interface/PixelBarrelName.h" #include "DataFormats/TrackerCommon/interface/PixelEndcapName.h" @@ -31,8 +31,8 @@ class SiPixelVCalDB : public edm::one::EDAnalyzer<> { void analyze(const edm::Event&, const edm::EventSetup&) override; private: - edm::ESGetToken tkGeomToken_; - edm::ESGetToken tkTopoToken_; + const edm::ESGetToken tkGeomToken_; + const edm::ESGetToken tkTopoToken_; std::string recordName_; typedef std::vector Parameters; Parameters BPixParameters_; diff --git a/CondTools/SiPixel/src/PixelPopConCalibSourceHandler.cc b/CondTools/SiPixel/src/PixelPopConCalibSourceHandler.cc index 38bda86e48c85..708ff0a6f6d13 100644 --- a/CondTools/SiPixel/src/PixelPopConCalibSourceHandler.cc +++ b/CondTools/SiPixel/src/PixelPopConCalibSourceHandler.cc @@ -40,7 +40,6 @@ #include "CalibFormats/SiPixelObjects/interface/PixelCalibConfiguration.h" // test poolDBOutput -#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" #include "FWCore/ServiceRegistry/interface/Service.h" using namespace std; @@ -286,8 +285,8 @@ void PixelPopConCalibSourceHandler::getNewObjects_file() { // use online code to parse the file pos::PixelCalibConfiguration fancyCalib(inputFilename); - SiPixelCalibConfiguration *calibConfig = new SiPixelCalibConfiguration(fancyCalib); + auto calibConfig = std::make_shared(fancyCalib); - m_to_transfer.push_back(std::make_pair(calibConfig, _sinceIOV)); + m_iovs.insert(std::make_pair(_sinceIOV, calibConfig)); } // void PixelPopConCalibSourceHandler::getNewObjects_file() diff --git a/CondTools/SiStrip/plugins/SealModules.cc b/CondTools/SiStrip/plugins/SealModules.cc deleted file mode 100644 index 82d8357c0968c..0000000000000 --- a/CondTools/SiStrip/plugins/SealModules.cc +++ /dev/null @@ -1,57 +0,0 @@ -#include "FWCore/PluginManager/interface/ModuleDef.h" - -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "CondTools/SiStrip/plugins/SiStripThresholdBuilder.h" -DEFINE_FWK_MODULE(SiStripThresholdBuilder); - -#include "CondTools/SiStrip/plugins/SiStripThresholdReader.h" -DEFINE_FWK_MODULE(SiStripThresholdReader); - -#include "CondTools/SiStrip/plugins/SiStripPedestalsBuilder.h" -DEFINE_FWK_MODULE(SiStripPedestalsBuilder); - -#include "CondTools/SiStrip/plugins/SiStripPedestalsReader.h" -DEFINE_FWK_MODULE(SiStripPedestalsReader); - -#include "CondTools/SiStrip/plugins/SiStripNoisesBuilder.h" -DEFINE_FWK_MODULE(SiStripNoisesBuilder); - -#include "CondTools/SiStrip/plugins/SiStripNoisesReader.h" -DEFINE_FWK_MODULE(SiStripNoisesReader); - -#include "CondTools/SiStrip/plugins/SiStripApvGainBuilder.h" -DEFINE_FWK_MODULE(SiStripApvGainBuilder); - -#include "CondTools/SiStrip/plugins/SiStripApvGainReader.h" -DEFINE_FWK_MODULE(SiStripApvGainReader); - -#include "CondTools/SiStrip/plugins/SiStripBadChannelBuilder.h" -DEFINE_FWK_MODULE(SiStripBadChannelBuilder); - -#include "CondTools/SiStrip/plugins/SiStripBadFiberBuilder.h" -DEFINE_FWK_MODULE(SiStripBadFiberBuilder); - -#include "CondTools/SiStrip/plugins/SiStripDetVOffFakeBuilder.h" -DEFINE_FWK_MODULE(SiStripDetVOffFakeBuilder); - -#include "CondTools/SiStrip/plugins/SiStripDetVOffReader.h" -DEFINE_FWK_MODULE(SiStripDetVOffReader); - -#include "CondTools/SiStrip/plugins/SiStripCablingTrackerMap.h" -DEFINE_FWK_MODULE(SiStripCablingTrackerMap); - -#include "CondTools/SiStrip/plugins/SiStripFedCablingBuilder.h" -DEFINE_FWK_MODULE(SiStripFedCablingBuilder); - -#include "CondTools/SiStrip/plugins/SiStripFedCablingReader.h" -DEFINE_FWK_MODULE(SiStripFedCablingReader); - -#include "CondTools/SiStrip/plugins/SiStripLorentzAngleReader.h" -DEFINE_FWK_MODULE(SiStripLorentzAngleReader); - -#include "CondTools/SiStrip/plugins/SiStripSummaryReader.h" -DEFINE_FWK_MODULE(SiStripSummaryReader); - -#include "CondTools/SiStrip/plugins/SiStripSummaryBuilder.h" -DEFINE_FWK_MODULE(SiStripSummaryBuilder); diff --git a/CondTools/SiStrip/plugins/SiStripApvGainBuilder.cc b/CondTools/SiStrip/plugins/SiStripApvGainBuilder.cc index 4cef3d99a8f24..1a03defb6fe3b 100644 --- a/CondTools/SiStrip/plugins/SiStripApvGainBuilder.cc +++ b/CondTools/SiStrip/plugins/SiStripApvGainBuilder.cc @@ -1,7 +1,32 @@ -#include "CondTools/SiStrip/plugins/SiStripApvGainBuilder.h" -#include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" -#include +// system include files #include +#include + +// user include files +#include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" +#include "CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h" +#include "CondFormats/SiStripObjects/interface/SiStripApvGain.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/FileInPath.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +#include "CLHEP/Random/RandFlat.h" +#include "CLHEP/Random/RandGauss.h" + +class SiStripApvGainBuilder : public edm::one::EDAnalyzer<> { +public: + explicit SiStripApvGainBuilder(const edm::ParameterSet& iConfig); + + ~SiStripApvGainBuilder() override = default; + + void analyze(const edm::Event&, const edm::EventSetup&) override; + +private: + const edm::FileInPath fp_; + const bool printdebug_; +}; SiStripApvGainBuilder::SiStripApvGainBuilder(const edm::ParameterSet& iConfig) : fp_(iConfig.getUntrackedParameter("file", @@ -16,12 +41,16 @@ void SiStripApvGainBuilder::analyze(const edm::Event& evt, const edm::EventSetup SiStripApvGain obj; + const auto& reader = SiStripDetInfoFileReader::read(fp_.fullPath()); + const auto& DetInfos = reader.getAllData(); + int count = -1; - for (const auto& it : SiStripDetInfoFileReader::read(fp_.fullPath()).getAllData()) { + for (const auto& it : DetInfos) { + const auto& nAPVs = it.second.nApvs; count++; //Generate Gain for det detid std::vector theSiStripVector; - for (unsigned short j = 0; j < it.second.nApvs; j++) { + for (unsigned short j = 0; j < nAPVs; j++) { float gain = (j + 1) * 1000 + (CLHEP::RandFlat::shoot(1.) * 100); if (count < printdebug_) edm::LogInfo("SiStripApvGainBuilder") << "detid " << it.first << " \t" @@ -47,3 +76,8 @@ void SiStripApvGainBuilder::analyze(const edm::Event& evt, const edm::EventSetup edm::LogError("SiStripApvGainBuilder") << "Service is unavailable" << std::endl; } } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(SiStripApvGainBuilder); diff --git a/CondTools/SiStrip/plugins/SiStripApvGainBuilder.h b/CondTools/SiStrip/plugins/SiStripApvGainBuilder.h deleted file mode 100644 index fd6368fb77e77..0000000000000 --- a/CondTools/SiStrip/plugins/SiStripApvGainBuilder.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef SiStripApvGainBuilder_H -#define SiStripApvGainBuilder_H - -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h" -#include "FWCore/ParameterSet/interface/FileInPath.h" - -#include "CondFormats/SiStripObjects/interface/SiStripApvGain.h" - -#include "CLHEP/Random/RandFlat.h" -#include "CLHEP/Random/RandGauss.h" - -class SiStripApvGainBuilder : public edm::one::EDAnalyzer<> { -public: - explicit SiStripApvGainBuilder(const edm::ParameterSet& iConfig); - - ~SiStripApvGainBuilder() override{}; - - void analyze(const edm::Event&, const edm::EventSetup&) override; - -private: - edm::FileInPath fp_; - bool printdebug_; -}; - -#endif diff --git a/CondTools/SiStrip/plugins/SiStripApvGainReader.cc b/CondTools/SiStrip/plugins/SiStripApvGainReader.cc index 10dec6cca6783..4951825f897cc 100644 --- a/CondTools/SiStrip/plugins/SiStripApvGainReader.cc +++ b/CondTools/SiStrip/plugins/SiStripApvGainReader.cc @@ -1,13 +1,48 @@ -#include "CondFormats/SiStripObjects/interface/SiStripApvGain.h" -#include "CondFormats/DataRecord/interface/SiStripApvGainRcd.h" -#include "CalibFormats/SiStripObjects/interface/SiStripGain.h" - -#include "CondTools/SiStrip/plugins/SiStripApvGainReader.h" - +// system include files #include #include #include +// user include files +#include "CalibFormats/SiStripObjects/interface/SiStripGain.h" +#include "CalibTracker/Records/interface/SiStripGainRcd.h" +#include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "CondFormats/DataRecord/interface/SiStripApvGainRcd.h" +#include "CondFormats/SiStripObjects/interface/SiStripApvGain.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +// root objects +#include "TROOT.h" +#include "TSystem.h" +#include "TFile.h" +#include "TDirectory.h" +#include "TTree.h" + +class SiStripApvGainReader : public edm::one::EDAnalyzer { +public: + explicit SiStripApvGainReader(const edm::ParameterSet&); + ~SiStripApvGainReader() override = default; + + void analyze(const edm::Event&, const edm::EventSetup&) override; + +private: + // initializers list + const bool printdebug_; + const std::string formatedOutput_; + const uint32_t gainType_; + const edm::ESGetToken gainToken_; + edm::Service fs_; + TTree* tree_ = nullptr; + int id_ = 0, detId_ = 0, apvId_ = 0; + double gain_ = 0; +}; + using namespace cms; SiStripApvGainReader::SiStripApvGainReader(const edm::ParameterSet& iConfig) @@ -67,3 +102,8 @@ void SiStripApvGainReader::analyze(const edm::Event& e, const edm::EventSetup& i if (pFile) fclose(pFile); } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(SiStripApvGainReader); diff --git a/CondTools/SiStrip/plugins/SiStripApvGainReader.h b/CondTools/SiStrip/plugins/SiStripApvGainReader.h deleted file mode 100644 index 6551d4184fc81..0000000000000 --- a/CondTools/SiStrip/plugins/SiStripApvGainReader.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef SiStripApvGainReader_H -#define SiStripApvGainReader_H - -// system include files -//#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "CommonTools/UtilAlgos/interface/TFileService.h" -#include "CalibTracker/Records/interface/SiStripGainRcd.h" - -// root objects -#include "TROOT.h" -#include "TSystem.h" -#include "TFile.h" -#include "TDirectory.h" -#include "TTree.h" - -class SiStripGain; - -class SiStripApvGainReader : public edm::one::EDAnalyzer { -public: - explicit SiStripApvGainReader(const edm::ParameterSet&); - ~SiStripApvGainReader() override = default; - - void analyze(const edm::Event&, const edm::EventSetup&) override; - -private: - bool printdebug_; - std::string formatedOutput_; - uint32_t gainType_; - edm::ESGetToken gainToken_; - edm::Service fs_; - TTree* tree_ = nullptr; - int id_ = 0, detId_ = 0, apvId_ = 0; - double gain_ = 0; -}; -#endif diff --git a/CondTools/SiStrip/plugins/SiStripApvGainRescaler.cc b/CondTools/SiStrip/plugins/SiStripApvGainRescaler.cc index 56dc16f3d3bd7..9c00f5e34aa63 100644 --- a/CondTools/SiStrip/plugins/SiStripApvGainRescaler.cc +++ b/CondTools/SiStrip/plugins/SiStripApvGainRescaler.cc @@ -59,9 +59,9 @@ class SiStripApvGainRescaler : public edm::one::EDAnalyzer<> { const std::string m_Record; // take G2_old and G1_old from the regular gain handle - edm::ESGetToken g1g2Token_; + const edm::ESGetToken g1g2Token_; // take the additional G1_new from the Gain3Rcd (dirty trick) - edm::ESGetToken g3Token_; + const edm::ESGetToken g3Token_; }; // @@ -72,11 +72,7 @@ SiStripApvGainRescaler::SiStripApvGainRescaler(const edm::ParameterSet& iConfig) //now do what ever initialization is needed } -SiStripApvGainRescaler::~SiStripApvGainRescaler() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} - +SiStripApvGainRescaler::~SiStripApvGainRescaler() = default; // // member functions // diff --git a/CondTools/SiStrip/plugins/SiStripApvSimulationParametersBuilder.cc b/CondTools/SiStrip/plugins/SiStripApvSimulationParametersBuilder.cc index c391b42fb691c..ed22b5311cc60 100644 --- a/CondTools/SiStrip/plugins/SiStripApvSimulationParametersBuilder.cc +++ b/CondTools/SiStrip/plugins/SiStripApvSimulationParametersBuilder.cc @@ -12,7 +12,7 @@ class SiStripApvSimulationParametersBuilder : public edm::one::EDAnalyzer<> { void analyze(const edm::Event&, const edm::EventSetup&) override; private: - edm::ESGetToken m_parametersToken; + const edm::ESGetToken m_parametersToken; }; void SiStripApvSimulationParametersBuilder::analyze(const edm::Event&, const edm::EventSetup& evtSetup) { diff --git a/CondTools/SiStrip/plugins/SiStripBadChannelBuilder.cc b/CondTools/SiStrip/plugins/SiStripBadChannelBuilder.cc index 68d1bef917bbe..2ccd6227380d8 100644 --- a/CondTools/SiStrip/plugins/SiStripBadChannelBuilder.cc +++ b/CondTools/SiStrip/plugins/SiStripBadChannelBuilder.cc @@ -1,9 +1,37 @@ -#include "CondTools/SiStrip/plugins/SiStripBadChannelBuilder.h" -#include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" - +// system include files +#include +#include #include #include +// user include files +#include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" +#include "CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h" +#include "CondFormats/SiStripObjects/interface/SiStripBadStrip.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/FileInPath.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/Exception.h" + +#include "CLHEP/Random/RandFlat.h" +#include "CLHEP/Random/RandGauss.h" + +class SiStripBadChannelBuilder : public ConditionDBWriter { +public: + explicit SiStripBadChannelBuilder(const edm::ParameterSet&); + ~SiStripBadChannelBuilder() override; + +private: + std::unique_ptr getNewObject() override; + + edm::FileInPath fp_; + bool printdebug_; + + typedef std::vector Parameters; + Parameters BadComponentList_; +}; + SiStripBadChannelBuilder::SiStripBadChannelBuilder(const edm::ParameterSet& iConfig) : ConditionDBWriter(iConfig) { fp_ = iConfig.getUntrackedParameter("file", edm::FileInPath(SiStripDetInfoFileReader::kDefaultFile)); @@ -11,7 +39,7 @@ SiStripBadChannelBuilder::SiStripBadChannelBuilder(const edm::ParameterSet& iCon BadComponentList_ = iConfig.getUntrackedParameter("BadComponentList"); } -SiStripBadChannelBuilder::~SiStripBadChannelBuilder() {} +SiStripBadChannelBuilder::~SiStripBadChannelBuilder() = default; std::unique_ptr SiStripBadChannelBuilder::getNewObject() { edm::LogInfo("SiStripBadChannelBuilder") << "... creating dummy SiStripBadStrip Data" << std::endl; @@ -89,3 +117,8 @@ std::unique_ptr SiStripBadChannelBuilder::getNewObject() { return obj; } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(SiStripBadChannelBuilder); diff --git a/CondTools/SiStrip/plugins/SiStripBadChannelBuilder.h b/CondTools/SiStrip/plugins/SiStripBadChannelBuilder.h deleted file mode 100644 index 16650bd89af8c..0000000000000 --- a/CondTools/SiStrip/plugins/SiStripBadChannelBuilder.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef SiStripBadChannelBuilder_H -#define SiStripBadChannelBuilder_H - -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h" -#include "FWCore/ParameterSet/interface/FileInPath.h" - -#include "CondFormats/SiStripObjects/interface/SiStripBadStrip.h" - -#include "CLHEP/Random/RandFlat.h" -#include "CLHEP/Random/RandGauss.h" - -#include -#include - -class SiStripBadChannelBuilder : public ConditionDBWriter { -public: - explicit SiStripBadChannelBuilder(const edm::ParameterSet&); - ~SiStripBadChannelBuilder() override; - -private: - std::unique_ptr getNewObject() override; - - edm::FileInPath fp_; - bool printdebug_; - - typedef std::vector Parameters; - Parameters BadComponentList_; -}; -#endif diff --git a/CondTools/SiStrip/plugins/SiStripBadFiberBuilder.cc b/CondTools/SiStrip/plugins/SiStripBadFiberBuilder.cc index 71b874a6a9d93..e6b750618266c 100644 --- a/CondTools/SiStrip/plugins/SiStripBadFiberBuilder.cc +++ b/CondTools/SiStrip/plugins/SiStripBadFiberBuilder.cc @@ -1,16 +1,39 @@ -#include "CondTools/SiStrip/plugins/SiStripBadFiberBuilder.h" - +// system include files +#include #include #include #include +// user include files +#include "CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h" +#include "CondFormats/SiStripObjects/interface/SiStripBadStrip.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/FileInPath.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/Exception.h" + +class SiStripBadFiberBuilder : public ConditionDBWriter { +public: + explicit SiStripBadFiberBuilder(const edm::ParameterSet&); + ~SiStripBadFiberBuilder() override; + +private: + std::unique_ptr getNewObject() override; + + bool printdebug_; + + typedef std::vector Parameters; + Parameters BadComponentList_; +}; + SiStripBadFiberBuilder::SiStripBadFiberBuilder(const edm::ParameterSet& iConfig) : ConditionDBWriter(iConfig) { printdebug_ = iConfig.getUntrackedParameter("printDebug", false); BadComponentList_ = iConfig.getUntrackedParameter("BadComponentList"); } -SiStripBadFiberBuilder::~SiStripBadFiberBuilder() {} +SiStripBadFiberBuilder::~SiStripBadFiberBuilder() = default; std::unique_ptr SiStripBadFiberBuilder::getNewObject() { edm::LogInfo("SiStripBadFiberBuilder") << "... creating dummy SiStripBadStrip Data" << std::endl; @@ -52,3 +75,8 @@ std::unique_ptr SiStripBadFiberBuilder::getNewObject() { return obj; } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(SiStripBadFiberBuilder); diff --git a/CondTools/SiStrip/plugins/SiStripBadFiberBuilder.h b/CondTools/SiStrip/plugins/SiStripBadFiberBuilder.h deleted file mode 100644 index a0f9a67877325..0000000000000 --- a/CondTools/SiStrip/plugins/SiStripBadFiberBuilder.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef SiStripBadFiberBuilder_H -#define SiStripBadFiberBuilder_H - -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h" -#include "CondFormats/SiStripObjects/interface/SiStripBadStrip.h" -#include "FWCore/ParameterSet/interface/FileInPath.h" -#include - -class SiStripBadFiberBuilder : public ConditionDBWriter { -public: - explicit SiStripBadFiberBuilder(const edm::ParameterSet&); - ~SiStripBadFiberBuilder() override; - -private: - std::unique_ptr getNewObject() override; - - bool printdebug_; - - typedef std::vector Parameters; - Parameters BadComponentList_; -}; -#endif diff --git a/CondTools/SiStrip/plugins/SiStripBadStripReader.cc b/CondTools/SiStrip/plugins/SiStripBadStripReader.cc index 320086d35a93c..b5e7698fef93c 100644 --- a/CondTools/SiStrip/plugins/SiStripBadStripReader.cc +++ b/CondTools/SiStrip/plugins/SiStripBadStripReader.cc @@ -14,15 +14,15 @@ class SiStripBadStripReader : public edm::one::EDAnalyzer<> { public: explicit SiStripBadStripReader(const edm::ParameterSet& iConfig) - : printdebug_(iConfig.getUntrackedParameter("printDebug", 1)), badStripToken_(esConsumes()) {} + : printdebug_(iConfig.getUntrackedParameter("printDebug", false)), badStripToken_(esConsumes()) {} ~SiStripBadStripReader() override; void analyze(const edm::Event&, const edm::EventSetup&) override; private: - uint32_t printdebug_; - edm::ESGetToken badStripToken_; + const bool printdebug_; + const edm::ESGetToken badStripToken_; }; SiStripBadStripReader::~SiStripBadStripReader() = default; diff --git a/CondTools/SiStrip/plugins/SiStripCablingTrackerMap.cc b/CondTools/SiStrip/plugins/SiStripCablingTrackerMap.cc index bb01f2154916a..cdf1042ad00b8 100644 --- a/CondTools/SiStrip/plugins/SiStripCablingTrackerMap.cc +++ b/CondTools/SiStrip/plugins/SiStripCablingTrackerMap.cc @@ -1,8 +1,32 @@ -#include "CondTools/SiStrip/plugins/SiStripCablingTrackerMap.h" +#include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CommonTools/TrackerMap/interface/TrackerMap.h" +#include "CalibTracker/Records/interface/SiStripDetCablingRcd.h" +#include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h" #include "CommonTools/TrackerMap/interface/TrackerMap.h" #include +class SiStripCablingTrackerMap : public edm::one::EDAnalyzer { +public: + SiStripCablingTrackerMap(const edm::ParameterSet& conf); + ~SiStripCablingTrackerMap() override = default; + + void beginRun(const edm::Run& run, const edm::EventSetup& es) override; + void endJob() override; + void endRun(const edm::Run& run, const edm::EventSetup& es) override{}; + void analyze(const edm::Event& e, const edm::EventSetup& c) override; + +private: + const edm::ESGetToken detCablingToken_; + + std::unique_ptr tkMap_detCab; //0 for onTrack, 1 for offTrack, 2 for All +}; + SiStripCablingTrackerMap::SiStripCablingTrackerMap(edm::ParameterSet const& conf) : detCablingToken_(esConsumes()) {} void SiStripCablingTrackerMap::beginRun(const edm::Run& run, const edm::EventSetup& es) { @@ -10,7 +34,6 @@ void SiStripCablingTrackerMap::beginRun(const edm::Run& run, const edm::EventSet } //------------------------------------------------------------------------------------------ - void SiStripCablingTrackerMap::endJob() { tkMap_detCab->save(true, 0, 0, "DetCabling.png"); tkMap_detCab->print(true, 0, 0, "DetCabling"); @@ -29,3 +52,8 @@ void SiStripCablingTrackerMap::analyze(const edm::Event& e, const edm::EventSetu tkMap_detCab->fill(detid, 1); } } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(SiStripCablingTrackerMap); diff --git a/CondTools/SiStrip/plugins/SiStripCablingTrackerMap.h b/CondTools/SiStrip/plugins/SiStripCablingTrackerMap.h deleted file mode 100644 index b1ce7ac03f410..0000000000000 --- a/CondTools/SiStrip/plugins/SiStripCablingTrackerMap.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef SiStripCablingTrackerMap_h -#define SiStripCablingTrackerMap_h - -#include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "CommonTools/TrackerMap/interface/TrackerMap.h" -#include "CalibTracker/Records/interface/SiStripDetCablingRcd.h" - -#include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h" - -class SiStripCablingTrackerMap : public edm::one::EDAnalyzer { -public: - SiStripCablingTrackerMap(const edm::ParameterSet& conf); - ~SiStripCablingTrackerMap() override = default; - - void beginRun(const edm::Run& run, const edm::EventSetup& es) override; - void endJob() override; - void endRun(const edm::Run& run, const edm::EventSetup& es) override{}; - void analyze(const edm::Event& e, const edm::EventSetup& c) override; - -private: - edm::ESGetToken detCablingToken_; - - std::unique_ptr tkMap_detCab; //0 for onTrack, 1 for offTrack, 2 for All -}; - -#endif diff --git a/CondTools/SiStrip/plugins/SiStripChannelGainFromDBMiscalibrator.cc b/CondTools/SiStrip/plugins/SiStripChannelGainFromDBMiscalibrator.cc index 0ea0498b4a6c4..ea27e03174a16 100644 --- a/CondTools/SiStrip/plugins/SiStripChannelGainFromDBMiscalibrator.cc +++ b/CondTools/SiStrip/plugins/SiStripChannelGainFromDBMiscalibrator.cc @@ -65,8 +65,8 @@ class SiStripChannelGainFromDBMiscalibrator : public edm::one::EDAnalyzer<> { const uint32_t m_gainType; const bool m_saveMaps; const std::vector m_parameters; - edm::ESGetToken gainToken_; - edm::ESGetToken tTopoToken_; + const edm::ESGetToken gainToken_; + const edm::ESGetToken tTopoToken_; std::unique_ptr scale_map; std::unique_ptr smear_map; diff --git a/CondTools/SiStrip/plugins/SiStripDetVOffFakeBuilder.cc b/CondTools/SiStrip/plugins/SiStripDetVOffFakeBuilder.cc index 3ff5471fa1d90..5bca723ce18fa 100644 --- a/CondTools/SiStrip/plugins/SiStripDetVOffFakeBuilder.cc +++ b/CondTools/SiStrip/plugins/SiStripDetVOffFakeBuilder.cc @@ -2,17 +2,37 @@ #include // user include files - #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" - #include "CondFormats/SiStripObjects/interface/SiStripDetVOff.h" - -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" #include "Geometry/CommonDetUnit/interface/GeomDet.h" #include "Geometry/CommonTopologies/interface/StripTopology.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" + +class SiStripDetVOffFakeBuilder : public edm::one::EDAnalyzer<> { +public: + explicit SiStripDetVOffFakeBuilder(const edm::ParameterSet& iConfig); -#include "CondTools/SiStrip/plugins/SiStripDetVOffFakeBuilder.h" + ~SiStripDetVOffFakeBuilder() override; + + virtual void initialize(const edm::EventSetup&); + + void analyze(const edm::Event&, const edm::EventSetup&) override; + +private: + bool printdebug_; + const edm::ESGetToken tkGeomToken_; + std::vector detids; +}; using namespace std; using namespace cms; @@ -20,7 +40,7 @@ using namespace cms; SiStripDetVOffFakeBuilder::SiStripDetVOffFakeBuilder(const edm::ParameterSet& iConfig) : printdebug_(iConfig.getUntrackedParameter("printDebug", false)), tkGeomToken_(esConsumes()) {} -SiStripDetVOffFakeBuilder::~SiStripDetVOffFakeBuilder() {} +SiStripDetVOffFakeBuilder::~SiStripDetVOffFakeBuilder() = default; void SiStripDetVOffFakeBuilder::initialize(const edm::EventSetup& iSetup) { const auto& tkGeom = iSetup.getData(tkGeomToken_); @@ -94,3 +114,8 @@ void SiStripDetVOffFakeBuilder::analyze(const edm::Event& evt, const edm::EventS edm::LogError("SiStripDetVOffFakeBuilder") << "Service is unavailable" << std::endl; } } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(SiStripDetVOffFakeBuilder); diff --git a/CondTools/SiStrip/plugins/SiStripDetVOffFakeBuilder.h b/CondTools/SiStrip/plugins/SiStripDetVOffFakeBuilder.h deleted file mode 100644 index 8c3957325b1d1..0000000000000 --- a/CondTools/SiStrip/plugins/SiStripDetVOffFakeBuilder.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef SiStripDetVOff_H -#define SiStripDetVOff_H - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" - -class TrackerGeometry; - -class SiStripDetVOffFakeBuilder : public edm::one::EDAnalyzer<> { -public: - explicit SiStripDetVOffFakeBuilder(const edm::ParameterSet& iConfig); - - ~SiStripDetVOffFakeBuilder() override; - - virtual void initialize(const edm::EventSetup&); - - void analyze(const edm::Event&, const edm::EventSetup&) override; - -private: - bool printdebug_; - edm::ESGetToken tkGeomToken_; - std::vector detids; -}; -#endif diff --git a/CondTools/SiStrip/plugins/SiStripDetVOffReader.cc b/CondTools/SiStrip/plugins/SiStripDetVOffReader.cc index c829e0545bdf6..28a9a233be8c8 100644 --- a/CondTools/SiStrip/plugins/SiStripDetVOffReader.cc +++ b/CondTools/SiStrip/plugins/SiStripDetVOffReader.cc @@ -1,11 +1,38 @@ -#include "CondFormats/SiStripObjects/interface/SiStripDetVOff.h" - -#include "CondTools/SiStrip/plugins/SiStripDetVOffReader.h" - +// system include files #include #include #include +// user include files +#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" +#include "CondFormats/SiStripObjects/interface/SiStripDetVOff.h" +#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +// +// +// class decleration +// +class SiStripDetVOffReader : public edm::one::EDAnalyzer<> { +public: + explicit SiStripDetVOffReader(const edm::ParameterSet&); + ~SiStripDetVOffReader() override = default; + + void analyze(const edm::Event&, const edm::EventSetup&) override; + +private: + const bool printdebug_; + const edm::ESGetToken detVOffToken_; + std::vector detids; +}; + SiStripDetVOffReader::SiStripDetVOffReader(const edm::ParameterSet& iConfig) : printdebug_(iConfig.getUntrackedParameter("printDebug", true)), detVOffToken_(esConsumes()) {} @@ -44,3 +71,8 @@ void SiStripDetVOffReader::analyze(const edm::Event& e, const edm::EventSetup& i } } } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(SiStripDetVOffReader); diff --git a/CondTools/SiStrip/plugins/SiStripDetVOffReader.h b/CondTools/SiStrip/plugins/SiStripDetVOffReader.h deleted file mode 100644 index ad79ce3b65727..0000000000000 --- a/CondTools/SiStrip/plugins/SiStripDetVOffReader.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef SiStripDetVOffReader_H -#define SiStripDetVOffReader_H - -// system include files -//#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" - -class SiStripDetVOff; -// -// -// class decleration -// -class SiStripDetVOffReader : public edm::one::EDAnalyzer<> { -public: - explicit SiStripDetVOffReader(const edm::ParameterSet&); - ~SiStripDetVOffReader() override = default; - - void analyze(const edm::Event&, const edm::EventSetup&) override; - -private: - bool printdebug_; - edm::ESGetToken detVOffToken_; - std::vector detids; -}; -#endif - -/* LocalWords: ifndef - */ diff --git a/CondTools/SiStrip/plugins/SiStripFedCablingBuilder.cc b/CondTools/SiStrip/plugins/SiStripFedCablingBuilder.cc index 4bfa0df8de243..638aab28c71a5 100644 --- a/CondTools/SiStrip/plugins/SiStripFedCablingBuilder.cc +++ b/CondTools/SiStrip/plugins/SiStripFedCablingBuilder.cc @@ -1,14 +1,46 @@ -#include "CondTools/SiStrip/plugins/SiStripFedCablingBuilder.h" -#include "CalibFormats/SiStripObjects/interface/SiStripFecCabling.h" +// sytem include files +#include +#include +#include + +// user include files #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h" +#include "CalibFormats/SiStripObjects/interface/SiStripFecCabling.h" #include "CalibFormats/SiStripObjects/interface/SiStripRegionCabling.h" -#include "CondFormats/SiStripObjects/interface/SiStripFedCabling.h" +#include "CalibTracker/Records/interface/SiStripDetCablingRcd.h" +#include "CalibTracker/Records/interface/SiStripFecCablingRcd.h" +#include "CalibTracker/Records/interface/SiStripRegionCablingRcd.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" -#include "FWCore/ServiceRegistry/interface/Service.h" +#include "CondFormats/DataRecord/interface/SiStripFedCablingRcd.h" +#include "CondFormats/SiStripObjects/interface/SiStripFedCabling.h" +#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Run.h" -#include -#include -#include +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Utilities/interface/Exception.h" + +class SiStripFedCablingBuilder : public edm::one::EDAnalyzer { +public: + SiStripFedCablingBuilder(const edm::ParameterSet& iConfig); + + ~SiStripFedCablingBuilder() override = default; + + void beginRun(const edm::Run&, const edm::EventSetup&) override; + void analyze(const edm::Event&, const edm::EventSetup&) override {} + void endRun(const edm::Run&, const edm::EventSetup&) override{}; + +private: + const bool printFecCabling_; + const bool printDetCabling_; + const bool printRegionCabling_; + const edm::ESGetToken fedCablingToken_; + const edm::ESGetToken fecCablingToken_; + const edm::ESGetToken detCablingToken_; + const edm::ESGetToken regionCablingToken_; + const edm::ESGetToken tTopoToken_; +}; // ----------------------------------------------------------------------------- // @@ -106,3 +138,8 @@ void SiStripFedCablingBuilder::beginRun(const edm::Run& run, const edm::EventSet edm::LogError("SiStripFedCablingBuilder") << "Service is unavailable" << std::endl; } } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(SiStripFedCablingBuilder); diff --git a/CondTools/SiStrip/plugins/SiStripFedCablingBuilder.h b/CondTools/SiStrip/plugins/SiStripFedCablingBuilder.h deleted file mode 100644 index 3d29527da4f0e..0000000000000 --- a/CondTools/SiStrip/plugins/SiStripFedCablingBuilder.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef SiStripFedCablingBuilder_H -#define SiStripFedCablingBuilder_H -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "CondFormats/DataRecord/interface/SiStripFedCablingRcd.h" -#include "CalibTracker/Records/interface/SiStripFecCablingRcd.h" -#include "CalibTracker/Records/interface/SiStripDetCablingRcd.h" -#include "CalibTracker/Records/interface/SiStripRegionCablingRcd.h" - -class SiStripFedCabling; -class SiStripFecCabling; -class SiStripDetCabling; -class SiStripRegionCabling; - -class SiStripFedCablingBuilder : public edm::one::EDAnalyzer { -public: - SiStripFedCablingBuilder(const edm::ParameterSet& iConfig); - - ~SiStripFedCablingBuilder() = default; - - void beginRun(const edm::Run&, const edm::EventSetup&) override; - void analyze(const edm::Event&, const edm::EventSetup&) override {} - void endRun(const edm::Run&, const edm::EventSetup&) override{}; - -private: - bool printFecCabling_; - bool printDetCabling_; - bool printRegionCabling_; - edm::ESGetToken fedCablingToken_; - edm::ESGetToken fecCablingToken_; - edm::ESGetToken detCablingToken_; - edm::ESGetToken regionCablingToken_; - edm::ESGetToken tTopoToken_; -}; -#endif diff --git a/CondTools/SiStrip/plugins/SiStripFedCablingReader.cc b/CondTools/SiStrip/plugins/SiStripFedCablingReader.cc index 9c863af42146f..aa22438efb82d 100644 --- a/CondTools/SiStrip/plugins/SiStripFedCablingReader.cc +++ b/CondTools/SiStrip/plugins/SiStripFedCablingReader.cc @@ -1,12 +1,42 @@ -#include "CondTools/SiStrip/plugins/SiStripFedCablingReader.h" -#include "CalibFormats/SiStripObjects/interface/SiStripFecCabling.h" +// system includes +#include +#include + +// user includes #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h" +#include "CalibFormats/SiStripObjects/interface/SiStripFecCabling.h" #include "CalibFormats/SiStripObjects/interface/SiStripRegionCabling.h" +#include "CalibTracker/Records/interface/SiStripDetCablingRcd.h" +#include "CalibTracker/Records/interface/SiStripFecCablingRcd.h" +#include "CalibTracker/Records/interface/SiStripRegionCablingRcd.h" +#include "CondFormats/DataRecord/interface/SiStripFedCablingRcd.h" #include "CondFormats/SiStripObjects/interface/SiStripFedCabling.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include -#include +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +class SiStripFedCablingReader : public edm::one::EDAnalyzer { +public: + SiStripFedCablingReader(const edm::ParameterSet&); + ~SiStripFedCablingReader() override = default; + + void beginRun(const edm::Run&, const edm::EventSetup&) override; + void endRun(const edm::Run&, const edm::EventSetup&) override{}; + void analyze(const edm::Event&, const edm::EventSetup&) override{}; + +private: + bool printFecCabling_; + bool printDetCabling_; + bool printRegionCabling_; + const edm::ESGetToken fedCablingToken_; + const edm::ESGetToken fecCablingToken_; + const edm::ESGetToken detCablingToken_; + const edm::ESGetToken regionCablingToken_; + const edm::ESGetToken tTopoToken_; +}; // ----------------------------------------------------------------------------- // @@ -102,3 +132,8 @@ void SiStripFedCablingReader::beginRun(const edm::Run& run, const edm::EventSetu edm::LogVerbatim("SiStripFedCablingReader") << ss.str(); } } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(SiStripFedCablingReader); diff --git a/CondTools/SiStrip/plugins/SiStripFedCablingReader.h b/CondTools/SiStrip/plugins/SiStripFedCablingReader.h deleted file mode 100644 index 52f7fd539b246..0000000000000 --- a/CondTools/SiStrip/plugins/SiStripFedCablingReader.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef CondTools_SiStrip_FedCablingReader_H -#define CondTools_SiStrip_FedCablingReader_H - -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "CondFormats/DataRecord/interface/SiStripFedCablingRcd.h" -#include "CalibTracker/Records/interface/SiStripFecCablingRcd.h" -#include "CalibTracker/Records/interface/SiStripDetCablingRcd.h" -#include "CalibTracker/Records/interface/SiStripRegionCablingRcd.h" - -class SiStripFedCabling; -class SiStripFecCabling; -class SiStripDetCabling; -class SiStripRegionCabling; - -class SiStripFedCablingReader : public edm::one::EDAnalyzer { -public: - SiStripFedCablingReader(const edm::ParameterSet&); - ~SiStripFedCablingReader() = default; - - void beginRun(const edm::Run&, const edm::EventSetup&) override; - void endRun(const edm::Run&, const edm::EventSetup&) override{}; - void analyze(const edm::Event&, const edm::EventSetup&) override{}; - -private: - bool printFecCabling_; - bool printDetCabling_; - bool printRegionCabling_; - edm::ESGetToken fedCablingToken_; - edm::ESGetToken fecCablingToken_; - edm::ESGetToken detCablingToken_; - edm::ESGetToken regionCablingToken_; - edm::ESGetToken tTopoToken_; -}; - -#endif // CondTools_SiStrip_FedCablingReader_H diff --git a/CondTools/SiStrip/plugins/SiStripLorentzAngleReader.cc b/CondTools/SiStrip/plugins/SiStripLorentzAngleReader.cc index c0553dfa6f591..9f0a0bb48ec04 100644 --- a/CondTools/SiStrip/plugins/SiStripLorentzAngleReader.cc +++ b/CondTools/SiStrip/plugins/SiStripLorentzAngleReader.cc @@ -1,11 +1,36 @@ -#include "CondFormats/SiStripObjects/interface/SiStripLorentzAngle.h" - -#include "CondTools/SiStrip/plugins/SiStripLorentzAngleReader.h" - +// system include files #include #include #include +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CondFormats/DataRecord/interface/SiStripLorentzAngleRcd.h" +#include "CondFormats/SiStripObjects/interface/SiStripLorentzAngle.h" + +// +// +// class decleration +// +class SiStripLorentzAngleReader : public edm::one::EDAnalyzer<> { +public: + explicit SiStripLorentzAngleReader(const edm::ParameterSet&); + ~SiStripLorentzAngleReader() override = default; + + void analyze(const edm::Event&, const edm::EventSetup&) override; + +private: + uint32_t printdebug_; + std::string label_; + const edm::ESGetToken laToken_; +}; + using namespace cms; SiStripLorentzAngleReader::SiStripLorentzAngleReader(const edm::ParameterSet& iConfig) @@ -27,3 +52,8 @@ void SiStripLorentzAngleReader::analyze(const edm::Event& e, const edm::EventSet count++; } } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(SiStripLorentzAngleReader); diff --git a/CondTools/SiStrip/plugins/SiStripLorentzAngleReader.h b/CondTools/SiStrip/plugins/SiStripLorentzAngleReader.h deleted file mode 100644 index d5b174a101307..0000000000000 --- a/CondTools/SiStrip/plugins/SiStripLorentzAngleReader.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef SiStripLorentzAngleReader_H -#define SiStripLorentzAngleReader_H - -// system include files -//#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "CondFormats/DataRecord/interface/SiStripLorentzAngleRcd.h" - -class SiStripLorentzAngle; - -// -// -// class decleration -// -class SiStripLorentzAngleReader : public edm::one::EDAnalyzer<> { -public: - explicit SiStripLorentzAngleReader(const edm::ParameterSet&); - ~SiStripLorentzAngleReader() override = default; - - void analyze(const edm::Event&, const edm::EventSetup&) override; - -private: - uint32_t printdebug_; - std::string label_; - edm::ESGetToken laToken_; -}; - -#endif diff --git a/CondTools/SiStrip/plugins/SiStripNoisesBuilder.cc b/CondTools/SiStrip/plugins/SiStripNoisesBuilder.cc index de511793bb741..e90abc8fb07fc 100644 --- a/CondTools/SiStrip/plugins/SiStripNoisesBuilder.cc +++ b/CondTools/SiStrip/plugins/SiStripNoisesBuilder.cc @@ -1,8 +1,32 @@ -#include "CondTools/SiStrip/plugins/SiStripNoisesBuilder.h" -#include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" +// system includes #include #include +// user includes +#include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" +#include "CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h" +#include "CondFormats/SiStripObjects/interface/SiStripNoises.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/FileInPath.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/Exception.h" + +#include "CLHEP/Random/RandFlat.h" +#include "CLHEP/Random/RandGauss.h" + +class SiStripNoisesBuilder : public edm::one::EDAnalyzer<> { +public: + explicit SiStripNoisesBuilder(const edm::ParameterSet& iConfig); + + ~SiStripNoisesBuilder() override = default; + + void analyze(const edm::Event&, const edm::EventSetup&) override; + +private: + const edm::FileInPath fp_; + const uint32_t printdebug_; +}; + SiStripNoisesBuilder::SiStripNoisesBuilder(const edm::ParameterSet& iConfig) : fp_(iConfig.getUntrackedParameter("file", edm::FileInPath(SiStripDetInfoFileReader::kDefaultFile))), @@ -16,11 +40,17 @@ void SiStripNoisesBuilder::analyze(const edm::Event& evt, const edm::EventSetup& SiStripNoises obj; int count = -1; - for (const auto& it : SiStripDetInfoFileReader::read(fp_.fullPath()).getAllData()) { + + const auto& reader = SiStripDetInfoFileReader::read(fp_.fullPath()); + const auto& DetInfos = reader.getAllData(); + + for (const auto& it : DetInfos) { + const auto& nAPVs = it.second.nApvs; + count++; //Generate Noise for det detid SiStripNoises::InputVector theSiStripVector; - for (int strip = 0; strip < 128 * it.second.nApvs; ++strip) { + for (int strip = 0; strip < 128 * nAPVs; ++strip) { float MeanNoise = 5; float RmsNoise = 1; float noise = CLHEP::RandGauss::shoot(MeanNoise, RmsNoise); @@ -34,22 +64,25 @@ void SiStripNoisesBuilder::analyze(const edm::Event& evt, const edm::EventSetup& << "detid " << it.first << " \t" << " strip " << strip << " \t" << noise << " \t" << theSiStripVector.back() / 10 << " \t" << std::endl; } - if (!obj.put(it.first, theSiStripVector)) edm::LogError("SiStripNoisesBuilder") << "[SiStripNoisesBuilder::analyze] detid already exists" << std::endl; } - //End now write sistripnoises data in DB + //And now write sistripnoises data in DB edm::Service mydbservice; if (mydbservice.isAvailable()) { if (mydbservice->isNewTagRequest("SiStripNoisesRcd")) { mydbservice->createOneIOV(obj, mydbservice->beginOfTime(), "SiStripNoisesRcd"); } else { - //mydbservice->createNewIOV(obj,mydbservice->currentTime(),"SiStripNoisesRcd"); mydbservice->appendOneIOV(obj, mydbservice->currentTime(), "SiStripNoisesRcd"); } } else { edm::LogError("SiStripNoisesBuilder") << "Service is unavailable" << std::endl; } } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(SiStripNoisesBuilder); diff --git a/CondTools/SiStrip/plugins/SiStripNoisesBuilder.h b/CondTools/SiStrip/plugins/SiStripNoisesBuilder.h deleted file mode 100644 index 1b2114344fc3f..0000000000000 --- a/CondTools/SiStrip/plugins/SiStripNoisesBuilder.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef SiStripNoisesBuilder_H -#define SiStripNoisesBuilder_H -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h" -#include "FWCore/ParameterSet/interface/FileInPath.h" - -#include "CondFormats/SiStripObjects/interface/SiStripNoises.h" - -#include "CLHEP/Random/RandFlat.h" -#include "CLHEP/Random/RandGauss.h" - -class SiStripNoisesBuilder : public edm::one::EDAnalyzer<> { -public: - explicit SiStripNoisesBuilder(const edm::ParameterSet& iConfig); - - ~SiStripNoisesBuilder() override{}; - - void analyze(const edm::Event&, const edm::EventSetup&) override; - -private: - edm::FileInPath fp_; - uint32_t printdebug_; -}; -#endif diff --git a/CondTools/SiStrip/plugins/SiStripNoisesFromDBMiscalibrator.cc b/CondTools/SiStrip/plugins/SiStripNoisesFromDBMiscalibrator.cc index 9f5f48813aa75..7d6d8fdf1ce3f 100644 --- a/CondTools/SiStrip/plugins/SiStripNoisesFromDBMiscalibrator.cc +++ b/CondTools/SiStrip/plugins/SiStripNoisesFromDBMiscalibrator.cc @@ -67,9 +67,9 @@ class SiStripNoisesFromDBMiscalibrator : public edm::one::EDAnalyzer<> { const bool m_fillDefaults; const bool m_saveMaps; const std::vector m_parameters; - edm::FileInPath fp_; - edm::ESGetToken m_tTopoToken; - edm::ESGetToken m_noiseToken; + const edm::FileInPath fp_; + const edm::ESGetToken m_tTopoToken; + const edm::ESGetToken m_noiseToken; std::unique_ptr scale_map; std::unique_ptr smear_map; @@ -298,11 +298,15 @@ std::unique_ptr SiStripNoisesFromDBMiscalibrator::getNewObject_wi std::vector missingDetIds; - for (const auto& it : SiStripDetInfoFileReader::read(fp_.fullPath()).getAllData()) { + const auto& reader = SiStripDetInfoFileReader::read(fp_.fullPath()); + const auto& DetInfos = reader.getAllData(); + + for (const auto& it : DetInfos) { + const auto& nAPVs = it.second.nApvs; //Generate Noise for det detid bool isMissing(false); SiStripNoises::InputVector theSiStripVector; - for (int t_strip = 0; t_strip < 128 * it.second.nApvs; ++t_strip) { + for (int t_strip = 0; t_strip < 128 * nAPVs; ++t_strip) { std::pair index = std::make_pair(it.first, t_strip); if (theMap.find(index) == theMap.end()) { diff --git a/CondTools/SiStrip/plugins/SiStripNoisesReader.cc b/CondTools/SiStrip/plugins/SiStripNoisesReader.cc index 5fd801f68f0f7..1d6a57af693c3 100644 --- a/CondTools/SiStrip/plugins/SiStripNoisesReader.cc +++ b/CondTools/SiStrip/plugins/SiStripNoisesReader.cc @@ -1,11 +1,38 @@ -#include "CondTools/SiStrip/plugins/SiStripNoisesReader.h" +// system include files +#include +#include +#include + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CondFormats/SiStripObjects/interface/SiStripNoises.h" +#include "CondFormats/DataRecord/interface/SiStripNoisesRcd.h" + +class SiStripNoisesReader : public edm::one::EDAnalyzer<> { +public: + explicit SiStripNoisesReader(const edm::ParameterSet&); + ~SiStripNoisesReader() override; + + void analyze(const edm::Event&, const edm::EventSetup&) override; + +private: + const uint32_t printdebug_; + const edm::ESGetToken noisesToken_; +}; using namespace cms; SiStripNoisesReader::SiStripNoisesReader(const edm::ParameterSet& iConfig) : printdebug_(iConfig.getUntrackedParameter("printDebug", 1)), noisesToken_(esConsumes()) {} -SiStripNoisesReader::~SiStripNoisesReader() {} +SiStripNoisesReader::~SiStripNoisesReader() = default; void SiStripNoisesReader::analyze(const edm::Event& e, const edm::EventSetup& iSetup) { const auto& stripNoises = iSetup.getData(noisesToken_); @@ -29,3 +56,8 @@ void SiStripNoisesReader::analyze(const edm::Event& e, const edm::EventSetup& iS } } } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(SiStripNoisesReader); diff --git a/CondTools/SiStrip/plugins/SiStripNoisesReader.h b/CondTools/SiStrip/plugins/SiStripNoisesReader.h deleted file mode 100644 index c03e6f6693111..0000000000000 --- a/CondTools/SiStrip/plugins/SiStripNoisesReader.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef SiStripNoisesReader_H -#define SiStripNoisesReader_H - -// system include files -//#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "CondFormats/SiStripObjects/interface/SiStripNoises.h" -#include "CondFormats/DataRecord/interface/SiStripNoisesRcd.h" - -#include -#include -#include - -class SiStripNoisesReader : public edm::one::EDAnalyzer<> { -public: - explicit SiStripNoisesReader(const edm::ParameterSet&); - ~SiStripNoisesReader() override; - - void analyze(const edm::Event&, const edm::EventSetup&) override; - -private: - uint32_t printdebug_; - edm::ESGetToken noisesToken_; -}; -#endif diff --git a/CondTools/SiStrip/plugins/SiStripPedestalsBuilder.cc b/CondTools/SiStrip/plugins/SiStripPedestalsBuilder.cc index b24861d0974eb..de0d86309cb5d 100644 --- a/CondTools/SiStrip/plugins/SiStripPedestalsBuilder.cc +++ b/CondTools/SiStrip/plugins/SiStripPedestalsBuilder.cc @@ -1,8 +1,31 @@ -#include "CondTools/SiStrip/plugins/SiStripPedestalsBuilder.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/FileInPath.h" #include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" +#include "CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h" +#include "CondFormats/SiStripObjects/interface/SiStripPedestals.h" + +#include "CLHEP/Random/RandFlat.h" +#include "CLHEP/Random/RandGauss.h" + #include #include +class SiStripPedestalsBuilder : public edm::one::EDAnalyzer<> { +public: + explicit SiStripPedestalsBuilder(const edm::ParameterSet& iConfig); + + ~SiStripPedestalsBuilder() override = default; + + void analyze(const edm::Event&, const edm::EventSetup&) override; + +private: + edm::FileInPath fp_; + uint32_t printdebug_; +}; + SiStripPedestalsBuilder::SiStripPedestalsBuilder(const edm::ParameterSet& iConfig) : fp_(iConfig.getUntrackedParameter("file", edm::FileInPath(SiStripDetInfoFileReader::kDefaultFile))), @@ -17,11 +40,17 @@ void SiStripPedestalsBuilder::analyze(const edm::Event& evt, const edm::EventSet SiStripPedestals obj; int count = -1; - for (const auto& it : SiStripDetInfoFileReader::read(fp_.fullPath()).getAllData()) { + + const auto& reader = SiStripDetInfoFileReader::read(fp_.fullPath()); + const auto& DetInfos = reader.getAllData(); + + for (const auto& it : DetInfos) { + const auto& nAPVs = it.second.nApvs; + count++; //Generate Pedestal for det detid SiStripPedestals::InputVector theSiStripVector; - for (int strip = 0; strip < 128 * it.second.nApvs; ++strip) { + for (int strip = 0; strip < 128 * nAPVs; ++strip) { float MeanPed = 100; float RmsPed = 5; @@ -53,3 +82,8 @@ void SiStripPedestalsBuilder::analyze(const edm::Event& evt, const edm::EventSet edm::LogError("SiStripPedestalsBuilder") << "Service is unavailable" << std::endl; } } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(SiStripPedestalsBuilder); diff --git a/CondTools/SiStrip/plugins/SiStripPedestalsBuilder.h b/CondTools/SiStrip/plugins/SiStripPedestalsBuilder.h deleted file mode 100644 index 743d13da60a53..0000000000000 --- a/CondTools/SiStrip/plugins/SiStripPedestalsBuilder.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef CSiStripPedestalsBuilder_H -#define CSiStripPedestalsBuilder_H - -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h" -#include "FWCore/ParameterSet/interface/FileInPath.h" - -#include "CondFormats/SiStripObjects/interface/SiStripPedestals.h" - -#include "CLHEP/Random/RandFlat.h" -#include "CLHEP/Random/RandGauss.h" - -class SiStripPedestalsBuilder : public edm::one::EDAnalyzer<> { -public: - explicit SiStripPedestalsBuilder(const edm::ParameterSet& iConfig); - - ~SiStripPedestalsBuilder() override{}; - - void analyze(const edm::Event&, const edm::EventSetup&) override; - -private: - edm::FileInPath fp_; - uint32_t printdebug_; -}; -#endif diff --git a/CondTools/SiStrip/plugins/SiStripPedestalsReader.cc b/CondTools/SiStrip/plugins/SiStripPedestalsReader.cc index b528bcd5d2802..b04ab0737af28 100644 --- a/CondTools/SiStrip/plugins/SiStripPedestalsReader.cc +++ b/CondTools/SiStrip/plugins/SiStripPedestalsReader.cc @@ -1,4 +1,32 @@ -#include "CondTools/SiStrip/plugins/SiStripPedestalsReader.h" +// system include files +//#include +#include +#include +#include + +// user include files +#include "CondFormats/DataRecord/interface/SiStripPedestalsRcd.h" +#include "CondFormats/SiStripObjects/interface/SiStripPedestals.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +class SiStripPedestalsReader : public edm::one::EDAnalyzer<> { +public: + explicit SiStripPedestalsReader(const edm::ParameterSet&); + ~SiStripPedestalsReader() override = default; + + void analyze(const edm::Event&, const edm::EventSetup&) override; + +private: + uint32_t printdebug_; + const edm::ESGetToken pedestalsToken_; +}; using namespace std; using namespace cms; @@ -27,3 +55,8 @@ void SiStripPedestalsReader::analyze(const edm::Event& e, const edm::EventSetup& } } } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(SiStripPedestalsReader); diff --git a/CondTools/SiStrip/plugins/SiStripPedestalsReader.h b/CondTools/SiStrip/plugins/SiStripPedestalsReader.h deleted file mode 100644 index 534f8b7cbfaf3..0000000000000 --- a/CondTools/SiStrip/plugins/SiStripPedestalsReader.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef SiStripPedestalsReader_H -#define SiStripPedestalsReader_H - -// system include files -//#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "CondFormats/SiStripObjects/interface/SiStripPedestals.h" -#include "CondFormats/DataRecord/interface/SiStripPedestalsRcd.h" - -#include -#include -#include - -class SiStripPedestalsReader : public edm::one::EDAnalyzer<> { -public: - explicit SiStripPedestalsReader(const edm::ParameterSet&); - ~SiStripPedestalsReader() override = default; - - void analyze(const edm::Event&, const edm::EventSetup&) override; - -private: - uint32_t printdebug_; - edm::ESGetToken pedestalsToken_; -}; -#endif diff --git a/CondTools/SiStrip/plugins/SiStripSummaryBuilder.cc b/CondTools/SiStrip/plugins/SiStripSummaryBuilder.cc index 8b76ceb33d0d8..bb8335e440ccd 100644 --- a/CondTools/SiStrip/plugins/SiStripSummaryBuilder.cc +++ b/CondTools/SiStrip/plugins/SiStripSummaryBuilder.cc @@ -1,7 +1,34 @@ -#include "CondTools/SiStrip/plugins/SiStripSummaryBuilder.h" +// system include files #include #include +// user include files +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h" +#include "FWCore/ParameterSet/interface/FileInPath.h" +#include "CondFormats/SiStripObjects/interface/SiStripSummary.h" + +#include "CLHEP/Random/RandFlat.h" +#include "CLHEP/Random/RandGauss.h" + +class SiStripSummaryBuilder : public edm::one::EDAnalyzer<> { +public: + explicit SiStripSummaryBuilder(const edm::ParameterSet& iConfig); + + ~SiStripSummaryBuilder() override = default; + + void analyze(const edm::Event&, const edm::EventSetup&) override; + +private: + edm::FileInPath fp_; + bool printdebug_; + + edm::ParameterSet iConfig_; +}; + SiStripSummaryBuilder::SiStripSummaryBuilder(const edm::ParameterSet& iConfig) : fp_(iConfig.getUntrackedParameter( "file", edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"))), @@ -111,3 +138,8 @@ void SiStripSummaryBuilder::analyze(const edm::Event& evt, const edm::EventSetup edm::LogError("SiStripSummaryBuilder") << "Service is unavailable" << std::endl; } } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(SiStripSummaryBuilder); diff --git a/CondTools/SiStrip/plugins/SiStripSummaryBuilder.h b/CondTools/SiStrip/plugins/SiStripSummaryBuilder.h deleted file mode 100644 index ad7c83331bfc3..0000000000000 --- a/CondTools/SiStrip/plugins/SiStripSummaryBuilder.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef SiStripSummaryBuilder_H -#define SiStripSummaryBuilder_H - -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h" -#include "FWCore/ParameterSet/interface/FileInPath.h" - -#include "CondFormats/SiStripObjects/interface/SiStripSummary.h" - -#include "CLHEP/Random/RandFlat.h" -#include "CLHEP/Random/RandGauss.h" - -class SiStripSummaryBuilder : public edm::one::EDAnalyzer<> { -public: - explicit SiStripSummaryBuilder(const edm::ParameterSet& iConfig); - - ~SiStripSummaryBuilder() override{}; - - void analyze(const edm::Event&, const edm::EventSetup&) override; - -private: - edm::FileInPath fp_; - bool printdebug_; - - edm::ParameterSet iConfig_; -}; - -#endif diff --git a/CondTools/SiStrip/plugins/SiStripSummaryReader.cc b/CondTools/SiStrip/plugins/SiStripSummaryReader.cc index c2a1087d03d42..e2a16049f36d7 100644 --- a/CondTools/SiStrip/plugins/SiStripSummaryReader.cc +++ b/CondTools/SiStrip/plugins/SiStripSummaryReader.cc @@ -1,13 +1,34 @@ +// user include files +#include "CondFormats/DataRecord/interface/SiStripSummaryRcd.h" #include "CondFormats/SiStripObjects/interface/SiStripSummary.h" - -#include "CondTools/SiStrip/plugins/SiStripSummaryReader.h" - +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +// system include files #include #include #include #include #include +class SiStripSummaryReader : public edm::one::EDAnalyzer<> { +public: + explicit SiStripSummaryReader(const edm::ParameterSet&); + ~SiStripSummaryReader() override = default; + + void analyze(const edm::Event&, const edm::EventSetup&) override; + +private: + uint32_t printdebug_; + const edm::ESGetToken summaryToken_; +}; + SiStripSummaryReader::SiStripSummaryReader(const edm::ParameterSet& iConfig) : printdebug_(iConfig.getUntrackedParameter("printDebug", 1)), summaryToken_(esConsumes()) {} @@ -34,3 +55,8 @@ void SiStripSummaryReader::analyze(const edm::Event& e, const edm::EventSetup& i } edm::LogInfo("SiStripSummaryReader") << ss.str(); } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(SiStripSummaryReader); diff --git a/CondTools/SiStrip/plugins/SiStripSummaryReader.h b/CondTools/SiStrip/plugins/SiStripSummaryReader.h deleted file mode 100644 index f07f9a78137bb..0000000000000 --- a/CondTools/SiStrip/plugins/SiStripSummaryReader.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef SiStripSummaryReader_H -#define SiStripSummaryReader_H - -// system include files -//#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "CondFormats/DataRecord/interface/SiStripSummaryRcd.h" -class SiStripSummary; - -class SiStripSummaryReader : public edm::one::EDAnalyzer<> { -public: - explicit SiStripSummaryReader(const edm::ParameterSet&); - ~SiStripSummaryReader() override = default; - - void analyze(const edm::Event&, const edm::EventSetup&) override; - -private: - uint32_t printdebug_; - edm::ESGetToken summaryToken_; -}; -#endif diff --git a/CondTools/SiStrip/plugins/SiStripThresholdBuilder.cc b/CondTools/SiStrip/plugins/SiStripThresholdBuilder.cc index 5d3439d5ce4cd..21c245fa166a8 100644 --- a/CondTools/SiStrip/plugins/SiStripThresholdBuilder.cc +++ b/CondTools/SiStrip/plugins/SiStripThresholdBuilder.cc @@ -1,8 +1,31 @@ -#include "CondTools/SiStrip/plugins/SiStripThresholdBuilder.h" #include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" +#include "CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h" +#include "CondFormats/SiStripObjects/interface/SiStripThreshold.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/FileInPath.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/Exception.h" + +#include "CLHEP/Random/RandFlat.h" +#include "CLHEP/Random/RandGauss.h" + #include #include +class SiStripThresholdBuilder : public edm::one::EDAnalyzer<> { +public: + explicit SiStripThresholdBuilder(const edm::ParameterSet& iConfig); + + ~SiStripThresholdBuilder() override = default; + + void analyze(const edm::Event&, const edm::EventSetup&) override; + +private: + edm::FileInPath fp_; + uint32_t printdebug_; +}; + SiStripThresholdBuilder::SiStripThresholdBuilder(const edm::ParameterSet& iConfig) : fp_(iConfig.getUntrackedParameter("file", edm::FileInPath(SiStripDetInfoFileReader::kDefaultFile))), @@ -16,8 +39,11 @@ void SiStripThresholdBuilder::analyze(const edm::Event& evt, const edm::EventSet SiStripThreshold obj; + const auto& reader = SiStripDetInfoFileReader::read(fp_.fullPath()); + const auto& DetInfos = reader.getAllData(); + int count = -1; - for (const auto& it : SiStripDetInfoFileReader::read(fp_.fullPath()).getAllData()) { + for (const auto& it : DetInfos) { count++; //Generate Pedestal for det detid SiStripThreshold::Container theSiStripVector; @@ -66,3 +92,8 @@ void SiStripThresholdBuilder::analyze(const edm::Event& evt, const edm::EventSet edm::LogError("SiStripThresholdBuilder") << "Service is unavailable" << std::endl; } } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(SiStripThresholdBuilder); diff --git a/CondTools/SiStrip/plugins/SiStripThresholdBuilder.h b/CondTools/SiStrip/plugins/SiStripThresholdBuilder.h deleted file mode 100644 index da3cd68576ba6..0000000000000 --- a/CondTools/SiStrip/plugins/SiStripThresholdBuilder.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef CSiStripThresholdBuilder_H -#define CSiStripThresholdBuilder_H - -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h" -#include "FWCore/ParameterSet/interface/FileInPath.h" - -#include "CondFormats/SiStripObjects/interface/SiStripThreshold.h" - -#include "CLHEP/Random/RandFlat.h" -#include "CLHEP/Random/RandGauss.h" - -class SiStripThresholdBuilder : public edm::one::EDAnalyzer<> { -public: - explicit SiStripThresholdBuilder(const edm::ParameterSet& iConfig); - - ~SiStripThresholdBuilder() override{}; - - void analyze(const edm::Event&, const edm::EventSetup&) override; - -private: - edm::FileInPath fp_; - uint32_t printdebug_; -}; -#endif diff --git a/CondTools/SiStrip/plugins/SiStripThresholdReader.cc b/CondTools/SiStrip/plugins/SiStripThresholdReader.cc index ab8b8c492785b..e48f0c0d2b1dc 100644 --- a/CondTools/SiStrip/plugins/SiStripThresholdReader.cc +++ b/CondTools/SiStrip/plugins/SiStripThresholdReader.cc @@ -1,6 +1,33 @@ -#include "CondTools/SiStrip/plugins/SiStripThresholdReader.h" +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CondFormats/SiStripObjects/interface/SiStripThreshold.h" #include "CondFormats/DataRecord/interface/SiStripThresholdRcd.h" +// system include files +#include +#include +#include +#include + +class SiStripThresholdReader : public edm::one::EDAnalyzer<> { +public: + explicit SiStripThresholdReader(const edm::ParameterSet&); + ~SiStripThresholdReader() override = default; + + void analyze(const edm::Event&, const edm::EventSetup&) override; + +private: + uint32_t printdebug_; + const edm::ESGetToken thresholdToken_; +}; + using namespace std; using namespace cms; @@ -39,3 +66,8 @@ void SiStripThresholdReader::analyze(const edm::Event& e, const edm::EventSetup& } } } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(SiStripThresholdReader); diff --git a/CondTools/SiStrip/plugins/SiStripThresholdReader.h b/CondTools/SiStrip/plugins/SiStripThresholdReader.h deleted file mode 100644 index 5b15e39e0226a..0000000000000 --- a/CondTools/SiStrip/plugins/SiStripThresholdReader.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef SiStripThresholdReader_H -#define SiStripThresholdReader_H - -// system include files -//#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "CondFormats/SiStripObjects/interface/SiStripThreshold.h" -#include "CondFormats/DataRecord/interface/SiStripThresholdRcd.h" - -#include -#include -#include - -class SiStripThresholdReader : public edm::one::EDAnalyzer<> { -public: - explicit SiStripThresholdReader(const edm::ParameterSet&); - ~SiStripThresholdReader() override = default; - - void analyze(const edm::Event&, const edm::EventSetup&) override; - -private: - uint32_t printdebug_; - edm::ESGetToken thresholdToken_; -}; -#endif diff --git a/CondTools/SiStrip/scripts/SiStripDAQPopCon.py b/CondTools/SiStrip/scripts/SiStripDAQPopCon.py index dc1222c1e533d..2e7645d58ca56 100755 --- a/CondTools/SiStrip/scripts/SiStripDAQPopCon.py +++ b/CondTools/SiStrip/scripts/SiStripDAQPopCon.py @@ -83,6 +83,8 @@ def runjob(args): pipe = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) atexit.register(partial(helper.kill_subproc_noexcept, pipe)) out = pipe.communicate()[0] + if isinstance(out, bytes): + out = out.decode("utf8", "replace") logging.info('\n%s\n' % out) logging.info('@@@CMSSW job return code = %d@@@' % pipe.returncode) if pipe.returncode != 0: diff --git a/CondTools/SiStrip/test/BuildFile.xml b/CondTools/SiStrip/test/BuildFile.xml index d165435cb4b45..faaafdb804527 100644 --- a/CondTools/SiStrip/test/BuildFile.xml +++ b/CondTools/SiStrip/test/BuildFile.xml @@ -5,3 +5,8 @@ + + + + + diff --git a/CondTools/SiStrip/test/SiStripApvGainReader_cfg.py b/CondTools/SiStrip/test/SiStripApvGainReader_cfg.py index bc8ab0930614f..6cb6b3161a49b 100644 --- a/CondTools/SiStrip/test/SiStripApvGainReader_cfg.py +++ b/CondTools/SiStrip/test/SiStripApvGainReader_cfg.py @@ -1,14 +1,22 @@ import FWCore.ParameterSet.Config as cms -from FWCore.ParameterSet.VarParsing import VarParsing - - -options = VarParsing('python') -options.register('runN', 1, - VarParsing.multiplicity.singleton, - VarParsing.varType.int, - "runN in the IOV" -) - +import FWCore.ParameterSet.VarParsing as VarParsing + +options = VarParsing.VarParsing() +options.register('runN', + 1, + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.int, + "runN in the IOV.") +options.register('tag', + 'SiStripApvGain_GR10_v1_hlt', + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "input tag") +options.register('inputFiles', + 'frontier://FrontierProd/CMS_CONDITIONS', + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "input files") options.parseArguments() if (not options.tag or not options.inputFiles): @@ -50,8 +58,7 @@ ## under test ## process.poolDBESSource = cms.ESSource("PoolDBESSource", - #connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS'), - connect = cms.string(options.inputFiles[0]), + connect = cms.string(options.inputFiles), toGet = cms.VPSet(cms.PSet(record = cms.string('SiStripApvGainRcd'), tag = cms.string(options.tag) ) diff --git a/CondTools/SiStrip/test/SiStripBadChannelBuilder_cfg.py b/CondTools/SiStrip/test/SiStripBadChannelBuilder_cfg.py index 5d2afdfd985a4..52e73e59d8ae7 100644 --- a/CondTools/SiStrip/test/SiStripBadChannelBuilder_cfg.py +++ b/CondTools/SiStrip/test/SiStripBadChannelBuilder_cfg.py @@ -23,15 +23,15 @@ DBParameters = cms.PSet( authenticationPath = cms.untracked.string('/afs/cern.ch/cms/DB/conddb') ), - timetype = cms.string('runnumber'), + timetype = cms.untracked.string('runnumber'), connect = cms.string('sqlite_file:dbfile.db'), toPut = cms.VPSet(cms.PSet( - record = cms.string('SiStripBadStrip'), + record = cms.string('SiStripBadStripRcd'), tag = cms.string('SiStripBadChannel_v1') )) ) -process.prod = cms.EDFilter("SiStripBadChannelBuilder", +process.prod = cms.EDAnalyzer("SiStripBadChannelBuilder", printDebug = cms.untracked.bool(True), BadComponentList = cms.untracked.VPSet(cms.PSet( BadChannelList = cms.vuint32(4, 5, 6, 7, 8, @@ -60,7 +60,7 @@ BadModule = cms.uint32(470394789) )), IOVMode = cms.string('Run'), - Record = cms.string('SiStripBadStrip'), + Record = cms.string('SiStripBadStripRcd'), doStoreOnDB = cms.bool(True), file = cms.untracked.FileInPath('CalibTracker/SiStripCommon/data/SiStripDetInfo.dat'), SinceAppendMode = cms.bool(True) diff --git a/CondTools/SiStrip/test/SiStripBadFiberBuilder_cfg.py b/CondTools/SiStrip/test/SiStripBadFiberBuilder_cfg.py index 0589450620a9a..55e1bf7b8a59c 100644 --- a/CondTools/SiStrip/test/SiStripBadFiberBuilder_cfg.py +++ b/CondTools/SiStrip/test/SiStripBadFiberBuilder_cfg.py @@ -23,7 +23,7 @@ DBParameters = cms.PSet( authenticationPath = cms.untracked.string('/afs/cern.ch/cms/DB/conddb') ), - timetype = cms.string('runnumber'), + timetype = cms.untracked.string('runnumber'), connect = cms.string('sqlite_file:dbfile.db'), toPut = cms.VPSet(cms.PSet( record = cms.string('SiStripBadStrip'), @@ -31,7 +31,7 @@ )) ) -process.prod = cms.EDFilter("SiStripBadFiberBuilder", +process.prod = cms.EDAnalyzer("SiStripBadFiberBuilder", printDebug = cms.untracked.bool(True), BadComponentList = cms.untracked.VPSet(cms.PSet( BadModule = cms.uint32(369120278), diff --git a/CondTools/SiStrip/test/SiStripBadStripReader_cfg.py b/CondTools/SiStrip/test/SiStripBadStripReader_cfg.py index 6f14f32db3211..3e0065d72193e 100644 --- a/CondTools/SiStrip/test/SiStripBadStripReader_cfg.py +++ b/CondTools/SiStrip/test/SiStripBadStripReader_cfg.py @@ -5,10 +5,8 @@ input = cms.untracked.int32(1) ) process.source = cms.Source("EmptySource", - lastRun = cms.untracked.uint32(1), - timetype = cms.string('runnumber'), firstRun = cms.untracked.uint32(1), - interval = cms.uint32(1) + numberEventsInRun = cms.untracked.uint32(1), ) process.MessageLogger = cms.Service("MessageLogger", diff --git a/CondTools/SiStrip/test/SiStripDetVOffFakeBuilder_cfg.py b/CondTools/SiStrip/test/SiStripDetVOffFakeBuilder_cfg.py index c33cd43c3f7aa..19d823da4ecc2 100644 --- a/CondTools/SiStrip/test/SiStripDetVOffFakeBuilder_cfg.py +++ b/CondTools/SiStrip/test/SiStripDetVOffFakeBuilder_cfg.py @@ -31,8 +31,11 @@ )) ) +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") +from Configuration.AlCa.autoCond import autoCond +process.GlobalTag.globaltag = autoCond['run2_design'] +print("taking geometry from %s" % process.GlobalTag.globaltag.value()) process.load("Configuration.StandardSequences.GeometryDB_cff") -process.TrackerDigiGeometryESModule.applyAlignment = False process.prod = cms.EDAnalyzer("SiStripDetVOffFakeBuilder") diff --git a/CondTools/SiStrip/test/SiStripDetVOffReader_cfg.py b/CondTools/SiStrip/test/SiStripDetVOffReader_cfg.py index d805890b7dc94..bebd78b5761d5 100644 --- a/CondTools/SiStrip/test/SiStripDetVOffReader_cfg.py +++ b/CondTools/SiStrip/test/SiStripDetVOffReader_cfg.py @@ -8,11 +8,8 @@ ), debugModules = cms.untracked.vstring(''), files = cms.untracked.PSet( - SiStripDetVOffReader = cms.untracked.PSet( - - ) - ), - threshold = cms.untracked.string('INFO') + SiStripDetVOffReader = cms.untracked.PSet() + ) ) process.source = cms.Source("EmptyIOVSource", diff --git a/CondTools/SiStrip/test/SiStripFedCablingBuilder_cfg.py b/CondTools/SiStrip/test/SiStripFedCablingBuilder_cfg.py index fd1b07788723e..eeb58c337bdb7 100644 --- a/CondTools/SiStrip/test/SiStripFedCablingBuilder_cfg.py +++ b/CondTools/SiStrip/test/SiStripFedCablingBuilder_cfg.py @@ -3,10 +3,9 @@ process = cms.Process("FedCablingBuilder") process.MessageLogger = cms.Service("MessageLogger", + threshold = cms.untracked.string('INFO'), debugModules = cms.untracked.vstring(''), - cablingBuilder = cms.untracked.PSet( - threshold = cms.untracked.string('INFO') - ), + #destinations = cms.untracked.vstring('cout'), destinations = cms.untracked.vstring('cablingBuilder.log') ) @@ -19,7 +18,7 @@ input = cms.untracked.int32(1) ) -process.load("CalibTracker.SiStripESProducers.SiStripFedCablingFakeESSource_cfi") +process.load("CalibTracker.SiStripESProducers.fake.SiStripFedCablingFakeESSource_cfi") process.PoolDBOutputService = cms.Service("PoolDBOutputService", BlobStreamerName = cms.untracked.string('TBufferBlobStreamingService'), @@ -28,15 +27,19 @@ authenticationPath = cms.untracked.string('/afs/cern.ch/cms/DB/conddb') ), timetype = cms.untracked.string('runnumber'), - connect = cms.string('sqlite_file:dummy2.db'), + connect = cms.string('sqlite_file:dbfile.db'), toPut = cms.VPSet(cms.PSet( record = cms.string('SiStripFedCablingRcd'), tag = cms.string('SiStripFedCabling_30X') )) ) +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") +from Configuration.AlCa.autoCond import autoCond +process.GlobalTag.globaltag = autoCond['run2_design'] +print("taking geometry from %s" % process.GlobalTag.globaltag.value()) process.load("Configuration.StandardSequences.GeometryDB_cff") -process.TrackerDigiGeometryESModule.applyAlignment = False + process.SiStripConnectivity = cms.ESProducer("SiStripConnectivity") process.SiStripRegionConnectivity = cms.ESProducer("SiStripRegionConnectivity", EtaDivisions = cms.untracked.uint32(20), @@ -44,6 +47,9 @@ EtaMax = cms.untracked.double(2.5) ) +process.prefer_SiStripConnectivity = cms.ESPrefer("SiStripConnectivity", "sistripconn") +process.prefer_SiStripCabling = cms.ESPrefer("SiStripFedCablingFakeESSource", "siStripFedCabling") + process.fedcablingbuilder = cms.EDAnalyzer("SiStripFedCablingBuilder", PrintFecCabling = cms.untracked.bool(True), PrintDetCabling = cms.untracked.bool(True), diff --git a/CondTools/SiStrip/test/SiStripFedCablingReader_cfg.py b/CondTools/SiStrip/test/SiStripFedCablingReader_cfg.py index 3c7f757284db1..ee3e46110733f 100644 --- a/CondTools/SiStrip/test/SiStripFedCablingReader_cfg.py +++ b/CondTools/SiStrip/test/SiStripFedCablingReader_cfg.py @@ -3,10 +3,9 @@ process = cms.Process("FedCablingReader") process.MessageLogger = cms.Service("MessageLogger", + threshold = cms.untracked.string('INFO'), debugModules = cms.untracked.vstring(''), - cablingReader = cms.untracked.PSet( - threshold = cms.untracked.string('INFO') - ), + #destinations = cms.untracked.vstring('cout'), destinations = cms.untracked.vstring('cablingReader.log') ) @@ -26,15 +25,19 @@ authenticationPath = cms.untracked.string('/afs/cern.ch/cms/DB/conddb') ), timetype = cms.untracked.string('runnumber'), - connect = cms.string('sqlite_file:dummy2.db'), + connect = cms.string('sqlite_file:dbfile.db'), toGet = cms.VPSet(cms.PSet( record = cms.string('SiStripFedCablingRcd'), tag = cms.string('SiStripFedCabling_30X') )) ) +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") +from Configuration.AlCa.autoCond import autoCond +process.GlobalTag.globaltag = autoCond['run2_design'] +print("taking geometry from %s" % process.GlobalTag.globaltag.value()) process.load("Configuration.StandardSequences.GeometryDB_cff") -process.TrackerDigiGeometryESModule.applyAlignment = False + process.SiStripConnectivity = cms.ESProducer("SiStripConnectivity") process.SiStripRegionConnectivity = cms.ESProducer("SiStripRegionConnectivity", EtaDivisions = cms.untracked.uint32(20), @@ -42,10 +45,13 @@ EtaMax = cms.untracked.double(2.5) ) +process.prefer_SiStripConnectivity = cms.ESPrefer("SiStripConnectivity", "sistripconn") +process.prefer_SiStripCabling = cms.ESPrefer("PoolDBESSource", "poolDBESSource") + process.fedcablingreader = cms.EDAnalyzer("SiStripFedCablingReader", - PrintFecCabling = cms.untracked.bool(True), - PrintDetCabling = cms.untracked.bool(True), - PrintRegionCabling = cms.untracked.bool(True) + PrintFecCabling = cms.untracked.bool(True), + PrintDetCabling = cms.untracked.bool(True), + PrintRegionCabling = cms.untracked.bool(True) ) process.p1 = cms.Path(process.fedcablingreader) diff --git a/CondTools/SiStrip/test/SiStripSummaryBuilder_cfg.py b/CondTools/SiStrip/test/SiStripSummaryBuilder_cfg.py index 0eb1d6f75e036..e69753483f17c 100644 --- a/CondTools/SiStrip/test/SiStripSummaryBuilder_cfg.py +++ b/CondTools/SiStrip/test/SiStripSummaryBuilder_cfg.py @@ -17,17 +17,14 @@ # different !! process.source = cms.Source("EmptySource", - timetype = cms.string("runnumber"), - firstRun = cms.untracked.uint32(1), - lastRun = cms.untracked.uint32(1), - interval = cms.untracked.uint32(1) + numberEventsInRun = cms.untracked.uint32(1), + firstRun = cms.untracked.uint32(1) ) process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) ) - process.PoolDBOutputService = cms.Service("PoolDBOutputService", BlobStreamerName = cms.untracked.string('TBufferBlobStreamingService'), DBParameters = cms.PSet( diff --git a/CondTools/SiStrip/test/SiStripThresholdBuilder_cfg.py b/CondTools/SiStrip/test/SiStripThresholdBuilder_cfg.py index 65831dda781c1..9cbc011e7b025 100644 --- a/CondTools/SiStrip/test/SiStripThresholdBuilder_cfg.py +++ b/CondTools/SiStrip/test/SiStripThresholdBuilder_cfg.py @@ -9,20 +9,12 @@ process = cms.Process("Builder") process.MessageLogger = cms.Service("MessageLogger", - ThresholdBuilder = cms.untracked.PSet( - threshold = cms.untracked.string('INFO') - ), cerr = cms.untracked.PSet( enable = cms.untracked.bool(False) ), cout = cms.untracked.PSet( + enable = cms.untracked.bool(True), threshold = cms.untracked.string('INFO') - ), - debugModules = cms.untracked.vstring(''), - files = cms.untracked.PSet( - ThresholdBuilder = cms.untracked.PSet( - - ) ) ) @@ -38,10 +30,7 @@ process.PoolDBOutputService = cms.Service("PoolDBOutputService", BlobStreamerName = cms.untracked.string('TBufferBlobStreamingService'), - DBParameters = cms.PSet( - messageLevel = cms.untracked.int32(2), - authenticationPath = cms.untracked.string('/afs/cern.ch/cms/DB/conddb') - ), + DBParameters = cms.PSet(authenticationPath = cms.untracked.string('/afs/cern.ch/cms/DB/conddb')), timetype = cms.untracked.string('runnumber'), connect = cms.string('sqlite_file:dbfile.db'), toPut = cms.VPSet(cms.PSet( @@ -50,7 +39,6 @@ )) ) - process.p1 = cms.Path(process.siStripThresholdBuilder) diff --git a/CondTools/SiStrip/test/SiStripThresholdReader_cfg.py b/CondTools/SiStrip/test/SiStripThresholdReader_cfg.py index c7e83c5b77b25..f18880ffb3bb2 100644 --- a/CondTools/SiStrip/test/SiStripThresholdReader_cfg.py +++ b/CondTools/SiStrip/test/SiStripThresholdReader_cfg.py @@ -9,21 +9,13 @@ process = cms.Process("Reader") process.MessageLogger = cms.Service("MessageLogger", - ThresholdReader = cms.untracked.PSet( - threshold = cms.untracked.string('INFO') - ), cerr = cms.untracked.PSet( enable = cms.untracked.bool(False) ), cout = cms.untracked.PSet( - threshold = cms.untracked.string('INFO') + enable = cms.untracked.bool(True) ), - debugModules = cms.untracked.vstring(''), - files = cms.untracked.PSet( - ThresholdReader = cms.untracked.PSet( - - ) - ) + debugModules = cms.untracked.vstring('') ) process.maxEvents = cms.untracked.PSet( @@ -49,9 +41,8 @@ ) process.reader = cms.EDAnalyzer("SiStripThresholdReader", - printDebug = cms.untracked.uint32(5) - ) - + printDebug = cms.untracked.uint32(5) + ) process.p1 = cms.Path(process.reader) diff --git a/CondTools/SiStrip/test/runTests.cpp b/CondTools/SiStrip/test/runTests.cpp new file mode 100644 index 0000000000000..2f0e0c40064da --- /dev/null +++ b/CondTools/SiStrip/test/runTests.cpp @@ -0,0 +1,2 @@ +#include "FWCore/Utilities/interface/TestHelper.h" +RUNTEST() diff --git a/CondTools/SiStrip/test/testBuildersReaders.sh b/CondTools/SiStrip/test/testBuildersReaders.sh new file mode 100755 index 0000000000000..54da323c1f38f --- /dev/null +++ b/CondTools/SiStrip/test/testBuildersReaders.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +function die { echo $1: status $2 ; exit $2; } + +if test -f "dbfile.db"; then + echo "cleaning the local test area" + rm -fr dbfile.db +fi + +echo " testing CondTools/SiStrip" + +## do the builders first (need the input db file) +for entry in "${LOCAL_TEST_DIR}/"SiStrip*Builder_cfg.py +do + echo "===== Test \"cmsRun $entry \" ====" + (cmsRun $entry) || die "Failure using cmsRun $entry" $? +done + +echo -e " Done with the writers \n\n" + +## do the readers +for entry in "${LOCAL_TEST_DIR}/"SiStrip*Reader_cfg.py +do + echo "===== Test \"cmsRun $entry \" ====" + (cmsRun $entry) || die "Failure using cmsRun $entry" $? +done + +echo -e " Done with the readers \n\n" + +## do the miscalibrators +(cmsRun ${LOCAL_TEST_DIR}/SiStripChannelGainFromDBMiscalibrator_cfg.py) || die "Failure using cmsRun SiStripChannelGainFromDBMiscalibrator_cfg.py)" $? +(cmsRun ${LOCAL_TEST_DIR}/SiStripNoiseFromDBMiscalibrator_cfg.py) || die "Failure using cmsRun SiStripNoiseFromDBMiscalibrator_cfg.py" $? + +echo -e " Done with the miscalibrators \n\n" diff --git a/Configuration/AlCa/python/autoCond.py b/Configuration/AlCa/python/autoCond.py index babae05777c2c..3ee91c1919fbd 100644 --- a/Configuration/AlCa/python/autoCond.py +++ b/Configuration/AlCa/python/autoCond.py @@ -2,81 +2,81 @@ ### NEW KEYS ### # GlobalTag for MC production with perfectly aligned and calibrated detector for Run1 - 'run1_design' : '121X_mcRun1_design_v6', + 'run1_design' : '122X_mcRun1_design_v1', # GlobalTag for MC production (pp collisions) with realistic alignment and calibrations for Run1 - 'run1_mc' : '121X_mcRun1_realistic_v6', + 'run1_mc' : '122X_mcRun1_realistic_v1', # GlobalTag for MC production (Heavy Ions collisions) with realistic alignment and calibrations for Run1 - 'run1_mc_hi' : '121X_mcRun1_HeavyIon_v7', + 'run1_mc_hi' : '122X_mcRun1_HeavyIon_v1', # GlobalTag for MC production with pessimistic alignment and calibrations for Run2 - 'run2_mc_50ns' : '121X_mcRun2_startup_v8', + 'run2_mc_50ns' : '122X_mcRun2_startup_v1', # GlobalTag for MC production (2015 L1 Trigger Stage1) with startup-like alignment and calibrations for Run2, L1 trigger in Stage1 mode - 'run2_mc_l1stage1' : '121X_mcRun2_asymptotic_l1stage1_v8', + 'run2_mc_l1stage1' : '122X_mcRun2_asymptotic_l1stage1_v1', # GlobalTag for MC production with perfectly aligned and calibrated detector for Run2 - 'run2_design' : '121X_mcRun2_design_v8', + 'run2_design' : '122X_mcRun2_design_v1', #GlobalTag for MC production with optimistic alignment and calibrations for 2016, prior to VFP change - 'run2_mc_pre_vfp' : '121X_mcRun2_asymptotic_preVFP_v8', + 'run2_mc_pre_vfp' : '122X_mcRun2_asymptotic_preVFP_v1', #GlobalTag for MC production with optimistic alignment and calibrations for 2016, after VFP change - 'run2_mc' : '121X_mcRun2_asymptotic_v8', + 'run2_mc' : '122X_mcRun2_asymptotic_v1', # GlobalTag for MC production (cosmics) with starup-like alignment and calibrations for Run2, Strip tracker in peak mode - 'run2_mc_cosmics' : '121X_mcRun2cosmics_asymptotic_deco_v8', + 'run2_mc_cosmics' : '122X_mcRun2cosmics_asymptotic_deco_v1', # GlobalTag for MC production (Heavy Ions collisions) with optimistic alignment and calibrations for Run2 - 'run2_mc_hi' : '121X_mcRun2_HeavyIon_v8', + 'run2_mc_hi' : '122X_mcRun2_HeavyIon_v1', # GlobalTag for MC production (p-Pb collisions) with realistic alignment and calibrations for Run2 - 'run2_mc_pa' : '121X_mcRun2_pA_v8', + 'run2_mc_pa' : '122X_mcRun2_pA_v1', # GlobalTag for Run2 data reprocessing - 'run2_data' : '121X_dataRun2_v11', + 'run2_data' : '122X_dataRun2_v1', # GlobalTag for Run2 data 2018B relvals only: HEM-15-16 fail - 'run2_data_HEfail' : '121X_dataRun2_HEfail_v11', + 'run2_data_HEfail' : '122X_dataRun2_HEfail_v1', # GlobalTag for Run2 data relvals: allows customization to run with fixed L1 menu - 'run2_data_relval' : '121X_dataRun2_relval_v11', + 'run2_data_relval' : '122X_dataRun2_relval_v1', # GlobalTag for Run2 HI data - 'run2_data_promptlike_hi' : '121X_dataRun2_PromptLike_HI_v10', + 'run2_data_promptlike_hi' : '122X_dataRun2_PromptLike_HI_v1', # GlobalTag for Run3 HLT: it points to the online GT - 'run3_hlt' : '121X_dataRun3_HLT_v11', + 'run3_hlt' : '122X_dataRun3_HLT_v1', # GlobalTag with fixed snapshot time for Run2 HLT RelVals: customizations to run with fixed L1 Menu - 'run2_hlt_relval' : '121X_dataRun2_HLT_relval_v11', + 'run2_hlt_relval' : '122X_dataRun2_HLT_relval_v1', # GlobalTag for Run3 data relvals (express GT) - 'run3_data_express' : '121X_dataRun3_Express_v11', + 'run3_data_express' : '122X_dataRun3_Express_v1', # GlobalTag for Run3 data relvals - 'run3_data_prompt' : '121X_dataRun3_Prompt_v10', + 'run3_data_prompt' : '122X_dataRun3_Prompt_v1', # GlobalTag for Run3 offline data reprocessing - 'run3_data' : '121X_dataRun3_v10', + 'run3_data' : '122X_dataRun3_v1', # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2017 (and 0,0,~0-centred beamspot) - 'phase1_2017_design' : '121X_mc2017_design_v9', + 'phase1_2017_design' : '122X_mc2017_design_v1', # GlobalTag for MC production with realistic conditions for Phase1 2017 detector - 'phase1_2017_realistic' : '121X_mc2017_realistic_v9', + 'phase1_2017_realistic' : '122X_mc2017_realistic_v1', # GlobalTag for MC production (cosmics) with realistic alignment and calibrations for Phase1 2017 detector, Strip tracker in DECO mode - 'phase1_2017_cosmics' : '121X_mc2017cosmics_realistic_deco_v9', + 'phase1_2017_cosmics' : '122X_mc2017cosmics_realistic_deco_v1', # GlobalTag for MC production (cosmics) with realistic alignment and calibrations for Phase1 2017 detector, Strip tracker in PEAK mode - 'phase1_2017_cosmics_peak' : '121X_mc2017cosmics_realistic_peak_v9', + 'phase1_2017_cosmics_peak' : '122X_mc2017cosmics_realistic_peak_v1', # GlobalTag for MC production with perfectly aligned and calibrated detector for full Phase1 2018 (and 0,0,0-centred beamspot) - 'phase1_2018_design' : '121X_upgrade2018_design_v8', + 'phase1_2018_design' : '122X_upgrade2018_design_v1', # GlobalTag for MC production with realistic conditions for full Phase1 2018 detector - 'phase1_2018_realistic' : '121X_upgrade2018_realistic_v8', + 'phase1_2018_realistic' : '122X_upgrade2018_realistic_v1', # GlobalTag for MC production with realistic run-dependent (RD) conditions for full Phase1 2018 detector - 'phase1_2018_realistic_rd' : '121X_upgrade2018_realistic_RD_v8', + 'phase1_2018_realistic_rd' : '122X_upgrade2018_realistic_RD_v1', # GlobalTag for MC production with realistic conditions for full Phase1 2018 detector for Heavy Ion - 'phase1_2018_realistic_hi' : '121X_upgrade2018_realistic_HI_v8', + 'phase1_2018_realistic_hi' : '122X_upgrade2018_realistic_HI_v1', # GlobalTag for MC production with realistic conditions for full Phase1 2018 detector: HEM-15-16 fail - 'phase1_2018_realistic_HEfail' : '121X_upgrade2018_realistic_HEfail_v8', + 'phase1_2018_realistic_HEfail' : '122X_upgrade2018_realistic_HEfail_v1', # GlobalTag for MC production (cosmics) with realistic conditions for full Phase1 2018 detector, Strip tracker in DECO mode - 'phase1_2018_cosmics' : '121X_upgrade2018cosmics_realistic_deco_v10', + 'phase1_2018_cosmics' : '122X_upgrade2018cosmics_realistic_deco_v1', # GlobalTag for MC production (cosmics) with realistic conditions for full Phase1 2018 detector, Strip tracker in PEAK mode - 'phase1_2018_cosmics_peak' : '121X_upgrade2018cosmics_realistic_peak_v8', + 'phase1_2018_cosmics_peak' : '122X_upgrade2018cosmics_realistic_peak_v1', # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2021 - 'phase1_2021_design' : '121X_mcRun3_2021_design_v16', + 'phase1_2021_design' : '122X_mcRun3_2021_design_v1', # GlobalTag for MC production with realistic conditions for Phase1 2021 - 'phase1_2021_realistic' : '121X_mcRun3_2021_realistic_v18', + 'phase1_2021_realistic' : '122X_mcRun3_2021_realistic_v1', # GlobalTag for MC production (cosmics) with realistic conditions for Phase1 2021, Strip tracker in DECO mode - 'phase1_2021_cosmics' : '121X_mcRun3_2021cosmics_realistic_deco_v18', + 'phase1_2021_cosmics' : '122X_mcRun3_2021cosmics_realistic_deco_v1', # GlobalTag for MC production with realistic conditions for Phase1 2021 detector for Heavy Ion - 'phase1_2021_realistic_hi' : '121X_mcRun3_2021_realistic_HI_v18', + 'phase1_2021_realistic_hi' : '122X_mcRun3_2021_realistic_HI_v1', # GlobalTag for MC production with realistic conditions for Phase1 2023 - 'phase1_2023_realistic' : '121X_mcRun3_2023_realistic_v17', + 'phase1_2023_realistic' : '122X_mcRun3_2023_realistic_v1', # GlobalTag for MC production with realistic conditions for Phase1 2024 - 'phase1_2024_realistic' : '121X_mcRun3_2024_realistic_v17', + 'phase1_2024_realistic' : '122X_mcRun3_2024_realistic_v1', # GlobalTag for MC production with realistic conditions for Phase2 - 'phase2_realistic' : '121X_mcRun4_realistic_v8' + 'phase2_realistic' : '122X_mcRun4_realistic_v1' } aliases = { diff --git a/Configuration/Geometry/README.md b/Configuration/Geometry/README.md index dd5c1ab82c9ae..7e1bf81a28e1c 100644 --- a/Configuration/Geometry/README.md +++ b/Configuration/Geometry/README.md @@ -91,6 +91,7 @@ Fast Timing system: * I12: Starting from I11, new ETL layout from MTD TDR * I13: Starting from I11, new ETL layout from post MTD TDR (2 sectors per disc face) * I14: Same as I13, updated sensor structure, disc z location and passive materials +* I15: Same as I14, addition of notch and revision of envelope The script also handles the common and forward elements of the geometry: * O4: detailed cavern description, changes for modified CALO region for endcap part, no overlaps inside the Muon System diff --git a/Configuration/Geometry/python/GeometryDDDSimDB_cff.py b/Configuration/Geometry/python/GeometryDDDSimDB_cff.py index cfdc361714b58..5f71c3346d5ac 100644 --- a/Configuration/Geometry/python/GeometryDDDSimDB_cff.py +++ b/Configuration/Geometry/python/GeometryDDDSimDB_cff.py @@ -6,7 +6,7 @@ # Ideal geometry, needed for simulation # # Strictly xpeaking muonOffsetESProducer_cff is not needed; -# added for consistency with the DD4Hep version +# added for consistency with the DD4hep version # from GeometryReaders.XMLIdealGeometryESSource.cmsGeometryDB_cff import * from Geometry.MuonNumbering.muonNumberingInitialization_cfi import * diff --git a/Configuration/Geometry/python/dict2026Geometry.py b/Configuration/Geometry/python/dict2026Geometry.py index f68319cadda04..4d502d30ccce0 100644 --- a/Configuration/Geometry/python/dict2026Geometry.py +++ b/Configuration/Geometry/python/dict2026Geometry.py @@ -1567,6 +1567,34 @@ ], "era" : "phase2_timing, phase2_timing_layer, phase2_etlV4", }, + "I15" : { + 1 : [ + 'Geometry/MTDCommonData/data/mtdMaterial/v3/mtdMaterial.xml', + 'Geometry/MTDCommonData/data/btl/v1/btl.xml', + 'Geometry/MTDCommonData/data/etl/v7/etl.xml', + 'Geometry/MTDCommonData/data/mtdParameters/v3/mtdStructureTopology.xml', + 'Geometry/MTDCommonData/data/mtdParameters/v2/mtdParameters.xml', + ], + 3 : [ + 'Geometry/MTDSimData/data/v2/mtdsens.xml' + ], + 4 : [ + 'Geometry/MTDSimData/data/v2/mtdProdCuts.xml' + ], + "sim" : [ + 'from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import *', + ], + "reco" :[ + 'from RecoMTD.DetLayers.mtdDetLayerGeometry_cfi import *', + 'from Geometry.MTDGeometryBuilder.mtdParameters_cff import *', + 'from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import *', + 'from Geometry.MTDNumberingBuilder.mtdTopology_cfi import *', + 'from Geometry.MTDGeometryBuilder.mtdGeometry_cfi import *', + 'from Geometry.MTDGeometryBuilder.idealForDigiMTDGeometry_cff import *', + 'mtdGeometry.applyAlignment = cms.bool(False)' + ], + "era" : "phase2_timing, phase2_timing_layer, phase2_etlV4", + }, } allDicts = [ commonDict, trackerDict, caloDict, muonDict, forwardDict, timingDict ] diff --git a/Configuration/PyReleaseValidation/README.md b/Configuration/PyReleaseValidation/README.md index 6f5395d74d9bc..a66d10e4430f1 100644 --- a/Configuration/PyReleaseValidation/README.md +++ b/Configuration/PyReleaseValidation/README.md @@ -61,8 +61,8 @@ The offsets currently in use are: * 0.999: 0.99 with Phase-2 premixing with PU50 * 0.9821: Production-like premixing stage2 * 0.9921: Production-like premixing stage1+stage2 -* 0.911: DD4Hep reading geometry from XML -* 0.912: DD4Hep reading geometry from the DB +* 0.911: DD4hep reading geometry from XML +* 0.912: DD4hep reading geometry from the DB * 0.914: DDD DB * 0.101: Phase-2 aging, 1000fb-1 * 0.103: Phase-2 aging, 3000fb-1 diff --git a/Configuration/PyReleaseValidation/python/relval_2017.py b/Configuration/PyReleaseValidation/python/relval_2017.py index 1dd7cd8f9c419..4a67dae077793 100644 --- a/Configuration/PyReleaseValidation/python/relval_2017.py +++ b/Configuration/PyReleaseValidation/python/relval_2017.py @@ -27,7 +27,7 @@ # (Patatrack pixel-only: TTbar - on CPU: quadruplets, triplets) # (Patatrack ECAL-only: TTbar - on CPU) # (Patatrack HCAL-only: TTbar - on CPU) -# 2021 (DD4HEP XML: TTbar, ZMM) +# 2021 (DD4hep XML: TTbar, ZMM) # (DDD DB: TTbar, ZMM) # (ele guns 10, 35, 1000; pho guns 10, 35; mu guns 1, 10, 100, 1000, QCD 3TeV, QCD Flat) # (ZMM, TTbar, ZEE, MinBias, TTbar PU, TTbar PU premix, ZEE PU, TTbar design, GluGluTo2Jets, GluGluTo2Jets PU) diff --git a/Configuration/StandardSequences/python/AlCaHarvesting_cff.py b/Configuration/StandardSequences/python/AlCaHarvesting_cff.py index 88b0b11b71024..0c076565f446a 100644 --- a/Configuration/StandardSequences/python/AlCaHarvesting_cff.py +++ b/Configuration/StandardSequences/python/AlCaHarvesting_cff.py @@ -228,7 +228,6 @@ # -------------------------------------------------------------------------------------- # PPS calibration -ALCAHARVESTPPSTimingCalibration = ppsTimingCalibrationPCLHarvester.clone() ALCAHARVESTPPSTimingCalibration_metadata = cms.PSet(record = cms.untracked.string('PPSTimingCalibrationRcd')) ALCAHARVESTPPSTimingCalibration_dbOutput = cms.PSet(record = cms.string('PPSTimingCalibrationRcd'), tag = cms.string('PPSDiamondTimingCalibration_pcl'), diff --git a/DQM/BeamMonitor/plugins/BeamMonitor.cc b/DQM/BeamMonitor/plugins/BeamMonitor.cc index 6989ba262470e..bcf8a9afc3f18 100644 --- a/DQM/BeamMonitor/plugins/BeamMonitor.cc +++ b/DQM/BeamMonitor/plugins/BeamMonitor.cc @@ -1355,48 +1355,48 @@ void BeamMonitor::FitAndFill(const LuminosityBlock& lumiSeg, int& lastlumi, int& // } // Create the BeamSpotOnlineObjects object - BeamSpotOnlineObjects* BSOnline = new BeamSpotOnlineObjects(); - BSOnline->SetLastAnalyzedLumi(LSRange.second); - BSOnline->SetLastAnalyzedRun(theBeamFitter->getRunNumber()); - BSOnline->SetLastAnalyzedFill(0); // To be updated with correct LHC Fill number - BSOnline->SetPosition(bs.x0(), bs.y0(), bs.z0()); - BSOnline->SetSigmaZ(bs.sigmaZ()); - BSOnline->SetBeamWidthX(bs.BeamWidthX()); - BSOnline->SetBeamWidthY(bs.BeamWidthY()); - BSOnline->SetBeamWidthXError(bs.BeamWidthXError()); - BSOnline->SetBeamWidthYError(bs.BeamWidthYError()); - BSOnline->Setdxdz(bs.dxdz()); - BSOnline->Setdydz(bs.dydz()); - BSOnline->SetType(bs.type()); - BSOnline->SetEmittanceX(bs.emittanceX()); - BSOnline->SetEmittanceY(bs.emittanceY()); - BSOnline->SetBetaStar(bs.betaStar()); + BeamSpotOnlineObjects BSOnline; + BSOnline.SetLastAnalyzedLumi(LSRange.second); + BSOnline.SetLastAnalyzedRun(theBeamFitter->getRunNumber()); + BSOnline.SetLastAnalyzedFill(0); // To be updated with correct LHC Fill number + BSOnline.SetPosition(bs.x0(), bs.y0(), bs.z0()); + BSOnline.SetSigmaZ(bs.sigmaZ()); + BSOnline.SetBeamWidthX(bs.BeamWidthX()); + BSOnline.SetBeamWidthY(bs.BeamWidthY()); + BSOnline.SetBeamWidthXError(bs.BeamWidthXError()); + BSOnline.SetBeamWidthYError(bs.BeamWidthYError()); + BSOnline.Setdxdz(bs.dxdz()); + BSOnline.Setdydz(bs.dydz()); + BSOnline.SetType(bs.type()); + BSOnline.SetEmittanceX(bs.emittanceX()); + BSOnline.SetEmittanceY(bs.emittanceY()); + BSOnline.SetBetaStar(bs.betaStar()); for (int i = 0; i < 7; ++i) { for (int j = 0; j < 7; ++j) { - BSOnline->SetCovariance(i, j, bs.covariance(i, j)); + BSOnline.SetCovariance(i, j, bs.covariance(i, j)); } } - BSOnline->SetNumTracks(theBeamFitter->getNTracks()); - BSOnline->SetNumPVs(theBeamFitter->getNPVs()); - BSOnline->SetUsedEvents((int)DipPVInfo_[0]); - BSOnline->SetMeanPV(DipPVInfo_[1]); - BSOnline->SetMeanErrorPV(DipPVInfo_[2]); - BSOnline->SetRmsPV(DipPVInfo_[3]); - BSOnline->SetRmsErrorPV(DipPVInfo_[4]); - BSOnline->SetMaxPVs((int)DipPVInfo_[5]); + BSOnline.SetNumTracks(theBeamFitter->getNTracks()); + BSOnline.SetNumPVs(theBeamFitter->getNPVs()); + BSOnline.SetUsedEvents((int)DipPVInfo_[0]); + BSOnline.SetMeanPV(DipPVInfo_[1]); + BSOnline.SetMeanErrorPV(DipPVInfo_[2]); + BSOnline.SetRmsPV(DipPVInfo_[3]); + BSOnline.SetRmsErrorPV(DipPVInfo_[4]); + BSOnline.SetMaxPVs((int)DipPVInfo_[5]); auto creationTime = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) .count(); - BSOnline->SetCreationTime(creationTime); + BSOnline.SetCreationTime(creationTime); std::pair timeForDIP = theBeamFitter->getRefTime(); - BSOnline->SetStartTimeStamp(timeForDIP.first); - BSOnline->SetStartTime(getGMTstring(timeForDIP.first)); - BSOnline->SetEndTimeStamp(timeForDIP.second); - BSOnline->SetEndTime(getGMTstring(timeForDIP.second)); + BSOnline.SetStartTimeStamp(timeForDIP.first); + BSOnline.SetStartTime(getGMTstring(timeForDIP.first)); + BSOnline.SetEndTimeStamp(timeForDIP.second); + BSOnline.SetEndTime(getGMTstring(timeForDIP.second)); edm::LogInfo("BeamMonitor") << "FitAndFill::[PayloadCreation] BeamSpotOnline object created: \n" << std::endl; - edm::LogInfo("BeamMonitor") << *BSOnline << std::endl; + edm::LogInfo("BeamMonitor") << BSOnline << std::endl; // Create the payload for BeamSpotOnlineObjects object if (onlineDbService_.isAvailable()) { @@ -1414,18 +1414,18 @@ void BeamMonitor::FitAndFill(const LuminosityBlock& lumiSeg, int& lastlumi, int& onlineDbService_->logger().logInfo() << "\n" << bs; onlineDbService_->logger().logInfo() << "BeamMonitor::FitAndFill - [PayloadCreation] BeamSpotOnline object created:"; - onlineDbService_->logger().logInfo() << "\n" << *BSOnline; + onlineDbService_->logger().logInfo() << "\n" << BSOnline; onlineDbService_->logger().logInfo() << "BeamMonitor - Additional parameters for DIP:"; - onlineDbService_->logger().logInfo() << "Events used in the fit: " << BSOnline->GetUsedEvents(); - onlineDbService_->logger().logInfo() << "Mean PV : " << BSOnline->GetMeanPV(); - onlineDbService_->logger().logInfo() << "Mean PV Error : " << BSOnline->GetMeanErrorPV(); - onlineDbService_->logger().logInfo() << "Rms PV : " << BSOnline->GetRmsPV(); - onlineDbService_->logger().logInfo() << "Rms PV Error : " << BSOnline->GetRmsErrorPV(); - onlineDbService_->logger().logInfo() << "Max PVs : " << BSOnline->GetMaxPVs(); - onlineDbService_->logger().logInfo() << "StartTime : " << BSOnline->GetStartTime(); - onlineDbService_->logger().logInfo() << "StartTimeStamp : " << BSOnline->GetStartTimeStamp(); - onlineDbService_->logger().logInfo() << "EndTime : " << BSOnline->GetEndTime(); - onlineDbService_->logger().logInfo() << "EndTimeStamp : " << BSOnline->GetEndTimeStamp(); + onlineDbService_->logger().logInfo() << "Events used in the fit: " << BSOnline.GetUsedEvents(); + onlineDbService_->logger().logInfo() << "Mean PV : " << BSOnline.GetMeanPV(); + onlineDbService_->logger().logInfo() << "Mean PV Error : " << BSOnline.GetMeanErrorPV(); + onlineDbService_->logger().logInfo() << "Rms PV : " << BSOnline.GetRmsPV(); + onlineDbService_->logger().logInfo() << "Rms PV Error : " << BSOnline.GetRmsErrorPV(); + onlineDbService_->logger().logInfo() << "Max PVs : " << BSOnline.GetMaxPVs(); + onlineDbService_->logger().logInfo() << "StartTime : " << BSOnline.GetStartTime(); + onlineDbService_->logger().logInfo() << "StartTimeStamp : " << BSOnline.GetStartTimeStamp(); + onlineDbService_->logger().logInfo() << "EndTime : " << BSOnline.GetEndTime(); + onlineDbService_->logger().logInfo() << "EndTimeStamp : " << BSOnline.GetEndTimeStamp(); onlineDbService_->logger().logInfo() << "BeamMonitor::FitAndFill - [PayloadCreation] onlineDbService available"; onlineDbService_->logger().logInfo() << "BeamMonitor::FitAndFill - [PayloadCreation] SetCreationTime: " << creationTime @@ -1433,7 +1433,7 @@ void BeamMonitor::FitAndFill(const LuminosityBlock& lumiSeg, int& lastlumi, int& try { onlineDbService_->writeIOVForNextLumisection(BSOnline, recordName_); onlineDbService_->logger().logInfo() - << "BeamMonitor::FitAndFill - [PayloadCreation] writeForNextLumisection executed correctly"; + << "BeamMonitor::FitAndFill - [PayloadCreation] writeIOVForNextLumisection executed correctly"; } catch (const std::exception& e) { onlineDbService_->logger().logError() << "BeamMonitor - Error writing record: " << recordName_ << " for Run: " << frun << " - Lumi: " << LSRange.second; diff --git a/DQM/BeamMonitor/plugins/FakeBeamMonitor.cc b/DQM/BeamMonitor/plugins/FakeBeamMonitor.cc index 05a468f6ca130..8eca0df1df095 100644 --- a/DQM/BeamMonitor/plugins/FakeBeamMonitor.cc +++ b/DQM/BeamMonitor/plugins/FakeBeamMonitor.cc @@ -1384,51 +1384,48 @@ void FakeBeamMonitor::FitAndFill(const LuminosityBlock& lumiSeg, int& lastlumi, // } // Create the BeamSpotOnlineObjects object - BeamSpotOnlineObjects* BSOnline = new BeamSpotOnlineObjects(); - BSOnline->SetLastAnalyzedLumi(LSRange.second); - BSOnline->SetLastAnalyzedRun(frun); - BSOnline->SetLastAnalyzedFill(0); // To be updated with correct LHC Fill number - BSOnline->SetPosition(bs.x0(), bs.y0(), bs.z0()); - BSOnline->SetSigmaZ(bs.sigmaZ()); - BSOnline->SetBeamWidthX(bs.BeamWidthX()); - BSOnline->SetBeamWidthY(bs.BeamWidthY()); - BSOnline->SetBeamWidthXError(bs.BeamWidthXError()); - BSOnline->SetBeamWidthYError(bs.BeamWidthYError()); - BSOnline->Setdxdz(bs.dxdz()); - BSOnline->Setdydz(bs.dydz()); - BSOnline->SetType(bs.type()); - BSOnline->SetEmittanceX(bs.emittanceX()); - BSOnline->SetEmittanceY(bs.emittanceY()); - BSOnline->SetBetaStar(bs.betaStar()); + BeamSpotOnlineObjects BSOnline; + BSOnline.SetLastAnalyzedLumi(LSRange.second); + BSOnline.SetLastAnalyzedRun(frun); + BSOnline.SetLastAnalyzedFill(0); // To be updated with correct LHC Fill number + BSOnline.SetPosition(bs.x0(), bs.y0(), bs.z0()); + BSOnline.SetSigmaZ(bs.sigmaZ()); + BSOnline.SetBeamWidthX(bs.BeamWidthX()); + BSOnline.SetBeamWidthY(bs.BeamWidthY()); + BSOnline.SetBeamWidthXError(bs.BeamWidthXError()); + BSOnline.SetBeamWidthYError(bs.BeamWidthYError()); + BSOnline.Setdxdz(bs.dxdz()); + BSOnline.Setdydz(bs.dydz()); + BSOnline.SetType(bs.type()); + BSOnline.SetEmittanceX(bs.emittanceX()); + BSOnline.SetEmittanceY(bs.emittanceY()); + BSOnline.SetBetaStar(bs.betaStar()); for (int i = 0; i < 7; ++i) { for (int j = 0; j < 7; ++j) { - BSOnline->SetCovariance(i, j, bs.covariance(i, j)); + BSOnline.SetCovariance(i, j, bs.covariance(i, j)); } } - // BSOnline->SetNumTracks(theBeamFitter->getNTracks()); - // BSOnline->SetNumPVs(theBeamFitter->getNPVs()); - BSOnline->SetNumTracks(50); - BSOnline->SetNumPVs(10); - BSOnline->SetUsedEvents((int)DipPVInfo_[0]); - BSOnline->SetMeanPV(DipPVInfo_[1]); - BSOnline->SetMeanErrorPV(DipPVInfo_[2]); - BSOnline->SetRmsPV(DipPVInfo_[3]); - BSOnline->SetRmsErrorPV(DipPVInfo_[4]); - BSOnline->SetMaxPVs((int)DipPVInfo_[5]); + BSOnline.SetNumTracks(50); + BSOnline.SetNumPVs(10); + BSOnline.SetUsedEvents((int)DipPVInfo_[0]); + BSOnline.SetMeanPV(DipPVInfo_[1]); + BSOnline.SetMeanErrorPV(DipPVInfo_[2]); + BSOnline.SetRmsPV(DipPVInfo_[3]); + BSOnline.SetRmsErrorPV(DipPVInfo_[4]); + BSOnline.SetMaxPVs((int)DipPVInfo_[5]); auto creationTime = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); - BSOnline->SetCreationTime(creationTime); + BSOnline.SetCreationTime(creationTime); // use fake timestamps from 1970.01.01 00:00:00 to 1970.01.01 00:00:01 GMT std::pair timeForDIP = std::make_pair(0, 1); - BSOnline->SetStartTimeStamp(timeForDIP.first); - BSOnline->SetStartTime(getGMTstring(timeForDIP.first)); - BSOnline->SetEndTimeStamp(timeForDIP.second); - BSOnline->SetEndTime(getGMTstring(timeForDIP.second)); + BSOnline.SetStartTimeStamp(timeForDIP.first); + BSOnline.SetStartTime(getGMTstring(timeForDIP.first)); + BSOnline.SetEndTimeStamp(timeForDIP.second); + BSOnline.SetEndTime(getGMTstring(timeForDIP.second)); edm::LogInfo("FakeBeamMonitor") << "FitAndFill::[PayloadCreation] BeamSpotOnline object created: \n" << std::endl; - edm::LogInfo("FakeBeamMonitor") << *BSOnline << std::endl; - //std::cout << "------------------> fitted BS: " << *BSOnline << std::endl; + edm::LogInfo("FakeBeamMonitor") << BSOnline << std::endl; // Create the payload for BeamSpotOnlineObjects object if (onlineDbService_.isAvailable()) { @@ -1444,25 +1441,25 @@ void FakeBeamMonitor::FitAndFill(const LuminosityBlock& lumiSeg, int& lastlumi, onlineDbService_->logger().logInfo() << "\n" << bs; onlineDbService_->logger().logInfo() << "FakeBeamMonitor::FitAndFill - [PayloadCreation] BeamSpotOnline object created:"; - onlineDbService_->logger().logInfo() << "\n" << *BSOnline; + onlineDbService_->logger().logInfo() << "\n" << BSOnline; onlineDbService_->logger().logInfo() << "FakeBeamMonitor - Additional parameters for DIP:"; - onlineDbService_->logger().logInfo() << "Events used in the fit: " << BSOnline->GetUsedEvents(); - onlineDbService_->logger().logInfo() << "Mean PV : " << BSOnline->GetMeanPV(); - onlineDbService_->logger().logInfo() << "Mean PV Error : " << BSOnline->GetMeanErrorPV(); - onlineDbService_->logger().logInfo() << "Rms PV : " << BSOnline->GetRmsPV(); - onlineDbService_->logger().logInfo() << "Rms PV Error : " << BSOnline->GetRmsErrorPV(); - onlineDbService_->logger().logInfo() << "Max PVs : " << BSOnline->GetMaxPVs(); - onlineDbService_->logger().logInfo() << "StartTime : " << BSOnline->GetStartTime(); - onlineDbService_->logger().logInfo() << "StartTimeStamp : " << BSOnline->GetStartTimeStamp(); - onlineDbService_->logger().logInfo() << "EndTime : " << BSOnline->GetEndTime(); - onlineDbService_->logger().logInfo() << "EndTimeStamp : " << BSOnline->GetEndTimeStamp(); + onlineDbService_->logger().logInfo() << "Events used in the fit: " << BSOnline.GetUsedEvents(); + onlineDbService_->logger().logInfo() << "Mean PV : " << BSOnline.GetMeanPV(); + onlineDbService_->logger().logInfo() << "Mean PV Error : " << BSOnline.GetMeanErrorPV(); + onlineDbService_->logger().logInfo() << "Rms PV : " << BSOnline.GetRmsPV(); + onlineDbService_->logger().logInfo() << "Rms PV Error : " << BSOnline.GetRmsErrorPV(); + onlineDbService_->logger().logInfo() << "Max PVs : " << BSOnline.GetMaxPVs(); + onlineDbService_->logger().logInfo() << "StartTime : " << BSOnline.GetStartTime(); + onlineDbService_->logger().logInfo() << "StartTimeStamp : " << BSOnline.GetStartTimeStamp(); + onlineDbService_->logger().logInfo() << "EndTime : " << BSOnline.GetEndTime(); + onlineDbService_->logger().logInfo() << "EndTimeStamp : " << BSOnline.GetEndTimeStamp(); onlineDbService_->logger().logInfo() << "FakeBeamMonitor::FitAndFill - [PayloadCreation] onlineDbService available"; onlineDbService_->logger().logInfo() << "FakeBeamMonitor::FitAndFill - [PayloadCreation] SetCreationTime: " << creationTime << " [epoch in microseconds]"; try { onlineDbService_->writeIOVForNextLumisection(BSOnline, recordName_); onlineDbService_->logger().logInfo() - << "FakeBeamMonitor::FitAndFill - [PayloadCreation] writeForNextLumisection executed correctly"; + << "FakeBeamMonitor::FitAndFill - [PayloadCreation] writeIOVForNextLumisection executed correctly"; } catch (const std::exception& e) { onlineDbService_->logger().logError() << "FakeBeamMonitor - Error writing record: " << recordName_ << " for Run: " << frun << " - Lumi: " << LSRange.second; diff --git a/DQM/EcalMonitorClient/BuildFile.xml b/DQM/EcalMonitorClient/BuildFile.xml index 7924948a41352..1a014144d9eea 100644 --- a/DQM/EcalMonitorClient/BuildFile.xml +++ b/DQM/EcalMonitorClient/BuildFile.xml @@ -5,6 +5,8 @@ + + diff --git a/DQM/EcalMonitorClient/interface/MLClient.h b/DQM/EcalMonitorClient/interface/MLClient.h new file mode 100644 index 0000000000000..d8d8a2af92ba8 --- /dev/null +++ b/DQM/EcalMonitorClient/interface/MLClient.h @@ -0,0 +1,41 @@ +#ifndef MLClient_H +#define MLClient_H + +#include "DQWorkerClient.h" +#include +#include +#include + +namespace ecaldqm { + + class MLClient : public DQWorkerClient { + public: + MLClient(); + ~MLClient() override {} + + void producePlots(ProcessType) override; + + private: + void setParams(edm::ParameterSet const&) override; + + //Each Ecal Barrel occupancy map is plotted at the tower level + //34 towers in the eta and 72 towers in the phi directions + static const int nEtaTowers = 34; + static const int nPhiTowers = 72; + //After padding with two rows above and below to prevent the edge effect, 36 towers in eta direction + static const int nEtaTowersPad = 36; + float MLThreshold_; + float PUcorr_slope_; + float PUcorr_intercept_; + size_t nLS = 3; //No.of lumisections to add the occupancy over + size_t nLSloss = 6; //No.of lumisections to multiply the loss over + + std::deque NEventQ; //To keep the no.of events in each occupancy plot + std::deque> ebOccMap1dQ; //To keep the input occupancy plots to be summed + std::vector avgOcc_; //To keep the average occupancy to do response correction + std::deque>> lossMap2dQ; //To keep the ML losses to be multiplied + }; + +} // namespace ecaldqm + +#endif diff --git a/DQM/EcalMonitorClient/python/EcalMonitorClient_cfi.py b/DQM/EcalMonitorClient/python/EcalMonitorClient_cfi.py index a1edaffcc048e..0841ea2b5cc67 100644 --- a/DQM/EcalMonitorClient/python/EcalMonitorClient_cfi.py +++ b/DQM/EcalMonitorClient/python/EcalMonitorClient_cfi.py @@ -11,6 +11,7 @@ from DQM.EcalMonitorClient.TimingClient_cfi import ecalTimingClient from DQM.EcalMonitorClient.TrigPrimClient_cfi import ecalTrigPrimClient from DQM.EcalMonitorClient.SummaryClient_cfi import ecalSummaryClient +from DQM.EcalMonitorClient.MLClient_cfi import ecalMLClient ecalMonitorClient = DQMEDHarvester("EcalDQMonitorClient", moduleName = cms.untracked.string("Ecal Monitor Client"), @@ -22,6 +23,7 @@ "RawDataClient", "TrigPrimClient", "TimingClient", + "MLClient", "SummaryClient" ), # task parameters (included from indivitual cfis) @@ -33,7 +35,8 @@ SelectiveReadoutClient = ecalSelectiveReadoutClient, TimingClient = ecalTimingClient, TrigPrimClient = ecalTrigPrimClient, - SummaryClient = ecalSummaryClient + SummaryClient = ecalSummaryClient, + MLClient = ecalMLClient ), commonParameters = ecalCommonParams, verbosity = cms.untracked.int32(0) diff --git a/DQM/EcalMonitorClient/python/MLClient_cfi.py b/DQM/EcalMonitorClient/python/MLClient_cfi.py new file mode 100644 index 0000000000000..b5aca211b590a --- /dev/null +++ b/DQM/EcalMonitorClient/python/MLClient_cfi.py @@ -0,0 +1,411 @@ +import FWCore.ParameterSet.Config as cms + +from DQM.EcalMonitorTasks.OccupancyTask_cfi import ecalOccupancyTask + +#parameters dervied from training +MLThreshold = 0.1761 +PUcorr_slope = 8625.62354249 +PUcorr_intercept= 354776.97564344 +#Avg Occupancy of 2018 data +avgOcc = (1.4228867,1.4111477,1.4235557,1.403253 ,1.2926203,1.3110067,1.4317631, + 1.3582464,1.3350165,1.3870461,1.4315553,1.4340966,1.3463646,1.4664359, + 1.4383692,1.4883132,1.4921986,1.4414848,1.4935918,1.5053873,1.4814812, + 1.4806937,1.4688585,1.3852754,1.2133822,1.217942 ,1.2934631,1.2623638, + 1.4084297,1.2852081,1.3383209,1.3197039,1.2672714,1.2089411,1.2792134, + 1.2820784,1.2973225,1.2019042,0.0000001,1.2586329,1.424472 ,1.4129552, + 1.5303715,1.5035893,1.3739808,1.4674091,1.3101934,1.3559604,1.3654169, + 1.3723816,1.351616 ,1.3782867,1.6634412,1.6218939,1.5776167,1.5967489, + 1.4352198,1.4457697,1.5257363,1.5936497,1.2177914,1.1892394,1.2968882, + 1.2645309,1.333104 ,1.246442 ,1.2484925,1.2413881,1.3511598,1.3742812, + 1.3659753,1.3767184,1.4228867,1.4111477,1.4235557,1.403253 ,1.2926203, + 1.3110067,1.4317631,1.3582464,1.3350165,1.3870461,1.4315553,1.4340966, + 1.3463646,1.4664359,1.4383692,1.4883132,1.4921986,1.4414848,1.4935918, + 1.5053873,1.4814812,1.4806937,1.4688585,1.3852754,1.2133822,1.217942 , + 1.2934631,1.2623638,1.4084297,1.2852081,1.3383209,1.3197039,1.2672714, + 1.2089411,1.2792134,1.2820784,1.2973225,1.2019042,0.0000001,1.2586329, + 1.424472 ,1.4129552,1.5303715,1.5035893,1.3739808,1.4674091,1.3101934, + 1.3559604,1.3654169,1.3723816,1.351616 ,1.3782867,1.6634412,1.6218939, + 1.5776167,1.5967489,1.4352198,1.4457697,1.5257363,1.5936497,1.2177914, + 1.1892394,1.2968882,1.2645309,1.333104 ,1.246442 ,1.2484925,1.2413881, + 1.3511598,1.3742812,1.3659753,1.3767184,1.1556679,1.3391551,1.373256 , + 1.3540887,1.2471408,1.2453951,1.2790504,1.3212276,1.3020328,1.3587664, + 1.3487176,1.3814243,1.3593339,1.3286781,1.2952926,1.3192601,1.4060221, + 1.4540101,1.4574795,1.3729581,1.4051903,1.3568325,1.3918067,1.4169109, + 1.3129637,1.2971104,1.2642334,1.289142 ,1.3558336,1.2786664,1.296219 , + 1.298685 ,1.2628139,1.2494673,1.294434 ,1.2733648,1.2478417,1.1872551, + 1.2146964,2.0395069,1.5262315,1.4894062,1.4284101,1.4169872,1.352527 , + 1.3618537,1.3673831,1.334716 ,1.3480678,1.4098777,1.4061071,1.3918567, + 1.5523838,1.5230404,1.4913341,1.4753877,1.4160846,1.4024036,1.4175566, + 1.4888357,1.2680489,1.2883663,1.3472272,1.3023057,1.3586241,1.3383816, + 1.2996044,1.3184984,1.3418843,1.3903407,1.4139845,1.4251099,1.305113 , + 1.2633995,1.2851918,1.2743814,1.1825788,1.2547469,1.2440559,1.2770063, + 1.2717891,1.3396428,1.3710004,1.3859975,1.2798804,1.2516749,1.2677492, + 1.2683048,1.2613889,1.2783653,1.2966883,1.2827859,1.3206561,1.3148078, + 1.2636309,1.3001962,1.2161207,1.1910689,1.1688411,1.1911243,1.2880307, + 1.2225945,1.2570652,1.2086593,1.2767646,1.2320539,1.1953772,1.2159386, + 1.2037021,1.1857734,1.1674342,1.1956853,1.3138844,1.2758864,1.2300162, + 0.6665614,1.3036094,1.3088627,1.2554388,1.2967263,1.2841691,1.2875917, + 1.3089112,1.3331639,1.266067 ,1.2455457,1.2334898,1.2674097,1.276027 , + 1.1690655,1.1995609,1.199487 ,1.1338224,1.1563799,1.2194781,1.2064027, + 1.2493043,1.2673064,1.2891188,1.2735461,1.2408122,1.2415621,1.254231 , + 1.2100532,1.226575 ,1.2035872,1.2445701,1.1773577,1.1374254,1.1708428, + 1.1746327,1.1776469,1.2238355,1.2399627,1.2557915,1.2581828,1.1821021, + 1.1796409,1.2347831,1.248196 ,1.2299678,1.2151593,1.2597338,1.2399808, + 1.1583205,1.1536306,1.2159789,1.3336231,1.1655421,1.1663706,1.5020412, + 1.1574144,1.1892532,1.1677798,1.1635669,1.1543789,1.3043314,1.1876005, + 0.9521286,1.2199527,1.0653542,1.0589734,1.117103 ,1.0546287,1.2312565, + 1.1999464,1.1566527,1.1649921,1.246702 ,1.2841538,1.2533325,1.180725 , + 1.2153618,1.2312846,1.3220999,1.1518214,1.1985146,1.1956019,1.2026757, + 1.220378 ,1.2158185,1.1656332,1.1459147,1.1440367,0.0000001,1.106721 , + 1.2046571,1.1799783,1.1971282,1.2399644,1.2104925,1.1782469,1.2648659, + 1.2725782,1.2706518,1.2750179,1.1781482,1.1746165,1.1428392,1.1554896, + 1.08052 ,1.1252075,1.0796442,1.0661097,1.1994307,1.1427931,1.1547704, + 1.1450479,1.1638263,1.1558805,1.1312499,1.1190377,1.1767929,1.1355052, + 1.1739364,1.1897258,1.1543195,1.2075775,1.1802915,1.1443394,1.0686296, + 1.0484798,1.1059129,1.1041118,1.0907497,1.0863662,1.0989137,1.1160423, + 1.1354574,1.0911841,1.0848287,1.0849218,1.0303825,1.0509577,1.1060627, + 1.0906715,1.163807 ,1.1446611,1.1357274,1.1637452,1.1761752,1.1996605, + 1.1433704,1.1708797,1.0934016,1.1287714,1.1213528,0.9135892,1.1128932, + 1.1062543,1.0822164,1.1020374,1.1105623,1.0700424,1.0619079,1.1016523, + 1.0585421,1.0115267,1.031876 ,1.0759147,1.1201001,1.1058998,1.0973803, + 1.1015209,1.1435407,1.14981 ,1.1311004,1.1691828,1.1759555,1.1401734, + 1.1672325,1.1874546,1.0948305,1.0863739,1.1059391,1.0986216,1.1788837, + 1.1270268,1.1239996,1.1002039,1.1389588,1.141233 ,1.083227 ,1.0877259, + 1.1431438,1.1221772,1.1199503,1.1654431,1.1736141,1.1989235,1.1978018, + 1.167959 ,1.0133513,1.0567273,1.0395187,1.0680603,1.0610994,1.0597148, + 1.0684566,1.0339921,1.1405144,1.1203558,1.0788041,1.0960815,1.0242732, + 0.9811422,1.0137647,1.0043021,1.1159075,1.1183313,1.1035389,1.1150508, + 1.117763 ,1.1088306,1.0894555,1.1437987,1.1288823,1.1197007,1.1289188, + 1.1122833,1.1094319,1.0663022,1.0441525,1.0901659,1.1118773,1.1093612, + 1.0880778,1.0673048,1.0135869,0.9895969,1.0111624,0.994159 ,1.157239 , + 1.1461102,1.0853236,1.0694305,1.2243338,1.1992161,1.1530303,1.2302727, + 1.1132525,1.0987779,1.1112196,1.0841962,1.1152277,1.0965806,1.1059502, + 1.0867471,1.1308132,1.1056805,1.0888016,1.073627 ,1.1095271,1.0971298, + 1.0672264,1.0892332,1.1054503,1.0687332,1.0934203,1.1355063,1.24187 , + 1.2197568,1.2120614,1.1968735,1.0238991,0.9819736,0.9891209,1.0145121, + 1.0608021,1.0184129,1.0311555,1.0517814,1.1033106,1.0689223,1.0606674, + 1.0605292,1.0284557,0.971954 ,0.9526132,1.04703 ,1.128279 ,1.0795844, + 1.0738314,1.107188 ,1.1450828,1.1231935,1.0905402,1.1256251,1.1096694, + 1.0497596,1.0524868,1.0812023,1.0472693,1.0021344,1.0382787,1.0649058, + 1.0950122,1.0948782,1.0399659,1.0673079,1.0342895,1.0013512,0.9988917, + 1.0112954,1.0890151,1.042002 ,1.041176 ,1.0243192,1.1275606,1.1135633, + 1.1377431,1.1745214,1.1230987,1.0614204,1.0361215,1.1119354,1.0850902, + 1.0927483,1.1078453,1.077041 ,1.0753678,1.0642383,1.067675 ,1.1028837, + 1.0942855,1.0852079,1.0798481,1.088132 ,1.1058763,1.0810122,1.0625142, + 1.1011781,1.1856151,1.196195 ,1.1612228,1.1422418,0.9793076,0.9765419, + 0.9804395,1.0156407,1.0480926,1.0464298,1.0522102,1.0688092,1.1212629, + 1.0395747,0.9926344,1.0080917,1.0007402,0.9855192,0.9907292,0.9954209, + 1.1032989,1.0986856,1.1330308,1.1098777,1.1356755,1.1181957,1.113232 , + 1.1295322,1.1084793,1.0193369,1.0491607,1.0724577,1.0785445,1.0371226, + 0.0036721,1.0269073,1.0965271,1.0695037,1.0664477,1.087617 ,0.9891936, + 0.9989811,1.0070362,1.0190035,1.0781424,1.0664753,1.0687553,1.0421116, + 1.1388807,1.1237614,1.1355482,1.1830119,1.0553507,1.044697 ,1.0408233, + 1.0398819,1.0669746,1.0332361,1.0301825,0.9893497,1.059479 ,1.0278772, + 1.0176086,1.0205175,1.0467259,1.0548677,1.0646734,1.0527669,1.0866866, + 1.0472943,1.0426059,1.0849829,1.0999873,1.1246853,1.1031482,1.0814158, + 0.9405594,0.9336581,0.9254869,0.9352036,1.0345708,0.9965525,0.9950148, + 1.0257301,1.1129664,0.9780049,0.9502401,0.9700456,1.0284607,1.0213796, + 0.9910805,1.0367672,1.0796332,1.0587161,1.0674927,1.0761822,1.0794786, + 1.0831254,1.0830816,1.1075894,0.0126334,0.92802 ,0.9371951,0.9496164, + 1.0454251,1.0489166,1.0143294,1.0061715,1.0771358,1.0521995,1.0829998, + 1.0526272,0.9770707,0.9811446,0.9211687,0.947929 ,1.0504178,0.0000001, + 1.0035456,1.0284821,1.1091976,1.0872326,1.0880209,1.133727 ,1.014713 , + 0.9581099,0.9811009,1.0093567,1.0370228,0.989569 ,0.9988301,0.9841469, + 0.9527792,0.9855899,0.9826103,0.9610231,1.0160042,0.9992726,1.0005047, + 0.9965398,1.0511478,0.9744592,1.0089016,1.0331134,1.0977989,1.0927752, + 1.0878357,1.0548981,0.9570927,0.9533063,0.9489567,0.9408886,0.9869403, + 0.9708263,0.9788091,0.9671838,0.9488644,0.9382011,0.9179539,0.9175838, + 0.9908231,0.933664 ,0.9034764,0.929096 ,1.0545647,0.9846775,1.0010679, + 0.9964607,1.0280262,1.0288763,0.9798051,0.9853348,0.9509227,0.9410004, + 0.8996611,0.9309286,1.0092912,0.9800311,0.9862539,0.9823382,0.9956134, + 0.9848503,0.9927089,0.9988752,0.9427151,0.9123654,0.9192433,0.9211756, + 0.9682457,0.9614248,0.940841 ,2.9108264,1.0182347,1.0328737,1.0335125, + 1.0162688,0.9742591,0.9400508,0.9223933,0.9612672,0.9902653,0.9835137, + 0.9622135,0.9489338,0.9200854,0.9142317,0.9246915,0.9710323,0.9510582, + 0.986548 ,0.9715658,0.9551507,0.9795502,0.9373934,0.9590609,0.9864878, + 1.0536214,1.0606204,1.0470799,1.0450804,0.9423648,0.9130962,1.2390996, + 0.9090152,0.9728571,0.9594254,0.9378965,0.9442697,0.9128348,0.9111411, + 0.8573027,0.9057387,0.8775638,0.8585867,0.871328 ,0.8851443,1.0256898, + 0.9997756,1.0087074,0.9802992,1.0048345,0.986007 ,0.9939928,0.9924014, + 0.9393591,0.8975831,0.9569556,0.9221528,1.0005504,0.9573966,0.9446875, + 0.9525049,0.9864134,0.9616978,0.9709904,0.9688258,0.9331638,0.8939223, + 0.9041911,0.9179978,0.9570236,0.9535987,0.9462896,0.9406717,1.0385262, + 1.0471946,1.0040003,1.0764723,0.9440772,0.9303069,0.9388188,0.9624437, + 0.9522971,0.9236505,0.921064 ,0.9153899,0.9239462,0.9149684,0.9110753, + 0.9250061,0.9977021,0.9575272,0.9395442,0.9242274,0.8905004,1.215517 , + 0.9538251,0.9689807,1.0420041,1.0098691,1.0688168,0.9420413,0.9071479, + 0.9233371,0.8648853,0.9046464,0.944227 ,0.9231179,0.9260064,0.9462502, + 0.8824298,0.0000001,0.8896712,0.9343744,0.9496966,0.9062078,0.9076006, + 0.8920029,0.9911788,0.9509735,0.9620247,0.9532838,0.9553664,0.966219 , + 0.9766419,0.9830272,0.9704874,0.9066846,0.9014828,0.9114758,0.9525748, + 0.9449465,0.9234739,0.9165454,0.9440705,0.9461663,0.936758 ,0.9713703, + 0.9236538,0.9208513,0.891026 ,0.8855084,0.9444764,0.9177411,0.9162141, + 0.9445439,1.0220059,1.0118829,1.0278999,1.0203037,0.9124752,0.8955967, + 0.9001777,0.8839747,0.8924397,0.884959 ,0.9014532,0.8925565,0.7268787, + 0.8359309,0.8754961,0.8911034,0.9268813,0.9161255,0.9086187,0.853088 , + 0.9073059,0.8781778,0.9306351,0.9155804,0.9369089,0.9953336,0.9929911, + 0.9851077,0.8977557,0.8955045,0.8884436,0.8941315,0.921898 ,0.8701018, + 0.9078636,0.8981934,0.8977088,0.8691131,0.8413706,0.8976212,0.876539 , + 1.4657505,0.8280094,0.8627123,0.9547047,0.9364532,0.9272763,0.9186774, + 0.941437 ,0.9263571,0.9280555,0.9123494,0.9105576,0.9997209,0.9331673, + 0.9702676,0.911276 ,0.8823292,0.9235324,0.915177 ,0.9073598,0.8663465, + 0.8806252,0.8953832,0.8542768,0.8170022,0.8364354,0.8324253,0.9117646, + 0.8914846,0.882292 ,0.8745112,0.9651436,0.9339125,0.908168 ,0.8983836, + 1.0204283,1.014069 ,0.8514856,0.8366709,0.0000001,0.8435681,0.8716656, + 0.8663046,0.8687047,0.8607368,0.853239 ,0.8538001,0.9117879,0.8984275, + 0.9074128,0.8910619,0.9175624,0.9058829,0.9104028,0.9016951,0.9979504, + 1.0018495,0.9727136,0.9829723,0.8593063,0.8864803,0.8331164,0.8243229, + 0.8761157,0.84732 ,0.8649628,0.8924447,0.8528641,0.8461951,0.8256967, + 0.8219401,0.8493258,0.8396199,0.8288802,0.8688241,0.9221398,0.9144458, + 0.9145495,0.8767081,0.9111733,0.9246608,0.9190454,0.9145585,0.8979622, + 0.9213055,0.9043622,0.9187738,0.8733439,0.9010628,0.8879052,0.8862385, + 0.886833 ,0.8412263,0.8744929,0.8971784,0.7947825,0.7808067,0.720468 , + 0.7835823,0.8811975,0.8858461,0.8736796,0.8753381,0.9216196,0.9133907, + 0.877441 ,0.9787805,0.8858882,1.0329753,0.8817087,0.0000001,0.8540137, + 0.8454756,0.8776406,0.8772608,0.878461 ,0.817844 ,0.8320211,0.7978509, + 0.9232702,0.9232559,0.9103069,0.9115226,0.9466796,0.9346468,0.9280509, + 0.9378798,0.9828502,0.9918494,0.9742755,0.9657697,0.8602819,0.8742782, + 0.8663973,0.8632851,0.9069272,0.8904232,0.892713 ,0.9054623,0.8925498, + 0.868188 ,0.8912911,0.8767484,0.8553541,0.8425062,0.8211766,0.8539204, + 0.9321883,0.9126161,0.9168343,0.8570537,0.8895695,0.8795208,0.9255748, + 0.9180104,0.9300255,0.9378335,0.9242839,0.9336899,0.920904 ,2.8812766, + 0.9271864,0.8993225,0.8857986,0.8936499,0.8895433,0.8900022,0.8410531, + 0.8081046,0.8150144,0.8173641,0.8881866,0.8837494,0.8417418,0.8877832, + 0.9664047,0.9465755,0.8891603,1.0593798,1.0501429,1.0378563,0.9041524, + 0.9222154,0.9227488,0.8894223,1.1206282,0.8359311,1.1750071,0.8632696, + 0.0000001,0.8440654,0.9061905,0.9033526,0.9075296,0.9265232,0.9251202, + 0.9390653,0.9226105,0.935118 ,1.0248573,0.9950228,1.016836 ,1.0150337, + 0.8846998,0.8870716,0.8825005,0.8993919,0.9015642,0.917635 ,0.9108042, + 0.9158255,0.8933692,0.8818774,0.8733479,0.8590702,0.8610741,0.8412985, + 0.8419823,0.8535126,0.9552853,0.9233503,0.9074404,0.8874421,0.0000001, + 0.9037543,0.9428068,0.9528409,0.8795176,0.8777585,0.9160822,0.9397873, + 0.9309441,0.9063056,0.9192985,0.9255057,0.9270568,0.9176704,0.9140722, + 0.9111696,0.8597785,0.8489559,0.843753 ,0.8581451,0.9068368,0.8959244, + 0.9229929,0.871972 ,0.9834073,0.9476991,0.9360896,1.081524 ,0.9255442, + 0.9070221,0.9115756,0.9298295,0.9134066,0.9056591,0.9027434,0.8674105, + 0.9019305,0.8612094,0.8585056,0.854815 ,0.0000001,0.9021256,0.9177787, + 0.9240243,0.9644239,0.9404687,0.9274049,0.9379409,1.0399606,1.033352 , + 1.0249641,1.0473272,0.8932669,0.9111941,0.8852406,0.8920174,0.9242499, + 0.9056967,0.9006191,0.9015262,0.9182317,0.9183906,0.9038095,0.904799 , + 0.8838023,0.8785893,0.8584824,0.8979258,0.9706077,0.9469935,0.9398977, + 0.894461 ,0.93994 ,0.923337 ,0.9488781,0.9627277,0.9054735,0.9163985, + 0.8944787,0.9150251,1.0493075,0.9096289,0.9115776,0.9412426,0.9343278, + 0.9121064,0.9117633,0.9251044,0.8971121,0.8652557,0.8633423,0.8604623, + 0.9248523,0.9076622,0.917069 ,0.8871456,0.7269943,0.9629616,0.9667225, + 0.9250519,0.9176884,0.8880241,0.9236936,0.9247792,1.0054232,1.0092628, + 0.9994277,0.9991693,0.9058928,0.91171 ,0.9149265,0.915843 ,0.8517995, + 1.2385432,0.8757702,0.8800565,0.9347579,0.9362207,0.9103072,0.9455385, + 0.8727469,0.8400666,0.8438162,0.8415763,0.9646621,0.9707538,0.9637925, + 0.9641757,0.9592127,0.952417 ,0.943792 ,0.925786 ,0.9483845,0.9503665, + 0.9362003,0.9343288,0.9373538,0.9214206,0.9170751,0.9483343,0.9092611, + 0.9025595,0.9094557,0.8846688,0.9492338,0.9302807,0.9313844,0.9440831, + 0.9525137,0.9451442,0.9452839,0.9544351,1.036723 ,1.0263921,0.9881323, + 0.9197441,0.9673854,0.9597923,0.9846507,0.9979741,0.9559562,0.9387934, + 0.9402372,0.9639017,0.9070854,0.9081604,0.8969148,0.8985816,0.8914095, + 0.9212565,0.9167472,0.9287409,0.902436 ,0.8889644,0.8948577,0.9066438, + 0.9909534,0.9763708,0.9878008,0.9885211,0.8955337,0.8991327,0.8798093, + 0.8914046,0.8749264,0.8727064,0.8536081,0.8715125,0.8831692,0.8919016, + 0.890573 ,0.8926457,0.8800267,0.8306233,0.0000001,0.8467921,0.9303848, + 0.9340462,0.9263893,0.9474682,0.9142375,0.9178317,0.8966044,0.8933908, + 1.0630243,0.9105239,0.8925556,0.908989 ,0.9122123,0.894343 ,0.9251699, + 0.9552048,0.900656 ,0.8886392,0.9272086,0.8625895,0.9300183,0.934134 , + 0.9291555,0.9527701,0.9416874,0.9565993,0.9468805,0.9310883,0.9963626, + 0.981036 ,0.9834724,0.8948759,0.8951459,0.9467054,1.045526 ,0.9973741, + 0.9467732,0.9394466,0.9388553,0.9175566,0.8865193,0.8930401,0.8786154, + 0.8805791,0.9849347,0.8849503,0.9020472,0.9081354,0.8883678,0.8618975, + 0.8621318,0.8847593,0.9791163,0.9981784,0.9598348,0.9630426,0.8954888, + 0.9089435,0.906523 ,0.9254694,0.8724284,1.549498 ,0.854642 ,0.8899876, + 0.884106 ,0.8911538,0.8788657,0.8989016,0.8683069,0.8187966,0.8331737, + 0.8169547,0.9497713,0.9372764,0.9718387,0.9716983,0.8817951,0.9177381, + 0.9272385,0.9305192,0.9138 ,0.8917226,0.9022007,0.8728969,0.8857559, + 0.8511966,0.8776945,0.9188874,0.8799872,0.8727769,0.8972793,0.8775748, + 0.9025099,0.9059016,0.9018834,0.9358472,0.9280242,0.9306515,0.930319 , + 0.9408762,0.9894212,0.9801961,0.9481966,0.930518 ,0.9068527,0.926452 , + 0.9481174,0.9932294,0.9508854,0.9168876,0.8955552,0.9298086,0.8856096, + 0.8778232,0.8678781,0.8428098,0.8649303,0.8521905,0.8853881,0.896262 , + 0.8637611,0.8508386,0.8579808,0.8781487,0.9782724,0.9819542,0.967945 , + 0.9718521,0.8657284,0.8617702,0.8596571,0.8718904,0.815865 ,0.9508535, + 0.8448715,0.8618798,0.9203976,0.8956626,0.9108895,0.9208714,0.8267219, + 0.8333327,0.8175609,0.8405349,0.9207596,0.9302374,0.922721 ,0.9375702, + 0.8972806,0.9022034,0.9092163,0.8919818,0.9115573,0.8941678,0.9727003, + 0.8788491,0.8066372,0.8540529,0.8720537,0.9097501,0.881356 ,0.8739368, + 0.9094095,0.8718069,0.9059213,0.9068483,0.8904512,0.903352 ,0.9266117, + 0.9053527,0.8990905,0.9183056,0.9928399,0.9813229,0.9759782,0.9492933, + 0.9382915,0.9312818,0.9518742,0.9820717,0.9150143,0.8835462,0.905087 , + 0.9380701,0.8669695,0.8730215,0.8537797,0.842343 ,0.8181646,0.8662508, + 0.8914459,0.8917838,0.8953646,0.8582759,0.8843335,0.9019104,0.9775726, + 0.9695851,0.9684169,0.9945092,0.8906423,0.9011754,0.8905966,0.9067472, + 0.8615755,0.8759038,0.8511059,0.8939573,0.9214789,0.8934948,0.9003874, + 0.9254834,0.8977927,0.8781966,0.8783478,0.8897681,0.9544448,0.9752168, + 0.9538611,0.9523727,0.8953019,0.8955504,0.8835472,0.9036127,0.9425184, + 0.9428679,0.9121487,0.8942021,0.8973826,0.8607216,0.8798548,0.9563062, + 0.9242093,0.8927971,0.9064167,0.8659616,0.9165348,0.9324718,0.9197962, + 0.9270453,0.9173116,0.9100388,0.8664268,0.9012297,0.9287284,0.9629037, + 0.9950356,1.0044856,0.9998307,0.9981116,1.0173699,1.0312284,0.9523295, + 0.927979 ,0.9188983,0.9468584,0.8899338,0.8799069,0.8932109,0.8625482, + 0.8758663,0.8662992,0.8897169,0.8896759,0.9471669,0.8646078,0.9203457, + 0.9465771,1.0671935,1.0762529,1.0574509,1.0543979,0.950247 ,0.9430968, + 0.9417606,0.960602 ,0.8665491,0.8781953,0.8720518,0.8933613,0.9384555, + 0.9348907,0.9343287,0.9597977,0.9400162,0.9181851,0.9304919,0.9181332, + 0.9856796,0.989359 ,0.979789 ,0.9625634,1.0298804,0.9681855,0.926324 , + 0.9493014,0.952226 ,0.9659102,0.9622204,0.9933803,0.9975445,0.9534022, + 0.9508471,1.0023971,0.925873 ,0.9181251,0.9037386,0.9369083,0.9686341, + 0.951229 ,0.9527286,0.9704438,0.952726 ,0.9563661,0.9672213,0.9009546, + 0.891305 ,0.9141365,0.9042941,0.9908844,1.02451 ,1.0002937,1.0145459, + 1.0238333,0.9640087,0.9803975,0.9345359,0.9562771,0.9798419,0.9632123, + 0.9474075,0.9594575,0.9523167,0.9568143,0.9725029,0.9635358,0.8913772, + 0.9376766,0.9153062,0.9443082,1.0907506,1.0779955,1.0835589,1.077103 , + 0.94592 ,0.9423046,0.9353216,1.0058889,0.8812236,0.8900912,0.8739714, + 0.908954 ,0.9684916,0.9758947,0.9528789,0.9715638,0.9147444,0.9392554, + 0.9166325,0.9577266,1.0328426,1.0275623,0.9930462,1.0105317,1.0487862, + 1.0094688,0.9696991,0.9790145,0.9874703,0.9714156,1.0046459,0.9714112, + 0.9987967,0.9554723,0.9812179,1.0174359,0.9316527,0.9212265,0.9473284, + 0.9529327,0.9768106,0.9761072,0.9925398,1.0105116,0.9765943,0.9735287, + 0.9720789,0.9780715,0.8837507,0.9996244,1.0094591,0.963135 ,1.0569199, + 1.0577636,1.0485023,1.0917665,1.0001658,0.9943501,0.994733 ,0.9737829, + 0.9874289,0.9499856,0.9437758,0.9718275,0.9466712,0.9368256,0.9245117, + 0.9746943,0.9231877,0.94381 ,0.9099722,0.9743401,1.0912923,1.0798532, + 1.0705048,1.0671401,1.0020626,0.9723217,0.9538407,1.0237085,0.9082063, + 0.9232261,0.9122615,0.9056468,1.0189087,1.0061275,1.0277444,1.0416385, + 0.962988 ,0.9448321,0.9274885,0.9500597,1.0350192,1.0535637,1.0434896, + 1.0389384,1.0624195,1.0245159,1.0062119,1.0112492,0.9908073,1.0161494, + 1.0189636,1.0372617,1.0417999,0.9965699,0.98918 ,1.0221821,0.9552784, + 0.9465883,0.9436496,0.9627379,0.9957007,0.9908555,1.0349085,1.051325 , + 1.028265 ,0.9742572,0.9853188,1.0277784,1.0784379,1.0248644,1.003191 , + 1.053859 ,1.0747 ,1.0681137,1.0964813,1.1012894,1.0878161,1.0215803, + 1.0319945,1.0705597,1.0117067,1.0089118,0.9623004,0.9945062,0.9931936, + 0.9826046,0.9807656,0.9893571,0.9855912,0.9956348,1.0180117,1.0992355, + 1.1510247,1.1642762,1.1348028,1.173378 ,1.0495415,1.0537665,1.0280858, + 1.0769577,0.9539952,0.9503716,0.9480621,0.9564386,1.0447392,1.055281 , + 1.0632157,1.0446833,0.9611291,0.9580613,1.0140576,1.0192964,1.1120509, + 1.0763414,1.0876051,1.0807177,1.0965352,1.0385919,1.0403399,1.010437 , + 1.0453093,1.0263721,1.0174105,1.0635544,1.0635546,1.0340421,0.9741846, + 1.0584152,1.0422455,0.9897347,0.9849003,1.0250511,1.0373392,1.0450774, + 1.0938035,1.0942651,1.0443715,1.0503259,1.057446 ,1.0592597,1.0620625, + 1.1111387,1.1216173,1.07478 ,1.1132259,1.1209106,1.1106815,1.1423119, + 1.1024584,1.1221232,1.0857874,1.119742 ,1.0454632,1.0458753,1.0386395, + 1.0446345,1.0093486,1.031795 ,1.0488297,1.0821855,1.0077721,0.989686 , + 1.0048161,1.0512829,1.1880068,1.1788449,1.1607702,1.1446868,1.0427889, + 1.0694175,1.0607653,1.0898038,1.0094677,0.9899454,1.0312396,1.035437 , + 1.1059195,1.1086949,1.0641108,1.0961732,0.9638143,0.9419206,0.9821325, + 1.029164 ,1.1191941,1.1493175,1.1181508,1.1407369,1.1214831,1.0663868, + 1.0815727,1.1323632,1.080952 ,1.0808178,1.0681598,1.0592092,1.1199073, + 1.0957614,1.0681812,1.095979 ,1.0511014,1.0613471,1.0412358,1.0636799, + 1.1067268,1.0797632,1.0823264,1.1153238,1.1133441,1.0766457,1.0854424, + 1.0825747,1.0796758,1.077734 ,1.0952778,1.0772076,1.116454 ,1.1395183, + 1.1075819,1.1624501,1.1176701,1.0958973,1.1218029,1.1186683,1.0628506, + 1.1145004,1.082948 ,2.0175941,1.0875287,1.1025825,1.0269455,1.051285 , + 1.0476145,1.0404844,1.04963 ,1.0591438,1.1902895,1.2070227,1.070815 , + 1.1989648,1.0498666,1.0610474,1.0391423,1.1304657,1.0339167,0.9998445, + 1.0041345,1.0160474,1.0799819,1.0712526,1.0879661,1.1218227,1.009931 , + 0.9974062,1.0133066,1.0665259,1.146356 ,1.11963 ,1.1033186,1.1570126, + 1.0548068,1.0348623,1.0482756,1.0204102,1.1040101,1.0592386,0.0000001, + 1.0342314,1.103851 ,1.1129369,1.086817 ,1.1150911,1.0553069,1.1031967, + 1.0349835,1.0537988,1.057883 ,1.0326748,1.0403845,1.0982782,1.1092652, + 1.1100249,1.0888118,1.2074842,1.0731583,1.0833149,1.0942907,1.1083862, + 1.1723955,1.1690109,1.1536716,1.1711152,1.0897936,1.0986527,1.1139878, + 1.1540499,1.1051458,1.0760595,1.0817837,1.0871581,1.0496042,1.0790346, + 1.0484509,1.0936309,1.1005198,1.0929288,1.0838492,1.0982997,1.1599445, + 1.1893239,1.1655681,1.2092586,1.0883923,0.0000001,1.0871845,1.1466825, + 1.0404817,1.0230678,1.0366768,1.0639437,1.1151003,1.1272596,1.1084887, + 1.172429 ,1.0334686,1.056801 ,1.0597215,1.1326951,1.1498877,1.1962935, + 1.1868553,1.197981 ,1.1254083,1.1704431,1.1394123,1.1020141,1.1297313, + 1.0543509,1.0454857,1.0557848,1.1286277,1.1447449,1.1176616,1.1541518, + 1.0896667,1.0803887,1.0532128,1.092551 ,1.1030624,1.1308889,1.1280392, + 1.1362039,1.1384581,1.1629614,1.1217985,1.1243501,1.1104747,1.1264488, + 1.1229146,1.1263402,1.1778469,1.1807829,1.1596237,1.2130113,1.1391164, + 1.1422114,1.1164465,1.1751232,1.1258872,1.099769 ,1.0997097,1.1154337, + 1.0979413,1.1053877,1.1027399,1.1099522,1.0839096,1.0836432,1.0714954, + 1.1008861,1.2654308,1.2331656,1.2076157,1.1879531,1.0935781,1.7174256, + 1.1764588,1.1788416,1.0990402,1.0679119,1.045539 ,1.0417056,1.1428436, + 1.11865 ,1.1203463,1.1667153,1.0560808,1.059954 ,1.0763974,1.0821347, + 1.1756307,1.2023616,1.1829935,1.1883497,1.0870489,1.095404 ,1.1019858, + 1.1221294,1.0918556,1.1270142,1.1056459,1.1165003,1.1656616,1.1915104, + 0.002418 ,1.1863734,1.1364913,1.1363342,1.1130465,1.110378 ,1.1059235, + 1.1423405,1.1317402,1.1555637,1.19754 ,1.2092884,1.1779846,1.1680648, + 1.0450194,1.0761367,1.0764713,1.0921346,1.2287006,1.1786282,1.1539404, + 1.1696078,1.1572577,1.1409811,1.1399884,1.1648638,1.1468616,1.1229811, + 1.126923 ,1.1402842,1.0744516,1.1010847,1.1182138,1.129174 ,1.1766611, + 1.1814339,1.1808836,1.2256684,1.1890299,1.09418 ,1.2673656,1.2581869, + 1.1922612,1.2071455,1.1834393,1.189612 ,1.1241446,1.1361836,1.2856306, + 1.0855542,1.1677229,1.129777 ,1.1726019,1.1948112,1.177284 ,1.1930918, + 1.2184905,1.2298344,1.2539822,1.2478415,1.2095121,1.2372787,1.1454738, + 3.1246946,1.1560615,1.1634603,1.2031316,1.1657577,1.1755668,1.1764408, + 1.2373508,1.2221774,1.2183428,1.238299 ,1.1809549,1.191622 ,1.151616 , + 1.2120161,1.1659451,1.1903535,1.1537067,1.2121307,1.2561139,1.2496953, + 1.2179667,1.1991129,1.0504661,1.1208445,1.0576257,1.0786569,1.2795471, + 1.2460271,1.2595681,1.2700136,1.2370667,1.2096518,1.1916556,1.193431 , + 1.0698317,1.144996 ,1.0978631,1.1083387,1.1395663,1.1424139,1.1672275, + 1.1997005,1.2066722,1.2632322,1.2644491,1.2359862,1.30099 ,1.3310392, + 1.3187488,1.3390772,1.2772553,1.2618415,1.2443427,1.2669835,1.1606162, + 1.1572101,1.166028 ,1.1820868,1.237196 ,1.2618593,1.2292744,1.2615335, + 1.2021271,1.2560732,1.0985605,1.1192125,1.2854187,1.2854668,1.2659054, + 1.2904642,1.204288 ,1.2769686,1.22887 ,1.2694381,1.262182 ,1.2492793, + 1.2524626,1.2057602,1.285684 ,1.3115458,1.3069377,1.3391898,1.2591854, + 1.2057227,1.2264768,1.2316214,1.2125773,1.228851 ,1.2327005,1.2707509, + 1.2734746,1.3064344,1.2484472,1.2517314,1.3417968,1.3300421,1.3112333, + 1.3796477,1.2670193,1.2653888,1.3392452,1.3002052,1.2524494,1.254415 , + 1.2804451,1.2688684,1.2028832,1.1860383,1.1875746,1.1912442,0.0000001, + 1.2032371,1.2014136,1.231438 ,1.3126636,1.331844 ,1.3611454,1.4050549, + 1.4224403,1.4060786,1.3756822,1.3766484,1.3069599,1.2942712,1.2930294, + 1.3145667,1.3122438,1.2794976,1.2148988,1.3100493,1.3224905,1.3191464, + 1.3389342,1.361294 ,1.2701417,1.3292892,1.1934788,1.2651747,1.5510794, + 1.4734362,1.4419538,1.4431967,1.2666522,1.2626339,1.2941803,1.3723079, + 1.3035368,1.3176153,1.2581673,1.2753432,1.3376918,1.3208125,1.3536242, + 1.4160626,1.4042524,1.344823 ,1.2438911,1.2328366,1.3651066,1.3063282, + 1.3048015,1.4230167,1.35694 ,1.4077983,1.3601282,1.3300114,1.3991088, + 1.4520401,1.4256567,1.3559659,1.4381483,1.4401627,1.3999768,1.4125986, + 1.5223697,1.4434851,1.4603108,1.5000014,1.2174413,1.2294974,1.2586482, + 1.216323 ,1.2512149,1.2926644,1.2528789,1.2970006,1.3622391,1.3856924, + 1.4004105,1.4416406,1.4794058,1.4634441,1.4094539,1.4000301,1.3603994, + 1.3507206,1.2953093,1.3714509,1.2608073,1.2605048,1.1679753,1.2375603, + 1.301859 ,1.3278127,1.3557078,1.3832617,1.2936115,1.3297484,1.3304836, + 1.3198843,1.5357888,1.5275854,1.4613336,1.3965021,1.2506508,1.2348884, + 1.2870482,1.3202029,1.3375303,0.0000001,1.298619 ,1.3328781,1.4041303, + 1.4315721,1.3459045,1.3987832,1.4487712,1.3514799,1.3224082,1.3118832, + 0.7346643,1.4961067,1.5317262,1.5882863,1.3276595,1.3988692,1.3189229, + 1.3246715,1.4484233,1.459936 ,1.4757891,1.4265023,1.3769624,1.4194289, + 1.4359689,1.4053208,1.5716549,1.5246555,1.4746208,1.34677 ,1.2433277, + 1.2356131,1.2907763,1.2757168,1.3311623,1.3449943,1.2992672,0.0000001, + 1.3622391,1.3856924,1.4004105,1.4416406,1.4794058,1.4634441,1.4094539, + 1.4000301,1.3603994,1.3507206,1.2953093,1.3714509,1.2608073,1.2605048, + 1.1679753,1.2375603,1.301859 ,1.3278127,1.3557078,1.3832617,1.2936115, + 1.3297484,1.3304836,1.3198843,1.5357888,1.5275854,1.4613336,1.3965021, + 1.2506508,1.2348884,1.2870482,1.3202029,1.3375303,0.0000001,1.298619 , + 1.3328781,1.4041303,1.4315721,1.3459045,1.3987832,1.4487712,1.3514799, + 1.3224082,1.3118832,0.7346643,1.4961067,1.5317262,1.5882863,1.3276595, + 1.3988692,1.3189229,1.3246715,1.4484233,1.459936 ,1.4757891,1.4265023, + 1.3769624,1.4194289,1.4359689,1.4053208,1.5716549,1.5246555,1.4746208, + 1.34677 ,1.2433277,1.2356131,1.2907763,1.2757168,1.3311623,1.3449943, + 1.2992672,0.0000001) + +ecalMLClient = cms.untracked.PSet( + params = cms.untracked.PSet( + MLThreshold = cms.untracked.double(MLThreshold), + PUcorr_slope = cms.untracked.double(PUcorr_slope), + PUcorr_intercept = cms.untracked.double(PUcorr_intercept), + avgOcc = cms.untracked.vdouble(avgOcc) + ), + sources = cms.untracked.PSet( + DigiAllByLumi = ecalOccupancyTask.MEs.DigiAllByLumi, + AELoss = ecalOccupancyTask.MEs.AELoss, + PU = ecalOccupancyTask.MEs.PU, + NumEvents = ecalOccupancyTask.MEs.NEvents + ), + MEs = cms.untracked.PSet( + MLQualitySummary = cms.untracked.PSet( + path = cms.untracked.string('%(subdet)s/%(prefix)sSummaryClient/%(prefix)sOT%(suffix)s ML quality summary'), + kind = cms.untracked.string('TH2F'), + otype = cms.untracked.string('Ecal3P'), + btype = cms.untracked.string('SuperCrystal'), + description = cms.untracked.string('Quality summary from the ML inference.') + ), + EventsperMLImage = cms.untracked.PSet( + path = cms.untracked.string('Ecal/Trends/Number of Events used per ML image'), + kind = cms.untracked.string('TProfile'), + otype = cms.untracked.string('Ecal2P'), + btype = cms.untracked.string('Trend'), + description = cms.untracked.string('Trend of the number of events in an image fed into the ML model') + ) + ) +) diff --git a/DQM/EcalMonitorClient/src/MLClient.cc b/DQM/EcalMonitorClient/src/MLClient.cc new file mode 100644 index 0000000000000..7154f3859e773 --- /dev/null +++ b/DQM/EcalMonitorClient/src/MLClient.cc @@ -0,0 +1,281 @@ +#include "DQM/EcalMonitorClient/interface/MLClient.h" + +#include "DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h" + +#include "CondFormats/EcalObjects/interface/EcalDQMStatusHelper.h" + +#include "DQM/EcalCommon/interface/EcalDQMCommonUtils.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "PhysicsTools/ONNXRuntime/interface/ONNXRuntime.h" + +#include "DQM/EcalCommon/interface/MESetNonObject.h" + +using namespace cms::Ort; + +namespace ecaldqm { + MLClient::MLClient() : DQWorkerClient() { qualitySummaries_.insert("MLQualitySummary"); } + + void MLClient::setParams(edm::ParameterSet const& _params) { + MLThreshold_ = _params.getUntrackedParameter("MLThreshold"); + PUcorr_slope_ = _params.getUntrackedParameter("PUcorr_slope"); + PUcorr_intercept_ = _params.getUntrackedParameter("PUcorr_intercept"); + avgOcc_ = _params.getUntrackedParameter>("avgOcc"); + if (!onlineMode_) { + MEs_.erase(std::string("MLQualitySummary")); + MEs_.erase(std::string("EventsperMLImage")); + sources_.erase(std::string("PU")); + sources_.erase(std::string("NumEvents")); + sources_.erase(std::string("DigiAllByLumi")); + sources_.erase(std::string("AELoss")); + } + } + + void MLClient::producePlots(ProcessType) { + if (!onlineMode_) + return; + using namespace std; + MESet& meMLQualitySummary(MEs_.at("MLQualitySummary")); + MESet& meEventsperMLImage(MEs_.at("EventsperMLImage")); + + MESetNonObject const& sPU(static_cast(sources_.at("PU"))); + MESetNonObject const& sNumEvents(static_cast(sources_.at("NumEvents"))); + + //Get the no.of events and the PU per LS calculated in OccupancyTask + int nEv = sNumEvents.getFloatValue(); + double pu = sPU.getFloatValue(); + //Do not compute ML quality if PU is non existent. + if (pu < 0.) { + return; + } + uint32_t mask(1 << EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR | + 1 << EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING | + 1 << EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_ERROR); + + //////////////// ML Data Preprocessing ////////////////////////////////// + //Inorder to feed the data into the ML model we apply some preprocessing. + //We use the Digi Occupancy per Lumisection as the input source. + //The model was trained on each occupancy plot having 500 events. + //In apprehension of the low luminosity in the beginning of Run3, where in online DQM + //the no.of events per LS could be lower than 500, we sum the occupancies over a fixed no.of lumisections as a running sum, + //and require that the total no.of events on this summed occupancy to be atleast 200. + //(This no.of LS and the no.of events are parameters which would require tuning later) + //This summed occupancy is now the input image, which is then corrected for PileUp(PU) dependence and + //change in no.of events, which are derived from training. + //The input image is also padded by replicating the top and bottom rows so as to prevent the "edge effect" + //wherein the ML model's learning degrades near the edge of the data set it sees. + //This padding is then removed during inference on the model output. + + //Get the histogram of the input digi occupancy per lumisection. + TH2F* hEbDigiMap((sources_.at("DigiAllByLumi")).getME(1)->getTH2F()); + + size_t nTowers = nEtaTowers * nPhiTowers; //Each occupancy map is of size 34x72 towers + std::vector ebOccMap1dCumulPad; //Vector to feed into the ML network + std::valarray ebOccMap1d(nTowers); //Array to store occupancy map of size 34x72 + //Store the values from the input histogram into the array + //to do preprocessing + for (int i = 0; i < hEbDigiMap->GetNbinsY(); i++) { //NbinsY = 34, NbinsX = 72 + for (int j = 0; j < hEbDigiMap->GetNbinsX(); j++) { + int bin = hEbDigiMap->GetBin(j + 1, i + 1); + int k = (i * nPhiTowers) + j; + ebOccMap1d[k] = hEbDigiMap->GetBinContent(bin); + } + } + ebOccMap1dQ.push_back(ebOccMap1d); //Queue which stores input occupancy maps for nLS lumis + NEventQ.push_back(nEv); //Queue which stores the no.of events per LS for nLS lumis + + if (NEventQ.size() < nLS) { + return; //Should have nLS lumis to add the occupancy over. + } + if (NEventQ.size() > nLS) { + NEventQ.pop_front(); //Keep only nLS consecutive LS. Pop the first one if size greater than nLS + } + if (ebOccMap1dQ.size() > nLS) { + ebOccMap1dQ.pop_front(); //Same conditon for the input occupancy maps. + } + + int TNum = 0; + for (size_t i = 0; i < nLS; i++) { + TNum += NEventQ[i]; //Total no.of events over nLS lumis + } + if (TNum < 200) { + return; //The total no.of events should be atleast 200 over nLS for meaningful statistics + } + //Fill the ME to monitor the trend of the total no.of events in each input image to the ML model + meEventsperMLImage.fill(getEcalDQMSetupObjects(), EcalBarrel, double(timestamp_.iLumi), double(TNum)); + + //Array to hold the sum of inputs, which make atleast 200 events. + std::valarray ebOccMap1dCumul(0., nTowers); + + for (size_t i = 0; i < ebOccMap1dQ.size(); i++) { + ebOccMap1dCumul += ebOccMap1dQ[i]; //Sum the input arrays of N LS. + } + //Applying PU correction derived from training + ebOccMap1dCumul = ebOccMap1dCumul / (PUcorr_slope_ * pu + PUcorr_intercept_); + + //Scaling up to match input dimensions. 36*72 used instead of 34*72 to accommodate the additional padding + //of 2 rows to prevent the "edge effect" which is done below + ebOccMap1dCumul = ebOccMap1dCumul * (nEtaTowersPad * nPhiTowers); + + //Correction for no.of events in each input image as originally model trained with 500 events per image + ebOccMap1dCumul = ebOccMap1dCumul * (500. / TNum); + + //The pre-processed input is now fed into the input tensor vector which will go into the ML model + ebOccMap1dCumulPad.assign(std::begin(ebOccMap1dCumul), std::end(ebOccMap1dCumul)); + + //Replicate and pad with the first and last row to prevent the edge effect + for (int k = 0; k < nPhiTowers; k++) { + float val = ebOccMap1dCumulPad[nPhiTowers - 1]; + ebOccMap1dCumulPad.insert(ebOccMap1dCumulPad.begin(), + val); //padding in the beginning with the first row elements + } + + int size = ebOccMap1dCumulPad.size(); + for (int k = (size - nPhiTowers); k < size; k++) { + float val = ebOccMap1dCumulPad[k]; + ebOccMap1dCumulPad.push_back(val); //padding at the end with the last row elements + } + + ///// Model Inference ////// + //An Autoencoder (AE) network with resnet architecture is used here which is trained on + //certified good data (EB digi occupancy) from Run 2018 data. + //On giving an input occupancy map, the encoder part of the AE compresses and reduces the input data, learning its features, + //and the decoder reconstructs the data from the encoded form into a representation as close to the original input as possible. + //We then compute the Mean squared error (MSE) between the input and output image, also called the Reconstruction Loss, + //calculated at a tower by tower basis. + //Thus, given an anomalous tower the loss should be significantly higher than the loss with respect to good towers, which the model + //has already seen --> anomaly detection. + //When calculating the loss we also apply a response correction by dividing each input and output image with the average occupancy from + //all 2018 data (also to be tuned),to accommodate the difference in response of crystals in different regions of the Ecal Barrel + //Further each loss map from each input image is then multiplied by the last N loss maps, + ///so that real anomalies which persist with time are enhanced and fluctuations are suppressed. + //A quality threshold is then applied on this time multiplied loss map, to mark them as GOOD or BAD, + //after which it is stored as a quality summary ME. + + ///ONNX model running/// + std::string instanceName{"AE-DQM-inference"}; + std::string modelFilepath = edm::FileInPath("DQM/EcalMonitorClient/data/onnxModels/resnet.onnx").fullPath(); + + Ort::SessionOptions sessionOptions; + sessionOptions.SetIntraOpNumThreads(1); + Ort::Env env(OrtLoggingLevel::ORT_LOGGING_LEVEL_WARNING, instanceName.c_str()); + Ort::Session session(env, modelFilepath.c_str(), sessionOptions); + + Ort::AllocatorWithDefaultOptions allocator; + + const char* inputName = session.GetInputName(0, allocator); + + Ort::TypeInfo inputTypeInfo = session.GetInputTypeInfo(0); + auto inputTensorInfo = inputTypeInfo.GetTensorTypeAndShapeInfo(); + + std::vector inputDims = inputTensorInfo.GetShape(); + + const char* outputName = session.GetOutputName(0, allocator); + + Ort::TypeInfo outputTypeInfo = session.GetOutputTypeInfo(0); + auto outputTensorInfo = outputTypeInfo.GetTensorTypeAndShapeInfo(); + + std::vector outputDims = outputTensorInfo.GetShape(); + + size_t TensorSize = nEtaTowersPad * nPhiTowers; + std::vector ebRecoOccMap1dPad(TensorSize); //To store the output reconstructed occupancy + + std::vector inputNames{inputName}; + std::vector outputNames{outputName}; + std::vector inputTensors; + std::vector outputTensors; + + Ort::MemoryInfo memoryInfo = + Ort::MemoryInfo::CreateCpu(OrtAllocatorType::OrtArenaAllocator, OrtMemType::OrtMemTypeDefault); + inputTensors.push_back(Ort::Value::CreateTensor( + memoryInfo, ebOccMap1dCumulPad.data(), TensorSize, inputDims.data(), inputDims.size())); + + outputTensors.push_back(Ort::Value::CreateTensor( + memoryInfo, ebRecoOccMap1dPad.data(), TensorSize, outputDims.data(), outputDims.size())); + + session.Run(Ort::RunOptions{nullptr}, + inputNames.data(), + inputTensors.data(), + 1, + outputNames.data(), + outputTensors.data(), + 1); + + ///Inference on the output from the model/// + //2D Loss map to store tower by tower loss between the output (reconstructed) and input occupancies, + //Have same dimensions as the occupancy plot + std::valarray> lossMap2d(std::valarray(nPhiTowers), nEtaTowers); + + //1D val arrays to store row wise information corresponding to the reconstructed, input and average occupancies, and loss. + //and to do element wise (tower wise) operations on them to calculate the MSE loss between the reco and input occupancy. + std::valarray recoOcc1d(0., nPhiTowers); + std::valarray inputOcc1d(0., nPhiTowers); + std::valarray avgOcc1d(0., nPhiTowers); + std::valarray loss_; + + //Loss calculation + //Ignore the top and bottom replicated padded rows when doing inference + //by making index i run over (1,35) instead of (0,36) + for (int i = 1; i < 35; i++) { + for (int j = 0; j < nPhiTowers; j++) { + int k = (i * nPhiTowers) + j; + recoOcc1d[j] = ebRecoOccMap1dPad[k]; + inputOcc1d[j] = ebOccMap1dCumulPad[k]; + avgOcc1d[j] = avgOcc_[k]; + } + //Calculate the MSE loss = (output-input)^2, with avg response correction + loss_ = std::pow((recoOcc1d / avgOcc1d - inputOcc1d / avgOcc1d), 2); + lossMap2d[i - 1] = (loss_); + } + + lossMap2dQ.push_back(lossMap2d); //Store each loss map from the output in the queue + if (lossMap2dQ.size() > nLSloss) { + lossMap2dQ.pop_front(); //Keep exactly nLSloss loss maps to multiply + } + if (lossMap2dQ.size() < nLSloss) { //Exit if there are not nLSloss loss maps + return; + } + //To hold the final multiplied loss + std::valarray> lossMap2dMult(std::valarray(1., nPhiTowers), nEtaTowers); + + //Multiply together the last nLSloss loss maps + //So that real anomalies which persist with time are enhanced and fluctuations are suppressed. + for (size_t i = 0; i < lossMap2dQ.size(); i++) { + lossMap2dMult *= lossMap2dQ[i]; + } + + //Fill the AELoss ME with the values of this time multiplied loss map + MESet const& sAELoss(sources_.at("AELoss")); + TH2F* hLossMap2dMult(sAELoss.getME(1)->getTH2F()); + for (int i = 0; i < hLossMap2dMult->GetNbinsY(); i++) { + for (int j = 0; j < hLossMap2dMult->GetNbinsX(); j++) { + int bin_ = hLossMap2dMult->GetBin(j + 1, i + 1); + double content = lossMap2dMult[i][j]; + hLossMap2dMult->SetBinContent(bin_, content); + } + } + ///////////////////// ML Quality Summary ///////////////////// + //Apply the quality threshold on the time multiplied loss map stored in the ME AELoss + //If anomalous, the tower entry will have a large loss value. If good, the value will be close to zero. + + MESet::const_iterator dAEnd(sAELoss.end(GetElectronicsMap())); + for (MESet::const_iterator dItr(sAELoss.beginChannel(GetElectronicsMap())); dItr != dAEnd; + dItr.toNextChannel(GetElectronicsMap())) { + DetId id(dItr->getId()); + + bool doMaskML(meMLQualitySummary.maskMatches(id, mask, statusManager_, GetTrigTowerMap())); + + float entries(dItr->getBinContent()); + int quality(doMaskML ? kMGood : kGood); + //If a trigger tower entry is greater than the ML threshold, set it to Bad quality, otherwise Good. + if (entries > MLThreshold_) { + quality = doMaskML ? kMBad : kBad; + } + //Fill the quality summary with the quality of the given tower id. + meMLQualitySummary.setBinContent(getEcalDQMSetupObjects(), id, double(quality)); + } // ML Quality Summary + } // producePlots() + + DEFINE_ECALDQM_WORKER(MLClient); +} // namespace ecaldqm diff --git a/DQM/EcalMonitorTasks/interface/OccupancyTask.h b/DQM/EcalMonitorTasks/interface/OccupancyTask.h index d58a0f1172fcd..7a1b28a6952bd 100644 --- a/DQM/EcalMonitorTasks/interface/OccupancyTask.h +++ b/DQM/EcalMonitorTasks/interface/OccupancyTask.h @@ -11,6 +11,7 @@ #include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbService.h" #include "DataFormats/Provenance/interface/Timestamp.h" #include "FWCore/Framework/interface/ConsumesCollector.h" +#include "DataFormats/Scalers/interface/LumiScalers.h" namespace ecaldqm { class OccupancyTask : public DQWorkerTask { @@ -30,6 +31,7 @@ namespace ecaldqm { void runOnTPDigis(EcalTrigPrimDigiCollection const&); void runOnRecHits(EcalRecHitCollection const&, Collections); void setTokens(edm::ConsumesCollector&) override; + void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; private: void setParams(edm::ParameterSet const&) override; @@ -38,6 +40,12 @@ namespace ecaldqm { float recHitThreshold_; float tpThreshold_; edm::TimeValue_t m_iTime; + edm::InputTag lumiTag; + edm::EDGetTokenT lumiScalersToken_; + double scal_pu; + bool FindPUinLS = false; + int nEv; + bool lumiCheck_; }; inline bool OccupancyTask::analyze(void const* _p, Collections _collection) { diff --git a/DQM/EcalMonitorTasks/python/OccupancyTask_cfi.py b/DQM/EcalMonitorTasks/python/OccupancyTask_cfi.py index b7080fd6b94cc..f80773d936c10 100644 --- a/DQM/EcalMonitorTasks/python/OccupancyTask_cfi.py +++ b/DQM/EcalMonitorTasks/python/OccupancyTask_cfi.py @@ -2,12 +2,15 @@ tpThreshold = 4. recHitThreshold = 0.5 +lumiCheck = False ecalOccupancyTask = cms.untracked.PSet( params = cms.untracked.PSet( recHitThreshold = cms.untracked.double(recHitThreshold), - tpThreshold = cms.untracked.double(tpThreshold) - ), + tpThreshold = cms.untracked.double(tpThreshold), + scalers = cms.InputTag('hltScalersRawToDigi'), + lumiCheck = cms.untracked.bool(lumiCheck) + ), MEs = cms.untracked.PSet( TrendNTPDigi = cms.untracked.PSet( path = cms.untracked.string('Ecal/Trends/OccupancyTask %(prefix)s number of filtered TP digis'), @@ -242,8 +245,44 @@ otype = cms.untracked.string('Ecal3P'), btype = cms.untracked.string('ProjEta'), description = cms.untracked.string('Projection of average laser transparency correction from DB.') + ), + TrendEventsperLumi = cms.untracked.PSet( + path = cms.untracked.string('Ecal/Trends/Number of Events per Lumisection'), + kind = cms.untracked.string('TProfile'), + otype = cms.untracked.string('Ecal2P'), + btype = cms.untracked.string('Trend'), + description = cms.untracked.string('Trend of the number of events per lumisection') + ), + TrendPUperLumi = cms.untracked.PSet( + path = cms.untracked.string('Ecal/Trends/PU per Lumisection'), + kind = cms.untracked.string('TProfile'), + otype = cms.untracked.string('Ecal2P'), + btype = cms.untracked.string('Trend'), + description = cms.untracked.string('Trend of the pile up per lumisection') + ), + AELoss = cms.untracked.PSet( + path = cms.untracked.string('%(subdet)s/%(prefix)sOccupancyTask/%(prefix)sOT AE Loss'), + kind = cms.untracked.string('TH2F'), + otype = cms.untracked.string('Ecal3P'), + btype = cms.untracked.string('SuperCrystal'), + description = cms.untracked.string('AE Loss from inference') + ), + PU = cms.untracked.PSet( + path = cms.untracked.string('Ecal/EventInfo/PU in the lumi'), + kind = cms.untracked.string('REAL'), + otype = cms.untracked.string('None'), + btype = cms.untracked.string('User'), + description = cms.untracked.string('Pile up in this lumisection') + ), + NEvents = cms.untracked.PSet( + path = cms.untracked.string('Ecal/EventInfo/Number of events in the lumi'), + kind = cms.untracked.string('REAL'), + otype = cms.untracked.string('None'), + btype = cms.untracked.string('User'), + description = cms.untracked.string('Number of events in this lumisection') ) + # TPDigiProjPhi = cms.untracked.PSet( # path = cms.untracked.string('%(subdet)s/%(prefix)sOccupancyTask/%(prefix)sOT TP digi occupancy%(suffix)s projection phi'), # kind = cms.untracked.string('TH1F'), diff --git a/DQM/EcalMonitorTasks/src/OccupancyTask.cc b/DQM/EcalMonitorTasks/src/OccupancyTask.cc index f89cdf7016d5c..f5829246eabc0 100644 --- a/DQM/EcalMonitorTasks/src/OccupancyTask.cc +++ b/DQM/EcalMonitorTasks/src/OccupancyTask.cc @@ -4,6 +4,8 @@ #include "DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/Event.h" +#include "DataFormats/Scalers/interface/LumiScalers.h" namespace ecaldqm { OccupancyTask::OccupancyTask() : DQWorkerTask(), recHitThreshold_(0.), tpThreshold_(0.), m_iTime(0.) {} @@ -11,9 +13,21 @@ namespace ecaldqm { void OccupancyTask::setParams(edm::ParameterSet const& _params) { recHitThreshold_ = _params.getUntrackedParameter("recHitThreshold"); tpThreshold_ = _params.getUntrackedParameter("tpThreshold"); + lumiTag = _params.getParameter("scalers"); + lumiCheck_ = _params.getUntrackedParameter("lumiCheck", false); + if (!onlineMode_) { + MEs_.erase(std::string("PU")); + MEs_.erase(std::string("NEvents")); + MEs_.erase(std::string("TrendEventsperLumi")); + MEs_.erase(std::string("TrendPUperLumi")); + MEs_.erase(std::string("AELoss")); + } } - void OccupancyTask::setTokens(edm::ConsumesCollector& _collector) { lasertoken_ = _collector.esConsumes(); } + void OccupancyTask::setTokens(edm::ConsumesCollector& _collector) { + lasertoken_ = _collector.esConsumes(); + lumiScalersToken_ = _collector.consumes(lumiTag); + } bool OccupancyTask::filterRunType(short const* _runType) { for (int iFED(0); iFED < 54; iFED++) { @@ -36,7 +50,14 @@ namespace ecaldqm { MEs_.at("DigiAllByLumi").reset(GetElectronicsMap()); MEs_.at("TPDigiThrAllByLumi").reset(GetElectronicsMap()); MEs_.at("RecHitThrAllByLumi").reset(GetElectronicsMap()); + nEv = 0; + if (onlineMode_) { + MEs_.at("PU").reset(GetElectronicsMap(), -1); + MEs_.at("NEvents").reset(GetElectronicsMap(), -1); + FindPUinLS = true; + } } + nEv++; MESet& meLaserCorrProjEta(MEs_.at("LaserCorrProjEta")); m_iTime = _evt.time().value(); if (FillLaser) { @@ -61,6 +82,18 @@ namespace ecaldqm { } FillLaser = false; } + if (lumiCheck_ && FindPUinLS) { + scal_pu = -1.; + MESet& mePU(static_cast(MEs_.at("PU"))); + edm::Handle lumiScalers; + _evt.getByToken(lumiScalersToken_, lumiScalers); + if (lumiScalers.isValid() and not lumiScalers->empty()) { + auto scalit = lumiScalers->begin(); + scal_pu = scalit->pileup(); + } + mePU.fill(getEcalDQMSetupObjects(), double(scal_pu)); + FindPUinLS = false; + } } void OccupancyTask::runOnRawData(EcalRawDataCollection const& _dcchs) { @@ -70,6 +103,18 @@ namespace ecaldqm { meDCC.fill(getEcalDQMSetupObjects(), dcchItr->id()); } + void OccupancyTask::endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) { + if (onlineMode_) { + MESet& meNEvents(static_cast(MEs_.at("NEvents"))); + MESet& meTrendEventsperLumi(MEs_.at("TrendEventsperLumi")); + MESet& meTrendPUperLumi(MEs_.at("TrendPUperLumi")); + + meNEvents.fill(getEcalDQMSetupObjects(), double(nEv)); + meTrendEventsperLumi.fill(getEcalDQMSetupObjects(), EcalBarrel, double(timestamp_.iLumi), double(nEv)); + meTrendPUperLumi.fill(getEcalDQMSetupObjects(), EcalBarrel, double(timestamp_.iLumi), double(scal_pu)); + } + } + template void OccupancyTask::runOnDigis(DigiCollection const& _digis, Collections _collection) { MESet& meDigi(MEs_.at("Digi")); @@ -80,6 +125,9 @@ namespace ecaldqm { MESet& meDigiDCC(MEs_.at("DigiDCC")); MESet& meDigi1D(MEs_.at("Digi1D")); MESet& meTrendNDigi(MEs_.at("TrendNDigi")); + MESet* meAELoss = nullptr; + if (onlineMode_) + meAELoss = &MEs_.at("AELoss"); std::for_each(_digis.begin(), _digis.end(), [&](typename DigiCollection::Digi const& digi) { DetId id(digi.id()); @@ -89,6 +137,8 @@ namespace ecaldqm { meDigiAll.fill(getEcalDQMSetupObjects(), id); meDigiAllByLumi.fill(getEcalDQMSetupObjects(), id); meDigiDCC.fill(getEcalDQMSetupObjects(), id); + if (onlineMode_) + meAELoss->fill(getEcalDQMSetupObjects(), id); }); int iSubdet(_collection == kEBDigi ? EcalBarrel : EcalEndcap); diff --git a/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py index 5f9b35d4a5552..e79ba64ac064e 100644 --- a/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py @@ -117,7 +117,7 @@ process.ecalMonitorClient.workerParameters.TimingClient.params.minChannelEntries = cms.untracked.int32(0) process.ecalMonitorClient.verbosity = 0 -process.ecalMonitorClient.workers = ['IntegrityClient', 'OccupancyClient', 'PresampleClient', 'RawDataClient', 'TimingClient', 'SelectiveReadoutClient', 'TrigPrimClient', 'SummaryClient'] +process.ecalMonitorClient.workers = ['IntegrityClient', 'OccupancyClient', 'PresampleClient', 'RawDataClient', 'TimingClient', 'SelectiveReadoutClient', 'TrigPrimClient', 'MLClient', 'SummaryClient'] process.ecalMonitorClient.workerParameters.SummaryClient.params.activeSources = ['Integrity', 'RawData', 'Presample', 'TriggerPrimitives', 'Timing', 'HotCell'] process.ecalMonitorClient.commonParameters.onlineMode = True @@ -135,7 +135,10 @@ process.tcdsDigis = tcdsRawToDigi.clone( InputLabel = "rawDataCollector" ) - +###### LumiScalars to get the PU/luminosity info ###### +process.hltScalersRawToDigi = cms.EDProducer( "ScalersRawToDigi", + scalersInputTag = cms.InputTag( "rawDataCollector" ) +) process.dqmEnv.subSystemFolder = 'Ecal' process.dqmSaver.tag = 'Ecal' @@ -158,6 +161,7 @@ process.ecalMonitorTask.workerParameters.TrigPrimTask.params.runOnEmul = True process.ecalMonitorTask.commonParameters.willConvertToEDM = False process.ecalMonitorTask.commonParameters.onlineMode = True +process.ecalMonitorTask.workerParameters.OccupancyTask.params.lumiCheck = True ### Sequences ### @@ -168,7 +172,7 @@ ### Paths ### -process.ecalMonitorPath = cms.Path(process.preScaler+process.ecalPreRecoSequence+process.ecalPhysicsFilter+process.ecalRecoSequence+process.tcdsDigis+process.ecalMonitorTask) +process.ecalMonitorPath = cms.Path(process.hltScalersRawToDigi+process.preScaler+process.ecalPreRecoSequence+process.ecalPhysicsFilter+process.ecalRecoSequence+process.tcdsDigis+process.ecalMonitorTask) process.ecalClientPath = cms.Path(process.preScaler+process.ecalPreRecoSequence+process.ecalPhysicsFilter+process.ecalMonitorClient) process.dqmEndPath = cms.EndPath(process.dqmEnv) @@ -186,7 +190,7 @@ elif (runTypeName == 'cosmic_run' or runTypeName == 'cosmic_run_stage1'): # process.dqmEndPath.remove(process.dqmQTest) process.ecalMonitorTask.workers = ['EnergyTask', 'IntegrityTask', 'OccupancyTask', 'RawDataTask', 'TimingTask', 'TrigPrimTask', 'PresampleTask', 'SelectiveReadoutTask'] - process.ecalMonitorClient.workers = ['IntegrityClient', 'OccupancyClient', 'PresampleClient', 'RawDataClient', 'TimingClient', 'SelectiveReadoutClient', 'TrigPrimClient', 'SummaryClient'] + process.ecalMonitorClient.workers = ['IntegrityClient', 'OccupancyClient', 'PresampleClient', 'RawDataClient', 'TimingClient', 'SelectiveReadoutClient', 'TrigPrimClient', 'MLClient', 'SummaryClient'] process.ecalMonitorClient.workerParameters.SummaryClient.params.activeSources = ['Integrity', 'RawData', 'Presample', 'TriggerPrimitives', 'Timing', 'HotCell'] process.ecalMonitorTask.workerParameters.PresampleTask.params.doPulseMaxCheck = False elif runTypeName == 'hi_run': diff --git a/DQMOffline/L1Trigger/interface/L1TPhase2CorrelatorOffline.h b/DQMOffline/L1Trigger/interface/L1TPhase2CorrelatorOffline.h index 264749a0bb03d..8033256e70ff7 100644 --- a/DQMOffline/L1Trigger/interface/L1TPhase2CorrelatorOffline.h +++ b/DQMOffline/L1Trigger/interface/L1TPhase2CorrelatorOffline.h @@ -75,8 +75,8 @@ class L1TPhase2CorrelatorOffline : public DQMOneEDAnalyzer<> { void computeResponseResolution(); + std::vector getQuantile(float quant, TH2F* hist); void medianResponseCorrResolution(MonitorElement* in2D, MonitorElement* response, MonitorElement* resolution); - void medianResponse(MonitorElement* in2D, MonitorElement* response); struct SimpleObject { float pt, eta, phi; diff --git a/DQMOffline/L1Trigger/src/L1TPhase2CorrelatorOffline.cc b/DQMOffline/L1Trigger/src/L1TPhase2CorrelatorOffline.cc index 42ebbd59401d3..eb9de7bfa26fb 100644 --- a/DQMOffline/L1Trigger/src/L1TPhase2CorrelatorOffline.cc +++ b/DQMOffline/L1Trigger/src/L1TPhase2CorrelatorOffline.cc @@ -906,6 +906,31 @@ void L1TPhase2CorrelatorOffline::computeResponseResolution() { } } +std::vector L1TPhase2CorrelatorOffline::getQuantile(float quant, TH2F* hist) { + std::vector quantiles(hist->GetNbinsX(), 1.); + for (int ix = 1; ix < hist->GetNbinsX() + 1; ix++) { + float thresh = quant * (hist->Integral(ix, ix, 0, -1)); + if (hist->Integral(ix, ix, 0, -1) == 0.) { + } else if (quant <= 0. || thresh < hist->GetBinContent(ix, 0)) { + quantiles[ix - 1] = hist->GetYaxis()->GetBinLowEdge(1); + } else if (quant >= 1. || thresh >= hist->Integral(ix, ix, 0, hist->GetNbinsY())) { + quantiles[ix - 1] = hist->GetYaxis()->GetBinUpEdge(hist->GetNbinsY()); + } else { + float sum = hist->GetBinContent(ix, 0); + for (int iy = 1; iy < hist->GetNbinsY() + 1; iy++) { + float add = hist->GetBinContent(ix, iy); + if (sum + add >= thresh) { + quantiles[ix - 1] = + hist->GetYaxis()->GetBinLowEdge(iy) + hist->GetYaxis()->GetBinWidth(iy) * ((thresh - sum) / add); + break; + } + sum += add; + } + } + } + return quantiles; +} + void L1TPhase2CorrelatorOffline::medianResponseCorrResolution(MonitorElement* in2D, MonitorElement* response, MonitorElement* resolution) { @@ -913,19 +938,14 @@ void L1TPhase2CorrelatorOffline::medianResponseCorrResolution(MonitorElement* in auto hresp = response->getTH1F(); if (hbase != nullptr && hresp != nullptr) { if (hbase->GetNbinsX() == hresp->GetNbinsX()) { - TDirectory threadsafeDir = - TDirectory(((std::string)(hbase->GetName()) + "dirL1TPhase2CorrelatorOffline").c_str(), - ((std::string)(hbase->GetName()) + "dirL1TPhase2CorrelatorOffline").c_str()); - TDirectory::TContext context(gDirectory, &threadsafeDir); - auto med = hbase->QuantilesX(0.5, "_qx"); + auto med = getQuantile(0.5, hbase); TGraph* ptrecgen = new TGraph(hbase->GetNbinsX()); for (int ib = 1; ib < hbase->GetNbinsX() + 1; ib++) { - float corr = med->GetBinContent(ib); + float corr = med[ib - 1]; float xval = hbase->GetXaxis()->GetBinCenter(ib); ptrecgen->SetPoint(ib - 1, xval * corr, xval); hresp->SetBinContent(ib, corr); } - delete med; if (resolution != nullptr) { auto hresol = resolution->getTH1F(); if (hresol != nullptr) { @@ -943,17 +963,13 @@ void L1TPhase2CorrelatorOffline::medianResponseCorrResolution(MonitorElement* in } } delete ptrecgen; - auto qc = ch->QuantilesX(0.5, "_qc"); - auto qhi = ch->QuantilesX(0.84, "_qhi"); - auto qlo = ch->QuantilesX(0.16, "_qlo"); + auto qc = getQuantile(0.5, ch); + auto qhi = getQuantile(0.84, ch); + auto qlo = getQuantile(0.16, ch); delete ch; for (int ibx = 1; ibx < hbase->GetNbinsX() + 1; ibx++) { - hresol->SetBinContent( - ibx, qc->GetBinContent(ibx) > 0.2 ? (qhi->GetBinContent(ibx) - qlo->GetBinContent(ibx)) / 2. : 0.); + hresol->SetBinContent(ibx, qc[ibx - 1] > 0.2 ? (qhi[ibx - 1] - qlo[ibx - 1]) / 2. : 0.); } - delete qc; - delete qhi; - delete qlo; } } } else { diff --git a/DataFormats/CSCDigi/interface/CSCALCTDigi.h b/DataFormats/CSCDigi/interface/CSCALCTDigi.h index 8a3bfe366f4c0..a96c23fe95cb8 100644 --- a/DataFormats/CSCDigi/interface/CSCALCTDigi.h +++ b/DataFormats/CSCDigi/interface/CSCALCTDigi.h @@ -115,11 +115,12 @@ class CSCALCTDigi { void setRun3(const bool isRun3); // wire hits in this ALCT - const WireContainer& getHits() const { return hits_; } + const WireContainer& getHits() const { return hits_.empty() ? emptyContainer() : hits_; } void setHits(const WireContainer& hits) { hits_ = hits; } private: + static const WireContainer& emptyContainer(); uint16_t valid_; uint16_t quality_; uint16_t accel_; diff --git a/DataFormats/CSCDigi/src/CSCALCTDigi.cc b/DataFormats/CSCDigi/src/CSCALCTDigi.cc index bfff87ad3d0da..027f9d5cf7cd3 100644 --- a/DataFormats/CSCDigi/src/CSCALCTDigi.cc +++ b/DataFormats/CSCDigi/src/CSCALCTDigi.cc @@ -11,10 +11,26 @@ #include #include -enum Pattern_Info { NUM_LAYERS = 6, ALCT_PATTERN_WIDTH = 5 }; - using namespace std; +namespace { + enum Pattern_Info { NUM_LAYERS = 6, ALCT_PATTERN_WIDTH = 5 }; + + CSCALCTDigi::WireContainer makeEmptyContainer() { + CSCALCTDigi::WireContainer ret; + ret.resize(NUM_LAYERS); + for (auto& p : ret) { + p.resize(ALCT_PATTERN_WIDTH); + } + return ret; + } +} // namespace + +CSCALCTDigi::WireContainer const& CSCALCTDigi::emptyContainer() { + static WireContainer const s_container = makeEmptyContainer(); + return s_container; +} + /// Constructors CSCALCTDigi::CSCALCTDigi(const uint16_t valid, const uint16_t quality, @@ -33,12 +49,7 @@ CSCALCTDigi::CSCALCTDigi(const uint16_t valid, bx_(bx), trknmb_(trknmb), hmt_(hmt), - version_(version) { - hits_.resize(NUM_LAYERS); - for (auto& p : hits_) { - p.resize(ALCT_PATTERN_WIDTH); - } -} + version_(version) {} /// Default CSCALCTDigi::CSCALCTDigi() { @@ -56,11 +67,8 @@ void CSCALCTDigi::clear() { trknmb_ = 0; fullbx_ = 0; hmt_ = 0; - hits_.resize(NUM_LAYERS); + hits_.clear(); version_ = Version::Legacy; - for (auto& p : hits_) { - p.resize(ALCT_PATTERN_WIDTH); - } } uint16_t CSCALCTDigi::getHMT() const { return (isRun3() ? hmt_ : std::numeric_limits::max()); } diff --git a/DataFormats/ParticleFlowCandidate/src/PFCandidate.cc b/DataFormats/ParticleFlowCandidate/src/PFCandidate.cc index 632579a364f6d..8b4fde698dcb9 100644 --- a/DataFormats/ParticleFlowCandidate/src/PFCandidate.cc +++ b/DataFormats/ParticleFlowCandidate/src/PFCandidate.cc @@ -45,6 +45,7 @@ PFCandidate::PFCandidate() dnn_e_bkgNonIsolated_(PFCandidate::bigMva_), dnn_e_bkgTau_(PFCandidate::bigMva_), dnn_e_bkgPhoton_(PFCandidate::bigMva_), + dnn_gamma_(PFCandidate::bigMva_), getter_(nullptr), storedRefsBitPattern_(0), time_(0.f), @@ -89,6 +90,7 @@ PFCandidate::PFCandidate(Charge charge, const LorentzVector& p4, ParticleType pa dnn_e_bkgNonIsolated_(PFCandidate::bigMva_), dnn_e_bkgTau_(PFCandidate::bigMva_), dnn_e_bkgPhoton_(PFCandidate::bigMva_), + dnn_gamma_(PFCandidate::bigMva_), getter_(nullptr), storedRefsBitPattern_(0), time_(0.f), @@ -150,6 +152,7 @@ PFCandidate::PFCandidate(PFCandidate const& iOther) dnn_e_bkgNonIsolated_(iOther.dnn_e_bkgNonIsolated_), dnn_e_bkgTau_(iOther.dnn_e_bkgTau_), dnn_e_bkgPhoton_(iOther.dnn_e_bkgPhoton_), + dnn_gamma_(iOther.dnn_gamma_), positionAtECALEntrance_(iOther.positionAtECALEntrance_), getter_(iOther.getter_), storedRefsBitPattern_(iOther.storedRefsBitPattern_), @@ -199,6 +202,7 @@ PFCandidate& PFCandidate::operator=(PFCandidate const& iOther) { dnn_e_bkgNonIsolated_ = iOther.dnn_e_bkgNonIsolated_; dnn_e_bkgTau_ = iOther.dnn_e_bkgTau_; dnn_e_bkgPhoton_ = iOther.dnn_e_bkgPhoton_; + dnn_gamma_ = iOther.dnn_gamma_; positionAtECALEntrance_ = iOther.positionAtECALEntrance_; getter_ = iOther.getter_; storedRefsBitPattern_ = iOther.storedRefsBitPattern_; diff --git a/DataFormats/Provenance/interface/IndexIntoFile.h b/DataFormats/Provenance/interface/IndexIntoFile.h index 0cce5ac09f3e4..5c66a74832788 100644 --- a/DataFormats/Provenance/interface/IndexIntoFile.h +++ b/DataFormats/Provenance/interface/IndexIntoFile.h @@ -234,6 +234,7 @@ namespace edm { static constexpr LuminosityBlockNumber_t invalidLumi = 0U; static constexpr EventNumber_t invalidEvent = 0U; static constexpr EntryNumber_t invalidEntry = -1LL; + static constexpr EntryNumber_t continuedLumi = -2LL; enum EntryType { kRun, kLumi, kEvent, kEnd }; @@ -263,7 +264,7 @@ namespace edm { /// 4. event number /// /// 5. entry number - enum SortOrder { numericalOrder, firstAppearanceOrder }; + enum SortOrder { numericalOrder, firstAppearanceOrder, entryOrder }; /// Used to start an iteration over the Runs, Lumis, and Events in a file. /// Note the argument specifies the order @@ -545,6 +546,7 @@ namespace edm { virtual RunNumber_t run() const = 0; virtual LuminosityBlockNumber_t lumi() const = 0; virtual EntryNumber_t entry() const = 0; + virtual bool entryContinues() const = 0; virtual LuminosityBlockNumber_t peekAheadAtLumi() const = 0; virtual EntryNumber_t peekAheadAtEventEntry() const = 0; EntryNumber_t firstEventEntryThisRun(); @@ -625,6 +627,7 @@ namespace edm { RunNumber_t run() const override; LuminosityBlockNumber_t lumi() const override; EntryNumber_t entry() const override; + bool entryContinues() const final { return false; }; LuminosityBlockNumber_t peekAheadAtLumi() const override; EntryNumber_t peekAheadAtEventEntry() const override; bool skipLumiInRun() override; @@ -659,6 +662,7 @@ namespace edm { RunNumber_t run() const override; LuminosityBlockNumber_t lumi() const override; EntryNumber_t entry() const override; + bool entryContinues() const final { return false; } LuminosityBlockNumber_t peekAheadAtLumi() const override; EntryNumber_t peekAheadAtEventEntry() const override; bool skipLumiInRun() override; @@ -678,6 +682,45 @@ namespace edm { //***************************************************************************** //***************************************************************************** + class IndexIntoFileItrEntryOrder : public IndexIntoFileItrImpl { + public: + IndexIntoFileItrEntryOrder(IndexIntoFile const* indexIntoFile, + EntryType entryType, + int indexToRun, + int indexToLumi, + int indexToEventRange, + long long indexToEvent, + long long nEvents); + + IndexIntoFileItrImpl* clone() const override; + int processHistoryIDIndex() const override; + RunNumber_t run() const override; + LuminosityBlockNumber_t lumi() const override; + EntryNumber_t entry() const override; + bool entryContinues() const override; + LuminosityBlockNumber_t peekAheadAtLumi() const override; + EntryNumber_t peekAheadAtEventEntry() const override; + bool skipLumiInRun() override; + bool lumiEntryValid(int index) const override; + + private: + RunOrLumiEntry const& runOrLumisEntry(EntryNumber_t iEntry) const { + return indexIntoFile()->runOrLumiEntries()[fileOrderRunOrLumiEntry_[iEntry]]; + } + void initializeLumi_() override; + bool nextEventRange() override; + bool previousEventRange() override; + bool setToLastEventInRange(int index) override; + EntryType getRunOrLumiEntryType(int index) const override; + bool isSameLumi(int index1, int index2) const override; + bool isSameRun(int index1, int index2) const override; + LuminosityBlockNumber_t lumi(int index) const override; + std::vector fileOrderRunOrLumiEntry_; + }; + + //***************************************************************************** + //***************************************************************************** + class IndexIntoFileItr { public: /// This itended to be used only internally and by IndexIntoFile. @@ -702,6 +745,7 @@ namespace edm { RunNumber_t run() const { return impl_->run(); } LuminosityBlockNumber_t lumi() const { return impl_->lumi(); } EntryNumber_t entry() const { return impl_->entry(); } + bool entryContinues() const { return impl_->entryContinues(); } /// Same as lumi() except when the the current type is kRun. /// In that case instead of always returning 0 (invalid), it will return the lumi that will be processed next diff --git a/DataFormats/Provenance/src/IndexIntoFile.cc b/DataFormats/Provenance/src/IndexIntoFile.cc index 9878864bfd392..f33549a509bf7 100644 --- a/DataFormats/Provenance/src/IndexIntoFile.cc +++ b/DataFormats/Provenance/src/IndexIntoFile.cc @@ -1725,6 +1725,284 @@ namespace edm { return indexIntoFile()->runOrLumiIndexes()[index].lumi(); } + //************************************* + IndexIntoFile::IndexIntoFileItrEntryOrder::IndexIntoFileItrEntryOrder(IndexIntoFile const* indexIntoFile, + EntryType entryType, + int indexToRun, + int indexToLumi, + int indexToEventRange, + long long indexToEvent, + long long nEvents) + : IndexIntoFileItrImpl( + indexIntoFile, entryType, indexToRun, indexToLumi, indexToEventRange, indexToEvent, nEvents) { + auto const& runOrLumiEntries = this->indexIntoFile()->runOrLumiEntries(); + fileOrderRunOrLumiEntry_.reserve(runOrLumiEntries.size()); + auto const itBegin = runOrLumiEntries.begin(); + auto itPresentEntryToRunOrLumis = runOrLumiEntries.begin(); + auto itRestartSearchAt = runOrLumiEntries.begin(); + EntryNumber_t endOfContiguousEventEntry = 0; + std::vector usedEntry(runOrLumiEntries.size(), false); + auto findFirstOpen = [](auto const& entries) { + return std::find(entries.begin(), entries.end(), false) - entries.begin(); + }; + while (fileOrderRunOrLumiEntry_.size() != runOrLumiEntries.size()) { + assert(itRestartSearchAt != runOrLumiEntries.end()); + assert(itPresentEntryToRunOrLumis != runOrLumiEntries.end()); + + auto const index = itPresentEntryToRunOrLumis - itBegin; + if (usedEntry[index]) { + ++itPresentEntryToRunOrLumis; + continue; + } + assert(static_cast(index) < runOrLumiEntries.size()); + if (itPresentEntryToRunOrLumis->isRun()) { + //take Run as it is + fileOrderRunOrLumiEntry_.push_back(index); + usedEntry[index] = true; + itRestartSearchAt = runOrLumiEntries.begin() + findFirstOpen(usedEntry); + itPresentEntryToRunOrLumis = itRestartSearchAt; + continue; + } + auto const beginEvents = itPresentEntryToRunOrLumis->beginEvents(); + if (beginEvents == invalidEntry) { + //this is an empty lumi. We want to preserve the order w.r.t previous entries + if (std::find(usedEntry.begin(), usedEntry.begin() + index, false) == usedEntry.begin() + index) { + fileOrderRunOrLumiEntry_.push_back(index); + usedEntry[index] = true; + itRestartSearchAt = runOrLumiEntries.begin() + findFirstOpen(usedEntry); + itPresentEntryToRunOrLumis = itRestartSearchAt; + continue; + } + } else if (beginEvents == endOfContiguousEventEntry) { + fileOrderRunOrLumiEntry_.push_back(index); + usedEntry[index] = true; + endOfContiguousEventEntry = itPresentEntryToRunOrLumis->endEvents(); + itRestartSearchAt = runOrLumiEntries.begin() + findFirstOpen(usedEntry); + itPresentEntryToRunOrLumis = itRestartSearchAt; + continue; + } + ++itPresentEntryToRunOrLumis; + } + } + + IndexIntoFile::IndexIntoFileItrImpl* IndexIntoFile::IndexIntoFileItrEntryOrder::clone() const { + return new IndexIntoFileItrEntryOrder(*this); + } + + int IndexIntoFile::IndexIntoFileItrEntryOrder::processHistoryIDIndex() const { + if (type() == kEnd) + return invalidIndex; + return runOrLumisEntry(indexToRun()).processHistoryIDIndex(); + } + + RunNumber_t IndexIntoFile::IndexIntoFileItrEntryOrder::run() const { + if (type() == kEnd) + return invalidRun; + return runOrLumisEntry(indexToRun()).run(); + } + + LuminosityBlockNumber_t IndexIntoFile::IndexIntoFileItrEntryOrder::lumi() const { + if (type() == kEnd || type() == kRun) + return invalidLumi; + return runOrLumisEntry(indexToLumi()).lumi(); + } + + IndexIntoFile::EntryNumber_t IndexIntoFile::IndexIntoFileItrEntryOrder::entry() const { + if (type() == kEnd) + return invalidEntry; + if (type() == kRun) + return runOrLumisEntry(indexToRun()).entry(); + if (type() == kLumi) { + auto entry = runOrLumisEntry(indexToLumi()).entry(); + if (entry == invalidEntry) { + if (indexToLumi() + 1 < size()) { + if (runOrLumisEntry(indexToLumi()).lumi() != runOrLumisEntry(indexToLumi() + 1).lumi()) { + //find the end of this lumi + auto const& runLumiEntry = runOrLumisEntry(indexToLumi()); + for (auto nextIndex = indexToLumi() + 1; nextIndex < size(); ++nextIndex) { + auto const& nextRunLumiEntry = runOrLumisEntry(nextIndex); + if (runLumiEntry.lumi() == nextRunLumiEntry.lumi() and runLumiEntry.run() == nextRunLumiEntry.run() and + runLumiEntry.processHistoryIDIndex() == nextRunLumiEntry.processHistoryIDIndex()) { + auto nextEntry = nextRunLumiEntry.entry(); + if (nextEntry != invalidEntry) { + return nextEntry; + } + } + } + return continuedLumi; + } + } + } + return entry; + } + return runOrLumisEntry(indexToEventRange()).beginEvents() + indexToEvent(); + } + + bool IndexIntoFile::IndexIntoFileItrEntryOrder::entryContinues() const { + auto entry = runOrLumisEntry(indexToLumi()).entry(); + return entry == invalidEntry; + } + + LuminosityBlockNumber_t IndexIntoFile::IndexIntoFileItrEntryOrder::peekAheadAtLumi() const { + if (indexToLumi() == invalidIndex) + return invalidLumi; + return runOrLumisEntry(indexToLumi()).lumi(); + } + + IndexIntoFile::EntryNumber_t IndexIntoFile::IndexIntoFileItrEntryOrder::peekAheadAtEventEntry() const { + if (indexToLumi() == invalidIndex) + return invalidEntry; + if (indexToEvent() >= nEvents()) + return invalidEntry; + return runOrLumisEntry(indexToEventRange()).beginEvents() + indexToEvent(); + } + + void IndexIntoFile::IndexIntoFileItrEntryOrder::initializeLumi_() { + assert(indexToLumi() != invalidIndex); + + setIndexToEventRange(invalidIndex); + setIndexToEvent(0); + setNEvents(0); + + for (int i = 0; indexToLumi() + i < size(); ++i) { + if (runOrLumisEntry(indexToLumi() + i).isRun()) { + break; + } else if (runOrLumisEntry(indexToLumi() + i).lumi() == runOrLumisEntry(indexToLumi()).lumi()) { + if (runOrLumisEntry(indexToLumi() + i).beginEvents() == invalidEntry) { + continue; + } + setIndexToEventRange(indexToLumi() + i); + setIndexToEvent(0); + setNEvents(runOrLumisEntry(indexToEventRange()).endEvents() - + runOrLumisEntry(indexToEventRange()).beginEvents()); + break; + } else { + break; + } + } + } + + bool IndexIntoFile::IndexIntoFileItrEntryOrder::nextEventRange() { + if (indexToEventRange() == invalidIndex) + return false; + + // Look for the next event range, same lumi but different entry + for (int i = 1; indexToEventRange() + i < size(); ++i) { + if (runOrLumisEntry(indexToEventRange() + i).isRun()) { + return false; // hit next run + } else if (runOrLumisEntry(indexToEventRange() + i).lumi() == runOrLumisEntry(indexToEventRange()).lumi()) { + if (runOrLumisEntry(indexToEventRange() + i).beginEvents() == invalidEntry) { + continue; // same lumi but has no events, keep looking + } + setIndexToEventRange(indexToEventRange() + i); + setIndexToEvent(0); + setNEvents(runOrLumisEntry(indexToEventRange()).endEvents() - + runOrLumisEntry(indexToEventRange()).beginEvents()); + return true; // found more events in this lumi + } + return false; // hit next lumi + } + return false; // hit the end of the IndexIntoFile + } + + bool IndexIntoFile::IndexIntoFileItrEntryOrder::previousEventRange() { + if (indexToEventRange() == invalidIndex) + return false; + assert(indexToEventRange() < size()); + + // Look backward for a previous event range with events, same lumi but different entry + for (int i = 1; indexToEventRange() - i > 0; ++i) { + int newRange = indexToEventRange() - i; + if (runOrLumisEntry(newRange).isRun()) { + return false; // hit run + } else if (isSameLumi(newRange, indexToEventRange())) { + if (runOrLumisEntry(newRange).beginEvents() == invalidEntry) { + continue; // same lumi but has no events, keep looking + } + setIndexToEventRange(newRange); + setNEvents(runOrLumisEntry(indexToEventRange()).endEvents() - + runOrLumisEntry(indexToEventRange()).beginEvents()); + setIndexToEvent(nEvents() - 1); + return true; // found previous event in this lumi + } + return false; // hit previous lumi + } + return false; // hit the beginning of the IndexIntoFile, 0th entry has to be a run + } + + bool IndexIntoFile::IndexIntoFileItrEntryOrder::setToLastEventInRange(int index) { + if (runOrLumisEntry(index).beginEvents() == invalidEntry) { + return false; + } + setIndexToEventRange(index); + setNEvents(runOrLumisEntry(indexToEventRange()).endEvents() - runOrLumisEntry(indexToEventRange()).beginEvents()); + assert(nEvents() > 0); + setIndexToEvent(nEvents() - 1); + return true; + } + + bool IndexIntoFile::IndexIntoFileItrEntryOrder::skipLumiInRun() { + if (indexToLumi() == invalidIndex) + return false; + for (int i = 1; indexToLumi() + i < size(); ++i) { + int newLumi = indexToLumi() + i; + if (runOrLumisEntry(newLumi).isRun()) { + return false; // hit next run + } else if (runOrLumisEntry(newLumi).lumi() == runOrLumisEntry(indexToLumi()).lumi()) { + continue; + } + setIndexToLumi(newLumi); + initializeLumi(); + return true; // hit next lumi + } + return false; // hit the end of the IndexIntoFile + } + + bool IndexIntoFile::IndexIntoFileItrEntryOrder::lumiEntryValid(int index) const { + auto entry = runOrLumisEntry(index).entry(); + if (entry == invalidEntry) { + if (index + 1 < size()) { + if (runOrLumisEntry(index).lumi() != runOrLumisEntry(index + 1).lumi()) { + return true; + } + } + } + return entry != invalidEntry; + } + + IndexIntoFile::EntryType IndexIntoFile::IndexIntoFileItrEntryOrder::getRunOrLumiEntryType(int index) const { + if (index < 0 || index >= size()) { + return kEnd; + } else if (runOrLumisEntry(index).isRun()) { + return kRun; + } + return kLumi; + } + + bool IndexIntoFile::IndexIntoFileItrEntryOrder::isSameLumi(int index1, int index2) const { + if (index1 < 0 || index1 >= size() || index2 < 0 || index2 >= size()) { + return false; + } + return runOrLumisEntry(index1).lumi() == runOrLumisEntry(index2).lumi(); + } + + bool IndexIntoFile::IndexIntoFileItrEntryOrder::isSameRun(int index1, int index2) const { + if (index1 < 0 || index1 >= size() || index2 < 0 || index2 >= size()) { + return false; + } + return runOrLumisEntry(index1).run() == runOrLumisEntry(index2).run() && + runOrLumisEntry(index1).processHistoryIDIndex() == runOrLumisEntry(index2).processHistoryIDIndex(); + } + + LuminosityBlockNumber_t IndexIntoFile::IndexIntoFileItrEntryOrder::lumi(int index) const { + if (index < 0 || index >= size()) { + return invalidLumi; + } + return runOrLumisEntry(index).lumi(); + } + + //************************************* + IndexIntoFile::IndexIntoFileItr::IndexIntoFileItr(IndexIntoFile const* indexIntoFile, SortOrder sortOrder, EntryType entryType, @@ -1738,10 +2016,14 @@ namespace edm { value_ptr temp(new IndexIntoFileItrSorted( indexIntoFile, entryType, indexToRun, indexToLumi, indexToEventRange, indexToEvent, nEvents)); swap(temp, impl_); - } else { + } else if (sortOrder == firstAppearanceOrder) { value_ptr temp(new IndexIntoFileItrNoSort( indexIntoFile, entryType, indexToRun, indexToLumi, indexToEventRange, indexToEvent, nEvents)); swap(temp, impl_); + } else { + value_ptr temp(new IndexIntoFileItrEntryOrder( + indexIntoFile, entryType, indexToRun, indexToLumi, indexToEventRange, indexToEvent, nEvents)); + swap(temp, impl_); } } diff --git a/DataFormats/Provenance/test/indexIntoFile3_t.cppunit.cc b/DataFormats/Provenance/test/indexIntoFile3_t.cppunit.cc index 857d27f0210b9..1eb217de559b3 100644 --- a/DataFormats/Provenance/test/indexIntoFile3_t.cppunit.cc +++ b/DataFormats/Provenance/test/indexIntoFile3_t.cppunit.cc @@ -21,6 +21,9 @@ class TestIndexIntoFile3 : public CppUnit::TestFixture { CPPUNIT_TEST(testIterEndWithEvent); CPPUNIT_TEST(testOverlappingLumis); CPPUNIT_TEST(testOverlappingLumisMore); + CPPUNIT_TEST(testOverlappingLumisOutOfOrderEvent); + CPPUNIT_TEST(testOverlappingLumisWithEndWithEmptyLumi); + CPPUNIT_TEST(testOverlappingLumisWithLumiEndOrderChanged); CPPUNIT_TEST_SUITE_END(); public: @@ -69,13 +72,16 @@ class TestIndexIntoFile3 : public CppUnit::TestFixture { void testIterEndWithEvent(); void testOverlappingLumis(); void testOverlappingLumisMore(); + void testOverlappingLumisOutOfOrderEvent(); + void testOverlappingLumisWithEndWithEmptyLumi(); + void testOverlappingLumisWithLumiEndOrderChanged(); ProcessHistoryID nullPHID; ProcessHistoryID fakePHID1; ProcessHistoryID fakePHID2; ProcessHistoryID fakePHID3; - void check(edm::IndexIntoFile::IndexIntoFileItr const& iter, + bool check(edm::IndexIntoFile::IndexIntoFileItr const& iter, IndexIntoFile::EntryType type, int indexToRun, int indexToLumi, @@ -100,7 +106,7 @@ class TestIndexIntoFile3 : public CppUnit::TestFixture { ///registration of the test so that the runner can find it CPPUNIT_TEST_SUITE_REGISTRATION(TestIndexIntoFile3); -void TestIndexIntoFile3::check(edm::IndexIntoFile::IndexIntoFileItr const& iter, +bool TestIndexIntoFile3::check(edm::IndexIntoFile::IndexIntoFileItr const& iter, IndexIntoFile::EntryType type, int indexToRun, int indexToLumi, @@ -116,7 +122,7 @@ void TestIndexIntoFile3::check(edm::IndexIntoFile::IndexIntoFileItr const& iter, std::cout << "Iterator values " << iter.type() << " " << iter.indexToRun() << " " << iter.indexToLumi() << " " << iter.indexToEventRange() << " " << iter.indexToEvent() << " " << iter.nEvents() << "\n"; } - CPPUNIT_ASSERT(theyMatch); + return theyMatch; } void TestIndexIntoFile3::checkSkipped(int phIndexOfSkippedEvent, @@ -216,41 +222,41 @@ void TestIndexIntoFile3::testIterEndWithEvent() { iterFirstCopy2 = iterFirstCopy; CPPUNIT_ASSERT(iterFirst == iterFirstCopy2); if (i == 0) { - check(iterFirst, kRun, 0, 1, 1, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 1, 1, 0, 2)); CPPUNIT_ASSERT(iterFirst.indexIntoFile() == &indexIntoFile); CPPUNIT_ASSERT(iterFirst.size() == 10); } else if (i == 1) - check(iterFirst, kLumi, 0, 1, 1, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 1, 1, 0, 2)); else if (i == 2) - check(iterFirst, kLumi, 0, 2, 1, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 2, 1, 0, 2)); else if (i == 3) - check(iterFirst, kLumi, 0, 3, 1, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 3, 1, 0, 2)); else if (i == 4) - check(iterFirst, kEvent, 0, 3, 1, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 3, 1, 0, 2)); else if (i == 5) - check(iterFirst, kEvent, 0, 3, 1, 1, 2); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 3, 1, 1, 2)); else if (i == 6) - check(iterFirst, kEvent, 0, 3, 3, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 3, 3, 0, 2)); else if (i == 7) - check(iterFirst, kEvent, 0, 3, 3, 1, 2); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 3, 3, 1, 2)); else if (i == 8) - check(iterFirst, kLumi, 0, 4, 4, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 4, 4, 0, 2)); else if (i == 9) - check(iterFirst, kEvent, 0, 4, 4, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 4, 0, 2)); else if (i == 10) - check(iterFirst, kEvent, 0, 4, 4, 1, 2); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 4, 1, 2)); else if (i == 11) - check(iterFirst, kRun, 5, 7, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kRun, 5, 7, -1, 0, 0)); else if (i == 12) - check(iterFirst, kRun, 6, 7, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kRun, 6, 7, -1, 0, 0)); else if (i == 13) - check(iterFirst, kLumi, 6, 7, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 6, 7, -1, 0, 0)); else if (i == 14) - check(iterFirst, kLumi, 6, 8, 9, 0, 1); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 6, 8, 9, 0, 1)); else if (i == 15) - check(iterFirst, kLumi, 6, 9, 9, 0, 1); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 6, 9, 9, 0, 1)); else if (i == 16) - check(iterFirst, kEvent, 6, 9, 9, 0, 1); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 6, 9, 9, 0, 1)); else CPPUNIT_ASSERT(false); @@ -357,41 +363,41 @@ void TestIndexIntoFile3::testIterEndWithEvent() { CPPUNIT_ASSERT(iterNum == iterNumCopy); CPPUNIT_ASSERT(iterNum == iterNumCopy2); if (i == 0) { - check(iterNum, kRun, 0, 1, 1, 0, 4); + CPPUNIT_ASSERT(check(iterNum, kRun, 0, 1, 1, 0, 4)); CPPUNIT_ASSERT(iterNum.indexIntoFile() == &indexIntoFile); CPPUNIT_ASSERT(iterNum.size() == 10); } else if (i == 1) - check(iterNum, kLumi, 0, 1, 1, 0, 4); + CPPUNIT_ASSERT(check(iterNum, kLumi, 0, 1, 1, 0, 4)); else if (i == 2) - check(iterNum, kLumi, 0, 2, 1, 0, 4); + CPPUNIT_ASSERT(check(iterNum, kLumi, 0, 2, 1, 0, 4)); else if (i == 3) - check(iterNum, kLumi, 0, 3, 1, 0, 4); + CPPUNIT_ASSERT(check(iterNum, kLumi, 0, 3, 1, 0, 4)); else if (i == 4) - check(iterNum, kEvent, 0, 3, 1, 0, 4); + CPPUNIT_ASSERT(check(iterNum, kEvent, 0, 3, 1, 0, 4)); else if (i == 5) - check(iterNum, kEvent, 0, 3, 1, 1, 4); + CPPUNIT_ASSERT(check(iterNum, kEvent, 0, 3, 1, 1, 4)); else if (i == 6) - check(iterNum, kEvent, 0, 3, 1, 2, 4); + CPPUNIT_ASSERT(check(iterNum, kEvent, 0, 3, 1, 2, 4)); else if (i == 7) - check(iterNum, kEvent, 0, 3, 1, 3, 4); + CPPUNIT_ASSERT(check(iterNum, kEvent, 0, 3, 1, 3, 4)); else if (i == 8) - check(iterNum, kLumi, 0, 4, 4, 0, 2); + CPPUNIT_ASSERT(check(iterNum, kLumi, 0, 4, 4, 0, 2)); else if (i == 9) - check(iterNum, kEvent, 0, 4, 4, 0, 2); + CPPUNIT_ASSERT(check(iterNum, kEvent, 0, 4, 4, 0, 2)); else if (i == 10) - check(iterNum, kEvent, 0, 4, 4, 1, 2); + CPPUNIT_ASSERT(check(iterNum, kEvent, 0, 4, 4, 1, 2)); else if (i == 11) - check(iterNum, kRun, 5, 7, -1, 0, 0); + CPPUNIT_ASSERT(check(iterNum, kRun, 5, 7, -1, 0, 0)); else if (i == 12) - check(iterNum, kRun, 6, 7, -1, 0, 0); + CPPUNIT_ASSERT(check(iterNum, kRun, 6, 7, -1, 0, 0)); else if (i == 13) - check(iterNum, kLumi, 6, 7, -1, 0, 0); + CPPUNIT_ASSERT(check(iterNum, kLumi, 6, 7, -1, 0, 0)); else if (i == 14) - check(iterNum, kLumi, 6, 8, 8, 0, 1); + CPPUNIT_ASSERT(check(iterNum, kLumi, 6, 8, 8, 0, 1)); else if (i == 15) - check(iterNum, kLumi, 6, 9, 8, 0, 1); + CPPUNIT_ASSERT(check(iterNum, kLumi, 6, 9, 8, 0, 1)); else if (i == 16) - check(iterNum, kEvent, 6, 9, 8, 0, 1); + CPPUNIT_ASSERT(check(iterNum, kEvent, 6, 9, 8, 0, 1)); else CPPUNIT_ASSERT(false); @@ -453,76 +459,205 @@ void TestIndexIntoFile3::testIterEndWithEvent() { if (i == 16) checkIDRunLumiEntry(iterNum, 1, 11, 102, 6); // Event } - checkIDRunLumiEntry(iterFirst, -1, 0, 0, -1); // Event + checkIDRunLumiEntry(iterNum, -1, 0, 0, -1); // Event + + { + edm::IndexIntoFile::IndexIntoFileItr iter3( + &indexIntoFile, IndexIntoFile::entryOrder, IndexIntoFile::kEvent, 0, 3, 2, 1, 2); + edm::IndexIntoFile::IndexIntoFileItr iter1(iter3); + + CPPUNIT_ASSERT(iter1 == iter3); + CPPUNIT_ASSERT(iter1.indexIntoFile() == &indexIntoFile); + CPPUNIT_ASSERT(iter1.size() == 10); + CPPUNIT_ASSERT(iter1.type() == kEvent); + CPPUNIT_ASSERT(iter1.indexToRun() == 0); + CPPUNIT_ASSERT(iter1.indexToLumi() == 3); + CPPUNIT_ASSERT(iter1.indexToEventRange() == 2); + CPPUNIT_ASSERT(iter1.indexToEvent() == 1); + CPPUNIT_ASSERT(iter1.nEvents() == 2); + + iter1 = ++iter3; + CPPUNIT_ASSERT(iter1 == iter3); + + CPPUNIT_ASSERT(indexIntoFile.iterationWillBeInEntryOrder(IndexIntoFile::entryOrder) == true); + + edm::IndexIntoFile::IndexIntoFileItr iterEntry = indexIntoFile.begin(IndexIntoFile::entryOrder); + edm::IndexIntoFile::IndexIntoFileItr iterEntryCopy = iterEntry; + edm::IndexIntoFile::IndexIntoFileItr iterEntryCopy2 = iterEntry; + edm::IndexIntoFile::IndexIntoFileItr iterEntryEnd = indexIntoFile.end(IndexIntoFile::entryOrder); + int i = 0; + for (i = 0; iterEntry != iterEntryEnd; ++iterEntry, ++iterEntryCopy, ++i) { + CPPUNIT_ASSERT(iterEntry == iterEntryCopy); + iterEntryCopy2 = iterEntryCopy; + CPPUNIT_ASSERT(iterEntry == iterEntryCopy2); + if (i == 0) { + CPPUNIT_ASSERT(check(iterEntry, kRun, 0, 1, 1, 0, 2)); + CPPUNIT_ASSERT(iterEntry.indexIntoFile() == &indexIntoFile); + CPPUNIT_ASSERT(iterEntry.size() == 10); + } else if (i == 1) + CPPUNIT_ASSERT(check(iterEntry, kLumi, 0, 1, 1, 0, 2)); + else if (i == 2) + CPPUNIT_ASSERT(check(iterEntry, kLumi, 0, 2, 1, 0, 2)); + else if (i == 3) + CPPUNIT_ASSERT(check(iterEntry, kLumi, 0, 3, 1, 0, 2)); + else if (i == 4) + CPPUNIT_ASSERT(check(iterEntry, kEvent, 0, 3, 1, 0, 2)); + else if (i == 5) + CPPUNIT_ASSERT(check(iterEntry, kEvent, 0, 3, 1, 1, 2)); + else if (i == 6) + CPPUNIT_ASSERT(check(iterEntry, kEvent, 0, 3, 3, 0, 2)); + else if (i == 7) + CPPUNIT_ASSERT(check(iterEntry, kEvent, 0, 3, 3, 1, 2)); + else if (i == 8) + CPPUNIT_ASSERT(check(iterEntry, kLumi, 0, 4, 4, 0, 2)); + else if (i == 9) + CPPUNIT_ASSERT(check(iterEntry, kEvent, 0, 4, 4, 0, 2)); + else if (i == 10) + CPPUNIT_ASSERT(check(iterEntry, kEvent, 0, 4, 4, 1, 2)); + else if (i == 11) + CPPUNIT_ASSERT(check(iterEntry, kRun, 5, 7, -1, 0, 0)); + else if (i == 12) + CPPUNIT_ASSERT(check(iterEntry, kRun, 6, 7, -1, 0, 0)); + else if (i == 13) + CPPUNIT_ASSERT(check(iterEntry, kLumi, 6, 7, -1, 0, 0)); + else if (i == 14) + CPPUNIT_ASSERT(check(iterEntry, kLumi, 6, 8, 9, 0, 1)); + else if (i == 15) + CPPUNIT_ASSERT(check(iterEntry, kLumi, 6, 9, 9, 0, 1)); + else if (i == 16) + CPPUNIT_ASSERT(check(iterEntry, kEvent, 6, 9, 9, 0, 1)); + else + CPPUNIT_ASSERT(false); + + if (i == 0) + CPPUNIT_ASSERT(iterEntry.firstEventEntryThisRun() == 0); + if (i == 10) + CPPUNIT_ASSERT(iterEntry.firstEventEntryThisRun() == 0); + if (i == 12) + CPPUNIT_ASSERT(iterEntry.firstEventEntryThisRun() == 6); + + if (i == 0) + CPPUNIT_ASSERT(iterEntry.firstEventEntryThisLumi() == 0); + if (i == 1) + CPPUNIT_ASSERT(iterEntry.firstEventEntryThisLumi() == 0); + if (i == 2) + CPPUNIT_ASSERT(iterEntry.firstEventEntryThisLumi() == 0); + if (i == 3) + CPPUNIT_ASSERT(iterEntry.firstEventEntryThisLumi() == 0); + if (i == 10) + CPPUNIT_ASSERT(iterEntry.firstEventEntryThisLumi() == 4); + if (i == 12) + CPPUNIT_ASSERT(iterEntry.firstEventEntryThisLumi() == IndexIntoFile::invalidIndex); + } + CPPUNIT_ASSERT(i == 17); + for (i = 0, iterEntry = indexIntoFile.begin(IndexIntoFile::entryOrder); iterEntry != iterEntryEnd; + ++iterEntry, ++i) { + if (i == 0) + checkIDRunLumiEntry(iterEntry, 0, 11, 0, 0); // Run + if (i == 1) + checkIDRunLumiEntry(iterEntry, 0, 11, 101, 0); // Lumi + if (i == 2) + checkIDRunLumiEntry(iterEntry, 0, 11, 101, 1); // Lumi + if (i == 3) + checkIDRunLumiEntry(iterEntry, 0, 11, 101, 2); // Lumi + if (i == 4) + checkIDRunLumiEntry(iterEntry, 0, 11, 101, 0); // Event + if (i == 5) + checkIDRunLumiEntry(iterEntry, 0, 11, 101, 1); // Event + if (i == 6) + checkIDRunLumiEntry(iterEntry, 0, 11, 101, 2); // Event + if (i == 7) + checkIDRunLumiEntry(iterEntry, 0, 11, 101, 3); // Event + if (i == 8) + checkIDRunLumiEntry(iterEntry, 0, 11, 102, 3); // Lumi + if (i == 9) + checkIDRunLumiEntry(iterEntry, 0, 11, 102, 4); // Event + if (i == 10) + checkIDRunLumiEntry(iterEntry, 0, 11, 102, 5); // Event + if (i == 11) + checkIDRunLumiEntry(iterEntry, 1, 11, 0, 1); // Run + if (i == 12) + checkIDRunLumiEntry(iterEntry, 1, 11, 0, 2); // Run + if (i == 13) + checkIDRunLumiEntry(iterEntry, 1, 11, 101, 4); // Lumi + if (i == 14) + checkIDRunLumiEntry(iterEntry, 1, 11, 102, 5); // Lumi + if (i == 15) + checkIDRunLumiEntry(iterEntry, 1, 11, 102, 6); // Lumi + if (i == 16) + checkIDRunLumiEntry(iterEntry, 1, 11, 102, 6); // Event + } + checkIDRunLumiEntry(iterEntry, -1, 0, 0, -1); // Event + } iterFirst = indexIntoFile.begin(IndexIntoFile::firstAppearanceOrder); - check(iterFirst, kRun, 0, 1, 1, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 1, 1, 0, 2)); skipEventForward(iterFirst); checkSkipped(0, 11, 101, 0); - check(iterFirst, kRun, 0, 1, 1, 1, 2); + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 1, 1, 1, 2)); skipEventForward(iterFirst); checkSkipped(0, 11, 101, 1); - check(iterFirst, kRun, 0, 1, 3, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 1, 3, 0, 2)); skipEventForward(iterFirst); checkSkipped(0, 11, 101, 2); - check(iterFirst, kRun, 0, 1, 3, 1, 2); + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 1, 3, 1, 2)); skipEventForward(iterFirst); checkSkipped(0, 11, 101, 3); - check(iterFirst, kRun, 0, 4, 4, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 4, 4, 0, 2)); skipEventForward(iterFirst); checkSkipped(0, 11, 102, 4); - check(iterFirst, kRun, 0, 4, 4, 1, 2); + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 4, 4, 1, 2)); skipEventForward(iterFirst); checkSkipped(0, 11, 102, 5); - check(iterFirst, kRun, 5, 7, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kRun, 5, 7, -1, 0, 0)); skipEventForward(iterFirst); checkSkipped(1, 11, 102, 6); - check(iterFirst, kEnd, -1, -1, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kEnd, -1, -1, -1, 0, 0)); skipEventForward(iterFirst); checkSkipped(-1, 0, 0, -1); - check(iterFirst, kEnd, -1, -1, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kEnd, -1, -1, -1, 0, 0)); iterFirst = indexIntoFile.begin(IndexIntoFile::firstAppearanceOrder); ++iterFirst; skipEventForward(iterFirst); checkSkipped(0, 11, 101, 0); - check(iterFirst, kLumi, 0, 1, 1, 1, 2); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 1, 1, 1, 2)); skipEventForward(iterFirst); checkSkipped(0, 11, 101, 1); - check(iterFirst, kLumi, 0, 1, 3, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 1, 3, 0, 2)); skipEventForward(iterFirst); checkSkipped(0, 11, 101, 2); - check(iterFirst, kLumi, 0, 1, 3, 1, 2); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 1, 3, 1, 2)); skipEventForward(iterFirst); checkSkipped(0, 11, 101, 3); - check(iterFirst, kLumi, 0, 4, 4, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 4, 4, 0, 2)); skipEventForward(iterFirst); checkSkipped(0, 11, 102, 4); - check(iterFirst, kLumi, 0, 4, 4, 1, 2); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 4, 4, 1, 2)); skipEventForward(iterFirst); checkSkipped(0, 11, 102, 5); - check(iterFirst, kRun, 5, 7, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kRun, 5, 7, -1, 0, 0)); ++iterFirst; ++iterFirst; ++iterFirst; skipEventForward(iterFirst); checkSkipped(1, 11, 102, 6); - check(iterFirst, kEnd, -1, -1, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kEnd, -1, -1, -1, 0, 0)); iterFirst = indexIntoFile.begin(IndexIntoFile::firstAppearanceOrder); ++iterFirst; @@ -532,135 +667,135 @@ void TestIndexIntoFile3::testIterEndWithEvent() { skipEventForward(iterFirst); checkSkipped(0, 11, 101, 0); - check(iterFirst, kEvent, 0, 3, 1, 1, 2); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 3, 1, 1, 2)); skipEventForward(iterFirst); checkSkipped(0, 11, 101, 1); - check(iterFirst, kEvent, 0, 3, 3, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 3, 3, 0, 2)); skipEventForward(iterFirst); checkSkipped(0, 11, 101, 2); - check(iterFirst, kEvent, 0, 3, 3, 1, 2); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 3, 3, 1, 2)); skipEventForward(iterFirst); checkSkipped(0, 11, 101, 3); - check(iterFirst, kLumi, 0, 4, 4, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 4, 4, 0, 2)); ++iterFirst; skipEventForward(iterFirst); checkSkipped(0, 11, 102, 4); - check(iterFirst, kEvent, 0, 4, 4, 1, 2); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 4, 1, 2)); skipEventForward(iterFirst); checkSkipped(0, 11, 102, 5); - check(iterFirst, kRun, 5, 7, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kRun, 5, 7, -1, 0, 0)); iterFirst = indexIntoFile.begin(IndexIntoFile::firstAppearanceOrder); iterFirst.advanceToNextLumiOrRun(); - check(iterFirst, kLumi, 0, 1, 1, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 1, 1, 0, 2)); iterFirst.advanceToNextLumiOrRun(); - check(iterFirst, kLumi, 0, 4, 4, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 4, 4, 0, 2)); iterFirst.advanceToNextLumiOrRun(); - check(iterFirst, kRun, 5, 7, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kRun, 5, 7, -1, 0, 0)); iterFirst.advanceToNextLumiOrRun(); - check(iterFirst, kLumi, 6, 7, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 6, 7, -1, 0, 0)); iterFirst.advanceToNextLumiOrRun(); - check(iterFirst, kLumi, 6, 8, 9, 0, 1); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 6, 8, 9, 0, 1)); iterFirst.advanceToNextLumiOrRun(); - check(iterFirst, kEnd, -1, -1, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kEnd, -1, -1, -1, 0, 0)); iterFirst = indexIntoFile.begin(IndexIntoFile::firstAppearanceOrder); ++iterFirst; ++iterFirst; ++iterFirst; ++iterFirst; - check(iterFirst, kEvent, 0, 3, 1, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 3, 1, 0, 2)); iterFirst.advanceToNextLumiOrRun(); - check(iterFirst, kLumi, 0, 4, 4, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 4, 4, 0, 2)); ++iterFirst; iterFirst.advanceToNextLumiOrRun(); - check(iterFirst, kRun, 5, 7, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kRun, 5, 7, -1, 0, 0)); iterFirst = indexIntoFile.begin(IndexIntoFile::firstAppearanceOrder); ++iterFirst; ++iterFirst; ++iterFirst; ++iterFirst; - check(iterFirst, kEvent, 0, 3, 1, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 3, 1, 0, 2)); iterFirst.advanceToNextRun(); - check(iterFirst, kRun, 5, 7, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kRun, 5, 7, -1, 0, 0)); // Repeat skip tests with the other sort order iterNum = indexIntoFile.begin(IndexIntoFile::numericalOrder); - check(iterNum, kRun, 0, 1, 1, 0, 4); + CPPUNIT_ASSERT(check(iterNum, kRun, 0, 1, 1, 0, 4)); skipEventForward(iterNum); checkSkipped(0, 11, 101, 3); - check(iterNum, kRun, 0, 1, 1, 1, 4); + CPPUNIT_ASSERT(check(iterNum, kRun, 0, 1, 1, 1, 4)); skipEventForward(iterNum); checkSkipped(0, 11, 101, 2); - check(iterNum, kRun, 0, 1, 1, 2, 4); + CPPUNIT_ASSERT(check(iterNum, kRun, 0, 1, 1, 2, 4)); skipEventForward(iterNum); checkSkipped(0, 11, 101, 1); - check(iterNum, kRun, 0, 1, 1, 3, 4); + CPPUNIT_ASSERT(check(iterNum, kRun, 0, 1, 1, 3, 4)); skipEventForward(iterNum); checkSkipped(0, 11, 101, 0); - check(iterNum, kRun, 0, 4, 4, 0, 2); + CPPUNIT_ASSERT(check(iterNum, kRun, 0, 4, 4, 0, 2)); skipEventForward(iterNum); checkSkipped(0, 11, 102, 5); - check(iterNum, kRun, 0, 4, 4, 1, 2); + CPPUNIT_ASSERT(check(iterNum, kRun, 0, 4, 4, 1, 2)); skipEventForward(iterNum); checkSkipped(0, 11, 102, 4); - check(iterNum, kRun, 5, 7, -1, 0, 0); + CPPUNIT_ASSERT(check(iterNum, kRun, 5, 7, -1, 0, 0)); skipEventForward(iterNum); checkSkipped(1, 11, 102, 6); - check(iterNum, kEnd, -1, -1, -1, 0, 0); + CPPUNIT_ASSERT(check(iterNum, kEnd, -1, -1, -1, 0, 0)); skipEventForward(iterNum); checkSkipped(-1, 0, 0, -1); - check(iterNum, kEnd, -1, -1, -1, 0, 0); + CPPUNIT_ASSERT(check(iterNum, kEnd, -1, -1, -1, 0, 0)); iterNum = indexIntoFile.begin(IndexIntoFile::numericalOrder); ++iterNum; skipEventForward(iterNum); checkSkipped(0, 11, 101, 3); - check(iterNum, kLumi, 0, 1, 1, 1, 4); + CPPUNIT_ASSERT(check(iterNum, kLumi, 0, 1, 1, 1, 4)); skipEventForward(iterNum); checkSkipped(0, 11, 101, 2); - check(iterNum, kLumi, 0, 1, 1, 2, 4); + CPPUNIT_ASSERT(check(iterNum, kLumi, 0, 1, 1, 2, 4)); skipEventForward(iterNum); checkSkipped(0, 11, 101, 1); - check(iterNum, kLumi, 0, 1, 1, 3, 4); + CPPUNIT_ASSERT(check(iterNum, kLumi, 0, 1, 1, 3, 4)); skipEventForward(iterNum); checkSkipped(0, 11, 101, 0); - check(iterNum, kLumi, 0, 4, 4, 0, 2); + CPPUNIT_ASSERT(check(iterNum, kLumi, 0, 4, 4, 0, 2)); skipEventForward(iterNum); checkSkipped(0, 11, 102, 5); - check(iterNum, kLumi, 0, 4, 4, 1, 2); + CPPUNIT_ASSERT(check(iterNum, kLumi, 0, 4, 4, 1, 2)); skipEventForward(iterNum); checkSkipped(0, 11, 102, 4); - check(iterNum, kRun, 5, 7, -1, 0, 0); + CPPUNIT_ASSERT(check(iterNum, kRun, 5, 7, -1, 0, 0)); ++iterNum; ++iterNum; ++iterNum; - check(iterNum, kLumi, 6, 8, 8, 0, 1); + CPPUNIT_ASSERT(check(iterNum, kLumi, 6, 8, 8, 0, 1)); skipEventForward(iterNum); checkSkipped(1, 11, 102, 6); - check(iterNum, kEnd, -1, -1, -1, 0, 0); + CPPUNIT_ASSERT(check(iterNum, kEnd, -1, -1, -1, 0, 0)); iterNum = indexIntoFile.begin(IndexIntoFile::numericalOrder); ++iterNum; @@ -670,63 +805,63 @@ void TestIndexIntoFile3::testIterEndWithEvent() { skipEventForward(iterNum); checkSkipped(0, 11, 101, 3); - check(iterNum, kEvent, 0, 3, 1, 1, 4); + CPPUNIT_ASSERT(check(iterNum, kEvent, 0, 3, 1, 1, 4)); skipEventForward(iterNum); checkSkipped(0, 11, 101, 2); - check(iterNum, kEvent, 0, 3, 1, 2, 4); + CPPUNIT_ASSERT(check(iterNum, kEvent, 0, 3, 1, 2, 4)); skipEventForward(iterNum); checkSkipped(0, 11, 101, 1); - check(iterNum, kEvent, 0, 3, 1, 3, 4); + CPPUNIT_ASSERT(check(iterNum, kEvent, 0, 3, 1, 3, 4)); skipEventForward(iterNum); checkSkipped(0, 11, 101, 0); - check(iterNum, kLumi, 0, 4, 4, 0, 2); + CPPUNIT_ASSERT(check(iterNum, kLumi, 0, 4, 4, 0, 2)); ++iterNum; skipEventForward(iterNum); checkSkipped(0, 11, 102, 5); - check(iterNum, kEvent, 0, 4, 4, 1, 2); + CPPUNIT_ASSERT(check(iterNum, kEvent, 0, 4, 4, 1, 2)); skipEventForward(iterNum); checkSkipped(0, 11, 102, 4); - check(iterNum, kRun, 5, 7, -1, 0, 0); + CPPUNIT_ASSERT(check(iterNum, kRun, 5, 7, -1, 0, 0)); iterNum = indexIntoFile.begin(IndexIntoFile::numericalOrder); iterNum.advanceToNextLumiOrRun(); - check(iterNum, kLumi, 0, 1, 1, 0, 4); + CPPUNIT_ASSERT(check(iterNum, kLumi, 0, 1, 1, 0, 4)); iterNum.advanceToNextLumiOrRun(); - check(iterNum, kLumi, 0, 4, 4, 0, 2); + CPPUNIT_ASSERT(check(iterNum, kLumi, 0, 4, 4, 0, 2)); iterNum.advanceToNextLumiOrRun(); - check(iterNum, kRun, 5, 7, -1, 0, 0); + CPPUNIT_ASSERT(check(iterNum, kRun, 5, 7, -1, 0, 0)); iterNum.advanceToNextLumiOrRun(); - check(iterNum, kLumi, 6, 7, -1, 0, 0); + CPPUNIT_ASSERT(check(iterNum, kLumi, 6, 7, -1, 0, 0)); iterNum.advanceToNextLumiOrRun(); - check(iterNum, kLumi, 6, 8, 8, 0, 1); + CPPUNIT_ASSERT(check(iterNum, kLumi, 6, 8, 8, 0, 1)); iterNum.advanceToNextLumiOrRun(); - check(iterNum, kEnd, -1, -1, -1, 0, 0); + CPPUNIT_ASSERT(check(iterNum, kEnd, -1, -1, -1, 0, 0)); iterNum = indexIntoFile.begin(IndexIntoFile::numericalOrder); ++iterNum; ++iterNum; ++iterNum; ++iterNum; - check(iterNum, kEvent, 0, 3, 1, 0, 4); + CPPUNIT_ASSERT(check(iterNum, kEvent, 0, 3, 1, 0, 4)); iterNum.advanceToNextLumiOrRun(); - check(iterNum, kLumi, 0, 4, 4, 0, 2); + CPPUNIT_ASSERT(check(iterNum, kLumi, 0, 4, 4, 0, 2)); ++iterNum; iterNum.advanceToNextLumiOrRun(); - check(iterNum, kRun, 5, 7, -1, 0, 0); + CPPUNIT_ASSERT(check(iterNum, kRun, 5, 7, -1, 0, 0)); iterNum = indexIntoFile.begin(IndexIntoFile::numericalOrder); ++iterNum; ++iterNum; ++iterNum; ++iterNum; - check(iterNum, kEvent, 0, 3, 1, 0, 4); + CPPUNIT_ASSERT(check(iterNum, kEvent, 0, 3, 1, 0, 4)); iterNum.advanceToNextRun(); - check(iterNum, kRun, 5, 7, -1, 0, 0); + CPPUNIT_ASSERT(check(iterNum, kRun, 5, 7, -1, 0, 0)); // Check backwards iteration @@ -734,35 +869,35 @@ void TestIndexIntoFile3::testIterEndWithEvent() { skipEventBackward(iterFirst); checkSkipped(1, 11, 102, 6); - check(iterFirst, kRun, 5, 8, 9, 0, 1); + CPPUNIT_ASSERT(check(iterFirst, kRun, 5, 8, 9, 0, 1)); skipEventBackward(iterFirst); checkSkipped(0, 11, 102, 5); - check(iterFirst, kRun, 0, 4, 4, 1, 2); + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 4, 4, 1, 2)); skipEventBackward(iterFirst); checkSkipped(0, 11, 102, 4); - check(iterFirst, kRun, 0, 4, 4, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 4, 4, 0, 2)); skipEventBackward(iterFirst); checkSkipped(0, 11, 101, 3); - check(iterFirst, kRun, 0, 1, 3, 1, 2); + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 1, 3, 1, 2)); skipEventBackward(iterFirst); checkSkipped(0, 11, 101, 2); - check(iterFirst, kRun, 0, 1, 3, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 1, 3, 0, 2)); skipEventBackward(iterFirst); checkSkipped(0, 11, 101, 1); - check(iterFirst, kRun, 0, 1, 1, 1, 2); + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 1, 1, 1, 2)); skipEventBackward(iterFirst); checkSkipped(0, 11, 101, 0); - check(iterFirst, kRun, 0, 1, 1, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 1, 1, 0, 2)); skipEventBackward(iterFirst); checkSkipped(-1, 0, 0, -1); - check(iterFirst, kRun, 0, 1, 1, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 1, 1, 0, 2)); ++iterFirst; ++iterFirst; @@ -774,79 +909,79 @@ void TestIndexIntoFile3::testIterEndWithEvent() { ++iterFirst; ++iterFirst; ++iterFirst; - check(iterFirst, kEvent, 0, 4, 4, 1, 2); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 4, 1, 2)); skipEventBackward(iterFirst); checkSkipped(0, 11, 102, 4); - check(iterFirst, kEvent, 0, 4, 4, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 4, 0, 2)); skipEventBackward(iterFirst); checkSkipped(0, 11, 101, 3); - check(iterFirst, kLumi, 0, 1, 3, 1, 2); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 1, 3, 1, 2)); skipEventForward(iterFirst); skipEventForward(iterFirst); - check(iterFirst, kLumi, 0, 4, 4, 1, 2); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 4, 4, 1, 2)); skipEventBackward(iterFirst); checkSkipped(0, 11, 102, 4); - check(iterFirst, kLumi, 0, 4, 4, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 4, 4, 0, 2)); skipEventBackward(iterFirst); checkSkipped(0, 11, 101, 3); - check(iterFirst, kLumi, 0, 1, 3, 1, 2); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 1, 3, 1, 2)); iterFirst.advanceToNextRun(); iterFirst.advanceToEvent(); - check(iterFirst, kEvent, 6, 9, 9, 0, 1); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 6, 9, 9, 0, 1)); skipEventBackward(iterFirst); checkSkipped(0, 11, 102, 5); - check(iterFirst, kRun, 0, 4, 4, 1, 2); + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 4, 4, 1, 2)); iterFirst.advanceToNextRun(); ++iterFirst; ++iterFirst; ++iterFirst; - check(iterFirst, kLumi, 6, 8, 9, 0, 1); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 6, 8, 9, 0, 1)); skipEventBackward(iterFirst); checkSkipped(0, 11, 102, 5); - check(iterFirst, kRun, 0, 4, 4, 1, 2); + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 4, 4, 1, 2)); iterNum = indexIntoFile.end(IndexIntoFile::numericalOrder); skipEventBackward(iterNum); checkSkipped(1, 11, 102, 6); - check(iterNum, kRun, 5, 8, 8, 0, 1); + CPPUNIT_ASSERT(check(iterNum, kRun, 5, 8, 8, 0, 1)); skipEventBackward(iterNum); checkSkipped(0, 11, 102, 4); - check(iterNum, kRun, 0, 4, 4, 1, 2); + CPPUNIT_ASSERT(check(iterNum, kRun, 0, 4, 4, 1, 2)); skipEventBackward(iterNum); checkSkipped(0, 11, 102, 5); - check(iterNum, kRun, 0, 4, 4, 0, 2); + CPPUNIT_ASSERT(check(iterNum, kRun, 0, 4, 4, 0, 2)); skipEventBackward(iterNum); checkSkipped(0, 11, 101, 0); - check(iterNum, kRun, 0, 1, 1, 3, 4); + CPPUNIT_ASSERT(check(iterNum, kRun, 0, 1, 1, 3, 4)); skipEventBackward(iterNum); checkSkipped(0, 11, 101, 1); - check(iterNum, kRun, 0, 1, 1, 2, 4); + CPPUNIT_ASSERT(check(iterNum, kRun, 0, 1, 1, 2, 4)); skipEventBackward(iterNum); checkSkipped(0, 11, 101, 2); - check(iterNum, kRun, 0, 1, 1, 1, 4); + CPPUNIT_ASSERT(check(iterNum, kRun, 0, 1, 1, 1, 4)); skipEventBackward(iterNum); checkSkipped(0, 11, 101, 3); - check(iterNum, kRun, 0, 1, 1, 0, 4); + CPPUNIT_ASSERT(check(iterNum, kRun, 0, 1, 1, 0, 4)); skipEventBackward(iterNum); checkSkipped(-1, 0, 0, -1); - check(iterNum, kRun, 0, 1, 1, 0, 4); + CPPUNIT_ASSERT(check(iterNum, kRun, 0, 1, 1, 0, 4)); ++iterNum; ++iterNum; @@ -858,45 +993,45 @@ void TestIndexIntoFile3::testIterEndWithEvent() { ++iterNum; ++iterNum; ++iterNum; - check(iterNum, kEvent, 0, 4, 4, 1, 2); + CPPUNIT_ASSERT(check(iterNum, kEvent, 0, 4, 4, 1, 2)); skipEventBackward(iterNum); checkSkipped(0, 11, 102, 5); - check(iterNum, kEvent, 0, 4, 4, 0, 2); + CPPUNIT_ASSERT(check(iterNum, kEvent, 0, 4, 4, 0, 2)); skipEventBackward(iterNum); checkSkipped(0, 11, 101, 0); - check(iterNum, kLumi, 0, 1, 1, 3, 4); + CPPUNIT_ASSERT(check(iterNum, kLumi, 0, 1, 1, 3, 4)); skipEventForward(iterNum); skipEventForward(iterNum); - check(iterNum, kLumi, 0, 4, 4, 1, 2); + CPPUNIT_ASSERT(check(iterNum, kLumi, 0, 4, 4, 1, 2)); skipEventBackward(iterNum); checkSkipped(0, 11, 102, 5); - check(iterNum, kLumi, 0, 4, 4, 0, 2); + CPPUNIT_ASSERT(check(iterNum, kLumi, 0, 4, 4, 0, 2)); skipEventBackward(iterNum); checkSkipped(0, 11, 101, 0); - check(iterNum, kLumi, 0, 1, 1, 3, 4); + CPPUNIT_ASSERT(check(iterNum, kLumi, 0, 1, 1, 3, 4)); iterNum.advanceToNextRun(); iterNum.advanceToEvent(); - check(iterNum, kEvent, 6, 9, 8, 0, 1); + CPPUNIT_ASSERT(check(iterNum, kEvent, 6, 9, 8, 0, 1)); skipEventBackward(iterNum); checkSkipped(0, 11, 102, 4); - check(iterNum, kRun, 0, 4, 4, 1, 2); + CPPUNIT_ASSERT(check(iterNum, kRun, 0, 4, 4, 1, 2)); iterNum.advanceToNextRun(); ++iterNum; ++iterNum; ++iterNum; - check(iterNum, kLumi, 6, 8, 8, 0, 1); + CPPUNIT_ASSERT(check(iterNum, kLumi, 6, 8, 8, 0, 1)); skipEventBackward(iterNum); checkSkipped(0, 11, 102, 4); - check(iterNum, kRun, 0, 4, 4, 1, 2); + CPPUNIT_ASSERT(check(iterNum, kRun, 0, 4, 4, 1, 2)); } void TestIndexIntoFile3::testOverlappingLumis() { @@ -940,41 +1075,41 @@ void TestIndexIntoFile3::testOverlappingLumis() { int i = 0; for (i = 0; iterFirst != iterFirstEnd; ++iterFirst, ++i) { if (i == 0) { - check(iterFirst, kRun, 0, 1, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 1, -1, 0, 0)); CPPUNIT_ASSERT(iterFirst.indexIntoFile() == &indexIntoFile); CPPUNIT_ASSERT(iterFirst.size() == 11); } //values are 'IndexIntoFile::EntryType' 'indexToRun' 'indexToLumi' 'indexToEventRange' 'indexToEvent' 'nEvents' else if (i == 1) - check(iterFirst, kLumi, 0, 1, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 1, -1, 0, 0)); else if (i == 2) - check(iterFirst, kLumi, 0, 3, 2, 0, 4); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 3, 2, 0, 4)); else if (i == 3) - check(iterFirst, kEvent, 0, 3, 2, 0, 4); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 3, 2, 0, 4)); else if (i == 4) - check(iterFirst, kEvent, 0, 3, 2, 1, 4); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 3, 2, 1, 4)); else if (i == 5) - check(iterFirst, kEvent, 0, 3, 2, 2, 4); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 3, 2, 2, 4)); else if (i == 6) - check(iterFirst, kEvent, 0, 3, 2, 3, 4); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 3, 2, 3, 4)); else if (i == 7) - check(iterFirst, kLumi, 0, 5, 4, 0, 1); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 5, 4, 0, 1)); else if (i == 8) - check(iterFirst, kEvent, 0, 5, 4, 0, 1); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 5, 4, 0, 1)); else if (i == 9) - check(iterFirst, kEvent, 0, 5, 5, 0, 1); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 5, 5, 0, 1)); else if (i == 10) - check(iterFirst, kRun, 6, 8, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kRun, 6, 8, -1, 0, 0)); else if (i == 11) - check(iterFirst, kRun, 7, 8, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kRun, 7, 8, -1, 0, 0)); else if (i == 12) - check(iterFirst, kLumi, 7, 8, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 7, 8, -1, 0, 0)); else if (i == 13) - check(iterFirst, kLumi, 7, 9, 10, 0, 1); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 7, 9, 10, 0, 1)); else if (i == 14) - check(iterFirst, kLumi, 7, 10, 10, 0, 1); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 7, 10, 10, 0, 1)); else if (i == 15) - check(iterFirst, kEvent, 7, 10, 10, 0, 1); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 7, 10, 10, 0, 1)); else CPPUNIT_ASSERT(false); @@ -1001,68 +1136,129 @@ void TestIndexIntoFile3::testOverlappingLumis() { for (i = 0; iterFirst != iterFirstEnd; ++iterFirst, ++i) { //values are 'IndexIntoFile::EntryType' 'indexToRun' 'indexToLumi' 'indexToEventRange' 'indexToEvent' 'nEvents' if (i == 0) { - check(iterFirst, kRun, 0, 2, 1, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 2, 1, 0, 2)); iterFirst.getLumisInRun(lumis); std::vector expected{102, 103, 104}; CPPUNIT_ASSERT(lumis == expected); } else if (i == 1) - check(iterFirst, kLumi, 0, 2, 1, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 2, 1, 0, 2)); + else if (i == 2) + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 2, 1, 0, 2)); + else if (i == 3) + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 2, 1, 1, 2)); + else if (i == 4) + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 4, 3, 0, 4)); + else if (i == 5) + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 3, 0, 4)); + else if (i == 6) + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 3, 1, 4)); + else if (i == 7) + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 3, 2, 4)); + else if (i == 8) + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 3, 3, 4)); + else if (i == 9) + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 5, -1, 0, 0)); + else if (i == 10) + CPPUNIT_ASSERT(check(iterFirst, kRun, 6, 8, -1, 0, 0)); + else if (i == 11) + CPPUNIT_ASSERT(check(iterFirst, kRun, 7, 8, -1, 0, 0)); + else if (i == 12) + CPPUNIT_ASSERT(check(iterFirst, kLumi, 7, 8, -1, 0, 0)); + else if (i == 13) + CPPUNIT_ASSERT(check(iterFirst, kLumi, 7, 9, 9, 0, 1)); + else if (i == 14) + CPPUNIT_ASSERT(check(iterFirst, kLumi, 7, 10, 9, 0, 1)); + else if (i == 15) + CPPUNIT_ASSERT(check(iterFirst, kEvent, 7, 10, 9, 0, 1)); + else + CPPUNIT_ASSERT(false); + } + CPPUNIT_ASSERT(i == 16); + } + { + edm::IndexIntoFile::IndexIntoFileItr iterFirst = indexIntoFile.begin(IndexIntoFile::entryOrder); + edm::IndexIntoFile::IndexIntoFileItr iterFirstEnd = indexIntoFile.end(IndexIntoFile::entryOrder); + int i = 0; + for (i = 0; iterFirst != iterFirstEnd; ++iterFirst, ++i) { + //values are 'IndexIntoFile::EntryType' 'indexToRun' 'indexToLumi' 'indexToEventRange' 'indexToEvent' 'nEvents' + if (i == 0) { + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 1, -1, 0, 0)); + CPPUNIT_ASSERT(iterFirst.indexIntoFile() == &indexIntoFile); + CPPUNIT_ASSERT(iterFirst.size() == 11); + } + //values are 'IndexIntoFile::EntryType' 'indexToRun' 'indexToLumi' 'indexToEventRange' 'indexToEvent' 'nEvents' + else if (i == 1) + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 1, -1, 0, 0)); else if (i == 2) - check(iterFirst, kEvent, 0, 2, 1, 0, 2); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 3, 2, 0, 4)); else if (i == 3) - check(iterFirst, kEvent, 0, 2, 1, 1, 2); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 3, 2, 0, 4)); else if (i == 4) - check(iterFirst, kLumi, 0, 4, 3, 0, 4); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 3, 2, 1, 4)); else if (i == 5) - check(iterFirst, kEvent, 0, 4, 3, 0, 4); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 3, 2, 2, 4)); else if (i == 6) - check(iterFirst, kEvent, 0, 4, 3, 1, 4); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 3, 2, 3, 4)); else if (i == 7) - check(iterFirst, kEvent, 0, 4, 3, 2, 4); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 5, 4, 0, 1)); else if (i == 8) - check(iterFirst, kEvent, 0, 4, 3, 3, 4); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 5, 4, 0, 1)); else if (i == 9) - check(iterFirst, kLumi, 0, 5, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 5, 5, 0, 1)); else if (i == 10) - check(iterFirst, kRun, 6, 8, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kRun, 6, 8, -1, 0, 0)); else if (i == 11) - check(iterFirst, kRun, 7, 8, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kRun, 7, 8, -1, 0, 0)); else if (i == 12) - check(iterFirst, kLumi, 7, 8, -1, 0, 0); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 7, 8, -1, 0, 0)); else if (i == 13) - check(iterFirst, kLumi, 7, 9, 9, 0, 1); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 7, 9, 10, 0, 1)); else if (i == 14) - check(iterFirst, kLumi, 7, 10, 9, 0, 1); + CPPUNIT_ASSERT(check(iterFirst, kLumi, 7, 10, 10, 0, 1)); else if (i == 15) - check(iterFirst, kEvent, 7, 10, 9, 0, 1); + CPPUNIT_ASSERT(check(iterFirst, kEvent, 7, 10, 10, 0, 1)); else CPPUNIT_ASSERT(false); + + if (i == 1) + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 0); + if (i == 9) + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 0); + if (i == 11) + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 6); + + if (i == 2) + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == 0); + if (i == 9) + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == 4); + if (i == 11) + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == IndexIntoFile::invalidIndex); } CPPUNIT_ASSERT(i == 16); } { edm::IndexIntoFile::IndexIntoFileItr testIter = indexIntoFile.findPosition(11, 103, 7); - check(testIter, kRun, 0, 4, 3, 3, 4); + CPPUNIT_ASSERT(check(testIter, kRun, 0, 4, 3, 3, 4)); ++testIter; - check(testIter, kLumi, 0, 4, 3, 3, 4); + CPPUNIT_ASSERT(check(testIter, kLumi, 0, 4, 3, 3, 4)); ++testIter; - check(testIter, kEvent, 0, 4, 3, 3, 4); + CPPUNIT_ASSERT(check(testIter, kEvent, 0, 4, 3, 3, 4)); ++testIter; - check(testIter, kLumi, 0, 5, -1, 0, 0); + CPPUNIT_ASSERT(check(testIter, kLumi, 0, 5, -1, 0, 0)); } { edm::IndexIntoFile::IndexIntoFileItr testIter = indexIntoFile.findPosition(11, 0, 7); - check(testIter, kRun, 0, 4, 3, 3, 4); + CPPUNIT_ASSERT(check(testIter, kRun, 0, 4, 3, 3, 4)); ++testIter; - check(testIter, kLumi, 0, 4, 3, 3, 4); + CPPUNIT_ASSERT(check(testIter, kLumi, 0, 4, 3, 3, 4)); ++testIter; - check(testIter, kEvent, 0, 4, 3, 3, 4); + CPPUNIT_ASSERT(check(testIter, kEvent, 0, 4, 3, 3, 4)); ++testIter; - check(testIter, kLumi, 0, 5, -1, 0, 0); + CPPUNIT_ASSERT(check(testIter, kLumi, 0, 5, -1, 0, 0)); skipEventBackward(testIter); - check(testIter, kLumi, 0, 4, 3, 3, 4); + CPPUNIT_ASSERT(check(testIter, kLumi, 0, 4, 3, 3, 4)); } } @@ -1090,68 +1286,1089 @@ void TestIndexIntoFile3::testOverlappingLumisMore() { std::vector lumis; - edm::IndexIntoFile::IndexIntoFileItr iterFirst = indexIntoFile.begin(IndexIntoFile::firstAppearanceOrder); - edm::IndexIntoFile::IndexIntoFileItr iterFirstEnd = indexIntoFile.end(IndexIntoFile::firstAppearanceOrder); - int i = 0; - for (i = 0; iterFirst != iterFirstEnd; ++iterFirst, ++i) { - if (i == 0) { - check(iterFirst, kRun, 0, 2, 1, 0, 3); - CPPUNIT_ASSERT(iterFirst.indexIntoFile() == &indexIntoFile); - CPPUNIT_ASSERT(iterFirst.size() == 10); + { + edm::IndexIntoFile::IndexIntoFileItr iterFirst = indexIntoFile.begin(IndexIntoFile::firstAppearanceOrder); + edm::IndexIntoFile::IndexIntoFileItr iterFirstEnd = indexIntoFile.end(IndexIntoFile::firstAppearanceOrder); + int i = 0; + for (i = 0; iterFirst != iterFirstEnd; ++iterFirst, ++i) { + switch (i) { + case 0: { + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 2, 1, 0, 3)); + CPPUNIT_ASSERT(iterFirst.indexIntoFile() == &indexIntoFile); + CPPUNIT_ASSERT(iterFirst.size() == 10); + + iterFirst.getLumisInRun(lumis); + std::vector expected{101, 102}; + CPPUNIT_ASSERT(lumis == expected); + break; + } + //values are 'IndexIntoFile::EntryType' 'indexToRun' 'indexToLumi' 'indexToEventRange' 'indexToEvent' 'nEvents' + case 1: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 2, 1, 0, 3)); + break; + } + case 2: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 2, 1, 0, 3)); + break; + } + case 3: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 2, 1, 1, 3)); + break; + } + case 4: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 2, 1, 2, 3)); + break; + } + case 5: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 2, 2, 0, 1)); + break; + } + case 6: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 4, 3, 0, 1)); + break; + } + case 7: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 3, 0, 1)); + break; + } + case 8: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 4, 0, 1)); + break; + } + case 9: { + CPPUNIT_ASSERT(check(iterFirst, kRun, 5, 7, -1, 0, 0)); + + iterFirst.getLumisInRun(lumis); + std::vector expected{101, 102}; + CPPUNIT_ASSERT(lumis == expected); + break; + } + case 10: { + CPPUNIT_ASSERT(check(iterFirst, kRun, 6, 7, -1, 0, 0)); + break; + } + case 11: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 6, 7, -1, 0, 0)); + break; + } + case 12: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 6, 8, 9, 0, 1)); + break; + } + case 13: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 6, 9, 9, 0, 1)); + break; + } + case 14: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 6, 9, 9, 0, 1)); + break; + } + default: { + CPPUNIT_ASSERT(false); + } + } + if (i == 0) + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 0); + if (i == 8) + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 0); + if (i == 10) + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 6); - iterFirst.getLumisInRun(lumis); - std::vector expected{101, 102}; - CPPUNIT_ASSERT(lumis == expected); + if (i == 0) + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == 0); + if (i == 8) + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == 4); + if (i == 10) + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == IndexIntoFile::invalidIndex); } - //values are 'IndexIntoFile::EntryType' 'indexToRun' 'indexToLumi' 'indexToEventRange' 'indexToEvent' 'nEvents' - else if (i == 1) - check(iterFirst, kLumi, 0, 2, 1, 0, 3); - else if (i == 2) - check(iterFirst, kEvent, 0, 2, 1, 0, 3); - else if (i == 3) - check(iterFirst, kEvent, 0, 2, 1, 1, 3); - else if (i == 4) - check(iterFirst, kEvent, 0, 2, 1, 2, 3); - else if (i == 5) - check(iterFirst, kEvent, 0, 2, 2, 0, 1); - else if (i == 6) - check(iterFirst, kLumi, 0, 4, 3, 0, 1); - else if (i == 7) - check(iterFirst, kEvent, 0, 4, 3, 0, 1); - else if (i == 8) - check(iterFirst, kEvent, 0, 4, 4, 0, 1); - else if (i == 9) { - check(iterFirst, kRun, 5, 7, -1, 0, 0); - - iterFirst.getLumisInRun(lumis); - std::vector expected{101, 102}; - CPPUNIT_ASSERT(lumis == expected); - } else if (i == 10) - check(iterFirst, kRun, 6, 7, -1, 0, 0); - else if (i == 11) - check(iterFirst, kLumi, 6, 7, -1, 0, 0); - else if (i == 12) - check(iterFirst, kLumi, 6, 8, 9, 0, 1); - else if (i == 13) - check(iterFirst, kLumi, 6, 9, 9, 0, 1); - else if (i == 14) - check(iterFirst, kEvent, 6, 9, 9, 0, 1); - else - CPPUNIT_ASSERT(false); + CPPUNIT_ASSERT(i == 15); + } - if (i == 0) - CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 0); - if (i == 8) - CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 0); - if (i == 10) - CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 6); + { + edm::IndexIntoFile::IndexIntoFileItr iterFirst = indexIntoFile.begin(IndexIntoFile::entryOrder); + edm::IndexIntoFile::IndexIntoFileItr iterFirstEnd = indexIntoFile.end(IndexIntoFile::entryOrder); + int i = 0; + for (i = 0; iterFirst != iterFirstEnd; ++iterFirst, ++i) { + switch (i) { + case 0: { + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 2, 1, 0, 3)); + CPPUNIT_ASSERT(iterFirst.indexIntoFile() == &indexIntoFile); + CPPUNIT_ASSERT(iterFirst.size() == 10); + + iterFirst.getLumisInRun(lumis); + std::vector expected{101, 102}; + CPPUNIT_ASSERT(lumis == expected); + break; + } + //values are 'IndexIntoFile::EntryType' 'indexToRun' 'indexToLumi' 'indexToEventRange' 'indexToEvent' 'nEvents' + case 1: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 2, 1, 0, 3)); + break; + } + case 2: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 2, 1, 0, 3)); + break; + } + case 3: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 2, 1, 1, 3)); + break; + } + case 4: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 2, 1, 2, 3)); + break; + } + case 5: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 2, 2, 0, 1)); + break; + } + case 6: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 4, 3, 0, 1)); + break; + } + case 7: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 3, 0, 1)); + break; + } + case 8: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 4, 0, 1)); + break; + } + case 9: { + CPPUNIT_ASSERT(check(iterFirst, kRun, 5, 7, -1, 0, 0)); + + iterFirst.getLumisInRun(lumis); + std::vector expected{101, 102}; + CPPUNIT_ASSERT(lumis == expected); + break; + } + case 10: { + CPPUNIT_ASSERT(check(iterFirst, kRun, 6, 7, -1, 0, 0)); + break; + } + case 11: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 6, 7, -1, 0, 0)); + break; + } + case 12: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 6, 8, 9, 0, 1)); + break; + } + case 13: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 6, 9, 9, 0, 1)); + break; + } + case 14: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 6, 9, 9, 0, 1)); + break; + } + default: + CPPUNIT_ASSERT(false); + } - if (i == 0) - CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == 0); - if (i == 8) - CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == 4); - if (i == 10) - CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == IndexIntoFile::invalidIndex); + if (i == 0) + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 0); + if (i == 8) + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 0); + if (i == 10) + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 6); + + if (i == 0) + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == 0); + if (i == 8) + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == 4); + if (i == 10) + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == IndexIntoFile::invalidIndex); + } + CPPUNIT_ASSERT(i == 15); + } +} + +void TestIndexIntoFile3::testOverlappingLumisOutOfOrderEvent() { + edm::IndexIntoFile indexIntoFile; + indexIntoFile.addEntry(fakePHID1, 11, 101, 7, 0); // Event + indexIntoFile.addEntry(fakePHID1, 11, 101, 6, 1); // Event + indexIntoFile.addEntry(fakePHID1, 11, 101, 5, 2); // Event + //Dummy Lumi gets added + indexIntoFile.addEntry(fakePHID1, 11, 102, 5, 3); // Event + //Another dummy lumi gets added + indexIntoFile.addEntry(fakePHID1, 11, 101, 4, 4); // Event + indexIntoFile.addEntry(fakePHID1, 11, 101, 0, 0); // Lumi + + indexIntoFile.addEntry(fakePHID1, 11, 102, 4, 5); // Event + indexIntoFile.addEntry(fakePHID1, 11, 102, 0, 1); // Lumi + indexIntoFile.addEntry(fakePHID1, 11, 0, 0, 0); // Run + indexIntoFile.addEntry(fakePHID2, 11, 0, 0, 1); // Run + indexIntoFile.addEntry(fakePHID2, 11, 101, 0, 2); // Lumi + indexIntoFile.addEntry(fakePHID2, 11, 102, 0, 3); // Lumi + indexIntoFile.addEntry(fakePHID2, 11, 102, 4, 6); // Event + indexIntoFile.addEntry(fakePHID2, 11, 102, 0, 4); // Lumi + indexIntoFile.addEntry(fakePHID2, 11, 0, 0, 2); // Run + indexIntoFile.sortVector_Run_Or_Lumi_Entries(); + + std::vector lumis; + + { + edm::IndexIntoFile::IndexIntoFileItr iterFirst = indexIntoFile.begin(IndexIntoFile::firstAppearanceOrder); + edm::IndexIntoFile::IndexIntoFileItr iterFirstEnd = indexIntoFile.end(IndexIntoFile::firstAppearanceOrder); + int i = 0; + for (i = 0; iterFirst != iterFirstEnd; ++iterFirst, ++i) { + switch (i) { + case 0: { + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 2, 1, 0, 3)); // run 11 + CPPUNIT_ASSERT(iterFirst.indexIntoFile() == &indexIntoFile); + CPPUNIT_ASSERT(iterFirst.size() == 10); + + iterFirst.getLumisInRun(lumis); + std::vector expected{101, 102}; + CPPUNIT_ASSERT(lumis == expected); + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 0); + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == 0); + break; + } + //values are 'IndexIntoFile::EntryType' 'indexToRun' 'indexToLumi' 'indexToEventRange' 'indexToEvent' 'nEvents' + case 1: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 2, 1, 0, 3)); // lumi 11/101 + break; + } + case 2: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 2, 1, 0, 3)); // event 11/101/7 + break; + } + case 3: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 2, 1, 1, 3)); // event 11/101/6 + break; + } + case 4: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 2, 1, 2, 3)); // event 11/101/5 + break; + } + case 5: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 2, 2, 0, 1)); + break; + } + case 6: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 4, 3, 0, 1)); + break; + } + case 7: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 3, 0, 1)); + break; + } + case 8: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 4, 0, 1)); + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 0); + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == 3); + break; + } + case 9: { + CPPUNIT_ASSERT(check(iterFirst, kRun, 5, 7, -1, 0, 0)); + + iterFirst.getLumisInRun(lumis); + std::vector expected{101, 102}; + CPPUNIT_ASSERT(lumis == expected); + break; + } + case 10: { + CPPUNIT_ASSERT(check(iterFirst, kRun, 6, 7, -1, 0, 0)); + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 6); + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == IndexIntoFile::invalidIndex); + break; + } + case 11: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 6, 7, -1, 0, 0)); + break; + } + case 12: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 6, 8, 9, 0, 1)); + break; + } + case 13: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 6, 9, 9, 0, 1)); + break; + } + case 14: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 6, 9, 9, 0, 1)); + break; + } + default: { + CPPUNIT_ASSERT(false); + } + } + } + CPPUNIT_ASSERT(i == 15); + } + + { + edm::IndexIntoFile::IndexIntoFileItr iterFirst = indexIntoFile.begin(IndexIntoFile::entryOrder); + edm::IndexIntoFile::IndexIntoFileItr iterFirstEnd = indexIntoFile.end(IndexIntoFile::entryOrder); + int i = 0; + for (i = 0; iterFirst != iterFirstEnd; ++iterFirst, ++i) { + /*std::cout << "out of order run:" << iterFirst.run() << " lumi:" << iterFirst.lumi() + << " firstEventEntryThisRun:" << iterFirst.firstEventEntryThisRun() + << " firstEventEntryThisLumi:" << iterFirst.firstEventEntryThisLumi() << std::endl; */ + switch (i) { + case 0: { + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 1, 1, 0, 3)); // run 11 + CPPUNIT_ASSERT(iterFirst.indexIntoFile() == &indexIntoFile); + CPPUNIT_ASSERT(iterFirst.size() == 10); + + iterFirst.getLumisInRun(lumis); + std::vector expected{101, 102}; + CPPUNIT_ASSERT(lumis == expected); + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 0); + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == 0); + break; + } + //values are 'IndexIntoFile::EntryType' 'indexToRun' 'indexToLumi' 'indexToEventRange' 'indexToEvent' 'nEvents' + case 1: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 1, 1, 0, 3)); // lumi 11/101 + CPPUNIT_ASSERT(iterFirst.entryContinues()); + break; + } + case 2: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 1, 1, 0, 3)); // event 11/101/7 + break; + } + case 3: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 1, 1, 1, 3)); // event 11/101/6 + break; + } + case 4: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 1, 1, 2, 3)); // event 11/101/5 + break; + } + case 5: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 2, 2, 0, 1)); // lumi 11/102 + CPPUNIT_ASSERT(iterFirst.entryContinues()); + break; + } + case 6: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 2, 2, 0, 1)); // event 11/102/3 + break; + } + case 7: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 3, 3, 0, 1)); // lumi 11/101 + CPPUNIT_ASSERT(not iterFirst.entryContinues()); + break; + } + case 8: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 3, 3, 0, 1)); // event 11/101/4 + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 0); + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == 4); + break; + } + case 9: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 4, 4, 0, 1)); // lumi 11/102 + CPPUNIT_ASSERT(not iterFirst.entryContinues()); + break; + } + case 10: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 4, 0, 1)); // event 11/102/4 + break; + } + case 11: { + CPPUNIT_ASSERT(check(iterFirst, kRun, 5, 7, -1, 0, 0)); //Run Phid 2 11 + + iterFirst.getLumisInRun(lumis); + std::vector expected{101, 102}; + CPPUNIT_ASSERT(lumis == expected); + + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 6); + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == IndexIntoFile::invalidIndex); + break; + } + case 12: { + CPPUNIT_ASSERT(check(iterFirst, kRun, 6, 7, -1, 0, 0)); + break; + } + case 13: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 6, 7, -1, 0, 0)); + break; + } + case 14: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 6, 8, 9, 0, 1)); + break; + } + case 15: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 6, 9, 9, 0, 1)); + break; + } + case 16: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 6, 9, 9, 0, 1)); + break; + } + default: + CPPUNIT_ASSERT(false); + } + } + CPPUNIT_ASSERT(i == 17); + } +} + +void TestIndexIntoFile3::testOverlappingLumisWithEndWithEmptyLumi() { + // from a failed job + edm::IndexIntoFile indexIntoFile; + indexIntoFile.addEntry(fakePHID1, 1, 1, 2, 0); // Event + indexIntoFile.addEntry(fakePHID1, 1, 1, 5, 1); // Event + indexIntoFile.addEntry(fakePHID1, 1, 2, 8, 2); // Event + indexIntoFile.addEntry(fakePHID1, 1, 2, 6, 3); // Event + indexIntoFile.addEntry(fakePHID1, 1, 1, 3, 4); // Event + indexIntoFile.addEntry(fakePHID1, 1, 2, 9, 5); // Event + indexIntoFile.addEntry(fakePHID1, 1, 1, 4, 6); // Event + indexIntoFile.addEntry(fakePHID1, 1, 1, 1, 7); // Event + indexIntoFile.addEntry(fakePHID1, 1, 2, 7, 8); // Event + indexIntoFile.addEntry(fakePHID1, 1, 1, 0, 0); // Lumi + indexIntoFile.addEntry(fakePHID1, 1, 2, 10, 9); // Event + indexIntoFile.addEntry(fakePHID1, 1, 2, 0, 1); // Lumi + indexIntoFile.addEntry(fakePHID1, 1, 3, 12, 10); // Event + indexIntoFile.addEntry(fakePHID1, 1, 3, 11, 11); // Event + indexIntoFile.addEntry(fakePHID1, 1, 3, 15, 12); // Event + indexIntoFile.addEntry(fakePHID1, 1, 3, 14, 13); // Event + indexIntoFile.addEntry(fakePHID1, 1, 4, 18, 14); // Event + indexIntoFile.addEntry(fakePHID1, 1, 4, 17, 15); // Event + indexIntoFile.addEntry(fakePHID1, 1, 4, 20, 16); // Event + indexIntoFile.addEntry(fakePHID1, 1, 3, 13, 17); // Event + indexIntoFile.addEntry(fakePHID1, 1, 3, 0, 2); // Lumi + indexIntoFile.addEntry(fakePHID1, 1, 4, 19, 18); // Event + indexIntoFile.addEntry(fakePHID1, 1, 4, 16, 19); // Event + indexIntoFile.addEntry(fakePHID1, 1, 4, 0, 3); // Lumi + indexIntoFile.addEntry(fakePHID1, 1, 0, 0, 0); // Run + indexIntoFile.sortVector_Run_Or_Lumi_Entries(); + + std::vector lumis; + + { + edm::IndexIntoFile::IndexIntoFileItr iterFirst = indexIntoFile.begin(IndexIntoFile::firstAppearanceOrder); + edm::IndexIntoFile::IndexIntoFileItr iterFirstEnd = indexIntoFile.end(IndexIntoFile::firstAppearanceOrder); + int i = 0; + for (i = 0; iterFirst != iterFirstEnd; ++iterFirst, ++i) { + //std::cout << "out of order run:" << iterFirst.run() << " lumi:" << iterFirst.lumi() + // << " firstEventEntryThisRun:" << iterFirst.firstEventEntryThisRun() + // << " firstEventEntryThisLumi:" << iterFirst.firstEventEntryThisLumi() << std::endl; + switch (i) { + case 0: { + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 4, 1, 0, 2)); // run 1 + CPPUNIT_ASSERT(iterFirst.indexIntoFile() == &indexIntoFile); + CPPUNIT_ASSERT(iterFirst.size() == 13); + iterFirst.getLumisInRun(lumis); + std::vector expected{1, 2, 3, 4}; + CPPUNIT_ASSERT(lumis == expected); + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 0); + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == 0); + break; + } + //values are 'IndexIntoFile::EntryType' 'indexToRun' 'indexToLumi' 'indexToEventRange' 'indexToEvent' 'nEvents' + case 1: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 4, 1, 0, 2)); // lumi 1/1 + break; + } + case 2: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 1, 0, 2)); // event 1/1/2 + break; + } + case 3: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 1, 1, 2)); // event 1/1/5 + break; + } + case 4: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 2, 0, 1)); // event 1/1/3 + break; + } + case 5: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 3, 0, 2)); // event 1/1/4 + break; + } + case 6: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 3, 1, 2)); // event 1/1/1 + break; + } + case 7: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 8, 5, 0, 2)); // lumi 1/2 + break; + } + case 8: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 8, 5, 0, 2)); // event 1/2/8 + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 0); + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == 2); + break; + } + case 9: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 8, 5, 1, 2)); // event 1/2/6 + break; + } + case 10: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 8, 6, 0, 1)); // event 1/2/9 + break; + } + case 11: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 8, 7, 0, 1)); // event 1/2/7 + break; + } + case 12: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 8, 8, 0, 1)); // event 1/2/10 + break; + } + case 13: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 10, 9, 0, 4)); // lumi 1/3 + break; + } + case 14: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 10, 9, 0, 4)); // event 1/3/12 + break; + } + case 15: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 10, 9, 1, 4)); // event 1/3/11 + break; + } + case 16: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 10, 9, 2, 4)); // event 1/3/15 + break; + } + case 17: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 10, 9, 3, 4)); // event 1/3/14 + break; + } + case 18: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 10, 10, 0, 1)); // event 1/3/13 + break; + } + case 19: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 12, 11, 0, 3)); // lumi 1/4 + break; + } + case 20: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 12, 11, 0, 3)); // event 1/4/18 + break; + } + case 21: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 12, 11, 1, 3)); // event 1/4/17 + break; + } + case 22: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 12, 11, 2, 3)); // event 1/4/20 + break; + } + case 23: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 12, 12, 0, 2)); // event 1/4/19 + break; + } + case 24: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 12, 12, 1, 2)); // event 1/4/16 + break; + } + default: { + CPPUNIT_ASSERT(false); + } + } + } + CPPUNIT_ASSERT(i == 25); + } + + { + edm::IndexIntoFile::IndexIntoFileItr iterFirst = indexIntoFile.begin(IndexIntoFile::entryOrder); + edm::IndexIntoFile::IndexIntoFileItr iterFirstEnd = indexIntoFile.end(IndexIntoFile::entryOrder); + int i = 0; + for (i = 0; iterFirst != iterFirstEnd; ++iterFirst, ++i) { + //std::cout << "out of order run:" << iterFirst.run() << " lumi:" << iterFirst.lumi() + // << " firstEventEntryThisRun:" << iterFirst.firstEventEntryThisRun() + // << " firstEventEntryThisLumi:" << iterFirst.firstEventEntryThisLumi() << std::endl; + switch (i) { + case 0: { + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 1, 1, 0, 2)); // run 1 + CPPUNIT_ASSERT(iterFirst.run() == 1); + CPPUNIT_ASSERT(iterFirst.indexIntoFile() == &indexIntoFile); + CPPUNIT_ASSERT(iterFirst.size() == 13); + + iterFirst.getLumisInRun(lumis); + std::vector expected{1, 2, 3, 4}; + //CPPUNIT_ASSERT(lumis == expected); + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 0); + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == 0); + break; + } + //values are 'IndexIntoFile::EntryType' 'indexToRun' 'indexToLumi' 'indexToEventRange' 'indexToEvent' 'nEvents' + case 1: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 1, 1, 0, 2)); // lumi 1/1 + CPPUNIT_ASSERT(iterFirst.lumi() == 1); + CPPUNIT_ASSERT(iterFirst.entryContinues()); + break; + } + case 2: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 1, 1, 0, 2)); // event 1/1/2 + break; + } + case 3: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 1, 1, 1, 2)); // event 1/1/5 + break; + } + case 4: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 2, 2, 0, 2)); // lumi 1/2 + CPPUNIT_ASSERT(iterFirst.lumi() == 2); + CPPUNIT_ASSERT(iterFirst.entryContinues()); + break; + } + case 5: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 2, 2, 0, 2)); // event 1/2/8 + break; + } + case 6: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 2, 2, 1, 2)); // event 1/2/6 + break; + } + case 7: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 3, 3, 0, 1)); // lumi 1/1 + CPPUNIT_ASSERT(iterFirst.lumi() == 1); + CPPUNIT_ASSERT(iterFirst.entryContinues()); + break; + } + case 8: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 3, 3, 0, 1)); // event 1/1/3 + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 0); + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == 4); + break; + } + case 9: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 4, 4, 0, 1)); // lumi 1/2 + CPPUNIT_ASSERT(iterFirst.lumi() == 2); + CPPUNIT_ASSERT(iterFirst.entryContinues()); + break; + } + case 10: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 4, 0, 1)); // event 1/2/9 + break; + } + case 11: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 6, 5, 0, 2)); // lumi 1/1 5 + CPPUNIT_ASSERT(iterFirst.lumi() == 1); + CPPUNIT_ASSERT(not iterFirst.entryContinues()); + break; + } + case 12: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 6, 5, 0, 2)); // event 1/1/4 + break; + } + case 13: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 6, 5, 1, 2)); // event 1/1/1 + break; + } + case 14: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 8, 7, 0, 1)); // lumi 1/2 + CPPUNIT_ASSERT(iterFirst.lumi() == 2); + CPPUNIT_ASSERT(not iterFirst.entryContinues()); + break; + } + case 15: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 8, 7, 0, 1)); // event 1/2/7 + break; + } + case 16: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 8, 8, 0, 1)); // event 1/2/10 + CPPUNIT_ASSERT(iterFirst.lumi() == 2); + break; + } + case 17: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 9, 9, 0, 4)); // lumi 1/3 + CPPUNIT_ASSERT(iterFirst.lumi() == 3); + CPPUNIT_ASSERT(iterFirst.entryContinues()); + break; + } + case 18: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 9, 9, 0, 4)); // event 1/3/12 + break; + } + case 19: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 9, 9, 1, 4)); // event 1/3/11 + break; + } + case 20: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 9, 9, 2, 4)); // event 1/3/15 + break; + } + case 21: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 9, 9, 3, 4)); // event 1/3/14 + break; + } + case 22: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 10, 10, 0, 3)); // lumi 1/4 + CPPUNIT_ASSERT(iterFirst.lumi() == 4); + CPPUNIT_ASSERT(iterFirst.entryContinues()); + break; + } + case 23: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 10, 10, 0, 3)); // event 1/4/16 + break; + } + case 24: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 10, 10, 1, 3)); // event 1/4/17 + break; + } + case 25: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 10, 10, 2, 3)); // event 1/4/18 + break; + } + case 26: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 11, 11, 0, 1)); // lumi 1/3 + CPPUNIT_ASSERT(iterFirst.lumi() == 3); + CPPUNIT_ASSERT(not iterFirst.entryContinues()); + break; + } + case 27: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 11, 11, 0, 1)); // event 1/3/13 + break; + } + case 28: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 12, 12, 0, 2)); // lumi 1/4 + CPPUNIT_ASSERT(iterFirst.lumi() == 4); + CPPUNIT_ASSERT(not iterFirst.entryContinues()); + break; + } + case 29: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 12, 12, 0, 2)); // event 1/4/19 + break; + } + case 30: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 12, 12, 1, 2)); // event 1/4/16 + break; + } + + default: + CPPUNIT_ASSERT(false); + } + } + CPPUNIT_ASSERT(i == 31); + } +} + +void TestIndexIntoFile3::testOverlappingLumisWithLumiEndOrderChanged() { + // from a failed job + edm::IndexIntoFile indexIntoFile; + indexIntoFile.addEntry(fakePHID1, 1, 1, 2, 0); // Event + indexIntoFile.addEntry(fakePHID1, 1, 1, 5, 1); // Event + indexIntoFile.addEntry(fakePHID1, 1, 2, 8, 2); // Event + indexIntoFile.addEntry(fakePHID1, 1, 2, 6, 3); // Event + indexIntoFile.addEntry(fakePHID1, 1, 1, 3, 4); // Event + indexIntoFile.addEntry(fakePHID1, 1, 2, 9, 5); // Event + indexIntoFile.addEntry(fakePHID1, 1, 1, 4, 6); // Event + indexIntoFile.addEntry(fakePHID1, 1, 2, 7, 7); // Event + indexIntoFile.addEntry(fakePHID1, 1, 2, 10, 8); // Event + indexIntoFile.addEntry(fakePHID1, 1, 2, 0, 0); // Lumi + indexIntoFile.addEntry(fakePHID1, 1, 1, 1, 9); // Event + indexIntoFile.addEntry(fakePHID1, 1, 1, 0, 1); // Lumi + indexIntoFile.addEntry(fakePHID1, 1, 3, 12, 10); // Event + indexIntoFile.addEntry(fakePHID1, 1, 3, 11, 11); // Event + indexIntoFile.addEntry(fakePHID1, 1, 3, 15, 12); // Event + indexIntoFile.addEntry(fakePHID1, 1, 3, 14, 13); // Event + indexIntoFile.addEntry(fakePHID1, 1, 4, 18, 14); // Event + indexIntoFile.addEntry(fakePHID1, 1, 4, 17, 15); // Event + indexIntoFile.addEntry(fakePHID1, 1, 4, 20, 16); // Event + indexIntoFile.addEntry(fakePHID1, 1, 4, 19, 17); // Event + indexIntoFile.addEntry(fakePHID1, 1, 4, 16, 18); // Event + indexIntoFile.addEntry(fakePHID1, 1, 4, 0, 2); // Lumi + indexIntoFile.addEntry(fakePHID1, 1, 3, 13, 19); // Event + indexIntoFile.addEntry(fakePHID1, 1, 3, 0, 3); // Lumi + indexIntoFile.addEntry(fakePHID1, 1, 0, 0, 0); // Run + indexIntoFile.sortVector_Run_Or_Lumi_Entries(); + + std::vector lumis; + + { + edm::IndexIntoFile::IndexIntoFileItr iterFirst = indexIntoFile.begin(IndexIntoFile::firstAppearanceOrder); + edm::IndexIntoFile::IndexIntoFileItr iterFirstEnd = indexIntoFile.end(IndexIntoFile::firstAppearanceOrder); + int i = 0; + for (i = 0; iterFirst != iterFirstEnd; ++iterFirst, ++i) { + //std::cout << "out of order run:" << iterFirst.run() << " lumi:" << iterFirst.lumi() + // << " firstEventEntryThisRun:" << iterFirst.firstEventEntryThisRun() + // << " firstEventEntryThisLumi:" << iterFirst.firstEventEntryThisLumi() << std::endl; + switch (i) { + case 0: { + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 4, 1, 0, 2)); // run 1 + CPPUNIT_ASSERT(iterFirst.indexIntoFile() == &indexIntoFile); + CPPUNIT_ASSERT(iterFirst.size() == 11); + iterFirst.getLumisInRun(lumis); + std::vector expected{1, 2, 3, 4}; + CPPUNIT_ASSERT(lumis == expected); + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 0); + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == 0); + break; + } + //values are 'IndexIntoFile::EntryType' 'indexToRun' 'indexToLumi' 'indexToEventRange' 'indexToEvent' 'nEvents' + case 1: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 4, 1, 0, 2)); // lumi 1/1 + break; + } + case 2: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 1, 0, 2)); // event 1/1/2 + break; + } + case 3: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 1, 1, 2)); // event 1/1/5 + break; + } + case 4: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 2, 0, 1)); // event 1/1/3 + break; + } + case 5: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 3, 0, 1)); // event 1/1/4 + break; + } + case 6: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 4, 0, 1)); // event 1/1/1 + break; + } + case 7: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 7, 5, 0, 2)); // lumi 1/2 + break; + } + case 8: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 7, 5, 0, 2)); // event 1/2/8 + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 0); + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == 2); + break; + } + case 9: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 7, 5, 1, 2)); // event 1/2/6 + break; + } + case 10: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 7, 6, 0, 1)); // event 1/2/9 + break; + } + case 11: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 7, 7, 0, 2)); // event 1/2/7 + break; + } + case 12: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 7, 7, 1, 2)); // event 1/2/10 + break; + } + case 13: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 9, 8, 0, 4)); // lumi 1/3 + break; + } + case 14: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 9, 8, 0, 4)); // event 1/3/12 + break; + } + case 15: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 9, 8, 1, 4)); // event 1/3/11 + break; + } + case 16: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 9, 8, 2, 4)); // event 1/3/15 + break; + } + case 17: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 9, 8, 3, 4)); // event 1/3/14 + break; + } + case 18: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 9, 9, 0, 1)); // event 1/3/13 + break; + } + case 19: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 10, 10, 0, 5)); // lumi 1/4 + break; + } + case 20: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 10, 10, 0, 5)); // event 1/4/18 + break; + } + case 21: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 10, 10, 1, 5)); // event 1/4/17 + break; + } + case 22: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 10, 10, 2, 5)); // event 1/4/20 + break; + } + case 23: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 10, 10, 3, 5)); // event 1/4/19 + break; + } + case 24: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 10, 10, 4, 5)); // event 1/4/16 + break; + } + default: { + CPPUNIT_ASSERT(false); + } + } + } + CPPUNIT_ASSERT(i == 25); + } + + { + edm::IndexIntoFile::IndexIntoFileItr iterFirst = indexIntoFile.begin(IndexIntoFile::entryOrder); + edm::IndexIntoFile::IndexIntoFileItr iterFirstEnd = indexIntoFile.end(IndexIntoFile::entryOrder); + int i = 0; + for (i = 0; iterFirst != iterFirstEnd; ++iterFirst, ++i) { + //std::cout << "out of order run:" << iterFirst.run() << " lumi:" << iterFirst.lumi() + // << " firstEventEntryThisRun:" << iterFirst.firstEventEntryThisRun() + // << " firstEventEntryThisLumi:" << iterFirst.firstEventEntryThisLumi() << std::endl; + switch (i) { + case 0: { + CPPUNIT_ASSERT(check(iterFirst, kRun, 0, 1, 1, 0, 2)); // run 1 + CPPUNIT_ASSERT(iterFirst.run() == 1); + CPPUNIT_ASSERT(iterFirst.indexIntoFile() == &indexIntoFile); + CPPUNIT_ASSERT(iterFirst.size() == 11); + + iterFirst.getLumisInRun(lumis); + std::vector expected{1, 2, 3, 4}; + //CPPUNIT_ASSERT(lumis == expected); + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 0); + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == 0); + break; + } + //values are 'IndexIntoFile::EntryType' 'indexToRun' 'indexToLumi' 'indexToEventRange' 'indexToEvent' 'nEvents' + case 1: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 1, 1, 0, 2)); // lumi 1/1 + CPPUNIT_ASSERT(iterFirst.lumi() == 1); + CPPUNIT_ASSERT(iterFirst.entryContinues()); + break; + } + case 2: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 1, 1, 0, 2)); // event 1/1/2 + break; + } + case 3: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 1, 1, 1, 2)); // event 1/1/5 + break; + } + case 4: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 2, 2, 0, 2)); // lumi 1/2 + CPPUNIT_ASSERT(iterFirst.lumi() == 2); + CPPUNIT_ASSERT(iterFirst.entryContinues()); + break; + } + case 5: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 2, 2, 0, 2)); // event 1/2/8 + break; + } + case 6: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 2, 2, 1, 2)); // event 1/2/6 + break; + } + case 7: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 3, 3, 0, 1)); // lumi 1/1 + CPPUNIT_ASSERT(iterFirst.lumi() == 1); + CPPUNIT_ASSERT(iterFirst.entryContinues()); + break; + } + case 8: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 3, 3, 0, 1)); // event 1/1/3 + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisRun() == 0); + CPPUNIT_ASSERT(iterFirst.firstEventEntryThisLumi() == 4); + break; + } + case 9: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 4, 4, 0, 1)); // lumi 1/2 + CPPUNIT_ASSERT(iterFirst.lumi() == 2); + CPPUNIT_ASSERT(iterFirst.entryContinues()); + break; + } + case 10: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 4, 4, 0, 1)); // event 1/2/9 + break; + } + case 11: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 5, 5, 0, 1)); // lumi 1/1 5 + CPPUNIT_ASSERT(iterFirst.lumi() == 1); + CPPUNIT_ASSERT(iterFirst.entryContinues()); + break; + } + case 12: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 5, 5, 0, 1)); // event 1/1/4 + break; + } + case 13: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 6, 6, 0, 2)); // lumi 1/2 + CPPUNIT_ASSERT(iterFirst.lumi() == 2); + CPPUNIT_ASSERT(not iterFirst.entryContinues()); + break; + } + case 14: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 6, 6, 0, 2)); // event 1/2/7 + break; + } + case 15: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 6, 6, 1, 2)); // event 1/2/10 + CPPUNIT_ASSERT(iterFirst.lumi() == 2); + break; + } + case 16: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 7, 7, 0, 1)); // lumi 1/1 + CPPUNIT_ASSERT(iterFirst.lumi() == 1); + CPPUNIT_ASSERT(not iterFirst.entryContinues()); + break; + } + case 17: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 7, 7, 0, 1)); // event 1/1/1 + break; + } + case 18: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 8, 8, 0, 4)); // lumi 1/3 + CPPUNIT_ASSERT(iterFirst.lumi() == 3); + CPPUNIT_ASSERT(iterFirst.entryContinues()); + break; + } + case 19: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 8, 8, 0, 4)); // event 1/3/12 + break; + } + case 20: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 8, 8, 1, 4)); // event 1/3/11 + break; + } + case 21: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 8, 8, 2, 4)); // event 1/3/15 + break; + } + case 22: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 8, 8, 3, 4)); // event 1/3/14 + break; + } + case 23: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 9, 9, 0, 5)); // lumi 1/4 + CPPUNIT_ASSERT(iterFirst.lumi() == 4); + CPPUNIT_ASSERT(not iterFirst.entryContinues()); + break; + } + case 24: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 9, 9, 0, 5)); // event 1/4/16 + break; + } + case 25: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 9, 9, 1, 5)); // event 1/4/17 + break; + } + case 26: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 9, 9, 2, 5)); // event 1/4/18 + break; + } + case 27: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 9, 9, 3, 5)); // event 1/4/19 + break; + } + case 28: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 9, 9, 4, 5)); // event 1/4/16 + break; + } + case 29: { + CPPUNIT_ASSERT(check(iterFirst, kLumi, 0, 10, 10, 0, 1)); // lumi 1/3 + CPPUNIT_ASSERT(iterFirst.lumi() == 3); + CPPUNIT_ASSERT(not iterFirst.entryContinues()); + break; + } + case 30: { + CPPUNIT_ASSERT(check(iterFirst, kEvent, 0, 10, 10, 0, 1)); // event 1/3/13 + break; + } + + default: + CPPUNIT_ASSERT(false); + } + } + CPPUNIT_ASSERT(i == 31); } - CPPUNIT_ASSERT(i == 15); } diff --git a/DataFormats/Provenance/test/indexIntoFile_t.cppunit.cc b/DataFormats/Provenance/test/indexIntoFile_t.cppunit.cc index fab1b41dd7b3b..e698772ee75c8 100644 --- a/DataFormats/Provenance/test/indexIntoFile_t.cppunit.cc +++ b/DataFormats/Provenance/test/indexIntoFile_t.cppunit.cc @@ -176,6 +176,16 @@ void TestIndexIntoFile::testEmptyIndex() { CPPUNIT_ASSERT(iterFirstEnd.indexToEvent() == 0); CPPUNIT_ASSERT(iterFirstEnd.nEvents() == 0); + edm::IndexIntoFile::IndexIntoFileItr iterEntryEnd = indexIntoFile.end(IndexIntoFile::entryOrder); + CPPUNIT_ASSERT(iterEntryEnd.indexIntoFile() == &indexIntoFile); + CPPUNIT_ASSERT(iterEntryEnd.size() == 0); + CPPUNIT_ASSERT(iterEntryEnd.type() == kEnd); + CPPUNIT_ASSERT(iterEntryEnd.indexToRun() == IndexIntoFile::invalidIndex); + CPPUNIT_ASSERT(iterEntryEnd.indexToLumi() == IndexIntoFile::invalidIndex); + CPPUNIT_ASSERT(iterEntryEnd.indexToEventRange() == IndexIntoFile::invalidIndex); + CPPUNIT_ASSERT(iterEntryEnd.indexToEvent() == 0); + CPPUNIT_ASSERT(iterEntryEnd.nEvents() == 0); + edm::IndexIntoFile::IndexIntoFileItr iterNum = indexIntoFile.begin(IndexIntoFile::numericalOrder); CPPUNIT_ASSERT(iterNum == iterNumEnd); @@ -189,6 +199,15 @@ void TestIndexIntoFile::testEmptyIndex() { skipEventBackward(iterFirst); checkSkipped(-1, 0, 0, -1); check(iterFirst, kEnd, -1, -1, -1, 0, 0); + + { + auto iterEntry = indexIntoFile.begin(IndexIntoFile::entryOrder); + CPPUNIT_ASSERT(iterEntry == iterEntryEnd); + + skipEventBackward(iterEntry); + checkSkipped(-1, 0, 0, -1); + check(iterEntry, kEnd, -1, -1, -1, 0, 0); + } } void TestIndexIntoFile::testIterEndWithLumi() { @@ -245,6 +264,29 @@ void TestIndexIntoFile::testIterEndWithLumi() { } CPPUNIT_ASSERT(i == 5); + // Now repeat the above tests for the entry iteration + + edm::IndexIntoFile::IndexIntoFileItr iterEntry = indexIntoFile.begin(IndexIntoFile::entryOrder); + edm::IndexIntoFile::IndexIntoFileItr iterEntryEnd = indexIntoFile.end(IndexIntoFile::entryOrder); + for (i = 0; iterEntry != iterEntryEnd; ++iterEntry, ++i) { + if (i == 0) + check(iterEntry, kRun, 0, 1, -1, 0, 0); + else if (i == 1) + check(iterEntry, kLumi, 0, 1, -1, 0, 0); + else if (i == 2) + check(iterEntry, kRun, 2, 3, -1, 0, 0); + else if (i == 3) + check(iterEntry, kLumi, 2, 3, -1, 0, 0); + else if (i == 4) + check(iterEntry, kLumi, 2, 4, -1, 0, 0); + else + CPPUNIT_ASSERT(false); + + CPPUNIT_ASSERT(iterEntry.firstEventEntryThisRun() == IndexIntoFile::invalidEntry); + CPPUNIT_ASSERT(iterEntry.firstEventEntryThisLumi() == IndexIntoFile::invalidEntry); + } + CPPUNIT_ASSERT(i == 5); + iterFirst = indexIntoFile.begin(IndexIntoFile::firstAppearanceOrder); skipEventForward(iterFirst); @@ -256,6 +298,12 @@ void TestIndexIntoFile::testIterEndWithLumi() { skipEventForward(iterNum); checkSkipped(-1, 0, 0, -1); check(iterNum, kEnd, -1, -1, -1, 0, 0); + + iterEntry = indexIntoFile.begin(IndexIntoFile::entryOrder); + + skipEventForward(iterEntry); + checkSkipped(-1, 0, 0, -1); + check(iterEntry, kEnd, -1, -1, -1, 0, 0); } void TestIndexIntoFile::testIterEndWithRun() { @@ -308,6 +356,28 @@ void TestIndexIntoFile::testIterEndWithRun() { } CPPUNIT_ASSERT(i == 4); + // Now repeat the above tests for the entry iteration + + edm::IndexIntoFile::IndexIntoFileItr iterEntry = indexIntoFile.begin(IndexIntoFile::entryOrder); + edm::IndexIntoFile::IndexIntoFileItr iterEntryEnd = indexIntoFile.end(IndexIntoFile::entryOrder); + i = 0; + for (; iterEntry != iterEntryEnd; ++iterEntry, ++i) { + if (i == 0) + check(iterEntry, kRun, 0, -1, -1, 0, 0); + else if (i == 1) + check(iterEntry, kRun, 1, -1, -1, 0, 0); + else if (i == 2) + check(iterEntry, kRun, 2, -1, -1, 0, 0); + else if (i == 3) + check(iterEntry, kRun, 3, -1, -1, 0, 0); + else + CPPUNIT_ASSERT(false); + + CPPUNIT_ASSERT(iterEntry.firstEventEntryThisRun() == IndexIntoFile::invalidEntry); + CPPUNIT_ASSERT(iterEntry.firstEventEntryThisLumi() == IndexIntoFile::invalidEntry); + } + CPPUNIT_ASSERT(i == 4); + iterFirst = indexIntoFile.begin(IndexIntoFile::firstAppearanceOrder); skipEventForward(iterFirst); @@ -335,6 +405,20 @@ void TestIndexIntoFile::testIterEndWithRun() { check(iterNum, kRun, 3, -1, -1, 0, 0); iterNum.advanceToNextLumiOrRun(); check(iterNum, kEnd, -1, -1, -1, 0, 0); + + iterEntry = indexIntoFile.begin(IndexIntoFile::entryOrder); + + skipEventForward(iterEntry); + checkSkipped(-1, 0, 0, -1); + check(iterEntry, kEnd, -1, -1, -1, 0, 0); + + iterEntry = indexIntoFile.begin(IndexIntoFile::entryOrder); + iterEntry.advanceToNextLumiOrRun(); + check(iterEntry, kRun, 2, -1, -1, 0, 0); + ++iterEntry; + check(iterEntry, kRun, 3, -1, -1, 0, 0); + iterEntry.advanceToNextLumiOrRun(); + check(iterEntry, kEnd, -1, -1, -1, 0, 0); } void TestIndexIntoFile::testIterLastLumiRangeNoEvents() { @@ -419,6 +503,37 @@ void TestIndexIntoFile::testIterLastLumiRangeNoEvents() { CPPUNIT_ASSERT(false); } CPPUNIT_ASSERT(i == 11); + + edm::IndexIntoFile::IndexIntoFileItr iterEntry = indexIntoFile.begin(IndexIntoFile::entryOrder); + edm::IndexIntoFile::IndexIntoFileItr iterEntryEnd = indexIntoFile.end(IndexIntoFile::entryOrder); + i = 0; + for (; iterEntry != iterEntryEnd; ++iterEntry, ++i) { + if (i == 0) + check(iterEntry, kRun, 0, 1, 1, 0, 1); + else if (i == 1) + check(iterEntry, kLumi, 0, 1, 1, 0, 1); + else if (i == 2) + check(iterEntry, kLumi, 0, 2, 1, 0, 1); + else if (i == 3) + check(iterEntry, kEvent, 0, 2, 1, 0, 1); + else if (i == 4) + check(iterEntry, kLumi, 0, 3, 3, 0, 1); + else if (i == 5) + check(iterEntry, kLumi, 0, 4, 3, 0, 1); + else if (i == 6) + check(iterEntry, kEvent, 0, 4, 3, 0, 1); + else if (i == 7) + check(iterEntry, kRun, 5, 6, 6, 0, 1); + else if (i == 8) + check(iterEntry, kLumi, 5, 6, 6, 0, 1); + else if (i == 9) + check(iterEntry, kLumi, 5, 7, 6, 0, 1); + else if (i == 10) + check(iterEntry, kEvent, 5, 7, 6, 0, 1); + else + CPPUNIT_ASSERT(false); + } + CPPUNIT_ASSERT(i == 11); } void TestIndexIntoFile::testSkip() { @@ -489,6 +604,35 @@ void TestIndexIntoFile::testSkip() { skipEventForward(iterNum); checkSkipped(-1, 0, 0, -1); check(iterNum, kEnd, -1, -1, -1, 0, 0); + { + edm::IndexIntoFile::IndexIntoFileItr iterEntry = indexIntoFile.begin(IndexIntoFile::entryOrder); + + skipEventForward(iterEntry); + checkSkipped(0, 1, 101, 0); + check(iterEntry, kRun, 0, 3, -1, 0, 0); + + skipEventForward(iterEntry); + checkSkipped(-1, 0, 0, -1); + check(iterEntry, kEnd, -1, -1, -1, 0, 0); + + skipEventBackward(iterEntry); + checkSkipped(0, 1, 101, 0); + check(iterEntry, kRun, 0, 1, 1, 0, 1); + + skipEventBackward(iterEntry); + checkSkipped(-1, 0, 0, -1); + check(iterEntry, kRun, 0, 1, 1, 0, 1); + + iterEntry = indexIntoFile.begin(IndexIntoFile::entryOrder); + ++iterEntry; + skipEventForward(iterEntry); + checkSkipped(0, 1, 101, 0); + check(iterEntry, kLumi, 0, 3, -1, 0, 0); + + skipEventForward(iterEntry); + checkSkipped(-1, 0, 0, -1); + check(iterEntry, kEnd, -1, -1, -1, 0, 0); + } } void TestIndexIntoFile::testSkip2() { @@ -573,6 +717,40 @@ void TestIndexIntoFile::testSkip2() { skipEventForward(iterNum); checkSkipped(0, 2, 101, 1); check(iterNum, kRun, 4, 7, -1, 0, 0); + + { + edm::IndexIntoFile::IndexIntoFileItr iterEntry = indexIntoFile.begin(IndexIntoFile::entryOrder); + + skipEventForward(iterEntry); + checkSkipped(0, 1, 101, 0); + check(iterEntry, kRun, 0, 3, -1, 0, 0); + + skipEventForward(iterEntry); + checkSkipped(0, 2, 101, 1); + check(iterEntry, kRun, 4, 7, -1, 0, 0); + + skipEventForward(iterEntry); + checkSkipped(-1, 0, 0, -1); + check(iterEntry, kEnd, -1, -1, -1, 0, 0); + + skipEventBackward(iterEntry); + checkSkipped(0, 2, 101, 1); + check(iterEntry, kRun, 4, 5, 5, 0, 1); + + skipEventBackward(iterEntry); + checkSkipped(0, 1, 101, 0); + check(iterEntry, kRun, 0, 1, 1, 0, 1); + + iterEntry = indexIntoFile.begin(IndexIntoFile::entryOrder); + ++iterEntry; + skipEventForward(iterEntry); + checkSkipped(0, 1, 101, 0); + check(iterEntry, kLumi, 0, 3, -1, 0, 0); + + skipEventForward(iterEntry); + checkSkipped(0, 2, 101, 1); + check(iterEntry, kRun, 4, 7, -1, 0, 0); + } } void TestIndexIntoFile::testSkip3() { @@ -602,6 +780,14 @@ void TestIndexIntoFile::testSkip3() { skipEventForward(iterNum); checkSkipped(0, 2, 102, 0); check(iterNum, kRun, 2, 6, -1, 0, 0); + + { + edm::IndexIntoFile::IndexIntoFileItr iterEntry = indexIntoFile.begin(IndexIntoFile::entryOrder); + + skipEventForward(iterEntry); + checkSkipped(0, 2, 102, 0); + check(iterEntry, kRun, 2, 6, -1, 0, 0); + } } void TestIndexIntoFile::testReduce() { diff --git a/DetectorDescription/DDCMS/plugins/BuildFile.xml b/DetectorDescription/DDCMS/plugins/BuildFile.xml index 3bac0040bd395..5661d19f4ce18 100644 --- a/DetectorDescription/DDCMS/plugins/BuildFile.xml +++ b/DetectorDescription/DDCMS/plugins/BuildFile.xml @@ -16,7 +16,7 @@ - + diff --git a/DetectorDescription/DDCMS/plugins/DDDetectorESProducer.cc b/DetectorDescription/DDCMS/plugins/DDDetectorESProducer.cc index 640e24c1db61d..bad693fcc759d 100644 --- a/DetectorDescription/DDCMS/plugins/DDDetectorESProducer.cc +++ b/DetectorDescription/DDCMS/plugins/DDDetectorESProducer.cc @@ -69,7 +69,7 @@ DDDetectorESProducer::DDDetectorESProducer(const ParameterSet& iConfig) confGeomXMLFiles_(fromDB_ ? "none" : iConfig.getParameter("confGeomXMLFiles").fullPath()), rootDDName_(iConfig.getParameter("rootDDName")), label_(iConfig.getParameter("label")) { - usesResources({edm::ESSharedResourceNames::kDD4Hep}); + usesResources({edm::ESSharedResourceNames::kDD4hep}); edm::LogVerbatim("Geometry") << "DDDetectorESProducer::fromDB " << fromDB_ << " appendToDataLabel " << appendToDataLabel_ << " rootDDName " << rootDDName_ << " label " << label_ << " confGeomXMLFiles " << confGeomXMLFiles_; diff --git a/DetectorDescription/DDCMS/plugins/test/DDTestDumpFile.cc b/DetectorDescription/DDCMS/plugins/test/DDTestDumpFile.cc index 7be824e03a8e2..231c444369264 100644 --- a/DetectorDescription/DDCMS/plugins/test/DDTestDumpFile.cc +++ b/DetectorDescription/DDCMS/plugins/test/DDTestDumpFile.cc @@ -37,7 +37,7 @@ class DDTestDumpFile : public one::EDAnalyzer<> { DDTestDumpFile::DDTestDumpFile(const ParameterSet& iConfig) : m_tag(iConfig.getUntrackedParameter("tag", "unknown")), - m_outputFileName(iConfig.getUntrackedParameter("outputFileName", "cmsDD4HepGeom.root")), + m_outputFileName(iConfig.getUntrackedParameter("outputFileName", "cmsDD4hepGeom.root")), m_label(iConfig.getParameter("DDDetector")), m_token(esConsumes(m_label)) {} diff --git a/EventFilter/CSCRawToDigi/interface/CSCDCCExaminer.h b/EventFilter/CSCRawToDigi/interface/CSCDCCExaminer.h index 6e33918ddc298..6793e2ca5defc 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCDCCExaminer.h +++ b/EventFilter/CSCRawToDigi/interface/CSCDCCExaminer.h @@ -126,6 +126,7 @@ class CSCDCCExaminer { uint32_t TMB_WordsExpected; uint32_t TMB_Tbins; uint32_t TMB_WordsRPC; + uint32_t TMB_WordsGEM; uint32_t TMB_Firmware_Revision; uint32_t DDU_Firmware_Revision; diff --git a/EventFilter/CSCRawToDigi/interface/CSCGEMData.h b/EventFilter/CSCRawToDigi/interface/CSCGEMData.h new file mode 100644 index 0000000000000..4d9f66d8e9025 --- /dev/null +++ b/EventFilter/CSCRawToDigi/interface/CSCGEMData.h @@ -0,0 +1,51 @@ +#ifndef EventFilter_CSCRawToDigi_CSCGEMData_h +#define EventFilter_CSCRawToDigi_CSCGEMData_h + +#include +#ifndef LOCAL_UNPACK +#include +#endif + +class GEMPadDigiCluster; + +class CSCGEMData { +public: + /// default constructor + CSCGEMData(int ntbins = 12, int gem_fibers_mask = 0xf); + // length is in 16-bit words + CSCGEMData(const unsigned short *c04buf, int length, int gem_fibers_mask = 0xf); + + // std::vector BXN() const; + std::vector digis(int gem_chamber) const; + std::vector etaDigis(int gem_chamber, int eta) const; + int sizeInWords() const { return size_; } + int numGEMs() const { + return 2; // !!! TODO actual number of GEM chambers in readout + } + int gemFibersMask() const { return gems_enabled_; } + int numGEMEnabledFibers() const { return ngems_; } + int nTbins() const { return ntbins_; } + void print() const; + bool check() const { return ((theData[0] == 0x6C04) && (theData[size_ - 1] == 0x6D04)); } + + /// turns on the debug flag for this class + static void setDebug(bool debugValue) { debug = debugValue; } + +private: + int getPartitionNumber(int address, int nPads) const; + int getPartitionStripNumber(int address, int nPads, int etaPart) const; + +#ifdef LOCAL_UNPACK + static bool debug; +#else + static std::atomic debug; +#endif + + int ntbins_; + int gems_enabled_; + int ngems_; + int size_; + unsigned short theData[8 * 2 * 32 + 2]; +}; + +#endif diff --git a/EventFilter/CSCRawToDigi/interface/CSCTMBData.h b/EventFilter/CSCRawToDigi/interface/CSCTMBData.h index ec5ed82203fa7..62e3d8ab8cf08 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCTMBData.h +++ b/EventFilter/CSCRawToDigi/interface/CSCTMBData.h @@ -15,6 +15,7 @@ #include "EventFilter/CSCRawToDigi/interface/CSCTMBBlockedCFEB.h" #include "EventFilter/CSCRawToDigi/interface/CSCTMBTrailer.h" #include "EventFilter/CSCRawToDigi/interface/CSCRPCData.h" +#include "EventFilter/CSCRawToDigi/interface/CSCGEMData.h" #include #include #ifndef LOCAL_UNPACK @@ -51,6 +52,8 @@ class CSCTMBData { /// check this before using RPC bool hasRPC() const { return theRPCDataIsPresent; } CSCRPCData* rpcData() { return &theRPCData; } + bool hasGEM() const { return theGEMDataIsPresent; } + CSCGEMData* gemData() const; /// not const because it sets size int TMBTrailer @@ -76,6 +79,7 @@ class CSCTMBData { CSCTMBHeader theTMBHeader; CSCComparatorData theComparatorData; CSCRPCData theRPCData; + CSCGEMData* theGEMData; /// The TMB scope is not present in most of data hence its dynamic bool theTMBScopeIsPresent; CSCTMBScope* theTMBScope; @@ -97,6 +101,7 @@ class CSCTMBData { unsigned short size_; unsigned short cWordCnt; bool theRPCDataIsPresent; + bool theGEMDataIsPresent; }; #endif diff --git a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader.h b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader.h index 6bb53e0b16c84..ae3bd3166da8c 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader.h +++ b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader.h @@ -23,6 +23,10 @@ struct CSCTMBHeader2006; struct CSCTMBHeader2007; struct CSCTMBHeader2007_rev0x50c3; struct CSCTMBHeader2013; +struct CSCTMBHeader2020_TMB; +struct CSCTMBHeader2020_CCLUT; +struct CSCTMBHeader2020_GEM; +struct CSCTMBHeader2020_Run2; class CSCTMBHeader { public: @@ -54,6 +58,10 @@ class CSCTMBHeader { CSCTMBHeader2007_rev0x50c3 tmbHeader2007_rev0x50c3() const; CSCTMBHeader2006 tmbHeader2006() const; CSCTMBHeader2013 tmbHeader2013() const; + CSCTMBHeader2020_TMB tmbHeader2020_TMB() const; + CSCTMBHeader2020_CCLUT tmbHeader2020_CCLUT() const; + CSCTMBHeader2020_GEM tmbHeader2020_GEM() const; + CSCTMBHeader2020_Run2 tmbHeader2020_Run2() const; uint16_t NTBins() const { return theHeaderFormat->NTBins(); } uint16_t NCFEBs() const { return theHeaderFormat->NCFEBs(); } @@ -65,6 +73,23 @@ class CSCTMBHeader { void setNCFEBs(uint16_t ncfebs) { theHeaderFormat->setNCFEBs(ncfebs); } + /// == Run 3 CSC-GEM Trigger Format + uint16_t clct0_ComparatorCode() const { return theHeaderFormat->clct0_ComparatorCode(); } + uint16_t clct1_ComparatorCode() const { return theHeaderFormat->clct1_ComparatorCode(); } + uint16_t clct0_xky() const { return theHeaderFormat->clct0_xky(); } + uint16_t clct1_xky() const { return theHeaderFormat->clct1_xky(); } + uint16_t hmt_nhits() const { return theHeaderFormat->hmt_nhits(); } + uint16_t hmt_ALCTMatchTime() const { return theHeaderFormat->hmt_ALCTMatchTime(); } + uint16_t gem_enabled_fibers() const { return theHeaderFormat->gem_enabled_fibers(); } + uint16_t gem_fifo_tbins() const { return theHeaderFormat->gem_fifo_tbins(); } + uint16_t gem_fifo_pretrig() const { return theHeaderFormat->gem_fifo_pretrig(); } + uint16_t gem_zero_suppress() const { return theHeaderFormat->gem_zero_suppress(); } + uint16_t gem_sync_dataword() const { return theHeaderFormat->gem_sync_dataword(); } + uint16_t gem_timing_dataword() const { return theHeaderFormat->gem_timing_dataword(); } + uint16_t run3_CLCT_patternID() const { return theHeaderFormat->run3_CLCT_patternID(); } + ///returns Run3 Shower Digi for HMT + CSCShowerDigi showerDigi(uint32_t idlayer) const { return theHeaderFormat->showerDigi(idlayer); } + ///returns CLCT digis std::vector CLCTDigis(uint32_t idlayer) { return theHeaderFormat->CLCTDigis(idlayer); } @@ -86,9 +111,6 @@ class CSCTMBHeader { bool check() const { return theHeaderFormat->check(); } - /// Needed before data packing - //void setChamberId(const CSCDetId & detId) {theChamberId = detId;} - /// for data packing void addCLCT0(const CSCCLCTDigi& digi) { theHeaderFormat->addCLCT0(digi); } void addCLCT1(const CSCCLCTDigi& digi) { theHeaderFormat->addCLCT1(digi); } @@ -96,6 +118,8 @@ class CSCTMBHeader { void addALCT1(const CSCALCTDigi& digi) { theHeaderFormat->addALCT1(digi); } void addCorrelatedLCT0(const CSCCorrelatedLCTDigi& digi) { theHeaderFormat->addCorrelatedLCT0(digi); } void addCorrelatedLCT1(const CSCCorrelatedLCTDigi& digi) { theHeaderFormat->addCorrelatedLCT1(digi); } + // Add Run3 Shower digi for HMT + void addShower(const CSCShowerDigi& digi) { theHeaderFormat->addShower(digi); } /// these methods need more brains to figure which one goes first void add(const std::vector& digis); diff --git a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2006.h b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2006.h index 426b8c8ff2f71..d16e5a839cb65 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2006.h +++ b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2006.h @@ -26,10 +26,27 @@ struct CSCTMBHeader2006 : public CSCVTMBHeaderFormat { uint16_t syncErrorMPC0() const override { return bits.MPC_Muon0_SyncErr_; } uint16_t syncErrorMPC1() const override { return bits.MPC_Muon1_SyncErr_; } + /// == Run 3 CSC-GEM Trigger Format + uint16_t clct0_ComparatorCode() const override { return 0; } + uint16_t clct1_ComparatorCode() const override { return 0; } + uint16_t clct0_xky() const override { return 0; } + uint16_t clct1_xky() const override { return 0; } + uint16_t hmt_nhits() const override { return 0; } + uint16_t hmt_ALCTMatchTime() const override { return 0; } + uint16_t gem_enabled_fibers() const override { return 0; } + uint16_t gem_fifo_tbins() const override { return 0; } + uint16_t gem_fifo_pretrig() const override { return 0; } + uint16_t gem_zero_suppress() const override { return 0; } + uint16_t gem_sync_dataword() const override { return 0; } + uint16_t gem_timing_dataword() const override { return 0; } + uint16_t run3_CLCT_patternID() const override { return 0; } + ///returns CLCT digis std::vector CLCTDigis(uint32_t idlayer) override; ///returns CorrelatedLCT digis std::vector CorrelatedLCTDigis(uint32_t idlayer) const override; + ///returns HMT Shower digi + CSCShowerDigi showerDigi(uint32_t idlayer) const override { return CSCShowerDigi(); } /// in 16-bit words. Add olne because we include beginning(b0c) and /// end (e0c) flags diff --git a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2007.h b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2007.h index 6bee14ad6d30f..08e33d323656d 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2007.h +++ b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2007.h @@ -26,10 +26,27 @@ struct CSCTMBHeader2007 : public CSCVTMBHeaderFormat { uint16_t syncErrorMPC0() const override { return bits.MPC_Muon0_SyncErr_; } uint16_t syncErrorMPC1() const override { return bits.MPC_Muon1_SyncErr_; } + /// == Run 3 CSC-GEM Trigger Format + uint16_t clct0_ComparatorCode() const override { return 0; } + uint16_t clct1_ComparatorCode() const override { return 0; } + uint16_t clct0_xky() const override { return 0; } + uint16_t clct1_xky() const override { return 0; } + uint16_t hmt_nhits() const override { return 0; } + uint16_t hmt_ALCTMatchTime() const override { return 0; } + uint16_t gem_enabled_fibers() const override { return 0; } + uint16_t gem_fifo_tbins() const override { return 0; } + uint16_t gem_fifo_pretrig() const override { return 0; } + uint16_t gem_zero_suppress() const override { return 0; } + uint16_t gem_sync_dataword() const override { return 0; } + uint16_t gem_timing_dataword() const override { return 0; } + uint16_t run3_CLCT_patternID() const override { return 0; } + ///returns CLCT digis std::vector CLCTDigis(uint32_t idlayer) override; ///returns CorrelatedLCT digis std::vector CorrelatedLCTDigis(uint32_t idlayer) const override; + ///returns HMT Shower digi + CSCShowerDigi showerDigi(uint32_t idlayer) const override { return CSCShowerDigi(); } /// in 16-bit words. Add olne because we include beginning(b0c) and /// end (e0c) flags @@ -40,9 +57,6 @@ struct CSCTMBHeader2007 : public CSCVTMBHeaderFormat { unsigned short* data() override { return (unsigned short*)(&bits); } bool check() const override { return bits.e0bline == 0x6e0b; } - /// Needed before data packing - //void setChamberId(const CSCDetId & detId) {theChamberId = detId;} - /// for data packing void addCLCT0(const CSCCLCTDigi& digi) override; void addCLCT1(const CSCCLCTDigi& digi) override; diff --git a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2007_rev0x50c3.h b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2007_rev0x50c3.h index 84ec227300947..d74dfb1ea131e 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2007_rev0x50c3.h +++ b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2007_rev0x50c3.h @@ -20,16 +20,33 @@ struct CSCTMBHeader2007_rev0x50c3 : public CSCVTMBHeaderFormat { uint16_t NTBins() const override { return bits.nTBins; } uint16_t NCFEBs() const override { return bits.nCFEBs; } void setNCFEBs(uint16_t ncfebs) override { bits.nCFEBs = ncfebs & 0x1F; } + uint16_t firmwareRevision() const override { return bits.firmRevCode; } uint16_t syncError() const override { return bits.syncError; } uint16_t syncErrorCLCT() const override { return bits.clct_sync_err; } uint16_t syncErrorMPC0() const override { return bits.MPC_Muon0_SyncErr_; } uint16_t syncErrorMPC1() const override { return bits.MPC_Muon1_SyncErr_; } - uint16_t firmwareRevision() const override { return bits.firmRevCode; } + + /// == Run 3 CSC-GEM Trigger Format + uint16_t clct0_ComparatorCode() const override { return 0; } + uint16_t clct1_ComparatorCode() const override { return 0; } + uint16_t clct0_xky() const override { return 0; } + uint16_t clct1_xky() const override { return 0; } + uint16_t hmt_nhits() const override { return 0; } + uint16_t hmt_ALCTMatchTime() const override { return 0; } + uint16_t gem_enabled_fibers() const override { return 0; } + uint16_t gem_fifo_tbins() const override { return 0; } + uint16_t gem_fifo_pretrig() const override { return 0; } + uint16_t gem_zero_suppress() const override { return 0; } + uint16_t gem_sync_dataword() const override { return 0; } + uint16_t gem_timing_dataword() const override { return 0; } + uint16_t run3_CLCT_patternID() const override { return 0; } ///returns CLCT digis std::vector CLCTDigis(uint32_t idlayer) override; ///returns CorrelatedLCT digis std::vector CorrelatedLCTDigis(uint32_t idlayer) const override; + ///returns HMT Shower digi + CSCShowerDigi showerDigi(uint32_t idlayer) const override { return CSCShowerDigi(); } /// in 16-bit words. Add olne because we include beginning(b0c) and /// end (e0c) flags @@ -40,9 +57,6 @@ struct CSCTMBHeader2007_rev0x50c3 : public CSCVTMBHeaderFormat { unsigned short* data() override { return (unsigned short*)(&bits); } bool check() const override { return bits.e0bline == 0x6e0b; } - /// Needed before data packing - //void setChamberId(const CSCDetId & detId) {theChamberId = detId;} - /// for data packing void addCLCT0(const CSCCLCTDigi& digi) override; void addCLCT1(const CSCCLCTDigi& digi) override; diff --git a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2013.h b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2013.h index c58cd36a5ec5d..202288eea8864 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2013.h +++ b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2013.h @@ -26,10 +26,27 @@ struct CSCTMBHeader2013 : public CSCVTMBHeaderFormat { uint16_t syncErrorMPC0() const override { return bits.MPC_Muon0_SyncErr_; } uint16_t syncErrorMPC1() const override { return bits.MPC_Muon1_SyncErr_; } + /// == Run 3 CSC-GEM Trigger Format + uint16_t clct0_ComparatorCode() const override { return 0; } + uint16_t clct1_ComparatorCode() const override { return 0; } + uint16_t clct0_xky() const override { return 0; } + uint16_t clct1_xky() const override { return 0; } + uint16_t hmt_nhits() const override { return 0; } + uint16_t hmt_ALCTMatchTime() const override { return 0; } + uint16_t gem_enabled_fibers() const override { return 0; } + uint16_t gem_fifo_tbins() const override { return 0; } + uint16_t gem_fifo_pretrig() const override { return 0; } + uint16_t gem_zero_suppress() const override { return 0; } + uint16_t gem_sync_dataword() const override { return 0; } + uint16_t gem_timing_dataword() const override { return 0; } + uint16_t run3_CLCT_patternID() const override { return 0; } + ///returns CLCT digis std::vector CLCTDigis(uint32_t idlayer) override; ///returns CorrelatedLCT digis std::vector CorrelatedLCTDigis(uint32_t idlayer) const override; + ///returns HMT Shower digi + CSCShowerDigi showerDigi(uint32_t idlayer) const override { return CSCShowerDigi(); } /// in 16-bit words. Add olne because we include beginning(b0c) and /// end (e0c) flags @@ -40,9 +57,6 @@ struct CSCTMBHeader2013 : public CSCVTMBHeaderFormat { unsigned short* data() override { return (unsigned short*)(&bits); } bool check() const override { return bits.e0bline == 0x6e0b; } - /// Needed before data packing - //void setChamberId(const CSCDetId & detId) {theChamberId = detId;} - /// for data packing void addCLCT0(const CSCCLCTDigi& digi) override; void addCLCT1(const CSCCLCTDigi& digi) override; @@ -117,7 +131,6 @@ struct CSCTMBHeader2013 : public CSCVTMBHeaderFormat { flag38 : 1; unsigned buf_fence_cnt : 12, reverse_hs_csc : 1, reverse_hs_me1a : 1, reverse_hs_me1b : 1, flag39 : 1; // 40 - // unsigned buf_fence_cnt_peak:12, reserved8:3, flag40:1; unsigned activeCFEBs_2 : 2, readCFEBs_2 : 2, cfeb_badbits_found_2 : 2, parity_err_cfeb_ram_2 : 2, CFEBsEnabled_2 : 2, buf_fence_cnt_is_peak : 1, mxcfeb : 1, trig_source_vec : 2, tmb_trig_pulse : 1, flag40 : 1; unsigned tmb_allow_alct : 1, tmb_allow_clct : 1, tmb_allow_match : 1, tmb_allow_alct_ro : 1, tmb_allow_clct_ro : 1, diff --git a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_CCLUT.h b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_CCLUT.h new file mode 100644 index 0000000000000..217f3d4da0c77 --- /dev/null +++ b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_CCLUT.h @@ -0,0 +1,153 @@ +#ifndef EventFilter_CSCRawToDigi_CSCTMBHeader2020_CCLUT_h +#define EventFilter_CSCRawToDigi_CSCTMBHeader2020_CCLUT_h +#include "EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h" +#include "DataFormats/MuonDetId/interface/CSCDetId.h" + +struct CSCTMBHeader2020_CCLUT : public CSCVTMBHeaderFormat { + enum { NWORDS = 43 }; + CSCTMBHeader2020_CCLUT(); + CSCTMBHeader2020_CCLUT(const unsigned short* buf); + void setEventInformation(const CSCDMBHeader& dmbHeader) override; + + uint16_t BXNCount() const override { return bits.bxnCount; } + uint16_t ALCTMatchTime() const override { return bits.matchWin; } + uint16_t CLCTOnly() const override { return bits.clctOnly; } + uint16_t ALCTOnly() const override { return bits.alctOnly; } + uint16_t TMBMatch() const override { return bits.tmbMatch; } + uint16_t Bxn0Diff() const override { return 0; } + uint16_t Bxn1Diff() const override { return 0; } + uint16_t L1ANumber() const override { return bits.l1aNumber; } + uint16_t NTBins() const override { return bits.nTBins; } + uint16_t NCFEBs() const override { return bits.nCFEBs; } + void setNCFEBs(uint16_t ncfebs) override { bits.nCFEBs = ncfebs & 0x7F; } + uint16_t firmwareRevision() const override { return bits.firmRevCode; } + uint16_t syncError() const override { return bits.syncError; } + uint16_t syncErrorCLCT() const override { return bits.clct_sync_err; } + uint16_t syncErrorMPC0() const override { return 0; } + uint16_t syncErrorMPC1() const override { return 0; } + + // == Run 3 CSC-GEM Trigger Format + uint16_t clct0_ComparatorCode() const override { return bits.clct0_comparator_code; } + uint16_t clct1_ComparatorCode() const override { return bits.clct1_comparator_code; } + uint16_t clct0_xky() const override { return bits.clct0_xky; } + uint16_t clct1_xky() const override { return bits.clct1_xky; } + uint16_t hmt_nhits() const override { + return ((bits.hmt_nhits_bit0 & 0x1) + ((bits.hmt_nhits_bit1 & 0x1) << 1) + + ((bits.hmt_nhits_bits_high & 0x1F) << 2)); + } + uint16_t hmt_ALCTMatchTime() const override { return bits.hmt_match_win; } + + uint16_t gem_enabled_fibers() const override { return 0; } + uint16_t gem_fifo_tbins() const override { return 0; } + uint16_t gem_fifo_pretrig() const override { return 0; } + uint16_t gem_zero_suppress() const override { return 0; } + uint16_t gem_sync_dataword() const override { return 0; } + uint16_t gem_timing_dataword() const override { return 0; } + + uint16_t run3_CLCT_patternID() const override { + return (bits.MPC_Muon_clct_pattern_low | (bits.MPC_Muon_clct_pattern_bit5 << 4)); + } + // == + + ///returns CLCT digis + std::vector CLCTDigis(uint32_t idlayer) override; + ///returns CorrelatedLCT digis + std::vector CorrelatedLCTDigis(uint32_t idlayer) const override; + ///returns HMT Shower digi + CSCShowerDigi showerDigi(uint32_t idlayer) const override; + + /// in 16-bit words. Add olne because we include beginning(b0c) and + /// end (e0c) flags + unsigned short int sizeInWords() const override { return NWORDS; } + + unsigned short int NHeaderFrames() const override { return bits.nHeaderFrames; } + /// returns the first data word + unsigned short* data() override { return (unsigned short*)(&bits); } + bool check() const override { return bits.e0bline == 0x6e0b; } + + /// for data packing + void addCLCT0(const CSCCLCTDigi& digi) override; + void addCLCT1(const CSCCLCTDigi& digi) override; + void addALCT0(const CSCALCTDigi& digi) override; + void addALCT1(const CSCALCTDigi& digi) override; + void addCorrelatedLCT0(const CSCCorrelatedLCTDigi& digi) override; + void addCorrelatedLCT1(const CSCCorrelatedLCTDigi& digi) override; + void addShower(const CSCShowerDigi& digi) override; + + void swapCLCTs(CSCCLCTDigi& digi1, CSCCLCTDigi& digi2); + + void print(std::ostream& os) const override; + + struct { + // 0 + unsigned b0cline : 16; + unsigned bxnCount : 12, dduCode1 : 3, flag1 : 1; + unsigned l1aNumber : 12, dduCode2 : 3, flag2 : 1; + unsigned readoutCounter : 12, dduCode3 : 3, flag3 : 1; + // 4 + unsigned boardID : 5, cscID : 4, runID : 4, stackOvf : 1, syncError : 1, flag4 : 1; + unsigned nHeaderFrames : 6, fifoMode : 3, r_type : 2, l1atype : 2, hasBuf : 1, bufFull : 1, flag5 : 1; + unsigned bd_status : 15, flag6 : 1; + unsigned firmRevCode : 15, flag7 : 1; + // 8 + unsigned bxnPreTrigger : 12, tmb_clct0_discard : 1, tmb_clct1_discard : 1, clock_lock_lost : 1, flag8 : 1; + unsigned preTrigCounter : 15, flag9 : 1; + unsigned clct0_comparator_code : 12, clct0_xky : 2, hmt_nhits_bit0 : 1, flag10 : 1; // 12-bits comp code fw version + unsigned clctCounterLow : 15, flag11 : 1; + // 12 + unsigned clctCounterHigh : 15, flag12 : 1; + unsigned trigCounter : 15, flag13 : 1; + unsigned clct1_comparator_code : 12, clct1_xky : 2, hmt_nhits_bit1 : 1, flag14 : 1; // 12-bits comp code fw version + unsigned alctCounterLow : 15, flag15 : 1; + // 16 + unsigned alctCounterHigh : 15, flag16 : 1; + unsigned uptimeCounterLow : 15, flag17 : 1; + unsigned uptimeCounterHigh : 15, flag18 : 1; + unsigned nCFEBs : 3, nTBins : 5, fifoPretrig : 5, scopeExists : 1, vmeExists : 1, flag19 : 1; + // 20 + unsigned hitThresh : 3, pidThresh : 4, nphThresh : 3, pid_thresh_postdrift : 4, staggerCSC : 1, flag20 : 1; + unsigned triadPersist : 4, dmbThresh : 3, alct_delay : 4, clct_width : 4, flag21 : 1; + unsigned trigSourceVect : 9, clct0_slope : 4, clct0_LR_bend : 1, clct1_LR_bend : 1, flag22 : 1; + unsigned activeCFEBs : 5, readCFEBs : 5, pop_l1a_match_win : 4, aff_source : 1, flag23 : 1; + // 24 + unsigned tmbMatch : 1, alctOnly : 1, clctOnly : 1, matchWin : 4, noALCT : 1, oneALCT : 1, oneCLCT : 1, twoALCT : 1, + twoCLCT : 1, dupeALCT : 1, dupeCLCT : 1, lctRankErr : 1, flag24 : 1; + unsigned clct0_valid : 1, clct0_quality : 3, clct0_shape : 4, clct0_key_low : 7, flag25 : 1; + unsigned clct1_valid : 1, clct1_quality : 3, clct1_shape : 4, clct1_key_low : 7, flag26 : 1; + unsigned clct0_key_high : 1, clct1_key_high : 1, clct_bxn : 2, clct_sync_err : 1, clct0Invalid : 1, + clct1Invalid : 1, clct1Busy : 1, parity_err_cfeb_ram : 5, parity_err_rpc : 1, parity_err_summary : 1, + flag27 : 1; + // 28 + unsigned alct0Valid : 1, alct0Quality : 2, alct0Amu : 1, alct0Key : 7, clct1_slope : 4, flag28 : 1; + unsigned alct1Valid : 1, alct1Quality : 2, alct1Amu : 1, alct1Key : 7, drift_delay : 2, bcb_read_enable : 1, + hs_layer_trig : 1, flag29 : 1; + unsigned hmt_nhits_bits_high : 5, alct_ecc_err : 2, cfeb_badbits_found : 5, cfeb_badbits_blocked : 1, alctCfg : 1, + bx0_match : 1, flag30 : 1; + unsigned MPC_Muon0_alct_key_wire : 7, MPC_Muon_clct_pattern_low : 4, MPC_Muon0_lct_quality : 3, + MPC_Muon0_clct_QuarterStrip : 1, flag31 : 1; + // 32 + unsigned MPC_Muon0_clct_key_halfstrip : 8, MPC_Muon0_clct_LR : 1, MPC_Muon0_clct_EighthStrip : 1, + MPC_Muon_alct_bxn : 1, MPC_Muon0_clct_bx0 : 1, MPC_Muon0_clct_bend_low : 3, flag32 : 1; + unsigned MPC_Muon1_alct_key_wire : 7, MPC_Muon_clct_pattern_bit5 : 1, MPC_Muon_HMT_high : 3, + MPC_Muon1_lct_quality : 3, MPC_Muon1_clct_QuarterStrip : 1, flag33 : 1; + unsigned MPC_Muon1_clct_key_halfstrip : 8, MPC_Muon1_clct_LR : 1, MPC_Muon1_clct_EighthStrip : 1, + MPC_Muon_HMT_bit0 : 1, MPC_Muon1_clct_bx0 : 1, MPC_Muon1_clct_bend_low : 3, flag34 : 1; + unsigned MPC_Muon0_lct_vpf : 1, MPC_Muon0_clct_bend_bit4 : 1, MPC_Muon1_lct_vpf : 1, MPC_Muon1_clct_bend_bit4 : 1, + MPCDelay : 4, MPCAccept : 2, CFEBsEnabled : 5, flag35 : 1; + // 36 + unsigned RPCList : 2, NRPCs : 2, RPCEnable : 1, fifo_tbins_rpc : 5, fifo_pretrig_rpc : 5, flag36 : 1; + unsigned r_wr_buf_adr : 11, r_wr_buf_ready : 1, wr_buf_ready : 1, buf_q_full : 1, buf_q_empty : 1, flag37 : 1; + unsigned r_buf_fence_dist : 11, buf_q_ovf_err : 1, buf_q_udf_err : 1, buf_q_adr_err : 1, buf_stalled : 1, + flag38 : 1; + unsigned buf_fence_cnt : 12, reverse_hs_csc : 1, reverse_hs_me1a : 1, reverse_hs_me1b : 1, flag39 : 1; + // 40 + unsigned activeCFEBs_2 : 2, readCFEBs_2 : 2, cfeb_badbits_found_2 : 2, parity_err_cfeb_ram_2 : 2, + CFEBsEnabled_2 : 2, buf_fence_cnt_is_peak : 1, mxcfeb : 1, trig_source_vec : 2, tmb_trig_pulse : 1, flag40 : 1; + unsigned run3_trig_df : 1, gem_enable : 1, hmt_match_win : 4, tmb_alct_only_ro : 1, tmb_clct_only_ro : 1, + tmb_match_ro : 1, tmb_trig_keep : 1, tmb_non_trig_keep : 1, lyr_thresh_pretrig : 3, layer_trig_en : 1, + flag41 : 1; + unsigned e0bline : 16; + } bits; +}; + +#endif diff --git a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_GEM.h b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_GEM.h new file mode 100644 index 0000000000000..7cf58d3819074 --- /dev/null +++ b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_GEM.h @@ -0,0 +1,162 @@ +#ifndef EventFilter_CSCRawToDigi_CSCTMBHeader2020_GEM_h +#define EventFilter_CSCRawToDigi_CSCTMBHeader2020_GEM_h +#include "EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h" +#include "DataFormats/MuonDetId/interface/CSCDetId.h" + +struct CSCTMBHeader2020_GEM : public CSCVTMBHeaderFormat { + enum { NWORDS = 43 }; + CSCTMBHeader2020_GEM(); + CSCTMBHeader2020_GEM(const unsigned short* buf); + void setEventInformation(const CSCDMBHeader& dmbHeader) override; + + uint16_t BXNCount() const override { return bits.bxnCount; } + uint16_t ALCTMatchTime() const override { return bits.matchWin; } + uint16_t CLCTOnly() const override { return bits.clctOnly; } + uint16_t ALCTOnly() const override { return bits.alctOnly; } + uint16_t TMBMatch() const override { return bits.tmbMatch; } + uint16_t Bxn0Diff() const override { return 0; } + uint16_t Bxn1Diff() const override { return 0; } + uint16_t L1ANumber() const override { return bits.l1aNumber; } + uint16_t NTBins() const override { return bits.nTBins; } + uint16_t NCFEBs() const override { return bits.nCFEBs; } + void setNCFEBs(uint16_t ncfebs) override { bits.nCFEBs = ncfebs & 0x7F; } + uint16_t firmwareRevision() const override { return bits.firmRevCode; } + uint16_t syncError() const override { return bits.syncError; } + uint16_t syncErrorCLCT() const override { return bits.clct_sync_err; } + uint16_t syncErrorMPC0() const override { return 0; } + uint16_t syncErrorMPC1() const override { return 0; } + + // == Run 3 CSC-GEM Trigger Format + uint16_t clct0_ComparatorCode() const override { return bits.clct0_comparator_code; } + uint16_t clct1_ComparatorCode() const override { return bits.clct1_comparator_code; } + uint16_t clct0_xky() const override { return bits.clct0_xky; } + uint16_t clct1_xky() const override { return bits.clct1_xky; } + uint16_t hmt_nhits() const override { + return ((bits.hmt_nhits_bit0 & 0x1) + ((bits.hmt_nhits_bit1 & 0x1) << 1) + + ((bits.hmt_nhits_bits_high & 0x1F) << 2)); + } + uint16_t hmt_ALCTMatchTime() const override { return bits.hmt_match_win; } + uint16_t gem_enabled_fibers() const override { return (bits.gem_enabled_fibers_ & 0xF); } + uint16_t gem_fifo_tbins() const override { return bits.fifo_tbins_gem_; } + uint16_t gem_fifo_pretrig() const override { return bits.fifo_pretrig_gem_; } + uint16_t gem_zero_suppress() const override { return bits.gem_zero_suppression_; } + uint16_t gem_sync_dataword() const override { + return ((bits.lct0_nogem) + (bits.lct0_with_gemA << 1) + (bits.lct0_with_gemB << 2) + (bits.lct0_with_copad << 3) + + (bits.lct1_nogem << 4) + (bits.lct1_with_gemA << 5) + (bits.lct1_with_gemB << 6) + + (bits.lct1_with_copad << 7) + (bits.gemA_vpf << 8) + (bits.gemB_vpf << 9) + (bits.gemA_over_flow << 10) + + (bits.gemB_over_flow << 11) + (bits.gemA_sync << 12) + (bits.gemB_sync << 13) + (bits.gems_sync << 14)); + } + uint16_t gem_timing_dataword() const override { + return ((bits.num_copad & 0xF) + ((bits.gem_delay & 0xF) << 4) + ((bits.gem_clct_win & 0xF) << 8) + + ((bits.alct_gem_win & 0x7) << 12)); + } + uint16_t run3_CLCT_patternID() const override { + return (bits.MPC_Muon_clct_pattern_low | (bits.MPC_Muon_clct_pattern_bit5 << 4)); + } + // == + + ///returns CLCT digis + std::vector CLCTDigis(uint32_t idlayer) override; + ///returns CorrelatedLCT digis + std::vector CorrelatedLCTDigis(uint32_t idlayer) const override; + ///returns HMT Shower digi + CSCShowerDigi showerDigi(uint32_t idlayer) const override; + + /// in 16-bit words. Add olne because we include beginning(b0c) and + /// end (e0c) flags + unsigned short int sizeInWords() const override { return NWORDS; } + + unsigned short int NHeaderFrames() const override { return bits.nHeaderFrames; } + /// returns the first data word + unsigned short* data() override { return (unsigned short*)(&bits); } + bool check() const override { return bits.e0bline == 0x6e0b; } + + /// for data packing + void addCLCT0(const CSCCLCTDigi& digi) override; + void addCLCT1(const CSCCLCTDigi& digi) override; + void addALCT0(const CSCALCTDigi& digi) override; + void addALCT1(const CSCALCTDigi& digi) override; + void addCorrelatedLCT0(const CSCCorrelatedLCTDigi& digi) override; + void addCorrelatedLCT1(const CSCCorrelatedLCTDigi& digi) override; + void addShower(const CSCShowerDigi& digi) override; + + void swapCLCTs(CSCCLCTDigi& digi1, CSCCLCTDigi& digi2); + + void print(std::ostream& os) const override; + + struct { + // 0 + unsigned b0cline : 16; + unsigned bxnCount : 12, dduCode1 : 3, flag1 : 1; + unsigned l1aNumber : 12, dduCode2 : 3, flag2 : 1; + unsigned readoutCounter : 12, dduCode3 : 3, flag3 : 1; + // 4 + unsigned boardID : 5, cscID : 4, runID : 4, stackOvf : 1, syncError : 1, flag4 : 1; + unsigned nHeaderFrames : 6, fifoMode : 3, r_type : 2, l1atype : 2, hasBuf : 1, bufFull : 1, flag5 : 1; + unsigned bd_status : 15, flag6 : 1; + unsigned firmRevCode : 15, flag7 : 1; + // 8 + unsigned bxnPreTrigger : 12, tmb_clct0_discard : 1, tmb_clct1_discard : 1, clock_lock_lost : 1, flag8 : 1; + unsigned preTrigCounter : 15, flag9 : 1; + unsigned clct0_comparator_code : 12, clct0_xky : 2, hmt_nhits_bit0 : 1, flag10 : 1; // 12-bits comp code fw version + unsigned clctCounterLow : 15, flag11 : 1; + // 12 + unsigned lct0_nogem : 1, lct0_with_gemA : 1, lct0_with_gemB : 1, lct0_with_copad : 1, lct1_nogem : 1, + lct1_with_gemA : 1, lct1_with_gemB : 1, lct1_with_copad : 1, gemA_vpf : 1, gemB_vpf : 1, gemA_over_flow : 1, + gemB_over_flow : 1, gemA_sync : 1, gemB_sync : 1, gems_sync : 1, flag12 : 1; + unsigned trigCounter : 15, flag13 : 1; + unsigned clct1_comparator_code : 12, clct1_xky : 2, hmt_nhits_bit1 : 1, flag14 : 1; // 12-bits comp code fw version + unsigned alctCounterLow : 15, flag15 : 1; + // 16 + unsigned num_copad : 4, gem_delay : 4, gem_clct_win : 4, alct_gem_win : 3, flag16 : 1; + unsigned uptimeCounterLow : 15, flag17 : 1; + unsigned uptimeCounterHigh : 15, flag18 : 1; + unsigned nCFEBs : 3, nTBins : 5, fifoPretrig : 5, scopeExists : 1, vmeExists : 1, flag19 : 1; + // 20 + unsigned hitThresh : 3, pidThresh : 4, nphThresh : 3, pid_thresh_postdrift : 4, staggerCSC : 1, flag20 : 1; + unsigned triadPersist : 4, dmbThresh : 3, alct_delay : 4, clct_width : 4, flag21 : 1; + unsigned trigSourceVect : 9, clct0_slope : 4, clct0_LR_bend : 1, clct1_LR_bend : 1, flag22 : 1; + unsigned activeCFEBs : 5, readCFEBs : 5, pop_l1a_match_win : 4, aff_source : 1, flag23 : 1; + // 24 + unsigned tmbMatch : 1, alctOnly : 1, clctOnly : 1, matchWin : 4, noALCT : 1, oneALCT : 1, oneCLCT : 1, twoALCT : 1, + twoCLCT : 1, dupeALCT : 1, dupeCLCT : 1, lctRankErr : 1, flag24 : 1; + unsigned clct0_valid : 1, clct0_quality : 3, clct0_shape : 4, clct0_key_low : 7, flag25 : 1; + unsigned clct1_valid : 1, clct1_quality : 3, clct1_shape : 4, clct1_key_low : 7, flag26 : 1; + unsigned clct0_key_high : 1, clct1_key_high : 1, clct_bxn : 2, clct_sync_err : 1, clct0Invalid : 1, + clct1Invalid : 1, clct1Busy : 1, parity_err_cfeb_ram : 5, parity_err_rpc : 1, parity_err_summary : 1, + flag27 : 1; + // 28 + unsigned alct0Valid : 1, alct0Quality : 2, alct0Amu : 1, alct0Key : 7, clct1_slope : 4, flag28 : 1; + unsigned alct1Valid : 1, alct1Quality : 2, alct1Amu : 1, alct1Key : 7, drift_delay : 2, bcb_read_enable : 1, + hs_layer_trig : 1, flag29 : 1; + unsigned hmt_nhits_bits_high : 5, alct_ecc_err : 2, cfeb_badbits_found : 5, cfeb_badbits_blocked : 1, alctCfg : 1, + bx0_match : 1, flag30 : 1; + unsigned MPC_Muon0_alct_key_wire : 7, MPC_Muon_clct_pattern_low : 4, MPC_Muon0_lct_quality : 3, + MPC_Muon0_clct_QuarterStrip : 1, flag31 : 1; + // 32 + unsigned MPC_Muon0_clct_key_halfstrip : 8, MPC_Muon0_clct_LR : 1, MPC_Muon0_clct_EighthStrip : 1, + MPC_Muon_alct_bxn : 1, MPC_Muon0_clct_bx0 : 1, MPC_Muon0_clct_bend_low : 3, flag32 : 1; + unsigned MPC_Muon1_alct_key_wire : 7, MPC_Muon_clct_pattern_bit5 : 1, MPC_Muon_HMT_high : 3, + MPC_Muon1_lct_quality : 3, MPC_Muon1_clct_QuarterStrip : 1, flag33 : 1; + unsigned MPC_Muon1_clct_key_halfstrip : 8, MPC_Muon1_clct_LR : 1, MPC_Muon1_clct_EighthStrip : 1, + MPC_Muon_HMT_bit0 : 1, MPC_Muon1_clct_bx0 : 1, MPC_Muon1_clct_bend_low : 3, flag34 : 1; + unsigned MPC_Muon0_lct_vpf : 1, MPC_Muon0_clct_bend_bit4 : 1, MPC_Muon1_lct_vpf : 1, MPC_Muon1_clct_bend_bit4 : 1, + MPCDelay : 4, MPCAccept : 2, CFEBsEnabled : 5, flag35 : 1; + // 36 + unsigned gem_enabled_fibers_ : 4, gem_zero_suppression_ : 1, fifo_tbins_gem_ : 5, fifo_pretrig_gem_ : 5, flag36 : 1; + unsigned r_wr_buf_adr : 11, r_wr_buf_ready : 1, wr_buf_ready : 1, buf_q_full : 1, buf_q_empty : 1, flag37 : 1; + unsigned r_buf_fence_dist : 11, buf_q_ovf_err : 1, buf_q_udf_err : 1, buf_q_adr_err : 1, buf_stalled : 1, + flag38 : 1; + unsigned buf_fence_cnt : 12, reverse_hs_csc : 1, reverse_hs_me1a : 1, reverse_hs_me1b : 1, flag39 : 1; + // 40 + unsigned activeCFEBs_2 : 2, readCFEBs_2 : 2, cfeb_badbits_found_2 : 2, parity_err_cfeb_ram_2 : 2, + CFEBsEnabled_2 : 2, buf_fence_cnt_is_peak : 1, gem_csc_bend_enable : 1, trig_source_vec : 2, tmb_trig_pulse : 1, + flag40 : 1; + unsigned run3_trig_df : 1, gem_enable : 1, hmt_match_win : 4, tmb_alct_only_ro : 1, tmb_clct_only_ro : 1, + tmb_match_ro : 1, tmb_trig_keep : 1, tmb_non_trig_keep : 1, lyr_thresh_pretrig : 3, layer_trig_en : 1, + flag41 : 1; + unsigned e0bline : 16; + } bits; +}; + +#endif diff --git a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_Run2.h b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_Run2.h new file mode 100644 index 0000000000000..d767328f74a7a --- /dev/null +++ b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_Run2.h @@ -0,0 +1,143 @@ +#ifndef EventFilter_CSCRawToDigi_CSCTMBHeader2020_Run2_h +#define EventFilter_CSCRawToDigi_CSCTMBHeader2020_Run2_h +#include "EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h" +#include "DataFormats/MuonDetId/interface/CSCDetId.h" + +struct CSCTMBHeader2020_Run2 : public CSCVTMBHeaderFormat { + enum { NWORDS = 43 }; + CSCTMBHeader2020_Run2(int firmware_revision = 0x421); + CSCTMBHeader2020_Run2(const unsigned short* buf); + void setEventInformation(const CSCDMBHeader& dmbHeader) override; + + uint16_t BXNCount() const override { return bits.bxnCount; } + uint16_t ALCTMatchTime() const override { return bits.matchWin; } + uint16_t CLCTOnly() const override { return bits.clctOnly; } + uint16_t ALCTOnly() const override { return bits.alctOnly; } + uint16_t TMBMatch() const override { return bits.tmbMatch; } + uint16_t Bxn0Diff() const override { return 0; } + uint16_t Bxn1Diff() const override { return 0; } + uint16_t L1ANumber() const override { return bits.l1aNumber; } + uint16_t NTBins() const override { return bits.nTBins; } + uint16_t NCFEBs() const override { return bits.nCFEBs; } + void setNCFEBs(uint16_t ncfebs) override { bits.nCFEBs = ncfebs & 0x7F; } + uint16_t firmwareRevision() const override { return bits.firmRevCode; } + uint16_t syncError() const override { return bits.syncError; } + uint16_t syncErrorCLCT() const override { return bits.clct_sync_err; } + uint16_t syncErrorMPC0() const override { return bits.MPC_Muon0_SyncErr_; } + uint16_t syncErrorMPC1() const override { return bits.MPC_Muon1_SyncErr_; } + + // == Run 3 CSC-GEM Trigger Format + uint16_t clct0_ComparatorCode() const override { return 0; } + uint16_t clct1_ComparatorCode() const override { return 0; } + uint16_t clct0_xky() const override { return 0; } + uint16_t clct1_xky() const override { return 0; } + uint16_t hmt_nhits() const override { return 0; } + uint16_t hmt_ALCTMatchTime() const override { return 0; } + uint16_t gem_enabled_fibers() const override { return 0; } + uint16_t gem_fifo_tbins() const override { return 0; } + uint16_t gem_fifo_pretrig() const override { return 0; } + uint16_t gem_zero_suppress() const override { return 0; } + uint16_t gem_sync_dataword() const override { return 0; } + uint16_t gem_timing_dataword() const override { return 0; } + uint16_t run3_CLCT_patternID() const override { return 0; } + + ///returns CLCT digis + std::vector CLCTDigis(uint32_t idlayer) override; + ///returns CorrelatedLCT digis + std::vector CorrelatedLCTDigis(uint32_t idlayer) const override; + ///returns HMT Shower digi + CSCShowerDigi showerDigi(uint32_t idlayer) const override { return CSCShowerDigi(); } + + /// in 16-bit words. Add olne because we include beginning(b0c) and + /// end (e0c) flags + unsigned short int sizeInWords() const override { return NWORDS; } + + unsigned short int NHeaderFrames() const override { return bits.nHeaderFrames; } + /// returns the first data word + unsigned short* data() override { return (unsigned short*)(&bits); } + bool check() const override { return bits.e0bline == 0x6e0b; } + + /// for data packing + void addCLCT0(const CSCCLCTDigi& digi) override; + void addCLCT1(const CSCCLCTDigi& digi) override; + void addALCT0(const CSCALCTDigi& digi) override; + void addALCT1(const CSCALCTDigi& digi) override; + void addCorrelatedLCT0(const CSCCorrelatedLCTDigi& digi) override; + void addCorrelatedLCT1(const CSCCorrelatedLCTDigi& digi) override; + void addShower(const CSCShowerDigi& digi) override{}; + + void swapCLCTs(CSCCLCTDigi& digi1, CSCCLCTDigi& digi2); + + void print(std::ostream& os) const override; + + struct { + // 0 + unsigned b0cline : 16; + unsigned bxnCount : 12, dduCode1 : 3, flag1 : 1; + unsigned l1aNumber : 12, dduCode2 : 3, flag2 : 1; + unsigned readoutCounter : 12, dduCode3 : 3, flag3 : 1; + // 4 + unsigned boardID : 5, cscID : 4, runID : 4, stackOvf : 1, syncError : 1, flag4 : 1; + unsigned nHeaderFrames : 6, fifoMode : 3, r_type : 2, l1atype : 2, hasBuf : 1, bufFull : 1, flag5 : 1; + unsigned bd_status : 15, flag6 : 1; + unsigned firmRevCode : 15, flag7 : 1; + // 8 + unsigned bxnPreTrigger : 12, tmb_clct0_discard : 1, tmb_clct1_discard : 1, clock_lock_lost : 1, flag8 : 1; + unsigned preTrigCounterLow : 15, flag9 : 1; + unsigned preTrigCounterHigh : 15, flag10 : 1; + unsigned clctCounterLow : 15, flag11 : 1; + // 12 + unsigned clctCounterHigh : 15, flag12 : 1; + unsigned trigCounterLow : 15, flag13 : 1; + unsigned trigCounterHigh : 15, flag14 : 1; + unsigned alctCounterLow : 15, flag15 : 1; + // 16 + unsigned alctCounterHigh : 15, flag16 : 1; + unsigned uptimeCounterLow : 15, flag17 : 1; + unsigned uptimeCounterHigh : 15, flag18 : 1; + unsigned nCFEBs : 3, nTBins : 5, fifoPretrig : 5, scopeExists : 1, vmeExists : 1, flag19 : 1; + // 20 + unsigned hitThresh : 3, pidThresh : 4, nphThresh : 3, pid_thresh_postdrift : 4, staggerCSC : 1, flag20 : 1; + unsigned triadPersist : 4, dmbThresh : 3, alct_delay : 4, clct_width : 4, flag21 : 1; + unsigned trigSourceVect : 9, r_nlayers_hit_vec : 6, flag22 : 1; + unsigned activeCFEBs : 5, readCFEBs : 5, pop_l1a_match_win : 4, aff_source : 1, flag23 : 1; + // 24 + unsigned tmbMatch : 1, alctOnly : 1, clctOnly : 1, matchWin : 4, noALCT : 1, oneALCT : 1, oneCLCT : 1, twoALCT : 1, + twoCLCT : 1, dupeALCT : 1, dupeCLCT : 1, lctRankErr : 1, flag24 : 1; + unsigned clct0_valid : 1, clct0_quality : 3, clct0_shape : 4, clct0_key_low : 7, flag25 : 1; + unsigned clct1_valid : 1, clct1_quality : 3, clct1_shape : 4, clct1_key_low : 7, flag26 : 1; + unsigned clct0_key_high : 1, clct1_key_high : 1, clct_bxn : 2, clct_sync_err : 1, clct0Invalid : 1, + clct1Invalid : 1, clct1Busy : 1, parity_err_cfeb_ram : 5, parity_err_rpc : 1, parity_err_summary : 1, + flag27 : 1; + // 28 + unsigned alct0Valid : 1, alct0Quality : 2, alct0Amu : 1, alct0Key : 7, alct_pretrig_win : 4, flag28 : 1; + unsigned alct1Valid : 1, alct1Quality : 2, alct1Amu : 1, alct1Key : 7, drift_delay : 2, bcb_read_enable : 1, + hs_layer_trig : 1, flag29 : 1; + unsigned alctBXN : 5, alct_ecc_err : 2, cfeb_badbits_found : 5, cfeb_badbits_blocked : 1, alctCfg : 1, + bx0_match : 1, flag30 : 1; + unsigned MPC_Muon0_wire_ : 7, MPC_Muon0_clct_pattern_ : 4, MPC_Muon0_quality_ : 4, flag31 : 1; + // 32 + unsigned MPC_Muon0_halfstrip_clct_pattern : 8, MPC_Muon0_bend_ : 1, MPC_Muon0_SyncErr_ : 1, MPC_Muon0_bx_ : 1, + MPC_Muon0_bc0_ : 1, MPC_Muon0_cscid_low : 3, flag32 : 1; + unsigned MPC_Muon1_wire_ : 7, MPC_Muon1_clct_pattern_ : 4, MPC_Muon1_quality_ : 4, flag33 : 1; + unsigned MPC_Muon1_halfstrip_clct_pattern : 8, MPC_Muon1_bend_ : 1, MPC_Muon1_SyncErr_ : 1, MPC_Muon1_bx_ : 1, + MPC_Muon1_bc0_ : 1, MPC_Muon1_cscid_low : 3, flag34 : 1; + unsigned MPC_Muon0_vpf_ : 1, MPC_Muon0_cscid_bit4 : 1, MPC_Muon1_vpf_ : 1, MPC_Muon1_cscid_bit4 : 1, MPCDelay : 4, + MPCAccept : 2, CFEBsEnabled : 5, flag35 : 1; + // 36 + unsigned RPCList : 2, NRPCs : 2, RPCEnable : 1, fifo_tbins_rpc : 5, fifo_pretrig_rpc : 5, flag36 : 1; + unsigned r_wr_buf_adr : 11, r_wr_buf_ready : 1, wr_buf_ready : 1, buf_q_full : 1, buf_q_empty : 1, flag37 : 1; + unsigned r_buf_fence_dist : 11, buf_q_ovf_err : 1, buf_q_udf_err : 1, buf_q_adr_err : 1, buf_stalled : 1, + flag38 : 1; + unsigned buf_fence_cnt : 12, reverse_hs_csc : 1, reverse_hs_me1a : 1, reverse_hs_me1b : 1, flag39 : 1; + // 40 + unsigned activeCFEBs_2 : 2, readCFEBs_2 : 2, cfeb_badbits_found_2 : 2, parity_err_cfeb_ram_2 : 2, + CFEBsEnabled_2 : 2, buf_fence_cnt_is_peak : 1, mxcfeb : 1, trig_source_vec : 2, tmb_trig_pulse : 1, flag40 : 1; + unsigned tmb_allow_alct : 1, tmb_allow_clct : 1, tmb_allow_match : 1, tmb_allow_alct_ro : 1, tmb_allow_clct_ro : 1, + tmb_allow_match_ro : 1, tmb_alct_only_ro : 1, tmb_clct_only_ro : 1, tmb_match_ro : 1, tmb_trig_keep : 1, + tmb_non_trig_keep : 1, lyr_thresh_pretrig : 3, layer_trig_en : 1, flag41 : 1; + unsigned e0bline : 16; + } bits; +}; + +#endif diff --git a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_TMB.h b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_TMB.h new file mode 100644 index 0000000000000..fa809c117997e --- /dev/null +++ b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_TMB.h @@ -0,0 +1,145 @@ +#ifndef EventFilter_CSCRawToDigi_CSCTMBHeader2020_TMB_h +#define EventFilter_CSCRawToDigi_CSCTMBHeader2020_TMB_h +#include "EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h" +#include "DataFormats/MuonDetId/interface/CSCDetId.h" + +struct CSCTMBHeader2020_TMB : public CSCVTMBHeaderFormat { + enum { NWORDS = 43 }; + CSCTMBHeader2020_TMB(); + CSCTMBHeader2020_TMB(const unsigned short* buf); + void setEventInformation(const CSCDMBHeader& dmbHeader) override; + + uint16_t BXNCount() const override { return bits.bxnCount; } + uint16_t ALCTMatchTime() const override { return bits.matchWin; } + uint16_t CLCTOnly() const override { return bits.clctOnly; } + uint16_t ALCTOnly() const override { return bits.alctOnly; } + uint16_t TMBMatch() const override { return bits.tmbMatch; } + uint16_t Bxn0Diff() const override { return 0; } + uint16_t Bxn1Diff() const override { return 0; } + uint16_t L1ANumber() const override { return bits.l1aNumber; } + uint16_t NTBins() const override { return bits.nTBins; } + uint16_t NCFEBs() const override { return bits.nCFEBs; } + void setNCFEBs(uint16_t ncfebs) override { bits.nCFEBs = ncfebs & 0x7F; } + uint16_t firmwareRevision() const override { return bits.firmRevCode; } + uint16_t syncError() const override { return bits.syncError; } + uint16_t syncErrorCLCT() const override { return bits.clct_sync_err; } + uint16_t syncErrorMPC0() const override { return 0; } + uint16_t syncErrorMPC1() const override { return 0; } + + // == Run 3 CSC-GEM Trigger Format + uint16_t clct0_ComparatorCode() const override { return 0; } + uint16_t clct1_ComparatorCode() const override { return 0; } + uint16_t clct0_xky() const override { return 0; } + uint16_t clct1_xky() const override { return 0; } + uint16_t hmt_nhits() const override { return 0; } + uint16_t hmt_ALCTMatchTime() const override { return 0; } + uint16_t gem_enabled_fibers() const override { return 0; } + uint16_t gem_fifo_tbins() const override { return 0; } + uint16_t gem_fifo_pretrig() const override { return 0; } + uint16_t gem_zero_suppress() const override { return 0; } + uint16_t gem_sync_dataword() const override { return 0; } + uint16_t gem_timing_dataword() const override { return 0; } + uint16_t run3_CLCT_patternID() const override { return 0; } + + ///returns CLCT digis + std::vector CLCTDigis(uint32_t idlayer) override; + ///returns CorrelatedLCT digis + std::vector CorrelatedLCTDigis(uint32_t idlayer) const override; + ///returns HMT Shower digi + CSCShowerDigi showerDigi(uint32_t idlayer) const override; + + /// in 16-bit words. Add olne because we include beginning(b0c) and + /// end (e0c) flags + unsigned short int sizeInWords() const override { return NWORDS; } + + unsigned short int NHeaderFrames() const override { return bits.nHeaderFrames; } + /// returns the first data word + unsigned short* data() override { return (unsigned short*)(&bits); } + bool check() const override { return bits.e0bline == 0x6e0b; } + + /// for data packing + void addCLCT0(const CSCCLCTDigi& digi) override; + void addCLCT1(const CSCCLCTDigi& digi) override; + void addALCT0(const CSCALCTDigi& digi) override; + void addALCT1(const CSCALCTDigi& digi) override; + void addCorrelatedLCT0(const CSCCorrelatedLCTDigi& digi) override; + void addCorrelatedLCT1(const CSCCorrelatedLCTDigi& digi) override; + void addShower(const CSCShowerDigi& digi) override; + + void swapCLCTs(CSCCLCTDigi& digi1, CSCCLCTDigi& digi2); + + void print(std::ostream& os) const override; + + struct { + // 0 + unsigned b0cline : 16; + unsigned bxnCount : 12, dduCode1 : 3, flag1 : 1; + unsigned l1aNumber : 12, dduCode2 : 3, flag2 : 1; + unsigned readoutCounter : 12, dduCode3 : 3, flag3 : 1; + // 4 + unsigned boardID : 5, cscID : 4, runID : 4, stackOvf : 1, syncError : 1, flag4 : 1; + unsigned nHeaderFrames : 6, fifoMode : 3, r_type : 2, l1atype : 2, hasBuf : 1, bufFull : 1, flag5 : 1; + unsigned bd_status : 15, flag6 : 1; + unsigned firmRevCode : 15, flag7 : 1; + // 8 + unsigned bxnPreTrigger : 12, tmb_clct0_discard : 1, tmb_clct1_discard : 1, clock_lock_lost : 1, flag8 : 1; + unsigned preTrigCounterLow : 15, flag9 : 1; + unsigned preTrigCounterHigh : 15, flag10 : 1; + unsigned clctCounterLow : 15, flag11 : 1; + // 12 + unsigned clctCounterHigh : 15, flag12 : 1; + unsigned trigCounterLow : 15, flag13 : 1; + unsigned trigCounterHigh : 15, flag14 : 1; + unsigned alctCounterLow : 15, flag15 : 1; + // 16 + unsigned alctCounterHigh : 15, flag16 : 1; + unsigned uptimeCounterLow : 15, flag17 : 1; + unsigned uptimeCounterHigh : 15, flag18 : 1; + unsigned nCFEBs : 3, nTBins : 5, fifoPretrig : 5, scopeExists : 1, vmeExists : 1, flag19 : 1; + // 20 + unsigned hitThresh : 3, pidThresh : 4, nphThresh : 3, pid_thresh_postdrift : 4, staggerCSC : 1, flag20 : 1; + unsigned triadPersist : 4, dmbThresh : 3, alct_delay : 4, clct_width : 4, flag21 : 1; + unsigned trigSourceVect : 9, r_nlayers_hit_vec : 6, flag22 : 1; + unsigned activeCFEBs : 5, readCFEBs : 5, pop_l1a_match_win : 4, aff_source : 1, flag23 : 1; + // 24 + unsigned tmbMatch : 1, alctOnly : 1, clctOnly : 1, matchWin : 4, noALCT : 1, oneALCT : 1, oneCLCT : 1, twoALCT : 1, + twoCLCT : 1, dupeALCT : 1, dupeCLCT : 1, lctRankErr : 1, flag24 : 1; + unsigned clct0_valid : 1, clct0_quality : 3, clct0_shape : 4, clct0_key_low : 7, flag25 : 1; + unsigned clct1_valid : 1, clct1_quality : 3, clct1_shape : 4, clct1_key_low : 7, flag26 : 1; + unsigned clct0_key_high : 1, clct1_key_high : 1, clct_bxn : 2, clct_sync_err : 1, clct0Invalid : 1, + clct1Invalid : 1, clct1Busy : 1, parity_err_cfeb_ram : 5, parity_err_rpc : 1, parity_err_summary : 1, + flag27 : 1; + // 28 + unsigned alct0Valid : 1, alct0Quality : 2, alct0Amu : 1, alct0Key : 7, alct_pretrig_win : 4, flag28 : 1; + unsigned alct1Valid : 1, alct1Quality : 2, alct1Amu : 1, alct1Key : 7, drift_delay : 2, bcb_read_enable : 1, + hs_layer_trig : 1, flag29 : 1; + unsigned alctBXN : 5, alct_ecc_err : 2, cfeb_badbits_found : 5, cfeb_badbits_blocked : 1, alctCfg : 1, + bx0_match : 1, flag30 : 1; + unsigned MPC_Muon0_alct_key_wire : 7, MPC_Muon_clct_pattern_low : 4, MPC_Muon0_lct_quality : 3, + MPC_Muon0_clct_QuarterStrip : 1, flag31 : 1; + // 32 + unsigned MPC_Muon0_clct_key_halfstrip : 8, MPC_Muon0_clct_LR : 1, MPC_Muon0_clct_EighthStrip : 1, + MPC_Muon_alct_bxn : 1, MPC_Muon0_clct_bx0 : 1, MPC_Muon0_clct_bend_low : 3, flag32 : 1; + unsigned MPC_Muon1_alct_key_wire : 7, MPC_Muon_clct_pattern_bit5 : 1, MPC_Muon_HMT_high : 3, + MPC_Muon1_lct_quality : 3, MPC_Muon1_clct_QuarterStrip : 1, flag33 : 1; + unsigned MPC_Muon1_clct_key_halfstrip : 8, MPC_Muon1_clct_LR : 1, MPC_Muon1_clct_EighthStrip : 1, + MPC_Muon_HMT_bit0 : 1, MPC_Muon1_clct_bx0 : 1, MPC_Muon1_clct_bend_low : 3, flag34 : 1; + unsigned MPC_Muon0_lct_vpf : 1, MPC_Muon0_clct_bend_bit4 : 1, MPC_Muon1_lct_vpf : 1, MPC_Muon1_clct_bend_bit4 : 1, + MPCDelay : 4, MPCAccept : 2, CFEBsEnabled : 5, flag35 : 1; + // 36 + unsigned RPCList : 2, NRPCs : 2, RPCEnable : 1, fifo_tbins_rpc : 5, fifo_pretrig_rpc : 5, flag36 : 1; + unsigned r_wr_buf_adr : 11, r_wr_buf_ready : 1, wr_buf_ready : 1, buf_q_full : 1, buf_q_empty : 1, flag37 : 1; + unsigned r_buf_fence_dist : 11, buf_q_ovf_err : 1, buf_q_udf_err : 1, buf_q_adr_err : 1, buf_stalled : 1, + flag38 : 1; + unsigned buf_fence_cnt : 12, reverse_hs_csc : 1, reverse_hs_me1a : 1, reverse_hs_me1b : 1, flag39 : 1; + // 40 + unsigned activeCFEBs_2 : 2, readCFEBs_2 : 2, cfeb_badbits_found_2 : 2, parity_err_cfeb_ram_2 : 2, + CFEBsEnabled_2 : 2, buf_fence_cnt_is_peak : 1, mxcfeb : 1, trig_source_vec : 2, tmb_trig_pulse : 1, flag40 : 1; + unsigned tmb_allow_alct : 1, tmb_allow_clct : 1, tmb_allow_match : 1, tmb_allow_alct_ro : 1, tmb_allow_clct_ro : 1, + tmb_allow_match_ro : 1, tmb_alct_only_ro : 1, tmb_clct_only_ro : 1, tmb_match_ro : 1, tmb_trig_keep : 1, + tmb_non_trig_keep : 1, lyr_thresh_pretrig : 3, layer_trig_en : 1, flag41 : 1; + unsigned e0bline : 16; + } bits; +}; + +#endif diff --git a/EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h b/EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h index 2f32bc8dbe0c9..36aca2232cb24 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h +++ b/EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h @@ -29,6 +29,22 @@ class CSCVTMBHeaderFormat { virtual uint16_t syncErrorCLCT() const = 0; virtual uint16_t syncErrorMPC0() const = 0; virtual uint16_t syncErrorMPC1() const = 0; + + /// == Run 3 CSC-GEM Trigger Format + virtual uint16_t clct0_ComparatorCode() const = 0; + virtual uint16_t clct1_ComparatorCode() const = 0; + virtual uint16_t clct0_xky() const = 0; + virtual uint16_t clct1_xky() const = 0; + virtual uint16_t hmt_nhits() const = 0; + virtual uint16_t hmt_ALCTMatchTime() const = 0; + virtual uint16_t gem_enabled_fibers() const = 0; + virtual uint16_t gem_fifo_tbins() const = 0; + virtual uint16_t gem_fifo_pretrig() const = 0; + virtual uint16_t gem_zero_suppress() const = 0; + virtual uint16_t gem_sync_dataword() const = 0; + virtual uint16_t gem_timing_dataword() const = 0; + virtual uint16_t run3_CLCT_patternID() const = 0; + uint16_t sizeInBytes() const { return sizeInWords() * 2; } virtual uint16_t NTBins() const = 0; virtual uint16_t NCFEBs() const = 0; @@ -38,6 +54,8 @@ class CSCVTMBHeaderFormat { virtual std::vector CLCTDigis(uint32_t idlayer) = 0; ///returns CorrelatedLCT digis virtual std::vector CorrelatedLCTDigis(uint32_t idlayer) const = 0; + ///returns Run3 HMT Shower digi + virtual CSCShowerDigi showerDigi(uint32_t idlayer) const = 0; /// in 16-bit words. Add olne because we include beginning(b0c) and /// end (e0c) flags @@ -47,9 +65,6 @@ class CSCVTMBHeaderFormat { virtual unsigned short* data() = 0; virtual bool check() const = 0; - /// Needed before data packing - //void setChamberId(const CSCDetId & detId) {theChamberId = detId;} - /// for data packing virtual void addCLCT0(const CSCCLCTDigi& digi) = 0; virtual void addCLCT1(const CSCCLCTDigi& digi) = 0; diff --git a/EventFilter/CSCRawToDigi/plugins/CSCDCCUnpacker.cc b/EventFilter/CSCRawToDigi/plugins/CSCDCCUnpacker.cc index 20a3a224a3b00..9c755c35787c2 100644 --- a/EventFilter/CSCRawToDigi/plugins/CSCDCCUnpacker.cc +++ b/EventFilter/CSCRawToDigi/plugins/CSCDCCUnpacker.cc @@ -53,6 +53,7 @@ #include "EventFilter/CSCRawToDigi/interface/CSCTMBData.h" #include "EventFilter/CSCRawToDigi/interface/CSCDCCEventData.h" #include "EventFilter/CSCRawToDigi/interface/CSCCFEBData.h" +#include "EventFilter/CSCRawToDigi/interface/CSCGEMData.h" #include "EventFilter/CSCRawToDigi/interface/CSCMonitorInterface.h" #include @@ -83,6 +84,9 @@ class CSCDCCUnpacker : public edm::stream::EDProducer<> { bool debug, printEventNumber, goodEvent, useExaminer, unpackStatusDigis; bool useSelectiveUnpacking, useFormatStatus; + /// option to unpack RPC data + bool useRPCs_; + /// option to unpack GEM cluster data bool useGEMs_; @@ -97,6 +101,9 @@ class CSCDCCUnpacker : public edm::stream::EDProducer<> { int numOfEvents; unsigned int errorMask, examinerMask; bool instantiateDQM; + + bool disableMappingCheck, b904Setup; + CSCMonitorInterface* monitor; /// Token for consumes interface & access to data @@ -120,6 +127,7 @@ CSCDCCUnpacker::CSCDCCUnpacker(const edm::ParameterSet& pset) : numOfEvents(0) { /// Enable Format Status Digis useFormatStatus = pset.getParameter("UseFormatStatus"); + useRPCs_ = pset.getParameter("useRPCs"); useGEMs_ = pset.getParameter("useGEMs"); useCSCShowers_ = pset.getParameter("useCSCShowers"); @@ -128,6 +136,11 @@ CSCDCCUnpacker::CSCDCCUnpacker(const edm::ParameterSet& pset) : numOfEvents(0) { debug = pset.getUntrackedParameter("Debug", false); instantiateDQM = pset.getUntrackedParameter("runDQM", false); + // Disable FED/DDU to chamber mapping inconsistency check + disableMappingCheck = pset.getUntrackedParameter("DisableMappingCheck", false); + // Make aware the unpacker that B904 test setup is used (disable mapping inconsistency check) + b904Setup = pset.getUntrackedParameter("B904Setup", false); + /// Visualization of raw data visualFEDInspect = pset.getUntrackedParameter("VisualFEDInspect", false); visualFEDShort = pset.getUntrackedParameter("VisualFEDShort", false); @@ -145,7 +158,6 @@ CSCDCCUnpacker::CSCDCCUnpacker(const edm::ParameterSet& pset) : numOfEvents(0) { produces("MuonCSCComparatorDigi"); produces("MuonCSCALCTDigi"); produces("MuonCSCCLCTDigi"); - produces("MuonCSCRPCDigi"); produces("MuonCSCCorrelatedLCTDigi"); if (unpackStatusDigis) { @@ -161,6 +173,10 @@ CSCDCCUnpacker::CSCDCCUnpacker(const edm::ParameterSet& pset) : numOfEvents(0) { produces("MuonCSCDCCFormatStatusDigi"); } + if (useRPCs_) { + produces("MuonCSCRPCDigi"); + } + if (useGEMs_) { produces("MuonGEMPadDigiCluster"); } @@ -197,6 +213,7 @@ void CSCDCCUnpacker::fillDescriptions(edm::ConfigurationDescriptions& descriptio desc.add("ErrorMask", 0)->setComment("# This mask simply reduces error reporting"); desc.add("UnpackStatusDigis", false)->setComment("# Unpack general status digis?"); desc.add("UseFormatStatus", true)->setComment("# Unpack FormatStatus digi?"); + desc.add("useRPCs", false)->setComment("Unpack RPC data"); desc.add("useGEMs", false)->setComment("Unpack GEM trigger data"); desc.add("useCSCShowers", false)->setComment("Unpack CSCShower trigger data"); desc.addUntracked("Debug", false)->setComment("# Turn on lots of output"); @@ -206,6 +223,9 @@ void CSCDCCUnpacker::fillDescriptions(edm::ConfigurationDescriptions& descriptio desc.addUntracked("VisualFEDShort", false)->setComment("# Visualization of raw data in corrupted events"); desc.addUntracked("FormatedEventDump", false); desc.addUntracked("SuppressZeroLCT", true); + desc.addUntracked("DisableMappingCheck", false) + ->setComment("# Disable FED/DDU to chamber mapping inconsistency check"); + desc.addUntracked("B904Setup", false)->setComment("# Make the unpacker aware of B904 test setup configuration"); descriptions.add("muonCSCDCCUnpacker", desc); descriptions.setComment(" This is the generic cfi file for CSC unpacking"); } @@ -331,9 +351,9 @@ void CSCDCCUnpacker::produce(edm::Event& e, const edm::EventSetup& c) { } /* - std::cout << "FED" << id << " " << fedData.size() << " " << goodEvent << " " - << std::hex << examiner->errors() << std::dec << " " << status << std::endl; - */ + std::cout << "FED" << std::dec << id << " size:" << fedData.size() << " good:" << goodEvent << " errs 0x" + << std::hex << examiner->errors() << std::dec << std::endl; + */ // Fill Format status digis per FED // Remove examiner->errors() != 0 check if we need to put status digis for every event @@ -457,10 +477,13 @@ void CSCDCCUnpacker::produce(edm::Event& e, const edm::EventSetup& c) { /// Skip chambers (special case of data corruption), which report wrong ID and pose as different chamber if (isDDU_FED) { unsigned int dduid = cscmapping->ddu(layer); - if ((dduid >= 1) && (dduid <= 36)) + if ((dduid >= 1) && (dduid <= 36)) { dduid = postLS1_map[dduid - 1]; // Fix for Post-LS1 FED/DDU IDs mappings - // std::cout << "CSC " << layer << " -> " << id << ":" << dduid << ":" << vmecrate << ":" << dmb ; - if (id != dduid) { + // std::cout << "CSC " << layer << " -> " << id << ":" << dduid << ":" << vmecrate << ":" << dmb << std::endl; + } + + /// Do not skip chamber data if mapping check is disabled or b904 setup data file is used + if ((!disableMappingCheck) && (!b904Setup) && (id != dduid)) { LogTrace("CSCDDUUnpacker|CSCRawToDigi") << " CSC->FED/DDU mapping inconsistency!!! "; LogTrace("CSCDCCUnpacker|CSCRawToDigi") << "readout FED/DDU ID=" << id << " expected ID=" << dduid << ", skipping chamber " << layer @@ -539,12 +562,39 @@ void CSCDCCUnpacker::produce(edm::Event& e, const edm::EventSetup& c) { } else clctProduct->move(std::make_pair(clctDigis.begin(), clctDigis.end()), layer); - /// fill cscrpc digi + /// fill Run3 HMT Shower digi + if (useCSCShowers_) { + CSCShowerDigi showerDigi = cscData[iCSC].tmbHeader()->showerDigi(layer.rawId()); + if (showerDigi.isValid()) { + std::vector showerDigis; + showerDigis.push_back(showerDigi); + showerProduct->move(std::make_pair(showerDigis.begin(), showerDigis.end()), layer); + } + } + + /// fill CSC-RPC or CSC-GEMs digis if (cscData[iCSC].tmbData()->checkSize()) { - if (cscData[iCSC].tmbData()->hasRPC()) { + if (useRPCs_ && cscData[iCSC].tmbData()->hasRPC()) { std::vector rpcDigis = cscData[iCSC].tmbData()->rpcData()->digis(); rpcProduct->move(std::make_pair(rpcDigis.begin(), rpcDigis.end()), layer); } + + /// fill CSC-GEM GEMPadCluster digis + if (useGEMs_ && cscData[iCSC].tmbData()->hasGEM()) { + for (int unsigned igem = 0; igem < (int unsigned)(cscData[iCSC].tmbData()->gemData()->numGEMs()); + ++igem) { + int gem_chamber = layer.chamber(); + int gem_region = (layer.endcap() == 1) ? 1 : -1; + for (unsigned ieta = 0; ieta < 8; ieta++) { + // GE11 eta needs to be reversed from 0-7 to 8-1 + GEMDetId gemid(gem_region, layer.ring(), layer.station(), igem + 1, gem_chamber, 8 - ieta); + std::vector gemDigis = + cscData[iCSC].tmbData()->gemData()->etaDigis(igem, ieta); + if (!gemDigis.empty()) + gemProduct->move(std::make_pair(gemDigis.begin(), gemDigis.end()), gemid); + } + } + } } else LogTrace("CSCDCCUnpacker|CSCRawToDigi") << " TMBData check size failed!"; } @@ -632,7 +682,6 @@ void CSCDCCUnpacker::produce(edm::Event& e, const edm::EventSetup& c) { e.put(std::move(alctProduct), "MuonCSCALCTDigi"); e.put(std::move(clctProduct), "MuonCSCCLCTDigi"); e.put(std::move(comparatorProduct), "MuonCSCComparatorDigi"); - e.put(std::move(rpcProduct), "MuonCSCRPCDigi"); e.put(std::move(corrlctProduct), "MuonCSCCorrelatedLCTDigi"); if (useFormatStatus) @@ -646,6 +695,10 @@ void CSCDCCUnpacker::produce(edm::Event& e, const edm::EventSetup& c) { e.put(std::move(dccStatusProduct), "MuonCSCDCCStatusDigi"); e.put(std::move(alctStatusProduct), "MuonCSCALCTStatusDigi"); } + + if (useRPCs_) { + e.put(std::move(rpcProduct), "MuonCSCRPCDigi"); + } if (useGEMs_) { e.put(std::move(gemProduct), "MuonGEMPadDigiCluster"); } diff --git a/EventFilter/CSCRawToDigi/src/CSCDCCExaminer.cc b/EventFilter/CSCRawToDigi/src/CSCDCCExaminer.cc index f3a6879d99298..d746d68838aed 100644 --- a/EventFilter/CSCRawToDigi/src/CSCDCCExaminer.cc +++ b/EventFilter/CSCRawToDigi/src/CSCDCCExaminer.cc @@ -234,6 +234,7 @@ CSCDCCExaminer::CSCDCCExaminer(ExaminerMaskType mask) nWG_round_up = 0; TMB_WordsRPC = 0; + TMB_WordsGEM = 0; TMB_Firmware_Revision = 0; DDU_Firmware_Revision = 0; zeroCounts(); @@ -270,10 +271,12 @@ int32_t CSCDCCExaminer::check(const uint16_t*& buffer, int32_t length) { /// Check for presence of data blocks inside TMB data bool fTMB_MiniScope_Start = false; bool fTMB_RPC_Start = false; + bool fTMB_GEM_Start = false; bool fTMB_BlockedCFEBs_Start = false; bool fTMB_MiniScope = false; bool fTMB_RPC = false; + bool fTMB_GEM = false; bool fTMB_BlockedCFEBs = false; while (length > 0) { @@ -602,10 +605,12 @@ int32_t CSCDCCExaminer::check(const uint16_t*& buffer, int32_t length) { fTMB_MiniScope_Start = false; fTMB_RPC_Start = false; + fTMB_GEM_Start = false; fTMB_BlockedCFEBs_Start = false; fTMB_MiniScope = false; fTMB_RPC = false; + fTMB_GEM = false; fTMB_BlockedCFEBs = false; zeroCounts(); @@ -959,11 +964,42 @@ int32_t CSCDCCExaminer::check(const uint16_t*& buffer, int32_t length) { if (fTMB_Header && ((buf0[2] & 0xFFFF) == 0x6E0B)) { if (fTMB_Format2007) { /* Checks for TMB2007 firmware revisions ranges to detect data format + ---------------- + * rev. code <0x4000 - TMB/OTMB firmware with changed firmware revision format + * 4 bits [12:9] = Data Format Version for the unpacker (can include TMB vs. OTMB etc here) + * 4 bits [8:5] = Major Version (major features which breaks compatibility, requires changes to other board firmware) + * 5 bits [4:0] = Minor version (minor features, internal fixes, bug fixes, etc). + * ---------------- * rev.0x50c3 - first revision with changed format * rev.0x42D5 - oldest known from 06/21/2007 * There is 4-bits year value rollover in revision number (0 in 2016) */ if ((TMB_Firmware_Revision >= 0x50c3) || (TMB_Firmware_Revision < 0x42D5)) { + bool isGEMfirmware = false; + if ((TMB_Firmware_Revision < 0x4000) && + (TMB_Firmware_Revision > 0x0)) { /* New TMB firmware revision format */ + /* Data Format Version codes + * 0=TMB + * 1=OTMB standard + * 2=OTMB+CCLUT+HMT Run3 data format + * 3=OTMB+CCLUT+HMT+GEM Run3 data format + */ + if (((TMB_Firmware_Revision >> 9) & 0x3) == 0x3) + isGEMfirmware = true; + } + + if (isGEMfirmware) { + uint16_t Enabled_GEMs = 0; + /* GEM output format, based on the number of enabled fibers, not yet implemented in the firmware */ + /* + for (int i = 0; i < 4; i++) + Enabled_GEMs += (buf_1[0] >> i) & 0x1; + */ + Enabled_GEMs = 4; // Currently always assume that all 4 fibers are enabled + // Number of enabled GEM Fibers * nTimebins + TMB_WordsGEM = Enabled_GEMs * ((buf_1[0] >> 5) & 0x1F) * 4; + TMB_WordsGEM += 2; // add header/trailer for block of GEM raw hits + } // On/off * nRPCs * nTimebins * 2 words/RPC/bin TMB_WordsRPC = ((buf_1[0] & 0x0010) >> 4) * ((buf_1[0] & 0x000c) >> 2) * ((buf_1[0] >> 5) & 0x1F) * 2; } else // original TMB2007 data format (may not work since TMB_Tbins != RPC_Tbins) @@ -982,6 +1018,11 @@ int32_t CSCDCCExaminer::check(const uint16_t*& buffer, int32_t length) { fTMB_RPC_Start = true; } + // Check for GEM data + if (fTMB_Header && (scanbuf(buf0, 4, 0x6C04) >= 0)) { + fTMB_GEM_Start = true; + } + // Check for Mini-Scope data if (fTMB_Header && (scanbuf(buf0, 4, 0x6B07) >= 0)) { fTMB_MiniScope_Start = true; @@ -997,6 +1038,11 @@ int32_t CSCDCCExaminer::check(const uint16_t*& buffer, int32_t length) { fTMB_RPC = true; } + // Check for end of GEM data + if (fTMB_Header && fTMB_GEM_Start && (scanbuf(buf0, 4, 0x6D04) >= 0)) { + fTMB_GEM = true; + } + // Check for end of Mini-Scope data if (fTMB_Header && fTMB_MiniScope_Start && (scanbuf(buf0, 4, 0x6E07) >= 0)) { fTMB_MiniScope = true; @@ -1007,12 +1053,6 @@ int32_t CSCDCCExaminer::check(const uint16_t*& buffer, int32_t length) { fTMB_BlockedCFEBs = true; } - /* - if ( fTMB_Header && (scanbuf(buf0,4, 0x6E04)>=0) ) { - TMB_WordsExpected += TMB_WordsRPC; - } - */ - // == TMB Trailer found if ( // Old TMB data format; last condition in needed not to confuse if with new ALCT data header @@ -1085,6 +1125,10 @@ int32_t CSCDCCExaminer::check(const uint16_t*& buffer, int32_t length) { if (fTMB_RPC) TMB_WordsExpected += TMB_WordsRPC; + // Correct expected wordcount by GEM data size + if (fTMB_GEM) + TMB_WordsExpected += TMB_WordsGEM; + // Correct expected wordcount by MiniScope data size (22 words + 2 signature words) if (fTMB_MiniScope) TMB_WordsExpected += 24; @@ -1115,7 +1159,7 @@ int32_t CSCDCCExaminer::check(const uint16_t*& buffer, int32_t length) { // == CFEB Sample Trailer found - if (((buf0[1] & 0xF000) == 0x7000) && ((buf0[2] & 0xF000) == 0x7000) && + if (!fTMB_Header && ((buf0[1] & 0xF000) == 0x7000) && ((buf0[2] & 0xF000) == 0x7000) && ((buf0[1] != 0x7FFF) || (buf0[2] != 0x7FFF)) && (((buf0[3] & 0xFFFF) == 0x7FFF) || // old format ((buf0[3] & buf0[0]) == 0x0000 && (buf0[3] + buf0[0]) == 0x7FFF) // 2007 format @@ -1167,7 +1211,7 @@ int32_t CSCDCCExaminer::check(const uint16_t*& buffer, int32_t length) { } // == CFEB B-word found - if ((buf0[0] & 0xF000) == 0xB000 && (buf0[1] & 0xF000) == 0xB000 && (buf0[2] & 0xF000) == 0xB000 && + if (!fTMB_Header && (buf0[0] & 0xF000) == 0xB000 && (buf0[1] & 0xF000) == 0xB000 && (buf0[2] & 0xF000) == 0xB000 && (buf0[3] & 0xF000) == 0xB000) { bCHAMB_STATUS[currentChamber] |= 0x400000; diff --git a/EventFilter/CSCRawToDigi/src/CSCGEMData.cc b/EventFilter/CSCRawToDigi/src/CSCGEMData.cc new file mode 100644 index 0000000000000..69be9e92991ae --- /dev/null +++ b/EventFilter/CSCRawToDigi/src/CSCGEMData.cc @@ -0,0 +1,173 @@ +#include "EventFilter/CSCRawToDigi/interface/CSCGEMData.h" +#include "DataFormats/GEMDigi/interface/GEMPadDigiCluster.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include +#include +#include // for bzero +#include + +#ifdef LOCAL_UNPACK +bool CSCGEMData::debug = false; +#else +std::atomic CSCGEMData::debug{false}; +#endif + +CSCGEMData::CSCGEMData(int ntbins, int gems_fibers) : ntbins_(ntbins), size_(0) { + theData[0] = 0x6C04; + ntbins_ = ntbins; + gems_enabled_ = gems_fibers; + ngems_ = 0; + /* Not implemented in the firmware yet */ + /* + for (int i=0; i<4; i++) + ngems_ += (gems_fibers>>i) & 0x1; + */ + ngems_ = 4; + size_ = 2 + ntbins_ * ngems_ * 4; + theData[size_ - 1] = 0x6D04; +} + +CSCGEMData::CSCGEMData(const unsigned short* buf, int length, int gems_fibers) : size_(length) { + size_ = length; + ngems_ = 0; + /* Not implemented in the firmware yet */ + /* + for (int i=0; i<4; i++) + ngems_ += (gems_fibers>>i) & 0x1; + */ + ngems_ = 4; + ntbins_ = (size_ - 2) / (4 * ngems_); + gems_enabled_ = gems_fibers; + memcpy(theData, buf, size_ * 2); +} + +void CSCGEMData::print() const { + LogTrace("CSCGEMData|CSCRawToDigi") << "CSCGEMData.Print"; + for (int line = 0; line < ((size_)); ++line) { + LogTrace("CSCGEMData|CSCRawToDigi") << std::hex << theData[line]; + } +} + +int CSCGEMData::getPartitionNumber(int addr, int npads) const { return addr / (npads - 1); } + +int CSCGEMData::getPartitionStripNumber(int address, int nPads, int etaPart) const { + return address - (nPads * etaPart); +} + +std::vector CSCGEMData::digis(int gem_chamber) const { + /// GEM data format v2 + std::vector result; + result.clear(); + int nPads = 192; // From geometry + int maxClusters = 4; + int nGEMs = 4; + // nGEMs = ngems_; // based on enabled fibers. not implemented in the firmware yet + for (int i = 0; i < ntbins_; i++) { + for (int fiber = 0; fiber < nGEMs; fiber++) { + for (int cluster = 0; cluster < maxClusters; cluster++) { + int dataAddr = 1 + (i * nGEMs + fiber) * maxClusters + cluster; + int gem_layer = (theData[dataAddr] >> 14) & 0x1; // gemA=0 or gemB=1 + if (gem_layer == gem_chamber) { + int cl_word = theData[dataAddr] & 0x3fff; + int pad = theData[dataAddr] & 0xff; + int eta = (theData[dataAddr] >> 8) & 0x7; + int cluster_size = (theData[dataAddr] >> 11) & 0x7; + if (pad < nPads) { + int padInPart = eta * nPads + pad; + if (debug) + LogTrace("CSCGEMData|CSCRawToDigi") + << "GEMlayer" << gem_layer << " cl_word" << dataAddr << ": 0x" << std::hex << cl_word << std::dec + << " tbin: " << i << " fiber#: " << (fiber + 1) << " cluster#: " << (cluster + 1) + << " padInPart: " << padInPart << " pad: " << pad << " eta: " << eta + << " cluster_size: " << cluster_size << std::endl; + std::vector pads; + for (int iP = 0; iP <= cluster_size; ++iP) + pads.push_back(padInPart + iP); + GEMPadDigiCluster pad_cluster(pads, i); + result.push_back(pad_cluster); + } + } + } + } + } + + /// GEM data format v1 + /// It is not used in the production + /// Keeping this commented code just for v1 unpacking algo reference + /* + std::vector result; + result.clear(); + int nPads = 192; // From geometry + int maxAddr = 1536; + int nGEMs = 2; + int maxClusters = 8; + // std::cout << std::hex << "markers " << theData[0] << ": " << theData[size_-1] << std::dec << " size: " << size_ << std::endl; + for (int i=0; i>11)&0x7; + if (address pads; + for(int iP = 0; iP <= nExtraPads; ++iP) + pads.push_back(padInPart + iP ); + GEMPadDigiCluster cluster ( pads, i); + result.push_back(cluster); + } + } + } + } + } + */ + return result; +} + +std::vector CSCGEMData::etaDigis(int gem_chamber, int eta_roll) const { + /// GEM data format v2 + std::vector result; + result.clear(); + int nPads = 192; // From geometry + int maxClusters = 4; + int nGEMs = 4; + // nGEMs = ngems_; // based on enabled fibers. not implemented in the firmware yet + for (int i = 0; i < ntbins_; i++) { + for (int fiber = 0; fiber < nGEMs; fiber++) { + for (int cluster = 0; cluster < maxClusters; cluster++) { + int dataAddr = 1 + (i * nGEMs + fiber) * maxClusters + cluster; + int gem_layer = (theData[dataAddr] >> 14) & 0x1; // gemA=0 or gemB=1 + if (gem_layer == gem_chamber) { + int cl_word = theData[dataAddr] & 0x3fff; + int pad = theData[dataAddr] & 0xff; + int eta = (theData[dataAddr] >> 8) & 0x7; + int cluster_size = (theData[dataAddr] >> 11) & 0x7; + if ((pad < nPads) && (eta == eta_roll)) { + int padInPart = pad; + if (debug) + LogTrace("CSCGEMData|CSCRawToDigi") + << "GEMlayer" << gem_layer << " cl_word" << dataAddr << ": 0x" << std::hex << cl_word << std::dec + << " tbin: " << i << " fiber#: " << (fiber + 1) << " cluster#: " << (cluster + 1) + << " padInPart: " << padInPart << " pad: " << pad << " eta: " << eta + << " cluster_size: " << cluster_size << std::endl; + std::vector pads; + for (int iP = 0; iP <= cluster_size; ++iP) + pads.push_back(padInPart + iP); + GEMPadDigiCluster pad_cluster(pads, i); + result.push_back(pad_cluster); + } + } + } + } + } + return result; +} diff --git a/EventFilter/CSCRawToDigi/src/CSCTMBData.cc b/EventFilter/CSCRawToDigi/src/CSCTMBData.cc index 4394764bd042c..821f7a9e9f355 100644 --- a/EventFilter/CSCRawToDigi/src/CSCTMBData.cc +++ b/EventFilter/CSCRawToDigi/src/CSCTMBData.cc @@ -24,6 +24,7 @@ CSCTMBData::CSCTMBData() theE0FLine(0), theTMBHeader(2007, 0x50c3), theComparatorData(&theTMBHeader), + theGEMData(nullptr), theTMBScopeIsPresent(false), theTMBScope(nullptr), theTMBMiniScopeIsPresent(false), @@ -33,7 +34,8 @@ CSCTMBData::CSCTMBData() theTMBTrailer(theTMBHeader.sizeInWords() + theComparatorData.sizeInWords(), 2007), size_(0), cWordCnt(0), - theRPCDataIsPresent(false) {} + theRPCDataIsPresent(false), + theGEMDataIsPresent(false) {} CSCTMBData::CSCTMBData(int firmwareVersion, int firmwareRevision, int cfebs) : theOriginalBuffer(nullptr), @@ -41,6 +43,7 @@ CSCTMBData::CSCTMBData(int firmwareVersion, int firmwareRevision, int cfebs) theE0FLine(0), theTMBHeader(firmwareVersion, firmwareRevision), theComparatorData(&theTMBHeader), + theGEMData(nullptr), theTMBScopeIsPresent(false), theTMBScope(nullptr), theTMBMiniScopeIsPresent(false), @@ -50,7 +53,8 @@ CSCTMBData::CSCTMBData(int firmwareVersion, int firmwareRevision, int cfebs) theTMBTrailer(theTMBHeader.sizeInWords() + theComparatorData.sizeInWords(), firmwareVersion), size_(0), cWordCnt(0), - theRPCDataIsPresent(false) { + theRPCDataIsPresent(false), + theGEMDataIsPresent(false) { theTMBHeader.setNCFEBs(cfebs); theComparatorData = CSCComparatorData(&theTMBHeader); theTMBTrailer = CSCTMBTrailer(theTMBHeader.sizeInWords() + theComparatorData.sizeInWords(), firmwareVersion); @@ -60,6 +64,7 @@ CSCTMBData::CSCTMBData(const uint16_t* buf) : theOriginalBuffer(buf), theTMBHeader(2007, 0x50c3), theComparatorData(&theTMBHeader), + theGEMData(nullptr), theTMBScopeIsPresent(false), theTMBScope(nullptr), theTMBMiniScopeIsPresent(false), @@ -67,7 +72,8 @@ CSCTMBData::CSCTMBData(const uint16_t* buf) theBlockedCFEBIsPresent(false), theTMBBlockedCFEB(nullptr), theTMBTrailer(theTMBHeader.sizeInWords() + theComparatorData.sizeInWords(), 2007), - theRPCDataIsPresent(false) { + theRPCDataIsPresent(false), + theGEMDataIsPresent(false) { size_ = UnpackTMB(buf); } @@ -80,13 +86,15 @@ CSCTMBData::CSCTMBData(const CSCTMBData& data) theTMBHeader(data.theTMBHeader), theComparatorData(data.theComparatorData), theRPCData(data.theRPCData), + theGEMData(data.theGEMData), theTMBScopeIsPresent(data.theTMBScopeIsPresent), theTMBMiniScopeIsPresent(data.theTMBMiniScopeIsPresent), theBlockedCFEBIsPresent(data.theBlockedCFEBIsPresent), theTMBTrailer(data.theTMBTrailer), size_(data.size_), cWordCnt(data.cWordCnt), - theRPCDataIsPresent(data.theRPCDataIsPresent) { + theRPCDataIsPresent(data.theRPCDataIsPresent), + theGEMDataIsPresent(data.theGEMDataIsPresent) { if (theTMBScopeIsPresent) { theTMBScope = new CSCTMBScope(*(data.theTMBScope)); } else { @@ -104,6 +112,12 @@ CSCTMBData::CSCTMBData(const CSCTMBData& data) } else { theTMBBlockedCFEB = nullptr; } + + if (theGEMDataIsPresent) { + theGEMData = new CSCGEMData(*(data.theGEMData)); + } else { + theGEMData = nullptr; + } } CSCTMBData::~CSCTMBData() { @@ -121,6 +135,11 @@ CSCTMBData::~CSCTMBData() { delete theTMBBlockedCFEB; theBlockedCFEBIsPresent = false; } + + if (theGEMDataIsPresent) { + delete theGEMData; + theGEMDataIsPresent = false; + } } /// returns -1 if not found @@ -154,8 +173,13 @@ int CSCTMBData::TMBCRCcalc() { int CSCTMBData::UnpackTMB(const uint16_t* buf) { ///determine 2007 or 2006 version unsigned short int firmwareVersion = 0; + unsigned short int firmwareRevision = 0; int Ntbins = 0; - int NRPCtbins = 0; // =VB= number of RPC tbins + int NRPCtbins = 0; // Number of RPC tbins + int NGEMtbins = 0; // Number of GEM tbins + int NGEMEnabled = 0; // Number of Enabled GEM Fibers + int GEMFibersMask = 0; + bool isGEMfirmware = false; int b0cLine = 0; ///assumes that buf starts at the tmb data ///this is not true if something is wrong in the data @@ -163,8 +187,24 @@ int CSCTMBData::UnpackTMB(const uint16_t* buf) { if (buf[b0cLine] == 0xdb0c) { firmwareVersion = 2007; + firmwareRevision = buf[b0cLine + 7] & 0x7fff; Ntbins = buf[b0cLine + 19] & 0xF8; - NRPCtbins = (buf[b0cLine + 36] >> 5) & 0x1F; // =VB= get RPC tbins + if ((firmwareRevision < 0x4000) /* New Run3 (O)TMB firmware revision format */ + && (((firmwareRevision >> 9) & 0x2) == 0x2)) + isGEMfirmware = true; + + if (isGEMfirmware) { + GEMFibersMask = buf[b0cLine + 36] & 0xf; // GEM enabled fibers 4-bits mask + /// Handling of enabled GEM fibers is not yet properly implemented in the firmware + // for (int i = 0; i < 4; i++) + // NGEMEnabled += (buf[b0cLine + 36] >> i) & 0x1; // Get number of enabled GEM fibers + NGEMEnabled = 4; // Currently always assume that all 4 fibers are enabled + NGEMtbins = (buf[b0cLine + 36] >> 5) & 0x1F; // Get GEM tbins + } + // } else { + { + NRPCtbins = (buf[b0cLine + 36] >> 5) & 0x1F; // Get RPC tbins + } } else if (buf[b0cLine] == 0x6b0c) { firmwareVersion = 2006; Ntbins = buf[b0cLine + 1] & 0x1f; @@ -180,6 +220,7 @@ int CSCTMBData::UnpackTMB(const uint16_t* buf) { } int MaxSizeRPC = 1 + NRPCtbins * 2 * 4 + 1; + int MaxSizeGEM = 1 + NGEMEnabled * NGEMtbins * 4 + 1; //int MaxSizeScope = 5; int e0bLine = -1; switch (firmwareVersion) { @@ -213,10 +254,7 @@ int CSCTMBData::UnpackTMB(const uint16_t* buf) { currentPosition += theComparatorData.sizeInWords(); } - //int i = currentPosition-1; - //printf ( "%04x %04x %04x %04x\n",buf[i+3],buf[i+2],buf[i+1],buf[i] ) ; - - // look for RPC + // look for RPC data int b04Line = currentPosition; if (buf[b04Line] == 0x6b04) { @@ -232,10 +270,31 @@ int CSCTMBData::UnpackTMB(const uint16_t* buf) { } } + // look for GEM data + int c04Line = currentPosition; + + if (buf[c04Line] == 0x6c04) { + // we need an d04 line to calculate the size + int d04Line = findLine(buf, 0x6d04, currentPosition, currentPosition + MaxSizeGEM); + if (d04Line != -1) { + theGEMDataIsPresent = true; + theGEMData = new CSCGEMData(buf + c04Line, d04Line - c04Line + 1, GEMFibersMask); + if (theGEMData != nullptr) + currentPosition += theGEMData->sizeInWords(); + } else { + LogTrace("CSCTMBData|CSCRawToDigi") << "CSCTMBData::corrupt GEM data! Failed to find end! "; + return 0; + } + } + int TotTMBReadout = 0; switch (firmwareVersion) { case 2007: - TotTMBReadout = 43 + Ntbins * 6 * 5 + 1 + NRPCtbins * 2 * 4 + 2 + 8 * 256 + 8; + if (theGEMDataIsPresent) { + TotTMBReadout = 43 + Ntbins * 6 * 5 + 1 + NGEMEnabled * NGEMtbins * 4 + 2 + 8 * 256 + 8; + } else { + TotTMBReadout = 43 + Ntbins * 6 * 5 + 1 + NRPCtbins * 2 * 4 + 2 + 8 * 256 + 8; + }; break; case 2006: TotTMBReadout = @@ -357,10 +416,10 @@ CSCTMBMiniScope& CSCTMBData::tmbMiniScope() const { return *theTMBMiniScope; } -CSCTMBBlockedCFEB& CSCTMBData::tmbBlockedCFEB() const { - if (!theBlockedCFEBIsPresent) - throw("No TMB Blocked CFEB in this chamber"); - return *theTMBBlockedCFEB; +CSCGEMData* CSCTMBData::gemData() const { + if (!theGEMDataIsPresent) + throw("No GEM Data in this chamber"); + return theGEMData; } std::bitset<22> CSCTMBData::nextCRC22_D16(const std::bitset<16>& D, const std::bitset<22>& C) { diff --git a/EventFilter/CSCRawToDigi/src/CSCTMBHeader.cc b/EventFilter/CSCRawToDigi/src/CSCTMBHeader.cc index 4793af87d24bc..e0a30aa82f937 100644 --- a/EventFilter/CSCRawToDigi/src/CSCTMBHeader.cc +++ b/EventFilter/CSCRawToDigi/src/CSCTMBHeader.cc @@ -5,6 +5,10 @@ #include "EventFilter/CSCRawToDigi/interface/CSCTMBHeader2007.h" #include "EventFilter/CSCRawToDigi/interface/CSCTMBHeader2007_rev0x50c3.h" #include "EventFilter/CSCRawToDigi/interface/CSCTMBHeader2013.h" +#include "EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_TMB.h" +#include "EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_CCLUT.h" +#include "EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_GEM.h" +#include "EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_Run2.h" #include "DataFormats/CSCDigi/interface/CSCCLCTDigi.h" #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -19,7 +23,59 @@ std::atomic CSCTMBHeader::debug{false}; CSCTMBHeader::CSCTMBHeader(int firmwareVersion, int firmwareRevision) : theHeaderFormat(), theFirmwareVersion(firmwareVersion) { - if (firmwareVersion == 2013) { + if (firmwareVersion == 2020) { + if ((firmwareRevision < 0x4000) && (firmwareRevision > 0x0)) { /* New (O)TMB firmware revision format */ + bool isGEM_fw = false; + bool isCCLUT_HMT_fw = false; + bool isOTMB_Run2_fw = false; + bool isTMB_Run3_fw = false; + bool isTMB_Run2_fw = false; + bool isRun2_df = false; + unsigned df_version = (firmwareRevision >> 9) & 0xF; // 4-bits Data Format version + unsigned major_ver = (firmwareRevision >> 5) & 0xF; // 4-bits major version part + // unsigned minor_ver = firmwareRevision & 0x1F; // 5-bits minor version part + switch (df_version) { + case 0x3: + isGEM_fw = true; + break; + case 0x2: + isCCLUT_HMT_fw = true; + break; + case 0x1: + isOTMB_Run2_fw = true; + break; + case 0x0: + if (major_ver == 1) + isTMB_Run2_fw = true; + else + isTMB_Run3_fw = true; + break; + default: + isGEM_fw = true; + } + if (major_ver == 1) { + isRun2_df = true; + } + + if (isGEM_fw) { + if (isRun2_df) { + theHeaderFormat = std::shared_ptr(new CSCTMBHeader2020_Run2(firmwareRevision)); + } else { + theHeaderFormat = std::shared_ptr(new CSCTMBHeader2020_GEM()); + } + } else if (isCCLUT_HMT_fw) { + if (isRun2_df) { + theHeaderFormat = std::shared_ptr(new CSCTMBHeader2020_Run2(firmwareRevision)); + } else { + theHeaderFormat = std::shared_ptr(new CSCTMBHeader2020_CCLUT()); + } + } else if (isOTMB_Run2_fw || isTMB_Run2_fw || isRun2_df) { + theHeaderFormat = std::shared_ptr(new CSCTMBHeader2020_Run2(firmwareRevision)); + } else if (isTMB_Run3_fw) { + theHeaderFormat = std::shared_ptr(new CSCTMBHeader2020_TMB()); + } + } + } else if (firmwareVersion == 2013) { theHeaderFormat = std::shared_ptr(new CSCTMBHeader2013()); } else if (firmwareVersion == 2006) { theHeaderFormat = std::shared_ptr(new CSCTMBHeader2006()); @@ -33,7 +89,17 @@ CSCTMBHeader::CSCTMBHeader(int firmwareVersion, int firmwareRevision) // if (firmwareRevision >= 0x7a76) // First OTMB firmware revision with 2013 format /* Revisions > 0x6000 - OTMB firmwares, < 0x42D5 - new TMB revisions in 2016 */ if ((firmwareRevision >= 0x6000) || (firmwareRevision < 0x42D5)) { - theHeaderFormat = std::shared_ptr(new CSCTMBHeader2013()); + bool isGEMfirmware = false; + /* There are OTMB2013 firmware versions exist, which reports firmwareRevision code = 0x0 */ + if ((firmwareRevision < 0x4000) && (firmwareRevision > 0x0)) { /* New (O)TMB firmware revision format */ + if (((firmwareRevision >> 9) & 0x3) == 0x3) + isGEMfirmware = true; + if (isGEMfirmware) { + theHeaderFormat = std::shared_ptr(new CSCTMBHeader2020_GEM()); + } else { + theHeaderFormat = std::shared_ptr(new CSCTMBHeader2013()); + } + } } else { theHeaderFormat = std::shared_ptr(new CSCTMBHeader2007_rev0x50c3()); } @@ -64,7 +130,65 @@ CSCTMBHeader::CSCTMBHeader(const unsigned short *buf) : theHeaderFormat() { /* Revisions > 0x6000 - OTMB firmwares, < 0x42D5 - new TMB revisions in 2016 */ if ((theHeaderFormat->firmwareRevision() >= 0x6000) || (theHeaderFormat->firmwareRevision() < 0x42D5)) { theFirmwareVersion = 2013; - theHeaderFormat = std::shared_ptr(new CSCTMBHeader2013(buf)); + bool isGEM_fw = false; + bool isCCLUT_HMT_fw = false; + bool isOTMB_Run2_fw = false; + bool isTMB_Run3_fw = false; + bool isTMB_Run2_fw = false; + bool isRun2_df = false; + unsigned firmwareRevision = theHeaderFormat->firmwareRevision(); + /* There are OTMB2013 firmware versions exist, which reports firmwareRevision code = 0x0 */ + if ((firmwareRevision < 0x4000) && (firmwareRevision > 0x0)) { /* New (O)TMB firmware revision format */ + theFirmwareVersion = 2020; + unsigned df_version = (firmwareRevision >> 9) & 0xF; // 4-bits Data Format version + unsigned major_ver = (firmwareRevision >> 5) & 0xF; // 4-bits major version part + // unsigned minor_ver = firmwareRevision & 0x1F; // 5-bits minor version part + switch (df_version) { + case 0x3: + isGEM_fw = true; + break; + case 0x2: + isCCLUT_HMT_fw = true; + break; + case 0x1: + isOTMB_Run2_fw = true; + break; + case 0x0: + if (major_ver == 1) + isTMB_Run2_fw = true; + else + isTMB_Run3_fw = true; + break; + default: + isGEM_fw = true; + } + if (major_ver == 1) { + isRun2_df = true; + } + } + if (theFirmwareVersion == 2020) { + if (isGEM_fw) { + if (isRun2_df) { + theHeaderFormat = std::shared_ptr(new CSCTMBHeader2020_Run2(buf)); + } else { + theHeaderFormat = std::shared_ptr(new CSCTMBHeader2020_GEM(buf)); + } + } else if (isCCLUT_HMT_fw) { + if (isRun2_df) { + theHeaderFormat = std::shared_ptr(new CSCTMBHeader2020_Run2(buf)); + } else { + theHeaderFormat = std::shared_ptr(new CSCTMBHeader2020_CCLUT(buf)); + } + } else if (isOTMB_Run2_fw || isTMB_Run2_fw || isRun2_df) { + theHeaderFormat = std::shared_ptr(new CSCTMBHeader2020_Run2(buf)); + } else if (isTMB_Run3_fw) { + theHeaderFormat = std::shared_ptr(new CSCTMBHeader2020_TMB(buf)); + } + + } else { + theHeaderFormat = std::shared_ptr(new CSCTMBHeader2013(buf)); + } + } else { theHeaderFormat = std::shared_ptr(new CSCTMBHeader2007_rev0x50c3(buf)); } @@ -157,6 +281,38 @@ CSCTMBHeader2013 CSCTMBHeader::tmbHeader2013() const { return *result; } +CSCTMBHeader2020_TMB CSCTMBHeader::tmbHeader2020_TMB() const { + CSCTMBHeader2020_TMB *result = dynamic_cast(theHeaderFormat.get()); + if (result == nullptr) { + throw cms::Exception("Could not get 2020 TMB Run3 header format"); + } + return *result; +} + +CSCTMBHeader2020_CCLUT CSCTMBHeader::tmbHeader2020_CCLUT() const { + CSCTMBHeader2020_CCLUT *result = dynamic_cast(theHeaderFormat.get()); + if (result == nullptr) { + throw cms::Exception("Could not get 2020 (O)TMB CCLUT header format"); + } + return *result; +} + +CSCTMBHeader2020_GEM CSCTMBHeader::tmbHeader2020_GEM() const { + CSCTMBHeader2020_GEM *result = dynamic_cast(theHeaderFormat.get()); + if (result == nullptr) { + throw cms::Exception("Could not get 2020 (O)TMB GEM header format"); + } + return *result; +} + +CSCTMBHeader2020_Run2 CSCTMBHeader::tmbHeader2020_Run2() const { + CSCTMBHeader2020_Run2 *result = dynamic_cast(theHeaderFormat.get()); + if (result == nullptr) { + throw cms::Exception("Could not get 2020 (O)TMB legacy Run2 header format"); + } + return *result; +} + CSCTMBHeader2006 CSCTMBHeader::tmbHeader2006() const { CSCTMBHeader2006 *result = dynamic_cast(theHeaderFormat.get()); if (result == nullptr) { @@ -186,6 +342,54 @@ void CSCTMBHeader::selfTest(int firmwareVersion, int firmwareRevision) { CSCCorrelatedLCTDigi lct0(1, 1, 2, 10, 98, 5, 0, 1, 0, 0, 0, 0); CSCCorrelatedLCTDigi lct1(2, 1, 2, 20, 15, 9, 1, 0, 0, 0, 0, 0); + // Use Run3 format digis for TMB firmwareVersion 2020 + // and revision codes for MEx1 CCLUT, ME11 CCLUT/GEM + if (firmwareVersion >= 2020) { + bool isGEM_fw = false; + bool isCCLUT_HMT_fw = false; + bool isOTMB_Run2_fw = false; + bool isTMB_Run3_fw = false; + bool isTMB_Run2_fw = false; + bool isRun2_df = false; + unsigned df_version = (firmwareRevision >> 9) & 0xF; // 4-bits Data Format version + unsigned major_ver = (firmwareRevision >> 5) & 0xF; // 4-bits major version part + // unsigned minor_ver = firmwareRevision & 0x1F; // 5-bits minor version part + switch (df_version) { + case 0x3: + isGEM_fw = true; + break; + case 0x2: + isCCLUT_HMT_fw = true; + break; + case 0x1: + isOTMB_Run2_fw = true; + break; + case 0x0: + if (major_ver == 1) + isTMB_Run2_fw = true; + else + isTMB_Run3_fw = true; + break; + default: + isGEM_fw = true; + } + if (major_ver == 1) { + isRun2_df = true; + } + if ((isGEM_fw || isCCLUT_HMT_fw) && !isRun2_df && !isOTMB_Run2_fw && !isTMB_Run2_fw) { + clct0 = CSCCLCTDigi( + 1, 6, 6, 1, 0, (120 % 32), (120 / 32), 2, 1, 3, 0xebf, CSCCLCTDigi::Version::Run3, true, false, 2, 6); + clct1 = CSCCLCTDigi( + 1, 6, 3, 1, 1, (132 % 32), (132 / 32), 2, 2, 3, 0xe54, CSCCLCTDigi::Version::Run3, false, true, 1, 15); + } + if ((isGEM_fw || isCCLUT_HMT_fw || isTMB_Run3_fw) && !isRun2_df && !isOTMB_Run2_fw && !isTMB_Run2_fw) { + lct0 = CSCCorrelatedLCTDigi( + 1, 1, 3, 85, 120, 6, 0, 0, 0, 0, 0, 0, CSCCorrelatedLCTDigi::Version::Run3, true, false, 2, 6); + lct1 = CSCCorrelatedLCTDigi( + 2, 1, 2, 81, 132, 3, 1, 0, 0, 0, 0, 0, CSCCorrelatedLCTDigi::Version::Run3, false, true, 0, 15); + } + } + CSCTMBHeader tmbHeader(firmwareVersion, firmwareRevision); tmbHeader.addCLCT0(clct0); tmbHeader.addCLCT1(clct1); diff --git a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2006.cc b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2006.cc index 5bad0f0a7ff3a..04e9592c6bdca 100644 --- a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2006.cc +++ b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2006.cc @@ -41,7 +41,6 @@ std::vector CSCTMBHeader2006::CLCTDigis(uint32_t idlayer) { CSCCLCTDigi digi0( bits.clct0_valid, bits.clct0_quality, shape, type, bend, strip, cfeb, bits.clct0_bxn, 1, bits.bxnPreTrigger); - //digi0.setFullBX(bits.bxnPreTrigger); result.push_back(digi0); /// for the first bits.clct: @@ -59,7 +58,6 @@ std::vector CSCTMBHeader2006::CLCTDigis(uint32_t idlayer) { //offlineStripNumbering(strip, cfeb, shape, bend); CSCCLCTDigi digi1( bits.clct1_valid, bits.clct1_quality, shape, type, bend, strip, cfeb, bits.clct1_bxn, 2, bits.bxnPreTrigger); - //digi1.setFullBX(bits.bxnPreTrigger); result.push_back(digi1); return result; } @@ -200,5 +198,3 @@ void CSCTMBHeader2006::print(std::ostream& os) const { os << "Firmware Rev code " << bits.firmRevCode << "\n"; os << "..................CLCT....................." << std::endl; } - -//unsigned short * data() = 0; diff --git a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2007.cc b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2007.cc index 411abb217df71..123e7ea612dcb 100644 --- a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2007.cc +++ b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2007.cc @@ -16,7 +16,6 @@ CSCTMBHeader2007::CSCTMBHeader2007(const unsigned short* buf) { memcpy(data(), b void CSCTMBHeader2007::setEventInformation(const CSCDMBHeader& dmbHeader) { bits.cscID = dmbHeader.dmbID(); bits.l1aNumber = dmbHeader.l1a(); - // bits.bxnCount = dmbHeader.bxn(); } ///returns CLCT digis @@ -29,7 +28,6 @@ std::vector CSCTMBHeader2007::CLCTDigis(uint32_t idlayer) { //offlineStripNumbering(strip, cfeb, pattern, bend); CSCCLCTDigi digi0( bits.clct0_valid, bits.clct0_quality, pattern, 1, bend, strip, cfeb, bits.clct0_bxn, 1, bits.bxnPreTrigger); - //digi0.setFullBX(bits.bxnPreTrigger); strip = bits.clct1_key; cfeb = (bits.clct1_cfeb_low) | (bits.clct1_cfeb_high << 1); @@ -38,7 +36,6 @@ std::vector CSCTMBHeader2007::CLCTDigis(uint32_t idlayer) { //offlineStripNumbering(strip, cfeb, pattern, bend); CSCCLCTDigi digi1( bits.clct1_valid, bits.clct1_quality, pattern, 1, bend, strip, cfeb, bits.clct1_bxn, 2, bits.bxnPreTrigger); - //digi1.setFullBX(bits.bxnPreTrigger); //if (digi0.isValid() && digi1.isValid()) swapCLCTs(digi0, digi1); @@ -168,21 +165,13 @@ void CSCTMBHeader2007::print(std::ostream& os) const { << "\n"; os << std::hex << "BOC LINE " << bits.b0cline << " EOB " << bits.e0bline << "\n"; os << std::dec << "fifoMode = " << bits.fifoMode << ", nTBins = " << bits.nTBins << "\n"; - // os << "dumpCFEBs = " << dumpCFEBs << ", nHeaderFrames = " - // << nHeaderFrames << "\n"; os << "boardID = " << bits.boardID << ", cscID = " << bits.cscID << "\n"; os << "l1aNumber = " << bits.l1aNumber << ", bxnCount = " << bits.bxnCount << "\n"; - // os << "preTrigTBins = " << preTrigTBins << ", nCFEBs = "<< nCFEBs<< " "; os << "trigSourceVect = " << bits.trigSourceVect << ", activeCFEBs = " << bits.activeCFEBs << "\n"; os << "bxnPreTrigger = " << bits.bxnPreTrigger << "\n"; os << "tmbMatch = " << bits.tmbMatch << " alctOnly = " << bits.alctOnly << " clctOnly = " << bits.clctOnly << "\n"; - // << " alctMatchTime = " << alctMatchTime << " "; - // os << "hs_thresh = " << hs_thresh << ", ds_thresh = " << ds_thresh - // << " "; os << "clct0_key = " << bits.clct0_key << " bits.clct0_shape = " << bits.clct0_shape << " clct0_quality = " << bits.clct0_quality << "\n"; - // os << "r_buf_nbusy = " << r_buf_nbusy << " "; - os << "..................CLCT....................." << "\n"; } diff --git a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2007_rev0x50c3.cc b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2007_rev0x50c3.cc index ef5c07eaba7b8..0e93db48e7ebe 100644 --- a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2007_rev0x50c3.cc +++ b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2007_rev0x50c3.cc @@ -19,7 +19,6 @@ CSCTMBHeader2007_rev0x50c3::CSCTMBHeader2007_rev0x50c3(const unsigned short* buf void CSCTMBHeader2007_rev0x50c3::setEventInformation(const CSCDMBHeader& dmbHeader) { bits.cscID = dmbHeader.dmbID(); bits.l1aNumber = dmbHeader.l1a24() & 0xFFF; - // bits.bxnCount = dmbHeader.bxn12(); } ///returns CLCT digis @@ -34,7 +33,6 @@ std::vector CSCTMBHeader2007_rev0x50c3::CLCTDigis(uint32_t idlayer) //offlineStripNumbering(strip, cfeb, pattern, bend); CSCCLCTDigi digi0( bits.clct0_valid, bits.clct0_quality, pattern, 1, bend, strip, cfeb, bits.clct_bxn, 1, bits.bxnPreTrigger); - //digi0.setFullBX(bits.bxnPreTrigger); halfstrip = bits.clct1_key_low + (bits.clct1_key_high << 7); strip = halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB; @@ -45,7 +43,6 @@ std::vector CSCTMBHeader2007_rev0x50c3::CLCTDigis(uint32_t idlayer) //offlineStripNumbering(strip, cfeb, pattern, bend); CSCCLCTDigi digi1( bits.clct1_valid, bits.clct1_quality, pattern, 1, bend, strip, cfeb, bits.clct_bxn, 2, bits.bxnPreTrigger); - //digi1.setFullBX(bits.bxnPreTrigger); result.push_back(digi0); result.push_back(digi1); return result; @@ -171,21 +168,12 @@ void CSCTMBHeader2007_rev0x50c3::print(std::ostream& os) const { << "\n"; os << std::hex << "BOC LINE " << bits.b0cline << " EOB " << bits.e0bline << "\n"; os << std::dec << "fifoMode = " << bits.fifoMode << ", nTBins = " << bits.nTBins << "\n"; - // os << "dumpCFEBs = " << dumpCFEBs << ", nHeaderFrames = " - // << nHeaderFrames << "\n"; os << "boardID = " << bits.boardID << ", cscID = " << bits.cscID << "\n"; os << "l1aNumber = " << bits.l1aNumber << ", bxnCount = " << bits.bxnCount << "\n"; - // os << "preTrigTBins = " << preTrigTBins << ", nCFEBs = "<< nCFEBs<< " "; os << "trigSourceVect = " << bits.trigSourceVect << ", activeCFEBs = " << bits.activeCFEBs << "\n"; os << "bxnPreTrigger = " << bits.bxnPreTrigger << "\n"; os << "tmbMatch = " << bits.tmbMatch << " alctOnly = " << bits.alctOnly << " clctOnly = " << bits.clctOnly << "\n"; - // << " alctMatchTime = " << alctMatchTime << " "; - // os << "hs_thresh = " << hs_thresh << ", ds_thresh = " << ds_thresh - // << " "; - // os << "clct0_key = " << bits.clct0_key os << " bits.clct0_shape = " << bits.clct0_shape << " clct0_quality = " << bits.clct0_quality << "\n"; - // os << "r_buf_nbusy = " << r_buf_nbusy << " "; - os << "..................CLCT....................." << "\n"; } diff --git a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2013.cc b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2013.cc index 1c79a290a8ec1..d3dc945a20f94 100644 --- a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2013.cc +++ b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2013.cc @@ -17,7 +17,7 @@ CSCTMBHeader2013::CSCTMBHeader2013(const unsigned short* buf) { memcpy(data(), b void CSCTMBHeader2013::setEventInformation(const CSCDMBHeader& dmbHeader) { bits.cscID = dmbHeader.dmbID(); bits.l1aNumber = dmbHeader.l1a24() & 0xFFF; - // bits.bxnCount = dmbHeader.bxn12(); + // bits.bxnCount = dmbHeader.bxn12(); } ///returns CLCT digis @@ -32,7 +32,6 @@ std::vector CSCTMBHeader2013::CLCTDigis(uint32_t idlayer) { //offlineStripNumbering(strip, cfeb, pattern, bend); CSCCLCTDigi digi0( bits.clct0_valid, bits.clct0_quality, pattern, 1, bend, strip, cfeb, bits.clct_bxn, 1, bits.bxnPreTrigger); - //digi0.setFullBX(bits.bxnPreTrigger); halfstrip = bits.clct1_key_low + (bits.clct1_key_high << 7); strip = halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB; @@ -43,7 +42,6 @@ std::vector CSCTMBHeader2013::CLCTDigis(uint32_t idlayer) { //offlineStripNumbering(strip, cfeb, pattern, bend); CSCCLCTDigi digi1( bits.clct1_valid, bits.clct1_quality, pattern, 1, bend, strip, cfeb, bits.clct_bxn, 2, bits.bxnPreTrigger); - //digi1.setFullBX(bits.bxnPreTrigger); result.push_back(digi0); result.push_back(digi1); return result; @@ -169,22 +167,14 @@ void CSCTMBHeader2013::print(std::ostream& os) const { << "\n"; os << std::hex << "BOC LINE " << bits.b0cline << " EOB " << bits.e0bline << "\n"; os << std::dec << "fifoMode = " << bits.fifoMode << ", nTBins = " << bits.nTBins << "\n"; - // os << "dumpCFEBs = " << dumpCFEBs << ", nHeaderFrames = " - // << nHeaderFrames << "\n"; os << "boardID = " << bits.boardID << ", cscID = " << bits.cscID << "\n"; os << "l1aNumber = " << bits.l1aNumber << ", bxnCount = " << bits.bxnCount << "\n"; - // os << "preTrigTBins = " << preTrigTBins << ", nCFEBs = "<< nCFEBs<< " "; os << "trigSourceVect = " << bits.trigSourceVect << ", activeCFEBs = " << (bits.activeCFEBs | (bits.activeCFEBs_2 << 5)) << ", readCFEBs = " << (bits.readCFEBs | (bits.readCFEBs_2 << 5)) << "\n"; os << "bxnPreTrigger = " << bits.bxnPreTrigger << "\n"; os << "tmbMatch = " << bits.tmbMatch << " alctOnly = " << bits.alctOnly << " clctOnly = " << bits.clctOnly << "\n"; - // << " alctMatchTime = " << alctMatchTime << " "; - // os << "hs_thresh = " << hs_thresh << ", ds_thresh = " << ds_thresh - // << " "; - // os << "clct0_key = " << bits.clct0_key os << " bits.clct0_shape = " << bits.clct0_shape << " clct0_quality = " << bits.clct0_quality << "\n"; - // os << "r_buf_nbusy = " << r_buf_nbusy << " "; os << "..................CLCT....................." << "\n"; diff --git a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_CCLUT.cc b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_CCLUT.cc new file mode 100644 index 0000000000000..c02695979e19f --- /dev/null +++ b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_CCLUT.cc @@ -0,0 +1,322 @@ +#include "EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_CCLUT.h" +#include "EventFilter/CSCRawToDigi/interface/CSCDMBHeader.h" +#include "FWCore/Utilities/interface/Exception.h" + +const std::vector > + run3_pattern_lookup_tbl = {{0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, /// Valid LCT0, invalid LCT1 combination. Check LCT1 vpf + {0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, {1, 0}, {1, 1}, {1, 2}, {1, 3}, + {1, 4}, {2, 0}, {2, 1}, {2, 2}, {2, 3}, {2, 4}, {3, 0}, {3, 1}, {3, 2}, + {3, 3}, {3, 4}, {4, 0}, {4, 1}, {4, 2}, {4, 3}, {4, 4}}; /// pattern IDs 30,31 are reserved + +const unsigned run2_pattern_lookup_tbl[2][16] = {{10, 10, 10, 8, 8, 8, 6, 6, 6, 4, 4, 4, 2, 2, 2, 2}, + {10, 10, 10, 9, 9, 9, 7, 7, 7, 5, 5, 5, 3, 3, 3, 3}}; + +CSCTMBHeader2020_CCLUT::CSCTMBHeader2020_CCLUT() { + bzero(data(), sizeInWords() * 2); + bits.nHeaderFrames = 42; + bits.e0bline = 0x6E0B; + bits.b0cline = 0xDB0C; + bits.firmRevCode = 0x401; + bits.nTBins = 12; + bits.nCFEBs = 7; +} + +CSCTMBHeader2020_CCLUT::CSCTMBHeader2020_CCLUT(const unsigned short* buf) { memcpy(data(), buf, sizeInWords() * 2); } + +void CSCTMBHeader2020_CCLUT::setEventInformation(const CSCDMBHeader& dmbHeader) { + bits.cscID = dmbHeader.dmbID(); + bits.l1aNumber = dmbHeader.l1a(); + bits.bxnCount = dmbHeader.bxn(); +} + +///returns CLCT digis +std::vector CSCTMBHeader2020_CCLUT::CLCTDigis(uint32_t idlayer) { + std::vector result; + unsigned halfstrip = bits.clct0_key_low + (bits.clct0_key_high << 7); + unsigned strip = halfstrip % 32; + // CLCT0 1/4 strip bit + bool quartstrip = (bits.clct0_xky >> 1) & 0x1; + // CLCT1 1/8 strip bit + bool eighthstrip = bits.clct0_xky & 0x1; + unsigned cfeb = halfstrip / 32; + + /// CLCT0 LR bend and slope are from dedicated header fields + unsigned run3_pattern = bits.clct0_shape & 0x7; // 3-bit Run3 CLCT PatternID + unsigned bend = bits.clct0_LR_bend; + unsigned slope = bits.clct0_slope; + unsigned run2_pattern = run2_pattern_lookup_tbl[bend][slope]; + + CSCCLCTDigi digi0(bits.clct0_valid, + bits.clct0_quality, + run2_pattern, + 1, + bend, + strip, + cfeb, + bits.clct_bxn, + 1, + bits.bxnPreTrigger, + bits.clct0_comparator_code, + CSCCLCTDigi::Version::Run3, + quartstrip, + eighthstrip, + run3_pattern, + slope); + + halfstrip = bits.clct1_key_low + (bits.clct1_key_high << 7); + strip = halfstrip % 32; + // CLCT0 1/4 strip bit + quartstrip = (bits.clct1_xky >> 1) & 0x1; + // CLCT1 1/8 strip bit + eighthstrip = bits.clct1_xky & 0x1; + cfeb = halfstrip / 32; + + // CLCT LR bend and slope are from dedicated header fields + run3_pattern = bits.clct1_shape & 0x7; // 3-bit Run3 CLCT PatternID + bend = bits.clct1_LR_bend; + slope = bits.clct1_slope; + run2_pattern = run2_pattern_lookup_tbl[bend][slope]; + + CSCCLCTDigi digi1(bits.clct1_valid, + bits.clct1_quality, + run2_pattern, + 1, + bend, + strip, + cfeb, + bits.clct_bxn, + 2, + bits.bxnPreTrigger, + bits.clct1_comparator_code, + CSCCLCTDigi::Version::Run3, + quartstrip, + eighthstrip, + run3_pattern, + slope); + + result.push_back(digi0); + result.push_back(digi1); + return result; +} + +///returns CorrelatedLCT digis +std::vector CSCTMBHeader2020_CCLUT::CorrelatedLCTDigis(uint32_t idlayer) const { + std::vector result; + /// for the zeroth MPC word: + unsigned strip = bits.MPC_Muon0_clct_key_halfstrip; //this goes from 0-223 + unsigned slope = (bits.MPC_Muon0_clct_bend_low & 0x7) | (bits.MPC_Muon0_clct_bend_bit4 << 3); + unsigned hmt = bits.MPC_Muon_HMT_bit0 | (bits.MPC_Muon_HMT_high << 1); // HighMultiplicityTrigger + unsigned clct_pattern_id = bits.MPC_Muon_clct_pattern_low | (bits.MPC_Muon_clct_pattern_bit5 << 4); + + std::pair run3_pattern_pair = run3_pattern_lookup_tbl[clct_pattern_id % 30]; + unsigned run2_pattern = run2_pattern_lookup_tbl[bits.MPC_Muon0_clct_LR][slope]; + unsigned run3_pattern = run3_pattern_pair.second & 0x7; + + CSCCorrelatedLCTDigi digi(1, + bits.MPC_Muon0_lct_vpf, + bits.MPC_Muon0_lct_quality, + bits.MPC_Muon0_alct_key_wire, + strip, + run2_pattern, + bits.MPC_Muon0_clct_LR, + bits.MPC_Muon_alct_bxn, + 0, + bits.MPC_Muon0_clct_bx0, + 0, + 0, + CSCCorrelatedLCTDigi::Version::Run3, + bits.MPC_Muon0_clct_QuarterStrip, + bits.MPC_Muon0_clct_EighthStrip, + run3_pattern, + slope); + digi.setHMT(hmt); + result.push_back(digi); + /// for the first MPC word: + strip = bits.MPC_Muon1_clct_key_halfstrip; //this goes from 0-223 + slope = (bits.MPC_Muon1_clct_bend_low & 0x7) | (bits.MPC_Muon1_clct_bend_bit4 << 3); + run2_pattern = run2_pattern_lookup_tbl[bits.MPC_Muon1_clct_LR][slope]; + run3_pattern = run3_pattern_pair.first & 0x7; + + digi = CSCCorrelatedLCTDigi(2, + bits.MPC_Muon1_lct_vpf, + bits.MPC_Muon1_lct_quality, + bits.MPC_Muon1_alct_key_wire, + strip, + run2_pattern, + bits.MPC_Muon1_clct_LR, + bits.MPC_Muon_alct_bxn, + 0, + bits.MPC_Muon1_clct_bx0, + 0, + 0, + CSCCorrelatedLCTDigi::Version::Run3, + bits.MPC_Muon1_clct_QuarterStrip, + bits.MPC_Muon1_clct_EighthStrip, + run3_pattern, + slope); + digi.setHMT(hmt); + result.push_back(digi); + return result; +} + +CSCShowerDigi CSCTMBHeader2020_CCLUT::showerDigi(uint32_t idlayer) const { + unsigned hmt_bits = bits.MPC_Muon_HMT_bit0 | (bits.MPC_Muon_HMT_high << 1); // HighMultiplicityTrigger bits + uint16_t cscid = 0; // ??? What is 4-bits CSC Id in CSshowerDigi + CSCShowerDigi result(hmt_bits & 0x3, (hmt_bits >> 2) & 0x3, cscid); // 2-bits intime, 2-bits out of time + return result; +} + +void CSCTMBHeader2020_CCLUT::addALCT0(const CSCALCTDigi& digi) { + throw cms::Exception("In CSC TMBHeaderFormat 2007, ALCTs belong in ALCT header"); +} + +void CSCTMBHeader2020_CCLUT::addALCT1(const CSCALCTDigi& digi) { + throw cms::Exception("In CSC TMBHeaderFormat 2007, ALCTs belong in ALCT header"); +} + +void CSCTMBHeader2020_CCLUT::addCLCT0(const CSCCLCTDigi& digi) { + unsigned halfStrip = digi.getKeyStrip(); + unsigned pattern = digi.getRun3Pattern(); + bits.clct0_valid = digi.isValid(); + bits.clct0_quality = digi.getQuality(); + bits.clct0_shape = pattern; + // first 7 bits of halfstrip + bits.clct0_key_low = halfStrip & (0x7F); + // most-significant (8th) bit + bits.clct0_key_high = (halfStrip >> 7) & (0x1); + bits.clct_bxn = digi.getBX(); + bits.bxnPreTrigger = digi.getFullBX(); + bits.clct0_comparator_code = digi.getCompCode(); + bits.clct0_xky = (digi.getEighthStripBit() & 0x1) + ((digi.getQuartStripBit() & 0x1) << 1); + bits.clct0_LR_bend = digi.getBend(); + bits.clct0_slope = digi.getSlope(); +} + +void CSCTMBHeader2020_CCLUT::addCLCT1(const CSCCLCTDigi& digi) { + unsigned halfStrip = digi.getKeyStrip(); + unsigned pattern = digi.getRun3Pattern(); + bits.clct1_valid = digi.isValid(); + bits.clct1_quality = digi.getQuality(); + bits.clct1_shape = pattern; + // first 7 bits of halfstrip + bits.clct1_key_low = halfStrip & (0x7F); + // most-significant (8th) bit + bits.clct1_key_high = (halfStrip >> 7) & (0x1); + // There is just one BX field common for CLCT0 and CLCT1 (since both + // are latched at the same BX); set it in addCLCT0(). + bits.bxnPreTrigger = digi.getFullBX(); + bits.clct1_comparator_code = digi.getCompCode(); + bits.clct1_xky = (digi.getEighthStripBit() & 0x1) + ((digi.getQuartStripBit() & 0x1) << 1); + bits.clct1_LR_bend = digi.getBend(); + bits.clct1_slope = digi.getSlope(); +} + +void CSCTMBHeader2020_CCLUT::addCorrelatedLCT0(const CSCCorrelatedLCTDigi& digi) { + bits.MPC_Muon0_lct_vpf = digi.isValid(); + bits.MPC_Muon0_alct_key_wire = digi.getKeyWG(); + bits.MPC_Muon0_clct_key_halfstrip = digi.getStrip(2) & 0xFF; + bits.MPC_Muon0_clct_QuarterStrip = digi.getQuartStripBit() & 0x1; + bits.MPC_Muon0_clct_EighthStrip = digi.getEighthStripBit() & 0x1; + bits.MPC_Muon0_lct_quality = digi.getQuality() & 0x7; + + // To restore 5-bits Run3 CLCT Pattern ID first assume and set pattern ID = LCT0 Run3 pattern + uint16_t run3_pattern = digi.getRun3Pattern(); + bits.MPC_Muon_clct_pattern_low = run3_pattern & 0xF; + bits.MPC_Muon_clct_pattern_bit5 = (run3_pattern >> 4) & 0x1; + bits.MPC_Muon0_clct_bend_low = digi.getSlope() & 0x7; + bits.MPC_Muon0_clct_bend_bit4 = (digi.getSlope() >> 3) & 0x1; + bits.MPC_Muon0_clct_LR = digi.getBend() & 0x1; + bits.MPC_Muon_HMT_bit0 = digi.getHMT() & 0x1; + bits.MPC_Muon_HMT_high = (digi.getHMT() >> 1) & 0x7; + bits.MPC_Muon_alct_bxn = digi.getBX(); + bits.MPC_Muon0_clct_bx0 = digi.getBX0(); +} + +void CSCTMBHeader2020_CCLUT::addCorrelatedLCT1(const CSCCorrelatedLCTDigi& digi) { + bits.MPC_Muon1_lct_vpf = digi.isValid(); + bits.MPC_Muon1_alct_key_wire = digi.getKeyWG(); + bits.MPC_Muon1_clct_key_halfstrip = digi.getStrip(2) & 0xFF; + bits.MPC_Muon1_clct_QuarterStrip = digi.getQuartStripBit() & 0x1; + bits.MPC_Muon1_clct_EighthStrip = digi.getEighthStripBit() & 0x1; + bits.MPC_Muon1_lct_quality = digi.getQuality() & 0x7; + + // To restore 5-bits Run3 CLCT Pattern ID assume that LCT0 pattern ID is already processed + // and combine LCT1 Run3 pattern to set final 5-bit pattern ID + if (digi.isValid()) { + uint16_t clct_pattern_id = bits.MPC_Muon_clct_pattern_low | (bits.MPC_Muon_clct_pattern_bit5 << 4); + uint16_t run3_pattern = digi.getRun3Pattern(); + clct_pattern_id = (clct_pattern_id + (run3_pattern + 1) * 5) % 30; + bits.MPC_Muon_clct_pattern_low = clct_pattern_id & 0xF; + bits.MPC_Muon_clct_pattern_bit5 = (clct_pattern_id >> 4) & 0x1; + } + bits.MPC_Muon1_clct_bend_low = digi.getSlope() & 0x7; + bits.MPC_Muon1_clct_bend_bit4 = (digi.getSlope() >> 3) & 0x1; + bits.MPC_Muon1_clct_LR = digi.getBend() & 0x1; + bits.MPC_Muon_HMT_bit0 = digi.getHMT() & 0x1; + bits.MPC_Muon_HMT_high = (digi.getHMT() >> 1) & 0x7; + bits.MPC_Muon_alct_bxn = digi.getBX(); + bits.MPC_Muon1_clct_bx0 = digi.getBX0(); +} + +void CSCTMBHeader2020_CCLUT::addShower(const CSCShowerDigi& digi) { + uint16_t hmt_bits = (digi.bitsInTime() & 0x3) + ((digi.bitsOutOfTime() & 0x3) << 2); + bits.MPC_Muon_HMT_bit0 = hmt_bits & 0x1; + bits.MPC_Muon_HMT_high = (hmt_bits >> 1) & 0x7; +} + +void CSCTMBHeader2020_CCLUT::print(std::ostream& os) const { + os << "...............(O)TMB2020 CCLUT/HMT Header.................." + << "\n"; + os << std::hex << "BOC LINE " << bits.b0cline << " EOB " << bits.e0bline << "\n"; + os << std::hex << "FW revision: 0x" << bits.firmRevCode << "\n"; + os << std::dec << "fifoMode = " << bits.fifoMode << ", nTBins = " << bits.nTBins << "\n"; + os << "boardID = " << bits.boardID << ", cscID = " << bits.cscID << "\n"; + os << "l1aNumber = " << bits.l1aNumber << ", bxnCount = " << bits.bxnCount << "\n"; + os << "trigSourceVect = " << bits.trigSourceVect << ", run3_trig_df = " << bits.run3_trig_df << ", activeCFEBs = 0x" + << std::hex << (bits.activeCFEBs | (bits.activeCFEBs_2 << 5)) << ", readCFEBs = 0x" << std::hex + << (bits.readCFEBs | (bits.readCFEBs_2 << 5)) << std::dec << "\n"; + os << "bxnPreTrigger = " << bits.bxnPreTrigger << "\n"; + os << "tmbMatch = " << bits.tmbMatch << " alctOnly = " << bits.alctOnly << " clctOnly = " << bits.clctOnly << "\n"; + + os << "readoutCounter: " << std::dec << bits.readoutCounter << ", buf_q_ovf: " << bits.stackOvf + << ", sync_err: " << bits.syncError << ", has_buf: " << bits.hasBuf << ", buf_stalled: " << bits.bufFull << "\n"; + os << "r_wr_buf_adr: 0x" << std::hex << bits.r_wr_buf_adr << ", r_wr_buf_ready: " << bits.r_wr_buf_ready + << ", wr_buf_ready: " << bits.wr_buf_ready << ", buf_q_full: " << bits.buf_q_full + << ", buf_q_empty: " << bits.buf_q_empty << ",\nr_buf_fence_dist: 0x" << bits.r_buf_fence_dist + << ", buf_q_ovf_err: " << bits.buf_q_ovf_err << ", buf_q_udf_err: " << bits.buf_q_udf_err + << ", buf_q_adr_err: " << bits.buf_q_adr_err << ", buf_stalled: " << bits.buf_stalled << ",\nbuf_fence_cnt: 0x" + << bits.buf_fence_cnt << ", reverse_hs_csc: " << bits.reverse_hs_csc + << ", reverse_hs_me1a: " << bits.reverse_hs_me1a << ", reverse_hs_me1b: " << bits.reverse_hs_me1b << "\n"; + os << "CLCT Words:\n" + << " bits.clct0_valid = " << bits.clct0_valid << " bits.clct0_shape = " << bits.clct0_shape + << " bits.clct0_quality = " << bits.clct0_quality + << " halfstrip = " << (bits.clct0_key_low + (bits.clct0_key_high << 7)) << "\n"; + os << " bits.clct0_xky = " << bits.clct0_xky << " bits.clct0_comparator_code = " << bits.clct0_comparator_code + << " bits.clct0_LR_bend = " << bits.clct0_LR_bend << " bits.clct0_slope = " << bits.clct0_slope << "\n"; + + os << " bits.clct1_valid = " << bits.clct1_valid << " bits.clct1_shape = " << bits.clct1_shape + << " bits.clct1_quality = " << bits.clct1_quality + << " halfstrip = " << (bits.clct1_key_low + (bits.clct1_key_high << 7)) << "\n"; + os << " bits.clct1_xky = " << bits.clct1_xky << " bits.clct1_comparator_code = " << bits.clct1_comparator_code + << " bits.clct1_LR_bend = " << bits.clct1_LR_bend << " bits.clct1_slope = " << bits.clct1_slope << "\n"; + + os << "MPC Words:\n" + << " LCT0 valid = " << bits.MPC_Muon0_lct_vpf << " key WG = " << bits.MPC_Muon0_alct_key_wire + << " key halfstrip = " << bits.MPC_Muon0_clct_key_halfstrip + << " 1/4strip flag = " << bits.MPC_Muon0_clct_QuarterStrip + << " 1/8strip flag = " << bits.MPC_Muon0_clct_EighthStrip << "\n" + << " quality = " << bits.MPC_Muon0_lct_quality + << " slope/bend = " << ((bits.MPC_Muon0_clct_bend_low & 0x7) | (bits.MPC_Muon0_clct_bend_bit4 << 3)) + << " L/R bend = " << bits.MPC_Muon0_clct_LR << "\n"; + + os << " LCT1 valid = " << bits.MPC_Muon1_lct_vpf << " key WG = " << bits.MPC_Muon1_alct_key_wire + << " key halfstrip = " << bits.MPC_Muon1_clct_key_halfstrip + << " 1/4strip flag = " << bits.MPC_Muon1_clct_QuarterStrip + << " 1/8strip flag = " << bits.MPC_Muon1_clct_EighthStrip << "\n" + << " quality = " << bits.MPC_Muon1_lct_quality + << " slope/bend = " << ((bits.MPC_Muon1_clct_bend_low & 0x7) | (bits.MPC_Muon1_clct_bend_bit4 << 3)) + << " L/R bend = " << bits.MPC_Muon1_clct_LR << "\n"; + + os << " clct_5bit_pattern_id = " << (bits.MPC_Muon_clct_pattern_low | (bits.MPC_Muon_clct_pattern_bit5 << 4)) + << " HMT = " << (bits.MPC_Muon_HMT_bit0 | (bits.MPC_Muon_HMT_high << 1)) << "\n"; +} diff --git a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_GEM.cc b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_GEM.cc new file mode 100644 index 0000000000000..7ecf3feeb9e0d --- /dev/null +++ b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_GEM.cc @@ -0,0 +1,334 @@ +#include "EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_GEM.h" +#include "EventFilter/CSCRawToDigi/interface/CSCDMBHeader.h" +#include "FWCore/Utilities/interface/Exception.h" + +const std::vector > + run3_pattern_lookup_tbl = {{0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, /// Valid LCT0, invalid LCT1 combination. Check LCT1 vpf + {0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, {1, 0}, {1, 1}, {1, 2}, {1, 3}, + {1, 4}, {2, 0}, {2, 1}, {2, 2}, {2, 3}, {2, 4}, {3, 0}, {3, 1}, {3, 2}, + {3, 3}, {3, 4}, {4, 0}, {4, 1}, {4, 2}, {4, 3}, {4, 4}}; /// pattern IDs 30,31 are reserved + +const unsigned run2_pattern_lookup_tbl[2][16] = {{10, 10, 10, 8, 8, 8, 6, 6, 6, 4, 4, 4, 2, 2, 2, 2}, + {10, 10, 10, 9, 9, 9, 7, 7, 7, 5, 5, 5, 3, 3, 3, 3}}; + +CSCTMBHeader2020_GEM::CSCTMBHeader2020_GEM() { + bzero(data(), sizeInWords() * 2); + bits.nHeaderFrames = 42; + bits.e0bline = 0x6E0B; + bits.b0cline = 0xDB0C; + bits.firmRevCode = 0x601; + bits.nTBins = 12; + bits.nCFEBs = 7; +} + +CSCTMBHeader2020_GEM::CSCTMBHeader2020_GEM(const unsigned short* buf) { memcpy(data(), buf, sizeInWords() * 2); } + +void CSCTMBHeader2020_GEM::setEventInformation(const CSCDMBHeader& dmbHeader) { + bits.cscID = dmbHeader.dmbID(); + bits.l1aNumber = dmbHeader.l1a(); + bits.bxnCount = dmbHeader.bxn(); +} + +///returns CLCT digis +std::vector CSCTMBHeader2020_GEM::CLCTDigis(uint32_t idlayer) { + std::vector result; + unsigned halfstrip = bits.clct0_key_low + (bits.clct0_key_high << 7); + unsigned strip = halfstrip % 32; + // CLCT0 1/4 strip bit + bool quartstrip = (bits.clct0_xky >> 1) & 0x1; + // CLCT1 1/8 strip bit + bool eighthstrip = bits.clct0_xky & 0x1; + unsigned cfeb = halfstrip / 32; + + /// CLCT0 LR bend and slope are from dedicated header fields + unsigned run3_pattern = bits.clct0_shape & 0x7; // 3-bit Run3 CLCT PatternID + unsigned bend = bits.clct0_LR_bend; + unsigned slope = bits.clct0_slope; + unsigned run2_pattern = run2_pattern_lookup_tbl[bend][slope]; + + CSCCLCTDigi digi0(bits.clct0_valid, + bits.clct0_quality, + run2_pattern, + 1, + bend, + strip, + cfeb, + bits.clct_bxn, + 1, + bits.bxnPreTrigger, + bits.clct0_comparator_code, + CSCCLCTDigi::Version::Run3, + quartstrip, + eighthstrip, + run3_pattern, + slope); + + halfstrip = bits.clct1_key_low + (bits.clct1_key_high << 7); + strip = halfstrip % 32; + // CLCT0 1/4 strip bit + quartstrip = (bits.clct1_xky >> 1) & 0x1; + // CLCT1 1/8 strip bit + eighthstrip = bits.clct1_xky & 0x1; + cfeb = halfstrip / 32; + + // CLCT LR bend and slope are from dedicated header fields + run3_pattern = bits.clct1_shape & 0x7; // 3-bit Run3 CLCT PatternID + bend = bits.clct1_LR_bend; + slope = bits.clct1_slope; + run2_pattern = run2_pattern_lookup_tbl[bend][slope]; + + CSCCLCTDigi digi1(bits.clct1_valid, + bits.clct1_quality, + run2_pattern, + 1, + bend, + strip, + cfeb, + bits.clct_bxn, + 2, + bits.bxnPreTrigger, + bits.clct1_comparator_code, + CSCCLCTDigi::Version::Run3, + quartstrip, + eighthstrip, + run3_pattern, + slope); + + result.push_back(digi0); + result.push_back(digi1); + return result; +} + +///returns CorrelatedLCT digis +std::vector CSCTMBHeader2020_GEM::CorrelatedLCTDigis(uint32_t idlayer) const { + std::vector result; + /// for the zeroth MPC word: + unsigned strip = bits.MPC_Muon0_clct_key_halfstrip; //this goes from 0-223 + unsigned slope = (bits.MPC_Muon0_clct_bend_low & 0x7) | (bits.MPC_Muon0_clct_bend_bit4 << 3); + unsigned hmt = bits.MPC_Muon_HMT_bit0 | (bits.MPC_Muon_HMT_high << 1); // HighMultiplicityTrigger + unsigned clct_pattern_id = bits.MPC_Muon_clct_pattern_low | (bits.MPC_Muon_clct_pattern_bit5 << 4); + + std::pair run3_pattern_pair = run3_pattern_lookup_tbl[clct_pattern_id % 30]; + unsigned run2_pattern = run2_pattern_lookup_tbl[bits.MPC_Muon0_clct_LR][slope]; + unsigned run3_pattern = run3_pattern_pair.second & 0x7; + + CSCCorrelatedLCTDigi digi(1, + bits.MPC_Muon0_lct_vpf, + bits.MPC_Muon0_lct_quality, + bits.MPC_Muon0_alct_key_wire, + strip, + run2_pattern, + bits.MPC_Muon0_clct_LR, + bits.MPC_Muon_alct_bxn, + 0, + bits.MPC_Muon0_clct_bx0, + 0, + 0, + CSCCorrelatedLCTDigi::Version::Run3, + bits.MPC_Muon0_clct_QuarterStrip, + bits.MPC_Muon0_clct_EighthStrip, + run3_pattern, + slope); + digi.setHMT(hmt); + result.push_back(digi); + /// for the first MPC word: + strip = bits.MPC_Muon1_clct_key_halfstrip; //this goes from 0-223 + slope = (bits.MPC_Muon1_clct_bend_low & 0x7) | (bits.MPC_Muon1_clct_bend_bit4 << 3); + run2_pattern = run2_pattern_lookup_tbl[bits.MPC_Muon1_clct_LR][slope]; + run3_pattern = run3_pattern_pair.first & 0x7; + + digi = CSCCorrelatedLCTDigi(2, + bits.MPC_Muon1_lct_vpf, + bits.MPC_Muon1_lct_quality, + bits.MPC_Muon1_alct_key_wire, + strip, + run2_pattern, + bits.MPC_Muon1_clct_LR, + bits.MPC_Muon_alct_bxn, + 0, + bits.MPC_Muon1_clct_bx0, + 0, + 0, + CSCCorrelatedLCTDigi::Version::Run3, + bits.MPC_Muon1_clct_QuarterStrip, + bits.MPC_Muon1_clct_EighthStrip, + run3_pattern, + slope); + digi.setHMT(hmt); + result.push_back(digi); + return result; +} + +CSCShowerDigi CSCTMBHeader2020_GEM::showerDigi(uint32_t idlayer) const { + unsigned hmt_bits = bits.MPC_Muon_HMT_bit0 | (bits.MPC_Muon_HMT_high << 1); // HighMultiplicityTrigger bits + uint16_t cscid = 0; // ??? What is 4-bits CSC Id in CSshowerDigi + CSCShowerDigi result(hmt_bits & 0x3, (hmt_bits >> 2) & 0x3, cscid); // 2-bits intime, 2-bits out of time + return result; +} + +void CSCTMBHeader2020_GEM::addALCT0(const CSCALCTDigi& digi) { + throw cms::Exception("In CSC TMBHeaderFormat 2007, ALCTs belong in ALCT header"); +} + +void CSCTMBHeader2020_GEM::addALCT1(const CSCALCTDigi& digi) { + throw cms::Exception("In CSC TMBHeaderFormat 2007, ALCTs belong in ALCT header"); +} + +void CSCTMBHeader2020_GEM::addCLCT0(const CSCCLCTDigi& digi) { + unsigned halfStrip = digi.getKeyStrip(); + unsigned pattern = digi.getRun3Pattern(); + bits.clct0_valid = digi.isValid(); + bits.clct0_quality = digi.getQuality(); + bits.clct0_shape = pattern; + // first 7 bits of halfstrip + bits.clct0_key_low = halfStrip & (0x7F); + // most-significant (8th) bit + bits.clct0_key_high = (halfStrip >> 7) & (0x1); + bits.clct_bxn = digi.getBX(); + bits.bxnPreTrigger = digi.getFullBX(); + bits.clct0_comparator_code = digi.getCompCode(); + bits.clct0_xky = (digi.getEighthStripBit() & 0x1) + ((digi.getQuartStripBit() & 0x1) << 1); + bits.clct0_LR_bend = digi.getBend(); + bits.clct0_slope = digi.getSlope(); +} + +void CSCTMBHeader2020_GEM::addCLCT1(const CSCCLCTDigi& digi) { + unsigned halfStrip = digi.getKeyStrip(); + unsigned pattern = digi.getRun3Pattern(); + bits.clct1_valid = digi.isValid(); + bits.clct1_quality = digi.getQuality(); + bits.clct1_shape = pattern; + // first 7 bits of halfstrip + bits.clct1_key_low = halfStrip & (0x7F); + // most-significant (8th) bit + bits.clct1_key_high = (halfStrip >> 7) & (0x1); + // There is just one BX field common for CLCT0 and CLCT1 (since both + // are latched at the same BX); set it in addCLCT0(). + bits.bxnPreTrigger = digi.getFullBX(); + bits.clct1_comparator_code = digi.getCompCode(); + bits.clct1_xky = (digi.getEighthStripBit() & 0x1) + ((digi.getQuartStripBit() & 0x1) << 1); + bits.clct1_LR_bend = digi.getBend(); + bits.clct1_slope = digi.getSlope(); +} + +void CSCTMBHeader2020_GEM::addCorrelatedLCT0(const CSCCorrelatedLCTDigi& digi) { + bits.MPC_Muon0_lct_vpf = digi.isValid(); + bits.MPC_Muon0_alct_key_wire = digi.getKeyWG(); + bits.MPC_Muon0_clct_key_halfstrip = digi.getStrip(2) & 0xFF; + bits.MPC_Muon0_clct_QuarterStrip = digi.getQuartStripBit() & 0x1; + bits.MPC_Muon0_clct_EighthStrip = digi.getEighthStripBit() & 0x1; + bits.MPC_Muon0_lct_quality = digi.getQuality() & 0x7; + + // To restore 5-bits Run3 CLCT Pattern ID first assume and set pattern ID = LCT0 Run3 pattern + uint16_t run3_pattern = digi.getRun3Pattern(); + bits.MPC_Muon_clct_pattern_low = run3_pattern & 0xF; + bits.MPC_Muon_clct_pattern_bit5 = (run3_pattern >> 4) & 0x1; + bits.MPC_Muon0_clct_bend_low = digi.getSlope() & 0x7; + bits.MPC_Muon0_clct_bend_bit4 = (digi.getSlope() >> 3) & 0x1; + bits.MPC_Muon0_clct_LR = digi.getBend() & 0x1; + bits.MPC_Muon_HMT_bit0 = digi.getHMT() & 0x1; + bits.MPC_Muon_HMT_high = (digi.getHMT() >> 1) & 0x7; + bits.MPC_Muon_alct_bxn = digi.getBX(); + bits.MPC_Muon0_clct_bx0 = digi.getBX0(); +} + +void CSCTMBHeader2020_GEM::addCorrelatedLCT1(const CSCCorrelatedLCTDigi& digi) { + bits.MPC_Muon1_lct_vpf = digi.isValid(); + bits.MPC_Muon1_alct_key_wire = digi.getKeyWG(); + bits.MPC_Muon1_clct_key_halfstrip = digi.getStrip(2) & 0xFF; + bits.MPC_Muon1_clct_QuarterStrip = digi.getQuartStripBit() & 0x1; + bits.MPC_Muon1_clct_EighthStrip = digi.getEighthStripBit() & 0x1; + bits.MPC_Muon1_lct_quality = digi.getQuality() & 0x7; + + // To restore 5-bits Run3 CLCT Pattern ID assume that LCT0 pattern ID is already processed + // and combine LCT1 Run3 pattern to set final 5-bit pattern ID + if (digi.isValid()) { + uint16_t clct_pattern_id = bits.MPC_Muon_clct_pattern_low | (bits.MPC_Muon_clct_pattern_bit5 << 4); + uint16_t run3_pattern = digi.getRun3Pattern(); + clct_pattern_id = (clct_pattern_id + (run3_pattern + 1) * 5) % 30; + bits.MPC_Muon_clct_pattern_low = clct_pattern_id & 0xF; + bits.MPC_Muon_clct_pattern_bit5 = (clct_pattern_id >> 4) & 0x1; + } + bits.MPC_Muon1_clct_bend_low = digi.getSlope() & 0x7; + bits.MPC_Muon1_clct_bend_bit4 = (digi.getSlope() >> 3) & 0x1; + bits.MPC_Muon1_clct_LR = digi.getBend() & 0x1; + bits.MPC_Muon_HMT_bit0 = digi.getHMT() & 0x1; + bits.MPC_Muon_HMT_high = (digi.getHMT() >> 1) & 0x7; + bits.MPC_Muon_alct_bxn = digi.getBX(); + bits.MPC_Muon1_clct_bx0 = digi.getBX0(); +} + +void CSCTMBHeader2020_GEM::addShower(const CSCShowerDigi& digi) { + uint16_t hmt_bits = (digi.bitsInTime() & 0x3) + ((digi.bitsOutOfTime() & 0x3) << 2); + bits.MPC_Muon_HMT_bit0 = hmt_bits & 0x1; + bits.MPC_Muon_HMT_high = (hmt_bits >> 1) & 0x7; +} + +void CSCTMBHeader2020_GEM::print(std::ostream& os) const { + os << "...............(O)TMB2020 ME11 GEM/CCLUT/HMT Header.................." + << "\n"; + os << std::hex << "BOC LINE " << bits.b0cline << " EOB " << bits.e0bline << "\n"; + os << std::hex << "FW revision: 0x" << bits.firmRevCode << "\n"; + os << std::dec << "fifoMode = " << bits.fifoMode << ", nTBins = " << bits.nTBins << "\n"; + os << "boardID = " << bits.boardID << ", cscID = " << bits.cscID << "\n"; + os << "l1aNumber = " << bits.l1aNumber << ", bxnCount = " << bits.bxnCount << "\n"; + os << "trigSourceVect = " << bits.trigSourceVect << ", run3_trig_df = " << bits.run3_trig_df + << ", gem_enable = " << bits.gem_enable << ", gem_csc_bend_enable = " << bits.gem_csc_bend_enable + << ", activeCFEBs = 0x" << std::hex << (bits.activeCFEBs | (bits.activeCFEBs_2 << 5)) << ", readCFEBs = 0x" + << std::hex << (bits.readCFEBs | (bits.readCFEBs_2 << 5)) << std::dec << "\n"; + os << "bxnPreTrigger = " << bits.bxnPreTrigger << "\n"; + os << "tmbMatch = " << bits.tmbMatch << " alctOnly = " << bits.alctOnly << " clctOnly = " << bits.clctOnly << "\n"; + + os << "readoutCounter: " << std::dec << bits.readoutCounter << ", buf_q_ovf: " << bits.stackOvf + << ", sync_err: " << bits.syncError << ", has_buf: " << bits.hasBuf << ", buf_stalled: " << bits.bufFull << "\n"; + os << "r_wr_buf_adr: 0x" << std::hex << bits.r_wr_buf_adr << ", r_wr_buf_ready: " << bits.r_wr_buf_ready + << ", wr_buf_ready: " << bits.wr_buf_ready << ", buf_q_full: " << bits.buf_q_full + << ", buf_q_empty: " << bits.buf_q_empty << ",\nr_buf_fence_dist: 0x" << bits.r_buf_fence_dist + << ", buf_q_ovf_err: " << bits.buf_q_ovf_err << ", buf_q_udf_err: " << bits.buf_q_udf_err + << ", buf_q_adr_err: " << bits.buf_q_adr_err << ", buf_stalled: " << bits.buf_stalled << ",\nbuf_fence_cnt: 0x" + << bits.buf_fence_cnt << ", reverse_hs_csc: " << bits.reverse_hs_csc + << ", reverse_hs_me1a: " << bits.reverse_hs_me1a << ", reverse_hs_me1b: " << bits.reverse_hs_me1b << std::dec + << "\n"; + os << "CLCT Words:\n" + << " bits.clct0_valid = " << bits.clct0_valid << " bits.clct0_shape = " << bits.clct0_shape + << " bits.clct0_quality = " << bits.clct0_quality + << " halfstrip = " << (bits.clct0_key_low + (bits.clct0_key_high << 7)) << "\n"; + os << " bits.clct0_xky = " << bits.clct0_xky << " bits.clct0_comparator_code = " << bits.clct0_comparator_code + << " bits.clct0_LR_bend = " << bits.clct0_LR_bend << " bits.clct0_slope = " << bits.clct0_slope << "\n"; + + os << " bits.clct1_valid = " << bits.clct1_valid << " bits.clct1_shape = " << bits.clct1_shape + << " bits.clct1_quality = " << bits.clct1_quality + << " halfstrip = " << (bits.clct1_key_low + (bits.clct1_key_high << 7)) << "\n"; + os << " bits.clct1_xky = " << bits.clct1_xky << " bits.clct1_comparator_code = " << bits.clct1_comparator_code + << " bits.clct1_LR_bend = " << bits.clct1_LR_bend << " bits.clct1_slope = " << bits.clct1_slope << "\n"; + + os << "MPC Words:\n" + << " LCT0 valid = " << bits.MPC_Muon0_lct_vpf << " key WG = " << bits.MPC_Muon0_alct_key_wire + << " key halfstrip = " << bits.MPC_Muon0_clct_key_halfstrip + << " 1/4strip flag = " << bits.MPC_Muon0_clct_QuarterStrip + << " 1/8strip flag = " << bits.MPC_Muon0_clct_EighthStrip << "\n" + << " quality = " << bits.MPC_Muon0_lct_quality + << " slope/bend = " << ((bits.MPC_Muon0_clct_bend_low & 0x7) | (bits.MPC_Muon0_clct_bend_bit4 << 3)) + << " L/R bend = " << bits.MPC_Muon0_clct_LR << "\n"; + + os << " LCT1 valid = " << bits.MPC_Muon1_lct_vpf << " key WG = " << bits.MPC_Muon1_alct_key_wire + << " key halfstrip = " << bits.MPC_Muon1_clct_key_halfstrip + << " 1/4strip flag = " << bits.MPC_Muon1_clct_QuarterStrip + << " 1/8strip flag = " << bits.MPC_Muon1_clct_EighthStrip << "\n" + << " quality = " << bits.MPC_Muon1_lct_quality + << " slope/bend = " << ((bits.MPC_Muon1_clct_bend_low & 0x7) | (bits.MPC_Muon1_clct_bend_bit4 << 3)) + << " L/R bend = " << bits.MPC_Muon1_clct_LR << "\n"; + + os << " clct_5bit_pattern_id = " << (bits.MPC_Muon_clct_pattern_low | (bits.MPC_Muon_clct_pattern_bit5 << 4)) + << " HMT = " << (bits.MPC_Muon_HMT_bit0 | (bits.MPC_Muon_HMT_high << 1)) << "\n"; + + // os << "..................CLCT....................." << "\n"; + os << "GEM Data:\n" + << " gem_enabled_fibers = 0x" << std::hex << gem_enabled_fibers() << std::dec + << " gem_fifo_tbins = " << gem_fifo_tbins() << " gem_fifo_pretrig = " << gem_fifo_pretrig() + << " gem_zero_suppress = " << gem_zero_suppress() << " gem_csc_bend_enable = " << bits.gem_csc_bend_enable + << " gem_sync_dataword = 0x" << std::hex << gem_sync_dataword() << " gem_timing_dataword = 0x" << std::hex + << gem_timing_dataword() << std::dec << "\n"; + os << " gem num_copad: " << bits.num_copad << ", gem_delay: " << bits.gem_delay + << ", gem_clct_win: " << bits.gem_clct_win << ", alct_gem_win: " << bits.alct_gem_win << "\n"; +} diff --git a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_Run2.cc b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_Run2.cc new file mode 100644 index 0000000000000..edf0befa35144 --- /dev/null +++ b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_Run2.cc @@ -0,0 +1,182 @@ +#include "EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_Run2.h" +#include "EventFilter/CSCRawToDigi/interface/CSCDMBHeader.h" +#include "FWCore/Utilities/interface/Exception.h" + +CSCTMBHeader2020_Run2::CSCTMBHeader2020_Run2(int firmware_revision) { + bzero(data(), sizeInWords() * 2); + bits.nHeaderFrames = 42; + bits.e0bline = 0x6E0B; + bits.b0cline = 0xDB0C; + bits.firmRevCode = firmware_revision; + bits.nTBins = 12; + bits.nCFEBs = 5; +} + +CSCTMBHeader2020_Run2::CSCTMBHeader2020_Run2(const unsigned short* buf) { memcpy(data(), buf, sizeInWords() * 2); } + +void CSCTMBHeader2020_Run2::setEventInformation(const CSCDMBHeader& dmbHeader) { + bits.cscID = dmbHeader.dmbID(); + bits.l1aNumber = dmbHeader.l1a(); + bits.bxnCount = dmbHeader.bxn(); +} + +///returns CLCT digis +std::vector CSCTMBHeader2020_Run2::CLCTDigis(uint32_t idlayer) { + std::vector result; + unsigned halfstrip = bits.clct0_key_low + (bits.clct0_key_high << 7); + unsigned strip = halfstrip % 32; + unsigned cfeb = halfstrip / 32; + unsigned pattern = bits.clct0_shape; + unsigned bend = pattern & 0x1; + + CSCCLCTDigi digi0( + bits.clct0_valid, bits.clct0_quality, pattern, 1, bend, strip, cfeb, bits.clct_bxn, 1, bits.bxnPreTrigger); + + halfstrip = bits.clct1_key_low + (bits.clct1_key_high << 7); + strip = halfstrip % 32; + cfeb = halfstrip / 32; + pattern = bits.clct1_shape; + bend = pattern & 0x1; + + CSCCLCTDigi digi1( + bits.clct1_valid, bits.clct1_quality, pattern, 1, bend, strip, cfeb, bits.clct_bxn, 2, bits.bxnPreTrigger); + result.push_back(digi0); + result.push_back(digi1); + return result; +} + +///returns CorrelatedLCT digis +std::vector CSCTMBHeader2020_Run2::CorrelatedLCTDigis(uint32_t idlayer) const { + std::vector result; + /// for the zeroth MPC word: + unsigned strip = bits.MPC_Muon0_halfstrip_clct_pattern; //this goes from 0-159 + CSCCorrelatedLCTDigi digi(1, + bits.MPC_Muon0_vpf_, + bits.MPC_Muon0_quality_, + bits.MPC_Muon0_wire_, + strip, + bits.MPC_Muon0_clct_pattern_, + bits.MPC_Muon0_bend_, + bits.MPC_Muon0_bx_, + 0, + bits.MPC_Muon0_bc0_, + bits.MPC_Muon0_SyncErr_, + bits.MPC_Muon0_cscid_low | (bits.MPC_Muon0_cscid_bit4 << 3)); + result.push_back(digi); + /// for the first MPC word: + strip = bits.MPC_Muon1_halfstrip_clct_pattern; //this goes from 0-159 + digi = CSCCorrelatedLCTDigi(2, + bits.MPC_Muon1_vpf_, + bits.MPC_Muon1_quality_, + bits.MPC_Muon1_wire_, + strip, + bits.MPC_Muon1_clct_pattern_, + bits.MPC_Muon1_bend_, + bits.MPC_Muon1_bx_, + 0, + bits.MPC_Muon1_bc0_, + bits.MPC_Muon1_SyncErr_, + bits.MPC_Muon1_cscid_low | (bits.MPC_Muon1_cscid_bit4 << 3)); + result.push_back(digi); + return result; +} + +void CSCTMBHeader2020_Run2::addALCT0(const CSCALCTDigi& digi) { + throw cms::Exception("In CSC TMBHeaderFormat 2007, ALCTs belong in ALCT header"); +} + +void CSCTMBHeader2020_Run2::addALCT1(const CSCALCTDigi& digi) { + throw cms::Exception("In CSC TMBHeaderFormat 2007, ALCTs belong in ALCT header"); +} + +void CSCTMBHeader2020_Run2::addCLCT0(const CSCCLCTDigi& digi) { + unsigned halfStrip = digi.getKeyStrip(); + unsigned pattern = digi.getPattern(); + bits.clct0_valid = digi.isValid(); + bits.clct0_quality = digi.getQuality(); + bits.clct0_shape = pattern; + // first 7 bits of halfstrip + bits.clct0_key_low = halfStrip & (0x7F); + // most-significant (8th) bit + bits.clct0_key_high = (halfStrip >> 7) & (0x1); + bits.clct_bxn = digi.getBX(); + bits.bxnPreTrigger = digi.getFullBX(); +} + +void CSCTMBHeader2020_Run2::addCLCT1(const CSCCLCTDigi& digi) { + unsigned halfStrip = digi.getKeyStrip(); + unsigned pattern = digi.getPattern(); + bits.clct1_valid = digi.isValid(); + bits.clct1_quality = digi.getQuality(); + bits.clct1_shape = pattern; + // first 7 bits of halfstrip + bits.clct1_key_low = halfStrip & (0x7F); + // most-significant (8th) bit + bits.clct1_key_high = (halfStrip >> 7) & (0x1); + // There is just one BX field common for CLCT0 and CLCT1 (since both + // are latched at the same BX); set it in addCLCT0(). + bits.bxnPreTrigger = digi.getFullBX(); +} + +void CSCTMBHeader2020_Run2::addCorrelatedLCT0(const CSCCorrelatedLCTDigi& digi) { + unsigned halfStrip = digi.getStrip(); + bits.MPC_Muon0_vpf_ = digi.isValid(); + bits.MPC_Muon0_wire_ = digi.getKeyWG(); + bits.MPC_Muon0_clct_pattern_ = digi.getPattern(); + bits.MPC_Muon0_quality_ = digi.getQuality(); + bits.MPC_Muon0_halfstrip_clct_pattern = halfStrip; + bits.MPC_Muon0_bend_ = digi.getBend(); + bits.MPC_Muon0_SyncErr_ = digi.getSyncErr(); + bits.MPC_Muon0_bx_ = digi.getBX(); + bits.MPC_Muon0_bc0_ = digi.getBX0(); + bits.MPC_Muon0_cscid_low = digi.getCSCID() & 0x7; + bits.MPC_Muon0_cscid_bit4 = (digi.getCSCID() >> 3) & 0x1; +} + +void CSCTMBHeader2020_Run2::addCorrelatedLCT1(const CSCCorrelatedLCTDigi& digi) { + unsigned halfStrip = digi.getStrip(); + bits.MPC_Muon1_vpf_ = digi.isValid(); + bits.MPC_Muon1_wire_ = digi.getKeyWG(); + bits.MPC_Muon1_clct_pattern_ = digi.getPattern(); + bits.MPC_Muon1_quality_ = digi.getQuality(); + bits.MPC_Muon1_halfstrip_clct_pattern = halfStrip; + bits.MPC_Muon1_bend_ = digi.getBend(); + bits.MPC_Muon1_SyncErr_ = digi.getSyncErr(); + bits.MPC_Muon1_bx_ = digi.getBX(); + bits.MPC_Muon1_bc0_ = digi.getBX0(); + bits.MPC_Muon1_cscid_low = digi.getCSCID() & 0x7; + bits.MPC_Muon1_cscid_bit4 = (digi.getCSCID() >> 3) & 0x1; +} + +void CSCTMBHeader2020_Run2::print(std::ostream& os) const { + os << "...............(O)TMB2020 legacy Run2 Header.................." + << "\n"; + os << std::hex << "BOC LINE " << bits.b0cline << " EOB " << bits.e0bline << "\n"; + os << std::hex << "FW revision: 0x" << bits.firmRevCode << "\n"; + os << std::dec << "fifoMode = " << bits.fifoMode << ", nTBins = " << bits.nTBins << "\n"; + os << "boardID = " << bits.boardID << ", cscID = " << bits.cscID << "\n"; + os << "l1aNumber = " << bits.l1aNumber << ", bxnCount = " << bits.bxnCount << "\n"; + os << "trigSourceVect = " << bits.trigSourceVect << ", activeCFEBs = 0x" << std::hex + << (bits.activeCFEBs | (bits.activeCFEBs_2 << 5)) << ", readCFEBs = 0x" << std::hex + << (bits.readCFEBs | (bits.readCFEBs_2 << 5)) << std::dec << "\n"; + os << "bxnPreTrigger = " << bits.bxnPreTrigger << "\n"; + os << "tmbMatch = " << bits.tmbMatch << " alctOnly = " << bits.alctOnly << " clctOnly = " << bits.clctOnly << "\n"; + + os << "CLCT Words:\n" + << " bits.clct0_valid = " << bits.clct0_valid << " bits.clct0_shape = " << bits.clct0_shape + << " bits.clct0_quality = " << bits.clct0_quality + << " halfstrip = " << (bits.clct0_key_low + (bits.clct0_key_high << 7)) << "\n"; + + os << " bits.clct1_valid = " << bits.clct1_valid << " bits.clct1_shape = " << bits.clct1_shape + << " bits.clct1_quality = " << bits.clct1_quality + << " halfstrip = " << (bits.clct1_key_low + (bits.clct1_key_high << 7)) << "\n"; + + os << "MPC Words:\n" + << " LCT0 valid = " << bits.MPC_Muon0_vpf_ << " key WG = " << bits.MPC_Muon0_wire_ + << " key halfstrip = " << bits.MPC_Muon0_halfstrip_clct_pattern << " pattern = " << bits.MPC_Muon0_clct_pattern_ + << " quality = " << bits.MPC_Muon0_quality_ << "\n"; + + os << " LCT1 valid = " << bits.MPC_Muon1_vpf_ << " key WG = " << bits.MPC_Muon1_wire_ + << " key halfstrip = " << bits.MPC_Muon1_halfstrip_clct_pattern << " pattern = " << bits.MPC_Muon1_clct_pattern_ + << " quality = " << bits.MPC_Muon1_quality_ << "\n"; +} diff --git a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_TMB.cc b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_TMB.cc new file mode 100644 index 0000000000000..161a51dffb090 --- /dev/null +++ b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_TMB.cc @@ -0,0 +1,254 @@ +#include "EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_TMB.h" +#include "EventFilter/CSCRawToDigi/interface/CSCDMBHeader.h" +#include "FWCore/Utilities/interface/Exception.h" + +const std::vector > + run3_pattern_lookup_tbl = {{0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, /// Valid LCT0, invalid LCT1 combination. Check LCT1 vpf + {0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, {1, 0}, {1, 1}, {1, 2}, {1, 3}, + {1, 4}, {2, 0}, {2, 1}, {2, 2}, {2, 3}, {2, 4}, {3, 0}, {3, 1}, {3, 2}, + {3, 3}, {3, 4}, {4, 0}, {4, 1}, {4, 2}, {4, 3}, {4, 4}}; /// pattern IDs 30,31 are reserved + +const unsigned run2_pattern_lookup_tbl[2][16] = {{10, 10, 10, 8, 8, 8, 6, 6, 6, 4, 4, 4, 2, 2, 2, 2}, + {10, 10, 10, 9, 9, 9, 7, 7, 7, 5, 5, 5, 3, 3, 3, 3}}; + +CSCTMBHeader2020_TMB::CSCTMBHeader2020_TMB() { + bzero(data(), sizeInWords() * 2); + bits.nHeaderFrames = 42; + bits.e0bline = 0x6E0B; + bits.b0cline = 0xDB0C; + bits.firmRevCode = 0x001; + bits.nTBins = 12; + bits.nCFEBs = 5; +} + +CSCTMBHeader2020_TMB::CSCTMBHeader2020_TMB(const unsigned short* buf) { memcpy(data(), buf, sizeInWords() * 2); } + +void CSCTMBHeader2020_TMB::setEventInformation(const CSCDMBHeader& dmbHeader) { + bits.cscID = dmbHeader.dmbID(); + bits.l1aNumber = dmbHeader.l1a(); + bits.bxnCount = dmbHeader.bxn(); +} + +///returns CLCT digis +std::vector CSCTMBHeader2020_TMB::CLCTDigis(uint32_t idlayer) { + std::vector result; + unsigned halfstrip = bits.clct0_key_low + (bits.clct0_key_high << 7); + unsigned strip = halfstrip % 32; + unsigned cfeb = halfstrip / 32; + unsigned pattern = bits.clct0_shape; + unsigned bend = pattern & 0x1; + + CSCCLCTDigi digi0( + bits.clct0_valid, bits.clct0_quality, pattern, 1, bend, strip, cfeb, bits.clct_bxn, 1, bits.bxnPreTrigger); + + halfstrip = bits.clct1_key_low + (bits.clct1_key_high << 7); + strip = halfstrip % 32; + cfeb = halfstrip / 32; + pattern = bits.clct1_shape; + bend = pattern & 0x1; + + CSCCLCTDigi digi1( + bits.clct1_valid, bits.clct1_quality, pattern, 1, bend, strip, cfeb, bits.clct_bxn, 2, bits.bxnPreTrigger); + result.push_back(digi0); + result.push_back(digi1); + return result; +} + +///returns CorrelatedLCT digis +std::vector CSCTMBHeader2020_TMB::CorrelatedLCTDigis(uint32_t idlayer) const { + std::vector result; + unsigned strip = bits.MPC_Muon0_clct_key_halfstrip; //this goes from 0-223 + unsigned slope = (bits.MPC_Muon0_clct_bend_low & 0x7) | (bits.MPC_Muon0_clct_bend_bit4 << 3); + unsigned hmt = bits.MPC_Muon_HMT_bit0 | (bits.MPC_Muon_HMT_high << 1); // HighMultiplicityTrigger + unsigned clct_pattern_id = bits.MPC_Muon_clct_pattern_low | (bits.MPC_Muon_clct_pattern_bit5 << 4); + + std::pair run3_pattern_pair = run3_pattern_lookup_tbl[clct_pattern_id % 30]; + unsigned run2_pattern = run2_pattern_lookup_tbl[bits.MPC_Muon0_clct_LR][slope]; + unsigned run3_pattern = run3_pattern_pair.second & 0x7; + + CSCCorrelatedLCTDigi digi(1, + bits.MPC_Muon0_lct_vpf, + bits.MPC_Muon0_lct_quality, + bits.MPC_Muon0_alct_key_wire, + strip, + run2_pattern, + bits.MPC_Muon0_clct_LR, + bits.MPC_Muon_alct_bxn, + 0, + bits.MPC_Muon0_clct_bx0, + 0, + 0, + CSCCorrelatedLCTDigi::Version::Run3, + bits.MPC_Muon0_clct_QuarterStrip, + bits.MPC_Muon0_clct_EighthStrip, + run3_pattern, + slope); + digi.setHMT(hmt); + result.push_back(digi); + /// for the first MPC word: + strip = bits.MPC_Muon1_clct_key_halfstrip; //this goes from 0-223 + slope = (bits.MPC_Muon1_clct_bend_low & 0x7) | (bits.MPC_Muon1_clct_bend_bit4 << 3); + run2_pattern = run2_pattern_lookup_tbl[bits.MPC_Muon1_clct_LR][slope]; + run3_pattern = run3_pattern_pair.first & 0x7; + digi = CSCCorrelatedLCTDigi(2, + bits.MPC_Muon1_lct_vpf, + bits.MPC_Muon1_lct_quality, + bits.MPC_Muon1_alct_key_wire, + strip, + run2_pattern, + bits.MPC_Muon1_clct_LR, + bits.MPC_Muon_alct_bxn, + 0, + bits.MPC_Muon1_clct_bx0, + 0, + 0, + CSCCorrelatedLCTDigi::Version::Run3, + bits.MPC_Muon1_clct_QuarterStrip, + bits.MPC_Muon1_clct_EighthStrip, + run3_pattern, + slope); + digi.setHMT(hmt); + result.push_back(digi); + return result; +} + +CSCShowerDigi CSCTMBHeader2020_TMB::showerDigi(uint32_t idlayer) const { + unsigned hmt_bits = bits.MPC_Muon_HMT_bit0 | (bits.MPC_Muon_HMT_high << 1); // HighMultiplicityTrigger bits + uint16_t cscid = 0; // ??? What is 4-bits CSC Id in CSshowerDigi + CSCShowerDigi result(hmt_bits & 0x3, (hmt_bits >> 2) & 0x3, cscid); // 2-bits intime, 2-bits out of time + return result; +} + +void CSCTMBHeader2020_TMB::addALCT0(const CSCALCTDigi& digi) { + throw cms::Exception("In CSC TMBHeaderFormat 2007, ALCTs belong in ALCT header"); +} + +void CSCTMBHeader2020_TMB::addALCT1(const CSCALCTDigi& digi) { + throw cms::Exception("In CSC TMBHeaderFormat 2007, ALCTs belong in ALCT header"); +} + +void CSCTMBHeader2020_TMB::addCLCT0(const CSCCLCTDigi& digi) { + unsigned halfStrip = digi.getKeyStrip(); + unsigned pattern = digi.getPattern(); + bits.clct0_valid = digi.isValid(); + bits.clct0_quality = digi.getQuality(); + bits.clct0_shape = pattern; + // first 7 bits of halfstrip + bits.clct0_key_low = halfStrip & (0x7F); + // most-significant (8th) bit + bits.clct0_key_high = (halfStrip >> 7) & (0x1); + bits.clct_bxn = digi.getBX(); + bits.bxnPreTrigger = digi.getFullBX(); +} + +void CSCTMBHeader2020_TMB::addCLCT1(const CSCCLCTDigi& digi) { + unsigned halfStrip = digi.getKeyStrip(); + unsigned pattern = digi.getPattern(); + bits.clct1_valid = digi.isValid(); + bits.clct1_quality = digi.getQuality(); + bits.clct1_shape = pattern; + // first 7 bits of halfstrip + bits.clct1_key_low = halfStrip & (0x7F); + // most-significant (8th) bit + bits.clct1_key_high = (halfStrip >> 7) & (0x1); + // There is just one BX field common for CLCT0 and CLCT1 (since both + // are latched at the same BX); set it in addCLCT0(). + bits.bxnPreTrigger = digi.getFullBX(); +} + +void CSCTMBHeader2020_TMB::addCorrelatedLCT0(const CSCCorrelatedLCTDigi& digi) { + bits.MPC_Muon0_lct_vpf = digi.isValid(); + bits.MPC_Muon0_alct_key_wire = digi.getKeyWG(); + bits.MPC_Muon0_clct_key_halfstrip = digi.getStrip(2) & 0xFF; + bits.MPC_Muon0_clct_QuarterStrip = digi.getQuartStripBit() & 0x1; + bits.MPC_Muon0_clct_EighthStrip = digi.getEighthStripBit() & 0x1; + bits.MPC_Muon0_lct_quality = digi.getQuality() & 0x7; + + // To restore 5-bits Run3 CLCT Pattern ID first assume and set pattern ID = LCT0 Run3 pattern + uint16_t run3_pattern = digi.getRun3Pattern(); + bits.MPC_Muon_clct_pattern_low = run3_pattern & 0xF; + bits.MPC_Muon_clct_pattern_bit5 = (run3_pattern >> 4) & 0x1; + bits.MPC_Muon0_clct_bend_low = digi.getSlope() & 0x7; + bits.MPC_Muon0_clct_bend_bit4 = (digi.getSlope() >> 3) & 0x1; + bits.MPC_Muon0_clct_LR = digi.getBend() & 0x1; + bits.MPC_Muon_HMT_bit0 = digi.getHMT() & 0x1; + bits.MPC_Muon_HMT_high = (digi.getHMT() >> 1) & 0x7; + bits.MPC_Muon_alct_bxn = digi.getBX(); + bits.MPC_Muon0_clct_bx0 = digi.getBX0(); +} + +void CSCTMBHeader2020_TMB::addCorrelatedLCT1(const CSCCorrelatedLCTDigi& digi) { + bits.MPC_Muon1_lct_vpf = digi.isValid(); + bits.MPC_Muon1_alct_key_wire = digi.getKeyWG(); + bits.MPC_Muon1_clct_key_halfstrip = digi.getStrip(2) & 0xFF; + bits.MPC_Muon1_clct_QuarterStrip = digi.getQuartStripBit() & 0x1; + bits.MPC_Muon1_clct_EighthStrip = digi.getEighthStripBit() & 0x1; + bits.MPC_Muon1_lct_quality = digi.getQuality() & 0x7; + + // To restore 5-bits Run3 CLCT Pattern ID assume that LCT0 pattern ID is already processed + // and combine LCT1 Run3 pattern to set final 5-bit pattern ID + if (digi.isValid()) { + uint16_t clct_pattern_id = bits.MPC_Muon_clct_pattern_low | (bits.MPC_Muon_clct_pattern_bit5 << 4); + uint16_t run3_pattern = digi.getRun3Pattern(); + clct_pattern_id = (clct_pattern_id + (run3_pattern + 1) * 5) % 30; + bits.MPC_Muon_clct_pattern_low = clct_pattern_id & 0xF; + bits.MPC_Muon_clct_pattern_bit5 = (clct_pattern_id >> 4) & 0x1; + } + bits.MPC_Muon1_clct_bend_low = digi.getSlope() & 0x7; + bits.MPC_Muon1_clct_bend_bit4 = (digi.getSlope() >> 3) & 0x1; + bits.MPC_Muon1_clct_LR = digi.getBend() & 0x1; + bits.MPC_Muon_HMT_bit0 = digi.getHMT() & 0x1; + bits.MPC_Muon_HMT_high = (digi.getHMT() >> 1) & 0x7; + bits.MPC_Muon_alct_bxn = digi.getBX(); + bits.MPC_Muon1_clct_bx0 = digi.getBX0(); +} + +void CSCTMBHeader2020_TMB::addShower(const CSCShowerDigi& digi) { + uint16_t hmt_bits = (digi.bitsInTime() & 0x3) + ((digi.bitsOutOfTime() & 0x3) << 2); + bits.MPC_Muon_HMT_bit0 = hmt_bits & 0x1; + bits.MPC_Muon_HMT_high = (hmt_bits >> 1) & 0x7; +} + +void CSCTMBHeader2020_TMB::print(std::ostream& os) const { + os << "...............(O)TMB2020 TMB Run3 Header.................." + << "\n"; + os << std::hex << "BOC LINE " << bits.b0cline << " EOB " << bits.e0bline << "\n"; + os << std::hex << "FW revision: 0x" << bits.firmRevCode << "\n"; + os << std::dec << "fifoMode = " << bits.fifoMode << ", nTBins = " << bits.nTBins << "\n"; + os << "boardID = " << bits.boardID << ", cscID = " << bits.cscID << "\n"; + os << "l1aNumber = " << bits.l1aNumber << ", bxnCount = " << bits.bxnCount << "\n"; + os << "trigSourceVect = " << bits.trigSourceVect << ", activeCFEBs = 0x" << std::hex + << (bits.activeCFEBs | (bits.activeCFEBs_2 << 5)) << ", readCFEBs = 0x" << std::hex + << (bits.readCFEBs | (bits.readCFEBs_2 << 5)) << std::dec << "\n"; + os << "bxnPreTrigger = " << bits.bxnPreTrigger << "\n"; + os << "tmbMatch = " << bits.tmbMatch << " alctOnly = " << bits.alctOnly << " clctOnly = " << bits.clctOnly << "\n"; + + os << "CLCT Words:\n" + << " bits.clct0_valid = " << bits.clct0_valid << " bits.clct0_shape = " << bits.clct0_shape + << " bits.clct0_quality = " << bits.clct0_quality + << " halfstrip = " << (bits.clct0_key_low + (bits.clct0_key_high << 7)) << "\n"; + + os << " bits.clct1_valid = " << bits.clct1_valid << " bits.clct1_shape = " << bits.clct1_shape + << " bits.clct1_quality = " << bits.clct1_quality + << " halfstrip = " << (bits.clct1_key_low + (bits.clct1_key_high << 7)) << "\n"; + + os << "MPC Words:\n" + << " LCT0 valid = " << bits.MPC_Muon0_lct_vpf << " key WG = " << bits.MPC_Muon0_alct_key_wire + << " key halfstrip = " << bits.MPC_Muon0_clct_key_halfstrip + << " 1/4strip flag = " << bits.MPC_Muon0_clct_QuarterStrip + << " 1/8strip flag = " << bits.MPC_Muon0_clct_EighthStrip << "\n" + << " quality = " << bits.MPC_Muon0_lct_quality + << " slope/bend = " << ((bits.MPC_Muon0_clct_bend_low & 0x7) | (bits.MPC_Muon0_clct_bend_bit4 << 3)) + << " L/R bend = " << bits.MPC_Muon0_clct_LR << "\n"; + + os << " LCT1 valid = " << bits.MPC_Muon1_lct_vpf << " key WG = " << bits.MPC_Muon1_alct_key_wire + << " key halfstrip = " << bits.MPC_Muon1_clct_key_halfstrip + << " 1/4strip flag = " << bits.MPC_Muon1_clct_QuarterStrip + << " 1/8strip flag = " << bits.MPC_Muon1_clct_EighthStrip << "\n" + << " quality = " << bits.MPC_Muon1_lct_quality + << " slope/bend = " << ((bits.MPC_Muon1_clct_bend_low & 0x7) | (bits.MPC_Muon1_clct_bend_bit4 << 3)) + << " L/R bend = " << bits.MPC_Muon1_clct_LR << "\n"; + + os << " clct_5bit_pattern_id = " << (bits.MPC_Muon_clct_pattern_low | (bits.MPC_Muon_clct_pattern_bit5 << 4)) + << " HMT = " << (bits.MPC_Muon_HMT_bit0 | (bits.MPC_Muon_HMT_high << 1)) << "\n"; +} diff --git a/EventFilter/CSCRawToDigi/test/cscRawToDigiTest.cpp b/EventFilter/CSCRawToDigi/test/cscRawToDigiTest.cpp index 3ba41053797ce..5db84d8604da1 100644 --- a/EventFilter/CSCRawToDigi/test/cscRawToDigiTest.cpp +++ b/EventFilter/CSCRawToDigi/test/cscRawToDigiTest.cpp @@ -10,6 +10,17 @@ int main() { CSCTMBHeader::selfTest(2007, 0x50c3); // For Run-2 CSCTMBHeader::selfTest(2013, 0x6200); + // For Run-3 (O)TMB firmware and data format + + CSCTMBHeader::selfTest(2020, 0x401); // OTMB MEx1 CCLUT/HMT Run3 format + CSCTMBHeader::selfTest(2020, 0x601); // OTMB MEx1 CCLUT/HMT+GEM Run3 format + CSCTMBHeader::selfTest(2020, 0x001); // TMB HMT CLCT Run2 LCT Run3 format + + CSCTMBHeader::selfTest(2020, 0x021); // TMB CCLUT/HMT Run2 format + CSCTMBHeader::selfTest(2020, 0x221); // OTMB CCLUT/HMT Run2 format + CSCTMBHeader::selfTest(2020, 0x421); // OTMB MEx1 2020 Run2 format + CSCTMBHeader::selfTest(2020, 0x621); // OTMB ME11 2020 Run2 format + CSCALCTHeader::selfTest(2007); CSCALCTHeader::selfTest(2006); CSCTMBData::selfTest(); diff --git a/EventFilter/L1GlobalTriggerRawToDigi/interface/ConditionDumperInEdm.h b/EventFilter/L1GlobalTriggerRawToDigi/interface/ConditionDumperInEdm.h index 201852bb8a618..4accf7d2f10c2 100644 --- a/EventFilter/L1GlobalTriggerRawToDigi/interface/ConditionDumperInEdm.h +++ b/EventFilter/L1GlobalTriggerRawToDigi/interface/ConditionDumperInEdm.h @@ -33,13 +33,15 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Utilities/interface/InputTag.h" #include "DataFormats/Common/interface/ConditionsInEdm.h" #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerEvmReadoutRecord.h" +#include "CondFormats/DataRecord/interface/RunSummaryRcd.h" +#include "CondFormats/RunInfo/interface/RunInfo.h" + // // class declaration // @@ -62,13 +64,6 @@ class ConditionDumperInEdm : public edm::one::EDProducer - const T* get(const edm::EventSetup& setup) { - edm::ESHandle handle; - setup.get().get(handle); - return handle.product(); - } - // ----------member data --------------------------- const edm::InputTag gtEvmDigisLabel_; @@ -76,6 +71,7 @@ class ConditionDumperInEdm : public edm::one::EDProducer gtEvmDigisLabelToken_; + const edm::ESGetToken runInfoToken_; const edm::EDPutTokenT lumiToken_; const edm::EDPutTokenT runToken_; const edm::EDPutTokenT eventToken_; diff --git a/EventFilter/L1GlobalTriggerRawToDigi/src/ConditionDumperInEdm.cc b/EventFilter/L1GlobalTriggerRawToDigi/src/ConditionDumperInEdm.cc index b9655079d98af..c0b5f17a2e8bc 100644 --- a/EventFilter/L1GlobalTriggerRawToDigi/src/ConditionDumperInEdm.cc +++ b/EventFilter/L1GlobalTriggerRawToDigi/src/ConditionDumperInEdm.cc @@ -6,15 +6,13 @@ #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerEvmReadoutRecord.h" #include "DataFormats/L1GlobalTrigger/interface/L1GtfeExtWord.h" -#include "CondFormats/DataRecord/interface/RunSummaryRcd.h" -#include "CondFormats/RunInfo/interface/RunInfo.h" - // // constructors and destructor // ConditionDumperInEdm::ConditionDumperInEdm(const edm::ParameterSet& iConfig) : gtEvmDigisLabel_{iConfig.getParameter("gtEvmDigisLabel")}, gtEvmDigisLabelToken_{consumes(gtEvmDigisLabel_)}, + runInfoToken_{esConsumes()}, //per LUMI products lumiToken_{produces()}, //per RUN products @@ -45,11 +43,10 @@ void ConditionDumperInEdm::endRunProduce(edm::Run& run, const edm::EventSetup& s //dump of RunInfo auto& runBlock = *(runCache(run.index())); { - edm::ESHandle sum; - setup.get().get(sum); - runBlock.BStartCurrent = sum->m_start_current; - runBlock.BStopCurrent = sum->m_stop_current; - runBlock.BAvgCurrent = sum->m_avg_current; + auto const& sum = setup.getData(runInfoToken_); + runBlock.BStartCurrent = sum.m_start_current; + runBlock.BStopCurrent = sum.m_stop_current; + runBlock.BAvgCurrent = sum.m_avg_current; } run.emplace(runToken_, runBlock); diff --git a/FWCore/Concurrency/interface/SharedResourceNames.h b/FWCore/Concurrency/interface/SharedResourceNames.h index 0fcd634e8cca4..c063cd7eea7ef 100644 --- a/FWCore/Concurrency/interface/SharedResourceNames.h +++ b/FWCore/Concurrency/interface/SharedResourceNames.h @@ -35,7 +35,7 @@ namespace edm { class ESSharedResourceNames { public: static const std::string kDDGeometry; - static const std::string kDD4Hep; + static const std::string kDD4hep; }; // Each time the following function is called, it returns a different diff --git a/FWCore/Concurrency/src/SharedResourceNames.cc b/FWCore/Concurrency/src/SharedResourceNames.cc index b043e9bfd731f..7011235d15472 100644 --- a/FWCore/Concurrency/src/SharedResourceNames.cc +++ b/FWCore/Concurrency/src/SharedResourceNames.cc @@ -13,7 +13,7 @@ const std::string edm::SharedResourceNames::kEvtGen = "EvtGen"; const std::string edm::SharedResourceNames::kHerwig6 = "Herwig6"; const std::string edm::ESSharedResourceNames::kDDGeometry = "es_DDGeometry"; -const std::string edm::ESSharedResourceNames::kDD4Hep = "es_DD4Hep"; +const std::string edm::ESSharedResourceNames::kDD4hep = "es_DD4hep"; static std::atomic counter; diff --git a/FWCore/Framework/interface/LuminosityBlockPrincipal.h b/FWCore/Framework/interface/LuminosityBlockPrincipal.h index 4f71d35bb61b3..4ab4c1d56cbcc 100644 --- a/FWCore/Framework/interface/LuminosityBlockPrincipal.h +++ b/FWCore/Framework/interface/LuminosityBlockPrincipal.h @@ -48,6 +48,8 @@ namespace edm { void setRunPrincipal(std::shared_ptr rp) { runPrincipal_ = rp; } + void setWillBeContinued(bool iContinued) { willBeContinued_ = iContinued; } + LuminosityBlockIndex index() const { return index_; } LuminosityBlockID id() const { return aux().id(); } @@ -71,6 +73,9 @@ namespace edm { void put(ProductResolverIndex index, std::unique_ptr edp) const; + ///The source is replaying overlapping LuminosityBlocks and this is not the last part for this LumiosityBlock + bool willBeContinued() const { return willBeContinued_; } + private: unsigned int transitionIndex_() const override; @@ -79,6 +84,8 @@ namespace edm { LuminosityBlockAuxiliary aux_; LuminosityBlockIndex index_; + + bool willBeContinued_ = false; }; } // namespace edm #endif diff --git a/FWCore/Framework/interface/stream/EDAnalyzerAdaptor.h b/FWCore/Framework/interface/stream/EDAnalyzerAdaptor.h index 1bb532737f2d7..752a54743282c 100644 --- a/FWCore/Framework/interface/stream/EDAnalyzerAdaptor.h +++ b/FWCore/Framework/interface/stream/EDAnalyzerAdaptor.h @@ -65,7 +65,7 @@ namespace edm { } EDAnalyzerAdaptor(const EDAnalyzerAdaptor&) = delete; // stop default const EDAnalyzerAdaptor& operator=(const EDAnalyzerAdaptor&) = delete; // stop default - ~EDAnalyzerAdaptor() override {} + ~EDAnalyzerAdaptor() override { deleteModulesEarly(); } static void fillDescriptions(ConfigurationDescriptions& descriptions) { T::fillDescriptions(descriptions); } static void prevalidate(ConfigurationDescriptions& descriptions) { T::prevalidate(descriptions); } diff --git a/FWCore/Framework/interface/stream/EDAnalyzerAdaptorBase.h b/FWCore/Framework/interface/stream/EDAnalyzerAdaptorBase.h index 95ec3a1a268f3..9f1d4c4794f21 100644 --- a/FWCore/Framework/interface/stream/EDAnalyzerAdaptorBase.h +++ b/FWCore/Framework/interface/stream/EDAnalyzerAdaptorBase.h @@ -126,6 +126,8 @@ namespace edm { std::vector consumesInfo() const; + void deleteModulesEarly(); + private: bool doEvent(EventTransitionInfo const&, ActivityRegistry*, ModuleCallingContext const*); void doPreallocate(PreallocationConfiguration const&); diff --git a/FWCore/Framework/interface/stream/ProducingModuleAdaptor.h b/FWCore/Framework/interface/stream/ProducingModuleAdaptor.h index 499691f733430..7c8381b835f62 100644 --- a/FWCore/Framework/interface/stream/ProducingModuleAdaptor.h +++ b/FWCore/Framework/interface/stream/ProducingModuleAdaptor.h @@ -53,7 +53,7 @@ namespace edm { } ProducingModuleAdaptor(const ProducingModuleAdaptor&) = delete; // stop default const ProducingModuleAdaptor& operator=(const ProducingModuleAdaptor&) = delete; // stop default - ~ProducingModuleAdaptor() override {} + ~ProducingModuleAdaptor() override { this->deleteModulesEarly(); } static void fillDescriptions(ConfigurationDescriptions& descriptions) { T::fillDescriptions(descriptions); } static void prevalidate(ConfigurationDescriptions& descriptions) { T::prevalidate(descriptions); } diff --git a/FWCore/Framework/interface/stream/ProducingModuleAdaptorBase.h b/FWCore/Framework/interface/stream/ProducingModuleAdaptorBase.h index 2171e04ab8ba4..5c51a76ff5590 100644 --- a/FWCore/Framework/interface/stream/ProducingModuleAdaptorBase.h +++ b/FWCore/Framework/interface/stream/ProducingModuleAdaptorBase.h @@ -149,6 +149,8 @@ namespace edm { const ProducerBase* producer() { return m_streamModules[0]; } + void deleteModulesEarly(); + private: void doPreallocate(PreallocationConfiguration const&); virtual void preallocLumis(unsigned int) {} diff --git a/FWCore/Framework/src/EventProcessor.cc b/FWCore/Framework/src/EventProcessor.cc index 9c6f58a7d22f1..beacc275cdc97 100644 --- a/FWCore/Framework/src/EventProcessor.cc +++ b/FWCore/Framework/src/EventProcessor.cc @@ -1758,17 +1758,19 @@ namespace edm { void EventProcessor::writeLumiAsync(WaitingTaskHolder task, LuminosityBlockPrincipal& lumiPrincipal) { using namespace edm::waiting_task; - chain::first([&](auto nextTask) { - ServiceRegistry::Operate op(serviceToken_); - - lumiPrincipal.runPrincipal().mergeableRunProductMetadata()->writeLumi(lumiPrincipal.luminosityBlock()); - schedule_->writeLumiAsync(nextTask, lumiPrincipal, &processContext_, actReg_.get()); - }) | chain::ifThen(not subProcesses_.empty(), [this, &lumiPrincipal](auto nextTask) { - ServiceRegistry::Operate op(serviceToken_); - for (auto& s : subProcesses_) { - s.writeLumiAsync(nextTask, lumiPrincipal); - } - }) | chain::lastTask(std::move(task)); + if (not lumiPrincipal.willBeContinued()) { + chain::first([&](auto nextTask) { + ServiceRegistry::Operate op(serviceToken_); + + lumiPrincipal.runPrincipal().mergeableRunProductMetadata()->writeLumi(lumiPrincipal.luminosityBlock()); + schedule_->writeLumiAsync(nextTask, lumiPrincipal, &processContext_, actReg_.get()); + }) | chain::ifThen(not subProcesses_.empty(), [this, &lumiPrincipal](auto nextTask) { + ServiceRegistry::Operate op(serviceToken_); + for (auto& s : subProcesses_) { + s.writeLumiAsync(nextTask, lumiPrincipal); + } + }) | chain::lastTask(std::move(task)); + } } void EventProcessor::deleteLumiFromCache(LuminosityBlockProcessingStatus& iStatus) { diff --git a/FWCore/Framework/src/LuminosityBlockPrincipal.cc b/FWCore/Framework/src/LuminosityBlockPrincipal.cc index 63994ccb77de9..824a8d69cdc90 100644 --- a/FWCore/Framework/src/LuminosityBlockPrincipal.cc +++ b/FWCore/Framework/src/LuminosityBlockPrincipal.cc @@ -16,6 +16,7 @@ namespace edm { void LuminosityBlockPrincipal::fillLuminosityBlockPrincipal(ProcessHistory const* processHistory, DelayedReader* reader) { fillPrincipal(aux_.processHistoryID(), processHistory, reader); + willBeContinued_ = false; } void LuminosityBlockPrincipal::put(BranchDescription const& bd, std::unique_ptr edp) const { diff --git a/FWCore/Framework/src/stream/EDAnalyzerAdaptorBase.cc b/FWCore/Framework/src/stream/EDAnalyzerAdaptorBase.cc index 2cff309ee689c..813d520f252e1 100644 --- a/FWCore/Framework/src/stream/EDAnalyzerAdaptorBase.cc +++ b/FWCore/Framework/src/stream/EDAnalyzerAdaptorBase.cc @@ -54,6 +54,13 @@ EDAnalyzerAdaptorBase::~EDAnalyzerAdaptorBase() { } } +void EDAnalyzerAdaptorBase::deleteModulesEarly() { + for (auto m : m_streamModules) { + delete m; + } + m_streamModules.clear(); +} + // // assignment operators // diff --git a/FWCore/Framework/src/stream/ProducingModuleAdaptorBase.cc b/FWCore/Framework/src/stream/ProducingModuleAdaptorBase.cc index b34073bfe8425..08b90a87178d1 100644 --- a/FWCore/Framework/src/stream/ProducingModuleAdaptorBase.cc +++ b/FWCore/Framework/src/stream/ProducingModuleAdaptorBase.cc @@ -47,6 +47,14 @@ namespace edm { } } + template + void ProducingModuleAdaptorBase::deleteModulesEarly() { + for (auto m : m_streamModules) { + delete m; + } + m_streamModules.clear(); + } + // // member functions // diff --git a/FWCore/Framework/test/run_global_stream_one.sh b/FWCore/Framework/test/run_global_stream_one.sh index 7c93ea3bdaf29..b3d000f237803 100755 --- a/FWCore/Framework/test/run_global_stream_one.sh +++ b/FWCore/Framework/test/run_global_stream_one.sh @@ -1,7 +1,7 @@ #!/bin/bash # Pass in name and status -function die { echo $1: status $2 ; exit $2; } +function die { echo $1: status $2 ; echo === Log file === ; cat ${3:-/dev/null} ; echo === End log file === ; exit $2; } pushd ${LOCAL_TMP_DIR} @@ -9,27 +9,29 @@ F1=${LOCAL_TEST_DIR}/test_global_modules_cfg.py F2=${LOCAL_TEST_DIR}/test_stream_modules_cfg.py F3=${LOCAL_TEST_DIR}/test_one_modules_cfg.py F4=${LOCAL_TEST_DIR}/test_limited_modules_cfg.py -(cmsRun $F1 ) >& log_test_global_modules || die "Failure using $F1" $? +(cmsRun $F1 ) >& log_test_global_modules || die "Failure using $F1" $? log_test_global_modules # These greps are testing callWhenNewProductsRegistered -grep "global::StreamIntProducer TriggerResults" log_test_global_modules > /dev/null || die "grep failed to find 'global::StreamIntProducer TriggerResults'" $? -grep "global::StreamIntAnalyzer TriggerResults" log_test_global_modules > /dev/null || die "grep failed to find 'global::StreamIntAnalyzer TriggerResults'" $? -(cmsRun $F2 ) >& log_test_stream_modules || die "Failure using $F2" $? -grep "stream::GlobalIntAnalyzer TriggerResults" log_test_stream_modules > /dev/null || die "grep failed to find 'stream::GlobalIntAnalyzer TriggerResults'" $? -(cmsRun $F3 ) >& log_test_one_modules || die "Failure using $F3" $? -grep "one::SharedResourcesAnalyzer TriggerResults" log_test_one_modules > /dev/null || die "grep failed to find 'one::SharedResourcesAnalyzer TriggerResults'" $? -(cmsRun $F4 ) >& log_test_limited_modules || die "Failure using $F4" $? -grep "limited::StreamIntAnalyzer TriggerResults" log_test_limited_modules > /dev/null || die "grep failed to find 'limited::StreamIntAnalyzer TriggerResults'" $? +grep "global::StreamIntProducer TriggerResults" log_test_global_modules > /dev/null || die "grep failed to find 'global::StreamIntProducer TriggerResults'" $? log_test_global_modules +grep "global::StreamIntAnalyzer TriggerResults" log_test_global_modules > /dev/null || die "grep failed to find 'global::StreamIntAnalyzer TriggerResults'" $? log_test_global_modules +(cmsRun $F2 ) >& log_test_stream_modules || die "Failure using $F2" $? log_test_stream_modules +grep "stream::GlobalIntAnalyzer TriggerResults" log_test_stream_modules > /dev/null || die "grep failed to find 'stream::GlobalIntAnalyzer TriggerResults'" $? log_test_stream_modules +(cmsRun $F3 ) >& log_test_one_modules || die "Failure using $F3" $? log_test_one_modules +grep "one::SharedResourcesAnalyzer TriggerResults" log_test_one_modules > /dev/null || die "grep failed to find 'one::SharedResourcesAnalyzer TriggerResults'" $? log_test_one_modules +(cmsRun $F4 ) >& log_test_limited_modules || die "Failure using $F4" $? log_test_limited_modules +grep "limited::StreamIntAnalyzer TriggerResults" log_test_limited_modules > /dev/null || die "grep failed to find 'limited::StreamIntAnalyzer TriggerResults'" $? log_test_limited_modules #the last few lines of the output are the printout from the # ConcurrentModuleTimer service detailing how much time was # spent in 2,3 or 4 modules running simultaneously. touch empty_file -(cmsRun ${LOCAL_TEST_DIR}/test_no_concurrent_module_cfg.py 2>&1) | tail -n 3 | grep -v ' 0 ' | grep -v 'e-' | diff - empty_file || die "Failure using test_no_concurrent_module_cfg.py" $? +(cmsRun ${LOCAL_TEST_DIR}/test_no_concurrent_module_cfg.py ) >& log_test_no_concurrent_module +cat log_test_no_concurrent_module | tail -n 3 | grep -v ' 0 ' | grep -v 'e-' | diff - empty_file || die "Failure using test_no_concurrent_module_cfg.py" $? log_test_no_concurrent_module -(cmsRun ${LOCAL_TEST_DIR}/test_limited_concurrent_module_cfg.py 2>&1) | tail -n 3 | grep -v ' 0 ' | grep -v 'e-' | diff - empty_file || die "Failure using test_limited_concurrent_module_cfg.py" $? +(cmsRun ${LOCAL_TEST_DIR}/test_limited_concurrent_module_cfg.py ) >& log_test_limited_concurrent_module +cat log_test_limited_concurrent_module | tail -n 3 | grep -v ' 0 ' | grep -v 'e-' | diff - empty_file || die "Failure using test_limited_concurrent_module_cfg.py" $? log_test_limited_concurrent_module echo cmsRun modules_2_concurrent_lumis_cfg.py -cmsRun ${LOCAL_TEST_DIR}/modules_2_concurrent_lumis_cfg.py || die "cmsRun modules_2_concurrent_lumis_cfg.py" $? +(cmsRun ${LOCAL_TEST_DIR}/modules_2_concurrent_lumis_cfg.py ) &> log_modules_2_concurrent_lumis || die "cmsRun modules_2_concurrent_lumis_cfg.py" $? log_modules_2_concurrent_lumis popd diff --git a/FWCore/Integration/test/CatchStdExceptiontest.sh b/FWCore/Integration/test/CatchStdExceptiontest.sh index fc2215fd5f02b..84ece9261cce4 100755 --- a/FWCore/Integration/test/CatchStdExceptiontest.sh +++ b/FWCore/Integration/test/CatchStdExceptiontest.sh @@ -4,13 +4,13 @@ LOCAL_TEST_DIR=${CMSSW_BASE}/src/FWCore/Integration/test LOCAL_TMP_DIR=${CMSSW_BASE}/tmp/${SCRAM_ARCH} # Pass in name and status -function die { echo $1: status $2 ; exit $2; } +function die { echo $1: status $2 ; echo === Test log === ; cat ${3:-/dev/null} ; echo === End test log === ; exit $2; } pushd ${LOCAL_TMP_DIR} -cmsRun ${LOCAL_TEST_DIR}/CatchStdExceptiontest_cfg.py &> CatchStdException.log && die 'Failed in using CatchStdException_cfg.py' 1 +cmsRun ${LOCAL_TEST_DIR}/CatchStdExceptiontest_cfg.py &> CatchStdException.log && die 'Failed in using CatchStdException_cfg.py' 1 CatchStdException.log -grep -q WhatsItESProducer CatchStdException.log || die 'Failed to find Producers name' $? +grep -q WhatsItESProducer CatchStdException.log || die 'Failed to find Producers name' $? CatchStdException.log #grep -w ESProducer CatcheStdException.log popd diff --git a/FWCore/Services/test/BuildFile.xml b/FWCore/Services/test/BuildFile.xml index 6a361071cb683..1c7f6fa6edfea 100644 --- a/FWCore/Services/test/BuildFile.xml +++ b/FWCore/Services/test/BuildFile.xml @@ -9,10 +9,12 @@ - - - - + + + + + + diff --git a/FWCore/Utilities/interface/ReusableObjectHolder.h b/FWCore/Utilities/interface/ReusableObjectHolder.h index 4b8270e1b8fd6..60302f28b12f5 100644 --- a/FWCore/Utilities/interface/ReusableObjectHolder.h +++ b/FWCore/Utilities/interface/ReusableObjectHolder.h @@ -17,21 +17,23 @@ This class manages the cache of reusable objects and therefore an instance of this class must live as long as you want the cache to live. - - The primary way of using the class it to call makeOrGetAndClear - An example use would be + + The primary way of using the class is to call makeOrGet: \code - auto objectToUse = holder.makeOrGetAndClear( - []() { return new MyObject(10); }, //makes new one - [](MyObject* old) {old->reset(); } //resets old one - ); + auto objectToUse = holder.makeOrGet([]() { return new MyObject(); }); + use(*objectToUse); \endcode - - If you always want to set the values you can use makeOrGet + + If the returned object should be be automatically set or reset, call makeOrGetAndClear: + \code + auto objectToUse = holder.makeOrGetAndClear([]() { return new MyObject(10); }, // makes new objects + [](MyObject* old) { old->reset(); } // resets any object before returning it + ); + \endcode + which is equivalent to \code - auto objectToUse = holder.makeOrGet( - []() { return new MyObject(); }); - objectToUse->setValue(3); + auto objectToUse = holder.makeOrGet([]() { return new MyObject(10); }); + objectToUse->reset(); \endcode NOTE: If you hold onto the std::shared_ptr<> until another call to the ReusableObjectHolder, @@ -69,11 +71,11 @@ // Created: Fri, 31 July 2014 14:29:41 GMT // -#include -#include #include -#include "tbb/task.h" -#include "tbb/concurrent_queue.h" +#include +#include + +#include namespace edm { template > @@ -108,43 +110,44 @@ namespace edm { /// Use this function in conjunction with add() std::shared_ptr tryToGet() { std::unique_ptr item; - m_availableQueue.try_pop(item); - if (nullptr == item) { + if (m_availableQueue.try_pop(item)) { + return wrapCustomDeleter(std::move(item)); + } else { return std::shared_ptr{}; } - //instead of deleting, hand back to queue - auto pHolder = this; - auto deleter = item.get_deleter(); - ++m_outstandingObjects; - return std::shared_ptr{item.release(), [pHolder, deleter](T* iItem) { - pHolder->addBack(std::unique_ptr{iItem, deleter}); - }}; } - ///If there isn't an object already available, creates a new one using iFunc - template - std::shared_ptr makeOrGet(F iFunc) { - std::shared_ptr returnValue; - while (!(returnValue = tryToGet())) { - add(makeUnique(iFunc())); + ///Takes an object from the queue if one is available, or creates one using iMakeFunc. + template + std::shared_ptr makeOrGet(FM&& iMakeFunc) { + std::unique_ptr item; + if (m_availableQueue.try_pop(item)) { + return wrapCustomDeleter(std::move(item)); + } else { + return wrapCustomDeleter(makeUnique(iMakeFunc())); } - return returnValue; } - ///If there is an object already available, passes the object to iClearFunc and then - /// returns the object. - ///If there is not an object already available, creates a new one using iMakeFunc + ///Takes an object from the queue if one is available, or creates one using iMakeFunc. + ///Then, passes the object to iClearFunc, and returns it. template - std::shared_ptr makeOrGetAndClear(FM iMakeFunc, FC iClearFunc) { - std::shared_ptr returnValue; - while (!(returnValue = tryToGet())) { - add(makeUnique(iMakeFunc())); - } + std::shared_ptr makeOrGetAndClear(FM&& iMakeFunc, FC&& iClearFunc) { + std::shared_ptr returnValue = makeOrGet(std::forward(iMakeFunc)); iClearFunc(returnValue.get()); return returnValue; } private: + ///Wraps an object in a shared_ptr with a custom deleter, that hands the wrapped object + // back to the queue instead of deleting it + std::shared_ptr wrapCustomDeleter(std::unique_ptr item) { + auto deleter = item.get_deleter(); + ++m_outstandingObjects; + return std::shared_ptr{item.release(), [this, deleter](T* iItem) { + this->addBack(std::unique_ptr{iItem, deleter}); + }}; + } + std::unique_ptr makeUnique(T* ptr) { static_assert(std::is_same_v>, "Generating functions returning raw pointers are supported only with std::default_delete"); diff --git a/Geometry/CSCGeometryBuilder/interface/CSCGeometryParsFromDD.h b/Geometry/CSCGeometryBuilder/interface/CSCGeometryParsFromDD.h index 9b032d0f6944f..60a5905b956de 100644 --- a/Geometry/CSCGeometryBuilder/interface/CSCGeometryParsFromDD.h +++ b/Geometry/CSCGeometryBuilder/interface/CSCGeometryParsFromDD.h @@ -6,7 +6,7 @@ // Description: CSC Geometry Pars for DD4hep // // -// \author Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4HEP migration) +// \author Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4hep migration) // Created: Thu, 05 March 2020 // Modified: Thu, 04 June 2020, following what made in PR #30047 // diff --git a/Geometry/CSCGeometryBuilder/plugins/CSCGeometryESModule.cc b/Geometry/CSCGeometryBuilder/plugins/CSCGeometryESModule.cc index 171df17d2177d..e8ef20f02b703 100644 --- a/Geometry/CSCGeometryBuilder/plugins/CSCGeometryESModule.cc +++ b/Geometry/CSCGeometryBuilder/plugins/CSCGeometryESModule.cc @@ -4,7 +4,7 @@ // Description: CSC ESModule for DD4hep // // -// \author Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osborne made for DTs (DD4HEP migration) +// \author Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osborne made for DTs (DD4hep migration) // Created: Thu, 05 March 2020 // Modified: Thu, 04 June 2020, following what made in PR #30047 // @@ -214,7 +214,7 @@ void CSCGeometryESModule::initCSCGeometry_(const MuonGeometryRecord& record, std builder.build(*host, cpv.product(), mdc); }); } else if (fromDD4hep_) { - edm::LogVerbatim("CSCGeoemtryESModule") << "(0) CSCGeometryESModule - DD4HEP "; + edm::LogVerbatim("CSCGeoemtryESModule") << "(0) CSCGeometryESModule - DD4hep "; host->ifRecordChanges(record, [&host, &record, this](auto const& rec) { host->clear(); edm::ESTransientHandle cpv = record.getTransientHandle(cpvTokendd4hep_); diff --git a/Geometry/CSCGeometryBuilder/plugins/CSCGeometryValidate.cc b/Geometry/CSCGeometryBuilder/plugins/CSCGeometryValidate.cc index cad9eb452ec63..2af4f1fccc748 100644 --- a/Geometry/CSCGeometryBuilder/plugins/CSCGeometryValidate.cc +++ b/Geometry/CSCGeometryBuilder/plugins/CSCGeometryValidate.cc @@ -4,7 +4,7 @@ Description: CSC GeometryValidate from DD & DD4hep // -// Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4HEP migration) +// Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4hep migration) // Created: Thu, 05 March 2020 */ diff --git a/Geometry/CSCGeometryBuilder/src/CSCGeometryBuilderFromDDD.cc b/Geometry/CSCGeometryBuilder/src/CSCGeometryBuilderFromDDD.cc index ceda1d2f63f3c..2da24f7dd4897 100644 --- a/Geometry/CSCGeometryBuilder/src/CSCGeometryBuilderFromDDD.cc +++ b/Geometry/CSCGeometryBuilder/src/CSCGeometryBuilderFromDDD.cc @@ -4,7 +4,7 @@ // Description: CSC Geometry Builder for DD4hep // // -// \author Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4HEP migration) +// \author Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4hep migration) // Created: Thu, 05 March 2020 // Modified: Thu, 04 June 2020, following what made in PR #30047 // @@ -51,7 +51,7 @@ void CSCGeometryBuilderFromDDD::build(CSCGeometry& geom, CSCGeometryParsFromDD cscp; if (!cscp.build(cview, muonConstants, rig, rdp)) { - throw cms::Exception("CSCGeometryBuilderFromDDD", "Failed to build the necessary objects from the DD4HEP"); + throw cms::Exception("CSCGeometryBuilderFromDDD", "Failed to build the necessary objects from the DD4hep"); } CSCGeometryBuilder realbuilder; diff --git a/Geometry/CSCGeometryBuilder/src/CSCGeometryBuilderFromDDD.h b/Geometry/CSCGeometryBuilder/src/CSCGeometryBuilderFromDDD.h index d076de490b79a..7523addb0aaba 100644 --- a/Geometry/CSCGeometryBuilder/src/CSCGeometryBuilderFromDDD.h +++ b/Geometry/CSCGeometryBuilder/src/CSCGeometryBuilderFromDDD.h @@ -6,7 +6,7 @@ // Description: CSC Geometry Builder for DD4hep // // -// \author Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4HEP migration) +// \author Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4hep migration) // Created: Thu, 05 March 2020 // Modified: Thu, 04 June 2020, following what made in PR #30047 // diff --git a/Geometry/CSCGeometryBuilder/src/CSCGeometryParsFromDD.cc b/Geometry/CSCGeometryBuilder/src/CSCGeometryParsFromDD.cc index 33f98925e101d..b3dd57dcec6ba 100644 --- a/Geometry/CSCGeometryBuilder/src/CSCGeometryParsFromDD.cc +++ b/Geometry/CSCGeometryBuilder/src/CSCGeometryParsFromDD.cc @@ -4,7 +4,7 @@ // Description: CSC Geometry Pars for DD4hep // // -// \author Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4HEP migration) +// \author Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4hep migration) // Created: Thu, 05 March 2020 // Modified: Thu, 04 June 2020, following what made in PR #30047 // Modified: Wed, 23 December 2020 @@ -390,7 +390,7 @@ bool CSCGeometryParsFromDD::build(const cms::DDCompactView* cview, std::vector grmat(9); std::vector trm(9); - edm::LogVerbatim("CSCGeometryParsFromDD") << "(0) CSCGeometryParsFromDD - DD4HEP "; + edm::LogVerbatim("CSCGeometryParsFromDD") << "(0) CSCGeometryParsFromDD - DD4hep "; while (fv.firstChild()) { MuonGeometryNumbering mbn(muonConstants); diff --git a/Geometry/CaloEventSetup/interface/CaloGeometryDBWriter.h b/Geometry/CaloEventSetup/interface/CaloGeometryDBWriter.h index 18e8b65045a59..4971909978114 100644 --- a/Geometry/CaloEventSetup/interface/CaloGeometryDBWriter.h +++ b/Geometry/CaloEventSetup/interface/CaloGeometryDBWriter.h @@ -17,32 +17,32 @@ class CaloGeometryDBWriter { static void write(const TrVec& tvec, const DimVec& dvec, const IVec& ivec, const std::string& tag) { const IVec dins; - PCaloGeometry* peg = new PCaloGeometry(tvec, dvec, ivec, dins); + const PCaloGeometry peg(tvec, dvec, ivec, dins); edm::Service mydbservice; if (!mydbservice.isAvailable()) { edm::LogError("PCaloDBGeometryBuilder") << "PoolDBOutputService unavailable"; } else { if (mydbservice->isNewTagRequest(tag)) { - mydbservice->createNewIOV(peg, mydbservice->beginOfTime(), mydbservice->endOfTime(), tag); + mydbservice->createOneIOV(peg, mydbservice->beginOfTime(), tag); } else { - mydbservice->appendSinceTime(peg, mydbservice->currentTime(), tag); + mydbservice->appendOneIOV(peg, mydbservice->currentTime(), tag); } } } static void writeIndexed( const TrVec& tvec, const DimVec& dvec, const IVec& ivec, const IVec& dins, const std::string& tag) { - PCaloGeometry* peg = new PCaloGeometry(tvec, dvec, ivec, dins); + const PCaloGeometry peg(tvec, dvec, ivec, dins); edm::Service mydbservice; if (!mydbservice.isAvailable()) { edm::LogError("PCaloDBGeometryBuilder") << "PoolDBOutputService unavailable"; } else { if (mydbservice->isNewTagRequest(tag)) { - mydbservice->createNewIOV(peg, mydbservice->beginOfTime(), mydbservice->endOfTime(), tag); + mydbservice->createOneIOV(peg, mydbservice->beginOfTime(), tag); } else { - mydbservice->appendSinceTime(peg, mydbservice->currentTime(), tag); + mydbservice->appendOneIOV(peg, mydbservice->currentTime(), tag); } } } diff --git a/Geometry/CaloEventSetup/test/CaloAlignmentRcdWrite.cc b/Geometry/CaloEventSetup/test/CaloAlignmentRcdWrite.cc index 55c9020aeef47..2cb39c04fe3ee 100644 --- a/Geometry/CaloEventSetup/test/CaloAlignmentRcdWrite.cc +++ b/Geometry/CaloEventSetup/test/CaloAlignmentRcdWrite.cc @@ -7,6 +7,7 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "Utilities/General/interface/ClassName.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/ESGetToken.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" @@ -47,23 +48,23 @@ void CaloAlignmentRcdWrite::writeAlignments(const edm::EventSetup& evtSetup, edm std::string recordName = Demangle(typeid(T).name())(); - std::cout << "Uploading alignments to the database: " << recordName << std::endl; + edm::LogInfo("CaloAlignmentRcdWrite") << "Uploading alignments to the database: " << recordName; edm::Service poolDbService; if (!poolDbService.isAvailable()) throw cms::Exception("NotAvailable") << "PoolDBOutputService not available"; - Alignments* alignments = new Alignments(alignmentsES); + const Alignments alignments(alignmentsES); - poolDbService->writeOne(&(*alignments), poolDbService->currentTime(), recordName); + poolDbService->writeOneIOV(alignments, poolDbService->currentTime(), recordName); } void CaloAlignmentRcdWrite::analyze(const edm::Event& /*evt*/, const edm::EventSetup& evtSetup) { if (nEventCalls_ > 0) { - std::cout << "Writing to DB to be done only once, " - << "set 'untracked PSet maxEvents = {untracked int32 input = 1}'." - << "(Your writing should be fine.)" << std::endl; + edm::LogInfo("CaloAlignmentRcdWrite") << "Writing to DB to be done only once, " + << "set 'untracked PSet maxEvents = {untracked int32 input = 1}'." + << "(Your writing should be fine.)"; return; } @@ -71,7 +72,7 @@ void CaloAlignmentRcdWrite::analyze(const edm::Event& /*evt*/, const edm::EventS writeAlignments(evtSetup, eeToken_); writeAlignments(evtSetup, esToken_); - std::cout << "done!" << std::endl; + edm::LogInfo("CaloAlignmentRcdWrite") << "done!"; nEventCalls_++; } diff --git a/Geometry/CaloEventSetup/test/testAli2File_cfg.py b/Geometry/CaloEventSetup/test/testAli2File_cfg.py index 654d11278409c..f07428ec5468c 100644 --- a/Geometry/CaloEventSetup/test/testAli2File_cfg.py +++ b/Geometry/CaloEventSetup/test/testAli2File_cfg.py @@ -2,6 +2,9 @@ process = cms.Process("read") process.load('CondCore.CondDB.CondDB_cfi') +process.load("FWCore.MessageService.MessageLogger_cfi") +process.MessageLogger.cerr.threshold = "INFO" +process.MessageLogger.cerr.CaloAlignmentRcdWrite = dict() process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) diff --git a/Geometry/CaloEventSetup/test/testWriteESAlignments_cfg.py b/Geometry/CaloEventSetup/test/testWriteESAlignments_cfg.py index 0350d008eaf4f..4c8e69c8dd3f8 100644 --- a/Geometry/CaloEventSetup/test/testWriteESAlignments_cfg.py +++ b/Geometry/CaloEventSetup/test/testWriteESAlignments_cfg.py @@ -2,6 +2,9 @@ process = cms.Process("read") process.load('CondCore.CondDB.CondDB_cfi') +process.load("FWCore.MessageService.MessageLogger_cfi") +process.MessageLogger.cerr.threshold = "INFO" +process.MessageLogger.cerr.WriteESAlignments = dict() process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) diff --git a/Geometry/CaloEventSetup/test/zeroAli2File_cfg.py b/Geometry/CaloEventSetup/test/zeroAli2File_cfg.py index 9cce9c7890213..9a22a3eee792c 100644 --- a/Geometry/CaloEventSetup/test/zeroAli2File_cfg.py +++ b/Geometry/CaloEventSetup/test/zeroAli2File_cfg.py @@ -2,6 +2,9 @@ process = cms.Process("read") process.load('CondCore.CondDB.CondDB_cfi') +process.load("FWCore.MessageService.MessageLogger_cfi") +process.MessageLogger.cerr.threshold = "INFO" +process.MessageLogger.cerr.CaloAlignmentRcdWrite = dict() process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) diff --git a/Geometry/CaloTopology/test/testFastTimeTopology_cfg.py b/Geometry/CaloTopology/test/testFastTimeTopology_cfg.py deleted file mode 100644 index 3ca94a84a62a8..0000000000000 --- a/Geometry/CaloTopology/test/testFastTimeTopology_cfg.py +++ /dev/null @@ -1,54 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("PROD") -process.load("SimGeneral.HepPDTESSource.pdt_cfi") - -process.load("Geometry.HGCalCommonData.testFastTimeXML_cfi") -process.load("Geometry.HGCalCommonData.fastTimeParametersInitialization_cfi") -process.load("Geometry.HGCalCommonData.fastTimeNumberingInitialization_cfi") -process.load("Geometry.CaloEventSetup.FastTimeTopology_cfi") - -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - enable = cms.untracked.bool(False) - ), - cout = cms.untracked.PSet( - HGCalGeom = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - default = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - enable = cms.untracked.bool(True), - threshold = cms.untracked.string('DEBUG') - ), - debugModules = cms.untracked.vstring('*') -) - -process.load("IOMC.RandomEngine.IOMC_cff") -process.RandomNumberGeneratorService.generator.initialSeed = 456789 - -process.source = cms.Source("EmptySource") - -process.generator = cms.EDProducer("FlatRandomEGunProducer", - PGunParameters = cms.PSet( - PartID = cms.vint32(14), - MinEta = cms.double(-3.5), - MaxEta = cms.double(3.5), - MinPhi = cms.double(-3.14159265359), - MaxPhi = cms.double(3.14159265359), - MinE = cms.double(9.99), - MaxE = cms.double(10.01) - ), - AddAntiParticle = cms.bool(False), - Verbosity = cms.untracked.int32(0), - firstRun = cms.untracked.uint32(1) -) - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(1) -) - -process.prod = cms.EDAnalyzer("FastTimeTopologyTester") - -process.p1 = cms.Path(process.generator*process.prod) diff --git a/Geometry/DTGeometryBuilder/src/DTGeometryParsFromDD.cc b/Geometry/DTGeometryBuilder/src/DTGeometryParsFromDD.cc index acd84916444ad..74111d91d452b 100644 --- a/Geometry/DTGeometryBuilder/src/DTGeometryParsFromDD.cc +++ b/Geometry/DTGeometryBuilder/src/DTGeometryParsFromDD.cc @@ -264,7 +264,7 @@ DTGeometryParsFromDD::PosRotPair DTGeometryParsFromDD::plane(const DDFilteredVie void DTGeometryParsFromDD::buildGeometry(cms::DDFilteredView& fv, const MuonGeometryConstants& muonConstants, RecoIdealGeometry& rig) const { - edm::LogVerbatim("DTGeometryParsFromDD") << "(0) DTGeometryParsFromDD - DD4HEP "; + edm::LogVerbatim("DTGeometryParsFromDD") << "(0) DTGeometryParsFromDD - DD4hep "; bool doChamber = fv.firstChild(); @@ -300,7 +300,7 @@ DTGeometryParsFromDD::PosRotPair DTGeometryParsFromDD::plane(const cms::DDFilter gtran[1] = tr[1] / dd4hep::cm; gtran[2] = tr[2] / dd4hep::cm; - edm::LogVerbatim("DTGeometryParsFromDD") << "(4) DD4HEP, Position " + edm::LogVerbatim("DTGeometryParsFromDD") << "(4) DD4hep, Position " << " " << gtran[0] << " " << gtran[1] << " " << gtran[2]; DDRotationMatrix rotation = fv.rotation(); @@ -340,7 +340,7 @@ void DTGeometryParsFromDD::insertChamber(cms::DDFilteredView& fv, par[3] = par_temp[2] / dd4hep::mm; edm::LogVerbatim("DTGeometryParsFromDD") - << "(1) DD4HEP, Chamber DetID " << rawid << " " << par[0] << " " << par[1] << " " << par[2] << " " << par[3]; + << "(1) DD4hep, Chamber DetID " << rawid << " " << par[0] << " " << par[1] << " " << par[2] << " " << par[3]; PosRotPair posRot(plane(fv)); rig.insert(rawid, posRot.first, posRot.second, par); } @@ -361,7 +361,7 @@ void DTGeometryParsFromDD::insertSuperLayer(cms::DDFilteredView& fv, par[3] = par_temp[2] / dd4hep::mm; edm::LogVerbatim("DTGeometryParsFromDD") - << "(2) DD4HEP, Super Layer DetID " << rawid << " " << par[0] << " " << par[1] << " " << par[2] << " " << par[3]; + << "(2) DD4hep, Super Layer DetID " << rawid << " " << par[0] << " " << par[1] << " " << par[2] << " " << par[3]; PosRotPair posRot(plane(fv)); rig.insert(slId, posRot.first, posRot.second, par); } @@ -402,7 +402,7 @@ void DTGeometryParsFromDD::insertLayer(cms::DDFilteredView& fv, PosRotPair posRot(plane(fv)); edm::LogVerbatim("DTGeometryParsFromDD") - << "(3) DD4HEP, Layer DetID " << rawid << " " << par[0] << " " << par[1] << " " << par[2] << " " << par[3] << " " + << "(3) DD4hep, Layer DetID " << rawid << " " << par[0] << " " << par[1] << " " << par[2] << " " << par[3] << " " << par[4] << " " << par[5] << " " << par[6]; rig.insert(layId, posRot.first, posRot.second, par); } diff --git a/Geometry/EcalAlgo/interface/WriteESAlignments.h b/Geometry/EcalAlgo/interface/WriteESAlignments.h index fec45deb3969c..160e4de203ff8 100644 --- a/Geometry/EcalAlgo/interface/WriteESAlignments.h +++ b/Geometry/EcalAlgo/interface/WriteESAlignments.h @@ -1,5 +1,5 @@ -#ifndef SOMEPACKAGE_WRITEESALIGNMENTS_H -#define SOMEPACKAGE_WRITEESALIGNMENTS_H 1 +#ifndef Geometry_EcalAlgo_WriteESAlignments_h +#define Geometry_EcalAlgo_WriteESAlignments_h namespace edm { class ConsumesCollector; @@ -13,7 +13,6 @@ namespace edm { class WriteESAlignments { public: - typedef Alignments* AliPtr; typedef std::vector AliVec; typedef AlignTransform::Translation Trl; @@ -43,7 +42,7 @@ class WriteESAlignments { const DVec& z, AliVec& va); - void write(AliPtr aliPtr); + void write(const Alignments& ali); edm::ESGetToken geometryToken_; edm::ESGetToken alignmentToken_; diff --git a/Geometry/EcalAlgo/plugins/moduleDD4Hep.cc b/Geometry/EcalAlgo/plugins/moduleDD4hep.cc similarity index 100% rename from Geometry/EcalAlgo/plugins/moduleDD4Hep.cc rename to Geometry/EcalAlgo/plugins/moduleDD4hep.cc diff --git a/Geometry/EcalAlgo/src/WriteESAlignments.cc b/Geometry/EcalAlgo/src/WriteESAlignments.cc index c72b235d1832e..92295562e3e22 100644 --- a/Geometry/EcalAlgo/src/WriteESAlignments.cc +++ b/Geometry/EcalAlgo/src/WriteESAlignments.cc @@ -2,6 +2,7 @@ #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" @@ -31,23 +32,23 @@ void WEA::writeAlignments(const edm::EventSetup& eventSetup, assert(ytranslVec.size() == k_nA); assert(ztranslVec.size() == k_nA); - AliPtr aliPtr(new Alignments); // writeOne will take ownership! - AliVec& vali(aliPtr->m_align); + Alignments ali; + AliVec& vali(ali.m_align); convert(eventSetup, alphaVec, betaVec, gammaVec, xtranslVec, ytranslVec, ztranslVec, vali); - write(aliPtr); + write(ali); } -void WEA::write(WEA::AliPtr aliPtr) { - std::cout << "Uploading ES alignments to the database" << std::endl; +void WEA::write(const Alignments& ali) { + edm::LogVerbatim("WriteESAlignments") << "Uploading ES alignments to the database"; edm::Service poolDbService; if (!poolDbService.isAvailable()) throw cms::Exception("NotAvailable") << "PoolDBOutputService not available"; - poolDbService->writeOne(&(*aliPtr), poolDbService->currentTime(), "ESAlignmentRcd"); + poolDbService->writeOneIOV(ali, poolDbService->currentTime(), "ESAlignmentRcd"); } void WEA::convert(const edm::EventSetup& eS, @@ -92,20 +93,22 @@ void WEA::convert(const edm::EventSetup& eS, const Trl s_n(t_n + s_p + q_I - InvL_n * q_I); - std::cout << "For i = " << i << ", q_I=" << q_I << std::endl; - std::cout << "For i = " << i << ", s_p=" << s_p << std::endl; - std::cout << "For i = " << i << ", alpha = " << 1000. * alpha << " mr" << std::endl; - std::cout << "For i = " << i << ", beta = " << 1000. * beta << " mr" << std::endl; - std::cout << "For i = " << i << ", gamma = " << 1000. * gamma << " mr" << std::endl; - std::cout << " For i = " << i << ", L_n = " << L_n << " Euler angles=" << InvL_n.eulerAngles() << "\n" - << std::endl; - std::cout << "For i = " << i << ", t_n=" << t_n << std::endl; - std::cout << "For i = " << i << ", G_p=" << G_p << " Euler angles=" << G_p.eulerAngles() << "\n" << std::endl; - std::cout << " For i = " << i << ", InvL_n = " << InvL_n << " Euler angles=" << InvL_n.eulerAngles() << "\n" - << std::endl; - std::cout << " For i =" << i << ", G_n = " << G_n << " Euler angles=" << G_n.eulerAngles() << "\n" << std::endl; - std::cout << " For i =" << i << ", s_n = " << s_n << std::endl; - std::cout << "++++++++++++++++++++++++++\n\n" << std::endl; + edm::LogVerbatim("WriteESAlignments") << "For i = " << i << ", q_I=" << q_I; + edm::LogVerbatim("WriteESAlignments") << "For i = " << i << ", s_p=" << s_p; + edm::LogVerbatim("WriteESAlignments") << "For i = " << i << ", alpha = " << 1000. * alpha << " mr"; + edm::LogVerbatim("WriteESAlignments") << "For i = " << i << ", beta = " << 1000. * beta << " mr"; + edm::LogVerbatim("WriteESAlignments") << "For i = " << i << ", gamma = " << 1000. * gamma << " mr"; + edm::LogVerbatim("WriteESAlignments") + << " For i = " << i << ", L_n = " << L_n << " Euler angles=" << InvL_n.eulerAngles() << "\n"; + edm::LogVerbatim("WriteESAlignments") << "For i = " << i << ", t_n=" << t_n; + edm::LogVerbatim("WriteESAlignments") + << "For i = " << i << ", G_p=" << G_p << " Euler angles=" << G_p.eulerAngles() << "\n"; + edm::LogVerbatim("WriteESAlignments") + << " For i = " << i << ", InvL_n = " << InvL_n << " Euler angles=" << InvL_n.eulerAngles() << "\n"; + edm::LogVerbatim("WriteESAlignments") + << " For i =" << i << ", G_n = " << G_n << " Euler angles=" << G_n.eulerAngles() << "\n"; + edm::LogVerbatim("WriteESAlignments") << " For i =" << i << ", s_n = " << s_n; + edm::LogVerbatim("WriteESAlignments") << "++++++++++++++++++++++++++\n\n"; va.emplace_back(AlignTransform(s_n, G_n, id)); } diff --git a/Geometry/EcalAlgo/test/python/README.txt b/Geometry/EcalAlgo/test/python/README.txt index ffcc1992f78a2..b35aa72ca2c09 100644 --- a/Geometry/EcalAlgo/test/python/README.txt +++ b/Geometry/EcalAlgo/test/python/README.txt @@ -1,10 +1,10 @@ -The validation of the ECAL Reco geometry in the old DDD way and new DD4HEP way is done with two dumpers present in Geometry/EcalAlgo/test/python : +The validation of the ECAL Reco geometry in the old DDD way and new DD4hep way is done with two dumpers present in Geometry/EcalAlgo/test/python : 1) runEcalCellDumpDDD_cfg.py for DDD -2) runEcalCellDumpDD4Hep_cfg.py for DD4HEP +2) runEcalCellDumpDD4hep_cfg.py for DD4hep These dump the position, backface, dimensions and the 8 corner-coordinates of each ECAL crystal in EB and EE. For this two analyzers are used ecalBarrelCellParameterDump.cc and ecalEndcapCellParameterDump.cc which are present in: Geometry/EcalAlgo/test -To dump these into a file execute: cmsRun PATH_TO_CONFIG/runEcalCellDumpDD4Hep_cfg.py > ECAL_cellParams_DD4HEP_Dump.txt and similarly for the DDD config. +To dump these into a file execute: cmsRun PATH_TO_CONFIG/runEcalCellDumpDD4hep_cfg.py > ECAL_cellParams_DD4hep_Dump.txt and similarly for the DDD config. The dump will be found to be identical. diff --git a/Geometry/EcalAlgo/test/python/runEcalCellDumpDD4Hep_cfg.py b/Geometry/EcalAlgo/test/python/runEcalCellDumpDD4hep_cfg.py similarity index 100% rename from Geometry/EcalAlgo/test/python/runEcalCellDumpDD4Hep_cfg.py rename to Geometry/EcalAlgo/test/python/runEcalCellDumpDD4hep_cfg.py diff --git a/Geometry/EcalCommonData/test/python/dumpECDD4Hep_cfg.py b/Geometry/EcalCommonData/test/python/dumpECDD4hep_cfg.py similarity index 100% rename from Geometry/EcalCommonData/test/python/dumpECDD4Hep_cfg.py rename to Geometry/EcalCommonData/test/python/dumpECDD4hep_cfg.py diff --git a/Geometry/EcalCommonData/test/python/runEcalSimParameterDD4Hep_cfg.py b/Geometry/EcalCommonData/test/python/runEcalSimParameterDD4hep_cfg.py similarity index 100% rename from Geometry/EcalCommonData/test/python/runEcalSimParameterDD4Hep_cfg.py rename to Geometry/EcalCommonData/test/python/runEcalSimParameterDD4hep_cfg.py diff --git a/Geometry/GEMGeometryBuilder/interface/ME0GeometryParsFromDD.h b/Geometry/GEMGeometryBuilder/interface/ME0GeometryParsFromDD.h index 1c70ad8b9f0f3..7a5850b84fdd8 100644 --- a/Geometry/GEMGeometryBuilder/interface/ME0GeometryParsFromDD.h +++ b/Geometry/GEMGeometryBuilder/interface/ME0GeometryParsFromDD.h @@ -29,7 +29,7 @@ class ME0GeometryParsFromDD { ~ME0GeometryParsFromDD(void) {} // DD void build(const DDCompactView*, const MuonGeometryConstants&, RecoIdealGeometry&); - // DD4HEP + // DD4hep void build(const cms::DDCompactView*, const MuonGeometryConstants&, RecoIdealGeometry&); private: @@ -44,7 +44,7 @@ class ME0GeometryParsFromDD { std::vector getTranslation(DDFilteredView& fv); std::vector getRotation(DDFilteredView& fv); - //DD4HEP + //DD4hep void buildGeometry(cms::DDFilteredView&, const MuonGeometryConstants&, RecoIdealGeometry&); diff --git a/Geometry/GEMGeometryBuilder/plugins/GEMGeometryESModule.cc b/Geometry/GEMGeometryBuilder/plugins/GEMGeometryESModule.cc index b1721a6b7812d..5ded4eef6f6e6 100644 --- a/Geometry/GEMGeometryBuilder/plugins/GEMGeometryESModule.cc +++ b/Geometry/GEMGeometryBuilder/plugins/GEMGeometryESModule.cc @@ -1,10 +1,10 @@ /* //\class GEMGeometryESModule - Description: GEM Geometry ES Module from DD & DD4HEP + Description: GEM Geometry ES Module from DD & DD4hep DD4hep part added to the original old file (DD version) made by M. Maggi (INFN Bari) // -// Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4HEP migration) +// Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4hep migration) // Created: 27 Jan 2020 */ #include "Geometry/GEMGeometryBuilder/src/GEMGeometryBuilder.h" diff --git a/Geometry/GEMGeometryBuilder/plugins/GEMGeometryValidate.cc b/Geometry/GEMGeometryBuilder/plugins/GEMGeometryValidate.cc index f10cfcdea1ed9..c173bc0d1589f 100644 --- a/Geometry/GEMGeometryBuilder/plugins/GEMGeometryValidate.cc +++ b/Geometry/GEMGeometryBuilder/plugins/GEMGeometryValidate.cc @@ -1,10 +1,10 @@ /* //\class GEMGeometryValidate - Description: GEM GeometryValidate from DD & DD4HEP + Description: GEM GeometryValidate from DD & DD4hep // -// Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4HEP migration) +// Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4hep migration) // Created: 27 Jan 2020 */ diff --git a/Geometry/GEMGeometryBuilder/plugins/ME0GeometryESModule.cc b/Geometry/GEMGeometryBuilder/plugins/ME0GeometryESModule.cc index 16d3437cb992f..cd627d04901a1 100644 --- a/Geometry/GEMGeometryBuilder/plugins/ME0GeometryESModule.cc +++ b/Geometry/GEMGeometryBuilder/plugins/ME0GeometryESModule.cc @@ -4,7 +4,7 @@ Description: ME0 GeometryESModule from DD & DD4hep DD4hep part added to the original old file (DD version) made by M. Maggi (INFN Bari) // -// Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osborne made for DTs (DD4HEP migration) +// Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osborne made for DTs (DD4hep migration) // Created: 29 Apr 2020 */ @@ -82,7 +82,7 @@ std::unique_ptr ME0GeometryESModule::produce(const MuonGeometryReco ME0GeometryBuilder builder; return std::unique_ptr(builder.build(cpv.product(), mdc)); } else if (fromDD4hep_) { - edm::LogVerbatim("ME0GeometryESModule") << "(0) ME0GeometryESModule - DD4HEP "; + edm::LogVerbatim("ME0GeometryESModule") << "(0) ME0GeometryESModule - DD4hep "; edm::LogVerbatim("GEMGeometry") << "ME0GeometryESModule::produce :: ME0GeometryBuilder builder DD4hep"; auto cpv = record.getTransientHandle(dd4hepcpvToken_); const auto& mdc = record.get(mdcToken_); diff --git a/Geometry/GEMGeometryBuilder/plugins/ME0GeometryValidate.cc b/Geometry/GEMGeometryBuilder/plugins/ME0GeometryValidate.cc index 60fdd03f2c22c..30dbc1ee50790 100644 --- a/Geometry/GEMGeometryBuilder/plugins/ME0GeometryValidate.cc +++ b/Geometry/GEMGeometryBuilder/plugins/ME0GeometryValidate.cc @@ -4,7 +4,7 @@ Description: ME0 GeometryValidate for DD4hep // -// Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osborne made for DTs (DD4HEP migration) +// Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osborne made for DTs (DD4hep migration) // Created: 29 Apr 2020 */ diff --git a/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilder.cc b/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilder.cc index 161d18934ffc9..d16520f439419 100644 --- a/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilder.cc +++ b/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilder.cc @@ -1,9 +1,9 @@ /* //\class GEMGeometryBuilder - Description: GEM Geometry builder from DD and DD4HEP + Description: GEM Geometry builder from DD and DD4hep DD4hep part added to the original old file (DD version) made by M. Maggi (INFN Bari) - Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4HEP migration) + Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4hep migration) Updated by Sunanda Banerjee (Fermilab) to make it working for dd4hep Updated: 7 August 2020 */ @@ -301,7 +301,7 @@ GEMGeometryBuilder::RCPBoundPlane GEMGeometryBuilder::boundPlane(const DDFiltere return RCPBoundPlane(new BoundPlane(posResult, rotResult, bounds)); } -// DD4HEP +// DD4hep void GEMGeometryBuilder::build(GEMGeometry& theGeometry, const cms::DDCompactView* cview, diff --git a/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilder.h b/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilder.h index 38658f42a83e2..79c772b660a43 100644 --- a/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilder.h +++ b/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilder.h @@ -5,10 +5,10 @@ /* //\class GEMGeometryBuilder - Description: GEM Geometry builder from DD & DD4HEP + Description: GEM Geometry builder from DD & DD4hep DD4hep part added to the original old file (DD version) made by M. Maggi (INFN Bari) // -// Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4HEP migration) +// Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4hep migration) // Created: 27 Jan 2020 */ #include diff --git a/Geometry/GEMGeometryBuilder/src/GEMGeometryParsFromDD.cc b/Geometry/GEMGeometryBuilder/src/GEMGeometryParsFromDD.cc index e05aad346742b..17ef0b5492486 100644 --- a/Geometry/GEMGeometryBuilder/src/GEMGeometryParsFromDD.cc +++ b/Geometry/GEMGeometryBuilder/src/GEMGeometryParsFromDD.cc @@ -236,7 +236,7 @@ void GEMGeometryParsFromDD::build(const cms::DDCompactView* cview, void GEMGeometryParsFromDD::buildGeometry(cms::DDFilteredView& fv, const MuonGeometryConstants& muonConstants, RecoIdealGeometry& rgeo) { - edm::LogVerbatim("GEMGeometryParsFromDD") << "(0) GEMGeometryParsFromDD - DD4HEP "; + edm::LogVerbatim("GEMGeometryParsFromDD") << "(0) GEMGeometryParsFromDD - DD4hep "; MuonGeometryNumbering mdddnum(muonConstants); GEMNumberingScheme gemNum(muonConstants); @@ -305,7 +305,7 @@ void GEMGeometryParsFromDD::buildSuperChamber(cms::DDFilteredView& fv, GEMDetId std::vector vrot = getRotation(fv); edm::LogVerbatim("GEMGeometryParsFromDD") - << "(3) DD4HEP, SuperChamber DetID " << gemid.rawId() << " Name " << std::string(name) << " dx1 " << dx1 + << "(3) DD4hep, SuperChamber DetID " << gemid.rawId() << " Name " << std::string(name) << " dx1 " << dx1 << " dx2 " << dx2 << " dy " << dy << " dz " << dz; rgeo.insert(gemid.rawId(), vtra, vrot, pars, {std::string(name)}); } @@ -333,7 +333,7 @@ void GEMGeometryParsFromDD::buildChamber(cms::DDFilteredView& fv, GEMDetId detId std::vector vrot = getRotation(fv); edm::LogVerbatim("GEMGeometryParsFromDD") - << "(4) DD4HEP, Chamber DetID " << gemid.rawId() << " Name " << std::string(name) << " dx1 " << dx1 << " dx2 " + << "(4) DD4hep, Chamber DetID " << gemid.rawId() << " Name " << std::string(name) << " dx1 " << dx1 << " dx2 " << dx2 << " dy " << dy << " dz " << dz; rgeo.insert(gemid.rawId(), vtra, vrot, pars, {std::string(name)}); } @@ -356,7 +356,7 @@ void GEMGeometryParsFromDD::buildEtaPartition(cms::DDFilteredView& fv, GEMDetId std::vector vrot = getRotation(fv); edm::LogVerbatim("GEMGeometryParsFromDD") - << "(5) DD4HEP, Eta Partion DetID " << detId.rawId() << " Name " << std::string(name) << " dx1 " << dx1 << " dx2 " + << "(5) DD4hep, Eta Partion DetID " << detId.rawId() << " Name " << std::string(name) << " dx1 " << dx1 << " dx2 " << dx2 << " dy " << dy << " dz " << dz << " nStrips " << nStrips << " nPads " << nPads << " dPhi " << dPhi; rgeo.insert(detId.rawId(), vtra, vrot, pars, {std::string(name)}); } @@ -368,7 +368,7 @@ std::vector GEMGeometryParsFromDD::getTranslation(cms::DDFilteredView& f tran[2] = static_cast(fv.translation().Z()) / dd4hep::mm; edm::LogVerbatim("GEMGeometryParsFromDD") - << "(1) DD4HEP, tran vector " << tran[0] << " " << tran[1] << " " << tran[2]; + << "(1) DD4hep, tran vector " << tran[0] << " " << tran[1] << " " << tran[2]; return {tran[0], tran[1], tran[2]}; } @@ -379,7 +379,7 @@ std::vector GEMGeometryParsFromDD::getRotation(cms::DDFilteredView& fv) rota.GetComponents(x, y, z); const std::vector rot = {x.X(), x.Y(), x.Z(), y.X(), y.Y(), y.Z(), z.X(), z.Y(), z.Z()}; edm::LogVerbatim("GEMGeometryParsFromDD") - << "(2) DD4HEP, rot matrix " << rot[0] << " " << rot[1] << " " << rot[2] << " " << rot[3] << " " << rot[4] + << "(2) DD4hep, rot matrix " << rot[0] << " " << rot[1] << " " << rot[2] << " " << rot[3] << " " << rot[4] << " " << rot[5] << " " << rot[6] << " " << rot[7] << " " << rot[8]; return {rot[0], rot[1], rot[2], rot[3], rot[4], rot[5], rot[6], rot[7], rot[8]}; } diff --git a/Geometry/GEMGeometryBuilder/src/ME0GeometryBuilder.cc b/Geometry/GEMGeometryBuilder/src/ME0GeometryBuilder.cc index 21cd2c4eb57b7..79f36ee47dfef 100644 --- a/Geometry/GEMGeometryBuilder/src/ME0GeometryBuilder.cc +++ b/Geometry/GEMGeometryBuilder/src/ME0GeometryBuilder.cc @@ -3,7 +3,7 @@ Description: ME0 Geometry builder from DD & DD4hep DD4hep part added to the original old file (DD version) made by M. Maggi (INFN Bari) - Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osborne made for DTs (DD4HEP migration) + Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osborne made for DTs (DD4hep migration) Updated by Sunanda Banerjee (Fermilab) to make it work for DDD/DD4hep Updated: 7 August 2020 */ diff --git a/Geometry/GEMGeometryBuilder/src/ME0GeometryBuilder.h b/Geometry/GEMGeometryBuilder/src/ME0GeometryBuilder.h index 4625d2b2a3f81..dff45c661cbfc 100644 --- a/Geometry/GEMGeometryBuilder/src/ME0GeometryBuilder.h +++ b/Geometry/GEMGeometryBuilder/src/ME0GeometryBuilder.h @@ -3,10 +3,10 @@ /* //\class ME0GeometryBuilder - Description: ME0 Geometry builder for DD4HEP + Description: ME0 Geometry builder for DD4hep DD4hep part added to the original old file (DD version) made by M. Maggi (INFN Bari) // -// Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osborne made for DTs (DD4HEP migration) +// Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osborne made for DTs (DD4hep migration) // Created: 29 Apr 2019 */ diff --git a/Geometry/GEMGeometryBuilder/src/ME0GeometryParsFromDD.cc b/Geometry/GEMGeometryBuilder/src/ME0GeometryParsFromDD.cc index 4f0149364bd25..50594fe04d5f1 100644 --- a/Geometry/GEMGeometryBuilder/src/ME0GeometryParsFromDD.cc +++ b/Geometry/GEMGeometryBuilder/src/ME0GeometryParsFromDD.cc @@ -181,7 +181,7 @@ std::vector ME0GeometryParsFromDD::getRotation(DDFilteredView& fv) { return {x.X(), x.Y(), x.Z(), y.X(), y.Y(), y.Z(), z.X(), z.Y(), z.Z()}; } -// DD4HEP +// DD4hep void ME0GeometryParsFromDD::build(const cms::DDCompactView* cview, const MuonGeometryConstants& muonConstants, @@ -196,7 +196,7 @@ void ME0GeometryParsFromDD::build(const cms::DDCompactView* cview, void ME0GeometryParsFromDD::buildGeometry(cms::DDFilteredView& fv, const MuonGeometryConstants& muonConstants, RecoIdealGeometry& rgeo) { - edm::LogVerbatim("ME0GeometryParsFromDD") << "(0) ME0GeometryParsFromDD - DD4HEP "; + edm::LogVerbatim("ME0GeometryParsFromDD") << "(0) ME0GeometryParsFromDD - DD4hep "; MuonGeometryNumbering mdddnum(muonConstants); ME0NumberingScheme me0Num(muonConstants); @@ -228,7 +228,7 @@ void ME0GeometryParsFromDD::buildChamber(cms::DDFilteredView& fv, ME0DetId detId std::vector vrot = getRotation(fv); edm::LogVerbatim("ME0GeometryParsFromDD") - << "(4) DD4HEP, Chamber DetID " << detId.chamberId().rawId() << " Name " << std::string(name); + << "(4) DD4hep, Chamber DetID " << detId.chamberId().rawId() << " Name " << std::string(name); rgeo.insert(detId.chamberId().rawId(), vtra, vrot, pars, {std::string(name)}); } @@ -240,7 +240,7 @@ void ME0GeometryParsFromDD::buildLayer(cms::DDFilteredView& fv, ME0DetId detId, std::vector vrot = getRotation(fv); edm::LogVerbatim("ME0GeometryParsFromDD") - << "(5) DD4HEP, Layer DetID " << detId.layerId().rawId() << " Name " << std::string(name); + << "(5) DD4hep, Layer DetID " << detId.layerId().rawId() << " Name " << std::string(name); rgeo.insert(detId.layerId().rawId(), vtra, vrot, pars, {std::string(name)}); } @@ -254,7 +254,7 @@ void ME0GeometryParsFromDD::buildEtaPartition(cms::DDFilteredView& fv, ME0DetId std::vector vtra = getTranslation(fv); std::vector vrot = getRotation(fv); - edm::LogVerbatim("ME0GeometryParsFromDD") << "(6) DD4HEP, Eta Partion DetID " << detId.rawId() << " Name " + edm::LogVerbatim("ME0GeometryParsFromDD") << "(6) DD4hep, Eta Partion DetID " << detId.rawId() << " Name " << std::string(name) << " nStrips " << nStrips << " nPads " << nPads; rgeo.insert(detId.rawId(), vtra, vrot, pars, {std::string(name)}); @@ -264,7 +264,7 @@ std::vector ME0GeometryParsFromDD::getDimension(cms::DDFilteredView& fv) std::vector dpar = fv.parameters(); edm::LogVerbatim("ME0GeometryParsFromDD") - << "(1) DD4HEP, dimension dx1 " << dpar[0] / dd4hep::mm << ", dx2 " << dpar[1] / dd4hep::mm << ", dy " + << "(1) DD4hep, dimension dx1 " << dpar[0] / dd4hep::mm << ", dx2 " << dpar[1] / dd4hep::mm << ", dy " << dpar[3] / dd4hep::mm << ", dz " << dpar[2] / dd4hep::mm; return {dpar[0] / dd4hep::mm, dpar[1] / dd4hep::mm, dpar[3] / dd4hep::mm, dpar[2] / dd4hep::mm}; @@ -277,7 +277,7 @@ std::vector ME0GeometryParsFromDD::getTranslation(cms::DDFilteredView& f tran[2] = static_cast(fv.translation().Z()) / dd4hep::mm; edm::LogVerbatim("ME0GeometryParsFromDD") - << "(2) DD4HEP, tran vector " << tran[0] << " " << tran[1] << " " << tran[2]; + << "(2) DD4hep, tran vector " << tran[0] << " " << tran[1] << " " << tran[2]; return {tran[0], tran[1], tran[2]}; } @@ -288,7 +288,7 @@ std::vector ME0GeometryParsFromDD::getRotation(cms::DDFilteredView& fv) rota.GetComponents(x, y, z); const std::vector rot = {x.X(), x.Y(), x.Z(), y.X(), y.Y(), y.Z(), z.X(), z.Y(), z.Z()}; edm::LogVerbatim("ME0GeometryParsFromDD") - << "(3) DD4HEP, rot matrix " << rot[0] << " " << rot[1] << " " << rot[2] << " " << rot[3] << " " << rot[4] + << "(3) DD4hep, rot matrix " << rot[0] << " " << rot[1] << " " << rot[2] << " " << rot[3] << " " << rot[4] << " " << rot[5] << " " << rot[6] << " " << rot[7] << " " << rot[8]; return {rot[0], rot[1], rot[2], rot[3], rot[4], rot[5], rot[6], rot[7], rot[8]}; } diff --git a/Geometry/GEMGeometryBuilder/test/python/dumpGEMGeometryDD4Hep_cfg.py b/Geometry/GEMGeometryBuilder/test/python/dumpGEMGeometryDD4hep_cfg.py similarity index 100% rename from Geometry/GEMGeometryBuilder/test/python/dumpGEMGeometryDD4Hep_cfg.py rename to Geometry/GEMGeometryBuilder/test/python/dumpGEMGeometryDD4hep_cfg.py diff --git a/Geometry/GEMGeometryBuilder/test/python/dumpME0GeometryDD4Hep_cfg.py b/Geometry/GEMGeometryBuilder/test/python/dumpME0GeometryDD4hep_cfg.py similarity index 100% rename from Geometry/GEMGeometryBuilder/test/python/dumpME0GeometryDD4Hep_cfg.py rename to Geometry/GEMGeometryBuilder/test/python/dumpME0GeometryDD4hep_cfg.py diff --git a/Geometry/GEMGeometryBuilder/test/python/validateGEMGeometryDD4Hep_cfg.py b/Geometry/GEMGeometryBuilder/test/python/validateGEMGeometryDD4hep_cfg.py similarity index 100% rename from Geometry/GEMGeometryBuilder/test/python/validateGEMGeometryDD4Hep_cfg.py rename to Geometry/GEMGeometryBuilder/test/python/validateGEMGeometryDD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/data/TB160/hgcalCons.xml b/Geometry/HGCalCommonData/data/TB160/hgcalCons.xml index 99ba78055eef7..643d0c559b41f 100644 --- a/Geometry/HGCalCommonData/data/TB160/hgcalCons.xml +++ b/Geometry/HGCalCommonData/data/TB160/hgcalCons.xml @@ -269,6 +269,7 @@ + diff --git a/Geometry/HGCalCommonData/data/TB161/1Module/hgcalCons.xml b/Geometry/HGCalCommonData/data/TB161/1Module/hgcalCons.xml index 0ee0307d91276..5f23696c805c0 100644 --- a/Geometry/HGCalCommonData/data/TB161/1Module/hgcalCons.xml +++ b/Geometry/HGCalCommonData/data/TB161/1Module/hgcalCons.xml @@ -26,6 +26,7 @@ + diff --git a/Geometry/HGCalCommonData/data/TB161/8Module/hgcalCons.xml b/Geometry/HGCalCommonData/data/TB161/8Module/hgcalCons.xml index 005de5fa86b38..11b4d664aae4c 100644 --- a/Geometry/HGCalCommonData/data/TB161/8Module/hgcalCons.xml +++ b/Geometry/HGCalCommonData/data/TB161/8Module/hgcalCons.xml @@ -89,6 +89,7 @@ + diff --git a/Geometry/HGCalCommonData/data/TB161/TimingLayer/hgcalCons.xml b/Geometry/HGCalCommonData/data/TB161/TimingLayer/hgcalCons.xml index 52520904a1b9e..5c06aeecfb084 100644 --- a/Geometry/HGCalCommonData/data/TB161/TimingLayer/hgcalCons.xml +++ b/Geometry/HGCalCommonData/data/TB161/TimingLayer/hgcalCons.xml @@ -26,6 +26,7 @@ + diff --git a/Geometry/HGCalCommonData/data/TB170/July17/hgcalCons.xml b/Geometry/HGCalCommonData/data/TB170/July17/hgcalCons.xml index 54b8bbbfc939b..ab8f59ed24632 100644 --- a/Geometry/HGCalCommonData/data/TB170/July17/hgcalCons.xml +++ b/Geometry/HGCalCommonData/data/TB170/July17/hgcalCons.xml @@ -55,6 +55,7 @@ + @@ -96,6 +97,7 @@ + diff --git a/Geometry/HGCalCommonData/data/TB170/Sep17/hgcalCons.xml b/Geometry/HGCalCommonData/data/TB170/Sep17/hgcalCons.xml index dbc6c6c0b428a..f95d4a1bce871 100644 --- a/Geometry/HGCalCommonData/data/TB170/Sep17/hgcalCons.xml +++ b/Geometry/HGCalCommonData/data/TB170/Sep17/hgcalCons.xml @@ -186,6 +186,7 @@ + diff --git a/Geometry/HGCalCommonData/data/TB170/hgcalCons.xml b/Geometry/HGCalCommonData/data/TB170/hgcalCons.xml index 45e8153986ab7..df259eec18e51 100644 --- a/Geometry/HGCalCommonData/data/TB170/hgcalCons.xml +++ b/Geometry/HGCalCommonData/data/TB170/hgcalCons.xml @@ -280,6 +280,7 @@ + @@ -393,6 +394,7 @@ + diff --git a/Geometry/HGCalCommonData/data/TB180/hgcalCons.xml b/Geometry/HGCalCommonData/data/TB180/hgcalCons.xml index 5335bf89d3465..2cb30b13d0d12 100644 --- a/Geometry/HGCalCommonData/data/TB180/hgcalCons.xml +++ b/Geometry/HGCalCommonData/data/TB180/hgcalCons.xml @@ -44,6 +44,7 @@ + diff --git a/Geometry/HGCalCommonData/data/TB181/June18/hgcalCons.xml b/Geometry/HGCalCommonData/data/TB181/June18/hgcalCons.xml index 5163725219870..ba51916be6f54 100644 --- a/Geometry/HGCalCommonData/data/TB181/June18/hgcalCons.xml +++ b/Geometry/HGCalCommonData/data/TB181/June18/hgcalCons.xml @@ -269,6 +269,7 @@ + diff --git a/Geometry/HGCalCommonData/data/TB181/Oct181/hgcalCons.xml b/Geometry/HGCalCommonData/data/TB181/Oct181/hgcalCons.xml index ecadaa8121088..b6c5cc7366cb5 100644 --- a/Geometry/HGCalCommonData/data/TB181/Oct181/hgcalCons.xml +++ b/Geometry/HGCalCommonData/data/TB181/Oct181/hgcalCons.xml @@ -280,6 +280,7 @@ + @@ -393,6 +394,7 @@ + diff --git a/Geometry/HGCalCommonData/data/TB181/Test/hgcalCons.xml b/Geometry/HGCalCommonData/data/TB181/Test/hgcalCons.xml index a77f0842fe086..0ab8ca982a0a0 100644 --- a/Geometry/HGCalCommonData/data/TB181/Test/hgcalCons.xml +++ b/Geometry/HGCalCommonData/data/TB181/Test/hgcalCons.xml @@ -125,6 +125,7 @@ + diff --git a/Geometry/HGCalCommonData/data/dd4hep/cms-test-ddhgcalModule-algorithm.xml b/Geometry/HGCalCommonData/data/dd4hep/cms-test-ddhgcalModule-algorithm.xml deleted file mode 100644 index 88aa7250c72aa..0000000000000 --- a/Geometry/HGCalCommonData/data/dd4hep/cms-test-ddhgcalModule-algorithm.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Geometry/HGCalCommonData/data/dd4hep/cms-test-ddhgcalModuleAlgo-algorithm.xml b/Geometry/HGCalCommonData/data/dd4hep/cms-test-ddhgcalModuleAlgo-algorithm.xml deleted file mode 100644 index 8c87110738b01..0000000000000 --- a/Geometry/HGCalCommonData/data/dd4hep/cms-test-ddhgcalModuleAlgo-algorithm.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Geometry/HGCalCommonData/data/dd4hep/cms-test-ddhgcalV8-algorithm.xml b/Geometry/HGCalCommonData/data/dd4hep/cms-test-ddhgcalV8-algorithm.xml deleted file mode 100644 index 4aa1467bbb028..0000000000000 --- a/Geometry/HGCalCommonData/data/dd4hep/cms-test-ddhgcalV8-algorithm.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Geometry/HGCalCommonData/data/hgcal/v7/hgcal.xml b/Geometry/HGCalCommonData/data/hgcal/v7/hgcal.xml deleted file mode 100644 index 44cb54d8315c7..0000000000000 --- a/Geometry/HGCalCommonData/data/hgcal/v7/hgcal.xml +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Geometry/HGCalCommonData/data/hgcal/v8/hgcal.xml b/Geometry/HGCalCommonData/data/hgcal/v8/hgcal.xml deleted file mode 100644 index 65d0a1df52c3d..0000000000000 --- a/Geometry/HGCalCommonData/data/hgcal/v8/hgcal.xml +++ /dev/null @@ -1,176 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Geometry/HGCalCommonData/data/hgcal/v9/hgcal.xml b/Geometry/HGCalCommonData/data/hgcal/v9/hgcal.xml deleted file mode 100644 index bc24cfee8cdba..0000000000000 --- a/Geometry/HGCalCommonData/data/hgcal/v9/hgcal.xml +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Geometry/HGCalCommonData/data/hgcalCons/v7/hgcalCons.xml b/Geometry/HGCalCommonData/data/hgcalCons/v7/hgcalCons.xml deleted file mode 100644 index 8766e1200a4e3..0000000000000 --- a/Geometry/HGCalCommonData/data/hgcalCons/v7/hgcalCons.xml +++ /dev/null @@ -1,399 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Geometry/HGCalCommonData/data/hgcalCons/v8/hgcalCons.xml b/Geometry/HGCalCommonData/data/hgcalCons/v8/hgcalCons.xml deleted file mode 100644 index 8766e1200a4e3..0000000000000 --- a/Geometry/HGCalCommonData/data/hgcalCons/v8/hgcalCons.xml +++ /dev/null @@ -1,399 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Geometry/HGCalCommonData/data/hgcalCons/v9/hgcalCons.xml b/Geometry/HGCalCommonData/data/hgcalCons/v9/hgcalCons.xml deleted file mode 100644 index b54022e32474b..0000000000000 --- a/Geometry/HGCalCommonData/data/hgcalCons/v9/hgcalCons.xml +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - [hgcal:radMixL0], [hgcal:radMixL1], [hgcal:radMixL2], [hgcal:radMixL3], - [hgcal:radMixL4], [hgcal:radMixL5], [hgcal:radMixL6], [hgcal:radMixL7], - [hgcal:radMixL8], [hgcal:radMixL9], [hgcal:radMixL10],[hgcal:radMixL11], - [hgcal:radMixL12],[hgcal:radMixL13],[hgcal:radMixL14],[hgcal:radMixL15] - - - [hgcal:zMinEE], [hgcal:zMinHEsil], [hgcal:zMinHEmix], - [hgcal:zMaxHEmix] - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Geometry/HGCalCommonData/data/hgcalEE/v7/hgcalEE.xml b/Geometry/HGCalCommonData/data/hgcalEE/v7/hgcalEE.xml deleted file mode 100644 index 9d1496b9f36c7..0000000000000 --- a/Geometry/HGCalCommonData/data/hgcalEE/v7/hgcalEE.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - hgcalwafer:HGCalEEWaferFine, hgcalwafer:HGCalEEWaferCoarse - - materials:Carbon_fibre_str_Upgrade2, materials:Tungsten, - materials:Tungsten, materials:Tungsten, hgcal:WCu, hgcal:WCu, - hgcal:WCu, materials:Copper, materials:Copper, materials:Air, - materials:M_NEMA FR4 plate, materials:Air, materials:Foam, - materials:Aluminium, materials:Air - - EEModule, EEAbsorber1, EEAbsorber2, EEAbsorber3, EEAbsorber4, EEAbsorber5, - EEAbsorber6, EECuFrame, EEHeatShield, EESensitive, EEPCB, EEAirGap, - EEThermalScreen, EEScreenCover, EEThermalGap - - 0.5*mm, 2.0*mm, 2.8*mm, 4.2*mm, 0.6*mm, 1.2*mm, 2.2*mm, - 0.5*mm, 6.0*mm, 0.1*mm, 2.0*mm, 2.0*mm, 16.0*mm, 2.0*mm, 10.0*mm - - - 4, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18 - - 30.0*mm, 19.8*mm, 19.8*mm, 19.8*mm, 19.8*mm, 19.8*mm, 21.8*mm, 21.8*mm, - 21.8*mm, 21.8*mm, 21.8*mm, 25.2*mm, 25.2*mm, 25.2*mm, 25.2*mm - - 13, 12, 13, 14, - 0, 1, 0, 7, 11, 10, 9, 9, 9, 4, 8, 4, 9, 9, 9, 10, 11, 7, - 0, 1, 0, 7, 11, 10, 9, 9, 9, 4, 8, 4, 9, 9, 9, 10, 11, 7, - 0, 1, 0, 7, 11, 10, 9, 9, 9, 4, 8, 4, 9, 9, 9, 10, 11, 7, - 0, 1, 0, 7, 11, 10, 9, 9, 9, 4, 8, 4, 9, 9, 9, 10, 11, 7, - 0, 1, 0, 7, 11, 10, 9, 9, 9, 4, 8, 4, 9, 9, 9, 10, 11, 7, - 0, 2, 0, 7, 11, 10, 9, 9, 9, 5, 8, 5, 9, 9, 9, 10, 11, 7, - 0, 2, 0, 7, 11, 10, 9, 9, 9, 5, 8, 5, 9, 9, 9, 10, 11, 7, - 0, 2, 0, 7, 11, 10, 9, 9, 9, 5, 8, 5, 9, 9, 9, 10, 11, 7, - 0, 2, 0, 7, 11, 10, 9, 9, 9, 5, 8, 5, 9, 9, 9, 10, 11, 7, - 0, 2, 0, 7, 11, 10, 9, 9, 9, 5, 8, 5, 9, 9, 9, 10, 11, 7, - 0, 3, 0, 7, 11, 10, 9, 9, 9, 6, 8, 6, 9, 9, 9, 10, 11, 7, - 0, 3, 0, 7, 11, 10, 9, 9, 9, 6, 8, 6, 9, 9, 9, 10, 11, 7, - 0, 3, 0, 7, 11, 10, 9, 9, 9, 6, 8, 6, 9, 9, 9, 10, 11, 7, - 0, 3, 0, 7, 11, 10, 9, 9, 9, 6, 8, 6, 9, 9, 9, 10, 11, 7 - - - 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0 - - - - - - - - [etaMax:slope], [hgcal:slope1] - - [hgcal:slope2], [hgcal:slope3], 0, 0 - - [hgcal:zHGCal1], [hgcal:zHGCal2], [hgcal:zHGCal3], - [hgcal:zHGCal4] - - [hgcal:rMaxHGCal1], [hgcal:rMaxHGCal2], [hgcal:rMaxHGCal3], - [hgcal:rMaxHGCal4] - - - - - - - - - - - - - - - - - - - - diff --git a/Geometry/HGCalCommonData/data/hgcalEE/v8/hgcalEE.xml b/Geometry/HGCalCommonData/data/hgcalEE/v8/hgcalEE.xml deleted file mode 100644 index c556aadb7f7d4..0000000000000 --- a/Geometry/HGCalCommonData/data/hgcalEE/v8/hgcalEE.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - - - - - - hgcalwafer:HGCalEEWaferFine, hgcalwafer:HGCalEEWaferCoarse - - materials:Carbon_fibre_str_Upgrade2, materials:Tungsten, - materials:Tungsten, materials:Tungsten, hgcal:WCu, hgcal:WCu, - hgcal:WCu, materials:Copper, materials:Copper, materials:Silicon, - materials:M_NEMA FR4 plate, materials:Air, materials:Foam, - materials:Aluminium, materials:Air - - EEModule, EEAbsorber1, EEAbsorber2, EEAbsorber3, EEAbsorber4, EEAbsorber5, - EEAbsorber6, EECuFrame, EEHeatShield, EESensitive, EEPCB, EEAirGap, - EEThermalScreen, EEScreenCover, EEThermalGap - - 0.5*mm, 2.0*mm, 2.8*mm, 4.2*mm, 0.6*mm, 1.2*mm, 2.2*mm, - 0.5*mm, 6.0*mm, 0.1*mm, 2.0*mm, 2.0*mm, 16.0*mm, 2.0*mm, 10.0*mm - - - 4, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18 - - 30.0*mm, 19.8*mm, 19.8*mm, 19.8*mm, 19.8*mm, 19.8*mm, 21.8*mm, 21.8*mm, - 21.8*mm, 21.8*mm, 21.8*mm, 25.2*mm, 25.2*mm, 25.2*mm, 25.2*mm - - 13, 12, 13, 14, - 0, 1, 0, 7, 11, 10, 9, 9, 9, 4, 8, 4, 9, 9, 9, 10, 11, 7, - 0, 1, 0, 7, 11, 10, 9, 9, 9, 4, 8, 4, 9, 9, 9, 10, 11, 7, - 0, 1, 0, 7, 11, 10, 9, 9, 9, 4, 8, 4, 9, 9, 9, 10, 11, 7, - 0, 1, 0, 7, 11, 10, 9, 9, 9, 4, 8, 4, 9, 9, 9, 10, 11, 7, - 0, 1, 0, 7, 11, 10, 9, 9, 9, 4, 8, 4, 9, 9, 9, 10, 11, 7, - 0, 2, 0, 7, 11, 10, 9, 9, 9, 5, 8, 5, 9, 9, 9, 10, 11, 7, - 0, 2, 0, 7, 11, 10, 9, 9, 9, 5, 8, 5, 9, 9, 9, 10, 11, 7, - 0, 2, 0, 7, 11, 10, 9, 9, 9, 5, 8, 5, 9, 9, 9, 10, 11, 7, - 0, 2, 0, 7, 11, 10, 9, 9, 9, 5, 8, 5, 9, 9, 9, 10, 11, 7, - 0, 2, 0, 7, 11, 10, 9, 9, 9, 5, 8, 5, 9, 9, 9, 10, 11, 7, - 0, 3, 0, 7, 11, 10, 9, 9, 9, 6, 8, 6, 9, 9, 9, 10, 11, 7, - 0, 3, 0, 7, 11, 10, 9, 9, 9, 6, 8, 6, 9, 9, 9, 10, 11, 7, - 0, 3, 0, 7, 11, 10, 9, 9, 9, 6, 8, 6, 9, 9, 9, 10, 11, 7, - 0, 3, 0, 7, 11, 10, 9, 9, 9, 6, 8, 6, 9, 9, 9, 10, 11, 7 - - - 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0 - - - - - - - [etaMax:slope], [etaMax:slope] - - [hgcal:slope2], [hgcal:slope3], 0, 0 - - [hgcal:zHGCal1], [hgcal:zHGCal2], [hgcal:zHGCal3], - [hgcal:zHGCal4] - - [hgcal:rMaxHGCal1], [hgcal:rMaxHGCal2], [hgcal:rMaxHGCal3], - [hgcal:rMaxHGCal4] - - - - - - - - - - - - - - - - - - - - diff --git a/Geometry/HGCalCommonData/data/hgcalHEmix/v16/hgcalHEmix.xml b/Geometry/HGCalCommonData/data/hgcalHEmix/v16/hgcalHEmix.xml index 63429ac591647..dd9287da587ed 100644 --- a/Geometry/HGCalCommonData/data/hgcalHEmix/v16/hgcalHEmix.xml +++ b/Geometry/HGCalCommonData/data/hgcalHEmix/v16/hgcalHEmix.xml @@ -119,9 +119,9 @@ hgcalwafer:HGCalHEWafer0Coarse2bm4, hgcalwafer:HGCalHEWafer0Coarse2bm5 materials:StainlessSteel, materials:StainlessSteel, materials:Air, - materials:Copper, materials:Air, materials:Copper + materials:StainlessSteel, materials:Air, materials:Copper - HGCalHEAbsorber1, HGCalHEAbsorber2, HGCalHEAirGap1, HGCalHECopperCover, + HGCalHEAbsorber1, HGCalHEAbsorber2, HGCalHEAirGap1, HGCalHESteelCover, HGCalHESiliconLayer, HGCalHECoolingPlate 41.5*mm, 60.7*mm, 4.0*mm, 2.5*mm, [hgcal:ModuleThicknessHE], 6.35*mm diff --git a/Geometry/HGCalCommonData/data/hgcalHEsil/v16/hgcalHEsil.xml b/Geometry/HGCalCommonData/data/hgcalHEsil/v16/hgcalHEsil.xml index 5a59d1e56e1be..794ad6debe78d 100644 --- a/Geometry/HGCalCommonData/data/hgcalHEsil/v16/hgcalHEsil.xml +++ b/Geometry/HGCalCommonData/data/hgcalHEsil/v16/hgcalHEsil.xml @@ -103,10 +103,11 @@ hgcalwafer:HGCalHEWafer0Coarse2bm4, hgcalwafer:HGCalHEWafer0Coarse2bm5 materials:StainlessSteel, materials:StainlessSteel, materials:Air, - materials:Air, materials:Copper, materials:Copper, materials:Air + materials:Air, materials:StainlessSteel, materials:Copper, + materials:Air HGCalHEAbsorber1, HGCalHEAbsorber2, HGCalHEAirGap0, HGCalHEAirGap1, - HGCalHECopperCover, HGCalHECoolingPlate, HGCalHESiliconLayer + HGCalHESteelCover, HGCalHECoolingPlate, HGCalHESiliconLayer 45.0*mm, 41.5*mm, 1.25*mm, 4.00*mm, 2.50*mm, 6.35*mm, [hgcal:ModuleThicknessHE] diff --git a/Geometry/HGCalCommonData/data/hgcalHEsil/v7/hgcalHEsil.xml b/Geometry/HGCalCommonData/data/hgcalHEsil/v7/hgcalHEsil.xml deleted file mode 100644 index 7a84abb651049..0000000000000 --- a/Geometry/HGCalCommonData/data/hgcalHEsil/v7/hgcalHEsil.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - hgcalwafer:HGCalHEWaferFine, hgcalwafer:HGCalHEWaferCoarse - - materials:H_Brass, materials:Carbon_fibre_str_Upgrade2, materials:Copper, - materials:Copper, materials:Air, materials:M_NEMA FR4 plate, - materials:Air, materials:StainlessSteel, materials:Foam, - materials:Aluminium, materials:Air - - HESiliconAbsorber1, HESiliconAbsorber2, HESiliconShield, - HESiliconHeatShield, HESiliconSensitive, HESiliconPCB, HESiliconAirGap, - HESiliconSupport, HEThermalScreen, HEScreenCover, HEThermalGap - - 35.0*mm, 1.0*mm, 0.5*mm, 6.0*mm, 0.1*mm, 2.0*mm, 2.0*mm, 15*mm, 16.0*mm, - 2.0*mm, 10.0*mm - - 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 4 - - 15.0*mm, 46.8*mm, 46.8*mm, 46.8*mm, 46.8*mm, 46.8*mm, 46.8*mm, 46.8*mm, - 46.8*mm, 46.8*mm, 46.8*mm, 46.8*mm, 46.8*mm, 30.0*mm - - 7, - 0, 2, 6, 5, 4, 4, 4, 1, 3, 0, 2, 6, 5, 4, 4, 4, 1, 3, - 0, 2, 6, 5, 4, 4, 4, 1, 3, 0, 2, 6, 5, 4, 4, 4, 1, 3, - 0, 2, 6, 5, 4, 4, 4, 1, 3, 0, 2, 6, 5, 4, 4, 4, 1, 3, - 0, 2, 6, 5, 4, 4, 4, 1, 3, 0, 2, 6, 5, 4, 4, 4, 1, 3, - 0, 2, 6, 5, 4, 4, 4, 1, 3, 0, 2, 6, 5, 4, 4, 4, 1, 3, - 0, 2, 6, 5, 4, 4, 4, 1, 3, 0, 2, 6, 5, 4, 4, 4, 1, 3, - 10, 9, 8, 9 - - - 0, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0 - - - - - - - - [etaMax:slope], [hgcal:slope1] - - [hgcal:slope2], 0, 0, 0 - - [hgcal:zHGCal1], [hgcal:zHGCal2], [hgcal:zHGCal3], - [hgcal:zHGCal4] - - [hgcal:rMaxHGCal1], [hgcal:rMaxHGCal2], [hgcal:rMaxHGCal2], - [hgcal:rMaxHGCal4] - - - - - - - - - - - - - - - - - - - - diff --git a/Geometry/HGCalCommonData/data/hgcalHEsil/v7SS/hgcalHEsil.xml b/Geometry/HGCalCommonData/data/hgcalHEsil/v7SS/hgcalHEsil.xml deleted file mode 100644 index 465c3e6917998..0000000000000 --- a/Geometry/HGCalCommonData/data/hgcalHEsil/v7SS/hgcalHEsil.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - hgcalwafer:HGCalHEWaferFine, hgcalwafer:HGCalHEWaferCoarse - - materials:StainlessSteel, materials:Carbon_fibre_str_Upgrade2, - materials:Copper, materials:Copper, materials:Air, - materials:M_NEMA FR4 plate, materials:Air, materials:StainlessSteel, - materials:Foam, materials:Aluminium, materials:Air - - HESiliconAbsorber1, HESiliconAbsorber2, HESiliconShield, - HESiliconHeatShield, HESiliconSensitive, HESiliconPCB, HESiliconAirGap, - HESiliconSupport, HEThermalScreen, HEScreenCover, HEThermalGap - - 35.0*mm, 1.0*mm, 0.5*mm, 6.0*mm, 0.1*mm, 2.0*mm, 2.0*mm, 15*mm, 16.0*mm, - 2.0*mm, 10.0*mm - - 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 4 - - 15.0*mm, 46.8*mm, 46.8*mm, 46.8*mm, 46.8*mm, 46.8*mm, 46.8*mm, 46.8*mm, - 46.8*mm, 46.8*mm, 46.8*mm, 46.8*mm, 46.8*mm, 30.0*mm - - 7, - 0, 2, 6, 5, 4, 4, 4, 1, 3, 0, 2, 6, 5, 4, 4, 4, 1, 3, - 0, 2, 6, 5, 4, 4, 4, 1, 3, 0, 2, 6, 5, 4, 4, 4, 1, 3, - 0, 2, 6, 5, 4, 4, 4, 1, 3, 0, 2, 6, 5, 4, 4, 4, 1, 3, - 0, 2, 6, 5, 4, 4, 4, 1, 3, 0, 2, 6, 5, 4, 4, 4, 1, 3, - 0, 2, 6, 5, 4, 4, 4, 1, 3, 0, 2, 6, 5, 4, 4, 4, 1, 3, - 0, 2, 6, 5, 4, 4, 4, 1, 3, 0, 2, 6, 5, 4, 4, 4, 1, 3, - 10, 9, 8, 9 - - - 0, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0 - - - - - - - - [etaMax:slope], [hgcal:slope1] - - [hgcal:slope2], 0, 0, 0 - - [hgcal:zHGCal1], [hgcal:zHGCal2], [hgcal:zHGCal3], - [hgcal:zHGCal4] - - [hgcal:rMaxHGCal1], [hgcal:rMaxHGCal2], [hgcal:rMaxHGCal2], - [hgcal:rMaxHGCal4] - - - - - - - - - - - - - - - - - diff --git a/Geometry/HGCalCommonData/data/hgcalHEsil/v8/hgcalHEsil.xml b/Geometry/HGCalCommonData/data/hgcalHEsil/v8/hgcalHEsil.xml deleted file mode 100644 index 4605c14da566c..0000000000000 --- a/Geometry/HGCalCommonData/data/hgcalHEsil/v8/hgcalHEsil.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - hgcalwafer:HGCalHEWaferFine, hgcalwafer:HGCalHEWaferCoarse - - materials:StainlessSteel, materials:Carbon_fibre_str_Upgrade2, - materials:Copper, materials:Copper, materials:Silicon, - materials:M_NEMA FR4 plate, materials:Air, materials:StainlessSteel, - materials:Foam, materials:Aluminium, materials:Air - - HESiliconAbsorber1, HESiliconAbsorber2, HESiliconShield, - HESiliconHeatShield, HESiliconSensitive, HESiliconPCB, HESiliconAirGap, - HESiliconSupport, HEThermalScreen, HEScreenCover, HEThermalGap - - 35.0*mm, 1.0*mm, 0.5*mm, 6.0*mm, 0.1*mm, 2.0*mm, 2.0*mm, 15*mm, 16.0*mm, - 2.0*mm, 10.0*mm - - 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 4 - - 15.0*mm, 46.8*mm, 46.8*mm, 46.8*mm, 46.8*mm, 46.8*mm, 46.8*mm, 46.8*mm, - 46.8*mm, 46.8*mm, 46.8*mm, 46.8*mm, 46.8*mm, 30.0*mm - - 7, - 0, 2, 6, 5, 4, 4, 4, 1, 3, 0, 2, 6, 5, 4, 4, 4, 1, 3, - 0, 2, 6, 5, 4, 4, 4, 1, 3, 0, 2, 6, 5, 4, 4, 4, 1, 3, - 0, 2, 6, 5, 4, 4, 4, 1, 3, 0, 2, 6, 5, 4, 4, 4, 1, 3, - 0, 2, 6, 5, 4, 4, 4, 1, 3, 0, 2, 6, 5, 4, 4, 4, 1, 3, - 0, 2, 6, 5, 4, 4, 4, 1, 3, 0, 2, 6, 5, 4, 4, 4, 1, 3, - 0, 2, 6, 5, 4, 4, 4, 1, 3, 0, 2, 6, 5, 4, 4, 4, 1, 3, - 10, 9, 8, 9 - - - 0, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0 - - - - - - - [etaMax:slope], [etaMax:slope] - - [hgcal:slope2], 0, 0, 0 - - [hgcal:zHGCal1], [hgcal:zHGCal2], [hgcal:zHGCal3], - [hgcal:zHGCal4] - - [hgcal:rMaxHGCal1], [hgcal:rMaxHGCal2], [hgcal:rMaxHGCal2], - [hgcal:rMaxHGCal4] - - - - - - - - - - - - - - - - - - - - diff --git a/Geometry/HGCalCommonData/interface/HGCalDDDConstants.h b/Geometry/HGCalCommonData/interface/HGCalDDDConstants.h index 7c9ffb888ff92..2194c01af7a7a 100644 --- a/Geometry/HGCalCommonData/interface/HGCalDDDConstants.h +++ b/Geometry/HGCalCommonData/interface/HGCalDDDConstants.h @@ -113,12 +113,21 @@ class HGCalDDDConstants { std::pair rowColumnWafer(const int wafer) const; int sectors() const { return hgpar_->nSectors_; } std::pair simToReco(int cell, int layer, int mod, bool half) const; + int tileCount(int layer, int ring) const; bool tileExist(int zside, int layer, int ring, int phi) const { int indx = HGCalTileIndex::tileIndex(layer, ring, 0); auto itr = hgpar_->tileInfoMap_.find(indx); bool ok = (itr == hgpar_->tileInfoMap_.end()) ? false : HGCalTileIndex::tileExist(itr->second.hex, zside, phi); return ok; } + std::pair tileRings(int layer) const { + if (mode_ == HGCalGeometryMode::TrapezoidFile) { + int ll = layer - hgpar_->firstLayer_; + if (ll >= 0 && ll < static_cast(hgpar_->tileRingRange_.size())) + return hgpar_->tileRingRange_[ll]; + } + return std::make_pair(0, 0); + } int tileSiPM(int sipm) const { return ((sipm > 0) ? HGCalTypes::SiPMSmall : HGCalTypes::SiPMLarge); } bool tileTrapezoid() const { return ((mode_ == HGCalGeometryMode::Trapezoid) || (mode_ == HGCalGeometryMode::TrapezoidFile) || @@ -212,16 +221,17 @@ class HGCalDDDConstants { int wafers() const; int wafers(int layer, int type) const; int waferToCopy(int wafer) const { - return ((wafer >= 0) && (wafer < (int)(hgpar_->waferCopy_.size()))) ? hgpar_->waferCopy_[wafer] - : (int)(hgpar_->waferCopy_.size()); + return ((wafer >= 0) && (wafer < static_cast(hgpar_->waferCopy_.size()))) + ? hgpar_->waferCopy_[wafer] + : static_cast(hgpar_->waferCopy_.size()); } // wafer transverse thickness classification (2 = coarse, 1 = fine) int waferTypeT(int wafer) const { - return ((wafer >= 0) && (wafer < (int)(hgpar_->waferTypeT_.size()))) ? hgpar_->waferTypeT_[wafer] : 0; + return ((wafer >= 0) && (wafer < static_cast(hgpar_->waferTypeT_.size()))) ? hgpar_->waferTypeT_[wafer] : 0; } // wafer longitudinal thickness classification (1 = 100um, 2 = 200um, 3=300um) int waferTypeL(int wafer) const { - return ((wafer >= 0) && (wafer < (int)(hgpar_->waferTypeL_.size()))) ? hgpar_->waferTypeL_[wafer] : 0; + return ((wafer >= 0) && (wafer < static_cast(hgpar_->waferTypeL_.size()))) ? hgpar_->waferTypeL_[wafer] : 0; } int waferType(DetId const& id, bool fromFile = false) const; int waferType(int layer, int waferU, int waferV, bool fromFile = false) const; diff --git a/Geometry/HGCalCommonData/interface/HGCalGeomParameters.h b/Geometry/HGCalCommonData/interface/HGCalGeomParameters.h index 154407eeadad9..717d850530932 100644 --- a/Geometry/HGCalCommonData/interface/HGCalGeomParameters.h +++ b/Geometry/HGCalCommonData/interface/HGCalGeomParameters.h @@ -99,6 +99,10 @@ class HGCalGeomParameters { : half(h), wafer(w), xyz(std::move(p)) {} }; + constexpr static int siliconFileEE = 2; + constexpr static int siliconFileHE = 3; + constexpr static int scintillatorFile = 4; + private: void loadGeometryHexagon(const std::map& layers, std::vector& trforms, @@ -143,9 +147,6 @@ class HGCalGeomParameters { void resetZero(std::vector&); constexpr static double tan30deg_ = 0.5773502693; - constexpr static int siliconFileEE = 2; - constexpr static int siliconFileHE = 3; - constexpr static int scintillatorFile = 4; HGCalGeomTools geomTools_; const double sqrt3_; double waferSize_; diff --git a/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalHEFileAlgo.cc b/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalHEFileAlgo.cc index 52ef2236c155f..4f1adfe3fbadd 100644 --- a/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalHEFileAlgo.cc +++ b/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalHEFileAlgo.cc @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////// // File: DDHGCalHEFileAlgo.cc -// Description: Geometry factory class for HGCal (Mix) adopted for DD4HEP +// Description: Geometry factory class for HGCal (Mix) adopted for DD4hep /////////////////////////////////////////////////////////////////////////////// #include diff --git a/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalMixLayer.cc b/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalMixLayer.cc index edb275f11cc9d..18ac1bee17d8e 100644 --- a/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalMixLayer.cc +++ b/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalMixLayer.cc @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////// // File: DDHGCalMixLayer.cc -// Description: Geometry factory class for HGCal (Mix) adopted for DD4HEP +// Description: Geometry factory class for HGCal (Mix) adopted for DD4hep /////////////////////////////////////////////////////////////////////////////// #include diff --git a/Geometry/HGCalCommonData/python/ecalhcalPhaseIIGeometryXML_cfi.py b/Geometry/HGCalCommonData/python/ecalhcalPhaseIIGeometryXML_cfi.py deleted file mode 100644 index 2b939210087d0..0000000000000 --- a/Geometry/HGCalCommonData/python/ecalhcalPhaseIIGeometryXML_cfi.py +++ /dev/null @@ -1,58 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", - geomXMLFiles = cms.vstring('Geometry/CMSCommonData/data/materials.xml', - 'Geometry/HcalCommonData/data/average/hcalforwardmaterial.xml', - 'Geometry/TrackerCommonData/data/trackermaterial.xml', - 'Geometry/CMSCommonData/data/rotations.xml', - "Geometry/HcalCommonData/data/hcalrotations.xml", - 'Geometry/CMSCommonData/data/normal/cmsextent.xml', - 'Geometry/CMSCommonData/data/cms.xml', - 'Geometry/CMSCommonData/data/cmsMother.xml', - 'Geometry/CMSCommonData/data/eta3/etaMax.xml', - 'Geometry/CMSCommonData/data/caloBase/2026/v1/caloBase.xml', - 'Geometry/CMSCommonData/data/cmsCalo.xml', - 'Geometry/CMSCommonData/data/muonBase.xml', - 'Geometry/CMSCommonData/data/cmsMuon.xml', - 'Geometry/CMSCommonData/data/mgnt.xml', - 'Geometry/CMSCommonData/data/muonMB.xml', - 'Geometry/CMSCommonData/data/muonMagnet.xml', - 'Geometry/EcalCommonData/data/ectkcable.xml', - 'Geometry/EcalCommonData/data/eregalgo/2026/v1/eregalgo.xml', - 'Geometry/EcalCommonData/data/ebalgo.xml', - 'Geometry/EcalCommonData/data/ebcon.xml', - 'Geometry/EcalCommonData/data/ebrot.xml', - 'Geometry/EcalCommonData/data/eecon.xml', - 'Geometry/EcalCommonData/data/escon/2026/v1/escon.xml', - 'Geometry/EcalCommonData/data/esalgo/2026/v1/esalgo.xml', - 'Geometry/HcalCommonData/data/hcalrotations.xml', - 'Geometry/HcalCommonData/data/hcal/HGCal/hcalalgo.xml', - 'Geometry/HcalCommonData/data/hcalbarrelalgo.xml', - 'Geometry/HcalCommonData/data/hcalendcap/SSAbsorber/hcalendcapalgo.xml', - 'Geometry/HcalCommonData/data/hcalouteralgo.xml', - 'Geometry/HcalCommonData/data/hcalforwardalgo.xml', - 'Geometry/HcalCommonData/data/hcalSimNumbering/2026/hcalSimNumbering.xml', - 'Geometry/HcalCommonData/data/hcalRecNumbering/2026/hcalRecNumbering.xml', - 'Geometry/HcalCommonData/data/average/hcalforwardmaterial.xml', - 'Geometry/HGCalCommonData/data/hgcal/v8/hgcal.xml', - 'Geometry/HGCalCommonData/data/hgcalEE/v8/hgcalEE.xml', - 'Geometry/HGCalCommonData/data/hgcalHEsil/v8/hgcalHEsil.xml', - 'Geometry/HGCalCommonData/data/hgcalwafer/v7/hgcalwafer.xml', - 'Geometry/HGCalCommonData/data/hgcalCons/v8/hgcalCons.xml', - 'Geometry/ForwardCommonData/data/forwardshield/2017/v1/forwardshield.xml', - 'Geometry/EcalSimData/data/PhaseII/ecalsens.xml', - 'Geometry/HcalCommonData/data/hcalsens/HGCal/hcalsenspmf.xml', - 'Geometry/HcalSimData/data/hf.xml', - 'Geometry/HcalSimData/data/hfpmt.xml', - 'Geometry/HcalSimData/data/hffibrebundle.xml', - 'Geometry/HcalSimData/data/CaloUtil.xml', - 'Geometry/HGCalSimData/data/hgcsensv8.xml', - 'Geometry/HGCalSimData/data/hgccons.xml', - 'Geometry/HGCalSimData/data/hgcProdCuts.xml', - 'Geometry/HcalSimData/data/HcalProdCuts.xml', - 'Geometry/EcalSimData/data/EcalProdCuts.xml', - 'Geometry/CMSCommonData/data/FieldParameters.xml'), - rootNodeName = cms.string('cms:OCMS') -) - - diff --git a/Geometry/HGCalCommonData/python/testFastTimeXML_cfi.py b/Geometry/HGCalCommonData/python/testFastTimeXML_cfi.py deleted file mode 100644 index 0795bdc5a9684..0000000000000 --- a/Geometry/HGCalCommonData/python/testFastTimeXML_cfi.py +++ /dev/null @@ -1,122 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -# This config was generated automatically using generate2026Geometry.py -# If you notice a mistake, please update the generating script, not just this config - -XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", - geomXMLFiles = cms.vstring( - 'Geometry/CMSCommonData/data/materials.xml', - 'Geometry/CMSCommonData/data/rotations.xml', - 'Geometry/CMSCommonData/data/extend/cmsextent.xml', - 'Geometry/CMSCommonData/data/cms/2019/v1/cms.xml', - 'Geometry/CMSCommonData/data/eta3/etaMax.xml', - 'Geometry/CMSCommonData/data/cmsMother.xml', - 'Geometry/CMSCommonData/data/cmsTracker.xml', - 'Geometry/CMSCommonData/data/caloBase/2026/v1/caloBase.xml', - 'Geometry/CMSCommonData/data/cmsCalo.xml', - 'Geometry/CMSCommonData/data/muonBase/2026/v1/muonBase.xml', - 'Geometry/CMSCommonData/data/cmsMuon.xml', - 'Geometry/CMSCommonData/data/mgnt.xml', - 'Geometry/CMSCommonData/data/beampipe/2026/v1/beampipe.xml', - 'Geometry/CMSCommonData/data/cmsBeam/2026/v1/cmsBeam.xml', - 'Geometry/CMSCommonData/data/muonMB.xml', - 'Geometry/CMSCommonData/data/muonMagnet.xml', - 'Geometry/CMSCommonData/data/cavern.xml', - 'Geometry/TrackerCommonData/data/PhaseII/trackerParameters.xml', - 'Geometry/TrackerCommonData/data/pixfwdCommon.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/pixfwd.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/pixbar.xml', - 'Geometry/TrackerCommonData/data/trackermaterial.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/tracker.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/pixel.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/trackerbar.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/trackerfwd.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/trackerStructureTopology.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/pixelStructureTopology.xml', - 'Geometry/TrackerSimData/data/PhaseII/TiltedTracker4026/trackersens.xml', - 'Geometry/TrackerSimData/data/PhaseII/TiltedTracker4026/pixelsens.xml', - 'Geometry/TrackerRecoData/data/PhaseII/TiltedTracker4026/trackerRecoMaterial.xml', - 'Geometry/TrackerSimData/data/PhaseII/TiltedTracker4026/trackerProdCuts.xml', - 'Geometry/TrackerSimData/data/PhaseII/TiltedTracker4026/pixelProdCuts.xml', - 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', - 'Geometry/EcalCommonData/data/ectkcable.xml', - 'Geometry/EcalCommonData/data/eregalgo/2026/v1/eregalgo.xml', - 'Geometry/EcalCommonData/data/ebalgo.xml', - 'Geometry/EcalCommonData/data/ebcon.xml', - 'Geometry/EcalCommonData/data/ebrot.xml', - 'Geometry/EcalCommonData/data/eecon.xml', - 'Geometry/EcalCommonData/data/escon/2026/v1/escon.xml', - 'Geometry/EcalCommonData/data/esalgo/2026/v1/esalgo.xml', - 'Geometry/HcalCommonData/data/hcalrotations.xml', - 'Geometry/HcalCommonData/data/hcal/HGCal/hcalalgo.xml', - 'Geometry/HcalCommonData/data/hcalbarrelalgo.xml', - 'Geometry/HcalCommonData/data/hcalendcap/HGCal/hcalendcapalgo.xml', - 'Geometry/HcalCommonData/data/hcalouteralgo.xml', - 'Geometry/HcalCommonData/data/hcalforwardalgo.xml', - 'Geometry/HcalCommonData/data/hcalSimNumbering/2026/hcalSimNumbering.xml', - 'Geometry/HcalCommonData/data/hcalRecNumbering/2026/hcalRecNumbering.xml', - 'Geometry/HcalCommonData/data/average/hcalforwardmaterial.xml', - 'Geometry/HGCalCommonData/data/hgcal/v7/hgcal.xml', - 'Geometry/HGCalCommonData/data/hgcalEE/v7/hgcalEE.xml', - 'Geometry/HGCalCommonData/data/hgcalHEsil/v7/hgcalHEsil.xml', - 'Geometry/HGCalCommonData/data/hgcalwafer/v7/hgcalwafer.xml', - 'Geometry/HGCalCommonData/data/hgcalCons/v7/hgcalCons.xml', - 'Geometry/MuonCommonData/data/mbCommon/2015/v1/mbCommon.xml', - 'Geometry/MuonCommonData/data/mb1/2015/v1/mb1.xml', - 'Geometry/MuonCommonData/data/mb2/2015/v1/mb2.xml', - 'Geometry/MuonCommonData/data/mb3/2015/v1/mb3.xml', - 'Geometry/MuonCommonData/data/mb4/2015/v1/mb4.xml', - 'Geometry/MuonCommonData/data/muonYoke/2021/v2/muonYoke.xml', - 'Geometry/MuonCommonData/data/mf/2026/v1/mf.xml', - 'Geometry/MuonCommonData/data/rpcf/2026/v1/rpcf.xml', - 'Geometry/MuonCommonData/data/gemf/TDR_BaseLine/gemf.xml', - 'Geometry/MuonCommonData/data/gem11/TDR_BaseLine/gem11.xml', - 'Geometry/MuonCommonData/data/gem21/TDR_BaseLine/gem21.xml', - 'Geometry/MuonCommonData/data/csc/2015/v1/csc.xml', - 'Geometry/MuonCommonData/data/mfshield/2026/v1/mfshield.xml', - 'Geometry/MuonCommonData/data/me0/TDR_BaseLine/me0.xml', - 'Geometry/ForwardCommonData/data/forwardshield/2015/v1/forwardshield.xml', - 'Geometry/ForwardCommonData/data/brmrotations.xml', - 'Geometry/ForwardCommonData/data/PostLS2/brm.xml', - 'Geometry/ForwardCommonData/data/zdcmaterials.xml', - 'Geometry/ForwardCommonData/data/lumimaterials.xml', - 'Geometry/ForwardCommonData/data/zdcrotations.xml', - 'Geometry/ForwardCommonData/data/lumirotations.xml', - 'Geometry/ForwardCommonData/data/zdc.xml', - 'Geometry/ForwardCommonData/data/zdclumi.xml', - 'Geometry/ForwardCommonData/data/cmszdc.xml', - 'Geometry/HGCalCommonData/data/fastTimingBarrel.xml', - 'Geometry/HGCalCommonData/data/fastTimingEndcap.xml', - 'Geometry/HGCalCommonData/data/fastTimingElement.xml', - )+ - cms.vstring( - 'Geometry/MuonCommonData/data/muonNumbering/TDR_BaseLine/muonNumbering.xml', - 'Geometry/EcalSimData/data/PhaseII/ecalsens.xml', - 'Geometry/HcalCommonData/data/hcalsens/HGCal/hcalsenspmf.xml', - 'Geometry/HcalSimData/data/hf.xml', - 'Geometry/HcalSimData/data/hfpmt.xml', - 'Geometry/HcalSimData/data/hffibrebundle.xml', - 'Geometry/HcalSimData/data/CaloUtil.xml', - 'Geometry/HGCalSimData/data/hgcsensv6.xml', - 'Geometry/HGCalSimData/data/hgccons.xml', - 'Geometry/HGCalSimData/data/hgcProdCuts.xml', - 'Geometry/MuonSimData/data/PhaseII/ME0EtaPart/muonSens.xml', - 'Geometry/DTGeometryBuilder/data/dtSpecsFilter.xml', - 'Geometry/CSCGeometryBuilder/data/cscSpecsFilter.xml', - 'Geometry/CSCGeometryBuilder/data/cscSpecs.xml', - 'Geometry/RPCGeometryBuilder/data/PhaseII/RPCSpecs.xml', - 'Geometry/GEMGeometryBuilder/data/v7/GEMSpecsFilter.xml', - 'Geometry/GEMGeometryBuilder/data/v7/GEMSpecs.xml', - 'Geometry/ForwardCommonData/data/brmsens.xml', - 'Geometry/ForwardSimData/data/zdcsens.xml', - 'Geometry/HGCalSimData/data/fasttimesens.xml', - 'Geometry/HcalSimData/data/HcalProdCuts.xml', - 'Geometry/EcalSimData/data/EcalProdCuts.xml', - 'Geometry/MuonSimData/data/PhaseII/muonProdCuts.xml', - 'Geometry/ForwardSimData/data/zdcProdCuts.xml', - 'Geometry/ForwardSimData/data/ForwardShieldProdCuts.xml', - 'Geometry/HGCalSimData/data/fasttimeProdCuts.xml', - 'Geometry/CMSCommonData/data/FieldParameters.xml', - ), - rootNodeName = cms.string('cms:OCMS') -) diff --git a/Geometry/HGCalCommonData/python/testHGCV7XML_cfi.py b/Geometry/HGCalCommonData/python/testHGCV7XML_cfi.py deleted file mode 100644 index a1affc140313f..0000000000000 --- a/Geometry/HGCalCommonData/python/testHGCV7XML_cfi.py +++ /dev/null @@ -1,117 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -# This config was generated automatically using generate2026Geometry.py -# If you notice a mistake, please update the generating script, not just this config - -XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", - geomXMLFiles = cms.vstring( - 'Geometry/CMSCommonData/data/materials.xml', - 'Geometry/CMSCommonData/data/rotations.xml', - 'Geometry/CMSCommonData/data/extend/cmsextent.xml', - 'Geometry/CMSCommonData/data/cms/2019/v1/cms.xml', - 'Geometry/CMSCommonData/data/eta3/etaMax.xml', - 'Geometry/CMSCommonData/data/cmsMother.xml', - 'Geometry/CMSCommonData/data/cmsTracker.xml', - 'Geometry/CMSCommonData/data/caloBase/2026/v1/caloBase.xml', - 'Geometry/CMSCommonData/data/cmsCalo.xml', - 'Geometry/CMSCommonData/data/muonBase/2026/v1/muonBase.xml', - 'Geometry/CMSCommonData/data/cmsMuon.xml', - 'Geometry/CMSCommonData/data/mgnt.xml', - 'Geometry/CMSCommonData/data/beampipe/2026/v1/beampipe.xml', - 'Geometry/CMSCommonData/data/cmsBeam/2026/v1/cmsBeam.xml', - 'Geometry/CMSCommonData/data/muonMB.xml', - 'Geometry/CMSCommonData/data/muonMagnet.xml', - 'Geometry/CMSCommonData/data/cavern.xml', - 'Geometry/TrackerCommonData/data/PhaseII/trackerParameters.xml', - 'Geometry/TrackerCommonData/data/pixfwdCommon.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/pixfwd.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/pixbar.xml', - 'Geometry/TrackerCommonData/data/trackermaterial.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/tracker.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/pixel.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/trackerbar.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/trackerfwd.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/trackerStructureTopology.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/pixelStructureTopology.xml', - 'Geometry/TrackerSimData/data/PhaseII/TiltedTracker4026/trackersens.xml', - 'Geometry/TrackerSimData/data/PhaseII/TiltedTracker4026/pixelsens.xml', - 'Geometry/TrackerRecoData/data/PhaseII/TiltedTracker4026/trackerRecoMaterial.xml', - 'Geometry/TrackerSimData/data/PhaseII/TiltedTracker4026/trackerProdCuts.xml', - 'Geometry/TrackerSimData/data/PhaseII/TiltedTracker4026/pixelProdCuts.xml', - 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', - 'Geometry/EcalCommonData/data/ectkcable.xml', - 'Geometry/EcalCommonData/data/eregalgo/2026/v1/eregalgo.xml', - 'Geometry/EcalCommonData/data/ebalgo.xml', - 'Geometry/EcalCommonData/data/ebcon.xml', - 'Geometry/EcalCommonData/data/ebrot.xml', - 'Geometry/EcalCommonData/data/eecon.xml', - 'Geometry/EcalCommonData/data/escon/2026/v1/escon.xml', - 'Geometry/EcalCommonData/data/esalgo/2026/v1/esalgo.xml', - 'Geometry/HcalCommonData/data/hcalrotations.xml', - 'Geometry/HcalCommonData/data/hcal/HGCal/hcalalgo.xml', - 'Geometry/HcalCommonData/data/hcalbarrelalgo.xml', - 'Geometry/HcalCommonData/data/hcalendcap/HGCal/hcalendcapalgo.xml', - 'Geometry/HcalCommonData/data/hcalouteralgo.xml', - 'Geometry/HcalCommonData/data/hcalforwardalgo.xml', - 'Geometry/HcalCommonData/data/hcalSimNumbering/2026/hcalSimNumbering.xml', - 'Geometry/HcalCommonData/data/hcalRecNumbering/2026/hcalRecNumbering.xml', - 'Geometry/HcalCommonData/data/average/hcalforwardmaterial.xml', - 'Geometry/HGCalCommonData/data/hgcal/v7/hgcal.xml', - 'Geometry/HGCalCommonData/data/hgcalEE/v7/hgcalEE.xml', - 'Geometry/HGCalCommonData/data/hgcalHEsil/v7/hgcalHEsil.xml', - 'Geometry/HGCalCommonData/data/hgcalwafer/v7/hgcalwafer.xml', - 'Geometry/HGCalCommonData/data/hgcalCons/v7/hgcalCons.xml', - 'Geometry/MuonCommonData/data/mbCommon/2015/v1/mbCommon.xml', - 'Geometry/MuonCommonData/data/mb1/2015/v1/mb1.xml', - 'Geometry/MuonCommonData/data/mb2/2015/v1/mb2.xml', - 'Geometry/MuonCommonData/data/mb3/2015/v1/mb3.xml', - 'Geometry/MuonCommonData/data/mb4/2015/v1/mb4.xml', - 'Geometry/MuonCommonData/data/muonYoke/2021/v2/muonYoke.xml', - 'Geometry/MuonCommonData/data/mf/2026/v1/mf.xml', - 'Geometry/MuonCommonData/data/rpcf/2026/v1/rpcf.xml', - 'Geometry/MuonCommonData/data/gemf/TDR_BaseLine/gemf.xml', - 'Geometry/MuonCommonData/data/gem11/TDR_BaseLine/gem11.xml', - 'Geometry/MuonCommonData/data/gem21/TDR_BaseLine/gem21.xml', - 'Geometry/MuonCommonData/data/csc/2015/v1/csc.xml', - 'Geometry/MuonCommonData/data/mfshield/2026/v1/mfshield.xml', - 'Geometry/MuonCommonData/data/me0/TDR_BaseLine/me0.xml', - 'Geometry/ForwardCommonData/data/forwardshield/2015/v1/forwardshield.xml', - 'Geometry/ForwardCommonData/data/brmrotations.xml', - 'Geometry/ForwardCommonData/data/PostLS2/brm.xml', - 'Geometry/ForwardCommonData/data/zdcmaterials.xml', - 'Geometry/ForwardCommonData/data/lumimaterials.xml', - 'Geometry/ForwardCommonData/data/zdcrotations.xml', - 'Geometry/ForwardCommonData/data/lumirotations.xml', - 'Geometry/ForwardCommonData/data/zdc.xml', - 'Geometry/ForwardCommonData/data/zdclumi.xml', - 'Geometry/ForwardCommonData/data/cmszdc.xml', - )+ - cms.vstring( - 'Geometry/MuonCommonData/data/muonNumbering/TDR_BaseLine/muonNumbering.xml', - 'Geometry/EcalSimData/data/PhaseII/ecalsens.xml', - 'Geometry/HcalCommonData/data/hcalsens/HGCal/hcalsenspmf.xml', - 'Geometry/HcalSimData/data/hf.xml', - 'Geometry/HcalSimData/data/hfpmt.xml', - 'Geometry/HcalSimData/data/hffibrebundle.xml', - 'Geometry/HcalSimData/data/CaloUtil.xml', - 'Geometry/HGCalSimData/data/hgcsensv6.xml', - 'Geometry/HGCalSimData/data/hgccons.xml', - 'Geometry/HGCalSimData/data/hgcProdCuts.xml', - 'Geometry/MuonSimData/data/PhaseII/ME0EtaPart/muonSens.xml', - 'Geometry/DTGeometryBuilder/data/dtSpecsFilter.xml', - 'Geometry/CSCGeometryBuilder/data/cscSpecsFilter.xml', - 'Geometry/CSCGeometryBuilder/data/cscSpecs.xml', - 'Geometry/RPCGeometryBuilder/data/PhaseII/RPCSpecs.xml', - 'Geometry/GEMGeometryBuilder/data/v7/GEMSpecsFilter.xml', - 'Geometry/GEMGeometryBuilder/data/v7/GEMSpecs.xml', - 'Geometry/ForwardCommonData/data/brmsens.xml', - 'Geometry/ForwardSimData/data/zdcsens.xml', - 'Geometry/HcalSimData/data/HcalProdCuts.xml', - 'Geometry/EcalSimData/data/EcalProdCuts.xml', - 'Geometry/MuonSimData/data/PhaseII/muonProdCuts.xml', - 'Geometry/ForwardSimData/data/zdcProdCuts.xml', - 'Geometry/ForwardSimData/data/ForwardShieldProdCuts.xml', - 'Geometry/CMSCommonData/data/FieldParameters.xml', - ), - rootNodeName = cms.string('cms:OCMS') -) diff --git a/Geometry/HGCalCommonData/python/testHGCV8XML_cfi.py b/Geometry/HGCalCommonData/python/testHGCV8XML_cfi.py deleted file mode 100644 index 8a1ba3ec7a489..0000000000000 --- a/Geometry/HGCalCommonData/python/testHGCV8XML_cfi.py +++ /dev/null @@ -1,120 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -# This config was generated automatically using generate2026Geometry.py -# If you notice a mistake, please update the generating script, not just this config - -XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", - geomXMLFiles = cms.vstring( - 'Geometry/CMSCommonData/data/materials.xml', - 'Geometry/CMSCommonData/data/rotations.xml', - 'Geometry/CMSCommonData/data/extend/v2/cmsextent.xml', - 'Geometry/CMSCommonData/data/cms/2026/v1/cms.xml', - 'Geometry/CMSCommonData/data/eta3/etaMax.xml', - 'Geometry/CMSCommonData/data/cmsMother.xml', - 'Geometry/CMSCommonData/data/cmsTracker.xml', - 'Geometry/CMSCommonData/data/caloBase/2026/v1/caloBase.xml', - 'Geometry/CMSCommonData/data/cmsCalo.xml', - 'Geometry/CMSCommonData/data/muonBase/2026/v2/muonBase.xml', - 'Geometry/CMSCommonData/data/cmsMuon.xml', - 'Geometry/CMSCommonData/data/mgnt.xml', - 'Geometry/CMSCommonData/data/beampipe/2026/v1/beampipe.xml', - 'Geometry/CMSCommonData/data/cmsBeam/2026/v1/cmsBeam.xml', - 'Geometry/CMSCommonData/data/muonMB.xml', - 'Geometry/CMSCommonData/data/muonMagnet.xml', - 'Geometry/CMSCommonData/data/cavern/2017/v2/cavern.xml', - 'Geometry/CMSCommonData/data/cavernData/2017/v1/cavernData.xml', - 'Geometry/CMSCommonData/data/cavernFloor/2017/v1/cavernFloor.xml', - 'Geometry/TrackerCommonData/data/PhaseII/trackerParameters.xml', - 'Geometry/TrackerCommonData/data/pixfwdCommon.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker404/pixfwd.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker404/pixbar.xml', - 'Geometry/TrackerCommonData/data/trackermaterial.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker404/otst.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker404/tracker.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker404/pixel.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker404/trackerbar.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker404/trackerfwd.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker404/trackerStructureTopology.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker404/pixelStructureTopology.xml', - 'Geometry/TrackerSimData/data/PhaseII/TiltedTracker404/trackersens.xml', - 'Geometry/TrackerSimData/data/PhaseII/TiltedTracker404/pixelsens.xml', - 'Geometry/TrackerRecoData/data/PhaseII/TiltedTracker404/trackerRecoMaterial.xml', - 'Geometry/TrackerSimData/data/PhaseII/TiltedTracker404/trackerProdCuts.xml', - 'Geometry/TrackerSimData/data/PhaseII/TiltedTracker404/pixelProdCuts.xml', - 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', - 'Geometry/EcalCommonData/data/ectkcable.xml', - 'Geometry/EcalCommonData/data/eregalgo/2026/v1/eregalgo.xml', - 'Geometry/EcalCommonData/data/ebalgo.xml', - 'Geometry/EcalCommonData/data/ebcon.xml', - 'Geometry/EcalCommonData/data/ebrot.xml', - 'Geometry/EcalCommonData/data/eecon.xml', - 'Geometry/EcalCommonData/data/escon/2026/v1/escon.xml', - 'Geometry/EcalCommonData/data/esalgo/2026/v1/esalgo.xml', - 'Geometry/HcalCommonData/data/hcalrotations.xml', - 'Geometry/HcalCommonData/data/hcal/HGCal/hcalalgo.xml', - 'Geometry/HcalCommonData/data/hcalbarrelalgo.xml', - 'Geometry/HcalCommonData/data/hcalendcap/SSAbsorber/hcalendcapalgo.xml', - 'Geometry/HcalCommonData/data/hcalouteralgo.xml', - 'Geometry/HcalCommonData/data/hcalforwardalgo.xml', - 'Geometry/HcalCommonData/data/hcalSimNumbering/2026/hcalSimNumbering.xml', - 'Geometry/HcalCommonData/data/hcalRecNumbering/2026/hcalRecNumbering.xml', - 'Geometry/HcalCommonData/data/average/hcalforwardmaterial.xml', - 'Geometry/HGCalCommonData/data/hgcal/v8/hgcal.xml', - 'Geometry/HGCalCommonData/data/hgcalEE/v8/hgcalEE.xml', - 'Geometry/HGCalCommonData/data/hgcalHEsil/v8/hgcalHEsil.xml', - 'Geometry/HGCalCommonData/data/hgcalwafer/v8/hgcalwafer.xml', - 'Geometry/HGCalCommonData/data/hgcalCons/v8/hgcalCons.xml', - 'Geometry/MuonCommonData/data/mbCommon/2017/v2/mbCommon.xml', - 'Geometry/MuonCommonData/data/mb1/2015/v1/mb1.xml', - 'Geometry/MuonCommonData/data/mb2/2015/v1/mb2.xml', - 'Geometry/MuonCommonData/data/mb3/2015/v1/mb3.xml', - 'Geometry/MuonCommonData/data/mb4/2015/v1/mb4.xml', - 'Geometry/MuonCommonData/data/muonYoke/2021/v2/muonYoke.xml', - 'Geometry/MuonCommonData/data/mf/2026/v2/mf.xml', - 'Geometry/MuonCommonData/data/rpcf/2026/v1/rpcf.xml', - 'Geometry/MuonCommonData/data/gemf/TDR_BaseLine/gemf.xml', - 'Geometry/MuonCommonData/data/gem11/TDR_BaseLine/gem11.xml', - 'Geometry/MuonCommonData/data/gem21/TDR_Dev/gem21.xml', - 'Geometry/MuonCommonData/data/csc/2015/v1/csc.xml', - 'Geometry/MuonCommonData/data/mfshield/2026/v1/mfshield.xml', - 'Geometry/MuonCommonData/data/me0/TDR_Dev/me0.xml', - 'Geometry/ForwardCommonData/data/forwardshield/2017/v1/forwardshield.xml', - 'Geometry/ForwardCommonData/data/brmrotations.xml', - 'Geometry/ForwardCommonData/data/PostLS2/brm.xml', - 'Geometry/ForwardCommonData/data/zdcmaterials.xml', - 'Geometry/ForwardCommonData/data/lumimaterials.xml', - 'Geometry/ForwardCommonData/data/zdcrotations.xml', - 'Geometry/ForwardCommonData/data/lumirotations.xml', - 'Geometry/ForwardCommonData/data/zdc.xml', - 'Geometry/ForwardCommonData/data/zdclumi.xml', - 'Geometry/ForwardCommonData/data/cmszdc.xml', - )+ - cms.vstring( - 'Geometry/MuonCommonData/data/muonNumbering/TDR_DeV/muonNumbering.xml', - 'Geometry/EcalSimData/data/PhaseII/ecalsens.xml', - 'Geometry/HcalCommonData/data/hcalsens/HGCal/hcalsenspmf.xml', - 'Geometry/HcalSimData/data/hf.xml', - 'Geometry/HcalSimData/data/hfpmt.xml', - 'Geometry/HcalSimData/data/hffibrebundle.xml', - 'Geometry/HcalSimData/data/CaloUtil.xml', - 'Geometry/HGCalSimData/data/hgcsensv8.xml', - 'Geometry/HGCalSimData/data/hgccons.xml', - 'Geometry/HGCalSimData/data/hgcProdCuts.xml', - 'Geometry/MuonSimData/data/PhaseII/ME0EtaPart/muonSens.xml', - 'Geometry/DTGeometryBuilder/data/dtSpecsFilter.xml', - 'Geometry/CSCGeometryBuilder/data/cscSpecsFilter.xml', - 'Geometry/CSCGeometryBuilder/data/cscSpecs.xml', - 'Geometry/RPCGeometryBuilder/data/PhaseII/RPCSpecs.xml', - 'Geometry/GEMGeometryBuilder/data/v7/GEMSpecsFilter.xml', - 'Geometry/GEMGeometryBuilder/data/v7/GEMSpecs.xml', - 'Geometry/ForwardCommonData/data/brmsens.xml', - 'Geometry/ForwardSimData/data/zdcsens.xml', - 'Geometry/HcalSimData/data/HcalProdCuts.xml', - 'Geometry/EcalSimData/data/EcalProdCuts.xml', - 'Geometry/MuonSimData/data/PhaseII/muonProdCuts.xml', - 'Geometry/ForwardSimData/data/zdcProdCuts.xml', - 'Geometry/ForwardSimData/data/ForwardShieldProdCuts.xml', - 'Geometry/CMSCommonData/data/FieldParameters.xml', - ), - rootNodeName = cms.string('cms:OCMS') -) diff --git a/Geometry/HGCalCommonData/python/testHGCV8_cff.py b/Geometry/HGCalCommonData/python/testHGCV8_cff.py deleted file mode 100644 index c53d03755ec60..0000000000000 --- a/Geometry/HGCalCommonData/python/testHGCV8_cff.py +++ /dev/null @@ -1,53 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from Geometry.HGCalCommonData.testHGCV8XML_cfi import * -from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi import * -from SLHCUpgradeSimulations.Geometry.fakeConditions_phase2TkT6_cff import * -from Geometry.HcalCommonData.hcalDDConstants_cff import * -from Geometry.HGCalCommonData.hgcalV6ParametersInitialization_cfi import * -from Geometry.HGCalCommonData.hgcalV6NumberingInitialization_cfi import * - -# tracker -from Geometry.CommonTopologies.globalTrackingGeometry_cfi import * -from RecoTracker.GeometryESProducer.TrackerRecoGeometryESProducer_cfi import * -from Geometry.TrackerGeometryBuilder.trackerParameters_cfi import * -from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import * -from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import * -trackerGeometry.applyAlignment = cms.bool(False) - -# calo -from Geometry.CaloEventSetup.HGCalV6Topology_cfi import * -from Geometry.HGCalGeometry.HGCalV6GeometryESProducer_cfi import * -from Geometry.CaloEventSetup.CaloTopology_cfi import * -from Geometry.CaloEventSetup.CaloGeometryBuilder_cfi import * -CaloGeometryBuilder = cms.ESProducer("CaloGeometryBuilder", - SelectedCalos = cms.vstring("HCAL" , - "ZDC" , - "EcalBarrel" , - "TOWER" , - "HGCalEESensitive" , - "HGCalHESiliconSensitive" - ) -) -from Geometry.EcalAlgo.EcalBarrelGeometry_cfi import * -from Geometry.HcalEventSetup.HcalGeometry_cfi import * -from Geometry.HcalEventSetup.CaloTowerGeometry_cfi import * -from Geometry.HcalEventSetup.CaloTowerTopology_cfi import * -from Geometry.HcalCommonData.hcalDDDRecConstants_cfi import * -from Geometry.HcalEventSetup.hcalTopologyIdeal_cfi import * -from Geometry.CaloEventSetup.EcalTrigTowerConstituents_cfi import * -from Geometry.EcalMapping.EcalMapping_cfi import * -from Geometry.EcalMapping.EcalMappingRecord_cfi import * - -# muon -from Geometry.MuonNumbering.muonNumberingInitialization_cfi import * -from RecoMuon.DetLayers.muonDetLayerGeometry_cfi import * -from Geometry.GEMGeometryBuilder.gemGeometry_cfi import * -from Geometry.GEMGeometryBuilder.me0Geometry_cfi import * -from Geometry.CSCGeometryBuilder.idealForDigiCscGeometry_cff import * -from Geometry.DTGeometryBuilder.idealForDigiDtGeometry_cff import * - -# forward -from Geometry.ForwardGeometry.ForwardGeometry_cfi import * -from Geometry.HGCalCommonData.fastTimeNumberingInitialization_cfi import * -from Geometry.HGCalCommonData.fastTimeParametersInitialization_cfi import * diff --git a/Geometry/HGCalCommonData/python/testHGCV9XML_cfi.py b/Geometry/HGCalCommonData/python/testHGCV9XML_cfi.py deleted file mode 100644 index 696624068b895..0000000000000 --- a/Geometry/HGCalCommonData/python/testHGCV9XML_cfi.py +++ /dev/null @@ -1,29 +0,0 @@ - -import FWCore.ParameterSet.Config as cms - -XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", - geomXMLFiles = cms.vstring( - 'Geometry/CMSCommonData/data/materials.xml', - 'Geometry/CMSCommonData/data/rotations.xml', - 'Geometry/CMSCommonData/data/extend/cmsextent.xml', - 'Geometry/CMSCommonData/data/cms/2019/v1/cms.xml', - 'Geometry/CMSCommonData/data/eta3/etaMax.xml', - 'Geometry/CMSCommonData/data/cmsMother.xml', - 'Geometry/CMSCommonData/data/caloBase/2026/v1/caloBase.xml', - 'Geometry/CMSCommonData/data/cmsCalo.xml', - 'Geometry/HGCalCommonData/data/hgcalMaterial/v1/hgcalMaterial.xml', - 'Geometry/HGCalCommonData/data/hgcal/v9/hgcal.xml', - 'Geometry/HGCalCommonData/data/hgcalEE/v9/hgcalEE.xml', - 'Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcalHEsil.xml', - 'Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcalHEmix.xml', - 'Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml', - 'Geometry/HGCalCommonData/data/hgcalcell/v9/hgcalcell.xml', - 'Geometry/HGCalCommonData/data/hgcalCons/v9/hgcalCons.xml', - 'Geometry/HGCalSimData/data/hgcsensv9.xml', - 'Geometry/HGCalSimData/data/hgcProdCutsv9.xml', - 'Geometry/CMSCommonData/data/FieldParameters.xml', - ), - rootNodeName = cms.string('cms:OCMS') -) - - diff --git a/Geometry/HGCalCommonData/python/testHGCalModuleAlgoXML_cfi.py b/Geometry/HGCalCommonData/python/testHGCalModuleAlgoXML_cfi.py deleted file mode 100644 index 3b117c37b626c..0000000000000 --- a/Geometry/HGCalCommonData/python/testHGCalModuleAlgoXML_cfi.py +++ /dev/null @@ -1,18 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", - geomXMLFiles = cms.vstring( - 'Geometry/CMSCommonData/data/materials.xml', - 'Geometry/CMSCommonData/data/rotations.xml', - 'Geometry/CMSCommonData/data/extend/cmsextent.xml', - 'Geometry/CMSCommonData/data/cms/2019/v1/cms.xml', - 'Geometry/CMSCommonData/data/eta3/etaMax.xml', - 'Geometry/CMSCommonData/data/cmsMother.xml', - 'Geometry/CMSCommonData/data/caloBase/2026/v1/caloBase.xml', - 'Geometry/CMSCommonData/data/cmsCalo.xml', - 'Geometry/HGCalCommonData/data/hgcal/v7/hgcal.xml', - 'Geometry/HGCalCommonData/data/hgcalwafer/v7/hgcalwafer.xml', - 'Geometry/HGCalCommonData/data/hgcalEE/v7/hgcalEE.xml', - ), - rootNodeName = cms.string('cms:OCMS') -) diff --git a/Geometry/HGCalCommonData/python/testHGCalModuleXML_cfi.py b/Geometry/HGCalCommonData/python/testHGCalModuleXML_cfi.py deleted file mode 100644 index 3cf8deab87550..0000000000000 --- a/Geometry/HGCalCommonData/python/testHGCalModuleXML_cfi.py +++ /dev/null @@ -1,18 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", - geomXMLFiles = cms.vstring( - 'Geometry/CMSCommonData/data/materials.xml', - 'Geometry/CMSCommonData/data/rotations.xml', - 'Geometry/CMSCommonData/data/extend/cmsextent.xml', - 'Geometry/CMSCommonData/data/cms/2019/v1/cms.xml', - 'Geometry/CMSCommonData/data/eta3/etaMax.xml', - 'Geometry/CMSCommonData/data/cmsMother.xml', - 'Geometry/CMSCommonData/data/caloBase/2026/v1/caloBase.xml', - 'Geometry/CMSCommonData/data/cmsCalo.xml', - 'Geometry/HGCalCommonData/data/hgcal/v8/hgcal.xml', - 'Geometry/HGCalCommonData/data/hgcalwafer/v8/hgcalwafer.xml', - 'Geometry/HGCalCommonData/data/hgcalEE/v8/hgcalEE.xml', - ), - rootNodeName = cms.string('cms:OCMS') -) diff --git a/Geometry/HGCalCommonData/python/testHGCalXML_cfi.py b/Geometry/HGCalCommonData/python/testHGCalXML_cfi.py deleted file mode 100644 index a1affc140313f..0000000000000 --- a/Geometry/HGCalCommonData/python/testHGCalXML_cfi.py +++ /dev/null @@ -1,117 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -# This config was generated automatically using generate2026Geometry.py -# If you notice a mistake, please update the generating script, not just this config - -XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", - geomXMLFiles = cms.vstring( - 'Geometry/CMSCommonData/data/materials.xml', - 'Geometry/CMSCommonData/data/rotations.xml', - 'Geometry/CMSCommonData/data/extend/cmsextent.xml', - 'Geometry/CMSCommonData/data/cms/2019/v1/cms.xml', - 'Geometry/CMSCommonData/data/eta3/etaMax.xml', - 'Geometry/CMSCommonData/data/cmsMother.xml', - 'Geometry/CMSCommonData/data/cmsTracker.xml', - 'Geometry/CMSCommonData/data/caloBase/2026/v1/caloBase.xml', - 'Geometry/CMSCommonData/data/cmsCalo.xml', - 'Geometry/CMSCommonData/data/muonBase/2026/v1/muonBase.xml', - 'Geometry/CMSCommonData/data/cmsMuon.xml', - 'Geometry/CMSCommonData/data/mgnt.xml', - 'Geometry/CMSCommonData/data/beampipe/2026/v1/beampipe.xml', - 'Geometry/CMSCommonData/data/cmsBeam/2026/v1/cmsBeam.xml', - 'Geometry/CMSCommonData/data/muonMB.xml', - 'Geometry/CMSCommonData/data/muonMagnet.xml', - 'Geometry/CMSCommonData/data/cavern.xml', - 'Geometry/TrackerCommonData/data/PhaseII/trackerParameters.xml', - 'Geometry/TrackerCommonData/data/pixfwdCommon.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/pixfwd.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/pixbar.xml', - 'Geometry/TrackerCommonData/data/trackermaterial.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/tracker.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/pixel.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/trackerbar.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/trackerfwd.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/trackerStructureTopology.xml', - 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker4026/pixelStructureTopology.xml', - 'Geometry/TrackerSimData/data/PhaseII/TiltedTracker4026/trackersens.xml', - 'Geometry/TrackerSimData/data/PhaseII/TiltedTracker4026/pixelsens.xml', - 'Geometry/TrackerRecoData/data/PhaseII/TiltedTracker4026/trackerRecoMaterial.xml', - 'Geometry/TrackerSimData/data/PhaseII/TiltedTracker4026/trackerProdCuts.xml', - 'Geometry/TrackerSimData/data/PhaseII/TiltedTracker4026/pixelProdCuts.xml', - 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', - 'Geometry/EcalCommonData/data/ectkcable.xml', - 'Geometry/EcalCommonData/data/eregalgo/2026/v1/eregalgo.xml', - 'Geometry/EcalCommonData/data/ebalgo.xml', - 'Geometry/EcalCommonData/data/ebcon.xml', - 'Geometry/EcalCommonData/data/ebrot.xml', - 'Geometry/EcalCommonData/data/eecon.xml', - 'Geometry/EcalCommonData/data/escon/2026/v1/escon.xml', - 'Geometry/EcalCommonData/data/esalgo/2026/v1/esalgo.xml', - 'Geometry/HcalCommonData/data/hcalrotations.xml', - 'Geometry/HcalCommonData/data/hcal/HGCal/hcalalgo.xml', - 'Geometry/HcalCommonData/data/hcalbarrelalgo.xml', - 'Geometry/HcalCommonData/data/hcalendcap/HGCal/hcalendcapalgo.xml', - 'Geometry/HcalCommonData/data/hcalouteralgo.xml', - 'Geometry/HcalCommonData/data/hcalforwardalgo.xml', - 'Geometry/HcalCommonData/data/hcalSimNumbering/2026/hcalSimNumbering.xml', - 'Geometry/HcalCommonData/data/hcalRecNumbering/2026/hcalRecNumbering.xml', - 'Geometry/HcalCommonData/data/average/hcalforwardmaterial.xml', - 'Geometry/HGCalCommonData/data/hgcal/v7/hgcal.xml', - 'Geometry/HGCalCommonData/data/hgcalEE/v7/hgcalEE.xml', - 'Geometry/HGCalCommonData/data/hgcalHEsil/v7/hgcalHEsil.xml', - 'Geometry/HGCalCommonData/data/hgcalwafer/v7/hgcalwafer.xml', - 'Geometry/HGCalCommonData/data/hgcalCons/v7/hgcalCons.xml', - 'Geometry/MuonCommonData/data/mbCommon/2015/v1/mbCommon.xml', - 'Geometry/MuonCommonData/data/mb1/2015/v1/mb1.xml', - 'Geometry/MuonCommonData/data/mb2/2015/v1/mb2.xml', - 'Geometry/MuonCommonData/data/mb3/2015/v1/mb3.xml', - 'Geometry/MuonCommonData/data/mb4/2015/v1/mb4.xml', - 'Geometry/MuonCommonData/data/muonYoke/2021/v2/muonYoke.xml', - 'Geometry/MuonCommonData/data/mf/2026/v1/mf.xml', - 'Geometry/MuonCommonData/data/rpcf/2026/v1/rpcf.xml', - 'Geometry/MuonCommonData/data/gemf/TDR_BaseLine/gemf.xml', - 'Geometry/MuonCommonData/data/gem11/TDR_BaseLine/gem11.xml', - 'Geometry/MuonCommonData/data/gem21/TDR_BaseLine/gem21.xml', - 'Geometry/MuonCommonData/data/csc/2015/v1/csc.xml', - 'Geometry/MuonCommonData/data/mfshield/2026/v1/mfshield.xml', - 'Geometry/MuonCommonData/data/me0/TDR_BaseLine/me0.xml', - 'Geometry/ForwardCommonData/data/forwardshield/2015/v1/forwardshield.xml', - 'Geometry/ForwardCommonData/data/brmrotations.xml', - 'Geometry/ForwardCommonData/data/PostLS2/brm.xml', - 'Geometry/ForwardCommonData/data/zdcmaterials.xml', - 'Geometry/ForwardCommonData/data/lumimaterials.xml', - 'Geometry/ForwardCommonData/data/zdcrotations.xml', - 'Geometry/ForwardCommonData/data/lumirotations.xml', - 'Geometry/ForwardCommonData/data/zdc.xml', - 'Geometry/ForwardCommonData/data/zdclumi.xml', - 'Geometry/ForwardCommonData/data/cmszdc.xml', - )+ - cms.vstring( - 'Geometry/MuonCommonData/data/muonNumbering/TDR_BaseLine/muonNumbering.xml', - 'Geometry/EcalSimData/data/PhaseII/ecalsens.xml', - 'Geometry/HcalCommonData/data/hcalsens/HGCal/hcalsenspmf.xml', - 'Geometry/HcalSimData/data/hf.xml', - 'Geometry/HcalSimData/data/hfpmt.xml', - 'Geometry/HcalSimData/data/hffibrebundle.xml', - 'Geometry/HcalSimData/data/CaloUtil.xml', - 'Geometry/HGCalSimData/data/hgcsensv6.xml', - 'Geometry/HGCalSimData/data/hgccons.xml', - 'Geometry/HGCalSimData/data/hgcProdCuts.xml', - 'Geometry/MuonSimData/data/PhaseII/ME0EtaPart/muonSens.xml', - 'Geometry/DTGeometryBuilder/data/dtSpecsFilter.xml', - 'Geometry/CSCGeometryBuilder/data/cscSpecsFilter.xml', - 'Geometry/CSCGeometryBuilder/data/cscSpecs.xml', - 'Geometry/RPCGeometryBuilder/data/PhaseII/RPCSpecs.xml', - 'Geometry/GEMGeometryBuilder/data/v7/GEMSpecsFilter.xml', - 'Geometry/GEMGeometryBuilder/data/v7/GEMSpecs.xml', - 'Geometry/ForwardCommonData/data/brmsens.xml', - 'Geometry/ForwardSimData/data/zdcsens.xml', - 'Geometry/HcalSimData/data/HcalProdCuts.xml', - 'Geometry/EcalSimData/data/EcalProdCuts.xml', - 'Geometry/MuonSimData/data/PhaseII/muonProdCuts.xml', - 'Geometry/ForwardSimData/data/zdcProdCuts.xml', - 'Geometry/ForwardSimData/data/ForwardShieldProdCuts.xml', - 'Geometry/CMSCommonData/data/FieldParameters.xml', - ), - rootNodeName = cms.string('cms:OCMS') -) diff --git a/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc b/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc index 10286d481690c..aefdcf260eee3 100644 --- a/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc +++ b/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc @@ -7,6 +7,7 @@ #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/Exception.h" +#include "Geometry/HGCalCommonData/interface/HGCalGeomParameters.h" #include "Geometry/HGCalCommonData/interface/HGCalGeomTools.h" #include "Geometry/HGCalCommonData/interface/HGCalGeometryMode.h" #include "Geometry/HGCalCommonData/interface/HGCalTypes.h" @@ -15,6 +16,7 @@ #include "Geometry/HGCalCommonData/interface/HGCalWaferType.h" #include +#include #include #include #include @@ -588,7 +590,7 @@ bool HGCalDDDConstants::isValidTrap(int layer, int irad, int iphi) const { const auto& indx = getIndex(layer, true); if (indx.first < 0) return false; - return ((irad >= hgpar_->iradMinBH_[indx.first]) && (irad <= hgpar_->iradMaxBH_[indx.first]) && (iphi > 0) && + return ((irad >= hgpar_->iradMinBH_[indx.first]) && (irad <= (hgpar_->iradMaxBH_[indx.first] + 1)) && (iphi > 0) && (iphi <= hgpar_->scintCells(layer))); } @@ -949,11 +951,14 @@ double HGCalDDDConstants::mouseBite(bool reco) const { } int HGCalDDDConstants::numberCells(bool reco) const { - int cells(0); - unsigned int nlayer = (reco) ? hgpar_->depth_.size() : hgpar_->layer_.size(); - for (unsigned k = 0; k < nlayer; ++k) { - std::vector ncells = numberCells(((reco) ? hgpar_->depth_[k] : hgpar_->layer_[k]), reco); - cells = std::accumulate(ncells.begin(), ncells.end(), cells); + int cells = + (tileTrapezoid() && (hgpar_->waferMaskMode_ == HGCalGeomParameters::scintillatorFile)) ? tileCount(0, -1) : 0; + if (cells == 0) { + unsigned int nlayer = (reco) ? hgpar_->depth_.size() : hgpar_->layer_.size(); + for (unsigned k = 0; k < nlayer; ++k) { + std::vector ncells = numberCells(((reco) ? hgpar_->depth_[k] : hgpar_->layer_[k]), reco); + cells = std::accumulate(ncells.begin(), ncells.end(), cells); + } } return cells; } @@ -1111,6 +1116,32 @@ std::pair HGCalDDDConstants::simToReco(int cell, int lay, int mod, boo } } +int HGCalDDDConstants::tileCount(int layer, int ring) const { + int laymin(layer), laymax(layer), ringmin(ring), ringmax(ring), kount(0); + if (layer == 0) { + laymin = hgpar_->firstLayer_; + laymax = lastLayer(true); + } + for (int lay = laymin; lay <= laymax; ++lay) { + if (ring < 0) { + int ll = lay - hgpar_->firstLayer_; + ringmin = hgpar_->tileRingRange_[ll].first; + ringmax = hgpar_->tileRingRange_[ll].second; + } + for (int rin = ringmin; rin <= ringmax; ++rin) { + int indx = HGCalTileIndex::tileIndex(lay, rin + 1, 0); + auto itr = hgpar_->tileInfoMap_.find(indx); + if (itr != hgpar_->tileInfoMap_.end()) { + for (int k = 0; k < 4; ++k) { + std::bitset<24> b(itr->second.hex[k]); + kount += b.count(); + } + } + } + } + return (3 * kount); +} + int HGCalDDDConstants::waferFromCopy(int copy) const { const int ncopies = hgpar_->waferCopy_.size(); int wafer(ncopies); diff --git a/Geometry/HGCalCommonData/src/HGCalGeomParameters.cc b/Geometry/HGCalCommonData/src/HGCalGeomParameters.cc index 75019519e3495..a5805a254d1b7 100644 --- a/Geometry/HGCalCommonData/src/HGCalGeomParameters.cc +++ b/Geometry/HGCalCommonData/src/HGCalGeomParameters.cc @@ -1173,6 +1173,11 @@ void HGCalGeomParameters::loadSpecParsHexagon(const DDFilteredView& fv, php.layerGroupM_ = dbl_to_int(getDDDArray("GroupingZMid", sv, 0)); php.layerGroupO_ = dbl_to_int(getDDDArray("GroupingZOut", sv, 0)); php.slopeMin_ = getDDDArray("Slope", sv, 1); + const auto& dummy2 = getDDDArray("LayerOffset", sv, 0); + if (!dummy2.empty()) + php.layerOffset_ = dummy2[0]; + else + php.layerOffset_ = 0; // Wafer size std::string attribute = "Volume"; @@ -1223,6 +1228,14 @@ void HGCalGeomParameters::loadSpecParsHexagon(const cms::DDFilteredView& fv, php.cellSize_ = fv.get >(sdTag3, "CellSize"); rescale(php.cellSize_, HGCalParameters::k_ScaleFromDD4hepToG4); + // Layer Offset + const auto& dummy2 = fv.get >(sdTag1, "LayerOffset"); + if (!dummy2.empty()) { + php.layerOffset_ = dummy2[0]; + } else { + php.layerOffset_ = 0; + } + loadSpecParsHexagon(php); } @@ -1242,6 +1255,8 @@ void HGCalGeomParameters::loadSpecParsHexagon(const HGCalParameters& php) { edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: " << php.cellSize_.size() << " cells of sizes:"; for (unsigned int k = 0; k < php.cellSize_.size(); ++k) edm::LogVerbatim("HGCalGeom") << " [" << k << "] " << php.cellSize_[k]; + edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: First Layer " << php.firstLayer_ << " and layer offset " + << php.layerOffset_; #endif } @@ -2109,7 +2124,7 @@ void HGCalGeomParameters::loadCellTrapezoid(HGCalParameters& php) { // Minimum and maximum radius index for each layer for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k) { php.iradMinBH_.emplace_back(1 + php.tileRingRange_[k].first); - php.iradMaxBH_.emplace_back(php.tileRingRange_[k].second); + php.iradMaxBH_.emplace_back(1 + php.tileRingRange_[k].second); #ifdef EDM_ML_DEBUG int kk = php.scintType(php.firstLayer_ + (int)(k)); edm::LogVerbatim("HGCalGeom") << "New Layer " << k << " Type " << kk << " Low edge " << php.iradMinBH_.back() diff --git a/Geometry/HGCalCommonData/test/python/dumpAHcalModuleDD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpAHcalModuleDD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpAHcalModuleDD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpAHcalModuleDD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/dumpExtendedHGCalGeometryDD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpExtendedHGCalGeometryDD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpExtendedHGCalGeometryDD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpExtendedHGCalGeometryDD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalCellDD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalCellDD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpHGCalCellDD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpHGCalCellDD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalEEDD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalEEDD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpHGCalEEDD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpHGCalEEDD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalEEFileDD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalEEFileDD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpHGCalEEFileDD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpHGCalEEFileDD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalEEV15DD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalEEV15DD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpHGCalEEV15DD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpHGCalEEV15DD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalEEV16DD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalEEV16DD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpHGCalEEV16DD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpHGCalEEV16DD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalGeometryDD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalGeometryDD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpHGCalGeometryDD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpHGCalGeometryDD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalHEmixDD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalHEmixDD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpHGCalHEmixDD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpHGCalHEmixDD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalHEmixFileDD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalHEmixFileDD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpHGCalHEmixFileDD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpHGCalHEmixFileDD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalHEmixV15DD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalHEmixV15DD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpHGCalHEmixV15DD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpHGCalHEmixV15DD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalHEmixV16DD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalHEmixV16DD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpHGCalHEmixV16DD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpHGCalHEmixV16DD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalHEsilDD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalHEsilDD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpHGCalHEsilDD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpHGCalHEsilDD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalHEsilV15DD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalHEsilV15DD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpHGCalHEsilV15DD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpHGCalHEsilV15DD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalHEsilV16DD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalHEsilV16DD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpHGCalHEsilV16DD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpHGCalHEsilV16DD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalModuleAlgoDD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalModuleAlgoDD4Hep_cfg.py deleted file mode 100644 index 541743169000e..0000000000000 --- a/Geometry/HGCalCommonData/test/python/dumpHGCalModuleAlgoDD4Hep_cfg.py +++ /dev/null @@ -1,25 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("DDHGCalModuleAlgoTest") - -process.load('FWCore.MessageService.MessageLogger_cfi') -process.source = cms.Source("EmptySource") -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(1) - ) - -process.MessageLogger.cerr.FwkReport.reportEvery = 5 -if hasattr(process,'MessageLogger'): - process.MessageLogger.HGCalGeom=dict() - -process.DDDetectorESProducer = cms.ESSource("DDDetectorESProducer", - confGeomXMLFiles = cms.FileInPath('Geometry/HGCalCommonData/data/dd4hep/cms-test-ddhgcalModuleAlgo-algorithm.xml'), - appendToDataLabel = cms.string('DDHGCalModuleAlgo') - ) - -process.testDump = cms.EDAnalyzer("DDTestDumpFile", - outputFileName = cms.untracked.string('hgcalModuleAlgoDD4hep.root'), - DDDetector = cms.ESInputTag('','DDHGCalModuleAlgo') - ) - -process.p = cms.Path(process.testDump) diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalModuleAlgoDDD_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalModuleAlgoDDD_cfg.py deleted file mode 100644 index bf94e9b959d3a..0000000000000 --- a/Geometry/HGCalCommonData/test/python/dumpHGCalModuleAlgoDDD_cfg.py +++ /dev/null @@ -1,26 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("DUMP") -process.load("Geometry.HGCalCommonData.testHGCalModuleAlgoXML_cfi") -process.load('FWCore.MessageService.MessageLogger_cfi') - -if 'MessageLogger' in process.__dict__: - process.MessageLogger.G4cerr=dict() - process.MessageLogger.G4cout=dict() - process.MessageLogger.HGCalGeom=dict() - -process.source = cms.Source("EmptySource") - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(1) -) - -process.add_(cms.ESProducer("TGeoMgrFromDdd", - verbose = cms.untracked.bool(False), - level = cms.untracked.int32(14) -)) - -process.dump = cms.EDAnalyzer("DumpSimGeometry", - outputFileName = cms.untracked.string('hgcalModuleAlgoDDD.root')) - -process.p = cms.Path(process.dump) diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalModuleDD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalModuleDD4Hep_cfg.py deleted file mode 100644 index f10f7cf1ddf55..0000000000000 --- a/Geometry/HGCalCommonData/test/python/dumpHGCalModuleDD4Hep_cfg.py +++ /dev/null @@ -1,25 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("DDHGCalModuleTest") - -process.load('FWCore.MessageService.MessageLogger_cfi') -process.source = cms.Source("EmptySource") -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(1) - ) - -process.MessageLogger.cerr.FwkReport.reportEvery = 5 -if hasattr(process,'MessageLogger'): - process.MessageLogger.HGCalGeom=dict() - -process.DDDetectorESProducer = cms.ESSource("DDDetectorESProducer", - confGeomXMLFiles = cms.FileInPath('Geometry/HGCalCommonData/data/dd4hep/cms-test-ddhgcalModule-algorithm.xml'), - appendToDataLabel = cms.string('DDHGCalModule') - ) - -process.testDump = cms.EDAnalyzer("DDTestDumpFile", - outputFileName = cms.untracked.string('hgcalModuleDD4hep.root'), - DDDetector = cms.ESInputTag('','DDHGCalModule') - ) - -process.p = cms.Path(process.testDump) diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalModuleDDD_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalModuleDDD_cfg.py deleted file mode 100644 index 8f5158b24dd60..0000000000000 --- a/Geometry/HGCalCommonData/test/python/dumpHGCalModuleDDD_cfg.py +++ /dev/null @@ -1,26 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("DUMP") -process.load("Geometry.HGCalCommonData.testHGCalModuleXML_cfi") -process.load('FWCore.MessageService.MessageLogger_cfi') - -if 'MessageLogger' in process.__dict__: - process.MessageLogger.G4cerr=dict() - process.MessageLogger.G4cout=dict() - process.MessageLogger.HGCalGeom=dict() - -process.source = cms.Source("EmptySource") - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(1) -) - -process.add_(cms.ESProducer("TGeoMgrFromDdd", - verbose = cms.untracked.bool(False), - level = cms.untracked.int32(14) -)) - -process.dump = cms.EDAnalyzer("DumpSimGeometry", - outputFileName = cms.untracked.string('hgcalModuleDDD.root')) - -process.p = cms.Path(process.dump) diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalNoTaperEndcapDD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalNoTaperEndcapDD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpHGCalNoTaperEndcapDD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpHGCalNoTaperEndcapDD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalTBModuleDD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalTBModuleDD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpHGCalTBModuleDD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpHGCalTBModuleDD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalTBModuleXDD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalTBModuleXDD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpHGCalTBModuleXDD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpHGCalTBModuleXDD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalWafer8DD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalWafer8DD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpHGCalWafer8DD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpHGCalWafer8DD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalWaferAlgoDD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalWaferAlgoDD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpHGCalWaferAlgoDD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpHGCalWaferAlgoDD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalWaferDD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalWaferDD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpHGCalWaferDD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpHGCalWaferDD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalWaferFDD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalWaferFDD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpHGCalWaferFDD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpHGCalWaferFDD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/dumpHGCalWaferPDD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/dumpHGCalWaferPDD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/dumpHGCalWaferPDD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/dumpHGCalWaferPDD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/runHGCalD77DD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/runHGCalD77DD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/runHGCalD77DD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/runHGCalD77DD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/runHGCalWafer8DD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/runHGCalWafer8DD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/runHGCalWafer8DD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/runHGCalWafer8DD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/testFastTimeNumbering_cfg.py b/Geometry/HGCalCommonData/test/python/testFastTimeNumbering_cfg.py deleted file mode 100644 index 06c610fdb3db7..0000000000000 --- a/Geometry/HGCalCommonData/test/python/testFastTimeNumbering_cfg.py +++ /dev/null @@ -1,52 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("PROD") -process.load("SimGeneral.HepPDTESSource.pdt_cfi") -process.load("Geometry.HGCalCommonData.testFastTimeXML_cfi") -process.load("Geometry.HGCalCommonData.fastTimeParametersInitialization_cfi") -process.load("Geometry.HGCalCommonData.fastTimeNumberingInitialization_cfi") - -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - enable = cms.untracked.bool(False) - ), - cout = cms.untracked.PSet( - HGCalGeom = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - default = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - enable = cms.untracked.bool(True), - threshold = cms.untracked.string('DEBUG') - ), - debugModules = cms.untracked.vstring('*') -) - -process.load("IOMC.RandomEngine.IOMC_cff") -process.RandomNumberGeneratorService.generator.initialSeed = 456789 - -process.source = cms.Source("EmptySource") - -process.generator = cms.EDProducer("FlatRandomEGunProducer", - PGunParameters = cms.PSet( - PartID = cms.vint32(14), - MinEta = cms.double(-3.5), - MaxEta = cms.double(3.5), - MinPhi = cms.double(-3.14159265359), - MaxPhi = cms.double(3.14159265359), - MinE = cms.double(9.99), - MaxE = cms.double(10.01) - ), - AddAntiParticle = cms.bool(False), - Verbosity = cms.untracked.int32(0), - firstRun = cms.untracked.uint32(1) -) - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(1) -) - -process.prod = cms.EDAnalyzer("FastTimeNumberingTester") - -process.p1 = cms.Path(process.generator*process.prod) diff --git a/Geometry/HGCalCommonData/test/python/testHGCalParametersDD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/testHGCalParametersDD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/testHGCalParametersDD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/testHGCalParametersDD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/testHGCalParametersV16DD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/testHGCalParametersV16DD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/testHGCalParametersV16DD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/testHGCalParametersV16DD4hep_cfg.py diff --git a/Geometry/HGCalCommonData/test/python/testHGCalTBParametersDD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/testHGCalTBParametersDD4hep_cfg.py similarity index 100% rename from Geometry/HGCalCommonData/test/python/testHGCalTBParametersDD4Hep_cfg.py rename to Geometry/HGCalCommonData/test/python/testHGCalTBParametersDD4hep_cfg.py diff --git a/Geometry/HGCalGeometry/src/HGCalGeometryLoader.cc b/Geometry/HGCalGeometry/src/HGCalGeometryLoader.cc index 2357f1fd8f888..16719ac17ac4c 100644 --- a/Geometry/HGCalGeometry/src/HGCalGeometryLoader.cc +++ b/Geometry/HGCalGeometry/src/HGCalGeometryLoader.cc @@ -182,7 +182,7 @@ HGCalGeometry* HGCalGeometryLoader::build(const HGCalTopology& topology) { geom->sortDetIds(); if (counter != numberExpected) { - if (test) { + if (topology.tileTrapezoid()) { edm::LogVerbatim("HGCalGeom") << "Inconsistent # of cells: expected " << numberExpected << ":" << numberOfCells << " , inited " << counter; } else { diff --git a/Geometry/HGCalGeometry/test/HGCalValidScintTest.cc b/Geometry/HGCalGeometry/test/HGCalValidScintTest.cc new file mode 100644 index 0000000000000..4ee801f2243a8 --- /dev/null +++ b/Geometry/HGCalGeometry/test/HGCalValidScintTest.cc @@ -0,0 +1,108 @@ +#include +#include +#include +#include +#include + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" + +#include "Geometry/Records/interface/IdealGeometryRecord.h" +#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" +#include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" +#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" +#include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" +#include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" + +class HGCalValidScintTest : public edm::one::EDAnalyzer<> { +public: + explicit HGCalValidScintTest(const edm::ParameterSet&); + ~HGCalValidScintTest() override = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + void analyze(edm::Event const& iEvent, edm::EventSetup const&) override; + +private: + const edm::ESGetToken geomToken_; + struct layerInfo { + int ringMin, ringMax; + double rMin, rMax; + layerInfo(int minR = 100, double rMn = 0, int maxR = 0, double rMx = 0) + : ringMin(minR), ringMax(maxR), rMin(rMn), rMax(rMx){}; + }; +}; + +HGCalValidScintTest::HGCalValidScintTest(const edm::ParameterSet& iC) + : geomToken_(esConsumes(edm::ESInputTag{"", "HGCalHEScintillatorSensitive"})) {} + +void HGCalValidScintTest::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + descriptions.add("hgcalValidScintTest", desc); +} + +void HGCalValidScintTest::analyze(const edm::Event&, const edm::EventSetup& iSetup) { + const auto& geom = &iSetup.getData(geomToken_); + DetId::Detector det = DetId::HGCalHSc; + edm::LogVerbatim("HGCalGeom") << "Perform test for HGCalHEScintillatorSensitive Detector " << det << " Mode " + << geom->topology().dddConstants().geomMode(); + + int firstLayer = geom->topology().dddConstants().firstLayer(); + int lastLayer = geom->topology().dddConstants().lastLayer(true); + const std::vector& ids = geom->getValidDetIds(); + edm::LogVerbatim("HGCalGeom") << "doTest: " << ids.size() << " valid ids for " << geom->cellElement(); + + int zside(1); + std::map layerMap; + for (int layer = firstLayer; layer <= lastLayer; ++layer) { + std::vector > done; + for (auto const& id : ids) { + HGCScintillatorDetId hid(id); + if ((hid.zside() != zside) || (hid.layer() != layer)) + continue; + std::pair ring = std::make_pair(hid.ring(), 0); + if (std::find(done.begin(), done.end(), ring) != done.end()) + continue; + done.emplace_back(ring); + edm::LogVerbatim("HGCalGeom") << "Corners for " << hid; + + const auto cor = geom->getNewCorners(id); + std::ostringstream st1; + for (unsigned int k = 0; k < cor.size(); ++k) + st1 << " [" << k << "] " << std::setprecision(4) << cor[k]; + edm::LogVerbatim("HGCalGeom") << st1.str(); + + double r = cor[0].perp(); + auto itr = layerMap.find(layer); + if (itr == layerMap.end()) { + layerInfo info; + info.ringMin = info.ringMax = ring.first; + info.rMin = info.rMax = r; + layerMap[layer] = info; + } else { + layerInfo info = itr->second; + if (info.ringMin > ring.first) { + info.ringMin = ring.first; + info.rMin = r; + } else if (info.ringMax < ring.first) { + info.ringMax = ring.first; + info.rMax = r; + } + layerMap[layer] = info; + } + } + } + edm::LogVerbatim("HGCalGeom") << "\n\nSummary of " << layerMap.size() << " Scintillator layers"; + for (auto itr = layerMap.begin(); itr != layerMap.end(); ++itr) + edm::LogVerbatim("HGCalGeom") << "Layer " << itr->first << " lowest Ring " << (itr->second).ringMin << ":" + << (itr->second).rMin << " largest Ring " << (itr->second).ringMax << ":" + << (itr->second).rMax; +} + +//define this as a plug-in +DEFINE_FWK_MODULE(HGCalValidScintTest); diff --git a/Geometry/HGCalGeometry/test/python/testFastTimeGeometry_cfg.py b/Geometry/HGCalGeometry/test/python/testFastTimeGeometry_cfg.py deleted file mode 100644 index 2bf7448c1d8a6..0000000000000 --- a/Geometry/HGCalGeometry/test/python/testFastTimeGeometry_cfg.py +++ /dev/null @@ -1,61 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("PROD") -process.load("SimGeneral.HepPDTESSource.pdt_cfi") - -process.load("Geometry.HGCalCommonData.testFastTimeXML_cfi") -process.load("Geometry.HGCalCommonData.fastTimeParametersInitialization_cfi") -process.load("Geometry.HGCalCommonData.fastTimeNumberingInitialization_cfi") -process.load("Geometry.CaloEventSetup.FastTimeTopology_cfi") -process.load("Geometry.HGCalGeometry.FastTimeGeometryESProducer_cfi") - -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - enable = cms.untracked.bool(False) - ), - cout = cms.untracked.PSet( - HGCalGeom = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - default = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - enable = cms.untracked.bool(True), - threshold = cms.untracked.string('DEBUG') - ), - debugModules = cms.untracked.vstring('*') -) - -process.load("IOMC.RandomEngine.IOMC_cff") -process.RandomNumberGeneratorService.generator.initialSeed = 456789 - -process.source = cms.Source("EmptySource") - -process.generator = cms.EDProducer("FlatRandomEGunProducer", - PGunParameters = cms.PSet( - PartID = cms.vint32(14), - MinEta = cms.double(-3.5), - MaxEta = cms.double(3.5), - MinPhi = cms.double(-3.14159265359), - MaxPhi = cms.double(3.14159265359), - MinE = cms.double(9.99), - MaxE = cms.double(10.01) - ), - AddAntiParticle = cms.bool(False), - Verbosity = cms.untracked.int32(0), - firstRun = cms.untracked.uint32(1) -) - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(1) -) - -process.prodBar = cms.EDAnalyzer("FastTimeGeometryTester", - Detector = cms.string("FastTimeBarrel"), -) - -process.prodEnd = process.prodBar.clone( - Detector = "SFBX", -) - -process.p1 = cms.Path(process.generator*process.prodBar*process.prodEnd) diff --git a/Geometry/HGCalGeometry/test/python/testHGCalCellDumpDD4Hep_cfg.py b/Geometry/HGCalGeometry/test/python/testHGCalCellDumpDD4hep_cfg.py similarity index 100% rename from Geometry/HGCalGeometry/test/python/testHGCalCellDumpDD4Hep_cfg.py rename to Geometry/HGCalGeometry/test/python/testHGCalCellDumpDD4hep_cfg.py diff --git a/Geometry/HGCalGeometry/test/python/testHGCalValidScintTest_cfg.py b/Geometry/HGCalGeometry/test/python/testHGCalValidScintTest_cfg.py new file mode 100644 index 0000000000000..50b91187c4a1e --- /dev/null +++ b/Geometry/HGCalGeometry/test/python/testHGCalValidScintTest_cfg.py @@ -0,0 +1,39 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 +process = cms.Process('PROD',Phase2C11) + +process.load("SimGeneral.HepPDTESSource.pdt_cfi") +process.load("Configuration.Geometry.GeometryExtended2026D86Reco_cff") +process.load('FWCore.MessageService.MessageLogger_cfi') + +if hasattr(process,'MessageLogger'): + process.MessageLogger.HGCalGeom=dict() + +process.load("IOMC.RandomEngine.IOMC_cff") +process.RandomNumberGeneratorService.generator.initialSeed = 456789 + +process.source = cms.Source("EmptySource") + +process.generator = cms.EDProducer("FlatRandomEGunProducer", + PGunParameters = cms.PSet( + PartID = cms.vint32(14), + MinEta = cms.double(-3.5), + MaxEta = cms.double(3.5), + MinPhi = cms.double(-3.14159265359), + MaxPhi = cms.double(3.14159265359), + MinE = cms.double(9.99), + MaxE = cms.double(10.01) + ), + AddAntiParticle = cms.bool(False), + Verbosity = cms.untracked.int32(0), + firstRun = cms.untracked.uint32(1) +) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1) +) + +process.load("Geometry.HGCalGeometry.hgcalValidScintTest_cfi") + +process.p1 = cms.Path(process.generator*process.hgcalValidScintTest) diff --git a/Geometry/HGCalSimData/data/hgcProdCuts.xml b/Geometry/HGCalSimData/data/hgcProdCuts.xml deleted file mode 100644 index 4f5557aa006d4..0000000000000 --- a/Geometry/HGCalSimData/data/hgcProdCuts.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/Geometry/HGCalSimData/data/hgccons.xml b/Geometry/HGCalSimData/data/hgccons.xml deleted file mode 100644 index 8758e324969e7..0000000000000 --- a/Geometry/HGCalSimData/data/hgccons.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/Geometry/HGCalSimData/data/hgcsens.xml b/Geometry/HGCalSimData/data/hgcsens.xml deleted file mode 100644 index 5199c9a868896..0000000000000 --- a/Geometry/HGCalSimData/data/hgcsens.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/Geometry/HGCalSimData/data/hgcsensv6.xml b/Geometry/HGCalSimData/data/hgcsensv6.xml deleted file mode 100644 index c5f4fdb86c5b6..0000000000000 --- a/Geometry/HGCalSimData/data/hgcsensv6.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/Geometry/HGCalSimData/data/hgcsensv8.xml b/Geometry/HGCalSimData/data/hgcsensv8.xml deleted file mode 100644 index 0312b1d77421c..0000000000000 --- a/Geometry/HGCalSimData/data/hgcsensv8.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/Geometry/HcalCommonData/test/python/runHcalParametersFromDD4HepAnalyzer_cfg.py b/Geometry/HcalCommonData/test/python/runHcalParametersFromDD4hepAnalyzer_cfg.py similarity index 100% rename from Geometry/HcalCommonData/test/python/runHcalParametersFromDD4HepAnalyzer_cfg.py rename to Geometry/HcalCommonData/test/python/runHcalParametersFromDD4hepAnalyzer_cfg.py diff --git a/Geometry/HcalCommonData/test/python/runHcalSimParametersDD4Hep_cfg.py b/Geometry/HcalCommonData/test/python/runHcalSimParametersDD4hep_cfg.py similarity index 100% rename from Geometry/HcalCommonData/test/python/runHcalSimParametersDD4Hep_cfg.py rename to Geometry/HcalCommonData/test/python/runHcalSimParametersDD4hep_cfg.py diff --git a/Geometry/HcalTestBeamData/test/python/testHcalTBParameterDD4Hep_cfg.py b/Geometry/HcalTestBeamData/test/python/testHcalTBParameterDD4hep_cfg.py similarity index 100% rename from Geometry/HcalTestBeamData/test/python/testHcalTBParameterDD4Hep_cfg.py rename to Geometry/HcalTestBeamData/test/python/testHcalTBParameterDD4hep_cfg.py diff --git a/Geometry/HcalTowerAlgo/test/runHcalCellDumpDD4Hep_cfg.py b/Geometry/HcalTowerAlgo/test/runHcalCellDumpDD4hep_cfg.py similarity index 100% rename from Geometry/HcalTowerAlgo/test/runHcalCellDumpDD4Hep_cfg.py rename to Geometry/HcalTowerAlgo/test/runHcalCellDumpDD4hep_cfg.py diff --git a/Geometry/MTDCommonData/data/etl/v7/etl.xml b/Geometry/MTDCommonData/data/etl/v7/etl.xml new file mode 100644 index 0000000000000..00dcc84950457 --- /dev/null +++ b/Geometry/MTDCommonData/data/etl/v7/etl.xml @@ -0,0 +1,4012 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1, 7, 18, 33, 50, 69, 90, 112, 136, 161, 186, 207, 227, 247, 266, + 285, 305, 325, 349, 374, 398, 421, 443, 463, 481, 497, 510, 517 + + + + 1, 8, 21, 37, 55, 75, 97, 120, 144, 169, 193, 213, 233, 252, 271, + 291, 311, 332, 357, 382, 406, 428, 449, 468, 485, 500, 511, 517 + + + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 6, 7, 8, 8, 7, 6, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + + + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 6, 7, 8, 8, 7, 6, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + + + + 1, 10, 23, 39, 57, 77, 99, 122, 146, 171, 194, 214, 234, 254, 273, + 293, 313, 335, 360, 384, 407, 430, 451, 470, 487, 501, 511, 514 + + + + 1, 4, 14, 28, 45, 64, 85, 107, 130, 154, 179, 201, 221, 241, 260, + 280, 300, 320, 343, 368, 392, 415, 437, 457, 475, 491, 504, 513 + + + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 6, 7, 7, 8, 7, 6, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + + + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 6, 7, 8, 7, 7, 6, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ([x_offset]), ([y_start_front]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X7]/2), ([y_start_front]+[DeltaY_ServiceModule]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+2*[DeltaY_ServiceModule]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+2*[DeltaY_ServiceModule]+[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid] +[ServiceHybrid_X6]/2), ([y_start_front]+3*[DeltaY_ServiceModule]+[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid] +[ServiceHybrid_X6]/2+[DeltaX_Service6_Service7]), ([y_start_front]+3*[DeltaY_ServiceModule]+[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+4*[DeltaY_ServiceModule]+[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+4*[DeltaY_ServiceModule]+2*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid] +[ServiceHybrid_X3]/2), ([y_start_front]+5*[DeltaY_ServiceModule]+2*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid] +[ServiceHybrid_X3]/2+[DeltaX_Service3_Service6]), ([y_start_front]+5*[DeltaY_ServiceModule]+2*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service6]+[DeltaX_Service6_Service7]), ([y_start_front]+5*[DeltaY_ServiceModule]+2*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+6*[DeltaY_ServiceModule]+2*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+6*[DeltaY_ServiceModule]+3*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X6]/2), ([y_start_front]+7*[DeltaY_ServiceModule]+3*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+8*[DeltaY_ServiceModule]+3*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+8*[DeltaY_ServiceModule]+4*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X6]/2), ([y_start_front]+9*[DeltaY_ServiceModule]+4*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X6]/2+[DeltaX_Service6_Service7]), ([y_start_front]+9*[DeltaY_ServiceModule]+4*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+10*[DeltaY_ServiceModule]+4*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+10*[DeltaY_ServiceModule]+5*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2), ([y_start_front]+11*[DeltaY_ServiceModule]+5*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service6]), ([y_start_front]+11*[DeltaY_ServiceModule]+5*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service6]+[ServiceHybrid_X6]+[DeltaX]+[DeltaX_Service6_Service7]), ([y_start_front]+11*[DeltaY_ServiceModule]+5*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+12*[DeltaY_ServiceModule]+5*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+12*[DeltaY_ServiceModule]+6*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2), ([y_start_front]+13*[DeltaY_ServiceModule]+6*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service6]), ([y_start_front]+13*[DeltaY_ServiceModule]+6*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service6]+[DeltaX_Service6_Service7]), ([y_start_front]+13*[DeltaY_ServiceModule]+6*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+14*[DeltaY_ServiceModule]+6*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+14*[DeltaY_ServiceModule]+7*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X6]/2), ([y_start_front]+15*[DeltaY_ServiceModule]+7*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+16*[DeltaY_ServiceModule]+7*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+16*[DeltaY_ServiceModule]+8*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X6]/2), ([y_start_front]+17*[DeltaY_ServiceModule]+8*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X6]/2+2*[ServiceHybrid_X6]+2*[DeltaX]+[DeltaX_Service6_Service7]), ([y_start_front]+17*[DeltaY_ServiceModule]+8*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+18*[DeltaY_ServiceModule]+8*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+18*[DeltaY_ServiceModule]+9*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2), ([y_start_front]+19*[DeltaY_ServiceModule]+9*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[ServiceHybrid_X3]+[DeltaX]+[DeltaX_Service3_Service6]), ([y_start_front]+19*[DeltaY_ServiceModule]+9*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[ServiceHybrid_X3]+[DeltaX]+[DeltaX_Service3_Service6]+[DeltaX_Service6_Service7]), ([y_start_front]+19*[DeltaY_ServiceModule]+9*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+2*[SensorModule_X]+2*[DeltaX]), ([y_start_front]+20*[DeltaY_ServiceModule]+9*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]+5*[SensorModule_X]+5*[DeltaX]), ([y_start_front]+20*[DeltaY_ServiceModule]+10*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]+6*[SensorModule_X]+6*[DeltaX]), ([y_start_front]+21*[DeltaY_ServiceModule]+10*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+6*[SensorModule_X]+6*[DeltaX]+[DeltaX_Service3_Service6]), ([y_start_front]+21*[DeltaY_ServiceModule]+10*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+6*[SensorModule_X]+6*[DeltaX]), ([y_start_front]+22*[DeltaY_ServiceModule]+10*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]+6*[SensorModule_X]+6*[DeltaX]), ([y_start_front]+22*[DeltaY_ServiceModule]+11*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ( [x_offset]+7*[SensorModule_X]+7*[DeltaX]), ([y_start_front]+23*[DeltaY_ServiceModule]+11*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ( [x_offset]+7*[SensorModule_X]+6*[DeltaX]+[DeltaX_Service3_Service6]), ([y_start_front]+23*[DeltaY_ServiceModule]+11*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+7*[SensorModule_X]+7*[DeltaX]), ([y_start_front]+24*[DeltaY_ServiceModule]+11*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]+7*[SensorModule_X]+7*[DeltaX]), ([y_start_front]+24*[DeltaY_ServiceModule]+12*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ( [x_offset]+8*[SensorModule_X]+8*[DeltaX]), ([y_start_front]+25*[DeltaY_ServiceModule]+12*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ( [x_offset]+8*[SensorModule_X]+8*[DeltaX]+[ServiceHybrid_X3]+[DeltaX]+[DeltaX_Service3_Service7]), ([y_start_front]+25*[DeltaY_ServiceModule]+12*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+8*[SensorModule_X]+8*[DeltaX]), ([y_start_front]+26*[DeltaY_ServiceModule]+12*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]+8*[SensorModule_X]+8*[DeltaX]), ([y_start_front]+26*[DeltaY_ServiceModule]+13*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]+9*[SensorModule_X]+9*[DeltaX]), ([y_start_front]+27*[DeltaY_ServiceModule]+13*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+9*[SensorModule_X]+9*[DeltaX]+[ServiceHybrid_X3]+[DeltaX]+[DeltaX_Service3_Service6]), ([y_start_front]+27*[DeltaY_ServiceModule]+13*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+9*[SensorModule_X]+9*[DeltaX]+[ServiceHybrid_X3]+[DeltaX]+[DeltaX_Service3_Service6]+[DeltaX_Service6_Service7]), ([y_start_front]+27*[DeltaY_ServiceModule]+13*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+8*[SensorModule_X]+8*[DeltaX]), ([y_start_front]+28*[DeltaY_ServiceModule]+13*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]+8*[SensorModule_X]+8*[DeltaX]), ([y_start_front]+28*[DeltaY_ServiceModule]+14*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ( [x_offset]+8*[SensorModule_X]+8*[DeltaX]), ([y_start_front]+29*[DeltaY_ServiceModule]+14*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ( [x_offset]+8*[SensorModule_X]+8*[DeltaX]+[ServiceHybrid_X3]+[DeltaX]+[DeltaX_Service3_Service7]), ([y_start_front]+29*[DeltaY_ServiceModule]+14*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+7*[SensorModule_X]+7*[DeltaX]), ([y_start_front]+30*[DeltaY_ServiceModule]+14*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]+7*[SensorModule_X]+7*[DeltaX]), ([y_start_front]+30*[DeltaY_ServiceModule]+15*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ( [x_offset]+7*[SensorModule_X]+7*[DeltaX]), ([y_start_front]+31*[DeltaY_ServiceModule]+15*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ( [x_offset]+7*[SensorModule_X]+6*[DeltaX]+[DeltaX_Service3_Service6]), ([y_start_front]+31*[DeltaY_ServiceModule]+15*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+6*[SensorModule_X]+6*[DeltaX]), ([y_start_front]+32*[DeltaY_ServiceModule]+15*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]+6*[SensorModule_X]+6*[DeltaX]), ([y_start_front]+32*[DeltaY_ServiceModule]+16*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]+6*[SensorModule_X]+6*[DeltaX]), ([y_start_front]+33*[DeltaY_ServiceModule]+16*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+6*[SensorModule_X]+6*[DeltaX]+[DeltaX_Service3_Service6]), ([y_start_front]+33*[DeltaY_ServiceModule]+16*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+5*[SensorModule_X]+5*[DeltaX]), ([y_start_front]+34*[DeltaY_ServiceModule]+16*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]+2*[SensorModule_X]+2*[DeltaX]), ([y_start_front]+34*[DeltaY_ServiceModule]+17*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2), ([y_start_front]+35*[DeltaY_ServiceModule]+17*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[ServiceHybrid_X3]+[DeltaX]+[DeltaX_Service3_Service6]), ([y_start_front]+35*[DeltaY_ServiceModule]+17*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[ServiceHybrid_X3]+[DeltaX]+[DeltaX_Service3_Service6]+[DeltaX_Service6_Service7]), ([y_start_front]+35*[DeltaY_ServiceModule]+17*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+36*[DeltaY_ServiceModule]+17*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+36*[DeltaY_ServiceModule]+18*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X6]/2), ([y_start_front]+37*[DeltaY_ServiceModule]+18*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X6]/2+2*[ServiceHybrid_X6]+2*[DeltaX]+[DeltaX_Service6_Service7]), ([y_start_front]+37*[DeltaY_ServiceModule]+18*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+38*[DeltaY_ServiceModule]+18*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+38*[DeltaY_ServiceModule]+19*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X6]/2), ([y_start_front]+39*[DeltaY_ServiceModule]+19*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+40*[DeltaY_ServiceModule]+19*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+40*[DeltaY_ServiceModule]+20*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2), ([y_start_front]+41*[DeltaY_ServiceModule]+20*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service6]), ([y_start_front]+41*[DeltaY_ServiceModule]+20*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service6]+[DeltaX_Service6_Service7]), ([y_start_front]+41*[DeltaY_ServiceModule]+20*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+42*[DeltaY_ServiceModule]+20*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+42*[DeltaY_ServiceModule]+21*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2), ([y_start_front]+43*[DeltaY_ServiceModule]+21*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service6]), ([y_start_front]+43*[DeltaY_ServiceModule]+21*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service6]+[ServiceHybrid_X6]+[DeltaX]+[DeltaX_Service6_Service7]), ([y_start_front]+43*[DeltaY_ServiceModule]+21*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+44*[DeltaY_ServiceModule]+21*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+44*[DeltaY_ServiceModule]+22*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X6]/2), ([y_start_front]+45*[DeltaY_ServiceModule]+22*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X6]/2+[DeltaX_Service6_Service7]), ([y_start_front]+45*[DeltaY_ServiceModule]+22*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+46*[DeltaY_ServiceModule]+22*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+46*[DeltaY_ServiceModule]+23*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X6]/2), ([y_start_front]+47*[DeltaY_ServiceModule]+23*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+48*[DeltaY_ServiceModule]+23*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+48*[DeltaY_ServiceModule]+24*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2), ([y_start_front]+49*[DeltaY_ServiceModule]+24*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service6]), ([y_start_front]+49*[DeltaY_ServiceModule]+24*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service6]+[DeltaX_Service6_Service7]), ([y_start_front]+49*[DeltaY_ServiceModule]+24*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+50*[DeltaY_ServiceModule]+24*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+50*[DeltaY_ServiceModule]+25*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X6]/2), ([y_start_front]+51*[DeltaY_ServiceModule]+25*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X6]/2+[DeltaX_Service6_Service7]), ([y_start_front]+51*[DeltaY_ServiceModule]+25*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+52*[DeltaY_ServiceModule]+25*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+52*[DeltaY_ServiceModule]+26*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X7]/2), ([y_start_front]+53*[DeltaY_ServiceModule]+26*[SensorModule_Y]), ([ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_front]+54*[DeltaY_ServiceModule]+26*[SensorModule_Y]), ([SensorModule_translation_z]) + + + + + + + + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2), ([y_start_back]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-[DeltaY_ServiceModule]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-[DeltaY_ServiceModule]-[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2), ([y_start_back]-2*[DeltaY_ServiceModule]-[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service7]), ([y_start_back]-2*[DeltaY_ServiceModule]-[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-3*[DeltaY_ServiceModule]-[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-3*[DeltaY_ServiceModule]-2*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X7]/2), ([y_start_back]-4*[DeltaY_ServiceModule]-2*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-5*[DeltaY_ServiceModule]-2*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-5*[DeltaY_ServiceModule]-3*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2), ([y_start_back]-6*[DeltaY_ServiceModule]-3*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service7]), ([y_start_back]-6*[DeltaY_ServiceModule]-3*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-7*[DeltaY_ServiceModule]-3*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-7*[DeltaY_ServiceModule]-4*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X6]/2), ([y_start_back]-8*[DeltaY_ServiceModule]-4*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X6]/2+[ServiceHybrid_X6]+[DeltaX]+[DeltaX_Service6_Service7]), ([y_start_back]-8*[DeltaY_ServiceModule]-4*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-9*[DeltaY_ServiceModule]-4*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-9*[DeltaY_ServiceModule]-5*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X7]/2), ([y_start_back]-10*[DeltaY_ServiceModule]-5*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-11*[DeltaY_ServiceModule]-5*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-11*[DeltaY_ServiceModule]-6*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2), ([y_start_back]-12*[DeltaY_ServiceModule]-6*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service6]), ([y_start_back]-12*[DeltaY_ServiceModule]-6*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service6]+[ServiceHybrid_X6]+[DeltaX]+[DeltaX_Service6_Service7]), ([y_start_back]-12*[DeltaY_ServiceModule]-6*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-13*[DeltaY_ServiceModule]-6*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-13*[DeltaY_ServiceModule]-7*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2), ([y_start_back]-14*[DeltaY_ServiceModule]-7*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service6]), ([y_start_back]-14*[DeltaY_ServiceModule]-7*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service6]+[DeltaX_Service6_Service7]), ([y_start_back]-14*[DeltaY_ServiceModule]-7*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-15*[DeltaY_ServiceModule]-7*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-15*[DeltaY_ServiceModule]-8*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2), ([y_start_back]-16*[DeltaY_ServiceModule]-8*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[ServiceHybrid_X3]+[DeltaX]+[DeltaX_Service3_Service6]), ([y_start_back]-16*[DeltaY_ServiceModule]-8*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-17*[DeltaY_ServiceModule]-8*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-17*[DeltaY_ServiceModule]-9*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2), ([y_start_back]-18*[DeltaY_ServiceModule]-9*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[ServiceHybrid_X3]+[DeltaX]+[DeltaX_Service3_Service6]), ([y_start_back]-18*[DeltaY_ServiceModule]-9*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[ServiceHybrid_X3]+[DeltaX]+[DeltaX_Service3_Service6]+[ServiceHybrid_X6]+[DeltaX]+[DeltaX_Service6_Service7]), ([y_start_back]-18*[DeltaY_ServiceModule]-9*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-19*[DeltaY_ServiceModule]-9*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]+3*[SensorModule_X]+3*[DeltaX]), ([y_start_back]-19*[DeltaY_ServiceModule]-10*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]+4*[SensorModule_X]+4*[DeltaX]), ([y_start_back]-20*[DeltaY_ServiceModule]-10*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+4*[SensorModule_X]+4*[DeltaX]+2*[ServiceHybrid_X3]+2*[DeltaX]+[DeltaX_Service3_Service7]), ([y_start_back]-20*[DeltaY_ServiceModule]-10*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ( [x_offset]+4*[SensorModule_X]+4*[DeltaX]), ([y_start_back]-21*[DeltaY_ServiceModule]-10*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]+6*[SensorModule_X]+6*[DeltaX]), ([y_start_back]-21*[DeltaY_ServiceModule]-11*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]+7*[SensorModule_X]+7*[DeltaX]), ([y_start_back]-22*[DeltaY_ServiceModule]-11*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+7*[SensorModule_X]+7*[DeltaX]+[ServiceHybrid_X3]+[DeltaX]+[DeltaX_Service3_Service7]), ([y_start_back]-22*[DeltaY_ServiceModule]-11*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ( [x_offset]+6*[SensorModule_X]+6*[DeltaX]), ([y_start_back]-23*[DeltaY_ServiceModule]-11*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([SensorModule_X]/2+7*[SensorModule_X]+7*[DeltaX]), ([y_start_back]-23*[DeltaY_ServiceModule]-12*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]+8*[SensorModule_X]+8*[DeltaX]), ([y_start_back]-24*[DeltaY_ServiceModule]-12*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+8*[SensorModule_X]+8*[DeltaX]+[ServiceHybrid_X3]+[DeltaX]+[DeltaX_Service3_Service7]), ([y_start_back]-24*[DeltaY_ServiceModule]-12*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+7*[SensorModule_X]+7*[DeltaX]), ([y_start_back]-25*[DeltaY_ServiceModule]-12*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]+7*[SensorModule_X]+7*[DeltaX]), ([y_start_back]-25*[DeltaY_ServiceModule]-13*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ( [x_offset]+8*[SensorModule_X]+8*[DeltaX]), ([y_start_back]-26*[DeltaY_ServiceModule]-13*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ( [x_offset]+8*[SensorModule_X]+8*[DeltaX]+[ServiceHybrid_X3]+[DeltaX]+[DeltaX_Service3_Service7]), ([y_start_back]-26*[DeltaY_ServiceModule]-13*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+8*[SensorModule_X]+8*[DeltaX]), ([y_start_back]-27*[DeltaY_ServiceModule]-13*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]+8*[SensorModule_X]+8*[DeltaX]), ([y_start_back]-27*[DeltaY_ServiceModule]-14*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ( [x_offset]+8*[SensorModule_X]+8*[DeltaX]), ([y_start_back]-28*[DeltaY_ServiceModule]-14*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ( [x_offset]+8*[SensorModule_X]+8*[DeltaX]+[ServiceHybrid_X3]+[DeltaX]+[DeltaX_Service3_Service7]), ([y_start_back]-28*[DeltaY_ServiceModule]-14*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+7*[SensorModule_X]+7*[DeltaX]), ([y_start_back]-29*[DeltaY_ServiceModule]-14*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]+7*[SensorModule_X]+7*[DeltaX]), ([y_start_back]-29*[DeltaY_ServiceModule]-15*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]+8*[SensorModule_X]+8*[DeltaX]), ([y_start_back]-30*[DeltaY_ServiceModule]-15*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+8*[SensorModule_X]+8*[DeltaX]+[ServiceHybrid_X3]+[DeltaX]+[DeltaX_Service3_Service7]), ([y_start_back]-30*[DeltaY_ServiceModule]-15*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([SensorModule_X]/2+7*[SensorModule_X]+7*[DeltaX]), ([y_start_back]-31*[DeltaY_ServiceModule]-15*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ( [x_offset]+6*[SensorModule_X]+6*[DeltaX]), ([y_start_back]-31*[DeltaY_ServiceModule]-16*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]+7*[SensorModule_X]+7*[DeltaX]), ([y_start_back]-32*[DeltaY_ServiceModule]-16*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+7*[SensorModule_X]+7*[DeltaX]+[ServiceHybrid_X3]+[DeltaX]+[DeltaX_Service3_Service7]), ([y_start_back]-32*[DeltaY_ServiceModule]-16*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+6*[SensorModule_X]+6*[DeltaX]), ([y_start_back]-33*[DeltaY_ServiceModule]-16*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ( [x_offset]+4*[SensorModule_X]+4*[DeltaX]), ([y_start_back]-33*[DeltaY_ServiceModule]-17*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]+4*[SensorModule_X]+4*[DeltaX]), ([y_start_back]-34*[DeltaY_ServiceModule]-17*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+4*[SensorModule_X]+4*[DeltaX]+2*[ServiceHybrid_X3]+2*[DeltaX]+[DeltaX_Service3_Service7]), ([y_start_back]-34*[DeltaY_ServiceModule]-17*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]+3*[SensorModule_X]+3*[DeltaX]), ([y_start_back]-35*[DeltaY_ServiceModule]-17*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-35*[DeltaY_ServiceModule]-18*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2), ([y_start_back]-36*[DeltaY_ServiceModule]-18*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[ServiceHybrid_X3]+[DeltaX]+[DeltaX_Service3_Service6]), ([y_start_back]-36*[DeltaY_ServiceModule]-18*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[ServiceHybrid_X3]+[DeltaX]+[DeltaX_Service3_Service6]+[ServiceHybrid_X6]+[DeltaX]+[DeltaX_Service6_Service7]), ([y_start_back]-36*[DeltaY_ServiceModule]-18*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-37*[DeltaY_ServiceModule]-18*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-37*[DeltaY_ServiceModule]-19*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2), ([y_start_back]-38*[DeltaY_ServiceModule]-19*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[ServiceHybrid_X3]+[DeltaX]+[DeltaX_Service3_Service6]), ([y_start_back]-38*[DeltaY_ServiceModule]-19*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-39*[DeltaY_ServiceModule]-19*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-39*[DeltaY_ServiceModule]-20*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2), ([y_start_back]-40*[DeltaY_ServiceModule]-20*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service6]), ([y_start_back]-40*[DeltaY_ServiceModule]-20*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service6]+[DeltaX_Service6_Service7]), ([y_start_back]-40*[DeltaY_ServiceModule]-20*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-41*[DeltaY_ServiceModule]-20*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-41*[DeltaY_ServiceModule]-21*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2), ([y_start_back]-42*[DeltaY_ServiceModule]-21*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service6]), ([y_start_back]-42*[DeltaY_ServiceModule]-21*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service6]+[ServiceHybrid_X6]+[DeltaX]+[DeltaX_Service6_Service7]), ([y_start_back]-42*[DeltaY_ServiceModule]-21*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-43*[DeltaY_ServiceModule]-21*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-43*[DeltaY_ServiceModule]-22*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X7]/2), ([y_start_back]-44*[DeltaY_ServiceModule]-22*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-45*[DeltaY_ServiceModule]-22*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-45*[DeltaY_ServiceModule]-23*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X6]/2), ([y_start_back]-46*[DeltaY_ServiceModule]-23*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X6]/2+[ServiceHybrid_X6]+[DeltaX]+[DeltaX_Service6_Service7]), ([y_start_back]-46*[DeltaY_ServiceModule]-23*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-47*[DeltaY_ServiceModule]-23*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-47*[DeltaY_ServiceModule]-24*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2), ([y_start_back]-48*[DeltaY_ServiceModule]-24*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service7]), ([y_start_back]-48*[DeltaY_ServiceModule]-24*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-49*[DeltaY_ServiceModule]-24*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-49*[DeltaY_ServiceModule]-25*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X7]/2), ([y_start_back]-50*[DeltaY_ServiceModule]-25*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-51*[DeltaY_ServiceModule]-25*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-51*[DeltaY_ServiceModule]-26*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2), ([y_start_back]-52*[DeltaY_ServiceModule]-26*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2+[DeltaX_Service3_Service7]), ([y_start_back]-52*[DeltaY_ServiceModule]-26*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-53*[DeltaY_ServiceModule]-26*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([x_offset]), ([y_start_back]-53*[DeltaY_ServiceModule]-27*[SensorModule_Y]), (-1*[SensorModule_translation_z]) + + + + + + + + + + + + + ([xoffset_servicehybrid]+[ServiceHybrid_X3]/2), ([y_start_back]-54*[DeltaY_ServiceModule]-27*[SensorModule_Y]), (-1*[ServiceHybrid_translation_z]) + + + + + + + + diff --git a/Geometry/MTDCommonData/data/mtdMaterial/v3/mtdMaterial.xml b/Geometry/MTDCommonData/data/mtdMaterial/v3/mtdMaterial.xml index 84dd49003f78d..ced33db8dd4f4 100644 --- a/Geometry/MTDCommonData/data/mtdMaterial/v3/mtdMaterial.xml +++ b/Geometry/MTDCommonData/data/mtdMaterial/v3/mtdMaterial.xml @@ -159,6 +159,28 @@ + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/Geometry/MuonNumbering/test/testConstantsFromDD4Hep_cfg.py b/Geometry/MuonNumbering/test/testConstantsFromDD4hep_cfg.py similarity index 100% rename from Geometry/MuonNumbering/test/testConstantsFromDD4Hep_cfg.py rename to Geometry/MuonNumbering/test/testConstantsFromDD4hep_cfg.py diff --git a/Geometry/MuonNumbering/test/testMuonOffsetDD4Hep_cfg.py b/Geometry/MuonNumbering/test/testMuonOffsetDD4hep_cfg.py similarity index 100% rename from Geometry/MuonNumbering/test/testMuonOffsetDD4Hep_cfg.py rename to Geometry/MuonNumbering/test/testMuonOffsetDD4hep_cfg.py diff --git a/Geometry/RPCGeometryBuilder/plugins/RPCGeometryESModule.cc b/Geometry/RPCGeometryBuilder/plugins/RPCGeometryESModule.cc index 610352ecdb7eb..839b463f042d7 100644 --- a/Geometry/RPCGeometryBuilder/plugins/RPCGeometryESModule.cc +++ b/Geometry/RPCGeometryBuilder/plugins/RPCGeometryESModule.cc @@ -4,7 +4,7 @@ Description: RPC GeometryESModule from DD & DD4hep DD4hep part added to the original old file (DD version) made by M. Maggi (INFN Bari) // -// Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osborne made for DTs (DD4HEP migration) +// Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osborne made for DTs (DD4hep migration) // Created: Fri, 20 Sep 2019 // Modified: Fri, 29 May 2020, following what Sunanda Banerjee made in PR #29842 PR #29943 and Ianna Osborne in PR #29954 */ @@ -79,7 +79,7 @@ std::unique_ptr RPCGeometryESModule::produce(const MuonGeometryReco RPCGeometryBuilder builder; return std::unique_ptr(builder.build(&(*cpv), mdc)); } else if (fromDD4hep_) { - edm::LogVerbatim("RPCGeoemtryESModule") << "(0) RPCGeometryESModule - DD4HEP "; + edm::LogVerbatim("RPCGeoemtryESModule") << "(0) RPCGeometryESModule - DD4hep "; edm::ESTransientHandle cpv = record.getTransientHandle(idealDD4hepGeomToken_); auto const& mdc = record.get(dddConstantsToken_); RPCGeometryBuilder builder; diff --git a/Geometry/RPCGeometryBuilder/plugins/RPCGeometryValidate.cc b/Geometry/RPCGeometryBuilder/plugins/RPCGeometryValidate.cc index 50eddebee9c41..415c1550614b3 100644 --- a/Geometry/RPCGeometryBuilder/plugins/RPCGeometryValidate.cc +++ b/Geometry/RPCGeometryBuilder/plugins/RPCGeometryValidate.cc @@ -4,7 +4,7 @@ Description: RPC GeometryValidate from DD & DD4hep // -// Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4HEP migration) +// Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4hep migration) // Created: Fri, 20 Sep 2019 */ diff --git a/Geometry/RPCGeometryBuilder/src/RPCGeometryBuilder.cc b/Geometry/RPCGeometryBuilder/src/RPCGeometryBuilder.cc index f6c8917db84a2..63a662e6eb007 100644 --- a/Geometry/RPCGeometryBuilder/src/RPCGeometryBuilder.cc +++ b/Geometry/RPCGeometryBuilder/src/RPCGeometryBuilder.cc @@ -4,7 +4,7 @@ Description: RPC Geometry builder from DD & DD4hep DD4hep part added to the original old file (DD version) made by M. Maggi (INFN Bari) // -// Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osborne made for DTs (DD4HEP migration) +// Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osborne made for DTs (DD4hep migration) // Created: Fri, 20 Sep 2019 // Modified: Fri, 29 May 2020, following what Sunanda Banerjee made in PR #29842 PR #29943 and Ianna Osborne in PR #29954 */ diff --git a/Geometry/RPCGeometryBuilder/src/RPCGeometryBuilder.h b/Geometry/RPCGeometryBuilder/src/RPCGeometryBuilder.h index 01a9998cd2e87..fad238a4c9806 100644 --- a/Geometry/RPCGeometryBuilder/src/RPCGeometryBuilder.h +++ b/Geometry/RPCGeometryBuilder/src/RPCGeometryBuilder.h @@ -6,7 +6,7 @@ Description: RPC Geometry builder from DD & DD4hep DD4hep part added to the original old file (DD version) made by M. Maggi (INFN Bari) // -// Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osborne made for DTs (DD4HEP migration) +// Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osborne made for DTs (DD4hep migration) // Created: Fri, 20 Sep 2019 // Modified: Fri, 29 May 2020, following what Sunanda Banerjee made in PR #29842 PR #29943 and Ianna Osborne in PR #29954 */ diff --git a/Geometry/TrackerCommonData/test/python/dumpTrackerDD4Hep_cfg.py b/Geometry/TrackerCommonData/test/python/dumpTrackerDD4hep_cfg.py similarity index 100% rename from Geometry/TrackerCommonData/test/python/dumpTrackerDD4Hep_cfg.py rename to Geometry/TrackerCommonData/test/python/dumpTrackerDD4hep_cfg.py diff --git a/Geometry/TrackerGeometryBuilder/test/ModuleInfo.cc b/Geometry/TrackerGeometryBuilder/test/ModuleInfo.cc index 33522e0ef4fb9..54ed55bad9e66 100644 --- a/Geometry/TrackerGeometryBuilder/test/ModuleInfo.cc +++ b/Geometry/TrackerGeometryBuilder/test/ModuleInfo.cc @@ -22,7 +22,6 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Utilities/interface/Exception.h" @@ -64,24 +63,25 @@ using namespace cms_rounding; class ModuleInfo : public edm::one::EDAnalyzer<> { public: explicit ModuleInfo(const edm::ParameterSet&); - ~ModuleInfo() override; - void beginJob() override {} void analyze(edm::Event const& iEvent, edm::EventSetup const&) override; - void endJob() override {} private: bool fromDDD_; bool printDDD_; double tolerance_; + edm::ESGetToken rDDToken_; + edm::ESGetToken pDDToken_; + edm::ESGetToken tTopoToken_; }; ModuleInfo::ModuleInfo(const edm::ParameterSet& ps) : fromDDD_(ps.getParameter("fromDDD")), printDDD_(ps.getUntrackedParameter("printDDD", true)), - tolerance_(ps.getUntrackedParameter("tolerance", 1.e-23)) {} - -ModuleInfo::~ModuleInfo() {} + tolerance_(ps.getUntrackedParameter("tolerance", 1.e-23)), + rDDToken_(esConsumes()), + pDDToken_(esConsumes()), + tTopoToken_(esConsumes()) {} // ------------ method called to produce the data ------------ void ModuleInfo::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { @@ -98,18 +98,14 @@ void ModuleInfo::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup // get the GeometricDet // - edm::ESHandle rDD; - iSetup.get().get(rDD); + auto const& rDD = iSetup.getData(rDDToken_); - edm::LogInfo("ModuleInfo") << " Top node is " << rDD.product() << " " << rDD.product()->name() << std::endl; - edm::LogInfo("ModuleInfo") << " And Contains Daughters: " << rDD.product()->deepComponents().size() << std::endl; + edm::LogInfo("ModuleInfo") << " Top node is " << &rDD << " " << rDD.name() << std::endl; + edm::LogInfo("ModuleInfo") << " And Contains Daughters: " << rDD.deepComponents().size() << std::endl; // //first instance tracking geometry - edm::ESHandle pDD; - iSetup.get().get(pDD); - edm::ESHandle tTopo_handle; - iSetup.get().get(tTopo_handle); - const TrackerTopology* tTopo = tTopo_handle.product(); + auto const& pDD = iSetup.getData(pDDToken_); + const TrackerTopology* tTopo = &iSetup.getData(tTopoToken_); // // counters @@ -149,7 +145,7 @@ void ModuleInfo::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup unsigned int tec_r6_rphiN = 0; unsigned int tec_r7_rphiN = 0; - std::vector modules = (*rDD).deepComponents(); + std::vector modules = rDD.deepComponents(); Output << "************************ List of modules with positions ************************" << std::endl; for (auto& module : modules) { @@ -401,7 +397,7 @@ void ModuleInfo::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup } // Local axes from Reco - const GeomDet* geomdet = pDD->idToDet(module->geographicalId()); + const GeomDet* geomdet = pDD.idToDet(module->geographicalId()); // Global Coordinates (i,j,k) LocalVector xLocal(1, 0, 0); LocalVector yLocal(0, 1, 0); diff --git a/Geometry/TrackerGeometryBuilder/test/TrackerDigiGeometryAnalyzer.cc b/Geometry/TrackerGeometryBuilder/test/TrackerDigiGeometryAnalyzer.cc index 88251f7f901c4..319d74308ae78 100644 --- a/Geometry/TrackerGeometryBuilder/test/TrackerDigiGeometryAnalyzer.cc +++ b/Geometry/TrackerGeometryBuilder/test/TrackerDigiGeometryAnalyzer.cc @@ -25,7 +25,6 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -55,22 +54,19 @@ class TrackerDigiGeometryAnalyzer : public edm::one::EDAnalyzer<> { public: explicit TrackerDigiGeometryAnalyzer(const edm::ParameterSet&); - ~TrackerDigiGeometryAnalyzer() override; - void beginJob() override {} void analyze(edm::Event const& iEvent, edm::EventSetup const&) override; - void endJob() override {} private: void analyseTrapezoidal(const GeomDetUnit& det); void checkRotation(const GeomDetUnit& det); void checkTopology(const GeomDetUnit& det); std::ostream& cylindrical(std::ostream& os, const GlobalPoint& gp) const; -}; -TrackerDigiGeometryAnalyzer::TrackerDigiGeometryAnalyzer(const edm::ParameterSet& iConfig) {} + edm::ESGetToken pDDToken_; +}; -TrackerDigiGeometryAnalyzer::~TrackerDigiGeometryAnalyzer() {} +TrackerDigiGeometryAnalyzer::TrackerDigiGeometryAnalyzer(const edm::ParameterSet& iConfig) : pDDToken_(esConsumes()) {} // ------------ method called to produce the data ------------ void TrackerDigiGeometryAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { @@ -78,13 +74,12 @@ void TrackerDigiGeometryAnalyzer::analyze(const edm::Event& iEvent, const edm::E // // get the TrackerGeom // - edm::ESHandle pDD; - iSetup.get().get(pDD); - PRINT("TrackerDigiGeometryAnalyzer") << " Geometry node for TrackerGeom is " << &(*pDD) << '\n'; - PRINT("TrackerDigiGeometryAnalyzer") << " I have " << pDD->detUnits().size() << " detectors" << '\n'; - PRINT("TrackerDigiGeometryAnalyzer") << " I have " << pDD->detTypes().size() << " types" << '\n'; + auto const& pDD = iSetup.getData(pDDToken_); + PRINT("TrackerDigiGeometryAnalyzer") << " Geometry node for TrackerGeom is " << &pDD << '\n'; + PRINT("TrackerDigiGeometryAnalyzer") << " I have " << pDD.detUnits().size() << " detectors" << '\n'; + PRINT("TrackerDigiGeometryAnalyzer") << " I have " << pDD.detTypes().size() << " types" << '\n'; - for (auto const& it : pDD->detUnits()) { + for (auto const& it : pDD.detUnits()) { if (dynamic_cast((it)) != nullptr) { const BoundPlane& p = (dynamic_cast((it)))->specificSurface(); PRINT("TrackerDigiGeometryAnalyzer") << it->geographicalId() << " RadLeng Pixel " << p.mediumProperties().radLen() @@ -100,7 +95,7 @@ void TrackerDigiGeometryAnalyzer::analyze(const edm::Event& iEvent, const edm::E //analyseTrapezoidal(*it); } - for (auto const& it : pDD->detTypes()) { + for (auto const& it : pDD.detTypes()) { if (dynamic_cast((it)) != nullptr) { const PixelTopology& p = (dynamic_cast((it)))->specificTopology(); PRINT("TrackerDigiGeometryAnalyzer") << " PIXEL Det " // << it->geographicalId() diff --git a/Geometry/TrackerGeometryBuilder/test/TrackerMapTool.cc b/Geometry/TrackerGeometryBuilder/test/TrackerMapTool.cc index a61070315436c..0c861a6dcb73b 100644 --- a/Geometry/TrackerGeometryBuilder/test/TrackerMapTool.cc +++ b/Geometry/TrackerGeometryBuilder/test/TrackerMapTool.cc @@ -30,7 +30,6 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -53,32 +52,17 @@ class TrackerMapTool : public edm::one::EDAnalyzer<> { public: explicit TrackerMapTool(const edm::ParameterSet&); - ~TrackerMapTool() override; - void beginJob() override {} void analyze(edm::Event const& iEvent, edm::EventSetup const&) override; - void endJob() override {} -}; -// -// constants, enums and typedefs -// - -// -// static data member definitions -// +private: + edm::ESGetToken pDDToken_; +}; // // constructors and destructor // -TrackerMapTool::TrackerMapTool(const edm::ParameterSet& iConfig) { - //now do what ever initialization is needed -} - -TrackerMapTool::~TrackerMapTool() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} +TrackerMapTool::TrackerMapTool(const edm::ParameterSet& iConfig) : pDDToken_(esConsumes()) {} // // member functions @@ -116,11 +100,10 @@ void TrackerMapTool::analyze(const edm::Event& iEvent, const edm::EventSetup& iS // // get the TrackerGeom // - edm::ESHandle pDD; - iSetup.get().get(pDD); - edm::LogInfo("TrackerMapTool") << " Geometry node for TrackerGeom is " << &(*pDD); - edm::LogInfo("TrackerMapTool") << " I have " << pDD->dets().size() << " detectors"; - edm::LogInfo("TrackerMapTool") << " I have " << pDD->detTypes().size() << " types"; + auto const& pDD = iSetup.getData(pDDToken_); + edm::LogInfo("TrackerMapTool") << " Geometry node for TrackerGeom is " << &pDD; + edm::LogInfo("TrackerMapTool") << " I have " << pDD.dets().size() << " detectors"; + edm::LogInfo("TrackerMapTool") << " I have " << pDD.detTypes().size() << " types"; int spicchif[] = {24, 24, 40, 56, 40, 56, 80}; int spicchib[] = {20, 32, 44, 30, 38, 46, 56, 42, 48, 54, 60, 66, 74}; @@ -140,8 +123,8 @@ void TrackerMapTool::analyze(const edm::Event& iEvent, const edm::EventSetup& iS float width, length, thickness, widthAtHalfLength; std::ofstream output("tracker.dat", std::ios::out); - auto begin = pDD->detUnits().begin(); - auto end = pDD->detUnits().end(); + auto begin = pDD.detUnits().begin(); + auto end = pDD.detUnits().end(); for (; begin != end; ++begin) { ntotmod++; diff --git a/Geometry/TrackerGeometryBuilder/test/TrackerParametersAnalyzer.cc b/Geometry/TrackerGeometryBuilder/test/TrackerParametersAnalyzer.cc index 56892f4287632..2eaf2d87da2b8 100644 --- a/Geometry/TrackerGeometryBuilder/test/TrackerParametersAnalyzer.cc +++ b/Geometry/TrackerGeometryBuilder/test/TrackerParametersAnalyzer.cc @@ -1,7 +1,6 @@ #include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "Geometry/Records/interface/PTrackerParametersRcd.h" @@ -11,26 +10,26 @@ class TrackerParametersAnalyzer : public edm::one::EDAnalyzer<> { public: - explicit TrackerParametersAnalyzer(const edm::ParameterSet&) {} + explicit TrackerParametersAnalyzer(const edm::ParameterSet&) : ptpToken_(esConsumes()) {} - void beginJob() override {} void analyze(edm::Event const& iEvent, edm::EventSetup const&) override; - void endJob() override {} + +private: + edm::ESGetToken ptpToken_; }; void TrackerParametersAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { edm::LogVerbatim("TrackerParametersAnalyzer") << "Here I am"; - edm::ESHandle ptp; - iSetup.get().get(ptp); + auto const& ptp = iSetup.getData(ptpToken_); - for (const auto& vitem : ptp->vitems) { + for (const auto& vitem : ptp.vitems) { edm::LogVerbatim("TrackerParametersAnalyzer") << vitem.id << " has " << vitem.vpars.size() << ":"; for (const auto& in : vitem.vpars) { edm::LogVerbatim("TrackerParametersAnalyzer") << in << ";"; } } - for (int vpar : ptp->vpars) { + for (int vpar : ptp.vpars) { std::cout << vpar << "; "; } } diff --git a/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc b/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc index eaf2719520dcd..9579db5aef07c 100644 --- a/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc +++ b/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc @@ -102,7 +102,7 @@ GeometricDet::GeometricDet(DDFilteredView* fv, GeometricEnumType type) } /* - Constructor from DD4HEP Filtered view. + Constructor from DD4hep Filtered view. */ GeometricDet::GeometricDet(cms::DDFilteredView* fv, GeometricEnumType type) : ddname_(dd4hep::dd::noNamespace(fv->name())), diff --git a/HLTrigger/Configuration/scripts/hltGetConfiguration b/HLTrigger/Configuration/scripts/hltGetConfiguration index 990fb7d3b8b3b..8bb026a675db2 100755 --- a/HLTrigger/Configuration/scripts/hltGetConfiguration +++ b/HLTrigger/Configuration/scripts/hltGetConfiguration @@ -78,8 +78,8 @@ parser.add_argument('--l1-emulator', parser.add_argument('--dbproxy', dest = 'proxy', - action = 'store_const', - const = 'True', + action = 'store_true', + default = defaults.proxy, help = 'Use a socks proxy to connect outside CERN network (default: False)' ) parser.add_argument('--dbproxyport', dest = 'proxy_port', diff --git a/HLTrigger/Configuration/scripts/hltIntegrationTests b/HLTrigger/Configuration/scripts/hltIntegrationTests index e2a8357f7642e..b008d7d70800f 100755 --- a/HLTrigger/Configuration/scripts/hltIntegrationTests +++ b/HLTrigger/Configuration/scripts/hltIntegrationTests @@ -205,12 +205,12 @@ while true; do shift 1 ;; "--dbproxyhost" ) - PROXYHOST="$HLTLISTPATHPROXY --dbproxyhost $2" + HLTLISTPATHPROXY="$HLTLISTPATHPROXY --dbproxyhost $2" EXTRA="$EXTRA --dbproxyhost $2" shift 2 ;; "--dbproxyport" ) - PROXYPORT="$HLTLISTPATHPROXY --dbproxyport $2" + HLTLISTPATHPROXY="$HLTLISTPATHPROXY --dbproxyport $2" EXTRA="$EXTRA --dbproxyport $2" shift 2 ;; diff --git a/HLTrigger/Configuration/scripts/hltListPaths b/HLTrigger/Configuration/scripts/hltListPaths index c783d8d361809..f89c17a09d102 100755 --- a/HLTrigger/Configuration/scripts/hltListPaths +++ b/HLTrigger/Configuration/scripts/hltListPaths @@ -62,8 +62,8 @@ parser.add_argument('menu', help = 'HLT menu to dump from the database. Supported formats are:\n - /path/to/configuration[/Vn]\n - [[{v1|v2|v3}/]{run3|run2|online|adg}:]/path/to/configuration[/Vn]\n - run:runnumber\nThe possible converters are "v1", "v2, and "v3" (default).\nThe possible databases are "run3" (default, used for offline development), "run2" (used for accessing run2 offline development menus), "online" (used to extract online menus within Point 5) and "adg" (used to extract the online menus outside Point 5).\nIf no menu version is specified, the latest one is automatically used.\nIf "run:" is used instead, the HLT menu used for the given run number is looked up and used.\nNote other converters and databases exist as options but they are only for expert/special use.' ) parser.add_argument('--dbproxy', dest = 'proxy', - action = 'store_const', - const = 'True', + action = 'store_true', + default = defaults.proxy, help = 'Use a socks proxy to connect outside CERN network (default: False)' ) parser.add_argument('--dbproxyport', dest = 'proxy_port', @@ -108,4 +108,3 @@ config = parser.parse_args() paths = getPathList(config) for path in paths: print(path) - diff --git a/HLTrigger/JetMET/plugins/PixelJetPuId.cc b/HLTrigger/JetMET/plugins/PixelJetPuId.cc index 252213bde5bae..38b7bec94c8ab 100644 --- a/HLTrigger/JetMET/plugins/PixelJetPuId.cc +++ b/HLTrigger/JetMET/plugins/PixelJetPuId.cc @@ -20,6 +20,7 @@ If the sum of the tracks momentum is under a threshold the jet is tagged as "PUj // system include files #include +#include // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" @@ -149,13 +150,13 @@ void PixelJetPuId::produce(edm::StreamID sid, edm::Event& iEvent, const edm::Eve //get tracks Handle > tracks; iEvent.getByToken(tracksToken, tracks); - unsigned int tsize = tracks->size(); - float teta[tsize], tphi[tsize]; - unsigned int i = 0; + uint const asize = std::max(1u, (uint)tracks->size()); + float teta[asize], tphi[asize]; + uint tsize = 0; for (auto const& tr : *tracks) { - teta[i] = tr.eta(); - tphi[i] = tr.phi(); - ++i; + teta[tsize] = tr.eta(); + tphi[tsize] = tr.phi(); + ++tsize; } //get jets diff --git a/HeterogeneousCore/MPICore/scripts/cmsenv_mpirun b/HeterogeneousCore/MPICore/scripts/cmsenv_mpirun new file mode 100755 index 0000000000000..3946e79d26a81 --- /dev/null +++ b/HeterogeneousCore/MPICore/scripts/cmsenv_mpirun @@ -0,0 +1,26 @@ +#! /bin/bash + +VERBOSE=false +RELEASE=false + +for ARG in "$@"; do + case "$ARG" in + -v|--verbose) + VERBOSE=true + ;; + cmsenv_release) + RELEASE=true + ;; + esac +done + +# additional options oassed to cmsenv_orted +EXTRA_OPTIONS="" + +# if "-v" or "--verbose" are specified, add "-mca cmsenv_verbose true" +$VERBOSE && EXTRA_OPTIONS="$EXTRA_OPTIONS -mca cmsenv_verbose true" + +# if "-mca cmsenv_release" is not specified, add "-mca cmsenv_release $CMSSW_BASE" +$RELEASE || EXTRA_OPTIONS="$EXTRA_OPTIONS -mca cmsenv_release $CMSSW_BASE" + +exec mpirun --launch-agent $CMSSW_BASE/bin/$SCRAM_ARCH/cmsenv_orted $EXTRA_OPTIONS "$@" diff --git a/HeterogeneousCore/MPICore/scripts/cmsenv_orted b/HeterogeneousCore/MPICore/scripts/cmsenv_orted new file mode 100755 index 0000000000000..9fb12cdfbfb4f --- /dev/null +++ b/HeterogeneousCore/MPICore/scripts/cmsenv_orted @@ -0,0 +1,153 @@ +#! /bin/bash + +# orted_with_cmsenv - Open RTE Daemon wrapper for CMSSW + +PROGRAM=$(basename $0) +WORKDIR=$PWD +MCA_PREFIX=cmsenv + +function usage() { + cat << @EOF +$PROGRAM - Open RTE Daemon wrapper for CMSSW + +Usage: + $PROGRAM [-mca ${MCA_PREFIX}_release CMSSW_BASE] [-mca ${MCA_PREFIX}_verbose {true|false}] ... + +Load the CMS environment from the given release area, then launch orted with the same arguments. +@EOF +} + +function error() { + echo "$PROGRAM: error: $@" + echo + usage + exit 1 +} + +function warning() { + echo "$PROGRAM: warning: $@" +} + +function validate_and_set_option() { + local VARIABLE="$1" + local VALUE="$2" + + case $VARIABLE in + VERBOSE ) + # boolean argument + case "$VALUE" in + true | yes | 1) + eval $VARIABLE=true + return 0 + ;; + false | no | 0) + eval $VARIABLE=false + return 0 + ;; + *) + return 1 + ;; + esac + ;; + + RELEASE ) + # directory argument + if [ -d "$VALUE" ]; then + eval $VARIABLE=$(realpath "$VALUE") + return 0 + else + return 1 + fi + ;; + + * ) + # unknown variable, do not perform any validation + ;; + + esac +} + + +function parse_mca_options() { + local MCA_OPTION="" + local MCA_VARIABLE="" + + for ARG in "$@"; do + # look for an "--mca ${MCA_PREFIX}_variable value" triplet + case "$ARG" in + -mca | --mca) + MCA_OPTION="$ARG" + MCA_VARIABLE="" + ;; + ${MCA_PREFIX}_release) + [ "$MCA_OPTION" ] && MCA_VARIABLE="RELEASE" + ;; + ${MCA_PREFIX}_verbose) + [ "$MCA_OPTION" ] && MCA_VARIABLE="VERBOSE" + ;; + ${MCA_PREFIX}_*) + warning "unrecognized option $MCA_OPTION $ARG" + # reset the parsing state + MCA_OPTION="" + MCA_VARIABLE="" + ;; + *) + [ "$MCA_OPTION" ] && [ "$MCA_VARIABLE" ] || continue + # validate and set the argument + if validate_and_set_option "$MCA_VARIABLE" "$ARG"; then + true + else + warning "invalid argument $MCA_OPTION $MCA_VARIABLE $ARG" + fi + # reset the parsing state + MCA_OPTION="" + MCA_VARIABLE="" + ;; + esac + done +} + +# arguments and options +RELEASE= +VERBOSE=false + +# parse the command line options, look for "--mca ${MCA_PREFIX}_variable value" triplets +parse_mca_options "$@" + +if $VERBOSE; then + echo "$PROGRAM initial environment:" + echo "--------------------------------------------------------------------------------" + env | sort + echo "--------------------------------------------------------------------------------" + echo +fi + +if $VERBOSE; then + echo "$PROGRAM command line arguments:" + echo "--------------------------------------------------------------------------------" + echo "$0" "$@" | sed -e's/ \+-/ \\\n -/g' + echo "--------------------------------------------------------------------------------" + echo +fi + +# if CMSSW is not set from the MCA options, try to determine it from the location of this file +if [ "$RELEASE" ]; then + [ -f "$RELEASE/config/scram_basedir" ] || error "invalid release area at $RELEASE" +else + RELEASE="$(realpath $(dirname $(realpath "$0"))/../..)" + [ -f "$RELEASE/config/scram_basedir" ] || error "cannot automatically determine CMSSW_BASE, please set it with the \"-mca ${MCA_PREFIX}_release CMSSW_BASE\" option" +fi + +export VO_CMS_SW_DIR=$(< $RELEASE/config/scram_basedir) +[ -f "$VO_CMS_SW_DIR/cmsset_default.sh" ] || error "invalid CMS installation at $VO_CMS_SW_DIR" + +# load the CMS environment +source "$VO_CMS_SW_DIR"/cmsset_default.sh + +# load the CMSSW release environment +cd "$RELEASE" +eval $(scram runtime -sh) + +# run the ORTED/MPI processes in the work directory +cd "$WORKDIR" +exec orted "$@" diff --git a/IOPool/Common/test/BuildFile.xml b/IOPool/Common/test/BuildFile.xml index 127df1a2d84b2..da64ac0ecd9bb 100644 --- a/IOPool/Common/test/BuildFile.xml +++ b/IOPool/Common/test/BuildFile.xml @@ -9,4 +9,6 @@ + + diff --git a/IOPool/Common/test/copy_overlap_lumi_cfg.py b/IOPool/Common/test/copy_overlap_lumi_cfg.py new file mode 100644 index 0000000000000..5d88c6a7f3d18 --- /dev/null +++ b/IOPool/Common/test/copy_overlap_lumi_cfg.py @@ -0,0 +1,11 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("READ") + +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring("file:test_overlap_lumi.root"), + noRunLumiSort = cms.untracked.bool(True) ) + +process.out = cms.OutputModule("PoolOutputModule", fileName = cms.untracked.string("copy_test_overlap_lumi.root")) + +process.o = cms.EndPath(process.out) diff --git a/IOPool/Common/test/make_overlap_lumi_cfg.py b/IOPool/Common/test/make_overlap_lumi_cfg.py new file mode 100644 index 0000000000000..e561acb1154a8 --- /dev/null +++ b/IOPool/Common/test/make_overlap_lumi_cfg.py @@ -0,0 +1,24 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("TEST") + +process.source = cms.Source("EmptySource", + numberEventsInLuminosityBlock = cms.untracked.uint32(5)) + +process.thing = cms.EDProducer("ThingProducer", offsetDelta = cms.int32(1)) + + +process.sleep = cms.EDProducer("timestudy::SleepingProducer", + ivalue = cms.int32(1), + consumes = cms.VInputTag(), + eventTimes = cms.vdouble(1.0, 0.001, 0.001)) + +process.o = cms.OutputModule("PoolOutputModule", fileName = cms.untracked.string("test_overlap_lumi.root")) + +process.p = cms.Path( process.sleep ) + +process.maxEvents.input = 20 + +process.options.numberOfThreads = 8 + +process.e = cms.EndPath(process.o, cms.Task(process.thing)) diff --git a/IOPool/Common/test/test_overlap_lumi_fast_copy.sh b/IOPool/Common/test/test_overlap_lumi_fast_copy.sh new file mode 100755 index 0000000000000..ec5001962cb61 --- /dev/null +++ b/IOPool/Common/test/test_overlap_lumi_fast_copy.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# Pass in name and status +function die { echo $1: status $2 ; exit $2; } + +LOCAL_TEST_DIR=src/IOPool/Common/test + +cmsRun ${LOCAL_TEST_DIR}/make_overlap_lumi_cfg.py || die "cmsRun make_overlap_lumi_cfg.py failed" $? + +cmsRun -e -j overlap_lumi_FrameworkJobReport.xml ${LOCAL_TEST_DIR}/copy_overlap_lumi_cfg.py || die "cmsRun copy_overlap_lumi_cfg.py failed" $? + +grep '1' overlap_lumi_FrameworkJobReport.xml || die "fast copying did not occur" 1 diff --git a/IOPool/Input/src/RepeatingCachedRootSource.cc b/IOPool/Input/src/RepeatingCachedRootSource.cc index 3ffb31224b02e..e8e46015ff37c 100644 --- a/IOPool/Input/src/RepeatingCachedRootSource.cc +++ b/IOPool/Input/src/RepeatingCachedRootSource.cc @@ -271,7 +271,8 @@ std::unique_ptr RepeatingCachedRootSource::makeRootFile( -1, //treeMaxVirtualSize(), processingMode(), runHelper_, - true, //noEventSort_, + false, //noRunLumiSort_ + true, //noEventSort_, selectorRules_, InputType::Primary, branchIDListHelper(), diff --git a/IOPool/Input/src/RootFile.cc b/IOPool/Input/src/RootFile.cc index e1ea9ed283c0e..67a9c594f79a6 100644 --- a/IOPool/Input/src/RootFile.cc +++ b/IOPool/Input/src/RootFile.cc @@ -155,6 +155,7 @@ namespace edm { int treeMaxVirtualSize, InputSource::ProcessingMode processingMode, RunHelperBase* runHelper, + bool noRunLumiSort, bool noEventSort, ProductSelectorRules const& productSelectorRules, InputType inputType, @@ -184,8 +185,9 @@ namespace edm { indexIntoFileSharedPtr_(new IndexIntoFile), indexIntoFile_(*indexIntoFileSharedPtr_), orderedProcessHistoryIDs_(orderedProcessHistoryIDs), - indexIntoFileBegin_( - indexIntoFile_.begin(noEventSort ? IndexIntoFile::firstAppearanceOrder : IndexIntoFile::numericalOrder)), + indexIntoFileBegin_(indexIntoFile_.begin( + noRunLumiSort ? IndexIntoFile::entryOrder + : (noEventSort ? IndexIntoFile::firstAppearanceOrder : IndexIntoFile::numericalOrder))), indexIntoFileEnd_(indexIntoFileBegin_), indexIntoFileIter_(indexIntoFileBegin_), storedMergeableRunProductMetadata_((inputType == InputType::Primary) ? new StoredMergeableRunProductMetadata @@ -194,6 +196,7 @@ namespace edm { eventProcessHistoryIter_(eventProcessHistoryIDs_.begin()), savedRunAuxiliary_(), skipAnyEvents_(skipAnyEvents), + noRunLumiSort_(noRunLumiSort), noEventSort_(noEventSort), enforceGUIDInFileName_(enforceGUIDInFileName), whyNotFastClonable_(0), @@ -509,10 +512,12 @@ namespace edm { } initializeDuplicateChecker(indexesIntoFiles, currentIndexIntoFile); - indexIntoFileIter_ = indexIntoFileBegin_ = - indexIntoFile_.begin(noEventSort ? IndexIntoFile::firstAppearanceOrder : IndexIntoFile::numericalOrder); - indexIntoFileEnd_ = - indexIntoFile_.end(noEventSort ? IndexIntoFile::firstAppearanceOrder : IndexIntoFile::numericalOrder); + indexIntoFileIter_ = indexIntoFileBegin_ = indexIntoFile_.begin( + noRunLumiSort ? IndexIntoFile::entryOrder + : (noEventSort ? IndexIntoFile::firstAppearanceOrder : IndexIntoFile::numericalOrder)); + indexIntoFileEnd_ = indexIntoFile_.end( + noRunLumiSort ? IndexIntoFile::entryOrder + : (noEventSort ? IndexIntoFile::firstAppearanceOrder : IndexIntoFile::numericalOrder)); runHelper_->setForcedRunOffset(indexIntoFileBegin_ == indexIntoFileEnd_ ? 1 : indexIntoFileBegin_.run()); eventProcessHistoryIter_ = eventProcessHistoryIDs_.begin(); @@ -738,7 +743,8 @@ namespace edm { // From here on, record all reasons we can't fast clone. IndexIntoFile::SortOrder sortOrder = - (noEventSort_ ? IndexIntoFile::firstAppearanceOrder : IndexIntoFile::numericalOrder); + (noRunLumiSort_ ? IndexIntoFile::entryOrder + : (noEventSort_ ? IndexIntoFile::firstAppearanceOrder : IndexIntoFile::numericalOrder)); if (!indexIntoFile_.iterationWillBeInEntryOrder(sortOrder)) { whyNotFastClonable_ += (noEventSort_ ? FileBlock::RunOrLumiNotContiguous : FileBlock::EventsToBeSorted); } @@ -1496,6 +1502,9 @@ namespace edm { IndexIntoFile::SortOrder sortOrder = IndexIntoFile::numericalOrder; if (noEventSort_) sortOrder = IndexIntoFile::firstAppearanceOrder; + if (noRunLumiSort_) { + sortOrder = IndexIntoFile::entryOrder; + } IndexIntoFile::IndexIntoFileItr iter = indexIntoFile_.findPosition(sortOrder, eventID.run(), eventID.luminosityBlock(), eventID.event()); @@ -1780,13 +1789,19 @@ namespace edm { return; } // End code for backward compatibility before the existence of lumi trees. - lumiTree_.setEntryNumber(indexIntoFileIter_.entry()); - // NOTE: we use 0 for the index since do not do delayed reads for LuminosityBlockPrincipals - lumiTree_.insertEntryForIndex(0); - auto history = processHistoryRegistry_->getMapped(lumiPrincipal.aux().processHistoryID()); - lumiPrincipal.fillLuminosityBlockPrincipal(history, lumiTree_.resetAndGetRootDelayedReader()); - // Read in all the products now. - lumiPrincipal.readAllFromSourceAndMergeImmediately(); + if (not indexIntoFileIter_.entryContinues()) { + lumiTree_.setEntryNumber(indexIntoFileIter_.entry()); + // NOTE: we use 0 for the index since do not do delayed reads for LuminosityBlockPrincipals + lumiTree_.insertEntryForIndex(0); + auto history = processHistoryRegistry_->getMapped(lumiPrincipal.aux().processHistoryID()); + lumiPrincipal.fillLuminosityBlockPrincipal(history, lumiTree_.resetAndGetRootDelayedReader()); + // Read in all the products now. + lumiPrincipal.readAllFromSourceAndMergeImmediately(); + } else { + auto history = processHistoryRegistry_->getMapped(lumiPrincipal.aux().processHistoryID()); + lumiPrincipal.fillLuminosityBlockPrincipal(history, nullptr); + lumiPrincipal.setWillBeContinued(true); + } ++indexIntoFileIter_; } diff --git a/IOPool/Input/src/RootFile.h b/IOPool/Input/src/RootFile.h index 13e20f81e15bd..90784812a589a 100644 --- a/IOPool/Input/src/RootFile.h +++ b/IOPool/Input/src/RootFile.h @@ -84,6 +84,7 @@ namespace edm { int treeMaxVirtualSize, InputSource::ProcessingMode processingMode, RunHelperBase* runHelper, + bool noRunLumiSort, bool noEventSort, ProductSelectorRules const& productSelectorRules, InputType inputType, @@ -140,6 +141,7 @@ namespace edm { processingMode, runHelper, false, + false, productSelectorRules, inputType, branchIDListHelper, @@ -190,6 +192,7 @@ namespace edm { InputSource::RunsLumisAndEvents, runHelper, false, + false, productSelectorRules, inputType, nullptr, @@ -371,6 +374,7 @@ namespace edm { std::vector::const_iterator eventProcessHistoryIter_; // backward compatibility edm::propagate_const> savedRunAuxiliary_; bool skipAnyEvents_; + bool noRunLumiSort_; bool noEventSort_; bool enforceGUIDInFileName_; int whyNotFastClonable_; diff --git a/IOPool/Input/src/RootPrimaryFileSequence.cc b/IOPool/Input/src/RootPrimaryFileSequence.cc index 42f3ee1196cae..34a85919b8b8d 100644 --- a/IOPool/Input/src/RootPrimaryFileSequence.cc +++ b/IOPool/Input/src/RootPrimaryFileSequence.cc @@ -29,7 +29,8 @@ namespace edm { orderedProcessHistoryIDs_(), eventSkipperByID_(EventSkipperByID::create(pset).release()), initialNumberOfEventsToSkip_(pset.getUntrackedParameter("skipEvents")), - noEventSort_(pset.getUntrackedParameter("noEventSort")), + noRunLumiSort_(pset.getUntrackedParameter("noRunLumiSort")), + noEventSort_(noRunLumiSort_ ? true : pset.getUntrackedParameter("noEventSort")), treeCacheSize_(noEventSort_ ? pset.getUntrackedParameter("cacheSize") : 0U), duplicateChecker_(new DuplicateChecker(pset)), usingGoToEvent_(false), @@ -149,6 +150,7 @@ namespace edm { input_.treeMaxVirtualSize(), input_.processingMode(), input_.runHelper(), + noRunLumiSort_, noEventSort_, input_.productSelectorRules(), InputType::Primary, @@ -411,6 +413,10 @@ namespace edm { "Note 1: Events within the same lumi will always be processed contiguously.\n" "Note 2: Lumis within the same run will always be processed contiguously.\n" "Note 3: Any sorting occurs independently in each input file (no sorting across input files)."); + desc.addUntracked("noRunLumiSort", false) + ->setComment( + "True: Process runs, lumis and events in the order they appear in the file.\n" + "False: Follow settings based on 'noEventSort' setting."); desc.addUntracked("cacheSize", roottree::defaultCacheSize) ->setComment("Size of ROOT TTree prefetch cache. Affects performance."); std::string defaultString("permissive"); diff --git a/IOPool/Input/src/RootPrimaryFileSequence.h b/IOPool/Input/src/RootPrimaryFileSequence.h index 81b714c29fed5..75bc262b19c48 100644 --- a/IOPool/Input/src/RootPrimaryFileSequence.h +++ b/IOPool/Input/src/RootPrimaryFileSequence.h @@ -74,6 +74,7 @@ namespace edm { edm::propagate_const> fb_; edm::propagate_const> eventSkipperByID_; int initialNumberOfEventsToSkip_; + bool noRunLumiSort_; bool noEventSort_; unsigned int treeCacheSize_; edm::propagate_const> duplicateChecker_; diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc index 3a52e263e9786..bae26474a5220 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc @@ -1073,20 +1073,16 @@ std::vector CSCCathodeLCTProcessor::readoutCLCTs() const { const int max_late_tbin = CSCConstants::MAX_CLCT_TBINS - 1; // debugging messages when early_tbin or late_tbin has a suspicious value - bool debugTimeBins = true; - if (debugTimeBins) { - if (early_tbin < 0) { - edm::LogWarning("CSCCathodeLCTProcessor|SuspiciousParameters") - << "Early time bin (early_tbin) smaller than minimum allowed, which is 0. set early_tbin to 0."; - early_tbin = 0; - } - if (late_tbin > max_late_tbin) { - edm::LogWarning("CSCCathodeLCTProcessor|SuspiciousParameters") - << "Late time bin (late_tbin) larger than maximum allowed, which is " << max_late_tbin - << ". set early_tbin to max allowed"; - late_tbin = CSCConstants::MAX_CLCT_TBINS - 1; - } - debugTimeBins = false; + if (early_tbin < 0) { + edm::LogWarning("CSCCathodeLCTProcessor|SuspiciousParameters") + << "Early time bin (early_tbin) smaller than minimum allowed, which is 0. set early_tbin to 0."; + early_tbin = 0; + } + if (late_tbin > max_late_tbin) { + edm::LogWarning("CSCCathodeLCTProcessor|SuspiciousParameters") + << "Late time bin (late_tbin) larger than maximum allowed, which is " << max_late_tbin + << ". set early_tbin to max allowed"; + late_tbin = CSCConstants::MAX_CLCT_TBINS - 1; } // get the valid LCTs. No BX selection is done here diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc index b61a51754a399..21dc0b62f7eb7 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc @@ -280,20 +280,16 @@ std::vector CSCMotherboard::readoutLCTs() const { const int max_late_tbin = CSCConstants::MAX_LCT_TBINS - 1; // debugging messages when early_tbin or late_tbin has a suspicious value - bool debugTimeBins = true; - if (debugTimeBins) { - if (early_tbin < 0) { - edm::LogWarning("CSCMotherboard|SuspiciousParameters") - << "Early time bin (early_tbin) smaller than minimum allowed, which is 0. set early_tbin to 0."; - early_tbin = 0; - } - if (late_tbin > max_late_tbin) { - edm::LogWarning("CSCMotherboard|SuspiciousParameters") - << "Late time bin (late_tbin) larger than maximum allowed, which is " << max_late_tbin - << ". set early_tbin to max allowed"; - late_tbin = CSCConstants::MAX_LCT_TBINS - 1; - } - debugTimeBins = false; + if (early_tbin < 0) { + edm::LogWarning("CSCMotherboard|SuspiciousParameters") + << "Early time bin (early_tbin) smaller than minimum allowed, which is 0. set early_tbin to 0."; + early_tbin = 0; + } + if (late_tbin > max_late_tbin) { + edm::LogWarning("CSCMotherboard|SuspiciousParameters") + << "Late time bin (late_tbin) larger than maximum allowed, which is " << max_late_tbin + << ". set early_tbin to max allowed"; + late_tbin = CSCConstants::MAX_LCT_TBINS - 1; } // Start from the vector of all found correlated LCTs and select diff --git a/L1Trigger/L1TMuon/python/simDigis_cff.py b/L1Trigger/L1TMuon/python/simDigis_cff.py index 50d183abbd2c9..134a832412a95 100644 --- a/L1Trigger/L1TMuon/python/simDigis_cff.py +++ b/L1Trigger/L1TMuon/python/simDigis_cff.py @@ -20,6 +20,13 @@ CSCComparatorDigiProducer = 'simMuonCSCDigis:MuonCSCComparatorDigi', CSCWireDigiProducer = 'simMuonCSCDigis:MuonCSCWireDigi' ) +# For Run-3: turn on CCLUT in the MEX/1 chambers +simCscTriggerPrimitiveDigisRun3 = simCscTriggerPrimitiveDigis.clone() +simCscTriggerPrimitiveDigisRun3.commonParam.runCCLUT_OTMB = True + +# For Phase-2: turn on CCLUT in the ME1/3 and MEX/2 chambers +simCscTriggerPrimitiveDigisPhase2 = simCscTriggerPrimitiveDigisRun3.clone() +simCscTriggerPrimitiveDigisPhase2.commonParam.runCCLUT_TMB = True SimL1TMuonCommonTask = cms.Task(simDtTriggerPrimitiveDigis, simCscTriggerPrimitiveDigis) SimL1TMuonCommon = cms.Sequence(SimL1TMuonCommonTask) @@ -106,16 +113,16 @@ ## GEM TPs from L1Trigger.L1TGEM.simGEMDigis_cff import * _run3_SimL1TMuonTask = SimL1TMuonTask.copy() -#_run3_SimL1TMuonTask.add(simMuonGEMPadTask) +_run3_SimL1TMuonTask.add(simCscTriggerPrimitiveDigisRun3) from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM -#(stage2L1Trigger & run3_GEM).toReplaceWith( SimL1TMuonTask, _run3_SimL1TMuonTask ) (stage2L1Trigger & run3_GEM).toReplaceWith( SimL1TMuonTask, cms.Task(simMuonGEMPadTask,_run3_SimL1TMuonTask) ) ## ME0 TPs from L1Trigger.L1TGEM.me0TriggerDigis_cff import * _phase2_SimL1TMuonTask = SimL1TMuonTask.copy() _phase2_SimL1TMuonTask.add(me0TriggerAllDigiTask) +_phase2_SimL1TMuonTask.add(simCscTriggerPrimitiveDigisPhase2) _phase2_GE0_SimL1TMuonTask = SimL1TMuonTask.copyAndExclude([me0TriggerAllDigiTask]) from Configuration.Eras.Modifier_phase2_muon_cff import phase2_muon diff --git a/MagneticField/Engine/test/regression.py b/MagneticField/Engine/test/regression.py index 70e5f217a2eb7..650b314b77863 100644 --- a/MagneticField/Engine/test/regression.py +++ b/MagneticField/Engine/test/regression.py @@ -10,7 +10,7 @@ 'static_DDD', #default value VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, - "MF producer to use. Valid values: 'static_DDD', 'static_DD4Hep', 'fromDB', 'fromDB_DD4Hep'") + "MF producer to use. Valid values: 'static_DDD', 'static_DD4hep', 'fromDB', 'fromDB_DD4hep'") options.register('era', 'RunII', #default value @@ -40,7 +40,7 @@ if options.current < 0 : # Test all currents, simulating different IOVs with different values runInfo # FIXME: currents are set all equal for the time being because we need to set up a way to specify the correct # reference file file to be picked for each at runtime. - if options.producerType == 'static_DDD' or options.producerType == 'static_DD4Hep' : + if options.producerType == 'static_DDD' or options.producerType == 'static_DD4hep' : sys.exit('Invalid configuration: current=-1 mode is not supported with static prouducers') process.maxEvents.input = 4 process.source.numberEventsInLuminosityBlock =cms.untracked.uint32(1) @@ -113,7 +113,7 @@ process.load("MagneticField.Engine.volumeBasedMagneticField_71212_cfi") #2.0T -elif options.producerType == 'static_DD4Hep' : +elif options.producerType == 'static_DD4hep' : process.load("MagneticField.Engine.volumeBasedMagneticField_dd4hep_160812_cfi") if options.current > 17543 : if options.era == 'RunI' : @@ -125,13 +125,13 @@ process.VolumeBasedMagneticFieldESProducer.version = cms.string('grid_160812_3t') process.ParametrizedMagneticFieldProducer.parameters.BValue = cms.string('3_0T') elif options.current > 4779 : - sys.exit('ERROR: Unsupported current for static_DD4Hep: ' + str(options.current)) + sys.exit('ERROR: Unsupported current for static_DD4hep: ' + str(options.current)) -elif options.producerType == 'fromDB' or options.producerType == 'fromDB_DD4Hep': +elif options.producerType == 'fromDB' or options.producerType == 'fromDB_DD4hep': if options.producerType == 'fromDB': process.load("Configuration.StandardSequences.MagneticField_cff") - elif options.producerType == 'fromDB_DD4Hep': + elif options.producerType == 'fromDB_DD4hep': process.load("MagneticField.Engine.volumeBasedMagneticFieldFromDB_dd4hep_cfi") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/MagneticField/Engine/test/runTest.sh b/MagneticField/Engine/test/runTest.sh index 4cbd3a060588c..1c46565f71c71 100755 --- a/MagneticField/Engine/test/runTest.sh +++ b/MagneticField/Engine/test/runTest.sh @@ -9,31 +9,31 @@ echo "===== Test MF map regressions ====" #Run II, 3.8T (cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=static_DDD) || die "MF regression failure, from xml, DDD, 3.8T" $? (cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=fromDB) || die "MF regression failure, from DB, DDD, 3.8T" $? -(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=static_DD4Hep) || die "MF regression failure, from xml, DD4hep, 3.8T" $? -(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=fromDB_DD4Hep) || die "MF regression failure, from DB, DD4hep, 3.8T" $? +(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=static_DD4hep) || die "MF regression failure, from xml, DD4hep, 3.8T" $? +(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=fromDB_DD4hep) || die "MF regression failure, from DB, DD4hep, 3.8T" $? #Run I, 3.8T #(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=static_DDD era=RunI) || die "MF regression failure, from xml, DDD, 3.8T RunI" $? (cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=fromDB era=RunI) || die "MF regression failure, from DB, DDD, 3.8T RunI" $? -#(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=static_DD4Hep era=RunI) || die "MF regression failure, from xml, DD4hep, 3.8T RunI" $? -#(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=fromDB_DD4Hep era=RunI) || die "MF regression failure, from DB, DD4hep, 3.8T RunI" $? +#(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=static_DD4hep era=RunI) || die "MF regression failure, from xml, DD4hep, 3.8T RunI" $? +#(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=fromDB_DD4hep era=RunI) || die "MF regression failure, from DB, DD4hep, 3.8T RunI" $? #Run II, 3.5T export CURRENT=16730 #(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=static_DDD current=$CURRENT) || die "MF regression failure, from xml, DDD, 3.5T" $? #(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=fromDB current=$CURRENT) || die "MF regression failure, from DB, DDD, 3.5T" $? -(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=static_DD4Hep current=$CURRENT) || die "MF regression failure, from xml, DD4hep, 3.5T" $? -#(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=fromDB_DD4Hep current=$CURRENT) || die "MF regression failure, from DB, DD4hep, 3.5T" $? +(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=static_DD4hep current=$CURRENT) || die "MF regression failure, from xml, DD4hep, 3.5T" $? +#(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=fromDB_DD4hep current=$CURRENT) || die "MF regression failure, from DB, DD4hep, 3.5T" $? #Run II, 3T export CURRENT=14340 (cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=static_DDD current=$CURRENT) || die "MF regression failure, from xml, DDD, 3T" $? #(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=fromDB current=$CURRENT) || die "MF regression failure, from DB, DDD, 3T" $? -#(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=static_DD4Hep current=$CURRENT) || die "MF regression failure, from xml, DD4hep, 3T" $? -#(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=fromDB_DD4Hep current=$CURRENT) || die "MF regression failure, from DB, DD4hep, 3T" $? +#(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=static_DD4hep current=$CURRENT) || die "MF regression failure, from xml, DD4hep, 3T" $? +#(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=fromDB_DD4hep current=$CURRENT) || die "MF regression failure, from DB, DD4hep, 3T" $? #Run II, 2T export CURRENT=9500 #(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=static_DDD current=$CURRENT) || die "MF regression failure, from xml, DDD, 2T" $? #(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=fromDB current=$CURRENT) || die "MF regression failure, from DB, DDD, 2T" $? -(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=fromDB_DD4Hep current=$CURRENT) || die "MF regression failure, from DB, DD4hep, 2T" $? +(cmsRun ${LOCAL_TEST_DIR}/regression.py producerType=fromDB_DD4hep current=$CURRENT) || die "MF regression failure, from DB, DD4hep, 2T" $? diff --git a/MagneticField/GeomBuilder/data/cms-mf-geometry_160812.xml b/MagneticField/GeomBuilder/data/cms-mf-geometry_160812.xml index ba5a4b48e2b68..154b187a6d4f2 100644 --- a/MagneticField/GeomBuilder/data/cms-mf-geometry_160812.xml +++ b/MagneticField/GeomBuilder/data/cms-mf-geometry_160812.xml @@ -27,7 +27,7 @@ - + diff --git a/MagneticField/GeomBuilder/data/cms-mf-geometry_71212.xml b/MagneticField/GeomBuilder/data/cms-mf-geometry_71212.xml index 5a76f1b4d94b5..a752dbc4c8dbc 100644 --- a/MagneticField/GeomBuilder/data/cms-mf-geometry_71212.xml +++ b/MagneticField/GeomBuilder/data/cms-mf-geometry_71212.xml @@ -26,7 +26,7 @@ - + diff --git a/MagneticField/GeomBuilder/plugins/dd4hep/DD4hep_VolumeBasedMagneticFieldESProducerFromDB.cc b/MagneticField/GeomBuilder/plugins/dd4hep/DD4hep_VolumeBasedMagneticFieldESProducerFromDB.cc index d920c2a5e4c0d..db3413c2a1cea 100644 --- a/MagneticField/GeomBuilder/plugins/dd4hep/DD4hep_VolumeBasedMagneticFieldESProducerFromDB.cc +++ b/MagneticField/GeomBuilder/plugins/dd4hep/DD4hep_VolumeBasedMagneticFieldESProducerFromDB.cc @@ -81,7 +81,7 @@ DD4hep_VolumeBasedMagneticFieldESProducerFromDB::DD4hep_VolumeBasedMagneticField const edm::ParameterSet& iConfig) : debug_(iConfig.getUntrackedParameter("debugBuilder")) { std::string const myConfigLabel = "VBMFESChoice"; - usesResources({edm::ESSharedResourceNames::kDD4Hep}); + usesResources({edm::ESSharedResourceNames::kDD4hep}); //Based on configuration, pick algorithm to produce the proper MagFieldConfig with a specific label const int current = iConfig.getParameter("valueOverride"); diff --git a/PhysicsTools/MVAComputer/interface/MVAComputerCache.h b/PhysicsTools/MVAComputer/interface/MVAComputerCache.h index cb7c7003f9cff..625450afe5023 100644 --- a/PhysicsTools/MVAComputer/interface/MVAComputerCache.h +++ b/PhysicsTools/MVAComputer/interface/MVAComputerCache.h @@ -13,8 +13,6 @@ #include -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "PhysicsTools/MVAComputer/interface/Calibration.h" #include "PhysicsTools/MVAComputer/interface/MVAComputer.h" @@ -33,34 +31,6 @@ namespace PhysicsTools { bool update(const Calibration::MVAComputer *computer); bool update(const Calibration::MVAComputerContainer *container, const char *calib); - template - bool update(const edm::EventSetup &es) { - edm::ESHandle handle; - es.get().get(handle); - return update(handle.product()); - } - - template - bool update(const edm::EventSetup &es, const char *calib) { - edm::ESHandle handle; - es.get().get(handle); - return update(handle.product(), calib); - } - - template - bool update(const char *label, const edm::EventSetup &es) { - edm::ESHandle handle; - es.get().get(label, handle); - return update(handle.product()); - } - - template - bool update(const char *label, const edm::EventSetup &es, const char *calib) { - edm::ESHandle handle; - es.get().get(label, handle); - return update(handle.product(), calib); - } - operator bool() const { return computer.get(); } MVAComputer &operator*() { return *computer; } diff --git a/PhysicsTools/MVAComputer/src/MVAComputer.cc b/PhysicsTools/MVAComputer/src/MVAComputer.cc index 2ac0c16cce160..f8c614b5fc298 100644 --- a/PhysicsTools/MVAComputer/src/MVAComputer.cc +++ b/PhysicsTools/MVAComputer/src/MVAComputer.cc @@ -58,12 +58,11 @@ namespace PhysicsTools { trainCalib->initFlags(flags); VarProcessor::ConfigCtx config(flags); - std::vector processors = calib->getProcessors(); + std::vector processors = calib->getProcessors(); - for (std::vector::const_iterator iter = processors.begin(); iter != processors.end(); - ++iter) { - std::string name = (*iter)->getInstanceName(); - VarProcessor *processor = VarProcessor::create(name.c_str(), *iter, this); + for (const auto *calibProc : processors) { + std::string name = calibProc->getInstanceName(); + VarProcessor *processor = VarProcessor::create(name.c_str(), calibProc, this); if (!processor) throw cms::Exception("UnknownProcessor") << name << " could not be instantiated." << std::endl; diff --git a/PhysicsTools/MVAComputer/test/testMVAComputerEvaluate.cc b/PhysicsTools/MVAComputer/test/testMVAComputerEvaluate.cc index 8ec91c32e1b4e..d640fa80ffc19 100644 --- a/PhysicsTools/MVAComputer/test/testMVAComputerEvaluate.cc +++ b/PhysicsTools/MVAComputer/test/testMVAComputerEvaluate.cc @@ -1,10 +1,9 @@ #include -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/stream/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "PhysicsTools/MVAComputer/interface/MVAComputerCache.h" @@ -20,13 +19,14 @@ using namespace PhysicsTools; -class testMVAComputerEvaluate : public edm::EDAnalyzer { +class testMVAComputerEvaluate : public edm::stream::EDAnalyzer<> { public: explicit testMVAComputerEvaluate(const edm::ParameterSet& params); virtual void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup); private: + edm::ESGetToken mvaToken_; MVAComputerCache mvaComputer; }; @@ -38,7 +38,7 @@ void testMVAComputerEvaluate::analyze(const edm::Event& iEvent, const edm::Event // you can use a MVAComputerContainer to pass around // multiple different MVA's in one event setup record // identify the right one by a definable name string - mvaComputer.update(iSetup, "testMVA"); + mvaComputer.update(&iSetup.getData(mvaToken_), "testMVA"); Variable::Value values[] = {Variable::Value("x", 1.0), Variable::Value("y", 1.5)}; @@ -47,7 +47,7 @@ void testMVAComputerEvaluate::analyze(const edm::Event& iEvent, const edm::Event // std::vector also works, but plain array has better performance // for fixed-size arrays (no internal malloc/free) - std::cout << "mva.eval(x = 1.0, y = 1.5) = " << result << std::endl; + edm::LogPrint("testMVAComputerEvaluate") << "mva.eval(x = 1.0, y = 1.5) = " << result; } // define this as a plug-in diff --git a/RecoBTag/FeatureTools/interface/ChargedCandidateConverter.h b/RecoBTag/FeatureTools/interface/ChargedCandidateConverter.h index 93447c3ef9aac..6ea872004da65 100644 --- a/RecoBTag/FeatureTools/interface/ChargedCandidateConverter.h +++ b/RecoBTag/FeatureTools/interface/ChargedCandidateConverter.h @@ -51,25 +51,9 @@ namespace btagbtvdeep { c_pf_features.drminsv = catch_infs_and_bound(drminpfcandsv, 0, -1. * jetR, 0, -1. * jetR); - // subjet related - const auto* patJet = dynamic_cast(&jet); - if (!patJet) { - throw edm::Exception(edm::errors::InvalidReference) << "Input is not a pat::Jet."; - } - - if (patJet->nSubjetCollections() > 0) { - auto subjets = patJet->subjets(); - // sort by pt - std::sort(subjets.begin(), subjets.end(), [](const edm::Ptr& p1, const edm::Ptr& p2) { - return p1->pt() > p2->pt(); - }); - c_pf_features.drsubjet1 = !subjets.empty() ? reco::deltaR(*c_pf, *subjets.at(0)) : -1; - c_pf_features.drsubjet2 = subjets.size() > 1 ? reco::deltaR(*c_pf, *subjets.at(1)) : -1; - } else { - // AK4 jets don't have subjets - c_pf_features.drsubjet1 = -1; - c_pf_features.drsubjet2 = -1; - } + std::pair drSubjetFeatures = getDRSubjetFeatures(jet, c_pf); + c_pf_features.drsubjet1 = drSubjetFeatures.first; + c_pf_features.drsubjet2 = drSubjetFeatures.second; } void packedCandidateToFeatures(const pat::PackedCandidate* c_pf, diff --git a/RecoBTag/FeatureTools/interface/NeutralCandidateConverter.h b/RecoBTag/FeatureTools/interface/NeutralCandidateConverter.h index 2055b72dbd385..6af3e44fc7de3 100644 --- a/RecoBTag/FeatureTools/interface/NeutralCandidateConverter.h +++ b/RecoBTag/FeatureTools/interface/NeutralCandidateConverter.h @@ -30,24 +30,9 @@ namespace btagbtvdeep { const float& drminpfcandsv, const float& jetR, NeutralCandidateFeatures& n_pf_features) { - const auto* patJet = dynamic_cast(&jet); - - if (!patJet) { - throw edm::Exception(edm::errors::InvalidReference) << "Input is not a pat::Jet."; - } - // Do Subjets - if (patJet->nSubjetCollections() > 0) { - auto subjets = patJet->subjets(); - // sort by pt - std::sort(subjets.begin(), subjets.end(), [](const edm::Ptr& p1, const edm::Ptr& p2) { - return p1->pt() > p2->pt(); - }); - n_pf_features.drsubjet1 = !subjets.empty() ? reco::deltaR(*n_pf, *subjets.at(0)) : -1; - n_pf_features.drsubjet2 = subjets.size() > 1 ? reco::deltaR(*n_pf, *subjets.at(1)) : -1; - } else { - n_pf_features.drsubjet1 = -1; - n_pf_features.drsubjet2 = -1; - } + std::pair drSubjetFeatures = getDRSubjetFeatures(jet, n_pf); + n_pf_features.drsubjet1 = drSubjetFeatures.first; + n_pf_features.drsubjet2 = drSubjetFeatures.second; // Jet relative vars n_pf_features.ptrel = catch_infs_and_bound(n_pf->pt() / jet.pt(), 0, -1, 0, -1); diff --git a/RecoBTag/FeatureTools/interface/deep_helpers.h b/RecoBTag/FeatureTools/interface/deep_helpers.h index e17aa3ce99271..73efc4c09b0ee 100644 --- a/RecoBTag/FeatureTools/interface/deep_helpers.h +++ b/RecoBTag/FeatureTools/interface/deep_helpers.h @@ -75,6 +75,8 @@ namespace btagbtvdeep { float quality_from_pfcand(const reco::PFCandidate &pfcand); float lost_inner_hits_from_pfcand(const reco::PFCandidate &pfcand); + std::pair getDRSubjetFeatures(const reco::Jet &jet, const reco::Candidate *cand); + // struct to hold preprocessing parameters struct PreprocessParams { struct VarInfo { diff --git a/RecoBTag/FeatureTools/src/deep_helpers.cc b/RecoBTag/FeatureTools/src/deep_helpers.cc index 49fa568b00933..2ec09624abc6c 100644 --- a/RecoBTag/FeatureTools/src/deep_helpers.cc +++ b/RecoBTag/FeatureTools/src/deep_helpers.cc @@ -119,4 +119,28 @@ namespace btagbtvdeep { return int16_t((qualityFlags & lostInnerHitsMask) >> lostInnerHitsShift) - 1; } + std::pair getDRSubjetFeatures(const reco::Jet &jet, const reco::Candidate *cand) { + const auto *patJet = dynamic_cast(&jet); + std::pair features; + // Do Subjets + if (patJet) { + if (patJet->nSubjetCollections() > 0) { + auto subjets = patJet->subjets(); + std::nth_element( + subjets.begin(), + subjets.begin() + 1, + subjets.end(), + [](const edm::Ptr &p1, const edm::Ptr &p2) { return p1->pt() > p2->pt(); }); + features.first = !subjets.empty() ? reco::deltaR(*cand, *subjets[0]) : -1; + features.second = subjets.size() > 1 ? reco::deltaR(*cand, *subjets[1]) : -1; + } else { + features.first = -1; + features.second = -1; + } + } else { + features.first = -1; + features.second = -1; + } + return features; + } } // namespace btagbtvdeep diff --git a/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc b/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc index 3c02f860940be..63ebc6b7f5593 100644 --- a/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc +++ b/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc @@ -9,13 +9,14 @@ #include //CMSSW includes -#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/RecoCandidate/interface/RecoCandidate.h" +#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" #include "Geometry/CommonDetUnit/interface/TrackingGeometry.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "DataFormats/RecoCandidate/interface/RecoCandidate.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "DataFormats/Math/interface/deltaR.h" +#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h" double scaleToE(const double &eta) { return 1.; } double scaleToEt(const double &eta) { return std::sin(2. * std::atan(std::exp(-eta))); } @@ -150,7 +151,7 @@ double EgammaHcalIsolation::goodHitEnergy(float pcluEta, if (!(goodHBe or goodHEe)) return 0.; - const auto phit = caloGeometry_.getPosition(hit.detid()); + const auto phit = caloGeometry_.getGeometry(hit.detid())->repPos(); const float phitEta = phit.eta(); if (extIncRule_ == InclusionRule::withinConeAroundCluster or intIncRule_ == InclusionRule::withinConeAroundCluster) { diff --git a/RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h b/RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h index fc2ba6c56d3b9..987d4c6db89a9 100644 --- a/RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h +++ b/RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h @@ -22,7 +22,15 @@ namespace edm { namespace hgcal { class RecHitTools { public: - RecHitTools() : geom_(nullptr), fhOffset_(0), bhOffset_(0), fhLastLayer_(0), noseLastLayer_(0), geometryType_(0) {} + RecHitTools() + : geom_(nullptr), + eeOffset_(0), + fhOffset_(0), + bhFirstLayer_(0), + bhOffset_(0), + fhLastLayer_(0), + noseLastLayer_(0), + geometryType_(0) {} ~RecHitTools() {} void setGeometry(CaloGeometry const&); @@ -66,9 +74,10 @@ namespace hgcal { inline const CaloGeometry* getGeometry() const { return geom_; }; unsigned int lastLayerEE(bool nose = false) const { return (nose ? HFNoseDetId::HFNoseLayerEEmax : fhOffset_); } unsigned int lastLayerFH() const { return fhLastLayer_; } - unsigned int firstLayerBH() const { return bhOffset_ + 1; } + unsigned int firstLayerBH() const { return bhFirstLayer_; } unsigned int lastLayerBH() const { return bhLastLayer_; } unsigned int lastLayer(bool nose = false) const { return (nose ? noseLastLayer_ : bhLastLayer_); } + std::pair firstAndLastLayer(DetId::Detector det, int subdet) const; unsigned int maxNumberOfWafersPerLayer(bool nose = false) const { return (nose ? maxNumberOfWafersNose_ : maxNumberOfWafersPerLayer_); } @@ -78,7 +87,7 @@ namespace hgcal { private: const CaloGeometry* geom_; - unsigned int fhOffset_, bhOffset_, bhLastLayer_, fhLastLayer_, noseLastLayer_; + unsigned int eeOffset_, fhOffset_, bhFirstLayer_, bhLastLayer_, bhOffset_, fhLastLayer_, noseLastLayer_; unsigned int maxNumberOfWafersPerLayer_, maxNumberOfWafersNose_; int geometryType_; int bhMaxIphi_; diff --git a/RecoLocalCalo/HGCalRecAlgos/src/RecHitTools.cc b/RecoLocalCalo/HGCalRecAlgos/src/RecHitTools.cc index 4b3424e8e8cb2..e55845499bb28 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/RecHitTools.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/RecHitTools.cc @@ -73,29 +73,32 @@ void RecHitTools::setGeometry(const CaloGeometry& geom) { //check if it's the new geometry if (geomEE) { geometryType_ = 1; - fhOffset_ = (geomEE->topology().dddConstants()).layers(true); + eeOffset_ = (geomEE->topology().dddConstants()).getLayerOffset(); wmaxEE = (geomEE->topology().dddConstants()).waferCount(0); auto geomFH = static_cast( geom_->getSubdetectorGeometry(DetId::HGCalHSi, ForwardSubdetector::ForwardEmpty)); + fhOffset_ = (geomFH->topology().dddConstants()).getLayerOffset(); wmaxFH = (geomFH->topology().dddConstants()).waferCount(0); - fhLastLayer_ = fhOffset_ + (geomFH->topology().dddConstants()).layers(true); + fhLastLayer_ = fhOffset_ + (geomFH->topology().dddConstants()).lastLayer(true); auto geomBH = static_cast( geom_->getSubdetectorGeometry(DetId::HGCalHSc, ForwardSubdetector::ForwardEmpty)); - bhOffset_ = - fhOffset_ + (geomBH->topology().dddConstants()).firstLayer() - (geomEE->topology().dddConstants()).firstLayer(); - bhLastLayer_ = bhOffset_ + (geomBH->topology().dddConstants()).layers(true); + bhOffset_ = (geomBH->topology().dddConstants()).getLayerOffset(); + bhFirstLayer_ = bhOffset_ + (geomBH->topology().dddConstants()).firstLayer(); + bhLastLayer_ = bhOffset_ + (geomBH->topology().dddConstants()).lastLayer(true); bhMaxIphi_ = geomBH->topology().dddConstants().maxCells(true); } else { geometryType_ = 0; geomEE = static_cast(geom_->getSubdetectorGeometry(DetId::Forward, ForwardSubdetector::HGCEE)); - fhOffset_ = (geomEE->topology().dddConstants()).layers(true); + eeOffset_ = (geomEE->topology().dddConstants()).getLayerOffset(); wmaxEE = 1 + (geomEE->topology().dddConstants()).waferMax(); auto geomFH = static_cast(geom_->getSubdetectorGeometry(DetId::Forward, ForwardSubdetector::HGCHEF)); - bhOffset_ = fhOffset_ + (geomFH->topology().dddConstants()).layers(true); + fhOffset_ = (geomFH->topology().dddConstants()).getLayerOffset(); + fhLastLayer_ = fhOffset_ + (geomFH->topology().dddConstants()).layers(true); + bhOffset_ = fhLastLayer_; + bhFirstLayer_ = bhOffset_ + 1; wmaxFH = 1 + (geomFH->topology().dddConstants()).waferMax(); - fhLastLayer_ = bhOffset_; auto geomBH = static_cast(geom_->getSubdetectorGeometry(DetId::Hcal, HcalSubdetector::HcalEndcap)); bhLastLayer_ = bhOffset_ + (geomBH->topology().dddConstants())->getMaxDepth(1); @@ -470,6 +473,18 @@ float RecHitTools::getPt(const DetId& id, const float& hitEnergy, const float& v return pt; } +std::pair RecHitTools::firstAndLastLayer(DetId::Detector det, int subdet) const { + if ((det == DetId::HGCalEE) || ((det == DetId::Forward) && (subdet == HGCEE))) { + return std::make_pair(eeOffset_ + 1, fhOffset_); + } else if ((det == DetId::HGCalHSi) || ((det == DetId::Forward) && (subdet == HGCHEF))) { + return std::make_pair(fhOffset_ + 1, fhLastLayer_); + } else if ((det == DetId::Forward) && (subdet == HFNose)) { + return std::make_pair(1, noseLastLayer_); + } else { + return std::make_pair(bhFirstLayer_, bhLastLayer_); + } +} + bool RecHitTools::maskCell(const DetId& id, int corners) const { if (id.det() == DetId::Hcal) { return false; diff --git a/RecoLocalCalo/HGCalRecAlgos/test/BuildFile.xml b/RecoLocalCalo/HGCalRecAlgos/test/BuildFile.xml new file mode 100644 index 0000000000000..0e0662ca3a67e --- /dev/null +++ b/RecoLocalCalo/HGCalRecAlgos/test/BuildFile.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/RecoLocalCalo/HGCalRecAlgos/test/HGCalTestRecHitTools.cc b/RecoLocalCalo/HGCalRecAlgos/test/HGCalTestRecHitTools.cc new file mode 100644 index 0000000000000..4b96f41343749 --- /dev/null +++ b/RecoLocalCalo/HGCalRecAlgos/test/HGCalTestRecHitTools.cc @@ -0,0 +1,57 @@ +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" +#include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" +#include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" + +#include + +class HGCalTestRecHitTools : public edm::one::EDAnalyzer<> { +public: + explicit HGCalTestRecHitTools(const edm::ParameterSet&); + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + void beginJob() override {} + void analyze(edm::Event const& iEvent, edm::EventSetup const&) override; + void endJob() override {} + +private: + const edm::ESGetToken tok_geom_; + hgcal::RecHitTools tool_; +}; + +HGCalTestRecHitTools::HGCalTestRecHitTools(const edm::ParameterSet&) + : tok_geom_(esConsumes()) {} + +void HGCalTestRecHitTools::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + descriptions.add("hgcalRecHitTools", desc); +} + +void HGCalTestRecHitTools::analyze(const edm::Event& /*iEvent*/, const edm::EventSetup& iSetup) { + const CaloGeometry geo = iSetup.getData(tok_geom_); + tool_.setGeometry(geo); + + edm::LogVerbatim("HGCalGeom") << "EE: Last Layer " << tool_.lastLayerEE(); + edm::LogVerbatim("HGCalGeom") << "FH: Last Layer " << tool_.lastLayerFH(); + edm::LogVerbatim("HGCalGeom") << "BH: First & Last Layer " << tool_.firstLayerBH() << ":" << tool_.lastLayerBH(); + edm::LogVerbatim("HGCalGeom") << "Last Layer " << tool_.lastLayer(); + std::vector dets = {DetId::HGCalEE, DetId::HGCalHSi, DetId::HGCalHSc}; + for (const auto& det : dets) { + auto layer = tool_.firstAndLastLayer(det, 0); + edm::LogVerbatim("HGCalGeom") << "First & Last Layer for Det " << det << " are " << layer.first << ":" + << layer.second; + } + + edm::LogVerbatim("HGCalGeom") << "Maximum # of wafers per layer " << tool_.maxNumberOfWafersPerLayer(); + edm::LogVerbatim("HGCalGeom") << "Maximum # of iphi: " << tool_.getScintMaxIphi(); + edm::LogVerbatim("HGCalGeom") << "Geometry type " << tool_.getGeometryType(); +} + +DEFINE_FWK_MODULE(HGCalTestRecHitTools); diff --git a/RecoLocalCalo/HGCalRecAlgos/test/testHGCalRecHitTools_cfg.py b/RecoLocalCalo/HGCalRecAlgos/test/testHGCalRecHitTools_cfg.py new file mode 100644 index 0000000000000..78bc13d5f5874 --- /dev/null +++ b/RecoLocalCalo/HGCalRecAlgos/test/testHGCalRecHitTools_cfg.py @@ -0,0 +1,38 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 +process = cms.Process('PROD',Phase2C11) + +process.load("SimGeneral.HepPDTESSource.pdt_cfi") +process.load('Configuration.Geometry.GeometryExtended2026D86Reco_cff') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load("RecoLocalCalo.HGCalRecAlgos.hgcalRecHitTools_cfi") + +if hasattr(process,'MessageLogger'): + process.MessageLogger.HGCalGeom=dict() + +process.load("IOMC.RandomEngine.IOMC_cff") +process.RandomNumberGeneratorService.generator.initialSeed = 456789 + +process.source = cms.Source("EmptySource") + +process.generator = cms.EDProducer("FlatRandomEGunProducer", + PGunParameters = cms.PSet( + PartID = cms.vint32(14), + MinEta = cms.double(-3.5), + MaxEta = cms.double(3.5), + MinPhi = cms.double(-3.14159265359), + MaxPhi = cms.double(3.14159265359), + MinE = cms.double(9.99), + MaxE = cms.double(10.01) + ), + AddAntiParticle = cms.bool(False), + Verbosity = cms.untracked.int32(0), + firstRun = cms.untracked.uint32(1) +) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1) +) + +process.p1 = cms.Path(process.generator*process.hgcalRecHitTools) diff --git a/RecoPixelVertexing/PixelVertexFinding/test/VertexFinder_t.h b/RecoPixelVertexing/PixelVertexFinding/test/VertexFinder_t.h index 52253a1e4bbfe..5f8a0646c726a 100644 --- a/RecoPixelVertexing/PixelVertexFinding/test/VertexFinder_t.h +++ b/RecoPixelVertexing/PixelVertexFinding/test/VertexFinder_t.h @@ -67,9 +67,10 @@ struct ClusterGenerator { ev.ztrack.clear(); ev.eztrack.clear(); ev.ivert.clear(); + ev.pttrack.clear(); for (int iv = 0; iv < nclus; ++iv) { auto nt = trackGen(reng); - ev.itrack[nclus] = nt; + ev.itrack[iv] = nt; for (int it = 0; it < nt; ++it) { auto err = errgen(reng); // reality is not flat.... ev.ztrack.push_back(ev.zvert[iv] + err * gauss(reng)); diff --git a/RecoTauTag/HLTProducers/python/applyL2TauTag.py b/RecoTauTag/HLTProducers/python/applyL2TauTag.py index 4ebe47f5bc22c..4a1291ffe8466 100644 --- a/RecoTauTag/HLTProducers/python/applyL2TauTag.py +++ b/RecoTauTag/HLTProducers/python/applyL2TauTag.py @@ -52,7 +52,8 @@ def update(process): nExpected = 2, L1TauSrc = 'hltL1sDoubleTauBigOR', L2Outcomes = 'hltL2TauTagNNProducer:DoubleTau', - DiscrWP = thWp[working_point] + DiscrWP = thWp[working_point], + l1TauPtThreshold = 250, ) # L2 updated Sequence process.hltL2TauTagNNSequence = cms.Sequence(process.HLTDoCaloSequence + process.hltL1sDoubleTauBigOR + process.hltL2TauTagNNProducer) diff --git a/RecoTauTag/HLTProducers/src/L2TauTagFilter.cc b/RecoTauTag/HLTProducers/src/L2TauTagFilter.cc index 9b52a5a8c3b80..7e3e2b0ea9e7d 100644 --- a/RecoTauTag/HLTProducers/src/L2TauTagFilter.cc +++ b/RecoTauTag/HLTProducers/src/L2TauTagFilter.cc @@ -26,7 +26,8 @@ class L2TauTagFilter : public HLTFilter { l1TauSrc_(cfg.getParameter("L1TauSrc")), l1TauSrcToken_(consumes(l1TauSrc_)), l2OutcomesToken_(consumes>(cfg.getParameter("L2Outcomes"))), - discrWP_(cfg.getParameter("DiscrWP")) {} + discrWP_(cfg.getParameter("DiscrWP")), + l1PtTh_(cfg.getParameter("l1TauPtThreshold")) {} static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; makeHLTFilterDescription(desc); @@ -35,6 +36,7 @@ class L2TauTagFilter : public HLTFilter { ->setComment("Which trigger should the L1 Taus collection pass"); desc.add("L2Outcomes", edm::InputTag(""))->setComment("L2 CNN outcomes"); desc.add("DiscrWP", 0.1227)->setComment("value of discriminator threshold"); + desc.add("l1TauPtThreshold", 250)->setComment("value of L1Tau pass-through pt threshold"); descriptions.addWithDefaultLabel(desc); } @@ -55,7 +57,7 @@ class L2TauTagFilter : public HLTFilter { throw cms::Exception("Inconsistent Data", "L2TauTagFilter::hltFilter") << "CNN output size != L1 taus size \n"; } for (size_t l1_idx = 0; l1_idx < l1Taus.size(); l1_idx++) { - if (L2Outcomes[l1_idx] >= discrWP_) { + if (L2Outcomes[l1_idx] >= discrWP_ || l1Taus[l1_idx]->pt() > l1PtTh_) { filterproduct.addObject(nTauPassed, l1Taus[l1_idx]); nTauPassed++; } @@ -70,6 +72,7 @@ class L2TauTagFilter : public HLTFilter { const edm::EDGetTokenT l1TauSrcToken_; const edm::EDGetTokenT> l2OutcomesToken_; const double discrWP_; + const double l1PtTh_; }; //define this as a plug-in diff --git a/RecoTauTag/HLTProducers/src/L2TauTagNNProducer.cc b/RecoTauTag/HLTProducers/src/L2TauTagNNProducer.cc index 9b6621a9d4ab7..93c6e10e56ca7 100644 --- a/RecoTauTag/HLTProducers/src/L2TauTagNNProducer.cc +++ b/RecoTauTag/HLTProducers/src/L2TauTagNNProducer.cc @@ -255,18 +255,21 @@ void L2TauNNProducer::fillDescriptions(edm::ConfigurationDescriptions& descripti edm::ParameterSetDescription desc; desc.add("debugLevel", 0)->setComment("set debug level for printing out info"); edm::ParameterSetDescription l1TausPset; - l1TausPset.add("L1CollectionName", "")->setComment("Name of collections"); - l1TausPset.add("L1TauTrigger", edm::InputTag("")) + l1TausPset.add("L1CollectionName", "DoubleTau")->setComment("Name of collections"); + l1TausPset.add("L1TauTrigger", edm::InputTag("hltL1sDoubleTauBigOR")) ->setComment("Which trigger should the L1 Taus collection pass"); - desc.addVPSet("L1Taus", l1TausPset); - desc.add("hbheInput", edm::InputTag(""))->setComment("HBHE recHit collection"); - desc.add("hoInput", edm::InputTag(""))->setComment("HO recHit Collection"); - desc.add("ebInput", edm::InputTag(""))->setComment("EB recHit Collection"); - desc.add("eeInput", edm::InputTag(""))->setComment("EE recHit Collection"); + edm::ParameterSet l1TausPSetDefault; + l1TausPSetDefault.addParameter("L1CollectionName", "DoubleTau"); + l1TausPSetDefault.addParameter("L1TauTrigger", edm::InputTag("hltL1sDoubleTauBigOR")); + desc.addVPSet("L1Taus", l1TausPset, {l1TausPSetDefault}); + desc.add("hbheInput", edm::InputTag("hltHbhereco"))->setComment("HBHE recHit collection"); + desc.add("hoInput", edm::InputTag("hltHoreco"))->setComment("HO recHit Collection"); + desc.add("ebInput", edm::InputTag("hltEcalRecHit:EcalRecHitsEB"))->setComment("EB recHit Collection"); + desc.add("eeInput", edm::InputTag("hltEcalRecHit:EcalRecHitsEE"))->setComment("EE recHit Collection"); desc.add("pataVertices", edm::InputTag("hltPixelVerticesSoA")) ->setComment("patatrack vertices collection"); desc.add("pataTracks", edm::InputTag("hltPixelTracksSoA"))->setComment("patatrack collection"); - desc.add("BeamSpot", edm::InputTag(""))->setComment("BeamSpot Collection"); + desc.add("BeamSpot", edm::InputTag("hltOnlineBeamSpot"))->setComment("BeamSpot Collection"); desc.add("maxVtx", 100)->setComment("max output collection size (number of accepted vertices)"); desc.add("fractionSumPt2", 0.3)->setComment("threshold on sumPt2 fraction of the leading vertex"); desc.add("minSumPt2", 0.)->setComment("min sumPt2"); @@ -403,8 +406,8 @@ void L2TauNNProducer::fillL1TauVars(tensorflow::Tensor& cellGridMatrix, const st auto getCell = [&](NNInputs input) -> float& { return getCellImpl(cellGridMatrix, tau_idx, phi_idx, eta_idx, input); }; - getCell(NNInputs::l1Tau_pt) = allTaus[tau_idx]->polarP4().pt(); - getCell(NNInputs::l1Tau_eta) = allTaus[tau_idx]->polarP4().eta(); + getCell(NNInputs::l1Tau_pt) = allTaus[tau_idx]->pt(); + getCell(NNInputs::l1Tau_eta) = allTaus[tau_idx]->eta(); getCell(NNInputs::l1Tau_hwIso) = allTaus[tau_idx]->hwIso(); } } @@ -675,8 +678,8 @@ void L2TauNNProducer::fillPatatracks(tensorflow::Tensor& cellGridMatrix, }; const int nTaus = static_cast(allTaus.size()); for (tau_idx = 0; tau_idx < nTaus; tau_idx++) { - const float tauEta = allTaus[tau_idx]->polarP4().eta(); - const float tauPhi = allTaus[tau_idx]->polarP4().phi(); + const float tauEta = allTaus[tau_idx]->eta(); + const float tauPhi = allTaus[tau_idx]->phi(); auto maxTracks = patatracks_tsoa.stride(); auto const* quality = patatracks_tsoa.qualityData(); @@ -826,7 +829,7 @@ void L2TauNNProducer::produce(edm::Event& event, const edm::EventSetup& eventset for (size_t tau_pos = 0; tau_pos < nTau; ++tau_pos) { const auto tau_idx = TauCollectionMap[inp_idx][tau_pos]; if (debugLevel_ > 0) { - edm::LogInfo("DebugInfo") << event.id().event() << " \t " << (allTaus[tau_idx])->polarP4().pt() << " \t " + edm::LogInfo("DebugInfo") << event.id().event() << " \t " << (allTaus[tau_idx])->pt() << " \t " << tau_score.at(tau_idx) << std::endl; } (*tau_tags)[tau_pos] = tau_score.at(tau_idx); diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index 9e6fc7c103db2..6fa3a45c9a342 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -1163,9 +1163,9 @@ class DeepTauId : public deep_tau::DeepTauBase { desc.add("save_inputs", false); desc.add("is_online", false); - desc.add>("VSeWP"); - desc.add>("VSmuWP"); - desc.add>("VSjetWP"); + desc.add>("VSeWP", {"-1."}); + desc.add>("VSmuWP", {"-1."}); + desc.add>("VSjetWP", {"-1."}); desc.addUntracked("basicTauDiscriminators", edm::InputTag("basicTauDiscriminators")); desc.addUntracked("basicTauDiscriminatorsdR03", edm::InputTag("basicTauDiscriminatorsdR03")); diff --git a/RecoTracker/MkFit/plugins/MkFitIterationConfigESProducer.cc b/RecoTracker/MkFit/plugins/MkFitIterationConfigESProducer.cc index c68d3802ae65f..930c9c4da6342 100644 --- a/RecoTracker/MkFit/plugins/MkFitIterationConfigESProducer.cc +++ b/RecoTracker/MkFit/plugins/MkFitIterationConfigESProducer.cc @@ -14,10 +14,10 @@ namespace { using namespace mkfit; - void partitionSeeds0(const TrackerInfo &trk_info, - const TrackVec &in_seeds, - const EventOfHits &eoh, - IterationSeedPartition &part) { + [[maybe_unused]] void partitionSeeds0(const TrackerInfo &trk_info, + const TrackVec &in_seeds, + const EventOfHits &eoh, + IterationSeedPartition &part) { const size_t size = in_seeds.size(); for (size_t i = 0; i < size; ++i) { @@ -25,7 +25,7 @@ namespace { const bool z_dir_pos = S.pz() > 0; - HitOnTrack hot = S.getLastHitOnTrack(); + const auto &hot = S.getLastHitOnTrack(); const float eta = eoh[hot.layer].GetHit(hot.index).eta(); // Region to be defined by propagation / intersection tests @@ -82,6 +82,115 @@ namespace { part.m_sort_score[i] = maxEta_regSort * (reg - TrackerInfo::Reg_Barrel) + eta; } } + + [[maybe_unused]] void partitionSeeds1(const TrackerInfo &trk_info, + const TrackVec &in_seeds, + const EventOfHits &eoh, + IterationSeedPartition &part) { + const LayerInfo &tib1 = trk_info.m_layers[4]; + const LayerInfo &tob1 = trk_info.m_layers[10]; + + const LayerInfo &tidp1 = trk_info.m_layers[21]; + const LayerInfo &tidn1 = trk_info.m_layers[48]; + + const LayerInfo &tecp1 = trk_info.m_layers[27]; + const LayerInfo &tecn1 = trk_info.m_layers[54]; + + // Merge first two layers to account for mono/stereo coverage. + // TrackerInfo could hold joint limits for sub-detectors. + const auto &L = trk_info.m_layers; + const float tidp_rin = std::min(L[21].m_rin, L[22].m_rin); + const float tidp_rout = std::max(L[21].m_rout, L[22].m_rout); + const float tecp_rin = std::min(L[27].m_rin, L[28].m_rin); + const float tecp_rout = std::max(L[27].m_rout, L[28].m_rout); + const float tidn_rin = std::min(L[48].m_rin, L[49].m_rin); + const float tidn_rout = std::max(L[48].m_rout, L[49].m_rout); + const float tecn_rin = std::min(L[54].m_rin, L[55].m_rin); + const float tecn_rout = std::max(L[54].m_rout, L[55].m_rout); + + // Bias towards more aggressive transition-region assignemnts. + // With current tunning it seems to make things a bit worse. + const float tid_z_extra = 0.0f; // 5.0f; + const float tec_z_extra = 0.0f; // 10.0f; + + const size_t size = in_seeds.size(); + + auto barrel_pos_check = [](const Track &S, float maxR, float rin, float zmax) -> bool { + bool inside = maxR > rin && S.zAtR(rin) < zmax; + return inside; + }; + + auto barrel_neg_check = [](const Track &S, float maxR, float rin, float zmin) -> bool { + bool inside = maxR > rin && S.zAtR(rin) > zmin; + return inside; + }; + + auto endcap_pos_check = [](const Track &S, float maxR, float rout, float rin, float zmin) -> bool { + bool inside = maxR > rout ? S.zAtR(rout) > zmin : (maxR > rin && S.zAtR(maxR) > zmin); + return inside; + }; + + auto endcap_neg_check = [](const Track &S, float maxR, float rout, float rin, float zmax) -> bool { + bool inside = maxR > rout ? S.zAtR(rout) < zmax : (maxR > rin && S.zAtR(maxR) < zmax); + return inside; + }; + + for (size_t i = 0; i < size; ++i) { + const Track &S = in_seeds[i]; + + const auto &hot = S.getLastHitOnTrack(); + const float eta = eoh[hot.layer].GetHit(hot.index).eta(); + + // Region to be defined by propagation / intersection tests + TrackerInfo::EtaRegion reg; + + // Max eta used for region sorting + constexpr float maxEta_regSort = 7.0; + + const bool z_dir_pos = S.pz() > 0; + const float maxR = S.maxReachRadius(); + + if (z_dir_pos) { + const bool in_tib = barrel_pos_check(S, maxR, tib1.m_rin, tib1.m_zmax); + const bool in_tob = barrel_pos_check(S, maxR, tob1.m_rin, tob1.m_zmax); + + if (!in_tib && !in_tob) { + reg = TrackerInfo::Reg_Endcap_Pos; + } else { + const bool in_tid = endcap_pos_check(S, maxR, tidp_rout, tidp_rin, tidp1.m_zmin - tid_z_extra); + const bool in_tec = endcap_pos_check(S, maxR, tecp_rout, tecp_rin, tecp1.m_zmin - tec_z_extra); + + if (!in_tid && !in_tec) { + reg = TrackerInfo::Reg_Barrel; + } else { + reg = TrackerInfo::Reg_Transition_Pos; + } + } + } else { + const bool in_tib = barrel_neg_check(S, maxR, tib1.m_rin, tib1.m_zmin); + const bool in_tob = barrel_neg_check(S, maxR, tob1.m_rin, tob1.m_zmin); + + if (!in_tib && !in_tob) { + reg = TrackerInfo::Reg_Endcap_Neg; + } else { + const bool in_tid = endcap_neg_check(S, maxR, tidn_rout, tidn_rin, tidn1.m_zmax + tid_z_extra); + const bool in_tec = endcap_neg_check(S, maxR, tecn_rout, tecn_rin, tecn1.m_zmax + tec_z_extra); + + if (!in_tid && !in_tec) { + reg = TrackerInfo::Reg_Barrel; + } else { + reg = TrackerInfo::Reg_Transition_Neg; + } + } + } + + part.m_region[i] = reg; + + // TrackerInfo::EtaRegion is enum from 0 to 5 (Reg_Endcap_Neg,Reg_Transition_Neg,Reg_Barrel,Reg_Transition_Pos,Reg_Endcap_Pos) + // Symmetrization around TrackerInfo::Reg_Barrel for sorting is required + part.m_sort_score[i] = maxEta_regSort * (reg - TrackerInfo::Reg_Barrel) + eta; + } + } } // namespace class MkFitIterationConfigESProducer : public edm::ESProducer { @@ -111,7 +220,7 @@ void MkFitIterationConfigESProducer::fillDescriptions(edm::ConfigurationDescript std::unique_ptr MkFitIterationConfigESProducer::produce( const TrackerRecoGeometryRecord &iRecord) { auto it_conf = mkfit::ConfigJson_Load_File(configFile_); - it_conf->m_partition_seeds = partitionSeeds0; + it_conf->m_partition_seeds = partitionSeeds1; return it_conf; } diff --git a/RecoTracker/MkFit/plugins/MkFitSeedConverter.cc b/RecoTracker/MkFit/plugins/MkFitSeedConverter.cc index d4ba6d083ef86..fb427aa22d2ce 100644 --- a/RecoTracker/MkFit/plugins/MkFitSeedConverter.cc +++ b/RecoTracker/MkFit/plugins/MkFitSeedConverter.cc @@ -8,6 +8,7 @@ #include "DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h" #include "DataFormats/TrackerRecHit2D/interface/OmniClusterRef.h" #include "DataFormats/TrackerRecHit2D/interface/trackerHitRTTI.h" +#include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h" #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "DataFormats/TrackerCommon/interface/TrackerDetSide.h" @@ -129,13 +130,28 @@ mkfit::TrackVec MkFitSeedConverter::convertSeeds(const edm::View if (not trackerHitRTTI::isFromDet(recHit)) { throw cms::Exception("Assert") << "Encountered a seed with a hit which is not trackerHitRTTI::isFromDet()"; } - const auto& clusterRef = static_cast(recHit).firstClusterRef(); - const auto detId = recHit.geographicalId(); - const auto ilay = mkFitGeom.layerNumberConverter().convertLayerNumber( - detId.subdetId(), ttopo.layer(detId), false, ttopo.isStereo(detId), isPlusSide(detId)); - LogTrace("MkFitSeedConverter") << " addin hit detid " << detId.rawId() << " index " << clusterRef.index() - << " ilay " << ilay; - ret.back().addHitIdx(clusterRef.index(), ilay, 0); // per-hit chi2 is not known + auto& baseTrkRecHit = static_cast(recHit); + if (!baseTrkRecHit.isMatched()) { + const auto& clusterRef = baseTrkRecHit.firstClusterRef(); + const auto detId = recHit.geographicalId(); + const auto ilay = mkFitGeom.layerNumberConverter().convertLayerNumber( + detId.subdetId(), ttopo.layer(detId), false, ttopo.isStereo(detId), isPlusSide(detId)); + LogTrace("MkFitSeedConverter") << " adding hit detid " << detId.rawId() << " index " << clusterRef.index() + << " ilay " << ilay; + ret.back().addHitIdx(clusterRef.index(), ilay, 0); // per-hit chi2 is not known + } else { + auto& matched2D = dynamic_cast(recHit); + const OmniClusterRef* const clRefs[2] = {&matched2D.monoClusterRef(), &matched2D.stereoClusterRef()}; + const DetId detIds[2] = {matched2D.monoId(), matched2D.stereoId()}; + for (int ii = 0; ii < 2; ++ii) { + const auto& detId = detIds[ii]; + const auto ilay = mkFitGeom.layerNumberConverter().convertLayerNumber( + detId.subdetId(), ttopo.layer(detId), false, ttopo.isStereo(detId), isPlusSide(detId)); + LogTrace("MkFitSeedConverter") << " adding matched hit detid " << detId.rawId() << " index " + << clRefs[ii]->index() << " ilay " << ilay; + ret.back().addHitIdx(clRefs[ii]->index(), ilay, 0); // per-hit chi2 is not known + } + } } ++seed_index; } diff --git a/RecoVertex/BeamSpotProducer/plugins/BeamSpotWrite2DB.cc b/RecoVertex/BeamSpotProducer/plugins/BeamSpotWrite2DB.cc index 77ad5650576aa..3ce2a8759df4b 100644 --- a/RecoVertex/BeamSpotProducer/plugins/BeamSpotWrite2DB.cc +++ b/RecoVertex/BeamSpotProducer/plugins/BeamSpotWrite2DB.cc @@ -97,22 +97,22 @@ void BeamSpotWrite2DB::endJob() { fasciiFile >> tag >> emittanceY; fasciiFile >> tag >> betastar; - BeamSpotObjects* abeam = new BeamSpotObjects(); - - abeam->SetType(type); - abeam->SetPosition(x, y, z); - abeam->SetSigmaZ(sigmaZ); - abeam->Setdxdz(dxdz); - abeam->Setdydz(dydz); - abeam->SetBeamWidthX(beamWidthX); - abeam->SetBeamWidthY(beamWidthY); - abeam->SetEmittanceX(emittanceX); - abeam->SetEmittanceY(emittanceY); - abeam->SetBetaStar(betastar); + BeamSpotObjects abeam; + + abeam.SetType(type); + abeam.SetPosition(x, y, z); + abeam.SetSigmaZ(sigmaZ); + abeam.Setdxdz(dxdz); + abeam.Setdydz(dydz); + abeam.SetBeamWidthX(beamWidthX); + abeam.SetBeamWidthY(beamWidthY); + abeam.SetEmittanceX(emittanceX); + abeam.SetEmittanceY(emittanceY); + abeam.SetBetaStar(betastar); for (int i = 0; i < 7; ++i) { for (int j = 0; j < 7; ++j) { - abeam->SetCovariance(i, j, cov[i][j]); + abeam.SetCovariance(i, j, cov[i][j]); } } @@ -123,11 +123,10 @@ void BeamSpotWrite2DB::endJob() { edm::LogPrint("BeamSpotWrite2DB") << "poolDBService available"; if (poolDbService->isNewTagRequest("BeamSpotObjectsRcd")) { edm::LogPrint("BeamSpotWrite2DB") << "new tag requested"; - poolDbService->createNewIOV( - abeam, poolDbService->beginOfTime(), poolDbService->endOfTime(), "BeamSpotObjectsRcd"); + poolDbService->createOneIOV(abeam, poolDbService->beginOfTime(), "BeamSpotObjectsRcd"); } else { edm::LogPrint("BeamSpotWrite2DB") << "no new tag requested"; - poolDbService->appendSinceTime(abeam, poolDbService->currentTime(), "BeamSpotObjectsRcd"); + poolDbService->appendOneIOV(abeam, poolDbService->currentTime(), "BeamSpotObjectsRcd"); } } edm::LogPrint("BeamSpotWrite2DB") << "[BeamSpotWrite2DB] endJob done \n"; diff --git a/RecoVertex/BeamSpotProducer/src/BeamFitter.cc b/RecoVertex/BeamSpotProducer/src/BeamFitter.cc index 24106cf5b865b..c73ef041b3835 100644 --- a/RecoVertex/BeamSpotProducer/src/BeamFitter.cc +++ b/RecoVertex/BeamSpotProducer/src/BeamFitter.cc @@ -744,13 +744,13 @@ void BeamFitter::dumpTxtFile(std::string &fileName, bool append) { } void BeamFitter::write2DB() { - BeamSpotObjects *pBSObjects = new BeamSpotObjects(); + BeamSpotObjects pBSObjects; - pBSObjects->SetPosition(fbeamspot.position().X(), fbeamspot.position().Y(), fbeamspot.position().Z()); + pBSObjects.SetPosition(fbeamspot.position().X(), fbeamspot.position().Y(), fbeamspot.position().Z()); //std::cout << " wrote: x= " << fbeamspot.position().X() << " y= "<< fbeamspot.position().Y() << " z= " << fbeamspot.position().Z() << std::endl; - pBSObjects->SetSigmaZ(fbeamspot.sigmaZ()); - pBSObjects->Setdxdz(fbeamspot.dxdz()); - pBSObjects->Setdydz(fbeamspot.dydz()); + pBSObjects.SetSigmaZ(fbeamspot.sigmaZ()); + pBSObjects.Setdxdz(fbeamspot.dxdz()); + pBSObjects.Setdydz(fbeamspot.dydz()); //if (inputBeamWidth_ > 0 ) { // std::cout << " beam width value forced to be " << inputBeamWidth_ << std::endl; // pBSObjects->SetBeamWidthX(inputBeamWidth_); @@ -758,13 +758,13 @@ void BeamFitter::write2DB() { //} else { // need to fix this //std::cout << " using default value, 15e-4, for beam width!!!"<SetBeamWidthX(fbeamspot.BeamWidthX()); - pBSObjects->SetBeamWidthY(fbeamspot.BeamWidthY()); + pBSObjects.SetBeamWidthX(fbeamspot.BeamWidthX()); + pBSObjects.SetBeamWidthY(fbeamspot.BeamWidthY()); //} for (int i = 0; i < 7; ++i) { for (int j = 0; j < 7; ++j) { - pBSObjects->SetCovariance(i, j, fbeamspot.covariance(i, j)); + pBSObjects.SetCovariance(i, j, fbeamspot.covariance(i, j)); } } edm::Service poolDbService; @@ -772,11 +772,10 @@ void BeamFitter::write2DB() { std::cout << "poolDBService available" << std::endl; if (poolDbService->isNewTagRequest("BeamSpotObjectsRcd")) { std::cout << "new tag requested" << std::endl; - poolDbService->createNewIOV( - pBSObjects, poolDbService->beginOfTime(), poolDbService->endOfTime(), "BeamSpotObjectsRcd"); + poolDbService->createOneIOV(pBSObjects, poolDbService->beginOfTime(), "BeamSpotObjectsRcd"); } else { std::cout << "no new tag requested" << std::endl; - poolDbService->appendSinceTime(pBSObjects, poolDbService->currentTime(), "BeamSpotObjectsRcd"); + poolDbService->appendOneIOV(pBSObjects, poolDbService->currentTime(), "BeamSpotObjectsRcd"); } } } diff --git a/SimG4CMS/CherenkovAnalysis/data/SingleDREAMDD4Hep.xml b/SimG4CMS/CherenkovAnalysis/data/SingleDREAMDD4hep.xml similarity index 100% rename from SimG4CMS/CherenkovAnalysis/data/SingleDREAMDD4Hep.xml rename to SimG4CMS/CherenkovAnalysis/data/SingleDREAMDD4hep.xml diff --git a/SimG4CMS/CherenkovAnalysis/interface/DreamSD.h b/SimG4CMS/CherenkovAnalysis/interface/DreamSD.h index 3205f0f3bbfb9..514d7c4a17e55 100644 --- a/SimG4CMS/CherenkovAnalysis/interface/DreamSD.h +++ b/SimG4CMS/CherenkovAnalysis/interface/DreamSD.h @@ -58,10 +58,10 @@ class DreamSD : public CaloSD { bool setPbWO2MaterialProperties_(G4Material *aMaterial); static constexpr double k_ScaleFromDDDToG4 = 1.0; - static constexpr double k_ScaleFromDD4HepToG4 = 1.0 / dd4hep::mm; + static constexpr double k_ScaleFromDD4hepToG4 = 1.0 / dd4hep::mm; const DDCompactView *cpvDDD_; - const cms::DDCompactView *cpvDD4Hep_; + const cms::DDCompactView *cpvDD4hep_; bool useBirk_, doCherenkov_, readBothSide_, dd4hep_; double birk1_, birk2_, birk3_; diff --git a/SimG4CMS/CherenkovAnalysis/plugins/DreamSensitiveDetectorBuilder.cc b/SimG4CMS/CherenkovAnalysis/plugins/DreamSensitiveDetectorBuilder.cc index 20a1e1c4a2228..bc020b7ea525e 100644 --- a/SimG4CMS/CherenkovAnalysis/plugins/DreamSensitiveDetectorBuilder.cc +++ b/SimG4CMS/CherenkovAnalysis/plugins/DreamSensitiveDetectorBuilder.cc @@ -20,17 +20,17 @@ class DreamSensitiveDetectorBuilder : public SensitiveDetectorMakerBase { public: explicit DreamSensitiveDetectorBuilder(edm::ParameterSet const& p, edm::ConsumesCollector cc) { - fromDD4Hep_ = p.getParameter("g4GeometryDD4hepSource"); - if (fromDD4Hep_) - cpvTokenDD4Hep_ = cc.esConsumes(); + fromDD4hep_ = p.getParameter("g4GeometryDD4hepSource"); + if (fromDD4hep_) + cpvTokenDD4hep_ = cc.esConsumes(); else cpvTokenDDD_ = cc.esConsumes(); - edm::LogVerbatim("EcalSim") << "DreamSensitiveDetectorBuilder called with dd4hep flag " << fromDD4Hep_; + edm::LogVerbatim("EcalSim") << "DreamSensitiveDetectorBuilder called with dd4hep flag " << fromDD4hep_; } void beginRun(const edm::EventSetup& es) final { - if (fromDD4Hep_) { - cpvDD4Hep_ = &es.getData(cpvTokenDD4Hep_); + if (fromDD4hep_) { + cpvDD4hep_ = &es.getData(cpvTokenDD4hep_); } else { cpvDDD_ = &es.getData(cpvTokenDDD_); } @@ -41,17 +41,17 @@ class DreamSensitiveDetectorBuilder : public SensitiveDetectorMakerBase { const edm::ParameterSet& p, const SimTrackManager* man, SimActivityRegistry& reg) const final { - auto sd = std::make_unique(iname, cpvDDD_, cpvDD4Hep_, clg, p, man); + auto sd = std::make_unique(iname, cpvDDD_, cpvDD4hep_, clg, p, man); SimActivityRegistryEnroller::enroll(reg, sd.get()); return sd; } private: - bool fromDD4Hep_; + bool fromDD4hep_; edm::ESGetToken cpvTokenDDD_; - edm::ESGetToken cpvTokenDD4Hep_; + edm::ESGetToken cpvTokenDD4hep_; const DDCompactView* cpvDDD_; - const cms::DDCompactView* cpvDD4Hep_; + const cms::DDCompactView* cpvDD4hep_; }; typedef DreamSD DreamSensitiveDetector; diff --git a/SimG4CMS/CherenkovAnalysis/src/DreamSD.cc b/SimG4CMS/CherenkovAnalysis/src/DreamSD.cc index 57f355729dc12..db3fc73ca3197 100644 --- a/SimG4CMS/CherenkovAnalysis/src/DreamSD.cc +++ b/SimG4CMS/CherenkovAnalysis/src/DreamSD.cc @@ -30,11 +30,11 @@ //________________________________________________________________________________________ DreamSD::DreamSD(const std::string &name, const DDCompactView *cpvDDD, - const cms::DDCompactView *cpvDD4Hep, + const cms::DDCompactView *cpvDD4hep, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *manager) - : CaloSD(name, clg, p, manager), cpvDDD_(cpvDDD), cpvDD4Hep_(cpvDD4Hep) { + : CaloSD(name, clg, p, manager), cpvDDD_(cpvDDD), cpvDD4hep_(cpvDD4hep) { edm::ParameterSet m_EC = p.getParameter("ECalSD"); useBirk_ = m_EC.getParameter("UseBirkLaw"); doCherenkov_ = m_EC.getParameter("doCherenkov"); @@ -120,7 +120,7 @@ uint32_t DreamSD::setDetUnitId(const G4Step *aStep) { void DreamSD::initMap(const std::string &sd) { if (dd4hep_) { const cms::DDFilter filter("ReadOutName", sd); - cms::DDFilteredView fv((*cpvDD4Hep_), filter); + cms::DDFilteredView fv((*cpvDD4hep_), filter); while (fv.firstChild()) { std::string name = static_cast(dd4hep::dd::noNamespace(fv.name())); std::vector paras(fv.parameters()); @@ -130,8 +130,8 @@ void DreamSD::initMap(const std::string &sd) { #endif // Set length to be the largest size, width the smallest std::sort(paras.begin(), paras.end()); - double length = 2.0 * k_ScaleFromDD4HepToG4 * paras.back(); - double width = 2.0 * k_ScaleFromDD4HepToG4 * paras.front(); + double length = 2.0 * k_ScaleFromDD4hepToG4 * paras.back(); + double width = 2.0 * k_ScaleFromDD4hepToG4 * paras.front(); fillMap(name, length, width); } } else { diff --git a/SimG4CMS/CherenkovAnalysis/test/runSingleDREAMDD4Hep_cfg.py b/SimG4CMS/CherenkovAnalysis/test/runSingleDREAMDD4hep_cfg.py similarity index 97% rename from SimG4CMS/CherenkovAnalysis/test/runSingleDREAMDD4Hep_cfg.py rename to SimG4CMS/CherenkovAnalysis/test/runSingleDREAMDD4hep_cfg.py index e4069a5951fbe..c02940a7c4bee 100644 --- a/SimG4CMS/CherenkovAnalysis/test/runSingleDREAMDD4Hep_cfg.py +++ b/SimG4CMS/CherenkovAnalysis/test/runSingleDREAMDD4hep_cfg.py @@ -38,7 +38,7 @@ process.p1 = cms.Path(process.generator*process.VtxSmeared*process.generatorSmeared*process.g4SimHits*process.cherenkovAnalysis) -process.DDDetectorESProducer.confGeomXMLFiles = cms.FileInPath("SimG4CMS/CherenkovAnalysis/data/SingleDREAMDD4Hep.xml") +process.DDDetectorESProducer.confGeomXMLFiles = cms.FileInPath("SimG4CMS/CherenkovAnalysis/data/SingleDREAMDD4hep.xml") process.generator.PGunParameters.MinE = 10.0 process.generator.PGunParameters.MaxE = 10.0 process.g4SimHits.UseMagneticField = False diff --git a/SimG4CMS/CherenkovAnalysis/test/runSingleDREAMDDD_cfg.py b/SimG4CMS/CherenkovAnalysis/test/runSingleDREAMDDD_cfg.py index f00be6da65cf4..e3cca53ddb51c 100644 --- a/SimG4CMS/CherenkovAnalysis/test/runSingleDREAMDDD_cfg.py +++ b/SimG4CMS/CherenkovAnalysis/test/runSingleDREAMDDD_cfg.py @@ -43,7 +43,7 @@ process.g4SimHits.ECalSD = cms.PSet( TestBeam = cms.untracked.bool(False), ReadBothSide = cms.untracked.bool(True), - DD4Hep = cms.untracked.bool(False), + DD4hep = cms.untracked.bool(False), BirkL3Parametrization = cms.bool(False), doCherenkov = cms.bool(True), BirkCut = cms.double(0.1), diff --git a/SimG4CMS/CherenkovAnalysis/test/testMuon_cfg.py b/SimG4CMS/CherenkovAnalysis/test/testMuon_cfg.py index 3f77a26b73315..3f300c9526f53 100644 --- a/SimG4CMS/CherenkovAnalysis/test/testMuon_cfg.py +++ b/SimG4CMS/CherenkovAnalysis/test/testMuon_cfg.py @@ -73,7 +73,7 @@ TestBeam = cms.untracked.bool(False), ReadBothSide = cms.untracked.bool(False), BirkL3Parametrization = cms.bool(False), - DD4Hep = cms.untracked.bool(False), + DD4hep = cms.untracked.bool(False), doCherenkov = cms.bool(False), BirkCut = cms.double(0.1), BirkC1 = cms.double(0.0045), diff --git a/SimG4CMS/HGCalTestBeam/plugins/HGCPassive.cc b/SimG4CMS/HGCalTestBeam/plugins/HGCPassive.cc index 6c30d5cb7b127..2569fe5edda27 100644 --- a/SimG4CMS/HGCalTestBeam/plugins/HGCPassive.cc +++ b/SimG4CMS/HGCalTestBeam/plugins/HGCPassive.cc @@ -78,7 +78,7 @@ HGCPassive::HGCPassive(const edm::ParameterSet &p) : topPV_(nullptr), topLV_(nul edm::ParameterSet m_Passive = p.getParameter("HGCPassive"); LVNames_ = m_Passive.getParameter>("LVNames"); motherName_ = m_Passive.getParameter("MotherName"); - bool dd4hep = m_Passive.getParameter("IfDD4Hep"); + bool dd4hep = m_Passive.getParameter("IfDD4hep"); addlevel_ = dd4hep ? 1 : 0; #ifdef EDM_ML_DEBUG diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN170_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN170_cfg.py index ffebf5a7ea94d..5b1817ac1669f 100644 --- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN170_cfg.py +++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN170_cfg.py @@ -103,7 +103,7 @@ HGCPassive = cms.PSet( LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), MotherName = cms.string('OCMS'), - IfDD4Hep = cms.bool(False), + IfDD4hep = cms.bool(False), ), type = cms.string('HGCPassive'), ) diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1DD4Hep_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1DD4hep_cfg.py similarity index 97% rename from SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1DD4Hep_cfg.py rename to SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1DD4hep_cfg.py index b6ce1cd26dbd1..ea373e69ce7e7 100644 --- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1DD4Hep_cfg.py +++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1DD4hep_cfg.py @@ -57,14 +57,14 @@ dataTier = cms.untracked.string('GEN-SIM'), filterName = cms.untracked.string('') ), - fileName = cms.untracked.string('file:TBGenSim181Oct1DD4Hep.root'), + fileName = cms.untracked.string('file:TBGenSim181Oct1DD4hep.root'), outputCommands = process.FEVTDEBUGEventContent.outputCommands, splitLevel = cms.untracked.int32(0) ) # Additional output definition process.TFileService = cms.Service("TFileService", - fileName = cms.string('TBGenSimDD4Hep.root') + fileName = cms.string('TBGenSimDD4hep.root') ) # Other statements @@ -105,7 +105,7 @@ HGCPassive = cms.PSet( LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), MotherName = cms.string('OCMS'), - IfDD4Hep = cms.bool(True), + IfDD4hep = cms.bool(True), ), type = cms.string('HGCPassive'), ) diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1PC1mm_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1PC1mm_cfg.py index f7a646183257c..26fdf2fd702bf 100644 --- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1PC1mm_cfg.py +++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1PC1mm_cfg.py @@ -103,7 +103,7 @@ HGCPassive = cms.PSet( LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), MotherName = cms.string('OCMS'), - IfDD4Hep = cms.bool(False), + IfDD4hep = cms.bool(False), ), type = cms.string('HGCPassive'), ) diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1_cfg.py index dedf1c3e905b5..45587c8108c8b 100644 --- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1_cfg.py +++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1_cfg.py @@ -102,7 +102,7 @@ HGCPassive = cms.PSet( LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), MotherName = cms.string('OCMS'), - IfDD4Hep = cms.bool(False), + IfDD4hep = cms.bool(False), ), type = cms.string('HGCPassive'), ) diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1el100_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1el100_cfg.py index 2ff18aae945a8..93469f479eb73 100644 --- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1el100_cfg.py +++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1el100_cfg.py @@ -104,7 +104,7 @@ HGCPassive = cms.PSet( LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), MotherName = cms.string('OCMS'), - IfDD4Hep = cms.bool(False), + IfDD4hep = cms.bool(False), ), type = cms.string('HGCPassive'), ) diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct2_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct2_cfg.py index 78e5591094328..6aa7ac21ce3c5 100644 --- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct2_cfg.py +++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct2_cfg.py @@ -102,7 +102,7 @@ HGCPassive = cms.PSet( LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), MotherName = cms.string('OCMS'), - IfDD4Hep = cms.bool(False), + IfDD4hep = cms.bool(False), ), type = cms.string('HGCPassive'), ) diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct3_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct3_cfg.py index adfa709001079..39677a35f6e8f 100644 --- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct3_cfg.py +++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct3_cfg.py @@ -102,7 +102,7 @@ HGCPassive = cms.PSet( LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), MotherName = cms.string('OCMS'), - IfDD4Hep = cms.bool(False), + IfDD4hep = cms.bool(False), ), type = cms.string('HGCPassive'), ) diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct4_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct4_cfg.py index 26a3a41c82086..0262c64699b8a 100644 --- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct4_cfg.py +++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct4_cfg.py @@ -102,7 +102,7 @@ HGCPassive = cms.PSet( LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), MotherName = cms.string('OCMS'), - IfDD4Hep = cms.bool(False), + IfDD4hep = cms.bool(False), ), type = cms.string('HGCPassive'), ) diff --git a/SimG4Core/PrintGeomInfo/test/SimFileCompare.cpp b/SimG4Core/PrintGeomInfo/test/SimFileCompare.cpp index d20fb2f2b2cb1..1ca8bbf444c99 100644 --- a/SimG4Core/PrintGeomInfo/test/SimFileCompare.cpp +++ b/SimG4Core/PrintGeomInfo/test/SimFileCompare.cpp @@ -9,8 +9,8 @@ // type (int) Type of file: material (0), solid (1), // LogicalVolume (2), PhysicalVolume (3) // files (int) Double digits each inidicating the file source -// (0 for DDD, 1 for DD4HEP). So if first file is -// DDD and second is DD4HEP, it will be 10 +// (0 for DDD, 1 for DD4hep). So if first file is +// DDD and second is DD4hep, it will be 10 // mode (int) Treat (0) or not treat (1) names from DDD // deug (int) Single digit number (0 minimum printout) // @@ -376,7 +376,7 @@ int main(int argc, char* argv[]) { << "name of the first input file\n" << "name of the second input file\n" << "type (Material:0, Solid:1, LV:2, PV:3\n" - << "files (10 if first file from DDD and second from DD4HEP)\n" + << "files (10 if first file from DDD and second from DD4hep)\n" << "mode (treat the name for DDD or not == needed for PV)\n" << "debug flag (0 for minimum printout)\n" << std::endl; diff --git a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckDD4Hep_cfg.py b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckDD4hep_cfg.py similarity index 100% rename from SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckDD4Hep_cfg.py rename to SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckDD4hep_cfg.py diff --git a/SimG4Core/PrintGeomInfo/test/python/runDD4HepBigXML_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runDD4hepBigXML_cfg.py similarity index 100% rename from SimG4Core/PrintGeomInfo/test/python/runDD4HepBigXML_cfg.py rename to SimG4Core/PrintGeomInfo/test/python/runDD4hepBigXML_cfg.py diff --git a/SimG4Core/PrintGeomInfo/test/python/runDD4HepDB_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runDD4hepDB_cfg.py similarity index 100% rename from SimG4Core/PrintGeomInfo/test/python/runDD4HepDB_cfg.py rename to SimG4Core/PrintGeomInfo/test/python/runDD4hepDB_cfg.py diff --git a/SimG4Core/PrintGeomInfo/test/python/runDD4HepXML_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runDD4hepXML_cfg.py similarity index 100% rename from SimG4Core/PrintGeomInfo/test/python/runDD4HepXML_cfg.py rename to SimG4Core/PrintGeomInfo/test/python/runDD4hepXML_cfg.py diff --git a/SimTracker/TrackTriggerAssociation/plugins/TTStubAssociator.cc b/SimTracker/TrackTriggerAssociation/plugins/TTStubAssociator.cc index a252f3c6e0c94..639b8cd0d6507 100644 --- a/SimTracker/TrackTriggerAssociation/plugins/TTStubAssociator.cc +++ b/SimTracker/TrackTriggerAssociation/plugins/TTStubAssociator.cc @@ -24,8 +24,8 @@ void TTStubAssociator::produce(edm::Event& iEvent, const int ncont1 = 0; - const TrackerGeometry* const theTrackerGeom = theTrackerGeometry_.product(); - const TrackerTopology* const tTopo = theTrackerTopology_.product(); + const TrackerGeometry* const theTrackerGeom = &iSetup.getData(theTrackerGeometryToken_); + const TrackerTopology* const tTopo = &iSetup.getData(theTrackerTopologyToken_); /// Loop over the InputTags to handle multiple collections diff --git a/SimTracker/TrackTriggerAssociation/plugins/TTStubAssociator.h b/SimTracker/TrackTriggerAssociation/plugins/TTStubAssociator.h index 3fd21a8e37321..1799fca4e867b 100644 --- a/SimTracker/TrackTriggerAssociation/plugins/TTStubAssociator.h +++ b/SimTracker/TrackTriggerAssociation/plugins/TTStubAssociator.h @@ -18,7 +18,6 @@ #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -60,8 +59,8 @@ class TTStubAssociator : public edm::stream::EDProducer<> { std::vector > > > ttStubsTokens_; std::vector > > ttClusterTruthTokens_; - edm::ESHandle theTrackerGeometry_; - edm::ESHandle theTrackerTopology_; + edm::ESGetToken theTrackerGeometryToken_; + edm::ESGetToken theTrackerTopologyToken_; /// Mandatory methods void beginRun(const edm::Run& run, const edm::EventSetup& iSetup) override; @@ -92,6 +91,9 @@ TTStubAssociator::TTStubAssociator(const edm::ParameterSet& iConfig) { produces >(iTag.instance()); } + + theTrackerGeometryToken_ = esConsumes(); + theTrackerTopologyToken_ = esConsumes(); } /// Destructor @@ -103,9 +105,6 @@ template void TTStubAssociator::beginRun(const edm::Run& run, const edm::EventSetup& iSetup) { /// Print some information when loaded edm::LogInfo("TTStubAssociator< ") << templateNameFinder() << " > loaded."; - - iSetup.get().get(theTrackerTopology_); - iSetup.get().get(theTrackerGeometry_); } /// End run diff --git a/SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h b/SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h index 82fbba6d154e2..55a955d4cef10 100644 --- a/SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h +++ b/SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h @@ -16,11 +16,9 @@ ************************************************************/ //#include -#include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Utilities/interface/EDGetToken.h" diff --git a/SimTracker/TrackerHitAssociation/test/TestAssociator.cc b/SimTracker/TrackerHitAssociation/test/TestAssociator.cc index 0dd62191c9872..3b4eefe4da74d 100644 --- a/SimTracker/TrackerHitAssociation/test/TestAssociator.cc +++ b/SimTracker/TrackerHitAssociation/test/TestAssociator.cc @@ -11,9 +11,6 @@ #include "SimTracker/TrackerHitAssociation/test/TestAssociator.h" -//--- framework stuff -#include "FWCore/Framework/interface/ESHandle.h" - //--- for Geometry: #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" diff --git a/SimTracker/TrackerHitAssociation/test/TestAssociator.h b/SimTracker/TrackerHitAssociation/test/TestAssociator.h index d0212f66a6a40..e3a80136596d3 100644 --- a/SimTracker/TrackerHitAssociation/test/TestAssociator.h +++ b/SimTracker/TrackerHitAssociation/test/TestAssociator.h @@ -8,14 +8,14 @@ * ************************************************************/ -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h" -class TestAssociator : public edm::EDAnalyzer { +class TestAssociator : public edm::one::EDAnalyzer<> { public: explicit TestAssociator(const edm::ParameterSet& conf); diff --git a/SimTracker/TrackerHitAssociation/test/myTrackAnalyzer.cc b/SimTracker/TrackerHitAssociation/test/myTrackAnalyzer.cc index 1658d1dada4d8..765fe65105ddd 100644 --- a/SimTracker/TrackerHitAssociation/test/myTrackAnalyzer.cc +++ b/SimTracker/TrackerHitAssociation/test/myTrackAnalyzer.cc @@ -13,7 +13,8 @@ myTrackAnalyzer::myTrackAnalyzer(edm::ParameterSet const& conf) : trackerHitAssociatorConfig_(conf, consumesCollector()), doPixel_(conf.getParameter("associatePixel")), doStrip_(conf.getParameter("associateStrip")), - trackCollectionTag_(conf.getParameter("trackCollectionTag")) {} + trackCollectionTag_(conf.getParameter("trackCollectionTag")), + tokGeo_(esConsumes()) {} myTrackAnalyzer::~myTrackAnalyzer() {} @@ -21,8 +22,7 @@ void myTrackAnalyzer::analyze(const edm::Event& event, const edm::EventSetup& se // // extract tracker geometry // - edm::ESHandle theG; - setup.get().get(theG); + auto const& theG = setup.getHandle(tokGeo_); using namespace std; diff --git a/SimTracker/TrackerHitAssociation/test/myTrackAnalyzer.h b/SimTracker/TrackerHitAssociation/test/myTrackAnalyzer.h index dc0f780bee839..fe3c25c0be18e 100644 --- a/SimTracker/TrackerHitAssociation/test/myTrackAnalyzer.h +++ b/SimTracker/TrackerHitAssociation/test/myTrackAnalyzer.h @@ -4,17 +4,15 @@ #include #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Utilities/interface/InputTag.h" #include "DataFormats/TrackReco/interface/TrackFwd.h" #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "Geometry/CommonDetUnit/interface/GeomDet.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" @@ -39,7 +37,7 @@ class SiStripHitAssociator; -class myTrackAnalyzer : public edm::EDAnalyzer { +class myTrackAnalyzer : public edm::one::EDAnalyzer<> { public: typedef std::map sim_id_map; sim_id_map SimIdMap; @@ -52,8 +50,9 @@ class myTrackAnalyzer : public edm::EDAnalyzer { private: TrackerHitAssociator::Config trackerHitAssociatorConfig_; - bool doPixel_, doStrip_; - edm::InputTag trackCollectionTag_; + const bool doPixel_, doStrip_; + const edm::InputTag trackCollectionTag_; + const edm::ESGetToken tokGeo_; }; #endif diff --git a/TauAnalysis/MCEmbeddingTools/plugins/CaloCleaner.h b/TauAnalysis/MCEmbeddingTools/plugins/CaloCleaner.h index 065ee5c83ae17..e9eec4a8f9fa8 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/CaloCleaner.h +++ b/TauAnalysis/MCEmbeddingTools/plugins/CaloCleaner.h @@ -46,6 +46,7 @@ class CaloCleaner : public edm::stream::EDProducer<> { const edm::EDGetTokenT > mu_input_; std::map > inputs_; + edm::ESGetToken propagatorToken_; TrackDetectorAssociator trackAssociator_; TrackAssociatorParameters parameters_; @@ -56,7 +57,8 @@ class CaloCleaner : public edm::stream::EDProducer<> { template CaloCleaner::CaloCleaner(const edm::ParameterSet& iConfig) - : mu_input_(consumes >(iConfig.getParameter("MuonCollection"))) { + : mu_input_(consumes >(iConfig.getParameter("MuonCollection"))), + propagatorToken_(esConsumes(edm::ESInputTag("", "SteppingHelixPropagatorAny"))) { std::vector inCollections = iConfig.getParameter >("oldCollection"); for (const auto& inCollection : inCollections) { inputs_[inCollection.instance()] = consumes(inCollection); @@ -77,9 +79,8 @@ CaloCleaner::~CaloCleaner() { template void CaloCleaner::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { - edm::ESHandle propagator; - iSetup.get().get("SteppingHelixPropagatorAny", propagator); - trackAssociator_.setPropagator(propagator.product()); + auto const& propagator = iSetup.getData(propagatorToken_); + trackAssociator_.setPropagator(&propagator); edm::Handle > muonHandle; iEvent.getByToken(mu_input_, muonHandle); diff --git a/TauAnalysis/MCEmbeddingTools/plugins/EmbeddingVertexCorrector.cc b/TauAnalysis/MCEmbeddingTools/plugins/EmbeddingVertexCorrector.cc index 72ba8f3549686..dae640883fe88 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/EmbeddingVertexCorrector.cc +++ b/TauAnalysis/MCEmbeddingTools/plugins/EmbeddingVertexCorrector.cc @@ -44,7 +44,6 @@ #include "CondFormats/BeamSpotObjects/interface/BeamSpotObjects.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" namespace HepMC { @@ -63,7 +62,6 @@ class EmbeddingVertexCorrector : public edm::stream::EDProducer<> { static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - void beginRun(const edm::Run&, const edm::EventSetup& iEventSetup) override; void produce(edm::Event&, const edm::EventSetup&) override; // ----------member data --------------------------- @@ -89,15 +87,6 @@ EmbeddingVertexCorrector::~EmbeddingVertexCorrector() {} // member functions // -void EmbeddingVertexCorrector::beginRun(const edm::Run&, const edm::EventSetup& iEventSetup) { - // edm::ESHandle< SimBeamSpotObjects > beamhandle; - // iEventSetup.get().get(beamhandle); - - edm::ESHandle beamhandle; - iEventSetup.get().get(beamhandle); - - edm::LogInfo("TauEmbedding") << "beam handle\n" << (*beamhandle); -} // ------------ method called to produce the data ------------ void EmbeddingVertexCorrector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; diff --git a/TopQuarkAnalysis/TopEventSelection/plugins/TtFullHadSignalSelMVAComputer.cc b/TopQuarkAnalysis/TopEventSelection/plugins/TtFullHadSignalSelMVAComputer.cc index 7d60920f16ac3..5e483ea4380b3 100644 --- a/TopQuarkAnalysis/TopEventSelection/plugins/TtFullHadSignalSelMVAComputer.cc +++ b/TopQuarkAnalysis/TopEventSelection/plugins/TtFullHadSignalSelMVAComputer.cc @@ -11,47 +11,27 @@ #include "DataFormats/PatCandidates/interface/Flags.h" TtFullHadSignalSelMVAComputer::TtFullHadSignalSelMVAComputer(const edm::ParameterSet& cfg) - : jetsToken_(consumes >(cfg.getParameter("jets"))) { - produces("DiscSel"); -} - -TtFullHadSignalSelMVAComputer::~TtFullHadSignalSelMVAComputer() {} + : mvaToken_(esConsumes()), + jetsToken_(consumes >(cfg.getParameter("jets"))), + putToken_(produces("DiscSel")) {} void TtFullHadSignalSelMVAComputer::produce(edm::Event& evt, const edm::EventSetup& setup) { - std::unique_ptr pOutDisc(new double); - - mvaComputer.update(setup, "ttFullHadSignalSelMVA"); - - // read name of the last processor in the MVA calibration - // (to be used as meta information) - edm::ESHandle calibContainer; - setup.get().get(calibContainer); - std::vector processors = - (calibContainer->find("ttFullHadSignalSelMVA")).getProcessors(); + mvaComputer.update(&setup.getData(mvaToken_), "ttFullHadSignalSelMVA"); - edm::Handle > jets; - evt.getByToken(jetsToken_, jets); + const auto& jets = evt.get(jetsToken_); //calculation of InputVariables //see TopQuarkAnalysis/TopTools/interface/TtFullHadSignalSel.h // /src/TtFullHadSignalSel.cc //all objects, jets, which are needed for the calculation //of the input-variables have to be passed to this class - TtFullHadSignalSel selection(*jets); + TtFullHadSignalSel selection(jets); double discrim = evaluateTtFullHadSignalSel(mvaComputer, selection); - *pOutDisc = discrim; - - evt.put(std::move(pOutDisc), "DiscSel"); - - DiscSel = discrim; + evt.emplace(putToken_, discrim); } -void TtFullHadSignalSelMVAComputer::beginJob() {} - -void TtFullHadSignalSelMVAComputer::endJob() {} - // implement the plugins for the computer container // -> register TtFullHadSignalSelMVARcd // -> define TtFullHadSignalSelMVAFileSource diff --git a/TopQuarkAnalysis/TopEventSelection/plugins/TtFullHadSignalSelMVAComputer.h b/TopQuarkAnalysis/TopEventSelection/plugins/TtFullHadSignalSelMVAComputer.h index 660e9a4504c7f..fd1c93d8e60c3 100644 --- a/TopQuarkAnalysis/TopEventSelection/plugins/TtFullHadSignalSelMVAComputer.h +++ b/TopQuarkAnalysis/TopEventSelection/plugins/TtFullHadSignalSelMVAComputer.h @@ -2,7 +2,7 @@ #define TtFullHadSignalSelMVAComputer_h #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "PhysicsTools/MVAComputer/interface/HelperMacros.h" #include "PhysicsTools/MVAComputer/interface/MVAComputerCache.h" @@ -15,21 +15,18 @@ MVA_COMPUTER_CONTAINER_DEFINE(TtFullHadSignalSelMVA); // defines TopFullHadLepSignalSelMVARcd #endif -class TtFullHadSignalSelMVAComputer : public edm::EDProducer { +class TtFullHadSignalSelMVAComputer : public edm::stream::EDProducer<> { public: explicit TtFullHadSignalSelMVAComputer(const edm::ParameterSet&); - ~TtFullHadSignalSelMVAComputer() override; private: - void beginJob() override; void produce(edm::Event& evt, const edm::EventSetup& setup) override; - void endJob() override; + edm::ESGetToken mvaToken_; edm::EDGetTokenT > jetsToken_; + edm::EDPutTokenT putToken_; PhysicsTools::MVAComputerCache mvaComputer; - - double DiscSel; }; #endif diff --git a/TopQuarkAnalysis/TopEventSelection/plugins/TtSemiLepSignalSelMVAComputer.cc b/TopQuarkAnalysis/TopEventSelection/plugins/TtSemiLepSignalSelMVAComputer.cc index cc24153a3bb83..2e59a75d76bc1 100644 --- a/TopQuarkAnalysis/TopEventSelection/plugins/TtSemiLepSignalSelMVAComputer.cc +++ b/TopQuarkAnalysis/TopEventSelection/plugins/TtSemiLepSignalSelMVAComputer.cc @@ -11,26 +11,17 @@ #include "DataFormats/PatCandidates/interface/Flags.h" TtSemiLepSignalSelMVAComputer::TtSemiLepSignalSelMVAComputer(const edm::ParameterSet& cfg) - : muonsToken_(consumes >(cfg.getParameter("muons"))), + : mvaToken_(esConsumes()), + muonsToken_(consumes >(cfg.getParameter("muons"))), jetsToken_(consumes >(cfg.getParameter("jets"))), METsToken_(consumes >(cfg.getParameter("mets"))), - electronsToken_(consumes >(cfg.getParameter("elecs"))) { - produces("DiscSel"); -} + electronsToken_(consumes >(cfg.getParameter("elecs"))), + putToken_(produces("DiscSel")) {} TtSemiLepSignalSelMVAComputer::~TtSemiLepSignalSelMVAComputer() {} void TtSemiLepSignalSelMVAComputer::produce(edm::Event& evt, const edm::EventSetup& setup) { - std::unique_ptr pOutDisc(new double); - - mvaComputer.update(setup, "ttSemiLepSignalSelMVA"); - - // read name of the last processor in the MVA calibration - // (to be used as meta information) - edm::ESHandle calibContainer; - setup.get().get(calibContainer); - std::vector processors = - (calibContainer->find("ttSemiLepSignalSelMVA")).getProcessors(); + mvaComputer.update(&setup.getData(mvaToken_), "ttSemiLepSignalSelMVA"); //make your preselection! This must!! be the same one as in TraintreeSaver.cc edm::Handle > MET_handle; @@ -113,17 +104,9 @@ void TtSemiLepSignalSelMVAComputer::produce(edm::Event& evt, const edm::EventSet discrim = evaluateTtSemiLepSignalSel(mvaComputer, selection); } - *pOutDisc = discrim; - - evt.put(std::move(pOutDisc), "DiscSel"); - - DiscSel = discrim; + evt.emplace(putToken_, discrim); } -void TtSemiLepSignalSelMVAComputer::beginJob() {} - -void TtSemiLepSignalSelMVAComputer::endJob() {} - double TtSemiLepSignalSelMVAComputer::DeltaPhi(const math::XYZTLorentzVector& v1, const math::XYZTLorentzVector& v2) { double dPhi = fabs(v1.Phi() - v2.Phi()); if (dPhi > TMath::Pi()) diff --git a/TopQuarkAnalysis/TopEventSelection/plugins/TtSemiLepSignalSelMVAComputer.h b/TopQuarkAnalysis/TopEventSelection/plugins/TtSemiLepSignalSelMVAComputer.h index de547acc2edf8..4855266cdbd61 100644 --- a/TopQuarkAnalysis/TopEventSelection/plugins/TtSemiLepSignalSelMVAComputer.h +++ b/TopQuarkAnalysis/TopEventSelection/plugins/TtSemiLepSignalSelMVAComputer.h @@ -2,7 +2,7 @@ #define TtSemiLepSignalSelMVAComputer_h #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "PhysicsTools/MVAComputer/interface/HelperMacros.h" #include "PhysicsTools/MVAComputer/interface/MVAComputerCache.h" @@ -18,27 +18,25 @@ MVA_COMPUTER_CONTAINER_DEFINE(TtSemiLepSignalSelMVA); // defines TopSemiLepLepSignalSelMVARcd #endif -class TtSemiLepSignalSelMVAComputer : public edm::EDProducer { +class TtSemiLepSignalSelMVAComputer : public edm::stream::EDProducer<> { public: explicit TtSemiLepSignalSelMVAComputer(const edm::ParameterSet&); ~TtSemiLepSignalSelMVAComputer() override; private: - void beginJob() override; void produce(edm::Event& evt, const edm::EventSetup& setup) override; - void endJob() override; double DeltaPhi(const math::XYZTLorentzVector& v1, const math::XYZTLorentzVector& v2); double DeltaR(const math::XYZTLorentzVector& v1, const math::XYZTLorentzVector& v2); + edm::ESGetToken mvaToken_; edm::EDGetTokenT > muonsToken_; edm::EDGetTokenT > jetsToken_; edm::EDGetTokenT > METsToken_; edm::EDGetTokenT > electronsToken_; + edm::EDPutTokenT putToken_; PhysicsTools::MVAComputerCache mvaComputer; - - double DiscSel; }; #endif diff --git a/TopQuarkAnalysis/TopJetCombination/plugins/TtSemiLepJetCombMVAComputer.cc b/TopQuarkAnalysis/TopJetCombination/plugins/TtSemiLepJetCombMVAComputer.cc index fa7793eb24ac7..e5a4288384142 100644 --- a/TopQuarkAnalysis/TopJetCombination/plugins/TtSemiLepJetCombMVAComputer.cc +++ b/TopQuarkAnalysis/TopJetCombination/plugins/TtSemiLepJetCombMVAComputer.cc @@ -3,7 +3,8 @@ #include "TopQuarkAnalysis/TopJetCombination/plugins/TtSemiLepJetCombMVAComputer.h" TtSemiLepJetCombMVAComputer::TtSemiLepJetCombMVAComputer(const edm::ParameterSet& cfg) - : lepsToken_(consumes>(cfg.getParameter("leps"))), + : mvaToken_(esConsumes()), + lepsToken_(consumes>(cfg.getParameter("leps"))), jetsToken_(consumes>(cfg.getParameter("jets"))), metsToken_(consumes>(cfg.getParameter("mets"))), maxNJets_(cfg.getParameter("maxNJets")), @@ -14,22 +15,19 @@ TtSemiLepJetCombMVAComputer::TtSemiLepJetCombMVAComputer(const edm::ParameterSet produces("NumberOfConsideredJets"); } -TtSemiLepJetCombMVAComputer::~TtSemiLepJetCombMVAComputer() {} - void TtSemiLepJetCombMVAComputer::produce(edm::Event& evt, const edm::EventSetup& setup) { std::unique_ptr>> pOut(new std::vector>); std::unique_ptr> pOutDisc(new std::vector); std::unique_ptr pOutMeth(new std::string); std::unique_ptr pJetsConsidered(new int); - mvaComputer.update(setup, "ttSemiLepJetCombMVA"); + const auto& calibContainer = setup.getData(mvaToken_); + mvaComputer.update(&calibContainer, "ttSemiLepJetCombMVA"); // read name of the processor that provides the MVA discriminator // (to be used as meta information) - edm::ESHandle calibContainer; - setup.get().get(calibContainer); - std::vector processors = - (calibContainer->find("ttSemiLepJetCombMVA")).getProcessors(); + std::vector processors = + (calibContainer.find("ttSemiLepJetCombMVA")).getProcessors(); *pOutMeth = (processors[processors.size() - 3])->getInstanceName(); evt.put(std::move(pOutMeth), "Method"); @@ -120,10 +118,6 @@ void TtSemiLepJetCombMVAComputer::produce(edm::Event& evt, const edm::EventSetup evt.put(std::move(pJetsConsidered), "NumberOfConsideredJets"); } -void TtSemiLepJetCombMVAComputer::beginJob() {} - -void TtSemiLepJetCombMVAComputer::endJob() {} - // implement the plugins for the computer container // -> register TtSemiLepJetCombMVARcd // -> define TtSemiLepJetCombMVAFileSource diff --git a/TopQuarkAnalysis/TopJetCombination/plugins/TtSemiLepJetCombMVAComputer.h b/TopQuarkAnalysis/TopJetCombination/plugins/TtSemiLepJetCombMVAComputer.h index d04bd2fdeab0d..4acb59ed7f302 100644 --- a/TopQuarkAnalysis/TopJetCombination/plugins/TtSemiLepJetCombMVAComputer.h +++ b/TopQuarkAnalysis/TopJetCombination/plugins/TtSemiLepJetCombMVAComputer.h @@ -2,7 +2,7 @@ #define TtSemiLepJetCombMVAComputer_h #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "PhysicsTools/MVAComputer/interface/HelperMacros.h" #include "PhysicsTools/MVAComputer/interface/MVAComputerCache.h" @@ -18,22 +18,20 @@ MVA_COMPUTER_CONTAINER_DEFINE(TtSemiLepJetCombMVA); // defines TtSemiLepJetCombMVARcd #endif -class TtSemiLepJetCombMVAComputer : public edm::EDProducer { +class TtSemiLepJetCombMVAComputer : public edm::stream::EDProducer<> { public: explicit TtSemiLepJetCombMVAComputer(const edm::ParameterSet&); - ~TtSemiLepJetCombMVAComputer() override; private: - void beginJob() override; void produce(edm::Event& evt, const edm::EventSetup& setup) override; - void endJob() override; + edm::ESGetToken mvaToken_; edm::EDGetTokenT> lepsToken_; edm::EDGetTokenT> jetsToken_; edm::EDGetTokenT> metsToken_; - int maxNJets_; - int maxNComb_; + const int maxNJets_; + const int maxNComb_; PhysicsTools::MVAComputerCache mvaComputer; }; diff --git a/Utilities/ReleaseScripts/test/BuildFile.xml b/Utilities/ReleaseScripts/test/BuildFile.xml index 18e332a86bdee..1d6d57765d61e 100644 --- a/Utilities/ReleaseScripts/test/BuildFile.xml +++ b/Utilities/ReleaseScripts/test/BuildFile.xml @@ -2,8 +2,10 @@ - - - - - + + + + + + + diff --git a/Validation/CheckOverlap/test/python/runFastTiming_cfg.py b/Validation/CheckOverlap/test/python/runFastTiming_cfg.py deleted file mode 100644 index 0bfb410594786..0000000000000 --- a/Validation/CheckOverlap/test/python/runFastTiming_cfg.py +++ /dev/null @@ -1,69 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("PROD") -process.load("SimGeneral.HepPDTESSource.pdt_cfi") - -process.load("Geometry.HGCalCommonData.testFastTimeXML_cfi") -#process.load("Geometry.CMSCommonData.cmsExtendedGeometry2023FastTimingXML_cfi") -#process.load("Geometry.TrackerNumberingBuilder.trackerNumberingSLHCGeometry_cfi") -#process.load("Geometry.HcalCommonData.hcalSimNumberingInitialization_cfi") -process.load("Geometry.HGCalCommonData.fastTimeNumberingInitialization_cfi") -process.load("SimG4Core.Application.g4SimHits_cfi") - -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - enable = cms.untracked.bool(False) - ), - cout = cms.untracked.PSet( - G4cerr = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - G4cout = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - HGCalGeom = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - default = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - enable = cms.untracked.bool(True) - ) -) - -process.load("IOMC.RandomEngine.IOMC_cff") -process.RandomNumberGeneratorService.generator.initialSeed = 456789 -process.RandomNumberGeneratorService.g4SimHits.initialSeed = 9876 -process.RandomNumberGeneratorService.VtxSmeared.initialSeed = 123456789 - -process.source = cms.Source("EmptySource") - -process.generator = cms.EDProducer("FlatRandomEGunProducer", - PGunParameters = cms.PSet( - PartID = cms.vint32(14), - MinEta = cms.double(-3.5), - MaxEta = cms.double(3.5), - MinPhi = cms.double(-3.14159265359), - MaxPhi = cms.double(3.14159265359), - MinE = cms.double(9.99), - MaxE = cms.double(10.01) - ), - AddAntiParticle = cms.bool(False), - Verbosity = cms.untracked.int32(0), - firstRun = cms.untracked.uint32(1) -) - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(1) -) - -process.p1 = cms.Path(process.generator*process.g4SimHits) -process.g4SimHits.UseMagneticField = False -process.g4SimHits.Physics.type = 'SimG4Core/Physics/DummyPhysics' -process.g4SimHits.Physics.DummyEMPhysics = True -process.g4SimHits.Watchers = cms.VPSet(cms.PSet( - type = cms.string('CheckOverlap'), - Resolution = cms.untracked.int32(1000), - NodeNames = cms.untracked.vstring('CALO') -)) - diff --git a/Validation/Geometry/macros/MatBudgetHcal.C b/Validation/Geometry/macros/MatBudgetHcal.C index 9dbade1a2def1..ba1a0ac67bcfb 100644 --- a/Validation/Geometry/macros/MatBudgetHcal.C +++ b/Validation/Geometry/macros/MatBudgetHcal.C @@ -13,9 +13,9 @@ // tag (string) Tag to be added to the name of the canvas ("Run") // debug (bool) print or not the debug information (false) // -// etaPhiPlotComp(fileName1, fileName2, plot, lay, ifEta, maxEta, tag1, +// etaPhiPlotComp(fileName1, fileName2, plot, lay, ifEta, maxEta, tag1, // tag2, debug) -// Make superimposed plors of integrated interaction/radiation/step +// Make superimposed plors of integrated interaction/radiation/step // lengths from 2 files produced through 2 sources of geometry as a // function of eta or phi // @@ -38,7 +38,7 @@ // the same meanings as those of *etaPhiPlot* // // etaSlicePlot(fileName, plot, ifirst, ilast, ietaRange, drawLeg, tag, debug); -// Plot phi distributions of integrated interaction/radiation/step +// Plot phi distributions of integrated interaction/radiation/step // length for a given ietaRange (0 -> 28; 1 --> 29; 2 --> 9) // // printTable(fileName, outputFileName, inputFileName) @@ -93,14 +93,14 @@ void etaPhiPlot(TString fileName = "matbdg_HCAL.root", std::string tag = "Run", bool debug = false); void etaPhiPlotComp(TString fileName1 = "matbdgHCAL_run3.root", - TString fileName2 = "matbdgHCAL_run3_dd4hep.root", - std::string plot = "IntLen", - int lay = 2, - bool ifEta = true, - double maxEta = -1, - std::string tag1 = "DDD", - std::string tag2 = "DD4HEP", - bool debug = false); + TString fileName2 = "matbdgHCAL_run3_dd4hep.root", + std::string plot = "IntLen", + int lay = 2, + bool ifEta = true, + double maxEta = -1, + std::string tag1 = "DDD", + std::string tag2 = "DD4hep", + bool debug = false); void etaPhiPlotHO(TString fileName = "matbdg_HCAL.root", TString plot = "IntLen", int drawLeg = 1, @@ -126,13 +126,13 @@ void etaPhi2DPlot(TString fileName = "matbdg_HCAL.root", int drawLeg = 1, std::string tag = "Run"); void etaSlicePlot(TString fileName = "matbdg_HCAL.root", - TString plot = "IntLen", - int ifirst = 0, - int ilast = 19, - int ietaRange = 0, - int drawLeg = 1, - std::string tag = "Run", - bool debug = false); + TString plot = "IntLen", + int ifirst = 0, + int ilast = 19, + int ietaRange = 0, + int drawLeg = 1, + std::string tag = "Run", + bool debug = false); void etaPhi2DPlot(int nslice, int kslice, TString fileName = "matbdg_HCAL.root", @@ -274,7 +274,7 @@ void etaPhiPlot(TString fileName, for (int ibx = 0; ibx < nbinX; ibx++) { double xx1 = xmin + ibx * dx; double cont = prof[0]->GetBinContent(ibx + 1); - std::cout << " | " << ibx << "(" << xx1 << ":" << (xx1 + dx) << ") " << cont; + std::cout << " | " << ibx << "(" << xx1 << ":" << (xx1 + dx) << ") " << cont; } std::cout << "\n"; } @@ -295,25 +295,25 @@ void etaPhiPlot(TString fileName, } void etaPhiPlotComp(TString fileName1, - TString fileName2, - std::string plot, - int lay, - bool ifEta, - double maxEta, - std::string tag1, - std::string tag2, - bool debug) { + TString fileName2, + std::string plot, + int lay, + bool ifEta, + double maxEta, + std::string tag1, + std::string tag2, + bool debug) { setStyle(); TFile *file1 = new TFile(fileName1); TFile *file2 = new TFile(fileName2); - if (lay < 0) + if (lay < 0) lay = 0; else if (lay > 21) lay = 21; if ((file1 != nullptr) && (file2 != nullptr)) { TDirectory *dir1 = (TDirectory *)(file1->FindObjectAny("g4SimHits")); TDirectory *dir2 = (TDirectory *)(file2->FindObjectAny("g4SimHits")); - + TString xtit = TString("#eta"); std::string ztit("eta"); std::string ytit("none"); @@ -344,9 +344,8 @@ void etaPhiPlotComp(TString fileName1, xtit = TString("#phi"); ztit = "phi"; } - double fac[23] = {0.05, 0.1, 0.3, 0.3, 0.3, 0.3, 0.3, 0.4, 0.4, 0.4, - 0.5, 0.5, 0.5, 0.5, 0.6, 0.6, 0.7, 0.8, 0.8, 0.9, - 1.0, 1.0, 1.0}; + double fac[23] = {0.05, 0.1, 0.3, 0.3, 0.3, 0.3, 0.3, 0.4, 0.4, 0.4, 0.5, 0.5, + 0.5, 0.5, 0.6, 0.6, 0.7, 0.8, 0.8, 0.9, 1.0, 1.0, 1.0}; ymax *= fac[lay]; TLegend *leg = new TLegend(xh - 0.13, 0.80, xh, 0.90); @@ -358,7 +357,7 @@ void etaPhiPlotComp(TString fileName1, int color[2] = {2, 4}; char hname[10], title[50], cname[100]; if (lay > 1 && lay < 21) { - sprintf(title, "%s (Layer %d)", ytit.c_str(), lay-1); + sprintf(title, "%s (Layer %d)", ytit.c_str(), lay - 1); } else if (lay == 1) { sprintf(title, "%s (After Crystal)", ytit.c_str()); } else if (lay > 20) { @@ -371,28 +370,28 @@ void etaPhiPlotComp(TString fileName1, dir2->GetObject(hname, prof[1]); if ((prof[0] != nullptr) && (prof[1] != nullptr)) { for (int k = 0; k < 2; ++k) { - prof[k]->GetXaxis()->SetTitle(xtit); - prof[k]->GetYaxis()->SetTitle(title); - prof[k]->GetYaxis()->SetRangeUser(ymin, ymax); - prof[k]->SetLineColor(color[k]); - prof[k]->SetLineWidth(2); - if (ifEta && maxEta > 0) - prof[k]->GetXaxis()->SetRangeUser(-maxEta, maxEta); - if (xh < 0.8) - prof[k]->GetYaxis()->SetTitleOffset(1.7); - else - prof[k]->GetYaxis()->SetTitleOffset(1.0); - if (k == 0) - leg->AddEntry(prof[k], tag1.c_str(), "lf"); - else - leg->AddEntry(prof[k], tag2.c_str(), "lf"); + prof[k]->GetXaxis()->SetTitle(xtit); + prof[k]->GetYaxis()->SetTitle(title); + prof[k]->GetYaxis()->SetRangeUser(ymin, ymax); + prof[k]->SetLineColor(color[k]); + prof[k]->SetLineWidth(2); + if (ifEta && maxEta > 0) + prof[k]->GetXaxis()->SetRangeUser(-maxEta, maxEta); + if (xh < 0.8) + prof[k]->GetYaxis()->SetTitleOffset(1.7); + else + prof[k]->GetYaxis()->SetTitleOffset(1.0); + if (k == 0) + leg->AddEntry(prof[k], tag1.c_str(), "lf"); + else + leg->AddEntry(prof[k], tag2.c_str(), "lf"); } - sprintf (cname, "c_%sLay%d%s%s%s", plot1.c_str(), lay, ztit.c_str(), tag1.c_str(), tag2.c_str()); + sprintf(cname, "c_%sLay%d%s%s%s", plot1.c_str(), lay, ztit.c_str(), tag1.c_str(), tag2.c_str()); TCanvas *cc1 = new TCanvas(cname, cname, 700, 600); if (xh < 0.8) { - cc1->SetLeftMargin(0.15); - cc1->SetRightMargin(0.05); + cc1->SetLeftMargin(0.15); + cc1->SetRightMargin(0.05); } prof[0]->Draw("h"); @@ -400,21 +399,22 @@ void etaPhiPlotComp(TString fileName1, leg->Draw("sames"); if (debug) { - int nbinX = prof[0]->GetNbinsX(); - double xmin = prof[0]->GetXaxis()->GetXmin(); - double xmax = prof[0]->GetXaxis()->GetXmax(); - double dx = (xmax - xmin) / nbinX; - for (int ibx = 0; ibx < nbinX; ibx++) { - double xx1 = xmin + ibx * dx; - if (xx1 >= -1.5 && xx1 < 1.5) { - double cont1 = prof[0]->GetBinContent(ibx + 1); - double cont2 = prof[1]->GetBinContent(ibx + 1); - if ((cont1 + cont2) > 0.01) { - double frac = 2.0 * (cont1 - cont2) / (cont1 + cont2); - std::cout << ibx << "(" << xx1 << ":" << (xx1 + dx) << ") " << cont1 << ":" << cont2 << ":" << frac << std::endl; - } - } - } + int nbinX = prof[0]->GetNbinsX(); + double xmin = prof[0]->GetXaxis()->GetXmin(); + double xmax = prof[0]->GetXaxis()->GetXmax(); + double dx = (xmax - xmin) / nbinX; + for (int ibx = 0; ibx < nbinX; ibx++) { + double xx1 = xmin + ibx * dx; + if (xx1 >= -1.5 && xx1 < 1.5) { + double cont1 = prof[0]->GetBinContent(ibx + 1); + double cont2 = prof[1]->GetBinContent(ibx + 1); + if ((cont1 + cont2) > 0.01) { + double frac = 2.0 * (cont1 - cont2) / (cont1 + cont2); + std::cout << ibx << "(" << xx1 << ":" << (xx1 + dx) << ") " << cont1 << ":" << cont2 << ":" << frac + << std::endl; + } + } + } } } } @@ -926,14 +926,8 @@ void etaPhi2DPlot( } } -void etaSlicePlot(TString fileName, - TString plot, - int ifirst, - int ilast, - int ietaRange, - int drawLeg, - std::string tag, - bool debug) { +void etaSlicePlot( + TString fileName, TString plot, int ifirst, int ilast, int ietaRange, int drawLeg, std::string tag, bool debug) { TFile *hcalFile = new TFile(fileName); hcalFile->cd("g4SimHits"); setStyle(); diff --git a/Validation/Geometry/macros/MatBudgetVolume.C b/Validation/Geometry/macros/MatBudgetVolume.C index aa51f0ae0f8aa..c509a254f6add 100644 --- a/Validation/Geometry/macros/MatBudgetVolume.C +++ b/Validation/Geometry/macros/MatBudgetVolume.C @@ -25,7 +25,7 @@ // by one of dddXML/dd4hepXML/dddDB/dd4hepDB strings // and finally with *tag* and ".root" // txt (std::string) Part of the y-title coming after #frac for the plot -// ("{DDD}{DD4Hep}") +// ("{DDD}{DD4hep}") // /////////////////////////////////////////////////////////////////////////////// @@ -66,7 +66,7 @@ void etaPhiPlotComp(TString fileName1 = "matbdg_run3.root", std::string plot = "intl", bool ifEta = true, std::string tag = "Run3", - std::string txt = "{DDD}/{DD4Hep}", + std::string txt = "{DDD}/{DD4hep}", bool debug = false); void etaPhiPlotComp4(std::string filePreFix = "files/matbdgRun3", std::string tag = "pre6", diff --git a/Validation/Geometry/python/materialBudgetVolume_cfi.py b/Validation/Geometry/python/materialBudgetVolume_cfi.py index 8df9233b3ed4b..75c9cbd822273 100644 --- a/Validation/Geometry/python/materialBudgetVolume_cfi.py +++ b/Validation/Geometry/python/materialBudgetVolume_cfi.py @@ -5,10 +5,10 @@ MaterialBudgetVolume = cms.PSet( lvNames = cms.vstring('BEAM', 'BEAM1', 'BEAM2', 'BEAM3', 'BEAM4', 'Tracker', 'ECAL', 'HCal', 'VCAL', 'MGNT', 'MUON', 'OQUA', 'CALOEC'), lvLevels = cms.vint32(3, 3, 3, 3, 3, 3, 4, 4, 3, 4, 3, 3, 4), - useDD4Hep = cms.bool(False), + useDD4hep = cms.bool(False), ), type = cms.string('MaterialBudgetVolume'), )) from Configuration.ProcessModifiers.dd4hep_cff import dd4hep -dd4hep.toModify( g4SimHits.Watchers[0].MaterialBudgetVolume, useDD4Hep = True ) +dd4hep.toModify( g4SimHits.Watchers[0].MaterialBudgetVolume, useDD4hep = True ) diff --git a/Validation/Geometry/src/MaterialBudgetHcalHistos.cc b/Validation/Geometry/src/MaterialBudgetHcalHistos.cc index 844884ea5b2d6..20ba4f605cc13 100644 --- a/Validation/Geometry/src/MaterialBudgetHcalHistos.cc +++ b/Validation/Geometry/src/MaterialBudgetHcalHistos.cc @@ -40,7 +40,7 @@ MaterialBudgetHcalHistos::MaterialBudgetHcalHistos(const edm::ParameterSet& p) { << " (Eta limit " << etaLow_ << ":" << etaHigh_ << ")" << " Eta range (" << etaLowMin_ << ":" << etaLowMax_ << "), (" << etaMidMin_ << ":" << etaMidMax_ << "), (" << etaHighMin_ << ":" << etaHighMax_ - << ") Debug for eta range " << etaMinP_ << ":" << etaMaxP_ << " FromDD4Hep " + << ") Debug for eta range " << etaMinP_ << ":" << etaMaxP_ << " FromDD4hep " << fromdd4hep_; if (fillHistos_) book(); diff --git a/Validation/Geometry/src/MaterialBudgetVolume.cc b/Validation/Geometry/src/MaterialBudgetVolume.cc index 6357e4640d8c2..8507e37da0eab 100644 --- a/Validation/Geometry/src/MaterialBudgetVolume.cc +++ b/Validation/Geometry/src/MaterialBudgetVolume.cc @@ -79,7 +79,7 @@ MaterialBudgetVolume::MaterialBudgetVolume(const edm::ParameterSet& p) : init_(f lvNames_ = m_p.getParameter >("lvNames"); lvLevel_ = m_p.getParameter >("lvLevels"); - iaddLevel_ = (m_p.getParameter("useDD4Hep")) ? 1 : 0; + iaddLevel_ = (m_p.getParameter("useDD4hep")) ? 1 : 0; edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume: Studies Material budget for " << lvNames_.size() << " volumes with addLevel " << iaddLevel_; diff --git a/Validation/Geometry/test/runMaterialBudgetVolumeBigDD4HepXML_cfg.py b/Validation/Geometry/test/runMaterialBudgetVolumeBigDD4hepXML_cfg.py similarity index 100% rename from Validation/Geometry/test/runMaterialBudgetVolumeBigDD4HepXML_cfg.py rename to Validation/Geometry/test/runMaterialBudgetVolumeBigDD4hepXML_cfg.py diff --git a/Validation/Geometry/test/runP_ECAL_dd4hep_cfg.py b/Validation/Geometry/test/runP_ECAL_dd4hep_cfg.py index 1eb835dea42b9..2d183e5efc02b 100644 --- a/Validation/Geometry/test/runP_ECAL_dd4hep_cfg.py +++ b/Validation/Geometry/test/runP_ECAL_dd4hep_cfg.py @@ -45,14 +45,14 @@ process.g4SimHits.Watchers = cms.VPSet(cms.PSet( type = cms.string('MaterialBudgetAction'), MaterialBudgetAction = cms.PSet( - HistosFile = cms.string('matbdg_ECAL_DD4HEP.root'), + HistosFile = cms.string('matbdg_ECAL_DD4hep.root'), AllStepsToTree = cms.bool(False), HistogramList = cms.string('ECAL'), SelectedVolumes = cms.vstring('ECAL'), # string TextFile = "None" # "None" means this option TreeFile = cms.string('None'), StopAfterProcess = cms.string('None'), - TextFile = cms.string('matbdg_ECAL_DD4HEP.txt') + TextFile = cms.string('matbdg_ECAL_DD4hep.txt') ) )) diff --git a/Validation/HGCalValidation/test/HGCHitValidation.cc b/Validation/HGCalValidation/test/HGCHitValidation.cc index d7633c7e80401..30cfefbac8864 100644 --- a/Validation/HGCalValidation/test/HGCHitValidation.cc +++ b/Validation/HGCalValidation/test/HGCHitValidation.cc @@ -71,7 +71,7 @@ class HGCHitValidation : public edm::one::EDAnalyzer HGCHitTuple; void beginJob() override; - void endJob() override; + void endJob() override {} void beginRun(edm::Run const &, edm::EventSetup const &) override; void analyze(edm::Event const &, edm::EventSetup const &) override; void endRun(edm::Run const &, edm::EventSetup const &) override {} @@ -466,13 +466,6 @@ void HGCHitValidation::analyze(const edm::Event &iEvent, const edm::EventSetup & } } -void HGCHitValidation::endJob() { - if (makeTree_) { - hgcHits_->GetDirectory()->cd(); - hgcHits_->Write(); - } -} - void HGCHitValidation::analyzeHGCalSimHit(edm::Handle> const &simHits, int idet, TH1F *hist, diff --git a/Validation/HGCalValidation/test/MakePlots.C b/Validation/HGCalValidation/test/MakePlots.C index 5757032b57e7d..b25591768e825 100644 --- a/Validation/HGCalValidation/test/MakePlots.C +++ b/Validation/HGCalValidation/test/MakePlots.C @@ -453,7 +453,7 @@ void hgcalBHValidPlots(std::string fname = "roots/hgcBHValidD83.root", void ehcalPlots(std::string fname = "ecalHitdd4hep.root", std::string dirnm = "EcalSimHitStudy", - std::string tag = "DD4Hep", + std::string tag = "DD4hep", int dets = 2, bool save = false, bool debug = false) { diff --git a/Validation/HGCalValidation/test/python/testFastTimerSimHit_cfg.py b/Validation/HGCalValidation/test/python/testFastTimerSimHit_cfg.py deleted file mode 100644 index 2abbd183edee9..0000000000000 --- a/Validation/HGCalValidation/test/python/testFastTimerSimHit_cfg.py +++ /dev/null @@ -1,105 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("PROD") -process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") -process.load('Configuration.StandardSequences.Generator_cff') -process.load("IOMC.EventVertexGenerators.VtxSmearedGauss_cfi") -process.load('GeneratorInterface.Core.genFilterSummary_cff') -process.load('Configuration.StandardSequences.SimIdeal_cff') - -process.load("Geometry.HGCalCommonData.testFastTimeXML_cfi") -process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi") -process.load("Geometry.EcalCommonData.ecalSimulationParameters_cff") -process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cff") -process.load("Geometry.HGCalCommonData.hgcalV6ParametersInitialization_cfi") -process.load("Geometry.HGCalCommonData.hgcalV6NumberingInitialization_cfi") -process.load("Geometry.HGCalCommonData.fastTimeParametersInitialization_cfi") -process.load("Geometry.HGCalCommonData.fastTimeNumberingInitialization_cfi") - -process.load("Configuration.StandardSequences.MagneticField_cff") -process.load("Configuration.EventContent.EventContent_cff") - -process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") -from Configuration.AlCa.autoCond import autoCond -process.GlobalTag.globaltag = autoCond['run2_mc'] - -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - enable = cms.untracked.bool(False) - ), - cout = cms.untracked.PSet( - DEBUG = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - FastTimerSim = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - G4cerr = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - G4cout = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - enable = cms.untracked.bool(True) - ) -) - -process.load("IOMC.RandomEngine.IOMC_cff") -process.RandomNumberGeneratorService.generator.initialSeed = 456789 -process.RandomNumberGeneratorService.g4SimHits.initialSeed = 9876 -process.RandomNumberGeneratorService.VtxSmeared.initialSeed = 123456789 - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(1000) -) - -process.source = cms.Source("EmptySource", - firstRun = cms.untracked.uint32(1), - firstEvent = cms.untracked.uint32(1) -) - -process.load("Configuration.Generator.MinBias_13TeV_pythia8_cff") -#process.load("Configuration.Generator.SingleMuPt100_cfi") - -process.output = cms.OutputModule("PoolOutputModule", - process.FEVTSIMEventContent, - fileName = cms.untracked.string('simevent_QGSP_BERT_EML.root') -) - -process.Timing = cms.Service("Timing") - -process.SimpleMemoryCheck = cms.Service("SimpleMemoryCheck", - oncePerEventMode = cms.untracked.bool(True), - showMallocInfo = cms.untracked.bool(True), - dump = cms.untracked.bool(True), - ignoreTotal = cms.untracked.int32(1) -) - -process.load('Validation.HGCalValidation.ftSimHitTest_cfi') -process.TFileService = cms.Service("TFileService", - fileName = cms.string('ftValid.root'), - closeFileFast = cms.untracked.bool(True) - ) - -process.generation_step = cms.Path(process.pgen) -process.simulation_step = cms.Path(process.psim) -process.genfiltersummary_step = cms.EndPath(process.genFilterSummary) -process.analysis_step = cms.Path(process.ftSimHitTest) -process.out_step = cms.EndPath(process.output) - -process.g4SimHits.Physics.type = 'SimG4Core/Physics/QGSP_FTFP_BERT_EML' -process.g4SimHits.G4Commands = ['/run/verbose 2'] - -# Schedule definition -process.schedule = cms.Schedule(process.generation_step, - process.simulation_step, - process.analysis_step, - process.out_step - ) - -# filter all path with the production filter sequence -for path in process.paths: - getattr(process,path)._seq = process.generator * getattr(process,path)._seq diff --git a/Validation/MtdValidation/plugins/BuildFile.xml b/Validation/MtdValidation/plugins/BuildFile.xml index 4899951cd25f4..c23e6ab4f027a 100644 --- a/Validation/MtdValidation/plugins/BuildFile.xml +++ b/Validation/MtdValidation/plugins/BuildFile.xml @@ -8,6 +8,8 @@ + + diff --git a/Validation/MtdValidation/plugins/MtdTracksHarvester.cc b/Validation/MtdValidation/plugins/MtdTracksHarvester.cc index 112f5bd263980..db67dddf9d34e 100644 --- a/Validation/MtdValidation/plugins/MtdTracksHarvester.cc +++ b/Validation/MtdValidation/plugins/MtdTracksHarvester.cc @@ -30,6 +30,10 @@ class MtdTracksHarvester : public DQMEDHarvester { MonitorElement* meEtlEtaEff_[2]; MonitorElement* meEtlPhiEff_[2]; MonitorElement* meEtlPtEff_[2]; + MonitorElement* meMVAPtSelEff_; + MonitorElement* meMVAEtaSelEff_; + MonitorElement* meMVAPtMatchEff_; + MonitorElement* meMVAEtaMatchEff_; }; // ------------ constructor and destructor -------------- @@ -59,12 +63,20 @@ void MtdTracksHarvester::dqmEndJob(DQMStore::IBooker& ibook, DQMStore::IGetter& MonitorElement* meETLTrackEffEtaMtdZpos = igetter.get(folder_ + "TrackETLEffEtaMtdZpos"); MonitorElement* meETLTrackEffPhiMtdZpos = igetter.get(folder_ + "TrackETLEffPhiMtdZpos"); MonitorElement* meETLTrackEffPtMtdZpos = igetter.get(folder_ + "TrackETLEffPtMtdZpos"); + MonitorElement* meMVATrackEffPtTot = igetter.get(folder_ + "MVAEffPtTot"); + MonitorElement* meMVATrackMatchedEffPtTot = igetter.get(folder_ + "MVAMatchedEffPtTot"); + MonitorElement* meMVATrackMatchedEffPtMtd = igetter.get(folder_ + "MVAMatchedEffPtMtd"); + MonitorElement* meMVATrackEffEtaTot = igetter.get(folder_ + "MVAEffEtaTot"); + MonitorElement* meMVATrackMatchedEffEtaTot = igetter.get(folder_ + "MVAMatchedEffEtaTot"); + MonitorElement* meMVATrackMatchedEffEtaMtd = igetter.get(folder_ + "MVAMatchedEffEtaMtd"); if (!meBTLTrackEffEtaTot || !meBTLTrackEffPhiTot || !meBTLTrackEffPtTot || !meBTLTrackEffEtaMtd || !meBTLTrackEffPhiMtd || !meBTLTrackEffPtMtd || !meETLTrackEffEtaTotZneg || !meETLTrackEffPhiTotZneg || !meETLTrackEffPtTotZneg || !meETLTrackEffEtaMtdZneg || !meETLTrackEffPhiMtdZneg || !meETLTrackEffPtMtdZneg || !meETLTrackEffEtaTotZpos || !meETLTrackEffPhiTotZpos || !meETLTrackEffPtTotZpos || !meETLTrackEffEtaMtdZpos || - !meETLTrackEffPhiMtdZpos || !meETLTrackEffPtMtdZpos) { + !meETLTrackEffPhiMtdZpos || !meETLTrackEffPtMtdZpos || !meMVATrackEffPtTot || !meMVATrackMatchedEffPtTot || + !meMVATrackMatchedEffPtMtd || !meMVATrackEffEtaTot || !meMVATrackMatchedEffEtaTot || + !meMVATrackMatchedEffEtaMtd) { edm::LogError("MtdTracksHarvester") << "Monitoring histograms not found!" << std::endl; return; } @@ -116,6 +128,26 @@ void MtdTracksHarvester::dqmEndJob(DQMStore::IBooker& ibook, DQMStore::IGetter& meETLTrackEffPtTotZpos->getNbinsX(), meETLTrackEffPtTotZpos->getTH1()->GetXaxis()->GetXmin(), meETLTrackEffPtTotZpos->getTH1()->GetXaxis()->GetXmax()); + meMVAPtSelEff_ = ibook.book1D("MVAPtSelEff", + "Track selected efficiency VS Pt;Pt [GeV];Efficiency", + meMVATrackEffPtTot->getNbinsX(), + meMVATrackEffPtTot->getTH1()->GetXaxis()->GetXmin(), + meMVATrackEffPtTot->getTH1()->GetXaxis()->GetXmax()); + meMVAEtaSelEff_ = ibook.book1D("MVAEtaSelEff", + "Track selected efficiency VS Eta;Eta;Efficiency", + meMVATrackEffEtaTot->getNbinsX(), + meMVATrackEffEtaTot->getTH1()->GetXaxis()->GetXmin(), + meMVATrackEffEtaTot->getTH1()->GetXaxis()->GetXmax()); + meMVAPtMatchEff_ = ibook.book1D("MVAPtMatchEff", + "Track matched to GEN efficiency VS Pt;Pt [GeV];Efficiency", + meMVATrackMatchedEffPtTot->getNbinsX(), + meMVATrackMatchedEffPtTot->getTH1()->GetXaxis()->GetXmin(), + meMVATrackMatchedEffPtTot->getTH1()->GetXaxis()->GetXmax()); + meMVAEtaMatchEff_ = ibook.book1D("MVAEtaMatchEff", + "Track matched to GEN efficiency VS Eta;Eta;Efficiency", + meMVATrackMatchedEffEtaTot->getNbinsX(), + meMVATrackMatchedEffEtaTot->getTH1()->GetXaxis()->GetXmin(), + meMVATrackMatchedEffEtaTot->getTH1()->GetXaxis()->GetXmax()); meBtlEtaEff_->getTH1()->SetMinimum(0.); meBtlPhiEff_->getTH1()->SetMinimum(0.); @@ -125,6 +157,10 @@ void MtdTracksHarvester::dqmEndJob(DQMStore::IBooker& ibook, DQMStore::IGetter& meEtlPhiEff_[i]->getTH1()->SetMinimum(0.); meEtlPtEff_[i]->getTH1()->SetMinimum(0.); } + meMVAPtSelEff_->getTH1()->SetMinimum(0.); + meMVAEtaSelEff_->getTH1()->SetMinimum(0.); + meMVAPtMatchEff_->getTH1()->SetMinimum(0.); + meMVAEtaMatchEff_->getTH1()->SetMinimum(0.); // --- Calculate efficiency BTL for (int ibin = 1; ibin <= meBTLTrackEffEtaTot->getNbinsX(); ibin++) { @@ -247,6 +283,61 @@ void MtdTracksHarvester::dqmEndJob(DQMStore::IBooker& ibook, DQMStore::IGetter& meEtlPtEff_[1]->setBinContent(ibin, eff); meEtlPtEff_[1]->setBinError(ibin, bin_err); } + + for (int ibin = 1; ibin <= meMVATrackEffPtTot->getNbinsX(); ibin++) { + double eff = meMVATrackMatchedEffPtTot->getBinContent(ibin) / meMVATrackEffPtTot->getBinContent(ibin); + double bin_err = sqrt((meMVATrackMatchedEffPtTot->getBinContent(ibin) * + (meMVATrackEffPtTot->getBinContent(ibin) - meMVATrackMatchedEffPtTot->getBinContent(ibin))) / + pow(meMVATrackEffPtTot->getBinContent(ibin), 3)); + if (meMVATrackEffPtTot->getBinContent(ibin) == 0) { + eff = 0; + bin_err = 0; + } + meMVAPtSelEff_->setBinContent(ibin, eff); + meMVAPtSelEff_->setBinError(ibin, bin_err); + } + + for (int ibin = 1; ibin <= meMVATrackEffEtaTot->getNbinsX(); ibin++) { + double eff = meMVATrackMatchedEffEtaTot->getBinContent(ibin) / meMVATrackEffEtaTot->getBinContent(ibin); + double bin_err = + sqrt((meMVATrackMatchedEffEtaTot->getBinContent(ibin) * + (meMVATrackEffEtaTot->getBinContent(ibin) - meMVATrackMatchedEffEtaTot->getBinContent(ibin))) / + pow(meMVATrackEffEtaTot->getBinContent(ibin), 3)); + if (meMVATrackEffEtaTot->getBinContent(ibin) == 0) { + eff = 0; + bin_err = 0; + } + meMVAEtaSelEff_->setBinContent(ibin, eff); + meMVAEtaSelEff_->setBinError(ibin, bin_err); + } + + for (int ibin = 1; ibin <= meMVATrackMatchedEffPtTot->getNbinsX(); ibin++) { + double eff = meMVATrackMatchedEffPtMtd->getBinContent(ibin) / meMVATrackMatchedEffPtTot->getBinContent(ibin); + double bin_err = + sqrt((meMVATrackMatchedEffPtMtd->getBinContent(ibin) * + (meMVATrackMatchedEffPtTot->getBinContent(ibin) - meMVATrackMatchedEffPtMtd->getBinContent(ibin))) / + pow(meMVATrackMatchedEffPtTot->getBinContent(ibin), 3)); + if (meMVATrackMatchedEffPtTot->getBinContent(ibin) == 0) { + eff = 0; + bin_err = 0; + } + meMVAPtMatchEff_->setBinContent(ibin, eff); + meMVAPtMatchEff_->setBinError(ibin, bin_err); + } + + for (int ibin = 1; ibin <= meMVATrackMatchedEffEtaTot->getNbinsX(); ibin++) { + double eff = meMVATrackMatchedEffEtaMtd->getBinContent(ibin) / meMVATrackMatchedEffEtaTot->getBinContent(ibin); + double bin_err = + sqrt((meMVATrackMatchedEffEtaMtd->getBinContent(ibin) * + (meMVATrackMatchedEffEtaTot->getBinContent(ibin) - meMVATrackMatchedEffEtaMtd->getBinContent(ibin))) / + pow(meMVATrackMatchedEffEtaTot->getBinContent(ibin), 3)); + if (meMVATrackMatchedEffEtaTot->getBinContent(ibin) == 0) { + eff = 0; + bin_err = 0; + } + meMVAEtaMatchEff_->setBinContent(ibin, eff); + meMVAEtaMatchEff_->setBinError(ibin, bin_err); + } } // ------------ method fills 'descriptions' with the allowed parameters for the module ---------- diff --git a/Validation/MtdValidation/plugins/MtdTracksValidation.cc b/Validation/MtdValidation/plugins/MtdTracksValidation.cc index 9aa690b7fbb4a..adc6a5a3302f2 100644 --- a/Validation/MtdValidation/plugins/MtdTracksValidation.cc +++ b/Validation/MtdValidation/plugins/MtdTracksValidation.cc @@ -10,6 +10,7 @@ #include "DQMServices/Core/interface/DQMStore.h" #include "DataFormats/Common/interface/ValidHandle.h" +#include "DataFormats/Math/interface/deltaR.h" #include "DataFormats/Math/interface/GeantUnits.h" #include "DataFormats/ForwardDetId/interface/ETLDetId.h" #include "DataFormats/ForwardDetId/interface/BTLDetId.h" @@ -32,6 +33,11 @@ #include "Geometry/MTDGeometryBuilder/interface/ProxyMTDTopology.h" #include "Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h" +#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" +#include "SimGeneral/HepPDTRecord/interface/ParticleDataTable.h" +#include "HepMC/GenRanges.h" +#include "CLHEP/Units/PhysicalConstants.h" + class MtdTracksValidation : public DQMEDAnalyzer { public: explicit MtdTracksValidation(const edm::ParameterSet&); @@ -44,6 +50,10 @@ class MtdTracksValidation : public DQMEDAnalyzer { void analyze(const edm::Event&, const edm::EventSetup&) override; + const bool mvaGenSel(const HepMC::GenParticle&, const float&); + const bool mvaRecSel(const reco::TrackBase&, const reco::Vertex&, const double&, const double&); + const bool mvaGenRecMatch(const HepMC::GenParticle&, const double&, const reco::TrackBase&); + // ------------ member data ------------ const std::string folder_; @@ -51,10 +61,19 @@ class MtdTracksValidation : public DQMEDAnalyzer { const float trackMinEta_; const float trackMaxEta_; + static constexpr double etacutGEN_ = 4.; // |eta| < 4; + static constexpr double etacutREC_ = 3.; // |eta| < 3; + static constexpr double pTcut_ = 0.7; // PT > 0.7 GeV + static constexpr double deltaZcut_ = 0.1; // dz separation 1 mm + static constexpr double deltaPTcut_ = 0.05; // dPT < 5% + static constexpr double deltaDRcut_ = 0.03; // DeltaR separation + edm::EDGetTokenT GenRecTrackToken_; edm::EDGetTokenT RecTrackToken_; edm::EDGetTokenT> RecVertexToken_; + edm::EDGetTokenT HepMCProductToken_; + edm::EDGetTokenT> trackAssocToken_; edm::EDGetTokenT> pathLengthToken_; @@ -69,6 +88,7 @@ class MtdTracksValidation : public DQMEDAnalyzer { edm::EDGetTokenT> trackMVAQualToken_; edm::ESGetToken mtdtopoToken_; + edm::ESGetToken particleTableToken_; MonitorElement* meBTLTrackRPTime_; MonitorElement* meBTLTrackEffEtaTot_; @@ -99,9 +119,15 @@ class MtdTracksValidation : public DQMEDAnalyzer { MonitorElement* meTrackMVAQual_; MonitorElement* meTrackPathLenghtvsEta_; - MonitorElement* meVerNumber_; - MonitorElement* meVerZ_; - MonitorElement* meVerTime_; + MonitorElement* meMVATrackEffPtTot_; + MonitorElement* meMVATrackMatchedEffPtTot_; + MonitorElement* meMVATrackMatchedEffPtMtd_; + MonitorElement* meMVATrackEffEtaTot_; + MonitorElement* meMVATrackMatchedEffEtaTot_; + MonitorElement* meMVATrackMatchedEffEtaMtd_; + MonitorElement* meMVATrackResTot_; + MonitorElement* meMVATrackPullTot_; + MonitorElement* meMVATrackZposResTot_; }; // ------------ constructor and destructor -------------- @@ -113,6 +139,7 @@ MtdTracksValidation::MtdTracksValidation(const edm::ParameterSet& iConfig) GenRecTrackToken_ = consumes(iConfig.getParameter("inputTagG")); RecTrackToken_ = consumes(iConfig.getParameter("inputTagT")); RecVertexToken_ = consumes>(iConfig.getParameter("inputTagV")); + HepMCProductToken_ = consumes(iConfig.getParameter("inputTagH")); trackAssocToken_ = consumes>(iConfig.getParameter("trackAssocSrc")); pathLengthToken_ = consumes>(iConfig.getParameter("pathLengthSrc")); tmtdToken_ = consumes>(iConfig.getParameter("tmtd")); @@ -125,6 +152,7 @@ MtdTracksValidation::MtdTracksValidation(const edm::ParameterSet& iConfig) Sigmat0SafePidToken_ = consumes>(iConfig.getParameter("sigmat0SafePID")); trackMVAQualToken_ = consumes>(iConfig.getParameter("trackMVAQual")); mtdtopoToken_ = esConsumes(); + particleTableToken_ = esConsumes(); } MtdTracksValidation::~MtdTracksValidation() {} @@ -312,17 +340,65 @@ void MtdTracksValidation::analyze(const edm::Event& iEvent, const edm::EventSetu } } //RECO tracks loop - // --- Loop over the RECO vertices --- - int nv = 0; - for (const auto& v : *RecVertexHandle) { - if (v.isValid()) { - meVerZ_->Fill(v.z()); - meVerTime_->Fill(v.t()); - nv++; - } else - cout << "The vertex is not valid" << endl; + // reco-gen matching used for MVA quality flag + const auto& primRecoVtx = *(RecVertexHandle.product()->begin()); + + auto GenEventHandle = makeValid(iEvent.getHandle(HepMCProductToken_)); + const HepMC::GenEvent* mc = GenEventHandle->GetEvent(); + double zsim = convertMmToCm((*(mc->vertices_begin()))->position().z()); + double tsim = (*(mc->vertices_begin()))->position().t() * CLHEP::mm / CLHEP::c_light; + + auto pdt = iSetup.getHandle(particleTableToken_); + const HepPDT::ParticleDataTable* pdTable = pdt.product(); + + // select events with reco vertex close to true simulated primary vertex + if (std::abs(primRecoVtx.z() - zsim) < deltaZcut_) { + index = 0; + for (const auto& trackGen : *GenRecTrackHandle) { + const reco::TrackRef trackref(iEvent.getHandle(GenRecTrackToken_), index); + index++; + + // select the reconstructed track + + if (trackAssoc[trackref] == -1) { + continue; + } + + if (mvaRecSel(trackGen, primRecoVtx, t0Safe[trackref], Sigmat0Safe[trackref])) { + meMVATrackEffPtTot_->Fill(trackGen.pt()); + meMVATrackEffEtaTot_->Fill(std::abs(trackGen.eta())); + + double dZ = trackGen.vz() - zsim; + double dT(-9999.); + double pullT(-9999.); + if (Sigmat0Safe[trackref] != -1.) { + dT = t0Safe[trackref] - tsim; + pullT = dT / Sigmat0Safe[trackref]; + } + for (const auto& genP : mc->particle_range()) { + // select status 1 genParticles and match them to the reconstructed track + + float charge = pdTable->particle(HepPDT::ParticleID(genP->pdg_id())) != nullptr + ? pdTable->particle(HepPDT::ParticleID(genP->pdg_id()))->charge() + : 0.f; + if (mvaGenSel(*genP, charge)) { + if (mvaGenRecMatch(*genP, zsim, trackGen)) { + meMVATrackZposResTot_->Fill(dZ); + meMVATrackMatchedEffPtTot_->Fill(trackGen.pt()); + meMVATrackMatchedEffEtaTot_->Fill(std::abs(trackGen.eta())); + if (pullT > -9999.) { + meMVATrackResTot_->Fill(dT); + meMVATrackPullTot_->Fill(pullT); + meMVATrackMatchedEffPtMtd_->Fill(trackGen.pt()); + meMVATrackMatchedEffEtaMtd_->Fill(std::abs(trackGen.eta())); + } + break; + } + } + } + } + } } - meVerNumber_->Fill(nv); } // ------------ method for histogram booking ------------ @@ -383,9 +459,22 @@ void MtdTracksValidation::bookHistograms(DQMStore::IBooker& ibook, edm::Run cons meTrackMVAQual_ = ibook.book1D("TrackMVAQual", "Track MVA Quality as stored in Value Map ; MVAQual", 100, 0, 1); meTrackPathLenghtvsEta_ = ibook.bookProfile( "TrackPathLenghtvsEta", "MTD Track pathlength vs MTD track Eta;|#eta|;Pathlength", 100, 0, 3.2, 100.0, 400.0, "S"); - meVerZ_ = ibook.book1D("VerZ", "RECO Vertex Z;Z_{RECO} [cm]", 180, -18, 18); - meVerTime_ = ibook.book1D("VerTime", "RECO Vertex Time;t0 [ns]", 100, -1, 1); - meVerNumber_ = ibook.book1D("VerNumber", "RECO Vertex Number: Number of vertices", 100, 0, 500); + meMVATrackEffPtTot_ = ibook.book1D("MVAEffPtTot", "Pt of tracks associated to LV; track pt [GeV] ", 110, 0., 11.); + meMVATrackMatchedEffPtTot_ = + ibook.book1D("MVAMatchedEffPtTot", "Pt of tracks associated to LV matched to GEN; track pt [GeV] ", 110, 0., 11.); + meMVATrackMatchedEffPtMtd_ = ibook.book1D( + "MVAMatchedEffPtMtd", "Pt of tracks associated to LV matched to GEN with time; track pt [GeV] ", 110, 0., 11.); + meMVATrackEffEtaTot_ = ibook.book1D("MVAEffEtaTot", "Pt of tracks associated to LV; track eta ", 66, 0., 3.3); + meMVATrackMatchedEffEtaTot_ = + ibook.book1D("MVAMatchedEffEtaTot", "Pt of tracks associated to LV matched to GEN; track eta ", 66, 0., 3.3); + meMVATrackMatchedEffEtaMtd_ = ibook.book1D( + "MVAMatchedEffEtaMtd", "Pt of tracks associated to LV matched to GEN with time; track eta ", 66, 0., 3.3); + meMVATrackResTot_ = ibook.book1D( + "MVATrackRes", "t_{rec} - t_{sim} for LV associated tracks; t_{rec} - t_{sim} [ns] ", 120, -0.15, 0.15); + meMVATrackPullTot_ = + ibook.book1D("MVATrackPull", "Pull for associated tracks; (t_{rec}-t_{sim})/#sigma_{t}", 50, -5., 5.); + meMVATrackZposResTot_ = ibook.book1D( + "MVATrackZposResTot", "Z_{PCA} - Z_{sim} for associated tracks;Z_{PCA} - Z_{sim} [cm] ", 100, -0.1, 0.1); } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ @@ -397,6 +486,7 @@ void MtdTracksValidation::fillDescriptions(edm::ConfigurationDescriptions& descr desc.add("inputTagG", edm::InputTag("generalTracks")); desc.add("inputTagT", edm::InputTag("trackExtenderWithMTD")); desc.add("inputTagV", edm::InputTag("offlinePrimaryVertices4D")); + desc.add("inputTagH", edm::InputTag("generatorSmeared")); desc.add("tmtd", edm::InputTag("trackExtenderWithMTD:generalTracktmtd")); desc.add("sigmatmtd", edm::InputTag("trackExtenderWithMTD:generalTracksigmatmtd")); desc.add("t0Src", edm::InputTag("trackExtenderWithMTD:generalTrackt0")); @@ -416,4 +506,36 @@ void MtdTracksValidation::fillDescriptions(edm::ConfigurationDescriptions& descr descriptions.add("mtdTracks", desc); } +const bool MtdTracksValidation::mvaGenSel(const HepMC::GenParticle& gp, const float& charge) { + bool match = false; + if (gp.status() != 1) { + return match; + } + match = charge != 0.f && gp.momentum().perp() > pTcut_ && std::abs(gp.momentum().eta()) < etacutGEN_; + return match; +} + +const bool MtdTracksValidation::mvaRecSel(const reco::TrackBase& trk, + const reco::Vertex& vtx, + const double& t0, + const double& st0) { + bool match = false; + match = trk.pt() > pTcut_ && std::abs(trk.eta()) < etacutREC_ && std::abs(trk.vz() - vtx.z()) <= deltaZcut_; + if (st0 > 0.) { + match = match && std::abs(t0 - vtx.t()) < 3. * st0; + } + return match; +} + +const bool MtdTracksValidation::mvaGenRecMatch(const HepMC::GenParticle& genP, + const double& zsim, + const reco::TrackBase& trk) { + bool match = false; + double dR = reco::deltaR(genP.momentum(), trk.momentum()); + double genPT = genP.momentum().perp(); + match = + std::abs(genPT - trk.pt()) < trk.pt() * deltaPTcut_ && dR < deltaDRcut_ && std::abs(trk.vz() - zsim) < deltaZcut_; + return match; +} + DEFINE_FWK_MODULE(MtdTracksValidation); diff --git a/Validation/MtdValidation/plugins/Primary4DVertexHarvester.cc b/Validation/MtdValidation/plugins/Primary4DVertexHarvester.cc new file mode 100644 index 0000000000000..256080b6f307b --- /dev/null +++ b/Validation/MtdValidation/plugins/Primary4DVertexHarvester.cc @@ -0,0 +1,164 @@ +#include + +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "DQMServices/Core/interface/DQMEDHarvester.h" +#include "DQMServices/Core/interface/DQMStore.h" + +#include "DataFormats/ForwardDetId/interface/ETLDetId.h" + +class Primary4DVertexHarvester : public DQMEDHarvester { +public: + explicit Primary4DVertexHarvester(const edm::ParameterSet& iConfig); + ~Primary4DVertexHarvester() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +protected: + void dqmEndJob(DQMStore::IBooker&, DQMStore::IGetter&) override; + +private: + const std::string folder_; + + // --- Histograms + MonitorElement* meMVAPtSelEff_; + MonitorElement* meMVAEtaSelEff_; + MonitorElement* meMVAPtMatchEff_; + MonitorElement* meMVAEtaMatchEff_; +}; + +// ------------ constructor and destructor -------------- +Primary4DVertexHarvester::Primary4DVertexHarvester(const edm::ParameterSet& iConfig) + : folder_(iConfig.getParameter("folder")) {} + +Primary4DVertexHarvester::~Primary4DVertexHarvester() {} + +// ------------ endjob tasks ---------------------------- +void Primary4DVertexHarvester::dqmEndJob(DQMStore::IBooker& ibook, DQMStore::IGetter& igetter) { + // --- Get the monitoring histograms + MonitorElement* meMVATrackEffPtTot = igetter.get(folder_ + "MVAEffPtTot"); + MonitorElement* meMVATrackMatchedEffPtTot = igetter.get(folder_ + "MVAMatchedEffPtTot"); + MonitorElement* meMVATrackMatchedEffPtMtd = igetter.get(folder_ + "MVAMatchedEffPtMtd"); + MonitorElement* meMVATrackEffEtaTot = igetter.get(folder_ + "MVAEffEtaTot"); + MonitorElement* meMVATrackMatchedEffEtaTot = igetter.get(folder_ + "MVAMatchedEffEtaTot"); + MonitorElement* meMVATrackMatchedEffEtaMtd = igetter.get(folder_ + "MVAMatchedEffEtaMtd"); + MonitorElement* meRecoVtxVsLineDensity = igetter.get(folder_ + "RecoVtxVsLineDensity"); + MonitorElement* meRecVerNumber = igetter.get(folder_ + "RecVerNumber"); + + if (!meMVATrackEffPtTot || !meMVATrackMatchedEffPtTot || !meMVATrackMatchedEffPtMtd || !meMVATrackEffEtaTot || + !meMVATrackMatchedEffEtaTot || !meMVATrackMatchedEffEtaMtd || !meRecoVtxVsLineDensity || !meRecVerNumber) { + edm::LogError("Primary4DVertexHarvester") << "Monitoring histograms not found!" << std::endl; + return; + } + + // Normalize line density plot + double nEvt = meRecVerNumber->getEntries(); + if (nEvt > 0.) { + nEvt = 1. / nEvt; + double nEntries = meRecoVtxVsLineDensity->getEntries(); + for (int ibin = 1; ibin <= meRecoVtxVsLineDensity->getNbinsX(); ibin++) { + double cont = meRecoVtxVsLineDensity->getBinContent(ibin) * nEvt; + double bin_err = meRecoVtxVsLineDensity->getBinError(ibin) * nEvt; + meRecoVtxVsLineDensity->setBinContent(ibin, cont); + meRecoVtxVsLineDensity->setBinError(ibin, bin_err); + } + meRecoVtxVsLineDensity->setEntries(nEntries); + } + + // --- Book histograms + ibook.cd(folder_); + meMVAPtSelEff_ = ibook.book1D("MVAPtSelEff", + "Track selected efficiency VS Pt;Pt [GeV];Efficiency", + meMVATrackEffPtTot->getNbinsX(), + meMVATrackEffPtTot->getTH1()->GetXaxis()->GetXmin(), + meMVATrackEffPtTot->getTH1()->GetXaxis()->GetXmax()); + meMVAEtaSelEff_ = ibook.book1D("MVAEtaSelEff", + "Track selected efficiency VS Eta;Eta;Efficiency", + meMVATrackEffEtaTot->getNbinsX(), + meMVATrackEffEtaTot->getTH1()->GetXaxis()->GetXmin(), + meMVATrackEffEtaTot->getTH1()->GetXaxis()->GetXmax()); + meMVAPtMatchEff_ = ibook.book1D("MVAPtMatchEff", + "Track matched to GEN efficiency VS Pt;Pt [GeV];Efficiency", + meMVATrackMatchedEffPtTot->getNbinsX(), + meMVATrackMatchedEffPtTot->getTH1()->GetXaxis()->GetXmin(), + meMVATrackMatchedEffPtTot->getTH1()->GetXaxis()->GetXmax()); + meMVAEtaMatchEff_ = ibook.book1D("MVAEtaMatchEff", + "Track matched to GEN efficiency VS Eta;Eta;Efficiency", + meMVATrackMatchedEffEtaTot->getNbinsX(), + meMVATrackMatchedEffEtaTot->getTH1()->GetXaxis()->GetXmin(), + meMVATrackMatchedEffEtaTot->getTH1()->GetXaxis()->GetXmax()); + + meMVAPtSelEff_->getTH1()->SetMinimum(0.); + meMVAEtaSelEff_->getTH1()->SetMinimum(0.); + meMVAPtMatchEff_->getTH1()->SetMinimum(0.); + meMVAEtaMatchEff_->getTH1()->SetMinimum(0.); + + for (int ibin = 1; ibin <= meMVATrackEffPtTot->getNbinsX(); ibin++) { + double eff = meMVATrackMatchedEffPtTot->getBinContent(ibin) / meMVATrackEffPtTot->getBinContent(ibin); + double bin_err = sqrt((meMVATrackMatchedEffPtTot->getBinContent(ibin) * + (meMVATrackEffPtTot->getBinContent(ibin) - meMVATrackMatchedEffPtTot->getBinContent(ibin))) / + pow(meMVATrackEffPtTot->getBinContent(ibin), 3)); + if (meMVATrackEffPtTot->getBinContent(ibin) == 0) { + eff = 0; + bin_err = 0; + } + meMVAPtSelEff_->setBinContent(ibin, eff); + meMVAPtSelEff_->setBinError(ibin, bin_err); + } + + for (int ibin = 1; ibin <= meMVATrackEffEtaTot->getNbinsX(); ibin++) { + double eff = meMVATrackMatchedEffEtaTot->getBinContent(ibin) / meMVATrackEffEtaTot->getBinContent(ibin); + double bin_err = + sqrt((meMVATrackMatchedEffEtaTot->getBinContent(ibin) * + (meMVATrackEffEtaTot->getBinContent(ibin) - meMVATrackMatchedEffEtaTot->getBinContent(ibin))) / + pow(meMVATrackEffEtaTot->getBinContent(ibin), 3)); + if (meMVATrackEffEtaTot->getBinContent(ibin) == 0) { + eff = 0; + bin_err = 0; + } + meMVAEtaSelEff_->setBinContent(ibin, eff); + meMVAEtaSelEff_->setBinError(ibin, bin_err); + } + + for (int ibin = 1; ibin <= meMVATrackMatchedEffPtTot->getNbinsX(); ibin++) { + double eff = meMVATrackMatchedEffPtMtd->getBinContent(ibin) / meMVATrackMatchedEffPtTot->getBinContent(ibin); + double bin_err = + sqrt((meMVATrackMatchedEffPtMtd->getBinContent(ibin) * + (meMVATrackMatchedEffPtTot->getBinContent(ibin) - meMVATrackMatchedEffPtMtd->getBinContent(ibin))) / + pow(meMVATrackMatchedEffPtTot->getBinContent(ibin), 3)); + if (meMVATrackMatchedEffPtTot->getBinContent(ibin) == 0) { + eff = 0; + bin_err = 0; + } + meMVAPtMatchEff_->setBinContent(ibin, eff); + meMVAPtMatchEff_->setBinError(ibin, bin_err); + } + + for (int ibin = 1; ibin <= meMVATrackMatchedEffEtaTot->getNbinsX(); ibin++) { + double eff = meMVATrackMatchedEffEtaMtd->getBinContent(ibin) / meMVATrackMatchedEffEtaTot->getBinContent(ibin); + double bin_err = + sqrt((meMVATrackMatchedEffEtaMtd->getBinContent(ibin) * + (meMVATrackMatchedEffEtaTot->getBinContent(ibin) - meMVATrackMatchedEffEtaMtd->getBinContent(ibin))) / + pow(meMVATrackMatchedEffEtaTot->getBinContent(ibin), 3)); + if (meMVATrackMatchedEffEtaTot->getBinContent(ibin) == 0) { + eff = 0; + bin_err = 0; + } + meMVAEtaMatchEff_->setBinContent(ibin, eff); + meMVAEtaMatchEff_->setBinError(ibin, bin_err); + } +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ---------- +void Primary4DVertexHarvester::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("folder", "MTD/Vertices/"); + + descriptions.add("Primary4DVertexPostProcessor", desc); +} + +DEFINE_FWK_MODULE(Primary4DVertexHarvester); diff --git a/Validation/MtdValidation/plugins/Primary4DVertexValidation.cc b/Validation/MtdValidation/plugins/Primary4DVertexValidation.cc index 310aad0d4a492..9f1892bd768c2 100644 --- a/Validation/MtdValidation/plugins/Primary4DVertexValidation.cc +++ b/Validation/MtdValidation/plugins/Primary4DVertexValidation.cc @@ -47,6 +47,8 @@ #include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "DQMServices/Core/interface/DQMStore.h" +#include "DataFormats/Math/interface/deltaR.h" + //class declaration class Primary4DVertexValidation : public DQMEDAnalyzer { typedef math::XYZTLorentzVector LorentzVector; @@ -199,6 +201,9 @@ class Primary4DVertexValidation : public DQMEDAnalyzer { std::vector getSimPVs(const edm::Handle&); std::vector getRecoPVs(const edm::Handle>&); + const bool mvaTPSel(const TrackingParticle&); + const bool mvaRecSel(const reco::TrackBase&, const reco::Vertex&, const double&, const double&); + // ----------member data --------------------------- const std::string folder_; @@ -207,10 +212,14 @@ class Primary4DVertexValidation : public DQMEDAnalyzer { static constexpr double c_ = 2.99792458e1; //c in cm/ns static constexpr double mvaL_ = 0.5; //MVA cuts for MVA categories static constexpr double mvaH_ = 0.8; - static constexpr double selNdof_ = 4; - static constexpr double maxRank_ = 8; - static constexpr double maxTry_ = 10; - static constexpr double zWosMatchMax_ = 1; + static constexpr double selNdof_ = 4.; + static constexpr double maxRank_ = 8.; + static constexpr double maxTry_ = 10.; + static constexpr double zWosMatchMax_ = 1.; + static constexpr double etacutGEN_ = 4.; // |eta| < 4; + static constexpr double etacutREC_ = 3.; // |eta| < 3; + static constexpr double pTcut_ = 0.7; // PT > 0.7 GeV + static constexpr double deltaZcut_ = 0.1; // dz separation 1 mm const double trackweightTh_; const double mvaTh_; @@ -233,7 +242,6 @@ class Primary4DVertexValidation : public DQMEDAnalyzer { edm::EDGetTokenT> pathLengthToken_; edm::EDGetTokenT> momentumToken_; edm::EDGetTokenT> timeToken_; - edm::EDGetTokenT> sigmatimeToken_; edm::EDGetTokenT> t0SafePidToken_; edm::EDGetTokenT> sigmat0SafePidToken_; @@ -244,12 +252,22 @@ class Primary4DVertexValidation : public DQMEDAnalyzer { bool optionalPlots_; //histogram declaration + MonitorElement* meMVATrackEffPtTot_; + MonitorElement* meMVATrackMatchedEffPtTot_; + MonitorElement* meMVATrackMatchedEffPtMtd_; + MonitorElement* meMVATrackEffEtaTot_; + MonitorElement* meMVATrackMatchedEffEtaTot_; + MonitorElement* meMVATrackMatchedEffEtaMtd_; + MonitorElement* meMVATrackResTot_; + MonitorElement* meMVATrackPullTot_; + MonitorElement* meTrackResTot_; + MonitorElement* meTrackPullTot_; MonitorElement* meTrackRes_[3]; MonitorElement* meTrackPull_[3]; MonitorElement* meTrackResMass_[3]; - MonitorElement* meTrackPullMass_[3]; MonitorElement* meTrackResMassTrue_[3]; - MonitorElement* meTrackPullMassTrue_[3]; + MonitorElement* meMVATrackZposResTot_; + MonitorElement* meTrackZposResTot_; MonitorElement* meTrackZposRes_[3]; MonitorElement* meTrack3DposRes_[3]; MonitorElement* meTimeRes_; @@ -263,31 +281,35 @@ class Primary4DVertexValidation : public DQMEDAnalyzer { MonitorElement* meDeltaZrealreal_; MonitorElement* meDeltaZfakefake_; MonitorElement* meDeltaZfakereal_; - MonitorElement* meDeltaZTrealreal_; - MonitorElement* meDeltaZTfakefake_; - MonitorElement* meDeltaZTfakereal_; + MonitorElement* meDeltaTrealreal_; + MonitorElement* meDeltaTfakefake_; + MonitorElement* meDeltaTfakereal_; MonitorElement* meRecoPosInSimCollection_; MonitorElement* meRecoPosInRecoOrigCollection_; MonitorElement* meSimPosInSimOrigCollection_; MonitorElement* meRecoPVPosSignal_; MonitorElement* meRecoPVPosSignalNotHighestPt_; MonitorElement* meRecoVtxVsLineDensity_; + MonitorElement* meRecVerNumber_; + MonitorElement* meRecPVZ_; + MonitorElement* meRecPVT_; MonitorElement* meSimPVZ_; //some tests + MonitorElement* meTrackResLowPTot_; + MonitorElement* meTrackResHighPTot_; + MonitorElement* meTrackPullLowPTot_; + MonitorElement* meTrackPullHighPTot_; + MonitorElement* meTrackResLowP_[3]; MonitorElement* meTrackResHighP_[3]; MonitorElement* meTrackPullLowP_[3]; MonitorElement* meTrackPullHighP_[3]; MonitorElement* meTrackResMassProtons_[3]; - MonitorElement* meTrackPullMassProtons_[3]; MonitorElement* meTrackResMassTrueProtons_[3]; - MonitorElement* meTrackPullMassTrueProtons_[3]; MonitorElement* meTrackResMassPions_[3]; - MonitorElement* meTrackPullMassPions_[3]; MonitorElement* meTrackResMassTruePions_[3]; - MonitorElement* meTrackPullMassTruePions_[3]; }; // constructors and destructor @@ -314,7 +336,6 @@ Primary4DVertexValidation::Primary4DVertexValidation(const edm::ParameterSet& iC pathLengthToken_ = consumes>(iConfig.getParameter("pathLengthSrc")); momentumToken_ = consumes>(iConfig.getParameter("momentumSrc")); timeToken_ = consumes>(iConfig.getParameter("timeSrc")); - sigmatimeToken_ = consumes>(iConfig.getParameter("sigmaSrc")); t0SafePidToken_ = consumes>(iConfig.getParameter("t0SafePID")); sigmat0SafePidToken_ = consumes>(iConfig.getParameter("sigmat0SafePID")); trackMVAQualToken_ = consumes>(iConfig.getParameter("trackMVAQual")); @@ -330,6 +351,19 @@ void Primary4DVertexValidation::bookHistograms(DQMStore::IBooker& ibook, edm::EventSetup const& iSetup) { ibook.setCurrentFolder(folder_); // --- histograms booking + meMVATrackEffPtTot_ = ibook.book1D("MVAEffPtTot", "Pt of tracks associated to LV; track pt [GeV] ", 110, 0., 11.); + meMVATrackEffEtaTot_ = ibook.book1D("MVAEffEtaTot", "Pt of tracks associated to LV; track eta ", 66, 0., 3.3); + meMVATrackMatchedEffPtTot_ = + ibook.book1D("MVAMatchedEffPtTot", "Pt of tracks associated to LV matched to TP; track pt [GeV] ", 110, 0., 11.); + meMVATrackMatchedEffPtMtd_ = ibook.book1D( + "MVAMatchedEffPtMtd", "Pt of tracks associated to LV matched to TP with time; track pt [GeV] ", 110, 0., 11.); + meMVATrackMatchedEffEtaTot_ = + ibook.book1D("MVAMatchedEffEtaTot", "Pt of tracks associated to LV matched to TP; track eta ", 66, 0., 3.3); + meMVATrackMatchedEffEtaMtd_ = ibook.book1D( + "MVAMatchedEffEtaMtd", "Pt of tracks associated to LV matched to TP with time; track eta ", 66, 0., 3.3); + meMVATrackResTot_ = ibook.book1D( + "MVATrackRes", "t_{rec} - t_{sim} for tracks from LV MVA sel.; t_{rec} - t_{sim} [ns] ", 120, -0.15, 0.15); + meTrackResTot_ = ibook.book1D("TrackRes", "t_{rec} - t_{sim} for tracks; t_{rec} - t_{sim} [ns] ", 120, -0.15, 0.15); meTrackRes_[0] = ibook.book1D( "TrackRes-LowMVA", "t_{rec} - t_{sim} for tracks with MVA < 0.5; t_{rec} - t_{sim} [ns] ", 100, -1., 1.); meTrackRes_[1] = ibook.book1D( @@ -359,60 +393,50 @@ void Primary4DVertexValidation::bookHistograms(DQMStore::IBooker& ibook, -1., 1.); } + meMVATrackPullTot_ = + ibook.book1D("MVATrackPull", "Pull for tracks from LV MAV sel.; (t_{rec}-t_{sim})/#sigma_{t}", 50, -5., 5.); + meTrackPullTot_ = ibook.book1D("TrackPull", "Pull for tracks; (t_{rec}-t_{sim})/#sigma_{t}", 100, -10., 10.); meTrackPull_[0] = ibook.book1D("TrackPull-LowMVA", "Pull for tracks with MVA < 0.5; (t_{rec}-t_{sim})/#sigma_{t}", 100, -10., 10.); meTrackPull_[1] = ibook.book1D( "TrackPull-MediumMVA", "Pull for tracks with 0.5 < MVA < 0.8; (t_{rec}-t_{sim})/#sigma_{t}", 100, -10., 10.); meTrackPull_[2] = ibook.book1D("TrackPull-HighMVA", "Pull for tracks with MVA > 0.8; (t_{rec}-t_{sim})/#sigma_{t}", 100, -10., 10.); - if (optionalPlots_) { - meTrackPullMass_[0] = ibook.book1D( - "TrackPullMass-LowMVA", "Pull for tracks with MVA < 0.5; (t_{rec}-t_{est})/#sigma_{t}", 100, -10., 10.); - meTrackPullMass_[1] = ibook.book1D( - "TrackPullMass-MediumMVA", "Pull for tracks with 0.5 < MVA < 0.8; (t_{rec}-t_{est})/#sigma_{t}", 100, -10., 10.); - meTrackPullMass_[2] = ibook.book1D( - "TrackPullMass-HighMVA", "Pull for tracks with MVA > 0.8; (t_{rec}-t_{est})/#sigma_{t}", 100, -10., 10.); - meTrackPullMassTrue_[0] = ibook.book1D( - "TrackPullMassTrue-LowMVA", "Pull for tracks with MVA < 0.5; (t_{est}-t_{sim})/#sigma_{t}", 100, -10., 10.); - meTrackPullMassTrue_[1] = ibook.book1D("TrackPullMassTrue-MediumMVA", - "Pull for tracks with 0.5 < MVA < 0.8; (t_{est}-t_{sim})/#sigma_{t}", - 100, - -10., - 10.); - meTrackPullMassTrue_[2] = ibook.book1D( - "TrackPullMassTrue-HighMVA", "Pull for tracks with MVA > 0.8; (t_{est}-t_{sim})/#sigma_{t}", 100, -10., 10.); - } + meMVATrackZposResTot_ = ibook.book1D( + "MVATrackZposResTot", "Z_{PCA} - Z_{sim} for tracks from LV MVA sel.;Z_{PCA} - Z_{sim} [cm] ", 50, -0.1, 0.1); + meTrackZposResTot_ = + ibook.book1D("TrackZposResTot", "Z_{PCA} - Z_{sim} for tracks;Z_{PCA} - Z_{sim} [cm] ", 50, -0.5, 0.5); meTrackZposRes_[0] = ibook.book1D( - "TrackZposRes-LowMVA", "Z_{PCA} - Z_{sim} for tracks with MVA < 0.5;Z_{PCA} - Z_{sim} [cm] ", 100, -1., 1.); + "TrackZposRes-LowMVA", "Z_{PCA} - Z_{sim} for tracks with MVA < 0.5;Z_{PCA} - Z_{sim} [cm] ", 50, -0.5, 0.5); meTrackZposRes_[1] = ibook.book1D("TrackZposRes-MediumMVA", "Z_{PCA} - Z_{sim} for tracks with 0.5 < MVA < 0.8 ;Z_{PCA} - Z_{sim} [cm] ", - 100, - -1., - 1.); + 50, + -0.5, + 0.5); meTrackZposRes_[2] = ibook.book1D( - "TrackZposRes-HighMVA", "Z_{PCA} - Z_{sim} for tracks with MVA > 0.8 ;Z_{PCA} - Z_{sim} [cm] ", 100, -1., 1.); + "TrackZposRes-HighMVA", "Z_{PCA} - Z_{sim} for tracks with MVA > 0.8 ;Z_{PCA} - Z_{sim} [cm] ", 50, -0.5, 0.5); meTrack3DposRes_[0] = ibook.book1D("Track3DposRes-LowMVA", "3dPos_{PCA} - 3dPos_{sim} for tracks with MVA < 0.5 ;3dPos_{PCA} - 3dPos_{sim} [cm] ", - 100, - -1., - 1.); + 50, + -0.5, + 0.5); meTrack3DposRes_[1] = ibook.book1D("Track3DposRes-MediumMVA", "3dPos_{PCA} - 3dPos_{sim} for tracks with 0.5 < MVA < 0.8 ;3dPos_{PCA} - 3dPos_{sim} [cm] ", - 100, - -1., - 1.); + 50, + -0.5, + 0.5); meTrack3DposRes_[2] = ibook.book1D("Track3DposRes-HighMVA", "3dPos_{PCA} - 3dPos_{sim} for tracks with MVA > 0.8;3dPos_{PCA} - 3dPos_{sim} [cm] ", - 100, - -1., - 1.); - meTimeRes_ = ibook.book1D("TimeRes", "t_{rec} - t_{sim} ;t_{rec} - t_{sim} [ns] ", 100, -1., 1.); + 50, + -0.5, + 0.5); + meTimeRes_ = ibook.book1D("TimeRes", "t_{rec} - t_{sim} ;t_{rec} - t_{sim} [ns] ", 40, -0.2, 0.2); meTimePull_ = ibook.book1D("TimePull", "Pull; t_{rec} - t_{sim}/#sigma_{t rec}", 100, -10., 10.); meTimeSignalRes_ = - ibook.book1D("TimeSignalRes", "t_{rec} - t_{sim} for signal ;t_{rec} - t_{sim} [ns] ", 100, -1., 1.); + ibook.book1D("TimeSignalRes", "t_{rec} - t_{sim} for signal ;t_{rec} - t_{sim} [ns] ", 40, -0.2, 0.2); meTimeSignalPull_ = ibook.book1D("TimeSignalPull", "Pull for signal; t_{rec} - t_{sim}/#sigma_{t rec}", 100, -10., 10.); mePUvsRealV_ = @@ -425,15 +449,17 @@ void Primary4DVertexValidation::bookHistograms(DQMStore::IBooker& ibook, meDeltaZrealreal_ = ibook.book1D("DeltaZrealreal", "#Delta Z real-real; |#Delta Z (r-r)| [cm]", 100, 0, 0.5); meDeltaZfakefake_ = ibook.book1D("DeltaZfakefake", "#Delta Z fake-fake; |#Delta Z (f-f)| [cm]", 100, 0, 0.5); meDeltaZfakereal_ = ibook.book1D("DeltaZfakereal", "#Delta Z fake-real; |#Delta Z (f-r)| [cm]", 100, 0, 0.5); - meDeltaZTrealreal_ = ibook.book1D("DeltaZTrealreal", "#Delta ZT real-real; |#Delta ZT (r-r)| [cm]", 100, 0, 2.); - meDeltaZTfakefake_ = ibook.book1D("DeltaZTfakefake", "#Delta ZT fake-fake; |#Delta ZT (f-f)| [cm]", 100, 0, 2.); - meDeltaZTfakereal_ = ibook.book1D("DeltaZTfakereal", "#Delta ZT fake-real; |#Delta ZT (f-r)| [cm]", 100, 0, 2.); - meRecoPosInSimCollection_ = ibook.book1D( - "RecoPosInSimCollection", "Sim signal vertex index associated to Reco signal vertex; Sim PV index", 200, 0, 200); - meRecoPosInRecoOrigCollection_ = - ibook.book1D("RecoPosInRecoOrigCollection", "Reco signal index in OrigCollection; Reco index", 200, 0, 200); - meSimPosInSimOrigCollection_ = - ibook.book1D("SimPosInSimOrigCollection", "Sim signal index in OrigCollection; Sim index", 200, 0, 200); + meDeltaTrealreal_ = ibook.book1D("DeltaTrealreal", "#Delta T real-real; |#Delta T (r-r)| [sigma]", 60, 0., 30.); + meDeltaTfakefake_ = ibook.book1D("DeltaTfakefake", "#Delta T fake-fake; |#Delta T (f-f)| [sigma]", 60, 0., 30.); + meDeltaTfakereal_ = ibook.book1D("DeltaTfakereal", "#Delta T fake-real; |#Delta T (f-r)| [sigma]", 60, 0., 30.); + if (optionalPlots_) { + meRecoPosInSimCollection_ = ibook.book1D( + "RecoPosInSimCollection", "Sim signal vertex index associated to Reco signal vertex; Sim PV index", 200, 0, 200); + meRecoPosInRecoOrigCollection_ = + ibook.book1D("RecoPosInRecoOrigCollection", "Reco signal index in OrigCollection; Reco index", 200, 0, 200); + meSimPosInSimOrigCollection_ = + ibook.book1D("SimPosInSimOrigCollection", "Sim signal index in OrigCollection; Sim index", 200, 0, 200); + } meRecoPVPosSignal_ = ibook.book1D("RecoPVPosSignal", "Position in reco collection of PV associated to sim signal", 200, 0, 200); meRecoPVPosSignalNotHighestPt_ = @@ -444,9 +470,14 @@ void Primary4DVertexValidation::bookHistograms(DQMStore::IBooker& ibook, 200); meRecoVtxVsLineDensity_ = ibook.book1D("RecoVtxVsLineDensity", "#Reco vertices/mm/event; line density [#vtx/mm/event]", 160, 0., 4.); - meSimPVZ_ = ibook.book1D("simPVZ", "#Sim vertices/mm", 400, -20., 20.); + meRecVerNumber_ = ibook.book1D("RecVerNumber", "RECO Vertex Number: Number of vertices", 50, 0, 250); + meRecPVZ_ = ibook.book1D("recPVZ", "Weighted #Rec vertices/mm", 400, -20., 20.); + meRecPVT_ = ibook.book1D("recPVT", "#Rec vertices/10 ps", 200, -1., 1.); + meSimPVZ_ = ibook.book1D("simPVZ", "Weighted #Sim vertices/mm", 400, -20., 20.); //some tests + meTrackResLowPTot_ = ibook.book1D( + "TrackResLowP", "t_{rec} - t_{sim} for tracks with p < 2 GeV; t_{rec} - t_{sim} [ns] ", 70, -0.15, 0.15); meTrackResLowP_[0] = ibook.book1D("TrackResLowP-LowMVA", "t_{rec} - t_{sim} for tracks with MVA < 0.5 and p < 2 GeV; t_{rec} - t_{sim} [ns] ", @@ -465,6 +496,8 @@ void Primary4DVertexValidation::bookHistograms(DQMStore::IBooker& ibook, 100, -1., 1.); + meTrackResHighPTot_ = ibook.book1D( + "TrackResHighP", "t_{rec} - t_{sim} for tracks with p > 2 GeV; t_{rec} - t_{sim} [ns] ", 70, -0.15, 0.15); meTrackResHighP_[0] = ibook.book1D("TrackResHighP-LowMVA", "t_{rec} - t_{sim} for tracks with MVA < 0.5 and p > 2 GeV; t_{rec} - t_{sim} [ns] ", @@ -483,6 +516,8 @@ void Primary4DVertexValidation::bookHistograms(DQMStore::IBooker& ibook, 100, -1., 1.); + meTrackPullLowPTot_ = + ibook.book1D("TrackPullLowP", "Pull for tracks with p < 2 GeV; (t_{rec}-t_{sim})/#sigma_{t}", 100, -10., 10.); meTrackPullLowP_[0] = ibook.book1D("TrackPullLowP-LowMVA", "Pull for tracks with MVA < 0.5 and p < 2 GeV; (t_{rec}-t_{sim})/#sigma_{t}", 100, @@ -498,6 +533,8 @@ void Primary4DVertexValidation::bookHistograms(DQMStore::IBooker& ibook, 100, -10., 10.); + meTrackPullHighPTot_ = + ibook.book1D("TrackPullHighP", "Pull for tracks with p > 2 GeV; (t_{rec}-t_{sim})/#sigma_{t}", 100, -10., 10.); meTrackPullHighP_[0] = ibook.book1D("TrackPullHighP-LowMVA", "Pull for tracks with MVA < 0.5 and p > 2 GeV; (t_{rec}-t_{sim})/#sigma_{t}", 100, @@ -586,71 +623,6 @@ void Primary4DVertexValidation::bookHistograms(DQMStore::IBooker& ibook, 100, -1., 1.); - - meTrackPullMassProtons_[0] = ibook.book1D("TrackPullMass-Protons-LowMVA", - "Pull for proton tracks with MVA < 0.5; (t_{rec}-t_{est})/#sigma_{t}", - 100, - -10., - 10.); - meTrackPullMassProtons_[1] = - ibook.book1D("TrackPullMass-Protons-MediumMVA", - "Pull for proton tracks with 0.5 < MVA < 0.8; (t_{rec}-t_{est})/#sigma_{t}", - 100, - -10., - 10.); - meTrackPullMassProtons_[2] = ibook.book1D("TrackPullMass-Protons-HighMVA", - "Pull for proton tracks with MVA > 0.8; (t_{rec}-t_{est})/#sigma_{t}", - 100, - -10., - 10.); - meTrackPullMassTrueProtons_[0] = ibook.book1D("TrackPullMassTrue-Protons-LowMVA", - "Pull for proton tracks with MVA < 0.5; (t_{est}-t_{sim})/#sigma_{t}", - 100, - -10., - 10.); - meTrackPullMassTrueProtons_[1] = - ibook.book1D("TrackPullMassTrue-Protons-MediumMVA", - "Pull for proton tracks with 0.5 < MVA < 0.8; (t_{est}-t_{sim})/#sigma_{t}", - 100, - -10., - 10.); - meTrackPullMassTrueProtons_[2] = ibook.book1D("TrackPullMassTrue-Protons-HighMVA", - "Pull for proton tracks with MVA > 0.8; (t_{est}-t_{sim})/#sigma_{t}", - 100, - -10., - 10.); - - meTrackPullMassPions_[0] = ibook.book1D("TrackPullMass-Pions-LowMVA", - "Pull for pion tracks with MVA < 0.5; (t_{rec}-t_{est})/#sigma_{t}", - 100, - -10., - 10.); - meTrackPullMassPions_[1] = ibook.book1D("TrackPullMass-Pions-MediumMVA", - "Pull for pion tracks with 0.5 < MVA < 0.8; (t_{rec}-t_{est})/#sigma_{t}", - 100, - -10., - 10.); - meTrackPullMassPions_[2] = ibook.book1D("TrackPullMass-Pions-HighMVA", - "Pull for pion tracks with MVA > 0.8; (t_{rec}-t_{est})/#sigma_{t}", - 100, - -10., - 10.); - meTrackPullMassTruePions_[0] = ibook.book1D("TrackPullMassTrue-Pions-LowMVA", - "Pull for pion tracks with MVA < 0.5; (t_{est}-t_{sim})/#sigma_{t}", - 100, - -10., - 10.); - meTrackPullMassTruePions_[1] = - ibook.book1D("TrackPullMassTrue-Pions-MediumMVA", - "Pull for pion tracks with 0.5 < MVA < 0.8; (t_{est}-t_{sim})/#sigma_{t}", - 100, - -10., - 10.); - meTrackPullMassTruePions_[2] = ibook.book1D("TrackPullMassTrue-Pions-HighMVA", - "Pull for pion tracks with MVA > 0.8; (t_{est}-t_{sim})/#sigma_{t}", - 100, - -10., - 10.); } } @@ -1137,7 +1109,6 @@ void Primary4DVertexValidation::analyze(const edm::Event& iEvent, const edm::Eve const auto& pathLength = iEvent.get(pathLengthToken_); const auto& momentum = iEvent.get(momentumToken_); const auto& time = iEvent.get(timeToken_); - const auto& sigmatime = iEvent.get(sigmatimeToken_); const auto& t0Safe = iEvent.get(t0SafePidToken_); const auto& sigmat0Safe = iEvent.get(sigmat0SafePidToken_); const auto& mtdQualMVA = iEvent.get(trackMVAQualToken_); @@ -1152,17 +1123,32 @@ void Primary4DVertexValidation::analyze(const edm::Event& iEvent, const edm::Eve for (unsigned int iev = 0; iev < simpv.size(); iev++) { auto vsim = simpv.at(iev).sim_vertex; + bool selectedVtxMatching = recopv.at(iv).sim == iev && simpv.at(iev).rec == iv && + simpv.at(iev).eventId.bunchCrossing() == 0 && simpv.at(iev).eventId.event() == 0 && + recopv.at(iv).OriginalIndex == 0; + if (selectedVtxMatching && !recopv.at(iv).is_signal()) { + edm::LogWarning("Primary4DVertexValidation") + << "Reco vtx leading match inconsistent: BX/ID " << simpv.at(iev).eventId.bunchCrossing() << " " + << simpv.at(iev).eventId.event(); + } + double vzsim = simpv.at(iev).z; + double vtsim = simpv.at(iev).t * simUnit_; + for (auto iTrack = vertex->tracks_begin(); iTrack != vertex->tracks_end(); ++iTrack) { if (trackAssoc[*iTrack] == -1) { LogTrace("mtdTracks") << "Extended track not associated"; continue; } - const reco::TrackRef mtdTrackref = reco::TrackRef(iEvent.getHandle(RecTrackToken_), trackAssoc[*iTrack]); - if (vertex->trackWeight(*iTrack) < trackweightTh_) continue; + bool selectRecoTrk = mvaRecSel(**iTrack, *vertex, t0Safe[*iTrack], sigmat0Safe[*iTrack]); + if (selectedVtxMatching && selectRecoTrk) { + meMVATrackEffPtTot_->Fill((*iTrack)->pt()); + meMVATrackEffEtaTot_->Fill(std::abs((*iTrack)->eta())); + } + auto tp_info = getMatchedTP(*iTrack, vsim); if (tp_info != nullptr) { double mass = (*tp_info)->mass(); @@ -1183,9 +1169,34 @@ void Primary4DVertexValidation::analyze(const edm::Event& iEvent, const edm::Eve d3D = -d3D; } + bool selectTP = mvaTPSel(**tp_info); + + if (selectedVtxMatching && selectRecoTrk && selectTP) { + meMVATrackZposResTot_->Fill((*iTrack)->vz() - vzsim); + meMVATrackMatchedEffPtTot_->Fill((*iTrack)->pt()); + meMVATrackMatchedEffEtaTot_->Fill(std::abs((*iTrack)->eta())); + } + if (sigmat0Safe[*iTrack] == -1) continue; + if (selectedVtxMatching && selectRecoTrk && selectTP) { + meMVATrackResTot_->Fill(t0Safe[*iTrack] - vtsim); + meMVATrackPullTot_->Fill((t0Safe[*iTrack] - vtsim) / sigmat0Safe[*iTrack]); + meMVATrackMatchedEffPtMtd_->Fill((*iTrack)->pt()); + meMVATrackMatchedEffEtaMtd_->Fill(std::abs((*iTrack)->eta())); + } + meTrackResTot_->Fill(t0Safe[*iTrack] - tsim); + meTrackPullTot_->Fill((t0Safe[*iTrack] - tsim) / sigmat0Safe[*iTrack]); + meTrackZposResTot_->Fill(dZ); + if ((*iTrack)->p() <= 2) { + meTrackResLowPTot_->Fill(t0Safe[*iTrack] - tsim); + meTrackPullLowPTot_->Fill((t0Safe[*iTrack] - tsim) / sigmat0Safe[*iTrack]); + } else { + meTrackResHighPTot_->Fill(t0Safe[*iTrack] - tsim); + meTrackPullHighPTot_->Fill((t0Safe[*iTrack] - tsim) / sigmat0Safe[*iTrack]); + } + if (mtdQualMVA[(*iTrack)] < mvaL_) { meTrackZposRes_[0]->Fill(dZ); meTrack3DposRes_[0]->Fill(d3D); @@ -1194,9 +1205,7 @@ void Primary4DVertexValidation::analyze(const edm::Event& iEvent, const edm::Eve if (optionalPlots_) { meTrackResMass_[0]->Fill(t0Safe[*iTrack] - tEst); - meTrackPullMass_[0]->Fill((t0Safe[*iTrack] - tEst) / sigmat0Safe[*iTrack]); meTrackResMassTrue_[0]->Fill(tEst - tsim); - meTrackPullMassTrue_[0]->Fill((tEst - tsim) / sigmatime[*iTrack]); } if ((*iTrack)->p() <= 2) { @@ -1210,14 +1219,10 @@ void Primary4DVertexValidation::analyze(const edm::Event& iEvent, const edm::Eve if (optionalPlots_) { if (std::abs((*tp_info)->pdgId()) == 2212) { meTrackResMassProtons_[0]->Fill(t0Safe[*iTrack] - tEst); - meTrackPullMassProtons_[0]->Fill((t0Safe[*iTrack] - tEst) / sigmat0Safe[*iTrack]); meTrackResMassTrueProtons_[0]->Fill(tEst - tsim); - meTrackPullMassTrueProtons_[0]->Fill((tEst - tsim) / sigmatime[*iTrack]); } else if (std::abs((*tp_info)->pdgId()) == 211) { meTrackResMassPions_[0]->Fill(t0Safe[*iTrack] - tEst); - meTrackPullMassPions_[0]->Fill((t0Safe[*iTrack] - tEst) / sigmat0Safe[*iTrack]); meTrackResMassTruePions_[0]->Fill(tEst - tsim); - meTrackPullMassTruePions_[0]->Fill((tEst - tsim) / sigmatime[*iTrack]); } } @@ -1229,9 +1234,7 @@ void Primary4DVertexValidation::analyze(const edm::Event& iEvent, const edm::Eve if (optionalPlots_) { meTrackResMass_[1]->Fill(t0Safe[*iTrack] - tEst); - meTrackPullMass_[1]->Fill((t0Safe[*iTrack] - tEst) / sigmat0Safe[*iTrack]); meTrackResMassTrue_[1]->Fill(tEst - tsim); - meTrackPullMassTrue_[1]->Fill((tEst - tsim) / sigmatime[*iTrack]); } if ((*iTrack)->p() <= 2) { @@ -1245,14 +1248,10 @@ void Primary4DVertexValidation::analyze(const edm::Event& iEvent, const edm::Eve if (optionalPlots_) { if (std::abs((*tp_info)->pdgId()) == 2212) { meTrackResMassProtons_[1]->Fill(t0Safe[*iTrack] - tEst); - meTrackPullMassProtons_[1]->Fill((t0Safe[*iTrack] - tEst) / sigmat0Safe[*iTrack]); meTrackResMassTrueProtons_[1]->Fill(tEst - tsim); - meTrackPullMassTrueProtons_[1]->Fill((tEst - tsim) / sigmatime[*iTrack]); } else if (std::abs((*tp_info)->pdgId()) == 211) { meTrackResMassPions_[1]->Fill(t0Safe[*iTrack] - tEst); - meTrackPullMassPions_[1]->Fill((t0Safe[*iTrack] - tEst) / sigmat0Safe[*iTrack]); meTrackResMassTruePions_[1]->Fill(tEst - tsim); - meTrackPullMassTruePions_[1]->Fill((tEst - tsim) / sigmatime[*iTrack]); } } @@ -1264,9 +1263,7 @@ void Primary4DVertexValidation::analyze(const edm::Event& iEvent, const edm::Eve if (optionalPlots_) { meTrackResMass_[2]->Fill(t0Safe[*iTrack] - tEst); - meTrackPullMass_[2]->Fill((t0Safe[*iTrack] - tEst) / sigmat0Safe[*iTrack]); meTrackResMassTrue_[2]->Fill(tEst - tsim); - meTrackPullMassTrue_[2]->Fill((tEst - tsim) / sigmatime[*iTrack]); } if ((*iTrack)->p() <= 2) { @@ -1280,14 +1277,10 @@ void Primary4DVertexValidation::analyze(const edm::Event& iEvent, const edm::Eve if (optionalPlots_) { if (std::abs((*tp_info)->pdgId()) == 2212) { meTrackResMassProtons_[2]->Fill(t0Safe[*iTrack] - tEst); - meTrackPullMassProtons_[2]->Fill((t0Safe[*iTrack] - tEst) / sigmat0Safe[*iTrack]); meTrackResMassTrueProtons_[2]->Fill(tEst - tsim); - meTrackPullMassTrueProtons_[2]->Fill((tEst - tsim) / sigmatime[*iTrack]); } else if (std::abs((*tp_info)->pdgId()) == 211) { meTrackResMassPions_[2]->Fill(t0Safe[*iTrack] - tEst); - meTrackPullMassPions_[2]->Fill((t0Safe[*iTrack] - tEst) / sigmat0Safe[*iTrack]); meTrackResMassTruePions_[2]->Fill(tEst - tsim); - meTrackPullMassTruePions_[2]->Fill((tEst - tsim) / sigmatime[*iTrack]); } } } @@ -1307,8 +1300,13 @@ void Primary4DVertexValidation::analyze(const edm::Event& iEvent, const edm::Eve return lineDensityPar_[0] * exp(-0.5 * argl * argl); }; + meRecVerNumber_->Fill(recopv.size()); for (unsigned int ir = 0; ir < recopv.size(); ir++) { meRecoVtxVsLineDensity_->Fill(puLineDensity(recopv.at(ir).z)); + meRecPVZ_->Fill(recopv.at(ir).z, 1. / puLineDensity(recopv.at(ir).z)); + if (recopv.at(ir).recVtx->tError() > 0.) { + meRecPVT_->Fill(recopv.at(ir).recVtx->t()); + } if (debug_) { edm::LogPrint("Primary4DVertexValidation") << "************* IR: " << ir; edm::LogPrint("Primary4DVertexValidation") @@ -1339,8 +1337,8 @@ void Primary4DVertexValidation::analyze(const edm::Event& iEvent, const edm::Eve //fill vertices histograms here in a new loop for (unsigned int is = 0; is < simpv.size(); is++) { - meSimPVZ_->Fill(simpv.at(is).z); - if (is == 0) { + meSimPVZ_->Fill(simpv.at(is).z, 1. / puLineDensity(simpv.at(is).z)); + if (is == 0 && optionalPlots_) { meSimPosInSimOrigCollection_->Fill(simpv.at(is).OriginalIndex); } @@ -1363,8 +1361,10 @@ void Primary4DVertexValidation::analyze(const edm::Event& iEvent, const edm::Eve meTimeSignalRes_->Fill(recopv.at(ir).recVtx->t() - simpv.at(is).t * simUnit_); meTimeSignalPull_->Fill((recopv.at(ir).recVtx->t() - simpv.at(is).t * simUnit_) / recopv.at(ir).recVtx->tError()); - meRecoPosInSimCollection_->Fill(recopv.at(ir).sim); - meRecoPosInRecoOrigCollection_->Fill(recopv.at(ir).OriginalIndex); + if (optionalPlots_) { + meRecoPosInSimCollection_->Fill(recopv.at(ir).sim); + meRecoPosInRecoOrigCollection_->Fill(recopv.at(ir).OriginalIndex); + } } if (simpv.at(is).eventId.bunchCrossing() == 0 && simpv.at(is).eventId.event() == 0) { if (!recopv.at(ir).is_signal()) { @@ -1397,16 +1397,23 @@ void Primary4DVertexValidation::analyze(const edm::Event& iEvent, const edm::Eve for (unsigned int jv = iv; jv < recVtxs->size(); jv++) { if ((!(jv == iv)) && select(recVtxs->at(jv))) { double dz = recVtxs->at(iv).z() - recVtxs->at(jv).z(); - double dt = (recVtxs->at(iv).t() - recVtxs->at(jv).t()) * c_; + double dtsigma = std::sqrt(recVtxs->at(iv).covariance(3, 3) + recVtxs->at(jv).covariance(3, 3)); + double dt = (std::abs(dz) <= deltaZcut_ && dtsigma > 0.) + ? (recVtxs->at(iv).t() - recVtxs->at(jv).t()) / dtsigma + : -9999.; if (recopv.at(iv).is_real() && recopv.at(jv).is_real()) { meDeltaZrealreal_->Fill(std::abs(dz)); - meDeltaZTrealreal_->Fill(std::sqrt(dz * dz + dt * dt)); + if (dt != -9999.) { + meDeltaTrealreal_->Fill(std::abs(dt)); + } if (std::abs(dz) < std::abs(mindistance_realreal)) { mindistance_realreal = dz; } } else if (recopv.at(iv).is_fake() && recopv.at(jv).is_fake()) { meDeltaZfakefake_->Fill(std::abs(dz)); - meDeltaZTfakefake_->Fill(std::sqrt(dz * dz + dt * dt)); + if (dt != -9999.) { + meDeltaTfakefake_->Fill(std::abs(dt)); + } } } } @@ -1416,10 +1423,15 @@ void Primary4DVertexValidation::analyze(const edm::Event& iEvent, const edm::Eve for (unsigned int jv = 0; jv < recVtxs->size(); jv++) { if ((!(jv == iv)) && select(recVtxs->at(jv))) { double dz = recVtxs->at(iv).z() - recVtxs->at(jv).z(); - double dt = (recVtxs->at(iv).t() - recVtxs->at(jv).t()) * c_; + double dtsigma = std::sqrt(recVtxs->at(iv).covariance(3, 3) + recVtxs->at(jv).covariance(3, 3)); + double dt = (std::abs(dz) <= deltaZcut_ && dtsigma > 0.) + ? (recVtxs->at(iv).t() - recVtxs->at(jv).t()) / dtsigma + : -9999.; if (recopv.at(iv).is_fake() && recopv.at(jv).is_real()) { meDeltaZfakereal_->Fill(std::abs(dz)); - meDeltaZTfakereal_->Fill(std::abs(dz * dz + dt * dt)); + if (dt != -9999.) { + meDeltaTfakereal_->Fill(std::abs(dt)); + } if (std::abs(dz) < std::abs(mindistance_fakereal)) { mindistance_fakereal = dz; } @@ -1469,4 +1481,25 @@ void Primary4DVertexValidation::fillDescriptions(edm::ConfigurationDescriptions& descriptions.add("vertices4D", desc); } +const bool Primary4DVertexValidation::mvaTPSel(const TrackingParticle& tp) { + bool match = false; + if (tp.status() != 1) { + return match; + } + match = tp.charge() != 0 && tp.pt() > pTcut_ && std::abs(tp.eta()) < etacutGEN_; + return match; +} + +const bool Primary4DVertexValidation::mvaRecSel(const reco::TrackBase& trk, + const reco::Vertex& vtx, + const double& t0, + const double& st0) { + bool match = false; + match = trk.pt() > pTcut_ && std::abs(trk.eta()) < etacutREC_ && std::abs(trk.vz() - vtx.z()) <= deltaZcut_; + if (st0 > 0.) { + match = match && std::abs(t0 - vtx.t()) < 3. * st0; + } + return match; +} + DEFINE_FWK_MODULE(Primary4DVertexValidation); diff --git a/Validation/MtdValidation/python/MtdPostProcessor_cff.py b/Validation/MtdValidation/python/MtdPostProcessor_cff.py index 5baa321ddbd52..71576fa18b3f6 100644 --- a/Validation/MtdValidation/python/MtdPostProcessor_cff.py +++ b/Validation/MtdValidation/python/MtdPostProcessor_cff.py @@ -2,5 +2,6 @@ from Validation.MtdValidation.btlSimHitsPostProcessor_cfi import btlSimHitsPostProcessor from Validation.MtdValidation.MtdTracksPostProcessor_cfi import MtdTracksPostProcessor +from Validation.MtdValidation.Primary4DVertexPostProcessor_cfi import Primary4DVertexPostProcessor -mtdValidationPostProcessor = cms.Sequence(btlSimHitsPostProcessor + MtdTracksPostProcessor) +mtdValidationPostProcessor = cms.Sequence(btlSimHitsPostProcessor + MtdTracksPostProcessor + Primary4DVertexPostProcessor)