Skip to content

Commit

Permalink
Merge branch 'master' into testbranch_lexical_cast
Browse files Browse the repository at this point in the history
  • Loading branch information
Purva-Chaudhari authored Aug 24, 2021
2 parents 22407ac + e1e9a2f commit b0b7081
Show file tree
Hide file tree
Showing 2,276 changed files with 39,863 additions and 26,945 deletions.
3 changes: 0 additions & 3 deletions Alignment/APEEstimation/plugins/ApeEstimatorSummary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1077,9 +1077,6 @@ void ApeEstimatorSummary::analyze(const edm::Event& iEvent, const edm::EventSetu
for (auto& i_sector : m_tkSector_) {
delete a_sectorName[i_sector.first];
}
delete sectorNameTree;
delete defaultTreeX;
delete defaultTreeY;
}

firstEvent = false;
Expand Down
12 changes: 12 additions & 0 deletions Alignment/APEEstimation/python/AlignmentTrackSelector_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@
trackQualities = ["highPurity"],
)

## Filter for cosmics tracks
NoPuritySelector = Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi.AlignmentTrackSelector.clone(
applyBasicCuts = True,
filter = True,
src = 'ALCARECOTkAlMuonIsolated',
etaMin = -999.,
etaMax = 999.,
)

##
## Filters for skims
##
genSimSkimSelector = Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi.AlignmentTrackSelector.clone(
applyBasicCuts = True,
filter = True,
Expand Down
9 changes: 8 additions & 1 deletion Alignment/APEEstimation/python/TrackRefitter_38T_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
HighPuritySelector = Alignment.APEEstimation.AlignmentTrackSelector_cff.HighPuritySelector
HighPuritySelector.src = 'MuSkim'


NoPuritySelector = Alignment.APEEstimation.AlignmentTrackSelector_cff.NoPuritySelector
NoPuritySelector.src = 'MuSkim'

## SEQUENCE

Expand All @@ -33,5 +34,11 @@
TrackRefitterForApeEstimator
)

RefitterNoPuritySequence = cms.Sequence(
offlineBeamSpot*
NoPuritySelector*
TrackRefitterForApeEstimator
)



10 changes: 8 additions & 2 deletions Alignment/APEEstimation/test/autoSubmitter/autoSubmitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ def __init__(self, config, name):
self.sampleType = "MC"
else:
self.sampleType ="data1"

if "isCosmics" in dsDict:
self.isCosmics = (dsDict["isCosmics"] == "True")
else:
self.isCosmics = False

self.conditions, dummy, self.validConditions = loadConditions(dsDict)

Expand Down Expand Up @@ -205,7 +210,7 @@ def submit_jobs(self):

lastIter = (self.curIteration==self.maxIterations) and not self.alignment.isDesign

inputCommands = "sample={sample} fileNumber={fileNo} iterNumber={iterNo} lastIter={lastIter} alignRcd={alignRcd} maxEvents={maxEvents} globalTag={globalTag} measurementName={name} conditions={conditions}".format(sample=self.dataset.sampleType,fileNo="$1",iterNo=self.curIteration,lastIter=lastIter,alignRcd=alignmentNameToUse, maxEvents=self.maxEvents, globalTag=self.alignment.globalTag, name=self.name, conditions=rawFileName)
inputCommands = "sample={sample} fileNumber={fileNo} iterNumber={iterNo} lastIter={lastIter} alignRcd={alignRcd} maxEvents={maxEvents} globalTag={globalTag} measurementName={name} conditions={conditions} cosmics={cosmics}".format(sample=self.dataset.sampleType,fileNo="$1",iterNo=self.curIteration,lastIter=lastIter,alignRcd=alignmentNameToUse, maxEvents=self.maxEvents, globalTag=self.alignment.globalTag, name=self.name, conditions=rawFileName,cosmics=self.dataset.isCosmics)

from autoSubmitterTemplates import condorJobTemplate
jobFileContent = condorJobTemplate.format(base=base, inputFile="$2", inputCommands=inputCommands)
Expand Down Expand Up @@ -434,9 +439,10 @@ def run_iteration(self):
try:
self.submit_jobs()
save("measurements", measurements)
except:
except Exception as e:
# this is needed in case the scheduler goes down
print("Error submitting jobs for APE measurement {}".format(self.name))
print(e)
return

if self.status == STATE_BJOBS_WAITING:
Expand Down
2 changes: 2 additions & 0 deletions Alignment/APEEstimation/test/autoSubmitter/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ fileNames=filename.root otherFile_[1-6,8,10]_[1-2].root
maxEvents=-1
# optional, set to True for MC samples, False by default
isMC=False
# optional, set to True for cosmics samples, False by default
isCosmics=False

#define alignments like this
[alignment:alignmentObject]
Expand Down
20 changes: 13 additions & 7 deletions Alignment/APEEstimation/test/cfgTemplate/apeEstimator_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
options.register('lastIter', False, VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.bool, "Last iteration")
options.register('alignRcd','', VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "AlignmentRcd")
options.register('conditions',"None", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "File with conditions")

