Skip to content

Commit

Permalink
Merge pull request #1 from michele-mormile/from-CMSSW_14_0_X_2023-11-…
Browse files Browse the repository at this point in the history
…30-2300

From cmssw 14 0 x 2023 11 30 2300
  • Loading branch information
michele-mormile committed Dec 1, 2023
2 parents 821d9f0 + 3d15312 commit 8662727
Show file tree
Hide file tree
Showing 2,000 changed files with 243,973 additions and 108,848 deletions.
9 changes: 9 additions & 0 deletions Alignment/APEEstimation/test/plottingTools/granularity.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,12 @@ def __init__(self):

# this name is used by default by other plotting tools
standardGranularity = phaseOneGranularity

# Granularity for Validation plots in ApeEstimator2 part of allData.root
validationGranularity = Granularity()
validationGranularity.sectors["X"].append( (1,8) ) # Only X is needed here, names are not required

# By default, these 8 sectors are included for the ValidationSectors granularity:
# BpixLayer1Out, BpixLayer3In, FpixMinusLayer1, TibLayer1RphiOut, TibLayer4In, TobLayer1StereoOut, TobLayer5Out, TecPlusRing7
# This can be changed in apeEstimator_cfg or in SectorBuilder_cff
# For these sectors, additional hit validation plots are created
46 changes: 43 additions & 3 deletions Alignment/APEEstimation/test/plottingTools/validationPlotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def __init__(self):
self.markers = {}
self.outPath = None
self.granularity = standardGranularity
self.validationGranularity = validationGranularity

self.order = []

def addInputFile(self, label, inFile, color=None, marker=20):
Expand Down Expand Up @@ -120,7 +122,7 @@ def plotHist(self, folder, name, title, hists, twoDimensional=False):
if not twoDimensional:
legend.Draw()

cmsText = ROOT.TLatex(0.16,0.96,title)
cmsText = ROOT.TLatex(0.26,0.96,title)
cmsText.SetTextFont(42)
cmsText.SetNDC()
cmsText.Draw("same")
Expand Down Expand Up @@ -194,14 +196,36 @@ def makeTrackPlot(self,histName, twoDimensional=False):
if self.markers[label] == 0:
hist.SetMarkerSize(0)
hist.SetLineWidth(2)

fi.Close()
if twoDimensional:
self.plotHist("tracks", histName+"_"+label, label, [(hist, label),], twoDimensional=True)
else:
hists.append((hist, label))
if len(hists) > 0:
self.plotHist("tracks", histName, histName, hists, twoDimensional=twoDimensional)

def makeHitsPlot(self, sectorNumber, histName, twoDimensional=False):
hists = []
for label in self.order:
fi = ROOT.TFile(self.inFiles[label], "READ")
sectorName = fi.Get("ApeEstimator2/Sector_{sector}/z_name".format(sector=sectorNumber)).GetTitle()
hist = fi.Get("ApeEstimator2/Sector_{sector}/{histName}".format(sector=sectorNumber,histName=histName))
hist.SetLineColor(self.colors[label])
hist.SetMarkerColor(self.colors[label])
hist.SetMarkerStyle(self.markers[label])
hist.SetDirectory(0)
fi.Close()
if self.markers[label] == 0:
hist.SetMarkerSize(0)
hist.SetLineWidth(2)

if twoDimensional:
self.plotHist("hits"+"/{}".format(sectorName), histName+"_"+label, "{}: ".format(sectorName)+histName+" "+label, [(hist, label),], twoDimensional=True)
else:
hists.append((hist, label))
if len(hists) > 0:
self.plotHist("hits"+"/{}".format(sectorName), histName, "{}: ".format(sectorName)+histName, hists, twoDimensional=twoDimensional)



def draw(self):
Expand Down Expand Up @@ -245,7 +269,23 @@ def draw(self):
self.makeTrackPlot("h2_hitsStripVsTheta", twoDimensional=True)
self.makeTrackPlot("h2_ptVsTheta", twoDimensional=True)


rangeList = self.validationGranularity.sectors["X"]
for first, last in rangeList:
for i in range(first, last+1):
# Get list of plots per sector, as pixel sectors have different plots
# We get the list from one of the result files, the rest should have the same structure
directoryFile = ROOT.TFile(self.inFiles[self.order[0]], "READ")
directory = directoryFile.GetDirectory("ApeEstimator2/Sector_{}".format(i))

