diff --git a/Alignment/CommonAlignmentProducer/plugins/BuildFile.xml b/Alignment/CommonAlignmentProducer/plugins/BuildFile.xml
index 781fb09984b88..3c7f11b7dbec7 100644
--- a/Alignment/CommonAlignmentProducer/plugins/BuildFile.xml
+++ b/Alignment/CommonAlignmentProducer/plugins/BuildFile.xml
@@ -53,5 +53,6 @@
+
diff --git a/Alignment/CommonAlignmentProducer/plugins/LSNumberFilter.cc b/Alignment/CommonAlignmentProducer/plugins/LSNumberFilter.cc
index 894cd67bdfd68..e13de5c930ad7 100644
--- a/Alignment/CommonAlignmentProducer/plugins/LSNumberFilter.cc
+++ b/Alignment/CommonAlignmentProducer/plugins/LSNumberFilter.cc
@@ -1,10 +1,11 @@
-#include "FWCore/Framework/interface/stream/EDFilter.h"
#include "FWCore/Framework/interface/Event.h"
-#include "FWCore/Framework/interface/Run.h"
-#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/EventSetup.h"
+#include "FWCore/Framework/interface/MakerMacros.h"
+#include "FWCore/Framework/interface/Run.h"
+#include "FWCore/Framework/interface/stream/EDFilter.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
+#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
//
// class declaration
@@ -13,17 +14,30 @@
class LSNumberFilter : public edm::stream::EDFilter<> {
public:
explicit LSNumberFilter(const edm::ParameterSet&);
- ~LSNumberFilter() override;
+ ~LSNumberFilter() override = default;
+
+ static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
private:
+ void beginRun(edm::Run const&, edm::EventSetup const&) override;
bool filter(edm::Event&, const edm::EventSetup&) override;
- unsigned int minLS;
+ bool is_HLT_vetoed_;
+ const unsigned int minLS_;
+ const std::vector veto_HLT_Menu_;
+ HLTConfigProvider hltConfig_;
};
-LSNumberFilter::LSNumberFilter(const edm::ParameterSet& iConfig)
- : minLS(iConfig.getUntrackedParameter("minLS", 21)) {}
+void LSNumberFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
+ edm::ParameterSetDescription desc;
+ desc.setComment("Filters the first minLS lumisections and reject the run according to the HLT menu name");
+ desc.addUntracked("minLS", 21)->setComment("first LS to accept");
+ desc.addUntracked>("veto_HLT_Menu", {})->setComment("list of HLT menus to reject");
+ descriptions.addWithDefaultLabel(desc);
+}
-LSNumberFilter::~LSNumberFilter() {}
+LSNumberFilter::LSNumberFilter(const edm::ParameterSet& iConfig)
+ : minLS_(iConfig.getUntrackedParameter("minLS", 21)),
+ veto_HLT_Menu_(iConfig.getUntrackedParameter>("veto_HLT_Menu")) {}
//
// member functions
@@ -31,11 +45,27 @@ LSNumberFilter::~LSNumberFilter() {}
// ------------ method called on each new Event ------------
bool LSNumberFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) {
- if (iEvent.luminosityBlock() < minLS)
+ if ((iEvent.luminosityBlock() < minLS_) || is_HLT_vetoed_) {
return false;
+ }
return true;
}
+void LSNumberFilter::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) {
+ bool changed{false};
+ hltConfig_.init(iRun, iSetup, "HLT", changed);
+ is_HLT_vetoed_ = false;
+ for (const auto& veto : veto_HLT_Menu_) {
+ std::size_t found = hltConfig_.tableName().find(veto);
+ if (found != std::string::npos) {
+ is_HLT_vetoed_ = true;
+ edm::LogWarning("LSNumberFilter") << "Detected " << veto
+ << " in HLT Config tableName(): " << hltConfig_.tableName()
+ << "; Events of this run will be ignored" << std::endl;
+ break;
+ }
+ }
+}
//define this as a plug-in
DEFINE_FWK_MODULE(LSNumberFilter);
diff --git a/Alignment/CommonAlignmentProducer/python/ALCARECOPromptCalibProdSiPixelAli0T_cff.py b/Alignment/CommonAlignmentProducer/python/ALCARECOPromptCalibProdSiPixelAli0T_cff.py
index 8e4c6a0694880..3efc11e01e7fa 100644
--- a/Alignment/CommonAlignmentProducer/python/ALCARECOPromptCalibProdSiPixelAli0T_cff.py
+++ b/Alignment/CommonAlignmentProducer/python/ALCARECOPromptCalibProdSiPixelAli0T_cff.py
@@ -151,7 +151,7 @@
seqALCARECOPromptCalibProdSiPixelAli = cms.Sequence(ALCARECOTkAlMinBiasFilterForSiPixelAli*
- lsNumberFilter*
+ LSNumberFilter*
offlineBeamSpot*
SiPixelAliHighPuritySelector*
SiPixelAliTrackRefitter0*
diff --git a/Alignment/CommonAlignmentProducer/python/ALCARECOPromptCalibProdSiPixelAliHGDiMuon_cff.py b/Alignment/CommonAlignmentProducer/python/ALCARECOPromptCalibProdSiPixelAliHGDiMuon_cff.py
index 7cc13a08481c8..9fae5a852ed78 100644
--- a/Alignment/CommonAlignmentProducer/python/ALCARECOPromptCalibProdSiPixelAliHGDiMuon_cff.py
+++ b/Alignment/CommonAlignmentProducer/python/ALCARECOPromptCalibProdSiPixelAliHGDiMuon_cff.py
@@ -123,7 +123,7 @@
fileBlobLabel = cms.string(''))
seqALCARECOPromptCalibProdSiPixelAliHGDiMu = cms.Sequence(ALCARECOTkAlZMuMuFilterForSiPixelAli*
- lsNumberFilter*
+ LSNumberFilter*
offlineBeamSpot*
SiPixelAliHighPuritySelectorHGDimuon*
SiPixelAliTrackRefitterHGDimuon0*
diff --git a/Alignment/CommonAlignmentProducer/python/ALCARECOPromptCalibProdSiPixelAliHG_cff.py b/Alignment/CommonAlignmentProducer/python/ALCARECOPromptCalibProdSiPixelAliHG_cff.py
index 2c47ea7b6da76..a550d30cb3b84 100644
--- a/Alignment/CommonAlignmentProducer/python/ALCARECOPromptCalibProdSiPixelAliHG_cff.py
+++ b/Alignment/CommonAlignmentProducer/python/ALCARECOPromptCalibProdSiPixelAliHG_cff.py
@@ -64,7 +64,7 @@
fileBlobLabel = cms.string(''))
seqALCARECOPromptCalibProdSiPixelAliHG = cms.Sequence(ALCARECOTkAlMinBiasFilterForSiPixelAliHG*
- lsNumberFilter*
+ LSNumberFilter*
offlineBeamSpot*
SiPixelAliHighPuritySelectorHG*
SiPixelAliTrackRefitterHG0*
diff --git a/Alignment/CommonAlignmentProducer/python/ALCARECOPromptCalibProdSiPixelAli_cff.py b/Alignment/CommonAlignmentProducer/python/ALCARECOPromptCalibProdSiPixelAli_cff.py
index e9aa2c08d81b9..366910788be41 100644
--- a/Alignment/CommonAlignmentProducer/python/ALCARECOPromptCalibProdSiPixelAli_cff.py
+++ b/Alignment/CommonAlignmentProducer/python/ALCARECOPromptCalibProdSiPixelAli_cff.py
@@ -149,7 +149,7 @@
seqALCARECOPromptCalibProdSiPixelAli = cms.Sequence(ALCARECOTkAlMinBiasFilterForSiPixelAli*
- lsNumberFilter*
+ LSNumberFilter*
offlineBeamSpot*
SiPixelAliHighPuritySelector*
SiPixelAliTrackRefitter0*
diff --git a/Alignment/CommonAlignmentProducer/python/LSNumberFilter_cfi.py b/Alignment/CommonAlignmentProducer/python/LSNumberFilter_cfi.py
index 5fa6d8c3b08ac..04a737c8bb335 100644
--- a/Alignment/CommonAlignmentProducer/python/LSNumberFilter_cfi.py
+++ b/Alignment/CommonAlignmentProducer/python/LSNumberFilter_cfi.py
@@ -1,5 +1,10 @@
import FWCore.ParameterSet.Config as cms
-lsNumberFilter = cms.EDFilter("LSNumberFilter",
- minLS = cms.untracked.uint32(21)
- )
+from Alignment.CommonAlignmentProducer.lsNumberFilter_cfi import lsNumberFilter
+LSNumberFilter = lsNumberFilter.clone(
+ minLS = 21,
+ veto_HLT_Menu = [
+ "LumiScan",
+ "PPS",
+ "ECALTiming"]
+ )
diff --git a/Alignment/CommonAlignmentProducer/python/TkAlMuonSelectors_cfi.py b/Alignment/CommonAlignmentProducer/python/TkAlMuonSelectors_cfi.py
index 667913e6b9a1e..1999a479cb05b 100644
--- a/Alignment/CommonAlignmentProducer/python/TkAlMuonSelectors_cfi.py
+++ b/Alignment/CommonAlignmentProducer/python/TkAlMuonSelectors_cfi.py
@@ -16,3 +16,16 @@
cut = cms.string('(isolationR03().sumPt + isolationR03().emEt + isolationR03().hadEt)/pt < 0.15'),
filter = cms.bool(True)
)
+
+## FIXME: these are needed for ALCARECO production in CMSSW_14_0_X
+## to avoid loosing in efficiency. To be reviewed after muon reco is fixed
+
+from Configuration.Eras.Modifier_phase2_common_cff import phase2_common
+phase2_common.toModify(TkAlGoodIdMuonSelector,
+ cut = '(abs(eta) < 2.5 & isGlobalMuon & isTrackerMuon & numberOfMatches > 1 & globalTrack.hitPattern.numberOfValidMuonHits > 0 & globalTrack.normalizedChi2 < 20.) ||' # regular selection
+ '(abs(eta) > 2.3 & abs(eta) < 3.0 & numberOfMatches >= 0 & isTrackerMuon)' # to recover GE0 tracks
+ )
+
+phase2_common.toModify(TkAlRelCombIsoMuonSelector,
+ cut = '(isolationR03().sumPt)/pt < 0.1' # only tracker isolation
+ )
diff --git a/Alignment/CommonAlignmentProducer/python/customizeLSNumberFilterForRelVals.py b/Alignment/CommonAlignmentProducer/python/customizeLSNumberFilterForRelVals.py
index 32bbbb6340325..fe0186ff1982a 100644
--- a/Alignment/CommonAlignmentProducer/python/customizeLSNumberFilterForRelVals.py
+++ b/Alignment/CommonAlignmentProducer/python/customizeLSNumberFilterForRelVals.py
@@ -6,8 +6,8 @@
##
def doNotFilterLS(process):
- if hasattr(process,'lsNumberFilter'):
- process.lsNumberFilter.minLS = 1
+ if hasattr(process,'LSNumberFilter'):
+ process.LSNumberFilter.minLS = 1
return process
##
diff --git a/Alignment/MillePedeAlignmentAlgorithm/test/BuildFile.xml b/Alignment/MillePedeAlignmentAlgorithm/test/BuildFile.xml
index 9a1f8a9757530..7a70030f4732c 100644
--- a/Alignment/MillePedeAlignmentAlgorithm/test/BuildFile.xml
+++ b/Alignment/MillePedeAlignmentAlgorithm/test/BuildFile.xml
@@ -11,6 +11,9 @@
+
+
+
diff --git a/Alignment/MillePedeAlignmentAlgorithm/test/align_params_cff.py b/Alignment/MillePedeAlignmentAlgorithm/test/align_params_cff.py
new file mode 100644
index 0000000000000..933aaa7bdcc2a
--- /dev/null
+++ b/Alignment/MillePedeAlignmentAlgorithm/test/align_params_cff.py
@@ -0,0 +1,12 @@
+import FWCore.ParameterSet.Config as cms
+
+_alignParams = cms.PSet(
+ alignParams = cms.vstring(
+ "TrackerP1PXBHalfBarrel,111111",
+ "TrackerP1PXECHalfCylinder,111111",
+ "TrackerTIBHalfBarrel,111111",
+ "TrackerTOBHalfBarrel,rrrrrr",
+ "TrackerTIDEndcap,111111",
+ "TrackerTECEndcap,111111",
+ )
+)
diff --git a/Alignment/MillePedeAlignmentAlgorithm/test/convertMPresToDB_cfg.py b/Alignment/MillePedeAlignmentAlgorithm/test/convertMPresToDB_cfg.py
new file mode 100644
index 0000000000000..169ca036aa21a
--- /dev/null
+++ b/Alignment/MillePedeAlignmentAlgorithm/test/convertMPresToDB_cfg.py
@@ -0,0 +1,111 @@
+import FWCore.ParameterSet.Config as cms
+
+from Configuration.Eras.Era_Run3_cff import Run3
+process = cms.Process("Alignment", Run3)
+
+process.options = cms.untracked.PSet(
+ Rethrow = cms.untracked.vstring("ProductNotFound") # do not accept this exception
+ )
+
+######################################################
+# initialize MessageLogger
+######################################################
+process.load("FWCore.MessageService.MessageLogger_cfi")
+process.MessageLogger.files.alignment = cms.untracked.PSet(
+ DEBUG = cms.untracked.PSet(
+ limit = cms.untracked.int32(-1)
+ ),
+ INFO = cms.untracked.PSet(
+ limit = cms.untracked.int32(5),
+ reportEvery = cms.untracked.int32(5)
+ ),
+ WARNING = cms.untracked.PSet(
+ limit = cms.untracked.int32(10)
+ ),
+ ERROR = cms.untracked.PSet(
+ limit = cms.untracked.int32(-1)
+ ),
+ Alignment = cms.untracked.PSet(
+ limit = cms.untracked.int32(-1),
+ reportEvery = cms.untracked.int32(1)
+ ),
+ enableStatistics = cms.untracked.bool(True)
+ )
+
+######################################################
+# Design GT (in order to fetch the design geometry)
+######################################################
+process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
+from Configuration.AlCa.GlobalTag import GlobalTag
+process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2024_design', '') # take your favourite
+
+######################################################
+# Starting alignment of the campaign
+######################################################
+from CondCore.CondDB.CondDB_cfi import *
+CondDBConnection = CondDB.clone( connect = cms.string( 'sqlite_file:alignment_input.db' ) )
+process.trackerAlignment = cms.ESSource("PoolDBESSource",
+ CondDBConnection,
+ toGet = cms.VPSet(cms.PSet(record = cms.string("TrackerAlignmentRcd"),
+ tag = cms.string("TrackerAlignment_PCL_byRun_v2_express_348155")
+ )
+ ))
+
+process.es_prefer_trackerAlignment = cms.ESPrefer("PoolDBESSource", "trackerAlignment")
+
+######################################################
+# Alignment producer
+######################################################
+process.load("Configuration.Geometry.GeometryRecoDB_cff")
+process.load("Alignment.CommonAlignmentProducer.AlignmentProducer_cff")
+
+######################################################
+#
+# !!! This has to match the alignable selection
+# of the pede configuration !!!
+#
+######################################################
+from align_params_cff import _alignParams
+process.AlignmentProducer.ParameterBuilder.Selector = _alignParams
+
+######################################################
+# Alignment Producer options
+######################################################
+process.AlignmentProducer.doMisalignmentScenario = False #True
+process.AlignmentProducer.applyDbAlignment = True # either globalTag or trackerAlignment
+
+######################################################
+# assign by reference (i.e. could change MillePedeAlignmentAlgorithm as well):
+######################################################
+process.AlignmentProducer.algoConfig = process.MillePedeAlignmentAlgorithm
+process.AlignmentProducer.algoConfig.mode = 'pedeRead' # reads millepede.res
+process.AlignmentProducer.algoConfig.pedeReader.readFile = 'millepede.res'
+process.AlignmentProducer.algoConfig.treeFile = 'my_treeFile.root'
+
+######################################################
+# Source
+######################################################
+process.source = cms.Source("EmptySource",
+ firstRun = cms.untracked.uint32(1) # choose your run!
+ )
+process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1) )
+
+process.dump = cms.EDAnalyzer("EventContentAnalyzer")
+process.p = cms.Path(process.dump)
+
+# should not be needed, but is:
+# otherwise AlignmentProducer does not call relevant algorithm part
+process.AlignmentProducer.saveToDB = True
+
+######################################################
+# Output alignment payload from reading file
+######################################################
+CondDBConnectionOut = CondDB.clone( connect = cms.string( 'sqlite_file:convertedFromResFile.db' ) )
+process.PoolDBOutputService = cms.Service("PoolDBOutputService",
+ CondDBConnectionOut,
+ timetype = cms.untracked.string('runnumber'),
+ toPut = cms.VPSet(cms.PSet(record = cms.string('TrackerAlignmentRcd'),
+ tag = cms.string('Alignments')
+ )
+ )
+ )
diff --git a/Alignment/MillePedeAlignmentAlgorithm/test/test_pede.py b/Alignment/MillePedeAlignmentAlgorithm/test/test_pede.py
index aa516643cd082..4434441607632 100644
--- a/Alignment/MillePedeAlignmentAlgorithm/test/test_pede.py
+++ b/Alignment/MillePedeAlignmentAlgorithm/test/test_pede.py
@@ -1,4 +1,5 @@
import FWCore.ParameterSet.Config as cms
+
process = cms.Process("Alignment")
################################################################################
@@ -36,7 +37,6 @@
import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.GeneralSetup as generalSetup
generalSetup.setup(process, setupGlobaltag, setupCosmicsZeroTesla)
-
################################################################################
# setup alignment producer
# ------------------------------------------------------------------------------
@@ -50,7 +50,6 @@
primaryWidth = setupPrimaryWidth,
cosmicsZeroTesla = setupCosmicsZeroTesla)
-
################################################################################
# Overwrite some conditions in global tag
# ------------------------------------------------------------------------------
@@ -69,16 +68,8 @@
]
#
# # Define the high-level structure alignables
-process.AlignmentProducer.ParameterBuilder.SelectorRigid = cms.PSet(
- alignParams = cms.vstring(
- "TrackerP1PXBHalfBarrel,111111",
- "TrackerP1PXECHalfCylinder,111111",
- "TrackerTIBHalfBarrel,111111",
- "TrackerTOBHalfBarrel,rrrrrr",
- "TrackerTIDEndcap,111111",
- "TrackerTECEndcap,111111",
- )
- )
+from align_params_cff import _alignParams
+process.AlignmentProducer.ParameterBuilder.SelectorRigid = _alignParams
#########################
## insert Pedesettings ##
diff --git a/Alignment/MillePedeAlignmentAlgorithm/test/test_pede.sh b/Alignment/MillePedeAlignmentAlgorithm/test/test_pede.sh
index 339ce9792e472..2c85bb0e0accb 100755
--- a/Alignment/MillePedeAlignmentAlgorithm/test/test_pede.sh
+++ b/Alignment/MillePedeAlignmentAlgorithm/test/test_pede.sh
@@ -7,7 +7,7 @@ clean_up(){
echo -e "\nCleaning the local test area"
rm -fr milleBinary00*
rm -fr pedeSteer*
- rm -fr millepede.*
+ #rm -fr millepede.*
rm -fr *.root
rm -fr *.log
rm -fr *.dat
diff --git a/Alignment/MillePedeAlignmentAlgorithm/test/test_pedeConversion.sh b/Alignment/MillePedeAlignmentAlgorithm/test/test_pedeConversion.sh
new file mode 100755
index 0000000000000..021b67fcd8026
--- /dev/null
+++ b/Alignment/MillePedeAlignmentAlgorithm/test/test_pedeConversion.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+function die { echo $1: status $2; exit $2; }
+
+LOCAL_TEST_DIR=${SCRAM_TEST_PATH}
+
+echo "============== testing conversion to DB file from millepede.res"
+(cmsRun ${LOCAL_TEST_DIR}/convertMPresToDB_cfg.py) || die 'failed running convertMPresToDB_cfg.py' $?
+
+echo -e "Content of the current directory is: "`ls .`
+
+INPUTFILE=convertedFromResFile.db
+
+echo -e "\n\n============== testing converted file corresponds to input"
+(cmsRun ${SCRAM_TEST_PATH}/AlignmentRcdChecker_cfg.py inputSqliteFile=${INPUTFILE}) || die 'failed running AlignmentRcdChecker' $?
diff --git a/Alignment/OfflineValidation/bin/DMRtrends.cc b/Alignment/OfflineValidation/bin/DMRtrends.cc
index 78142253d76be..40a81014eeb6b 100644
--- a/Alignment/OfflineValidation/bin/DMRtrends.cc
+++ b/Alignment/OfflineValidation/bin/DMRtrends.cc
@@ -136,17 +136,17 @@ int trends(int argc, char *argv[]) {
for (auto const &Variable : validation.get_child("Variables")) {
vector> DMRs{{"mu", "#mu [#mum]", -6, 6},
- {"sigma", "#sigma_{#mu} [#mum]", -15, 15},
+ {"sigma", "#sigma_{#mu} [#mum]", -5, 5},
{"muplus", "#mu outward [#mum]", -6, 6},
- {"sigmaplus", "#sigma_{#mu outward} [#mum]", -15, 15},
+ {"sigmaplus", "#sigma_{#mu outward} [#mum]", -5, 5},
{"muminus", "#mu inward [#mum]", -6, 6},
- {"sigmaminus", "#sigma_{#mu inward} [#mum]", -15, 15},
- {"deltamu", "#Delta#mu [#mum]", -15, 15},
- {"sigmadeltamu", "#sigma_{#Delta#mu} [#mum]", -15, 15},
- {"musigma", "#mu [#mum]", -6, 6},
- {"muplussigmaplus", "#mu outward [#mum]", -15, 15},
- {"muminussigmaminus", "#mu inward [#mum]", -15, 15},
- {"deltamusigmadeltamu", "#Delta#mu [#mum]", -15, 15}};
+ {"sigmaminus", "#sigma_{#mu inward} [#mum]", -5, 5},
+ {"deltamu", "#Delta#mu [#mum]", -5, 5},
+ {"sigmadeltamu", "#sigma_{#Delta#mu} [#mum]", -5, 5},
+ {"musigma", "#mu [#mum]", -2, 4},
+ {"muplussigmaplus", "#mu outward [#mum]", -5, 5},
+ {"muminussigmaminus", "#mu inward [#mum]", -5, 5},
+ {"deltamusigmadeltamu", "#Delta#mu [#mum]", -5, 10}};
if (Variable.second.get_value() == "DrmsNR") {
DMRs = {{"mu", "RMS(x'_{pred}-x'_{hit} /#sigma)", -1.2, 1.2},
diff --git a/Alignment/OfflineValidation/bin/DiMuonVmerge.cc b/Alignment/OfflineValidation/bin/DiMuonVmerge.cc
index a12042f1cc759..7f9d4575f1363 100644
--- a/Alignment/OfflineValidation/bin/DiMuonVmerge.cc
+++ b/Alignment/OfflineValidation/bin/DiMuonVmerge.cc
@@ -46,10 +46,14 @@ int merge(int argc, char* argv[]) {
// std::cout << " Attribute: " << attr.first << " = " << attr.second.data() << std::endl;
// }
- std::cout << childTree.second.get("file") << std::endl;
+ std::string file = childTree.second.get("file");
+ std::cout << file << std::endl;
std::cout << childTree.second.get("title") << std::endl;
- std::string toAdd = childTree.second.get("file") +
- "/DiMuonVertexValidation.root=" + childTree.second.get("title") + ",";
+
+ // Check if the file contains "/eos/cms/" and add the prefix accordingly
+ std::string prefixToAdd = file.find("/eos/cms/") != std::string::npos ? "root://eoscms.cern.ch/" : "";
+ std::string toAdd =
+ prefixToAdd + file + "/DiMuonVertexValidation.root=" + childTree.second.get("title") + ",";
filesAndLabels += toAdd;
}
diff --git a/Alignment/OfflineValidation/bin/PVtrends.cc b/Alignment/OfflineValidation/bin/PVtrends.cc
index 8646608896594..6a7d87edb488b 100644
--- a/Alignment/OfflineValidation/bin/PVtrends.cc
+++ b/Alignment/OfflineValidation/bin/PVtrends.cc
@@ -140,8 +140,8 @@ int trends(int argc, char *argv[]) {
outputdir.data(),
Form("mean %s", titles[i].data()),
Form("mean %s", ytitles[i].data()),
- -7.,
- 10.,
+ -4.,
+ 8.,
style,
GetLumi,
lumiAxisType.data());
@@ -150,7 +150,7 @@ int trends(int argc, char *argv[]) {
Form("RMS %s", titles[i].data()),
Form("RMS %s", ytitles[i].data()),
0.,
- 35.,
+ 25.,
style,
GetLumi,
lumiAxisType.data());
@@ -181,12 +181,15 @@ int trends(int argc, char *argv[]) {
int color = alignment.second.get("color");
int style = floor(alignment.second.get("style") / 100.);
gMean->SetMarkerColor(color);
+ gMean->SetLineColor(color); // no need to be set but looks better IMHO
gMean->SetMarkerStyle(style);
+ gMean->SetMarkerSize(1.6);
hRMS->SetTitle(gtitle); // for the legend
//hRMS ->SetTitle(""); // for the legend
hRMS->SetMarkerSize(0.6);
hRMS->SetMarkerColor(color);
+ hRMS->SetLineColor(color); // needs to be set, otherwise color is NOT picked up
hRMS->SetMarkerStyle(style);
mean(gMean, "PZ", "p", fullRange);
diff --git a/Alignment/OfflineValidation/bin/Zmumumerge.cc b/Alignment/OfflineValidation/bin/Zmumumerge.cc
index 03eb44f9ca9a5..037177bdd8964 100644
--- a/Alignment/OfflineValidation/bin/Zmumumerge.cc
+++ b/Alignment/OfflineValidation/bin/Zmumumerge.cc
@@ -39,6 +39,7 @@
#include
#include "Alignment/OfflineValidation/interface/FitWithRooFit.h"
+#include "Alignment/OfflineValidation/macros/CMS_lumi.h"
using namespace RooFit;
using namespace std;
@@ -75,13 +76,25 @@ class FitOut {
};
FitOut ZMassBinFit_OldTool(TH1D* th1d_input, TString s_name = "zmumu_fitting", TString output_path = "./") {
- double xMin(75), xMax(105), xMean(91);
- double sigma = 2;
- double sigmaMin = 0.1;
- double sigmaMax = 10;
+ // silence messages
+ RooMsgService::instance().setGlobalKillBelow(RooFit::FATAL);
+
+ double xMean = 91.1876;
+ double xMin = th1d_input->GetXaxis()->GetXmin();
+ double xMax = th1d_input->GetXaxis()->GetXmax();
+
+ double sigma(2.);
+ double sigmaMin(0.1);
+ double sigmaMax(10.);
+
+ double sigma2(0.1);
+ double sigma2Min(0.);
+ double sigma2Max(10.);
+
+ std::unique_ptr fitter = std::make_unique();
+
+ bool useChi2(false);
- FitWithRooFit* fitter = new FitWithRooFit();
- double sigma2(0.1), sigma2Min(0.), sigma2Max(10.), useChi2(false);
fitter->useChi2_ = useChi2;
fitter->initMean(xMean, xMin, xMax);
fitter->initSigma(sigma, sigmaMin, sigmaMax);
@@ -89,8 +102,6 @@ FitOut ZMassBinFit_OldTool(TH1D* th1d_input, TString s_name = "zmumu_fitting", T
fitter->initAlpha(1.5, 0.05, 10.);
fitter->initN(1, 0.01, 100.);
fitter->initFGCB(0.4, 0., 1.);
-
- fitter->initMean(91.1876, xMin, xMax);
fitter->initGamma(2.4952, 0., 10.);
fitter->gamma()->setConstant(kTRUE);
fitter->initMean2(0., -20., 20.);
@@ -109,6 +120,7 @@ FitOut ZMassBinFit_OldTool(TH1D* th1d_input, TString s_name = "zmumu_fitting", T
fitter->initA4(0., -10., 10.);
fitter->initA5(0., -10., 10.);
fitter->initA6(0., -10., 10.);
+
TCanvas* c1 = new TCanvas();
c1->Clear();
c1->SetLeftMargin(0.15);
@@ -121,9 +133,10 @@ FitOut ZMassBinFit_OldTool(TH1D* th1d_input, TString s_name = "zmumu_fitting", T
FitOut fitRes(
fitter->mean()->getValV(), fitter->mean()->getError(), fitter->sigma()->getValV(), fitter->sigma()->getError());
+
return fitRes;
}
-void Draw_th1d(TH1D* th1d_input, TString variable_name) {
+void Draw_th1d(TH1D* th1d_input, TString variable_name, TString output_path) {
TCanvas* c = new TCanvas();
c->cd();
gStyle->SetOptStat(0);
@@ -137,12 +150,21 @@ void Draw_th1d(TH1D* th1d_input, TString variable_name) {
th1d_input->GetYaxis()->SetTitle("Mass mean (GeV)");
th1d_input->Draw();
tlxg->DrawLatexNDC(0.2, 0.8, Form("%s", GT.Data()));
- c->Print(Form("%s/fitResultPlot/mass_VS_%s.pdf", GT.Data(), variable_name.Data()));
+ c->Print(Form("%s/fitResultPlot/mass_VS_%s.pdf", output_path.Data(), variable_name.Data()));
}
const static int variables_number = 8;
const TString tstring_variables_name[variables_number] = {
"CosThetaCS", "DeltaEta", "EtaMinus", "EtaPlus", "PhiCS", "PhiMinus", "PhiPlus", "Pt"};
+const TString tstring_variables_name_label[variables_number] = {"cos #theta_{CS}",
+ "#Delta #eta",
+ "#eta_{#mu^{-}}",
+ "#eta_{#mu^{+}}",
+ "#phi_{CS}",
+ "#phi_{#mu^{-}}",
+ "#phi_{#mu^{+}}",
+ "p_{T}"};
+
void Fitting_GetMassmeanVSvariables(TString inputfile_name, TString output_path) {
TH2D* th2d_mass_variables[variables_number];
TFile* inputfile = TFile::Open(inputfile_name.Data());
@@ -154,7 +176,7 @@ void Fitting_GetMassmeanVSvariables(TString inputfile_name, TString output_path)
gSystem->Exec(Form("mkdir -p %s", output_path.Data()));
gSystem->Exec(Form("mkdir -p %s/fitResultPlot", output_path.Data()));
- TFile* outpufile = TFile::Open(Form("%s/fitting_output.root", output_path.Data()), "recreate");
+ TFile* outputfile = TFile::Open(Form("%s/fitting_output.root", output_path.Data()), "RECREATE");
TH1D* th1d_variables_meanmass[variables_number];
TH1D* th1d_variables_entries[variables_number];
const int variables_rebin[variables_number] = {1, 1, 1, 1, 1, 1, 1, 1};
@@ -169,8 +191,10 @@ void Fitting_GetMassmeanVSvariables(TString inputfile_name, TString output_path)
if (i == 7 and j > 25) {
continue;
}
- cout << "th1d_variables_meanmass[i]->GetNbinsX()=" << th1d_variables_meanmass[i]->GetNbinsX() << endl;
- cout << "th2d_mass_variables[i]->GetNbinsY()=" << th2d_mass_variables[i]->GetNbinsY() << endl;
+ std::cout << __PRETTY_FUNCTION__
+ << " th1d_variables_meanmass[i]->GetNbinsX()=" << th1d_variables_meanmass[i]->GetNbinsX() << endl;
+ std::cout << __PRETTY_FUNCTION__ << " th2d_mass_variables[i]->GetNbinsY()=" << th2d_mass_variables[i]->GetNbinsY()
+ << endl;
th1d_variables_meanmass[i]->SetBinContent(j, 0);
th1d_variables_meanmass[i]->SetBinError(j, 0);
@@ -181,25 +205,37 @@ void Fitting_GetMassmeanVSvariables(TString inputfile_name, TString output_path)
TString s_name = Form("%s_%d", tstring_variables_name[i].Data(), j);
FitOut fitR = ZMassBinFit_OldTool(th1d_i, s_name, output_path);
+
th1d_variables_meanmass[i]->SetBinContent(j, fitR.mean);
th1d_variables_meanmass[i]->SetBinError(j, fitR.mean_err);
}
+
th1d_variables_meanmass[i]->GetXaxis()->SetRangeUser(xaxis_range[i][0], xaxis_range[i][1]);
- Draw_th1d(th1d_variables_meanmass[i], tstring_variables_name[i]);
- outpufile->cd();
+ Draw_th1d(th1d_variables_meanmass[i], tstring_variables_name[i], output_path);
+ outputfile->cd();
th1d_variables_meanmass[i]->Write(th1d_name);
TString th1d_name_entries = Form("th1d_entries_%s", tstring_variables_name[i].Data());
th1d_variables_entries[i] = th2d_mass_variables[i]->ProjectionY(th1d_name_entries, 0, -1, "d");
th1d_variables_entries[i]->GetXaxis()->SetTitle(tstring_variables_name[i].Data());
th1d_variables_entries[i]->GetYaxis()->SetTitle("Entry");
- outpufile->cd();
+ outputfile->cd();
th1d_variables_entries[i]->Write(th1d_name_entries);
}
- outpufile->Write();
- outpufile->Close();
- delete outpufile;
+ if (outputfile->IsOpen()) {
+ // Get the path (current working directory) in which the file is going to be written
+ const char* path = outputfile->GetPath();
+
+ if (path) {
+ std::cout << "File is going to be written in the directory: " << path << " for input file: " << inputfile_name
+ << std::endl;
+ } else {
+ std::cerr << "Error: Unable to determine the path." << std::endl;
+ }
+ outputfile->Close();
+ delete outputfile;
+ }
}
const static int max_file_number = 10;
@@ -207,10 +243,13 @@ void Draw_TH1D_forMultiRootFiles(const vector& file_names,
const vector& label_names,
const vector& colors,
const vector& styles,
+ const TString& Rlabel,
const TString& th1d_name,
+ const TString& xlabel,
+ const TString& ylabel,
const TString& output_name) {
if (file_names.empty() || label_names.empty()) {
- cout << "Provided an empty list of file and label names" << std::endl;
+ std::cout << "Provided an empty list of file and label names" << std::endl;
return;
}
@@ -225,24 +264,96 @@ void Draw_TH1D_forMultiRootFiles(const vector& file_names,
th1d_input[filename.index()]->SetTitle("");
}
- TCanvas* c = new TCanvas();
- TLegend* lg = new TLegend(0.2, 0.7, 0.5, 0.95);
- c->cd();
+ int W = 800;
+ int H = 800;
+ // references for T, B, L, R
+ float T = 0.08 * H;
+ float B = 0.12 * H;
+ float L = 0.12 * W;
+ float R = 0.04 * W;
+
+ // Form the canvas name by appending th1d_name
+ TString canvasName;
+ canvasName.Form("canv_%s", th1d_name.Data());
+
+ // Create a new canvas with the formed name
+ TCanvas* canv = new TCanvas(canvasName, canvasName, W, H);
+ canv->SetFillColor(0);
+ canv->SetBorderMode(0);
+ canv->SetFrameFillStyle(0);
+ canv->SetFrameBorderMode(0);
+ canv->SetLeftMargin(L / W + 0.05);
+ canv->SetRightMargin(R / W);
+ canv->SetTopMargin(T / H);
+ canv->SetBottomMargin(B / H);
+ canv->SetTickx(0);
+ canv->SetTicky(0);
+ canv->SetGrid();
+ canv->cd();
+
gStyle->SetOptStat(0);
+ TLegend* lg = new TLegend(0.3, 0.7, 0.7, 0.9);
+ lg->SetFillStyle(0);
+ lg->SetLineColor(0);
+ lg->SetEntrySeparation(0.05);
+
+ double ymin;
+ double ymax;
+
+ for (auto const& labelname : label_names | boost::adaptors::indexed(0)) {
+ double temp_ymin = th1d_input[labelname.index()]->GetMinimum();
+ double temp_ymax = th1d_input[labelname.index()]->GetMaximum();
+ if (labelname.index() == 0) {
+ ymin = temp_ymin;
+ ymax = temp_ymax;
+ }
+ if (temp_ymin <= ymin) {
+ ymin = temp_ymin;
+ }
+ if (temp_ymax >= ymax) {
+ ymax = temp_ymax;
+ }
+ }
+
for (auto const& labelname : label_names | boost::adaptors::indexed(0)) {
th1d_input[labelname.index()]->SetMarkerColor(colors[labelname.index()]);
th1d_input[labelname.index()]->SetLineColor(colors[labelname.index()]);
th1d_input[labelname.index()]->SetMarkerStyle(styles[labelname.index()]);
- th1d_input[labelname.index()]->Draw("same");
+ th1d_input[labelname.index()]->GetXaxis()->SetTitle(xlabel);
+ th1d_input[labelname.index()]->GetYaxis()->SetTitle(ylabel);
+ th1d_input[labelname.index()]->GetYaxis()->SetTitleOffset(2.0);
lg->AddEntry(th1d_input[labelname.index()], labelname.value());
+
+ TString label_meanmass_plot = "Mean M_{#mu#mu} (GeV)";
+ if (ylabel.EqualTo(label_meanmass_plot)) {
+ double ycenter = (ymax + ymin) / 2.0;
+ double yrange = (ymax - ymin) * 2;
+ double Ymin = ycenter - yrange;
+ double Ymax = ycenter + yrange * 1.10;
+ th1d_input[labelname.index()]->SetAxisRange(Ymin, Ymax, "Y");
+ th1d_input[labelname.index()]->Draw("PEX0same");
+ } else {
+ double Ymin = ymin - ymin * 0.07;
+ double Ymax = ymax + ymax * 0.35;
+ th1d_input[labelname.index()]->SetAxisRange(Ymin, Ymax, "Y");
+ th1d_input[labelname.index()]->Draw("HIST E1 same");
+ }
}
+
+ CMS_lumi(canv, 0, 3, Rlabel);
+
lg->Draw("same");
- c->SaveAs(output_name);
+
+ canv->Update();
+ canv->RedrawAxis();
+ canv->GetFrame()->Draw();
+ canv->SaveAs(output_name);
+
if (output_name.Contains(".pdf")) {
TString output_name_png(output_name); // output_name is const, copy to modify
output_name_png.Replace(output_name_png.Index(".pdf"), 4, ".png");
- c->SaveAs(output_name_png);
+ canv->SaveAs(output_name_png);
}
}
@@ -253,6 +364,7 @@ int Zmumumerge(int argc, char* argv[]) {
vector vec_title;
vector vec_color;
vector vec_style;
+ vector vec_right_title;
Options options;
options.helper(argc, argv);
@@ -261,16 +373,42 @@ int Zmumumerge(int argc, char* argv[]) {
pt::read_json(options.config, main_tree);
pt::ptree alignments = main_tree.get_child("alignments");
pt::ptree validation = main_tree.get_child("validation");
+
+ //Load defined order
+ std::vector> alignmentsOrdered;
for (const auto& childTree : alignments) {
+ alignmentsOrdered.push_back(childTree);
+ }
+ std::sort(alignmentsOrdered.begin(),
+ alignmentsOrdered.end(),
+ [](const std::pair& left, const std::pair& right) {
+ return left.second.get("index") < right.second.get("index");
+ });
+
+ for (const auto& childTree : alignmentsOrdered) {
+ // do not consider the nodes with a "file" to merge
+ if (childTree.second.find("file") == childTree.second.not_found()) {
+ std::cerr << "Ignoring alignment: " << childTree.second.get("title") << ".\nNo file to merged found!"
+ << std::endl;
+ continue;
+ } else {
+ std::cout << "Storing alignment: " << childTree.second.get("title") << std::endl;
+ }
vec_single_file_path.push_back(childTree.second.get("file"));
vec_single_file_name.push_back(childTree.second.get("file") + "/Zmumu.root");
vec_color.push_back(childTree.second.get("color"));
vec_style.push_back(childTree.second.get("style"));
+ if (childTree.second.find("customrighttitle") == childTree.second.not_found()) {
+ vec_right_title.push_back("");
+ } else {
+ vec_right_title.push_back(childTree.second.get("customrighttitle"));
+ }
vec_global_tag.push_back(childTree.second.get("globaltag"));
vec_title.push_back(childTree.second.get("title"));
//Fitting_GetMassmeanVSvariables(childTree.second.get("file") + "/Zmumu.root", childTree.second.get("file"));
}
+
TString merge_output = main_tree.get("output");
//=============================================
vector vec_single_fittingoutput;
@@ -284,22 +422,32 @@ int Zmumumerge(int argc, char* argv[]) {
cout << "files_number=" << files_number << endl;
for (int idx_variable = 0; idx_variable < variables_number; idx_variable++) {
TString th1d_name = Form("th1d_meanmass_%s", tstring_variables_name[idx_variable].Data());
+
Draw_TH1D_forMultiRootFiles(
vec_single_fittingoutput,
vec_title,
vec_color,
vec_style,
+ vec_right_title[0],
th1d_name,
+ tstring_variables_name_label[idx_variable].Data(),
+ "Mean M_{#mu#mu} (GeV)",
merge_output + Form("/meanmass_%s_GTs.pdf", tstring_variables_name[idx_variable].Data()));
+
TString th1d_name_entries = Form("th1d_entries_%s", tstring_variables_name[idx_variable].Data());
+
Draw_TH1D_forMultiRootFiles(
vec_single_fittingoutput,
vec_title,
vec_color,
vec_style,
+ vec_right_title[0],
th1d_name_entries,
+ tstring_variables_name_label[idx_variable].Data(),
+ "Events",
merge_output + Form("/entries_%s_GTs.pdf", tstring_variables_name[idx_variable].Data()));
}
+
//=============================================
return EXIT_SUCCESS;
}
diff --git a/Alignment/OfflineValidation/interface/DiLeptonVertexHelpers.h b/Alignment/OfflineValidation/interface/DiLeptonVertexHelpers.h
index 51436d1fee44a..5cd32fc58d853 100644
--- a/Alignment/OfflineValidation/interface/DiLeptonVertexHelpers.h
+++ b/Alignment/OfflineValidation/interface/DiLeptonVertexHelpers.h
@@ -71,22 +71,26 @@ namespace DiLeptonHelp {
if (etaReg == etaRegion::END)
continue;
+ const auto& toSub = m_etaRegionNames[etaReg];
+
if (((TObject*)histo)->InheritsFrom("TH2")) {
- m_h2_map[etaReg] =
- fs.make((name + "_" + m_etaRegionNames[etaReg]).c_str(),
- (title + m_etaRegionNames[etaReg] + ";" + xTitle + ";" + yTitle + ";" + zTitle).c_str(),
- histo->GetNbinsX(),
- histo->GetXaxis()->GetXmin(),
- histo->GetXaxis()->GetXmax(),
- histo->GetNbinsY(),
- histo->GetYaxis()->GetXmin(),
- histo->GetYaxis()->GetXmax());
+ m_h2_map[etaReg] = fs.make(
+ (name + "_" + toSub).c_str(),
+ (title + " (" + toSub + ");" + xTitle + " (" + toSub + ") ;" + yTitle + " (" + toSub + ");" + zTitle)
+ .c_str(),
+ histo->GetNbinsX(),
+ histo->GetXaxis()->GetXmin(),
+ histo->GetXaxis()->GetXmax(),
+ histo->GetNbinsY(),
+ histo->GetYaxis()->GetXmin(),
+ histo->GetYaxis()->GetXmax());
} else {
- m_h1_map[etaReg] = fs.make((name + "_" + m_etaRegionNames[etaReg]).c_str(),
- (title + m_etaRegionNames[etaReg] + ";" + xTitle + ";" + yTitle).c_str(),
- histo->GetNbinsX(),
- histo->GetXaxis()->GetXmin(),
- histo->GetXaxis()->GetXmax());
+ m_h1_map[etaReg] = fs.make(
+ (name + "_" + toSub).c_str(),
+ (title + " (" + toSub + ");" + xTitle + " (" + toSub + ") ;" + yTitle + " (" + toSub + ")").c_str(),
+ histo->GetNbinsX(),
+ histo->GetXaxis()->GetXmin(),
+ histo->GetXaxis()->GetXmax());
}
}
diff --git a/Alignment/OfflineValidation/macros/CMS_lumi.h b/Alignment/OfflineValidation/macros/CMS_lumi.h
index 547fe9563eb8e..38902f97379b3 100644
--- a/Alignment/OfflineValidation/macros/CMS_lumi.h
+++ b/Alignment/OfflineValidation/macros/CMS_lumi.h
@@ -41,9 +41,9 @@ TString lumi_sqrtS = "";
bool writeExraLumi = false;
bool drawLogo = false;
-void CMS_lumi(TPad* pad, int iPeriod = 3, int iPosX = 10);
+void CMS_lumi(TPad* pad, int iPeriod = 3, int iPosX = 10, TString RLabel = "");
-inline void CMS_lumi(TPad* pad, int iPeriod, int iPosX) {
+inline void CMS_lumi(TPad* pad, int iPeriod, int iPosX, TString RLabel) {
bool outOfFrame = false;
if (iPosX / 10 == 0) {
outOfFrame = true;
@@ -139,7 +139,11 @@ inline void CMS_lumi(TPad* pad, int iPeriod, int iPosX) {
latex.SetTextFont(42);
latex.SetTextAlign(31);
latex.SetTextSize(lumiTextSize * t);
- latex.DrawLatex(1 - r, 1 - t + lumiTextOffset * t, lumiText);
+ if (RLabel != "") {
+ latex.DrawLatex(1 - r, 1 - t + lumiTextOffset * t, RLabel);
+ } else {
+ latex.DrawLatex(1 - r, 1 - t + lumiTextOffset * t, lumiText);
+ }
if (outOfFrame) {
latex.SetTextFont(cmsTextFont);
diff --git a/Alignment/OfflineValidation/macros/DiMuonMassProfiles.C b/Alignment/OfflineValidation/macros/DiMuonMassProfiles.C
new file mode 100644
index 0000000000000..2601c64099e45
--- /dev/null
+++ b/Alignment/OfflineValidation/macros/DiMuonMassProfiles.C
@@ -0,0 +1,894 @@
+// ROOT includes
+#include "RooAddPdf.h"
+#include "RooCBShape.h"
+#include "RooDataHist.h"
+#include "RooExponential.h"
+#include "RooGaussian.h"
+#include "RooPlot.h"
+#include "RooRealVar.h"
+#include "RooVoigtian.h"
+#include "TCanvas.h"
+#include "TClass.h"
+#include "TDirectory.h"
+#include "TFile.h"
+#include "TGaxis.h"
+#include "TH1.h"
+#include "TH2.h"
+#include "TH3.h"
+#include "TKey.h"
+#include "TLegend.h"
+#include "TObjString.h"
+#include "TObject.h"
+#include "TProfile.h"
+#include "TRatioPlot.h"
+#include "TStyle.h"
+
+// standard includes
+#include
+#include
+#include