diff --git a/Alignment/MillePedeAlignmentAlgorithm/python/alignmentsetup/GeneralSetup.py b/Alignment/MillePedeAlignmentAlgorithm/python/alignmentsetup/GeneralSetup.py index b36fd65083aaa..8d6f5a772dce5 100644 --- a/Alignment/MillePedeAlignmentAlgorithm/python/alignmentsetup/GeneralSetup.py +++ b/Alignment/MillePedeAlignmentAlgorithm/python/alignmentsetup/GeneralSetup.py @@ -1,29 +1,54 @@ from __future__ import print_function -def setup(process, global_tag, zero_tesla = False): +import re + +def setup(process, global_tag, zero_tesla=False, geometry=""): """General setup of an alignment process. Arguments: - `process`: cms.Process object - `global_tag`: global tag to be used - `zero_tesla`: if 'True' the B-field map for 0T is enforced + - `geometry`: geometry to be used (default is an empty string for the standard geometry) """ # MessageLogger for convenient output # -------------------------------------------------------------------------- process.load('Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.myMessageLogger_cff') - # Load the conditions + # Load the magnetic field configuration # -------------------------------------------------------------------------- if zero_tesla: - # actually only needed for 0T MC samples, but does not harm for 0T data: + # For 0T MC samples or data process.load("Configuration.StandardSequences.MagneticField_0T_cff") else: process.load('Configuration.StandardSequences.MagneticField_cff') - process.load('Configuration.Geometry.GeometryRecoDB_cff') + + # Load the geometry + # -------------------------------------------------------------------------- + if geometry == "": + # Default geometry + print(f"Using Geometry from DB") + process.load('Configuration.Geometry.GeometryRecoDB_cff') + else: + # Check if the geometry string matches the format "Extended", e.g. Extended2026D110 + if re.match(r"^Extended\w+$", geometry): + # Dynamically load the specified geometry + geometry_module = f"Configuration.Geometry.Geometry{geometry}Reco_cff" + try: + process.load(geometry_module) + print(f"Using Geometry: {geometry_module}") + except Exception as e: + print(f"Error: Unable to load the geometry module '{geometry_module}'.\n{e}") + raise + else: + raise ValueError(f"Invalid geometry format: '{geometry}'. Expected format is 'Extended'.") + + # Load the conditions (GlobalTag) + # -------------------------------------------------------------------------- process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") from Configuration.AlCa.GlobalTag import GlobalTag process.GlobalTag = GlobalTag(process.GlobalTag, global_tag) print("Using Global Tag:", process.GlobalTag.globaltag._value) - return process # not required because the cms.Process is modified in place + return process # Not required since the cms.Process object is modified in place diff --git a/Alignment/MillePedeAlignmentAlgorithm/scripts/mps_alisetup.py b/Alignment/MillePedeAlignmentAlgorithm/scripts/mps_alisetup.py index 6e213ee9d73ac..1d0cb8339e874 100755 --- a/Alignment/MillePedeAlignmentAlgorithm/scripts/mps_alisetup.py +++ b/Alignment/MillePedeAlignmentAlgorithm/scripts/mps_alisetup.py @@ -255,6 +255,7 @@ def _create_mille_jobs(self): gt_regex = re.compile('setupGlobaltag\s*\=\s*[\"\'](.*?)[\"\']') sg_regex = re.compile("setupRunStartGeometry\s*\=\s*.*$", re.M) collection_regex = re.compile('setupCollection\s*\=\s*[\"\'](.*?)[\"\']') + recogeom_regex = re.compile('setupRecoGeometry\s*\=\s*[\"\'](.*?)[\"\']') czt_regex = re.compile('setupCosmicsZeroTesla\s*\=\s*.*$', re.M) cdm_regex = re.compile('setupCosmicsDecoMode\s*\=\s*.*$', re.M) pw_regex = re.compile('setupPrimaryWidth\s*\=\s*.*$', re.M) @@ -275,6 +276,9 @@ def _create_mille_jobs(self): tmpFile = re.sub(gt_regex, 'setupGlobaltag = \"'+dataset["globaltag"]+'\"', tmpFile) + tmpFile = re.sub(recogeom_regex, + 'setupRecoGeometry = \"'+dataset["recogeometry"]+'\"', + tmpFile) tmpFile = re.sub(sg_regex, "setupRunStartGeometry = "+ self._general_options["FirstRunForStartGeometry"], tmpFile) @@ -353,6 +357,7 @@ def _create_mille_jobs(self): print("cosmicsDecoMode: ", dataset["cosmicsDecoMode"]) print("cosmicsZeroTesla: ", dataset["cosmicsZeroTesla"]) print("Globaltag: ", dataset["globaltag"]) + print("RecoGeometry: ", dataset["recogeometry"]) print("Number of jobs: ", dataset["njobs"]) print("Inputfilelist: ", dataset["inputFileList"]) if dataset["json"] != "": @@ -466,6 +471,9 @@ def _create_additional_pede_jobs(self): tmpFile = re.sub('setupGlobaltag\s*\=\s*[\"\'](.*?)[\"\']', 'setupGlobaltag = \"'+self._global_tag+'\"', tmpFile) + tmpFile = re.sub('setupRecoGeometry\s*\=\s*[\"\'](.*?)[\"\']', + 'setupRecoGeometry = \"'+self._reco_geometry+'\"', + tmpFile) tmpFile = re.sub('setupCollection\s*\=\s*[\"\'](.*?)[\"\']', 'setupCollection = \"'+collection+'\"', tmpFile) @@ -651,6 +659,7 @@ def _create_tracker_tree(self): config = mpsv_iniparser.ConfigData() config.jobDataPath = "." # current directory config.globalTag = self._global_tag + #config.recoGeometry = self._reco_geometry config.firstRun = self._first_run self._tracker_tree_path = mpsv_trackerTree.check(config) @@ -671,7 +680,7 @@ def _fetch_essentials(self): def _fetch_defaults(self): """Fetch default general options from config file.""" - for var in ("globaltag", "configTemplate", "json", "massStorageDir", + for var in ("globaltag", "recogeometry", "configTemplate", "json", "massStorageDir", "testMode"): try: self._general_options[var] = self._config.get("general", var) @@ -681,7 +690,7 @@ def _fetch_defaults(self): for dataset in self._external_datasets.values(): dataset["general"] = {} - for var in ("globaltag", "configTemplate", "json"): + for var in ("globaltag", "recogeometry", "configTemplate", "json"): try: dataset["general"][var] = dataset["config"].get("general", var) except (ConfigParser.NoSectionError,ConfigParser.NoOptionError): @@ -785,6 +794,23 @@ def _fetch_datasets(self): print("and no default in [general] section.") sys.exit(1) + # get recogeometry and configTemplate. If none in section, try to get + # default from [general] section. + for var in ("configTemplate", "recogeometry"): + try: + self._datasets[name][var] = config["config"].get(section, var) + except (ConfigParser.NoSectionError,ConfigParser.NoOptionError): + try: + self._datasets[name][var] = config["general"][var] + except KeyError: + try: + self._datasets[name][var] \ + = all_configs["main"]["general"][var] + except KeyError: + print("No",var,"found in ["+section+"]", end=' ') + print("and no default in [general] section.") + sys.exit(1) + # extract non-essential options if "ALCARECOTkAlCosmics" in self._datasets[name]["collection"]: try: @@ -885,7 +911,7 @@ def _fetch_datasets(self): sys.exit(1) self._global_tag = self._datasets[name]["globaltag"] - + self._reco_geometry = self._datasets[name]["recogeometry"] ################################################################################ if __name__ == "__main__": diff --git a/Alignment/MillePedeAlignmentAlgorithm/templates/alignment_config.ini b/Alignment/MillePedeAlignmentAlgorithm/templates/alignment_config.ini index ac57d4fee72f1..f76b574f6617d 100644 --- a/Alignment/MillePedeAlignmentAlgorithm/templates/alignment_config.ini +++ b/Alignment/MillePedeAlignmentAlgorithm/templates/alignment_config.ini @@ -52,6 +52,8 @@ pedeMem = 32000 datasetdir = /afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/MP/MPproduction/datasetfiles configTemplate = universalConfigTemplate.py globaltag = auto:run2_data +;# empty string defaults to geometry from DB +recogeometry = ;# set this to the run from where you want to start FirstRunForStartGeometry = 0 diff --git a/Alignment/MillePedeAlignmentAlgorithm/templates/universalConfigTemplate.py b/Alignment/MillePedeAlignmentAlgorithm/templates/universalConfigTemplate.py index acf65ccf1c341..ab5bb42e3da0e 100644 --- a/Alignment/MillePedeAlignmentAlgorithm/templates/universalConfigTemplate.py +++ b/Alignment/MillePedeAlignmentAlgorithm/templates/universalConfigTemplate.py @@ -34,10 +34,6 @@ # process.AlignmentProducer.algoConfig.TrajectoryFactory.ParticleProperties.PrimaryWidth = ... # if primaryWidth<=0.0 it has no effect at all. - -import FWCore.ParameterSet.Config as cms -process = cms.Process("Alignment") - ################################################################################ # Variables edited by mps_alisetup.py. Used in functions below. # You can change them manually as well. @@ -46,10 +42,21 @@ setupCollection = "placeholder_collection" setupCosmicsDecoMode = False setupCosmicsZeroTesla = False +setupRecoGeometry = "placeholder_recogeometry" setupPrimaryWidth = -1.0 setupJson = "placeholder_json" setupRunStartGeometry = -1 +import FWCore.ParameterSet.Config as cms +if not setupRecoGeometry: # empty string defaults to DB + from Configuration.Eras.Era_Run3_cff import Run3 + process = cms.Process("Alignment", Run3) +else: + import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings + # need to remove "Extended from the setupRecoGeometry because of defaultPhase2ConditionsEra interface" + _PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(setupRecoGeometry.replace("Extended", "")) + process = cms.Process("Alignment",_PH2_ERA) + ################################################################################ # Variables edited by MPS (mps_setup and mps_merge). Be careful. # ------------------------------------------------------------------------------ @@ -69,7 +76,7 @@ # General setup # ------------------------------------------------------------------------------ import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.GeneralSetup as generalSetup -generalSetup.setup(process, setupGlobaltag, setupCosmicsZeroTesla) +generalSetup.setup(process, setupGlobaltag, setupCosmicsZeroTesla, setupRecoGeometry) ################################################################################ diff --git a/Alignment/MillePedeAlignmentAlgorithm/test/test_mille.py b/Alignment/MillePedeAlignmentAlgorithm/test/test_mille.py index f84cdb87e5167..adcf84d75ed20 100644 --- a/Alignment/MillePedeAlignmentAlgorithm/test/test_mille.py +++ b/Alignment/MillePedeAlignmentAlgorithm/test/test_mille.py @@ -26,6 +26,7 @@ setupCosmicsDecoMode = False setupCosmicsZeroTesla = False setupPrimaryWidth = -1.0 +setupRecoGeometry = "" # empty string defaults to DB setupJson = "" setupRunStartGeometry = 362350 @@ -53,7 +54,7 @@ # General setup # ------------------------------------------------------------------------------ import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.GeneralSetup as generalSetup -generalSetup.setup(process, setupGlobaltag, setupCosmicsZeroTesla) +generalSetup.setup(process, setupGlobaltag, setupCosmicsZeroTesla, setupRecoGeometry) ################################################################################ # setup alignment producer diff --git a/Alignment/MillePedeAlignmentAlgorithm/test/test_pede.py b/Alignment/MillePedeAlignmentAlgorithm/test/test_pede.py index 4434441607632..79e1a9bb30670 100644 --- a/Alignment/MillePedeAlignmentAlgorithm/test/test_pede.py +++ b/Alignment/MillePedeAlignmentAlgorithm/test/test_pede.py @@ -11,6 +11,7 @@ setupCosmicsDecoMode = True setupCosmicsZeroTesla = False setupPrimaryWidth = -1.0 +setupRecoGeometry = "" # empty string defaults to DB setupJson = "placeholder_json" setupRunStartGeometry = 348908 @@ -35,7 +36,7 @@ # General setup # ------------------------------------------------------------------------------ import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.GeneralSetup as generalSetup -generalSetup.setup(process, setupGlobaltag, setupCosmicsZeroTesla) +generalSetup.setup(process, setupGlobaltag, setupCosmicsZeroTesla, setupRecoGeometry) ################################################################################ # setup alignment producer diff --git a/CalibTracker/StandaloneTrackerTopology/test/testStandaloneTrackerTopology.sh b/CalibTracker/StandaloneTrackerTopology/test/testStandaloneTrackerTopology.sh index afa0a21421eae..837ab11b025cb 100755 --- a/CalibTracker/StandaloneTrackerTopology/test/testStandaloneTrackerTopology.sh +++ b/CalibTracker/StandaloneTrackerTopology/test/testStandaloneTrackerTopology.sh @@ -6,4 +6,4 @@ echo " testing CalibTracker/StandalonTrackerTopology" cmsRun ${SCRAM_TEST_PATH}/testStandaloneTrackerTopology_cfg.py || die "Failure using cmsRun testPixelTopologyMapTest_cfg.py (Phase-0 test)" $? cmsRun ${SCRAM_TEST_PATH}/testStandaloneTrackerTopology_cfg.py runNumber=300000 || die "Failure using cmsRun testPixelTopologyMapTest_cfg.py (Phase-1 test)" $? -cmsRun ${SCRAM_TEST_PATH}/testStandaloneTrackerTopology_cfg.py globalTag=auto:phase2_realistic_T21 || die "Failure using cmsRun testPixelTopologyMapTest_cfg.py (Phase-2 test)" $? +cmsRun ${SCRAM_TEST_PATH}/testStandaloneTrackerTopology_cfg.py isPhase2=True || die "Failure using cmsRun testPixelTopologyMapTest_cfg.py (Phase-2 test)" $? diff --git a/CalibTracker/StandaloneTrackerTopology/test/testStandaloneTrackerTopology_cfg.py b/CalibTracker/StandaloneTrackerTopology/test/testStandaloneTrackerTopology_cfg.py index c4896e4e59c96..51f49c21baf95 100644 --- a/CalibTracker/StandaloneTrackerTopology/test/testStandaloneTrackerTopology_cfg.py +++ b/CalibTracker/StandaloneTrackerTopology/test/testStandaloneTrackerTopology_cfg.py @@ -1,7 +1,6 @@ import FWCore.ParameterSet.Config as cms import FWCore.ParameterSet.VarParsing as VarParsing -process = cms.Process("TopologyAnalysis") options = VarParsing.VarParsing("analysis") options.register ('globalTag', @@ -16,8 +15,25 @@ VarParsing.VarParsing.varType.int, # string, int, or float "run number") +options.register ('isPhase2', + False, + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.bool, # string, int, or float + "is phase2?") + options.parseArguments() +################################################################### +# Set default phase-2 settings +################################################################### +import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings +_PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION) + +if(options.isPhase2): + process = cms.Process("TopologyAnalysis",_PH2_ERA) +else: + process = cms.Process("TopologyAnalysis") + ################################################################### # Message logger service ################################################################### @@ -29,9 +45,9 @@ ################################################################### process.load("Configuration.StandardSequences.Services_cff") -if 'phase2' in options.globalTag: - process.load("Configuration.Geometry.GeometryExtended2026D98_cff") - process.load("Configuration.Geometry.GeometryExtended2026D98Reco_cff") +if(options.isPhase2): + process.load("Configuration.Geometry.GeometryExtendedRun4Default_cff") + process.load("Configuration.Geometry.GeometryExtendedRun4DefaultReco_cff") else: process.load("Configuration.StandardSequences.GeometryRecoDB_cff") @@ -40,7 +56,10 @@ #################################################################### process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, options.globalTag, '') +if(options.isPhase2): + process.GlobalTag = GlobalTag(process.GlobalTag, _PH2_GLOBAL_TAG, '') +else: + process.GlobalTag = GlobalTag(process.GlobalTag, options.globalTag, '') ################################################################### # Empty Source diff --git a/Calibration/HcalAlCaRecoProducers/plugins/BuildFile.xml b/Calibration/HcalAlCaRecoProducers/plugins/BuildFile.xml index 92ea6aec81373..494aad6ad808c 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/BuildFile.xml +++ b/Calibration/HcalAlCaRecoProducers/plugins/BuildFile.xml @@ -26,7 +26,6 @@ - diff --git a/CondCore/HLTPlugins/plugins/AlCaRecoTriggerBits_PayloadInspector.cc b/CondCore/HLTPlugins/plugins/AlCaRecoTriggerBits_PayloadInspector.cc index e0a19b97ad082..d4206508702ae 100644 --- a/CondCore/HLTPlugins/plugins/AlCaRecoTriggerBits_PayloadInspector.cc +++ b/CondCore/HLTPlugins/plugins/AlCaRecoTriggerBits_PayloadInspector.cc @@ -3,13 +3,15 @@ #include "CondCore/CondDB/interface/Time.h" #include "CondFormats/HLTObjects/interface/AlCaRecoTriggerBits.h" -#include -#include -#include -#include #include "TCanvas.h" #include "TLatex.h" #include "TLine.h" +#include +#include +#include +#include +#include +#include namespace { @@ -22,106 +24,133 @@ namespace { public: AlCaRecoTriggerBits_Display() : PlotImage("Table of AlCaRecoTriggerBits") {} + using TriggerMap = std::map; + bool fill() override { auto tag = PlotBase::getTag<0>(); auto iov = tag.iovs.front(); - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - std::string IOVsince = std::to_string(std::get<0>(iov)); + auto tagname = tag.name; + std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - // Get map of strings to concatenated list of names of HLT paths: - typedef std::map TriggerMap; - const TriggerMap &triggerMap = payload->m_alcarecoToTrig; + if (payload.get()) { + const TriggerMap &triggerMap = payload->m_alcarecoToTrig; - unsigned int mapsize = triggerMap.size(); - float pitch = 1. / (mapsize * 1.1); + // pre-compute how many time we break the line + const int totalCarriageReturns = calculateTotalCarriageReturns(payload); + LogDebug("AlCaRecoTriggerBits_Display") << "Total number of carriage returns: " << totalCarriageReturns; - float y, x1, x2; - std::vector y_x1, y_x2, y_line; - std::vector s_x1, s_x2, s_x3; + // Dynamically calculate the pitch and canvas height + float pitch = 1.0 / (totalCarriageReturns + 2.0); // Adjusted pitch for better spacing - // starting table at y=1.0 (top of the canvas) - // first column is at 0.02, second column at 0.32 NDC - y = 1.0; - x1 = 0.02; - x2 = x1 + 0.30; + float y = 1.0; + float x1 = 0.02, x2 = x1 + 0.25; + std::vector y_x1, y_x2, y_line; + std::vector s_x1, s_x2; - y -= pitch; - y_x1.push_back(y); - s_x1.push_back("#scale[1.2]{Key}"); - y_x2.push_back(y); - s_x2.push_back("#scale[1.2]{tag: " + tag.name + " in IOV: " + IOVsince + "}"); - - y -= pitch / 2.; - y_line.push_back(y); - - for (const auto &element : triggerMap) { + // Header row setup y -= pitch; y_x1.push_back(y); - s_x1.push_back(element.first); + s_x1.push_back("#scale[1.2]{Key}"); + y_x2.push_back(y); + s_x2.push_back("#scale[1.2]{tag: " + tagname + " in IOV: " + IOVsince + "}"); + + y -= pitch / 2.0; + y_line.push_back(y); + + // Populate rows with data from the trigger map + for (const auto &element : triggerMap) { + y -= pitch; + y_x1.push_back(y); + s_x1.push_back(element.first); + std::vector output; + + std::string toAppend = ""; + const std::vector paths = payload->decompose(element.second); + for (unsigned int iPath = 0; iPath < paths.size(); ++iPath) { + if ((toAppend + paths[iPath]).length() < 80) { // Wider lines + toAppend += paths[iPath] + ";"; + } else { + output.push_back(toAppend); + toAppend.clear(); + toAppend += paths[iPath] + ";"; + } + if (iPath == paths.size() - 1) + output.push_back(toAppend); + } - std::vector output; - std::string toAppend = ""; - const std::vector paths = payload->decompose(element.second); - for (unsigned int iPath = 0; iPath < paths.size(); ++iPath) { - // if the line to be added has less than 60 chars append to current - if ((toAppend + paths[iPath]).length() < 60) { - toAppend += paths[iPath] + ";"; - } else { - // else if the line exceeds 60 chars, dump in the vector and resume from scratch - output.push_back(toAppend); - toAppend.clear(); - toAppend += paths[iPath] + ";"; + for (unsigned int br = 0; br < output.size(); br++) { + y_x2.push_back(y); + s_x2.push_back("#color[2]{" + output[br] + "}"); + if (br != output.size() - 1) + y -= pitch; } - // if it's the last, dump it - if (iPath == paths.size() - 1) - output.push_back(toAppend); + + y_line.push_back(y - (pitch / 2.0)); } - for (unsigned int br = 0; br < output.size(); br++) { - y_x2.push_back(y); - s_x2.push_back("#color[2]{" + output[br] + "}"); - if (br != output.size() - 1) - y -= pitch; + // Dynamically calculate the pitch and canvas height + float canvasHeight = std::max(800.0f, totalCarriageReturns * 30.0f); // Adjust canvas height based on entries + TCanvas canvas("AlCaRecoTriggerBits", "AlCaRecoTriggerBits", 2000, static_cast(canvasHeight)); + + TLatex l; + l.SetTextAlign(12); + float textSize = std::clamp(pitch, 0.015f, 0.035f); + l.SetTextSize(textSize); + + // Draw the columns + int totalPitches = 0; + canvas.cd(); + for (unsigned int i = 0; i < y_x1.size(); i++) { + l.DrawLatexNDC(x1, y_x1[i], s_x1[i].c_str()); + if (i != 0) { + LogDebug("AlCaRecoTriggerBits_Display") + << "x1:" << x1 << " y_x1[" << std::setw(2) << i << "]: " << y_x1[i] + << " Delta = " << std::ceil((y_x1[i - 1] - y_x1[i]) / pitch) << " pitches " << s_x1[i].c_str(); + totalPitches += std::ceil((y_x1[i - 1] - y_x1[i]) / pitch); + } } - y_line.push_back(y - (pitch / 2.)); - } + LogDebug("AlCaRecoTriggerBits_Display") << "We've gone down by " << totalPitches << "pitches "; - TCanvas canvas("AlCaRecoTriggerBits", "AlCaRecoTriggerBits", 2000, std::max(y_x1.size(), y_x2.size()) * 40); - TLatex l; - // Draw the columns titles - l.SetTextAlign(12); + for (unsigned int i = 0; i < y_x2.size(); i++) { + l.DrawLatexNDC(x2, y_x2[i], s_x2[i].c_str()); + } - float newpitch = 1 / (std::max(y_x1.size(), y_x2.size()) * 1.1); - float factor = newpitch / pitch; - l.SetTextSize(newpitch - 0.002); - canvas.cd(); - for (unsigned int i = 0; i < y_x1.size(); i++) { - l.DrawLatexNDC(x1, 1 - (1 - y_x1[i]) * factor, s_x1[i].c_str()); - } + // Draw lines for row separation + TLine lines[y_line.size()]; + for (unsigned int i = 0; i < y_line.size(); i++) { + lines[i] = TLine(gPad->GetUxmin(), y_line[i], gPad->GetUxmax(), y_line[i]); + lines[i].SetLineWidth(1); + lines[i].SetLineStyle(9); + lines[i].SetLineColor(2); + lines[i].Draw("same"); + } - for (unsigned int i = 0; i < y_x2.size(); i++) { - l.DrawLatexNDC(x2, 1 - (1 - y_x2[i]) * factor, s_x2[i].c_str()); + canvas.SaveAs(m_imageFileName.c_str()); } + return true; + } - canvas.cd(); - canvas.Update(); + private: + int calculateTotalCarriageReturns(std::shared_ptr payload) { + int totalCarriageReturns = 0; + const TriggerMap &triggerMap = payload->m_alcarecoToTrig; - TLine lines[y_line.size()]; - unsigned int iL = 0; - for (const auto &line : y_line) { - lines[iL] = TLine(gPad->GetUxmin(), 1 - (1 - line) * factor, gPad->GetUxmax(), 1 - (1 - line) * factor); - lines[iL].SetLineWidth(1); - lines[iL].SetLineStyle(9); - lines[iL].SetLineColor(2); - lines[iL].Draw("same"); - iL++; + for (const auto &element : triggerMap) { + const auto &paths = payload->decompose(element.second); + int lineLength = 0; + + for (const auto &path : paths) { + lineLength += path.length() + 1; // +1 for the semicolon + if (lineLength >= 80) { + totalCarriageReturns++; + lineLength = path.length() + 1; // Reset for the next line segment + } + } + totalCarriageReturns++; // Count the initial line for each element } - - std::string fileName(m_imageFileName); - canvas.SaveAs(fileName.c_str()); - return true; + return totalCarriageReturns; } }; diff --git a/CondTools/BeamSpot/test/BeamSpotOnlineFromOfflineConverter_cfg.py b/CondTools/BeamSpot/test/BeamSpotOnlineFromOfflineConverter_cfg.py index 69269ab222fc8..26b79f35afe98 100644 --- a/CondTools/BeamSpot/test/BeamSpotOnlineFromOfflineConverter_cfg.py +++ b/CondTools/BeamSpot/test/BeamSpotOnlineFromOfflineConverter_cfg.py @@ -39,12 +39,19 @@ VarParsing.VarParsing.multiplicity.singleton, # singleton or list VarParsing.VarParsing.varType.int, # string, int, or float "IOV Start Lumi") +options.register('maxIOVtoProcess', + 999, # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.int, # string, int, or float + "max number of IOVs (events) to process") options.parseArguments() process.load("FWCore.MessageService.MessageLogger_cfi") process.MessageLogger.cerr.FwkReport.reportEvery = 100000 # do not clog output with IO -process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(999)) +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(options.maxIOVtoProcess) +) #################################################################### # Empty source @@ -53,7 +60,7 @@ firstRun = cms.untracked.uint32(options.startRun), firstLuminosityBlock = cms.untracked.uint32(options.startLumi), numberEventsInLuminosityBlock = cms.untracked.uint32(1), - numberEventsInRun = cms.untracked.uint32(999)) + numberEventsInRun = cms.untracked.uint32(options.maxIOVtoProcess)) #################################################################### # Connect to conditions DB diff --git a/CondTools/RunInfo/interface/LHCInfoHelper.h b/CondTools/RunInfo/interface/LHCInfoHelper.h index 61d005c287a17..60d96ed89a475 100644 --- a/CondTools/RunInfo/interface/LHCInfoHelper.h +++ b/CondTools/RunInfo/interface/LHCInfoHelper.h @@ -11,6 +11,9 @@ namespace cond { // Large number of LS for the OMS query, covering around 25 hours static constexpr unsigned int kLumisectionsQueryLimit = 4000; + // last Run number and LS number of the specified Fill + std::pair getFillLastRunAndLS(const cond::OMSService& oms, unsigned short fillId); + // Returns lumi-type IOV from last LS of last Run of the specified Fill cond::Time_t getFillLastLumiIOV(const cond::OMSService& oms, unsigned short fillId); diff --git a/CondTools/RunInfo/interface/LHCInfoPerFillPopConSourceHandler.h b/CondTools/RunInfo/interface/LHCInfoPerFillPopConSourceHandler.h new file mode 100644 index 0000000000000..9a0a5185258fc --- /dev/null +++ b/CondTools/RunInfo/interface/LHCInfoPerFillPopConSourceHandler.h @@ -0,0 +1,55 @@ +#include "CondCore/PopCon/interface/PopConSourceHandler.h" +#include "CondFormats/RunInfo/interface/LHCInfoPerFill.h" +#include "CondTools/RunInfo/interface/OMSAccess.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +class LHCInfoPerFillPopConSourceHandler : public popcon::PopConSourceHandler { +public: + LHCInfoPerFillPopConSourceHandler(edm::ParameterSet const& pset); + ~LHCInfoPerFillPopConSourceHandler() override = default; + + void getNewObjects() override; + std::string id() const override; + +private: + void addEmptyPayload(cond::Time_t iov); + + // Add payload to buffer and store corresponding lumiid IOV in m_timestampToLumiid map + void addPayloadToBuffer(cond::OMSServiceResultRef& row); + void convertBufferedIovsToLumiid(std::map timestampToLumiid); + + size_t getLumiData(const cond::OMSService& oms, + unsigned short fillId, + const boost::posix_time::ptime& beginFillTime, + const boost::posix_time::ptime& endFillTime); + + void getDipData(const cond::OMSService& oms, + const boost::posix_time::ptime& beginFillTime, + const boost::posix_time::ptime& endFillTime); + + bool getCTPPSData(cond::persistency::Session& session, + const boost::posix_time::ptime& beginFillTime, + const boost::posix_time::ptime& endFillTime); + + bool getEcalData(cond::persistency::Session& session, + const boost::posix_time::ptime& lowerTime, + const boost::posix_time::ptime& upperTime); + +private: + bool m_debug; + // starting date for sampling + boost::posix_time::ptime m_startTime; + boost::posix_time::ptime m_endTime; + bool m_endFillMode = true; + std::string m_name; + //for reading from relational database source + std::string m_connectionString, m_ecalConnectionString; + std::string m_authpath; + std::string m_omsBaseUrl; + std::unique_ptr m_fillPayload; + std::shared_ptr m_prevPayload; + std::vector>> m_tmpBuffer; + bool m_lastPayloadEmpty = false; + // to hold correspondance between timestamp-type IOVs and lumiid-type IOVs + std::map m_timestampToLumiid; +}; diff --git a/CondTools/RunInfo/interface/LHCInfoPerLSPopConSourceHandler.h b/CondTools/RunInfo/interface/LHCInfoPerLSPopConSourceHandler.h new file mode 100644 index 0000000000000..0578663626030 --- /dev/null +++ b/CondTools/RunInfo/interface/LHCInfoPerLSPopConSourceHandler.h @@ -0,0 +1,82 @@ +#ifndef LHCInfoPerLSPopConSourceHandler_h +#define LHCInfoPerLSPopConSourceHandler_h + +#include "CondCore/PopCon/interface/PopConSourceHandler.h" +#include "CondFormats/RunInfo/interface/LHCInfoPerLS.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CondTools/RunInfo/interface/OMSAccess.h" +#include +#include +#include +#include +#include + +class LHCInfoPerLSPopConSourceHandler : public popcon::PopConSourceHandler { +public: + LHCInfoPerLSPopConSourceHandler(edm::ParameterSet const& pset); + ~LHCInfoPerLSPopConSourceHandler() override; + void getNewObjects() override; + std::string id() const override; + +private: + void populateIovs(); + void filterInvalidPayloads(); + bool isPayloadValid(const LHCInfoPerLS& payload) const; + void addEmptyPayload(cond::Time_t iov); + void addDefaultPayload(cond::Time_t iov, unsigned short fill, const cond::OMSService& oms); + void addDefaultPayload(cond::Time_t iov, unsigned short fill, int run, unsigned short lumi); + bool makeFillPayload(std::unique_ptr& targetPayload, const cond::OMSServiceResult& queryResult); + void addPayloadToBuffer(cond::OMSServiceResultRef& row); + size_t bufferAllLS(const cond::OMSServiceResult& queryResult); + size_t getLumiData(const cond::OMSService& oms, + unsigned short fillId, + const boost::posix_time::ptime& beginFillTime, + const boost::posix_time::ptime& endFillTime); + bool getCTPPSData(cond::persistency::Session& session, + const boost::posix_time::ptime& beginFillTime, + const boost::posix_time::ptime& endFillTime); + + bool m_debug; + // starting date for sampling + boost::posix_time::ptime m_startTime; + boost::posix_time::ptime m_endTime; + bool m_endFillMode = true; + std::string m_name; + // for reading from relational database source + std::string m_connectionString; + std::string m_authpath; + std::string m_omsBaseUrl; + // Allows for basic test of durigFill mode when there is no Stable Beams in LHC + // makes duringFill interpret fills as ongoing fill and writing their last LS + // (disabling the check if the last LS is in stable beams, + // although still only fills with stable beams are being processed + // also, still only up to one payload will be written) + const bool m_debugLogic; + // values for the default payload which is inserted after the last processed fill + // has ended and there's no ongoing stable beam yet: + float m_defaultCrossingAngleX; + float m_defaultCrossingAngleY; + float m_defaultBetaStarX; + float m_defaultBetaStarY; + float m_minBetaStar; // meters + float m_maxBetaStar; // meters + float m_minCrossingAngle; // urad + float m_maxCrossingAngle; // urad + + std::unique_ptr m_fillPayload; + std::shared_ptr m_prevPayload; + cond::Time_t m_startFillTime; + cond::Time_t m_endFillTime; + cond::Time_t m_prevEndFillTime = 0; + cond::Time_t m_prevStartFillTime; + cond::Time_t m_startStableBeamTime; + cond::Time_t m_endStableBeamTime; + std::vector>> m_tmpBuffer; + bool m_lastPayloadEmpty = false; + // mapping of lumisections IDs (pairs of runnumber an LS number) found in OMS to + // the IDs they've been assignd from PPS DB value pair(-1, -1) means lumisection + // corresponding to the key exists in OMS but no lumisection was matched from PPS + std::map, std::pair> m_lsIdMap; +}; + +#endif \ No newline at end of file diff --git a/CondTools/RunInfo/interface/LHCInfoPopConSourceHandler.h b/CondTools/RunInfo/interface/LHCInfoPopConSourceHandler.h index 6139ba4becd26..4f5a2dd8a4e0b 100644 --- a/CondTools/RunInfo/interface/LHCInfoPopConSourceHandler.h +++ b/CondTools/RunInfo/interface/LHCInfoPopConSourceHandler.h @@ -18,8 +18,6 @@ class LHCInfoPopConSourceHandler : public popcon::PopConSourceHandler { void getNewObjects() override; std::string id() const override; - static constexpr unsigned int kLumisectionsQueryLimit = 4000; // enough for fills not exceeding 25h - private: void addEmptyPayload(cond::Time_t iov); diff --git a/CondTools/RunInfo/plugins/BuildFile.xml b/CondTools/RunInfo/plugins/BuildFile.xml index 9616cb9213904..fddb5283b8496 100644 --- a/CondTools/RunInfo/plugins/BuildFile.xml +++ b/CondTools/RunInfo/plugins/BuildFile.xml @@ -59,6 +59,10 @@ + + + + @@ -67,10 +71,14 @@ + + + + - + diff --git a/CondTools/RunInfo/plugins/LHCInfoPerFillOnlinePopConAnalyzer.cc b/CondTools/RunInfo/plugins/LHCInfoPerFillOnlinePopConAnalyzer.cc new file mode 100644 index 0000000000000..700052917ccde --- /dev/null +++ b/CondTools/RunInfo/plugins/LHCInfoPerFillOnlinePopConAnalyzer.cc @@ -0,0 +1,7 @@ +#include "CondCore/PopCon/interface/OnlinePopConAnalyzer.h" +#include "CondTools/RunInfo/interface/LHCInfoPerFillPopConSourceHandler.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +typedef popcon::OnlinePopConAnalyzer LHCInfoPerFillOnlinePopConAnalyzer; + +DEFINE_FWK_MODULE(LHCInfoPerFillOnlinePopConAnalyzer); diff --git a/CondTools/RunInfo/plugins/LHCInfoPerFillPopConAnalyzer.cc b/CondTools/RunInfo/plugins/LHCInfoPerFillPopConAnalyzer.cc index c87e36815e557..673ea289e788f 100644 --- a/CondTools/RunInfo/plugins/LHCInfoPerFillPopConAnalyzer.cc +++ b/CondTools/RunInfo/plugins/LHCInfoPerFillPopConAnalyzer.cc @@ -1,753 +1,7 @@ -#include "CondCore/CondDB/interface/ConnectionPool.h" #include "CondCore/PopCon/interface/PopConAnalyzer.h" -#include "CondCore/PopCon/interface/PopConSourceHandler.h" -#include "CondFormats/Common/interface/TimeConversions.h" -#include "CondFormats/RunInfo/interface/LHCInfoPerFill.h" -#include "CondTools/RunInfo/interface/LumiSectionFilter.h" -#include "CondTools/RunInfo/interface/LHCInfoHelper.h" -#include "CondTools/RunInfo/interface/OMSAccess.h" -#include "CoralBase/Attribute.h" -#include "CoralBase/AttributeList.h" -#include "CoralBase/AttributeSpecification.h" -#include "CoralBase/TimeStamp.h" +#include "CondTools/RunInfo/interface/LHCInfoPerFillPopConSourceHandler.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ParameterSet/interface/ParameterSetfwd.h" -#include "RelationalAccess/ICursor.h" -#include "RelationalAccess/IQuery.h" -#include "RelationalAccess/ISchema.h" -#include "RelationalAccess/ISessionProxy.h" - -class LHCInfoPerFillPopConSourceHandler; typedef popcon::PopConAnalyzer LHCInfoPerFillPopConAnalyzer; //define this as a plug-in DEFINE_FWK_MODULE(LHCInfoPerFillPopConAnalyzer); - -namespace cond { - namespace theLHCInfoPerFillPopConImpl { - - static const std::pair s_fillTypeMap[] = { - std::make_pair("PROTONS", LHCInfoPerFill::PROTONS), - std::make_pair("IONS", LHCInfoPerFill::IONS), - std::make_pair("COSMICS", LHCInfoPerFill::COSMICS), - std::make_pair("GAP", LHCInfoPerFill::GAP)}; - - static const std::pair s_particleTypeMap[] = { - std::make_pair("PROTON", LHCInfoPerFill::PROTON), - std::make_pair("PB82", LHCInfoPerFill::PB82), - std::make_pair("AR18", LHCInfoPerFill::AR18), - std::make_pair("D", LHCInfoPerFill::D), - std::make_pair("XE54", LHCInfoPerFill::XE54)}; - - LHCInfoPerFill::FillType fillTypeFromString(const std::string& s_fill_type) { - for (auto const& i : s_fillTypeMap) - if (s_fill_type == i.first) - return i.second; - return LHCInfoPerFill::UNKNOWN; - } - - LHCInfoPerFill::ParticleType particleTypeFromString(const std::string& s_particle_type) { - for (auto const& i : s_particleTypeMap) - if (s_particle_type == i.first) - return i.second; - return LHCInfoPerFill::NONE; - } - } // namespace theLHCInfoPerFillPopConImpl - - namespace impl { - - template <> - LHCInfoPerFill::FillType from_string(const std::string& attributeValue) { - return from_string_impl( - attributeValue, LHCInfoPerFill::UNKNOWN); - } - - template <> - LHCInfoPerFill::ParticleType from_string(const std::string& attributeValue) { - return from_string_impl( - attributeValue, LHCInfoPerFill::NONE); - } - - } // namespace impl -} // namespace cond - -namespace theLHCInfoPerFillImpl { - - bool makeFillPayload(std::unique_ptr& targetPayload, const cond::OMSServiceResult& queryResult) { - bool ret = false; - if (!queryResult.empty()) { - auto row = *queryResult.begin(); - auto currentFill = row.get("fill_number"); - auto bunches1 = row.get("bunches_beam1"); - auto bunches2 = row.get("bunches_beam2"); - auto collidingBunches = row.get("bunches_colliding"); - auto targetBunches = row.get("bunches_target"); - auto fillType = row.get("fill_type_runtime"); - auto particleType1 = row.get("fill_type_party1"); - auto particleType2 = row.get("fill_type_party2"); - auto intensityBeam1 = row.get("intensity_beam1"); - auto intensityBeam2 = row.get("intensity_beam2"); - auto energy = row.get("energy"); - auto creationTime = row.get("start_time"); - auto stableBeamStartTime = row.get("start_stable_beam"); - std::string endTimeStr = row.get("end_time"); - auto beamDumpTime = - (endTimeStr == "null") ? 0 : cond::time::from_boost(row.get("end_time")); - auto injectionScheme = row.get("injection_scheme"); - targetPayload = std::make_unique(); - targetPayload->setFillNumber(currentFill); - targetPayload->setBunchesInBeam1(bunches1); - targetPayload->setBunchesInBeam2(bunches2); - targetPayload->setCollidingBunches(collidingBunches); - targetPayload->setTargetBunches(targetBunches); - targetPayload->setFillType(fillType); - targetPayload->setParticleTypeForBeam1(particleType1); - targetPayload->setParticleTypeForBeam2(particleType2); - targetPayload->setIntensityForBeam1(intensityBeam1); - targetPayload->setIntensityForBeam2(intensityBeam2); - targetPayload->setEnergy(energy); - targetPayload->setCreationTime(cond::time::from_boost(creationTime)); - targetPayload->setBeginTime(cond::time::from_boost(stableBeamStartTime)); - targetPayload->setEndTime(beamDumpTime); - targetPayload->setInjectionScheme(injectionScheme); - ret = true; - } - return ret; - } -} // namespace theLHCInfoPerFillImpl - -namespace theLHCInfoPerFillImpl { - static const std::map vecMap = { - {"Beam1/beamPhaseMean", 1}, {"Beam2/beamPhaseMean", 2}, {"Beam1/cavPhaseMean", 3}, {"Beam2/cavPhaseMean", 4}}; - void setElementData(cond::Time_t since, - const std::string& dipVal, - unsigned int elementNr, - float value, - LHCInfoPerFill& payload, - std::set& initList) { - if (initList.find(since) == initList.end()) { - payload.beam1VC().resize(LHCInfoPerFill::bunchSlots, 0.); - payload.beam2VC().resize(LHCInfoPerFill::bunchSlots, 0.); - payload.beam1RF().resize(LHCInfoPerFill::bunchSlots, 0.); - payload.beam2RF().resize(LHCInfoPerFill::bunchSlots, 0.); - initList.insert(since); - } - // set the current values to all of the payloads of the lumi section samples after the current since - if (elementNr < LHCInfoPerFill::bunchSlots) { - switch (vecMap.at(dipVal)) { - case 1: - payload.beam1VC()[elementNr] = value; - break; - case 2: - payload.beam2VC()[elementNr] = value; - break; - case 3: - payload.beam1RF()[elementNr] = value; - break; - case 4: - payload.beam2RF()[elementNr] = value; - break; - default: - break; - } - } - } -} // namespace theLHCInfoPerFillImpl - -namespace theLHCInfoPerFillImpl { - bool comparePayloads(const LHCInfoPerFill& rhs, const LHCInfoPerFill& lhs) { - if (rhs.fillNumber() != lhs.fillNumber() || rhs.delivLumi() != lhs.delivLumi() || rhs.recLumi() != lhs.recLumi() || - rhs.instLumi() != lhs.instLumi() || rhs.instLumiError() != lhs.instLumiError() || - rhs.lhcState() != lhs.lhcState() || rhs.lhcComment() != lhs.lhcComment() || - rhs.ctppsStatus() != lhs.ctppsStatus()) { - return false; - } - return true; - } - - size_t transferPayloads(const std::vector>>& buffer, - std::map>& iovsToTransfer, - std::shared_ptr& prevPayload) { - size_t niovs = 0; - std::stringstream condIovs; - std::stringstream formattedIovs; - for (auto& iov : buffer) { - bool add = false; - auto payload = iov.second; - cond::Time_t since = iov.first; - if (iovsToTransfer.empty()) { - add = true; - } else { - LHCInfoPerFill& lastAdded = *iovsToTransfer.rbegin()->second; - if (!comparePayloads(lastAdded, *payload)) { - add = true; - } - } - if (add) { - niovs++; - condIovs << since << " "; - formattedIovs << boost::posix_time::to_iso_extended_string(cond::time::to_boost(since)) << " "; - iovsToTransfer.insert(std::make_pair(since, payload)); - prevPayload = iov.second; - } - } - edm::LogInfo("transferPayloads") << "TRANSFERED IOVS: " << condIovs.str(); - edm::LogInfo("transferPayloads") << "FORMATTED TRANSFERED IOVS: " << formattedIovs.str(); - return niovs; - } - -} // namespace theLHCInfoPerFillImpl -class LHCInfoPerFillPopConSourceHandler : public popcon::PopConSourceHandler { -public: - LHCInfoPerFillPopConSourceHandler(edm::ParameterSet const& pset) - : m_debug(pset.getUntrackedParameter("debug", false)), - m_startTime(), - m_endTime(), - m_endFillMode(pset.getUntrackedParameter("endFill", true)), - m_name(pset.getUntrackedParameter("name", "LHCInfoPerFillPopConSourceHandler")), - m_connectionString(pset.getUntrackedParameter("connectionString", "")), - m_ecalConnectionString(pset.getUntrackedParameter("ecalConnectionString", "")), - m_authpath(pset.getUntrackedParameter("authenticationPath", "")), - m_omsBaseUrl(pset.getUntrackedParameter("omsBaseUrl", "")), - m_fillPayload(), - m_prevPayload(), - m_tmpBuffer() { - if (!pset.getUntrackedParameter("startTime").empty()) { - m_startTime = boost::posix_time::time_from_string(pset.getUntrackedParameter("startTime")); - } - boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); - m_endTime = now; - if (!pset.getUntrackedParameter("endTime").empty()) { - m_endTime = boost::posix_time::time_from_string(pset.getUntrackedParameter("endTime")); - if (m_endTime > now) - m_endTime = now; - } - } - - ~LHCInfoPerFillPopConSourceHandler() override = default; - - void getNewObjects() override { - //if a new tag is created, transfer fake fill from 1 to the first fill for the first time - if (tagInfo().size == 0) { - edm::LogInfo(m_name) << "New tag " << tagInfo().name << "; from " << m_name << "::getNewObjects"; - } else { - //check what is already inside the database - edm::LogInfo(m_name) << "got info for tag " << tagInfo().name << ": size " << tagInfo().size - << ", last object valid since " << tagInfo().lastInterval.since << " ( " - << boost::posix_time::to_iso_extended_string( - cond::time::to_boost(tagInfo().lastInterval.since)) - << " ); from " << m_name << "::getNewObjects"; - } - - cond::Time_t lastSince = tagInfo().lastInterval.since; - if (tagInfo().isEmpty()) { - // for a new or empty tag, an empty payload should be added on top with since=1 - if (m_endFillMode) { - addEmptyPayload(1); - lastSince = 1; - } else { - addEmptyPayload(cond::time::lumiTime(1, 1)); - lastSince = cond::time::lumiTime(1, 1); - } - } else { - edm::LogInfo(m_name) << "The last Iov in tag " << tagInfo().name << " valid since " << lastSince << "from " - << m_name << "::getNewObjects"; - } - - //retrieve the data from the relational database source - cond::persistency::ConnectionPool connection; - //configure the connection - if (m_debug) { - connection.setMessageVerbosity(coral::Debug); - } else { - connection.setMessageVerbosity(coral::Error); - } - connection.setAuthenticationPath(m_authpath); - connection.configure(); - //create the sessions - cond::persistency::Session session = connection.createSession(m_connectionString, false); - cond::persistency::Session session2 = connection.createSession(m_ecalConnectionString, false); - // fetch last payload when available - if (!tagInfo().lastInterval.payloadId.empty()) { - cond::persistency::Session session3 = dbSession(); - session3.transaction().start(true); - m_prevPayload = session3.fetchPayload(tagInfo().lastInterval.payloadId); - session3.transaction().commit(); - } - - boost::posix_time::ptime executionTime = boost::posix_time::second_clock::local_time(); - cond::Time_t executionTimeIov = cond::time::from_boost(executionTime); - - cond::Time_t startTimestamp = m_startTime.is_not_a_date_time() ? 0 : cond::time::from_boost(m_startTime); - cond::Time_t nextFillSearchTimestamp = - std::max(startTimestamp, m_endFillMode ? lastSince : m_prevPayload->createTime()); - - edm::LogInfo(m_name) << "Starting sampling at " - << boost::posix_time::to_simple_string(cond::time::to_boost(nextFillSearchTimestamp)); - - while (true) { - if (nextFillSearchTimestamp >= executionTimeIov) { - edm::LogInfo(m_name) << "Sampling ended at the time " - << boost::posix_time::to_simple_string(cond::time::to_boost(executionTimeIov)); - break; - } - boost::posix_time::ptime nextFillSearchTime = cond::time::to_boost(nextFillSearchTimestamp); - boost::posix_time::ptime startSampleTime; - boost::posix_time::ptime endSampleTime; - - cond::OMSService oms; - oms.connect(m_omsBaseUrl); - auto query = oms.query("fills"); - - edm::LogInfo(m_name) << "Searching new fill after " << boost::posix_time::to_simple_string(nextFillSearchTime); - query->filterNotNull("start_stable_beam").filterNotNull("fill_number"); - if (nextFillSearchTime > cond::time::to_boost(m_prevPayload->createTime())) { - query->filterGE("start_time", nextFillSearchTime); - } else { - query->filterGT("start_time", nextFillSearchTime); - } - - query->filterLT("start_time", m_endTime); - if (m_endFillMode) - query->filterNotNull("end_time"); - bool foundFill = query->execute(); - if (foundFill) - foundFill = theLHCInfoPerFillImpl::makeFillPayload(m_fillPayload, query->result()); - if (!foundFill) { - edm::LogInfo(m_name) << "No fill found - END of job."; - break; - } - - startSampleTime = cond::time::to_boost(m_fillPayload->createTime()); - cond::Time_t startFillTime = m_fillPayload->createTime(); - cond::Time_t endFillTime = m_fillPayload->endTime(); - unsigned short lhcFill = m_fillPayload->fillNumber(); - bool ongoingFill = endFillTime == 0ULL; - if (ongoingFill) { - edm::LogInfo(m_name) << "Found ongoing fill " << lhcFill << " created at " - << cond::time::to_boost(startFillTime); - endSampleTime = executionTime; - nextFillSearchTimestamp = executionTimeIov; - } else { - edm::LogInfo(m_name) << "Found fill " << lhcFill << " created at " << cond::time::to_boost(startFillTime) - << " ending at " << cond::time::to_boost(endFillTime); - endSampleTime = cond::time::to_boost(endFillTime); - nextFillSearchTimestamp = endFillTime; - } - if (m_endFillMode || ongoingFill) { - getDipData(oms, startSampleTime, endSampleTime); - getLumiData(oms, lhcFill, startSampleTime, endSampleTime); - if (!m_tmpBuffer.empty()) { - boost::posix_time::ptime flumiStart = cond::time::to_boost(m_tmpBuffer.front().first); - boost::posix_time::ptime flumiStop = cond::time::to_boost(m_tmpBuffer.back().first); - edm::LogInfo(m_name) << "First lumi starts at " << flumiStart << " last lumi starts at " << flumiStop; - session.transaction().start(true); - getCTPPSData(session, startSampleTime, endSampleTime); - session.transaction().commit(); - session2.transaction().start(true); - getEcalData(session2, startSampleTime, endSampleTime); - session2.transaction().commit(); - } - } - - // In duringFill mode, convert the timestamp-type IOVs to lumiid-type IOVs - // before transferring the payloads from the buffer to the final collection - if (!m_endFillMode) { - convertBufferedIovsToLumiid(m_timestampToLumiid); - } - - size_t niovs = theLHCInfoPerFillImpl::transferPayloads(m_tmpBuffer, m_iovs, m_prevPayload); - edm::LogInfo(m_name) << "Added " << niovs << " iovs within the Fill time"; - m_tmpBuffer.clear(); - m_timestampToLumiid.clear(); - if (m_prevPayload->fillNumber() and !ongoingFill) { - if (m_endFillMode) { - addEmptyPayload(endFillTime); - } else { - addEmptyPayload(cond::lhcInfoHelper::getFillLastLumiIOV(oms, lhcFill)); - } - } - } - } - - std::string id() const override { return m_name; } - - static constexpr unsigned int kLumisectionsQueryLimit = 4000; - -private: - void addEmptyPayload(cond::Time_t iov) { - bool add = false; - if (m_iovs.empty()) { - if (!m_lastPayloadEmpty) - add = true; - } else { - auto lastAdded = m_iovs.rbegin()->second; - if (lastAdded->fillNumber() != 0) { - add = true; - } - } - if (add) { - auto newPayload = std::make_shared(); - m_iovs.insert(std::make_pair(iov, newPayload)); - m_prevPayload = newPayload; - edm::LogInfo(m_name) << "Added empty payload with IOV " << iov << " ( " - << boost::posix_time::to_iso_extended_string(cond::time::to_boost(iov)) << " )"; - } - } - - // Add payload to buffer and store corresponding lumiid IOV in m_timestampToLumiid map - void addPayloadToBuffer(cond::OMSServiceResultRef& row) { - auto startTime = row.get("start_time"); - auto delivLumi = row.get("delivered_lumi"); - auto recLumi = row.get("recorded_lumi"); - auto runNumber = std::stoul(row.get("run_number")); - auto lsNumber = std::stoul(row.get("lumisection_number")); - auto lumiid = cond::time::lumiTime(runNumber, lsNumber); - - LHCInfoPerFill* thisLumiSectionInfo = m_fillPayload->cloneFill(); - m_tmpBuffer.emplace_back(std::make_pair(cond::time::from_boost(startTime), thisLumiSectionInfo)); - if (!m_endFillMode) { - m_timestampToLumiid.insert(std::make_pair(cond::time::from_boost(startTime), lumiid)); - } - LHCInfoPerFill& payload = *thisLumiSectionInfo; - payload.setDelivLumi(delivLumi); - payload.setRecLumi(recLumi); - } - - void convertBufferedIovsToLumiid(std::map timestampToLumiid) { - for (auto& item : m_tmpBuffer) { - // Check if the lumiid IOV corresponding to the timestamp is present in the map - if (timestampToLumiid.find(item.first) == timestampToLumiid.end()) { - throw cms::Exception("LHCInfoPerFillPopConSourceHandler") - << "Can't find corresponding lumiid IOV for timestamp " << item.first << "\n"; - } - // Update the buffer with the lumiid-type IOV - item.first = timestampToLumiid.at(item.first); - } - } - - size_t getLumiData(const cond::OMSService& oms, - unsigned short fillId, - const boost::posix_time::ptime& beginFillTime, - const boost::posix_time::ptime& endFillTime) { - auto query = oms.query("lumisections"); - query->addOutputVars( - {"start_time", "delivered_lumi", "recorded_lumi", "beams_stable", "run_number", "lumisection_number"}); - query->filterEQ("fill_number", fillId); - query->filterGT("start_time", beginFillTime).filterLT("start_time", endFillTime); - query->filterEQ("beams_stable", "true"); - query->limit(kLumisectionsQueryLimit); - if (query->execute()) { - auto queryResult = query->result(); - edm::LogInfo(m_name) << "Found " << queryResult.size() << " lumisections with STABLE BEAM during the fill " - << fillId; - - if (!queryResult.empty()) { - if (m_endFillMode) { - auto firstRow = queryResult.front(); - addPayloadToBuffer(firstRow); - } - - auto lastRow = queryResult.back(); - addPayloadToBuffer(lastRow); - } - } - return 0; - } - - void getDipData(const cond::OMSService& oms, - const boost::posix_time::ptime& beginFillTime, - const boost::posix_time::ptime& endFillTime) { - // unsure how to handle this. - // the old implementation is not helping: apparently it is checking only the bunchconfiguration for the first diptime set of values... - auto query1 = oms.query("diplogger/dip/acc/LHC/RunControl/CirculatingBunchConfig/Beam1"); - query1->filterGT("dip_time", beginFillTime).filterLT("dip_time", endFillTime); - //This query is limited to 100 rows, but currently only one is used - //If all this data is needed and saved properly the limit has to be set: query1->limit(...) - if (query1->execute()) { - auto res = query1->result(); - if (!res.empty()) { - std::bitset bunchConfiguration1(0ULL); - auto row = *res.begin(); - auto vbunchConf1 = row.getArray("value"); - for (auto vb : vbunchConf1) { - if (vb != 0) { - unsigned short slot = (vb - 1) / 10 + 1; - bunchConfiguration1[slot] = true; - } - } - m_fillPayload->setBunchBitsetForBeam1(bunchConfiguration1); - } - } - auto query2 = oms.query("diplogger/dip/acc/LHC/RunControl/CirculatingBunchConfig/Beam2"); - query2->filterGT("dip_time", beginFillTime).filterLT("dip_time", endFillTime); - //This query is limited to 100 rows, but currently only one is used - if (query2->execute()) { - auto res = query2->result(); - if (!res.empty()) { - std::bitset bunchConfiguration2(0ULL); - auto row = *res.begin(); - auto vbunchConf2 = row.getArray("value"); - for (auto vb : vbunchConf2) { - if (vb != 0) { - unsigned short slot = (vb - 1) / 10 + 1; - bunchConfiguration2[slot] = true; - } - } - m_fillPayload->setBunchBitsetForBeam2(bunchConfiguration2); - } - } - - auto query3 = oms.query("diplogger/dip/CMS/LHC/LumiPerBunch"); - query3->filterGT("dip_time", beginFillTime).filterLT("dip_time", endFillTime); - //This query is limited to 100 rows, but currently only one is used - if (query3->execute()) { - auto res = query3->result(); - if (!res.empty()) { - std::vector lumiPerBX; - auto row = *res.begin(); - auto lumiBunchInst = row.getArray("lumi_bunch_inst"); - for (auto lb : lumiBunchInst) { - if (lb != 0.) { - lumiPerBX.push_back(lb); - } - } - m_fillPayload->setLumiPerBX(lumiPerBX); - } - } - } - - bool getCTPPSData(cond::persistency::Session& session, - const boost::posix_time::ptime& beginFillTime, - const boost::posix_time::ptime& endFillTime) { - //run the fifth query against the CTPPS schema - //Initializing the CMS_CTP_CTPPS_COND schema. - coral::ISchema& CTPPS = session.coralSession().schema("CMS_PPS_SPECT_COND"); - //execute query for CTPPS Data - std::unique_ptr CTPPSDataQuery(CTPPS.newQuery()); - //FROM clause - CTPPSDataQuery->addToTableList(std::string("PPS_LHC_MACHINE_PARAMS")); - //SELECT clause - CTPPSDataQuery->addToOutputList(std::string("DIP_UPDATE_TIME")); - CTPPSDataQuery->addToOutputList(std::string("LHC_STATE")); - CTPPSDataQuery->addToOutputList(std::string("LHC_COMMENT")); - if (m_debug) { - CTPPSDataQuery->addToOutputList(std::string("RUN_NUMBER")); - CTPPSDataQuery->addToOutputList(std::string("LUMI_SECTION")); - } - //WHERE CLAUSE - coral::AttributeList CTPPSDataBindVariables; - CTPPSDataBindVariables.extend(std::string("beginFillTime")); - CTPPSDataBindVariables.extend(std::string("endFillTime")); - CTPPSDataBindVariables[std::string("beginFillTime")].data() = coral::TimeStamp(beginFillTime); - CTPPSDataBindVariables[std::string("endFillTime")].data() = coral::TimeStamp(endFillTime); - std::string conditionStr = std::string("DIP_UPDATE_TIME>= :beginFillTime and DIP_UPDATE_TIME< :endFillTime"); - CTPPSDataQuery->setCondition(conditionStr, CTPPSDataBindVariables); - //ORDER BY clause - CTPPSDataQuery->addToOrderList(std::string("DIP_UPDATE_TIME")); - //define query output - coral::AttributeList CTPPSDataOutput; - CTPPSDataOutput.extend(std::string("DIP_UPDATE_TIME")); - CTPPSDataOutput.extend(std::string("LHC_STATE")); - CTPPSDataOutput.extend(std::string("LHC_COMMENT")); - if (m_debug) { - CTPPSDataOutput.extend(std::string("RUN_NUMBER")); - CTPPSDataOutput.extend(std::string("LUMI_SECTION")); - } - CTPPSDataQuery->defineOutput(CTPPSDataOutput); - //execute the query - coral::ICursor& CTPPSDataCursor = CTPPSDataQuery->execute(); - cond::Time_t dipTime = 0; - std::string lhcState = "", lhcComment = "", ctppsStatus = ""; - - //debug informations - unsigned int lumiSection = 0; - cond::Time_t runNumber = 0; - cond::Time_t savedDipTime = 0; - unsigned int savedLumiSection = 0; - cond::Time_t savedRunNumber = 0; - - bool ret = false; - LumiSectionFilter filter(m_tmpBuffer); - while (CTPPSDataCursor.next()) { - if (m_debug) { - std::ostringstream CTPPS; - CTPPSDataCursor.currentRow().toOutputStream(CTPPS); - } - coral::Attribute const& dipTimeAttribute = CTPPSDataCursor.currentRow()[std::string("DIP_UPDATE_TIME")]; - if (!dipTimeAttribute.isNull()) { - dipTime = cond::time::from_boost(dipTimeAttribute.data().time()); - if (filter.process(dipTime)) { - ret = true; - coral::Attribute const& lhcStateAttribute = CTPPSDataCursor.currentRow()[std::string("LHC_STATE")]; - if (!lhcStateAttribute.isNull()) { - lhcState = lhcStateAttribute.data(); - } - coral::Attribute const& lhcCommentAttribute = CTPPSDataCursor.currentRow()[std::string("LHC_COMMENT")]; - if (!lhcCommentAttribute.isNull()) { - lhcComment = lhcCommentAttribute.data(); - } - - if (m_debug) { - coral::Attribute const& runNumberAttribute = CTPPSDataCursor.currentRow()[std::string("RUN_NUMBER")]; - if (!runNumberAttribute.isNull()) { - runNumber = runNumberAttribute.data(); - } - coral::Attribute const& lumiSectionAttribute = CTPPSDataCursor.currentRow()[std::string("LUMI_SECTION")]; - if (!lumiSectionAttribute.isNull()) { - lumiSection = lumiSectionAttribute.data(); - } - } - - for (auto it = filter.current(); it != m_tmpBuffer.end(); it++) { - // set the current values to all of the payloads of the lumi section samples after the current since - LHCInfoPerFill& payload = *(it->second); - payload.setLhcState(lhcState); - payload.setLhcComment(lhcComment); - payload.setCtppsStatus(ctppsStatus); - - if (m_debug) { - savedDipTime = dipTime; - savedLumiSection = lumiSection; - savedRunNumber = runNumber; - } - } - } - } - } - if (m_debug) { - edm::LogInfo(m_name) << "Last assigned: " - << "DipTime: " << savedDipTime << " " - << "LumiSection: " << savedLumiSection << " " - << "RunNumber: " << savedRunNumber; - } - return ret; - } - - bool getEcalData(cond::persistency::Session& session, - const boost::posix_time::ptime& lowerTime, - const boost::posix_time::ptime& upperTime) { - //run the sixth query against the CMS_DCS_ENV_PVSS_COND schema - //Initializing the CMS_DCS_ENV_PVSS_COND schema. - coral::ISchema& ECAL = session.nominalSchema(); - //start the transaction against the fill logging schema - //execute query for ECAL Data - std::unique_ptr ECALDataQuery(ECAL.newQuery()); - //FROM clause - ECALDataQuery->addToTableList(std::string("BEAM_PHASE")); - //SELECT clause - ECALDataQuery->addToOutputList(std::string("CHANGE_DATE")); - ECALDataQuery->addToOutputList(std::string("DIP_value")); - ECALDataQuery->addToOutputList(std::string("element_nr")); - ECALDataQuery->addToOutputList(std::string("VALUE_NUMBER")); - //WHERE CLAUSE - coral::AttributeList ECALDataBindVariables; - ECALDataBindVariables.extend(std::string("lowerTime")); - ECALDataBindVariables.extend(std::string("upperTime")); - ECALDataBindVariables[std::string("lowerTime")].data() = coral::TimeStamp(lowerTime); - ECALDataBindVariables[std::string("upperTime")].data() = coral::TimeStamp(upperTime); - std::string conditionStr = std::string( - "(DIP_value LIKE '%beamPhaseMean%' OR DIP_value LIKE '%cavPhaseMean%') AND CHANGE_DATE >= :lowerTime AND " - "CHANGE_DATE < :upperTime"); - - ECALDataQuery->setCondition(conditionStr, ECALDataBindVariables); - //ORDER BY clause - ECALDataQuery->addToOrderList(std::string("CHANGE_DATE")); - ECALDataQuery->addToOrderList(std::string("DIP_value")); - ECALDataQuery->addToOrderList(std::string("element_nr")); - //define query output - coral::AttributeList ECALDataOutput; - ECALDataOutput.extend(std::string("CHANGE_DATE")); - ECALDataOutput.extend(std::string("DIP_value")); - ECALDataOutput.extend(std::string("element_nr")); - ECALDataOutput.extend(std::string("VALUE_NUMBER")); - //ECALDataQuery->limitReturnedRows( 14256 ); //3564 entries per vector. - ECALDataQuery->defineOutput(ECALDataOutput); - //execute the query - coral::ICursor& ECALDataCursor = ECALDataQuery->execute(); - cond::Time_t changeTime = 0; - cond::Time_t firstTime = 0; - std::string dipVal = ""; - unsigned int elementNr = 0; - float value = 0.; - std::set initializedVectors; - LumiSectionFilter filter(m_tmpBuffer); - bool ret = false; - if (m_prevPayload.get()) { - for (auto& lumiSlot : m_tmpBuffer) { - lumiSlot.second->setBeam1VC(m_prevPayload->beam1VC()); - lumiSlot.second->setBeam2VC(m_prevPayload->beam2VC()); - lumiSlot.second->setBeam1RF(m_prevPayload->beam1RF()); - lumiSlot.second->setBeam2RF(m_prevPayload->beam2RF()); - } - } - std::map iovMap; - if (m_tmpBuffer.empty()) { - return ret; - } - cond::Time_t lowerLumi = m_tmpBuffer.front().first; - while (ECALDataCursor.next()) { - if (m_debug) { - std::ostringstream ECAL; - ECALDataCursor.currentRow().toOutputStream(ECAL); - } - coral::Attribute const& changeDateAttribute = ECALDataCursor.currentRow()[std::string("CHANGE_DATE")]; - if (!changeDateAttribute.isNull()) { - ret = true; - boost::posix_time::ptime chTime = changeDateAttribute.data().time(); - // move the first IOV found to the start of the fill interval selected - if (changeTime == 0) { - firstTime = cond::time::from_boost(chTime); - } - changeTime = cond::time::from_boost(chTime); - cond::Time_t iovTime = changeTime; - if (changeTime == firstTime) - iovTime = lowerLumi; - coral::Attribute const& dipValAttribute = ECALDataCursor.currentRow()[std::string("DIP_value")]; - coral::Attribute const& valueNumberAttribute = ECALDataCursor.currentRow()[std::string("VALUE_NUMBER")]; - coral::Attribute const& elementNrAttribute = ECALDataCursor.currentRow()[std::string("element_nr")]; - if (!dipValAttribute.isNull() and !valueNumberAttribute.isNull()) { - dipVal = dipValAttribute.data(); - elementNr = elementNrAttribute.data(); - value = valueNumberAttribute.data(); - if (std::isnan(value)) - value = 0.; - if (filter.process(iovTime)) { - iovMap.insert(std::make_pair(changeTime, filter.current()->first)); - for (auto it = filter.current(); it != m_tmpBuffer.end(); it++) { - LHCInfoPerFill& payload = *(it->second); - theLHCInfoPerFillImpl::setElementData(it->first, dipVal, elementNr, value, payload, initializedVectors); - } - } - } - } - } - if (m_debug) { - for (auto& im : iovMap) { - edm::LogInfo(m_name) << "Found iov=" << im.first << " (" << cond::time::to_boost(im.first) << " ) moved to " - << im.second << " ( " << cond::time::to_boost(im.second) << " )"; - } - } - return ret; - } - -private: - bool m_debug; - // starting date for sampling - boost::posix_time::ptime m_startTime; - boost::posix_time::ptime m_endTime; - bool m_endFillMode = true; - std::string m_name; - //for reading from relational database source - std::string m_connectionString, m_ecalConnectionString; - std::string m_authpath; - std::string m_omsBaseUrl; - std::unique_ptr m_fillPayload; - std::shared_ptr m_prevPayload; - std::vector>> m_tmpBuffer; - bool m_lastPayloadEmpty = false; - // to hold correspondance between timestamp-type IOVs and lumiid-type IOVs - std::map m_timestampToLumiid; -}; diff --git a/CondTools/RunInfo/plugins/LHCInfoPerLSOnlinePopConAnalyzer.cc b/CondTools/RunInfo/plugins/LHCInfoPerLSOnlinePopConAnalyzer.cc new file mode 100644 index 0000000000000..709362592d160 --- /dev/null +++ b/CondTools/RunInfo/plugins/LHCInfoPerLSOnlinePopConAnalyzer.cc @@ -0,0 +1,7 @@ +#include "CondCore/PopCon/interface/OnlinePopConAnalyzer.h" +#include "CondTools/RunInfo/interface/LHCInfoPerLSPopConSourceHandler.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +using LHCInfoPerLSOnlinePopConAnalyzer = popcon::OnlinePopConAnalyzer; + +DEFINE_FWK_MODULE(LHCInfoPerLSOnlinePopConAnalyzer); diff --git a/CondTools/RunInfo/plugins/LHCInfoPerLSPopConAnalyzer.cc b/CondTools/RunInfo/plugins/LHCInfoPerLSPopConAnalyzer.cc index dc5fe9b298c8e..9a1fcbaa4dfdd 100644 --- a/CondTools/RunInfo/plugins/LHCInfoPerLSPopConAnalyzer.cc +++ b/CondTools/RunInfo/plugins/LHCInfoPerLSPopConAnalyzer.cc @@ -1,589 +1,7 @@ -#include "CondCore/CondDB/interface/ConnectionPool.h" -#include "CondCore/CondDB/interface/Types.h" #include "CondCore/PopCon/interface/PopConAnalyzer.h" -#include "CondCore/PopCon/interface/PopConSourceHandler.h" -#include "CondFormats/Common/interface/TimeConversions.h" -#include "CondFormats/RunInfo/interface/LHCInfoPerLS.h" -#include "CondTools/RunInfo/interface/LHCInfoHelper.h" -#include "CondTools/RunInfo/interface/OMSAccess.h" -#include "CoralBase/Attribute.h" -#include "CoralBase/AttributeList.h" -#include "CoralBase/AttributeSpecification.h" -#include "CoralBase/TimeStamp.h" +#include "CondTools/RunInfo/interface/LHCInfoPerLSPopConSourceHandler.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ParameterSet/interface/ParameterSetfwd.h" -#include "RelationalAccess/ICursor.h" -#include "RelationalAccess/IQuery.h" -#include "RelationalAccess/ISchema.h" -#include "RelationalAccess/ISessionProxy.h" - -using std::make_pair; -using std::pair; - -class LHCInfoPerLSPopConSourceHandler; typedef popcon::PopConAnalyzer LHCInfoPerLSPopConAnalyzer; -//define this as a plug-in -DEFINE_FWK_MODULE(LHCInfoPerLSPopConAnalyzer); - -namespace theLHCInfoPerLSImpl { - bool comparePayloads(const LHCInfoPerLS& rhs, const LHCInfoPerLS& lhs) { - if (rhs.fillNumber() != lhs.fillNumber() || rhs.runNumber() != lhs.runNumber() || - rhs.crossingAngleX() != lhs.crossingAngleX() || rhs.crossingAngleY() != lhs.crossingAngleY() || - rhs.betaStarX() != lhs.betaStarX() || rhs.betaStarY() != lhs.betaStarY()) { - return false; - } - return true; - } - - size_t transferPayloads(const std::vector>>& buffer, - std::map>& iovsToTransfer, - std::shared_ptr& prevPayload, - const std::map, pair>& lsIdMap, - cond::Time_t startStableBeamTime, - cond::Time_t endStableBeamTime) { - int lsMissingInPPS = 0; - int xAngleBothZero = 0, xAngleBothNonZero = 0, xAngleNegative = 0; - int betaNegative = 0; - size_t niovs = 0; - std::stringstream condIovs; - std::stringstream missingLsList; - for (auto& iov : buffer) { - bool add = false; - auto payload = iov.second; - cond::Time_t since = iov.first; - if (iovsToTransfer.empty()) { - add = true; - } else { - LHCInfoPerLS& lastAdded = *iovsToTransfer.rbegin()->second; - if (!comparePayloads(lastAdded, *payload)) { - add = true; - } - } - auto id = make_pair(payload->runNumber(), payload->lumiSection()); - bool stableBeam = since >= startStableBeamTime && since <= endStableBeamTime; - bool isMissing = lsIdMap.find(id) != lsIdMap.end() && id != lsIdMap.at(id); - if (stableBeam && isMissing) { - missingLsList << id.first << "_" << id.second << " "; - lsMissingInPPS += isMissing; - } - if (add && !isMissing) { - niovs++; - if (stableBeam) { - if (payload->crossingAngleX() == 0 && payload->crossingAngleY() == 0) - xAngleBothZero++; - if (payload->crossingAngleX() != 0 && payload->crossingAngleY() != 0) - xAngleBothNonZero++; - if (payload->crossingAngleX() < 0 || payload->crossingAngleY() < 0) - xAngleNegative++; - if (payload->betaStarX() < 0 || payload->betaStarY() < 0) - betaNegative++; - } - - condIovs << since << " "; - iovsToTransfer.insert(make_pair(since, payload)); - prevPayload = iov.second; - } - } - unsigned short fillNumber = (!buffer.empty()) ? buffer.front().second->fillNumber() : 0; - if (lsMissingInPPS > 0) { - edm::LogWarning("transferPayloads") - << "Number of stable beam LS in OMS without corresponding record in PPS DB for fill " << fillNumber << ": " - << lsMissingInPPS; - edm::LogWarning("transferPayloads") - << "Stable beam LS in OMS without corresponding record in PPS DB (run_LS): " << missingLsList.str(); - } - if (xAngleBothZero > 0) { - edm::LogWarning("transferPayloads") - << "Number of payloads written with crossingAngle == 0 for both X and Y for fill " << fillNumber << ": " - << xAngleBothZero; - } - if (xAngleBothNonZero > 0) { - edm::LogWarning("transferPayloads") - << "Number of payloads written with crossingAngle != 0 for both X and Y for fill " << fillNumber << ": " - << xAngleBothNonZero; - } - if (xAngleNegative > 0) { - edm::LogWarning("transferPayloads") - << "Number of payloads written with negative crossingAngle for fill " << fillNumber << ": " << xAngleNegative; - } - if (betaNegative > 0) { - edm::LogWarning("transferPayloads") - << "Number of payloads written with negative betaSta for fill " << fillNumber << ": " << betaNegative; - } - - edm::LogInfo("transferPayloads") << "TRANSFERED COND IOVS: " << condIovs.str(); - return niovs; - } - -} // namespace theLHCInfoPerLSImpl - -class LHCInfoPerLSPopConSourceHandler : public popcon::PopConSourceHandler { -public: - LHCInfoPerLSPopConSourceHandler(edm::ParameterSet const& pset) - : m_debug(pset.getUntrackedParameter("debug", false)), - m_startTime(), - m_endTime(), - m_endFillMode(pset.getUntrackedParameter("endFill", true)), - m_name(pset.getUntrackedParameter("name", "LHCInfoPerLSPopConSourceHandler")), - m_connectionString(pset.getUntrackedParameter("connectionString", "")), - m_authpath(pset.getUntrackedParameter("authenticationPath", "")), - m_omsBaseUrl(pset.getUntrackedParameter("omsBaseUrl", "")), - m_fillPayload(), - m_prevPayload(), - m_tmpBuffer() { - if (!pset.getUntrackedParameter("startTime").empty()) { - m_startTime = boost::posix_time::time_from_string(pset.getUntrackedParameter("startTime")); - } - boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); - m_endTime = now; - if (!pset.getUntrackedParameter("endTime").empty()) { - m_endTime = boost::posix_time::time_from_string(pset.getUntrackedParameter("endTime")); - if (m_endTime > now) - m_endTime = now; - } - } - - ~LHCInfoPerLSPopConSourceHandler() override = default; - - void getNewObjects() override { - //if a new tag is created, transfer fake fill from 1 to the first fill for the first time - if (tagInfo().size == 0) { - edm::LogInfo(m_name) << "New tag " << tagInfo().name << "; from " << m_name << "::getNewObjects"; - } else { - //check what is already inside the database - edm::LogInfo(m_name) << "got info for tag " << tagInfo().name << ": size " << tagInfo().size - << ", last object valid since " << tagInfo().lastInterval.since << " ( " - << boost::posix_time::to_iso_extended_string( - cond::time::to_boost(tagInfo().lastInterval.since)) - << " ); from " << m_name << "::getNewObjects"; - } - - cond::Time_t lastSince = tagInfo().lastInterval.since; - if (tagInfo().isEmpty()) { - // for a new or empty tag, an empty payload should be added on top with since=1 - if (m_endFillMode) { - addEmptyPayload(1); - lastSince = 1; - } else { - addEmptyPayload(cond::time::lumiTime(1, 1)); - lastSince = cond::time::lumiTime(1, 1); - } - } else { - edm::LogInfo(m_name) << "The last Iov in tag " << tagInfo().name << " valid since " << lastSince << "from " - << m_name << "::getNewObjects"; - } - - //retrieve the data from the relational database source - cond::persistency::ConnectionPool connection; - //configure the connection - if (m_debug) { - connection.setMessageVerbosity(coral::Debug); - } else { - connection.setMessageVerbosity(coral::Error); - } - connection.setAuthenticationPath(m_authpath); - connection.configure(); - //create the sessions - cond::persistency::Session session = connection.createSession(m_connectionString, false); - // fetch last payload when available - if (!tagInfo().lastInterval.payloadId.empty()) { - cond::persistency::Session session3 = dbSession(); - session3.transaction().start(true); - m_prevPayload = session3.fetchPayload(tagInfo().lastInterval.payloadId); - session3.transaction().commit(); - - // find startFillTime and endFillTime of the most recent fill already saved in the tag - if (m_prevPayload->fillNumber() != 0) { - cond::OMSService oms; - oms.connect(m_omsBaseUrl); - auto query = oms.query("fills"); - query->addOutputVar("end_time"); - query->addOutputVar("start_time"); - query->filterEQ("fill_number", m_prevPayload->fillNumber()); - bool foundFill = query->execute(); - if (foundFill) { - auto result = query->result(); - - if (!result.empty()) { - std::string endTimeStr = (*result.begin()).get("end_time"); - m_prevEndFillTime = - (endTimeStr == "null") - ? 0 - : cond::time::from_boost((*result.begin()).get("end_time")); - auto startFillTime = (*result.begin()).get("start_time"); - m_prevStartFillTime = cond::time::from_boost(startFillTime); - } else { - foundFill = false; - } - } - if (!foundFill) { - edm::LogError(m_name) << "Could not find end time of fill #" << m_prevPayload->fillNumber(); - } - } else { - m_prevEndFillTime = 0; - m_prevStartFillTime = 0; - } - } - - boost::posix_time::ptime executionTime = boost::posix_time::second_clock::local_time(); - cond::Time_t executionTimeIov = cond::time::from_boost(executionTime); - - cond::Time_t startTimestamp = m_startTime.is_not_a_date_time() ? 0 : cond::time::from_boost(m_startTime); - cond::Time_t nextFillSearchTimestamp = std::max(startTimestamp, m_endFillMode ? lastSince : m_prevEndFillTime); - - edm::LogInfo(m_name) << "Starting sampling at " - << boost::posix_time::to_simple_string(cond::time::to_boost(nextFillSearchTimestamp)); - - while (true) { - if (nextFillSearchTimestamp >= executionTimeIov) { - edm::LogInfo(m_name) << "Sampling ended at the time " - << boost::posix_time::to_simple_string(cond::time::to_boost(executionTimeIov)); - break; - } - boost::posix_time::ptime nextFillSearchTime = cond::time::to_boost(nextFillSearchTimestamp); - boost::posix_time::ptime startSampleTime; - boost::posix_time::ptime endSampleTime; - - cond::OMSService oms; - oms.connect(m_omsBaseUrl); - auto query = oms.query("fills"); - - if (!m_endFillMode and m_prevPayload->fillNumber() and m_prevEndFillTime == 0ULL) { - // continue processing unfinished fill with some payloads already in the tag - edm::LogInfo(m_name) << "Searching started fill #" << m_prevPayload->fillNumber(); - query->filterEQ("fill_number", m_prevPayload->fillNumber()); - bool foundFill = query->execute(); - if (foundFill) - foundFill = makeFillPayload(m_fillPayload, query->result()); - if (!foundFill) { - edm::LogError(m_name) << "Could not find fill #" << m_prevPayload->fillNumber(); - break; - } - startSampleTime = cond::time::to_boost(lastSince); - } else { - edm::LogInfo(m_name) << "Searching new fill after " << boost::posix_time::to_simple_string(nextFillSearchTime); - query->filterNotNull("start_stable_beam").filterNotNull("fill_number"); - if (nextFillSearchTime > cond::time::to_boost(m_prevStartFillTime)) { - query->filterGE("start_time", nextFillSearchTime); - } else { - query->filterGT("start_time", nextFillSearchTime); - } - - query->filterLT("start_time", m_endTime); - if (m_endFillMode) - query->filterNotNull("end_time"); - bool foundFill = query->execute(); - if (foundFill) - foundFill = makeFillPayload(m_fillPayload, query->result()); - if (!foundFill) { - edm::LogInfo(m_name) << "No fill found - END of job."; - break; - } - startSampleTime = cond::time::to_boost(m_startFillTime); - } - - unsigned short lhcFill = m_fillPayload->fillNumber(); - bool ongoingFill = m_endFillTime == 0ULL; - if (ongoingFill) { - edm::LogInfo(m_name) << "Found ongoing fill " << lhcFill << " created at " - << cond::time::to_boost(m_startFillTime); - endSampleTime = executionTime; - nextFillSearchTimestamp = executionTimeIov; - } else { - edm::LogInfo(m_name) << "Found fill " << lhcFill << " created at " << cond::time::to_boost(m_startFillTime) - << " ending at " << cond::time::to_boost(m_endFillTime); - endSampleTime = cond::time::to_boost(m_endFillTime); - nextFillSearchTimestamp = m_endFillTime; - } - - if (m_endFillMode || ongoingFill) { - getLumiData(oms, lhcFill, startSampleTime, endSampleTime); - - if (!m_tmpBuffer.empty()) { - boost::posix_time::ptime flumiStart = cond::time::to_boost(m_tmpBuffer.front().first); - boost::posix_time::ptime flumiStop = cond::time::to_boost(m_tmpBuffer.back().first); - edm::LogInfo(m_name) << "First buffered lumi starts at " << flumiStart << " last lumi starts at " - << flumiStop; - session.transaction().start(true); - getCTPPSData(session, startSampleTime, endSampleTime); - session.transaction().commit(); - } - } - - size_t niovs = theLHCInfoPerLSImpl::transferPayloads( - m_tmpBuffer, m_iovs, m_prevPayload, m_lsIdMap, m_startStableBeamTime, m_endStableBeamTime); - edm::LogInfo(m_name) << "Added " << niovs << " iovs within the Fill time"; - if (niovs) { - m_prevEndFillTime = m_endFillTime; - m_prevStartFillTime = m_startFillTime; - } - m_tmpBuffer.clear(); - m_lsIdMap.clear(); - if (m_prevPayload->fillNumber() and !ongoingFill) { - if (m_endFillMode) { - addEmptyPayload(m_endFillTime); - } else { - addEmptyPayload(cond::lhcInfoHelper::getFillLastLumiIOV(oms, lhcFill)); - } - } - } - } - std::string id() const override { return m_name; } - - static constexpr unsigned int kLumisectionsQueryLimit = 4000; - -private: - void addEmptyPayload(cond::Time_t iov) { - bool add = false; - if (m_iovs.empty()) { - if (!m_lastPayloadEmpty) - add = true; - } else { - auto lastAdded = m_iovs.rbegin()->second; - if (lastAdded->fillNumber() != 0) { - add = true; - } - } - if (add) { - auto newPayload = std::make_shared(); - m_iovs.insert(make_pair(iov, newPayload)); - m_prevPayload = newPayload; - m_prevEndFillTime = 0; - m_prevStartFillTime = 0; - edm::LogInfo(m_name) << "Added empty payload with IOV" << iov << " ( " - << boost::posix_time::to_iso_extended_string(cond::time::to_boost(iov)) << " )"; - } - } - - bool makeFillPayload(std::unique_ptr& targetPayload, const cond::OMSServiceResult& queryResult) { - bool ret = false; - if (!queryResult.empty()) { - auto row = *queryResult.begin(); - auto currentFill = row.get("fill_number"); - m_startFillTime = cond::time::from_boost(row.get("start_time")); - std::string endTimeStr = row.get("end_time"); - m_endFillTime = - (endTimeStr == "null") ? 0 : cond::time::from_boost(row.get("end_time")); - m_startStableBeamTime = cond::time::from_boost(row.get("start_stable_beam")); - m_endStableBeamTime = cond::time::from_boost(row.get("end_stable_beam")); - targetPayload = std::make_unique(); - targetPayload->setFillNumber(currentFill); - ret = true; - } - return ret; - } - - void addPayloadToBuffer(cond::OMSServiceResultRef& row) { - auto lumiTime = row.get("start_time"); - LHCInfoPerLS* thisLumiSectionInfo = new LHCInfoPerLS(*m_fillPayload); - thisLumiSectionInfo->setLumiSection(std::stoul(row.get("lumisection_number"))); - thisLumiSectionInfo->setRunNumber(std::stoul(row.get("run_number"))); - m_lsIdMap[make_pair(thisLumiSectionInfo->runNumber(), thisLumiSectionInfo->lumiSection())] = make_pair(-1, -1); - if (m_endFillMode) { - m_tmpBuffer.emplace_back(make_pair(cond::time::from_boost(lumiTime), thisLumiSectionInfo)); - } else { - m_tmpBuffer.emplace_back( - make_pair(cond::time::lumiTime(thisLumiSectionInfo->runNumber(), thisLumiSectionInfo->lumiSection()), - thisLumiSectionInfo)); - } - } - - size_t bufferAllLS(const cond::OMSServiceResult& queryResult) { - for (auto r : queryResult) { - addPayloadToBuffer(r); - } - return queryResult.size(); - } - - size_t bufferFirstStableBeamLS(const cond::OMSServiceResult& queryResult) { - for (auto r : queryResult) { - if (r.get("beams_stable") == "true") { - addPayloadToBuffer(r); - edm::LogInfo(m_name) << "Buffered first lumisection of stable beam: LS: " - << r.get("lumisection_number") - << " run: " << r.get("run_number"); - return 1; - } - } - return 0; - } - - size_t getLumiData(const cond::OMSService& oms, - unsigned short fillId, - const boost::posix_time::ptime& beginFillTime, - const boost::posix_time::ptime& endFillTime) { - auto query = oms.query("lumisections"); - query->addOutputVars({"start_time", "run_number", "beams_stable", "lumisection_number"}); - query->filterEQ("fill_number", fillId); - query->filterGT("start_time", beginFillTime).filterLT("start_time", endFillTime); - query->limit(kLumisectionsQueryLimit); - size_t nlumi = 0; - if (query->execute()) { - auto queryResult = query->result(); - if (m_endFillMode) { - nlumi = bufferAllLS(queryResult); - } else if (!queryResult.empty()) { - auto newestPayload = queryResult.back(); - if (newestPayload.get("beams_stable") == "true") { - addPayloadToBuffer(newestPayload); - nlumi = 1; - edm::LogInfo(m_name) << "Buffered most recent lumisection:" - << " LS: " << newestPayload.get("lumisection_number") - << " run: " << newestPayload.get("run_number"); - } - } - edm::LogInfo(m_name) << "Found " << queryResult.size() << " lumisections during the fill " << fillId; - } else { - edm::LogInfo(m_name) << "OMS query for lumisections of fill " << fillId << "failed, status:" << query->status(); - } - return nlumi; - } - - bool getCTPPSData(cond::persistency::Session& session, - const boost::posix_time::ptime& beginFillTime, - const boost::posix_time::ptime& endFillTime) { - //run the fifth query against the CTPPS schema - //Initializing the CMS_CTP_CTPPS_COND schema. - coral::ISchema& CTPPS = session.coralSession().schema("CMS_PPS_SPECT_COND"); - //execute query for CTPPS Data - std::unique_ptr CTPPSDataQuery(CTPPS.newQuery()); - //FROM clause - CTPPSDataQuery->addToTableList(std::string("PPS_LHC_MACHINE_PARAMS")); - //SELECT clause - CTPPSDataQuery->addToOutputList(std::string("DIP_UPDATE_TIME")); - CTPPSDataQuery->addToOutputList(std::string("LUMI_SECTION")); - CTPPSDataQuery->addToOutputList(std::string("RUN_NUMBER")); - CTPPSDataQuery->addToOutputList(std::string("FILL_NUMBER")); - CTPPSDataQuery->addToOutputList(std::string("XING_ANGLE_P5_X_URAD")); - CTPPSDataQuery->addToOutputList(std::string("XING_ANGLE_P5_Y_URAD")); - CTPPSDataQuery->addToOutputList(std::string("BETA_STAR_P5_X_M")); - CTPPSDataQuery->addToOutputList(std::string("BETA_STAR_P5_Y_M")); - //WHERE CLAUSE - coral::AttributeList CTPPSDataBindVariables; - CTPPSDataBindVariables.extend(std::string("beginFillTime")); - CTPPSDataBindVariables.extend(std::string("endFillTime")); - CTPPSDataBindVariables[std::string("beginFillTime")].data() = coral::TimeStamp(beginFillTime); - CTPPSDataBindVariables[std::string("endFillTime")].data() = coral::TimeStamp(endFillTime); - std::string conditionStr = std::string("DIP_UPDATE_TIME>= :beginFillTime and DIP_UPDATE_TIME< :endFillTime"); - CTPPSDataQuery->setCondition(conditionStr, CTPPSDataBindVariables); - //ORDER BY clause - CTPPSDataQuery->addToOrderList(std::string("DIP_UPDATE_TIME")); - //define query output - coral::AttributeList CTPPSDataOutput; - CTPPSDataOutput.extend(std::string("DIP_UPDATE_TIME")); - CTPPSDataOutput.extend(std::string("LUMI_SECTION")); - CTPPSDataOutput.extend(std::string("RUN_NUMBER")); - CTPPSDataOutput.extend(std::string("FILL_NUMBER")); - CTPPSDataOutput.extend(std::string("XING_ANGLE_P5_X_URAD")); - CTPPSDataOutput.extend(std::string("XING_ANGLE_P5_Y_URAD")); - CTPPSDataOutput.extend(std::string("BETA_STAR_P5_X_M")); - CTPPSDataOutput.extend(std::string("BETA_STAR_P5_Y_M")); - CTPPSDataQuery->defineOutput(CTPPSDataOutput); - //execute the query - coral::ICursor& CTPPSDataCursor = CTPPSDataQuery->execute(); - unsigned int lumiSection = 0; - cond::Time_t runNumber = 0; - int fillNumber = 0; - float crossingAngleX = 0., betaStarX = 0.; - float crossingAngleY = 0., betaStarY = 0.; - - bool ret = false; - int wrongFillNumbers = 0; - std::stringstream wrongFills; - std::vector>>::iterator current = m_tmpBuffer.begin(); - while (CTPPSDataCursor.next()) { - if (m_debug) { - std::ostringstream CTPPS; - CTPPSDataCursor.currentRow().toOutputStream(CTPPS); - } - coral::Attribute const& dipTimeAttribute = CTPPSDataCursor.currentRow()[std::string("DIP_UPDATE_TIME")]; - if (!dipTimeAttribute.isNull()) { - ret = true; - coral::Attribute const& lumiSectionAttribute = CTPPSDataCursor.currentRow()[std::string("LUMI_SECTION")]; - if (!lumiSectionAttribute.isNull()) { - lumiSection = lumiSectionAttribute.data(); - } - coral::Attribute const& runNumberAttribute = CTPPSDataCursor.currentRow()[std::string("RUN_NUMBER")]; - if (!runNumberAttribute.isNull()) { - runNumber = runNumberAttribute.data(); - } - coral::Attribute const& fillNumberAttribute = CTPPSDataCursor.currentRow()[std::string("FILL_NUMBER")]; - if (!fillNumberAttribute.isNull()) { - fillNumber = fillNumberAttribute.data(); - } - coral::Attribute const& crossingAngleXAttribute = - CTPPSDataCursor.currentRow()[std::string("XING_ANGLE_P5_X_URAD")]; - if (!crossingAngleXAttribute.isNull()) { - crossingAngleX = crossingAngleXAttribute.data(); - } - coral::Attribute const& crossingAngleYAttribute = - CTPPSDataCursor.currentRow()[std::string("XING_ANGLE_P5_Y_URAD")]; - if (!crossingAngleYAttribute.isNull()) { - crossingAngleY = crossingAngleYAttribute.data(); - } - coral::Attribute const& betaStarXAttribute = CTPPSDataCursor.currentRow()[std::string("BETA_STAR_P5_X_M")]; - if (!betaStarXAttribute.isNull()) { - betaStarX = betaStarXAttribute.data(); - } - coral::Attribute const& betaStarYAttribute = CTPPSDataCursor.currentRow()[std::string("BETA_STAR_P5_Y_M")]; - if (!betaStarYAttribute.isNull()) { - betaStarY = betaStarYAttribute.data(); - } - if (current != m_tmpBuffer.end() && current->second->fillNumber() != fillNumber) { - wrongFills << "( " << runNumber << "_" << lumiSection << " fill: OMS: " << current->second->fillNumber() - << " PPSdb: " << fillNumber << " ) "; - wrongFillNumbers++; - } - for (; - current != m_tmpBuffer.end() && make_pair(current->second->runNumber(), current->second->lumiSection()) <= - make_pair(runNumber, lumiSection); - current++) { - LHCInfoPerLS& payload = *(current->second); - payload.setCrossingAngleX(crossingAngleX); - payload.setCrossingAngleY(crossingAngleY); - payload.setBetaStarX(betaStarX); - payload.setBetaStarY(betaStarY); - payload.setLumiSection(lumiSection); - payload.setRunNumber(runNumber); - if (m_lsIdMap.find(make_pair(payload.runNumber(), payload.lumiSection())) != m_lsIdMap.end()) { - m_lsIdMap[make_pair(payload.runNumber(), payload.lumiSection())] = make_pair(runNumber, lumiSection); - } - } - } - } - if (wrongFillNumbers) { - edm::LogWarning("getCTPPSData") << "Number of records from PPS DB with fillNumber different from OMS: " - << wrongFillNumbers; - edm::LogWarning("getCTPPSData") << "Records from PPS DB with fillNumber different from OMS: " << wrongFills.str(); - } - return ret; - } -private: - bool m_debug; - // starting date for sampling - boost::posix_time::ptime m_startTime; - boost::posix_time::ptime m_endTime; - bool m_endFillMode = true; - std::string m_name; - //for reading from relational database source - std::string m_connectionString; - std::string m_authpath; - std::string m_omsBaseUrl; - std::unique_ptr m_fillPayload; - std::shared_ptr m_prevPayload; - cond::Time_t m_startFillTime; - cond::Time_t m_endFillTime; - cond::Time_t m_prevEndFillTime; - cond::Time_t m_prevStartFillTime; - cond::Time_t m_startStableBeamTime; - cond::Time_t m_endStableBeamTime; - std::vector>> m_tmpBuffer; - bool m_lastPayloadEmpty = false; - //mapping of lumisections IDs (pairs of runnumber an LS number) found in OMS to the IDs they've been assignd from PPS DB - //value pair(-1, -1) means lumisection corresponding to the key exists in OMS but no lumisection was matched from PPS - std::map, pair> m_lsIdMap; -}; +DEFINE_FWK_MODULE(LHCInfoPerLSPopConAnalyzer); \ No newline at end of file diff --git a/CondTools/RunInfo/python/LHCInfoPerFillPopConAnalyzer_cfg.py b/CondTools/RunInfo/python/LHCInfoPerFillPopConAnalyzer_cfg.py index d71362ecebfa8..22406260f051a 100644 --- a/CondTools/RunInfo/python/LHCInfoPerFillPopConAnalyzer_cfg.py +++ b/CondTools/RunInfo/python/LHCInfoPerFillPopConAnalyzer_cfg.py @@ -3,10 +3,6 @@ import FWCore.ParameterSet.VarParsing as VarParsing process = cms.Process("LHCInfoPerFillPopulator") from CondCore.CondDB.CondDB_cfi import * -#process.load("CondCore.DBCommon.CondDBCommon_cfi") -#process.CondDBCommon.connect = 'sqlite_file:lhcinfoperls_pop_test.db' -#process.CondDBCommon.DBParameters.authenticationPath = '.' -#process.CondDBCommon.DBParameters.messageLevel=cms.untracked.int32(1) sourceConnection = 'oracle://cms_omds_adg/CMS_RUNINFO_R' if socket.getfqdn().find('.cms') != -1: @@ -60,6 +56,51 @@ processes only fills starting before endTime; default to empty string which sets no restriction""" ) + +options.register( 'sourceConnection' + , "oracle://cms_orcon_adg/CMS_RUNTIME_LOGGER" + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , """beam data source connection string (aka PPS db)""" + ) +options.register( 'ecalConnection' + , "oracle://cms_orcon_adg/CMS_DCS_ENV_PVSS_COND" + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , """ecal data source connection string""" + ) +options.register( 'oms' + , "http://vocms0184.cern.ch/agg/api/v1" + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , """OMS base URL""" + ) + +#duringFill mode specific: +options.register( 'lastLumiFile' + , '' + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , """duringFill only: path to file with lumiid to override the last lumisection processed by HLT. + Used for testing. Leave empty for production behaviour (getting this info from OMS)""" + ) +options.register( 'frontierKey' + , '' + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , """duringFill only: run-unique key for writing with OnlinePopCon + (used for confirming proper upload)""" + ) + + +# so far there was no need to use option, added just in case +options.register( 'authenticationPath' + , "" + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , """for now this option was always left empty""" + ) + options.parseArguments() if options.mode is None: raise ValueError("mode argument not provided. Supported modes are: duringFill endFill") @@ -68,6 +109,7 @@ CondDBConnection = CondDB.clone( connect = cms.string( options.destinationConnection ) ) CondDBConnection.DBParameters.messageLevel = cms.untracked.int32( options.messageLevel ) +CondDBConnection.DBParameters.authenticationPath = cms.untracked.string(options.authenticationPath) process.MessageLogger = cms.Service("MessageLogger", cout = cms.untracked.PSet(threshold = cms.untracked.string('INFO')), @@ -87,30 +129,52 @@ else: timetype = 'lumiid' -process.PoolDBOutputService = cms.Service("PoolDBOutputService", - CondDBConnection, - timetype = cms.untracked.string(timetype), - toPut = cms.VPSet(cms.PSet(record = cms.string('LHCInfoPerFillRcd'), - tag = cms.string( options.tag ) - ) - ) - ) +if options.mode == "endFill": + process.PoolDBOutputService = cms.Service("PoolDBOutputService", + CondDBConnection, + timetype = cms.untracked.string(timetype), + toPut = cms.VPSet(cms.PSet(record = cms.string('LHCInfoPerFillRcd'), + tag = cms.string( options.tag ) + ) + ) + ) +else: + process.OnlineDBOutputService = cms.Service("OnlineDBOutputService", + CondDBConnection, + preLoadConnectionString = cms.untracked.string('frontier://FrontierProd/CMS_CONDITIONS' + if not options.destinationConnection.startswith('sqlite') + else options.destinationConnection ), + lastLumiFile = cms.untracked.string(options.lastLumiFile), + omsServiceUrl = cms.untracked.string('http://cmsoms-eventing.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection' + if not options.lastLumiFile else "" ), + # runNumber = cms.untracked.uint64(384468), #not used in production, the last LS processed is set as the 1st LS of this + #run if the omsServiceUrl is empty and file specified in lastLumiFile is empty + latency = cms.untracked.uint32(2), + timetype = cms.untracked.string(timetype), + toPut = cms.VPSet(cms.PSet( + record = cms.string('LHCInfoPerFillRcd'), + tag = cms.string( options.tag ), + onlyAppendUpdatePolicy = cms.untracked.bool(True) + )), + frontierKey = cms.untracked.string(options.frontierKey) +) + -process.Test1 = cms.EDAnalyzer("LHCInfoPerFillPopConAnalyzer", +process.Test1 = cms.EDAnalyzer("LHCInfoPerFillPopConAnalyzer" if options.mode == "endFill" else "LHCInfoPerFillOnlinePopConAnalyzer", SinceAppendMode = cms.bool(True), record = cms.string('LHCInfoPerFillRcd'), name = cms.untracked.string('LHCInfo'), - Source = cms.PSet(fill = cms.untracked.uint32(6417), + Source = cms.PSet( startTime = cms.untracked.string(options.startTime), endTime = cms.untracked.string(options.endTime), - endFill = cms.untracked.bool(True if options.mode == "endFill" else False), + endFill = cms.untracked.bool(options.mode == "endFill"), name = cms.untracked.string("LHCInfoPerFillPopConSourceHandler"), - connectionString = cms.untracked.string("oracle://cms_orcon_adg/CMS_RUNTIME_LOGGER"), - ecalConnectionString = cms.untracked.string("oracle://cms_orcon_adg/CMS_DCS_ENV_PVSS_COND"), - omsBaseUrl = cms.untracked.string("http://vocms0184.cern.ch/agg/api/v1"), - authenticationPath = cms.untracked.string(""), + connectionString = cms.untracked.string(options.sourceConnection), + ecalConnectionString = cms.untracked.string(options.ecalConnection), + omsBaseUrl = cms.untracked.string(options.oms), + authenticationPath = cms.untracked.string(options.authenticationPath), debug=cms.untracked.bool(False) - ), + ), loggingOn = cms.untracked.bool(True), IsDestDbCheckedInQueryLog = cms.untracked.bool(False) ) diff --git a/CondTools/RunInfo/python/LHCInfoPerLSPopConAnalyzer_cfg.py b/CondTools/RunInfo/python/LHCInfoPerLSPopConAnalyzer_cfg.py index 603c7f514d4ee..a58598f1d3ef1 100644 --- a/CondTools/RunInfo/python/LHCInfoPerLSPopConAnalyzer_cfg.py +++ b/CondTools/RunInfo/python/LHCInfoPerLSPopConAnalyzer_cfg.py @@ -3,10 +3,6 @@ import FWCore.ParameterSet.VarParsing as VarParsing process = cms.Process("LHCInfoPerLSPopulator") from CondCore.CondDB.CondDB_cfi import * -#process.load("CondCore.DBCommon.CondDBCommon_cfi") -#process.CondDBCommon.connect = 'sqlite_file:lhcinfoperls_pop_test.db' -#process.CondDBCommon.DBParameters.authenticationPath = '.' -#process.CondDBCommon.DBParameters.messageLevel=cms.untracked.int32(1) sourceConnection = 'oracle://cms_omds_adg/CMS_RUNINFO_R' if socket.getfqdn().find('.cms') != -1: @@ -60,6 +56,109 @@ processes only fills starting before endTime; default to empty string which sets no restriction""" ) + +options.register( 'sourceConnection' + , "oracle://cms_orcon_adg/CMS_RUNTIME_LOGGER" + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , """beam data source connection string (aka PPS db) + It's the source of crossing angle and beta * data""" + ) +options.register( 'oms' + , "http://vocms0184.cern.ch/agg/api/v1" + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , """OMS base URL""" + ) + +#duringFill mode specific: +options.register( 'lastLumiFile' + , '' + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , """duringFill only: path to file with lumiid to override the last lumisection processed by HLT. + Used for testing. Leave empty for production behaviour (getting this info from OMS)""" + ) +options.register( 'frontierKey' + , '' + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , """duringFill only: run-unique key for writing with OnlinePopCon + (used for confirming proper upload)""" + ) +options.register('offsetLS' + , 2 + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.int + , """duringFill only: offset between lastLumi (last LS processed by HLT or overriden by lastLumiFile) + and the IOV of the payload to be uploaded""" + ) +options.register( 'debugLogic' + , False + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.bool + , """duringFill only: Enables debug logic, meant to be used only for tests""" + ) +options.register( 'defaultXangleX' + , 160.0 # urad + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.float + , """duringFill only: crossingAngleX value (in urad) for the default payload. + The default payload is inserted after the last processed fill has ended + and there's no ongoing stable beam yet. """ + ) +options.register( 'defaultXangleY' + , 0.0 # urad + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.float + , """duringFill only: crossingAngleY value (in urad) for the default payload. + The default payload is inserted after the last processed fill has ended + and there's no ongoing stable beam yet. """ + ) +options.register( 'defaultBetaX' + , 0.3 # meters + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.float + , """duringFill only: betaStarX value (in meters) for the default payload. + The default payload is inserted after the last processed fill has ended + and there's no ongoing stable beam yet. """ + ) +options.register( 'defaultBetaY' + , 0.3 # meters + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.float + , """duringFill only: betaStarY value (in meters) for the default payload. + The default payload is inserted after the last processed fill has ended + and there's no ongoing stable beam yet. """ + ) + + +# it's unlikely to ever use values different from the defaults, added as a parameter just in case +options.register('minBetaStar', 0.1 + , VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.float + , """duringFill only: [meters] min value of the range of valid values. + If the value is outside of this range the payload is not uploaded""") +options.register('maxBetaStar', 100. + , VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.float + , """duringFill only: [meters] min value of the range of valid values. + If the value is outside of this range the payload is not uploaded""") +options.register('minCrossingAngle', 10. + , VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.float + , """duringFill only: [urad] min value of the range of valid values. + If the value is outside of this range the payload is not uploaded""") +options.register('maxCrossingAngle', 500. + , VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.float + , """duringFill only: [urad] min value of the range of valid values. + If the value is outside of this range the payload is not uploaded""") + +# as the previous options, so far there was no need to use option, added just in case +options.register( 'authenticationPath' + , "" + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , """for now this option was always left empty""" + ) + options.parseArguments() if options.mode is None: raise ValueError("mode argument not provided. Supported modes are: duringFill endFill") @@ -68,6 +167,7 @@ CondDBConnection = CondDB.clone( connect = cms.string( options.destinationConnection ) ) CondDBConnection.DBParameters.messageLevel = cms.untracked.int32( options.messageLevel ) +CondDBConnection.DBParameters.authenticationPath = cms.untracked.string(options.authenticationPath) process.MessageLogger = cms.Service("MessageLogger", cout = cms.untracked.PSet(threshold = cms.untracked.string('INFO')), @@ -87,31 +187,63 @@ else: timetype = 'lumiid' -process.PoolDBOutputService = cms.Service("PoolDBOutputService", - CondDBConnection, - timetype = cms.untracked.string(timetype), - toPut = cms.VPSet(cms.PSet(record = cms.string('LHCInfoPerLSRcd'), - tag = cms.string( options.tag ) - ) - ) - ) +if options.mode == "endFill": + process.PoolDBOutputService = cms.Service("PoolDBOutputService", + CondDBConnection, + timetype = cms.untracked.string(timetype), + toPut = cms.VPSet(cms.PSet(record = cms.string('LHCInfoPerLSRcd'), + tag = cms.string( options.tag ) + ) + ) + ) +else: + process.OnlineDBOutputService = cms.Service("OnlineDBOutputService", + CondDBConnection, + preLoadConnectionString = cms.untracked.string('frontier://FrontierProd/CMS_CONDITIONS' + if not options.destinationConnection.startswith('sqlite') + else options.destinationConnection ), + lastLumiFile = cms.untracked.string(options.lastLumiFile), + omsServiceUrl = cms.untracked.string('http://cmsoms-eventing.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection' + if not options.lastLumiFile else "" ), + # runNumber = cms.untracked.uint64(384468), #not used in production, the last LS processed is set as the 1st LS of this + #run if the omsServiceUrl is empty and file specified in lastLumiFile is empty + latency = cms.untracked.uint32(options.offsetLS), + timetype = cms.untracked.string(timetype), + toPut = cms.VPSet(cms.PSet( + record = cms.string('LHCInfoPerLSRcd'), + tag = cms.string( options.tag ), + onlyAppendUpdatePolicy = cms.untracked.bool(True) + )), + frontierKey = cms.untracked.string(options.frontierKey) +) + -process.Test1 = cms.EDAnalyzer("LHCInfoPerLSPopConAnalyzer", +process.Test1 = cms.EDAnalyzer(("LHCInfoPerLSPopConAnalyzer" if options.mode == "endFill" + else "LHCInfoPerLSOnlinePopConAnalyzer"), SinceAppendMode = cms.bool(True), record = cms.string('LHCInfoPerLSRcd'), name = cms.untracked.string('LHCInfo'), - Source = cms.PSet(fill = cms.untracked.uint32(6417), + Source = cms.PSet( startTime = cms.untracked.string(options.startTime), endTime = cms.untracked.string(options.endTime), - endFill = cms.untracked.bool(True if options.mode == "endFill" else False), + endFill = cms.untracked.bool(options.mode == "endFill"), name = cms.untracked.string("LHCInfoPerLSPopConSourceHandler"), - connectionString = cms.untracked.string("oracle://cms_orcon_adg/CMS_RUNTIME_LOGGER"), - omsBaseUrl = cms.untracked.string("http://vocms0184.cern.ch/agg/api/v1"), - authenticationPath = cms.untracked.string(""), - debug=cms.untracked.bool(False) - ), + connectionString = cms.untracked.string(options.sourceConnection), + omsBaseUrl = cms.untracked.string(options.oms), + authenticationPath = cms.untracked.string(options.authenticationPath), + debug=cms.untracked.bool(False), # Additional logs + debugLogic=cms.untracked.bool(options.debugLogic), + defaultCrossingAngleX = cms.untracked.double(options.defaultXangleX), + defaultCrossingAngleY = cms.untracked.double(options.defaultXangleY), + defaultBetaStarX = cms.untracked.double(options.defaultBetaX), + defaultBetaStarY = cms.untracked.double(options.defaultBetaY), + minBetaStar = cms.untracked.double(options.minBetaStar), + maxBetaStar = cms.untracked.double(options.maxBetaStar), + minCrossingAngle = cms.untracked.double(options.minCrossingAngle), + maxCrossingAngle = cms.untracked.double(options.maxCrossingAngle), + ), loggingOn = cms.untracked.bool(True), IsDestDbCheckedInQueryLog = cms.untracked.bool(False) ) -process.p = cms.Path(process.Test1) +process.p = cms.Path(process.Test1) \ No newline at end of file diff --git a/CondTools/RunInfo/src/FillInfoPopConSourceHandler.cc b/CondTools/RunInfo/src/FillInfoPopConSourceHandler.cc index 545be7b1827df..ee401b2730fb3 100644 --- a/CondTools/RunInfo/src/FillInfoPopConSourceHandler.cc +++ b/CondTools/RunInfo/src/FillInfoPopConSourceHandler.cc @@ -11,7 +11,6 @@ #include "CoralBase/Attribute.h" #include "CoralBase/AttributeSpecification.h" #include "CoralBase/TimeStamp.h" -#include #include #include #include @@ -146,7 +145,6 @@ void FillInfoPopConSourceHandler::getNewObjects() { coral::ICursor &fillDataCursor = fillDataQuery->execute(); //initialize loop variables unsigned short previousFillNumber = 1; - unsigned short currentFill = m_firstFill; cond::Time_t previousFillEndTime = 0ULL, afterPreviousFillEndTime = 0ULL, beforeStableBeamStartTime = 0ULL; if (tagInfo().size > 0) { previousFillNumber = previousFill->fillNumber(); @@ -167,7 +165,7 @@ void FillInfoPopConSourceHandler::getNewObjects() { fillDataCursor.currentRow().toOutputStream(qs); edm::LogInfo(m_name) << qs.str() << "\nfrom " << m_name << "::getNewObjects"; } - currentFill = fillDataCursor.currentRow()[std::string("LHCFILL")].data(); + unsigned short currentFill = fillDataCursor.currentRow()[std::string("LHCFILL")].data(); coral::Attribute const &bunches1Attribute = fillDataCursor.currentRow()[std::string("NBUNCHESBEAM1")]; if (bunches1Attribute.isNull()) { bunches1 = 0; diff --git a/CondTools/RunInfo/src/LHCInfoHelper.cc b/CondTools/RunInfo/src/LHCInfoHelper.cc index 54503068b8924..e23f4cc199e58 100644 --- a/CondTools/RunInfo/src/LHCInfoHelper.cc +++ b/CondTools/RunInfo/src/LHCInfoHelper.cc @@ -5,7 +5,9 @@ // Returns lumi-type IOV (packed using cond::time::lumiTime) from // last LS of last Run of the specified Fill //***************************************************************** -cond::Time_t cond::lhcInfoHelper::getFillLastLumiIOV(const cond::OMSService& oms, unsigned short fillId) { + +std::pair cond::lhcInfoHelper::getFillLastRunAndLS(const cond::OMSService& oms, + unsigned short fillId) { // Define query auto query = oms.query("lumisections"); query->addOutputVars({"lumisection_number", "run_number"}); @@ -27,5 +29,10 @@ cond::Time_t cond::lhcInfoHelper::getFillLastLumiIOV(const cond::OMSService& oms // Return the final IOV auto lastRun = queryResult.back().get("run_number"); auto lastLumi = queryResult.back().get("lumisection_number"); - return cond::time::lumiTime(lastRun, lastLumi); + return std::make_pair(lastRun, lastLumi); } + +cond::Time_t cond::lhcInfoHelper::getFillLastLumiIOV(const cond::OMSService& oms, unsigned short fillId) { + auto [lastRun, lastLumi] = getFillLastRunAndLS(oms, fillId); + return cond::time::lumiTime(lastRun, lastLumi); +} \ No newline at end of file diff --git a/CondTools/RunInfo/src/LHCInfoPerFillPopConSourceHandler.cc b/CondTools/RunInfo/src/LHCInfoPerFillPopConSourceHandler.cc new file mode 100644 index 0000000000000..553a0b6d9e2d6 --- /dev/null +++ b/CondTools/RunInfo/src/LHCInfoPerFillPopConSourceHandler.cc @@ -0,0 +1,744 @@ +#include "CondTools/RunInfo/interface/LHCInfoPerFillPopConSourceHandler.h" +#include "CondCore/CondDB/interface/ConnectionPool.h" +#include "CondFormats/Common/interface/TimeConversions.h" +#include "CondFormats/RunInfo/interface/LHCInfoPerFill.h" +#include "CondTools/RunInfo/interface/LumiSectionFilter.h" +#include "CondTools/RunInfo/interface/LHCInfoHelper.h" +#include "CondTools/RunInfo/interface/OMSAccess.h" +#include "CoralBase/Attribute.h" +#include "CoralBase/AttributeList.h" +#include "CoralBase/AttributeSpecification.h" +#include "CoralBase/TimeStamp.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "RelationalAccess/ICursor.h" +#include "RelationalAccess/IQuery.h" +#include "RelationalAccess/ISchema.h" +#include "RelationalAccess/ISessionProxy.h" + +using std::make_pair; +using std::pair; + +namespace cond { + namespace theLHCInfoPerFillPopConImpl { + + static const pair s_fillTypeMap[] = { + make_pair("PROTONS", LHCInfoPerFill::PROTONS), + make_pair("IONS", LHCInfoPerFill::IONS), + make_pair("COSMICS", LHCInfoPerFill::COSMICS), + make_pair("GAP", LHCInfoPerFill::GAP)}; + + static const pair s_particleTypeMap[] = { + make_pair("PROTON", LHCInfoPerFill::PROTON), + make_pair("PB82", LHCInfoPerFill::PB82), + make_pair("AR18", LHCInfoPerFill::AR18), + make_pair("D", LHCInfoPerFill::D), + make_pair("XE54", LHCInfoPerFill::XE54)}; + + LHCInfoPerFill::FillType fillTypeFromString(const std::string& s_fill_type) { + for (auto const& i : s_fillTypeMap) + if (s_fill_type == i.first) + return i.second; + return LHCInfoPerFill::UNKNOWN; + } + + LHCInfoPerFill::ParticleType particleTypeFromString(const std::string& s_particle_type) { + for (auto const& i : s_particleTypeMap) + if (s_particle_type == i.first) + return i.second; + return LHCInfoPerFill::NONE; + } + } // namespace theLHCInfoPerFillPopConImpl + + namespace impl { + + template <> + LHCInfoPerFill::FillType from_string(const std::string& attributeValue) { + return from_string_impl( + attributeValue, LHCInfoPerFill::UNKNOWN); + } + + template <> + LHCInfoPerFill::ParticleType from_string(const std::string& attributeValue) { + return from_string_impl( + attributeValue, LHCInfoPerFill::NONE); + } + + } // namespace impl +} // namespace cond + +namespace theLHCInfoPerFillImpl { + + bool makeFillPayload(std::unique_ptr& targetPayload, const cond::OMSServiceResult& queryResult) { + bool ret = false; + if (!queryResult.empty()) { + auto row = *queryResult.begin(); + auto currentFill = row.get("fill_number"); + auto bunches1 = row.get("bunches_beam1"); + auto bunches2 = row.get("bunches_beam2"); + auto collidingBunches = row.get("bunches_colliding"); + auto targetBunches = row.get("bunches_target"); + auto fillType = row.get("fill_type_runtime"); + auto particleType1 = row.get("fill_type_party1"); + auto particleType2 = row.get("fill_type_party2"); + auto intensityBeam1 = row.get("intensity_beam1"); + auto intensityBeam2 = row.get("intensity_beam2"); + auto energy = row.get("energy"); + auto creationTime = row.get("start_time"); + auto stableBeamStartTime = row.get("start_stable_beam"); + std::string endTimeStr = row.get("end_time"); + auto beamDumpTime = + (endTimeStr == "null") ? 0 : cond::time::from_boost(row.get("end_time")); + auto injectionScheme = row.get("injection_scheme"); + targetPayload = std::make_unique(); + targetPayload->setFillNumber(currentFill); + targetPayload->setBunchesInBeam1(bunches1); + targetPayload->setBunchesInBeam2(bunches2); + targetPayload->setCollidingBunches(collidingBunches); + targetPayload->setTargetBunches(targetBunches); + targetPayload->setFillType(fillType); + targetPayload->setParticleTypeForBeam1(particleType1); + targetPayload->setParticleTypeForBeam2(particleType2); + targetPayload->setIntensityForBeam1(intensityBeam1); + targetPayload->setIntensityForBeam2(intensityBeam2); + targetPayload->setEnergy(energy); + targetPayload->setCreationTime(cond::time::from_boost(creationTime)); + targetPayload->setBeginTime(cond::time::from_boost(stableBeamStartTime)); + targetPayload->setEndTime(beamDumpTime); + targetPayload->setInjectionScheme(injectionScheme); + ret = true; + } + return ret; + } +} // namespace theLHCInfoPerFillImpl + +namespace theLHCInfoPerFillImpl { + static const std::map vecMap = { + {"Beam1/beamPhaseMean", 1}, {"Beam2/beamPhaseMean", 2}, {"Beam1/cavPhaseMean", 3}, {"Beam2/cavPhaseMean", 4}}; + void setElementData(cond::Time_t since, + const std::string& dipVal, + unsigned int elementNr, + float value, + LHCInfoPerFill& payload, + std::set& initList) { + if (initList.find(since) == initList.end()) { + payload.beam1VC().resize(LHCInfoPerFill::bunchSlots, 0.); + payload.beam2VC().resize(LHCInfoPerFill::bunchSlots, 0.); + payload.beam1RF().resize(LHCInfoPerFill::bunchSlots, 0.); + payload.beam2RF().resize(LHCInfoPerFill::bunchSlots, 0.); + initList.insert(since); + } + // set the current values to all of the payloads of the lumi section samples after the current since + if (elementNr < LHCInfoPerFill::bunchSlots) { + switch (vecMap.at(dipVal)) { + case 1: + payload.beam1VC()[elementNr] = value; + break; + case 2: + payload.beam2VC()[elementNr] = value; + break; + case 3: + payload.beam1RF()[elementNr] = value; + break; + case 4: + payload.beam2RF()[elementNr] = value; + break; + default: + break; + } + } + } +} // namespace theLHCInfoPerFillImpl + +namespace theLHCInfoPerFillImpl { + bool comparePayloads(const LHCInfoPerFill& rhs, const LHCInfoPerFill& lhs) { + if (rhs.fillNumber() != lhs.fillNumber() || rhs.delivLumi() != lhs.delivLumi() || rhs.recLumi() != lhs.recLumi() || + rhs.instLumi() != lhs.instLumi() || rhs.instLumiError() != lhs.instLumiError() || + rhs.lhcState() != lhs.lhcState() || rhs.lhcComment() != lhs.lhcComment() || + rhs.ctppsStatus() != lhs.ctppsStatus()) { + return false; + } + return true; + } + + size_t transferPayloads(const std::vector>>& buffer, + std::map>& iovsToTransfer, + std::shared_ptr& prevPayload) { + size_t niovs = 0; + std::stringstream condIovs; + std::stringstream formattedIovs; + for (auto& iov : buffer) { + bool add = false; + auto payload = iov.second; + cond::Time_t since = iov.first; + if (iovsToTransfer.empty()) { + add = true; + } else { + LHCInfoPerFill& lastAdded = *iovsToTransfer.rbegin()->second; + if (!comparePayloads(lastAdded, *payload)) { + add = true; + } + } + if (add) { + niovs++; + condIovs << since << " "; + formattedIovs << boost::posix_time::to_iso_extended_string(cond::time::to_boost(since)) << " "; + iovsToTransfer.insert(make_pair(since, payload)); + prevPayload = iov.second; + } + } + edm::LogInfo("transferPayloads") << "TRANSFERED IOVS: " << condIovs.str(); + edm::LogInfo("transferPayloads") << "FORMATTED TRANSFERED IOVS: " << formattedIovs.str(); + return niovs; + } + +} // namespace theLHCInfoPerFillImpl + +LHCInfoPerFillPopConSourceHandler::LHCInfoPerFillPopConSourceHandler(edm::ParameterSet const& pset) + : m_debug(pset.getUntrackedParameter("debug", false)), + m_startTime(), + m_endTime(), + m_endFillMode(pset.getUntrackedParameter("endFill", true)), + m_name(pset.getUntrackedParameter("name", "LHCInfoPerFillPopConSourceHandler")), + m_connectionString(pset.getUntrackedParameter("connectionString", "")), + m_ecalConnectionString(pset.getUntrackedParameter("ecalConnectionString", "")), + m_authpath(pset.getUntrackedParameter("authenticationPath", "")), + m_omsBaseUrl(pset.getUntrackedParameter("omsBaseUrl", "")), + m_fillPayload(), + m_prevPayload(), + m_tmpBuffer() { + if (!pset.getUntrackedParameter("startTime").empty()) { + m_startTime = boost::posix_time::time_from_string(pset.getUntrackedParameter("startTime")); + } + boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); + m_endTime = now; + if (!pset.getUntrackedParameter("endTime").empty()) { + m_endTime = boost::posix_time::time_from_string(pset.getUntrackedParameter("endTime")); + if (m_endTime > now) + m_endTime = now; + } +} + +void LHCInfoPerFillPopConSourceHandler::getNewObjects() { + //if a new tag is created, transfer fake fill from 1 to the first fill for the first time + if (tagInfo().size == 0) { + edm::LogInfo(m_name) << "New tag " << tagInfo().name << "; from " << m_name << "::getNewObjects"; + } else { + //check what is already inside the database + edm::LogInfo(m_name) << "got info for tag " << tagInfo().name << ": size " << tagInfo().size + << ", last object valid since " << tagInfo().lastInterval.since << " ( " + << boost::posix_time::to_iso_extended_string( + cond::time::to_boost(tagInfo().lastInterval.since)) + << " ); from " << m_name << "::getNewObjects"; + } + + cond::Time_t lastSince = tagInfo().lastInterval.since; + if (tagInfo().isEmpty()) { + // for a new or empty tag in endFill mode, an empty payload should be added on top with since=1 + addEmptyPayload(1); + lastSince = 1; + if (!m_endFillMode) { + edm::LogInfo(m_name) << "Empty or new tag: uploading a default payload and ending the job"; + return; + } + } else { + edm::LogInfo(m_name) << "The last Iov in tag " << tagInfo().name << " valid since " << lastSince << "from " + << m_name << "::getNewObjects"; + } + + //retrieve the data from the relational database source + cond::persistency::ConnectionPool connection; + //configure the connection + if (m_debug) { + connection.setMessageVerbosity(coral::Debug); + } else { + connection.setMessageVerbosity(coral::Error); + } + connection.setAuthenticationPath(m_authpath); + connection.configure(); + //create the sessions + cond::persistency::Session session = connection.createSession(m_connectionString, false); + cond::persistency::Session session2 = connection.createSession(m_ecalConnectionString, false); + // fetch last payload when available + if (!tagInfo().lastInterval.payloadId.empty()) { + cond::persistency::Session session3 = dbSession(); + session3.transaction().start(true); + m_prevPayload = session3.fetchPayload(tagInfo().lastInterval.payloadId); + session3.transaction().commit(); + } + + boost::posix_time::ptime executionTime = boost::posix_time::second_clock::local_time(); + cond::Time_t executionTimeIov = cond::time::from_boost(executionTime); + + cond::Time_t startTimestamp = m_startTime.is_not_a_date_time() ? 0 : cond::time::from_boost(m_startTime); + cond::Time_t nextFillSearchTimestamp = + std::max(startTimestamp, m_endFillMode ? lastSince : m_prevPayload->createTime()); + + edm::LogInfo(m_name) << "Starting sampling at " + << boost::posix_time::to_simple_string(cond::time::to_boost(nextFillSearchTimestamp)); + + while (true) { + if (nextFillSearchTimestamp >= executionTimeIov) { + edm::LogInfo(m_name) << "Sampling ended at the time " + << boost::posix_time::to_simple_string(cond::time::to_boost(executionTimeIov)); + break; + } + boost::posix_time::ptime nextFillSearchTime = cond::time::to_boost(nextFillSearchTimestamp); + boost::posix_time::ptime startSampleTime; + boost::posix_time::ptime endSampleTime; + + cond::OMSService oms; + oms.connect(m_omsBaseUrl); + auto query = oms.query("fills"); + + edm::LogInfo(m_name) << "Searching new fill after " << boost::posix_time::to_simple_string(nextFillSearchTime); + query->filterNotNull("start_stable_beam").filterNotNull("fill_number"); + if (nextFillSearchTime > cond::time::to_boost(m_prevPayload->createTime())) { + query->filterGE("start_time", nextFillSearchTime); + } else { + query->filterGT("start_time", nextFillSearchTime); + } + + query->filterLT("start_time", m_endTime); + if (m_endFillMode) + query->filterNotNull("end_time"); + else + query->filterEQ("end_time", cond::OMSServiceQuery::SNULL); + + bool foundFill = query->execute(); + if (foundFill) + foundFill = theLHCInfoPerFillImpl::makeFillPayload(m_fillPayload, query->result()); + if (!foundFill) { + edm::LogInfo(m_name) << "No fill found - END of job."; + break; + } + + startSampleTime = cond::time::to_boost(m_fillPayload->createTime()); + cond::Time_t startFillTime = m_fillPayload->createTime(); + cond::Time_t endFillTime = m_fillPayload->endTime(); + unsigned short lhcFill = m_fillPayload->fillNumber(); + bool ongoingFill = endFillTime == 0ULL; + if (ongoingFill) { + edm::LogInfo(m_name) << "Found ongoing fill " << lhcFill << " created at " << cond::time::to_boost(startFillTime); + endSampleTime = executionTime; + nextFillSearchTimestamp = executionTimeIov; + } else { + edm::LogInfo(m_name) << "Found fill " << lhcFill << " created at " << cond::time::to_boost(startFillTime) + << " ending at " << cond::time::to_boost(endFillTime); + endSampleTime = cond::time::to_boost(endFillTime); + nextFillSearchTimestamp = endFillTime; + } + if (m_endFillMode || ongoingFill) { + getDipData(oms, startSampleTime, endSampleTime); + getLumiData(oms, lhcFill, startSampleTime, endSampleTime); + if (!m_tmpBuffer.empty()) { + boost::posix_time::ptime flumiStart = cond::time::to_boost(m_tmpBuffer.front().first); + boost::posix_time::ptime flumiStop = cond::time::to_boost(m_tmpBuffer.back().first); + edm::LogInfo(m_name) << "First lumi starts at " << flumiStart << " last lumi starts at " << flumiStop; + session.transaction().start(true); + getCTPPSData(session, startSampleTime, endSampleTime); + session.transaction().commit(); + session2.transaction().start(true); + getEcalData(session2, startSampleTime, endSampleTime); + session2.transaction().commit(); + } + } + + if (!m_endFillMode) { + if (m_tmpBuffer.size() > 1) { + throw cms::Exception("LHCInfoPerFillPopConSourceHandler") + << "More than 1 payload buffered for writing in duringFill mode.\ + In this mode only up to 1 payload can be written"; + } else if (m_tmpBuffer.size() == 1) { + if (theLHCInfoPerFillImpl::comparePayloads(*(m_tmpBuffer.begin()->second), *m_prevPayload)) { + m_tmpBuffer.clear(); + edm::LogInfo(m_name) + << "The buffered payload has the same data as the previous payload in the tag. It will not be written."; + } + } else if (m_tmpBuffer.empty()) { + addEmptyPayload( + cond::lhcInfoHelper::getFillLastLumiIOV(oms, lhcFill)); //the IOV doesn't matter when using OnlinePopCon + } + // In duringFill mode, convert the timestamp-type IOVs to lumiid-type IOVs + // before transferring the payloads from the buffer to the final collection + convertBufferedIovsToLumiid(m_timestampToLumiid); + } + + size_t niovs = theLHCInfoPerFillImpl::transferPayloads(m_tmpBuffer, m_iovs, m_prevPayload); + edm::LogInfo(m_name) << "Added " << niovs << " iovs within the Fill time"; + m_tmpBuffer.clear(); + m_timestampToLumiid.clear(); + + if (!m_endFillMode) { + return; + } + + // endFill mode only: + if (m_prevPayload->fillNumber() and !ongoingFill) { + if (m_endFillMode) { + addEmptyPayload(endFillTime); + } else { + addEmptyPayload(cond::lhcInfoHelper::getFillLastLumiIOV(oms, lhcFill)); + } + } + } +} + +std::string LHCInfoPerFillPopConSourceHandler::id() const { return m_name; } + +void LHCInfoPerFillPopConSourceHandler::addEmptyPayload(cond::Time_t iov) { + bool add = false; + if (m_iovs.empty()) { + if (!m_lastPayloadEmpty) + add = true; + } else { + auto lastAdded = m_iovs.rbegin()->second; + if (lastAdded->fillNumber() != 0) { + add = true; + } + } + if (add) { + auto newPayload = std::make_shared(); + m_iovs.insert(make_pair(iov, newPayload)); + m_prevPayload = newPayload; + edm::LogInfo(m_name) << "Added empty payload with IOV " << iov << " ( " + << boost::posix_time::to_iso_extended_string(cond::time::to_boost(iov)) << " )"; + } +} + +// Add payload to buffer and store corresponding lumiid IOV in m_timestampToLumiid map +void LHCInfoPerFillPopConSourceHandler::addPayloadToBuffer(cond::OMSServiceResultRef& row) { + auto startTime = row.get("start_time"); + auto delivLumi = row.get("delivered_lumi"); + auto recLumi = row.get("recorded_lumi"); + auto runNumber = std::stoul(row.get("run_number")); + auto lsNumber = std::stoul(row.get("lumisection_number")); + auto lumiid = cond::time::lumiTime(runNumber, lsNumber); + + LHCInfoPerFill* thisLumiSectionInfo = m_fillPayload->cloneFill(); + m_tmpBuffer.emplace_back(make_pair(cond::time::from_boost(startTime), thisLumiSectionInfo)); + if (!m_endFillMode) { + m_timestampToLumiid.insert(make_pair(cond::time::from_boost(startTime), lumiid)); + } + LHCInfoPerFill& payload = *thisLumiSectionInfo; + payload.setDelivLumi(delivLumi); + payload.setRecLumi(recLumi); +} + +void LHCInfoPerFillPopConSourceHandler::convertBufferedIovsToLumiid( + std::map timestampToLumiid) { + for (auto& item : m_tmpBuffer) { + // Check if the lumiid IOV corresponding to the timestamp is present in the map + if (timestampToLumiid.find(item.first) == timestampToLumiid.end()) { + throw cms::Exception("LHCInfoPerFillPopConSourceHandler") + << "Can't find corresponding lumiid IOV for timestamp " << item.first << "\n"; + } + // Update the buffer with the lumiid-type IOV + item.first = timestampToLumiid.at(item.first); + } +} + +size_t LHCInfoPerFillPopConSourceHandler::getLumiData(const cond::OMSService& oms, + unsigned short fillId, + const boost::posix_time::ptime& beginFillTime, + const boost::posix_time::ptime& endFillTime) { + auto query = oms.query("lumisections"); + query->addOutputVars( + {"start_time", "delivered_lumi", "recorded_lumi", "beams_stable", "run_number", "lumisection_number"}); + query->filterEQ("fill_number", fillId); + query->filterGT("start_time", beginFillTime).filterLT("start_time", endFillTime); + query->filterEQ("beams_stable", "true"); + query->limit(cond::lhcInfoHelper::kLumisectionsQueryLimit); + if (query->execute()) { + auto queryResult = query->result(); + edm::LogInfo(m_name) << "Found " << queryResult.size() << " lumisections with STABLE BEAM during the fill " + << fillId; + + if (!queryResult.empty()) { + if (m_endFillMode) { + auto firstRow = queryResult.front(); + addPayloadToBuffer(firstRow); + } + + auto lastRow = queryResult.back(); + addPayloadToBuffer(lastRow); + } + } + return 0; +} + +void LHCInfoPerFillPopConSourceHandler::getDipData(const cond::OMSService& oms, + const boost::posix_time::ptime& beginFillTime, + const boost::posix_time::ptime& endFillTime) { + // unsure how to handle this. + // the old implementation is not helping: apparently it is checking only the bunchconfiguration for the first diptime set of values... + auto query1 = oms.query("diplogger/dip/acc/LHC/RunControl/CirculatingBunchConfig/Beam1"); + query1->filterGT("dip_time", beginFillTime).filterLT("dip_time", endFillTime); + //This query is limited to 100 rows, but currently only one is used + //If all this data is needed and saved properly the limit has to be set: query1->limit(...) + if (query1->execute()) { + auto res = query1->result(); + if (!res.empty()) { + std::bitset bunchConfiguration1(0ULL); + auto row = *res.begin(); + auto vbunchConf1 = row.getArray("value"); + for (auto vb : vbunchConf1) { + if (vb != 0) { + unsigned short slot = (vb - 1) / 10 + 1; + bunchConfiguration1[slot] = true; + } + } + m_fillPayload->setBunchBitsetForBeam1(bunchConfiguration1); + } + } + auto query2 = oms.query("diplogger/dip/acc/LHC/RunControl/CirculatingBunchConfig/Beam2"); + query2->filterGT("dip_time", beginFillTime).filterLT("dip_time", endFillTime); + //This query is limited to 100 rows, but currently only one is used + if (query2->execute()) { + auto res = query2->result(); + if (!res.empty()) { + std::bitset bunchConfiguration2(0ULL); + auto row = *res.begin(); + auto vbunchConf2 = row.getArray("value"); + for (auto vb : vbunchConf2) { + if (vb != 0) { + unsigned short slot = (vb - 1) / 10 + 1; + bunchConfiguration2[slot] = true; + } + } + m_fillPayload->setBunchBitsetForBeam2(bunchConfiguration2); + } + } + + auto query3 = oms.query("diplogger/dip/CMS/LHC/LumiPerBunch"); + query3->filterGT("dip_time", beginFillTime).filterLT("dip_time", endFillTime); + //This query is limited to 100 rows, but currently only one is used + if (query3->execute()) { + auto res = query3->result(); + if (!res.empty()) { + std::vector lumiPerBX; + auto row = *res.begin(); + auto lumiBunchInst = row.getArray("lumi_bunch_inst"); + for (auto lb : lumiBunchInst) { + if (lb != 0.) { + lumiPerBX.push_back(lb); + } + } + m_fillPayload->setLumiPerBX(lumiPerBX); + } + } +} + +bool LHCInfoPerFillPopConSourceHandler::getCTPPSData(cond::persistency::Session& session, + const boost::posix_time::ptime& beginFillTime, + const boost::posix_time::ptime& endFillTime) { + //run the fifth query against the CTPPS schema + //Initializing the CMS_CTP_CTPPS_COND schema. + coral::ISchema& CTPPS = session.coralSession().schema("CMS_PPS_SPECT_COND"); + //execute query for CTPPS Data + std::unique_ptr CTPPSDataQuery(CTPPS.newQuery()); + //FROM clause + CTPPSDataQuery->addToTableList(std::string("PPS_LHC_MACHINE_PARAMS")); + //SELECT clause + CTPPSDataQuery->addToOutputList(std::string("DIP_UPDATE_TIME")); + CTPPSDataQuery->addToOutputList(std::string("LHC_STATE")); + CTPPSDataQuery->addToOutputList(std::string("LHC_COMMENT")); + if (m_debug) { + CTPPSDataQuery->addToOutputList(std::string("RUN_NUMBER")); + CTPPSDataQuery->addToOutputList(std::string("LUMI_SECTION")); + } + //WHERE CLAUSE + coral::AttributeList CTPPSDataBindVariables; + CTPPSDataBindVariables.extend(std::string("beginFillTime")); + CTPPSDataBindVariables.extend(std::string("endFillTime")); + CTPPSDataBindVariables[std::string("beginFillTime")].data() = coral::TimeStamp(beginFillTime); + CTPPSDataBindVariables[std::string("endFillTime")].data() = coral::TimeStamp(endFillTime); + std::string conditionStr = std::string("DIP_UPDATE_TIME>= :beginFillTime and DIP_UPDATE_TIME< :endFillTime"); + CTPPSDataQuery->setCondition(conditionStr, CTPPSDataBindVariables); + //ORDER BY clause + CTPPSDataQuery->addToOrderList(std::string("DIP_UPDATE_TIME")); + //define query output + coral::AttributeList CTPPSDataOutput; + CTPPSDataOutput.extend(std::string("DIP_UPDATE_TIME")); + CTPPSDataOutput.extend(std::string("LHC_STATE")); + CTPPSDataOutput.extend(std::string("LHC_COMMENT")); + if (m_debug) { + CTPPSDataOutput.extend(std::string("RUN_NUMBER")); + CTPPSDataOutput.extend(std::string("LUMI_SECTION")); + } + CTPPSDataQuery->defineOutput(CTPPSDataOutput); + //execute the query + coral::ICursor& CTPPSDataCursor = CTPPSDataQuery->execute(); + cond::Time_t dipTime = 0; + std::string lhcState = "", lhcComment = "", ctppsStatus = ""; + + //debug informations + unsigned int lumiSection = 0; + cond::Time_t runNumber = 0; + cond::Time_t savedDipTime = 0; + unsigned int savedLumiSection = 0; + cond::Time_t savedRunNumber = 0; + + bool ret = false; + LumiSectionFilter filter(m_tmpBuffer); + while (CTPPSDataCursor.next()) { + if (m_debug) { + std::ostringstream CTPPS; + CTPPSDataCursor.currentRow().toOutputStream(CTPPS); + } + coral::Attribute const& dipTimeAttribute = CTPPSDataCursor.currentRow()[std::string("DIP_UPDATE_TIME")]; + if (!dipTimeAttribute.isNull()) { + dipTime = cond::time::from_boost(dipTimeAttribute.data().time()); + if (filter.process(dipTime)) { + ret = true; + coral::Attribute const& lhcStateAttribute = CTPPSDataCursor.currentRow()[std::string("LHC_STATE")]; + if (!lhcStateAttribute.isNull()) { + lhcState = lhcStateAttribute.data(); + } + coral::Attribute const& lhcCommentAttribute = CTPPSDataCursor.currentRow()[std::string("LHC_COMMENT")]; + if (!lhcCommentAttribute.isNull()) { + lhcComment = lhcCommentAttribute.data(); + } + + if (m_debug) { + coral::Attribute const& runNumberAttribute = CTPPSDataCursor.currentRow()[std::string("RUN_NUMBER")]; + if (!runNumberAttribute.isNull()) { + runNumber = runNumberAttribute.data(); + } + coral::Attribute const& lumiSectionAttribute = CTPPSDataCursor.currentRow()[std::string("LUMI_SECTION")]; + if (!lumiSectionAttribute.isNull()) { + lumiSection = lumiSectionAttribute.data(); + } + } + + for (auto it = filter.current(); it != m_tmpBuffer.end(); it++) { + // set the current values to all of the payloads of the lumi section samples after the current since + LHCInfoPerFill& payload = *(it->second); + payload.setLhcState(lhcState); + payload.setLhcComment(lhcComment); + payload.setCtppsStatus(ctppsStatus); + + if (m_debug) { + savedDipTime = dipTime; + savedLumiSection = lumiSection; + savedRunNumber = runNumber; + } + } + } + } + } + if (m_debug) { + edm::LogInfo(m_name) << "Last assigned: " + << "DipTime: " << savedDipTime << " " + << "LumiSection: " << savedLumiSection << " " + << "RunNumber: " << savedRunNumber; + } + return ret; +} + +bool LHCInfoPerFillPopConSourceHandler::getEcalData(cond::persistency::Session& session, + const boost::posix_time::ptime& lowerTime, + const boost::posix_time::ptime& upperTime) { + //run the sixth query against the CMS_DCS_ENV_PVSS_COND schema + //Initializing the CMS_DCS_ENV_PVSS_COND schema. + coral::ISchema& ECAL = session.nominalSchema(); + //start the transaction against the fill logging schema + //execute query for ECAL Data + std::unique_ptr ECALDataQuery(ECAL.newQuery()); + //FROM clause + ECALDataQuery->addToTableList(std::string("BEAM_PHASE")); + //SELECT clause + ECALDataQuery->addToOutputList(std::string("CHANGE_DATE")); + ECALDataQuery->addToOutputList(std::string("DIP_value")); + ECALDataQuery->addToOutputList(std::string("element_nr")); + ECALDataQuery->addToOutputList(std::string("VALUE_NUMBER")); + //WHERE CLAUSE + coral::AttributeList ECALDataBindVariables; + ECALDataBindVariables.extend(std::string("lowerTime")); + ECALDataBindVariables.extend(std::string("upperTime")); + ECALDataBindVariables[std::string("lowerTime")].data() = coral::TimeStamp(lowerTime); + ECALDataBindVariables[std::string("upperTime")].data() = coral::TimeStamp(upperTime); + std::string conditionStr = std::string( + "(DIP_value LIKE '%beamPhaseMean%' OR DIP_value LIKE '%cavPhaseMean%') AND CHANGE_DATE >= :lowerTime AND " + "CHANGE_DATE < :upperTime"); + + ECALDataQuery->setCondition(conditionStr, ECALDataBindVariables); + //ORDER BY clause + ECALDataQuery->addToOrderList(std::string("CHANGE_DATE")); + ECALDataQuery->addToOrderList(std::string("DIP_value")); + ECALDataQuery->addToOrderList(std::string("element_nr")); + //define query output + coral::AttributeList ECALDataOutput; + ECALDataOutput.extend(std::string("CHANGE_DATE")); + ECALDataOutput.extend(std::string("DIP_value")); + ECALDataOutput.extend(std::string("element_nr")); + ECALDataOutput.extend(std::string("VALUE_NUMBER")); + //ECALDataQuery->limitReturnedRows( 14256 ); //3564 entries per vector. + ECALDataQuery->defineOutput(ECALDataOutput); + //execute the query + coral::ICursor& ECALDataCursor = ECALDataQuery->execute(); + cond::Time_t changeTime = 0; + cond::Time_t firstTime = 0; + std::string dipVal = ""; + unsigned int elementNr = 0; + float value = 0.; + std::set initializedVectors; + LumiSectionFilter filter(m_tmpBuffer); + bool ret = false; + if (m_prevPayload.get()) { + for (auto& lumiSlot : m_tmpBuffer) { + lumiSlot.second->setBeam1VC(m_prevPayload->beam1VC()); + lumiSlot.second->setBeam2VC(m_prevPayload->beam2VC()); + lumiSlot.second->setBeam1RF(m_prevPayload->beam1RF()); + lumiSlot.second->setBeam2RF(m_prevPayload->beam2RF()); + } + } + std::map iovMap; + if (m_tmpBuffer.empty()) { + return ret; + } + cond::Time_t lowerLumi = m_tmpBuffer.front().first; + while (ECALDataCursor.next()) { + if (m_debug) { + std::ostringstream ECAL; + ECALDataCursor.currentRow().toOutputStream(ECAL); + } + coral::Attribute const& changeDateAttribute = ECALDataCursor.currentRow()[std::string("CHANGE_DATE")]; + if (!changeDateAttribute.isNull()) { + ret = true; + boost::posix_time::ptime chTime = changeDateAttribute.data().time(); + // move the first IOV found to the start of the fill interval selected + if (changeTime == 0) { + firstTime = cond::time::from_boost(chTime); + } + changeTime = cond::time::from_boost(chTime); + cond::Time_t iovTime = changeTime; + if (changeTime == firstTime) + iovTime = lowerLumi; + coral::Attribute const& dipValAttribute = ECALDataCursor.currentRow()[std::string("DIP_value")]; + coral::Attribute const& valueNumberAttribute = ECALDataCursor.currentRow()[std::string("VALUE_NUMBER")]; + coral::Attribute const& elementNrAttribute = ECALDataCursor.currentRow()[std::string("element_nr")]; + if (!dipValAttribute.isNull() and !valueNumberAttribute.isNull()) { + dipVal = dipValAttribute.data(); + elementNr = elementNrAttribute.data(); + value = valueNumberAttribute.data(); + if (std::isnan(value)) + value = 0.; + if (filter.process(iovTime)) { + iovMap.insert(make_pair(changeTime, filter.current()->first)); + for (auto it = filter.current(); it != m_tmpBuffer.end(); it++) { + LHCInfoPerFill& payload = *(it->second); + theLHCInfoPerFillImpl::setElementData(it->first, dipVal, elementNr, value, payload, initializedVectors); + } + } + } + } + } + if (m_debug) { + for (auto& im : iovMap) { + edm::LogInfo(m_name) << "Found iov=" << im.first << " (" << cond::time::to_boost(im.first) << " ) moved to " + << im.second << " ( " << cond::time::to_boost(im.second) << " )"; + } + } + return ret; +} diff --git a/CondTools/RunInfo/src/LHCInfoPerLSPopConSourceHandler.cc b/CondTools/RunInfo/src/LHCInfoPerLSPopConSourceHandler.cc new file mode 100644 index 0000000000000..8cb01ac930cf8 --- /dev/null +++ b/CondTools/RunInfo/src/LHCInfoPerLSPopConSourceHandler.cc @@ -0,0 +1,659 @@ +#include "CondTools/RunInfo/interface/LHCInfoPerLSPopConSourceHandler.h" +#include "CondCore/CondDB/interface/ConnectionPool.h" +#include "CondCore/CondDB/interface/Types.h" +#include "CondFormats/Common/interface/TimeConversions.h" +#include "CondTools/RunInfo/interface/LHCInfoHelper.h" +#include "CondTools/RunInfo/interface/OMSAccess.h" +#include "CoralBase/Attribute.h" +#include "CoralBase/AttributeList.h" +#include "CoralBase/AttributeSpecification.h" +#include "CoralBase/TimeStamp.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "RelationalAccess/ICursor.h" +#include "RelationalAccess/IQuery.h" +#include "RelationalAccess/ISchema.h" +#include "RelationalAccess/ISessionProxy.h" +#include +#include + +using std::make_pair; +using std::pair; + +namespace theLHCInfoPerLSImpl { + bool comparePayloads(const LHCInfoPerLS& rhs, const LHCInfoPerLS& lhs) { + if (rhs.fillNumber() != lhs.fillNumber() || rhs.runNumber() != lhs.runNumber() || + rhs.crossingAngleX() != lhs.crossingAngleX() || rhs.crossingAngleY() != lhs.crossingAngleY() || + rhs.betaStarX() != lhs.betaStarX() || rhs.betaStarY() != lhs.betaStarY()) { + return false; + } + return true; + } + + size_t transferPayloads(const std::vector>>& buffer, + std::map>& iovsToTransfer, + std::shared_ptr& prevPayload, + const std::map, pair>& lsIdMap, + cond::Time_t startStableBeamTime, + cond::Time_t endStableBeamTime) { + int lsMissingInPPS = 0; + int xAngleBothZero = 0, xAngleBothNonZero = 0, xAngleNegative = 0; + int betaNegative = 0; + size_t niovs = 0; + std::stringstream condIovs; + std::stringstream missingLsList; + for (auto& iov : buffer) { + bool add = false; + auto payload = iov.second; + cond::Time_t since = iov.first; + if (iovsToTransfer.empty()) { + add = true; + } else { + LHCInfoPerLS& lastAdded = *iovsToTransfer.rbegin()->second; + if (!comparePayloads(lastAdded, *payload)) { + add = true; + } + } + auto id = make_pair(payload->runNumber(), payload->lumiSection()); + bool stableBeam = since >= startStableBeamTime && since <= endStableBeamTime; + bool isMissing = lsIdMap.find(id) != lsIdMap.end() && id != lsIdMap.at(id); + if (stableBeam && isMissing) { + missingLsList << id.first << "_" << id.second << " "; + lsMissingInPPS += isMissing; + } + if (add && !isMissing) { + niovs++; + if (stableBeam) { + if (payload->crossingAngleX() == 0 && payload->crossingAngleY() == 0) + xAngleBothZero++; + if (payload->crossingAngleX() != 0 && payload->crossingAngleY() != 0) + xAngleBothNonZero++; + if (payload->crossingAngleX() < 0 || payload->crossingAngleY() < 0) + xAngleNegative++; + if (payload->betaStarX() < 0 || payload->betaStarY() < 0) + betaNegative++; + } + + condIovs << since << " "; + iovsToTransfer.insert(make_pair(since, payload)); + prevPayload = iov.second; + } + } + unsigned short fillNumber = (!buffer.empty()) ? buffer.front().second->fillNumber() : 0; + if (lsMissingInPPS > 0) { + edm::LogWarning("transferPayloads") + << "Number of stable beam LS in OMS without corresponding record in PPS DB for fill " << fillNumber << ": " + << lsMissingInPPS; + edm::LogWarning("transferPayloads") + << "Stable beam LS in OMS without corresponding record in PPS DB (run_LS): " << missingLsList.str(); + } + if (xAngleBothZero > 0) { + edm::LogWarning("transferPayloads") + << "Number of payloads written with crossingAngle == 0 for both X and Y for fill " << fillNumber << ": " + << xAngleBothZero; + } + if (xAngleBothNonZero > 0) { + edm::LogWarning("transferPayloads") + << "Number of payloads written with crossingAngle != 0 for both X and Y for fill " << fillNumber << ": " + << xAngleBothNonZero; + } + if (xAngleNegative > 0) { + edm::LogWarning("transferPayloads") + << "Number of payloads written with negative crossingAngle for fill " << fillNumber << ": " << xAngleNegative; + } + if (betaNegative > 0) { + edm::LogWarning("transferPayloads") + << "Number of payloads written with negative betaSta for fill " << fillNumber << ": " << betaNegative; + } + + edm::LogInfo("transferPayloads") << "TRANSFERED COND IOVS: " << condIovs.str(); + return niovs; + } + +} // namespace theLHCInfoPerLSImpl + +LHCInfoPerLSPopConSourceHandler::LHCInfoPerLSPopConSourceHandler(edm::ParameterSet const& pset) + : m_debug(pset.getUntrackedParameter("debug", false)), + m_startTime(), + m_endTime(), + m_endFillMode(pset.getUntrackedParameter("endFill", true)), + m_name(pset.getUntrackedParameter("name", "LHCInfoPerLSPopConSourceHandler")), + m_connectionString(pset.getUntrackedParameter("connectionString", "")), + m_authpath(pset.getUntrackedParameter("authenticationPath", "")), + m_omsBaseUrl(pset.getUntrackedParameter("omsBaseUrl", "")), + m_debugLogic(pset.getUntrackedParameter("debugLogic", false)), + m_defaultCrossingAngleX(pset.getUntrackedParameter("defaultCrossingAngleX", 0)), + m_defaultCrossingAngleY(pset.getUntrackedParameter("defaultCrossingAngleY", 0)), + m_defaultBetaStarX(pset.getUntrackedParameter("defaultBetaStarX", 0)), + m_defaultBetaStarY(pset.getUntrackedParameter("defaultBetaStarY", 0)), + m_minBetaStar(pset.getUntrackedParameter("minBetaStar", 0.1)), + m_maxBetaStar(pset.getUntrackedParameter("maxBetaStar", 100.)), + m_minCrossingAngle(pset.getUntrackedParameter("minCrossingAngle", 10.)), + m_maxCrossingAngle(pset.getUntrackedParameter("maxCrossingAngle", 500.)), + m_fillPayload(), + m_prevPayload(), + m_tmpBuffer() { + if (!pset.getUntrackedParameter("startTime").empty()) { + m_startTime = boost::posix_time::time_from_string(pset.getUntrackedParameter("startTime")); + } + boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); + m_endTime = now; + if (!pset.getUntrackedParameter("endTime").empty()) { + m_endTime = boost::posix_time::time_from_string(pset.getUntrackedParameter("endTime")); + if (m_endTime > now) + m_endTime = now; + } + if (m_debugLogic && m_endFillMode) { + throw cms::Exception("invalid argument") << "debugLogic == true not supported for endFillMode == true"; + } +} + +LHCInfoPerLSPopConSourceHandler::~LHCInfoPerLSPopConSourceHandler() = default; + +void LHCInfoPerLSPopConSourceHandler::getNewObjects() { + populateIovs(); + if (!m_endFillMode) { // duringFill mode + filterInvalidPayloads(); + } +} + +void LHCInfoPerLSPopConSourceHandler::filterInvalidPayloads() { + // note: at the moment used only in duringFill mode so the m_iovs is quaranteed to have size() <= 1 + // but iterating through the whole map is implemented just in case the way it's used changes + auto it = m_iovs.begin(); + while (it != m_iovs.end()) { + std::stringstream payloadData; + payloadData << "LS = " << it->second->lumiSection() << ", run = " << it->second->runNumber() << ", " + << "xAngleX = " << it->second->crossingAngleX() << " urad, " + << "xAngleY = " << it->second->crossingAngleY() << " urad, " + << "beta*X = " << it->second->betaStarX() << " m, " + << "beta*Y = " << it->second->betaStarY() << " m"; + if (!isPayloadValid(*(it->second))) { + edm::LogWarning(m_name) << "Skipping upload of payload with invalid values: " << payloadData.str(); + m_iovs.erase(it++); // note: post-increment necessary to avoid using invalidated iterators + } else { + edm::LogInfo(m_name) << "Payload to be uploaded: " << payloadData.str(); + ++it; + } + } +} + +bool LHCInfoPerLSPopConSourceHandler::isPayloadValid(const LHCInfoPerLS& payload) const { + if ((payload.crossingAngleX() == 0. && payload.crossingAngleY() == 0.) || + (payload.crossingAngleX() != 0. && payload.crossingAngleY() != 0.)) + return false; + auto non0CrossingAngle = payload.crossingAngleX() != 0. ? payload.crossingAngleX() : payload.crossingAngleY(); + if ((non0CrossingAngle < m_minCrossingAngle || m_maxCrossingAngle < non0CrossingAngle) || + (payload.betaStarX() < m_minBetaStar || m_maxBetaStar < payload.betaStarX()) || + (payload.betaStarX() < m_minBetaStar || m_maxBetaStar < payload.betaStarX())) + return false; + return true; +} + +void LHCInfoPerLSPopConSourceHandler::populateIovs() { + //if a new tag is created, transfer fake fill from 1 to the first fill for the first time + if (tagInfo().size == 0) { + edm::LogInfo(m_name) << "New tag " << tagInfo().name << "; from " << m_name << "::getNewObjects"; + } else { + //check what is already inside the database + edm::LogInfo(m_name) << "got info for tag " << tagInfo().name << ": size " << tagInfo().size + << ", last object valid since " << tagInfo().lastInterval.since << " ( " + << boost::posix_time::to_iso_extended_string( + cond::time::to_boost(tagInfo().lastInterval.since)) + << " ); from " << m_name << "::getNewObjects"; + } + + cond::Time_t lastSince = tagInfo().lastInterval.since; + if (tagInfo().isEmpty()) { + // for a new or empty tag in endFill mode, an empty payload should be added on top with since=1 + if (m_endFillMode) { + addEmptyPayload(1); + lastSince = 1; + } else { //duringFill mode + edm::LogInfo(m_name) << "Empty or new tag: uploading a default payload and ending the job"; + cond::OMSService oms; + oms.connect(m_omsBaseUrl); + addDefaultPayload(1, 1, 1, 1); + return; + } + } else { + edm::LogInfo(m_name) << "The last Iov in tag " << tagInfo().name << " valid since " << lastSince << "from " + << m_name << "::getNewObjects"; + } + + //retrieve the data from the relational database source + cond::persistency::ConnectionPool connection; + //configure the connection + if (m_debug) { + connection.setMessageVerbosity(coral::Debug); + } else { + connection.setMessageVerbosity(coral::Error); + } + connection.setAuthenticationPath(m_authpath); + connection.configure(); + //create the sessions + cond::persistency::Session session = connection.createSession(m_connectionString, false); + // fetch last payload when available + if (!tagInfo().lastInterval.payloadId.empty()) { + cond::persistency::Session session3 = dbSession(); + session3.transaction().start(true); + m_prevPayload = session3.fetchPayload(tagInfo().lastInterval.payloadId); + session3.transaction().commit(); + + // find startFillTime and endFillTime of the most recent fill already saved in the tag + if (m_prevPayload->fillNumber() != 0) { + cond::OMSService oms; + oms.connect(m_omsBaseUrl); + auto query = oms.query("fills"); + query->addOutputVar("end_time"); + query->addOutputVar("start_time"); + query->filterEQ("fill_number", m_prevPayload->fillNumber()); + bool foundFill = query->execute(); + if (foundFill) { + auto result = query->result(); + + if (!result.empty()) { + std::string endTimeStr = (*result.begin()).get("end_time"); + m_prevEndFillTime = (endTimeStr == "null") + ? 0 + : cond::time::from_boost((*result.begin()).get("end_time")); + auto startFillTime = (*result.begin()).get("start_time"); + m_prevStartFillTime = cond::time::from_boost(startFillTime); + } else { + foundFill = false; + } + } + if (!foundFill) { + edm::LogError(m_name) << "Could not find end time of fill #" << m_prevPayload->fillNumber(); + } + } else { + m_prevEndFillTime = 0; + m_prevStartFillTime = 0; + } + } + + boost::posix_time::ptime executionTime = boost::posix_time::second_clock::local_time(); + cond::Time_t executionTimeIov = cond::time::from_boost(executionTime); + + cond::Time_t startTimestamp = m_startTime.is_not_a_date_time() ? 0 : cond::time::from_boost(m_startTime); + cond::Time_t nextFillSearchTimestamp = std::max(startTimestamp, m_endFillMode ? lastSince : m_prevEndFillTime); + + edm::LogInfo(m_name) << "Starting sampling at " + << boost::posix_time::to_simple_string(cond::time::to_boost(nextFillSearchTimestamp)); + + while (true) { + if (nextFillSearchTimestamp >= executionTimeIov) { + edm::LogInfo(m_name) << "Sampling ended at the time " + << boost::posix_time::to_simple_string(cond::time::to_boost(executionTimeIov)); + break; + } + boost::posix_time::ptime nextFillSearchTime = cond::time::to_boost(nextFillSearchTimestamp); + boost::posix_time::ptime startSampleTime; + boost::posix_time::ptime endSampleTime; + + cond::OMSService oms; + oms.connect(m_omsBaseUrl); + auto query = oms.query("fills"); + + if (m_debugLogic) + m_prevEndFillTime = 0ULL; + + if (!m_endFillMode and m_prevPayload->fillNumber() and m_prevEndFillTime == 0ULL) { + // continue processing unfinished fill with some payloads already in the tag + edm::LogInfo(m_name) << "Searching started fill #" << m_prevPayload->fillNumber(); + query->filterEQ("fill_number", m_prevPayload->fillNumber()); + bool foundFill = query->execute(); + if (foundFill) + foundFill = makeFillPayload(m_fillPayload, query->result()); + if (!foundFill) { + edm::LogError(m_name) << "Could not find fill #" << m_prevPayload->fillNumber(); + break; + } + } else { + edm::LogInfo(m_name) << "Searching new fill after " << boost::posix_time::to_simple_string(nextFillSearchTime); + query->filterNotNull("start_stable_beam").filterNotNull("fill_number"); + if (nextFillSearchTime > cond::time::to_boost(m_prevStartFillTime)) { + query->filterGE("start_time", nextFillSearchTime); + } else { + query->filterGT("start_time", nextFillSearchTime); + } + + query->filterLT("start_time", m_endTime); + if (m_endFillMode) + query->filterNotNull("end_time"); + else + query->filterEQ("end_time", cond::OMSServiceQuery::SNULL); + + bool querySuccess = query->execute(); + if (!querySuccess) { + edm::LogError(m_name) << "OMS fill query failed (http status not 200 nor 201). Request URL:\n" << query->url(); + } + bool foundFill = querySuccess ? makeFillPayload(m_fillPayload, query->result()) : false; + + if (!foundFill) { + if (m_endFillMode) { + edm::LogInfo(m_name) << "No fill found - END of job."; + } else { //duringFill mode + edm::LogInfo(m_name) << "No ongoing fill found."; + addDefaultPayload(1, m_prevPayload->fillNumber(), oms); //IOV doesn't matter here in duringFill mode + } + break; + } + } + startSampleTime = cond::time::to_boost(m_startFillTime); + + unsigned short lhcFill = m_fillPayload->fillNumber(); + bool ongoingFill = m_endFillTime == 0ULL; + if (ongoingFill) { + edm::LogInfo(m_name) << "Found ongoing fill " << lhcFill << " created at " + << cond::time::to_boost(m_startFillTime); + endSampleTime = executionTime; + nextFillSearchTimestamp = executionTimeIov; + } else { + edm::LogInfo(m_name) << "Found fill " << lhcFill << " created at " << cond::time::to_boost(m_startFillTime) + << " ending at " << cond::time::to_boost(m_endFillTime); + endSampleTime = cond::time::to_boost(m_endFillTime); + nextFillSearchTimestamp = m_endFillTime; + } + + if (m_endFillMode || ongoingFill) { + getLumiData(oms, lhcFill, startSampleTime, endSampleTime); + + if (!m_tmpBuffer.empty()) { + boost::posix_time::ptime flumiStart = cond::time::to_boost(m_tmpBuffer.front().first); + boost::posix_time::ptime flumiStop = cond::time::to_boost(m_tmpBuffer.back().first); + edm::LogInfo(m_name) << "First buffered lumi starts at " << flumiStart << " last lumi starts at " << flumiStop; + session.transaction().start(true); + getCTPPSData(session, startSampleTime, endSampleTime); + session.transaction().commit(); + } + } + + if (!m_endFillMode) { + if (m_tmpBuffer.size() > 1) { + throw cms::Exception("LHCInfoPerFillPopConSourceHandler") + << "More than 1 payload buffered for writing in duringFill mode.\ + In this mode only up to 1 payload can be written"; + } else if (m_tmpBuffer.size() == 1) { + if (theLHCInfoPerLSImpl::comparePayloads(*(m_tmpBuffer.begin()->second), *m_prevPayload)) { + m_tmpBuffer.clear(); + edm::LogInfo(m_name) + << "The buffered payload has the same data as the previous payload in the tag. It will not be written."; + } + } else if (m_tmpBuffer.empty()) { + // note: the IOV doesn't matter when using OnlinePopCon: + addDefaultPayload(1, lhcFill, oms); + } + } + + size_t niovs = theLHCInfoPerLSImpl::transferPayloads( + m_tmpBuffer, m_iovs, m_prevPayload, m_lsIdMap, m_startStableBeamTime, m_endStableBeamTime); + edm::LogInfo(m_name) << "Added " << niovs << " iovs within the Fill time"; + m_tmpBuffer.clear(); + m_lsIdMap.clear(); + + if (!m_endFillMode) { + return; + } + + // endFill mode only: + if (niovs) { + m_prevEndFillTime = m_endFillTime; + m_prevStartFillTime = m_startFillTime; + } + if (m_prevPayload->fillNumber() and !ongoingFill) { + if (m_endFillMode) { + addEmptyPayload(m_endFillTime); + } + } + } +} + +std::string LHCInfoPerLSPopConSourceHandler::id() const { return m_name; } + +void LHCInfoPerLSPopConSourceHandler::addEmptyPayload(cond::Time_t iov) { + bool add = false; + if (m_iovs.empty()) { + if (!m_lastPayloadEmpty) + add = true; + } else { + auto lastAdded = m_iovs.rbegin()->second; + if (lastAdded->fillNumber() != 0) { + add = true; + } + } + if (add) { + auto newPayload = std::make_shared(); + m_iovs.insert(make_pair(iov, newPayload)); + m_prevPayload = newPayload; + m_prevEndFillTime = 0; + m_prevStartFillTime = 0; + edm::LogInfo(m_name) << "Added empty payload with IOV" << iov << " ( " + << boost::posix_time::to_iso_extended_string(cond::time::to_boost(iov)) << " )"; + } +} + +void LHCInfoPerLSPopConSourceHandler::addDefaultPayload(cond::Time_t iov, + unsigned short fill, + const cond::OMSService& oms) { + auto defaultPayload = std::make_shared(); + defaultPayload->setFillNumber(fill); + auto [lastRun, lastLumi] = cond::lhcInfoHelper::getFillLastRunAndLS(oms, fill); + addDefaultPayload(iov, fill, lastRun, lastLumi); +} + +void LHCInfoPerLSPopConSourceHandler::addDefaultPayload(cond::Time_t iov, + unsigned short fill, + int run, + unsigned short lumi) { + auto defaultPayload = std::make_shared(); + defaultPayload->setFillNumber(fill); + defaultPayload->setRunNumber(run); + defaultPayload->setLumiSection(lumi); + defaultPayload->setCrossingAngleX(m_defaultCrossingAngleX); + defaultPayload->setCrossingAngleY(m_defaultCrossingAngleY); + defaultPayload->setBetaStarX(m_defaultBetaStarX); + defaultPayload->setBetaStarY(m_defaultBetaStarY); + + if (m_prevPayload && theLHCInfoPerLSImpl::comparePayloads(*defaultPayload, *m_prevPayload)) { + edm::LogInfo(m_name) + << "The default payload has the same data as the previous payload in the tag. It will not be written."; + } else { + m_iovs.insert(make_pair(iov, defaultPayload)); + edm::LogInfo(m_name) << "Uploading the default payload."; + } +} + +bool LHCInfoPerLSPopConSourceHandler::makeFillPayload(std::unique_ptr& targetPayload, + const cond::OMSServiceResult& queryResult) { + bool ret = false; + if (!queryResult.empty()) { + auto row = *queryResult.begin(); + auto currentFill = row.get("fill_number"); + m_startFillTime = cond::time::from_boost(row.get("start_time")); + std::string endTimeStr = row.get("end_time"); + if (m_debugLogic) { + m_endFillTime = 0; + } else { + m_endFillTime = + (endTimeStr == "null") ? 0 : cond::time::from_boost(row.get("end_time")); + } + m_startStableBeamTime = cond::time::from_boost(row.get("start_stable_beam")); + m_endStableBeamTime = cond::time::from_boost(row.get("end_stable_beam")); + targetPayload = std::make_unique(); + targetPayload->setFillNumber(currentFill); + ret = true; + } + return ret; +} + +void LHCInfoPerLSPopConSourceHandler::addPayloadToBuffer(cond::OMSServiceResultRef& row) { + auto lumiTime = row.get("start_time"); + LHCInfoPerLS* thisLumiSectionInfo = new LHCInfoPerLS(*m_fillPayload); + thisLumiSectionInfo->setLumiSection(std::stoul(row.get("lumisection_number"))); + thisLumiSectionInfo->setRunNumber(std::stoul(row.get("run_number"))); + m_lsIdMap[make_pair(thisLumiSectionInfo->runNumber(), thisLumiSectionInfo->lumiSection())] = make_pair(-1, -1); + if (m_endFillMode) { + m_tmpBuffer.emplace_back(make_pair(cond::time::from_boost(lumiTime), thisLumiSectionInfo)); + } else { + m_tmpBuffer.emplace_back( + make_pair(cond::time::lumiTime(thisLumiSectionInfo->runNumber(), thisLumiSectionInfo->lumiSection()), + thisLumiSectionInfo)); + } +} + +size_t LHCInfoPerLSPopConSourceHandler::bufferAllLS(const cond::OMSServiceResult& queryResult) { + for (auto r : queryResult) { + addPayloadToBuffer(r); + } + return queryResult.size(); +} + +size_t LHCInfoPerLSPopConSourceHandler::getLumiData(const cond::OMSService& oms, + unsigned short fillId, + const boost::posix_time::ptime& beginFillTime, + const boost::posix_time::ptime& endFillTime) { + auto query = oms.query("lumisections"); + query->addOutputVars({"start_time", "run_number", "beams_stable", "lumisection_number"}); + query->filterEQ("fill_number", fillId); + query->filterGT("start_time", beginFillTime).filterLT("start_time", endFillTime); + query->limit(cond::lhcInfoHelper::kLumisectionsQueryLimit); + size_t nlumi = 0; + if (query->execute()) { + auto queryResult = query->result(); + if (m_endFillMode) { + nlumi = bufferAllLS(queryResult); + } else if (!queryResult.empty()) { + auto newestPayload = queryResult.back(); + if (newestPayload.get("beams_stable") == "true" || m_debugLogic) { + addPayloadToBuffer(newestPayload); + nlumi = 1; + edm::LogInfo(m_name) << "Buffered most recent lumisection:" + << " LS: " << newestPayload.get("lumisection_number") + << " run: " << newestPayload.get("run_number"); + } + } + edm::LogInfo(m_name) << "Found " << queryResult.size() << " lumisections during the fill " << fillId; + } else { + edm::LogInfo(m_name) << "OMS query for lumisections of fill " << fillId << "failed, status:" << query->status(); + } + return nlumi; +} +bool LHCInfoPerLSPopConSourceHandler::getCTPPSData(cond::persistency::Session& session, + const boost::posix_time::ptime& beginFillTime, + const boost::posix_time::ptime& endFillTime) { + //run the fifth query against the CTPPS schema + //Initializing the CMS_CTP_CTPPS_COND schema. + coral::ISchema& CTPPS = session.coralSession().schema("CMS_PPS_SPECT_COND"); + //execute query for CTPPS Data + std::unique_ptr CTPPSDataQuery(CTPPS.newQuery()); + //FROM clause + CTPPSDataQuery->addToTableList(std::string("PPS_LHC_MACHINE_PARAMS")); + //SELECT clause + CTPPSDataQuery->addToOutputList(std::string("DIP_UPDATE_TIME")); + CTPPSDataQuery->addToOutputList(std::string("LUMI_SECTION")); + CTPPSDataQuery->addToOutputList(std::string("RUN_NUMBER")); + CTPPSDataQuery->addToOutputList(std::string("FILL_NUMBER")); + CTPPSDataQuery->addToOutputList(std::string("XING_ANGLE_P5_X_URAD")); + CTPPSDataQuery->addToOutputList(std::string("XING_ANGLE_P5_Y_URAD")); + CTPPSDataQuery->addToOutputList(std::string("BETA_STAR_P5_X_M")); + CTPPSDataQuery->addToOutputList(std::string("BETA_STAR_P5_Y_M")); + //WHERE CLAUSE + coral::AttributeList CTPPSDataBindVariables; + CTPPSDataBindVariables.extend(std::string("beginFillTime")); + CTPPSDataBindVariables.extend(std::string("endFillTime")); + CTPPSDataBindVariables[std::string("beginFillTime")].data() = coral::TimeStamp(beginFillTime); + CTPPSDataBindVariables[std::string("endFillTime")].data() = coral::TimeStamp(endFillTime); + std::string conditionStr = std::string("DIP_UPDATE_TIME>= :beginFillTime and DIP_UPDATE_TIME< :endFillTime"); + CTPPSDataQuery->setCondition(conditionStr, CTPPSDataBindVariables); + //ORDER BY clause + CTPPSDataQuery->addToOrderList(std::string("DIP_UPDATE_TIME")); + //define query output + coral::AttributeList CTPPSDataOutput; + CTPPSDataOutput.extend(std::string("DIP_UPDATE_TIME")); + CTPPSDataOutput.extend(std::string("LUMI_SECTION")); + CTPPSDataOutput.extend(std::string("RUN_NUMBER")); + CTPPSDataOutput.extend(std::string("FILL_NUMBER")); + CTPPSDataOutput.extend(std::string("XING_ANGLE_P5_X_URAD")); + CTPPSDataOutput.extend(std::string("XING_ANGLE_P5_Y_URAD")); + CTPPSDataOutput.extend(std::string("BETA_STAR_P5_X_M")); + CTPPSDataOutput.extend(std::string("BETA_STAR_P5_Y_M")); + CTPPSDataQuery->defineOutput(CTPPSDataOutput); + //execute the query + coral::ICursor& CTPPSDataCursor = CTPPSDataQuery->execute(); + unsigned int lumiSection = 0; + cond::Time_t runNumber = 0; + int fillNumber = 0; + float crossingAngleX = 0., betaStarX = 0.; + float crossingAngleY = 0., betaStarY = 0.; + + bool ret = false; + int wrongFillNumbers = 0; + std::stringstream wrongFills; + std::vector>>::iterator current = m_tmpBuffer.begin(); + while (CTPPSDataCursor.next()) { + if (m_debug) { + std::ostringstream CTPPS; + CTPPSDataCursor.currentRow().toOutputStream(CTPPS); + } + coral::Attribute const& dipTimeAttribute = CTPPSDataCursor.currentRow()[std::string("DIP_UPDATE_TIME")]; + if (!dipTimeAttribute.isNull()) { + ret = true; + coral::Attribute const& lumiSectionAttribute = CTPPSDataCursor.currentRow()[std::string("LUMI_SECTION")]; + if (!lumiSectionAttribute.isNull()) { + lumiSection = lumiSectionAttribute.data(); + } + coral::Attribute const& runNumberAttribute = CTPPSDataCursor.currentRow()[std::string("RUN_NUMBER")]; + if (!runNumberAttribute.isNull()) { + runNumber = runNumberAttribute.data(); + } + coral::Attribute const& fillNumberAttribute = CTPPSDataCursor.currentRow()[std::string("FILL_NUMBER")]; + if (!fillNumberAttribute.isNull()) { + fillNumber = fillNumberAttribute.data(); + } + coral::Attribute const& crossingAngleXAttribute = + CTPPSDataCursor.currentRow()[std::string("XING_ANGLE_P5_X_URAD")]; + if (!crossingAngleXAttribute.isNull()) { + crossingAngleX = crossingAngleXAttribute.data(); + } + coral::Attribute const& crossingAngleYAttribute = + CTPPSDataCursor.currentRow()[std::string("XING_ANGLE_P5_Y_URAD")]; + if (!crossingAngleYAttribute.isNull()) { + crossingAngleY = crossingAngleYAttribute.data(); + } + coral::Attribute const& betaStarXAttribute = CTPPSDataCursor.currentRow()[std::string("BETA_STAR_P5_X_M")]; + if (!betaStarXAttribute.isNull()) { + betaStarX = betaStarXAttribute.data(); + } + coral::Attribute const& betaStarYAttribute = CTPPSDataCursor.currentRow()[std::string("BETA_STAR_P5_Y_M")]; + if (!betaStarYAttribute.isNull()) { + betaStarY = betaStarYAttribute.data(); + } + if (current != m_tmpBuffer.end() && current->second->fillNumber() != fillNumber) { + wrongFills << "( " << runNumber << "_" << lumiSection << " fill: OMS: " << current->second->fillNumber() + << " PPSdb: " << fillNumber << " ) "; + wrongFillNumbers++; + } + for (; current != m_tmpBuffer.end() && make_pair(current->second->runNumber(), current->second->lumiSection()) <= + make_pair(runNumber, lumiSection); + current++) { + LHCInfoPerLS& payload = *(current->second); + payload.setCrossingAngleX(crossingAngleX); + payload.setCrossingAngleY(crossingAngleY); + payload.setBetaStarX(betaStarX); + payload.setBetaStarY(betaStarY); + payload.setLumiSection(lumiSection); + payload.setRunNumber(runNumber); + if (m_lsIdMap.find(make_pair(payload.runNumber(), payload.lumiSection())) != m_lsIdMap.end()) { + m_lsIdMap[make_pair(payload.runNumber(), payload.lumiSection())] = make_pair(runNumber, lumiSection); + } + } + } + } + if (wrongFillNumbers) { + edm::LogWarning("getCTPPSData") << "Number of records from PPS DB with fillNumber different from OMS: " + << wrongFillNumbers; + edm::LogWarning("getCTPPSData") << "Records from PPS DB with fillNumber different from OMS: " << wrongFills.str(); + } + return ret; +} diff --git a/CondTools/RunInfo/src/LHCInfoPopConSourceHandler.cc b/CondTools/RunInfo/src/LHCInfoPopConSourceHandler.cc index 0a344bd479711..c65760b113794 100644 --- a/CondTools/RunInfo/src/LHCInfoPopConSourceHandler.cc +++ b/CondTools/RunInfo/src/LHCInfoPopConSourceHandler.cc @@ -1,5 +1,6 @@ #include "CondCore/CondDB/interface/ConnectionPool.h" #include "CondFormats/Common/interface/TimeConversions.h" +#include "CondTools/RunInfo/interface/LHCInfoHelper.h" #include "CondTools/RunInfo/interface/LHCInfoPopConSourceHandler.h" #include "CondTools/RunInfo/interface/LumiSectionFilter.h" #include "CondTools/RunInfo/interface/OMSAccess.h" @@ -9,11 +10,11 @@ #include "CoralBase/TimeStamp.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/isFinite.h" #include "RelationalAccess/ICursor.h" #include "RelationalAccess/IQuery.h" #include "RelationalAccess/ISchema.h" #include "RelationalAccess/ISessionProxy.h" -#include #include #include #include @@ -159,7 +160,7 @@ size_t LHCInfoPopConSourceHandler::getLumiData(const cond::OMSService& oms, query->addOutputVars({"start_time", "delivered_lumi", "recorded_lumi"}); query->filterEQ("fill_number", fillId); query->filterGT("start_time", beginFillTime).filterLT("start_time", endFillTime); - query->limit(kLumisectionsQueryLimit); + query->limit(cond::lhcInfoHelper::kLumisectionsQueryLimit); size_t nlumi = 0; if (query->execute()) { auto res = query->result(); @@ -454,7 +455,7 @@ bool LHCInfoPopConSourceHandler::getEcalData(cond::persistency::Session& session dipVal = dipValAttribute.data(); elementNr = elementNrAttribute.data(); value = valueNumberAttribute.data(); - if (std::isnan(value)) + if (edm::isNotFinite(value)) value = 0.; if (filter.process(iovTime)) { iovMap.insert(std::make_pair(changeTime, filter.current()->first)); diff --git a/CondTools/RunInfo/test/last_lumi.txt b/CondTools/RunInfo/test/last_lumi.txt new file mode 100644 index 0000000000000..c4ed12a727c79 --- /dev/null +++ b/CondTools/RunInfo/test/last_lumi.txt @@ -0,0 +1 @@ +1663505258250241 diff --git a/CondTools/RunInfo/test/test_lhcInfoNewPopCon.sh b/CondTools/RunInfo/test/test_lhcInfoNewPopCon.sh index 750e1501f07a4..8ef3751949388 100755 --- a/CondTools/RunInfo/test/test_lhcInfoNewPopCon.sh +++ b/CondTools/RunInfo/test/test_lhcInfoNewPopCon.sh @@ -2,15 +2,24 @@ SCRIPTS_DIR=${CMSSW_BASE}/src/CondTools/RunInfo/python -function die { echo Failure $1: status $2 ; exit $2 ; } +function die { + log_file="$3" + if [ -f "$log_file" ]; then + echo "Log output:" + cat "$log_file" + fi + echo "Failure $1: status $2" + exit $2 +} assert_equal() { expected="$1" actual="$2" message="$3" + log_file="$4" if [ "$expected" != "$actual" ]; then - die "$message: Expected $expected, but got $actual" 1 + die "$message: Expected $expected, but got $actual" 1 "$log_file" fi } @@ -20,7 +29,7 @@ function assert_found_fills { shift 2 for fill_nr in "$@"; do if ! grep -q "Found fill $fill_nr" "$log_file"; then - die "$script_name didn't find fill $fill_nr" 1 # TODO FIX + die "$script_name didn't find fill $fill_nr" 1 "$log_file" fi done } @@ -31,43 +40,45 @@ echo "testing LHCInfoPerFillPopConAnalyzer in endFill mode for startTime=\"2022- cmsRun ${SCRIPTS_DIR}/LHCInfoPerFillPopConAnalyzer_cfg.py mode=endFill \ destinationConnection="sqlite_file:lhcinfo_pop_unit_test.db" \ startTime="2022-10-24 01:00:00.000" endTime="2022-10-24 20:00:00.000" \ - tag=fill_end_test > fill_end_test.log || die "cmsRun LHCInfoPerFillPopConAnalyzer_cfg.py mode=endFill" $? + tag=fill_end_test > fill_end_test.log || die "cmsRun LHCInfoPerFillPopConAnalyzer_cfg.py mode=endFill" $? "fill_end_test.log" assert_equal 7 `cat fill_end_test.log | grep -E '^Since ' | \ - wc -l` "LHCInfoPerFillPopConAnalyzer in EndFill mode written wrong number of payloads" + wc -l` "LHCInfoPerFillPopConAnalyzer in EndFill mode written wrong number of payloads" "fill_end_test.log" assert_found_fills fill_end_test.log "LHCInfoPerFillPopConAnalyzer in EndFill mode" 8307 8309 echo "testing LHCInfoPerLSPopConAnalyzer in endFill mode for startTime=\"2022-10-24 01:00:00.000\" endTime=\"2022-10-24 20:00:00.000\"" cmsRun ${SCRIPTS_DIR}/LHCInfoPerLSPopConAnalyzer_cfg.py mode=endFill \ destinationConnection="sqlite_file:lhcinfo_pop_unit_test.db" \ startTime="2022-10-24 01:00:00.000" endTime="2022-10-24 20:00:00.000" \ - tag=ls_end_test > ls_end_test.log || die "cmsRun LHCInfoPerLSPopConAnalyzer_cfg.py mode=endFill" $? + tag=ls_end_test > ls_end_test.log || die "cmsRun LHCInfoPerLSPopConAnalyzer_cfg.py mode=endFill" $? "ls_end_test.log" assert_equal 169 `cat ls_end_test.log | grep -E '^Since ' | \ - wc -l` "LHCInfoPerLSPopConAnalyzer in endFill mode written wrong number of payloads" + wc -l` "LHCInfoPerLSPopConAnalyzer in endFill mode written wrong number of payloads" "ls_end_test.log" assert_found_fills ls_end_test.log "LHCInfoPerLSPopConAnalyzer in endFill mode" 8307 8309 echo "testing LHCInfoPerLSPopConAnalyzer in endFill mode for startTime=\"2022-07-11 22:00:00.000\" endTime=\"2022-07-12 18:10:10.000\"" cmsRun ${SCRIPTS_DIR}/LHCInfoPerLSPopConAnalyzer_cfg.py mode=endFill \ destinationConnection="sqlite_file:lhcinfo_pop_unit_test.db" \ startTime="2022-07-11 22:00:00.000" endTime="2022-07-12 18:10:10.000" \ - tag=ls_end_test2 > ls_end_test2.log || die "cmsRun LHCInfoPerLSPopConAnalyzer_cfg.py mode=endFill" $? + tag=ls_end_test2 > ls_end_test2.log || die "cmsRun LHCInfoPerLSPopConAnalyzer_cfg.py mode=endFill" $? "ls_end_test2.log" assert_equal 70 `cat ls_end_test2.log | grep -E '^Since ' | \ - wc -l` "LHCInfoPerLSPopConAnalyzer in endFill mode written wrong number of payloads" + wc -l` "LHCInfoPerLSPopConAnalyzer in endFill mode written wrong number of payloads" "ls_end_test2.log" assert_found_fills ls_end_test2.log "LHCInfoPerLSPopConAnalyzer in endFill mode" 7967 +echo "1663505258250241" > last_lumi.txt + echo "testing LHCInfoPerFillPopConAnalyzer in duringFill mode for startTime=\"2022-10-24 01:00:00.000\" endTime=\"2022-10-24 20:00:00.000\"" cmsRun ${SCRIPTS_DIR}/LHCInfoPerFillPopConAnalyzer_cfg.py mode=duringFill \ destinationConnection="sqlite_file:lhcinfo_pop_unit_test.db" \ startTime="2022-10-24 01:00:00.000" endTime="2022-10-24 20:00:00.000" \ - tag=fill_during_test > fill_during_test.log || die "cmsRun LHCInfoPerFillPopConAnalyzer_cfg.py" $? -assert_equal 1 `cat fill_during_test.log | grep -E '^Since ' | \ - wc -l` "LHCInfoPerFillPopConAnalyzer in DuringFill written wrong number of payloads" -assert_found_fills fill_during_test.log "LHCInfoPerFillPopConAnalyzer in DuringFill" 8307 8309 + lastLumiFile=last_lumi.txt \ + tag=fill_during_test > fill_during_test.log || die "cmsRun LHCInfoPerFillPopConAnalyzer_cfg.py" $? "fill_during_test.log" +assert_equal 1 `cat fill_during_test.log | grep -E 'uploaded with since' | \ + wc -l` "LHCInfoPerFillPopConAnalyzer in DuringFill written wrong number of payloads" "fill_during_test.log" echo "testing LHCInfoPerLSPopConAnalyzer in duringFill mode for startTime=\"2022-10-24 01:00:00.000\" endTime=\"2022-10-24 20:00:00.000\"" cmsRun ${SCRIPTS_DIR}/LHCInfoPerLSPopConAnalyzer_cfg.py mode=duringFill \ destinationConnection="sqlite_file:lhcinfo_pop_unit_test.db" \ + lastLumiFile=last_lumi.txt \ startTime="2022-10-24 01:00:00.000" endTime="2022-10-24 20:00:00.000" \ - tag=ls_during_test > ls_during_test.log || die "cmsRun LHCInfoPerLSPopConAnalyzer_cfg.py mode=duringFill" $? -assert_equal 1 `cat ls_during_test.log | grep -E '^Since ' | \ - wc -l` "LHCInfoPerLSPopConAnalyzer in duringFill mode written wrong number of payloads" -assert_found_fills ls_during_test.log "LHCInfoPerLSPopConAnalyzer in duringFill mode" 8307 8309 + tag=ls_during_test > ls_during_test.log || die "cmsRun LHCInfoPerLSPopConAnalyzer_cfg.py mode=duringFill" $? "ls_during_test.log" +assert_equal 1 `cat ls_during_test.log | grep -E 'uploaded with since' | \ + wc -l` "LHCInfoPerLSPopConAnalyzer in duringFill mode written wrong number of payloads" "ls_during_test.log" diff --git a/Configuration/PyReleaseValidation/python/MatrixUtil.py b/Configuration/PyReleaseValidation/python/MatrixUtil.py index 05f43391f1c96..8dcc10ce98fdc 100644 --- a/Configuration/PyReleaseValidation/python/MatrixUtil.py +++ b/Configuration/PyReleaseValidation/python/MatrixUtil.py @@ -134,10 +134,10 @@ def das(self, das_options, dataset): elif self.skimEvents: from os import getenv if getenv("JENKINS_PREFIX") is not None: - # to be assured that whatever happens the files are only those at CERN - command = "das-up-to-nevents.py -d %s -e %d -pc"%(dataset,self.events) + # to be sure that whatever happens the files are only those at CERN + command = "das-up-to-nevents.py -d %s -e %d -pc -l lumi_ranges.txt"%(dataset,self.events) else: - command = "das-up-to-nevents.py -d %s -e %d"%(dataset,self.events) + command = "das-up-to-nevents.py -d %s -e %d -l lumi_ranges.txt"%(dataset,self.events) # Run filter on DAS output if self.ib_blacklist: command += " | grep -E -v " diff --git a/Configuration/PyReleaseValidation/python/WorkFlowRunner.py b/Configuration/PyReleaseValidation/python/WorkFlowRunner.py index 14203705882e9..78a11ed4c09f3 100644 --- a/Configuration/PyReleaseValidation/python/WorkFlowRunner.py +++ b/Configuration/PyReleaseValidation/python/WorkFlowRunner.py @@ -137,7 +137,14 @@ def closeCmd(i,ID): isInputOk = False inFile = 'filelist:' + basename(dasOutputPath) + + if com.skimEvents: + lumiRangeFile='step%d_lumiRanges.log'%(istep,) + cmd2 = preamble + "mv lumi_ranges.txt " + lumiRangeFile + retStep = self.doCmd(cmd2) + print("---") + else: #chaining IO , which should be done in WF object already and not using stepX.root but .root cmd += com diff --git a/Configuration/PyReleaseValidation/python/relval_data_highstats.py b/Configuration/PyReleaseValidation/python/relval_data_highstats.py index 146fd6e7b27fb..72063528b98f3 100644 --- a/Configuration/PyReleaseValidation/python/relval_data_highstats.py +++ b/Configuration/PyReleaseValidation/python/relval_data_highstats.py @@ -23,7 +23,8 @@ wf_number = wf_number + offset_pd * p_n wf_number = wf_number + offset_events * evs wf_number = round(wf_number,6) - step_name = "Run" + pd + era.split("Run")[1] + "_10k" + + step_name = "Run" + pd.replace("ParkingDouble","Park2") + era.split("Run")[1] + "_" + e_key y = str(base_wf) suff = "ZB_" if "ZeroBias" in step_name else "" workflows[wf_number] = ['',[step_name,'HLTDR3_' + y,'RECONANORUN3_' + suff + 'reHLT_'+y,'HARVESTRUN3_' + suff + y]] @@ -40,7 +41,8 @@ wf_number = wf_number + offset_pd * p_n wf_number = wf_number + offset_events * evs wf_number = round(wf_number,6) - step_name = "Run" + pd + era.split("Run")[1] + "_10k" + + step_name = "Run" + pd.replace("ParkingDouble","Park2") + era.split("Run")[1] + "_" + e_key y = str(base_wf) + "B" if "2023B" in era else str(base_wf) suff = "ZB_" if "ZeroBias" in step_name else "" workflows[wf_number] = ['',[step_name,'HLTDR3_' + y,'RECONANORUN3_' + suff + 'reHLT_'+y,'HARVESTRUN3_' + suff + y]] diff --git a/Configuration/PyReleaseValidation/python/relval_standard.py b/Configuration/PyReleaseValidation/python/relval_standard.py index c029d74f292c2..9d368812a5f51 100644 --- a/Configuration/PyReleaseValidation/python/relval_standard.py +++ b/Configuration/PyReleaseValidation/python/relval_standard.py @@ -583,11 +583,12 @@ wf_number = wf_number + offset_pd * p_n wf_number = wf_number + 0.0001 * 0.01 wf_number = round(wf_number,6) - step_name = "Run" + pd + era.split("Run")[1] + "_10k" + + step_name = "Run" + pd.replace("ParkingDouble","Park2") + era.split("Run")[1] + "_10k" y = str(base_wf) suff = "ZB_" if "ZeroBias" in step_name else "" workflows[wf_number] = ['',[step_name,'HLTDR3_' + y,'RECONANORUN3_' + suff + 'reHLT_'+y,'HARVESTRUN3_' + suff + y]] - + # 2023 base_wf = 2023 for e_n,era in enumerate(['Run2023D']): @@ -597,11 +598,11 @@ wf_number = wf_number + offset_pd * p_n wf_number = wf_number + 0.0001 * 0.01 wf_number = round(wf_number,6) - step_name = "Run" + pd + era.split("Run")[1] + "_10k" + + step_name = "Run" + pd.replace("ParkingDouble","Park2") + era.split("Run")[1] + "_10k" y = str(base_wf) + "B" if "2023B" in era else str(base_wf) suff = "ZB_" if "ZeroBias" in step_name else "" workflows[wf_number] = ['',[step_name,'HLTDR3_' + y,'RECONANORUN3_' + suff + 'reHLT_'+y,'HARVESTRUN3_' + suff + y]] - # 2022 base_wf = 2022 diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index a6097f612ebf7..06025976c4b9d 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -45,8 +45,8 @@ steps = Steps() #### Event to runs -event_steps = [0.01,0.05,0.15,0.25,0.5,1] #in millions -event_steps_k = ["10k","50k","150k","250k","500k","1M"] +event_steps = [0.01,0.05,0.1,0.15,0.25,0.5,1] #in millions +event_steps_k = ["10k","50k","100k","150k","250k","500k","1M"] ##TODO add an helper to convert the numbers to strings event_steps_dict = dict(zip(event_steps_k,event_steps)) #### Production test section #### steps['ProdMinBias']=merge([{'cfg':'MinBias_8TeV_pythia8_TuneCUETP8M1_cff','--relval':'9000,300'},step1Defaults]) @@ -653,7 +653,7 @@ for pd in pds_2024: dataset = "/" + pd + "/" + era + "-v1/RAW" for e_key,evs in event_steps_dict.items(): - step_name = "Run" + pd + era.split("Run")[1] + "_" + e_key + step_name = "Run" + pd.replace("ParkingDouble","Park2") + era.split("Run")[1] + "_" + e_key steps[step_name] = {'INPUT':InputInfo(dataSet=dataset,label=era.split("Run")[1],events=int(evs*1e6), skimEvents=True, location='STD')} ###2023 @@ -665,7 +665,7 @@ for pd in pds_2023: dataset = "/" + pd + "/" + era + "-v1/RAW" for e_key,evs in event_steps_dict.items(): - step_name = "Run" + pd + era.split("Run")[1] + "_" + e_key + step_name = "Run" + pd.replace("ParkingDouble","Park2") + era.split("Run")[1] + "_" + e_key steps[step_name] = {'INPUT':InputInfo(dataSet=dataset,label=era.split("Run")[1],events=int(evs*1e6), skimEvents=True, location='STD')} ###2022 diff --git a/Configuration/PyReleaseValidation/scripts/das-up-to-nevents.py b/Configuration/PyReleaseValidation/scripts/das-up-to-nevents.py index 05dea602a664a..e4e05305d623f 100755 --- a/Configuration/PyReleaseValidation/scripts/das-up-to-nevents.py +++ b/Configuration/PyReleaseValidation/scripts/das-up-to-nevents.py @@ -11,6 +11,8 @@ import os import json import sys +import itertools +import json ## Helpers base_cert_url = "https://cms-service-dqmdc.web.cern.ch/CAF/certification/" @@ -27,6 +29,13 @@ def get_url_clean(url): return BeautifulSoup(buffer.getvalue(), "lxml").text +def get_lumi_ranges(i): + result = [] + for _, b in itertools.groupby(enumerate(i), lambda pair: pair[1] - pair[0]): + b = list(b) + result.append([b[0][1],b[-1][1]]) + return result + def das_do_command(cmd): out = subprocess.check_output(cmd, shell=True, executable="/bin/bash").decode('utf8') return out.split("\n") @@ -90,6 +99,7 @@ def no_intersection(): parser.add_argument('--pandas', '-pd',action='store_true',help="Store the whole dataset (no event or threshold cut) in a csv") parser.add_argument('--proxy','-p', help='Allow to parse a x509 proxy if needed', type=str, default=None) parser.add_argument('--site','-s', help='Only data at specific site', type=str, default=None) + parser.add_argument('--lumis','-l', help='Output file for lumi ranges for the selected files (if black no lumiranges calculated)', type=str, default=None) parser.add_argument('--precheck','-pc', action='store_true', help='Check run per run before building the dataframes, to avoid huge caching.') args = parser.parse_args() @@ -106,6 +116,7 @@ def no_intersection(): threshold = args.threshold outfile = args.outfile site = args.site + lumis = args.lumis ## get the greatest golden json year = dataset.split("Run")[1][2:4] # from 20XX to XX @@ -222,8 +233,14 @@ def no_intersection(): df = df[df["events"] <= events] #jump too big files df.loc[:,"sum_evs"] = df.loc[:,"events"].cumsum() df = df[df["sum_evs"] < events] - + files = df.file + + if lumis is not None: + lumi_ranges = { int(r) : list(get_lumi_ranges(np.sort(np.concatenate(df.loc[df["run"]==r,"lumis"].values).ravel()).tolist())) for r in np.unique(df.run.values).tolist()} + + with open(lumis, 'w') as fp: + json.dump(lumi_ranges, fp) if outfile is not None: with open(outfile, 'w') as f: @@ -234,4 +251,4 @@ def no_intersection(): sys.exit(0) - + \ No newline at end of file diff --git a/Configuration/StandardSequences/python/SimL1EmulatorRepack_uGT_cff.py b/Configuration/StandardSequences/python/SimL1EmulatorRepack_uGT_cff.py index a6911252cf246..824627b19b80f 100644 --- a/Configuration/StandardSequences/python/SimL1EmulatorRepack_uGT_cff.py +++ b/Configuration/StandardSequences/python/SimL1EmulatorRepack_uGT_cff.py @@ -30,7 +30,7 @@ simGtStage2Digis.JetInputTag = "unpackGtStage2:Jet" simGtStage2Digis.EtSumInputTag = "unpackGtStage2:EtSum" simGtStage2Digis.EtSumZdcInputTag = "unpackGtStage2:EtSumZDC" -simGtStage2Digis.CICADAScoreInputTag = "unpackGtStage2:CICADAScore" +simGtStage2Digis.CICADAInputTag = "unpackGtStage2:CICADAScore" simGtStage2Digis.ExtInputTag = "unpackGtStage2" # as in default diff --git a/Configuration/StandardSequences/python/VtxSmeared.py b/Configuration/StandardSequences/python/VtxSmeared.py index be4bed9f70bb2..35672756edd50 100644 --- a/Configuration/StandardSequences/python/VtxSmeared.py +++ b/Configuration/StandardSequences/python/VtxSmeared.py @@ -73,6 +73,7 @@ 'Nominal2022PbPbCollision' : 'IOMC.EventVertexGenerators.VtxSmearedNominal2022PbPbCollision_cfi', 'Realistic2022PbPbCollision' : 'IOMC.EventVertexGenerators.VtxSmearedRealistic2022PbPbCollision_cfi', 'Realistic2023PbPbCollision' : 'IOMC.EventVertexGenerators.VtxSmearedRealistic2023PbPbCollision_cfi', + 'Realistic2024ppRefCollision' : 'IOMC.EventVertexGenerators.VtxSmearedRealistic2024ppRefCollision_cfi', } VtxSmearedDefaultKey='Realistic50ns13TeVCollision' VtxSmearedHIDefaultKey='RealisticPbPbCollision2018' diff --git a/DPGAnalysis/SiStripTools/plugins/MultiplicityAlgorithms.cc b/DPGAnalysis/SiStripTools/plugins/MultiplicityAlgorithms.cc index 4fc82ee7eb65d..5c08941e302a3 100644 --- a/DPGAnalysis/SiStripTools/plugins/MultiplicityAlgorithms.cc +++ b/DPGAnalysis/SiStripTools/plugins/MultiplicityAlgorithms.cc @@ -6,13 +6,15 @@ ClusterSummarySingleMultiplicity::ClusterSummarySingleMultiplicity(const edm::Pa edm::ConsumesCollector&& iC) : m_subdetenum((ClusterSummary::CMSTracker)iConfig.getParameter("subDetEnum")), m_varenum((ClusterSummary::VariablePlacement)iConfig.getParameter("varEnum")), - m_collection(iC.consumes(iConfig.getParameter("clusterSummaryCollection"))) {} + m_collection(iC.consumes(iConfig.getParameter("clusterSummaryCollection"))), + m_warn(iConfig.getUntrackedParameter("warnIfModuleMissing", true)) {} ClusterSummarySingleMultiplicity::ClusterSummarySingleMultiplicity(const edm::ParameterSet& iConfig, edm::ConsumesCollector& iC) : m_subdetenum((ClusterSummary::CMSTracker)iConfig.getParameter("subDetEnum")), m_varenum((ClusterSummary::VariablePlacement)iConfig.getParameter("varEnum")), - m_collection(iC.consumes(iConfig.getParameter("clusterSummaryCollection"))) {} + m_collection(iC.consumes(iConfig.getParameter("clusterSummaryCollection"))), + m_warn(iConfig.getUntrackedParameter("warnIfModuleMissing", true)) {} ClusterSummarySingleMultiplicity::value_t ClusterSummarySingleMultiplicity::getEvent( const edm::Event& iEvent, const edm::EventSetup& iSetup) const { @@ -23,13 +25,13 @@ ClusterSummarySingleMultiplicity::value_t ClusterSummarySingleMultiplicity::getE switch (m_varenum) { case ClusterSummary::NCLUSTERS: - mult = int(clustsumm->getNClus(m_subdetenum)); + mult = int(clustsumm->getNClus(m_subdetenum, m_warn)); break; case ClusterSummary::CLUSTERSIZE: - mult = int(clustsumm->getClusSize(m_subdetenum)); + mult = int(clustsumm->getClusSize(m_subdetenum, m_warn)); break; case ClusterSummary::CLUSTERCHARGE: - mult = int(clustsumm->getClusCharge(m_subdetenum)); + mult = int(clustsumm->getClusCharge(m_subdetenum, m_warn)); break; default: mult = -1; diff --git a/DPGAnalysis/SiStripTools/plugins/MultiplicityAlgorithms.h b/DPGAnalysis/SiStripTools/plugins/MultiplicityAlgorithms.h index 50dc883b9a132..4531bdb0b13a8 100644 --- a/DPGAnalysis/SiStripTools/plugins/MultiplicityAlgorithms.h +++ b/DPGAnalysis/SiStripTools/plugins/MultiplicityAlgorithms.h @@ -42,6 +42,7 @@ namespace sistriptools::algorithm { ClusterSummary::CMSTracker m_subdetenum; ClusterSummary::VariablePlacement m_varenum; edm::EDGetTokenT m_collection; + bool m_warn; }; template diff --git a/DQM/Integration/python/clients/beamspotdip_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beamspotdip_dqm_sourceclient-live_cfg.py index e353bbaf5d5d4..cffbb798b5867 100644 --- a/DQM/Integration/python/clients/beamspotdip_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beamspotdip_dqm_sourceclient-live_cfg.py @@ -48,6 +48,9 @@ process.load("DQM.BeamMonitor.BeamSpotDipServer_cff") process.beamSpotDipServer.verbose = cms.untracked.bool(True) +process.beamSpotDipServer.sourceFile = cms.untracked.string( + "/nfshome0/dqmpro/BeamMonitorDQM/BeamFitResultsForDIP.txt" +) # process customizations included here from DQM.Integration.config.online_customizations_cfi import * diff --git a/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareRecHits.cc b/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareRecHits.cc index 9d0bf1ac5eafb..b84de5250321e 100644 --- a/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareRecHits.cc +++ b/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareRecHits.cc @@ -99,20 +99,19 @@ void SiPixelCompareRecHits::analyzeSeparate(U tokenRef, V tokenTar, const edm const auto& rhsoaHandleRef = iEvent.getHandle(tokenRef); const auto& rhsoaHandleTar = iEvent.getHandle(tokenTar); - if (not rhsoaHandleRef or not rhsoaHandleTar) { + // Exit early if any handle is invalid + if (!rhsoaHandleRef || !rhsoaHandleTar) { edm::LogWarning out("SiPixelCompareRecHits"); - if (not rhsoaHandleRef) { + if (!rhsoaHandleRef) out << "reference rechits not found; "; - } - if (not rhsoaHandleTar) { + if (!rhsoaHandleTar) out << "target rechits not found; "; - } out << "the comparison will not run."; return; } - auto const& rhsoaRef = *rhsoaHandleRef; - auto const& rhsoaTar = *rhsoaHandleTar; + const auto& rhsoaRef = *rhsoaHandleRef; + const auto& rhsoaTar = *rhsoaHandleTar; auto const& soa2dRef = rhsoaRef.const_view(); auto const& soa2dTar = rhsoaTar.const_view(); @@ -121,15 +120,28 @@ void SiPixelCompareRecHits::analyzeSeparate(U tokenRef, V tokenTar, const edm uint32_t nHitsTar = soa2dTar.metadata().size(); hnHits_->Fill(nHitsRef, nHitsTar); + + // Map detector indices to target hits for quick access + std::unordered_map> detectorIndexMap; + detectorIndexMap.reserve(nHitsTar); + for (size_t j = 0; j < nHitsTar; ++j) { + detectorIndexMap[soa2dTar[j].detectorIndex()].push_back(j); + } + auto detIds = tkGeom_->detUnitIds(); + + // Loop through reference hits for (uint32_t i = 0; i < nHitsRef; i++) { float minD = mind2cut_; uint32_t matchedHit = invalidHit_; uint16_t indRef = soa2dRef[i].detectorIndex(); float xLocalRef = soa2dRef[i].xLocal(); float yLocalRef = soa2dRef[i].yLocal(); - for (uint32_t j = 0; j < nHitsTar; j++) { - if (soa2dTar.detectorIndex(j) == indRef) { + + // Look up hits in target with matching detector index + auto it = detectorIndexMap.find(indRef); + if (it != detectorIndexMap.end()) { + for (auto j : it->second) { float dx = xLocalRef - soa2dTar[j].xLocal(); float dy = yLocalRef - soa2dTar[j].yLocal(); float distance = dx * dx + dy * dy; @@ -139,22 +151,29 @@ void SiPixelCompareRecHits::analyzeSeparate(U tokenRef, V tokenTar, const edm } } } + + // Gather reference hit properties DetId id = detIds[indRef]; uint32_t chargeRef = soa2dRef[i].chargeAndStatus().charge; - int16_t sizeXRef = std::ceil(float(std::abs(soa2dRef[i].clusterSizeX()) / 8.)); - int16_t sizeYRef = std::ceil(float(std::abs(soa2dRef[i].clusterSizeY()) / 8.)); + int16_t sizeXRef = (soa2dRef[i].clusterSizeX() + 7) / 8; + int16_t sizeYRef = (soa2dRef[i].clusterSizeY() + 7) / 8; + + // Initialize target hit properties uint32_t chargeTar = 0; int16_t sizeXTar = -99; int16_t sizeYTar = -99; float xLocalTar = -999.; float yLocalTar = -999.; + if (matchedHit != invalidHit_) { chargeTar = soa2dTar[matchedHit].chargeAndStatus().charge; - sizeXTar = std::ceil(float(std::abs(soa2dTar[matchedHit].clusterSizeX()) / 8.)); - sizeYTar = std::ceil(float(std::abs(soa2dTar[matchedHit].clusterSizeY()) / 8.)); + sizeXTar = (soa2dTar[matchedHit].clusterSizeX() + 7) / 8; + sizeYTar = (soa2dTar[matchedHit].clusterSizeY() + 7) / 8; xLocalTar = soa2dTar[matchedHit].xLocal(); yLocalTar = soa2dTar[matchedHit].yLocal(); } + + // Populate histograms based on subdetector type switch (id.subdetId()) { case PixelSubdetector::PixelBarrel: hBchargeL_[tTopo_->pxbLayer(id) - 1]->Fill(chargeRef, chargeTar); diff --git a/DQM/TrackerRemapper/test/testPrintTkMaps.sh b/DQM/TrackerRemapper/test/testPrintTkMaps.sh index cadcd7e1e32b1..b89938a1de9df 100755 --- a/DQM/TrackerRemapper/test/testPrintTkMaps.sh +++ b/DQM/TrackerRemapper/test/testPrintTkMaps.sh @@ -8,7 +8,7 @@ printPixelTrackerMap --help || die 'failed running printPixelTrackerMap --help' printStripTrackerMap --help || die 'failed running printStripTrackerMap --help' $? echo -e "\n" testPixelFile=$CMSSW_BASE/src/SLHCUpgradeSimulations/Geometry/data/PhaseI/PixelSkimmedGeometry_phase1.txt -[ -e $testPixelFile} ] || testPixelFile=$CMSSW_RELEASE_BASE/src/SLHCUpgradeSimulations/Geometry/data/PhaseI/PixelSkimmedGeometry_phase1.txt +[ -e $testPixelFile ] || testPixelFile=$CMSSW_RELEASE_BASE/src/SLHCUpgradeSimulations/Geometry/data/PhaseI/PixelSkimmedGeometry_phase1.txt # Store the first 50 elements of the first column in a variable testPixelDetids=$(head -n 50 "$testPixelFile" | cut -d ' ' -f 1 | paste -sd ' ' -) diff --git a/DQMServices/Demo/test/BuildFile.xml b/DQMServices/Demo/test/BuildFile.xml index 53aaaaa7c7b9c..4f57697d9104d 100644 --- a/DQMServices/Demo/test/BuildFile.xml +++ b/DQMServices/Demo/test/BuildFile.xml @@ -6,3 +6,6 @@ + + + diff --git a/DQMServices/Demo/test/test_dqmgui_upload.sh b/DQMServices/Demo/test/test_dqmgui_upload.sh new file mode 100755 index 0000000000000..da48f6a56bd3b --- /dev/null +++ b/DQMServices/Demo/test/test_dqmgui_upload.sh @@ -0,0 +1,69 @@ +#!/bin/env bash +# Simple test to use one of the files generated by TestDQMServicesDemo test +# to upload it to the dev DQMGUI, making sure that the ROOT file format generated +# is compatible. See cmssw issue #43590. +# Requires curl and jq to be installed. Also requires either a Grid key and certificate, +# or a proxy to be available. +set -x +set -e + +DEV_DQMGUI_URL="https://cmsweb.cern.ch/dqm/dev" +# Create a unique fake "Era", so that different executions of this test +# produce differently named files. This is required, because this test might pass +# if it's checking a file that was successfully uploaded during a previous +# instance of the same test. +UNIQUE_ERA_ID=$(date -u +%Y%m%d%M%S%N) +OLD_FILENAME=DQM_V0001_R000000001__Harvesting__DQMTests__DQMIO.root +NEW_FILENAME=${OLD_FILENAME/DQMTests/DQMTests${UNIQUE_ERA_ID}} + +# Make sure the required file exists. We expect to find it in the current directory. +if [ ! -f $OLD_FILENAME ]; then + echo "Unable to find required file ${OLD_FILENAME}!" + exit 1 +fi + +# Prepare curl args +curl_args="" +if [ -n "$X509_CERT_DIR" ]; then + curl_args="${curl_args} --capath ${X509_CERT_DIR}/" +else + curl_args="${curl_args} -k" +fi +if [ -n "$X509_USER_PROXY" ]; then + curl_args="${curl_args} --key ${X509_USER_PROXY} --cert ${X509_USER_PROXY}" +elif [ -n "$X509_USER_KEY" ] && [ -n "$X509_USER_CERT" ]; then + curl_args="${curl_args} --key ${X509_USER_KEY} --cert ${X509_USER_CERT}" +elif [ -f $HOME/.globus/usercert.pem ] && [ -f $HOME/.globus/userkey.pem ]; then + curl_args="${curl_args} --key $HOME/.globus/userkey.pem --cert $HOME/.globus/usercert.pem" +else + echo "Unable to find proxy or key/cert env vars, cannot continue" + exit 1 +fi + +# Make a copy with a filename that conforms to the naming convention required by DQMGUI. +rm -f "$NEW_FILENAME" +cp $OLD_FILENAME "$NEW_FILENAME" + +# Upload the file to the DQMGUI +visDQMUpload.py "$DEV_DQMGUI_URL" "$NEW_FILENAME" + +# Wait for a bit for the file to be imported into the DQMGUI's index. +# The currently used file is very small and expected to be ingested quickly, +# but better safe than sorry. +SECONDS_TO_WAIT=600 +# Reset shell's internal SECONDS var. +SECONDS=0 + +while true; do + # Wait for the dataset to appear in the /json/samples endpoint. It might take a while. + if curl -sL $curl_args "${DEV_DQMGUI_URL}/data/json/samples?match=DQMTests${UNIQUE_ERA_ID}" | jq .samples[0].items[0].dataset | grep -q "$UNIQUE_ERA_ID"; then + exit 0 + fi + + sleep 10 + # Timeout after SECONDS_TO_WAIT have passed. + if [ $SECONDS -ge $SECONDS_TO_WAIT ]; then + exit 1 + fi +done +exit 1 diff --git a/DataFormats/Portable/interface/PortableCollection.h b/DataFormats/Portable/interface/PortableCollection.h index abfffff6ed1d2..e876c1558e96b 100644 --- a/DataFormats/Portable/interface/PortableCollection.h +++ b/DataFormats/Portable/interface/PortableCollection.h @@ -77,12 +77,12 @@ namespace cms::alpakatools { } }; - template - struct CopyToDevice> { + template + struct CopyToDevice> { template - static auto copyAsync(TQueue& queue, PortableHostMultiCollection const& srcData) { + static auto copyAsync(TQueue& queue, PortableHostMultiCollection const& srcData) { using TDevice = typename alpaka::trait::DevType::type; - PortableDeviceMultiCollection dstData(srcData.sizes(), queue); + PortableDeviceMultiCollection dstData(srcData.sizes(), queue); alpaka::memcpy(queue, dstData.buffer(), srcData.buffer()); return dstData; } diff --git a/DataFormats/TrackerCommon/interface/ClusterSummary.h b/DataFormats/TrackerCommon/interface/ClusterSummary.h index d8d3648eded39..6808ebba395c3 100644 --- a/DataFormats/TrackerCommon/interface/ClusterSummary.h +++ b/DataFormats/TrackerCommon/interface/ClusterSummary.h @@ -106,16 +106,16 @@ class ClusterSummary { int getClusSizeByIndex(const int mod) const { return clusSize.at(mod); } float getClusChargeByIndex(const int mod) const { return clusCharge.at(mod); } - int getNClus(const CMSTracker mod) const { - int pos = getModuleLocation(mod); + int getNClus(const CMSTracker mod, bool warn = true) const { + int pos = getModuleLocation(mod, warn); return pos < 0 ? 0. : nClus[pos]; } - int getClusSize(const CMSTracker mod) const { - int pos = getModuleLocation(mod); + int getClusSize(const CMSTracker mod, bool warn = true) const { + int pos = getModuleLocation(mod, warn); return pos < 0 ? 0. : clusSize[pos]; } - float getClusCharge(const CMSTracker mod) const { - int pos = getModuleLocation(mod); + float getClusCharge(const CMSTracker mod, bool warn = true) const { + int pos = getModuleLocation(mod, warn); return pos < 0 ? 0. : clusCharge[pos]; } @@ -127,9 +127,15 @@ class ClusterSummary { void addClusSizeByIndex(const int mod, const int val) { clusSize.at(mod) += val; } void addClusChargeByIndex(const int mod, const float val) { clusCharge.at(mod) += val; } - void addNClus(const CMSTracker mod, const int val) { nClus.at(getModuleLocation(mod)) += val; } - void addClusSize(const CMSTracker mod, const int val) { clusSize.at(getModuleLocation(mod)) += val; } - void addClusCharge(const CMSTracker mod, const float val) { clusCharge.at(getModuleLocation(mod)) += val; } + void addNClus(const CMSTracker mod, const int val, bool warn = true) { + nClus.at(getModuleLocation(mod, warn)) += val; + } + void addClusSize(const CMSTracker mod, const int val, bool warn = true) { + clusSize.at(getModuleLocation(mod, warn)) += val; + } + void addClusCharge(const CMSTracker mod, const float val, bool warn = true) { + clusCharge.at(getModuleLocation(mod, warn)) += val; + } const std::vector& getModules() const { return modules; } // Return the location of desired module within modules_. If warn is set to true, a warnign will be outputed in case no module was found diff --git a/FWCore/PluginManager/src/PauseMaxMemoryPreloadSentry.cc b/FWCore/PluginManager/src/PauseMaxMemoryPreloadSentry.cc new file mode 100644 index 0000000000000..f80986f6c563a --- /dev/null +++ b/FWCore/PluginManager/src/PauseMaxMemoryPreloadSentry.cc @@ -0,0 +1,11 @@ +#include "PauseMaxMemoryPreloadSentry.h" + +// By default do nothing, but add "hooks" that MaxMemoryPreload can +// override with LD_PRELOAD +void pauseMaxMemoryPreload() {} +void unpauseMaxMemoryPreload() {} + +namespace edm { + PauseMaxMemoryPreloadSentry::PauseMaxMemoryPreloadSentry() { pauseMaxMemoryPreload(); } + PauseMaxMemoryPreloadSentry::~PauseMaxMemoryPreloadSentry() { unpauseMaxMemoryPreload(); } +} // namespace edm diff --git a/FWCore/PluginManager/src/PauseMaxMemoryPreloadSentry.h b/FWCore/PluginManager/src/PauseMaxMemoryPreloadSentry.h new file mode 100644 index 0000000000000..68c14bb52172e --- /dev/null +++ b/FWCore/PluginManager/src/PauseMaxMemoryPreloadSentry.h @@ -0,0 +1,17 @@ +#ifndef FWCore_PluginManager_src_PauseMaxMemoryPreloadSentry_h +#define FWCore_PluginManager_src_PauseMaxMemoryPreloadSentry_h + +namespace edm { + class PauseMaxMemoryPreloadSentry { + public: + PauseMaxMemoryPreloadSentry(); + ~PauseMaxMemoryPreloadSentry(); + + PauseMaxMemoryPreloadSentry(const PauseMaxMemoryPreloadSentry&) = delete; + PauseMaxMemoryPreloadSentry(PauseMaxMemoryPreloadSentry&&) = delete; + PauseMaxMemoryPreloadSentry& operator=(const PauseMaxMemoryPreloadSentry&) = delete; + PauseMaxMemoryPreloadSentry& operator=(PauseMaxMemoryPreloadSentry&&) = delete; + }; +} // namespace edm + +#endif diff --git a/FWCore/PluginManager/src/PluginManager.cc b/FWCore/PluginManager/src/PluginManager.cc index 66ad296d3ee15..2582acea16dc9 100644 --- a/FWCore/PluginManager/src/PluginManager.cc +++ b/FWCore/PluginManager/src/PluginManager.cc @@ -29,6 +29,8 @@ #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Utilities/interface/thread_safety_macros.h" +#include "PauseMaxMemoryPreloadSentry.h" + namespace edmplugin { // // constants, enums and typedefs @@ -47,6 +49,7 @@ namespace edmplugin { throw cms::Exception("PluginMangerCacheProblem") << "Unable to open the cache file '" << cacheFile.string() << "'. Please check permissions on file"; } + edm::PauseMaxMemoryPreloadSentry pauseSentry; CacheParser::read(file, dir, categoryToInfos); return true; } diff --git a/Geometry/CMSCommonData/data/materials/2024/v1/materials.xml b/Geometry/CMSCommonData/data/materials/2024/v1/materials.xml new file mode 100644 index 0000000000000..5a09e02686524 --- /dev/null +++ b/Geometry/CMSCommonData/data/materials/2024/v1/materials.xml @@ -0,0 +1,4635 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/MTDCommonData/test/testMTDinDD4hep.py b/Geometry/MTDCommonData/test/testMTDinDD4hep.py index 2b14c8c270869..80c92252d09c2 100644 --- a/Geometry/MTDCommonData/test/testMTDinDD4hep.py +++ b/Geometry/MTDCommonData/test/testMTDinDD4hep.py @@ -1,9 +1,10 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 +import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings +_PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION) from Configuration.ProcessModifiers.dd4hep_cff import dd4hep -process = cms.Process("CompareGeometryTest",Phase2C17I13M9,dd4hep) +process = cms.Process("CompareGeometryTest",_PH2_ERA,dd4hep) process.source = cms.Source("EmptySource") process.maxEvents = cms.untracked.PSet( @@ -54,7 +55,7 @@ threshold = cms.untracked.string('INFO') ) -process.load('Configuration.Geometry.GeometryDD4hepExtended2026D110_cff') +process.load('Configuration.Geometry.GeometryDD4hepExtendedRun4Default_cff') process.testBTL = cms.EDAnalyzer("DD4hep_TestMTDIdealGeometry", DDDetector = cms.ESInputTag('',''), diff --git a/Geometry/MTDCommonData/test/testMTDinDDD.py b/Geometry/MTDCommonData/test/testMTDinDDD.py index 9a872cbe25a77..439a2e3c70584 100644 --- a/Geometry/MTDCommonData/test/testMTDinDDD.py +++ b/Geometry/MTDCommonData/test/testMTDinDDD.py @@ -1,8 +1,9 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 +import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings +_PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION) -process = cms.Process("CompareGeometryTest",Phase2C17I13M9) +process = cms.Process("CompareGeometryTest", _PH2_ERA) process.source = cms.Source("EmptySource") process.maxEvents = cms.untracked.PSet( @@ -53,7 +54,7 @@ threshold = cms.untracked.string('INFO') ) -process.load('Configuration.Geometry.GeometryExtended2026D110_cff') +process.load('Configuration.Geometry.GeometryExtendedRun4Default_cff') process.testBTL = cms.EDAnalyzer("TestMTDIdealGeometry", ddTopNodeName = cms.untracked.string('BarrelTimingLayer') diff --git a/Geometry/MTDGeometryBuilder/test/dd4hep_mtd_cfg.py b/Geometry/MTDGeometryBuilder/test/dd4hep_mtd_cfg.py index 773ce1bc4c21a..42df806bdad16 100644 --- a/Geometry/MTDGeometryBuilder/test/dd4hep_mtd_cfg.py +++ b/Geometry/MTDGeometryBuilder/test/dd4hep_mtd_cfg.py @@ -1,9 +1,11 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 +import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings +_PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION) + from Configuration.ProcessModifiers.dd4hep_cff import dd4hep -process = cms.Process("GeometryTest",Phase2C17I13M9,dd4hep) +process = cms.Process("GeometryTest",_PH2_ERA,dd4hep) process.source = cms.Source("EmptyIOVSource", lastValue = cms.uint64(1), @@ -50,7 +52,7 @@ threshold = cms.untracked.string('INFO') ) -process.load("Configuration.Geometry.GeometryDD4hepExtended2026D110Reco_cff") +process.load("Configuration.Geometry.GeometryDD4hepExtendedRun4DefaultReco_cff") process.Timing = cms.Service("Timing") diff --git a/Geometry/MTDGeometryBuilder/test/mtd_cfg.py b/Geometry/MTDGeometryBuilder/test/mtd_cfg.py index 5655d299e567d..59e7243471ceb 100644 --- a/Geometry/MTDGeometryBuilder/test/mtd_cfg.py +++ b/Geometry/MTDGeometryBuilder/test/mtd_cfg.py @@ -1,8 +1,9 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 +import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings +_PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION) -process = cms.Process("GeometryTest",Phase2C17I13M9) +process = cms.Process("GeometryTest", _PH2_ERA) process.source = cms.Source("EmptyIOVSource", lastValue = cms.uint64(1), @@ -46,7 +47,7 @@ threshold = cms.untracked.string('INFO') ) -process.load("Configuration.Geometry.GeometryExtended2026D110_cff") +process.load("Configuration.Geometry.GeometryExtendedRun4Default_cff") process.load("Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff") diff --git a/Geometry/MTDNumberingBuilder/plugins/DDCmsMTDConstruction.cc b/Geometry/MTDNumberingBuilder/plugins/DDCmsMTDConstruction.cc index 5aaa56179fb83..c4c6d038c5de1 100644 --- a/Geometry/MTDNumberingBuilder/plugins/DDCmsMTDConstruction.cc +++ b/Geometry/MTDNumberingBuilder/plugins/DDCmsMTDConstruction.cc @@ -22,23 +22,40 @@ using angle_units::operators::convertRadToDeg; class DDNameFilter : public DDFilter { public: + void addNS(const std::string& addNS) { allowedNS_.emplace_back(addNS); } void add(const std::string& add) { allowed_.emplace_back(add); } void veto(const std::string& veto) { veto_.emplace_back(veto); } bool accept(const DDExpandedView& ev) const final { - std::string currentName(ev.logicalPart().name().fullname()); - for (const auto& test : veto_) { - if (currentName.find(test) != std::string::npos) - return false; + if (allowedNS_.size() == 0 && allowed_.size() == 0 && veto_.size() == 0) { + return true; } - for (const auto& test : allowed_) { - if (currentName.find(test) != std::string::npos) - return true; + bool out(false); + std::string_view currentNSName(ev.logicalPart().name().ns()); + for (const auto& test : allowedNS_) { + if (currentNSName.find(test) != std::string::npos) { + out = true; + if (allowed_.size() > 0 || veto_.size() > 0) { + std::string_view currentName(ev.logicalPart().name().name()); + for (const auto& test : veto_) { + if (currentName.find(test) != std::string::npos) { + return false; + } + } + for (const auto& test : allowed_) { + if (currentName.find(test) != std::string::npos) { + return true; + } + } + } + break; + } } - return false; + return out; } private: + std::vector allowedNS_; std::vector allowed_; std::vector veto_; }; @@ -46,14 +63,9 @@ class DDNameFilter : public DDFilter { std::unique_ptr DDCmsMTDConstruction::construct(const DDCompactView& cpv) { std::string attribute{"CMSCutsRegion"}; DDNameFilter filter; - filter.add("mtd:"); - filter.add("btl:"); - filter.add("etl:"); - - std::vector volnames = {"FSide", "SupportPlate"}; - for (auto const& theVol : volnames) { - filter.veto(theVol); - } + filter.addNS("mtd"); + filter.addNS("btl"); + filter.addNS("etl"); DDFilteredView fv(cpv, filter); diff --git a/Geometry/MTDNumberingBuilder/test/dd4hep_mtd_cfg.py b/Geometry/MTDNumberingBuilder/test/dd4hep_mtd_cfg.py index 558b161e9660c..8f8f70417c74b 100644 --- a/Geometry/MTDNumberingBuilder/test/dd4hep_mtd_cfg.py +++ b/Geometry/MTDNumberingBuilder/test/dd4hep_mtd_cfg.py @@ -1,9 +1,11 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 +import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings +_PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION) + from Configuration.ProcessModifiers.dd4hep_cff import dd4hep -process = cms.Process("GeometryTest",Phase2C17I13M9,dd4hep) +process = cms.Process("GeometryTest",_PH2_ERA,dd4hep) process.source = cms.Source("EmptyIOVSource", lastValue = cms.uint64(1), @@ -47,7 +49,7 @@ threshold = cms.untracked.string('INFO') ) -process.load("Configuration.Geometry.GeometryDD4hepExtended2026D110Reco_cff") +process.load("Configuration.Geometry.GeometryDD4hepExtendedRun4DefaultReco_cff") process.prod = cms.EDAnalyzer("GeometricTimingDetAnalyzer") diff --git a/Geometry/MTDNumberingBuilder/test/mtd_cfg.py b/Geometry/MTDNumberingBuilder/test/mtd_cfg.py index c8ed561c1d8f4..26ad5930e64ee 100644 --- a/Geometry/MTDNumberingBuilder/test/mtd_cfg.py +++ b/Geometry/MTDNumberingBuilder/test/mtd_cfg.py @@ -1,8 +1,9 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 +import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings +_PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION) -process = cms.Process("GeometryTest",Phase2C17I13M9) +process = cms.Process("GeometryTest",_PH2_ERA) process.source = cms.Source("EmptyIOVSource", lastValue = cms.uint64(1), @@ -46,7 +47,7 @@ threshold = cms.untracked.string('INFO') ) -process.load("Configuration.Geometry.GeometryExtended2026D110Reco_cff") +process.load("Configuration.Geometry.GeometryExtendedRun4DefaultReco_cff") process.Timing = cms.Service("Timing") diff --git a/Geometry/MuonCommonData/data/mb4Shield/2024/v1/mb4Shield.xml b/Geometry/MuonCommonData/data/mb4Shield/2024/v1/mb4Shield.xml new file mode 100644 index 0000000000000..4240f06fee512 --- /dev/null +++ b/Geometry/MuonCommonData/data/mb4Shield/2024/v1/mb4Shield.xml @@ -0,0 +1,3782 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/HLTrigger/Configuration/python/HLT_75e33/test/runHLTTiming.sh b/HLTrigger/Configuration/python/HLT_75e33/test/runHLTTiming.sh index bbb147424fd8a..2e7c046ccd9c9 100755 --- a/HLTrigger/Configuration/python/HLT_75e33/test/runHLTTiming.sh +++ b/HLTrigger/Configuration/python/HLT_75e33/test/runHLTTiming.sh @@ -37,7 +37,7 @@ ALL_FILES="${ALL_FILES%?}" echo "Discovered files: $ALL_FILES" cmsDriver.py Phase2 -s L1P2GT,HLT:75e33_timing --processName=HLTX \ - --conditions auto:phase2_realistic_T33 --geometry Extended2026D110 \ + --conditions auto:phase2_realistic_T33 --geometry ExtendedRun4D110 \ --era Phase2C17I13M9 \ --customise SLHCUpgradeSimulations/Configuration/aging.customise_aging_1000 \ --eventcontent FEVTDEBUGHLT \ diff --git a/HLTrigger/Configuration/scripts/hltPhase2UpgradeIntegrationTests b/HLTrigger/Configuration/scripts/hltPhase2UpgradeIntegrationTests index c89f185e79b7a..0d35e4208b260 100755 --- a/HLTrigger/Configuration/scripts/hltPhase2UpgradeIntegrationTests +++ b/HLTrigger/Configuration/scripts/hltPhase2UpgradeIntegrationTests @@ -16,7 +16,7 @@ _PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_V _PH2_GEOMETRY = f"Extended{_settings.DEFAULT_VERSION}" # Get the actual era name from the version key -_PH2_ERA_NAME = _settings.properties[2026][_settings.DEFAULT_VERSION]['Era'] +_PH2_ERA_NAME = _settings.properties['Run4'][_settings.DEFAULT_VERSION]['Era'] # Function to display help information def print_help(): diff --git a/HeterogeneousCore/AlpakaInterface/test/alpaka/testPrefixScan.dev.cc b/HeterogeneousCore/AlpakaInterface/test/alpaka/testPrefixScan.dev.cc index 75a2f310e4fb4..a9df1ab547611 100644 --- a/HeterogeneousCore/AlpakaInterface/test/alpaka/testPrefixScan.dev.cc +++ b/HeterogeneousCore/AlpakaInterface/test/alpaka/testPrefixScan.dev.cc @@ -34,7 +34,17 @@ template struct testPrefixScan { template ALPAKA_FN_ACC void operator()(const TAcc& acc, unsigned int size) const { + // alpaka::warp::getSize(acc) is runtime, but we need a compile-time or constexpr value +#if defined(__CUDA_ARCH__) + // CUDA always has a warp size of 32 auto& ws = alpaka::declareSharedVar(acc); +#elif defined(__HIP_DEVICE_COMPILE__) + // HIP/ROCm defines warpSize as a constant expression with value 32 or 64 depending on the target device + auto& ws = alpaka::declareSharedVar(acc); +#else + // CPU back-ends always have a warp size of 1 + auto& ws = alpaka::declareSharedVar(acc); +#endif auto& c = alpaka::declareSharedVar(acc); auto& co = alpaka::declareSharedVar(acc); @@ -78,7 +88,7 @@ struct testWarpPrefixScan { template ALPAKA_FN_ACC void operator()(const TAcc& acc, uint32_t size) const { if constexpr (!requires_single_thread_per_block_v) { - ALPAKA_ASSERT_ACC(size <= 32); + ALPAKA_ASSERT_ACC(size <= static_cast(alpaka::warp::getSize(acc))); auto& c = alpaka::declareSharedVar(acc); auto& co = alpaka::declareSharedVar(acc); @@ -87,7 +97,8 @@ struct testWarpPrefixScan { auto i = blockThreadIdx; c[i] = 1; alpaka::syncBlockThreads(acc); - auto laneId = blockThreadIdx & 0x1f; + // a compile-time constant would be faster, but this is more portable + auto laneId = blockThreadIdx % alpaka::warp::getSize(acc); warpPrefixScan(acc, laneId, c, co, i); warpPrefixScan(acc, laneId, c, i); @@ -152,13 +163,18 @@ int main() { if constexpr (!requires_single_thread_per_block_v) { std::cout << "warp level" << std::endl; - const auto threadsPerBlockOrElementsPerThread = 32; + const auto threadsPerBlockOrElementsPerThread = warpSize; const auto blocksPerGrid = 1; const auto workDivWarp = make_workdiv(blocksPerGrid, threadsPerBlockOrElementsPerThread); - alpaka::enqueue(queue, alpaka::createTaskKernel(workDivWarp, testWarpPrefixScan(), 32)); - alpaka::enqueue(queue, alpaka::createTaskKernel(workDivWarp, testWarpPrefixScan(), 16)); - alpaka::enqueue(queue, alpaka::createTaskKernel(workDivWarp, testWarpPrefixScan(), 5)); + if (warpSize >= 64) + alpaka::enqueue(queue, alpaka::createTaskKernel(workDivWarp, testWarpPrefixScan(), 64)); + if (warpSize >= 32) + alpaka::enqueue(queue, alpaka::createTaskKernel(workDivWarp, testWarpPrefixScan(), 32)); + if (warpSize >= 16) + alpaka::enqueue(queue, alpaka::createTaskKernel(workDivWarp, testWarpPrefixScan(), 12)); + if (warpSize >= 8) + alpaka::enqueue(queue, alpaka::createTaskKernel(workDivWarp, testWarpPrefixScan(), 5)); } // PORTABLE BLOCK PREFIXSCAN @@ -166,7 +182,7 @@ int main() { // Running kernel with 1 block, and bs threads per block or elements per thread. // NB: obviously for tests only, for perf would need to use bs = 1024 in GPU version. - for (int bs = 32; bs <= 1024; bs += 32) { + for (int bs = warpSize; bs <= 1024; bs += warpSize) { const auto blocksPerGrid2 = 1; const auto workDivSingleBlock = make_workdiv(blocksPerGrid2, bs); diff --git a/HeterogeneousCore/AlpakaTest/interface/AlpakaESTestData.h b/HeterogeneousCore/AlpakaTest/interface/AlpakaESTestData.h index 9975feda1b92e..5446efb8c83c1 100644 --- a/HeterogeneousCore/AlpakaTest/interface/AlpakaESTestData.h +++ b/HeterogeneousCore/AlpakaTest/interface/AlpakaESTestData.h @@ -14,6 +14,8 @@ namespace cms::alpakatest { using AlpakaESTestDataCHost = PortableHostCollection; using AlpakaESTestDataDHost = PortableHostCollection; + using AlpakaESTestDataACMultiHost = PortableHostMultiCollection; + // Template-over-device model template class AlpakaESTestDataB { diff --git a/HeterogeneousCore/AlpakaTest/interface/alpaka/AlpakaESTestData.h b/HeterogeneousCore/AlpakaTest/interface/alpaka/AlpakaESTestData.h index 71c3b91d8ba2a..a7e31f46cdf63 100644 --- a/HeterogeneousCore/AlpakaTest/interface/alpaka/AlpakaESTestData.h +++ b/HeterogeneousCore/AlpakaTest/interface/alpaka/AlpakaESTestData.h @@ -20,6 +20,11 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { using AlpakaESTestDataEHost = cms::alpakatest::AlpakaESTestDataEHost; using AlpakaESTestDataEDevice = cms::alpakatest::AlpakaESTestDataE; + + using AlpakaESTestDataACMultiHost = cms::alpakatest::AlpakaESTestDataACMultiHost; + using AlpakaESTestDataACMultiDevice = + PortableMultiCollection; + } // namespace ALPAKA_ACCELERATOR_NAMESPACE // check that the portable device collections for the host device are the same as the portable host collections @@ -27,5 +32,6 @@ ASSERT_DEVICE_MATCHES_HOST_COLLECTION(AlpakaESTestDataADevice, cms::alpakatest:: ASSERT_DEVICE_MATCHES_HOST_COLLECTION(AlpakaESTestDataCDevice, cms::alpakatest::AlpakaESTestDataCHost); ASSERT_DEVICE_MATCHES_HOST_COLLECTION(AlpakaESTestDataDDevice, cms::alpakatest::AlpakaESTestDataDHost); ASSERT_DEVICE_MATCHES_HOST_COLLECTION(AlpakaESTestDataEDevice, cms::alpakatest::AlpakaESTestDataEHost); +ASSERT_DEVICE_MATCHES_HOST_COLLECTION(AlpakaESTestDataACMultiDevice, ::cms::alpakatest::AlpakaESTestDataACMultiHost); #endif // HeterogeneousCore_AlpakaTest_interface_alpaka_AlpakaESTestData_h diff --git a/HeterogeneousCore/AlpakaTest/plugins/alpaka/TestAlpakaESProducerAMulti.cc b/HeterogeneousCore/AlpakaTest/plugins/alpaka/TestAlpakaESProducerAMulti.cc new file mode 100644 index 0000000000000..38c5dadae55c1 --- /dev/null +++ b/HeterogeneousCore/AlpakaTest/plugins/alpaka/TestAlpakaESProducerAMulti.cc @@ -0,0 +1,60 @@ +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/ESGetToken.h" +#include "HeterogeneousCore/AlpakaCore/interface/alpaka/ESProducer.h" +#include "HeterogeneousCore/AlpakaCore/interface/alpaka/ModuleFactory.h" +#include "HeterogeneousCore/AlpakaInterface/interface/config.h" +#include "HeterogeneousCore/AlpakaInterface/interface/host.h" +#include "HeterogeneousCore/AlpakaInterface/interface/memory.h" +#include "HeterogeneousCore/AlpakaTest/interface/AlpakaESTestRecords.h" +#include "HeterogeneousCore/AlpakaTest/interface/AlpakaESTestSoA.h" +#include "HeterogeneousCore/AlpakaTest/interface/ESTestData.h" +#include "HeterogeneousCore/AlpakaTest/interface/alpaka/AlpakaESTestData.h" + +namespace ALPAKA_ACCELERATOR_NAMESPACE { + /** + * This class is the equivalent of TesAlpakaESProducerA.cc + * for PortableHostMultiCollection. It consumes a standard + * host ESProduct and converts the data into PortableHostMultiCollection, and + * implicitly transfers the data product to device + */ + class TestAlpakaESProducerAMulti : public ESProducer { + public: + TestAlpakaESProducerAMulti(edm::ParameterSet const& iConfig) : ESProducer(iConfig) { + auto cc = setWhatProduced(this); + token_ = cc.consumes(); + } + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + descriptions.addWithDefaultLabel(desc); + } + + std::optional produce(AlpakaESTestRecordA const& iRecord) { + auto const& input = iRecord.get(token_); + + int const sizeA = 10; + int const sizeC = 100; + // TODO: pinned allocation? + // TODO: cached allocation? + AlpakaESTestDataACMultiHost product({{sizeA, sizeC}}, cms::alpakatools::host()); + auto viewA = product.view< + cms::alpakatest::AlpakaESTestSoAA>(); // this template is not really needed as this is fhe first layout + auto viewC = product.view(); + + for (int i = 0; i < sizeA; ++i) { + viewA[i].z() = input.value() - i; + } + + for (int i = 0; i < sizeC; ++i) { + viewC[i].x() = input.value() + i; + } + + return product; + } + + private: + edm::ESGetToken token_; + }; +} // namespace ALPAKA_ACCELERATOR_NAMESPACE + +DEFINE_FWK_EVENTSETUP_ALPAKA_MODULE(TestAlpakaESProducerAMulti); diff --git a/HeterogeneousCore/AlpakaTest/plugins/alpaka/TestAlpakaGlobalProducer.cc b/HeterogeneousCore/AlpakaTest/plugins/alpaka/TestAlpakaGlobalProducer.cc index 499ce4b522e5f..19340231732b8 100644 --- a/HeterogeneousCore/AlpakaTest/plugins/alpaka/TestAlpakaGlobalProducer.cc +++ b/HeterogeneousCore/AlpakaTest/plugins/alpaka/TestAlpakaGlobalProducer.cc @@ -22,6 +22,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { public: TestAlpakaGlobalProducer(edm::ParameterSet const& config) : esToken_(esConsumes(config.getParameter("eventSetupSource"))), + esMultiToken_(esConsumes(config.getParameter("eventSetupSourceMulti"))), deviceToken_{produces()}, deviceTokenMulti2_{produces()}, deviceTokenMulti3_{produces()}, @@ -34,6 +35,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { void produce(edm::StreamID, device::Event& iEvent, device::EventSetup const& iSetup) const override { [[maybe_unused]] auto const& esData = iSetup.getData(esToken_); + [[maybe_unused]] auto const& esMultiData = iSetup.getData(esMultiToken_); portabletest::TestDeviceCollection deviceProduct{size_, iEvent.queue()}; portabletest::TestDeviceMultiCollection2 deviceProductMulti2{{{size_, size2_}}, iEvent.queue()}; @@ -52,6 +54,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("eventSetupSource", edm::ESInputTag{}); + desc.add("eventSetupSourceMulti", edm::ESInputTag{}); edm::ParameterSetDescription psetSize; psetSize.add("alpaka_serial_sync"); @@ -64,6 +67,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { private: const device::ESGetToken esToken_; + const device::ESGetToken esMultiToken_; const device::EDPutToken deviceToken_; const device::EDPutToken deviceTokenMulti2_; const device::EDPutToken deviceTokenMulti3_; diff --git a/HeterogeneousCore/AlpakaTest/src/ES_AlpakaESTestData.cc b/HeterogeneousCore/AlpakaTest/src/ES_AlpakaESTestData.cc index b6b2adaa98d81..ed017b50cf873 100644 --- a/HeterogeneousCore/AlpakaTest/src/ES_AlpakaESTestData.cc +++ b/HeterogeneousCore/AlpakaTest/src/ES_AlpakaESTestData.cc @@ -5,6 +5,7 @@ TYPELOOKUP_DATA_REG(cms::alpakatest::AlpakaESTestDataAHost); TYPELOOKUP_DATA_REG(cms::alpakatest::AlpakaESTestDataCHost); TYPELOOKUP_DATA_REG(cms::alpakatest::AlpakaESTestDataDHost); +TYPELOOKUP_DATA_REG(cms::alpakatest::AlpakaESTestDataACMultiHost); // Template-over-device model TYPELOOKUP_DATA_REG(cms::alpakatest::AlpakaESTestDataB); diff --git a/HeterogeneousCore/AlpakaTest/src/alpaka/ES_AlpakaESTestData.cc b/HeterogeneousCore/AlpakaTest/src/alpaka/ES_AlpakaESTestData.cc index f5093b6bf2e9d..a9f0ee95f286a 100644 --- a/HeterogeneousCore/AlpakaTest/src/alpaka/ES_AlpakaESTestData.cc +++ b/HeterogeneousCore/AlpakaTest/src/alpaka/ES_AlpakaESTestData.cc @@ -5,6 +5,7 @@ TYPELOOKUP_ALPAKA_DATA_REG(AlpakaESTestDataADevice); TYPELOOKUP_ALPAKA_DATA_REG(AlpakaESTestDataCDevice); TYPELOOKUP_ALPAKA_DATA_REG(AlpakaESTestDataDDevice); +TYPELOOKUP_ALPAKA_DATA_REG(AlpakaESTestDataACMultiDevice); // Template-over-device model #include "HeterogeneousCore/AlpakaTest/interface/AlpakaESTestData.h" diff --git a/HeterogeneousCore/AlpakaTest/test/testAlpakaModules_cfg.py b/HeterogeneousCore/AlpakaTest/test/testAlpakaModules_cfg.py index 238fee3597e70..62279b26b3010 100644 --- a/HeterogeneousCore/AlpakaTest/test/testAlpakaModules_cfg.py +++ b/HeterogeneousCore/AlpakaTest/test/testAlpakaModules_cfg.py @@ -59,11 +59,16 @@ appendToDataLabel = cms.string("null"), ) +# PortableMultiCollection +from HeterogeneousCore.AlpakaTest.testAlpakaESProducerAMulti_cfi import testAlpakaESProducerAMulti + process.intProduct = cms.EDProducer("IntProducer", ivalue = cms.int32(42)) +process.alpakaESProducerAMulti = testAlpakaESProducerAMulti.clone(appendToDataLabel = cms.string("appendedLabel")) from HeterogeneousCore.AlpakaTest.testAlpakaGlobalProducer_cfi import testAlpakaGlobalProducer process.alpakaGlobalProducer = testAlpakaGlobalProducer.clone( eventSetupSource = cms.ESInputTag("alpakaESProducerA", "appendedLabel"), + eventSetupSourceMulti = cms.ESInputTag("alpakaESProducerAMulti", "appendedLabel"), size = dict( alpaka_serial_sync = 10, alpaka_cuda_async = 20, @@ -146,7 +151,7 @@ if args.processAcceleratorBackend != "": process.ProcessAcceleratorAlpaka.setBackend(args.processAcceleratorBackend) if args.moduleBackend != "": - for name in ["ESProducerA", "ESProducerB", "ESProducerC", "ESProducerD", "ESProducerE", + for name in ["ESProducerA", "ESProducerB", "ESProducerC", "ESProducerD", "ESProducerE", "ESProducerAMulti", "ESProducerNull", "GlobalProducer", "GlobalProducerE", "StreamProducer", "StreamInstanceProducer", diff --git a/IOMC/EventVertexGenerators/python/VtxSmearedParameters_cfi.py b/IOMC/EventVertexGenerators/python/VtxSmearedParameters_cfi.py index 688f5dbfef5b2..61cdb5b2cacbe 100644 --- a/IOMC/EventVertexGenerators/python/VtxSmearedParameters_cfi.py +++ b/IOMC/EventVertexGenerators/python/VtxSmearedParameters_cfi.py @@ -1071,6 +1071,19 @@ Z0 = cms.double(0.3064731) ) +# From 2024 ppRef data run 387590-387721 +Realistic2024ppRefCollisionVtxSmearingParameters = cms.PSet( + Phi = cms.double(0.0), + BetaStar = cms.double(310), + Emittance = cms.double(8.636e-08), + Alpha = cms.double(0.0), + SigmaZ = cms.double(5.82376), + TimeOffset = cms.double(0.0), + X0 = cms.double(0.0244619), + Y0 = cms.double(-0.0169181), + Z0 = cms.double(0.3513597) +) + # Parameters for HL-LHC operation at 13TeV HLLHCVtxSmearingParameters = cms.PSet( MeanXIncm = cms.double(0.), diff --git a/IOMC/EventVertexGenerators/python/VtxSmearedRealistic2024ppRefCollision_cfi.py b/IOMC/EventVertexGenerators/python/VtxSmearedRealistic2024ppRefCollision_cfi.py new file mode 100644 index 0000000000000..fa04ac3d981a2 --- /dev/null +++ b/IOMC/EventVertexGenerators/python/VtxSmearedRealistic2024ppRefCollision_cfi.py @@ -0,0 +1,7 @@ +import FWCore.ParameterSet.Config as cms + +from IOMC.EventVertexGenerators.VtxSmearedParameters_cfi import Realistic2024ppRefCollisionVtxSmearingParameters,VtxSmearedCommon +VtxSmeared = cms.EDProducer("BetafuncEvtVtxGenerator", + Realistic2024ppRefCollisionVtxSmearingParameters, + VtxSmearedCommon +) diff --git a/IOPool/Output/src/RootOutputFile.cc b/IOPool/Output/src/RootOutputFile.cc index 9e0aa59304927..6451aa6e4daa2 100644 --- a/IOPool/Output/src/RootOutputFile.cc +++ b/IOPool/Output/src/RootOutputFile.cc @@ -125,13 +125,13 @@ namespace edm { } if (om_->compressionAlgorithm() == std::string("ZLIB")) { - filePtr_->SetCompressionAlgorithm(ROOT::kZLIB); + filePtr_->SetCompressionAlgorithm(ROOT::RCompressionSetting::EAlgorithm::kZLIB); } else if (om_->compressionAlgorithm() == std::string("LZMA")) { - filePtr_->SetCompressionAlgorithm(ROOT::kLZMA); + filePtr_->SetCompressionAlgorithm(ROOT::RCompressionSetting::EAlgorithm::kLZMA); } else if (om_->compressionAlgorithm() == std::string("ZSTD")) { - filePtr_->SetCompressionAlgorithm(ROOT::kZSTD); + filePtr_->SetCompressionAlgorithm(ROOT::RCompressionSetting::EAlgorithm::kZSTD); } else if (om_->compressionAlgorithm() == std::string("LZ4")) { - filePtr_->SetCompressionAlgorithm(ROOT::kLZ4); + filePtr_->SetCompressionAlgorithm(ROOT::RCompressionSetting::EAlgorithm::kLZ4); } else { throw Exception(errors::Configuration) << "PoolOutputModule configured with unknown compression algorithm '" << om_->compressionAlgorithm() << "'\n" diff --git a/L1Trigger/L1CaloTrigger/interface/Phase2L1RCT.h b/L1Trigger/L1CaloTrigger/interface/Phase2L1RCT.h index a51cf7f25f79f..f2e606262c931 100644 --- a/L1Trigger/L1CaloTrigger/interface/Phase2L1RCT.h +++ b/L1Trigger/L1CaloTrigger/interface/Phase2L1RCT.h @@ -1236,16 +1236,16 @@ inline p2eg::clusterInfo p2eg::getBremsValuesPos(p2eg::crystal tempX[p2eg::CRYST inline p2eg::clusterInfo p2eg::getBremsValuesNeg(p2eg::crystal tempX[p2eg::CRYSTAL_IN_ETA][p2eg::CRYSTAL_IN_PHI], ap_uint<5> seed_eta, ap_uint<5> seed_phi) { - ap_uint<12> temp[p2eg::CRYSTAL_IN_ETA + 2][p2eg::CRYSTAL_IN_PHI + 4]; + ap_uint<12> temp[p2eg::CRYSTAL_IN_ETA + 2][p2eg::CRYSTAL_IN_PHI + 7]; ap_uint<12> phi0eta[3], phi1eta[3], phi2eta[3], phi3eta[3], phi4eta[3]; ap_uint<12> eta_slice[3]; p2eg::clusterInfo cluster_tmp; - // Initialize all entries in a new ((15+2)x(20+4)) array to be zero. + // Initialize all entries in a new ((15+2)x(20+7)) array to be zero. for (int i = 0; i < (p2eg::CRYSTAL_IN_ETA + 2); i++) { - for (int j = 0; j < (p2eg::CRYSTAL_IN_PHI + 4); j++) { + for (int j = 0; j < (p2eg::CRYSTAL_IN_PHI + 7); j++) { temp[i][j] = 0; } } diff --git a/L1Trigger/L1TCaloLayer1/src/UCTRegion.cc b/L1Trigger/L1TCaloLayer1/src/UCTRegion.cc index 5cbe2b6f4a510..50769cf2d9d65 100644 --- a/L1Trigger/L1TCaloLayer1/src/UCTRegion.cc +++ b/L1Trigger/L1TCaloLayer1/src/UCTRegion.cc @@ -72,6 +72,7 @@ UCTRegion::UCTRegion(const UCTRegion& otherRegion) : crate(otherRegion.crate), card(otherRegion.card), region(otherRegion.region), + negativeEta(otherRegion.negativeEta), towers(otherRegion.towers), regionSummary(otherRegion.regionSummary), fwVersion(otherRegion.fwVersion) {} diff --git a/L1Trigger/L1TGlobal/src/L1TGlobalUtil.cc b/L1Trigger/L1TGlobal/src/L1TGlobalUtil.cc index e5daaf9d81c58..605f70808558b 100644 --- a/L1Trigger/L1TGlobal/src/L1TGlobalUtil.cc +++ b/L1Trigger/L1TGlobal/src/L1TGlobalUtil.cc @@ -338,8 +338,10 @@ void l1t::L1TGlobalUtil::loadPrescalesAndMasks() { //std::cout << "NumPrescaleSets= " << NumPrescaleSets << std::endl; if (NumPrescaleSets > 0) { // Fill default prescale set + prescale_vec.reserve(NumPrescaleSets); for (int iSet = 0; iSet < NumPrescaleSets; iSet++) { - prescale_vec.push_back(std::vector()); + prescale_vec.emplace_back(); + prescale_vec.back().reserve(m_numberPhysTriggers); for (unsigned int iBit = 0; iBit < m_numberPhysTriggers; ++iBit) { int inputDefaultPrescale = 1; prescale_vec[iSet].push_back(inputDefaultPrescale); @@ -379,8 +381,10 @@ void l1t::L1TGlobalUtil::loadPrescalesAndMasks() { m_PreScaleColumn = 0; + prescale_vec.reserve(1); for (int col = 0; col < 1; col++) { - prescale_vec.push_back(std::vector()); + prescale_vec.emplace_back(); + prescale_vec.back().reserve(m_numberPhysTriggers); for (unsigned int iBit = 0; iBit < m_numberPhysTriggers; ++iBit) { int inputDefaultPrescale = 0; prescale_vec[col].push_back(inputDefaultPrescale); @@ -390,9 +394,9 @@ void l1t::L1TGlobalUtil::loadPrescalesAndMasks() { inputPrescaleFile.close(); - m_initialPrescaleFactorsAlgoTrig = prescale_vec; + m_initialPrescaleFactorsAlgoTrig = std::move(prescale_vec); // setting of bx masks from an input file not enabled; do not see a use case at the moment - std::map > m_initialTriggerMaskAlgoTrig; + //std::map > m_initialTriggerMaskAlgoTrig; } void l1t::L1TGlobalUtil::eventSetupConsumes(edm::ConsumesCollector& iC, UseEventSetupIn useEventSetupIn) { diff --git a/PerfTools/AllocMonitor/README.md b/PerfTools/AllocMonitor/README.md index c59ee6253f9b6..02a51dbe44b12 100644 --- a/PerfTools/AllocMonitor/README.md +++ b/PerfTools/AllocMonitor/README.md @@ -29,6 +29,9 @@ The monitor is owned by the registry and should not be deleted by any other code of the monitor, one can call `cms::perftools::AllocMonitorRegistry::deregisterMonitor` to have the monitor removed from the callback list and be deleted (again, without the deallocation causing any callbacks). +NOTE: Experience has shown that using thread_local within a call to `allocCalled` or `deallocCalled` can lead to unexpected behavior. Therefore if per thread information must be gathered it is recommended to make a system that uses thread ids. +An example of such code can be found in the implementation of ModuleAllocMonitor. + ## General usage To use the facility, one needs to use LD_PRELOAD to load in the memory proxies before the application runs, e.g. @@ -99,3 +102,16 @@ The output file contains the following information on each line - Number of calls made to deallocation functions This service is multi-thread safe. Note that when run multi-threaded the maximum reported value will vary from job to job. + +### ModuleAllocMonitor +This service registers a monitor when the service is created (after python parsing is finished but before any modules +have been loaded into cmsRun) and writes module related information to the specified file. The file name, an optional +list of module names, and an optional number of initial events to skip are specified by setting parameters of the +service in the configuration. The parameters are +- filename: name of file to which to write reports +- moduleNames: list of modules which should have their information added to the file. An empty list specifies all modules should be included. +- nEventsToSkip: the number of initial events that must be processed before reporting happens. + +The beginning of the file contains a description of the structure and contents of the file. + +This service is multi-thread safe. \ No newline at end of file diff --git a/PerfTools/AllocMonitor/plugins/ModuleAllocMonitor.cc b/PerfTools/AllocMonitor/plugins/ModuleAllocMonitor.cc index 0ab24de326313..e6fb72ccefb70 100644 --- a/PerfTools/AllocMonitor/plugins/ModuleAllocMonitor.cc +++ b/PerfTools/AllocMonitor/plugins/ModuleAllocMonitor.cc @@ -23,10 +23,115 @@ #include "FWCore/ServiceRegistry/interface/ModuleCallingContext.h" #include "DataFormats/Provenance/interface/ModuleDescription.h" +#if defined(ALLOC_USE_PTHREADS) +#include +#else +#include +#include +#endif + #include "moduleAlloc_setupFile.h" #include "ThreadAllocInfo.h" namespace { + inline auto thread_id() { +#if defined(ALLOC_USE_PTHREADS) + /*NOTE: if use pthread_self, the values returned by linux had + lots of hash collisions when using a simple % hash. Worked + better if first divided value by 0x700 and then did %. + [test done on el8] + */ + return pthread_self(); +#else + return syscall(SYS_gettid); +#endif + } + + struct ThreadTracker { + static constexpr unsigned int kHashedEntries = 128; + static constexpr unsigned int kExtraEntries = 128; + static constexpr unsigned int kTotalEntries = kHashedEntries + kExtraEntries; + using entry_type = decltype(thread_id()); + static constexpr entry_type kUnusedEntry = ~entry_type(0); + std::array, kHashedEntries> hashed_threads_; + std::array, kExtraEntries> extra_threads_; + + ThreadTracker() { + //put a value which will not match the % used when looking up the entry + entry_type entry = 0; + for (auto& v : hashed_threads_) { + v = ++entry; + } + //assume kUsedEntry is not a valid thread-id + for (auto& v : extra_threads_) { + v = kUnusedEntry; + } + } + + std::size_t thread_index() { + auto id = thread_id(); + auto index = thread_index_guess(id); + auto used_id = hashed_threads_[index].load(); + + if (id == used_id) { + return index; + } + //try to be first thread to grab the index + auto expected = entry_type(index + 1); + if (used_id == expected) { + if (hashed_threads_[index].compare_exchange_strong(expected, id)) { + return index; + } else { + //another thread just beat us so have to go to non-hash storage + return find_new_index(id); + } + } + //search in non-hash storage + return find_index(id); + } + + private: + std::size_t thread_index_guess(entry_type id) const { +#if defined(ALLOC_USE_PTHREADS) + return (id / 0x700) % kHashedEntries; +#else + return id % kHashedEntries; +#endif + } + + std::size_t find_new_index(entry_type id) { + std::size_t index = 0; + for (auto& v : extra_threads_) { + entry_type expected = kUnusedEntry; + if (v == expected) { + if (v.compare_exchange_strong(expected, id)) { + return index + kHashedEntries; + } + } + ++index; + } + //failed to find an open entry + abort(); + return 0; + } + + std::size_t find_index(entry_type id) { + std::size_t index = 0; + for (auto const& v : extra_threads_) { + if (v == id) { + return index + kHashedEntries; + } + ++index; + } + return find_new_index(id); + } + }; + + static ThreadTracker& getTracker() { + static ThreadTracker s_tracker; + return s_tracker; + } + using namespace edm::service::moduleAlloc; class MonitorAdaptor : public cms::perftools::AllocMonitorBase { public: @@ -43,8 +148,8 @@ namespace { private: static ThreadAllocInfo& threadAllocInfo() { - thread_local ThreadAllocInfo s_info; - return s_info; + static ThreadAllocInfo s_info[ThreadTracker::kTotalEntries]; + return s_info[getTracker().thread_index()]; } void allocCalled(size_t iRequested, size_t iActual, void const*) final { auto& allocInfo = threadAllocInfo(); diff --git a/PerfTools/AllocMonitor/scripts/edmModuleAllocMonitorAnalyze.py b/PerfTools/AllocMonitor/scripts/edmModuleAllocMonitorAnalyze.py old mode 100644 new mode 100755 diff --git a/PerfTools/MaxMemoryPreload/README.md b/PerfTools/MaxMemoryPreload/README.md index 09409772fcef3..f65dc15e83d3a 100644 --- a/PerfTools/MaxMemoryPreload/README.md +++ b/PerfTools/MaxMemoryPreload/README.md @@ -16,6 +16,33 @@ LD_PRELOAD="libPerfToolsAllocMonitorPreload.so libPerfToolsMaxMemoryPreload.so" the order is important. +### Pausing the monitoring + +It is possible to temporarily pause the monitoring by instrumenting the target application by definining the following functions +```cpp +// in some header, +void pauseMaxMemoryPreload(); +void unpauseMaxMemoryPreload(); + +// in an implementation source file +void pauseMaxMemoryPreload() { +} +void unpauseMaxMemoryPreload() { +} +``` +and then using these in code +```cpp + ... + pauseMaxMemoryPreload(); + // code that should be excluded from the monitoring + unpauseMaxMemoryPreload(); + ... +``` + +The trick is that by default these functions are defined in the application, and the functions do nothing. The `libPerfToolsMaxMemoryPreload.so` provides also the same functions that actually pause the data collection, and the LD_PRELOADing makes the application to call the functions within `libPerfToolsMaxMemoryPreload.so`. + +It is recommended to not pause the monitoring within a multithreaded section, because that could result in unexpected results, because the pausing setting is global. + ## Reporting When the application ends, the monitor will report the following to standard error: diff --git a/PerfTools/MaxMemoryPreload/src/preload.cc b/PerfTools/MaxMemoryPreload/src/preload.cc index 4d7f2b4126539..64cb49923192a 100644 --- a/PerfTools/MaxMemoryPreload/src/preload.cc +++ b/PerfTools/MaxMemoryPreload/src/preload.cc @@ -26,6 +26,16 @@ // static data member definitions // +// Hooks the target application can be instrumented with to pause and +// unpause the MaxMemoryPreload. Pausing the monitoring during a +// multithreaded execution can result in unexpected results, because +// the setting is global. +namespace { + std::atomic paused = false; +} +void pauseMaxMemoryPreload() { paused = true; } +void unpauseMaxMemoryPreload() { paused = false; } + namespace { class MonitorAdaptor : public cms::perftools::AllocMonitorBase { public: @@ -34,6 +44,9 @@ namespace { private: void allocCalled(size_t iRequested, size_t iActual, void const*) final { + if (paused) + return; + nAllocations_.fetch_add(1, std::memory_order_acq_rel); requested_.fetch_add(iRequested, std::memory_order_acq_rel); @@ -48,6 +61,9 @@ namespace { } } void deallocCalled(size_t iActual, void const*) final { + if (paused) + return; + nDeallocations_.fetch_add(1, std::memory_order_acq_rel); auto present = presentActual_.load(std::memory_order_acquire); if (present >= iActual) { diff --git a/PhysicsTools/NanoAOD/plugins/NanoAODOutputModule.cc b/PhysicsTools/NanoAOD/plugins/NanoAODOutputModule.cc index 7e9c622f86df8..08519ecfc3f00 100644 --- a/PhysicsTools/NanoAOD/plugins/NanoAODOutputModule.cc +++ b/PhysicsTools/NanoAOD/plugins/NanoAODOutputModule.cc @@ -299,13 +299,13 @@ void NanoAODOutputModule::openFile(edm::FileBlock const&) { std::vector()); if (m_compressionAlgorithm == std::string("ZLIB")) { - m_file->SetCompressionAlgorithm(ROOT::kZLIB); + m_file->SetCompressionAlgorithm(ROOT::RCompressionSetting::EAlgorithm::kZLIB); } else if (m_compressionAlgorithm == std::string("LZMA")) { - m_file->SetCompressionAlgorithm(ROOT::kLZMA); + m_file->SetCompressionAlgorithm(ROOT::RCompressionSetting::EAlgorithm::kLZMA); } else if (m_compressionAlgorithm == std::string("ZSTD")) { - m_file->SetCompressionAlgorithm(ROOT::kZSTD); + m_file->SetCompressionAlgorithm(ROOT::RCompressionSetting::EAlgorithm::kZSTD); } else if (m_compressionAlgorithm == std::string("LZ4")) { - m_file->SetCompressionAlgorithm(ROOT::kLZ4); + m_file->SetCompressionAlgorithm(ROOT::RCompressionSetting::EAlgorithm::kLZ4); } else { throw cms::Exception("Configuration") << "NanoAODOutputModule configured with unknown compression algorithm '" << m_compressionAlgorithm << "'\n" diff --git a/PhysicsTools/NanoAOD/plugins/rntuple/NanoAODRNTupleOutputModule.cc b/PhysicsTools/NanoAOD/plugins/rntuple/NanoAODRNTupleOutputModule.cc index ea56c81c17d64..ca293cbe9e552 100644 --- a/PhysicsTools/NanoAOD/plugins/rntuple/NanoAODRNTupleOutputModule.cc +++ b/PhysicsTools/NanoAOD/plugins/rntuple/NanoAODRNTupleOutputModule.cc @@ -161,9 +161,9 @@ void NanoAODRNTupleOutputModule::openFile(edm::FileBlock const&) { std::vector()); if (m_compressionAlgorithm == "ZLIB") { - m_file->SetCompressionAlgorithm(ROOT::kZLIB); + m_file->SetCompressionAlgorithm(ROOT::RCompressionSetting::EAlgorithm::kZLIB); } else if (m_compressionAlgorithm == "LZMA") { - m_file->SetCompressionAlgorithm(ROOT::kLZMA); + m_file->SetCompressionAlgorithm(ROOT::RCompressionSetting::EAlgorithm::kLZMA); } else { throw cms::Exception("Configuration") << "NanoAODOutputModule configured with unknown compression algorithm '" << m_compressionAlgorithm << "'\n" diff --git a/PhysicsTools/NanoAODTools/python/postprocessing/framework/postprocessor.py b/PhysicsTools/NanoAODTools/python/postprocessing/framework/postprocessor.py index 3fd0c0a55bd43..cd731e6812cce 100755 --- a/PhysicsTools/NanoAODTools/python/postprocessing/framework/postprocessor.py +++ b/PhysicsTools/NanoAODTools/python/postprocessing/framework/postprocessor.py @@ -105,11 +105,11 @@ def run(self): (algo, level) = self.compression.split(":") compressionLevel = int(level) if algo == "LZMA": - compressionAlgo = ROOT.ROOT.kLZMA + compressionAlgo = ROOT.RCompressionSetting.EAlgorithm.kLZMA elif algo == "ZLIB": - compressionAlgo = ROOT.ROOT.kZLIB + compressionAlgo = ROOT.RCompressionSetting.EAlgorithm.kZLIB elif algo == "LZ4": - compressionAlgo = ROOT.ROOT.kLZ4 + compressionAlgo = ROOT.RCompressionSetting.EAlgorithm.kLZ4 else: raise RuntimeError("Unsupported compression %s" % algo) else: diff --git a/RecoMTD/DetLayers/test/mtd_cfg.py b/RecoMTD/DetLayers/test/mtd_cfg.py index 0e01676ca3336..3880b14ad87ff 100644 --- a/RecoMTD/DetLayers/test/mtd_cfg.py +++ b/RecoMTD/DetLayers/test/mtd_cfg.py @@ -1,8 +1,10 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 +import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings +_PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION) +from Configuration.ProcessModifiers.dd4hep_cff import dd4hep -process = cms.Process("GeometryTest",Phase2C17I13M9) +process = cms.Process("GeometryTest",_PH2_ERA,dd4hep) process.source = cms.Source("EmptySource") @@ -54,7 +56,7 @@ threshold = cms.untracked.string('INFO')) # Choose Tracker Geometry -process.load("Configuration.Geometry.GeometryExtendedRun4D110Reco_cff") +process.load("Configuration.Geometry.GeometryDD4hepExtendedRun4DefaultReco_cff") process.load("MagneticField.Engine.volumeBasedMagneticField_160812_cfi") process.Timing = cms.Service("Timing") diff --git a/RecoTracker/TkNavigation/test/NavigationSchoolAnalyzer_Phase2_cfg.py b/RecoTracker/TkNavigation/test/NavigationSchoolAnalyzer_Phase2_cfg.py index b7a8d02ac47ea..b3b5e1415c67a 100644 --- a/RecoTracker/TkNavigation/test/NavigationSchoolAnalyzer_Phase2_cfg.py +++ b/RecoTracker/TkNavigation/test/NavigationSchoolAnalyzer_Phase2_cfg.py @@ -1,18 +1,20 @@ import FWCore.ParameterSet.Config as cms # set the geometry and the GlobalTag +import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings +_PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION) -process = cms.Process("NavigationSchoolAnalyzer") +process = cms.Process("NavigationSchoolAnalyzer",_PH2_ERA) # the following lines are kept for when the phase-2 geometry wil be moved to DB #process.load("Configuration.StandardSequences.GeometryDB_cff") #process.load('Configuration.StandardSequences.GeometryRecoDB_cff') -process.load('Configuration.Geometry.GeometryExtended2026D98Reco_cff') +process.load('Configuration.Geometry.GeometryExtendedRun4DefaultReco_cff') process.load("Configuration.StandardSequences.MagneticField_cff") process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T25', '') +process.GlobalTag = GlobalTag(process.GlobalTag, _PH2_GLOBAL_TAG, '') process.load("RecoTracker.TkNavigation.NavigationSchoolESProducer_cff") #process.MessageLogger = cms.Service("MessageLogger", diff --git a/SimG4CMS/Forward/test/python/runMTDSens_DD4hep_cfg.py b/SimG4CMS/Forward/test/python/runMTDSens_DD4hep_cfg.py index 762f2cead99d9..9b7792cc627ee 100644 --- a/SimG4CMS/Forward/test/python/runMTDSens_DD4hep_cfg.py +++ b/SimG4CMS/Forward/test/python/runMTDSens_DD4hep_cfg.py @@ -1,10 +1,11 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 +import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings +_PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION) from Configuration.ProcessModifiers.dd4hep_cff import dd4hep -process = cms.Process('G4PrintGeometry',Phase2C17I13M9,dd4hep) +process = cms.Process('G4PrintGeometry',_PH2_ERA,dd4hep) -process.load('Configuration.Geometry.GeometryDD4hepExtendedRun4D110Reco_cff') +process.load('Configuration.Geometry.GeometryDD4hepExtendedRun4DefaultReco_cff') process.load('FWCore.MessageService.MessageLogger_cfi') process.load("FWCore.MessageLogger.MessageLogger_cfi") diff --git a/SimG4CMS/Forward/test/python/runMTDSens_cfg.py b/SimG4CMS/Forward/test/python/runMTDSens_cfg.py index 9b6fa7ea13759..ae7b7e149946a 100644 --- a/SimG4CMS/Forward/test/python/runMTDSens_cfg.py +++ b/SimG4CMS/Forward/test/python/runMTDSens_cfg.py @@ -1,10 +1,12 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 -process = cms.Process('G4PrintGeometry',Phase2C17I13M9) +import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings +_PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION) + +process = cms.Process('G4PrintGeometry', _PH2_ERA) -process.load('Configuration.Geometry.GeometryExtendedRun4D110Reco_cff') process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.Geometry.GeometryExtendedRun4DefaultReco_cff') process.load("FWCore.MessageLogger.MessageLogger_cfi") process.MessageLogger.cerr.threshold = cms.untracked.string('INFO') diff --git a/SimG4Core/Configuration/test/dd4hepTTBar2026D77_cfg.py b/SimG4Core/Configuration/test/dd4hepTTBarRun4D107_cfg.py similarity index 94% rename from SimG4Core/Configuration/test/dd4hepTTBar2026D77_cfg.py rename to SimG4Core/Configuration/test/dd4hepTTBarRun4D107_cfg.py index 7876f2ae41ae7..47597c991d466 100644 --- a/SimG4Core/Configuration/test/dd4hepTTBar2026D77_cfg.py +++ b/SimG4Core/Configuration/test/dd4hepTTBarRun4D107_cfg.py @@ -1,9 +1,9 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Era_Phase2C11I13M9_cff import Phase2C11I13M9 +from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 from Configuration.ProcessModifiers.dd4hep_cff import dd4hep -process = cms.Process('SIM',Phase2C11I13M9,dd4hep) +process = cms.Process('SIM',Phase2C17I13M9,dd4hep) # import of standard configurations process.load('Configuration.StandardSequences.Services_cff') @@ -11,8 +11,8 @@ process.load('FWCore.MessageService.MessageLogger_cfi') process.load('Configuration.EventContent.EventContent_cff') process.load('SimGeneral.MixingModule.mixNoPU_cfi') -process.load('Configuration.Geometry.GeometryDD4hepExtended2026D77Reco_cff') -process.load('Configuration.Geometry.GeometryDD4hepExtended2026D77_cff') +process.load('Configuration.Geometry.GeometryDD4hepExtendedRun4D107Reco_cff') +process.load('Configuration.Geometry.GeometryDD4hepExtendedRun4D107_cff') process.load('Configuration.StandardSequences.MagneticField_cff') process.load('Configuration.StandardSequences.Generator_cff') process.load('IOMC.EventVertexGenerators.VtxSmearedHLLHC14TeV_cfi') @@ -59,7 +59,7 @@ # Other statements process.genstepfilter.triggerConditions=cms.vstring("generation_step") from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T21', '') +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T25', '') process.generator = cms.EDFilter("Pythia8GeneratorFilter", PythiaParameters = cms.PSet( diff --git a/SimG4Core/Configuration/test/dd4hepTTBar2026D83_cfg.py b/SimG4Core/Configuration/test/dd4hepTTBarRun4D110_cfg.py similarity index 94% rename from SimG4Core/Configuration/test/dd4hepTTBar2026D83_cfg.py rename to SimG4Core/Configuration/test/dd4hepTTBarRun4D110_cfg.py index 543d74cb45653..2d096ddf54514 100644 --- a/SimG4Core/Configuration/test/dd4hepTTBar2026D83_cfg.py +++ b/SimG4Core/Configuration/test/dd4hepTTBarRun4D110_cfg.py @@ -1,9 +1,9 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Era_Phase2C11I13M9_cff import Phase2C11I13M9 +from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 from Configuration.ProcessModifiers.dd4hep_cff import dd4hep -process = cms.Process('SIM',Phase2C11I13M9,dd4hep) +process = cms.Process('SIM',Phase2C17I13M9,dd4hep) # import of standard configurations process.load('Configuration.StandardSequences.Services_cff') @@ -11,8 +11,8 @@ process.load('FWCore.MessageService.MessageLogger_cfi') process.load('Configuration.EventContent.EventContent_cff') process.load('SimGeneral.MixingModule.mixNoPU_cfi') -process.load('Configuration.Geometry.GeometryDD4hepExtended2026D83Reco_cff') -process.load('Configuration.Geometry.GeometryDD4hepExtended2026D83_cff') +process.load('Configuration.Geometry.GeometryDD4hepExtendedRun4D110Reco_cff') +process.load('Configuration.Geometry.GeometryDD4hepExtendedRun4D110_cff') process.load('Configuration.StandardSequences.MagneticField_cff') process.load('Configuration.StandardSequences.Generator_cff') process.load('IOMC.EventVertexGenerators.VtxSmearedHLLHC14TeV_cfi') @@ -59,7 +59,7 @@ # Other statements process.genstepfilter.triggerConditions=cms.vstring("generation_step") from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T21', '') +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T33', '') process.generator = cms.EDFilter("Pythia8GeneratorFilter", PythiaParameters = cms.PSet( diff --git a/SimG4Core/Configuration/test/dd4hep_ttbar_2026D77_Step1_cfg.py b/SimG4Core/Configuration/test/dd4hep_ttbar_Run4D110_Step1_cfg.py similarity index 95% rename from SimG4Core/Configuration/test/dd4hep_ttbar_2026D77_Step1_cfg.py rename to SimG4Core/Configuration/test/dd4hep_ttbar_Run4D110_Step1_cfg.py index b43320cb2f331..1d850b09470fe 100644 --- a/SimG4Core/Configuration/test/dd4hep_ttbar_2026D77_Step1_cfg.py +++ b/SimG4Core/Configuration/test/dd4hep_ttbar_Run4D110_Step1_cfg.py @@ -1,8 +1,9 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Era_Phase2C11_dd4hep_cff import Phase2C11_dd4hep +from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 +from Configuration.ProcessModifiers.dd4hep_cff import dd4hep -process = cms.Process('SIM',Phase2C11_dd4hep) +process = cms.Process('SIM',Phase2C17I13M9,dd4hep) # import of standard configurations process.load('Configuration.StandardSequences.Services_cff') @@ -10,7 +11,7 @@ process.load('FWCore.MessageService.MessageLogger_cfi') process.load('Configuration.EventContent.EventContent_cff') process.load('SimGeneral.MixingModule.mixNoPU_cfi') -process.load('Configuration.Geometry.GeometryDD4hepExtended2026D77Reco_cff') +process.load('Configuration.Geometry.GeometryDD4hepExtendedRun4D110Reco_cff') process.load('Configuration.StandardSequences.MagneticField_cff') process.load('Configuration.StandardSequences.Generator_cff') process.load('IOMC.EventVertexGenerators.VtxSmearedHLLHC14TeV_cfi') @@ -85,7 +86,7 @@ # Other statements process.genstepfilter.triggerConditions=cms.vstring("generation_step") from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T21', '') +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T33', '') process.generator = cms.EDFilter("Pythia8GeneratorFilter", PythiaParameters = cms.PSet( diff --git a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckCalo_cfg.py b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckCalo_cfg.py index fd49a8bfb027f..eb3837c1806eb 100644 --- a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckCalo_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckCalo_cfg.py @@ -2,9 +2,9 @@ # Way to use this: # cmsRun g4OverlapCheckCalo_cfg.py geometry=2021 tol=0.1 # -# Options for geometry 2016, 2017, 2021, 2026D102, 2026D103, 2026D104, -# 22026D108, 026D109, 2026D110, 2026D111, 2026D112, -# 2026D113, 2026D114, 2026D115 +# Options for geometry 2016, 2017, 2021, Run4D102, Run4D103, Run4D104, +# 2Run4D108, 026D109, Run4D110, Run4D111, Run4D112, +# Run4D113, Run4D114, Run4D115 # ############################################################################### import FWCore.ParameterSet.Config as cms @@ -18,7 +18,7 @@ "2021", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, - "geometry of operations: 2016, 2017, 2021, 2026D102, 2026D103, 2026D104, 2026D108, 2026D109, 2026D110, 2026D111, 2026D112, 2026D113, 2026D114, 2026D115") + "geometry of operations: 2016, 2017, 2021, Run4D102, Run4D103, Run4D104, Run4D108, Run4D109, Run4D110, Run4D111, Run4D112, Run4D113, Run4D114, Run4D115, Run4D116") options.register('tol', 0.01, VarParsing.VarParsing.multiplicity.singleton, @@ -34,76 +34,81 @@ #################################################################### # Use the options -if (options.geometry == "2026D102"): +if (options.geometry == "Run4D102"): from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) process.load('Configuration.Geometry.GeometryExtendedRun4D102Reco_cff') - baseName = 'Hcal2026D102' -elif (options.geometry == "2026D103"): + baseName = 'CaloRun4D102' +elif (options.geometry == "Run4D103"): from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) process.load('Configuration.Geometry.GeometryExtendedRun4D103Reco_cff') - baseName = 'Hcal2026D103' -elif (options.geometry == "2026D104"): + baseName = 'CaloRun4D103' +elif (options.geometry == "Run4D104"): from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9 process = cms.Process('G4PrintGeometry',Phase2C22I13M9) process.load('Configuration.Geometry.GeometryExtendedRun4D104Reco_cff') - baseName = 'Hcal2026D104' -elif (options.geometry == "2026D108"): + baseName = 'CaloRun4D104' +elif (options.geometry == "Run4D108"): from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D108' -elif (options.geometry == "2026D109"): + baseName = 'CaloRun4D108' +elif (options.geometry == "Run4D109"): from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9 process = cms.Process('G4PrintGeometry',Phase2C22I13M9) process.load('Configuration.Geometry.GeometryExtendedRun4D109Reco_cff') - baseName = 'Hcal2026D109' -elif (options.geometry == "2026D110"): + baseName = 'CaloRun4D109' +elif (options.geometry == "Run4D110"): from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D110' -elif (options.geometry == "2026D111"): + process.load('Configuration.Geometry.GeometryExtendedRun4D110Reco_cff') + baseName = 'CaloRun4D110' +elif (options.geometry == "Run4D111"): from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9 process = cms.Process('G4PrintGeometry',Phase2C22I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D111' -elif (options.geometry == "2026D112"): + process.load('Configuration.Geometry.GeometryExtendedRun4D111Reco_cff') + baseName = 'CaloRun4D111' +elif (options.geometry == "Run4D112"): from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9 process = cms.Process('G4PrintGeometry',Phase2C22I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D112' -elif (options.geometry == "2026D113"): + process.load('Configuration.Geometry.GeometryExtendedRun4D112Reco_cff') + baseName = 'CaloRun4D112' +elif (options.geometry == "Run4D113"): from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9 process = cms.Process('G4PrintGeometry',Phase2C22I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D113' -elif (options.geometry == "2026D114"): + process.load('Configuration.Geometry.GeometryExtendedRun4D113Reco_cff') + baseName = 'CaloRun4D113' +elif (options.geometry == "Run4D114"): from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D114' -elif (options.geometry == "2026D115"): + process.load('Configuration.Geometry.GeometryExtendedRun4D114Reco_cff') + baseName = 'CaloRun4D114' +elif (options.geometry == "Run4D115"): from Configuration.Eras.Era_Phase2C20I13M9_cff import Phase2C20I13M9 process = cms.Process('G4PrintGeometry',Phase2C20I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D115' + process.load('Configuration.Geometry.GeometryExtendedRun4D115Reco_cff') + baseName = 'CaloRun4D115' +elif (options.geometry == "Run4D116"): + from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 + process = cms.Process('G4PrintGeometry',Phase2C17I13M9) + process.load('Configuration.Geometry.GeometryExtendedRun4D116Reco_cff') + baseName = 'CaloRun4D110' elif (options.geometry == "2016"): from Configuration.Eras.Era_Run2_2016_cff import Run2_2016 process = cms.Process('G4PrintGeometry',Run2_2016) process.load('Configuration.Geometry.GeometryExtended2016Reco_cff') - baseName = 'Hcal2016' + baseName = 'Calo2016' elif (options.geometry == "2017"): from Configuration.Eras.Era_Run2_2017_cff import Run2_2017 process = cms.Process('G4PrintGeometry',Run2_2017) process.load('Configuration.Geometry.GeometryExtended2017Reco_cff') - baseName = 'Hcal2017' + baseName = 'Calo2017' else: from Configuration.Eras.Era_Run3_DDD_cff import Run3_DDD process = cms.Process('G4PrintGeometry',Run3_DDD) process.load('Configuration.Geometry.GeometryExtended2021Reco_cff') - baseName = 'Hcal2021' + baseName = 'Calo2021' print("Base file Name: ", baseName) diff --git a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckEcal_cfg.py b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckEcal_cfg.py index 720b8fc367044..bff51374a54e6 100644 --- a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckEcal_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckEcal_cfg.py @@ -2,9 +2,9 @@ # Way to use this: # cmsRun g4OverlapCheckEcal_cfg.py geometry=2021 tol=0.1 # -# Options for geometry 2016, 2017, 2021, 2026D102, 2026D103, 2026D104, -# 2026D108, 2026D109, 2026D110, 2026D111, 2026D112, -# 2026D113, 2026D114, 2026D115 +# Options for geometry 2016, 2017, 2021, Run4D102, Run4D103, Run4D104, +# Run4D108, Run4D109, Run4D110, Run4D111, Run4D112, +# Run4D113, Run4D114, Run4D115 # ############################################################################### import FWCore.ParameterSet.Config as cms @@ -18,7 +18,7 @@ "2021", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, - "geometry of operations: 2016, 2017, 2021, 2026D102, 2026D103, 2026D104, 2026D108, 2026D109, 2026D110, 2026D111, 2026D112, 2026D113, 2026D114, 2026D115") + "geometry of operations: 2016, 2017, 2021, Run4D102, Run4D103, Run4D104, Run4D108, Run4D109, Run4D110, Run4D111, Run4D112, Run4D113, Run4D114, Run4D115") options.register('tol', 0.01, VarParsing.VarParsing.multiplicity.singleton, @@ -34,61 +34,66 @@ #################################################################### # Use the options -if (options.geometry == "2026D102"): +if (options.geometry == "Run4D102"): from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) process.load('Configuration.Geometry.GeometryExtendedRun4D102Reco_cff') - baseName = 'Hcal2026D102' -elif (options.geometry == "2026D103"): + baseName = 'EcalRun4D102' +elif (options.geometry == "Run4D103"): from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) process.load('Configuration.Geometry.GeometryExtendedRun4D103Reco_cff') - baseName = 'Hcal2026D103' -elif (options.geometry == "2026D104"): + baseName = 'EcalRun4D103' +elif (options.geometry == "Run4D104"): from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9 process = cms.Process('G4PrintGeometry',Phase2C22I13M9) process.load('Configuration.Geometry.GeometryExtendedRun4D104Reco_cff') - baseName = 'Hcal2026D104' -elif (options.geometry == "2026D108"): + baseName = 'EcalRun4D104' +elif (options.geometry == "Run4D108"): from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D108' -elif (options.geometry == "2026D109"): + baseName = 'EcalRun4D108' +elif (options.geometry == "Run4D109"): from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9 process = cms.Process('G4PrintGeometry',Phase2C22I13M9) process.load('Configuration.Geometry.GeometryExtendedRun4D109Reco_cff') - baseName = 'Hcal2026D109' -elif (options.geometry == "2026D110"): + baseName = 'EcalRun4D109' +elif (options.geometry == "Run4D110"): from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D110' -elif (options.geometry == "2026D111"): + process.load('Configuration.Geometry.GeometryExtendedRun4D110Reco_cff') + baseName = 'EcalRun4D110' +elif (options.geometry == "Run4D111"): from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9 process = cms.Process('G4PrintGeometry',Phase2C22I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D111' -elif (options.geometry == "2026D112"): + process.load('Configuration.Geometry.GeometryExtendedRun4D111Reco_cff') + baseName = 'EcalRun4D111' +elif (options.geometry == "Run4D112"): from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9 process = cms.Process('G4PrintGeometry',Phase2C22I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D112' -elif (options.geometry == "2026D113"): + process.load('Configuration.Geometry.GeometryExtendedRun4D112Reco_cff') + baseName = 'EcalRun4D112' +elif (options.geometry == "Run4D113"): from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9 process = cms.Process('G4PrintGeometry',Phase2C22I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D113' -elif (options.geometry == "2026D114"): + process.load('Configuration.Geometry.GeometryExtendedRun4D113Reco_cff') + baseName = 'EcalRun4D113' +elif (options.geometry == "Run4D114"): from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D114' -elif (options.geometry == "2026D115"): + process.load('Configuration.Geometry.GeometryExtendedRun4D114Reco_cff') + baseName = 'EcalRun4D114' +elif (options.geometry == "Run4D115"): from Configuration.Eras.Era_Phase2C20I13M9_cff import Phase2C20I13M9 process = cms.Process('G4PrintGeometry',Phase2C20I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D115' + process.load('Configuration.Geometry.GeometryExtendedRun4D115Reco_cff') + baseName = 'EcalRun4D115' +elif (options.geometry == "Run4D116"): + from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 + process = cms.Process('G4PrintGeometry',Phase2C17I13M9) + process.load('Configuration.Geometry.GeometryExtendedRun4D116Reco_cff') + baseName = 'EcalRun4D110' elif (options.geometry == "2016"): from Configuration.Eras.Era_Run2_2016_cff import Run2_2016 process = cms.Process('G4PrintGeometry',Run2_2016) diff --git a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckHGCal_cfg.py b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckHGCal_cfg.py index 13d660264f4f8..bc0b14a9efb2f 100644 --- a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckHGCal_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckHGCal_cfg.py @@ -34,8 +34,8 @@ from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) -geomFile = "Configuration.Geometry.GeometryExtended2026" + options.geometry + "Reco_cff" -baseName = "HGCal2026" + options.geometry +geomFile = "Configuration.Geometry.GeometryExtendedRun4" + options.geometry + "Reco_cff" +baseName = "HGCalRun4" + options.geometry print("Geometry file Name: ", geomFile) print("Base file Name: ", baseName) diff --git a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckMuon_cfg.py b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckMuon_cfg.py index d0227771dc311..ec9e4bca12e4e 100644 --- a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckMuon_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckMuon_cfg.py @@ -2,9 +2,9 @@ # Way to use this: # cmsRun g4OverlapCheckMuon_cfg.py geometry=2021 tol=0.1 # -# Options for geometry 2016, 2017, 2021, 2026D102, 2026D103, 2026D104, -# 2026D108, 2026D109, 2026D110, 2026D111, 2026D112, -# 2026D113, 2026D114, 2026D115 +# Options for geometry 2016, 2017, 2021, Run4D102, Run4D103, Run4D104, +# Run4D108, Run4D109, Run4D110, Run4D111, Run4D112, +# Run4D113, Run4D114, Run4D115, Run4D116 # ############################################################################### import FWCore.ParameterSet.Config as cms @@ -18,7 +18,7 @@ "2021", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, - "geometry of operations: 2016, 2017, 2021, 2026D102, 2026D103, 2026D104, 2026D108, 2026D109, 2026D110, 2026D111, 2026D112, 2026D113, 2026D114, 2026D115") + "geometry of operations: 2016, 2017, 2021, Run4D102, Run4D103, Run4D104, Run4D108, Run4D109, Run4D110, Run4D111, Run4D112, Run4D113, Run4D114, Run4D115, Run4D116") options.register('tol', 0.01, VarParsing.VarParsing.multiplicity.singleton, @@ -34,61 +34,66 @@ #################################################################### # Use the options -if (options.geometry == "2026D102"): +if (options.geometry == "Run4D102"): from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) process.load('Configuration.Geometry.GeometryExtendedRun4D102Reco_cff') - baseName = 'Hcal2026D102' -elif (options.geometry == "2026D103"): + baseName = 'MuonRun4D102' +elif (options.geometry == "Run4D103"): from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) process.load('Configuration.Geometry.GeometryExtendedRun4D103Reco_cff') - baseName = 'Hcal2026D103' -elif (options.geometry == "2026D104"): + baseName = 'MuonRun4D103' +elif (options.geometry == "Run4D104"): from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9 process = cms.Process('G4PrintGeometry',Phase2C22I13M9) process.load('Configuration.Geometry.GeometryExtendedRun4D104Reco_cff') - baseName = 'Hcal2026D104' -elif (options.geometry == "2026D108"): + baseName = 'MuonRun4D104' +elif (options.geometry == "Run4D108"): from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D108' -elif (options.geometry == "2026D109"): + baseName = 'MuonRun4D108' +elif (options.geometry == "Run4D109"): from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9 process = cms.Process('G4PrintGeometry',Phase2C22I13M9) process.load('Configuration.Geometry.GeometryExtendedRun4D109Reco_cff') - baseName = 'Hcal2026D109' -elif (options.geometry == "2026D110"): + baseName = 'MuonRun4D109' +elif (options.geometry == "Run4D110"): from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D110' -elif (options.geometry == "2026D111"): + process.load('Configuration.Geometry.GeometryExtendedRun4D110Reco_cff') + baseName = 'MuonRun4D110' +elif (options.geometry == "Run4D111"): from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9 process = cms.Process('G4PrintGeometry',Phase2C22I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D111' -elif (options.geometry == "2026D112"): + process.load('Configuration.Geometry.GeometryExtendedRun4D111Reco_cff') + baseName = 'MuonRun4D111' +elif (options.geometry == "Run4D112"): from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9 process = cms.Process('G4PrintGeometry',Phase2C22I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D112' -elif (options.geometry == "2026D113"): + process.load('Configuration.Geometry.GeometryExtendedRun4D112Reco_cff') + baseName = 'MuonRun4D112' +elif (options.geometry == "Run4D113"): from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9 process = cms.Process('G4PrintGeometry',Phase2C22I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D113' -elif (options.geometry == "2026D114"): + process.load('Configuration.Geometry.GeometryExtendedRun4D113Reco_cff') + baseName = 'MuonRun4D113' +elif (options.geometry == "Run4D114"): from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D114' -elif (options.geometry == "2026D115"): + process.load('Configuration.Geometry.GeometryExtendedRun4D114Reco_cff') + baseName = 'MuonRun4D114' +elif (options.geometry == "Run4D115"): from Configuration.Eras.Era_Phase2C20I13M9_cff import Phase2C20I13M9 process = cms.Process('G4PrintGeometry',Phase2C20I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D115' + process.load('Configuration.Geometry.GeometryExtendedRun4D115Reco_cff') + baseName = 'MuonRun4D115' +elif (options.geometry == "Run4D116"): + from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 + process = cms.Process('G4PrintGeometry',Phase2C17I13M9) + process.load('Configuration.Geometry.GeometryExtendedRun4D116Reco_cff') + baseName = 'MuonRun4D116' elif (options.geometry == "2016"): from Configuration.Eras.Era_Run2_2016_cff import Run2_2016 process = cms.Process('G4PrintGeometry',Run2_2016) diff --git a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckNoseDDD_cfg.py b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckNoseDDD_cfg.py index 3f83f7fccb65b..7735da9ca1ae4 100644 --- a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckNoseDDD_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckNoseDDD_cfg.py @@ -36,8 +36,8 @@ process = cms.Process('OverlapCheck',Phase2C20I13M9) -baseName = "cms2026" + options.geometry + "DDD" -geomFile = "Configuration.Geometry.GeometryExtended2026" + options.geometry + "Reco_cff" +baseName = "cmsRun4" + options.geometry + "DDD" +geomFile = "Configuration.Geometry.GeometryExtendedRun4" + options.geometry + "Reco_cff" print("Geometry file Name: ", geomFile) diff --git a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckTracker_cfg.py b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckTracker_cfg.py index 0dededed89ecc..e008f279c5add 100644 --- a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckTracker_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckTracker_cfg.py @@ -2,9 +2,9 @@ # Way to use this: # cmsRun g4OverlapCheckTracker_cfg.py geometry=2021 tol=0.1 # -# Options for geometry 2016, 2017, 2021, 2026D102, 2026D103, 2026D104, -# 2026D108, 2026D109, 2026D110, 2026D111, 2026D112, -# 2026D113, 2026D114, 2026D115 +# Options for geometry 2016, 2017, 2021, Run4D102, Run4D103, Run4D104, +# Run4D108, Run4D109, Run4D110, Run4D111, Run4D112, +# Run4D113, Run4D114, Run4D115, Run4D115 # ############################################################################### import FWCore.ParameterSet.Config as cms @@ -18,7 +18,7 @@ "2021", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, - "geometry of operations: 2016, 2017, 2021, 2026D102, 2026D103, 2026D104, 2026D108, 2026D109, 2026D110, 2026D111, 2026D112, 2026D113, 2026D114, 2026D115") + "geometry of operations: 2016, 2017, 2021, Run4D102, Run4D103, Run4D104, Run4D108, Run4D109, Run4D110, Run4D111, Run4D112, Run4D113, Run4D114, Run4D115, Run4D116") options.register('tol', 0.01, VarParsing.VarParsing.multiplicity.singleton, @@ -34,61 +34,66 @@ #################################################################### # Use the options -if (options.geometry == "2026D102"): +if (options.geometry == "Run4D102"): from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) process.load('Configuration.Geometry.GeometryExtendedRun4D102Reco_cff') - baseName = 'Hcal2026D102' -elif (options.geometry == "2026D103"): + baseName = 'TrackerRun4D102' +elif (options.geometry == "Run4D103"): from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) process.load('Configuration.Geometry.GeometryExtendedRun4D103Reco_cff') - baseName = 'Hcal2026D103' -elif (options.geometry == "2026D104"): + baseName = 'TrackerRun4D103' +elif (options.geometry == "Run4D104"): from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9 process = cms.Process('G4PrintGeometry',Phase2C22I13M9) process.load('Configuration.Geometry.GeometryExtendedRun4D104Reco_cff') - baseName = 'Hcal2026D104' -elif (options.geometry == "2026D108"): + baseName = 'TrackerRun4D104' +elif (options.geometry == "Run4D108"): from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D108' -elif (options.geometry == "2026D109"): + baseName = 'TrackerRun4D108' +elif (options.geometry == "Run4D109"): from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9 process = cms.Process('G4PrintGeometry',Phase2C22I13M9) process.load('Configuration.Geometry.GeometryExtendedRun4D109Reco_cff') - baseName = 'Hcal2026D109' -elif (options.geometry == "2026D110"): + baseName = 'TrackerRun4D109' +elif (options.geometry == "Run4D110"): from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D110' -elif (options.geometry == "2026D111"): + process.load('Configuration.Geometry.GeometryExtendedRun4D110Reco_cff') + baseName = 'TrackerRun4D110' +elif (options.geometry == "Run4D111"): from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9 process = cms.Process('G4PrintGeometry',Phase2C22I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D111' -elif (options.geometry == "2026D112"): + process.load('Configuration.Geometry.GeometryExtendedRun4D111Reco_cff') + baseName = 'TrackerRun4D111' +elif (options.geometry == "Run4D112"): from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9 process = cms.Process('G4PrintGeometry',Phase2C22I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D112' -elif (options.geometry == "2026D113"): + process.load('Configuration.Geometry.GeometryExtendedRun4D112Reco_cff') + baseName = 'TrackerRun4D112' +elif (options.geometry == "Run4D113"): from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9 process = cms.Process('G4PrintGeometry',Phase2C22I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D113' -elif (options.geometry == "2026D114"): + process.load('Configuration.Geometry.GeometryExtendedRun4D113Reco_cff') + baseName = 'TrackerRun4D113' +elif (options.geometry == "Run4D114"): from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D114' -elif (options.geometry == "2026D115"): + process.load('Configuration.Geometry.GeometryExtendedRun4D114Reco_cff') + baseName = 'TrackerRun4D114' +elif (options.geometry == "Run4D115"): from Configuration.Eras.Era_Phase2C20I13M9_cff import Phase2C20I13M9 process = cms.Process('G4PrintGeometry',Phase2C20I13M9) - process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff') - baseName = 'Hcal2026D115' + process.load('Configuration.Geometry.GeometryExtendedRun4D115Reco_cff') + baseName = 'TrackerRun4D115' +elif (options.geometry == "Run4D116"): + from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 + process = cms.Process('G4PrintGeometry',Phase2C17I13M9) + process.load('Configuration.Geometry.GeometryExtendedRun4D116Reco_cff') + baseName = 'TrackerRun4D116' elif (options.geometry == "2016"): from Configuration.Eras.Era_Run2_2016_cff import Run2_2016 process = cms.Process('G4PrintGeometry',Run2_2016) diff --git a/SimG4Core/PrintGeomInfo/test/python/runDD4hepRun4D98_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runDD4hepRun4D98_cfg.py index 4e19c5a5f3fb5..c1f8d432ab12d 100644 --- a/SimG4Core/PrintGeomInfo/test/python/runDD4hepRun4D98_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runDD4hepRun4D98_cfg.py @@ -1,6 +1,6 @@ ############################################################################### # Way to use this: -# cmsRun runDD4hep2026_cfg.py type=Tracker +# cmsRun runDD4hepRun4D98_cfg.py type=Tracker # # Options for type Tracker, Calo, MTD, Muon # @@ -30,7 +30,7 @@ from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9,dd4hep) -geomFile = "Geometry.CMSCommonData.GeometryDD4hepExtended2026D98" + options.type + "Reco_cff" +geomFile = "Geometry.CMSCommonData.GeometryDD4hepExtendedRun4D98" + options.type + "Reco_cff" materialFileName = "matfileD98" + options.type + "DD4hep.txt" solidFileName = "solidfileD98" + options.type + "DD4hep.txt" lvFileName = "lvfileD98" + options.type + "DD4hep.txt" diff --git a/SimG4Core/PrintGeomInfo/test/python/runDD4hepRun4_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runDD4hepRun4_cfg.py index 4d35af5cb4195..6d1ab2127cfab 100644 --- a/SimG4Core/PrintGeomInfo/test/python/runDD4hepRun4_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runDD4hepRun4_cfg.py @@ -1,6 +1,6 @@ ############################################################################### # Way to use this: -# cmsRun runDD4hep2026_cfg.py geometry=D110 +# cmsRun runDD4hepRun4_cfg.py geometry=D110 # # Options for geometry D95, D96, D98, D99, D100, D101, D102, D103, D104, # D105, D106, D107, D108, D109, D110, D111, D112, D113, @@ -36,7 +36,7 @@ from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9,dd4hep) -geomFile = "Configuration.Geometry.GeometryDD4hepExtended2026" + options.geometry + "Reco_cff" +geomFile = "Configuration.Geometry.GeometryDD4hepExtendedRun4" + options.geometry + "Reco_cff" materialFileName = "matfile" + options.geometry + "DD4hep.txt" solidFileName = "solidfile" + options.geometry + "DD4hep.txt" lvFileName = "lvfile" + options.geometry + "DD4hep.txt" diff --git a/SimG4Core/PrintGeomInfo/test/python/runDDDRun4D98_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runDDDRun4D98_cfg.py index 6556b1d2530fd..0ce330ffb9100 100644 --- a/SimG4Core/PrintGeomInfo/test/python/runDDDRun4D98_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runDDDRun4D98_cfg.py @@ -1,6 +1,6 @@ ############################################################################### # Way to use this: -# cmsRun runDDD2026_cfg.py type=Tracker +# cmsRun runDDDRun4D98_cfg.py type=Tracker # # Options for type Tracker, Calo, MTD, Muon # diff --git a/SimG4Core/PrintGeomInfo/test/python/runDDDRun4_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runDDDRun4_cfg.py index 84c00ed270c85..c4c5b8457c5e8 100644 --- a/SimG4Core/PrintGeomInfo/test/python/runDDDRun4_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runDDDRun4_cfg.py @@ -1,6 +1,6 @@ ############################################################################### # Way to use this: -# cmsRun runDDD2026_cfg.py geometry=D110 +# cmsRun runDDDRun4_cfg.py geometry=D110 # # Options for geometry D95, D96, D98, D99, D100, D101, D102, D103, D104, # D105, D106, D107, D108, D109, D110, D111, D112, D113, @@ -35,7 +35,7 @@ from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) -geomFile = "Configuration.Geometry.GeometryExtended2026" + options.geometry + "Reco_cff" +geomFile = "Configuration.Geometry.GeometryExtendedRun4" + options.geometry + "Reco_cff" materialFileName = "matfile" + options.geometry + "DDD.txt" solidFileName = "solidfile" + options.geometry + "DDD.txt" lvFileName = "lvfile" + options.geometry + "DDD.txt" diff --git a/SimG4Core/PrintGeomInfo/test/python/runMaterialBudgeInfoRun4_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runMaterialBudgeInfoRun4_cfg.py index 4a50974d17ed3..e02a9a194fe09 100644 --- a/SimG4Core/PrintGeomInfo/test/python/runMaterialBudgeInfoRun4_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runMaterialBudgeInfoRun4_cfg.py @@ -1,6 +1,6 @@ #######################################################9######################## # Way to use this: -# cmsRun runMaterialBudgetInfo2026_cfg.py type=DDD geometry=D110 detector=Tracker +# cmsRun runMaterialBudgetInfoRun4_cfg.py type=DDD geometry=D110 detector=Tracker # # Options for type DDD, DD4hep # Options for geometry D95, D96, D98, D99, D100, D101, D102, D103, D104, @@ -90,9 +90,9 @@ process = cms.Process('G4PrintGeometry',Phase2C17I13M9) if (options.type == "DDD"): - geomFile = "Configuration.Geometry.GeometryExtended2026" + options.geometry + "Reco_cff" + geomFile = "Configuration.Geometry.GeometryExtendedRun4" + options.geometry + "Reco_cff" else: - geomFile = "Configuration.Geometry.GeometryDD4hepExtended2026" + options.geometry + "Reco_cff" + geomFile = "Configuration.Geometry.GeometryDD4hepExtendedRun4" + options.geometry + "Reco_cff" print("Geometry file Name: ", geomFile) print("Detector : ", options.detector) diff --git a/SimG4Core/PrintGeomInfo/test/python/runPrintG4Solids2_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runPrintG4Solids2_cfg.py index 7134063692c96..e1a7449bdce3e 100644 --- a/SimG4Core/PrintGeomInfo/test/python/runPrintG4Solids2_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runPrintG4Solids2_cfg.py @@ -1,6 +1,6 @@ ############################################################################### # Way to use this: -# cmsRun grunPrintG4Solids_cfg.py geometry=D110 dd4hep=False +# cmsRun grunPrintG4Solids2_cfg.py geometry=D110 dd4hep=False # # Options for geometry D95, D96, D98, D99, D100, D101, D102, D103, D104, # D105, D106, D107, D108, D109, D110, D111, D112, D113, @@ -36,7 +36,7 @@ from Configuration.ProcessModifiers.dd4hep_cff import dd4hep if (options.type == "DD4hep"): - geomFile = "Configuration.Geometry.GeometryDD4hepExtended2026" + options.geometry + "Reco_cff" + geomFile = "Configuration.Geometry.GeometryDD4hepExtendedRun4" + options.geometry + "Reco_cff" if (options.geometry == "D115"): from Configuration.Eras.Era_Phase2C20I13M9_cff import Phase2C20I13M9 process = cms.Process('PrintG4Solids',Phase2C20I13M9,dd4hep) @@ -44,7 +44,7 @@ from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('PrintG4Solids',Phase2C17I13M9,dd4hep) else: - geomFile = "Configuration.Geometry.GeometryExtended2026" + options.geometry + "Reco_cff" + geomFile = "Configuration.Geometry.GeometryExtendedRun4" + options.geometry + "Reco_cff" if (options.geometry == "D115"): from Configuration.Eras.Era_Phase2C20I13M9_cff import Phase2C20I13M9 process = cms.Process('PrintG4Solids',Phase2C20I13M9) diff --git a/SimG4Core/PrintGeomInfo/test/python/runPrintG4Solids_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runPrintG4Solids_cfg.py index 170053b4694f3..8162f9025e834 100644 --- a/SimG4Core/PrintGeomInfo/test/python/runPrintG4Solids_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runPrintG4Solids_cfg.py @@ -4,7 +4,7 @@ # # Options for geometry D95, D96, D98, D99, D100, D101, D102, D103, D104, # D105, D106, D107, D108, D109, D110, D111, D112, D113, -# D114, D115 +# D114, D115, D116 # Options for type DDD, DD4hep # ############################################################################### @@ -19,7 +19,7 @@ "D110", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, - "geometry of operations: D95, D96, D98, D99, D100, D101, D102, D103, D104, D105, D106, D107, D108, D109, D110, D111, D112, D113, D114, D115") + "geometry of operations: D95, D96, D98, D99, D100, D101, D102, D103, D104, D105, D106, D107, D108, D109, D110, D111, D112, D113, D114, D115, D116") options.register('type', "DDD", VarParsing.VarParsing.multiplicity.singleton, @@ -85,9 +85,9 @@ process = cms.Process('G4PrintGeometry',Phase2C17I13M9) if (options.type == "DD4hep"): - geomFile = "Configuration.Geometry.GeometryDD4hepExtended2026" + options.geometry + "Reco_cff" + geomFile = "Configuration.Geometry.GeometryDD4hepExtendedRun4" + options.geometry + "Reco_cff" else: - geomFile = "Configuration.Geometry.GeometryExtended2026" + options.geometry + "Reco_cff" + geomFile = "Configuration.Geometry.GeometryExtendedRun4" + options.geometry + "Reco_cff" print("Geometry file Name: ", geomFile) diff --git a/SimG4Core/PrintGeomInfo/test/python/runPrintG4TouchRun4_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runPrintG4TouchRun4_cfg.py index c08de4f33339d..c4f2c000f5825 100644 --- a/SimG4Core/PrintGeomInfo/test/python/runPrintG4TouchRun4_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runPrintG4TouchRun4_cfg.py @@ -4,7 +4,7 @@ # # Options for geometry D95, D96, D98, D99, D100, D101, D102, D103, D104, # D105, D106, D107, D108, D109, D110, D111, D112, D113, -# D114, D115 +# D114, D115, D116 # Options for type DDD, DD4hep # ############################################################################### @@ -85,9 +85,9 @@ process = cms.Process('G4PrintGeometry',Phase2C17I13M9) if (options.type == "DD4hep"): - geomFile = "Configuration.Geometry.GeometryDD4hepExtended2026" + options.geometry + "Reco_cff" + geomFile = "Configuration.Geometry.GeometryDD4hepExtendedRun4" + options.geometry + "Reco_cff" else: - geomFile = "Configuration.Geometry.GeometryExtended2026" + options.geometry + "Reco_cff" + geomFile = "Configuration.Geometry.GeometryExtendedRun4" + options.geometry + "Reco_cff" print("Geometry file Name: ", geomFile) diff --git a/SimG4Core/PrintGeomInfo/test/python/runPrintSolidRun4D98_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runPrintSolidRun4D98_cfg.py index 61461bb4e881e..14d33e968753b 100644 --- a/SimG4Core/PrintGeomInfo/test/python/runPrintSolidRun4D98_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runPrintSolidRun4D98_cfg.py @@ -1,6 +1,6 @@ #######################################################9######################## # Way to use this: -# cmsRun runPrintSolid2026D98_cfg.py type=DDD detector=Tracker +# cmsRun runPrintSolidRun4D98_cfg.py type=DDD detector=Tracker # # Options for type DDD, DD4hep # Options for detector Tracker, Calo, MTD, Muon @@ -41,7 +41,7 @@ else: from Configuration.ProcessModifiers.dd4hep_cff import dd4hep process = cms.Process('G4PrintGeometry',Phase2C17I13M9,dd4hep) - geomFile = "Geometry.CMSCommonData.GeometryDD4hepExtended2026D98" + options.detector + "Reco_cff" + geomFile = "Geometry.CMSCommonData.GeometryDD4hepExtendedRun4D98" + options.detector + "Reco_cff" process.load(geomFile) print("Geometry file Name: ", geomFile) diff --git a/SimG4Core/PrintGeomInfo/test/python/runPrintSolidRun4_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runPrintSolidRun4_cfg.py index 65c900b591dab..99e76cfab7609 100644 --- a/SimG4Core/PrintGeomInfo/test/python/runPrintSolidRun4_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runPrintSolidRun4_cfg.py @@ -1,11 +1,11 @@ #######################################################9######################## # Way to use this: -# cmsRun runPrintSolid2026_cfg.py type=DDD geometry=D110 +# cmsRun runPrintSolidRun4_cfg.py type=DDD geometry=D110 # # Options for type DDD, DD4hep # Options for geometry D95, D96, D98, D99, D100, D101, D102, D103, D104, # D105, D106, D107, D108, D109, D110, D111, D112, D113, -# D114, D115 +# D114, D115, D116 # ################################################################################ import FWCore.ParameterSet.Config as cms @@ -24,7 +24,7 @@ "D110", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, - "geometry of operations: D95, D96, D98, D99, D100, D101, D102, D103, D104, D105, D106, D107, D108, D109, D110, D111, D112, D113, D114, D115") + "geometry of operations: D95, D96, D98, D99, D100, D101, D102, D103, D104, D105, D106, D107, D108, D109, D110, D111, D112, D113, D114, D115, D116") ### get and parse the command line arguments options.parseArguments() @@ -86,9 +86,9 @@ process = cms.Process('G4PrintGeometry',Phase2C17I13M9) if (options.type == "DDD"): - geomFile = "Configuration.Geometry.GeometryExtended2026" + options.geometry + "Reco_cff" + geomFile = "Configuration.Geometry.GeometryExtendedRun4" + options.geometry + "Reco_cff" else: - geomFile = "Configuration.Geometry.GeometryDD4hepExtended2026" + options.geometry + "Reco_cff" + geomFile = "Configuration.Geometry.GeometryDD4hepExtendedRun4" + options.geometry + "Reco_cff" process.load(geomFile) diff --git a/SimG4Core/PrintGeomInfo/test/python/runSensRun4_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runSensRun4_cfg.py index 29dde3a60f460..f74e3bca40b41 100644 --- a/SimG4Core/PrintGeomInfo/test/python/runSensRun4_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runSensRun4_cfg.py @@ -1,10 +1,10 @@ ############################################################################### # Way to use this: -# cmsRun runSens2026_cfg.py geometry=D110 type=DDD +# cmsRun runSensRun4_cfg.py geometry=D110 type=DDD # # Options for geometry D95, D96, D98, D99, D100, D101, D102, D103, D104, # D105, D106, D107, D108, D109, D110, D111, D112, D113, -# D114, D115 +# D114, D115, D116 # Options for type DDD, DD4hep # ############################################################################### @@ -19,7 +19,7 @@ "D110", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, - "geometry of operations: D95, D96, D98, D99, D100, D101, D102, D103, D104, D105, D106, D107, D108, D109, D110, D111, D112, D113, D114, D115") + "geometry of operations: D95, D96, D98, D99, D100, D101, D102, D103, D104, D105, D106, D107, D108, D109, D110, D111, D112, D113, D114, D115, D116") options.register('type', "DDD", VarParsing.VarParsing.multiplicity.singleton, @@ -85,10 +85,10 @@ process = cms.Process('G4PrintGeometry',Phase2C17I13M9) if (options.type == "DD4hep"): - geomFile = "Configuration.Geometry.GeometryDD4hepExtended2026" + options.geometry + "Reco_cff" + geomFile = "Configuration.Geometry.GeometryDD4hepExtendedRun4" + options.geometry + "Reco_cff" dd4hep = True else: - geomFile = "Configuration.Geometry.GeometryExtended2026" + options.geometry + "Reco_cff" + geomFile = "Configuration.Geometry.GeometryExtendedRun4" + options.geometry + "Reco_cff" dd4hep = False print("Geometry file Name: ", geomFile) diff --git a/SimG4Core/PrintGeomInfo/test/python/runSummaryRun4_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runSummaryRun4_cfg.py index 7c1ad730535fd..0f5c71cdcb40b 100644 --- a/SimG4Core/PrintGeomInfo/test/python/runSummaryRun4_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runSummaryRun4_cfg.py @@ -1,10 +1,10 @@ ############################################################################### # Way to use this: -# cmsRun runSummary2026_cfg.py geometry=D110 +# cmsRun runSummaryRun4_cfg.py geometry=D110 # # Options for geometry D95, D96, D98, D99, D100, D101, D102, D103, D104, # D105, D106, D107, D108, D109, D110, D111, D112, D113, -# D114, D115 +# D114, D115, D116 # ############################################################################### import FWCore.ParameterSet.Config as cms @@ -18,7 +18,7 @@ "D110", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, - "geometry of operations: D95, D96, D98, D99, D100, D101, D102, D103, D104, D105, D106, D107, D108, D109, D110, D111, D112, D113, D114, D115") + "geometry of operations: D95, D96, D98, D99, D100, D101, D102, D103, D104, D105, D106, D107, D108, D109, D110, D111, D112, D113, D114, D115, D116") ### get and parse the command line arguments options.parseArguments() @@ -53,7 +53,7 @@ from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 process = cms.Process('G4PrintGeometry',Phase2C17I13M9) -geomFile = "Configuration.Geometry.GeometryExtended2026" + options.geometry + "Reco_cff" +geomFile = "Configuration.Geometry.GeometryExtendedRun4" + options.geometry + "Reco_cff" print("Geometry file Name: ", geomFile) diff --git a/Validation/Geometry/test/genHGCalPlots.sh b/Validation/Geometry/test/genHGCalPlots.sh index 814313b72e149..a1dea3056e2b1 100755 --- a/Validation/Geometry/test/genHGCalPlots.sh +++ b/Validation/Geometry/test/genHGCalPlots.sh @@ -1,6 +1,6 @@ #!/bin/bash -ex -geom=Extended2026D110 +geom=ExtendedRun4D110 VGEO_DIR=${CMSSW_BASE}/src/Validation/Geometry/test TEST_DIR=. diff --git a/Validation/MtdValidation/plugins/MtdTracksHarvester.cc b/Validation/MtdValidation/plugins/MtdTracksHarvester.cc index ddf1ca6563e7e..d3d0a271b2cb6 100644 --- a/Validation/MtdValidation/plugins/MtdTracksHarvester.cc +++ b/Validation/MtdValidation/plugins/MtdTracksHarvester.cc @@ -30,24 +30,77 @@ class MtdTracksHarvester : public DQMEDHarvester { MonitorElement* meBtlEtaEff_; MonitorElement* meBtlPhiEff_; MonitorElement* meBtlPtEff_; - MonitorElement* meEtlEtaEff_[2]; + MonitorElement* meEtlEtaEff_; + MonitorElement* meEtlPhiEff_; + MonitorElement* meEtlPtEff_; + MonitorElement* meEtlEtaEff2_; + MonitorElement* meEtlPhiEff2_; + MonitorElement* meEtlPtEff2_; MonitorElement* meEtlEtaEffLowPt_[2]; - MonitorElement* meEtlPhiEff_[2]; - MonitorElement* meEtlPtEff_[2]; - MonitorElement* meEtlEtaEff2_[2]; MonitorElement* meEtlEtaEff2LowPt_[2]; - MonitorElement* meEtlPhiEff2_[2]; - MonitorElement* meEtlPtEff2_[2]; - MonitorElement* meTPPtSelEff_; - MonitorElement* meTPEtaSelEff_; - MonitorElement* meTPPtMatchEff_; - MonitorElement* meTPEtaMatchEff_; - MonitorElement* meTPPtMatchEtl2Eff_; - MonitorElement* meTPEtaMatchEtl2Eff_; - MonitorElement* meTPmtdPtSelEff_; - MonitorElement* meTPmtdEtaSelEff_; - MonitorElement* meTPmtdPtMatchEff_; - MonitorElement* meTPmtdEtaMatchEff_; + + MonitorElement* meBTLTPPtSelEff_; + MonitorElement* meBTLTPEtaSelEff_; + MonitorElement* meBTLTPPtMatchEff_; + MonitorElement* meBTLTPEtaMatchEff_; + MonitorElement* meETLTPPtSelEff_; + MonitorElement* meETLTPEtaSelEff_; + MonitorElement* meETLTPPtMatchEff_; + MonitorElement* meETLTPEtaMatchEff_; + MonitorElement* meETLTPPtMatchEff2_; + MonitorElement* meETLTPEtaMatchEff2_; + + // - BTL track-mtd matching efficiencies + MonitorElement* meBTLTPmtdDirectEtaSelEff_; + MonitorElement* meBTLTPmtdDirectPtSelEff_; + MonitorElement* meBTLTPmtdOtherEtaSelEff_; + MonitorElement* meBTLTPmtdOtherPtSelEff_; + MonitorElement* meBTLTPnomtdEtaSelEff_; + MonitorElement* meBTLTPnomtdPtSelEff_; + + MonitorElement* meBTLTPmtdDirectCorrectAssocEtaMatchEff_; + MonitorElement* meBTLTPmtdDirectCorrectAssocPtMatchEff_; + MonitorElement* meBTLTPmtdDirectWrongAssocEtaMatchEff_; + MonitorElement* meBTLTPmtdDirectWrongAssocPtMatchEff_; + MonitorElement* meBTLTPmtdDirectNoAssocEtaMatchEff_; + MonitorElement* meBTLTPmtdDirectNoAssocPtMatchEff_; + + MonitorElement* meBTLTPmtdOtherCorrectAssocEtaMatchEff_; + MonitorElement* meBTLTPmtdOtherCorrectAssocPtMatchEff_; + MonitorElement* meBTLTPmtdOtherWrongAssocEtaMatchEff_; + MonitorElement* meBTLTPmtdOtherWrongAssocPtMatchEff_; + MonitorElement* meBTLTPmtdOtherNoAssocEtaMatchEff_; + MonitorElement* meBTLTPmtdOtherNoAssocPtMatchEff_; + + MonitorElement* meBTLTPnomtdEtaMatchEff_; + MonitorElement* meBTLTPnomtdPtMatchEff_; + + // - ETL track-mtd matching efficiencies + MonitorElement* meETLTPmtd1EtaSelEff_; + MonitorElement* meETLTPmtd1PtSelEff_; + MonitorElement* meETLTPmtd2EtaSelEff_; + MonitorElement* meETLTPmtd2PtSelEff_; + MonitorElement* meETLTPnomtdEtaSelEff_; + MonitorElement* meETLTPnomtdPtSelEff_; + + MonitorElement* meETLTPmtd1CorrectAssocEtaMatchEff_; + MonitorElement* meETLTPmtd1CorrectAssocPtMatchEff_; + MonitorElement* meETLTPmtd1WrongAssocEtaMatchEff_; + MonitorElement* meETLTPmtd1WrongAssocPtMatchEff_; + MonitorElement* meETLTPmtd1NoAssocEtaMatchEff_; + MonitorElement* meETLTPmtd1NoAssocPtMatchEff_; + + MonitorElement* meETLTPmtd2CorrectAssocEtaMatchEff_; + MonitorElement* meETLTPmtd2CorrectAssocPtMatchEff_; + MonitorElement* meETLTPmtd2WrongAssocEtaMatchEff_; + MonitorElement* meETLTPmtd2WrongAssocPtMatchEff_; + MonitorElement* meETLTPmtd2NoAssocEtaMatchEff_; + MonitorElement* meETLTPmtd2NoAssocPtMatchEff_; + + MonitorElement* meETLTPnomtdEtaMatchEff_; + MonitorElement* meETLTPnomtdPtMatchEff_; + + // - MonitorElement* meNoTimeFraction_; MonitorElement* meExtraPtEff_; MonitorElement* meExtraPtEtl2Eff_; @@ -93,54 +146,111 @@ void MtdTracksHarvester::normalize(MonitorElement* h, double scale) { // ------------ endjob tasks ---------------------------- void MtdTracksHarvester::dqmEndJob(DQMStore::IBooker& ibook, DQMStore::IGetter& igetter) { // --- Get the monitoring histograms - MonitorElement* meBTLTrackEffEtaTot = igetter.get(folder_ + "TrackBTLEffEtaTot"); - MonitorElement* meBTLTrackEffPhiTot = igetter.get(folder_ + "TrackBTLEffPhiTot"); - MonitorElement* meBTLTrackEffPtTot = igetter.get(folder_ + "TrackBTLEffPtTot"); - MonitorElement* meBTLTrackEffEtaMtd = igetter.get(folder_ + "TrackBTLEffEtaMtd"); - MonitorElement* meBTLTrackEffPhiMtd = igetter.get(folder_ + "TrackBTLEffPhiMtd"); - MonitorElement* meBTLTrackEffPtMtd = igetter.get(folder_ + "TrackBTLEffPtMtd"); - MonitorElement* meETLTrackEffEtaTotZneg = igetter.get(folder_ + "TrackETLEffEtaTotZneg"); - MonitorElement* meETLTrackEffEtaTotLowPt0 = igetter.get(folder_ + "TrackETLEffEtaTotLowPt0"); - MonitorElement* meETLTrackEffEtaTotLowPt1 = igetter.get(folder_ + "TrackETLEffEtaTotLowPt1"); - MonitorElement* meETLTrackEffPhiTotZneg = igetter.get(folder_ + "TrackETLEffPhiTotZneg"); - MonitorElement* meETLTrackEffPtTotZneg = igetter.get(folder_ + "TrackETLEffPtTotZneg"); - MonitorElement* meETLTrackEffEtaMtdZneg = igetter.get(folder_ + "TrackETLEffEtaMtdZneg"); - MonitorElement* meETLTrackEffEtaMtdLowPt0 = igetter.get(folder_ + "TrackETLEffEtaMtdLowPt0"); - MonitorElement* meETLTrackEffEtaMtdLowPt1 = igetter.get(folder_ + "TrackETLEffEtaMtdLowPt1"); - MonitorElement* meETLTrackEffPhiMtdZneg = igetter.get(folder_ + "TrackETLEffPhiMtdZneg"); - MonitorElement* meETLTrackEffPtMtdZneg = igetter.get(folder_ + "TrackETLEffPtMtdZneg"); - MonitorElement* meETLTrackEffEta2MtdZneg = igetter.get(folder_ + "TrackETLEffEta2MtdZneg"); - MonitorElement* meETLTrackEffEta2MtdLowPt0 = igetter.get(folder_ + "TrackETLEffEta2MtdLowPt0"); - MonitorElement* meETLTrackEffEta2MtdLowPt1 = igetter.get(folder_ + "TrackETLEffEta2MtdLowPt1"); - MonitorElement* meETLTrackEffPhi2MtdZneg = igetter.get(folder_ + "TrackETLEffPhi2MtdZneg"); - MonitorElement* meETLTrackEffPt2MtdZneg = igetter.get(folder_ + "TrackETLEffPt2MtdZneg"); - MonitorElement* meETLTrackEffEtaTotZpos = igetter.get(folder_ + "TrackETLEffEtaTotZpos"); - MonitorElement* meETLTrackEffPhiTotZpos = igetter.get(folder_ + "TrackETLEffPhiTotZpos"); - MonitorElement* meETLTrackEffPtTotZpos = igetter.get(folder_ + "TrackETLEffPtTotZpos"); - MonitorElement* meETLTrackEffEtaMtdZpos = igetter.get(folder_ + "TrackETLEffEtaMtdZpos"); - MonitorElement* meETLTrackEffPhiMtdZpos = igetter.get(folder_ + "TrackETLEffPhiMtdZpos"); - MonitorElement* meETLTrackEffPtMtdZpos = igetter.get(folder_ + "TrackETLEffPtMtdZpos"); - MonitorElement* meETLTrackEffEta2MtdZpos = igetter.get(folder_ + "TrackETLEffEta2MtdZpos"); - MonitorElement* meETLTrackEffPhi2MtdZpos = igetter.get(folder_ + "TrackETLEffPhi2MtdZpos"); - MonitorElement* meETLTrackEffPt2MtdZpos = igetter.get(folder_ + "TrackETLEffPt2MtdZpos"); - MonitorElement* meTrackPtTot = igetter.get(folder_ + "TrackPtTot"); + MonitorElement* meBTLTrackEtaTot = igetter.get(folder_ + "TrackBTLEtaTot"); + MonitorElement* meBTLTrackPhiTot = igetter.get(folder_ + "TrackBTLPhiTot"); + MonitorElement* meBTLTrackPtTot = igetter.get(folder_ + "TrackBTLPtTot"); + MonitorElement* meBTLTrackEtaMtd = igetter.get(folder_ + "TrackBTLEtaMtd"); + MonitorElement* meBTLTrackPhiMtd = igetter.get(folder_ + "TrackBTLPhiMtd"); + MonitorElement* meBTLTrackPtMtd = igetter.get(folder_ + "TrackBTLPtMtd"); + + MonitorElement* meETLTrackEtaTot = igetter.get(folder_ + "TrackETLEtaTot"); + MonitorElement* meETLTrackPhiTot = igetter.get(folder_ + "TrackETLPhiTot"); + MonitorElement* meETLTrackPtTot = igetter.get(folder_ + "TrackETLPtTot"); + MonitorElement* meETLTrackEtaMtd = igetter.get(folder_ + "TrackETLEtaMtd"); + MonitorElement* meETLTrackPhiMtd = igetter.get(folder_ + "TrackETLPhiMtd"); + MonitorElement* meETLTrackPtMtd = igetter.get(folder_ + "TrackETLPtMtd"); + MonitorElement* meETLTrackEta2Mtd = igetter.get(folder_ + "TrackETLEta2Mtd"); + MonitorElement* meETLTrackPhi2Mtd = igetter.get(folder_ + "TrackETLPhi2Mtd"); + MonitorElement* meETLTrackPt2Mtd = igetter.get(folder_ + "TrackETLPt2Mtd"); + + MonitorElement* meETLTrackEtaTotLowPt0 = igetter.get(folder_ + "TrackETLEtaTotLowPt0"); + MonitorElement* meETLTrackEtaTotLowPt1 = igetter.get(folder_ + "TrackETLEtaTotLowPt1"); + MonitorElement* meETLTrackEtaMtdLowPt0 = igetter.get(folder_ + "TrackETLEtaMtdLowPt0"); + MonitorElement* meETLTrackEtaMtdLowPt1 = igetter.get(folder_ + "TrackETLEtaMtdLowPt1"); + MonitorElement* meETLTrackEta2MtdLowPt0 = igetter.get(folder_ + "TrackETLEta2MtdLowPt0"); + MonitorElement* meETLTrackEta2MtdLowPt1 = igetter.get(folder_ + "TrackETLEta2MtdLowPt1"); + MonitorElement* meExtraPtMtd = igetter.get(folder_ + "ExtraPtMtd"); MonitorElement* meExtraPtEtl2Mtd = igetter.get(folder_ + "ExtraPtEtl2Mtd"); - MonitorElement* meTrackMatchedTPEffPtTot = igetter.get(folder_ + "MatchedTPEffPtTot"); - MonitorElement* meTrackMatchedTPEffPtTotLV = igetter.get(folder_ + "MatchedTPEffPtTotLV"); - MonitorElement* meTrackMatchedTPEffPtMtd = igetter.get(folder_ + "MatchedTPEffPtMtd"); - MonitorElement* meTrackMatchedTPEffPtEtl2Mtd = igetter.get(folder_ + "MatchedTPEffPtEtl2Mtd"); - MonitorElement* meTrackMatchedTPmtdEffPtTot = igetter.get(folder_ + "MatchedTPmtdEffPtTot"); - MonitorElement* meTrackMatchedTPmtdEffPtMtd = igetter.get(folder_ + "MatchedTPmtdEffPtMtd"); - MonitorElement* meTrackEtaTot = igetter.get(folder_ + "TrackEtaTot"); + MonitorElement* meTrackMatchedTPPtTotLV = igetter.get(folder_ + "MatchedTPPtTotLV"); MonitorElement* meExtraEtaMtd = igetter.get(folder_ + "ExtraEtaMtd"); MonitorElement* meExtraEtaEtl2Mtd = igetter.get(folder_ + "ExtraEtaEtl2Mtd"); - MonitorElement* meTrackMatchedTPEffEtaTot = igetter.get(folder_ + "MatchedTPEffEtaTot"); - MonitorElement* meTrackMatchedTPEffEtaTotLV = igetter.get(folder_ + "MatchedTPEffEtaTotLV"); - MonitorElement* meTrackMatchedTPEffEtaMtd = igetter.get(folder_ + "MatchedTPEffEtaMtd"); - MonitorElement* meTrackMatchedTPEffEtaEtl2Mtd = igetter.get(folder_ + "MatchedTPEffEtaEtl2Mtd"); - MonitorElement* meTrackMatchedTPmtdEffEtaTot = igetter.get(folder_ + "MatchedTPmtdEffEtaTot"); - MonitorElement* meTrackMatchedTPmtdEffEtaMtd = igetter.get(folder_ + "MatchedTPmtdEffEtaMtd"); + MonitorElement* meTrackMatchedTPEtaTotLV = igetter.get(folder_ + "MatchedTPEtaTotLV"); + + MonitorElement* meBTLTrackMatchedTPPtTot = igetter.get(folder_ + "BTLTrackMatchedTPPtTot"); + MonitorElement* meBTLTrackMatchedTPPtMtd = igetter.get(folder_ + "BTLTrackMatchedTPPtMtd"); + MonitorElement* meBTLTrackMatchedTPEtaTot = igetter.get(folder_ + "BTLTrackMatchedTPEtaTot"); + MonitorElement* meBTLTrackMatchedTPEtaMtd = igetter.get(folder_ + "BTLTrackMatchedTPEtaMtd"); + MonitorElement* meETLTrackMatchedTPPtTot = igetter.get(folder_ + "ETLTrackMatchedTPPtTot"); + MonitorElement* meETLTrackMatchedTPPtMtd = igetter.get(folder_ + "ETLTrackMatchedTPPtMtd"); + MonitorElement* meETLTrackMatchedTPPt2Mtd = igetter.get(folder_ + "ETLTrackMatchedTPPt2Mtd"); + MonitorElement* meETLTrackMatchedTPEtaTot = igetter.get(folder_ + "ETLTrackMatchedTPEtaTot"); + MonitorElement* meETLTrackMatchedTPEtaMtd = igetter.get(folder_ + "ETLTrackMatchedTPEtaMtd"); + MonitorElement* meETLTrackMatchedTPEta2Mtd = igetter.get(folder_ + "ETLTrackMatchedTPEta2Mtd"); + + // + MonitorElement* meBTLTrackMatchedTPmtdDirectEta = igetter.get(folder_ + "BTLTrackMatchedTPmtdDirectEta"); + MonitorElement* meBTLTrackMatchedTPmtdDirectPt = igetter.get(folder_ + "BTLTrackMatchedTPmtdDirectPt"); + MonitorElement* meBTLTrackMatchedTPmtdOtherEta = igetter.get(folder_ + "BTLTrackMatchedTPmtdOtherEta"); + MonitorElement* meBTLTrackMatchedTPmtdOtherPt = igetter.get(folder_ + "BTLTrackMatchedTPmtdOtherPt"); + ; + MonitorElement* meBTLTrackMatchedTPnomtdEta = igetter.get(folder_ + "BTLTrackMatchedTPnomtdEta"); + MonitorElement* meBTLTrackMatchedTPnomtdPt = igetter.get(folder_ + "BTLTrackMatchedTPnomtdPt"); + + MonitorElement* meBTLTrackMatchedTPmtdDirectCorrectAssocEta = + igetter.get(folder_ + "BTLTrackMatchedTPmtdDirectCorrectAssocEta"); + MonitorElement* meBTLTrackMatchedTPmtdDirectCorrectAssocPt = + igetter.get(folder_ + "BTLTrackMatchedTPmtdDirectCorrectAssocPt"); + MonitorElement* meBTLTrackMatchedTPmtdDirectWrongAssocEta = + igetter.get(folder_ + "BTLTrackMatchedTPmtdDirectWrongAssocEta"); + MonitorElement* meBTLTrackMatchedTPmtdDirectWrongAssocPt = + igetter.get(folder_ + "BTLTrackMatchedTPmtdDirectWrongAssocPt"); + MonitorElement* meBTLTrackMatchedTPmtdDirectNoAssocEta = + igetter.get(folder_ + "BTLTrackMatchedTPmtdDirectNoAssocEta"); + MonitorElement* meBTLTrackMatchedTPmtdDirectNoAssocPt = igetter.get(folder_ + "BTLTrackMatchedTPmtdDirectNoAssocPt"); + + MonitorElement* meBTLTrackMatchedTPmtdOtherCorrectAssocEta = + igetter.get(folder_ + "BTLTrackMatchedTPmtdOtherCorrectAssocEta"); + MonitorElement* meBTLTrackMatchedTPmtdOtherCorrectAssocPt = + igetter.get(folder_ + "BTLTrackMatchedTPmtdOtherCorrectAssocPt"); + MonitorElement* meBTLTrackMatchedTPmtdOtherWrongAssocEta = + igetter.get(folder_ + "BTLTrackMatchedTPmtdOtherWrongAssocEta"); + MonitorElement* meBTLTrackMatchedTPmtdOtherWrongAssocPt = + igetter.get(folder_ + "BTLTrackMatchedTPmtdOtherWrongAssocPt"); + MonitorElement* meBTLTrackMatchedTPmtdOtherNoAssocEta = igetter.get(folder_ + "BTLTrackMatchedTPmtdOtherNoAssocEta"); + MonitorElement* meBTLTrackMatchedTPmtdOtherNoAssocPt = igetter.get(folder_ + "BTLTrackMatchedTPmtdOtherNoAssocPt"); + + MonitorElement* meBTLTrackMatchedTPnomtdAssocEta = igetter.get(folder_ + "BTLTrackMatchedTPnomtdAssocEta"); + MonitorElement* meBTLTrackMatchedTPnomtdAssocPt = igetter.get(folder_ + "BTLTrackMatchedTPnomtdAssocPt"); + + MonitorElement* meETLTrackMatchedTPmtd1Eta = igetter.get(folder_ + "ETLTrackMatchedTPmtd1Eta"); + MonitorElement* meETLTrackMatchedTPmtd1Pt = igetter.get(folder_ + "ETLTrackMatchedTPmtd1Pt"); + MonitorElement* meETLTrackMatchedTPmtd2Eta = igetter.get(folder_ + "ETLTrackMatchedTPmtd2Eta"); + MonitorElement* meETLTrackMatchedTPmtd2Pt = igetter.get(folder_ + "ETLTrackMatchedTPmtd2Pt"); + ; + MonitorElement* meETLTrackMatchedTPnomtdEta = igetter.get(folder_ + "ETLTrackMatchedTPnomtdEta"); + MonitorElement* meETLTrackMatchedTPnomtdPt = igetter.get(folder_ + "ETLTrackMatchedTPnomtdPt"); + + MonitorElement* meETLTrackMatchedTPmtd1CorrectAssocEta = + igetter.get(folder_ + "ETLTrackMatchedTPmtd1CorrectAssocEta"); + MonitorElement* meETLTrackMatchedTPmtd1CorrectAssocPt = igetter.get(folder_ + "ETLTrackMatchedTPmtd1CorrectAssocPt"); + MonitorElement* meETLTrackMatchedTPmtd1WrongAssocEta = igetter.get(folder_ + "ETLTrackMatchedTPmtd1WrongAssocEta"); + MonitorElement* meETLTrackMatchedTPmtd1WrongAssocPt = igetter.get(folder_ + "ETLTrackMatchedTPmtd1WrongAssocPt"); + MonitorElement* meETLTrackMatchedTPmtd1NoAssocEta = igetter.get(folder_ + "ETLTrackMatchedTPmtd1NoAssocEta"); + MonitorElement* meETLTrackMatchedTPmtd1NoAssocPt = igetter.get(folder_ + "ETLTrackMatchedTPmtd1NoAssocPt"); + + MonitorElement* meETLTrackMatchedTPmtd2CorrectAssocEta = + igetter.get(folder_ + "ETLTrackMatchedTPmtd2CorrectAssocEta"); + MonitorElement* meETLTrackMatchedTPmtd2CorrectAssocPt = igetter.get(folder_ + "ETLTrackMatchedTPmtd2CorrectAssocPt"); + MonitorElement* meETLTrackMatchedTPmtd2WrongAssocEta = igetter.get(folder_ + "ETLTrackMatchedTPmtd2WrongAssocEta"); + MonitorElement* meETLTrackMatchedTPmtd2WrongAssocPt = igetter.get(folder_ + "ETLTrackMatchedTPmtd2WrongAssocPt"); + MonitorElement* meETLTrackMatchedTPmtd2NoAssocEta = igetter.get(folder_ + "ETLTrackMatchedTPmtd2NoAssocEta"); + MonitorElement* meETLTrackMatchedTPmtd2NoAssocPt = igetter.get(folder_ + "ETLTrackMatchedTPmtd2NoAssocPt"); + + MonitorElement* meETLTrackMatchedTPnomtdAssocEta = igetter.get(folder_ + "ETLTrackMatchedTPnomtdAssocEta"); + MonitorElement* meETLTrackMatchedTPnomtdAssocPt = igetter.get(folder_ + "ETLTrackMatchedTPnomtdAssocPt"); + + // MonitorElement* meTrackNumHits = igetter.get(folder_ + "TrackNumHits"); MonitorElement* meTrackNumHitsNT = igetter.get(folder_ + "TrackNumHitsNT"); MonitorElement* meExtraPhiAtBTL = igetter.get(folder_ + "ExtraPhiAtBTL"); @@ -149,21 +259,36 @@ void MtdTracksHarvester::dqmEndJob(DQMStore::IBooker& ibook, DQMStore::IGetter& MonitorElement* meExtraMTDfailExtenderEta = igetter.get(folder_ + "ExtraMTDfailExtenderEta"); MonitorElement* meExtraMTDfailExtenderPt = igetter.get(folder_ + "ExtraMTDfailExtenderPt"); - if (!meBTLTrackEffEtaTot || !meBTLTrackEffPhiTot || !meBTLTrackEffPtTot || !meBTLTrackEffEtaMtd || - !meBTLTrackEffPhiMtd || !meBTLTrackEffPtMtd || !meETLTrackEffEtaTotZneg || !meETLTrackEffPhiTotZneg || - !meETLTrackEffPtTotZneg || !meETLTrackEffEtaTotLowPt0 || !meETLTrackEffEtaTotLowPt1 || !meETLTrackEffEtaMtdZneg || - !meETLTrackEffEtaMtdLowPt0 || !meETLTrackEffEtaMtdLowPt1 || !meETLTrackEffPhiMtdZneg || !meETLTrackEffPtMtdZneg || - !meETLTrackEffEta2MtdZneg || !meETLTrackEffEta2MtdLowPt0 || !meETLTrackEffEta2MtdLowPt1 || - !meETLTrackEffPhi2MtdZneg || !meETLTrackEffPt2MtdZneg || !meETLTrackEffEtaTotZpos || !meETLTrackEffPhiTotZpos || - !meETLTrackEffPtTotZpos || !meETLTrackEffEtaMtdZpos || !meETLTrackEffPhiMtdZpos || !meETLTrackEffPtMtdZpos || - !meETLTrackEffEta2MtdZpos || !meETLTrackEffPhi2MtdZpos || !meETLTrackEffPt2MtdZpos || !meTrackMatchedTPEffPtTot || - !meTrackMatchedTPEffPtTotLV || !meTrackMatchedTPEffPtMtd || !meTrackMatchedTPEffPtEtl2Mtd || - !meTrackMatchedTPmtdEffPtTot || !meTrackMatchedTPmtdEffPtMtd || !meTrackMatchedTPEffEtaTot || - !meTrackMatchedTPEffEtaTotLV || !meTrackMatchedTPEffEtaMtd || !meTrackMatchedTPEffEtaEtl2Mtd || - !meTrackMatchedTPmtdEffEtaTot || !meTrackMatchedTPmtdEffEtaMtd || !meTrackNumHits || !meTrackNumHitsNT || - !meTrackPtTot || !meTrackEtaTot || !meExtraPtMtd || !meExtraPtEtl2Mtd || !meExtraEtaMtd || !meExtraEtaEtl2Mtd || - !meExtraPhiAtBTL || !meExtraPhiAtBTLmatched || !meExtraBTLeneInCone || !meExtraMTDfailExtenderEta || - !meExtraMTDfailExtenderPt) { + if (!meBTLTrackEtaTot || !meBTLTrackPhiTot || !meBTLTrackPtTot || !meBTLTrackEtaMtd || !meBTLTrackPhiMtd || + !meBTLTrackPtMtd || !meETLTrackEtaTot || !meETLTrackPhiTot || !meETLTrackPtTot || !meETLTrackEtaMtd || + !meETLTrackPhiMtd || !meETLTrackPtMtd || !meETLTrackEta2Mtd || !meETLTrackPhi2Mtd || !meETLTrackPt2Mtd || + !meETLTrackEtaTotLowPt0 || !meETLTrackEtaTotLowPt1 || !meETLTrackEtaMtdLowPt0 || !meETLTrackEtaMtdLowPt1 || + !meETLTrackEta2MtdLowPt0 || !meETLTrackEta2MtdLowPt1 || !meTrackMatchedTPPtTotLV || !meTrackMatchedTPEtaTotLV || + + !meBTLTrackMatchedTPPtTot || !meBTLTrackMatchedTPPtMtd || !meBTLTrackMatchedTPEtaTot || + !meBTLTrackMatchedTPEtaMtd || !meETLTrackMatchedTPPtTot || !meETLTrackMatchedTPPtMtd || + !meETLTrackMatchedTPPt2Mtd || !meETLTrackMatchedTPEtaTot || !meETLTrackMatchedTPEtaMtd || + !meETLTrackMatchedTPEta2Mtd || + + !meBTLTrackMatchedTPmtdDirectEta || !meBTLTrackMatchedTPmtdDirectPt || !meBTLTrackMatchedTPmtdOtherEta || + !meBTLTrackMatchedTPmtdOtherPt || !meBTLTrackMatchedTPnomtdEta || !meBTLTrackMatchedTPnomtdPt || + !meBTLTrackMatchedTPmtdDirectCorrectAssocEta || !meBTLTrackMatchedTPmtdDirectCorrectAssocPt || + !meBTLTrackMatchedTPmtdDirectWrongAssocEta || !meBTLTrackMatchedTPmtdDirectWrongAssocPt || + !meBTLTrackMatchedTPmtdDirectNoAssocEta || !meBTLTrackMatchedTPmtdDirectNoAssocPt || + !meBTLTrackMatchedTPmtdOtherCorrectAssocEta || !meBTLTrackMatchedTPmtdOtherCorrectAssocPt || + !meBTLTrackMatchedTPmtdOtherWrongAssocEta || !meBTLTrackMatchedTPmtdOtherWrongAssocPt || + !meBTLTrackMatchedTPmtdOtherNoAssocEta || !meBTLTrackMatchedTPmtdOtherNoAssocPt || + !meBTLTrackMatchedTPnomtdAssocEta || !meBTLTrackMatchedTPnomtdAssocPt || !meETLTrackMatchedTPmtd1Eta || + !meETLTrackMatchedTPmtd1Pt || !meETLTrackMatchedTPmtd2Eta || !meETLTrackMatchedTPmtd2Pt || + !meETLTrackMatchedTPnomtdEta || !meETLTrackMatchedTPnomtdPt || !meETLTrackMatchedTPmtd1CorrectAssocEta || + !meETLTrackMatchedTPmtd1CorrectAssocPt || !meETLTrackMatchedTPmtd1WrongAssocEta || + !meETLTrackMatchedTPmtd1WrongAssocPt || !meETLTrackMatchedTPmtd1NoAssocEta || !meETLTrackMatchedTPmtd1NoAssocPt || + !meETLTrackMatchedTPmtd2CorrectAssocEta || !meETLTrackMatchedTPmtd2CorrectAssocPt || + !meETLTrackMatchedTPmtd2WrongAssocEta || !meETLTrackMatchedTPmtd2WrongAssocPt || + !meETLTrackMatchedTPmtd2NoAssocEta || !meETLTrackMatchedTPmtd2NoAssocPt || !meETLTrackMatchedTPnomtdAssocEta || + !meETLTrackMatchedTPnomtdAssocPt || !meTrackNumHits || !meTrackNumHitsNT || !meExtraPtMtd || !meExtraPtEtl2Mtd || + !meExtraEtaMtd || !meExtraEtaEtl2Mtd || !meExtraPhiAtBTL || !meExtraPhiAtBTLmatched || !meExtraBTLeneInCone || + !meExtraMTDfailExtenderEta || !meExtraMTDfailExtenderPt) { edm::LogError("MtdTracksHarvester") << "Monitoring histograms not found!" << std::endl; return; } @@ -172,270 +297,583 @@ void MtdTracksHarvester::dqmEndJob(DQMStore::IBooker& ibook, DQMStore::IGetter& ibook.cd(folder_); meBtlEtaEff_ = ibook.book1D("BtlEtaEff", " Track Efficiency VS Eta;#eta;Efficiency", - meBTLTrackEffEtaTot->getNbinsX(), - meBTLTrackEffEtaTot->getTH1()->GetXaxis()->GetXmin(), - meBTLTrackEffEtaTot->getTH1()->GetXaxis()->GetXmax()); + meBTLTrackEtaTot->getNbinsX(), + meBTLTrackEtaTot->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackEtaTot->getTH1()->GetXaxis()->GetXmax()); meBtlEtaEff_->getTH1()->SetMinimum(0.); - computeEfficiency1D(meBTLTrackEffEtaMtd, meBTLTrackEffEtaTot, meBtlEtaEff_); + computeEfficiency1D(meBTLTrackEtaMtd, meBTLTrackEtaTot, meBtlEtaEff_); meBtlPhiEff_ = ibook.book1D("BtlPhiEff", "Track Efficiency VS Phi;#phi [rad];Efficiency", - meBTLTrackEffPhiTot->getNbinsX(), - meBTLTrackEffPhiTot->getTH1()->GetXaxis()->GetXmin(), - meBTLTrackEffPhiTot->getTH1()->GetXaxis()->GetXmax()); + meBTLTrackPhiTot->getNbinsX(), + meBTLTrackPhiTot->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackPhiTot->getTH1()->GetXaxis()->GetXmax()); meBtlPhiEff_->getTH1()->SetMinimum(0.); - computeEfficiency1D(meBTLTrackEffPhiMtd, meBTLTrackEffPhiTot, meBtlPhiEff_); + computeEfficiency1D(meBTLTrackPhiMtd, meBTLTrackPhiTot, meBtlPhiEff_); meBtlPtEff_ = ibook.book1D("BtlPtEff", "Track Efficiency VS Pt;Pt [GeV];Efficiency", - meBTLTrackEffPtTot->getNbinsX(), - meBTLTrackEffPtTot->getTH1()->GetXaxis()->GetXmin(), - meBTLTrackEffPtTot->getTH1()->GetXaxis()->GetXmax()); + meBTLTrackPtTot->getNbinsX(), + meBTLTrackPtTot->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackPtTot->getTH1()->GetXaxis()->GetXmax()); meBtlPtEff_->getTH1()->SetMinimum(0.); - computeEfficiency1D(meBTLTrackEffPtMtd, meBTLTrackEffPtTot, meBtlPtEff_); + computeEfficiency1D(meBTLTrackPtMtd, meBTLTrackPtTot, meBtlPtEff_); + + meEtlEtaEff_ = ibook.book1D("EtlEtaEff", + " Track Efficiency VS Eta;#eta;Efficiency", + meETLTrackEtaTot->getNbinsX(), + meETLTrackEtaTot->getTH1()->GetXaxis()->GetXmin(), + meETLTrackEtaTot->getTH1()->GetXaxis()->GetXmax()); + meEtlEtaEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackEtaMtd, meETLTrackEtaTot, meEtlEtaEff_); - meEtlEtaEff_[0] = ibook.book1D("EtlEtaEffZneg", - " Track Efficiency VS Eta (-Z);#eta;Efficiency", - meETLTrackEffEtaTotZneg->getNbinsX(), - meETLTrackEffEtaTotZneg->getTH1()->GetXaxis()->GetXmin(), - meETLTrackEffEtaTotZneg->getTH1()->GetXaxis()->GetXmax()); - meEtlEtaEff_[0]->getTH1()->SetMinimum(0.); - computeEfficiency1D(meETLTrackEffEtaMtdZneg, meETLTrackEffEtaTotZneg, meEtlEtaEff_[0]); + meEtlPhiEff_ = ibook.book1D("EtlPhiEff", + "Track Efficiency VS Phi;#phi [rad];Efficiency", + meETLTrackPhiTot->getNbinsX(), + meETLTrackPhiTot->getTH1()->GetXaxis()->GetXmin(), + meETLTrackPhiTot->getTH1()->GetXaxis()->GetXmax()); + meEtlPhiEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackPhiMtd, meETLTrackPhiTot, meEtlPhiEff_); + meEtlPtEff_ = ibook.book1D("EtlPtEff", + "Track Efficiency VS Pt;Pt [GeV];Efficiency", + meETLTrackPtTot->getNbinsX(), + meETLTrackPtTot->getTH1()->GetXaxis()->GetXmin(), + meETLTrackPtTot->getTH1()->GetXaxis()->GetXmax()); + meEtlPtEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackPtMtd, meETLTrackPtTot, meEtlPtEff_); + + meEtlEtaEff2_ = ibook.book1D("EtlEtaEff2", + " Track Efficiency VS Eta (2 hits);#eta;Efficiency", + meETLTrackEtaTot->getNbinsX(), + meETLTrackEtaTot->getTH1()->GetXaxis()->GetXmin(), + meETLTrackEtaTot->getTH1()->GetXaxis()->GetXmax()); + meEtlEtaEff2_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackEta2Mtd, meETLTrackEtaTot, meEtlEtaEff2_); + + meEtlPhiEff2_ = ibook.book1D("EtlPhiEff2", + "Track Efficiency VS Phi (2 hits);#phi [rad];Efficiency", + meETLTrackPhiTot->getNbinsX(), + meETLTrackPhiTot->getTH1()->GetXaxis()->GetXmin(), + meETLTrackPhiTot->getTH1()->GetXaxis()->GetXmax()); + meEtlPhiEff2_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackPhi2Mtd, meETLTrackPhiTot, meEtlPhiEff2_); + + meEtlPtEff2_ = ibook.book1D("EtlPtEff2", + "Track Efficiency VS Pt (2 hits);Pt [GeV];Efficiency", + meETLTrackPtTot->getNbinsX(), + meETLTrackPtTot->getTH1()->GetXaxis()->GetXmin(), + meETLTrackPtTot->getTH1()->GetXaxis()->GetXmax()); + meEtlPtEff2_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackPt2Mtd, meETLTrackPtTot, meEtlPtEff2_); + + // low pT meEtlEtaEffLowPt_[0] = ibook.book1D("EtlEtaEffLowPt0", " Track Efficiency VS Eta, 0.2 < pt < 0.45;#eta;Efficiency", - meETLTrackEffEtaTotLowPt0->getNbinsX(), - meETLTrackEffEtaTotLowPt0->getTH1()->GetXaxis()->GetXmin(), - meETLTrackEffEtaTotLowPt0->getTH1()->GetXaxis()->GetXmax()); + meETLTrackEtaTotLowPt0->getNbinsX(), + meETLTrackEtaTotLowPt0->getTH1()->GetXaxis()->GetXmin(), + meETLTrackEtaTotLowPt0->getTH1()->GetXaxis()->GetXmax()); meEtlEtaEffLowPt_[0]->getTH1()->SetMinimum(0.); - computeEfficiency1D(meETLTrackEffEtaMtdLowPt0, meETLTrackEffEtaTotLowPt0, meEtlEtaEffLowPt_[0]); - - meEtlPhiEff_[0] = ibook.book1D("EtlPhiEffZneg", - "Track Efficiency VS Phi (-Z);#phi [rad];Efficiency", - meETLTrackEffPhiTotZneg->getNbinsX(), - meETLTrackEffPhiTotZneg->getTH1()->GetXaxis()->GetXmin(), - meETLTrackEffPhiTotZneg->getTH1()->GetXaxis()->GetXmax()); - meEtlPhiEff_[0]->getTH1()->SetMinimum(0.); - computeEfficiency1D(meETLTrackEffPhiMtdZneg, meETLTrackEffPhiTotZneg, meEtlPhiEff_[0]); - - meEtlPtEff_[0] = ibook.book1D("EtlPtEffZneg", - "Track Efficiency VS Pt (-Z);Pt [GeV];Efficiency", - meETLTrackEffPtTotZneg->getNbinsX(), - meETLTrackEffPtTotZneg->getTH1()->GetXaxis()->GetXmin(), - meETLTrackEffPtTotZneg->getTH1()->GetXaxis()->GetXmax()); - meEtlPtEff_[0]->getTH1()->SetMinimum(0.); - computeEfficiency1D(meETLTrackEffPtMtdZneg, meETLTrackEffPtTotZneg, meEtlPtEff_[0]); - - meEtlEtaEff_[1] = ibook.book1D("EtlEtaEffZpos", - " Track Efficiency VS Eta (+Z);#eta;Efficiency", - meETLTrackEffEtaTotZpos->getNbinsX(), - meETLTrackEffEtaTotZpos->getTH1()->GetXaxis()->GetXmin(), - meETLTrackEffEtaTotZpos->getTH1()->GetXaxis()->GetXmax()); - meEtlEtaEff_[1]->getTH1()->SetMinimum(0.); - computeEfficiency1D(meETLTrackEffEtaMtdZpos, meETLTrackEffEtaTotZpos, meEtlEtaEff_[1]); + computeEfficiency1D(meETLTrackEtaMtdLowPt0, meETLTrackEtaTotLowPt0, meEtlEtaEffLowPt_[0]); meEtlEtaEffLowPt_[1] = ibook.book1D("EtlEtaEffLowPt1", " Track Efficiency VS Eta, 0.45 < pt < 0.7;#eta;Efficiency", - meETLTrackEffEtaTotLowPt1->getNbinsX(), - meETLTrackEffEtaTotLowPt1->getTH1()->GetXaxis()->GetXmin(), - meETLTrackEffEtaTotLowPt1->getTH1()->GetXaxis()->GetXmax()); + meETLTrackEtaTotLowPt1->getNbinsX(), + meETLTrackEtaTotLowPt1->getTH1()->GetXaxis()->GetXmin(), + meETLTrackEtaTotLowPt1->getTH1()->GetXaxis()->GetXmax()); meEtlEtaEffLowPt_[1]->getTH1()->SetMinimum(0.); - computeEfficiency1D(meETLTrackEffEtaMtdLowPt1, meETLTrackEffEtaTotLowPt1, meEtlEtaEffLowPt_[1]); - - meEtlPhiEff_[1] = ibook.book1D("EtlPhiEffZpos", - "Track Efficiency VS Phi (+Z);#phi [rad];Efficiency", - meETLTrackEffPhiTotZpos->getNbinsX(), - meETLTrackEffPhiTotZpos->getTH1()->GetXaxis()->GetXmin(), - meETLTrackEffPhiTotZpos->getTH1()->GetXaxis()->GetXmax()); - meEtlPhiEff_[1]->getTH1()->SetMinimum(0.); - computeEfficiency1D(meETLTrackEffPhiMtdZpos, meETLTrackEffPhiTotZpos, meEtlPhiEff_[1]); - - meEtlPtEff_[1] = ibook.book1D("EtlPtEffZpos", - "Track Efficiency VS Pt (+Z);Pt [GeV];Efficiency", - meETLTrackEffPtTotZpos->getNbinsX(), - meETLTrackEffPtTotZpos->getTH1()->GetXaxis()->GetXmin(), - meETLTrackEffPtTotZpos->getTH1()->GetXaxis()->GetXmax()); - meEtlPtEff_[1]->getTH1()->SetMinimum(0.); - computeEfficiency1D(meETLTrackEffPtMtdZpos, meETLTrackEffPtTotZpos, meEtlPtEff_[1]); - - meEtlEtaEff2_[0] = ibook.book1D("EtlEtaEff2Zneg", - " Track Efficiency VS Eta (-Z, 2 hit);#eta;Efficiency", - meETLTrackEffEtaTotZneg->getNbinsX(), - meETLTrackEffEtaTotZneg->getTH1()->GetXaxis()->GetXmin(), - meETLTrackEffEtaTotZneg->getTH1()->GetXaxis()->GetXmax()); - meEtlEtaEff2_[0]->getTH1()->SetMinimum(0.); - computeEfficiency1D(meETLTrackEffEta2MtdZneg, meETLTrackEffEtaTotZneg, meEtlEtaEff2_[0]); + computeEfficiency1D(meETLTrackEtaMtdLowPt1, meETLTrackEtaTotLowPt1, meEtlEtaEffLowPt_[1]); meEtlEtaEff2LowPt_[0] = ibook.book1D("EtlEtaEff2LowPt0", " Track Efficiency VS Eta (2 hits), 0.2 < pt < 0.45;#eta;Efficiency", - meETLTrackEffEtaTotLowPt0->getNbinsX(), - meETLTrackEffEtaTotLowPt0->getTH1()->GetXaxis()->GetXmin(), - meETLTrackEffEtaTotLowPt0->getTH1()->GetXaxis()->GetXmax()); + meETLTrackEtaTotLowPt0->getNbinsX(), + meETLTrackEtaTotLowPt0->getTH1()->GetXaxis()->GetXmin(), + meETLTrackEtaTotLowPt0->getTH1()->GetXaxis()->GetXmax()); meEtlEtaEff2LowPt_[0]->getTH1()->SetMinimum(0.); - computeEfficiency1D(meETLTrackEffEta2MtdLowPt0, meETLTrackEffEtaTotLowPt0, meEtlEtaEff2LowPt_[0]); - - meEtlPhiEff2_[0] = ibook.book1D("EtlPhiEff2Zneg", - "Track Efficiency VS Phi (-Z, 2 hits);#phi [rad];Efficiency", - meETLTrackEffPhiTotZneg->getNbinsX(), - meETLTrackEffPhiTotZneg->getTH1()->GetXaxis()->GetXmin(), - meETLTrackEffPhiTotZneg->getTH1()->GetXaxis()->GetXmax()); - meEtlPhiEff2_[0]->getTH1()->SetMinimum(0.); - computeEfficiency1D(meETLTrackEffPhi2MtdZneg, meETLTrackEffPhiTotZneg, meEtlPhiEff2_[0]); - - meEtlPtEff2_[0] = ibook.book1D("EtlPtEff2Zneg", - "Track Efficiency VS Pt (-Z, 2 hits);Pt [GeV];Efficiency", - meETLTrackEffPtTotZneg->getNbinsX(), - meETLTrackEffPtTotZneg->getTH1()->GetXaxis()->GetXmin(), - meETLTrackEffPtTotZneg->getTH1()->GetXaxis()->GetXmax()); - meEtlPtEff2_[0]->getTH1()->SetMinimum(0.); - computeEfficiency1D(meETLTrackEffPt2MtdZneg, meETLTrackEffPtTotZneg, meEtlPtEff2_[0]); - - meEtlEtaEff2_[1] = ibook.book1D("EtlEtaEff2Zpos", - "Track Efficiency VS Eta (+Z, 2 hits);#eta;Efficiency", - meETLTrackEffEtaTotZpos->getNbinsX(), - meETLTrackEffEtaTotZpos->getTH1()->GetXaxis()->GetXmin(), - meETLTrackEffEtaTotZpos->getTH1()->GetXaxis()->GetXmax()); - meEtlEtaEff2_[1]->getTH1()->SetMinimum(0.); - computeEfficiency1D(meETLTrackEffEta2MtdZpos, meETLTrackEffEtaTotZpos, meEtlEtaEff2_[1]); + computeEfficiency1D(meETLTrackEta2MtdLowPt0, meETLTrackEtaTotLowPt0, meEtlEtaEff2LowPt_[0]); meEtlEtaEff2LowPt_[1] = ibook.book1D("EtlEtaEff2LowPt1", " Track Efficiency VS Eta (2 hits), 0.45 < pt < 0.7;#eta;Efficiency", - meETLTrackEffEtaTotLowPt1->getNbinsX(), - meETLTrackEffEtaTotLowPt1->getTH1()->GetXaxis()->GetXmin(), - meETLTrackEffEtaTotLowPt1->getTH1()->GetXaxis()->GetXmax()); + meETLTrackEtaTotLowPt1->getNbinsX(), + meETLTrackEtaTotLowPt1->getTH1()->GetXaxis()->GetXmin(), + meETLTrackEtaTotLowPt1->getTH1()->GetXaxis()->GetXmax()); meEtlEtaEff2LowPt_[1]->getTH1()->SetMinimum(0.); - computeEfficiency1D(meETLTrackEffEta2MtdLowPt1, meETLTrackEffEtaTotLowPt1, meEtlEtaEff2LowPt_[1]); - - meEtlPhiEff2_[1] = ibook.book1D("EtlPhiEff2Zpos", - "Track Efficiency VS Phi (+Z, 2 hits);#phi [rad];Efficiency", - meETLTrackEffPhiTotZpos->getNbinsX(), - meETLTrackEffPhiTotZpos->getTH1()->GetXaxis()->GetXmin(), - meETLTrackEffPhiTotZpos->getTH1()->GetXaxis()->GetXmax()); - meEtlPhiEff2_[1]->getTH1()->SetMinimum(0.); - computeEfficiency1D(meETLTrackEffPhi2MtdZpos, meETLTrackEffPhiTotZpos, meEtlPhiEff2_[1]); - - meEtlPtEff2_[1] = ibook.book1D("EtlPtEff2Zpos", - "Track Efficiency VS Pt (+Z, 2 hits);Pt [GeV];Efficiency", - meETLTrackEffPtTotZpos->getNbinsX(), - meETLTrackEffPtTotZpos->getTH1()->GetXaxis()->GetXmin(), - meETLTrackEffPtTotZpos->getTH1()->GetXaxis()->GetXmax()); - meEtlPtEff2_[1]->getTH1()->SetMinimum(0.); - computeEfficiency1D(meETLTrackEffPt2MtdZpos, meETLTrackEffPtTotZpos, meEtlPtEff2_[1]); + computeEfficiency1D(meETLTrackEta2MtdLowPt1, meETLTrackEtaTotLowPt1, meEtlEtaEff2LowPt_[1]); meExtraPtEff_ = ibook.book1D("ExtraPtEff", "MTD matching efficiency wrt extrapolated track associated to LV VS Pt;Pt [GeV];Efficiency", - meTrackMatchedTPEffPtTotLV->getNbinsX(), - meTrackMatchedTPEffPtTotLV->getTH1()->GetXaxis()->GetXmin(), - meTrackMatchedTPEffPtTotLV->getTH1()->GetXaxis()->GetXmax()); + meTrackMatchedTPPtTotLV->getNbinsX(), + meTrackMatchedTPPtTotLV->getTH1()->GetXaxis()->GetXmin(), + meTrackMatchedTPPtTotLV->getTH1()->GetXaxis()->GetXmax()); meExtraPtEff_->getTH1()->SetMinimum(0.); - computeEfficiency1D(meExtraPtMtd, meTrackMatchedTPEffPtTotLV, meExtraPtEff_); + computeEfficiency1D(meExtraPtMtd, meTrackMatchedTPPtTotLV, meExtraPtEff_); meExtraPtEtl2Eff_ = ibook.book1D("ExtraPtEtl2Eff", "MTD matching efficiency (2 ETL) wrt extrapolated track associated to LV VS Pt;Pt [GeV];Efficiency", - meTrackMatchedTPEffPtTotLV->getNbinsX(), - meTrackMatchedTPEffPtTotLV->getTH1()->GetXaxis()->GetXmin(), - meTrackMatchedTPEffPtTotLV->getTH1()->GetXaxis()->GetXmax()); + meTrackMatchedTPPtTotLV->getNbinsX(), + meTrackMatchedTPPtTotLV->getTH1()->GetXaxis()->GetXmin(), + meTrackMatchedTPPtTotLV->getTH1()->GetXaxis()->GetXmax()); meExtraPtEtl2Eff_->getTH1()->SetMinimum(0.); - computeEfficiency1D(meExtraPtEtl2Mtd, meTrackMatchedTPEffPtTotLV, meExtraPtEtl2Eff_); + computeEfficiency1D(meExtraPtEtl2Mtd, meTrackMatchedTPPtTotLV, meExtraPtEtl2Eff_); meExtraEtaEff_ = ibook.book1D("ExtraEtaEff", "MTD matching efficiency wrt extrapolated track associated to LV VS Eta;Eta;Efficiency", - meTrackMatchedTPEffEtaTotLV->getNbinsX(), - meTrackMatchedTPEffEtaTotLV->getTH1()->GetXaxis()->GetXmin(), - meTrackMatchedTPEffEtaTotLV->getTH1()->GetXaxis()->GetXmax()); + meTrackMatchedTPEtaTotLV->getNbinsX(), + meTrackMatchedTPEtaTotLV->getTH1()->GetXaxis()->GetXmin(), + meTrackMatchedTPEtaTotLV->getTH1()->GetXaxis()->GetXmax()); meExtraEtaEff_->getTH1()->SetMinimum(0.); - computeEfficiency1D(meExtraEtaMtd, meTrackMatchedTPEffEtaTotLV, meExtraEtaEff_); + computeEfficiency1D(meExtraEtaMtd, meTrackMatchedTPEtaTotLV, meExtraEtaEff_); meExtraEtaEtl2Eff_ = ibook.book1D("ExtraEtaEtl2Eff", "MTD matching efficiency (2 ETL) wrt extrapolated track associated to LV VS Eta;Eta;Efficiency", - meTrackMatchedTPEffEtaTotLV->getNbinsX(), - meTrackMatchedTPEffEtaTotLV->getTH1()->GetXaxis()->GetXmin(), - meTrackMatchedTPEffEtaTotLV->getTH1()->GetXaxis()->GetXmax()); + meTrackMatchedTPEtaTotLV->getNbinsX(), + meTrackMatchedTPEtaTotLV->getTH1()->GetXaxis()->GetXmin(), + meTrackMatchedTPEtaTotLV->getTH1()->GetXaxis()->GetXmax()); meExtraEtaEtl2Eff_->getTH1()->SetMinimum(0.); - computeEfficiency1D(meExtraEtaEtl2Mtd, meTrackMatchedTPEffEtaTotLV, meExtraEtaEtl2Eff_); - - meTPPtSelEff_ = ibook.book1D("TPPtSelEff", - "Track selected efficiency TP VS Pt;Pt [GeV];Efficiency", - meTrackPtTot->getNbinsX(), - meTrackPtTot->getTH1()->GetXaxis()->GetXmin(), - meTrackPtTot->getTH1()->GetXaxis()->GetXmax()); - meTPPtSelEff_->getTH1()->SetMinimum(0.); - computeEfficiency1D(meTrackMatchedTPEffPtTot, meTrackPtTot, meTPPtSelEff_); - - meTPEtaSelEff_ = ibook.book1D("TPEtaSelEff", - "Track selected efficiency TP VS Eta;Eta;Efficiency", - meTrackEtaTot->getNbinsX(), - meTrackEtaTot->getTH1()->GetXaxis()->GetXmin(), - meTrackEtaTot->getTH1()->GetXaxis()->GetXmax()); - meTPEtaSelEff_->getTH1()->SetMinimum(0.); - computeEfficiency1D(meTrackMatchedTPEffEtaTot, meTrackEtaTot, meTPEtaSelEff_); - - meTPPtMatchEff_ = ibook.book1D("TPPtMatchEff", - "Track matched to TP efficiency VS Pt;Pt [GeV];Efficiency", - meTrackMatchedTPEffPtTot->getNbinsX(), - meTrackMatchedTPEffPtTot->getTH1()->GetXaxis()->GetXmin(), - meTrackMatchedTPEffPtTot->getTH1()->GetXaxis()->GetXmax()); - meTPPtMatchEff_->getTH1()->SetMinimum(0.); - computeEfficiency1D(meTrackMatchedTPEffPtMtd, meTrackMatchedTPEffPtTot, meTPPtMatchEff_); - - meTPEtaMatchEff_ = ibook.book1D("TPEtaMatchEff", - "Track matched to TP efficiency VS Eta;Eta;Efficiency", - meTrackMatchedTPEffEtaTot->getNbinsX(), - meTrackMatchedTPEffEtaTot->getTH1()->GetXaxis()->GetXmin(), - meTrackMatchedTPEffEtaTot->getTH1()->GetXaxis()->GetXmax()); - meTPEtaMatchEff_->getTH1()->SetMinimum(0.); - computeEfficiency1D(meTrackMatchedTPEffEtaMtd, meTrackMatchedTPEffEtaTot, meTPEtaMatchEff_); - - meTPPtMatchEtl2Eff_ = ibook.book1D("TPPtMatchEtl2Eff", - "Track matched to TP efficiency VS Pt, 2 ETL hits;Pt [GeV];Efficiency", - meTrackMatchedTPEffPtTot->getNbinsX(), - meTrackMatchedTPEffPtTot->getTH1()->GetXaxis()->GetXmin(), - meTrackMatchedTPEffPtTot->getTH1()->GetXaxis()->GetXmax()); - meTPPtMatchEtl2Eff_->getTH1()->SetMinimum(0.); - computeEfficiency1D(meTrackMatchedTPEffPtEtl2Mtd, meTrackMatchedTPEffPtTot, meTPPtMatchEtl2Eff_); - - meTPEtaMatchEtl2Eff_ = ibook.book1D("TPEtaMatchEtl2Eff", - "Track matched to TP efficiency VS Eta, 2 ETL hits;Eta;Efficiency", - meTrackMatchedTPEffEtaTot->getNbinsX(), - meTrackMatchedTPEffEtaTot->getTH1()->GetXaxis()->GetXmin(), - meTrackMatchedTPEffEtaTot->getTH1()->GetXaxis()->GetXmax()); - meTPEtaMatchEtl2Eff_->getTH1()->SetMinimum(0.); - computeEfficiency1D(meTrackMatchedTPEffEtaEtl2Mtd, meTrackMatchedTPEffEtaTot, meTPEtaMatchEtl2Eff_); - - meTPmtdPtSelEff_ = ibook.book1D("TPmtdPtSelEff", - "Track selected efficiency TP-mtd hit VS Pt;Pt [GeV];Efficiency", - meTrackPtTot->getNbinsX(), - meTrackPtTot->getTH1()->GetXaxis()->GetXmin(), - meTrackPtTot->getTH1()->GetXaxis()->GetXmax()); - meTPmtdPtSelEff_->getTH1()->SetMinimum(0.); - computeEfficiency1D(meTrackMatchedTPmtdEffPtTot, meTrackPtTot, meTPmtdPtSelEff_); - - meTPmtdEtaSelEff_ = ibook.book1D("TPmtdEtaSelEff", - "Track selected efficiency TPmtd hit VS Eta;Eta;Efficiency", - meTrackEtaTot->getNbinsX(), - meTrackEtaTot->getTH1()->GetXaxis()->GetXmin(), - meTrackEtaTot->getTH1()->GetXaxis()->GetXmax()); - meTPmtdEtaSelEff_->getTH1()->SetMinimum(0.); - computeEfficiency1D(meTrackMatchedTPmtdEffEtaTot, meTrackEtaTot, meTPmtdEtaSelEff_); - - meTPmtdPtMatchEff_ = ibook.book1D("TPmtdPtMatchEff", - "Track matched to TP-mtd hit efficiency VS Pt;Pt [GeV];Efficiency", - meTrackMatchedTPmtdEffPtTot->getNbinsX(), - meTrackMatchedTPmtdEffPtTot->getTH1()->GetXaxis()->GetXmin(), - meTrackMatchedTPmtdEffPtTot->getTH1()->GetXaxis()->GetXmax()); - meTPmtdPtMatchEff_->getTH1()->SetMinimum(0.); - computeEfficiency1D(meTrackMatchedTPmtdEffPtMtd, meTrackMatchedTPmtdEffPtTot, meTPmtdPtMatchEff_); - - meTPmtdEtaMatchEff_ = ibook.book1D("TPmtdEtaMatchEff", - "Track matched to TP-mtd hit efficiency VS Eta;Eta;Efficiency", - meTrackMatchedTPmtdEffEtaTot->getNbinsX(), - meTrackMatchedTPmtdEffEtaTot->getTH1()->GetXaxis()->GetXmin(), - meTrackMatchedTPmtdEffEtaTot->getTH1()->GetXaxis()->GetXmax()); - meTPmtdEtaMatchEff_->getTH1()->SetMinimum(0.); - computeEfficiency1D(meTrackMatchedTPmtdEffEtaMtd, meTrackMatchedTPmtdEffEtaTot, meTPmtdEtaMatchEff_); + computeEfficiency1D(meExtraEtaEtl2Mtd, meTrackMatchedTPEtaTotLV, meExtraEtaEtl2Eff_); + + // Efficiency for TP matched tracks + meBTLTPPtSelEff_ = ibook.book1D("BTLTPPtSelEff", + "Track selected efficiency TP VS Pt;Pt [GeV];Efficiency", + meBTLTrackPtTot->getNbinsX(), + meBTLTrackPtTot->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackPtTot->getTH1()->GetXaxis()->GetXmax()); + meBTLTPPtSelEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meBTLTrackMatchedTPPtTot, meBTLTrackPtTot, meBTLTPPtSelEff_); + + meBTLTPEtaSelEff_ = ibook.book1D("BTLTPEtaSelEff", + "Track selected efficiency TP VS Eta;Eta;Efficiency", + meBTLTrackEtaTot->getNbinsX(), + meBTLTrackEtaTot->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackEtaTot->getTH1()->GetXaxis()->GetXmax()); + meBTLTPEtaSelEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meBTLTrackMatchedTPEtaTot, meBTLTrackEtaTot, meBTLTPEtaSelEff_); + + meBTLTPPtMatchEff_ = ibook.book1D("BTLTPPtMatchEff", + "Track matched to TP efficiency VS Pt;Pt [GeV];Efficiency", + meBTLTrackMatchedTPPtTot->getNbinsX(), + meBTLTrackMatchedTPPtTot->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackMatchedTPPtTot->getTH1()->GetXaxis()->GetXmax()); + meBTLTPPtMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meBTLTrackMatchedTPPtMtd, meBTLTrackMatchedTPPtTot, meBTLTPPtMatchEff_); + + meBTLTPEtaMatchEff_ = ibook.book1D("BTLTPEtaMatchEff", + "Track matched to TP efficiency VS Eta;Eta;Efficiency", + meBTLTrackMatchedTPEtaTot->getNbinsX(), + meBTLTrackMatchedTPEtaTot->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackMatchedTPEtaTot->getTH1()->GetXaxis()->GetXmax()); + meBTLTPEtaMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meBTLTrackMatchedTPEtaMtd, meBTLTrackMatchedTPEtaTot, meBTLTPEtaMatchEff_); + + meETLTPPtSelEff_ = ibook.book1D("ETLTPPtSelEff", + "Track selected efficiency TP VS Pt;Pt [GeV];Efficiency", + meETLTrackPtTot->getNbinsX(), + meETLTrackPtTot->getTH1()->GetXaxis()->GetXmin(), + meETLTrackPtTot->getTH1()->GetXaxis()->GetXmax()); + meETLTPPtSelEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackMatchedTPPtTot, meETLTrackPtTot, meETLTPPtSelEff_); + + meETLTPEtaSelEff_ = ibook.book1D("ETLTPEtaSelEff", + "Track selected efficiency TP VS Eta;Eta;Efficiency", + meETLTrackEtaTot->getNbinsX(), + meETLTrackEtaTot->getTH1()->GetXaxis()->GetXmin(), + meETLTrackEtaTot->getTH1()->GetXaxis()->GetXmax()); + meETLTPEtaSelEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackMatchedTPEtaTot, meETLTrackEtaTot, meETLTPEtaSelEff_); + + meETLTPPtMatchEff_ = ibook.book1D("ETLTPPtMatchEff", + "Track matched to TP efficiency VS Pt;Pt [GeV];Efficiency", + meETLTrackMatchedTPPtTot->getNbinsX(), + meETLTrackMatchedTPPtTot->getTH1()->GetXaxis()->GetXmin(), + meETLTrackMatchedTPPtTot->getTH1()->GetXaxis()->GetXmax()); + meETLTPPtMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackMatchedTPPtMtd, meETLTrackMatchedTPPtTot, meETLTPPtMatchEff_); + + meETLTPEtaMatchEff_ = ibook.book1D("ETLTPEtaMatchEff", + "Track matched to TP efficiency VS Eta;Eta;Efficiency", + meETLTrackMatchedTPEtaTot->getNbinsX(), + meETLTrackMatchedTPEtaTot->getTH1()->GetXaxis()->GetXmin(), + meETLTrackMatchedTPEtaTot->getTH1()->GetXaxis()->GetXmax()); + meETLTPEtaMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackMatchedTPEtaMtd, meETLTrackMatchedTPEtaTot, meETLTPEtaMatchEff_); + + meETLTPPtMatchEff2_ = ibook.book1D("ETLTPPtMatchEff2", + "Track matched to TP efficiency VS Pt (2 ETL hits);Pt [GeV];Efficiency", + meETLTrackMatchedTPPtTot->getNbinsX(), + meETLTrackMatchedTPPtTot->getTH1()->GetXaxis()->GetXmin(), + meETLTrackMatchedTPPtTot->getTH1()->GetXaxis()->GetXmax()); + meETLTPPtMatchEff2_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackMatchedTPPt2Mtd, meETLTrackMatchedTPPtTot, meETLTPPtMatchEff2_); + + meETLTPEtaMatchEff2_ = ibook.book1D("ETLTPEtaMatchEff2", + "Track matched to TP efficiency VS Eta (2 hits);Eta;Efficiency", + meETLTrackMatchedTPEtaTot->getNbinsX(), + meETLTrackMatchedTPEtaTot->getTH1()->GetXaxis()->GetXmin(), + meETLTrackMatchedTPEtaTot->getTH1()->GetXaxis()->GetXmax()); + meETLTPEtaMatchEff2_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackMatchedTPEta2Mtd, meETLTrackMatchedTPEtaTot, meETLTPEtaMatchEff2_); + + // == Track-cluster matching efficiencies based on mc truth + // -- BTL + meBTLTPmtdDirectEtaSelEff_ = ibook.book1D("BTLTPmtdDirectEtaSelEff", + "Track selected efficiency TP-mtd hit (direct) VS Eta", + meBTLTrackEtaTot->getNbinsX(), + meBTLTrackEtaTot->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackEtaTot->getTH1()->GetXaxis()->GetXmax()); + meBTLTPmtdDirectEtaSelEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meBTLTrackMatchedTPmtdDirectEta, meBTLTrackEtaTot, meBTLTPmtdDirectEtaSelEff_); + + meBTLTPmtdDirectPtSelEff_ = ibook.book1D("BTLTPmtdDirectPtSelEff", + "Track selected efficiency TP-mtd hit (direct) VS Pt", + meBTLTrackPtTot->getNbinsX(), + meBTLTrackPtTot->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackPtTot->getTH1()->GetXaxis()->GetXmax()); + meBTLTPmtdDirectPtSelEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meBTLTrackMatchedTPmtdDirectPt, meBTLTrackPtTot, meBTLTPmtdDirectPtSelEff_); + + meBTLTPmtdOtherEtaSelEff_ = ibook.book1D("BTLTPmtdOtherEtaSelEff", + "Track selected efficiency TP-mtd hit (other) VS Eta", + meBTLTrackEtaTot->getNbinsX(), + meBTLTrackEtaTot->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackEtaTot->getTH1()->GetXaxis()->GetXmax()); + meBTLTPmtdOtherEtaSelEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meBTLTrackMatchedTPmtdOtherEta, meBTLTrackEtaTot, meBTLTPmtdOtherEtaSelEff_); + + meBTLTPmtdOtherPtSelEff_ = ibook.book1D("BTLTPmtdOtherPtSelEff", + "Track selected efficiency TP-mtd hit (other) VS Pt", + meBTLTrackPtTot->getNbinsX(), + meBTLTrackPtTot->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackPtTot->getTH1()->GetXaxis()->GetXmax()); + meBTLTPmtdOtherPtSelEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meBTLTrackMatchedTPmtdOtherPt, meBTLTrackPtTot, meBTLTPmtdOtherPtSelEff_); + + meBTLTPnomtdEtaSelEff_ = ibook.book1D("BTLTPnomtdEtaSelEff", + "Track selected efficiency TP-no mtd hit VS Eta", + meBTLTrackEtaTot->getNbinsX(), + meBTLTrackEtaTot->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackEtaTot->getTH1()->GetXaxis()->GetXmax()); + meBTLTPnomtdEtaSelEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meBTLTrackMatchedTPnomtdEta, meBTLTrackEtaTot, meBTLTPnomtdEtaSelEff_); + + meBTLTPnomtdPtSelEff_ = ibook.book1D("BTLTPnomtdPtSelEff", + "Track selected efficiency TP-no mtd hit VS Pt", + meBTLTrackPtTot->getNbinsX(), + meBTLTrackPtTot->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackPtTot->getTH1()->GetXaxis()->GetXmax()); + meBTLTPnomtdPtSelEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meBTLTrackMatchedTPnomtdPt, meBTLTrackPtTot, meBTLTPnomtdPtSelEff_); + + meBTLTPmtdDirectCorrectAssocEtaMatchEff_ = + ibook.book1D("BTLTPmtdDirectCorrectAssocEtaMatchEff", + "Track efficiency TP-mtd hit (direct), correct reco match VS Eta", + meBTLTrackMatchedTPmtdDirectEta->getNbinsX(), + meBTLTrackMatchedTPmtdDirectEta->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackMatchedTPmtdDirectEta->getTH1()->GetXaxis()->GetXmax()); + meBTLTPmtdDirectCorrectAssocEtaMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meBTLTrackMatchedTPmtdDirectCorrectAssocEta, + meBTLTrackMatchedTPmtdDirectEta, + meBTLTPmtdDirectCorrectAssocEtaMatchEff_); + + meBTLTPmtdDirectCorrectAssocPtMatchEff_ = + ibook.book1D("BTLTPmtdDirectCorrectAssocPtMatchEff", + "Track efficiency TP-mtd hit (direct), correct reco match VS Pt", + meBTLTrackMatchedTPmtdDirectPt->getNbinsX(), + meBTLTrackMatchedTPmtdDirectPt->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackMatchedTPmtdDirectPt->getTH1()->GetXaxis()->GetXmax()); + meBTLTPmtdDirectCorrectAssocPtMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meBTLTrackMatchedTPmtdDirectCorrectAssocPt, + meBTLTrackMatchedTPmtdDirectPt, + meBTLTPmtdDirectCorrectAssocPtMatchEff_); + + meBTLTPmtdDirectWrongAssocEtaMatchEff_ = + ibook.book1D("BTLTPmtdDirectWrongAssocEtaMatchEff", + "Track efficiency TP-mtd hit (direct), incorrect reco match VS Eta", + meBTLTrackMatchedTPmtdDirectEta->getNbinsX(), + meBTLTrackMatchedTPmtdDirectEta->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackMatchedTPmtdDirectEta->getTH1()->GetXaxis()->GetXmax()); + meBTLTPmtdDirectWrongAssocEtaMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meBTLTrackMatchedTPmtdDirectWrongAssocEta, + meBTLTrackMatchedTPmtdDirectEta, + meBTLTPmtdDirectWrongAssocEtaMatchEff_); + + meBTLTPmtdDirectWrongAssocPtMatchEff_ = + ibook.book1D("BTLTPmtdDirectWrongAssocPtMatchEff", + "Track efficiency TP-mtd hit (direct), incorrect reco match VS Pt", + meBTLTrackMatchedTPmtdDirectPt->getNbinsX(), + meBTLTrackMatchedTPmtdDirectPt->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackMatchedTPmtdDirectPt->getTH1()->GetXaxis()->GetXmax()); + meBTLTPmtdDirectWrongAssocPtMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D( + meBTLTrackMatchedTPmtdDirectWrongAssocPt, meBTLTrackMatchedTPmtdDirectPt, meBTLTPmtdDirectWrongAssocPtMatchEff_); + + meBTLTPmtdDirectNoAssocEtaMatchEff_ = ibook.book1D("BTLTPmtdDirectNoAssocEtaMatchEff", + "Track efficiency TP-mtd hit (direct), no reco match VS Eta", + meBTLTrackMatchedTPmtdDirectEta->getNbinsX(), + meBTLTrackMatchedTPmtdDirectEta->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackMatchedTPmtdDirectEta->getTH1()->GetXaxis()->GetXmax()); + meBTLTPmtdDirectNoAssocEtaMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D( + meBTLTrackMatchedTPmtdDirectNoAssocEta, meBTLTrackMatchedTPmtdDirectEta, meBTLTPmtdDirectNoAssocEtaMatchEff_); + + meBTLTPmtdDirectNoAssocPtMatchEff_ = ibook.book1D("BTLTPmtdDirectNoAssocPtMatchEff", + "Track efficiency TP-mtd hit (direct), no reco match VS Pt", + meBTLTrackMatchedTPmtdDirectPt->getNbinsX(), + meBTLTrackMatchedTPmtdDirectPt->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackMatchedTPmtdDirectPt->getTH1()->GetXaxis()->GetXmax()); + meBTLTPmtdDirectNoAssocPtMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D( + meBTLTrackMatchedTPmtdDirectNoAssocPt, meBTLTrackMatchedTPmtdDirectPt, meBTLTPmtdDirectNoAssocPtMatchEff_); + + meBTLTPmtdOtherCorrectAssocEtaMatchEff_ = + ibook.book1D("BTLTPmtdOtherCorrectAssocEtaMatchEff", + "Track efficiency TP-mtd hit (other), correct reco match VS Eta", + meBTLTrackMatchedTPmtdOtherEta->getNbinsX(), + meBTLTrackMatchedTPmtdOtherEta->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackMatchedTPmtdOtherEta->getTH1()->GetXaxis()->GetXmax()); + meBTLTPmtdOtherCorrectAssocEtaMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meBTLTrackMatchedTPmtdOtherCorrectAssocEta, + meBTLTrackMatchedTPmtdOtherEta, + meBTLTPmtdOtherCorrectAssocEtaMatchEff_); + + meBTLTPmtdOtherCorrectAssocPtMatchEff_ = ibook.book1D("BTLTPmtdOtherCorrectAssocPtMatchEff", + "Track efficiency TP-mtd hit (other), correct reco match VS Pt", + meBTLTrackMatchedTPmtdOtherPt->getNbinsX(), + meBTLTrackMatchedTPmtdOtherPt->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackMatchedTPmtdOtherPt->getTH1()->GetXaxis()->GetXmax()); + meBTLTPmtdOtherCorrectAssocPtMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D( + meBTLTrackMatchedTPmtdOtherCorrectAssocPt, meBTLTrackMatchedTPmtdOtherPt, meBTLTPmtdOtherCorrectAssocPtMatchEff_); + + meBTLTPmtdOtherWrongAssocEtaMatchEff_ = + ibook.book1D("BTLTPmtdOtherWrongAssocEtaMatchEff", + "Track efficiency TP-mtd hit (other), incorrect reco match VS Eta", + meBTLTrackMatchedTPmtdOtherEta->getNbinsX(), + meBTLTrackMatchedTPmtdOtherEta->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackMatchedTPmtdOtherEta->getTH1()->GetXaxis()->GetXmax()); + meBTLTPmtdOtherWrongAssocEtaMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D( + meBTLTrackMatchedTPmtdOtherWrongAssocEta, meBTLTrackMatchedTPmtdOtherEta, meBTLTPmtdOtherWrongAssocEtaMatchEff_); + + meBTLTPmtdOtherWrongAssocPtMatchEff_ = ibook.book1D("BTLTPmtdOtherWrongAssocPtMatchEff", + "Track efficiency TP-mtd hit (other), incorrect reco match VS Pt", + meBTLTrackMatchedTPmtdOtherPt->getNbinsX(), + meBTLTrackMatchedTPmtdOtherPt->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackMatchedTPmtdOtherPt->getTH1()->GetXaxis()->GetXmax()); + meBTLTPmtdOtherWrongAssocPtMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D( + meBTLTrackMatchedTPmtdOtherWrongAssocPt, meBTLTrackMatchedTPmtdOtherPt, meBTLTPmtdOtherWrongAssocPtMatchEff_); + + meBTLTPmtdOtherNoAssocEtaMatchEff_ = ibook.book1D("BTLTPmtdOtherNoAssocEtaMatchEff", + "Track efficiency TP-mtd hit (other), no reco match VS Eta", + meBTLTrackMatchedTPmtdOtherEta->getNbinsX(), + meBTLTrackMatchedTPmtdOtherEta->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackMatchedTPmtdOtherEta->getTH1()->GetXaxis()->GetXmax()); + meBTLTPmtdOtherNoAssocEtaMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D( + meBTLTrackMatchedTPmtdOtherNoAssocEta, meBTLTrackMatchedTPmtdOtherEta, meBTLTPmtdOtherNoAssocEtaMatchEff_); + + meBTLTPmtdOtherNoAssocPtMatchEff_ = ibook.book1D("BTLTPmtdOtherNoAssocPtMatchEff", + "Track efficiency TP-mtd hit (other), no reco match VS Pt", + meBTLTrackMatchedTPmtdOtherPt->getNbinsX(), + meBTLTrackMatchedTPmtdOtherPt->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackMatchedTPmtdOtherPt->getTH1()->GetXaxis()->GetXmax()); + meBTLTPmtdOtherNoAssocPtMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D( + meBTLTrackMatchedTPmtdOtherNoAssocPt, meBTLTrackMatchedTPmtdOtherPt, meBTLTPmtdOtherNoAssocPtMatchEff_); + + meBTLTPnomtdEtaMatchEff_ = ibook.book1D("BTLTPnomtdEtaMatchEff", + "Track efficiency TP- no mtd hit, with reco match VS Eta", + meBTLTrackMatchedTPnomtdEta->getNbinsX(), + meBTLTrackMatchedTPnomtdEta->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackMatchedTPnomtdEta->getTH1()->GetXaxis()->GetXmax()); + meBTLTPnomtdEtaMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meBTLTrackMatchedTPnomtdAssocEta, meBTLTrackMatchedTPnomtdEta, meBTLTPnomtdEtaMatchEff_); + + meBTLTPnomtdPtMatchEff_ = ibook.book1D("BTLTPnomtdPtMatchEff", + "Track efficiency TP- no mtd hit, with reco match VS Pt", + meBTLTrackMatchedTPnomtdPt->getNbinsX(), + meBTLTrackMatchedTPnomtdPt->getTH1()->GetXaxis()->GetXmin(), + meBTLTrackMatchedTPnomtdPt->getTH1()->GetXaxis()->GetXmax()); + meBTLTPnomtdPtMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meBTLTrackMatchedTPnomtdAssocPt, meBTLTrackMatchedTPnomtdPt, meBTLTPnomtdPtMatchEff_); + + // -- ETL + meETLTPmtd1EtaSelEff_ = ibook.book1D("ETLTPmtd1EtaSelEff", + "Track selected efficiency TP-mtd hit (>=1 sim hit) VS Eta", + meETLTrackEtaTot->getNbinsX(), + meETLTrackEtaTot->getTH1()->GetXaxis()->GetXmin(), + meETLTrackEtaTot->getTH1()->GetXaxis()->GetXmax()); + meETLTPmtd1EtaSelEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackMatchedTPmtd1Eta, meETLTrackEtaTot, meETLTPmtd1EtaSelEff_); + + meETLTPmtd1PtSelEff_ = ibook.book1D("ETLTPmtd1PtSelEff", + "Track selected efficiency TP-mtd hit (>=1 sim hit) VS Pt", + meETLTrackPtTot->getNbinsX(), + meETLTrackPtTot->getTH1()->GetXaxis()->GetXmin(), + meETLTrackPtTot->getTH1()->GetXaxis()->GetXmax()); + meETLTPmtd1PtSelEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackMatchedTPmtd1Pt, meETLTrackPtTot, meETLTPmtd1PtSelEff_); + + meETLTPmtd2EtaSelEff_ = ibook.book1D("ETLTPmtd2EtaSelEff", + "Track selected efficiency TP-mtd hit (2 sim hits) VS Eta", + meETLTrackEtaTot->getNbinsX(), + meETLTrackEtaTot->getTH1()->GetXaxis()->GetXmin(), + meETLTrackEtaTot->getTH1()->GetXaxis()->GetXmax()); + meETLTPmtd2EtaSelEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackMatchedTPmtd2Eta, meETLTrackEtaTot, meETLTPmtd2EtaSelEff_); + + meETLTPmtd2PtSelEff_ = ibook.book1D("ETLTPmtd2PtSelEff", + "Track selected efficiency TP-mtd hit (2 sim hits) VS Pt", + meETLTrackPtTot->getNbinsX(), + meETLTrackPtTot->getTH1()->GetXaxis()->GetXmin(), + meETLTrackPtTot->getTH1()->GetXaxis()->GetXmax()); + meETLTPmtd2PtSelEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackMatchedTPmtd2Pt, meETLTrackPtTot, meETLTPmtd2PtSelEff_); + + meETLTPnomtdEtaSelEff_ = ibook.book1D("ETLTPnomtdEtaSelEff", + "Track selected efficiency TP-no mtd hit VS Eta", + meETLTrackEtaTot->getNbinsX(), + meETLTrackEtaTot->getTH1()->GetXaxis()->GetXmin(), + meETLTrackEtaTot->getTH1()->GetXaxis()->GetXmax()); + meETLTPnomtdEtaSelEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackMatchedTPnomtdEta, meETLTrackEtaTot, meETLTPnomtdEtaSelEff_); + + meETLTPnomtdPtSelEff_ = ibook.book1D("ETLTPnomtdPtSelEff", + "Track selected efficiency TP-no mtd hit VS Pt", + meETLTrackPtTot->getNbinsX(), + meETLTrackPtTot->getTH1()->GetXaxis()->GetXmin(), + meETLTrackPtTot->getTH1()->GetXaxis()->GetXmax()); + meETLTPnomtdPtSelEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackMatchedTPnomtdPt, meETLTrackPtTot, meETLTPnomtdPtSelEff_); + + meETLTPmtd1CorrectAssocEtaMatchEff_ = + ibook.book1D("ETLTPmtd1CorrectAssocEtaMatchEff", + "Track efficiency TP-mtd hit (>=1 sim hit), correct reco match VS Eta", + meETLTrackMatchedTPmtd1Eta->getNbinsX(), + meETLTrackMatchedTPmtd1Eta->getTH1()->GetXaxis()->GetXmin(), + meETLTrackMatchedTPmtd1Eta->getTH1()->GetXaxis()->GetXmax()); + meETLTPmtd1CorrectAssocEtaMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D( + meETLTrackMatchedTPmtd1CorrectAssocEta, meETLTrackMatchedTPmtd1Eta, meETLTPmtd1CorrectAssocEtaMatchEff_); + + meETLTPmtd1CorrectAssocPtMatchEff_ = + ibook.book1D("ETLTPmtd1CorrectAssocPtMatchEff", + "Track efficiency TP-mtd hit (>=1 sim hit), correct reco match VS Pt", + meETLTrackMatchedTPmtd1Pt->getNbinsX(), + meETLTrackMatchedTPmtd1Pt->getTH1()->GetXaxis()->GetXmin(), + meETLTrackMatchedTPmtd1Pt->getTH1()->GetXaxis()->GetXmax()); + meETLTPmtd1CorrectAssocPtMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D( + meETLTrackMatchedTPmtd1CorrectAssocPt, meETLTrackMatchedTPmtd1Pt, meETLTPmtd1CorrectAssocPtMatchEff_); + + meETLTPmtd1WrongAssocEtaMatchEff_ = + ibook.book1D("ETLTPmtd1WrongAssocEtaMatchEff", + "Track efficiency TP-mtd hit (>=1 sim hit), incorrect reco match VS Eta", + meETLTrackMatchedTPmtd1Eta->getNbinsX(), + meETLTrackMatchedTPmtd1Eta->getTH1()->GetXaxis()->GetXmin(), + meETLTrackMatchedTPmtd1Eta->getTH1()->GetXaxis()->GetXmax()); + meETLTPmtd1WrongAssocEtaMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D( + meETLTrackMatchedTPmtd1WrongAssocEta, meETLTrackMatchedTPmtd1Eta, meETLTPmtd1WrongAssocEtaMatchEff_); + + meETLTPmtd1WrongAssocPtMatchEff_ = + ibook.book1D("ETLTPmtd1WrongAssocPtMatchEff", + "Track efficiency TP-mtd hit (>=1 sim hit), incorrect reco match VS Pt", + meETLTrackMatchedTPmtd1Pt->getNbinsX(), + meETLTrackMatchedTPmtd1Pt->getTH1()->GetXaxis()->GetXmin(), + meETLTrackMatchedTPmtd1Pt->getTH1()->GetXaxis()->GetXmax()); + meETLTPmtd1WrongAssocPtMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackMatchedTPmtd1WrongAssocPt, meETLTrackMatchedTPmtd1Pt, meETLTPmtd1WrongAssocPtMatchEff_); + + meETLTPmtd1NoAssocEtaMatchEff_ = ibook.book1D("ETLTPmtd1NoAssocEtaMatchEff", + "Track efficiency TP-mtd hit (>=1 sim hit), no reco match VS Eta", + meETLTrackMatchedTPmtd1Eta->getNbinsX(), + meETLTrackMatchedTPmtd1Eta->getTH1()->GetXaxis()->GetXmin(), + meETLTrackMatchedTPmtd1Eta->getTH1()->GetXaxis()->GetXmax()); + meETLTPmtd1NoAssocEtaMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackMatchedTPmtd1NoAssocEta, meETLTrackMatchedTPmtd1Eta, meETLTPmtd1NoAssocEtaMatchEff_); + + meETLTPmtd1NoAssocPtMatchEff_ = ibook.book1D("ETLTPmtd1NoAssocPtMatchEff", + "Track efficiency TP-mtd hit (>=1 sim hit), no reco match VS Pt", + meETLTrackMatchedTPmtd1Pt->getNbinsX(), + meETLTrackMatchedTPmtd1Pt->getTH1()->GetXaxis()->GetXmin(), + meETLTrackMatchedTPmtd1Pt->getTH1()->GetXaxis()->GetXmax()); + meETLTPmtd1NoAssocPtMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackMatchedTPmtd1NoAssocPt, meETLTrackMatchedTPmtd1Pt, meETLTPmtd1NoAssocPtMatchEff_); + + meETLTPmtd2CorrectAssocEtaMatchEff_ = + ibook.book1D("ETLTPmtd2CorrectAssocEtaMatchEff", + "Track efficiency TP-mtd hit (2 sim hits), correct reco match VS Eta", + meETLTrackMatchedTPmtd2Eta->getNbinsX(), + meETLTrackMatchedTPmtd2Eta->getTH1()->GetXaxis()->GetXmin(), + meETLTrackMatchedTPmtd2Eta->getTH1()->GetXaxis()->GetXmax()); + meETLTPmtd2CorrectAssocEtaMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D( + meETLTrackMatchedTPmtd2CorrectAssocEta, meETLTrackMatchedTPmtd2Eta, meETLTPmtd2CorrectAssocEtaMatchEff_); + + meETLTPmtd2CorrectAssocPtMatchEff_ = + ibook.book1D("ETLTPmtd2CorrectAssocPtMatchEff", + "Track efficiency TP-mtd hit (2 sim hits), correct reco match VS Pt", + meETLTrackMatchedTPmtd2Pt->getNbinsX(), + meETLTrackMatchedTPmtd2Pt->getTH1()->GetXaxis()->GetXmin(), + meETLTrackMatchedTPmtd2Pt->getTH1()->GetXaxis()->GetXmax()); + meETLTPmtd2CorrectAssocPtMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D( + meETLTrackMatchedTPmtd2CorrectAssocPt, meETLTrackMatchedTPmtd2Pt, meETLTPmtd2CorrectAssocPtMatchEff_); + + meETLTPmtd2WrongAssocEtaMatchEff_ = + ibook.book1D("ETLTPmtd2WrongAssocEtaMatchEff", + "Track efficiency TP-mtd hit (2 sim hits), incorrect reco match VS Eta", + meETLTrackMatchedTPmtd2Eta->getNbinsX(), + meETLTrackMatchedTPmtd2Eta->getTH1()->GetXaxis()->GetXmin(), + meETLTrackMatchedTPmtd2Eta->getTH1()->GetXaxis()->GetXmax()); + meETLTPmtd2WrongAssocEtaMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D( + meETLTrackMatchedTPmtd2WrongAssocEta, meETLTrackMatchedTPmtd2Eta, meETLTPmtd2WrongAssocEtaMatchEff_); + + meETLTPmtd2WrongAssocPtMatchEff_ = + ibook.book1D("ETLTPmtd2WrongAssocPtMatchEff", + "Track efficiency TP-mtd hit (2 sim hits), incorrect reco match VS Pt", + meETLTrackMatchedTPmtd2Pt->getNbinsX(), + meETLTrackMatchedTPmtd2Pt->getTH1()->GetXaxis()->GetXmin(), + meETLTrackMatchedTPmtd2Pt->getTH1()->GetXaxis()->GetXmax()); + meETLTPmtd2WrongAssocPtMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackMatchedTPmtd2WrongAssocPt, meETLTrackMatchedTPmtd2Pt, meETLTPmtd2WrongAssocPtMatchEff_); + + meETLTPmtd2NoAssocEtaMatchEff_ = ibook.book1D("ETLTPmtd2NoAssocEtaMatchEff", + "Track efficiency TP-mtd hit (2 sim hits), no reco match VS Eta", + meETLTrackMatchedTPmtd2Eta->getNbinsX(), + meETLTrackMatchedTPmtd2Eta->getTH1()->GetXaxis()->GetXmin(), + meETLTrackMatchedTPmtd2Eta->getTH1()->GetXaxis()->GetXmax()); + meETLTPmtd2NoAssocEtaMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackMatchedTPmtd2NoAssocEta, meETLTrackMatchedTPmtd2Eta, meETLTPmtd2NoAssocEtaMatchEff_); + + meETLTPmtd2NoAssocPtMatchEff_ = ibook.book1D("ETLTPmtd2NoAssocPtMatchEff", + "Track efficiency TP-mtd hit (2 sim hits), no reco match VS Pt", + meETLTrackMatchedTPmtd2Pt->getNbinsX(), + meETLTrackMatchedTPmtd2Pt->getTH1()->GetXaxis()->GetXmin(), + meETLTrackMatchedTPmtd2Pt->getTH1()->GetXaxis()->GetXmax()); + meETLTPmtd2NoAssocPtMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackMatchedTPmtd2NoAssocPt, meETLTrackMatchedTPmtd2Pt, meETLTPmtd2NoAssocPtMatchEff_); + + meETLTPnomtdEtaMatchEff_ = ibook.book1D("ETLTPnomtdEtaMatchEff", + "Track efficiency TP- no mtd hit, with reco match VS Eta", + meETLTrackMatchedTPnomtdEta->getNbinsX(), + meETLTrackMatchedTPnomtdEta->getTH1()->GetXaxis()->GetXmin(), + meETLTrackMatchedTPnomtdEta->getTH1()->GetXaxis()->GetXmax()); + meETLTPnomtdEtaMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackMatchedTPnomtdAssocEta, meETLTrackMatchedTPnomtdEta, meETLTPnomtdEtaMatchEff_); + + meETLTPnomtdPtMatchEff_ = ibook.book1D("ETLTPnomtdPtMatchEff", + "Track efficiency TP- no mtd hit, with reco match VS Pt", + meETLTrackMatchedTPnomtdPt->getNbinsX(), + meETLTrackMatchedTPnomtdPt->getTH1()->GetXaxis()->GetXmin(), + meETLTrackMatchedTPnomtdPt->getTH1()->GetXaxis()->GetXmax()); + meETLTPnomtdPtMatchEff_->getTH1()->SetMinimum(0.); + computeEfficiency1D(meETLTrackMatchedTPnomtdAssocPt, meETLTrackMatchedTPnomtdPt, meETLTPnomtdPtMatchEff_); meNoTimeFraction_ = ibook.book1D("NoTimeFraction", "Fraction of tracks with MTD hits and no time associated; Num. of hits", @@ -448,15 +886,15 @@ void MtdTracksHarvester::dqmEndJob(DQMStore::IBooker& ibook, DQMStore::IGetter& meBtlEtaEff_->getTH1()->SetMinimum(0.); meBtlPhiEff_->getTH1()->SetMinimum(0.); meBtlPtEff_->getTH1()->SetMinimum(0.); + meEtlEtaEff_->getTH1()->SetMinimum(0.); + meEtlPhiEff_->getTH1()->SetMinimum(0.); + meEtlPtEff_->getTH1()->SetMinimum(0.); + meEtlEtaEff2_->getTH1()->SetMinimum(0.); + meEtlPhiEff2_->getTH1()->SetMinimum(0.); + meEtlPtEff2_->getTH1()->SetMinimum(0.); for (int i = 0; i < 2; i++) { - meEtlEtaEff_[i]->getTH1()->SetMinimum(0.); meEtlEtaEffLowPt_[i]->getTH1()->SetMinimum(0.); - meEtlPhiEff_[i]->getTH1()->SetMinimum(0.); - meEtlPtEff_[i]->getTH1()->SetMinimum(0.); - meEtlEtaEff2_[i]->getTH1()->SetMinimum(0.); meEtlEtaEff2LowPt_[i]->getTH1()->SetMinimum(0.); - meEtlPhiEff2_[i]->getTH1()->SetMinimum(0.); - meEtlPtEff2_[i]->getTH1()->SetMinimum(0.); } meExtraPhiAtBTLEff_ = ibook.book1D("ExtraPhiAtBTLEff", @@ -472,20 +910,20 @@ void MtdTracksHarvester::dqmEndJob(DQMStore::IBooker& ibook, DQMStore::IGetter& meExtraMTDfailExtenderEtaEff_ = ibook.book1D("ExtraMTDfailExtenderEtaEff", "Track associated to LV extrapolated at MTD surface no extender efficiency VS Eta;Eta;Efficiency", - meTrackMatchedTPEffEtaTotLV->getNbinsX(), - meTrackMatchedTPEffEtaTotLV->getTH1()->GetXaxis()->GetXmin(), - meTrackMatchedTPEffEtaTotLV->getTH1()->GetXaxis()->GetXmax()); + meTrackMatchedTPEtaTotLV->getNbinsX(), + meTrackMatchedTPEtaTotLV->getTH1()->GetXaxis()->GetXmin(), + meTrackMatchedTPEtaTotLV->getTH1()->GetXaxis()->GetXmax()); meExtraMTDfailExtenderEtaEff_->getTH1()->SetMinimum(0.); - computeEfficiency1D(meExtraMTDfailExtenderEta, meTrackMatchedTPEffEtaTotLV, meExtraMTDfailExtenderEtaEff_); + computeEfficiency1D(meExtraMTDfailExtenderEta, meTrackMatchedTPEtaTotLV, meExtraMTDfailExtenderEtaEff_); meExtraMTDfailExtenderPtEff_ = ibook.book1D( "ExtraMTDfailExtenderPtEff", "Track associated to LV extrapolated at MTD surface no extender efficiency VS Pt;Pt [GeV];Efficiency", - meTrackMatchedTPEffPtTotLV->getNbinsX(), - meTrackMatchedTPEffPtTotLV->getTH1()->GetXaxis()->GetXmin(), - meTrackMatchedTPEffPtTotLV->getTH1()->GetXaxis()->GetXmax()); + meTrackMatchedTPPtTotLV->getNbinsX(), + meTrackMatchedTPPtTotLV->getTH1()->GetXaxis()->GetXmin(), + meTrackMatchedTPPtTotLV->getTH1()->GetXaxis()->GetXmax()); meExtraMTDfailExtenderPtEff_->getTH1()->SetMinimum(0.); - computeEfficiency1D(meExtraMTDfailExtenderPt, meTrackMatchedTPEffPtTotLV, meExtraMTDfailExtenderPtEff_); + computeEfficiency1D(meExtraMTDfailExtenderPt, meTrackMatchedTPPtTotLV, meExtraMTDfailExtenderPtEff_); } // ------------ method fills 'descriptions' with the allowed parameters for the module ---------- diff --git a/Validation/MtdValidation/plugins/MtdTracksValidation.cc b/Validation/MtdValidation/plugins/MtdTracksValidation.cc index 2bc29d47fccdd..5ea8cf8fa7611 100644 --- a/Validation/MtdValidation/plugins/MtdTracksValidation.cc +++ b/Validation/MtdValidation/plugins/MtdTracksValidation.cc @@ -54,6 +54,8 @@ #include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementError.h" #include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementPoint.h" #include "DataFormats/FTLRecHit/interface/FTLRecHitCollections.h" +#include "DataFormats/FTLRecHit/interface/FTLClusterCollections.h" +#include "DataFormats/TrackerRecHit2D/interface/MTDTrackingRecHit.h" #include "DataFormats/Common/interface/OneToMany.h" #include "DataFormats/Common/interface/AssociationMap.h" @@ -64,6 +66,9 @@ #include "SimDataFormats/CrossingFrame/interface/MixCollection.h" #include "SimDataFormats/TrackingHit/interface/PSimHit.h" #include "SimDataFormats/Associations/interface/MtdSimLayerClusterToTPAssociatorBaseImpl.h" +#include "SimDataFormats/CaloAnalysis/interface/MtdSimLayerCluster.h" +#include "SimDataFormats/Associations/interface/MtdRecoClusterToSimLayerClusterAssociationMap.h" +#include "SimDataFormats/Associations/interface/MtdSimLayerClusterToRecoClusterAssociationMap.h" #include "CLHEP/Units/PhysicalConstants.h" #include "MTDHit.h" @@ -101,9 +106,22 @@ class MtdTracksValidation : public DQMEDAnalyzer { bool isETL(const double eta) const { return (std::abs(eta) > trackMinEtlEta_) && (std::abs(eta) < trackMaxEtlEta_); } + void fillTrackClusterMatchingHistograms(MonitorElement* me1, + MonitorElement* me2, + MonitorElement* me3, + MonitorElement* me4, + MonitorElement* me5, + float var1, + float var2, + float var3, + float var4, + float var5, + bool flag); + // ------------ member data ------------ const std::string folder_; + const bool optionalPlots_; const float trackMaxPt_; const float trackMaxBtlEta_; const float trackMinEtlEta_; @@ -122,7 +140,6 @@ class MtdTracksValidation : public DQMEDAnalyzer { static constexpr double cluDRradius_ = 0.05; // to cluster rechits around extrapolated track const reco::RecoToSimCollection* r2s_; - const reco::SimToRecoCollection* s2r_; edm::EDGetTokenT GenRecTrackToken_; edm::EDGetTokenT RecTrackToken_; @@ -131,8 +148,12 @@ class MtdTracksValidation : public DQMEDAnalyzer { edm::EDGetTokenT simToRecoAssociationToken_; edm::EDGetTokenT recoToSimAssociationToken_; edm::EDGetTokenT tp2SimAssociationMapToken_; + edm::EDGetTokenT r2sAssociationMapToken_; + edm::EDGetTokenT btlRecHitsToken_; edm::EDGetTokenT etlRecHitsToken_; + edm::EDGetTokenT btlRecCluToken_; + edm::EDGetTokenT etlRecCluToken_; edm::EDGetTokenT> trackAssocToken_; edm::EDGetTokenT> pathLengthToken_; @@ -158,29 +179,41 @@ class MtdTracksValidation : public DQMEDAnalyzer { edm::ESGetToken builderToken_; MonitorElement* meBTLTrackRPTime_; - MonitorElement* meBTLTrackEffEtaTot_; - MonitorElement* meBTLTrackEffPhiTot_; - MonitorElement* meBTLTrackEffPtTot_; - MonitorElement* meBTLTrackEffEtaMtd_; - MonitorElement* meBTLTrackEffPhiMtd_; - MonitorElement* meBTLTrackEffPtMtd_; + MonitorElement* meBTLTrackEtaTot_; + MonitorElement* meBTLTrackPhiTot_; + MonitorElement* meBTLTrackPtTot_; + MonitorElement* meBTLTrackEtaMtd_; + MonitorElement* meBTLTrackPhiMtd_; + MonitorElement* meBTLTrackPtMtd_; MonitorElement* meBTLTrackPtRes_; MonitorElement* meETLTrackRPTime_; - MonitorElement* meETLTrackEffEtaTot_[2]; - MonitorElement* meETLTrackEffEtaTotLowPt_[2]; - MonitorElement* meETLTrackEffPhiTot_[2]; - MonitorElement* meETLTrackEffPtTot_[2]; - MonitorElement* meETLTrackEffEtaMtd_[2]; - MonitorElement* meETLTrackEffEtaMtdLowPt_[2]; - MonitorElement* meETLTrackEffEta2MtdLowPt_[2]; - MonitorElement* meETLTrackEffPhiMtd_[2]; - MonitorElement* meETLTrackEffPtMtd_[2]; - MonitorElement* meETLTrackEffEta2Mtd_[2]; - MonitorElement* meETLTrackEffPhi2Mtd_[2]; - MonitorElement* meETLTrackEffPt2Mtd_[2]; + MonitorElement* meETLTrackEtaTot_; + MonitorElement* meETLTrackPhiTot_; + MonitorElement* meETLTrackPtTot_; + MonitorElement* meETLTrackEtaMtd_; + MonitorElement* meETLTrackPhiMtd_; + MonitorElement* meETLTrackPtMtd_; + MonitorElement* meETLTrackEta2Mtd_; + MonitorElement* meETLTrackPhi2Mtd_; + MonitorElement* meETLTrackPt2Mtd_; MonitorElement* meETLTrackPtRes_; + MonitorElement* meETLTrackEtaTotLowPt_[2]; + MonitorElement* meETLTrackEtaMtdLowPt_[2]; + MonitorElement* meETLTrackEta2MtdLowPt_[2]; + + MonitorElement* meBTLTrackMatchedTPEtaTot_; + MonitorElement* meBTLTrackMatchedTPPtTot_; + MonitorElement* meBTLTrackMatchedTPEtaMtd_; + MonitorElement* meBTLTrackMatchedTPPtMtd_; + MonitorElement* meETLTrackMatchedTPEtaTot_; + MonitorElement* meETLTrackMatchedTPPtTot_; + MonitorElement* meETLTrackMatchedTPEtaMtd_; + MonitorElement* meETLTrackMatchedTPPtMtd_; + MonitorElement* meETLTrackMatchedTPEta2Mtd_; + MonitorElement* meETLTrackMatchedTPPt2Mtd_; + MonitorElement* meTracktmtd_; MonitorElement* meTrackt0Src_; MonitorElement* meTrackSigmat0Src_; @@ -198,10 +231,6 @@ class MtdTracksValidation : public DQMEDAnalyzer { MonitorElement* meTrackSigmaTof_[3]; MonitorElement* meTrackSigmaTofvsP_[3]; - MonitorElement* meTrackPtTot_; - MonitorElement* meExtraPtMtd_; - MonitorElement* meExtraPtEtl2Mtd_; - MonitorElement* meBTLTrackMatchedTPPtResMtd_; MonitorElement* meETLTrackMatchedTPPtResMtd_; MonitorElement* meETLTrackMatchedTP2PtResMtd_; @@ -221,36 +250,131 @@ class MtdTracksValidation : public DQMEDAnalyzer { MonitorElement* meETLTrackMatchedTPDPtvsPtMtd_; MonitorElement* meETLTrackMatchedTP2DPtvsPtMtd_; - MonitorElement* meTrackMatchedTPEffPtTot_; - MonitorElement* meTrackMatchedTPEffPtTotLV_; - MonitorElement* meTrackMatchedTPEffPtMtd_; - MonitorElement* meTrackMatchedTPEffPtEtl2Mtd_; - MonitorElement* meTrackMatchedTPmtdEffPtTot_; - MonitorElement* meTrackMatchedTPmtdEffPtMtd_; - MonitorElement* meTrackEtaTot_; - MonitorElement* meExtraEtaMtd_; - MonitorElement* meExtraEtaEtl2Mtd_; - MonitorElement* meTrackMatchedTPEffEtaTot_; - MonitorElement* meTrackMatchedTPEffEtaTotLV_; - MonitorElement* meTrackMatchedTPEffEtaMtd_; - MonitorElement* meTrackMatchedTPEffEtaEtl2Mtd_; - MonitorElement* meTrackMatchedTPmtdEffEtaTot_; - MonitorElement* meTrackMatchedTPmtdEffEtaMtd_; MonitorElement* meTrackResTot_; MonitorElement* meTrackPullTot_; MonitorElement* meTrackResTotvsMVAQual_; MonitorElement* meTrackPullTotvsMVAQual_; + MonitorElement* meTrackMatchedTPPtTotLV_; + MonitorElement* meTrackMatchedTPEtaTotLV_; + MonitorElement* meExtraPtMtd_; + MonitorElement* meExtraPtEtl2Mtd_; + MonitorElement* meExtraEtaMtd_; + MonitorElement* meExtraEtaEtl2Mtd_; MonitorElement* meExtraPhiAtBTL_; MonitorElement* meExtraPhiAtBTLmatched_; MonitorElement* meExtraBTLeneInCone_; MonitorElement* meExtraMTDfailExtenderEta_; MonitorElement* meExtraMTDfailExtenderPt_; + + // ====== Trak-cluster matching based on MC truth + // - BTL TPmtd Direct, TPmtd Other, TPnomtd + MonitorElement* meBTLTrackMatchedTPmtdDirectEta_; + MonitorElement* meBTLTrackMatchedTPmtdDirectPt_; + + MonitorElement* meBTLTrackMatchedTPmtdOtherEta_; + MonitorElement* meBTLTrackMatchedTPmtdOtherPt_; + + MonitorElement* meBTLTrackMatchedTPnomtdEta_; + MonitorElement* meBTLTrackMatchedTPnomtdPt_; + + // - BTL TPmtd Direct hits: correct, wrong, missing association in MTD + MonitorElement* meBTLTrackMatchedTPmtdDirectCorrectAssocEta_; + MonitorElement* meBTLTrackMatchedTPmtdDirectCorrectAssocPt_; + MonitorElement* meBTLTrackMatchedTPmtdDirectCorrectAssocMVAQual_; + MonitorElement* meBTLTrackMatchedTPmtdDirectCorrectAssocTimeRes_; + MonitorElement* meBTLTrackMatchedTPmtdDirectCorrectAssocTimePull_; + + MonitorElement* meBTLTrackMatchedTPmtdDirectWrongAssocEta_; + MonitorElement* meBTLTrackMatchedTPmtdDirectWrongAssocPt_; + MonitorElement* meBTLTrackMatchedTPmtdDirectWrongAssocMVAQual_; + MonitorElement* meBTLTrackMatchedTPmtdDirectWrongAssocTimeRes_; + MonitorElement* meBTLTrackMatchedTPmtdDirectWrongAssocTimePull_; + + MonitorElement* meBTLTrackMatchedTPmtdDirectNoAssocEta_; + MonitorElement* meBTLTrackMatchedTPmtdDirectNoAssocPt_; + + // - BTL TPmtd "other" hits: correct, wrong, missing association in MTD + MonitorElement* meBTLTrackMatchedTPmtdOtherCorrectAssocEta_; + MonitorElement* meBTLTrackMatchedTPmtdOtherCorrectAssocPt_; + MonitorElement* meBTLTrackMatchedTPmtdOtherCorrectAssocMVAQual_; + MonitorElement* meBTLTrackMatchedTPmtdOtherCorrectAssocTimeRes_; + MonitorElement* meBTLTrackMatchedTPmtdOtherCorrectAssocTimePull_; + + MonitorElement* meBTLTrackMatchedTPmtdOtherWrongAssocEta_; + MonitorElement* meBTLTrackMatchedTPmtdOtherWrongAssocPt_; + MonitorElement* meBTLTrackMatchedTPmtdOtherWrongAssocMVAQual_; + MonitorElement* meBTLTrackMatchedTPmtdOtherWrongAssocTimeRes_; + MonitorElement* meBTLTrackMatchedTPmtdOtherWrongAssocTimePull_; + + MonitorElement* meBTLTrackMatchedTPmtdOtherNoAssocEta_; + MonitorElement* meBTLTrackMatchedTPmtdOtherNoAssocPt_; + + // - BTL TPnomtd but a reco cluster is associated + MonitorElement* meBTLTrackMatchedTPnomtdAssocEta_; + MonitorElement* meBTLTrackMatchedTPnomtdAssocPt_; + MonitorElement* meBTLTrackMatchedTPnomtdAssocMVAQual_; + MonitorElement* meBTLTrackMatchedTPnomtdAssocTimeRes_; + MonitorElement* meBTLTrackMatchedTPnomtdAssocTimePull_; + + // - ETL: one, two o no sim hits + MonitorElement* meETLTrackMatchedTPmtd1Eta_; // -- sim hit in >=1 etl disk + MonitorElement* meETLTrackMatchedTPmtd1Pt_; + MonitorElement* meETLTrackMatchedTPmtd2Eta_; // -- sim hits in 2 etl disks + MonitorElement* meETLTrackMatchedTPmtd2Pt_; + MonitorElement* meETLTrackMatchedTPnomtdEta_; // -- no sim hits in etl + MonitorElement* meETLTrackMatchedTPnomtdPt_; + + // - ETL >=1 sim hit: each correct, at least one wrong, each sim hit missing reco association + MonitorElement* meETLTrackMatchedTPmtd1CorrectAssocEta_; + MonitorElement* meETLTrackMatchedTPmtd1CorrectAssocPt_; + MonitorElement* meETLTrackMatchedTPmtd1CorrectAssocMVAQual_; + MonitorElement* meETLTrackMatchedTPmtd1CorrectAssocTimeRes_; + MonitorElement* meETLTrackMatchedTPmtd1CorrectAssocTimePull_; + + MonitorElement* meETLTrackMatchedTPmtd1WrongAssocEta_; + MonitorElement* meETLTrackMatchedTPmtd1WrongAssocPt_; + MonitorElement* meETLTrackMatchedTPmtd1WrongAssocMVAQual_; + MonitorElement* meETLTrackMatchedTPmtd1WrongAssocTimeRes_; + MonitorElement* meETLTrackMatchedTPmtd1WrongAssocTimePull_; + + MonitorElement* meETLTrackMatchedTPmtd1NoAssocEta_; + MonitorElement* meETLTrackMatchedTPmtd1NoAssocPt_; + MonitorElement* meETLTrackMatchedTPmtd1NoAssocMVAQual_; + MonitorElement* meETLTrackMatchedTPmtd1NoAssocTimeRes_; + MonitorElement* meETLTrackMatchedTPmtd1NoAssocTimePull_; + + // - ETL - 2 sim hits: both correct, at least one wrong or one missing, both missing reco association + MonitorElement* meETLTrackMatchedTPmtd2CorrectAssocEta_; + MonitorElement* meETLTrackMatchedTPmtd2CorrectAssocPt_; + MonitorElement* meETLTrackMatchedTPmtd2CorrectAssocMVAQual_; + MonitorElement* meETLTrackMatchedTPmtd2CorrectAssocTimeRes_; + MonitorElement* meETLTrackMatchedTPmtd2CorrectAssocTimePull_; + + MonitorElement* meETLTrackMatchedTPmtd2WrongAssocEta_; + MonitorElement* meETLTrackMatchedTPmtd2WrongAssocPt_; + MonitorElement* meETLTrackMatchedTPmtd2WrongAssocMVAQual_; + MonitorElement* meETLTrackMatchedTPmtd2WrongAssocTimeRes_; + MonitorElement* meETLTrackMatchedTPmtd2WrongAssocTimePull_; + + MonitorElement* meETLTrackMatchedTPmtd2NoAssocEta_; + MonitorElement* meETLTrackMatchedTPmtd2NoAssocPt_; + MonitorElement* meETLTrackMatchedTPmtd2NoAssocMVAQual_; + MonitorElement* meETLTrackMatchedTPmtd2NoAssocTimeRes_; + MonitorElement* meETLTrackMatchedTPmtd2NoAssocTimePull_; + + // - ETL - no sim hits, but reco hit associated to the track + MonitorElement* meETLTrackMatchedTPnomtdAssocEta_; + MonitorElement* meETLTrackMatchedTPnomtdAssocPt_; + MonitorElement* meETLTrackMatchedTPnomtdAssocMVAQual_; + MonitorElement* meETLTrackMatchedTPnomtdAssocTimeRes_; + MonitorElement* meETLTrackMatchedTPnomtdAssocTimePull_; }; // ------------ constructor and destructor -------------- MtdTracksValidation::MtdTracksValidation(const edm::ParameterSet& iConfig) : folder_(iConfig.getParameter("folder")), + optionalPlots_(iConfig.getParameter("optionalPlots")), trackMaxPt_(iConfig.getParameter("trackMaximumPt")), trackMaxBtlEta_(iConfig.getParameter("trackMaximumBtlEta")), trackMinEtlEta_(iConfig.getParameter("trackMinimumEtlEta")), @@ -265,8 +389,12 @@ MtdTracksValidation::MtdTracksValidation(const edm::ParameterSet& iConfig) consumes(iConfig.getParameter("TPtoRecoTrackAssoc")); tp2SimAssociationMapToken_ = consumes(iConfig.getParameter("tp2SimAssociationMapTag")); + r2sAssociationMapToken_ = consumes( + iConfig.getParameter("r2sAssociationMapTag")); btlRecHitsToken_ = consumes(iConfig.getParameter("btlRecHits")); etlRecHitsToken_ = consumes(iConfig.getParameter("etlRecHits")); + btlRecCluToken_ = consumes(iConfig.getParameter("recCluTagBTL")); + etlRecCluToken_ = consumes(iConfig.getParameter("recCluTagETL")); trackAssocToken_ = consumes>(iConfig.getParameter("trackAssocSrc")); pathLengthToken_ = consumes>(iConfig.getParameter("pathLengthSrc")); tmtdToken_ = consumes>(iConfig.getParameter("tmtd")); @@ -300,11 +428,15 @@ void MtdTracksValidation::analyze(const edm::Event& iEvent, const edm::EventSetu auto GenRecTrackHandle = makeValid(iEvent.getHandle(GenRecTrackToken_)); + auto btlRecCluHandle = makeValid(iEvent.getHandle(btlRecCluToken_)); + auto etlRecCluHandle = makeValid(iEvent.getHandle(etlRecCluToken_)); + std::unordered_map m_btlHits; std::unordered_map m_etlHits; std::unordered_map> m_btlTrkPerCell; std::unordered_map> m_etlTrkPerCell; const auto& tp2SimAssociationMap = iEvent.get(tp2SimAssociationMapToken_); + const auto& r2sAssociationMap = iEvent.get(r2sAssociationMapToken_); const auto& tMtd = iEvent.get(tmtdToken_); const auto& SigmatMtd = iEvent.get(SigmatmtdToken_); @@ -322,9 +454,6 @@ void MtdTracksValidation::analyze(const edm::Event& iEvent, const edm::EventSetu const auto& pathLength = iEvent.get(pathLengthToken_); const auto& outermostHitPosition = iEvent.get(outermostHitPositionToken_); - auto simToRecoH = makeValid(iEvent.getHandle(simToRecoAssociationToken_)); - s2r_ = simToRecoH.product(); - auto recoToSimH = makeValid(iEvent.getHandle(recoToSimAssociationToken_)); r2s_ = recoToSimH.product(); @@ -345,6 +474,8 @@ void MtdTracksValidation::analyze(const edm::Event& iEvent, const edm::EventSetu bool isBTL = false; bool isETL = false; + bool ETLdisc1 = false; + bool ETLdisc2 = false; bool twoETLdiscs = false; bool noCrack = std::abs(trackGen.eta()) < trackMaxBtlEta_ || std::abs(trackGen.eta()) > trackMinEtlEta_; @@ -373,12 +504,17 @@ void MtdTracksValidation::analyze(const edm::Event& iEvent, const edm::EventSetu meTrackSigmaTofvsP_[2]->Fill(trackGen.p(), SigmaTofP[trackref] * 1e3); meTrackPathLenghtvsEta_->Fill(std::abs(trackGen.eta()), pathLength[trackref]); + bool MTDEtlZnegD1 = false; + bool MTDEtlZnegD2 = false; + bool MTDEtlZposD1 = false; + bool MTDEtlZposD2 = false; + std::vector, FTLCluster>> recoClustersRefs; if (std::abs(trackGen.eta()) < trackMaxBtlEta_) { // --- all BTL tracks (with and without hit in MTD) --- - meBTLTrackEffEtaTot_->Fill(trackGen.eta()); - meBTLTrackEffPhiTot_->Fill(trackGen.phi()); - meBTLTrackEffPtTot_->Fill(trackGen.pt()); + meBTLTrackEtaTot_->Fill(std::abs(trackGen.eta())); + meBTLTrackPhiTot_->Fill(trackGen.phi()); + meBTLTrackPtTot_->Fill(trackGen.pt()); bool MTDBtl = false; int numMTDBtlvalidhits = 0; @@ -389,6 +525,12 @@ void MtdTracksValidation::analyze(const edm::Event& iEvent, const edm::EventSetu if ((Hit.det() == 6) && (Hit.subdetId() == 1) && (Hit.mtdSubDetector() == 1)) { MTDBtl = true; numMTDBtlvalidhits++; + const auto* mtdhit = static_cast(hit); + const auto& hitCluster = mtdhit->mtdCluster(); + if (hitCluster.size() != 0) { + auto recoClusterRef = edmNew::makeRefTo(btlRecCluHandle, &hitCluster); + recoClustersRefs.push_back(recoClusterRef); + } } } meTrackNumHits_->Fill(numMTDBtlvalidhits); @@ -396,9 +538,9 @@ void MtdTracksValidation::analyze(const edm::Event& iEvent, const edm::EventSetu // --- keeping only tracks with last hit in MTD --- if (MTDBtl == true) { isBTL = true; - meBTLTrackEffEtaMtd_->Fill(trackGen.eta()); - meBTLTrackEffPhiMtd_->Fill(trackGen.phi()); - meBTLTrackEffPtMtd_->Fill(trackGen.pt()); + meBTLTrackEtaMtd_->Fill(std::abs(trackGen.eta())); + meBTLTrackPhiMtd_->Fill(trackGen.phi()); + meBTLTrackPtMtd_->Fill(trackGen.pt()); meBTLTrackRPTime_->Fill(track.t0()); meBTLTrackPtRes_->Fill((trackGen.pt() - track.pt()) / trackGen.pt()); } @@ -409,22 +551,10 @@ void MtdTracksValidation::analyze(const edm::Event& iEvent, const edm::EventSetu else { // --- all ETL tracks (with and without hit in MTD) --- - if ((trackGen.eta() < -trackMinEtlEta_) && (trackGen.eta() > -trackMaxEtlEta_)) { - meETLTrackEffEtaTot_[0]->Fill(trackGen.eta()); - meETLTrackEffPhiTot_[0]->Fill(trackGen.phi()); - meETLTrackEffPtTot_[0]->Fill(trackGen.pt()); - } + meETLTrackEtaTot_->Fill(std::abs(trackGen.eta())); + meETLTrackPhiTot_->Fill(trackGen.phi()); + meETLTrackPtTot_->Fill(trackGen.pt()); - if ((trackGen.eta() > trackMinEtlEta_) && (trackGen.eta() < trackMaxEtlEta_)) { - meETLTrackEffEtaTot_[1]->Fill(trackGen.eta()); - meETLTrackEffPhiTot_[1]->Fill(trackGen.phi()); - meETLTrackEffPtTot_[1]->Fill(trackGen.pt()); - } - - bool MTDEtlZnegD1 = false; - bool MTDEtlZnegD2 = false; - bool MTDEtlZposD1 = false; - bool MTDEtlZposD2 = false; int numMTDEtlvalidhits = 0; for (const auto hit : track.recHits()) { if (hit->isValid() == false) @@ -434,6 +564,13 @@ void MtdTracksValidation::analyze(const edm::Event& iEvent, const edm::EventSetu isETL = true; ETLDetId ETLHit = hit->geographicalId(); + const auto* mtdhit = static_cast(hit); + const auto& hitCluster = mtdhit->mtdCluster(); + if (hitCluster.size() != 0) { + auto recoClusterRef = edmNew::makeRefTo(etlRecCluHandle, &hitCluster); + recoClustersRefs.push_back(recoClusterRef); + } + if ((ETLHit.zside() == -1) && (ETLHit.nDisc() == 1)) { MTDEtlZnegD1 = true; meETLTrackRPTime_->Fill(track.t0()); @@ -466,30 +603,18 @@ void MtdTracksValidation::analyze(const edm::Event& iEvent, const edm::EventSetu } // --- keeping only tracks with last hit in MTD --- - if ((trackGen.eta() < -trackMinEtlEta_) && (trackGen.eta() > -trackMaxEtlEta_)) { - twoETLdiscs = (MTDEtlZnegD1 == true) && (MTDEtlZnegD2 == true); - if ((MTDEtlZnegD1 == true) || (MTDEtlZnegD2 == true)) { - meETLTrackEffEtaMtd_[0]->Fill(trackGen.eta()); - meETLTrackEffPhiMtd_[0]->Fill(trackGen.phi()); - meETLTrackEffPtMtd_[0]->Fill(trackGen.pt()); - if (twoETLdiscs) { - meETLTrackEffEta2Mtd_[0]->Fill(trackGen.eta()); - meETLTrackEffPhi2Mtd_[0]->Fill(trackGen.phi()); - meETLTrackEffPt2Mtd_[0]->Fill(trackGen.pt()); - } - } - } - if ((trackGen.eta() > trackMinEtlEta_) && (trackGen.eta() < trackMaxEtlEta_)) { - twoETLdiscs = (MTDEtlZposD1 == true) && (MTDEtlZposD2 == true); - if ((MTDEtlZposD1 == true) || (MTDEtlZposD2 == true)) { - meETLTrackEffEtaMtd_[1]->Fill(trackGen.eta()); - meETLTrackEffPhiMtd_[1]->Fill(trackGen.phi()); - meETLTrackEffPtMtd_[1]->Fill(trackGen.pt()); - if (twoETLdiscs) { - meETLTrackEffEta2Mtd_[1]->Fill(trackGen.eta()); - meETLTrackEffPhi2Mtd_[1]->Fill(trackGen.phi()); - meETLTrackEffPt2Mtd_[1]->Fill(trackGen.pt()); - } + ETLdisc1 = (MTDEtlZnegD1 || MTDEtlZposD1); + ETLdisc2 = (MTDEtlZnegD2 || MTDEtlZposD2); + twoETLdiscs = + ((MTDEtlZnegD1 == true) && (MTDEtlZnegD2 == true)) || ((MTDEtlZposD1 == true) && (MTDEtlZposD2 == true)); + if (ETLdisc1 || ETLdisc2) { + meETLTrackEtaMtd_->Fill(std::abs(trackGen.eta())); + meETLTrackPhiMtd_->Fill(trackGen.phi()); + meETLTrackPtMtd_->Fill(trackGen.pt()); + if (twoETLdiscs) { + meETLTrackEta2Mtd_->Fill(std::abs(trackGen.eta())); + meETLTrackPhi2Mtd_->Fill(trackGen.phi()); + meETLTrackPt2Mtd_->Fill(trackGen.pt()); } } } @@ -503,90 +628,394 @@ void MtdTracksValidation::analyze(const edm::Event& iEvent, const edm::EventSetu << trackGen.eta() << " BTL " << isBTL << " ETL " << isETL << " 2disks " << twoETLdiscs; - // TrackingParticle based matching - + // == TrackingParticle based matching const reco::TrackBaseRef trkrefb(trackref); auto tp_info = getMatchedTP(trkrefb); - - meTrackPtTot_->Fill(trackGen.pt()); - meTrackEtaTot_->Fill(std::abs(trackGen.eta())); if (tp_info != nullptr && trkTPSelAll(**tp_info)) { - if (trackGen.pt() < trackMaxPt_) { - if (isBTL) { - meBTLTrackMatchedTPPtResMtd_->Fill(std::abs(track.pt() - (*tp_info)->pt()) / - std::abs(trackGen.pt() - (*tp_info)->pt())); - meBTLTrackMatchedTPPtRatioGen_->Fill(trackGen.pt() / (*tp_info)->pt()); - meBTLTrackMatchedTPPtRatioMtd_->Fill(track.pt() / (*tp_info)->pt()); - meBTLTrackMatchedTPPtResvsPtMtd_->Fill( - (*tp_info)->pt(), std::abs(track.pt() - (*tp_info)->pt()) / std::abs(trackGen.pt() - (*tp_info)->pt())); - meBTLTrackMatchedTPDPtvsPtGen_->Fill((*tp_info)->pt(), - (trackGen.pt() - (*tp_info)->pt()) / (*tp_info)->pt()); - meBTLTrackMatchedTPDPtvsPtMtd_->Fill((*tp_info)->pt(), (track.pt() - (*tp_info)->pt()) / (*tp_info)->pt()); + // -- pT resolution plots + if (optionalPlots_) { + if (trackGen.pt() < trackMaxPt_) { + if (isBTL) { + meBTLTrackMatchedTPPtResMtd_->Fill(std::abs(track.pt() - (*tp_info)->pt()) / + std::abs(trackGen.pt() - (*tp_info)->pt())); + meBTLTrackMatchedTPPtRatioGen_->Fill(trackGen.pt() / (*tp_info)->pt()); + meBTLTrackMatchedTPPtRatioMtd_->Fill(track.pt() / (*tp_info)->pt()); + meBTLTrackMatchedTPPtResvsPtMtd_->Fill( + (*tp_info)->pt(), + std::abs(track.pt() - (*tp_info)->pt()) / std::abs(trackGen.pt() - (*tp_info)->pt())); + meBTLTrackMatchedTPDPtvsPtGen_->Fill((*tp_info)->pt(), + (trackGen.pt() - (*tp_info)->pt()) / (*tp_info)->pt()); + meBTLTrackMatchedTPDPtvsPtMtd_->Fill((*tp_info)->pt(), + (track.pt() - (*tp_info)->pt()) / (*tp_info)->pt()); + } + if (isETL && !twoETLdiscs && (std::abs(trackGen.eta()) > trackMinEtlEta_) && + (std::abs(trackGen.eta()) < trackMaxEtlEta_)) { + meETLTrackMatchedTPPtResMtd_->Fill(std::abs(track.pt() - (*tp_info)->pt()) / + std::abs(trackGen.pt() - (*tp_info)->pt())); + meETLTrackMatchedTPPtRatioGen_->Fill(trackGen.pt() / (*tp_info)->pt()); + meETLTrackMatchedTPPtRatioMtd_->Fill(track.pt() / (*tp_info)->pt()); + meETLTrackMatchedTPPtResvsPtMtd_->Fill( + (*tp_info)->pt(), + std::abs(track.pt() - (*tp_info)->pt()) / std::abs(trackGen.pt() - (*tp_info)->pt())); + meETLTrackMatchedTPDPtvsPtGen_->Fill((*tp_info)->pt(), + (trackGen.pt() - (*tp_info)->pt()) / ((*tp_info)->pt())); + meETLTrackMatchedTPDPtvsPtMtd_->Fill((*tp_info)->pt(), + (track.pt() - (*tp_info)->pt()) / ((*tp_info)->pt())); + } + if (isETL && twoETLdiscs) { + meETLTrackMatchedTP2PtResMtd_->Fill(std::abs(track.pt() - (*tp_info)->pt()) / + std::abs(trackGen.pt() - (*tp_info)->pt())); + meETLTrackMatchedTP2PtRatioGen_->Fill(trackGen.pt() / (*tp_info)->pt()); + meETLTrackMatchedTP2PtRatioMtd_->Fill(track.pt() / (*tp_info)->pt()); + meETLTrackMatchedTP2PtResvsPtMtd_->Fill( + (*tp_info)->pt(), + std::abs(track.pt() - (*tp_info)->pt()) / std::abs(trackGen.pt() - (*tp_info)->pt())); + meETLTrackMatchedTP2DPtvsPtGen_->Fill((*tp_info)->pt(), + (trackGen.pt() - (*tp_info)->pt()) / ((*tp_info)->pt())); + meETLTrackMatchedTP2DPtvsPtMtd_->Fill((*tp_info)->pt(), + (track.pt() - (*tp_info)->pt()) / ((*tp_info)->pt())); + } } - if (isETL && !twoETLdiscs && (std::abs(trackGen.eta()) > trackMinEtlEta_) && - (std::abs(trackGen.eta()) < trackMaxEtlEta_)) { - meETLTrackMatchedTPPtResMtd_->Fill(std::abs(track.pt() - (*tp_info)->pt()) / - std::abs(trackGen.pt() - (*tp_info)->pt())); - meETLTrackMatchedTPPtRatioGen_->Fill(trackGen.pt() / (*tp_info)->pt()); - meETLTrackMatchedTPPtRatioMtd_->Fill(track.pt() / (*tp_info)->pt()); - meETLTrackMatchedTPPtResvsPtMtd_->Fill( - (*tp_info)->pt(), std::abs(track.pt() - (*tp_info)->pt()) / std::abs(trackGen.pt() - (*tp_info)->pt())); - meETLTrackMatchedTPDPtvsPtGen_->Fill((*tp_info)->pt(), - (trackGen.pt() - (*tp_info)->pt()) / ((*tp_info)->pt())); - meETLTrackMatchedTPDPtvsPtMtd_->Fill((*tp_info)->pt(), - (track.pt() - (*tp_info)->pt()) / ((*tp_info)->pt())); + } + + // -- Track matched to TP: all and with last hit in MTD + if (std::abs(trackGen.eta()) < trackMaxBtlEta_) { + meBTLTrackMatchedTPEtaTot_->Fill(std::abs(trackGen.eta())); + meBTLTrackMatchedTPPtTot_->Fill(trackGen.pt()); + if (isBTL) { + meBTLTrackMatchedTPEtaMtd_->Fill(std::abs(trackGen.eta())); + meBTLTrackMatchedTPPtMtd_->Fill(trackGen.pt()); } - if (isETL && twoETLdiscs) { - meETLTrackMatchedTP2PtResMtd_->Fill(std::abs(track.pt() - (*tp_info)->pt()) / - std::abs(trackGen.pt() - (*tp_info)->pt())); - meETLTrackMatchedTP2PtRatioGen_->Fill(trackGen.pt() / (*tp_info)->pt()); - meETLTrackMatchedTP2PtRatioMtd_->Fill(track.pt() / (*tp_info)->pt()); - meETLTrackMatchedTP2PtResvsPtMtd_->Fill( - (*tp_info)->pt(), std::abs(track.pt() - (*tp_info)->pt()) / std::abs(trackGen.pt() - (*tp_info)->pt())); - meETLTrackMatchedTP2DPtvsPtGen_->Fill((*tp_info)->pt(), - (trackGen.pt() - (*tp_info)->pt()) / ((*tp_info)->pt())); - meETLTrackMatchedTP2DPtvsPtMtd_->Fill((*tp_info)->pt(), - (track.pt() - (*tp_info)->pt()) / ((*tp_info)->pt())); + } else { + meETLTrackMatchedTPEtaTot_->Fill(std::abs(trackGen.eta())); + meETLTrackMatchedTPPtTot_->Fill(trackGen.pt()); + if (isETL) { + meETLTrackMatchedTPEtaMtd_->Fill(std::abs(trackGen.eta())); + meETLTrackMatchedTPPtMtd_->Fill(trackGen.pt()); + if (twoETLdiscs) { + meETLTrackMatchedTPEta2Mtd_->Fill(std::abs(trackGen.eta())); + meETLTrackMatchedTPPt2Mtd_->Fill(trackGen.pt()); + } } } - auto simClustersRefs = tp2SimAssociationMap.find(*tp_info); - const bool withMTD = (simClustersRefs != tp2SimAssociationMap.end()); + if (noCrack) { - meTrackMatchedTPEffPtTot_->Fill(trackGen.pt()); if (trkTPSelLV(**tp_info)) { - meTrackMatchedTPEffPtTotLV_->Fill(trackGen.pt()); - } - if (withMTD) { - meTrackMatchedTPmtdEffPtTot_->Fill(trackGen.pt()); + meTrackMatchedTPEtaTotLV_->Fill(std::abs(trackGen.eta())); + meTrackMatchedTPPtTotLV_->Fill(trackGen.pt()); } } - meTrackMatchedTPEffEtaTot_->Fill(std::abs(trackGen.eta())); - if (trkTPSelLV(**tp_info)) { - meTrackMatchedTPEffEtaTotLV_->Fill(std::abs(trackGen.eta())); + + bool hasTime = false; + double tsim = (*tp_info)->parentVertex()->position().t() * simUnit_; + double dT(-9999.); + double pullT(-9999.); + if (Sigmat0Safe[trackref] != -1.) { + dT = t0Safe[trackref] - tsim; + pullT = dT / Sigmat0Safe[trackref]; + hasTime = true; } + + // == MC truth matching + bool isTPmtdDirectBTL = false, isTPmtdOtherBTL = false, isTPmtdDirectCorrectBTL = false, + isTPmtdOtherCorrectBTL = false, isTPmtdETLD1 = false, isTPmtdETLD2 = false, isTPmtdCorrectETLD1 = false, + isTPmtdCorrectETLD2 = false; + + auto simClustersRefsIt = tp2SimAssociationMap.find(*tp_info); + const bool withMTD = (simClustersRefsIt != tp2SimAssociationMap.end()); + + // If there is a mtdSimLayerCluster from the tracking particle if (withMTD) { - meTrackMatchedTPmtdEffEtaTot_->Fill(std::abs(trackGen.eta())); - } - if (isBTL || isETL) { - if (noCrack) { - meTrackMatchedTPEffPtMtd_->Fill(trackGen.pt()); - if (isBTL || twoETLdiscs) { - meTrackMatchedTPEffPtEtl2Mtd_->Fill(trackGen.pt()); + // -- Get the refs to MtdSimLayerClusters associated to the TP + std::vector> simClustersRefs; + for (const auto& ref : simClustersRefsIt->val) { + simClustersRefs.push_back(ref); + MTDDetId mtddetid = ref->detIds_and_rows().front().first; + if (mtddetid.mtdSubDetector() == 2) { + ETLDetId detid(mtddetid.rawId()); + if (detid.nDisc() == 1) + isTPmtdETLD1 = true; + if (detid.nDisc() == 2) + isTPmtdETLD2 = true; } - if (withMTD) { - meTrackMatchedTPmtdEffPtMtd_->Fill(trackGen.pt()); + } + + // === BTL + // -- Sort BTL sim clusters by time + std::vector>::iterator directSimClusIt; + if (std::abs(trackGen.eta()) < trackMaxBtlEta_ && !simClustersRefs.empty()) { + std::sort(simClustersRefs.begin(), simClustersRefs.end(), [](const auto& a, const auto& b) { + return a->simLCTime() < b->simLCTime(); + }); + // Find the first direct hit in time + directSimClusIt = std::find_if(simClustersRefs.begin(), simClustersRefs.end(), [](const auto& simCluster) { + return simCluster->trackIdOffset() == 0; + }); + // Check if TP has direct or other sim cluster for BTL + for (const auto& simClusterRef : simClustersRefs) { + if (directSimClusIt != simClustersRefs.end() && simClusterRef == *directSimClusIt) { + isTPmtdDirectBTL = true; + } else if (simClusterRef->trackIdOffset() != 0) { + isTPmtdOtherBTL = true; + } } } - meTrackMatchedTPEffEtaMtd_->Fill(std::abs(trackGen.eta())); - if (isBTL || twoETLdiscs) { - meTrackMatchedTPEffEtaEtl2Mtd_->Fill(std::abs(trackGen.eta())); + + // == Check if the track-cluster association is correct: Track->RecoClus->SimClus == Track->TP->SimClus + for (const auto& recClusterRef : recoClustersRefs) { + if (recClusterRef.isNonnull()) { + auto itp = r2sAssociationMap.equal_range(recClusterRef); + if (itp.first != itp.second) { + auto& simClustersRefs_RecoMatch = (*itp.first).second; + + for (const auto& simClusterRef_RecoMatch : simClustersRefs_RecoMatch) { + // Check if simClusterRef_RecoMatch exists in SimClusters + auto simClusterIt = + std::find(simClustersRefs.begin(), simClustersRefs.end(), simClusterRef_RecoMatch); + + // SimCluster found in SimClusters + if (simClusterIt != simClustersRefs.end()) { + if (isBTL) { + if (directSimClusIt != simClustersRefs.end() && simClusterRef_RecoMatch == *directSimClusIt) { + isTPmtdDirectCorrectBTL = true; + } else if (simClusterRef_RecoMatch->trackIdOffset() != 0) { + isTPmtdOtherCorrectBTL = true; + } + } + if (isETL) { + MTDDetId mtddetid = (*simClusterIt)->detIds_and_rows().front().first; + ETLDetId detid(mtddetid.rawId()); + if (detid.nDisc() == 1) + isTPmtdCorrectETLD1 = true; + if (detid.nDisc() == 2) + isTPmtdCorrectETLD2 = true; + } + } + } + } + } + } /// end loop over reco clusters associated to this track. + + // == BTL + if (std::abs(trackGen.eta()) < trackMaxBtlEta_) { + // -- Track matched to TP with sim hit in MTD + if (isTPmtdDirectBTL) { + meBTLTrackMatchedTPmtdDirectEta_->Fill(std::abs(trackGen.eta())); + meBTLTrackMatchedTPmtdDirectPt_->Fill(trackGen.pt()); + } else if (isTPmtdOtherBTL) { + meBTLTrackMatchedTPmtdOtherEta_->Fill(std::abs(trackGen.eta())); + meBTLTrackMatchedTPmtdOtherPt_->Fill(trackGen.pt()); + } + //-- Track matched to TP with sim hit in MTD, with associated reco cluster + if (isBTL) { + if (isTPmtdDirectBTL) { + // -- Track matched to TP with sim hit (direct), correctly associated reco cluster + if (isTPmtdDirectCorrectBTL) { + fillTrackClusterMatchingHistograms(meBTLTrackMatchedTPmtdDirectCorrectAssocEta_, + meBTLTrackMatchedTPmtdDirectCorrectAssocPt_, + meBTLTrackMatchedTPmtdDirectCorrectAssocMVAQual_, + meBTLTrackMatchedTPmtdDirectCorrectAssocTimeRes_, + meBTLTrackMatchedTPmtdDirectCorrectAssocTimePull_, + std::abs(trackGen.eta()), + trackGen.pt(), + mtdQualMVA[trackref], + dT, + pullT, + hasTime); + } + // -- Track matched to TP with sim hit (direct), incorrectly associated reco cluster + else { + fillTrackClusterMatchingHistograms(meBTLTrackMatchedTPmtdDirectWrongAssocEta_, + meBTLTrackMatchedTPmtdDirectWrongAssocPt_, + meBTLTrackMatchedTPmtdDirectWrongAssocMVAQual_, + meBTLTrackMatchedTPmtdDirectWrongAssocTimeRes_, + meBTLTrackMatchedTPmtdDirectWrongAssocTimePull_, + std::abs(trackGen.eta()), + trackGen.pt(), + mtdQualMVA[trackref], + dT, + pullT, + hasTime); + } + } + // -- Track matched to TP with sim hit (other), correctly associated reco cluster + else if (isTPmtdOtherBTL) { + if (isTPmtdOtherCorrectBTL) { + fillTrackClusterMatchingHistograms(meBTLTrackMatchedTPmtdOtherCorrectAssocEta_, + meBTLTrackMatchedTPmtdOtherCorrectAssocPt_, + meBTLTrackMatchedTPmtdOtherCorrectAssocMVAQual_, + meBTLTrackMatchedTPmtdOtherCorrectAssocTimeRes_, + meBTLTrackMatchedTPmtdOtherCorrectAssocTimePull_, + std::abs(trackGen.eta()), + trackGen.pt(), + mtdQualMVA[trackref], + dT, + pullT, + hasTime); + } + // -- Track matched to TP with sim hit (other), incorrectly associated reco cluster + else { + fillTrackClusterMatchingHistograms(meBTLTrackMatchedTPmtdOtherWrongAssocEta_, + meBTLTrackMatchedTPmtdOtherWrongAssocPt_, + meBTLTrackMatchedTPmtdOtherWrongAssocMVAQual_, + meBTLTrackMatchedTPmtdOtherWrongAssocTimeRes_, + meBTLTrackMatchedTPmtdOtherWrongAssocTimePull_, + std::abs(trackGen.eta()), + trackGen.pt(), + mtdQualMVA[trackref], + dT, + pullT, + hasTime); + } + } + } + // -- Track matched to TP with sim hit in MTD, missing associated reco cluster + else { + if (isTPmtdDirectBTL) { + meBTLTrackMatchedTPmtdDirectNoAssocEta_->Fill(std::abs(trackGen.eta())); + meBTLTrackMatchedTPmtdDirectNoAssocPt_->Fill(trackGen.pt()); + } else if (isTPmtdOtherBTL) { + meBTLTrackMatchedTPmtdOtherNoAssocEta_->Fill(std::abs(trackGen.eta())); + meBTLTrackMatchedTPmtdOtherNoAssocPt_->Fill(trackGen.pt()); + } + } + } // == end BTL + // == ETL + else { + // -- Track matched to TP with sim hit in one etl layer + if (isTPmtdETLD1 || isTPmtdETLD2) { // at least one hit (D1 or D2 or both) + meETLTrackMatchedTPmtd1Eta_->Fill(std::abs(trackGen.eta())); + meETLTrackMatchedTPmtd1Pt_->Fill(trackGen.pt()); + } + // -- Track matched to TP with sim hits in both etl layers (D1 and D2) + if (isTPmtdETLD1 && isTPmtdETLD2) { + meETLTrackMatchedTPmtd2Eta_->Fill(std::abs(trackGen.eta())); + meETLTrackMatchedTPmtd2Pt_->Fill(trackGen.pt()); + } + if (isETL) { + // -- Track matched to TP with sim hit in >=1 etl layer + if (isTPmtdETLD1 || isTPmtdETLD2) { + // - each hit is correctly associated to the track + if ((isTPmtdETLD1 && !isTPmtdETLD2 && ETLdisc1 && isTPmtdCorrectETLD1) || + (isTPmtdETLD2 && !isTPmtdETLD1 && ETLdisc2 && isTPmtdCorrectETLD2) || + (isTPmtdETLD1 && isTPmtdETLD2 && ETLdisc1 && ETLdisc2 && isTPmtdCorrectETLD1 && + isTPmtdCorrectETLD2)) { + fillTrackClusterMatchingHistograms(meETLTrackMatchedTPmtd1CorrectAssocEta_, + meETLTrackMatchedTPmtd1CorrectAssocPt_, + meETLTrackMatchedTPmtd1CorrectAssocMVAQual_, + meETLTrackMatchedTPmtd1CorrectAssocTimeRes_, + meETLTrackMatchedTPmtd1CorrectAssocTimePull_, + std::abs(trackGen.eta()), + trackGen.pt(), + mtdQualMVA[trackref], + dT, + pullT, + hasTime); + } + // - at least one reco hit is incorrectly associated or, if two sim hits, one reco hit is missing + else if ((isTPmtdETLD1 && !isTPmtdCorrectETLD1) || (isTPmtdETLD2 && !isTPmtdCorrectETLD2)) { + fillTrackClusterMatchingHistograms(meETLTrackMatchedTPmtd1WrongAssocEta_, + meETLTrackMatchedTPmtd1WrongAssocPt_, + meETLTrackMatchedTPmtd1WrongAssocMVAQual_, + meETLTrackMatchedTPmtd1WrongAssocTimeRes_, + meETLTrackMatchedTPmtd1WrongAssocTimePull_, + std::abs(trackGen.eta()), + trackGen.pt(), + mtdQualMVA[trackref], + dT, + pullT, + hasTime); + } + } + // -- Track matched to TP with sim hits in both etl layers (D1 and D2) + if (isTPmtdETLD1 && isTPmtdETLD2) { + // - each hit correctly associated to the track + if (ETLdisc1 && ETLdisc2 && isTPmtdCorrectETLD1 && isTPmtdCorrectETLD2) { + fillTrackClusterMatchingHistograms(meETLTrackMatchedTPmtd2CorrectAssocEta_, + meETLTrackMatchedTPmtd2CorrectAssocPt_, + meETLTrackMatchedTPmtd2CorrectAssocMVAQual_, + meETLTrackMatchedTPmtd2CorrectAssocTimeRes_, + meETLTrackMatchedTPmtd2CorrectAssocTimePull_, + std::abs(trackGen.eta()), + trackGen.pt(), + mtdQualMVA[trackref], + dT, + pullT, + hasTime); + } + // - at least one reco hit incorrectly associated or one hit missing + else if ((ETLdisc1 || ETLdisc2) && (!isTPmtdCorrectETLD1 || !isTPmtdCorrectETLD2)) { + fillTrackClusterMatchingHistograms(meETLTrackMatchedTPmtd2WrongAssocEta_, + meETLTrackMatchedTPmtd2WrongAssocPt_, + meETLTrackMatchedTPmtd2WrongAssocMVAQual_, + meETLTrackMatchedTPmtd2WrongAssocTimeRes_, + meETLTrackMatchedTPmtd2WrongAssocTimePull_, + std::abs(trackGen.eta()), + trackGen.pt(), + mtdQualMVA[trackref], + dT, + pullT, + hasTime); + } + } + } + // -- Missing association with reco hits in MTD + else { + // -- Track matched to TP with sim hit in >=1 etl layers, no reco hits associated to the track + if (isTPmtdETLD1 || isTPmtdETLD2) { + meETLTrackMatchedTPmtd1NoAssocEta_->Fill(std::abs(trackGen.eta())); + meETLTrackMatchedTPmtd1NoAssocPt_->Fill(trackGen.pt()); + } + // -- Track matched to TP with sim hit in 2 etl layers, no reco hits associated to the track + if (isTPmtdETLD1 && isTPmtdETLD2) { + meETLTrackMatchedTPmtd2NoAssocEta_->Fill(std::abs(trackGen.eta())); + meETLTrackMatchedTPmtd2NoAssocPt_->Fill(trackGen.pt()); + } + } + } // == end ETL + } // --- end "withMTD" + + // - Track matched to TP without sim hit in MTD, but with reco cluster associated + // - BTL + if (std::abs(trackGen.eta()) < trackMaxBtlEta_) { + if (!isTPmtdDirectBTL && !isTPmtdOtherBTL) { + meBTLTrackMatchedTPnomtdEta_->Fill(std::abs(trackGen.eta())); + meBTLTrackMatchedTPnomtdPt_->Fill(trackGen.pt()); + if (isBTL) { + fillTrackClusterMatchingHistograms(meBTLTrackMatchedTPnomtdAssocEta_, + meBTLTrackMatchedTPnomtdAssocPt_, + meBTLTrackMatchedTPnomtdAssocMVAQual_, + meBTLTrackMatchedTPnomtdAssocTimeRes_, + meBTLTrackMatchedTPnomtdAssocTimePull_, + std::abs(trackGen.eta()), + trackGen.pt(), + mtdQualMVA[trackref], + dT, + pullT, + hasTime); + } } - if (withMTD) { - meTrackMatchedTPmtdEffEtaMtd_->Fill(std::abs(trackGen.eta())); + } + // - ETL + else if (!isTPmtdETLD1 && !isTPmtdETLD2) { + meETLTrackMatchedTPnomtdEta_->Fill(std::abs(trackGen.eta())); + meETLTrackMatchedTPnomtdPt_->Fill(trackGen.pt()); + if (isETL) { + fillTrackClusterMatchingHistograms(meETLTrackMatchedTPnomtdAssocEta_, + meETLTrackMatchedTPnomtdAssocPt_, + meETLTrackMatchedTPnomtdAssocMVAQual_, + meETLTrackMatchedTPnomtdAssocTimeRes_, + meETLTrackMatchedTPnomtdAssocTimePull_, + std::abs(trackGen.eta()), + trackGen.pt(), + mtdQualMVA[trackref], + dT, + pullT, + hasTime); } } - // time pull and detailed extrapolation check only on tracks associated to TP from signal event + // == Time pull and detailed extrapolation check only on tracks associated to TP from signal event if (!trkTPSelLV(**tp_info)) { continue; } @@ -626,12 +1055,7 @@ void MtdTracksValidation::analyze(const edm::Event& iEvent, const edm::EventSetu } // detailed extrapolation check // time res and time pull - double tsim = (*tp_info)->parentVertex()->position().t() * simUnit_; - double dT(-9999.); - double pullT(-9999.); if (Sigmat0Safe[trackref] != -1.) { - dT = t0Safe[trackref] - tsim; - pullT = dT / Sigmat0Safe[trackref]; if (isBTL || isETL) { meTrackResTot_->Fill(dT); meTrackPullTot_->Fill(pullT); @@ -639,7 +1063,6 @@ void MtdTracksValidation::analyze(const edm::Event& iEvent, const edm::EventSetu meTrackPullTotvsMVAQual_->Fill(mtdQualMVA[trackref], pullT); } } // time res and time pull - } // TP matching } // trkRecSel @@ -647,9 +1070,9 @@ void MtdTracksValidation::analyze(const edm::Event& iEvent, const edm::EventSetu if (trkRecSelLowPt(trackGen)) { if ((std::abs(trackGen.eta()) > trackMinEtlEta_) && (std::abs(trackGen.eta()) < trackMaxEtlEta_)) { if (trackGen.pt() < 0.45) { - meETLTrackEffEtaTotLowPt_[0]->Fill(std::abs(trackGen.eta())); + meETLTrackEtaTotLowPt_[0]->Fill(std::abs(trackGen.eta())); } else { - meETLTrackEffEtaTotLowPt_[1]->Fill(std::abs(trackGen.eta())); + meETLTrackEtaTotLowPt_[1]->Fill(std::abs(trackGen.eta())); } } bool MTDEtlZnegD1 = false; @@ -685,16 +1108,16 @@ void MtdTracksValidation::analyze(const edm::Event& iEvent, const edm::EventSetu } if (isETL && (std::abs(trackGen.eta()) > trackMinEtlEta_) && (std::abs(trackGen.eta()) < trackMaxEtlEta_)) { if (trackGen.pt() < 0.45) { - meETLTrackEffEtaMtdLowPt_[0]->Fill(std::abs(trackGen.eta())); + meETLTrackEtaMtdLowPt_[0]->Fill(std::abs(trackGen.eta())); } else { - meETLTrackEffEtaMtdLowPt_[1]->Fill(std::abs(trackGen.eta())); + meETLTrackEtaMtdLowPt_[1]->Fill(std::abs(trackGen.eta())); } } if (isETL && twoETLdiscs) { if (trackGen.pt() < 0.45) { - meETLTrackEffEta2MtdLowPt_[0]->Fill(std::abs(trackGen.eta())); + meETLTrackEta2MtdLowPt_[0]->Fill(std::abs(trackGen.eta())); } else { - meETLTrackEffEta2MtdLowPt_[1]->Fill(std::abs(trackGen.eta())); + meETLTrackEta2MtdLowPt_[1]->Fill(std::abs(trackGen.eta())); } } } // trkRecSelLowPt @@ -895,59 +1318,41 @@ void MtdTracksValidation::bookHistograms(DQMStore::IBooker& ibook, edm::Run cons // histogram booking meBTLTrackRPTime_ = ibook.book1D("TrackBTLRPTime", "Track t0 with respect to R.P.;t0 [ns]", 100, -1, 3); - meBTLTrackEffEtaTot_ = ibook.book1D("TrackBTLEffEtaTot", "Eta of tracks (Tot);#eta_{RECO}", 100, -1.6, 1.6); - meBTLTrackEffPhiTot_ = ibook.book1D("TrackBTLEffPhiTot", "Phi of tracks (Tot);#phi_{RECO} [rad]", 100, -3.2, 3.2); - meBTLTrackEffPtTot_ = ibook.book1D("TrackBTLEffPtTot", "Pt of tracks (Tot);pt_{RECO} [GeV]", 50, 0, 10); - meBTLTrackEffEtaMtd_ = ibook.book1D("TrackBTLEffEtaMtd", "Eta of tracks (Mtd);#eta_{RECO}", 100, -1.6, 1.6); - meBTLTrackEffPhiMtd_ = ibook.book1D("TrackBTLEffPhiMtd", "Phi of tracks (Mtd);#phi_{RECO} [rad]", 100, -3.2, 3.2); - meBTLTrackEffPtMtd_ = ibook.book1D("TrackBTLEffPtMtd", "Pt of tracks (Mtd);pt_{RECO} [GeV]", 50, 0, 10); + meBTLTrackEtaTot_ = ibook.book1D("TrackBTLEtaTot", "Eta of tracks (Tot);#eta_{RECO}", 30, 0., 1.5); + meBTLTrackPhiTot_ = ibook.book1D("TrackBTLPhiTot", "Phi of tracks (Tot);#phi_{RECO} [rad]", 100, -3.2, 3.2); + meBTLTrackPtTot_ = ibook.book1D("TrackBTLPtTot", "Pt of tracks (Tot);pt_{RECO} [GeV]", 50, 0, 10); + meBTLTrackEtaMtd_ = ibook.book1D("TrackBTLEtaMtd", "Eta of tracks (Mtd);#eta_{RECO}", 30, 0., 1.5); + meBTLTrackPhiMtd_ = ibook.book1D("TrackBTLPhiMtd", "Phi of tracks (Mtd);#phi_{RECO} [rad]", 100, -3.2, 3.2); + meBTLTrackPtMtd_ = ibook.book1D("TrackBTLPtMtd", "Pt of tracks (Mtd);pt_{RECO} [GeV]", 50, 0, 10); meBTLTrackPtRes_ = ibook.book1D("TrackBTLPtRes", "Track pT resolution ;pT_{Gentrack}-pT_{MTDtrack}/pT_{Gentrack} ", 100, -0.1, 0.1); meETLTrackRPTime_ = ibook.book1D("TrackETLRPTime", "Track t0 with respect to R.P.;t0 [ns]", 100, -1, 3); - meETLTrackEffEtaTot_[0] = - ibook.book1D("TrackETLEffEtaTotZneg", "Eta of tracks (Tot) (-Z);#eta_{RECO}", 100, -3.2, -1.4); - meETLTrackEffEtaTot_[1] = - ibook.book1D("TrackETLEffEtaTotZpos", "Eta of tracks (Tot) (+Z);#eta_{RECO}", 100, 1.4, 3.2); - meETLTrackEffEtaTotLowPt_[0] = - ibook.book1D("TrackETLEffEtaTotLowPt0", "Eta of tracks, 0.2 < pt < 0.45 (Tot);#eta_{RECO}", 100, 1.4, 3.2); - meETLTrackEffEtaTotLowPt_[1] = - ibook.book1D("TrackETLEffEtaTotLowPt1", "Eta of tracks, 0.45 < pt < 0.7 (Tot);#eta_{RECO}", 100, 1.4, 3.2); - meETLTrackEffPhiTot_[0] = - ibook.book1D("TrackETLEffPhiTotZneg", "Phi of tracks (Tot) (-Z);#phi_{RECO} [rad]", 100, -3.2, 3.2); - meETLTrackEffPhiTot_[1] = - ibook.book1D("TrackETLEffPhiTotZpos", "Phi of tracks (Tot) (+Z);#phi_{RECO} [rad]", 100, -3.2, 3.2); - meETLTrackEffPtTot_[0] = ibook.book1D("TrackETLEffPtTotZneg", "Pt of tracks (Tot) (-Z);pt_{RECO} [GeV]", 50, 0, 10); - meETLTrackEffPtTot_[1] = ibook.book1D("TrackETLEffPtTotZpos", "Pt of tracks (Tot) (+Z);pt_{RECO} [GeV]", 50, 0, 10); - meETLTrackEffEtaMtd_[0] = - ibook.book1D("TrackETLEffEtaMtdZneg", "Eta of tracks (Mtd) (-Z);#eta_{RECO}", 100, -3.2, -1.4); - meETLTrackEffEtaMtd_[1] = - ibook.book1D("TrackETLEffEtaMtdZpos", "Eta of tracks (Mtd) (+Z);#eta_{RECO}", 100, 1.4, 3.2); - meETLTrackEffEtaMtdLowPt_[0] = - ibook.book1D("TrackETLEffEtaMtdLowPt0", "Eta of tracks, 0.2 < pt < 0.45 (Mtd);#eta_{RECO}", 100, 1.4, 3.2); - meETLTrackEffEtaMtdLowPt_[1] = - ibook.book1D("TrackETLEffEtaMtdLowPt1", "Eta of tracks, 0.45 < pt < 0.7 (Mtd);#eta_{RECO}", 100, 1.4, 3.2); - meETLTrackEffEta2MtdLowPt_[0] = - ibook.book1D("TrackETLEffEta2MtdLowPt0", "Eta of tracks, 0.2 < pt < 0.45 (Mtd 2 hit);#eta_{RECO}", 100, 1.4, 3.2); - meETLTrackEffEta2MtdLowPt_[1] = - ibook.book1D("TrackETLEffEta2MtdLowPt1", "Eta of tracks, 0.45 < pt < 0.7 (Mtd 2 hit);#eta_{RECO}", 100, 1.4, 3.2); - meETLTrackEffPhiMtd_[0] = - ibook.book1D("TrackETLEffPhiMtdZneg", "Phi of tracks (Mtd) (-Z);#phi_{RECO} [rad]", 100, -3.2, 3.2); - meETLTrackEffPhiMtd_[1] = - ibook.book1D("TrackETLEffPhiMtdZpos", "Phi of tracks (Mtd) (+Z);#phi_{RECO} [rad]", 100, -3.2, 3.2); - meETLTrackEffPtMtd_[0] = ibook.book1D("TrackETLEffPtMtdZneg", "Pt of tracks (Mtd) (-Z);pt_{RECO} [GeV]", 50, 0, 10); - meETLTrackEffPtMtd_[1] = ibook.book1D("TrackETLEffPtMtdZpos", "Pt of tracks (Mtd) (+Z);pt_{RECO} [GeV]", 50, 0, 10); - meETLTrackEffEta2Mtd_[0] = - ibook.book1D("TrackETLEffEta2MtdZneg", "Eta of tracks (Mtd 2 hit) (-Z);#eta_{RECO}", 100, -3.2, -1.4); - meETLTrackEffEta2Mtd_[1] = - ibook.book1D("TrackETLEffEta2MtdZpos", "Eta of tracks (Mtd 2 hit) (+Z);#eta_{RECO}", 100, 1.4, 3.2); - meETLTrackEffPhi2Mtd_[0] = - ibook.book1D("TrackETLEffPhi2MtdZneg", "Phi of tracks (Mtd 2 hit) (-Z);#phi_{RECO} [rad]", 100, -3.2, 3.2); - meETLTrackEffPhi2Mtd_[1] = - ibook.book1D("TrackETLEffPhi2MtdZpos", "Phi of tracks (Mtd 2 hit) (+Z);#phi_{RECO} [rad]", 100, -3.2, 3.2); - meETLTrackEffPt2Mtd_[0] = - ibook.book1D("TrackETLEffPt2MtdZneg", "Pt of tracks (Mtd 2 hit) (-Z);pt_{RECO} [GeV]", 50, 0, 10); - meETLTrackEffPt2Mtd_[1] = - ibook.book1D("TrackETLEffPt2MtdZpos", "Pt of tracks (Mtd 2 hit) (+Z);pt_{RECO} [GeV]", 50, 0, 10); + meETLTrackEtaTot_ = ibook.book1D("TrackETLEtaTot", "Eta of tracks (Tot);#eta_{RECO}", 30, 1.5, 3.0); + meETLTrackPhiTot_ = ibook.book1D("TrackETLPhiTot", "Phi of tracks (Tot);#phi_{RECO} [rad]", 100, -3.2, 3.2); + meETLTrackPhiTot_ = ibook.book1D("TrackETLPhiTot", "Phi of tracks (Tot);#phi_{RECO} [rad]", 100, -3.2, 3.2); + meETLTrackPtTot_ = ibook.book1D("TrackETLPtTot", "Pt of tracks (Tot);pt_{RECO} [GeV]", 50, 0, 10); + + meETLTrackEtaTotLowPt_[0] = + ibook.book1D("TrackETLEtaTotLowPt0", "Eta of tracks, 0.2 < pt < 0.45 (Tot);#eta_{RECO}", 30, 1.5, 3.0); + meETLTrackEtaTotLowPt_[1] = + ibook.book1D("TrackETLEtaTotLowPt1", "Eta of tracks, 0.45 < pt < 0.7 (Tot);#eta_{RECO}", 30, 1.5, 3.0); + + meETLTrackEtaMtd_ = ibook.book1D("TrackETLEtaMtd", "Eta of tracks (Mtd);#eta_{RECO}", 30, 1.5, 3.0); + meETLTrackEtaMtdLowPt_[0] = + ibook.book1D("TrackETLEtaMtdLowPt0", "Eta of tracks, 0.2 < pt < 0.45 (Mtd);#eta_{RECO}", 30, 1.5, 3.0); + meETLTrackEtaMtdLowPt_[1] = + ibook.book1D("TrackETLEtaMtdLowPt1", "Eta of tracks, 0.45 < pt < 0.7 (Mtd);#eta_{RECO}", 30, 1.5, 3.0); + meETLTrackEta2MtdLowPt_[0] = + ibook.book1D("TrackETLEta2MtdLowPt0", "Eta of tracks, 0.2 < pt < 0.45 (Mtd 2 hit);#eta_{RECO}", 30, 1.5, 3.0); + meETLTrackEta2MtdLowPt_[1] = + ibook.book1D("TrackETLEta2MtdLowPt1", "Eta of tracks, 0.45 < pt < 0.7 (Mtd 2 hit);#eta_{RECO}", 30, 1.5, 3.0); + + meETLTrackPhiMtd_ = ibook.book1D("TrackETLPhiMtd", "Phi of tracks (Mtd);#phi_{RECO} [rad]", 100, -3.2, 3.2); + meETLTrackPtMtd_ = ibook.book1D("TrackETLPtMtd", "Pt of tracks (Mtd);pt_{RECO} [GeV]", 50, 0, 10); + meETLTrackEta2Mtd_ = ibook.book1D("TrackETLEta2Mtd", "Eta of tracks (Mtd 2 hit);#eta_{RECO}", 30, 1.5, 3.0); + meETLTrackPhi2Mtd_ = ibook.book1D("TrackETLPhi2Mtd", "Phi of tracks (Mtd 2 hit);#phi_{RECO} [rad]", 100, -3.2, 3.2); + meETLTrackPt2Mtd_ = ibook.book1D("TrackETLPt2Mtd", "Pt of tracks (Mtd 2 hit);pt_{RECO} [GeV]", 50, 0, 10); + meETLTrackPtRes_ = ibook.book1D("TrackETLPtRes", "Track pT resolution;pT_{Gentrack}-pT_{MTDtrack}/pT_{Gentrack} ", 100, -0.1, 0.1); @@ -1010,164 +1415,164 @@ void MtdTracksValidation::bookHistograms(DQMStore::IBooker& ibook, edm::Run cons 110, 0., 11.); - - meTrackPtTot_ = ibook.book1D("TrackPtTot", "Pt of tracks ; track pt [GeV] ", 110, 0., 11.); - meTrackMatchedTPEffPtTot_ = - ibook.book1D("MatchedTPEffPtTot", "Pt of tracks matched to TP; track pt [GeV] ", 110, 0., 11.); - meTrackMatchedTPEffPtTotLV_ = - ibook.book1D("MatchedTPEffPtTotLV", "Pt of tracks associated to LV matched to TP; track pt [GeV] ", 110, 0., 11.); - meTrackMatchedTPEffPtMtd_ = - ibook.book1D("MatchedTPEffPtMtd", "Pt of tracks matched to TP with time; track pt [GeV] ", 110, 0., 11.); - meTrackMatchedTPEffPtEtl2Mtd_ = ibook.book1D( - "MatchedTPEffPtEtl2Mtd", "Pt of tracks matched to TP with time, 2 ETL hits; track pt [GeV] ", 110, 0., 11.); - - meBTLTrackMatchedTPPtResMtd_ = ibook.book1D( - "TrackMatchedTPBTLPtResMtd", - "Pt resolution of tracks matched to TP-BTL hit ;|pT_{MTDtrack}-pT_{truth}|/|pT_{Gentrack}-pT_{truth}| ", - 100, - 0., - 4.); - meETLTrackMatchedTPPtResMtd_ = ibook.book1D( - "TrackMatchedTPETLPtResMtd", - "Pt resolution of tracks matched to TP-ETL hit ;|pT_{MTDtrack}-pT_{truth}|/|pT_{Gentrack}-pT_{truth}| ", - 100, - 0., - 4.); - meETLTrackMatchedTP2PtResMtd_ = ibook.book1D( - "TrackMatchedTPETL2PtResMtd", - "Pt resolution of tracks matched to TP-ETL 2hits ;|pT_{MTDtrack}-pT_{truth}|/|pT_{Gentrack}-pT_{truth}| ", - 100, - 0., - 4.); - meBTLTrackMatchedTPPtRatioGen_ = ibook.book1D( - "TrackMatchedTPBTLPtRatioGen", "Pt ratio of Gentracks (BTL) ;pT_{Gentrack}/pT_{truth} ", 100, 0.9, 1.1); - meETLTrackMatchedTPPtRatioGen_ = ibook.book1D( - "TrackMatchedTPETLPtRatioGen", "Pt ratio of Gentracks (ETL 1hit) ;pT_{Gentrack}/pT_{truth} ", 100, 0.9, 1.1); - meETLTrackMatchedTP2PtRatioGen_ = ibook.book1D( - "TrackMatchedTPETL2PtRatioGen", "Pt ratio of Gentracks (ETL 2hits) ;pT_{Gentrack}/pT_{truth} ", 100, 0.9, 1.1); - meBTLTrackMatchedTPPtRatioMtd_ = ibook.book1D("TrackMatchedTPBTLPtRatioMtd", - "Pt ratio of tracks matched to TP-BTL hit ;pT_{MTDtrack}/pT_{truth} ", - 100, - 0.9, - 1.1); - meETLTrackMatchedTPPtRatioMtd_ = ibook.book1D("TrackMatchedTPETLPtRatioMtd", - "Pt ratio of tracks matched to TP-ETL hit ;pT_{MTDtrack}/pT_{truth} ", - 100, - 0.9, - 1.1); - meETLTrackMatchedTP2PtRatioMtd_ = - ibook.book1D("TrackMatchedTPETL2PtRatioMtd", - "Pt ratio of tracks matched to TP-ETL 2hits ;pT_{MTDtrack}/pT_{truth} ", - 100, - 0.9, - 1.1); - meBTLTrackMatchedTPPtResvsPtMtd_ = ibook.bookProfile("TrackMatchedTPBTLPtResvsPtMtd", - "Pt resolution of tracks matched to TP-BTL hit vs Pt;pT_{truth} " - "[GeV];|pT_{MTDtrack}-pT_{truth}|/|pT_{Gentrack}-pT_{truth}| ", + meExtraEtaMtd_ = + ibook.book1D("ExtraEtaMtd", "Eta of tracks associated to LV extrapolated to hits; track eta ", 66, 0., 3.3); + meExtraEtaEtl2Mtd_ = ibook.book1D( + "ExtraEtaEtl2Mtd", "Eta of tracks associated to LV extrapolated to hits, 2 ETL layers; track eta ", 66, 0., 3.3); + meTrackMatchedTPEtaTotLV_ = + ibook.book1D("MatchedTPEtaTotLV", "Eta of tracks associated to LV matched to TP; track eta ", 66, 0., 3.3); + meTrackMatchedTPPtTotLV_ = + ibook.book1D("MatchedTPPtTotLV", "Pt of tracks associated to LV matched to TP; track pt [GeV] ", 110, 0., 11.); + + meBTLTrackMatchedTPEtaTot_ = + ibook.book1D("BTLTrackMatchedTPEtaTot", "Eta of tracks matched to TP; track eta ", 30, 0., 1.5); + meBTLTrackMatchedTPEtaMtd_ = + ibook.book1D("BTLTrackMatchedTPEtaMtd", "Eta of tracks matched to TP with time; track eta ", 30, 0., 1.5); + meBTLTrackMatchedTPPtTot_ = + ibook.book1D("BTLTrackMatchedTPPtTot", "Pt of tracks matched to TP; track pt [GeV] ", 50, 0., 10.); + meBTLTrackMatchedTPPtMtd_ = + ibook.book1D("BTLTrackMatchedTPPtMtd", "Pt of tracks matched to TP with time; track pt [GeV] ", 50, 0., 10.); + meETLTrackMatchedTPEtaTot_ = + ibook.book1D("ETLTrackMatchedTPEtaTot", "Eta of tracks matched to TP; track eta ", 30, 1.5, 3.0); + meETLTrackMatchedTPEtaMtd_ = ibook.book1D( + "ETLTrackMatchedTPEtaMtd", "Eta of tracks matched to TP with time (>=1 ETL hit); track eta ", 30, 1.5, 3.0); + meETLTrackMatchedTPEta2Mtd_ = ibook.book1D( + "ETLTrackMatchedTPEta2Mtd", "Eta of tracks matched to TP with time (2 ETL hits); track eta ", 30, 1.5, 3.0); + meETLTrackMatchedTPPtTot_ = + ibook.book1D("ETLTrackMatchedTPPtTot", "Pt of tracks matched to TP; track pt [GeV] ", 50, 0., 10.); + meETLTrackMatchedTPPtMtd_ = ibook.book1D( + "ETLTrackMatchedTPPtMtd", "Pt of tracks matched to TP with time (>=1 ETL hit); track pt [GeV] ", 50, 0., 10.); + meETLTrackMatchedTPPt2Mtd_ = ibook.book1D( + "ETLTrackMatchedTPPt2Mtd", "Pt of tracks matched to TP with time (2 ETL hits); track pt [GeV] ", 50, 0., 10.); + + if (optionalPlots_) { + meBTLTrackMatchedTPPtResMtd_ = ibook.book1D( + "TrackMatchedTPBTLPtResMtd", + "Pt resolution of tracks matched to TP-BTL hit ;|pT_{MTDtrack}-pT_{truth}|/|pT_{Gentrack}-pT_{truth}| ", + 100, + 0., + 4.); + meETLTrackMatchedTPPtResMtd_ = ibook.book1D( + "TrackMatchedTPETLPtResMtd", + "Pt resolution of tracks matched to TP-ETL hit ;|pT_{MTDtrack}-pT_{truth}|/|pT_{Gentrack}-pT_{truth}| ", + 100, + 0., + 4.); + meETLTrackMatchedTP2PtResMtd_ = ibook.book1D( + "TrackMatchedTPETL2PtResMtd", + "Pt resolution of tracks matched to TP-ETL 2hits ;|pT_{MTDtrack}-pT_{truth}|/|pT_{Gentrack}-pT_{truth}| ", + 100, + 0., + 4.); + meBTLTrackMatchedTPPtRatioGen_ = ibook.book1D( + "TrackMatchedTPBTLPtRatioGen", "Pt ratio of Gentracks (BTL) ;pT_{Gentrack}/pT_{truth} ", 100, 0.9, 1.1); + meETLTrackMatchedTPPtRatioGen_ = ibook.book1D( + "TrackMatchedTPETLPtRatioGen", "Pt ratio of Gentracks (ETL 1hit) ;pT_{Gentrack}/pT_{truth} ", 100, 0.9, 1.1); + meETLTrackMatchedTP2PtRatioGen_ = ibook.book1D( + "TrackMatchedTPETL2PtRatioGen", "Pt ratio of Gentracks (ETL 2hits) ;pT_{Gentrack}/pT_{truth} ", 100, 0.9, 1.1); + meBTLTrackMatchedTPPtRatioMtd_ = + ibook.book1D("TrackMatchedTPBTLPtRatioMtd", + "Pt ratio of tracks matched to TP-BTL hit ;pT_{MTDtrack}/pT_{truth} ", + 100, + 0.9, + 1.1); + meETLTrackMatchedTPPtRatioMtd_ = + ibook.book1D("TrackMatchedTPETLPtRatioMtd", + "Pt ratio of tracks matched to TP-ETL hit ;pT_{MTDtrack}/pT_{truth} ", + 100, + 0.9, + 1.1); + meETLTrackMatchedTP2PtRatioMtd_ = + ibook.book1D("TrackMatchedTPETL2PtRatioMtd", + "Pt ratio of tracks matched to TP-ETL 2hits ;pT_{MTDtrack}/pT_{truth} ", + 100, + 0.9, + 1.1); + meBTLTrackMatchedTPPtResvsPtMtd_ = + ibook.bookProfile("TrackMatchedTPBTLPtResvsPtMtd", + "Pt resolution of tracks matched to TP-BTL hit vs Pt;pT_{truth} " + "[GeV];|pT_{MTDtrack}-pT_{truth}|/|pT_{Gentrack}-pT_{truth}| ", + 20, + 0.7, + 10., + 0., + 4., + "s"); + meETLTrackMatchedTPPtResvsPtMtd_ = + ibook.bookProfile("TrackMatchedTPETLPtResvsPtMtd", + "Pt resolution of tracks matched to TP-ETL hit vs Pt;pT_{truth} " + "[GeV];|pT_{MTDtrack}-pT_{truth}|/|pT_{Gentrack}-pT_{truth}| ", + 20, + 0.7, + 10., + 0., + 4., + "s"); + meETLTrackMatchedTP2PtResvsPtMtd_ = + ibook.bookProfile("TrackMatchedTPETL2PtResvsPtMtd", + "Pt resolution of tracks matched to TP-ETL 2hits Pt pT;pT_{truth} " + "[GeV];|pT_{MTDtrack}-pT_{truth}|/|pT_{Gentrack}-pT_{truth}| ", + 20, + 0.7, + 10., + 0., + 4., + "s"); + meBTLTrackMatchedTPDPtvsPtGen_ = ibook.bookProfile( + "TrackMatchedTPBTLDPtvsPtGen", + "Pt relative difference of Gentracks (BTL) vs Pt;pT_{truth} [GeV];pT_{Gentrack}-pT_{truth}/pT_{truth} ", + 20, + 0.7, + 10., + -0.1, + 0.1, + "s"); + meETLTrackMatchedTPDPtvsPtGen_ = ibook.bookProfile( + "TrackMatchedTPETLDPtvsPtGen", + "Pt relative difference of Gentracks (ETL 1hit) vs Pt;pT_{truth} [GeV];pT_{Gentrack}-pT_{truth}/pT_{truth} ", + 20, + 0.7, + 10., + -0.1, + 0.1, + "s"); + meETLTrackMatchedTP2DPtvsPtGen_ = ibook.bookProfile( + "TrackMatchedTPETL2DPtvsPtGen", + "Pt relative difference of Gentracks (ETL 2hits) vs Pt;pT_{truth} [GeV];pT_{Gentrack}-pT_{truth}/pT_{truth} ", + 20, + 0.7, + 10., + -0.1, + 0.1, + "s"); + meBTLTrackMatchedTPDPtvsPtMtd_ = ibook.bookProfile("TrackMatchedTPBTLDPtvsPtMtd", + "Pt relative difference of tracks matched to TP-BTL hits vs " + "Pt;pT_{truth} [GeV];pT_{MTDtrack}-pT_{truth}/pT_{truth} ", 20, 0.7, 10., - 0., - 4., + -0.1, + 0.1, "s"); - meETLTrackMatchedTPPtResvsPtMtd_ = ibook.bookProfile("TrackMatchedTPETLPtResvsPtMtd", - "Pt resolution of tracks matched to TP-ETL hit vs Pt;pT_{truth} " - "[GeV];|pT_{MTDtrack}-pT_{truth}|/|pT_{Gentrack}-pT_{truth}| ", + meETLTrackMatchedTPDPtvsPtMtd_ = ibook.bookProfile("TrackMatchedTPETLDPtvsPtMtd", + "Pt relative difference of tracks matched to TP-ETL hits vs " + "Pt;pT_{truth} [GeV];pT_{MTDtrack}-pT_{truth}/pT_{truth} ", 20, 0.7, 10., - 0., - 4., + -0.1, + 0.1, "s"); - meETLTrackMatchedTP2PtResvsPtMtd_ = - ibook.bookProfile("TrackMatchedTPETL2PtResvsPtMtd", - "Pt resolution of tracks matched to TP-ETL 2hits Pt pT;pT_{truth} " - "[GeV];|pT_{MTDtrack}-pT_{truth}|/|pT_{Gentrack}-pT_{truth}| ", - 20, - 0.7, - 10., - 0., - 4., - "s"); - meBTLTrackMatchedTPDPtvsPtGen_ = ibook.bookProfile( - "TrackMatchedTPBTLDPtvsPtGen", - "Pt relative difference of Gentracks (BTL) vs Pt;pT_{truth} [GeV];pT_{Gentrack}-pT_{truth}/pT_{truth} ", - 20, - 0.7, - 10., - -0.1, - 0.1, - "s"); - meETLTrackMatchedTPDPtvsPtGen_ = ibook.bookProfile( - "TrackMatchedTPETLDPtvsPtGen", - "Pt relative difference of Gentracks (ETL 1hit) vs Pt;pT_{truth} [GeV];pT_{Gentrack}-pT_{truth}/pT_{truth} ", - 20, - 0.7, - 10., - -0.1, - 0.1, - "s"); - meETLTrackMatchedTP2DPtvsPtGen_ = ibook.bookProfile( - "TrackMatchedTPETL2DPtvsPtGen", - "Pt relative difference of Gentracks (ETL 2hits) vs Pt;pT_{truth} [GeV];pT_{Gentrack}-pT_{truth}/pT_{truth} ", - 20, - 0.7, - 10., - -0.1, - 0.1, - "s"); - meBTLTrackMatchedTPDPtvsPtMtd_ = ibook.bookProfile("TrackMatchedTPBTLDPtvsPtMtd", - "Pt relative difference of tracks matched to TP-BTL hits vs " - "Pt;pT_{truth} [GeV];pT_{MTDtrack}-pT_{truth}/pT_{truth} ", - 20, - 0.7, - 10., - -0.1, - 0.1, - "s"); - meETLTrackMatchedTPDPtvsPtMtd_ = ibook.bookProfile("TrackMatchedTPETLDPtvsPtMtd", - "Pt relative difference of tracks matched to TP-ETL hits vs " - "Pt;pT_{truth} [GeV];pT_{MTDtrack}-pT_{truth}/pT_{truth} ", - 20, - 0.7, - 10., - -0.1, - 0.1, - "s"); - meETLTrackMatchedTP2DPtvsPtMtd_ = ibook.bookProfile("TrackMatchedTPETL2DPtvsPtMtd", - "Pt relative difference of tracks matched to TP-ETL 2hits vs " - "Pt;pT_{truth} [GeV];pT_{MTDtrack}-pT_{truth}/pT_{truth} ", - 20, - 0.7, - 10., - -0.1, - 0.1, - "s"); - - meTrackMatchedTPmtdEffPtTot_ = - ibook.book1D("MatchedTPmtdEffPtTot", "Pt of tracks matched to TP-mtd hit; track pt [GeV] ", 110, 0., 11.); - meTrackMatchedTPmtdEffPtMtd_ = ibook.book1D( - "MatchedTPmtdEffPtMtd", "Pt of tracks matched to TP-mtd hit with time; track pt [GeV] ", 110, 0., 11.); - - meExtraEtaMtd_ = - ibook.book1D("ExtraEtaMtd", "Eta of tracks associated to LV extrapolated to hits; track eta ", 66, 0., 3.3); - meExtraEtaEtl2Mtd_ = ibook.book1D( - "ExtraEtaEtl2Mtd", "Eta of tracks associated to LV extrapolated to hits, 2 ETL layers; track eta ", 66, 0., 3.3); - - meTrackEtaTot_ = ibook.book1D("TrackEtaTot", "Eta of tracks ; track eta ", 66, 0., 3.3); - meTrackMatchedTPEffEtaTot_ = - ibook.book1D("MatchedTPEffEtaTot", "Eta of tracks matched to TP; track eta ", 66, 0., 3.3); - meTrackMatchedTPEffEtaTotLV_ = - ibook.book1D("MatchedTPEffEtaTotLV", "Eta of tracks associated to LV matched to TP; track eta ", 66, 0., 3.3); - meTrackMatchedTPEffEtaMtd_ = - ibook.book1D("MatchedTPEffEtaMtd", "Eta of tracks matched to TP with time; track eta ", 66, 0., 3.3); - meTrackMatchedTPEffEtaEtl2Mtd_ = ibook.book1D( - "MatchedTPEffEtaEtl2Mtd", "Eta of tracks matched to TP with time, 2 ETL hits; track eta ", 66, 0., 3.3); - - meTrackMatchedTPmtdEffEtaTot_ = - ibook.book1D("MatchedTPmtdEffEtaTot", "Eta of tracks matched to TP-mtd hit; track eta ", 66, 0., 3.3); - meTrackMatchedTPmtdEffEtaMtd_ = - ibook.book1D("MatchedTPmtdEffEtaMtd", "Eta of tracks matched to TP-mtd hit with time; track eta ", 66, 0., 3.3); + meETLTrackMatchedTP2DPtvsPtMtd_ = ibook.bookProfile("TrackMatchedTPETL2DPtvsPtMtd", + "Pt relative difference of tracks matched to TP-ETL 2hits vs " + "Pt;pT_{truth} [GeV];pT_{MTDtrack}-pT_{truth}/pT_{truth} ", + 20, + 0.7, + 10., + -0.1, + 0.1, + "s"); + } // end optional plots meTrackResTot_ = ibook.book1D( "TrackRes", "t_{rec} - t_{sim} for LV associated tracks matched to TP; t_{rec} - t_{sim} [ns] ", 120, -0.15, 0.15); @@ -1219,6 +1624,435 @@ void MtdTracksValidation::bookHistograms(DQMStore::IBooker& ibook, edm::Run cons 110, 0., 11.); + + // Book the histograms for track-hit matching based on MC truth + meBTLTrackMatchedTPmtdDirectEta_ = + ibook.book1D("BTLTrackMatchedTPmtdDirectEta", + "Eta of tracks matched to TP with sim hit in MTD (direct);#eta_{RECO}", + 30, + 0., + 1.5); + meBTLTrackMatchedTPmtdDirectPt_ = + ibook.book1D("BTLTrackMatchedTPmtdDirectPt", + "Pt of tracks matched to TP with sim hit in MTD (direct); track pt [GeV]", + 50, + 0., + 10.); + + meBTLTrackMatchedTPmtdOtherEta_ = ibook.book1D("BTLTrackMatchedTPmtdOtherEta", + "Eta of tracks matched to TP with sim hit in MTD (other);#eta_{RECO}", + 30, + 0., + 1.5); + meBTLTrackMatchedTPmtdOtherPt_ = + ibook.book1D("BTLTrackMatchedTPmtdOtherPt", + "Pt of tracks matched to TP with sim hit in MTD (other); track pt [GeV]", + 50, + 0., + 10.); + + meBTLTrackMatchedTPnomtdEta_ = ibook.book1D( + "BTLTrackMatchedTPnomtdEta", "Eta of tracks matched to TP w/o sim hit in MTD;#eta_{RECO}", 30, 0., 1.5); + meBTLTrackMatchedTPnomtdPt_ = ibook.book1D( + "BTLTrackMatchedTPnomtdPt", "Pt of tracks matched to TP w/o sim hit in MTD; track pt [GeV]", 50, 0., 10.); + + meBTLTrackMatchedTPmtdDirectCorrectAssocEta_ = ibook.book1D( + "BTLTrackMatchedTPmtdDirectCorrectAssocEta", + "Eta of tracks matched to TP with sim hit in MTD (direct), correct track-MTD association;#eta_{RECO}", + 30, + 0., + 1.5); + meBTLTrackMatchedTPmtdDirectCorrectAssocPt_ = ibook.book1D( + "BTLTrackMatchedTPmtdDirectCorrectAssocPt", + "Pt of tracks matched to TP with sim hit in MTD (direct) - correct track-MTD association;track pt [GeV]", + 50, + 0., + 10.); + meBTLTrackMatchedTPmtdDirectCorrectAssocMVAQual_ = ibook.book1D( + "BTLTrackMatchedTPmtdDirectCorrectAssocMVAQual", + "MVA of tracks matched to TP with sim hit in MTD (direct) - correct track-MTD association; MVA score", + 100, + -1., + 1.); + meBTLTrackMatchedTPmtdDirectCorrectAssocTimeRes_ = + ibook.book1D("BTLTrackMatchedTPmtdDirectCorrectAssocTimeRes", + "Time resolution of tracks matched to TP with sim hit in MTD (direct) - correct track-MTD " + "association; t_{rec} - t_{sim} [ns] ", + 120, + -0.15, + 0.15); + meBTLTrackMatchedTPmtdDirectCorrectAssocTimePull_ = + ibook.book1D("BTLTrackMatchedTPmtdDirectCorrectAssocTimePull", + "Time pull of tracks matched to TP with sim hit in MTD (direct) - correct track-MTD association; " + "(t_{rec}-t_{sim})/#sigma_{t}", + 50, + -5., + 5.); + + meBTLTrackMatchedTPmtdDirectWrongAssocEta_ = + ibook.book1D("BTLTrackMatchedTPmtdDirectWrongAssocEta", + "Eta of tracks matched to TP with sim hit in MTD (direct) - wrong track-MTD association;#eta_{RECO}", + 30, + 0., + 1.5); + meBTLTrackMatchedTPmtdDirectWrongAssocPt_ = ibook.book1D( + "BTLTrackMatchedTPmtdDirectWrongAssocPt", + "Pt of tracks matched to TP with sim hit in MTD (direct) - wrong track-MTD association;track pt [GeV]", + 50, + 0., + 10.); + meBTLTrackMatchedTPmtdDirectWrongAssocMVAQual_ = + ibook.book1D("BTLTrackMatchedTPmtdDirectWrongAssocMVAQual", + "MVA of tracks matched to TP with sim hit in MTD (direct) - wrong track-MTD association; MVA score", + 100, + -1., + 1.); + meBTLTrackMatchedTPmtdDirectWrongAssocTimeRes_ = + ibook.book1D("BTLTrackMatchedTPmtdDirectWrongAssocTimeRes", + "Time resolution of tracks matched to TP with sim hit in MTD (direct) - wrong track-MTD " + "association; t_{rec} - t_{sim} [ns] ", + 120, + -0.15, + 0.15); + meBTLTrackMatchedTPmtdDirectWrongAssocTimePull_ = + ibook.book1D("BTLTrackMatchedTPmtdDirectWrongAssocTimePull", + "Time pull of tracks matched to TP with sim hit in MTD (direct) - wrong track-MTD association; " + "(t_{rec}-t_{sim})/#sigma_{t}", + 50, + -5., + 5.); + + meBTLTrackMatchedTPmtdDirectNoAssocEta_ = + ibook.book1D("BTLTrackMatchedTPmtdDirectNoAssocEta", + "Eta of tracks matched to TP with sim hit in MTD (direct) - no track-MTD association;#eta_{RECO}", + 30, + 0., + 1.5); + meBTLTrackMatchedTPmtdDirectNoAssocPt_ = + ibook.book1D("BTLTrackMatchedTPmtdDirectNoAssocPt", + "Pt of tracks matched to TP with sim hit in MTD (direct) - no track-MTD association;track pt [GeV]", + 50, + 0., + 10.); + + meBTLTrackMatchedTPmtdOtherCorrectAssocEta_ = ibook.book1D( + "BTLTrackMatchedTPmtdOtherCorrectAssocEta", + "Eta of tracks matched to TP with sim hit in MTD (direct), correct track-MTD association;#eta_{RECO}", + 30, + 0., + 1.5); + meBTLTrackMatchedTPmtdOtherCorrectAssocPt_ = ibook.book1D( + "BTLTrackMatchedTPmtdOtherCorrectAssocPt", + "Pt of tracks matched to TP with sim hit in MTD (direct) - correct track-MTD association;track pt [GeV]", + 50, + 0., + 10.); + meBTLTrackMatchedTPmtdOtherCorrectAssocMVAQual_ = ibook.book1D( + "BTLTrackMatchedTPmtdOtherCorrectAssocMVAQual", + "MVA of tracks matched to TP with sim hit in MTD (direct) - correct track-MTD association; MVA score", + 100, + -1., + 1.); + meBTLTrackMatchedTPmtdOtherCorrectAssocTimeRes_ = + ibook.book1D("BTLTrackMatchedTPmtdOtherCorrectAssocTimeRes", + "Time resolution of tracks matched to TP with sim hit in MTD (direct) - correct track-MTD " + "association; t_{rec} - t_{sim} [ns] ", + 120, + -0.15, + 0.15); + meBTLTrackMatchedTPmtdOtherCorrectAssocTimePull_ = + ibook.book1D("BTLTrackMatchedTPmtdOtherCorrectAssocTimePull", + "Time pull of tracks matched to TP with sim hit in MTD (direct) - correct track-MTD association; " + "(t_{rec}-t_{sim})/#sigma_{t}", + 50, + -5., + 5.); + + meBTLTrackMatchedTPmtdOtherWrongAssocEta_ = + ibook.book1D("BTLTrackMatchedTPmtdOtherWrongAssocEta", + "Eta of tracks matched to TP with sim hit in MTD (direct) - wrong track-MTD association;#eta_{RECO}", + 30, + 0., + 1.5); + meBTLTrackMatchedTPmtdOtherWrongAssocPt_ = ibook.book1D( + "BTLTrackMatchedTPmtdOtherWrongAssocPt", + "Pt of tracks matched to TP with sim hit in MTD (direct) - wrong track-MTD association;track pt [GeV]", + 50, + 0., + 10.); + meBTLTrackMatchedTPmtdOtherWrongAssocMVAQual_ = + ibook.book1D("BTLTrackMatchedTPmtdOtherWrongAssocMVAQual", + "MVA of tracks matched to TP with sim hit in MTD (direct) - wrong track-MTD association; MVA score", + 100, + -1., + 1.); + meBTLTrackMatchedTPmtdOtherWrongAssocTimeRes_ = + ibook.book1D("BTLTrackMatchedTPmtdOtherWrongAssocTimeRes", + "Time resolution of tracks matched to TP with sim hit in MTD (direct) - wrong track-MTD " + "association; t_{rec} - t_{sim} [ns] ", + 120, + -0.15, + 0.15); + meBTLTrackMatchedTPmtdOtherWrongAssocTimePull_ = + ibook.book1D("BTLTrackMatchedTPmtdOtherWrongAssocTimePull", + "Time pull of tracks matched to TP with sim hit in MTD (direct) - wrong track-MTD association; " + "(t_{rec}-t_{sim})/#sigma_{t}", + 50, + -5., + 5.); + + meBTLTrackMatchedTPmtdOtherNoAssocEta_ = + ibook.book1D("BTLTrackMatchedTPmtdOtherNoAssocEta", + "Eta of tracks matched to TP with sim hit in MTD (direct) - no track-MTD association;#eta_{RECO}", + 30, + 0., + 1.5); + meBTLTrackMatchedTPmtdOtherNoAssocPt_ = + ibook.book1D("BTLTrackMatchedTPmtdOtherNoAssocPt", + "Pt of tracks matched to TP with sim hit in MTD (direct) - no track-MTD association;track pt [GeV]", + 50, + 0., + 10.); + + meBTLTrackMatchedTPnomtdAssocEta_ = + ibook.book1D("BTLTrackMatchedTPnomtdAssocEta", + "Eta of tracks matched to TP w/o sim hit in MTD, with associated reco cluster;#eta_{RECO}", + 30, + 0., + 1.5); + meBTLTrackMatchedTPnomtdAssocPt_ = + ibook.book1D("BTLTrackMatchedTPnomtdAssocPt", + "Pt of tracks matched to TP w/o sim hit in MTD, with associated reco cluster;track pt [GeV]", + 50, + 0., + 10.); + meBTLTrackMatchedTPnomtdAssocMVAQual_ = + ibook.book1D("BTLTrackMatchedTPnomtdAssocMVAQual", + "MVA of tracks matched to TP w/o sim hit in MTD, with associated reco cluster; MVA score", + 100, + -1., + 1.); + meBTLTrackMatchedTPnomtdAssocTimeRes_ = ibook.book1D("BTLTrackMatchedTPnomtdAssocTimeRes", + "Time resolution of tracks matched to TP w/o sim hit in MTD, " + "with associated reco cluster; t_{rec} - t_{sim} [ns] ", + 120, + -0.15, + 0.15); + meBTLTrackMatchedTPnomtdAssocTimePull_ = ibook.book1D("BTLTrackMatchedTPnomtdAssocTimePull", + "Time pull of tracks matched to TP w/o sim hit in MTD, with " + "associated reco cluster; (t_{rec}-t_{sim})/#sigma_{t}", + 50, + -5., + 5.); + + meETLTrackMatchedTPmtd1Eta_ = ibook.book1D("ETLTrackMatchedTPmtd1Eta", + "Eta of tracks matched to TP with sim hit in MTD (>= 1 hit);#eta_{RECO}", + 30, + 1.5, + 3.0); + meETLTrackMatchedTPmtd1Pt_ = ibook.book1D("ETLTrackMatchedTPmtd1Pt", + "Pt of tracks matched to TP with sim hit in MTD (>= 1 hit); track pt [GeV]", + 50, + 0., + 10.); + + meETLTrackMatchedTPmtd2Eta_ = ibook.book1D( + "ETLTrackMatchedTPmtd2Eta", "Eta of tracks matched to TP with sim hit in MTD (2 hits);#eta_{RECO}", 30, 1.5, 3.0); + meETLTrackMatchedTPmtd2Pt_ = ibook.book1D( + "ETLTrackMatchedTPmtd2Pt", "Pt of tracks matched to TP with sim hit in MTD (2 hits); track pt [GeV]", 50, 0., 10.); + + meETLTrackMatchedTPnomtdEta_ = ibook.book1D( + "ETLTrackMatchedTPnomtdEta", "Eta of tracks matched to TP w/o sim hit in MTD;#eta_{RECO}", 30, 1.5, 3.0); + meETLTrackMatchedTPnomtdPt_ = ibook.book1D( + "ETLTrackMatchedTPnomtdPt", "Pt of tracks matched to TP w/o sim hit in MTD; track pt [GeV]", 50, 0., 10.); + + meETLTrackMatchedTPmtd1CorrectAssocEta_ = ibook.book1D( + "ETLTrackMatchedTPmtd1CorrectAssocEta", + "Eta of tracks matched to TP with sim hit in MTD (>= 1 hit), correct track-MTD association;#eta_{RECO}", + 30, + 1.5, + 3.0); + meETLTrackMatchedTPmtd1CorrectAssocPt_ = ibook.book1D( + "ETLTrackMatchedTPmtd1CorrectAssocPt", + "Pt of tracks matched to TP with sim hit in MTD (>= 1 hit) - correct track-MTD association;track pt [GeV]", + 50, + 0., + 10.); + meETLTrackMatchedTPmtd1CorrectAssocMVAQual_ = ibook.book1D( + "ETLTrackMatchedTPmtd1CorrectAssocMVAQual", + "MVA of tracks matched to TP with sim hit in MTD (>= 1 hit) - correct track-MTD association; MVA score", + 100, + -1., + 1.); + meETLTrackMatchedTPmtd1CorrectAssocTimeRes_ = + ibook.book1D("ETLTrackMatchedTPmtd1CorrectAssocTimeRes", + "Time resolution of tracks matched to TP with sim hit in MTD (>= 1 hit) - correct track-MTD " + "association; t_{rec} - t_{sim} [ns] ", + 120, + -0.15, + 0.15); + meETLTrackMatchedTPmtd1CorrectAssocTimePull_ = + ibook.book1D("ETLTrackMatchedTPmtd1CorrectAssocTimePull", + "Time pull of tracks matched to TP with sim hit in MTD (>= 1 hit) - correct track-MTD association; " + "(t_{rec}-t_{sim})/#sigma_{t}", + 50, + -5., + 5.); + + meETLTrackMatchedTPmtd2CorrectAssocEta_ = ibook.book1D( + "ETLTrackMatchedTPmtd2CorrectAssocEta", + "Eta of tracks matched to TP with sim hit in MTD (2 hits), correct track-MTD association;#eta_{RECO}", + 30, + 1.5, + 3.0); + meETLTrackMatchedTPmtd2CorrectAssocPt_ = ibook.book1D( + "ETLTrackMatchedTPmtd2CorrectAssocPt", + "Pt of tracks matched to TP with sim hit in MTD (2 hits) - correct track-MTD association;track pt [GeV]", + 50, + 0., + 10.); + meETLTrackMatchedTPmtd2CorrectAssocMVAQual_ = ibook.book1D( + "ETLTrackMatchedTPmtd2CorrectAssocMVAQual", + "MVA of tracks matched to TP with sim hit in MTD (2 hits) - correct track-MTD association; MVA score", + 100, + -1., + 1.); + meETLTrackMatchedTPmtd2CorrectAssocTimeRes_ = + ibook.book1D("ETLTrackMatchedTPmtd2CorrectAssocTimeRes", + "Time resolution of tracks matched to TP with sim hit in MTD (2 hits) - correct track-MTD " + "association; t_{rec} - t_{sim} [ns] ", + 120, + -0.15, + 0.15); + meETLTrackMatchedTPmtd2CorrectAssocTimePull_ = + ibook.book1D("ETLTrackMatchedTPmtd2CorrectAssocTimePull", + "Time pull of tracks matched to TP with sim hit in MTD (2 hits) - correct track-MTD association; " + "(t_{rec}-t_{sim})/#sigma_{t}", + 50, + -5., + 5.); + + meETLTrackMatchedTPmtd1WrongAssocEta_ = ibook.book1D( + "ETLTrackMatchedTPmtd1WrongAssocEta", + "Eta of tracks matched to TP with sim hit in MTD (>= 1 hit), wrong track-MTD association;#eta_{RECO}", + 30, + 1.5, + 3.0); + meETLTrackMatchedTPmtd1WrongAssocPt_ = ibook.book1D( + "ETLTrackMatchedTPmtd1WrongAssocPt", + "Pt of tracks matched to TP with sim hit in MTD (>= 1 hit) - wrong track-MTD association;track pt [GeV]", + 50, + 0., + 10.); + meETLTrackMatchedTPmtd1WrongAssocMVAQual_ = ibook.book1D( + "ETLTrackMatchedTPmtd1WrongAssocMVAQual", + "MVA of tracks matched to TP with sim hit in MTD (>= 1 hit) - wrong track-MTD association; MVA score", + 100, + -1., + 1.); + meETLTrackMatchedTPmtd1WrongAssocTimeRes_ = + ibook.book1D("ETLTrackMatchedTPmtd1WrongAssocTimeRes", + "Time resolution of tracks matched to TP with sim hit in MTD (>= 1 hit) - wrong track-MTD " + "association; t_{rec} - t_{sim} [ns] ", + 120, + -0.15, + 0.15); + meETLTrackMatchedTPmtd1WrongAssocTimePull_ = + ibook.book1D("ETLTrackMatchedTPmtd1WrongAssocTimePull", + "Time pull of tracks matched to TP with sim hit in MTD (>= 1 hit) - wrong track-MTD association; " + "(t_{rec}-t_{sim})/#sigma_{t}", + 50, + -5., + 5.); + + meETLTrackMatchedTPmtd2WrongAssocEta_ = + ibook.book1D("ETLTrackMatchedTPmtd2WrongAssocEta", + "Eta of tracks matched to TP with sim hit in MTD (2 hits), wrong track-MTD association;#eta_{RECO}", + 30, + 1.5, + 3.0); + meETLTrackMatchedTPmtd2WrongAssocPt_ = ibook.book1D( + "ETLTrackMatchedTPmtd2WrongAssocPt", + "Pt of tracks matched to TP with sim hit in MTD (2 hits) - wrong track-MTD association;track pt [GeV]", + 50, + 0., + 10.); + meETLTrackMatchedTPmtd2WrongAssocMVAQual_ = + ibook.book1D("ETLTrackMatchedTPmtd2WrongAssocMVAQual", + "MVA of tracks matched to TP with sim hit in MTD (2 hits) - wrong track-MTD association; MVA score", + 100, + -1., + 1.); + meETLTrackMatchedTPmtd2WrongAssocTimeRes_ = + ibook.book1D("ETLTrackMatchedTPmtd2WrongAssocTimeRes", + "Time resolution of tracks matched to TP with sim hit in MTD (2 hits) - wrong track-MTD " + "association; t_{rec} - t_{sim} [ns] ", + 120, + -0.15, + 0.15); + meETLTrackMatchedTPmtd2WrongAssocTimePull_ = + ibook.book1D("ETLTrackMatchedTPmtd2WrongAssocTimePull", + "Time pull of tracks matched to TP with sim hit in MTD (2 hits) - wrong track-MTD association; " + "(t_{rec}-t_{sim})/#sigma_{t}", + 50, + -5., + 5.); + + meETLTrackMatchedTPmtd1NoAssocEta_ = ibook.book1D( + "ETLTrackMatchedTPmtd1NoAssocEta", + "Eta of tracks matched to TP with sim hit in MTD (>= 1 hit), missing track-MTD association;#eta_{RECO}", + 30, + 1.5, + 3.0); + meETLTrackMatchedTPmtd1NoAssocPt_ = ibook.book1D( + "ETLTrackMatchedTPmtd1NoAssocPt", + "Pt of tracks matched to TP with sim hit in MTD (>= 1 hit) - missing track-MTD association;track pt [GeV]", + 50, + 0., + 10.); + + meETLTrackMatchedTPmtd2NoAssocEta_ = ibook.book1D( + "ETLTrackMatchedTPmtd2NoAssocEta", + "Eta of tracks matched to TP with sim hit in MTD (2 hits), missing track-MTD association;#eta_{RECO}", + 30, + 1.5, + 3.0); + meETLTrackMatchedTPmtd2NoAssocPt_ = ibook.book1D( + "ETLTrackMatchedTPmtd2NoAssocPt", + "Pt of tracks matched to TP with sim hit in MTD (2 hits) - missing track-MTD association;track pt [GeV]", + 50, + 0., + 10.); + meETLTrackMatchedTPnomtdAssocEta_ = + ibook.book1D("ETLTrackMatchedTPnomtdAssocEta", + "Eta of tracks matched to TP w/o sim hit in MTD, with associated reco cluster;#eta_{RECO}", + 30, + 1.5, + 3.0); + meETLTrackMatchedTPnomtdAssocPt_ = + ibook.book1D("ETLTrackMatchedTPnomtdAssocPt", + "Pt of tracks matched to TP w/o sim hit in MTD, with associated reco cluster;track pt [GeV]", + 50, + 0., + 10.); + meETLTrackMatchedTPnomtdAssocMVAQual_ = + ibook.book1D("ETLTrackMatchedTPnomtdAssocMVAQual", + "MVA of tracks matched to TP w/o sim hit in MTD, with associated reco cluster; MVA score", + 100, + -1., + 1.); + meETLTrackMatchedTPnomtdAssocTimeRes_ = ibook.book1D("ETLTrackMatchedTPnomtdAssocTimeRes", + "Time resolution of tracks matched to TP w/o sim hit in MTD, " + "with associated reco cluster; t_{rec} - t_{sim} [ns] ", + 120, + -0.15, + 0.15); + meETLTrackMatchedTPnomtdAssocTimePull_ = ibook.book1D("ETLTrackMatchedTPnomtdAssocTimePull", + "Time pull of tracks matched to TP w/o sim hit in MTD, with " + "associated reco cluster; (t_{rec}-t_{sim})/#sigma_{t}", + 50, + -5., + 5.); } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ @@ -1227,6 +2061,7 @@ void MtdTracksValidation::fillDescriptions(edm::ConfigurationDescriptions& descr edm::ParameterSetDescription desc; desc.add("folder", "MTD/Tracks"); + desc.add("optionalPlots", false); desc.add("inputTagG", edm::InputTag("generalTracks")); desc.add("inputTagT", edm::InputTag("trackExtenderWithMTD")); desc.add("inputTagV", edm::InputTag("offlinePrimaryVertices4D")); @@ -1234,8 +2069,11 @@ void MtdTracksValidation::fillDescriptions(edm::ConfigurationDescriptions& descr desc.add("SimTag", edm::InputTag("mix", "MergedTrackTruth")); desc.add("TPtoRecoTrackAssoc", edm::InputTag("trackingParticleRecoTrackAsssociation")); desc.add("tp2SimAssociationMapTag", edm::InputTag("mtdSimLayerClusterToTPAssociation")); + desc.add("r2sAssociationMapTag", edm::InputTag("mtdRecoClusterToSimLayerClusterAssociation")); desc.add("btlRecHits", edm::InputTag("mtdRecHits", "FTLBarrel")); desc.add("etlRecHits", edm::InputTag("mtdRecHits", "FTLEndcap")); + desc.add("recCluTagBTL", edm::InputTag("mtdClusters", "FTLBarrel")); + desc.add("recCluTagETL", edm::InputTag("mtdClusters", "FTLEndcap")); desc.add("tmtd", edm::InputTag("trackExtenderWithMTD:generalTracktmtd")); desc.add("sigmatmtd", edm::InputTag("trackExtenderWithMTD:generalTracksigmatmtd")); desc.add("t0Src", edm::InputTag("trackExtenderWithMTD:generalTrackt0")); @@ -1309,4 +2147,24 @@ const edm::Ref>* MtdTracksValidation::getMatchedTP return nullptr; } +void MtdTracksValidation::fillTrackClusterMatchingHistograms(MonitorElement* me1, + MonitorElement* me2, + MonitorElement* me3, + MonitorElement* me4, + MonitorElement* me5, + float var1, + float var2, + float var3, + float var4, + float var5, + bool flag) { + me1->Fill(var1); + me2->Fill(var2); + if (flag) { + me3->Fill(var3); + me4->Fill(var4); + me5->Fill(var5); + } +} + DEFINE_FWK_MODULE(MtdTracksValidation);