for histObject in directory.GetListOfKeys():
histName = histObject.GetName()
if histName.startswith("h_"): # 1D hist
self.makeHitsPlot(i, histName)
elif histName.startswith("h2_"):
self.makeHitsPlot(i, histName, twoDimensional=True)

directoryFile.Close()


def main():
pass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,24 @@
## customizations for the pp_on_AA eras
from Configuration.Eras.Modifier_pp_on_XeXe_2017_cff import pp_on_XeXe_2017
from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA
(pp_on_XeXe_2017 | pp_on_AA).toModify(ALCARECOTkAlMinBiasHLT,
eventSetupPathsKey='TkAlMinBiasHI'
)

(pp_on_XeXe_2017 | pp_on_AA).toModify(ALCARECOTkAlMinBias,
trackQualities = cms.vstring("highPurity")
)

pp_on_XeXe_2017.toModify(ALCARECOTkAlMinBiasHLT,
eventSetupPathsKey='TkAlMinBiasHI')

import HLTrigger.HLTfilters.triggerResultsFilterFromDB_cfi
ALCARECOTkAlMinBiasTriggerResultsHI = HLTrigger.HLTfilters.triggerResultsFilterFromDB_cfi.triggerResultsFilterFromDB.clone(
eventSetupPathsKey = 'TkAlMinBiasHI',
usePathStatus = False,
hltResults = 'TriggerResults::HLT',
l1tResults = '', # leaving empty (not interested in L1T results)
throw = False # tolerate triggers stated above, but not available
)

seqALCARECOTkAlMinBiasHI = cms.Sequence(ALCARECOTkAlMinBiasTriggerResultsHI*~ALCARECOTkAlMinBiasNOTHLT+ALCARECOTkAlMinBiasDCSFilter+ALCARECOTkAlMinBias)
pp_on_AA.toReplaceWith(seqALCARECOTkAlMinBias,seqALCARECOTkAlMinBiasHI)

from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker
phase2_tracker.toModify(ALCARECOTkAlMinBias, etaMin = -4, etaMax = 4)
4 changes: 2 additions & 2 deletions Alignment/MuonAlignment/python/convertXMLtoSQLite_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@

process.MuonGeometryDBConverter = cms.EDAnalyzer("MuonGeometryDBConverter",
input = cms.string("xml"),
fileName = cms.string(str(sys.argv[2])),
fileName = cms.string(str(sys.argv[1])),
shiftErr = cms.double(1000.),
angleErr = cms.double(6.28),
output = cms.string("db"))

