From d48bc96a2fff41ff44136ee0cff14c82c8b2e3d5 Mon Sep 17 00:00:00 2001 From: Danilo Meuser Date: Mon, 30 May 2022 14:36:28 +0200 Subject: [PATCH 1/8] New CondFormat for HG PCL alignment --- CondCore/PCLConfigPlugins/src/plugin.cc | 3 + CondCore/Utilities/plugins/Module_2XML.cc | 1 + CondCore/Utilities/src/CondDBFetch.cc | 1 + CondCore/Utilities/src/CondDBImport.cc | 1 + CondCore/Utilities/src/CondFormats.h | 1 + .../interface/AlignPCLThresholdsHGRcd.h | 8 + .../DataRecord/src/AlignPCLThresholdsHGRcd.cc | 4 + .../PCLConfig/interface/AlignPCLThresholds.h | 2 +- .../interface/AlignPCLThresholdsHG.h | 47 + .../plugins/AlignPCLThresholdsReader.cc | 71 +- .../plugins/AlignPCLThresholdsWriter.cc | 97 +- .../PCLConfig/python/ThresholdsHG_cff.py | 962 ++++++++++++++++++ .../PCLConfig/src/AlignPCLThresholdsHG.cc | 122 +++ .../src/T_EventSetup_AlignPCLThresholdsHG.cc | 4 + CondFormats/PCLConfig/src/classes_def.xml | 1 + CondFormats/PCLConfig/src/headers.h | 1 + .../test/AlignPCLThresholdsReader_cfg.py | 36 +- .../test/AlignPCLThresholdsWriter_cfg.py | 9 +- 18 files changed, 1331 insertions(+), 40 deletions(-) create mode 100644 CondFormats/DataRecord/interface/AlignPCLThresholdsHGRcd.h create mode 100644 CondFormats/DataRecord/src/AlignPCLThresholdsHGRcd.cc create mode 100644 CondFormats/PCLConfig/interface/AlignPCLThresholdsHG.h create mode 100644 CondFormats/PCLConfig/python/ThresholdsHG_cff.py create mode 100644 CondFormats/PCLConfig/src/AlignPCLThresholdsHG.cc create mode 100644 CondFormats/PCLConfig/src/T_EventSetup_AlignPCLThresholdsHG.cc diff --git a/CondCore/PCLConfigPlugins/src/plugin.cc b/CondCore/PCLConfigPlugins/src/plugin.cc index b9ad38cad20c1..e98e68b914075 100644 --- a/CondCore/PCLConfigPlugins/src/plugin.cc +++ b/CondCore/PCLConfigPlugins/src/plugin.cc @@ -1,5 +1,8 @@ #include "CondCore/ESSources/interface/registration_macros.h" #include "CondFormats/PCLConfig/interface/AlignPCLThresholds.h" +#include "CondFormats/PCLConfig/interface/AlignPCLThresholdsHG.h" #include "CondFormats/DataRecord/interface/AlignPCLThresholdsRcd.h" +#include "CondFormats/DataRecord/interface/AlignPCLThresholdsHGRcd.h" REGISTER_PLUGIN(AlignPCLThresholdsRcd, AlignPCLThresholds); +REGISTER_PLUGIN(AlignPCLThresholdsHGRcd, AlignPCLThresholdsHG); diff --git a/CondCore/Utilities/plugins/Module_2XML.cc b/CondCore/Utilities/plugins/Module_2XML.cc index 34b02814b32b7..0e99a897e891b 100644 --- a/CondCore/Utilities/plugins/Module_2XML.cc +++ b/CondCore/Utilities/plugins/Module_2XML.cc @@ -5,6 +5,7 @@ PAYLOAD_2XML_MODULE(pluginUtilities_payload2xml) { m.def("boost_version_label", &cond::boost_version_label, "Get boost version for this release"); PAYLOAD_2XML_CLASS(AlCaRecoTriggerBits); PAYLOAD_2XML_CLASS(AlignPCLThresholds); + PAYLOAD_2XML_CLASS(AlignPCLThresholdsHG); PAYLOAD_2XML_CLASS(AlignmentErrors); PAYLOAD_2XML_CLASS(AlignmentErrorsExtended); PAYLOAD_2XML_CLASS(AlignmentSurfaceDeformations); diff --git a/CondCore/Utilities/src/CondDBFetch.cc b/CondCore/Utilities/src/CondDBFetch.cc index b7f2885ed9b2f..10b7e3a15436c 100644 --- a/CondCore/Utilities/src/CondDBFetch.cc +++ b/CondCore/Utilities/src/CondDBFetch.cc @@ -33,6 +33,7 @@ namespace cond { FETCH_PAYLOAD_CASE(AlignmentSurfaceDeformations) FETCH_PAYLOAD_CASE(Alignments) FETCH_PAYLOAD_CASE(AlignPCLThresholds) + FETCH_PAYLOAD_CASE(AlignPCLThresholdsHG) FETCH_PAYLOAD_CASE(BeamSpotObjects) FETCH_PAYLOAD_CASE(BeamSpotOnlineObjects) FETCH_PAYLOAD_CASE(CSCBadChambers) diff --git a/CondCore/Utilities/src/CondDBImport.cc b/CondCore/Utilities/src/CondDBImport.cc index 6f2e371abce4e..94262be2d9e61 100644 --- a/CondCore/Utilities/src/CondDBImport.cc +++ b/CondCore/Utilities/src/CondDBImport.cc @@ -53,6 +53,7 @@ namespace cond { IMPORT_PAYLOAD_CASE(AlignmentSurfaceDeformations) IMPORT_PAYLOAD_CASE(Alignments) IMPORT_PAYLOAD_CASE(AlignPCLThresholds) + IMPORT_PAYLOAD_CASE(AlignPCLThresholdsHG) IMPORT_PAYLOAD_CASE(BeamSpotObjects) IMPORT_PAYLOAD_CASE(BeamSpotOnlineObjects) IMPORT_PAYLOAD_CASE(CSCBadChambers) diff --git a/CondCore/Utilities/src/CondFormats.h b/CondCore/Utilities/src/CondFormats.h index 97afa8c3b3464..38e8e8273909f 100644 --- a/CondCore/Utilities/src/CondFormats.h +++ b/CondCore/Utilities/src/CondFormats.h @@ -279,6 +279,7 @@ #include "CondFormats/BTauObjects/interface/TrackProbabilityCalibration.h" #include "CondFormats/MFObjects/interface/MagFieldConfig.h" #include "CondFormats/PCLConfig/interface/AlignPCLThresholds.h" +#include "CondFormats/PCLConfig/interface/AlignPCLThresholdsHG.h" #include "CondFormats/SiPhase2TrackerObjects/interface/TrackerDetToDTCELinkCablingMap.h" #include "CondFormats/SiPhase2TrackerObjects/interface/SiPhase2OuterTrackerLorentzAngle.h" #include "CondFormats/SiPhase2TrackerObjects/interface/DTCELinkId.h" diff --git a/CondFormats/DataRecord/interface/AlignPCLThresholdsHGRcd.h b/CondFormats/DataRecord/interface/AlignPCLThresholdsHGRcd.h new file mode 100644 index 0000000000000..0e7761fdfca5e --- /dev/null +++ b/CondFormats/DataRecord/interface/AlignPCLThresholdsHGRcd.h @@ -0,0 +1,8 @@ +#ifndef AlignPCLThresholdsRcd_AlignPCLThresholdsHGRcd_h +#define AlignPCLThresholdsRcd_AlignPCLThresholdsHGRcd_h + +#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" + +class AlignPCLThresholdsHGRcd : public edm::eventsetup::EventSetupRecordImplementation {}; + +#endif diff --git a/CondFormats/DataRecord/src/AlignPCLThresholdsHGRcd.cc b/CondFormats/DataRecord/src/AlignPCLThresholdsHGRcd.cc new file mode 100644 index 0000000000000..78c8ab331baa1 --- /dev/null +++ b/CondFormats/DataRecord/src/AlignPCLThresholdsHGRcd.cc @@ -0,0 +1,4 @@ +#include "CondFormats/DataRecord/interface/AlignPCLThresholdsHGRcd.h" +#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" + +EVENTSETUP_RECORD_REG(AlignPCLThresholdsHGRcd); diff --git a/CondFormats/PCLConfig/interface/AlignPCLThresholds.h b/CondFormats/PCLConfig/interface/AlignPCLThresholds.h index 9ab1045f6e5d7..4912d8c03b85c 100644 --- a/CondFormats/PCLConfig/interface/AlignPCLThresholds.h +++ b/CondFormats/PCLConfig/interface/AlignPCLThresholds.h @@ -45,7 +45,7 @@ class AlignPCLThresholds { void printAll() const; -private: +protected: threshold_map m_thresholds; int m_nrecords; diff --git a/CondFormats/PCLConfig/interface/AlignPCLThresholdsHG.h b/CondFormats/PCLConfig/interface/AlignPCLThresholdsHG.h new file mode 100644 index 0000000000000..14924897f957e --- /dev/null +++ b/CondFormats/PCLConfig/interface/AlignPCLThresholdsHG.h @@ -0,0 +1,47 @@ +#ifndef CondFormats_PCLConfig_AlignPCLThresholdsHG_h +#define CondFormats_PCLConfig_AlignPCLThresholdsHG_h + +#include "CondFormats/PCLConfig/interface/AlignPCLThresholds.h" +#include "CondFormats/Serialization/interface/Serializable.h" + +#include +#include +#include + +class AlignPCLThresholdsHG : public AlignPCLThresholds { +public: + AlignPCLThresholdsHG() {} + + enum FloatParamIndex { + FRACTION_CUT_X = 0, + FRACTION_CUT_Y = 1, + FRACTION_CUT_Z = 2, + FRACTION_CUT_TX = 3, + FRACTION_CUT_TY = 4, + FRACTION_CUT_TZ = 5, + FSIZE = 6 + }; + + void SetFractionCut(const std::string &AlignableId, const coordType &type, const float &cut); + + const std::unordered_map> &getFloatMap() const { return floatMap; } + const std::vector &getFloatVec(const std::string &AlignableId) const; + + float getFractionCut(const std::string &AlignableId, const coordType &type) const; + std::array getFractionCut(const std::string &AlignableId) const; + + int payloadVersion() const; + + void printAllHG() const; + + ~AlignPCLThresholdsHG() override {} + +private: + std::unordered_map> floatMap; + std::unordered_map> intMap; + std::unordered_map> stringMap; + + COND_SERIALIZABLE; +}; + +#endif diff --git a/CondFormats/PCLConfig/plugins/AlignPCLThresholdsReader.cc b/CondFormats/PCLConfig/plugins/AlignPCLThresholdsReader.cc index e899bf6fa4c1c..ff634cd00c4ce 100644 --- a/CondFormats/PCLConfig/plugins/AlignPCLThresholdsReader.cc +++ b/CondFormats/PCLConfig/plugins/AlignPCLThresholdsReader.cc @@ -6,9 +6,13 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "CondFormats/PCLConfig/interface/AlignPCLThresholds.h" +#include "CondFormats/PCLConfig/interface/AlignPCLThresholdsHG.h" #include "CondFormats/DataRecord/interface/AlignPCLThresholdsRcd.h" +#include "CondFormats/DataRecord/interface/AlignPCLThresholdsHGRcd.h" +#include "HLTrigger/HLTcore/interface/defaultModuleLabel.h" namespace edmtest { + template class AlignPCLThresholdsReader : public edm::one::EDAnalyzer<> { public: explicit AlignPCLThresholdsReader(edm::ParameterSet const& p); @@ -20,38 +24,42 @@ namespace edmtest { void analyze(const edm::Event& e, const edm::EventSetup& c) override; // ----------member data --------------------------- - const edm::ESGetToken thresholdToken_; + const edm::ESGetToken thresholdToken_; const bool printdebug_; const std::string formatedOutput_; }; - AlignPCLThresholdsReader::AlignPCLThresholdsReader(edm::ParameterSet const& p) + template + AlignPCLThresholdsReader::AlignPCLThresholdsReader(edm::ParameterSet const& p) : thresholdToken_(esConsumes()), printdebug_(p.getUntrackedParameter("printDebug", true)), formatedOutput_(p.getUntrackedParameter("outputFile", "")) { edm::LogInfo("AlignPCLThresholdsReader") << "AlignPCLThresholdsReader" << std::endl; } - AlignPCLThresholdsReader::~AlignPCLThresholdsReader() { + template + AlignPCLThresholdsReader::~AlignPCLThresholdsReader() { edm::LogInfo("AlignPCLThresholdsReader") << "~AlignPCLThresholdsReader " << std::endl; } - void AlignPCLThresholdsReader::analyze(const edm::Event& e, const edm::EventSetup& context) { + template + void AlignPCLThresholdsReader::analyze(const edm::Event& e, const edm::EventSetup& context) { edm::LogInfo("AlignPCLThresholdsReader") << "### AlignPCLThresholdsReader::analyze ###" << std::endl; edm::LogInfo("AlignPCLThresholdsReader") << " I AM IN RUN NUMBER " << e.id().run() << std::endl; edm::LogInfo("AlignPCLThresholdsReader") << " ---EVENT NUMBER " << e.id().event() << std::endl; + edm::eventsetup::EventSetupRecordKey inputKey = edm::eventsetup::EventSetupRecordKey::makeKey(); edm::eventsetup::EventSetupRecordKey recordKey( - edm::eventsetup::EventSetupRecordKey::TypeTag::findType("AlignPCLThresholdsRcd")); + edm::eventsetup::EventSetupRecordKey::TypeTag::findType(inputKey.type().name())); if (recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) { //record not found - edm::LogInfo("AlignPCLThresholdsReader") << "Record \"AlignPCLThresholdsRcd" - << "\" does not exist " << std::endl; + edm::LogInfo("AlignPCLThresholdsReader") + << "Record \"" << inputKey.type().name() << "\" does not exist " << std::endl; } //this part gets the handle of the event source and the record (i.e. the Database) - edm::ESHandle thresholdHandle = context.getHandle(thresholdToken_); + edm::ESHandle thresholdHandle = context.getHandle(thresholdToken_); edm::LogInfo("AlignPCLThresholdsReader") << "got eshandle" << std::endl; if (!thresholdHandle.isValid()) { @@ -59,7 +67,7 @@ namespace edmtest { return; } - const AlignPCLThresholds* thresholds = thresholdHandle.product(); + const T* thresholds = thresholdHandle.product(); edm::LogInfo("AlignPCLThresholdsReader") << "got AlignPCLThresholds* " << std::endl; edm::LogInfo("AlignPCLThresholdsReader") << "print pointer address : "; edm::LogInfo("AlignPCLThresholdsReader") << thresholds << std::endl; @@ -69,6 +77,10 @@ namespace edmtest { // use built-in method in the CondFormat to print the content if (printdebug_) { thresholds->printAll(); + // print additional thresholds if HG payload is used + if constexpr (std::is_same_v) { + thresholds->printAllHG(); + } } FILE* pFile = nullptr; @@ -132,16 +144,51 @@ namespace edmtest { } } } + + // print additional thresholds for HG payload + if constexpr (std::is_same_v) { + fprintf(pFile, "AlignPCLThresholdsHG::printAllHG() \n"); + fprintf(pFile, " ======================================= \n"); + const std::unordered_map>& floatMap = thresholds->getFloatMap(); + for (auto it = floatMap.begin(); it != floatMap.end(); ++it) { + fprintf(pFile, " ======================================= \n"); + + fprintf(pFile, "key : %s \n", (it->first).c_str()); + fprintf(pFile, + "- X_fractionCut : %8.3f \n", + thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::X)); + fprintf(pFile, + "- thetaX_fractionCut : %8.3f \n", + thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::theta_X)); + fprintf(pFile, + "- Y_fractionCut : %8.3f \n", + thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::Y)); + fprintf(pFile, + "- thetaY_fractionCut : %8.3f \n", + thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::theta_Y)); + fprintf(pFile, + "- Z_fractionCut : %8.3f \n", + thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::Z)); + fprintf(pFile, + "- thetaZ_fractionCut : %8.3f \n", + thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::theta_Z)); + } + } } } - void AlignPCLThresholdsReader::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + template + void AlignPCLThresholdsReader::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.setComment("Reads payloads of type AlignPCLThresholds"); desc.addUntracked("printDebug", true); desc.addUntracked("outputFile", ""); - descriptions.add("AlignPCLThresholdsReader", desc); + descriptions.add(defaultModuleLabel>(), desc); } - DEFINE_FWK_MODULE(AlignPCLThresholdsReader); + typedef AlignPCLThresholdsReader AlignPCLThresholdsLGReader; + typedef AlignPCLThresholdsReader AlignPCLThresholdsHGReader; + + DEFINE_FWK_MODULE(AlignPCLThresholdsLGReader); + DEFINE_FWK_MODULE(AlignPCLThresholdsHGReader); } // namespace edmtest diff --git a/CondFormats/PCLConfig/plugins/AlignPCLThresholdsWriter.cc b/CondFormats/PCLConfig/plugins/AlignPCLThresholdsWriter.cc index a42461bc85a20..34a4d881f8345 100644 --- a/CondFormats/PCLConfig/plugins/AlignPCLThresholdsWriter.cc +++ b/CondFormats/PCLConfig/plugins/AlignPCLThresholdsWriter.cc @@ -26,6 +26,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "CondFormats/PCLConfig/interface/AlignPCLThresholds.h" +#include "CondFormats/PCLConfig/interface/AlignPCLThresholdsHG.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" @@ -48,6 +49,10 @@ class AlignPCLThresholdsWriter : public edm::one::EDAnalyzer<> { void analyze(const edm::Event&, const edm::EventSetup&) override; DOFs::dof mapOntoEnum(std::string coord); + template + void writePayload(T& myThresholds); + void storeHGthresholds(AlignPCLThresholdsHG& myThresholds, const std::vector& alignables); + // ----------member data --------------------------- const std::string m_record; const unsigned int m_minNrecords; @@ -68,10 +73,47 @@ AlignPCLThresholdsWriter::AlignPCLThresholdsWriter(const edm::ParameterSet& iCon // ------------ method called for each event ------------ void AlignPCLThresholdsWriter::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - using namespace edm; + // detect if new payload is used + bool newClass = false; + for (auto& thePSet : m_parameters) { + if (thePSet.exists("fractionCut")) { + newClass = true; + break; + } + } - // output object - AlignPCLThresholds myThresholds{}; + // use templated method depending on new/old payload + if (newClass) { + AlignPCLThresholdsHG myThresholds{}; + writePayload(myThresholds); + } else { + AlignPCLThresholds myThresholds{}; + writePayload(myThresholds); + } +} + +DOFs::dof AlignPCLThresholdsWriter::mapOntoEnum(std::string coord) { + if (coord == "X") { + return DOFs::X; + } else if (coord == "Y") { + return DOFs::Y; + } else if (coord == "Z") { + return DOFs::Z; + } else if (coord == "thetaX") { + return DOFs::thetaX; + } else if (coord == "thetaY") { + return DOFs::thetaY; + } else if (coord == "thetaZ") { + return DOFs::thetaZ; + } else { + return DOFs::extraDOF; + } +} + +// ------------ templated method to write the payload ------------ +template +void AlignPCLThresholdsWriter::writePayload(T& myThresholds) { + using namespace edm; edm::LogInfo("AlignPCLThresholdsWriter") << "Size of AlignPCLThresholds object " << myThresholds.size() << std::endl; @@ -167,6 +209,11 @@ void AlignPCLThresholdsWriter::analyze(const edm::Event& iEvent, const edm::Even // use buil-in method in the CondFormat myThresholds.printAll(); + // additional thresholds for AlignPCLThresholdsHG + if constexpr (std::is_same_v) { + storeHGthresholds(myThresholds, alignables); + } + // Form the data here edm::Service poolDbService; if (poolDbService.isAvailable()) { @@ -176,22 +223,34 @@ void AlignPCLThresholdsWriter::analyze(const edm::Event& iEvent, const edm::Even } } -DOFs::dof AlignPCLThresholdsWriter::mapOntoEnum(std::string coord) { - if (coord == "X") { - return DOFs::X; - } else if (coord == "Y") { - return DOFs::Y; - } else if (coord == "Z") { - return DOFs::Z; - } else if (coord == "thetaX") { - return DOFs::thetaX; - } else if (coord == "thetaY") { - return DOFs::thetaY; - } else if (coord == "thetaZ") { - return DOFs::thetaZ; - } else { - return DOFs::extraDOF; +// ------------ method to store additional HG thresholds ------------ +void AlignPCLThresholdsWriter::storeHGthresholds(AlignPCLThresholdsHG& myThresholds, + const std::vector& alignables) { + edm::LogInfo("AlignPCLThresholdsWriter") + << "Found type AlignPCLThresholdsHG, additional thresholds are written" << std::endl; + + for (auto& alignable : alignables) { + for (auto& thePSet : m_parameters) { + const std::string alignableId(thePSet.getParameter("alignableId")); + const std::string DOF(thePSet.getParameter("DOF")); + + // Get coordType from DOF + AlignPCLThresholds::coordType type = static_cast(mapOntoEnum(DOF)); + + if (alignableId == alignable) { + if (thePSet.exists("fractionCut")) { + const double fractionCut(thePSet.getParameter("fractionCut")); + myThresholds.SetFractionCut(alignableId, type, fractionCut); + } else { + myThresholds.SetFractionCut(alignableId, type, -1.); // better way to define default fraction cut?? + } + } + } } + + // print additional tresholds + edm::LogInfo("AlignPCLThresholdsWriter") << "Additonal content of AlignPCLThresholdsHG " << std::endl; + myThresholds.printAllHG(); } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ @@ -208,6 +267,8 @@ void AlignPCLThresholdsWriter::fillDescriptions(edm::ConfigurationDescriptions& desc_thresholds.add("sigCut"); desc_thresholds.add("maxMoveCut"); desc_thresholds.add("maxErrorCut"); + // optional thresholds from new payload version + desc_thresholds.addOptional("fractionCut"); std::vector default_thresholds(1); desc.addVPSet("thresholds", desc_thresholds, default_thresholds); diff --git a/CondFormats/PCLConfig/python/ThresholdsHG_cff.py b/CondFormats/PCLConfig/python/ThresholdsHG_cff.py new file mode 100644 index 0000000000000..cde469be6c1ed --- /dev/null +++ b/CondFormats/PCLConfig/python/ThresholdsHG_cff.py @@ -0,0 +1,962 @@ +import FWCore.ParameterSet.Config as cms +import copy + +# ----------------------------------------------------------------------- +# Default configuration + +default = cms.VPSet( + #### Barrel Pixel HB X- + cms.PSet(alignableId = cms.string("TPBHalfBarrelXminus"), + DOF = cms.string("X"), + cut = cms.double(5.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPBHalfBarrelXminus"), + DOF = cms.string("thetaX"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPBHalfBarrelXminus"), + DOF = cms.string("Y"), + cut = cms.double(10.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPBHalfBarrelXminus"), + DOF = cms.string("thetaY"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPBHalfBarrelXminus"), + DOF = cms.string("Z"), + cut = cms.double(15.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPBHalfBarrelXminus"), + DOF = cms.string("thetaZ"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + ### Barrel Pixel HB X+ + cms.PSet(alignableId = cms.string("TPBHalfBarrelXplus"), + DOF = cms.string("X"), + cut = cms.double(5.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPBHalfBarrelXplus"), + DOF = cms.string("thetaX"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0), + ), + + cms.PSet(alignableId = cms.string("TPBHalfBarrelXplus"), + DOF = cms.string("Y"), + cut = cms.double(10.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPBHalfBarrelXplus"), + DOF = cms.string("thetaY"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPBHalfBarrelXplus"), + DOF = cms.string("Z"), + cut = cms.double(15.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPBHalfBarrelXplus"), + DOF = cms.string("thetaZ"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + ### Forward Pixel HC X-,Z- + cms.PSet(alignableId = cms.string("TPEHalfCylinderXminusZminus"), + DOF = cms.string("X"), + cut = cms.double(5.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPEHalfCylinderXminusZminus"), + DOF = cms.string("thetaX"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPEHalfCylinderXminusZminus"), + DOF = cms.string("Y"), + cut = cms.double(10.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPEHalfCylinderXminusZminus"), + DOF = cms.string("thetaY"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPEHalfCylinderXminusZminus"), + DOF = cms.string("Z"), + cut = cms.double(15.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPEHalfCylinderXminusZminus"), + DOF = cms.string("thetaZ"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + ### Forward Pixel HC X+,Z- + cms.PSet(alignableId = cms.string("TPEHalfCylinderXplusZminus"), + DOF = cms.string("X"), + cut = cms.double(5.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPEHalfCylinderXplusZminus"), + DOF = cms.string("thetaX"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPEHalfCylinderXplusZminus"), + DOF = cms.string("Y"), + cut = cms.double(10.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPEHalfCylinderXplusZminus"), + DOF = cms.string("thetaY"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPEHalfCylinderXplusZminus"), + DOF = cms.string("Z"), + cut = cms.double(15.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPEHalfCylinderXplusZminus"), + DOF = cms.string("thetaZ"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + ### Forward Pixel HC X-,Z+ + cms.PSet(alignableId = cms.string("TPEHalfCylinderXminusZplus"), + DOF = cms.string("X"), + cut = cms.double(5.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPEHalfCylinderXminusZplus"), + DOF = cms.string("thetaX"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPEHalfCylinderXminusZplus"), + DOF = cms.string("Y"), + cut = cms.double(10.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPEHalfCylinderXminusZplus"), + DOF = cms.string("thetaY"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPEHalfCylinderXminusZplus"), + DOF = cms.string("Z"), + cut = cms.double(15.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPEHalfCylinderXminusZplus"), + DOF = cms.string("thetaZ"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + ### Forward Pixel HC X+,Z+ + cms.PSet(alignableId = cms.string("TPEHalfCylinderXplusZplus"), + DOF = cms.string("X"), + cut = cms.double(5.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPEHalfCylinderXplusZplus"), + DOF = cms.string("thetaX"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPEHalfCylinderXplusZplus"), + DOF = cms.string("Y"), + cut = cms.double(10.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPEHalfCylinderXplusZplus"), + DOF = cms.string("thetaY"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPEHalfCylinderXplusZplus"), + DOF = cms.string("Z"), + cut = cms.double(15.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + cms.PSet(alignableId = cms.string("TPEHalfCylinderXplusZplus"), + DOF = cms.string("thetaZ"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + maxMoveCut = cms.double(200.0), + maxErrorCut = cms.double(10.0) + ), + + ### Barrel Pixel Ladder + cms.PSet(alignableId = cms.string("TPBLadder"), + DOF = cms.string("X"), + cut = cms.double(5.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadder"), + DOF = cms.string("thetaX"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadder"), + DOF = cms.string("Y"), + cut = cms.double(10.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadder"), + DOF = cms.string("thetaY"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadder"), + DOF = cms.string("Z"), + cut = cms.double(15.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadder"), + DOF = cms.string("thetaZ"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + ### EndCap Pixel Panel + cms.PSet(alignableId = cms.string("TPEPanel"), + DOF = cms.string("X"), + cut = cms.double(5.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanel"), + DOF = cms.string("thetaX"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanel"), + DOF = cms.string("Y"), + cut = cms.double(10.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanel"), + DOF = cms.string("thetaY"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanel"), + DOF = cms.string("Z"), + cut = cms.double(15.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanel"), + DOF = cms.string("thetaZ"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + ### Barrel Pixel Ladder Layer 1 + cms.PSet(alignableId = cms.string("TPBLadderLayer1"), + DOF = cms.string("X"), + cut = cms.double(5.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadderLayer1"), + DOF = cms.string("thetaX"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadderLayer1"), + DOF = cms.string("Y"), + cut = cms.double(10.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadderLayer1"), + DOF = cms.string("thetaY"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadderLayer1"), + DOF = cms.string("Z"), + cut = cms.double(15.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadderLayer1"), + DOF = cms.string("thetaZ"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + ### Barrel Pixel Ladder Layer 2 + cms.PSet(alignableId = cms.string("TPBLadderLayer2"), + DOF = cms.string("X"), + cut = cms.double(5.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadderLayer2"), + DOF = cms.string("thetaX"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadderLayer2"), + DOF = cms.string("Y"), + cut = cms.double(10.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadderLayer2"), + DOF = cms.string("thetaY"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadderLayer2"), + DOF = cms.string("Z"), + cut = cms.double(15.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadderLayer2"), + DOF = cms.string("thetaZ"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + ### Barrel Pixel Ladder Layer 3 + cms.PSet(alignableId = cms.string("TPBLadderLayer3"), + DOF = cms.string("X"), + cut = cms.double(5.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadderLayer3"), + DOF = cms.string("thetaX"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadderLayer3"), + DOF = cms.string("Y"), + cut = cms.double(10.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadderLayer3"), + DOF = cms.string("thetaY"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadderLayer3"), + DOF = cms.string("Z"), + cut = cms.double(15.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadderLayer3"), + DOF = cms.string("thetaZ"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + ### Barrel Pixel Ladder Layer 4 + cms.PSet(alignableId = cms.string("TPBLadderLayer4"), + DOF = cms.string("X"), + cut = cms.double(5.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadderLayer4"), + DOF = cms.string("thetaX"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadderLayer4"), + DOF = cms.string("Y"), + cut = cms.double(10.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadderLayer4"), + DOF = cms.string("thetaY"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadderLayer4"), + DOF = cms.string("Z"), + cut = cms.double(15.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPBLadderLayer4"), + DOF = cms.string("thetaZ"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + ### EndCap Pixel Panel Disk1 + cms.PSet(alignableId = cms.string("TPEPanelDisk1"), + DOF = cms.string("X"), + cut = cms.double(5.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDisk1"), + DOF = cms.string("thetaX"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDisk1"), + DOF = cms.string("Y"), + cut = cms.double(10.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDisk1"), + DOF = cms.string("thetaY"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDisk1"), + DOF = cms.string("Z"), + cut = cms.double(15.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDisk1"), + DOF = cms.string("thetaZ"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + ### EndCap Pixel Panel Disk2 + cms.PSet(alignableId = cms.string("TPEPanelDisk2"), + DOF = cms.string("X"), + cut = cms.double(5.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDisk2"), + DOF = cms.string("thetaX"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDisk2"), + DOF = cms.string("Y"), + cut = cms.double(10.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDisk2"), + DOF = cms.string("thetaY"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDisk2"), + DOF = cms.string("Z"), + cut = cms.double(15.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDisk2"), + DOF = cms.string("thetaZ"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + ### EndCap Pixel Panel Disk3 + cms.PSet(alignableId = cms.string("TPEPanelDisk3"), + DOF = cms.string("X"), + cut = cms.double(5.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDisk3"), + DOF = cms.string("thetaX"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDisk3"), + DOF = cms.string("Y"), + cut = cms.double(10.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDisk3"), + DOF = cms.string("thetaY"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDisk3"), + DOF = cms.string("Z"), + cut = cms.double(15.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDisk3"), + DOF = cms.string("thetaZ"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + ### EndCap Pixel Panel DiskM1 + cms.PSet(alignableId = cms.string("TPEPanelDiskM1"), + DOF = cms.string("X"), + cut = cms.double(5.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDiskM1"), + DOF = cms.string("thetaX"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDiskM1"), + DOF = cms.string("Y"), + cut = cms.double(10.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDiskM1"), + DOF = cms.string("thetaY"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDiskM1"), + DOF = cms.string("Z"), + cut = cms.double(15.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDiskM1"), + DOF = cms.string("thetaZ"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + ### EndCap Pixel Panel DiskM2 + cms.PSet(alignableId = cms.string("TPEPanelDiskM2"), + DOF = cms.string("X"), + cut = cms.double(5.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDiskM2"), + DOF = cms.string("thetaX"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDiskM2"), + DOF = cms.string("Y"), + cut = cms.double(10.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDiskM2"), + DOF = cms.string("thetaY"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDiskM2"), + DOF = cms.string("Z"), + cut = cms.double(15.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDiskM2"), + DOF = cms.string("thetaZ"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + ### EndCap Pixel Panel DiskM3 + cms.PSet(alignableId = cms.string("TPEPanelDiskM3"), + DOF = cms.string("X"), + cut = cms.double(5.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDiskM3"), + DOF = cms.string("thetaX"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDiskM3"), + DOF = cms.string("Y"), + cut = cms.double(10.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDiskM3"), + DOF = cms.string("thetaY"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDiskM3"), + DOF = cms.string("Z"), + cut = cms.double(15.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ), + + cms.PSet(alignableId = cms.string("TPEPanelDiskM3"), + DOF = cms.string("thetaZ"), + cut = cms.double(30.0), + sigCut = cms.double(2.5), + fractionCut = cms.double(0.25), + maxMoveCut = cms.double(100000.0), + maxErrorCut = cms.double(10000.0) + ) + ) + diff --git a/CondFormats/PCLConfig/src/AlignPCLThresholdsHG.cc b/CondFormats/PCLConfig/src/AlignPCLThresholdsHG.cc new file mode 100644 index 0000000000000..470adafc69a58 --- /dev/null +++ b/CondFormats/PCLConfig/src/AlignPCLThresholdsHG.cc @@ -0,0 +1,122 @@ +#include "CondFormats/PCLConfig/interface/AlignPCLThresholdsHG.h" +#include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include +#include // std::setw + +namespace AlignPCLThresholdsHGImpl { + template + const T &getParam(const std::vector ¶ms, size_t index) { + if (index >= params.size()) + throw std::out_of_range("Parameter with index " + std::to_string(index) + " is out of range."); + return params[index]; + } + + template + void setParam(std::vector ¶ms, size_t index, const T &value) { + if (index >= params.size()) + throw std::out_of_range("Parameter with index " + std::to_string(index) + " is out of range."); + params[index] = value; + } + +} //namespace AlignPCLThresholdsHGImpl + +const std::vector &AlignPCLThresholdsHG::getFloatVec(const std::string &AlignableId) const { + std::unordered_map>::const_iterator it = floatMap.find(AlignableId); + + if (it != floatMap.end()) { + return it->second; + } else { + throw cms::Exception("AlignPCLThresholdsHG") << "No float vector defined for Alignable id " << AlignableId << "\n"; + } +} + +void AlignPCLThresholdsHG::SetFractionCut(const std::string &AlignableId, const coordType &type, const float &cut) { + // Set entry in map if not yet available + std::unordered_map>::const_iterator it = floatMap.find(AlignableId); + if (it == floatMap.end()) + floatMap[AlignableId] = std::vector(FSIZE, 0.); + + switch (type) { + case X: + return AlignPCLThresholdsHGImpl::setParam(floatMap[AlignableId], FRACTION_CUT_X, cut); + case Y: + return AlignPCLThresholdsHGImpl::setParam(floatMap[AlignableId], FRACTION_CUT_Y, cut); + case Z: + return AlignPCLThresholdsHGImpl::setParam(floatMap[AlignableId], FRACTION_CUT_Z, cut); + case theta_X: + return AlignPCLThresholdsHGImpl::setParam(floatMap[AlignableId], FRACTION_CUT_TX, cut); + case theta_Y: + return AlignPCLThresholdsHGImpl::setParam(floatMap[AlignableId], FRACTION_CUT_TY, cut); + case theta_Z: + return AlignPCLThresholdsHGImpl::setParam(floatMap[AlignableId], FRACTION_CUT_TZ, cut); + default: + throw cms::Exception("AlignPCLThresholdsHG") + << "Requested setting fraction threshold for undefined coordinate" << type << "\n"; + } +} + +std::array AlignPCLThresholdsHG::getFractionCut(const std::string &AlignableId) const { + const std::vector vec = getFloatVec(AlignableId); + return {{AlignPCLThresholdsHGImpl::getParam(vec, FRACTION_CUT_X), + AlignPCLThresholdsHGImpl::getParam(vec, FRACTION_CUT_Y), + AlignPCLThresholdsHGImpl::getParam(vec, FRACTION_CUT_Z), + AlignPCLThresholdsHGImpl::getParam(vec, FRACTION_CUT_TX), + AlignPCLThresholdsHGImpl::getParam(vec, FRACTION_CUT_TY), + AlignPCLThresholdsHGImpl::getParam(vec, FRACTION_CUT_TZ)}}; +} + +float AlignPCLThresholdsHG::getFractionCut(const std::string &AlignableId, const coordType &type) const { + const std::vector vec = getFloatVec(AlignableId); + switch (type) { + case X: + return AlignPCLThresholdsHGImpl::getParam(vec, FRACTION_CUT_X); + case Y: + return AlignPCLThresholdsHGImpl::getParam(vec, FRACTION_CUT_Y); + case Z: + return AlignPCLThresholdsHGImpl::getParam(vec, FRACTION_CUT_Z); + case theta_X: + return AlignPCLThresholdsHGImpl::getParam(vec, FRACTION_CUT_TX); + case theta_Y: + return AlignPCLThresholdsHGImpl::getParam(vec, FRACTION_CUT_TY); + case theta_Z: + return AlignPCLThresholdsHGImpl::getParam(vec, FRACTION_CUT_TZ); + default: + throw cms::Exception("AlignPCLThresholdsHG") + << "Requested fraction threshold for undefined coordinate" << type << "\n"; + } +} + +int AlignPCLThresholdsHG::payloadVersion() const { + switch (FSIZE) { + case 6: + return 1; + default: + throw cms::Exception("AlignPCLThresholdsHG") + << "Payload version with FSIZE equal to " << FSIZE << " is not defined.\n"; + } +} + +void AlignPCLThresholdsHG::printAllHG() const { + edm::LogVerbatim("AlignPCLThresholdsHG") << "AlignPCLThresholdsHG::printAllHG()"; + edm::LogVerbatim("AlignPCLThresholdsHG") << " =================================="; + for (auto it = floatMap.begin(); it != floatMap.end(); ++it) { + edm::LogVerbatim("AlignPCLThresholdsHG") << " =================================="; + edm::LogVerbatim("AlignPCLThresholdsHG") + << "key : " << it->first << " \n" + << "- X_fractionCut : " << std::setw(4) << getFractionCut(it->first, X) << std::setw(5) << "\n" + + << "- thetaX_fractionCut : " << std::setw(4) << getFractionCut(it->first, theta_X) << std::setw(5) + << "\n" + + << "- Y_fractionCut : " << std::setw(4) << getFractionCut(it->first, Y) << std::setw(5) << "\n" + + << "- thetaY_fractionCut : " << std::setw(4) << getFractionCut(it->first, theta_Y) << std::setw(5) + << "\n" + + << "- Z_fractionCut : " << std::setw(4) << getFractionCut(it->first, Z) << std::setw(5) << "\n" + + << "- thetaZ_fractionCut : " << std::setw(4) << getFractionCut(it->first, theta_Z) << std::setw(5); + } +} diff --git a/CondFormats/PCLConfig/src/T_EventSetup_AlignPCLThresholdsHG.cc b/CondFormats/PCLConfig/src/T_EventSetup_AlignPCLThresholdsHG.cc new file mode 100644 index 0000000000000..e1bc185fa8452 --- /dev/null +++ b/CondFormats/PCLConfig/src/T_EventSetup_AlignPCLThresholdsHG.cc @@ -0,0 +1,4 @@ +#include "CondFormats/PCLConfig/interface/AlignPCLThresholdsHG.h" +#include "FWCore/Utilities/interface/typelookup.h" + +TYPELOOKUP_DATA_REG(AlignPCLThresholdsHG); diff --git a/CondFormats/PCLConfig/src/classes_def.xml b/CondFormats/PCLConfig/src/classes_def.xml index 39195a5fe5e08..4dd83f55fa9ac 100644 --- a/CondFormats/PCLConfig/src/classes_def.xml +++ b/CondFormats/PCLConfig/src/classes_def.xml @@ -4,4 +4,5 @@ + diff --git a/CondFormats/PCLConfig/src/headers.h b/CondFormats/PCLConfig/src/headers.h index facace9aa2dc9..dc0933c2705b8 100644 --- a/CondFormats/PCLConfig/src/headers.h +++ b/CondFormats/PCLConfig/src/headers.h @@ -1 +1,2 @@ #include "CondFormats/PCLConfig/interface/AlignPCLThresholds.h" +#include "CondFormats/PCLConfig/interface/AlignPCLThresholdsHG.h" diff --git a/CondFormats/PCLConfig/test/AlignPCLThresholdsReader_cfg.py b/CondFormats/PCLConfig/test/AlignPCLThresholdsReader_cfg.py index 324bf01a43adf..7fc3b03e42c12 100644 --- a/CondFormats/PCLConfig/test/AlignPCLThresholdsReader_cfg.py +++ b/CondFormats/PCLConfig/test/AlignPCLThresholdsReader_cfg.py @@ -18,9 +18,34 @@ reportEvery = cms.untracked.int32(1000) ), AlignPCLThresholdsReader = cms.untracked.PSet( limit = cms.untracked.int32(-1)), - AlignPCLThresholds = cms.untracked.PSet( limit = cms.untracked.int32(-1)) + AlignPCLThresholds = cms.untracked.PSet( limit = cms.untracked.int32(-1)), + AlignPCLThresholdsHG = cms.untracked.PSet( limit = cms.untracked.int32(-1)) ) +## +## Var Parsing +## +import FWCore.ParameterSet.VarParsing as VarParsing +options = VarParsing.VarParsing() +options.register('readLGpayload', + False, + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.bool, + "Read old payload type used for LG thresholds") +options.parseArguments() + +## +## Define record, class and module based on option +## +rcdName = "AlignPCLThresholdsHGRcd" +className = "AlignPCLThresholdsHG" +moduleName = "AlignPCLThresholdsHGReader" + +if options.readLGpayload: + rcdName = "AlignPCLThresholdsRcd" + className = "AlignPCLThresholds" + moduleName = "AlignPCLThresholdsLGReader" + ## ## Empty Source ## @@ -38,7 +63,7 @@ process.dbInput = cms.ESSource("PoolDBESSource", CondDBThresholds, - toGet = cms.VPSet(cms.PSet(record = cms.string('AlignPCLThresholdsRcd'), + toGet = cms.VPSet(cms.PSet(record = cms.string(rcdName), tag = cms.string('PCLThresholds_express_v0') # choose tag you want ) ) @@ -47,16 +72,17 @@ ## Retrieve it and check it's available in the ES ## process.get = cms.EDAnalyzer("EventSetupRecordDataGetter", - toGet = cms.VPSet(cms.PSet(record = cms.string('AlignPCLThresholdsRcd'), - data = cms.vstring('AlignPCLThresholds') + toGet = cms.VPSet(cms.PSet(record = cms.string(rcdName), + data = cms.vstring(className) ) ), verbose = cms.untracked.bool(True) ) + ## ## Read it back ## -process.ReadDB = cms.EDAnalyzer("AlignPCLThresholdsReader") +process.ReadDB = cms.EDAnalyzer(moduleName) process.ReadDB.printDebug = cms.untracked.bool(True) process.ReadDB.outputFile = cms.untracked.string('AlignPCLThresholds.log') diff --git a/CondFormats/PCLConfig/test/AlignPCLThresholdsWriter_cfg.py b/CondFormats/PCLConfig/test/AlignPCLThresholdsWriter_cfg.py index ed0d445d651b6..a8c491696cee0 100644 --- a/CondFormats/PCLConfig/test/AlignPCLThresholdsWriter_cfg.py +++ b/CondFormats/PCLConfig/test/AlignPCLThresholdsWriter_cfg.py @@ -19,7 +19,8 @@ reportEvery = cms.untracked.int32(1000) ), AlignPCLThresholdsWriter = cms.untracked.PSet( limit = cms.untracked.int32(-1)), - AlignPCLThresholds = cms.untracked.PSet( limit = cms.untracked.int32(-1)) + AlignPCLThresholds = cms.untracked.PSet( limit = cms.untracked.int32(-1)), + AlignPCLThresholdsHG = cms.untracked.PSet( limit = cms.untracked.int32(-1)) ) ## @@ -43,7 +44,7 @@ process.PoolDBOutputService = cms.Service("PoolDBOutputService", process.CondDB, timetype = cms.untracked.string('runnumber'), - toPut = cms.VPSet(cms.PSet(record = cms.string('AlignPCLThresholdsRcd'), + toPut = cms.VPSet(cms.PSet(record = cms.string('FooRcd'), tag = cms.string('PCLThresholds_express_v0') ) ) @@ -52,7 +53,7 @@ ## ## Impot the thresholds configuration ## -import CondFormats.PCLConfig.Thresholds_cff as Thresholds +import CondFormats.PCLConfig.ThresholdsHG_cff as Thresholds ## ## Example on how to add to the default extra degrees of freedom @@ -72,7 +73,7 @@ #print DefaultPlusSurface.dumpPython() process.WriteInDB = cms.EDAnalyzer("AlignPCLThresholdsWriter", - record= cms.string('AlignPCLThresholdsRcd'), + record= cms.string('FooRcd'), ### minimum number of records found in pede output minNRecords = cms.uint32(25000), #thresholds = cms.VPSet() # empty object From 7b27cad30bbdf7ec9411301dde67543a6d6bd63e Mon Sep 17 00:00:00 2001 From: mmusich Date: Mon, 6 Jun 2022 19:10:55 +0200 Subject: [PATCH 2/8] miscellaneous improvements in CondFormats/PCLConfig/ plugins --- .../plugins/AlignPCLThresholdsWriter.cc | 52 ++++++++++++------- .../test/AlignPCLThresholdsReader_cfg.py | 11 ++-- .../test/AlignPCLThresholdsWriter_cfg.py | 24 +++++++-- 3 files changed, 58 insertions(+), 29 deletions(-) diff --git a/CondFormats/PCLConfig/plugins/AlignPCLThresholdsWriter.cc b/CondFormats/PCLConfig/plugins/AlignPCLThresholdsWriter.cc index 34a4d881f8345..55d53f73ec9cf 100644 --- a/CondFormats/PCLConfig/plugins/AlignPCLThresholdsWriter.cc +++ b/CondFormats/PCLConfig/plugins/AlignPCLThresholdsWriter.cc @@ -38,6 +38,7 @@ namespace DOFs { enum dof { X, Y, Z, thetaX, thetaY, thetaZ, extraDOF }; } +template class AlignPCLThresholdsWriter : public edm::one::EDAnalyzer<> { public: explicit AlignPCLThresholdsWriter(const edm::ParameterSet&); @@ -49,7 +50,6 @@ class AlignPCLThresholdsWriter : public edm::one::EDAnalyzer<> { void analyze(const edm::Event&, const edm::EventSetup&) override; DOFs::dof mapOntoEnum(std::string coord); - template void writePayload(T& myThresholds); void storeHGthresholds(AlignPCLThresholdsHG& myThresholds, const std::vector& alignables); @@ -62,7 +62,8 @@ class AlignPCLThresholdsWriter : public edm::one::EDAnalyzer<> { // // constructors and destructor // -AlignPCLThresholdsWriter::AlignPCLThresholdsWriter(const edm::ParameterSet& iConfig) +template +AlignPCLThresholdsWriter::AlignPCLThresholdsWriter(const edm::ParameterSet& iConfig) : m_record(iConfig.getParameter("record")), m_minNrecords(iConfig.getParameter("minNRecords")), m_parameters(iConfig.getParameter >("thresholds")) {} @@ -72,7 +73,8 @@ AlignPCLThresholdsWriter::AlignPCLThresholdsWriter(const edm::ParameterSet& iCon // // ------------ method called for each event ------------ -void AlignPCLThresholdsWriter::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { +template +void AlignPCLThresholdsWriter::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { // detect if new payload is used bool newClass = false; for (auto& thePSet : m_parameters) { @@ -82,17 +84,24 @@ void AlignPCLThresholdsWriter::analyze(const edm::Event& iEvent, const edm::Even } } - // use templated method depending on new/old payload - if (newClass) { - AlignPCLThresholdsHG myThresholds{}; - writePayload(myThresholds); + T myThresholds{}; + if constexpr (std::is_same_v) { + if (newClass) { + this->writePayload(myThresholds); + } else { + throw cms::Exception("AlignPCLThresholdsWriter") << "mismatched configuration"; + } } else { - AlignPCLThresholds myThresholds{}; - writePayload(myThresholds); + if (!newClass) { + this->writePayload(myThresholds); + } else { + throw cms::Exception("AlignPCLThresholdsWriter") << "mismatched configuration"; + } } } -DOFs::dof AlignPCLThresholdsWriter::mapOntoEnum(std::string coord) { +template +DOFs::dof AlignPCLThresholdsWriter::mapOntoEnum(std::string coord) { if (coord == "X") { return DOFs::X; } else if (coord == "Y") { @@ -112,7 +121,7 @@ DOFs::dof AlignPCLThresholdsWriter::mapOntoEnum(std::string coord) { // ------------ templated method to write the payload ------------ template -void AlignPCLThresholdsWriter::writePayload(T& myThresholds) { +void AlignPCLThresholdsWriter::writePayload(T& myThresholds) { using namespace edm; edm::LogInfo("AlignPCLThresholdsWriter") << "Size of AlignPCLThresholds object " << myThresholds.size() << std::endl; @@ -224,8 +233,9 @@ void AlignPCLThresholdsWriter::writePayload(T& myThresholds) { } // ------------ method to store additional HG thresholds ------------ -void AlignPCLThresholdsWriter::storeHGthresholds(AlignPCLThresholdsHG& myThresholds, - const std::vector& alignables) { +template +void AlignPCLThresholdsWriter::storeHGthresholds(AlignPCLThresholdsHG& myThresholds, + const std::vector& alignables) { edm::LogInfo("AlignPCLThresholdsWriter") << "Found type AlignPCLThresholdsHG, additional thresholds are written" << std::endl; @@ -254,7 +264,8 @@ void AlignPCLThresholdsWriter::storeHGthresholds(AlignPCLThresholdsHG& myThresho } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ -void AlignPCLThresholdsWriter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { +template +void AlignPCLThresholdsWriter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.setComment("Plugin to write payloads of type AlignPCLThresholds"); desc.add("record", "AlignPCLThresholdsRcd"); @@ -267,13 +278,18 @@ void AlignPCLThresholdsWriter::fillDescriptions(edm::ConfigurationDescriptions& desc_thresholds.add("sigCut"); desc_thresholds.add("maxMoveCut"); desc_thresholds.add("maxErrorCut"); - // optional thresholds from new payload version - desc_thresholds.addOptional("fractionCut"); + if constexpr (std::is_same_v) { + //optional thresholds from new payload version (not for all the alignables) + desc_thresholds.addOptional("fractionCut"); + } std::vector default_thresholds(1); desc.addVPSet("thresholds", desc_thresholds, default_thresholds); descriptions.addWithDefaultLabel(desc); } -//define this as a plug-in -DEFINE_FWK_MODULE(AlignPCLThresholdsWriter); +typedef AlignPCLThresholdsWriter AlignPCLThresholdsLGWriter; +typedef AlignPCLThresholdsWriter AlignPCLThresholdsHGWriter; + +DEFINE_FWK_MODULE(AlignPCLThresholdsLGWriter); +DEFINE_FWK_MODULE(AlignPCLThresholdsHGWriter); diff --git a/CondFormats/PCLConfig/test/AlignPCLThresholdsReader_cfg.py b/CondFormats/PCLConfig/test/AlignPCLThresholdsReader_cfg.py index 7fc3b03e42c12..6a8dac9a148f7 100644 --- a/CondFormats/PCLConfig/test/AlignPCLThresholdsReader_cfg.py +++ b/CondFormats/PCLConfig/test/AlignPCLThresholdsReader_cfg.py @@ -37,15 +37,10 @@ ## ## Define record, class and module based on option ## -rcdName = "AlignPCLThresholdsHGRcd" -className = "AlignPCLThresholdsHG" -moduleName = "AlignPCLThresholdsHGReader" - -if options.readLGpayload: - rcdName = "AlignPCLThresholdsRcd" - className = "AlignPCLThresholds" - moduleName = "AlignPCLThresholdsLGReader" +[rcdName, className, moduleName] = ["AlignPCLThresholdsRcd","AlignPCLThresholds","AlignPCLThresholdsLGReader"] \ + if (options.readLGpayload) else ["AlignPCLThresholdsHGRcd","AlignPCLThresholdsHG","AlignPCLThresholdsHGReader"] +print("using %s %s %s" % (rcdName, className, moduleName)) ## ## Empty Source ## diff --git a/CondFormats/PCLConfig/test/AlignPCLThresholdsWriter_cfg.py b/CondFormats/PCLConfig/test/AlignPCLThresholdsWriter_cfg.py index a8c491696cee0..e8d46ac595842 100644 --- a/CondFormats/PCLConfig/test/AlignPCLThresholdsWriter_cfg.py +++ b/CondFormats/PCLConfig/test/AlignPCLThresholdsWriter_cfg.py @@ -23,6 +23,18 @@ AlignPCLThresholdsHG = cms.untracked.PSet( limit = cms.untracked.int32(-1)) ) +## +## Var Parsing +## +import FWCore.ParameterSet.VarParsing as VarParsing +options = VarParsing.VarParsing() +options.register('writeLGpayload', + False, + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.bool, + "Write old payload type used for LG thresholds") +options.parseArguments() + ## ## Empty source ## @@ -53,12 +65,15 @@ ## ## Impot the thresholds configuration ## -import CondFormats.PCLConfig.ThresholdsHG_cff as Thresholds +import CondFormats.PCLConfig.Thresholds_cff as Thresholds +import CondFormats.PCLConfig.ThresholdsHG_cff as ThresholdsHG ## ## Example on how to add to the default extra degrees of freedom ## AddSurfaceThresholds = copy.deepcopy(Thresholds.default) +AddSurfaceThresholdsHG = copy.deepcopy(ThresholdsHG.default) + BPixSurface= cms.VPSet( cms.PSet(alignableId = cms.string("TPBModule"), DOF = cms.string("Surface1"), @@ -72,13 +87,16 @@ DefaultPlusSurface = AddSurfaceThresholds+BPixSurface #print DefaultPlusSurface.dumpPython() -process.WriteInDB = cms.EDAnalyzer("AlignPCLThresholdsWriter", +[MODULE_NAME, THRS_NAME] = ["AlignPCLThresholdsLGWriter",AddSurfaceThresholds] if(options.writeLGpayload) else ["AlignPCLThresholdsHGWriter",AddSurfaceThresholdsHG] + + +process.WriteInDB = cms.EDAnalyzer(MODULE_NAME, record= cms.string('FooRcd'), ### minimum number of records found in pede output minNRecords = cms.uint32(25000), #thresholds = cms.VPSet() # empty object #thresholds = DefaultPlusSurface # add extra deegree of freedom - thresholds = Thresholds.default # as a cms.VPset + thresholds = THRS_NAME #Thresholds.default # as a cms.VPset ) process.p = cms.Path(process.WriteInDB) From e8637e3fa5bf5f7e521955f146992d59aba3fce0 Mon Sep 17 00:00:00 2001 From: mmusich Date: Wed, 8 Jun 2022 13:34:34 +0200 Subject: [PATCH 3/8] miscellaneous improvements in CondFormats/PCLConfig classes --- .../interface/AlignPCLThresholdsHG.h | 21 ++- .../plugins/AlignPCLThresholdsReader.cc | 125 ++++++++++----- .../plugins/AlignPCLThresholdsWriter.cc | 14 +- .../PCLConfig/src/AlignPCLThresholdsHG.cc | 150 ++++++++++++++---- .../test/AlignPCLThresholdsReader_cfg.py | 6 +- .../test/AlignPCLThresholdsWriter_cfg.py | 2 +- .../test/testReadWriteAlignPCLThresholds.sh | 5 + 7 files changed, 224 insertions(+), 99 deletions(-) diff --git a/CondFormats/PCLConfig/interface/AlignPCLThresholdsHG.h b/CondFormats/PCLConfig/interface/AlignPCLThresholdsHG.h index 14924897f957e..c8f07bc83ef10 100644 --- a/CondFormats/PCLConfig/interface/AlignPCLThresholdsHG.h +++ b/CondFormats/PCLConfig/interface/AlignPCLThresholdsHG.h @@ -10,6 +10,7 @@ class AlignPCLThresholdsHG : public AlignPCLThresholds { public: + typedef std::unordered_map> param_map; AlignPCLThresholdsHG() {} enum FloatParamIndex { @@ -22,24 +23,28 @@ class AlignPCLThresholdsHG : public AlignPCLThresholds { FSIZE = 6 }; - void SetFractionCut(const std::string &AlignableId, const coordType &type, const float &cut); + enum IntParamIndex { ISIZE = 0 }; + enum StringParamIndex { SSIZE = 0 }; - const std::unordered_map> &getFloatMap() const { return floatMap; } + void setFractionCut(const std::string &AlignableId, const coordType &type, const float &cut); + + const param_map &getFloatMap() const { return floatMap_; } const std::vector &getFloatVec(const std::string &AlignableId) const; float getFractionCut(const std::string &AlignableId, const coordType &type) const; std::array getFractionCut(const std::string &AlignableId) const; - int payloadVersion() const; + const int payloadVersion() const; - void printAllHG() const; + void printAll() const; - ~AlignPCLThresholdsHG() override {} + ~AlignPCLThresholdsHG() override = default; private: - std::unordered_map> floatMap; - std::unordered_map> intMap; - std::unordered_map> stringMap; + param_map floatMap_; + // yet unused, but kept for possible extensions + std::unordered_map> intMap_; + std::unordered_map> stringMap_; COND_SERIALIZABLE; }; diff --git a/CondFormats/PCLConfig/plugins/AlignPCLThresholdsReader.cc b/CondFormats/PCLConfig/plugins/AlignPCLThresholdsReader.cc index ff634cd00c4ce..94635961f3f16 100644 --- a/CondFormats/PCLConfig/plugins/AlignPCLThresholdsReader.cc +++ b/CondFormats/PCLConfig/plugins/AlignPCLThresholdsReader.cc @@ -77,10 +77,6 @@ namespace edmtest { // use built-in method in the CondFormat to print the content if (printdebug_) { thresholds->printAll(); - // print additional thresholds if HG payload is used - if constexpr (std::is_same_v) { - thresholds->printAllHG(); - } } FILE* pFile = nullptr; @@ -90,45 +86,118 @@ namespace edmtest { fprintf(pFile, "AlignPCLThresholds::printAll() \n"); fprintf(pFile, " =======================================================================================================" - "============ \n"); + "============\n"); fprintf(pFile, "N records cut: %i \n", thresholds->getNrecords()); AlignPCLThresholds::threshold_map m_thresholds = thresholds->getThreshold_Map(); + AlignPCLThresholdsHG::param_map m_floatMap{}; + + if constexpr (std::is_same_v) { + m_floatMap = thresholds->getFloatMap(); + } for (auto it = m_thresholds.begin(); it != m_thresholds.end(); ++it) { + bool hasFractionCut = (m_floatMap.find(it->first) != m_floatMap.end()); + fprintf(pFile, " =====================================================================================================" - "============== \n"); - fprintf(pFile, "key : %s \n ", (it->first).c_str()); + "==============\n"); + fprintf(pFile, "key : %s \n", (it->first).c_str()); fprintf(pFile, "- Xcut : %8.3f um ", (it->second).getXcut()); fprintf(pFile, "| sigXcut : %8.3f ", (it->second).getSigXcut()); fprintf(pFile, "| maxMoveXcut : %8.3f um ", (it->second).getMaxMoveXcut()); - fprintf(pFile, "| ErrorXcut : %8.3f um\n ", (it->second).getErrorXcut()); + fprintf(pFile, "| ErrorXcut : %8.3f um ", (it->second).getErrorXcut()); + if constexpr (std::is_same_v) { + if (hasFractionCut) { + fprintf(pFile, + "| X_fractionCut : %8.3f \n", + thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::X)); + } else { + fprintf(pFile, "\n"); + } + } else { + fprintf(pFile, "\n"); + } fprintf(pFile, "- thetaXcut : %8.3f urad ", (it->second).getThetaXcut()); fprintf(pFile, "| sigThetaXcut : %8.3f ", (it->second).getSigThetaXcut()); fprintf(pFile, "| maxMoveThetaXcut : %8.3f urad ", (it->second).getMaxMoveThetaXcut()); - fprintf(pFile, "| ErrorThetaXcut : %8.3f urad\n ", (it->second).getErrorThetaXcut()); + fprintf(pFile, "| ErrorThetaXcut : %8.3f urad ", (it->second).getErrorThetaXcut()); + if constexpr (std::is_same_v) { + if (hasFractionCut) { + fprintf(pFile, + "| thetaX_fractionCut : %8.3f \n", + thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::theta_X)); + } else { + fprintf(pFile, "\n"); + } + } else { + fprintf(pFile, "\n"); + } fprintf(pFile, "- Ycut : %8.3f um ", (it->second).getYcut()); fprintf(pFile, "| sigYcut : %8.3f ", (it->second).getSigXcut()); fprintf(pFile, "| maxMoveYcut : %8.3f um ", (it->second).getMaxMoveYcut()); - fprintf(pFile, "| ErrorYcut : %8.3f um\n ", (it->second).getErrorYcut()); + fprintf(pFile, "| ErrorYcut : %8.3f um ", (it->second).getErrorYcut()); + if constexpr (std::is_same_v) { + if (hasFractionCut) { + fprintf(pFile, + "| Y_fractionCut : %8.3f \n", + thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::Y)); + } else { + fprintf(pFile, "\n"); + } + } else { + fprintf(pFile, "\n"); + } fprintf(pFile, "- thetaYcut : %8.3f urad ", (it->second).getThetaYcut()); fprintf(pFile, "| sigThetaYcut : %8.3f ", (it->second).getSigThetaYcut()); fprintf(pFile, "| maxMoveThetaYcut : %8.3f urad ", (it->second).getMaxMoveThetaYcut()); - fprintf(pFile, "| ErrorThetaYcut : %8.3f urad\n ", (it->second).getErrorThetaYcut()); + fprintf(pFile, "| ErrorThetaYcut : %8.3f urad ", (it->second).getErrorThetaYcut()); + if constexpr (std::is_same_v) { + if (hasFractionCut) { + fprintf(pFile, + "| thetaY_fractionCut : %8.3f \n", + thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::theta_Y)); + } else { + fprintf(pFile, "\n"); + } + } else { + fprintf(pFile, "\n"); + } fprintf(pFile, "- Zcut : %8.3f um ", (it->second).getZcut()); fprintf(pFile, "| sigZcut : %8.3f ", (it->second).getSigZcut()); fprintf(pFile, "| maxMoveZcut : %8.3f um ", (it->second).getMaxMoveZcut()); - fprintf(pFile, "| ErrorZcut : %8.3f um\n ", (it->second).getErrorZcut()); + fprintf(pFile, "| ErrorZcut : %8.3f um ", (it->second).getErrorZcut()); + if constexpr (std::is_same_v) { + if (hasFractionCut) { + fprintf(pFile, + "| Z_fractionCut : %8.3f \n", + thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::Z)); + } else { + fprintf(pFile, "\n"); + } + } else { + fprintf(pFile, "\n"); + } fprintf(pFile, "- thetaZcut : %8.3f urad ", (it->second).getThetaZcut()); fprintf(pFile, "| sigThetaZcut : %8.3f ", (it->second).getSigThetaZcut()); fprintf(pFile, "| maxMoveThetaZcut : %8.3f urad ", (it->second).getMaxMoveThetaZcut()); - fprintf(pFile, "| ErrorThetaZcut : %8.3f urad\n ", (it->second).getErrorThetaZcut()); + fprintf(pFile, "| ErrorThetaZcut : %8.3f urad ", (it->second).getErrorThetaZcut()); + if constexpr (std::is_same_v) { + if (hasFractionCut) { + fprintf(pFile, + "| thetaZ_fractionCut : %8.3f \n", + thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::theta_Z)); + } else { + fprintf(pFile, "\n"); + } + } else { + fprintf(pFile, "\n"); + } if ((it->second).hasExtraDOF()) { for (unsigned int j = 0; j < (it->second).extraDOFSize(); j++) { @@ -144,36 +213,6 @@ namespace edmtest { } } } - - // print additional thresholds for HG payload - if constexpr (std::is_same_v) { - fprintf(pFile, "AlignPCLThresholdsHG::printAllHG() \n"); - fprintf(pFile, " ======================================= \n"); - const std::unordered_map>& floatMap = thresholds->getFloatMap(); - for (auto it = floatMap.begin(); it != floatMap.end(); ++it) { - fprintf(pFile, " ======================================= \n"); - - fprintf(pFile, "key : %s \n", (it->first).c_str()); - fprintf(pFile, - "- X_fractionCut : %8.3f \n", - thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::X)); - fprintf(pFile, - "- thetaX_fractionCut : %8.3f \n", - thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::theta_X)); - fprintf(pFile, - "- Y_fractionCut : %8.3f \n", - thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::Y)); - fprintf(pFile, - "- thetaY_fractionCut : %8.3f \n", - thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::theta_Y)); - fprintf(pFile, - "- Z_fractionCut : %8.3f \n", - thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::Z)); - fprintf(pFile, - "- thetaZ_fractionCut : %8.3f \n", - thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::theta_Z)); - } - } } } diff --git a/CondFormats/PCLConfig/plugins/AlignPCLThresholdsWriter.cc b/CondFormats/PCLConfig/plugins/AlignPCLThresholdsWriter.cc index 55d53f73ec9cf..b0e7f98b462e2 100644 --- a/CondFormats/PCLConfig/plugins/AlignPCLThresholdsWriter.cc +++ b/CondFormats/PCLConfig/plugins/AlignPCLThresholdsWriter.cc @@ -215,14 +215,14 @@ void AlignPCLThresholdsWriter::writePayload(T& myThresholds) { myThresholds.setNRecords(m_minNrecords); edm::LogInfo("AlignPCLThresholdsWriter") << "Content of AlignPCLThresholds " << std::endl; - // use buil-in method in the CondFormat - myThresholds.printAll(); - // additional thresholds for AlignPCLThresholdsHG if constexpr (std::is_same_v) { storeHGthresholds(myThresholds, alignables); } + // use built-in method in the CondFormat + myThresholds.printAll(); + // Form the data here edm::Service poolDbService; if (poolDbService.isAvailable()) { @@ -250,17 +250,11 @@ void AlignPCLThresholdsWriter::storeHGthresholds(AlignPCLThresholdsHG& myThre if (alignableId == alignable) { if (thePSet.exists("fractionCut")) { const double fractionCut(thePSet.getParameter("fractionCut")); - myThresholds.SetFractionCut(alignableId, type, fractionCut); - } else { - myThresholds.SetFractionCut(alignableId, type, -1.); // better way to define default fraction cut?? + myThresholds.setFractionCut(alignableId, type, fractionCut); } } } } - - // print additional tresholds - edm::LogInfo("AlignPCLThresholdsWriter") << "Additonal content of AlignPCLThresholdsHG " << std::endl; - myThresholds.printAllHG(); } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ diff --git a/CondFormats/PCLConfig/src/AlignPCLThresholdsHG.cc b/CondFormats/PCLConfig/src/AlignPCLThresholdsHG.cc index 470adafc69a58..0f8d94427b9c8 100644 --- a/CondFormats/PCLConfig/src/AlignPCLThresholdsHG.cc +++ b/CondFormats/PCLConfig/src/AlignPCLThresholdsHG.cc @@ -5,6 +5,7 @@ #include #include // std::setw +//****************************************************************************// namespace AlignPCLThresholdsHGImpl { template const T &getParam(const std::vector ¶ms, size_t index) { @@ -22,41 +23,44 @@ namespace AlignPCLThresholdsHGImpl { } //namespace AlignPCLThresholdsHGImpl +//****************************************************************************// const std::vector &AlignPCLThresholdsHG::getFloatVec(const std::string &AlignableId) const { - std::unordered_map>::const_iterator it = floatMap.find(AlignableId); + const auto &it = floatMap_.find(AlignableId); - if (it != floatMap.end()) { + if (it != floatMap_.end()) { return it->second; } else { throw cms::Exception("AlignPCLThresholdsHG") << "No float vector defined for Alignable id " << AlignableId << "\n"; } } -void AlignPCLThresholdsHG::SetFractionCut(const std::string &AlignableId, const coordType &type, const float &cut) { +//****************************************************************************// +void AlignPCLThresholdsHG::setFractionCut(const std::string &AlignableId, const coordType &type, const float &cut) { // Set entry in map if not yet available - std::unordered_map>::const_iterator it = floatMap.find(AlignableId); - if (it == floatMap.end()) - floatMap[AlignableId] = std::vector(FSIZE, 0.); + const auto &it = floatMap_.find(AlignableId); + if (it == floatMap_.end()) + floatMap_[AlignableId] = std::vector(FSIZE, -1.); switch (type) { case X: - return AlignPCLThresholdsHGImpl::setParam(floatMap[AlignableId], FRACTION_CUT_X, cut); + return AlignPCLThresholdsHGImpl::setParam(floatMap_[AlignableId], FRACTION_CUT_X, cut); case Y: - return AlignPCLThresholdsHGImpl::setParam(floatMap[AlignableId], FRACTION_CUT_Y, cut); + return AlignPCLThresholdsHGImpl::setParam(floatMap_[AlignableId], FRACTION_CUT_Y, cut); case Z: - return AlignPCLThresholdsHGImpl::setParam(floatMap[AlignableId], FRACTION_CUT_Z, cut); + return AlignPCLThresholdsHGImpl::setParam(floatMap_[AlignableId], FRACTION_CUT_Z, cut); case theta_X: - return AlignPCLThresholdsHGImpl::setParam(floatMap[AlignableId], FRACTION_CUT_TX, cut); + return AlignPCLThresholdsHGImpl::setParam(floatMap_[AlignableId], FRACTION_CUT_TX, cut); case theta_Y: - return AlignPCLThresholdsHGImpl::setParam(floatMap[AlignableId], FRACTION_CUT_TY, cut); + return AlignPCLThresholdsHGImpl::setParam(floatMap_[AlignableId], FRACTION_CUT_TY, cut); case theta_Z: - return AlignPCLThresholdsHGImpl::setParam(floatMap[AlignableId], FRACTION_CUT_TZ, cut); + return AlignPCLThresholdsHGImpl::setParam(floatMap_[AlignableId], FRACTION_CUT_TZ, cut); default: throw cms::Exception("AlignPCLThresholdsHG") << "Requested setting fraction threshold for undefined coordinate" << type << "\n"; } } +//****************************************************************************// std::array AlignPCLThresholdsHG::getFractionCut(const std::string &AlignableId) const { const std::vector vec = getFloatVec(AlignableId); return {{AlignPCLThresholdsHGImpl::getParam(vec, FRACTION_CUT_X), @@ -67,6 +71,7 @@ std::array AlignPCLThresholdsHG::getFractionCut(const std::string &Ali AlignPCLThresholdsHGImpl::getParam(vec, FRACTION_CUT_TZ)}}; } +//****************************************************************************// float AlignPCLThresholdsHG::getFractionCut(const std::string &AlignableId, const coordType &type) const { const std::vector vec = getFloatVec(AlignableId); switch (type) { @@ -88,35 +93,110 @@ float AlignPCLThresholdsHG::getFractionCut(const std::string &AlignableId, const } } -int AlignPCLThresholdsHG::payloadVersion() const { - switch (FSIZE) { +//****************************************************************************// +const int AlignPCLThresholdsHG::payloadVersion() const { + switch (FSIZE + ISIZE + SSIZE) { case 6: return 1; default: throw cms::Exception("AlignPCLThresholdsHG") - << "Payload version with FSIZE equal to " << FSIZE << " is not defined.\n"; + << "Payload version with parameter size equal to " << FSIZE + ISIZE + SSIZE << " is not defined.\n"; } } -void AlignPCLThresholdsHG::printAllHG() const { - edm::LogVerbatim("AlignPCLThresholdsHG") << "AlignPCLThresholdsHG::printAllHG()"; - edm::LogVerbatim("AlignPCLThresholdsHG") << " =================================="; - for (auto it = floatMap.begin(); it != floatMap.end(); ++it) { - edm::LogVerbatim("AlignPCLThresholdsHG") << " =================================="; - edm::LogVerbatim("AlignPCLThresholdsHG") - << "key : " << it->first << " \n" - << "- X_fractionCut : " << std::setw(4) << getFractionCut(it->first, X) << std::setw(5) << "\n" - - << "- thetaX_fractionCut : " << std::setw(4) << getFractionCut(it->first, theta_X) << std::setw(5) - << "\n" - - << "- Y_fractionCut : " << std::setw(4) << getFractionCut(it->first, Y) << std::setw(5) << "\n" - - << "- thetaY_fractionCut : " << std::setw(4) << getFractionCut(it->first, theta_Y) << std::setw(5) - << "\n" - - << "- Z_fractionCut : " << std::setw(4) << getFractionCut(it->first, Z) << std::setw(5) << "\n" - - << "- thetaZ_fractionCut : " << std::setw(4) << getFractionCut(it->first, theta_Z) << std::setw(5); +//****************************************************************************// +void AlignPCLThresholdsHG::printAll() const { + edm::LogVerbatim out("AlignPCLThresholdsHG"); + + out << "AlignPCLThresholdsHG::printAll()\n"; + out << "=============================================================================================================" + "======\n"; + out << "N records cut: " << this->getNrecords() << "\n"; + for (auto it = m_thresholds.begin(); it != m_thresholds.end(); ++it) { + out << "===========================================================================================================" + "========\n"; + + std::stringstream ss; + + ss << "key : " << it->first << " \n" + << "- Xcut : " << std::setw(4) << (it->second).getXcut() << std::setw(5) << " um" + << "| sigXcut : " << std::setw(4) << (it->second).getSigXcut() << std::setw(1) << " " + << "| maxMoveXcut : " << std::setw(4) << (it->second).getMaxMoveXcut() << std::setw(5) << " um" + << "| ErrorXcut : " << std::setw(4) << (it->second).getErrorXcut() << std::setw(5) << " um"; + + if (floatMap_.find(it->first) != floatMap_.end()) { + ss << "| X_fractionCut : " << std::setw(4) << getFractionCut(it->first, X) << std::setw(5) << "\n"; + } else { + ss << "\n"; + } + + ss << "- thetaXcut : " << std::setw(4) << (it->second).getThetaXcut() << std::setw(5) << " urad" + << "| sigThetaXcut : " << std::setw(4) << (it->second).getSigThetaXcut() << std::setw(1) << " " + << "| maxMoveThetaXcut : " << std::setw(4) << (it->second).getMaxMoveThetaXcut() << std::setw(5) << " urad" + << "| ErrorThetaXcut : " << std::setw(4) << (it->second).getErrorThetaXcut() << std::setw(5) << " urad"; + + if (floatMap_.find(it->first) != floatMap_.end()) { + ss << "| thetaX_fractionCut : " << std::setw(4) << getFractionCut(it->first, theta_X) << std::setw(5) << "\n"; + } else { + ss << "\n"; + } + + ss << "- Ycut : " << std::setw(4) << (it->second).getYcut() << std::setw(5) << " um" + << "| sigYcut : " << std::setw(4) << (it->second).getSigXcut() << std::setw(1) << " " + << "| maxMoveYcut : " << std::setw(4) << (it->second).getMaxMoveYcut() << std::setw(5) << " um" + << "| ErrorYcut : " << std::setw(4) << (it->second).getErrorYcut() << std::setw(5) << " um"; + + if (floatMap_.find(it->first) != floatMap_.end()) { + ss << "| Y_fractionCut : " << std::setw(4) << getFractionCut(it->first, Y) << std::setw(5) << "\n"; + } else { + ss << "\n"; + } + + ss << "- thetaYcut : " << std::setw(4) << (it->second).getThetaYcut() << std::setw(5) << " urad" + << "| sigThetaYcut : " << std::setw(4) << (it->second).getSigThetaYcut() << std::setw(1) << " " + << "| maxMoveThetaYcut : " << std::setw(4) << (it->second).getMaxMoveThetaYcut() << std::setw(5) << " urad" + << "| ErrorThetaYcut : " << std::setw(4) << (it->second).getErrorThetaYcut() << std::setw(5) << " urad"; + + if (floatMap_.find(it->first) != floatMap_.end()) { + ss << "| thetaY_fractionCut : " << std::setw(4) << getFractionCut(it->first, theta_Y) << std::setw(5) << "\n"; + } else { + ss << "\n"; + } + + ss << "- Zcut : " << std::setw(4) << (it->second).getZcut() << std::setw(5) << " um" + << "| sigZcut : " << std::setw(4) << (it->second).getSigZcut() << std::setw(1) << " " + << "| maxMoveZcut : " << std::setw(4) << (it->second).getMaxMoveZcut() << std::setw(5) << " um" + << "| ErrorZcut : " << std::setw(4) << (it->second).getErrorZcut() << std::setw(5) << " um"; + + if (floatMap_.find(it->first) != floatMap_.end()) { + ss << "| Z_fractionCut : " << std::setw(4) << getFractionCut(it->first, Z) << std::setw(5) << "\n"; + } else { + ss << "\n"; + } + + ss << "- thetaZcut : " << std::setw(4) << (it->second).getThetaZcut() << std::setw(5) << " urad" + << "| sigThetaZcut : " << std::setw(4) << (it->second).getSigThetaZcut() << std::setw(1) << " " + << "| maxMoveThetaZcut : " << std::setw(4) << (it->second).getMaxMoveThetaZcut() << std::setw(5) << " urad" + << "| ErrorThetaZcut : " << std::setw(4) << (it->second).getErrorThetaZcut() << std::setw(5) << " urad"; + + if (floatMap_.find(it->first) != floatMap_.end()) { + ss << "| thetaZ_fractionCut : " << std::setw(4) << getFractionCut(it->first, theta_Z) << std::setw(5) << "\n"; + } else { + ss << "\n"; + } + + out << ss.str() << std::endl; + + if ((it->second).hasExtraDOF()) { + for (unsigned int j = 0; j < (it->second).extraDOFSize(); j++) { + std::array extraDOFCuts = getExtraDOFCutsForAlignable(it->first, j); + + out << "Extra DOF " << j << " with label: " << getExtraDOFLabelForAlignable(it->first, j); + out << "- cut : " << std::setw(4) << extraDOFCuts.at(0) << std::setw(5) << " " + << "| sigCut : " << std::setw(4) << extraDOFCuts.at(1) << std::setw(1) << " " + << "| maxMoveCut : " << std::setw(4) << extraDOFCuts.at(2) << std::setw(5) << " " + << "| maxErrorCut : " << std::setw(4) << extraDOFCuts.at(3) << std::setw(5) << " "; + } + } } } diff --git a/CondFormats/PCLConfig/test/AlignPCLThresholdsReader_cfg.py b/CondFormats/PCLConfig/test/AlignPCLThresholdsReader_cfg.py index 6a8dac9a148f7..729e41f5d1dd8 100644 --- a/CondFormats/PCLConfig/test/AlignPCLThresholdsReader_cfg.py +++ b/CondFormats/PCLConfig/test/AlignPCLThresholdsReader_cfg.py @@ -54,7 +54,9 @@ ## Get the payload ## from CondCore.CondDB.CondDB_cfi import * -CondDBThresholds = CondDB.clone(connect = cms.string("sqlite_file:mythresholds.db")) +inputDBfile = 'sqlite_file:mythresholds_%s.db' % ("LG" if(options.readLGpayload) else "HG") + +CondDBThresholds = CondDB.clone(connect = cms.string(inputDBfile)) process.dbInput = cms.ESSource("PoolDBESSource", CondDBThresholds, @@ -79,6 +81,6 @@ ## process.ReadDB = cms.EDAnalyzer(moduleName) process.ReadDB.printDebug = cms.untracked.bool(True) -process.ReadDB.outputFile = cms.untracked.string('AlignPCLThresholds.log') +process.ReadDB.outputFile = cms.untracked.string('AlignPCLThresholds_%s.log' % ("LG" if(options.readLGpayload) else "HG")) process.p = cms.Path(process.get+process.ReadDB) diff --git a/CondFormats/PCLConfig/test/AlignPCLThresholdsWriter_cfg.py b/CondFormats/PCLConfig/test/AlignPCLThresholdsWriter_cfg.py index e8d46ac595842..30a2b831afdfa 100644 --- a/CondFormats/PCLConfig/test/AlignPCLThresholdsWriter_cfg.py +++ b/CondFormats/PCLConfig/test/AlignPCLThresholdsWriter_cfg.py @@ -52,7 +52,7 @@ ## ## Output database (in this case local sqlite file) ## -process.CondDB.connect = 'sqlite_file:mythresholds.db' +process.CondDB.connect = 'sqlite_file:mythresholds_%s.db' % ("LG" if(options.writeLGpayload) else "HG") process.PoolDBOutputService = cms.Service("PoolDBOutputService", process.CondDB, timetype = cms.untracked.string('runnumber'), diff --git a/CondFormats/PCLConfig/test/testReadWriteAlignPCLThresholds.sh b/CondFormats/PCLConfig/test/testReadWriteAlignPCLThresholds.sh index 48b3d87ff65fd..13596d09aaa1a 100755 --- a/CondFormats/PCLConfig/test/testReadWriteAlignPCLThresholds.sh +++ b/CondFormats/PCLConfig/test/testReadWriteAlignPCLThresholds.sh @@ -1,4 +1,9 @@ #!/bin/bash function die { echo $1: status $2; exit $2; } +# test High Granularity cmsRun ${LOCAL_TEST_DIR}/AlignPCLThresholdsWriter_cfg.py || die 'failed running AlignPCLThresholdsWriter_cfg.py' $? cmsRun ${LOCAL_TEST_DIR}/AlignPCLThresholdsReader_cfg.py || die 'failed running AlignPCLThresholdsReader_cfg.py' $? + +# test Low Granularity +(cmsRun ${LOCAL_TEST_DIR}/AlignPCLThresholdsWriter_cfg.py writeLGpayload=True) || die 'failed running AlignPCLThresholdsWriter_cfg.py writeLGpayload=True' $? +(cmsRun ${LOCAL_TEST_DIR}/AlignPCLThresholdsReader_cfg.py readLGpayload=True) || die 'failed running AlignPCLThresholdsReader_cfg.py readLGpayload=True' $? From b1957c94fcca6ae448eee467d9aa2cf346af1e9d Mon Sep 17 00:00:00 2001 From: mmusich Date: Wed, 8 Jun 2022 15:36:22 +0200 Subject: [PATCH 4/8] use auto-generated configuration fragments for AlignPCLThresholds(Writer|Reader) --- .../plugins/AlignPCLThresholdsReader.cc | 2 +- .../plugins/AlignPCLThresholdsWriter.cc | 4 ++- .../test/AlignPCLThresholdsReader_cfg.py | 16 ++++++++--- .../test/AlignPCLThresholdsWriter_cfg.py | 27 +++++++++++++------ 4 files changed, 36 insertions(+), 13 deletions(-) diff --git a/CondFormats/PCLConfig/plugins/AlignPCLThresholdsReader.cc b/CondFormats/PCLConfig/plugins/AlignPCLThresholdsReader.cc index 94635961f3f16..78c5ed3d24e99 100644 --- a/CondFormats/PCLConfig/plugins/AlignPCLThresholdsReader.cc +++ b/CondFormats/PCLConfig/plugins/AlignPCLThresholdsReader.cc @@ -75,7 +75,7 @@ namespace edmtest { edm::LogInfo("AlignPCLThresholdsReader") << "Size " << thresholds->size() << std::endl; edm::LogInfo("AlignPCLThresholdsReader") << "Content of myThresholds " << std::endl; // use built-in method in the CondFormat to print the content - if (printdebug_) { + if (thresholds && printdebug_) { thresholds->printAll(); } diff --git a/CondFormats/PCLConfig/plugins/AlignPCLThresholdsWriter.cc b/CondFormats/PCLConfig/plugins/AlignPCLThresholdsWriter.cc index b0e7f98b462e2..69ad5b2805eb5 100644 --- a/CondFormats/PCLConfig/plugins/AlignPCLThresholdsWriter.cc +++ b/CondFormats/PCLConfig/plugins/AlignPCLThresholdsWriter.cc @@ -262,7 +262,6 @@ template void AlignPCLThresholdsWriter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.setComment("Plugin to write payloads of type AlignPCLThresholds"); - desc.add("record", "AlignPCLThresholdsRcd"); desc.add("minNRecords", 25000); edm::ParameterSetDescription desc_thresholds; @@ -273,8 +272,11 @@ void AlignPCLThresholdsWriter::fillDescriptions(edm::ConfigurationDescription desc_thresholds.add("maxMoveCut"); desc_thresholds.add("maxErrorCut"); if constexpr (std::is_same_v) { + desc.add("record", "AlignPCLThresholdsHGRcd"); //optional thresholds from new payload version (not for all the alignables) desc_thresholds.addOptional("fractionCut"); + } else { + desc.add("record", "AlignPCLThresholdsRcd"); } std::vector default_thresholds(1); diff --git a/CondFormats/PCLConfig/test/AlignPCLThresholdsReader_cfg.py b/CondFormats/PCLConfig/test/AlignPCLThresholdsReader_cfg.py index 729e41f5d1dd8..b386277c61b8a 100644 --- a/CondFormats/PCLConfig/test/AlignPCLThresholdsReader_cfg.py +++ b/CondFormats/PCLConfig/test/AlignPCLThresholdsReader_cfg.py @@ -79,8 +79,18 @@ ## ## Read it back ## -process.ReadDB = cms.EDAnalyzer(moduleName) -process.ReadDB.printDebug = cms.untracked.bool(True) -process.ReadDB.outputFile = cms.untracked.string('AlignPCLThresholds_%s.log' % ("LG" if(options.readLGpayload) else "HG")) +from CondFormats.PCLConfig.edmtestAlignPCLThresholdsReaderAlignPCLThresholdsAlignPCLThresholdsRcd_cfi import * +from CondFormats.PCLConfig.edmtestAlignPCLThresholdsReaderAlignPCLThresholdsHGAlignPCLThresholdsHGRcd_cfi import * + +if(options.readLGpayload): + process.ReadDB = edmtestAlignPCLThresholdsReaderAlignPCLThresholdsAlignPCLThresholdsRcd.clone( + printDebug = True, + outputFile = 'AlignPCLThresholds_%s.log' % ("LG" if(options.readLGpayload) else "HG") + ) +else: + process.ReadDB = edmtestAlignPCLThresholdsReaderAlignPCLThresholdsHGAlignPCLThresholdsHGRcd.clone( + printDebug = True, + outputFile = 'AlignPCLThresholds_%s.log' % ("LG" if(options.readLGpayload) else "HG") + ) process.p = cms.Path(process.get+process.ReadDB) diff --git a/CondFormats/PCLConfig/test/AlignPCLThresholdsWriter_cfg.py b/CondFormats/PCLConfig/test/AlignPCLThresholdsWriter_cfg.py index 30a2b831afdfa..970eb27c52f0c 100644 --- a/CondFormats/PCLConfig/test/AlignPCLThresholdsWriter_cfg.py +++ b/CondFormats/PCLConfig/test/AlignPCLThresholdsWriter_cfg.py @@ -88,15 +88,26 @@ #print DefaultPlusSurface.dumpPython() [MODULE_NAME, THRS_NAME] = ["AlignPCLThresholdsLGWriter",AddSurfaceThresholds] if(options.writeLGpayload) else ["AlignPCLThresholdsHGWriter",AddSurfaceThresholdsHG] +print("Writing payload with",MODULE_NAME) +from CondFormats.PCLConfig.alignPCLThresholdsHGWriter_cfi import alignPCLThresholdsHGWriter +from CondFormats.PCLConfig.alignPCLThresholdsLGWriter_cfi import alignPCLThresholdsLGWriter -process.WriteInDB = cms.EDAnalyzer(MODULE_NAME, - record= cms.string('FooRcd'), - ### minimum number of records found in pede output - minNRecords = cms.uint32(25000), - #thresholds = cms.VPSet() # empty object - #thresholds = DefaultPlusSurface # add extra deegree of freedom - thresholds = THRS_NAME #Thresholds.default # as a cms.VPset - ) +if(options.writeLGpayload): + process.WriteInDB = alignPCLThresholdsLGWriter.clone( + record = 'FooRcd', + ### minimum number of records found in pede output + minNRecords = 25000, + #thresholds = cms.VPSet() # empty object + #thresholds = DefaultPlusSurface # add extra deegree of freedom + thresholds = THRS_NAME + ) +else: + process.WriteInDB = alignPCLThresholdsHGWriter.clone( + record = 'FooRcd', + ### minimum number of records found in pede output + minNRecords = 25000, + thresholds = THRS_NAME + ) process.p = cms.Path(process.WriteInDB) From b60752fe52b610da6c12cc55e5632a6d1603a601 Mon Sep 17 00:00:00 2001 From: Danilo Meuser Date: Tue, 7 Jun 2022 15:42:33 +0200 Subject: [PATCH 5/8] Changed consumer code in Alignment to use new threshold payload --- .../interface/MillePedeFileReader.h | 12 ++++++------ .../plugins/MillePedeAlignmentAlgorithm.cc | 6 +++--- .../plugins/MillePedeAlignmentAlgorithm.h | 10 +++++----- .../plugins/MillePedeDQMModule.cc | 8 ++++++-- .../plugins/MillePedeDQMModule.h | 4 ++-- .../src/MillePedeFileReader.cc | 16 ++++++++-------- 6 files changed, 30 insertions(+), 26 deletions(-) diff --git a/Alignment/MillePedeAlignmentAlgorithm/interface/MillePedeFileReader.h b/Alignment/MillePedeAlignmentAlgorithm/interface/MillePedeFileReader.h index 4ebf978656a6c..8c9aa66b4af6c 100644 --- a/Alignment/MillePedeAlignmentAlgorithm/interface/MillePedeFileReader.h +++ b/Alignment/MillePedeAlignmentAlgorithm/interface/MillePedeFileReader.h @@ -12,7 +12,7 @@ /*** Alignment ***/ #include "Alignment/MillePedeAlignmentAlgorithm/interface/PedeLabelerBase.h" -#include "CondFormats/PCLConfig/interface/AlignPCLThresholds.h" +#include "CondFormats/PCLConfig/interface/AlignPCLThresholdsHG.h" struct mpPCLresults { private: @@ -59,7 +59,7 @@ class MillePedeFileReader { public: //==================================================================== explicit MillePedeFileReader(const edm::ParameterSet&, const std::shared_ptr&, - const std::shared_ptr&); + const std::shared_ptr&); virtual ~MillePedeFileReader() = default; @@ -81,7 +81,7 @@ class MillePedeFileReader { const std::array& getTZobs() const { return tZobs_; } const std::array& getTZobsErr() const { return tZobsErr_; } - const AlignPCLThresholds::threshold_map getThresholdMap() const { return theThresholds_.get()->getThreshold_Map(); } + const AlignPCLThresholdsHG::threshold_map getThresholdMap() const { return theThresholds_.get()->getThreshold_Map(); } const int binariesAmount() const { return binariesAmount_; } @@ -119,7 +119,7 @@ class MillePedeFileReader { const std::shared_ptr pedeLabeler_; // thresholds from DB - const std::shared_ptr theThresholds_; + const std::shared_ptr theThresholds_; // file-names const std::string millePedeEndFile_; @@ -168,8 +168,8 @@ class MillePedeFileReader { }; const std::array coord_str = {{"X", "Y", "Z", "theta_X", "theta_Y", "theta_Z", "extra_DOF", "none"}}; -inline std::ostream& operator<<(std::ostream& os, const AlignPCLThresholds::coordType& c) { - if (c >= AlignPCLThresholds::endOfTypes || c < AlignPCLThresholds::X) +inline std::ostream& operator<<(std::ostream& os, const AlignPCLThresholdsHG::coordType& c) { + if (c >= AlignPCLThresholdsHG::endOfTypes || c < AlignPCLThresholdsHG::X) return os << "unrecongnized coordinate"; return os << coord_str[c]; } diff --git a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeAlignmentAlgorithm.cc b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeAlignmentAlgorithm.cc index 552675fdc4153..4772b85a74f20 100644 --- a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeAlignmentAlgorithm.cc +++ b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeAlignmentAlgorithm.cc @@ -87,7 +87,7 @@ using namespace gbl; MillePedeAlignmentAlgorithm::MillePedeAlignmentAlgorithm(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC) : AlignmentAlgorithmBase(cfg, iC), topoToken_(iC.esConsumes()), - aliThrToken_(iC.esConsumes()), + aliThrToken_(iC.esConsumes()), theConfig(cfg), theMode(this->decodeMode(theConfig.getUntrackedParameter("mode"))), theDir(theConfig.getUntrackedParameter("fileDir")), @@ -183,7 +183,7 @@ void MillePedeAlignmentAlgorithm::initialize(const edm::EventSetup &setup, //Retrieve the thresolds cuts from DB for the PCL if (runAtPCL_) { const auto &th = &setup.getData(aliThrToken_); - theThresholds = std::make_shared(); + theThresholds = std::make_shared(); storeThresholds(th->getNrecords(), th->getThreshold_Map()); } @@ -301,7 +301,7 @@ bool MillePedeAlignmentAlgorithm::addCalibrations(const std::vectorsetAlignPCLThresholds(nRecords, thresholdMap); return true; } diff --git a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeAlignmentAlgorithm.h b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeAlignmentAlgorithm.h index 04dadeffd92b4..d1d29bb0c78ba 100644 --- a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeAlignmentAlgorithm.h +++ b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeAlignmentAlgorithm.h @@ -25,8 +25,8 @@ #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "Geometry/Records/interface/TrackerTopologyRcd.h" -#include "CondFormats/PCLConfig/interface/AlignPCLThresholds.h" -#include "CondFormats/DataRecord/interface/AlignPCLThresholdsRcd.h" +#include "CondFormats/PCLConfig/interface/AlignPCLThresholdsHG.h" +#include "CondFormats/DataRecord/interface/AlignPCLThresholdsHGRcd.h" #include #include @@ -76,7 +76,7 @@ class MillePedeAlignmentAlgorithm : public AlignmentAlgorithmBase { /// Pass integrated calibrations to Millepede (they are not owned by Millepede!) bool addCalibrations(const std::vector &iCals) override; - virtual bool storeThresholds(const int &nRecords, const AlignPCLThresholds::threshold_map &thresholdMap); + virtual bool storeThresholds(const int &nRecords, const AlignPCLThresholdsHG::threshold_map &thresholdMap); /// Called at end of job void terminate(const edm::EventSetup &iSetup) override; @@ -271,7 +271,7 @@ class MillePedeAlignmentAlgorithm : public AlignmentAlgorithmBase { //-------------------------------------------------------- const edm::ESGetToken topoToken_; - const edm::ESGetToken aliThrToken_; + const edm::ESGetToken aliThrToken_; enum EModeBit { myMilleBit = 1 << 0, myPedeRunBit = 1 << 1, myPedeSteerBit = 1 << 2, myPedeReadBit = 1 << 3 }; unsigned int decodeMode(const std::string &mode) const; @@ -291,7 +291,7 @@ class MillePedeAlignmentAlgorithm : public AlignmentAlgorithmBase { std::unique_ptr thePedeSteer; std::unique_ptr theTrajectoryFactory; std::vector theCalibrations; - std::shared_ptr theThresholds; + std::shared_ptr theThresholds; unsigned int theMinNumHits; double theMaximalCor2D; /// maximal correlation allowed for 2D hit in TID/TEC. /// If larger, the 2D measurement gets diagonalized!!! diff --git a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.cc b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.cc index 3424d31129229..78e02c457a114 100644 --- a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.cc +++ b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.cc @@ -93,7 +93,7 @@ void MillePedeDQMModule ::beginRun(const edm::Run&, const edm::EventSetup& setup // take the thresholds from DB const auto& thresholds_ = &setup.getData(aliThrToken_); - auto myThresholds = std::make_shared(); + auto myThresholds = std::make_shared(); myThresholds->setAlignPCLThresholds(thresholds_->getNrecords(), thresholds_->getThreshold_Map()); TrackerGeomBuilderFromGeometricDet builder; @@ -110,7 +110,7 @@ void MillePedeDQMModule ::beginRun(const edm::Run&, const edm::EventSetup& setup labelerPlugin, PedeLabelerBase::TopLevelAlignables(tracker_.get(), nullptr, nullptr), labelerConfig)}; mpReader_ = std::make_unique( - mpReaderConfig_, pedeLabeler, std::shared_ptr(myThresholds)); + mpReaderConfig_, pedeLabeler, std::shared_ptr(myThresholds)); } void MillePedeDQMModule ::fillStatusHisto(MonitorElement* statusHisto) { @@ -264,6 +264,10 @@ int MillePedeDQMModule ::getIndexFromString(const std::string& alignableId) { return 5; } else if (alignableId == "TPEHalfCylinderXplusZplus") { return 4; + } else if (alignableId.rfind("TPBLadder", 0) == 0) { + return 6; + } else if (alignableId.rfind("TPEPanel", 0) == 0) { + return 7; } else { throw cms::Exception("LogicError") << "@SUB=MillePedeDQMModule::getIndexFromString\n" << "Retrieving conversion for not supported Alignable partition" << alignableId; diff --git a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.h b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.h index cb05faa56c1ad..f8953ec4241d4 100644 --- a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.h +++ b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.h @@ -30,7 +30,7 @@ #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeomBuilderFromGeometricDet.h" /*** Thresholds from DB ***/ -#include "CondFormats/DataRecord/interface/AlignPCLThresholdsRcd.h" +#include "CondFormats/DataRecord/interface/AlignPCLThresholdsHGRcd.h" /*** DQM ***/ #include "DQMServices/Core/interface/DQMEDHarvester.h" @@ -82,7 +82,7 @@ class MillePedeDQMModule : public DQMEDHarvester { const edm::ESGetToken gDetToken_; const edm::ESGetToken ptpToken_; const edm::ESGetToken ptitpToken_; - const edm::ESGetToken aliThrToken_; + const edm::ESGetToken aliThrToken_; const edm::ParameterSet mpReaderConfig_; std::unique_ptr tracker_; diff --git a/Alignment/MillePedeAlignmentAlgorithm/src/MillePedeFileReader.cc b/Alignment/MillePedeAlignmentAlgorithm/src/MillePedeFileReader.cc index 6db9fe70e4bee..7eff90d772ae5 100644 --- a/Alignment/MillePedeAlignmentAlgorithm/src/MillePedeFileReader.cc +++ b/Alignment/MillePedeAlignmentAlgorithm/src/MillePedeFileReader.cc @@ -14,7 +14,7 @@ MillePedeFileReader ::MillePedeFileReader(const edm::ParameterSet& config, const std::shared_ptr& pedeLabeler, - const std::shared_ptr& theThresholds) + const std::shared_ptr& theThresholds) : pedeLabeler_(pedeLabeler), theThresholds_(theThresholds), millePedeEndFile_(config.getParameter("millePedeEndFile")), @@ -142,32 +142,32 @@ void MillePedeFileReader ::readMillePedeResultFile() { auto det = getHLS(alignable); int detIndex = static_cast(det); - auto coord = static_cast(alignableIndex); + auto coord = static_cast(alignableIndex); std::string detLabel = getStringFromHLS(det); if (det != PclHLS::NotInPCL) { switch (coord) { - case AlignPCLThresholds::X: + case AlignPCLThresholdsHG::X: Xobs_[detIndex] = ObsMove; XobsErr_[detIndex] = ObsErr; break; - case AlignPCLThresholds::Y: + case AlignPCLThresholdsHG::Y: Yobs_[detIndex] = ObsMove; YobsErr_[detIndex] = ObsErr; break; - case AlignPCLThresholds::Z: + case AlignPCLThresholdsHG::Z: Zobs_[detIndex] = ObsMove; ZobsErr_[detIndex] = ObsErr; break; - case AlignPCLThresholds::theta_X: + case AlignPCLThresholdsHG::theta_X: tXobs_[detIndex] = ObsMove; tXobsErr_[detIndex] = ObsErr; break; - case AlignPCLThresholds::theta_Y: + case AlignPCLThresholdsHG::theta_Y: tYobs_[detIndex] = ObsMove; tYobsErr_[detIndex] = ObsErr; break; - case AlignPCLThresholds::theta_Z: + case AlignPCLThresholdsHG::theta_Z: tZobs_[detIndex] = ObsMove; tZobsErr_[detIndex] = ObsErr; break; From 4bcb8aeacb00c03e4b6c3d96326ff0c72c7216f6 Mon Sep 17 00:00:00 2001 From: mmusich Date: Mon, 13 Jun 2022 09:25:31 +0200 Subject: [PATCH 6/8] supply the AlignPCLThresholdsHGRcd via GlobalTags --- Configuration/AlCa/python/autoCond.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Configuration/AlCa/python/autoCond.py b/Configuration/AlCa/python/autoCond.py index ab56514b97f11..131eab9f15d11 100644 --- a/Configuration/AlCa/python/autoCond.py +++ b/Configuration/AlCa/python/autoCond.py @@ -24,23 +24,23 @@ # GlobalTag for MC production (p-Pb collisions) with realistic alignment and calibrations for Run2 'run2_mc_pa' : '123X_mcRun2_pA_v1', # GlobalTag for Run2 data reprocessing - 'run2_data' : '124X_dataRun2_v1', + 'run2_data' : '124X_dataRun2_v2', # GlobalTag for Run2 data 2018B relvals only: HEM-15-16 fail - 'run2_data_HEfail' : '124X_dataRun2_HEfail_v1', + 'run2_data_HEfail' : '124X_dataRun2_HEfail_v2', # GlobalTag for Run2 data relvals: allows customization to run with fixed L1 menu - 'run2_data_relval' : '124X_dataRun2_relval_v1', + 'run2_data_relval' : '124X_dataRun2_relval_v2', # GlobalTag for Run2 HI data - 'run2_data_promptlike_hi' : '123X_dataRun2_PromptLike_HI_v3', + 'run2_data_promptlike_hi' : '124X_dataRun2_PromptLike_HI_v1', # GlobalTag with fixed snapshot time for Run2 HLT RelVals: customizations to run with fixed L1 Menu 'run2_hlt_relval' : '123X_dataRun2_HLT_relval_v3', # GlobalTag for Run3 HLT: identical to the online GT (124X_dataRun3_HLT_v1) but with snapshot at 2022-06-08 15:00:00 (UTC) 'run3_hlt' : '124X_dataRun3_HLT_frozen_v1', # GlobalTag with fixed snapshot time for Run3 HLT RelVals: customizations to run with fixed L1 Menu 'run3_hlt_relval' : '124X_dataRun3_HLT_relval_v2', - # GlobalTag for Run3 data relvals (express GT) - identical to 123X_dataRun3_Express_v8 but with snapshot at 2022-05-31 20:00:00 (UTC) - 'run3_data_express' : '123X_dataRun3_Express_frozen_v4', - # GlobalTag for Run3 data relvals (prompt GT) - identical to 123X_dataRun3_Prompt_v10 but with snapshot at 2022-05-31 20:00:00 (UTC) - 'run3_data_prompt' : '123X_dataRun3_Prompt_frozen_v4', + # GlobalTag for Run3 data relvals (express GT) - identical to 124X_dataRun3_Express_v1 but with snapshot at 2022-06-09 20:00:00 (UTC) + 'run3_data_express' : '124X_dataRun3_Express_frozen_v1', + # GlobalTag for Run3 data relvals (prompt GT) - identical to 124X_dataRun3_Prompt_v1 but with snapshot at 2022-06-09 20:00:00 (UTC) + 'run3_data_prompt' : '124X_dataRun3_Prompt_frozen_v1', # GlobalTag for Run3 offline data reprocessing 'run3_data' : '124X_dataRun3_v2', # GlobalTag for Run3 data relvals: allows customization to run with fixed L1 menu From 771ab197431e690ca517282daed2fdb3e7ce4992 Mon Sep 17 00:00:00 2001 From: Danilo Meuser Date: Tue, 14 Jun 2022 15:18:37 +0200 Subject: [PATCH 7/8] Fix size of arrays to store new HG thresholds --- .../plugins/MillePedeDQMModule.cc | 20 +++++++++---------- .../plugins/MillePedeDQMModule.h | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.cc b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.cc index 78e02c457a114..fb5139b492471 100644 --- a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.cc +++ b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.cc @@ -132,14 +132,14 @@ void MillePedeDQMModule ::fillStatusHisto(MonitorElement* statusHisto) { } void MillePedeDQMModule ::fillExpertHistos() { - std::array Xcut_, sigXcut_, maxMoveXcut_, maxErrorXcut_; - std::array tXcut_, sigtXcut_, maxMovetXcut_, maxErrortXcut_; + std::array Xcut_, sigXcut_, maxMoveXcut_, maxErrorXcut_; + std::array tXcut_, sigtXcut_, maxMovetXcut_, maxErrortXcut_; - std::array Ycut_, sigYcut_, maxMoveYcut_, maxErrorYcut_; - std::array tYcut_, sigtYcut_, maxMovetYcut_, maxErrortYcut_; + std::array Ycut_, sigYcut_, maxMoveYcut_, maxErrorYcut_; + std::array tYcut_, sigtYcut_, maxMovetYcut_, maxErrortYcut_; - std::array Zcut_, sigZcut_, maxMoveZcut_, maxErrorZcut_; - std::array tZcut_, sigtZcut_, maxMovetZcut_, maxErrortZcut_; + std::array Zcut_, sigZcut_, maxMoveZcut_, maxErrorZcut_; + std::array tZcut_, sigtZcut_, maxMovetZcut_, maxErrortZcut_; auto myMap = mpReader_->getThresholdMap(); @@ -196,10 +196,10 @@ void MillePedeDQMModule ::fillExpertHistos() { } void MillePedeDQMModule ::fillExpertHisto(MonitorElement* histo, - const std::array& cut, - const std::array& sigCut, - const std::array& maxMoveCut, - const std::array& maxErrorCut, + const std::array& cut, + const std::array& sigCut, + const std::array& maxMoveCut, + const std::array& maxErrorCut, const std::array& obs, const std::array& obsErr) { TH1F* histo_0 = histo->getTH1F(); diff --git a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.h b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.h index f8953ec4241d4..e3edaa9d61462 100644 --- a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.h +++ b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.h @@ -64,10 +64,10 @@ class MillePedeDQMModule : public DQMEDHarvester { void fillExpertHistos(); void fillExpertHisto(MonitorElement* histo, - const std::array& cut, - const std::array& sigCut, - const std::array& maxMoveCut, - const std::array& maxErrorCut, + const std::array& cut, + const std::array& sigCut, + const std::array& maxMoveCut, + const std::array& maxErrorCut, const std::array& obs, const std::array& obsErr); From 8f866f7a4775e1d2127354741f8583bf63db5b01 Mon Sep 17 00:00:00 2001 From: Danilo Meuser Date: Tue, 14 Jun 2022 16:00:26 +0200 Subject: [PATCH 8/8] Store length of threshold and LG result array in enums --- .../plugins/MillePedeDQMModule.cc | 24 +++++++++---------- .../plugins/MillePedeDQMModule.h | 14 ++++++----- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.cc b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.cc index fb5139b492471..cae0f4596e82d 100644 --- a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.cc +++ b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.cc @@ -132,14 +132,14 @@ void MillePedeDQMModule ::fillStatusHisto(MonitorElement* statusHisto) { } void MillePedeDQMModule ::fillExpertHistos() { - std::array Xcut_, sigXcut_, maxMoveXcut_, maxErrorXcut_; - std::array tXcut_, sigtXcut_, maxMovetXcut_, maxErrortXcut_; + std::array Xcut_, sigXcut_, maxMoveXcut_, maxErrorXcut_; + std::array tXcut_, sigtXcut_, maxMovetXcut_, maxErrortXcut_; - std::array Ycut_, sigYcut_, maxMoveYcut_, maxErrorYcut_; - std::array tYcut_, sigtYcut_, maxMovetYcut_, maxErrortYcut_; + std::array Ycut_, sigYcut_, maxMoveYcut_, maxErrorYcut_; + std::array tYcut_, sigtYcut_, maxMovetYcut_, maxErrortYcut_; - std::array Zcut_, sigZcut_, maxMoveZcut_, maxErrorZcut_; - std::array tZcut_, sigtZcut_, maxMovetZcut_, maxErrortZcut_; + std::array Zcut_, sigZcut_, maxMoveZcut_, maxErrorZcut_; + std::array tZcut_, sigtZcut_, maxMovetZcut_, maxErrortZcut_; auto myMap = mpReader_->getThresholdMap(); @@ -196,12 +196,12 @@ void MillePedeDQMModule ::fillExpertHistos() { } void MillePedeDQMModule ::fillExpertHisto(MonitorElement* histo, - const std::array& cut, - const std::array& sigCut, - const std::array& maxMoveCut, - const std::array& maxErrorCut, - const std::array& obs, - const std::array& obsErr) { + const std::array& cut, + const std::array& sigCut, + const std::array& maxMoveCut, + const std::array& maxErrorCut, + const std::array& obs, + const std::array& obsErr) { TH1F* histo_0 = histo->getTH1F(); double max_ = *std::max_element(maxMoveCut.begin(), maxMoveCut.end()); diff --git a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.h b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.h index e3edaa9d61462..54346b8623efe 100644 --- a/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.h +++ b/Alignment/MillePedeAlignmentAlgorithm/plugins/MillePedeDQMModule.h @@ -53,6 +53,8 @@ class MillePedeDQMModule : public DQMEDHarvester { void dqmEndJob(DQMStore::IBooker&, DQMStore::IGetter&) override; + enum { SIZE_LG_STRUCTS = 6, SIZE_INDEX = 8 }; + //========================= PRIVATE METHODS ================================== private: //=================================================================== void beginRun(const edm::Run&, const edm::EventSetup&) override; @@ -64,12 +66,12 @@ class MillePedeDQMModule : public DQMEDHarvester { void fillExpertHistos(); void fillExpertHisto(MonitorElement* histo, - const std::array& cut, - const std::array& sigCut, - const std::array& maxMoveCut, - const std::array& maxErrorCut, - const std::array& obs, - const std::array& obsErr); + const std::array& cut, + const std::array& sigCut, + const std::array& maxMoveCut, + const std::array& maxErrorCut, + const std::array& obs, + const std::array& obsErr); bool setupChanged(const edm::EventSetup&); int getIndexFromString(const std::string& alignableId);