options.register('cosmics', False, VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.bool, "Cosmic data set")
# get and parse the command line arguments
options.parseArguments()

Expand Down Expand Up @@ -194,7 +194,6 @@
)
)
process.es_prefer_trackerAlignmentErr = cms.ESPrefer("PoolDBESSource","myTrackerAlignmentErr")



##
Expand Down Expand Up @@ -253,11 +252,18 @@
##
## Path
##
process.p = cms.Path(
#process.TriggerSelectionSequence* # You want to use this if you want to select for triggers
process.RefitterHighPuritySequence*
process.ApeEstimatorSequence
)

if not options.cosmics:
process.p = cms.Path(
#process.TriggerSelectionSequence* # You want to use this if you want to select for triggers
process.RefitterHighPuritySequence*
process.ApeEstimatorSequence
)
else:
process.p = cms.Path(
process.RefitterNoPuritySequence* # this sequence doesn't include high purity track criteria
process.ApeEstimatorSequence
)



2 changes: 1 addition & 1 deletion Alignment/APEEstimation/test/plottingTools/drawResults.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
plot.setOutputPath(base+"/hists/workingArea/")
# label(also used as name when adding systematic errors), inputFile, color (optional, automatic by default),
# marker (optional, 20 by default, 0 is line), hitNumbers (optional, file number of hits in each sector, allData.root)
plot.addInputFile("label", "base/hists/workingArea/iter14/allData_iterationApe.root", color = ROOT.kGray+2)
plot.addInputFile("label", base+"/hists/workingArea/iter14/allData_iterationApe.root", color = ROOT.kGray+2)
plot.setGranularity(standardGranularity)
plot.draw()
21 changes: 21 additions & 0 deletions Alignment/APEEstimation/test/plottingTools/drawValidation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Implementation to draw results of an APE measurement
# to check convergence
from validationPlotter import *
from granularity import *
import ROOT
import os
try:
base = os.environ['CMSSW_BASE']+"/src/Alignment/APEEstimation"
except KeyError:
base = ""

plot = ValidationPlotter()
plot.setOutputPath(base+"/hists/workingArea/validation")
# label(also used as name when adding systematic errors), inputFile, color (optional, automatic by default),
# marker (optional, 20 by default, 0 is line)
# Multiple inputs possible, in which case the plots will be normalized
# Remember that the folder has to be either iter0 or iter15 or baseline
plot.addInputFile("mp3401", "{base}/hists/workingArea/iter15/allData.root".format(base=base),color=ROOT.kBlack)
plot.addInputFile("Design", "{base}/hists/Design/baseline/allData.root".format(base=base),color=ROOT.kRed,marker=0)
plot.setGranularity(standardGranularity)
plot.draw()
18 changes: 9 additions & 9 deletions Alignment/APEEstimation/test/plottingTools/resultPlotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ def makeHitNumbers(self, label, sectorRange, coordinate):
posX = (float(i)+0.5)/numSectors*(1-ROOT.gPad.GetLeftMargin()-ROOT.gPad.GetRightMargin())+ROOT.gPad.GetLeftMargin()
posY = (1-ROOT.gPad.GetTopMargin()-size)-1.2*size*self.numHitCounters

label = ROOT.TLatex(posX, posY, "%.2E"%(num))
label.SetNDC(True)
label.SetTextColor(self.colors[label])
label.SetTextSize(size)
label.SetTextFont(font)
label.SetTextAngle(45)
label.SetTextAlign(align)
labels.append(label)
labelTex = ROOT.TLatex(posX, posY, "%.2E"%(num))
labelTex.SetNDC(True)
labelTex.SetTextColor(self.colors[label])
labelTex.SetTextSize(size)
labelTex.SetTextFont(font)
labelTex.SetTextAngle(45)
labelTex.SetTextAlign(align)
labels.append(labelTex)
return labels

def makeHist(self, label, sectorRange, coordinate, number):
Expand Down Expand Up @@ -161,7 +161,7 @@ def draw(self):
plotNumber = 0
rangeList = self.granularity.sectors[coordinate]
for sectorRange in rangeList:
self.canvas = ROOT.TCanvas("canvas", "canvas", int(ROOT.gStyle.GetCanvasDefW()*len(list(range(sectorRange[0],sectorRange[1]+1)))/10.),ROOT.gStyle.GetCanvasDefH())
self.canvas = ROOT.TCanvas("canvas", "canvas", max(int(ROOT.gStyle.GetCanvasDefW()*len(list(range(sectorRange[0],sectorRange[1]+1)))/10.), int(ROOT.gStyle.GetCanvasDefW()/2)),ROOT.gStyle.GetCanvasDefH())
ROOT.gPad.SetRightMargin(0.10)

legend = ROOT.TLegend(0.2,0.62,0.5,0.82)
Expand Down
Loading

0 comments on commit b0b7081

Please sign in to comment.