process.load("CondCore.DBCommon.CondDBSetup_cfi")
process.PoolDBOutputService = cms.Service("PoolDBOutputService",
process.CondDBSetup,
connect = cms.string("sqlite_file:"+str(sys.argv[2])[:-3]+"db"),
connect = cms.string("sqlite_file:"+str(sys.argv[1])[:-3]+"db"),
toPut = cms.VPSet(
cms.PSet(record = cms.string("DTAlignmentRcd"), tag = cms.string("DTAlignmentRcd")),
cms.PSet(record = cms.string("DTAlignmentErrorExtendedRcd"), tag = cms.string("DTAlignmentErrorExtendedRcd")),
Expand Down
32 changes: 15 additions & 17 deletions Alignment/MuonAlignmentAlgorithms/src/DTMuonMillepede.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "Alignment/MuonAlignmentAlgorithms/interface/DTMuonMillepede.h"

#include <array>
#include <iostream>

DTMuonMillepede::DTMuonMillepede(std::string path,
Expand Down Expand Up @@ -567,34 +568,32 @@ TMatrixD DTMuonMillepede::getCqcMatrix(int wh, int st, int se) {
}
}
}
double **Eta = new double *[12];
for (int counterLayer = 0; counterLayer < 12; counterLayer++) {

std::array<std::array<double, 12>, 12> Eta{};
for (size_t counterLayer = 0; counterLayer < Eta.size(); counterLayer++) {
if (counterLayer > 7 && st == 4)
continue;
Eta[counterLayer] = new double[5];
for (int counterLayer2 = 0; counterLayer2 < 12; counterLayer2++) {
if (counterLayer > 7 && st == 4)
for (size_t counterLayer2 = 0; counterLayer2 < Eta[counterLayer].size(); counterLayer2++) {
if (counterLayer2 > 7 && st == 4)
continue;
if ((counterLayer2 < 4 && counterLayer < 4) || (counterLayer2 > 3 && counterLayer > 3)) {
if (counterLayer == counterLayer2) {
Eta[counterLayer][counterLayer2] = 3.0 / (4.0);
} else {
Eta[counterLayer][counterLayer2] = -1.0 / (4.0);
}
} else {
Eta[counterLayer][counterLayer2] = 0.0;
}
}
}

for (int counterDeg = 0; counterDeg < 5; counterDeg++) {
for (int counterLayer = 0; counterLayer < 12; counterLayer++) {
for (size_t counterLayer = 0; counterLayer < 12; counterLayer++) {
if (counterLayer > 7 && st == 4)
continue;
for (int counterLayer2 = 0; counterLayer2 < 12; counterLayer2++) {
for (size_t counterLayer2 = 0; counterLayer2 < 12; counterLayer2++) {
if (counterLayer2 > 7 && st == 4)
continue;
for (int counterLayer3 = 0; counterLayer3 < 12; counterLayer3++) {
for (size_t counterLayer3 = 0; counterLayer3 < 12; counterLayer3++) {
if (counterLayer3 > 7 && st == 4)
continue;
matrix(5 * counterLayer2 + counterDeg, 5 * counterLayer3 + counterDeg) +=
Expand Down Expand Up @@ -668,13 +667,12 @@ TMatrixD DTMuonMillepede::getbqcMatrix(int wh, int st, int se) {
}
}
}
double **Eta = new double *[12];
for (int counterLayer = 0; counterLayer < 12; counterLayer++) {
std::array<std::array<double, 12>, 12> Eta{};
for (size_t counterLayer = 0; counterLayer < Eta.size(); counterLayer++) {
if (counterLayer > 7 && st == 4)
continue;
Eta[counterLayer] = new double[5];
for (int counterLayer2 = 0; counterLayer2 < 12; counterLayer2++) {
if (counterLayer > 7 && st == 4)
for (size_t counterLayer2 = 0; counterLayer2 < Eta[counterLayer].size(); counterLayer2++) {
if (counterLayer2 > 7 && st == 4)
continue;
if ((counterLayer2 < 4 && counterLayer < 4) || (counterLayer2 > 3 && counterLayer > 3)) {
if (counterLayer == counterLayer2) {
Expand All @@ -689,10 +687,10 @@ TMatrixD DTMuonMillepede::getbqcMatrix(int wh, int st, int se) {
}

for (int counterDeg = 0; counterDeg < 5; counterDeg++) {
for (int counterLayer = 0; counterLayer < 12; counterLayer++) {
for (size_t counterLayer = 0; counterLayer < 12; counterLayer++) {
if (counterLayer > 7 && st == 4)
continue;
for (int counterLayer2 = 0; counterLayer2 < 12; counterLayer2++) {
for (size_t counterLayer2 = 0; counterLayer2 < 12; counterLayer2++) {
if (counterLayer2 > 7 && st == 4)
continue;
float mean = 0;
Expand Down
18 changes: 17 additions & 1 deletion Alignment/OfflineValidation/bin/PVmerge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,26 @@ int merge(int argc, char* argv[]) {
float m_dzPhiMax = validation.count("m_dzPhiMax") ? validation.get<float>("m_dzPhiMax") : 40;
float m_dxyEtaMax = validation.count("m_dxyEtaMax") ? validation.get<float>("m_dxyEtaMax") : 40;
float m_dzEtaMax = validation.count("m_dzEtaMax") ? validation.get<float>("m_dzEtaMax") : 40;
float m_dxyPtMax = validation.count("m_dxyPtMax") ? validation.get<float>("m_dxyPtMax") : 40;
float m_dzPtMax = validation.count("m_dzPtMax") ? validation.get<float>("m_dzPtMax") : 40;
float m_dxyPhiNormMax = validation.count("m_dxyPhiNormMax") ? validation.get<float>("m_dxyPhiNormMax") : 0.5;
float m_dzPhiNormMax = validation.count("m_dzPhiNormMax") ? validation.get<float>("m_dzPhiNormMax") : 0.5;
float m_dxyEtaNormMax = validation.count("m_dxyEtaNormMax") ? validation.get<float>("m_dxyEtaNormMax") : 0.5;
float m_dzEtaNormMax = validation.count("m_dzEtaNormMax") ? validation.get<float>("m_dzEtaNormMax") : 0.5;
float m_dxyPtNormMax = validation.count("m_dxyPtNormMax") ? validation.get<float>("m_dxyPtNormMax") : 0.5;
float m_dzPtNormMax = validation.count("m_dzPtNormMax") ? validation.get<float>("m_dzPtNormMax") : 0.5;
float w_dxyPhiMax = validation.count("w_dxyPhiMax") ? validation.get<float>("w_dxyPhiMax") : 150;
float w_dzPhiMax = validation.count("w_dzPhiMax") ? validation.get<float>("w_dzPhiMax") : 150;
float w_dxyEtaMax = validation.count("w_dxyEtaMax") ? validation.get<float>("w_dxyEtaMax") : 150;
float w_dzEtaMax = validation.count("w_dzEtaMax") ? validation.get<float>("w_dzEtaMax") : 1000;
float w_dxyPtMax = validation.count("w_dxyPtMax") ? validation.get<float>("w_dxyPtMax") : 150;
float w_dzPtMax = validation.count("w_dzPtMax") ? validation.get<float>("w_dzPtMax") : 150;
float w_dxyPhiNormMax = validation.count("w_dxyPhiNormMax") ? validation.get<float>("w_dxyPhiNormMax") : 1.8;
float w_dzPhiNormMax = validation.count("w_dzPhiNormMax") ? validation.get<float>("w_dzPhiNormMax") : 1.8;
float w_dxyEtaNormMax = validation.count("w_dxyEtaNormMax") ? validation.get<float>("w_dxyEtaNormMax") : 1.8;
float w_dzEtaNormMax = validation.count("w_dzEtaNormMax") ? validation.get<float>("w_dzEtaNormMax") : 1.8;
float w_dxyPtNormMax = validation.count("w_dxyPtNormMax") ? validation.get<float>("w_dxyPtNormMax") : 1.8;
float w_dzPtNormMax = validation.count("w_dzPtNormMax") ? validation.get<float>("w_dzPtNormMax") : 1.8;
int iov = validation.count("IOV") ? validation.get<int>("IOV") : 1;
std::string rlabel = validation.count("customrighttitle") ? validation.get<std::string>("customrighttitle") : "";
rlabel = merge_style.count("Rlabel") ? merge_style.get<std::string>("Rlabel") : rlabel;
Expand All @@ -81,18 +89,26 @@ int merge(int argc, char* argv[]) {
m_dzPhiMax, // mean of dz vs Phi
m_dxyEtaMax, // mean of dxy vs Eta
m_dzEtaMax, // mean of dz vs Eta
m_dxyPtMax, // mean of dxy vs Pt
m_dzPtMax, // mean of dz vs Pt
m_dxyPhiNormMax, // mean of dxy vs Phi (norm)
m_dzPhiNormMax, // mean of dz vs Phi (norm)
m_dxyEtaNormMax, // mean of dxy vs Eta (norm)
m_dzEtaNormMax, // mean of dz vs Eta (norm)
m_dxyPtNormMax, // mean of dxy vs Pt (norm)
m_dzPtNormMax, // mean of dz vs Pt (norm)
w_dxyPhiMax, // width of dxy vs Phi
w_dzPhiMax, // width of dz vs Phi
w_dxyEtaMax, // width of dxy vs Eta
w_dzEtaMax, // width of dz vs Eta
w_dxyPtMax, // width of dxy vs Pt
w_dzPtMax, // width of dz vs Pt
w_dxyPhiNormMax, // width of dxy vs Phi (norm)
w_dzPhiNormMax, // width of dz vs Phi (norm)
w_dxyEtaNormMax, // width of dxy vs Eta (norm)
w_dzEtaNormMax // width of dz vs Eta (norm)
w_dzEtaNormMax, // width of dz vs Eta (norm)
w_dxyPtNormMax, // width of dxy vs Pt (norm)
w_dzPtNormMax // width of dz vs Pt (norm)
);

//Load file list in user defined order
Expand Down
Loading

0 comments on commit 8662727

Please sign in to comment.