diff --git a/Alignment/APEEstimation/plugins/ApeEstimatorSummary.cc b/Alignment/APEEstimation/plugins/ApeEstimatorSummary.cc index cca4f5866bea8..c3d04fd7f3788 100644 --- a/Alignment/APEEstimation/plugins/ApeEstimatorSummary.cc +++ b/Alignment/APEEstimation/plugins/ApeEstimatorSummary.cc @@ -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; diff --git a/Alignment/APEEstimation/python/AlignmentTrackSelector_cff.py b/Alignment/APEEstimation/python/AlignmentTrackSelector_cff.py index 32c34dfdc792c..8ad287472030f 100644 --- a/Alignment/APEEstimation/python/AlignmentTrackSelector_cff.py +++ b/Alignment/APEEstimation/python/AlignmentTrackSelector_cff.py @@ -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, diff --git a/Alignment/APEEstimation/python/TrackRefitter_38T_cff.py b/Alignment/APEEstimation/python/TrackRefitter_38T_cff.py index cd014aca9226b..d55cbcf5810fd 100644 --- a/Alignment/APEEstimation/python/TrackRefitter_38T_cff.py +++ b/Alignment/APEEstimation/python/TrackRefitter_38T_cff.py @@ -23,7 +23,8 @@ HighPuritySelector = Alignment.APEEstimation.AlignmentTrackSelector_cff.HighPuritySelector HighPuritySelector.src = 'MuSkim' - +NoPuritySelector = Alignment.APEEstimation.AlignmentTrackSelector_cff.NoPuritySelector +NoPuritySelector.src = 'MuSkim' ## SEQUENCE @@ -33,5 +34,11 @@ TrackRefitterForApeEstimator ) +RefitterNoPuritySequence = cms.Sequence( + offlineBeamSpot* + NoPuritySelector* + TrackRefitterForApeEstimator +) + diff --git a/Alignment/APEEstimation/test/autoSubmitter/autoSubmitter.py b/Alignment/APEEstimation/test/autoSubmitter/autoSubmitter.py index eb596a15eacca..27e0b0abe4882 100644 --- a/Alignment/APEEstimation/test/autoSubmitter/autoSubmitter.py +++ b/Alignment/APEEstimation/test/autoSubmitter/autoSubmitter.py @@ -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) @@ -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) @@ -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: diff --git a/Alignment/APEEstimation/test/autoSubmitter/config.ini b/Alignment/APEEstimation/test/autoSubmitter/config.ini index b17b831098c9c..576f63881c4ee 100644 --- a/Alignment/APEEstimation/test/autoSubmitter/config.ini +++ b/Alignment/APEEstimation/test/autoSubmitter/config.ini @@ -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] diff --git a/Alignment/APEEstimation/test/cfgTemplate/apeEstimator_cfg.py b/Alignment/APEEstimation/test/cfgTemplate/apeEstimator_cfg.py index c181cf3ccb727..9e2c085bc8cb1 100644 --- a/Alignment/APEEstimation/test/cfgTemplate/apeEstimator_cfg.py +++ b/Alignment/APEEstimation/test/cfgTemplate/apeEstimator_cfg.py @@ -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() @@ -194,7 +194,6 @@ ) ) process.es_prefer_trackerAlignmentErr = cms.ESPrefer("PoolDBESSource","myTrackerAlignmentErr") - ## @@ -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 + ) diff --git a/Alignment/APEEstimation/test/plottingTools/drawResults.py b/Alignment/APEEstimation/test/plottingTools/drawResults.py index c068c95df8fad..f0e21ea07826c 100644 --- a/Alignment/APEEstimation/test/plottingTools/drawResults.py +++ b/Alignment/APEEstimation/test/plottingTools/drawResults.py @@ -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() diff --git a/Alignment/APEEstimation/test/plottingTools/drawValidation.py b/Alignment/APEEstimation/test/plottingTools/drawValidation.py new file mode 100644 index 0000000000000..fe5c65822ed5e --- /dev/null +++ b/Alignment/APEEstimation/test/plottingTools/drawValidation.py @@ -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() diff --git a/Alignment/APEEstimation/test/plottingTools/resultPlotter.py b/Alignment/APEEstimation/test/plottingTools/resultPlotter.py index 07ba9385b37f5..b57ba9c8a76e2 100644 --- a/Alignment/APEEstimation/test/plottingTools/resultPlotter.py +++ b/Alignment/APEEstimation/test/plottingTools/resultPlotter.py @@ -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): @@ -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) diff --git a/Alignment/APEEstimation/test/plottingTools/validationPlotter.py b/Alignment/APEEstimation/test/plottingTools/validationPlotter.py new file mode 100644 index 0000000000000..2452086590334 --- /dev/null +++ b/Alignment/APEEstimation/test/plottingTools/validationPlotter.py @@ -0,0 +1,255 @@ +import ROOT +ROOT.gROOT.SetBatch(True) +from setTDRStyle import setTDRStyle + + +from granularity import * + + +class ValidationPlotter: + def __init__(self): + setTDRStyle() + self.inFiles = {} + self.labels = {} + self.colors = {} + self.markers = {} + self.outPath = None + self.granularity = standardGranularity + self.order = [] + + def addInputFile(self, label, inFile, color=None, marker=20): + self.order.append(label) + self.inFiles[label] = inFile + self.labels[label] = label + self.markers[label] = marker + if color != None: + self.colors[label] = color + else: + # choose first not occupied color (other than white) + for autoColor in range(1,100): + if autoColor not in self.colors.values() and not autoColor == 10: + self.colors[label] = autoColor + break + + def setGranularity(self, granularity): + self.granularity = granularity + + def setOutputPath(self, outPath): + self.outPath = outPath + + def convertName(self, name): + out = name.replace("Bpix", "BPIX") + out = out.replace("Fpix", "FPIX") + out = out.replace("Plus", "+") + out = out.replace("Minus", "-") + out = out.replace("Fpix", "FPIX") + out = out.replace("Tib", "TIB") + out = out.replace("Tob", "TOB") + out = out.replace("Tid", "TID") + out = out.replace("Tec", "TEC") + out = out.replace("Layer", " L") + out = out.replace("Ring", " R") + out = out.replace("Stereo", "S") + out = out.replace("Rphi", "R") # different from Ring, this one does not add a space in front + out = out.replace("In", "i") + out = out.replace("Out", "o") + return out + + def plotHist(self, folder, name, title, hists, twoDimensional=False): + self.canvas = ROOT.TCanvas("canvas", "canvas", ROOT.gStyle.GetCanvasDefW(),ROOT.gStyle.GetCanvasDefH()) + ROOT.gPad.SetRightMargin(0.10) + if twoDimensional: + ROOT.gPad.SetRightMargin(0.2) + + + legend = ROOT.TLegend(0.2,0.7,0.9,0.90) + legend.SetFillColor(0) + legend.SetFillStyle(0) + legend.SetTextSize(0.03) + legend.SetMargin(0.15) + legend.SetNColumns(2) + legend.SetBorderSize(0) + + normalize = False + if len (hists) > 1: + normalize = True + + + firstHist = True + scaleHist = None + maximum = 0 + for hist, label in hists: + + n = int(hist.Integral()) + mu = hist.GetMean() + sigma = hist.GetRMS() + + if normalize: + hist.Scale(1./hist.Integral()) + + if hist.GetMaximum() > maximum: + maximum = hist.GetMaximum() + + if firstHist: + scaleHist = hist + addDraw = "" + firstHist = False + else: + addDraw = "same" + + if not twoDimensional: + if self.markers[label] != 0: + drawMode = "P0%s"%(addDraw) + else: + drawMode = "hist%s"%(addDraw) + else: + drawMode = "COLZ" + + scaleHist.SetMaximum(maximum*1.5) + scaleHist.SetMinimum(0) + + hist.Draw(drawMode) + + legText = "#splitline{{{label}}}{{N={n:.2E},#mu={mu:.2f},RMS={sigma:.2f}}}".format(label=label,n=n, mu=mu,sigma=sigma) + + if self.markers[label] != 0: + legend.AddEntry(hist, legText, "p") + else: + legend.AddEntry(hist, legText, "l") + + if not twoDimensional: + legend.Draw() + + cmsText = ROOT.TLatex(0.16,0.96,title) + cmsText.SetTextFont(42) + cmsText.SetNDC() + cmsText.Draw("same") + + import os + if not os.path.isdir(self.outPath): + os.makedirs(self.outPath) + if not os.path.isdir(self.outPath+"/"+folder): + os.makedirs(self.outPath+"/"+folder) + self.canvas.SaveAs("{}/{}/{}.pdf".format(self.outPath, folder, name)) + self.canvas = None + + + + def makeResidualPlot(self, sectorNumber, coordinate): + # residual + hists = [] + for label in self.order: + fi = ROOT.TFile(self.inFiles[label], "READ") + hist = fi.Get("ApeEstimator1/Sector_{sectorNumber}/Results/h_Res{coordinate}".format(sectorNumber=sectorNumber, coordinate=coordinate)) + hist.SetLineColor(self.colors[label]) + hist.SetMarkerColor(self.colors[label]) + hist.SetMarkerStyle(self.markers[label]) + hist.SetDirectory(0) + if self.markers[label] == 0: + hist.SetMarkerSize(0) + hist.SetLineWidth(2) + + hists.append((hist, label)) + nameHist = fi.Get("ApeEstimator1/Sector_{sectorNumber}/z_name".format(sectorNumber=sectorNumber)) + nameHist.SetDirectory(0) + title = self.convertName(nameHist.GetTitle()) + fi.Close() + + name = "Sector_{sectorNumber}_Res{coordinate}".format(sectorNumber=sectorNumber, coordinate=coordinate) + + self.plotHist("residuals", name, title, hists) + + + # normalized residual + hists = [] + for label in self.order: + fi = ROOT.TFile(self.inFiles[label], "READ") + hist = fi.Get("ApeEstimator1/Sector_{sectorNumber}/Results/h_NorRes{coordinate}".format(sectorNumber=sectorNumber, coordinate=coordinate)) + hist.SetLineColor(self.colors[label]) + hist.SetMarkerColor(self.colors[label]) + hist.SetMarkerStyle(self.markers[label]) + hist.SetDirectory(0) + if self.markers[label] == 0: + hist.SetMarkerSize(0) + hist.SetLineWidth(2) + + hists.append((hist, label)) + nameHist = fi.Get("ApeEstimator1/Sector_{sectorNumber}/z_name".format(sectorNumber=sectorNumber)) + nameHist.SetDirectory(0) + title = self.convertName(nameHist.GetTitle()) + fi.Close() + name = "Sector_{sectorNumber}_NorRes{coordinate}".format(sectorNumber=sectorNumber, coordinate=coordinate) + + self.plotHist("residuals", name, title, hists) + + def makeTrackPlot(self,histName, twoDimensional=False): + hists = [] + for label in self.order: + fi = ROOT.TFile(self.inFiles[label], "READ") + hist = fi.Get("ApeEstimator2/TrackVariables/{histName}".format(histName=histName)) + hist.SetLineColor(self.colors[label]) + hist.SetMarkerColor(self.colors[label]) + hist.SetMarkerStyle(self.markers[label]) + hist.SetDirectory(0) + if self.markers[label] == 0: + hist.SetMarkerSize(0) + hist.SetLineWidth(2) + + 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 draw(self): + for coordinate in self.granularity.sectors.keys(): + rangeList = self.granularity.sectors[coordinate] + for first, last in rangeList: + for i in range(first, last+1): + self.makeResidualPlot(i, coordinate) + + self.makeTrackPlot("h_hitsSize") + self.makeTrackPlot("h_hitsValid") + self.makeTrackPlot("h_hitsInvalid") + self.makeTrackPlot("h_hits2D") + self.makeTrackPlot("h_layersMissed") + self.makeTrackPlot("h_hitsPixel") + self.makeTrackPlot("h_hitsStrip") + self.makeTrackPlot("h_charge") + self.makeTrackPlot("h_chi2") + self.makeTrackPlot("h_ndof") + self.makeTrackPlot("h_norChi2") + self.makeTrackPlot("h_prob") + self.makeTrackPlot("h_eta") + self.makeTrackPlot("h_etaErr") + self.makeTrackPlot("h_theta") + self.makeTrackPlot("h_phi") + self.makeTrackPlot("h_phiErr") + self.makeTrackPlot("h_d0Beamspot") + self.makeTrackPlot("h_d0BeamspotErr") + self.makeTrackPlot("h_dz") + self.makeTrackPlot("h_dzErr") + self.makeTrackPlot("h_pt") + self.makeTrackPlot("h_ptErr") + self.makeTrackPlot("h_meanAngle") + self.makeTrackPlot("h_hitsGood") + # these don't have several histograms in one plot + self.makeTrackPlot("h2_meanAngleVsHits", twoDimensional=True) + self.makeTrackPlot("h2_hitsGoodVsHitsValid", twoDimensional=True) + self.makeTrackPlot("h2_hitsPixelVsEta", twoDimensional=True) + self.makeTrackPlot("h2_hitsPixelVsTheta", twoDimensional=True) + self.makeTrackPlot("h2_hitsStripVsEta", twoDimensional=True) + self.makeTrackPlot("h2_hitsStripVsTheta", twoDimensional=True) + self.makeTrackPlot("h2_ptVsTheta", twoDimensional=True) + + + +def main(): + pass + + +if __name__ == "__main__": + main() diff --git a/Alignment/CocoaModel/src/Model.cc b/Alignment/CocoaModel/src/Model.cc index f516e0732d040..21a234ea310c7 100644 --- a/Alignment/CocoaModel/src/Model.cc +++ b/Alignment/CocoaModel/src/Model.cc @@ -19,8 +19,6 @@ #include "Alignment/CocoaModel/interface/MeasurementDiffEntry.h" #include "Alignment/CocoaModel/interface/CocoaDaqReaderText.h" #include "Alignment/CocoaModel/interface/CocoaDaqReaderRoot.h" -//t#include "Alignment/CocoaModel/interface/MeasurementDiffAngle.h" -//t#include "Alignment/CocoaModel/interface/MeasurementCentreEntry.h" #include "Alignment/CocoaUtilities/interface/ALIUtils.h" #include "Alignment/CocoaModel/interface/EntryAngle.h" #include "Alignment/CocoaModel/interface/ParameterMgr.h" @@ -432,12 +430,6 @@ void Model::readSystemDescription() { meastemp = new MeasurementCOPS(4, measType, measName); meastemp->setConversionFactor(wordlist); meastemp->construct(); - } else if (measType == ALIstring("DIFFCENTRE")) { - //t meastemp = new MeasurementDiffCentre( 1, measType, measName ); - meastemp->construct(); - } else if (measType == ALIstring("DIFFANGLE")) { - //t meastemp = new MeasurementDiffAngle( 2, measType, measName ); - meastemp->construct(); } else if (measType == ALIstring("DIFFENTRY")) { meastemp = new MeasurementDiffEntry(1, measType, measName); meastemp->construct(); diff --git a/Alignment/CommonAlignmentProducer/plugins/AlignmentProducer.cc b/Alignment/CommonAlignmentProducer/plugins/AlignmentProducer.cc index 2cae957af695c..b55f6c0332640 100644 --- a/Alignment/CommonAlignmentProducer/plugins/AlignmentProducer.cc +++ b/Alignment/CommonAlignmentProducer/plugins/AlignmentProducer.cc @@ -15,6 +15,13 @@ AlignmentProducer::AlignmentProducer(const edm::ParameterSet &config) maxLoops_{config.getUntrackedParameter("maxLoops")} { edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::AlignmentProducer"; + // do now all the consumes + trajTrackAssociationCollectionToken_ = consumes(tjTkAssociationMapTag_); + bsToken_ = consumes(beamSpotTag_); + tkFittedLasBeamCollectionToken_ = consumes(tkLasBeamTag_); + tsosVectorCollectionToken_ = consumes(tkLasBeamTag_); + aliClusterValueMapToken_ = consumes(clusterValueMapTag_); + // Tell the framework what data is being produced if (doTracker_) { setWhatProduced(this, &AlignmentProducer::produceTracker); diff --git a/Alignment/CommonAlignmentProducer/plugins/AlignmentProducer.h b/Alignment/CommonAlignmentProducer/plugins/AlignmentProducer.h index aea01e35b1702..dfc086dc415e6 100644 --- a/Alignment/CommonAlignmentProducer/plugins/AlignmentProducer.h +++ b/Alignment/CommonAlignmentProducer/plugins/AlignmentProducer.h @@ -58,33 +58,39 @@ class AlignmentProducer : public edm::ESProducerLooper, public AlignmentProducer bool getAliClusterValueMap(const edm::Event&, edm::Handle&) override; const unsigned int maxLoops_; /// Number of loops to loop + + edm::EDGetTokenT trajTrackAssociationCollectionToken_; + edm::EDGetTokenT bsToken_; + edm::EDGetTokenT tkFittedLasBeamCollectionToken_; + edm::EDGetTokenT tsosVectorCollectionToken_; + edm::EDGetTokenT aliClusterValueMapToken_; }; //------------------------------------------------------------------------------ inline bool AlignmentProducer::getTrajTrackAssociationCollection(const edm::Event& event, edm::Handle& result) { - return event.getByLabel(tjTkAssociationMapTag_, result); + return event.getByToken(trajTrackAssociationCollectionToken_, result); } //------------------------------------------------------------------------------ inline bool AlignmentProducer::getBeamSpot(const edm::Event& event, edm::Handle& result) { - return event.getByLabel(beamSpotTag_, result); + return event.getByToken(bsToken_, result); } //------------------------------------------------------------------------------ inline bool AlignmentProducer::getTkFittedLasBeamCollection(const edm::Run& run, edm::Handle& result) { - return run.getByLabel(tkLasBeamTag_, result); + return run.getByToken(tkFittedLasBeamCollectionToken_, result); } //------------------------------------------------------------------------------ inline bool AlignmentProducer::getTsosVectorCollection(const edm::Run& run, edm::Handle& result) { - return run.getByLabel(tkLasBeamTag_, result); + return run.getByToken(tsosVectorCollectionToken_, result); } //------------------------------------------------------------------------------ inline bool AlignmentProducer::getAliClusterValueMap(const edm::Event& event, edm::Handle& result) { - return event.getByLabel(clusterValueMapTag_, result); + return event.getByToken(aliClusterValueMapToken_, result); } #endif diff --git a/Alignment/HIPAlignmentAlgorithm/interface/LhcTrackAnalyzer.h b/Alignment/HIPAlignmentAlgorithm/interface/LhcTrackAnalyzer.h deleted file mode 100644 index 61ca07bdaf1f3..0000000000000 --- a/Alignment/HIPAlignmentAlgorithm/interface/LhcTrackAnalyzer.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef LhcTrackAnalyzer_h -#define LhcTrackAnalyzer_h - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "TFile.h" -#include "TH1D.h" -#include "TH1I.h" -#include "TH2D.h" -#include "TTree.h" - -#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h" - -#include "DataFormats/TrackCandidate/interface/TrackCandidate.h" -#include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" -#include "DataFormats/DetId/interface/DetId.h" -#include "DataFormats/SiStripDetId/interface/StripSubdetector.h" -#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" - -//FOR CLUSTERINFO -#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h" -#include "DataFormats/SiStripDigi/interface/SiStripDigi.h" -#include "DataFormats/SiStripCluster/interface/SiStripCluster.h" -//#include "DataFormats/SiStripCluster/interface/SiStripClusterInfo.h" -#include "DataFormats/Common/interface/DetSetVector.h" - -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "DataFormats/GeometryVector/interface/GlobalPoint.h" -#include "DataFormats/GeometryVector/interface/LocalPoint.h" -#include "Geometry/CommonDetUnit/interface/GeomDet.h" - -// system include files -#include -#include -#include -#include -#include -#include - -// -// class decleration -// - -class LhcTrackAnalyzer : public edm::one::EDAnalyzer<> { -public: - explicit LhcTrackAnalyzer(const edm::ParameterSet&); - ~LhcTrackAnalyzer() override; - -private: - void beginJob() override; - void analyze(const edm::Event&, const edm::EventSetup&) override; - void endJob() override; - - // ----------member data --------------------------- - edm::InputTag TrackCollectionTag_; - edm::InputTag PVtxCollectionTag_; - bool debug_; - - // Output - std::string filename_; - TFile* rootFile_; - TTree* rootTree_; - - // Root-Tuple variables : - //======================= - void SetVarToZero(); - - static const int nMaxtracks_ = 3000; - int nTracks_; - int run_; - int event_; - double pt_[nMaxtracks_]; - double eta_[nMaxtracks_]; - double phi_[nMaxtracks_]; - double chi2_[nMaxtracks_]; - double chi2ndof_[nMaxtracks_]; - int charge_[nMaxtracks_]; - double qoverp_[nMaxtracks_]; - double dz_[nMaxtracks_]; - double dxy_[nMaxtracks_]; - double xPCA_[nMaxtracks_]; - double yPCA_[nMaxtracks_]; - double zPCA_[nMaxtracks_]; - int trkAlgo_[nMaxtracks_]; - int trkQuality_[nMaxtracks_]; - int isHighPurity_[nMaxtracks_]; - int validhits_[nMaxtracks_][7]; - bool goodbx_; - bool goodvtx_; -}; - -#endif diff --git a/Alignment/HIPAlignmentAlgorithm/plugins/LhcTrackAnalyzer.cc b/Alignment/HIPAlignmentAlgorithm/plugins/LhcTrackAnalyzer.cc new file mode 100644 index 0000000000000..9d30308184337 --- /dev/null +++ b/Alignment/HIPAlignmentAlgorithm/plugins/LhcTrackAnalyzer.cc @@ -0,0 +1,342 @@ +// -*- C++ -*- +// +// Package: LhcTrackAnalyzer +// Class: LhcTrackAnalyzer +// +/**\class LhcTrackAnalyzer LhcTrackAnalyzer.cc Alignment/HIPAlignmentAlgorithm/plugins/LhcTrackAnalyzer.cc + + Originally written by M.Musich + Expanded by A. Bonato + + Description: Ntuplizer for collision tracks +*/ +// + +// system include files +#include +#include +#include + +// user include files +#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" +#include "DataFormats/SiStripDetId/interface/StripSubdetector.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +// ROOT includes +#include "TFile.h" +#include "TTree.h" + +// +// class decleration +// + +class LhcTrackAnalyzer : public edm::one::EDAnalyzer<> { +public: + explicit LhcTrackAnalyzer(const edm::ParameterSet&); + ~LhcTrackAnalyzer() override = default; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + // ----------member data --------------------------- + edm::InputTag TrackCollectionTag_; + edm::InputTag PVtxCollectionTag_; + bool debug_; + std::vector acceptedBX_; + + edm::EDGetTokenT theTrackCollectionToken; + edm::EDGetTokenT theVertexCollectionToken; + + // Output + std::string filename_; + TFile* rootFile_; + TTree* rootTree_; + + // Root-Tuple variables : + //======================= + void SetVarToZero(); + + static constexpr int nMaxtracks_ = 3000; + int nTracks_; + int run_; + int event_; + double pt_[nMaxtracks_]; + double eta_[nMaxtracks_]; + double phi_[nMaxtracks_]; + double chi2_[nMaxtracks_]; + double chi2ndof_[nMaxtracks_]; + int charge_[nMaxtracks_]; + double qoverp_[nMaxtracks_]; + double dz_[nMaxtracks_]; + double dxy_[nMaxtracks_]; + double xPCA_[nMaxtracks_]; + double yPCA_[nMaxtracks_]; + double zPCA_[nMaxtracks_]; + int trkAlgo_[nMaxtracks_]; + int trkQuality_[nMaxtracks_]; + int isHighPurity_[nMaxtracks_]; + int validhits_[nMaxtracks_][7]; + bool goodbx_; + bool goodvtx_; +}; + +// Constructor + +LhcTrackAnalyzer::LhcTrackAnalyzer(const edm::ParameterSet& iConfig) + : TrackCollectionTag_(iConfig.getParameter("TrackCollectionTag")), + PVtxCollectionTag_(iConfig.getParameter("PVtxCollectionTag")), + debug_(iConfig.getParameter("Debug")), + acceptedBX_(iConfig.getParameter>("acceptedBX")), + filename_(iConfig.getParameter("OutputFileName")) { + //now do what ever initialization is needed + theTrackCollectionToken = consumes(TrackCollectionTag_); + theVertexCollectionToken = consumes(PVtxCollectionTag_); +} + +// +// member functions +// + +/*****************************************************************************/ +void LhcTrackAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) +/*****************************************************************************/ +{ + using namespace edm; + using namespace reco; + using namespace std; + + //======================================================= + // Initialize Root-tuple variables + //======================================================= + + SetVarToZero(); + + //======================================================= + // Retrieve the Track information + //======================================================= + + const auto& vertices = iEvent.get(theVertexCollectionToken); + const auto& vtx = vertices.front(); + if (vtx.isFake()) { + goodvtx_ = false; + } else { + goodvtx_ = true; + } + + int bx = iEvent.bunchCrossing(); + if (acceptedBX_.empty()) { + goodbx_ = true; + } else { + if (std::find(acceptedBX_.begin(), acceptedBX_.end(), bx) != acceptedBX_.end()) { + goodbx_ = true; + } + } + + run_ = iEvent.id().run(); + event_ = iEvent.id().event(); + + const auto& tracks = iEvent.get(theTrackCollectionToken); + if (debug_) { + edm::LogInfo("LhcTrackAnalyzer") << "LhcTrackAnalyzer::analyze() looping over " << tracks.size() << "tracks." + << endl; + } + + for (const auto& track : tracks) { + if (nTracks_ >= nMaxtracks_) { + edm::LogWarning("LhcTrackAnalyzer") + << " LhcTrackAnalyzer::analyze() : Warning - Run " << run_ << " Event " << event_ + << "\tNumber of tracks: " << tracks.size() << " , greater than " << nMaxtracks_ << std::endl; + continue; + } + pt_[nTracks_] = track.pt(); + eta_[nTracks_] = track.eta(); + phi_[nTracks_] = track.phi(); + chi2_[nTracks_] = track.chi2(); + chi2ndof_[nTracks_] = track.normalizedChi2(); + charge_[nTracks_] = track.charge(); + qoverp_[nTracks_] = track.qoverp(); + dz_[nTracks_] = track.dz(); + dxy_[nTracks_] = track.dxy(); + xPCA_[nTracks_] = track.vertex().x(); + yPCA_[nTracks_] = track.vertex().y(); + zPCA_[nTracks_] = track.vertex().z(); + validhits_[nTracks_][0] = track.numberOfValidHits(); + validhits_[nTracks_][1] = track.hitPattern().numberOfValidPixelBarrelHits(); + validhits_[nTracks_][2] = track.hitPattern().numberOfValidPixelEndcapHits(); + validhits_[nTracks_][3] = track.hitPattern().numberOfValidStripTIBHits(); + validhits_[nTracks_][4] = track.hitPattern().numberOfValidStripTIDHits(); + validhits_[nTracks_][5] = track.hitPattern().numberOfValidStripTOBHits(); + validhits_[nTracks_][6] = track.hitPattern().numberOfValidStripTECHits(); + + int myalgo = -88; + if (track.algo() == reco::TrackBase::undefAlgorithm) { + myalgo = 0; + } else if (track.algo() == reco::TrackBase::ctf) { + myalgo = 1; + } else if (track.algo() == reco::TrackBase::duplicateMerge) { + myalgo = 2; + } else if (track.algo() == reco::TrackBase::cosmics) { + myalgo = 3; + } else if (track.algo() == reco::TrackBase::initialStep) { + myalgo = 4; + } else if (track.algo() == reco::TrackBase::lowPtTripletStep) { + myalgo = 5; + } else if (track.algo() == reco::TrackBase::pixelPairStep) { + myalgo = 6; + } else if (track.algo() == reco::TrackBase::detachedTripletStep) { + myalgo = 7; + } else if (track.algo() == reco::TrackBase::mixedTripletStep) { + myalgo = 8; + } else if (track.algo() == reco::TrackBase::pixelLessStep) { + myalgo = 9; + } else if (track.algo() == reco::TrackBase::tobTecStep) { + myalgo = 10; + } else if (track.algo() == reco::TrackBase::jetCoreRegionalStep) { + myalgo = 11; + } else if (track.algo() == reco::TrackBase::muonSeededStepInOut) { + myalgo = 13; + } else if (track.algo() == reco::TrackBase::muonSeededStepOutIn) { + myalgo = 14; + } else if (track.algo() == reco::TrackBase::highPtTripletStep) { + myalgo = 22; + } else if (track.algo() == reco::TrackBase::lowPtQuadStep) { + myalgo = 23; + } else if (track.algo() == reco::TrackBase::detachedQuadStep) { + myalgo = 24; + } else { + myalgo = 25; + edm::LogWarning("LhcTrackAnalyzer") + << "LhcTrackAnalyzer does not support all types of tracks, encountered one from algo " + << reco::TrackBase::algoName(track.algo()); + } + trkAlgo_[nTracks_] = myalgo; + + int myquality = -99; + if (track.quality(reco::TrackBase::undefQuality)) + myquality = -1; + if (track.quality(reco::TrackBase::loose)) + myquality = 0; + if (track.quality(reco::TrackBase::tight)) + myquality = 1; + if (track.quality(reco::TrackBase::highPurity)) + myquality = 2; + trkQuality_[nTracks_] = myquality; + + if (track.quality(reco::TrackBase::highPurity)) + isHighPurity_[nTracks_] = 1; + else + isHighPurity_[nTracks_] = 0; + nTracks_++; + + } //end loop on tracks + + for (int d = 0; d < nTracks_; ++d) { + if (abs(trkQuality_[d]) > 5) + edm::LogInfo("LhcTrackAnalyzer") << "MYQUALITY!!! " << trkQuality_[d] << " at track # " << d << "/" << nTracks_ + << endl; + } + + rootTree_->Fill(); +} + +/*****************************************************************************/ +void LhcTrackAnalyzer::beginJob() +/*****************************************************************************/ +{ + edm::LogInfo("beginJob") << "Begin Job" << std::endl; + // Define TTree for output + rootFile_ = new TFile(filename_.c_str(), "recreate"); + rootTree_ = new TTree("tree", "Lhc Track tree"); + + // Track Paramters + rootTree_->Branch("run", &run_, "run/I"); + rootTree_->Branch("event", &event_, "event/I"); + rootTree_->Branch("goodbx", &goodbx_, "goodbx/O"); + rootTree_->Branch("goodvtx", &goodvtx_, "goodvtx/O"); + rootTree_->Branch("nTracks", &nTracks_, "nTracks/I"); + rootTree_->Branch("pt", &pt_, "pt[nTracks]/D"); + rootTree_->Branch("eta", &eta_, "eta[nTracks]/D"); + rootTree_->Branch("phi", &phi_, "phi[nTracks]/D"); + rootTree_->Branch("chi2", &chi2_, "chi2[nTracks]/D"); + rootTree_->Branch("chi2ndof", &chi2ndof_, "chi2ndof[nTracks]/D"); + rootTree_->Branch("charge", &charge_, "charge[nTracks]/I"); + rootTree_->Branch("qoverp", &qoverp_, "qoverp[nTracks]/D"); + rootTree_->Branch("dz", &dz_, "dz[nTracks]/D"); + rootTree_->Branch("dxy", &dxy_, "dxy[nTracks]/D"); + rootTree_->Branch("xPCA", &xPCA_, "xPCA[nTracks]/D"); + rootTree_->Branch("yPCA", &yPCA_, "yPCA[nTracks]/D"); + rootTree_->Branch("zPCA", &zPCA_, "zPCA[nTracks]/D"); + rootTree_->Branch("isHighPurity", &isHighPurity_, "isHighPurity[nTracks]/I"); + rootTree_->Branch("trkQuality", &trkQuality_, "trkQuality[nTracks]/I"); + rootTree_->Branch("trkAlgo", &trkAlgo_, "trkAlgo[nTracks]/I"); + rootTree_->Branch("nValidHits", &validhits_, "nValidHits[nTracks][7]/I"); +} + +/*****************************************************************************/ +void LhcTrackAnalyzer::endJob() +/*****************************************************************************/ +{ + if (rootFile_) { + rootFile_->Write(); + rootFile_->Close(); + } +} + +/*****************************************************************************/ +void LhcTrackAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) +/*****************************************************************************/ +{ + edm::ParameterSetDescription desc; + desc.setComment("Ntuplizer for LHC tracks"); + desc.add("TrackCollectionTag", edm::InputTag("ALCARECOTkAlMinBias")); + desc.add("PVtxCollectionTag", edm::InputTag("offlinePrimaryVertices")); + desc.add("Debug", false); + desc.add>("acceptedBX", {}); + desc.add("OutputFileName", "LhcTrackAnalyzer_Output_default.root"); + descriptions.addWithDefaultLabel(desc); +} + +/*****************************************************************************/ +void LhcTrackAnalyzer::SetVarToZero() +/*****************************************************************************/ +{ + run_ = -1; + event_ = -99; + nTracks_ = 0; + for (int i = 0; i < nMaxtracks_; ++i) { + pt_[i] = 0; + eta_[i] = 0; + phi_[i] = 0; + chi2_[i] = 0; + chi2ndof_[i] = 0; + charge_[i] = 0; + qoverp_[i] = 0; + dz_[i] = 0; + dxy_[i] = 0; + xPCA_[i] = 0; + yPCA_[i] = 0; + zPCA_[i] = 0; + trkQuality_[i] = 0; + trkAlgo_[i] = -1; + isHighPurity_[i] = -3; + for (int j = 0; j < 7; j++) { + validhits_[nTracks_][j] = -1 * j; + } + } +} + +//define this as a plug-in +DEFINE_FWK_MODULE(LhcTrackAnalyzer); diff --git a/Alignment/HIPAlignmentAlgorithm/src/HIPAlignmentAlgorithm.cc b/Alignment/HIPAlignmentAlgorithm/src/HIPAlignmentAlgorithm.cc index 1f0cb0c349b86..39c6612187990 100644 --- a/Alignment/HIPAlignmentAlgorithm/src/HIPAlignmentAlgorithm.cc +++ b/Alignment/HIPAlignmentAlgorithm/src/HIPAlignmentAlgorithm.cc @@ -12,28 +12,28 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/Run.h" +#include "FWCore/Framework/interface/ESTransientHandle.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ValidityInterval.h" #include "TrackingTools/PatternTools/interface/Trajectory.h" #include "TrackingTools/TrackFitters/interface/TrajectoryStateCombiner.h" #include "Alignment/CommonAlignment/interface/Alignable.h" #include "Alignment/CommonAlignment/interface/AlignableDetUnit.h" +#include "Alignment/CommonAlignment/interface/AlignableExtras.h" #include "Alignment/CommonAlignment/interface/AlignmentParameters.h" #include "Alignment/CommonAlignment/interface/SurveyResidual.h" -#include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentParameterStore.h" #include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentParameterSelector.h" +#include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentParameterStore.h" #include "Alignment/HIPAlignmentAlgorithm/interface/HIPUserVariables.h" #include "Alignment/HIPAlignmentAlgorithm/interface/HIPUserVariablesIORoot.h" #include "Alignment/MuonAlignment/interface/AlignableMuon.h" -#include #include "Alignment/TrackerAlignment/interface/AlignableTracker.h" -#include "Alignment/CommonAlignment/interface/AlignableExtras.h" -#include "DataFormats/TrackReco/interface/Track.h" #include "CondFormats/AlignmentRecord/interface/GlobalPositionRcd.h" #include "CondFormats/AlignmentRecord/interface/TrackerAlignmentRcd.h" -#include "FWCore/Framework/interface/ValidityInterval.h" -#include "FWCore/Framework/interface/ESTransientHandle.h" -#include "FWCore/Framework/interface/EventSetup.h" +#include "DataFormats/GeometrySurface/interface/LocalError.h" +#include "DataFormats/TrackReco/interface/Track.h" #include "Alignment/HIPAlignmentAlgorithm/interface/HIPAlignmentAlgorithm.h" @@ -83,7 +83,6 @@ HIPAlignmentAlgorithm::HIPAlignmentAlgorithm(const edm::ParameterSet& cfg, edm:: theIOVrangeSet = cfg.getParameter>("IOVrange"); defaultAlignableSpecs.minNHits = cfg.getParameter("minimumNumberOfHits"); - ; defaultAlignableSpecs.minRelParError = cfg.getParameter("minRelParameterError"); defaultAlignableSpecs.maxRelParError = cfg.getParameter("maxRelParameterError"); defaultAlignableSpecs.maxHitPull = cfg.getParameter("maxAllowedHitPull"); diff --git a/Alignment/HIPAlignmentAlgorithm/src/LhcTrackAnalyzer.cc b/Alignment/HIPAlignmentAlgorithm/src/LhcTrackAnalyzer.cc deleted file mode 100644 index 37c427c70b022..0000000000000 --- a/Alignment/HIPAlignmentAlgorithm/src/LhcTrackAnalyzer.cc +++ /dev/null @@ -1,277 +0,0 @@ -// -*- C++ -*- -// -// Package: LhcTrackAnalyzer -// Class: LhcTrackAnalyzer -// -/**\class LhcTrackAnalyzer LhcTrackAnalyzer.cc MySub/LhcTrackAnalyzer/src/LhcTrackAnalyzer.cc - -Originally written by M.Musich -Expanded by A. Bonato - - Description: - - Implementation: - -*/ -// - -// updated to 25/2/2009 5.30 pm - -// -// - -// system include files -#include - -// user include files -#include "Alignment/HIPAlignmentAlgorithm/interface/LhcTrackAnalyzer.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" - -#include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h" -#include "FWCore/Framework/interface/Event.h" -#include -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "TH1F.h" -#include "TH2F.h" -#include "TFile.h" -#include "TROOT.h" -#include "TChain.h" -#include "TNtuple.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "CommonTools/UtilAlgos/interface/TFileService.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include -#include -#include -#include -#include "MagneticField/Engine/interface/MagneticField.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" - -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "DataFormats/VertexReco/interface/Vertex.h" -#include "DataFormats/VertexReco/interface/VertexFwd.h" - -// Constructor - -LhcTrackAnalyzer::LhcTrackAnalyzer(const edm::ParameterSet& iConfig) - -{ - //now do what ever initialization is needed - debug_ = iConfig.getParameter("Debug"); - TrackCollectionTag_ = iConfig.getParameter("TrackCollectionTag"); - PVtxCollectionTag_ = iConfig.getParameter("PVtxCollectionTag"); - filename_ = iConfig.getParameter("OutputFileName"); -} - -// Destructor -LhcTrackAnalyzer::~LhcTrackAnalyzer() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} - -// -// member functions -// - -// ------------ method called to for each event ------------ -void LhcTrackAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - using namespace edm; - using namespace reco; - using namespace std; - - //======================================================= - // Initialize Root-tuple variables - //======================================================= - - SetVarToZero(); - - //======================================================= - // Retrieve the Track information - //======================================================= - - Handle trackCollectionHandle; - iEvent.getByLabel(TrackCollectionTag_, trackCollectionHandle); - Handle vertexCollectionHandle; - iEvent.getByLabel(PVtxCollectionTag_, vertexCollectionHandle); - for (VertexCollection::const_iterator vtx = vertexCollectionHandle->begin(); vtx != vertexCollectionHandle->end(); - ++vtx) { - if (vtx == vertexCollectionHandle->begin()) { - if (vtx->isFake()) - goodvtx_ = false; - else - goodvtx_ = true; - } else - break; - } - - goodbx_ = true; - // int bx = iEvent.bunchCrossing(); - //if (bx==51 || bx==2724) goodbx_=true; - - run_ = iEvent.id().run(); - event_ = iEvent.id().event(); - - if (debug_) - cout << "LhcTrackAnalyzer::analyze() looping over " << trackCollectionHandle->size() << "tracks." << endl; - - // unsigned int i = 0; - for (TrackCollection::const_iterator track = trackCollectionHandle->begin(); track != trackCollectionHandle->end(); - ++track) { - if (nTracks_ >= nMaxtracks_) { - std::cout << " LhcTrackAnalyzer::analyze() : Warning - Run " << run_ << " Event " << event_ - << "\tNumber of tracks: " << trackCollectionHandle->size() << " , greater than " << nMaxtracks_ - << std::endl; - continue; - } - pt_[nTracks_] = track->pt(); - eta_[nTracks_] = track->eta(); - phi_[nTracks_] = track->phi(); - chi2_[nTracks_] = track->chi2(); - chi2ndof_[nTracks_] = track->normalizedChi2(); - charge_[nTracks_] = track->charge(); - qoverp_[nTracks_] = track->qoverp(); - dz_[nTracks_] = track->dz(); - dxy_[nTracks_] = track->dxy(); - xPCA_[nTracks_] = track->vertex().x(); - yPCA_[nTracks_] = track->vertex().y(); - zPCA_[nTracks_] = track->vertex().z(); - validhits_[nTracks_][0] = track->numberOfValidHits(); - validhits_[nTracks_][1] = track->hitPattern().numberOfValidPixelBarrelHits(); - validhits_[nTracks_][2] = track->hitPattern().numberOfValidPixelEndcapHits(); - validhits_[nTracks_][3] = track->hitPattern().numberOfValidStripTIBHits(); - validhits_[nTracks_][4] = track->hitPattern().numberOfValidStripTIDHits(); - validhits_[nTracks_][5] = track->hitPattern().numberOfValidStripTOBHits(); - validhits_[nTracks_][6] = track->hitPattern().numberOfValidStripTECHits(); - - int myalgo = -88; - if (track->algo() == reco::TrackBase::undefAlgorithm) - myalgo = 0; - if (track->algo() == reco::TrackBase::ctf) - myalgo = 1; - if (track->algo() == reco::TrackBase::initialStep) - myalgo = 4; - if (track->algo() == reco::TrackBase::lowPtTripletStep) - myalgo = 5; - if (track->algo() == reco::TrackBase::pixelPairStep) - myalgo = 6; - if (track->algo() == reco::TrackBase::detachedTripletStep) - myalgo = 7; - if (track->algo() == reco::TrackBase::mixedTripletStep) - myalgo = 8; - if (track->algo() == reco::TrackBase::pixelLessStep) - myalgo = 9; - if (track->algo() == reco::TrackBase::tobTecStep) - myalgo = 10; - if (track->algo() == reco::TrackBase::jetCoreRegionalStep) - myalgo = 11; - // This class is pending the migration to Phase1 tracks - if (track->algo() == reco::TrackBase::highPtTripletStep || track->algo() == reco::TrackBase::lowPtQuadStep || - track->algo() == reco::TrackBase::detachedQuadStep) { - throw cms::Exception("Not implemented") - << "LhcTrackAnalyzer does not yet support phase1 tracks, encountered one from algo " - << reco::TrackBase::algoName(track->algo()); - } - trkAlgo_[nTracks_] = myalgo; - - int myquality = -99; - if (track->quality(reco::TrackBase::undefQuality)) - myquality = -1; - if (track->quality(reco::TrackBase::loose)) - myquality = 0; - if (track->quality(reco::TrackBase::tight)) - myquality = 1; - if (track->quality(reco::TrackBase::highPurity)) - myquality = 2; - //if(track->quality(reco::TrackBase::confirmed))myquality=3; - // if(track->quality(reco::TrackBase::goodIterative))myquality=4; - // if(track->quality(reco::TrackBase::qualitySize))myquality=5; - trkQuality_[nTracks_] = myquality; - - if (track->quality(reco::TrackBase::highPurity)) - isHighPurity_[nTracks_] = 1; - else - isHighPurity_[nTracks_] = 0; - nTracks_++; - - } //end loop on tracks - - for (int d = 0; d < nTracks_; ++d) { - if (abs(trkQuality_[d]) > 5) - cout << "MYQUALITY!!! " << trkQuality_[d] << " at track # " << d << "/" << nTracks_ << endl; - } - - rootTree_->Fill(); -} - -// ------------ method called once each job before begining the event loop ------------ -void LhcTrackAnalyzer::beginJob() { - edm::LogInfo("beginJob") << "Begin Job" << std::endl; - // Define TTree for output - rootFile_ = new TFile(filename_.c_str(), "recreate"); - rootTree_ = new TTree("tree", "Lhc Track tree"); - - // Track Paramters - rootTree_->Branch("run", &run_, "run/I"); - rootTree_->Branch("event", &event_, "event/I"); - rootTree_->Branch("goodbx", &goodbx_, "goodbx/O"); - rootTree_->Branch("goodvtx", &goodvtx_, "goodvtx/O"); - rootTree_->Branch("nTracks", &nTracks_, "nTracks/I"); - rootTree_->Branch("pt", &pt_, "pt[nTracks]/D"); - rootTree_->Branch("eta", &eta_, "eta[nTracks]/D"); - rootTree_->Branch("phi", &phi_, "phi[nTracks]/D"); - rootTree_->Branch("chi2", &chi2_, "chi2[nTracks]/D"); - rootTree_->Branch("chi2ndof", &chi2ndof_, "chi2ndof[nTracks]/D"); - rootTree_->Branch("charge", &charge_, "charge[nTracks]/I"); - rootTree_->Branch("qoverp", &qoverp_, "qoverp[nTracks]/D"); - rootTree_->Branch("dz", &dz_, "dz[nTracks]/D"); - rootTree_->Branch("dxy", &dxy_, "dxy[nTracks]/D"); - rootTree_->Branch("xPCA", &xPCA_, "xPCA[nTracks]/D"); - rootTree_->Branch("yPCA", &yPCA_, "yPCA[nTracks]/D"); - rootTree_->Branch("zPCA", &zPCA_, "zPCA[nTracks]/D"); - rootTree_->Branch("isHighPurity", &isHighPurity_, "isHighPurity[nTracks]/I"); - rootTree_->Branch("trkQuality", &trkQuality_, "trkQuality[nTracks]/I"); - rootTree_->Branch("trkAlgo", &trkAlgo_, "trkAlgo[nTracks]/I"); - rootTree_->Branch("nValidHits", &validhits_, "nValidHits[nTracks][7]/I"); -} - -// ------------ method called once each job just after ending the event loop ------------ -void LhcTrackAnalyzer::endJob() { - if (rootFile_) { - rootFile_->Write(); - rootFile_->Close(); - } -} - -void LhcTrackAnalyzer::SetVarToZero() { - run_ = -1; - event_ = -99; - nTracks_ = 0; - for (int i = 0; i < nMaxtracks_; ++i) { - pt_[i] = 0; - eta_[i] = 0; - phi_[i] = 0; - chi2_[i] = 0; - chi2ndof_[i] = 0; - charge_[i] = 0; - qoverp_[i] = 0; - dz_[i] = 0; - dxy_[i] = 0; - xPCA_[i] = 0; - yPCA_[i] = 0; - zPCA_[i] = 0; - trkQuality_[i] = 0; - trkAlgo_[i] = -1; - isHighPurity_[i] = -3; - for (int j = 0; j < 7; j++) { - validhits_[nTracks_][j] = -1 * j; - } - } -} - -//define this as a plug-in -DEFINE_FWK_MODULE(LhcTrackAnalyzer); diff --git a/Alignment/HIPAlignmentAlgorithm/test/LHCAnalyzer_cfg.py b/Alignment/HIPAlignmentAlgorithm/test/LHCAnalyzer_cfg.py index 9fe0ef598f395..a1b5b13ed6657 100644 --- a/Alignment/HIPAlignmentAlgorithm/test/LHCAnalyzer_cfg.py +++ b/Alignment/HIPAlignmentAlgorithm/test/LHCAnalyzer_cfg.py @@ -1,39 +1,44 @@ import FWCore.ParameterSet.Config as cms +from PhysicsTools.PatAlgos.patInputFiles_cff import filesRelValTTbarPileUpGENSIMRECO process = cms.Process("Demo") -##process.load("AuxCode.CheckTkCollection.Run123151_RECO_cff") +################################################################### +# Messages +################################################################### process.load("FWCore.MessageService.MessageLogger_cfi") MessageLogger = cms.Service("MessageLogger", cout = cms.untracked.PSet( - threshold = cms.untracked.string('WARNING') - ), + threshold = cms.untracked.string('WARNING') + ), destinations = cms.untracked.vstring('cout') ) process.MessageLogger.cerr.FwkReport.reportEvery = 1000 +################################################################### +# Conditions +################################################################### process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") -process.GlobalTag.globaltag = 'GR09_R_34X_V2::All' -process.source = cms.Source("PoolSource", - fileNames = cms.untracked.vstring('rfio:///?svcClass=cmscafuser&path=/castor/cern.ch/cms/store/user/emiglior/ALCARECO/08Jan10/TkAlMinBias_123615.root','rfio:///?svcClass=cmscafuser&path=/castor/cern.ch/cms/store/user/emiglior/ALCARECO/08Jan10/TkAlMinBias_124009.root','rfio:///?svcClass=cmscafuser&path=/castor/cern.ch/cms/store/user/emiglior/ALCARECO/08Jan10/TkAlMinBias_124020.root','rfio:///?svcClass=cmscafuser&path=/castor/cern.ch/cms/store/user/emiglior/ALCARECO/08Jan10/TkAlMinBias_124022.root') - - -# - -#'rfio:///?svcClass=cmscafuser&path=/castor/cern.ch/cms/store/user/emiglior/ALCARECO/08Jan10/TkAlMinBias_124024.root','rfio:///?svcClass=cmscafuser&path=/castor/cern.ch/cms/store/user/emiglior/ALCARECO/08Jan10/TkAlMinBias_124030.root','rfio:///?svcClass=cmscafuser&path=/castor/cern.ch/cms/store/user/emiglior/ALCARECO/08Jan10/TkAlMinBias_124230.root' +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2017_realistic', '') - -#,'rfio:///?svcClass=cmscafuser&path=/castor/cern.ch/cms/store/user/emiglior/ALCARECO/08Jan10/TkAlMinBias_124120.root' #2.36TeV run - -) +################################################################### +# Event source +################################################################### +process.source = cms.Source("PoolSource", + fileNames = filesRelValTTbarPileUpGENSIMRECO) process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) +################################################################### +# Analyzer +################################################################### process.LhcTrackAnalyzer = cms.EDAnalyzer("LhcTrackAnalyzer", -# TrackCollectionTag = cms.InputTag("generalTracks"), - TrackCollectionTag = cms.InputTag("ALCARECOTkAlMinBias"), + TrackCollectionTag = cms.InputTag("generalTracks"), + #TrackCollectionTag = cms.InputTag("ALCARECOTkAlMinBias"), PVtxCollectionTag = cms.InputTag("offlinePrimaryVertices"), - OutputFileName = cms.string("AnalyzerOutput_1.root"), + acceptedBX = cms.vuint32(), # (51,2724) + OutputFileName = cms.string("AnalyzerOutput_1.root"), Debug = cms.bool(False) ) diff --git a/Alignment/LaserAlignment/BuildFile.xml b/Alignment/LaserAlignment/BuildFile.xml index fedafb9bdac8f..9b1e6ad9c934c 100644 --- a/Alignment/LaserAlignment/BuildFile.xml +++ b/Alignment/LaserAlignment/BuildFile.xml @@ -3,7 +3,6 @@ - diff --git a/Alignment/OfflineValidation/python/TkAlAllInOneTool/offlineValidationTemplates.py b/Alignment/OfflineValidation/python/TkAlAllInOneTool/offlineValidationTemplates.py index 2dbfeadbef788..3dd9a759a571a 100644 --- a/Alignment/OfflineValidation/python/TkAlAllInOneTool/offlineValidationTemplates.py +++ b/Alignment/OfflineValidation/python/TkAlAllInOneTool/offlineValidationTemplates.py @@ -33,13 +33,13 @@ ## Load and Configure OfflineValidation and Output File ## process.load("Alignment.OfflineValidation.TrackerOfflineValidation_.oO[offlineValidationMode]Oo._cff") -process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..compressionSettings = compressionSettings, +process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..compressionSettings = compressionSettings process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..Tracks = 'FinalTrackRefitter' process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..trajectoryInput = 'FinalTrackRefitter' process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..moduleLevelHistsTransient = .oO[offlineModuleLevelHistsTransient]Oo. process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..moduleLevelProfiles = .oO[offlineModuleLevelProfiles]Oo. process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..stripYResiduals = .oO[stripYResiduals]Oo. -process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..maxTracks = .oO[maxtracks]Oo./ .oO[parallelJobs]Oo. +process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..maxTracks = int(.oO[maxtracks]Oo./.oO[parallelJobs]Oo.) process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..chargeCut = .oO[chargeCut]Oo. """ diff --git a/Alignment/OfflineValidation/python/TkAlAllInOneTool/primaryVertexResolutionTemplates.py b/Alignment/OfflineValidation/python/TkAlAllInOneTool/primaryVertexResolutionTemplates.py index e2a0942f3299c..7b35628c5d95e 100644 --- a/Alignment/OfflineValidation/python/TkAlAllInOneTool/primaryVertexResolutionTemplates.py +++ b/Alignment/OfflineValidation/python/TkAlAllInOneTool/primaryVertexResolutionTemplates.py @@ -9,7 +9,7 @@ isMultipleRuns=False if(isinstance(runboundary, (list, tuple))): isMultipleRuns=True - print "Multiple Runs are selected" + print("Multiple Runs are selected") if(isMultipleRuns): process.source.firstRun = cms.untracked.uint32(int(runboundary[0])) diff --git a/Alignment/OfflineValidation/python/TkAlAllInOneTool/zMuMuValidationTemplates.py b/Alignment/OfflineValidation/python/TkAlAllInOneTool/zMuMuValidationTemplates.py index 97284eba43282..e1ea2121c27e4 100644 --- a/Alignment/OfflineValidation/python/TkAlAllInOneTool/zMuMuValidationTemplates.py +++ b/Alignment/OfflineValidation/python/TkAlAllInOneTool/zMuMuValidationTemplates.py @@ -1,8 +1,7 @@ ZMuMuValidationTemplate=""" - +compressionSettings = 207 ###### MuSclFit SETTINGS ############################################## - ### MuScleFit specific configuration process.looper = cms.Looper( diff --git a/Alignment/OfflineValidation/test/test_all.sh b/Alignment/OfflineValidation/test/test_all.sh index 0501533bbb3c9..afd15e3b9e83f 100755 --- a/Alignment/OfflineValidation/test/test_all.sh +++ b/Alignment/OfflineValidation/test/test_all.sh @@ -158,6 +158,16 @@ validateAlignments.py -c validation_config.ini -N testingAllInOneTool --dryRun | printf "\n\n" +echo " TESTING all-in-one tool configuration ..." +FILES="$PWD/testingAllInOneTool/*_cfg.py" +for f in $FILES +do + echo "Processing $f file..." + python3 $FILE/$f || die "Failure compiling test configuration" $? +done + +printf "\n\n" + echo " TESTING Primary Vertex Validation run-by-run submission ..." submitPVValidationJobs.py -j UNIT_TEST -D /HLTPhysics/Run2016C-TkAlMinBias-07Dec2018-v1/ALCARECO -i ${LOCAL_TEST_DIR}/testPVValidation_Relvals_DATA.ini -r --unitTest || die "Failure running PV Validation run-by-run submission" $? diff --git a/CalibCalorimetry/CaloTPG/src/CaloTPGTranscoderULUT.h b/CalibCalorimetry/CaloTPG/interface/CaloTPGTranscoderULUT.h similarity index 100% rename from CalibCalorimetry/CaloTPG/src/CaloTPGTranscoderULUT.h rename to CalibCalorimetry/CaloTPG/interface/CaloTPGTranscoderULUT.h diff --git a/CalibCalorimetry/CaloTPG/plugins/CaloTPGTranscoderULUTs.cc b/CalibCalorimetry/CaloTPG/plugins/CaloTPGTranscoderULUTs.cc index 7547c349fa6b4..99473986f4d62 100644 --- a/CalibCalorimetry/CaloTPG/plugins/CaloTPGTranscoderULUTs.cc +++ b/CalibCalorimetry/CaloTPG/plugins/CaloTPGTranscoderULUTs.cc @@ -25,7 +25,7 @@ #include "FWCore/Framework/interface/ESProducer.h" #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" -#include "CalibCalorimetry/CaloTPG/src/CaloTPGTranscoderULUT.h" +#include "CalibCalorimetry/CaloTPG/interface/CaloTPGTranscoderULUT.h" #include "CalibFormats/CaloTPG/interface/CaloTPGRecord.h" #include "FWCore/Framework/interface/ValidityInterval.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" diff --git a/CalibCalorimetry/CaloTPG/src/CaloTPGTranscoderULUT.cc b/CalibCalorimetry/CaloTPG/src/CaloTPGTranscoderULUT.cc index 48595c5ae9cec..ba934267acdc9 100644 --- a/CalibCalorimetry/CaloTPG/src/CaloTPGTranscoderULUT.cc +++ b/CalibCalorimetry/CaloTPG/src/CaloTPGTranscoderULUT.cc @@ -1,4 +1,4 @@ -#include "CalibCalorimetry/CaloTPG/src/CaloTPGTranscoderULUT.h" +#include "CalibCalorimetry/CaloTPG/interface/CaloTPGTranscoderULUT.h" #include "DataFormats/HcalDetId/interface/HcalGenericDetId.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Framework/interface/ESTransientHandle.h" diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigResidualCorrection.cc b/CalibMuon/DTCalibration/plugins/DTTTrigResidualCorrection.cc index ee8092ca60883..ac8f7cebfa63b 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigResidualCorrection.cc +++ b/CalibMuon/DTCalibration/plugins/DTTTrigResidualCorrection.cc @@ -15,6 +15,8 @@ #include "CondFormats/DataRecord/interface/DTTtrigRcd.h" #include "CondFormats/DTObjects/interface/DTMtime.h" #include "CondFormats/DataRecord/interface/DTMtimeRcd.h" +#include "CondFormats/DTObjects/interface/DTRecoConditions.h" +#include "CondFormats/DataRecord/interface/DTRecoConditionsVdriftRcd.h" #include "CalibMuon/DTCalibration/interface/DTResidualFitter.h" @@ -48,6 +50,7 @@ namespace dtCalibration { //useConstantvDrift_ = pset.getParameter("useConstantDriftVelocity"); dbLabel_ = pset.getUntrackedParameter("dbLabel", ""); useSlopesCalib_ = pset.getUntrackedParameter("useSlopesCalib", false); + readLegacyVDriftDB = pset.getParameter("readLegacyVDriftDB"); // Load external slopes if (useSlopesCalib_) { @@ -83,9 +86,22 @@ namespace dtCalibration { tTrigMap_ = &*tTrig; // Get vDrift record - ESHandle mTimeHandle; - setup.get().get(mTimeHandle); - mTimeMap_ = &*mTimeHandle; + if (readLegacyVDriftDB) { + ESHandle mTimeHandle; + setup.get().get(mTimeHandle); + mTimeMap_ = &*mTimeHandle; + vDriftMap_ = nullptr; + } else { + ESHandle hVdrift; + setup.get().get(hVdrift); + vDriftMap_ = &*hVdrift; + mTimeMap_ = nullptr; + // Consistency check: no parametrization is implemented for the time being + int version = vDriftMap_->version(); + if (version != 1) { + throw cms::Exception("Configuration") << "only version 1 is presently supported for VDriftDB"; + } + } } DTTTrigData DTTTrigResidualCorrection::correction(const DTSuperLayerId& slId) { @@ -94,10 +110,15 @@ namespace dtCalibration { if (status != 0) throw cms::Exception("[DTTTrigResidualCorrection]") << "Could not find tTrig entry in DB for" << slId << endl; - float vDrift, hitResolution; - status = mTimeMap_->get(slId, vDrift, hitResolution, DTVelocityUnits::cm_per_ns); - if (status != 0) - throw cms::Exception("[DTTTrigResidualCorrection]") << "Could not find vDrift entry in DB for" << slId << endl; + float vDrift, hitResolution = 0.; + if (readLegacyVDriftDB) { // Legacy format + status = mTimeMap_->get(slId, vDrift, hitResolution, DTVelocityUnits::cm_per_ns); + if (status != 0) + throw cms::Exception("[DTTTrigResidualCorrection]") << "Could not find vDrift entry in DB for" << slId << endl; + } else { + vDrift = vDriftMap_->get(DTWireId(slId.rawId())); + } + TH1F residualHisto = *(getHisto(slId)); LogTrace("Calibration") << "[DTTTrigResidualCorrection]: \n" << " Mean, RMS = " << residualHisto.GetMean() << ", " << residualHisto.GetRMS(); diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigResidualCorrection.h b/CalibMuon/DTCalibration/plugins/DTTTrigResidualCorrection.h index a9c5e3a01f91e..e13806bce3253 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigResidualCorrection.h +++ b/CalibMuon/DTCalibration/plugins/DTTTrigResidualCorrection.h @@ -18,6 +18,7 @@ namespace edm { class DTTtrig; class DTMtime; +class DTRecoConditions; class DTResidualFitter; class TH1F; @@ -50,7 +51,10 @@ namespace dtCalibration { double vDriftEff_[5][14][4][3]; const DTTtrig* tTrigMap_; - const DTMtime* mTimeMap_; + const DTMtime* mTimeMap_; // legacy vdrift DB object + const DTRecoConditions* vDriftMap_; // vdrift DB object in new format + bool readLegacyVDriftDB; // which one to use + DTResidualFitter* fitter_; }; diff --git a/CalibMuon/DTCalibration/plugins/DTVDriftCalibration.cc b/CalibMuon/DTCalibration/plugins/DTVDriftCalibration.cc index b76a9aade2917..69f4e9e5434e4 100644 --- a/CalibMuon/DTCalibration/plugins/DTVDriftCalibration.cc +++ b/CalibMuon/DTCalibration/plugins/DTVDriftCalibration.cc @@ -20,6 +20,7 @@ #include "CalibMuon/DTDigiSync/interface/DTTTrigBaseSync.h" #include "CondFormats/DTObjects/interface/DTMtime.h" +#include "CondFormats/DTObjects/interface/DTRecoConditions.h" #include "CondFormats/DataRecord/interface/DTStatusFlagRcd.h" #include "CondFormats/DTObjects/interface/DTStatusFlag.h" @@ -82,6 +83,8 @@ DTVDriftCalibration::DTVDriftCalibration(const ParameterSet& pset) // the granularity to be used for tMax string tMaxGranularity = pset.getUntrackedParameter("tMaxGranularity", "bySL"); + writeLegacyVDriftDB = pset.getParameter("writeLegacyVDriftDB"); + // Enforce it to be by SL since rest is not implemented if (tMaxGranularity != "bySL") { LogError("Calibration") << "[DTVDriftCalibration] tMaxGranularity will be fixed to bySL."; @@ -281,7 +284,16 @@ void DTVDriftCalibration::endJob() { // Instantiate a DTCalibrationMap object if you want to calculate the calibration constants DTCalibrationMap calibValuesFile(theCalibFilePar); // Create the object to be written to DB - DTMtime* mTime = new DTMtime(); + DTMtime* mTime = nullptr; + DTRecoConditions* vDrift = nullptr; + if (writeLegacyVDriftDB) { + mTime = new DTMtime(); + } else { + vDrift = new DTRecoConditions(); + vDrift->setFormulaExpr("[0]"); + //vDriftNewMap->setFormulaExpr("[0]*(1-[1]*x)"); // add parametrization for dependency along Y + vDrift->setVersion(1); + } // write the TMax histograms of each SL to the root file if (theGranularity == bySL) { @@ -322,7 +334,12 @@ void DTVDriftCalibration::endJob() { calibValuesFile.addCell(calibValuesFile.getKey(wireId), newConstants); // vdrift is cm/ns , resolution is cm - mTime->set((wireId.layerId()).superlayerId(), vDriftAndReso[0], vDriftAndReso[1], DTVelocityUnits::cm_per_ns); + if (writeLegacyVDriftDB) { + mTime->set((wireId.layerId()).superlayerId(), vDriftAndReso[0], vDriftAndReso[1], DTVelocityUnits::cm_per_ns); + } else { + vector params = {vDriftAndReso[0]}; + vDrift->set(wireId, params); + } LogTrace("Calibration") << " SL: " << (wireId.layerId()).superlayerId() << " vDrift = " << vDriftAndReso[0] << " reso = " << vDriftAndReso[1]; } @@ -366,8 +383,12 @@ void DTVDriftCalibration::endJob() { LogVerbatim("Calibration") << "[DTVDriftCalibration]Writing vdrift object to DB!"; // Write the vdrift object to DB - string record = "DTMtimeRcd"; - DTCalibDBUtils::writeToDB(record, mTime); + if (writeLegacyVDriftDB) { + string record = "DTMtimeRcd"; + DTCalibDBUtils::writeToDB(record, mTime); + } else { + DTCalibDBUtils::writeToDB("DTRecoConditionsVdriftRcd", vDrift); + } } // to be implemented: granularity different from bySL diff --git a/CalibMuon/DTCalibration/plugins/DTVDriftCalibration.h b/CalibMuon/DTCalibration/plugins/DTVDriftCalibration.h index 3cbe0afe81c3e..0bd6dbed47396 100644 --- a/CalibMuon/DTCalibration/plugins/DTVDriftCalibration.h +++ b/CalibMuon/DTCalibration/plugins/DTVDriftCalibration.h @@ -129,5 +129,8 @@ class DTVDriftCalibration : public edm::EDAnalyzer { // Choose the chamber you want to calibrate std::string theCalibChamber; + + // which format to be created + bool writeLegacyVDriftDB; }; #endif diff --git a/CalibMuon/DTCalibration/python/PlottingTools/plotT0FromHistos.py b/CalibMuon/DTCalibration/python/PlottingTools/plotT0FromHistos.py index ca58e650f36fd..23b57c9684f19 100644 --- a/CalibMuon/DTCalibration/python/PlottingTools/plotT0FromHistos.py +++ b/CalibMuon/DTCalibration/python/PlottingTools/plotT0FromHistos.py @@ -4,8 +4,8 @@ from .drawHistoAllChambers import drawHisto def binNumber(station,sl): - if sl is 3 and station is 4: return 11 - if sl is 2 and station is 4: return None + if sl == 3 and station == 4: return 11 + if sl == 2 and station == 4: return None start = (station - 1)*3 return start + sl diff --git a/CalibMuon/DTCalibration/python/dtTTrigResidualCorrection_cfi.py b/CalibMuon/DTCalibration/python/dtTTrigResidualCorrection_cfi.py index 58a4af8487e18..e969f2c06bf1b 100644 --- a/CalibMuon/DTCalibration/python/dtTTrigResidualCorrection_cfi.py +++ b/CalibMuon/DTCalibration/python/dtTTrigResidualCorrection_cfi.py @@ -8,6 +8,7 @@ #rootBaseDir = cms.untracked.string('/DQMData/DT/DTCalibValidation'), rootBaseDir = cms.untracked.string('DTResiduals'), dbLabel = cms.untracked.string(''), - useFitToResiduals = cms.bool(True) - ) + useFitToResiduals = cms.bool(True), + readLegacyVDriftDB =cms.bool(True) + ), ) diff --git a/CalibMuon/DTCalibration/python/dtVDriftAnalyzer_cfg.py b/CalibMuon/DTCalibration/python/dtVDriftAnalyzer_cfg.py index 7394e6f75aa1b..1fb4562afc348 100644 --- a/CalibMuon/DTCalibration/python/dtVDriftAnalyzer_cfg.py +++ b/CalibMuon/DTCalibration/python/dtVDriftAnalyzer_cfg.py @@ -14,7 +14,8 @@ ) process.dtVDriftAnalyzer = cms.EDAnalyzer("DTVDriftAnalyzer", - rootFileName = cms.untracked.string('') + rootFileName = cms.untracked.string(''), + readLegacyVDriftDB =cms.bool(True), ) process.p = cms.Path(process.dtVDriftAnalyzer) diff --git a/CalibMuon/DTCalibration/python/dtVDriftMeanTimerCalibration_cfi.py b/CalibMuon/DTCalibration/python/dtVDriftMeanTimerCalibration_cfi.py index ba8fe916a61e2..23cf35716e2d7 100644 --- a/CalibMuon/DTCalibration/python/dtVDriftMeanTimerCalibration_cfi.py +++ b/CalibMuon/DTCalibration/python/dtVDriftMeanTimerCalibration_cfi.py @@ -39,5 +39,9 @@ calibConstFileName = cms.untracked.string('vDriftAndReso.txt') ), # Name of the txt file which will contain the calibrated v_drift - vDriftFileName = cms.untracked.string('vDriftFromMtime.txt') + vDriftFileName = cms.untracked.string('vDriftFromMtime.txt'), + + # Use legacy DB format + writeLegacyVDriftDB =cms.bool(True), + ) diff --git a/CalibMuon/DTCalibration/python/dtVDriftMeanTimerCalibration_cosmics_cfi.py b/CalibMuon/DTCalibration/python/dtVDriftMeanTimerCalibration_cosmics_cfi.py index 02d7ae66d7675..799c7e933088c 100644 --- a/CalibMuon/DTCalibration/python/dtVDriftMeanTimerCalibration_cosmics_cfi.py +++ b/CalibMuon/DTCalibration/python/dtVDriftMeanTimerCalibration_cosmics_cfi.py @@ -39,5 +39,8 @@ calibConstFileName = cms.untracked.string('vDriftAndReso.txt') ), # Name of the txt file which will contain the calibrated v_drift - vDriftFileName = cms.untracked.string('vDriftFromMtime.txt') + vDriftFileName = cms.untracked.string('vDriftFromMtime.txt'), + + # Use legacy DB format + writeLegacyVDriftDB =cms.bool(True), ) diff --git a/CalibMuon/DTCalibration/python/dtVDriftMeanTimerWriter_cfi.py b/CalibMuon/DTCalibration/python/dtVDriftMeanTimerWriter_cfi.py index c06fabd3fc2b3..7b778afccb64b 100644 --- a/CalibMuon/DTCalibration/python/dtVDriftMeanTimerWriter_cfi.py +++ b/CalibMuon/DTCalibration/python/dtVDriftMeanTimerWriter_cfi.py @@ -5,5 +5,7 @@ vDriftAlgoConfig = cms.PSet( rootFileName = cms.string(''), debug = cms.untracked.bool(False) - ) + ), + readLegacyVDriftDB = cms.bool(True), + writeLegacyVDriftDB = cms.bool(True) ) diff --git a/CalibMuon/DTCalibration/test/DBTools/DTVDriftAnalyzer.cc b/CalibMuon/DTCalibration/test/DBTools/DTVDriftAnalyzer.cc index e484fc73d8fc4..6bd906fb2cb6d 100644 --- a/CalibMuon/DTCalibration/test/DBTools/DTVDriftAnalyzer.cc +++ b/CalibMuon/DTCalibration/test/DBTools/DTVDriftAnalyzer.cc @@ -11,6 +11,9 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "CondFormats/DTObjects/interface/DTMtime.h" #include "CondFormats/DataRecord/interface/DTMtimeRcd.h" +#include "CondFormats/DTObjects/interface/DTRecoConditions.h" +#include "CondFormats/DataRecord/interface/DTRecoConditionsVdriftRcd.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include #include "TFile.h" #include "TH1D.h" @@ -19,7 +22,8 @@ using namespace edm; using namespace std; -DTVDriftAnalyzer::DTVDriftAnalyzer(const ParameterSet& pset) { +DTVDriftAnalyzer::DTVDriftAnalyzer(const ParameterSet& pset) + : readLegacyVDriftDB(pset.getParameter("readLegacyVDriftDB")) { // The root file which will contain the histos string rootFileName = pset.getUntrackedParameter("rootFileName"); theFile = new TFile(rootFileName.c_str(), "RECREATE"); @@ -29,23 +33,57 @@ DTVDriftAnalyzer::DTVDriftAnalyzer(const ParameterSet& pset) { DTVDriftAnalyzer::~DTVDriftAnalyzer() { theFile->Close(); } void DTVDriftAnalyzer::beginRun(const edm::Run& run, const edm::EventSetup& eventSetup) { - ESHandle mTime; - eventSetup.get().get(mTime); - mTimeMap = &*mTime; - cout << "[DTVDriftAnalyzer] MTime version: " << mTime->version() << endl; + if (readLegacyVDriftDB) { + ESHandle mTime; + eventSetup.get().get(mTime); + mTimeMap = &*mTime; + vDriftMap_ = nullptr; + edm::LogVerbatim("DTVDriftAnalyzer") << "[DTVDriftAnalyzer] MTime version: " << mTime->version() << endl; + } else { + ESHandle hVdrift; + eventSetup.get().get(hVdrift); + vDriftMap_ = &*hVdrift; + mTimeMap = nullptr; + // Consistency check: no parametrization is implemented for the time being + int version = vDriftMap_->version(); + if (version != 1) { + throw cms::Exception("Configuration") << "only version 1 is presently supported for VDriftDB"; + } + } } void DTVDriftAnalyzer::endJob() { // Loop over DB entries - for (DTMtime::const_iterator mtime = mTimeMap->begin(); mtime != mTimeMap->end(); ++mtime) { - DTWireId wireId( - (*mtime).first.wheelId, (*mtime).first.stationId, (*mtime).first.sectorId, (*mtime).first.slId, 0, 0); - float vdrift; - float reso; - DetId detId(wireId.rawId()); + + map> values; + + if (readLegacyVDriftDB) { + for (DTMtime::const_iterator mtime = mTimeMap->begin(); mtime != mTimeMap->end(); ++mtime) { + DTWireId wireId( + (*mtime).first.wheelId, (*mtime).first.stationId, (*mtime).first.sectorId, (*mtime).first.slId, 0, 0); + float vdrift; + float reso; + DetId detId(wireId.rawId()); + // vdrift is cm/ns , resolution is cm + mTimeMap->get(detId, vdrift, reso, DTVelocityUnits::cm_per_ns); + values[wireId.rawId()] = make_pair(vdrift, reso); + } + } else { + for (DTRecoConditions::const_iterator vd = vDriftMap_->begin(); vd != vDriftMap_->end(); ++vd) { + DTWireId wireId(vd->first); + float vdrift = vDriftMap_->get(wireId); + values[vd->first] = make_pair(vdrift, 0.f); + } + } + + for (map>::const_iterator it = values.begin(); it != values.end(); ++it) { + float vdrift = it->second.first; + float reso = it->second.second; + DTWireId wireId(it->first); // vdrift is cm/ns , resolution is cm - mTimeMap->get(detId, vdrift, reso, DTVelocityUnits::cm_per_ns); - cout << "Wire: " << wireId << endl << " vdrift (cm/ns): " << vdrift << endl << " reso (cm): " << reso << endl; + edm::LogVerbatim("DTVDriftAnalyzer") << "Wire: " << wireId << endl + << " vdrift (cm/ns): " << vdrift << endl + << " reso (cm): " << reso << endl; //Define an histo for each wheel and each superlayer type TH1D* hVDriftHisto = theVDriftHistoMap[make_pair(wireId.wheel(), wireId.superlayer())]; diff --git a/CalibMuon/DTCalibration/test/DBTools/DTVDriftAnalyzer.h b/CalibMuon/DTCalibration/test/DBTools/DTVDriftAnalyzer.h index 72c70442d06be..e6c85041f5c78 100644 --- a/CalibMuon/DTCalibration/test/DBTools/DTVDriftAnalyzer.h +++ b/CalibMuon/DTCalibration/test/DBTools/DTVDriftAnalyzer.h @@ -18,6 +18,7 @@ #include class DTMtime; +class DTRecoConditions; class TFile; class TH1D; @@ -45,7 +46,9 @@ class DTVDriftAnalyzer : public edm::EDAnalyzer { TFile* theFile; //The t0 map - const DTMtime* mTimeMap; + const DTMtime* mTimeMap; // legacy DB object + const DTRecoConditions* vDriftMap_; // DB object in new format + bool readLegacyVDriftDB; // which one to use // Map of the vdrift, reso histos by wheel/sector/SL std::map, TH1D*> theVDriftHistoMap; diff --git a/CalibMuon/DTDigiSync/BuildFile.xml b/CalibMuon/DTDigiSync/BuildFile.xml index 09b5b5ba76949..6a6a31a2e8e80 100644 --- a/CalibMuon/DTDigiSync/BuildFile.xml +++ b/CalibMuon/DTDigiSync/BuildFile.xml @@ -1,7 +1,5 @@ - + - - diff --git a/CalibMuon/DTDigiSync/plugins/BuildFile.xml b/CalibMuon/DTDigiSync/plugins/BuildFile.xml new file mode 100644 index 0000000000000..9baa5d2f83b77 --- /dev/null +++ b/CalibMuon/DTDigiSync/plugins/BuildFile.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/CalibMuon/DTDigiSync/src/DTTTrigSyncFromDB.cc b/CalibMuon/DTDigiSync/plugins/DTTTrigSyncFromDB.cc similarity index 66% rename from CalibMuon/DTDigiSync/src/DTTTrigSyncFromDB.cc rename to CalibMuon/DTDigiSync/plugins/DTTTrigSyncFromDB.cc index 853104ddf2001..3c73027eeed0b 100644 --- a/CalibMuon/DTDigiSync/src/DTTTrigSyncFromDB.cc +++ b/CalibMuon/DTDigiSync/plugins/DTTTrigSyncFromDB.cc @@ -1,10 +1,107 @@ -/* - * See header file for a description of this class. +/** \class DTTTrigSyncFromDB + * Concrete implementation of a DTTTrigBaseSync. + * This class define the offset for RecHit building + * of data and simulation. + * The offset is computes as: + *
+ * offset = t0 + tTrig + wirePropCorr - tofCorr + *
+ * where:
+ * - t0 from test pulses (taken from DB, it is assumed to be in ns; can be switched off) + * - ttrig from the fit of time boxrising edge (taken from DB, it is assumed to be in ns) + * (At the moment a single value is read for ttrig offset + * but this may change in the future) + * - signal propagation along the wire (can be switched off): + * it is assumed the ttrig accounts on average for + * correction from the center of the wire to the frontend. + * Here we just have to correct for the distance of the hit from the wire center. + * - TOF correction (can be switched off for cosmics): + * the ttrig already accounts for average TOF correction, + * depending on the granularity used for the ttrig computation we just have to correct for the + * TOF from the center of the chamber, SL, layer or wire to the hit position. + * NOTE: particles are assumed as coming from the IP. + * + * The emulatorOffset is computed as: + *
+ * offset = int(ttrig/BXspace)*BXspace + t0 + *
+ * where:
+ * - t0 from test pulses (taken from DB, it is assumed to be in ns; can be switched off) + * - ttrig from the fit of time box rising edge (taken from DB, it is assumed to be in ns) + * - BXspace BX spacing (in ns). Can be configured. + * + * NOTE: this should approximate what is seen online by the BTI * * \author G. Cerminara - INFN Torino */ -#include "DTTTrigSyncFromDB.h" +#include "CalibMuon/DTDigiSync/interface/DTTTrigBaseSync.h" + +class DTLayer; +class DTWireId; +class DTT0; +class DTTtrig; + +namespace edm { + class ParameterSet; +} + +class DTTTrigSyncFromDB : public DTTTrigBaseSync { +public: + /// Constructor + DTTTrigSyncFromDB(const edm::ParameterSet& config); + + /// Destructor + ~DTTTrigSyncFromDB() override; + + // Operations + + /// Pass the Event Setup to the algo at each event + void setES(const edm::EventSetup& setup) override; + + /// Time (ns) to be subtracted to the digi time, + /// Parameters are the layer and the wireId to which the + /// digi is referred and the estimation of + /// the 3D hit position (globPos) + double offset(const DTLayer* layer, + const DTWireId& wireId, + const GlobalPoint& globPos, + double& tTrig, + double& wirePropCorr, + double& tofCorr) const override; + + /// Time (ns) to be subtracted to the digi time. + /// It does not take into account TOF and signal propagation along the wire + double offset(const DTWireId& wireId) const override; + + /// Time (ns) to be subtracted to the digi time for emulation purposes + /// It does not take into account TOF and signal propagation along the wire + /// It also returns the different contributions separately: + /// - tTrig is the offset (t_trig) + /// - t0cell is the t0 from pulses + double emulatorOffset(const DTWireId& wireId, double& tTrig, double& t0cell) const override; + +private: + const DTT0* tZeroMap; + const DTTtrig* tTrigMap; + // Set the verbosity level + const bool debug; + // The velocity of signal propagation along the wire (cm/ns) + double theVPropWire; + // Switch on/off the T0 correction from pulses + bool doT0Correction; + // Switch on/off the TOF correction for particles from IP + bool doTOFCorrection; + int theTOFCorrType; + // Switch on/off the correction for the signal propagation along the wire + bool doWirePropCorrection; + int theWirePropCorrType; + // spacing of BX in ns + double theBXspace; + + std::string thetTrigLabel; + std::string thet0Label; +}; #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -198,3 +295,8 @@ double DTTTrigSyncFromDB::emulatorOffset(const DTWireId& wireId, double& tTrig, return int(tTrig / theBXspace) * theBXspace + t0cell; } + +#include "FWCore/PluginManager/interface/PluginFactory.h" +#include "CalibMuon/DTDigiSync/interface/DTTTrigSyncFactory.h" + +DEFINE_EDM_PLUGIN(DTTTrigSyncFactory, DTTTrigSyncFromDB, "DTTTrigSyncFromDB"); diff --git a/CalibMuon/DTDigiSync/src/DTTTrigSyncT0Only.cc b/CalibMuon/DTDigiSync/plugins/DTTTrigSyncT0Only.cc similarity index 55% rename from CalibMuon/DTDigiSync/src/DTTTrigSyncT0Only.cc rename to CalibMuon/DTDigiSync/plugins/DTTTrigSyncT0Only.cc index e44b97b361da4..770714ed6f659 100644 --- a/CalibMuon/DTDigiSync/src/DTTTrigSyncT0Only.cc +++ b/CalibMuon/DTDigiSync/plugins/DTTTrigSyncT0Only.cc @@ -1,10 +1,57 @@ -/* - * See header file for a description of this class. +/** \class DTTTrigSyncT0Only + * Concrete implementation of a DTTTrigBaseSync. + * This plugin reads only the t0 from pulses from the DB. + * * * \author G. Cerminara - INFN Torino */ -#include "DTTTrigSyncT0Only.h" +#include "CalibMuon/DTDigiSync/interface/DTTTrigBaseSync.h" + +class DTLayer; +class DTWireId; +class DTT0; + +namespace edm { + class ParameterSet; +} + +class DTTTrigSyncT0Only : public DTTTrigBaseSync { +public: + /// Constructor + DTTTrigSyncT0Only(const edm::ParameterSet& config); + + /// Destructor + ~DTTTrigSyncT0Only() override; + + // Operations + + /// Pass the Event Setup to the algo at each event + void setES(const edm::EventSetup& setup) override; + + /// Time (ns) to be subtracted to the digi time, + /// Parameters are the layer and the wireId to which the + /// digi is referred and the estimation of + /// the 3D hit position (globPos) + double offset(const DTLayer* layer, + const DTWireId& wireId, + const GlobalPoint& globPos, + double& tTrig, + double& wirePropCorr, + double& tofCorr) const override; + + double offset(const DTWireId& wireId) const override; + + /// Time (ns) to be subtracted to the digi time for emulation purposes + /// Returns just 0 in this implementation of the plugin + double emulatorOffset(const DTWireId& wireId, double& tTrig, double& t0cell) const override; + +private: + const DTT0* tZeroMap; + + // Set the verbosity level + const bool debug; +}; #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -68,3 +115,8 @@ double DTTTrigSyncT0Only::emulatorOffset(const DTWireId& wireId, double& tTrig, t0cell = 0.; return 0.; } + +#include "FWCore/PluginManager/interface/PluginFactory.h" +#include "CalibMuon/DTDigiSync/interface/DTTTrigSyncFactory.h" + +DEFINE_EDM_PLUGIN(DTTTrigSyncFactory, DTTTrigSyncT0Only, "DTTTrigSyncT0Only"); diff --git a/CalibMuon/DTDigiSync/src/DTTTrigSyncTOFCorr.cc b/CalibMuon/DTDigiSync/plugins/DTTTrigSyncTOFCorr.cc similarity index 52% rename from CalibMuon/DTDigiSync/src/DTTTrigSyncTOFCorr.cc rename to CalibMuon/DTDigiSync/plugins/DTTTrigSyncTOFCorr.cc index 7a73f1db92c8a..3d2f6d53d8d6f 100644 --- a/CalibMuon/DTDigiSync/src/DTTTrigSyncTOFCorr.cc +++ b/CalibMuon/DTDigiSync/plugins/DTTTrigSyncTOFCorr.cc @@ -1,10 +1,106 @@ -/* - * See header file for a description of this class. +/** \class DTTTrigSyncTOFCorr + * Concrete implementation of a DTTTrigBaseSync. + * This class define the offsets for RecHit building + * coherently to the digitization realized with the + * DTDigiSyncTOFCorr module. + * The offset is computes as:
+ * offset = tTrig + wirePropCorr - tofCorr
+ * where:
+ * - tTrig is a fixed offset defined in tTrig parameter + * (default 500 ns)
+ * - wirePropCorr is the correction for the signal propagation along the wire
+ * - tofCorr is the correction for the TOF of the particle set according to + * tofCorrType parameter:
+ * 0: tofCorrType = TOF from IP to 3D Hit position (globPos)
+ * 1: tofCorrType = TOF correction for distance difference + * between 3D center of the chamber and hit position
+ * 2: tofCorrType = TOF correction for distance difference + * between 3D center of the wire and hit position + * (This mode in available for backward compatibility)
+ * + * The emulatorOffset is computed as: + *
+ * offset = int(ttrig/BXspace)*BXspace + *
+ * where:
+ * - ttrig from the fit of time box rising edge (taken from configuration, it is assumed to be in ns) + * - BXspace BX spacing (in ns). Taken from configuration (default 25ns). + * + * NOTE: this should approximate what is seen online by the BTI + * + * * * \author G. Cerminara - INFN Torino */ -#include "DTTTrigSyncTOFCorr.h" +#include "CalibMuon/DTDigiSync/interface/DTTTrigBaseSync.h" + +class DTLayer; +class DTWireId; + +namespace edm { + class ParameterSet; +} + +class DTTTrigSyncTOFCorr : public DTTTrigBaseSync { +public: + /// Constructor + DTTTrigSyncTOFCorr(const edm::ParameterSet& config); + + /// Destructor + ~DTTTrigSyncTOFCorr() override; + + // Operations + + /// Pass the Event Setup to the algo at each event + void setES(const edm::EventSetup& setup) override {} + + /// Time (ns) to be subtracted to the digi time, + /// Parameters are the layer and the wireId to which the + /// digi is referred and the estimation of + /// the 3D hit position (globPos) + /// It also returns the different contributions separately: + /// - tTrig is the offset (t_trig) + /// - wirePropCorr is the delay for signal propagation along the wire + /// - tofCorr is the correction due to the particle TOF + double offset(const DTLayer* layer, + const DTWireId& wireId, + const GlobalPoint& globPos, + double& tTrig, + double& wirePropCorr, + double& tofCorr) const override; + + double offset(const DTWireId& wireId) const override; + + /// Time (ns) to be subtracted to the digi time for emulation purposes + /// It does not take into account TOF and signal propagation along the wire + /// It also returns the different contributions separately: + /// - tTrig is the offset (t_trig) + /// - t0cell is the t0 from pulses (always 0 in this case) + double emulatorOffset(const DTWireId& wireId, double& tTrig, double& t0cell) const override; + +private: + // The fixed t_trig to be subtracted to digi time (ns) + const double theTTrig; + // Velocity of signal propagation along the wire (cm/ns) + // For the value + // cfr. CMS-IN 2000-021: (2.56+-0.17)x1e8 m/s + // CMS NOTE 2003-17: (0.244) m/ns = 24.4 cm/ns + const double theVPropWire; + + // Select the mode for TOF correction: + // 0: tofCorr = TOF from IP to 3D Hit position (globPos) + // 1: tofCorr = TOF correction for distance difference + // between 3D center of the chamber and hit position + // 2: tofCorr = TOF correction for distance difference + // between 3D center of the wire and hit position + const int theTOFCorrType; + + // Set the verbosity level + const bool debug; + // spacing of BX in ns + double theBXspace; +}; #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/Exception.h" @@ -112,3 +208,8 @@ double DTTTrigSyncTOFCorr::emulatorOffset(const DTWireId& wireId, double& tTrig, return int(tTrig / theBXspace) * theBXspace; } + +#include "FWCore/PluginManager/interface/PluginFactory.h" +#include "CalibMuon/DTDigiSync/interface/DTTTrigSyncFactory.h" + +DEFINE_EDM_PLUGIN(DTTTrigSyncFactory, DTTTrigSyncTOFCorr, "DTTTrigSyncTOFCorr"); diff --git a/CalibMuon/DTDigiSync/src/DTTTrigSyncFromDB.h b/CalibMuon/DTDigiSync/src/DTTTrigSyncFromDB.h deleted file mode 100644 index aa9728054cb75..0000000000000 --- a/CalibMuon/DTDigiSync/src/DTTTrigSyncFromDB.h +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef RecoLocalMuon_DTTTrigSyncFromDB_H -#define RecoLocalMuon_DTTTrigSyncFromDB_H - -/** \class DTTTrigSyncFromDB - * Concrete implementation of a DTTTrigBaseSync. - * This class define the offset for RecHit building - * of data and simulation. - * The offset is computes as: - *
- * offset = t0 + tTrig + wirePropCorr - tofCorr - *
- * where:
- * - t0 from test pulses (taken from DB, it is assumed to be in ns; can be switched off) - * - ttrig from the fit of time boxrising edge (taken from DB, it is assumed to be in ns) - * (At the moment a single value is read for ttrig offset - * but this may change in the future) - * - signal propagation along the wire (can be switched off): - * it is assumed the ttrig accounts on average for - * correction from the center of the wire to the frontend. - * Here we just have to correct for the distance of the hit from the wire center. - * - TOF correction (can be switched off for cosmics): - * the ttrig already accounts for average TOF correction, - * depending on the granularity used for the ttrig computation we just have to correct for the - * TOF from the center of the chamber, SL, layer or wire to the hit position. - * NOTE: particles are assumed as coming from the IP. - * - * The emulatorOffset is computed as: - *
- * offset = int(ttrig/BXspace)*BXspace + t0 - *
- * where:
- * - t0 from test pulses (taken from DB, it is assumed to be in ns; can be switched off) - * - ttrig from the fit of time box rising edge (taken from DB, it is assumed to be in ns) - * - BXspace BX spacing (in ns). Can be configured. - * - * NOTE: this should approximate what is seen online by the BTI - * - * \author G. Cerminara - INFN Torino - */ - -#include "CalibMuon/DTDigiSync/interface/DTTTrigBaseSync.h" - -class DTLayer; -class DTWireId; -class DTT0; -class DTTtrig; - -namespace edm { - class ParameterSet; -} - -class DTTTrigSyncFromDB : public DTTTrigBaseSync { -public: - /// Constructor - DTTTrigSyncFromDB(const edm::ParameterSet& config); - - /// Destructor - ~DTTTrigSyncFromDB() override; - - // Operations - - /// Pass the Event Setup to the algo at each event - void setES(const edm::EventSetup& setup) override; - - /// Time (ns) to be subtracted to the digi time, - /// Parameters are the layer and the wireId to which the - /// digi is referred and the estimation of - /// the 3D hit position (globPos) - double offset(const DTLayer* layer, - const DTWireId& wireId, - const GlobalPoint& globPos, - double& tTrig, - double& wirePropCorr, - double& tofCorr) const override; - - /// Time (ns) to be subtracted to the digi time. - /// It does not take into account TOF and signal propagation along the wire - double offset(const DTWireId& wireId) const override; - - /// Time (ns) to be subtracted to the digi time for emulation purposes - /// It does not take into account TOF and signal propagation along the wire - /// It also returns the different contributions separately: - /// - tTrig is the offset (t_trig) - /// - t0cell is the t0 from pulses - double emulatorOffset(const DTWireId& wireId, double& tTrig, double& t0cell) const override; - -private: - const DTT0* tZeroMap; - const DTTtrig* tTrigMap; - // Set the verbosity level - const bool debug; - // The velocity of signal propagation along the wire (cm/ns) - double theVPropWire; - // Switch on/off the T0 correction from pulses - bool doT0Correction; - // Switch on/off the TOF correction for particles from IP - bool doTOFCorrection; - int theTOFCorrType; - // Switch on/off the correction for the signal propagation along the wire - bool doWirePropCorrection; - int theWirePropCorrType; - // spacing of BX in ns - double theBXspace; - - std::string thetTrigLabel; - std::string thet0Label; -}; -#endif diff --git a/CalibMuon/DTDigiSync/src/DTTTrigSyncT0Only.h b/CalibMuon/DTDigiSync/src/DTTTrigSyncT0Only.h deleted file mode 100644 index 54c94be5983ae..0000000000000 --- a/CalibMuon/DTDigiSync/src/DTTTrigSyncT0Only.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef RecoLocalMuon_DTTTrigSyncT0Only_H -#define RecoLocalMuon_DTTTrigSyncT0Only_H - -/** \class DTTTrigSyncT0Only - * Concrete implementation of a DTTTrigBaseSync. - * This plugin reads only the t0 from pulses from the DB. - * - * - * \author G. Cerminara - INFN Torino - */ - -#include "CalibMuon/DTDigiSync/interface/DTTTrigBaseSync.h" - -class DTLayer; -class DTWireId; -class DTT0; - -namespace edm { - class ParameterSet; -} - -class DTTTrigSyncT0Only : public DTTTrigBaseSync { -public: - /// Constructor - DTTTrigSyncT0Only(const edm::ParameterSet& config); - - /// Destructor - ~DTTTrigSyncT0Only() override; - - // Operations - - /// Pass the Event Setup to the algo at each event - void setES(const edm::EventSetup& setup) override; - - /// Time (ns) to be subtracted to the digi time, - /// Parameters are the layer and the wireId to which the - /// digi is referred and the estimation of - /// the 3D hit position (globPos) - double offset(const DTLayer* layer, - const DTWireId& wireId, - const GlobalPoint& globPos, - double& tTrig, - double& wirePropCorr, - double& tofCorr) const override; - - double offset(const DTWireId& wireId) const override; - - /// Time (ns) to be subtracted to the digi time for emulation purposes - /// Returns just 0 in this implementation of the plugin - double emulatorOffset(const DTWireId& wireId, double& tTrig, double& t0cell) const override; - -private: - const DTT0* tZeroMap; - - // Set the verbosity level - const bool debug; -}; -#endif diff --git a/CalibMuon/DTDigiSync/src/DTTTrigSyncTOFCorr.h b/CalibMuon/DTDigiSync/src/DTTTrigSyncTOFCorr.h deleted file mode 100644 index 023f4f9b32bcb..0000000000000 --- a/CalibMuon/DTDigiSync/src/DTTTrigSyncTOFCorr.h +++ /dev/null @@ -1,107 +0,0 @@ -#ifndef RecoLocalMuon_DTTTrigSyncTOFCorr_H -#define RecoLocalMuon_DTTTrigSyncTOFCorr_H - -/** \class DTTTrigSyncTOFCorr - * Concrete implementation of a DTTTrigBaseSync. - * This class define the offsets for RecHit building - * coherently to the digitization realized with the - * DTDigiSyncTOFCorr module. - * The offset is computes as:
- * offset = tTrig + wirePropCorr - tofCorr
- * where:
- * - tTrig is a fixed offset defined in tTrig parameter - * (default 500 ns)
- * - wirePropCorr is the correction for the signal propagation along the wire
- * - tofCorr is the correction for the TOF of the particle set according to - * tofCorrType parameter:
- * 0: tofCorrType = TOF from IP to 3D Hit position (globPos)
- * 1: tofCorrType = TOF correction for distance difference - * between 3D center of the chamber and hit position
- * 2: tofCorrType = TOF correction for distance difference - * between 3D center of the wire and hit position - * (This mode in available for backward compatibility)
- * - * The emulatorOffset is computed as: - *
- * offset = int(ttrig/BXspace)*BXspace - *
- * where:
- * - ttrig from the fit of time box rising edge (taken from configuration, it is assumed to be in ns) - * - BXspace BX spacing (in ns). Taken from configuration (default 25ns). - * - * NOTE: this should approximate what is seen online by the BTI - * - * - * - * \author G. Cerminara - INFN Torino - */ - -#include "CalibMuon/DTDigiSync/interface/DTTTrigBaseSync.h" - -class DTLayer; -class DTWireId; - -namespace edm { - class ParameterSet; -} - -class DTTTrigSyncTOFCorr : public DTTTrigBaseSync { -public: - /// Constructor - DTTTrigSyncTOFCorr(const edm::ParameterSet& config); - - /// Destructor - ~DTTTrigSyncTOFCorr() override; - - // Operations - - /// Pass the Event Setup to the algo at each event - void setES(const edm::EventSetup& setup) override {} - - /// Time (ns) to be subtracted to the digi time, - /// Parameters are the layer and the wireId to which the - /// digi is referred and the estimation of - /// the 3D hit position (globPos) - /// It also returns the different contributions separately: - /// - tTrig is the offset (t_trig) - /// - wirePropCorr is the delay for signal propagation along the wire - /// - tofCorr is the correction due to the particle TOF - double offset(const DTLayer* layer, - const DTWireId& wireId, - const GlobalPoint& globPos, - double& tTrig, - double& wirePropCorr, - double& tofCorr) const override; - - double offset(const DTWireId& wireId) const override; - - /// Time (ns) to be subtracted to the digi time for emulation purposes - /// It does not take into account TOF and signal propagation along the wire - /// It also returns the different contributions separately: - /// - tTrig is the offset (t_trig) - /// - t0cell is the t0 from pulses (always 0 in this case) - double emulatorOffset(const DTWireId& wireId, double& tTrig, double& t0cell) const override; - -private: - // The fixed t_trig to be subtracted to digi time (ns) - const double theTTrig; - // Velocity of signal propagation along the wire (cm/ns) - // For the value - // cfr. CMS-IN 2000-021: (2.56+-0.17)x1e8 m/s - // CMS NOTE 2003-17: (0.244) m/ns = 24.4 cm/ns - const double theVPropWire; - - // Select the mode for TOF correction: - // 0: tofCorr = TOF from IP to 3D Hit position (globPos) - // 1: tofCorr = TOF correction for distance difference - // between 3D center of the chamber and hit position - // 2: tofCorr = TOF correction for distance difference - // between 3D center of the wire and hit position - const int theTOFCorrType; - - // Set the verbosity level - const bool debug; - // spacing of BX in ns - double theBXspace; -}; -#endif diff --git a/Calibration/HcalCalibAlgos/plugins/AnalyzerMinbias.cc b/Calibration/HcalCalibAlgos/plugins/AnalyzerMinbias.cc index 46078df901052..2d18f5e42a892 100644 --- a/Calibration/HcalCalibAlgos/plugins/AnalyzerMinbias.cc +++ b/Calibration/HcalCalibAlgos/plugins/AnalyzerMinbias.cc @@ -13,6 +13,9 @@ #include "CondFormats/HcalObjects/interface/HcalRespCorrs.h" #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "CommonTools/UtilAlgos/interface/TFileService.h" + #include "DataFormats/Common/interface/Ref.h" #include "DataFormats/Common/interface/TriggerResults.h" #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" @@ -41,7 +44,7 @@ #include "FWCore/Common/interface/TriggerNames.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/Run.h" @@ -56,7 +59,7 @@ namespace HcalMinbias {} // constructors and destructor -class AnalyzerMinbias : public edm::EDAnalyzer { +class AnalyzerMinbias : public edm::one::EDAnalyzer { public: explicit AnalyzerMinbias(const edm::ParameterSet&); ~AnalyzerMinbias() override; @@ -112,6 +115,7 @@ class AnalyzerMinbias : public edm::EDAnalyzer { }; AnalyzerMinbias::AnalyzerMinbias(const edm::ParameterSet& iConfig) { + usesResource(TFileService::kSharedResource); // get name of output file with histogramms fOutputFileName = iConfig.getUntrackedParameter("HistOutFile"); @@ -148,8 +152,9 @@ void AnalyzerMinbias::beginJob() { h_Signal[subd] = new TH1D(name, title, 100, -10., 10.); } + edm::Service fs; hOutputFile = new TFile(fOutputFileName.c_str(), "RECREATE"); - myTree = new TTree("RecJet", "RecJet Tree"); + myTree = fs->make("RecJet", "RecJet Tree"); myTree->Branch("mydet", &mydet, "mydet/I"); myTree->Branch("mysubd", &mysubd, "mysubd/I"); myTree->Branch("cells", &cells, "cells"); diff --git a/Calibration/HcalCalibAlgos/plugins/Analyzer_minbias.cc b/Calibration/HcalCalibAlgos/plugins/Analyzer_minbias.cc index 4798396530c3f..d5876ee030ad4 100644 --- a/Calibration/HcalCalibAlgos/plugins/Analyzer_minbias.cc +++ b/Calibration/HcalCalibAlgos/plugins/Analyzer_minbias.cc @@ -62,7 +62,6 @@ namespace cms { theRecalib = iConfig.getParameter("Recalib"); - // // for (int i = 0; i < 73; i++) { for (int j = 0; j < 43; j++) { @@ -70,8 +69,6 @@ namespace cms { noise_pl[i][j] = 0.; } } - // - // } Analyzer_minbias::~Analyzer_minbias() { @@ -85,7 +82,6 @@ namespace cms { } void Analyzer_minbias::beginJob() { - // hOutputFile = new TFile( fOutputFileName.c_str(), "RECREATE" ) ; myTree = fs->make("RecJet", "RecJet Tree"); myTree->Branch("mydet", &mydet, "mydet/I"); myTree->Branch("mysubd", &mysubd, "mysubd/I"); @@ -132,14 +128,12 @@ namespace cms { meannoise_pl[i][j] = 0.; meannoise_min[i][j] = 0.; - // for(int l=1;l<5;l++){ k = i * 1000 + j; sprintf(str0, "mpl%d", k); sprintf(str1, "mmin%d", k); sprintf(str10, "vpl%d", k); sprintf(str11, "vmin%d", k); - // edm::LogVerbatim("AnalyzerMB")<<" "<make(str0, "h0", 320, -10., 10.); @@ -151,7 +145,6 @@ namespace cms { } else { // HF // first order moment - // edm::LogVerbatim("AnalyzerMB")<<" "<make(str0, "h0", 320, -10., 10.); hCalo2[i][j] = fs->make(str1, "h1", 320, -10., 10.); @@ -168,7 +161,6 @@ namespace cms { hCalo2mom2[i][j] = fs->make(str11, "h11", 320, 0., 120.); } } // HE/HF boundary - // } // l } // j } // i @@ -286,12 +278,6 @@ namespace cms { edm::LogVerbatim("AnalyzerMB") << " Number of cells " << ii; - // hOutputFile->Write(); - // hOutputFile->cd(); - // myTree->Write(); - // hHBHEsize_vs_run->Write() ; - // hHFsize_vs_run->Write() ; - for (int i = 1; i < 73; i++) { for (int j = 1; j < 43; j++) { hCalo1[i][j]->Write(); @@ -301,12 +287,6 @@ namespace cms { } } - // hbheNoiseE->Write() ; - // hfNoiseE->Write() ; - // hbheSignalE->Write() ; - // hfSignalE->Write() ; - // hOutputFile->Close() ; - edm::LogVerbatim("AnalyzerMB") << " File is closed "; return; @@ -332,81 +312,6 @@ namespace cms { << " , " << provenance->moduleLabel() << " , " << provenance->productInstanceName(); } - /* - edm::Handle rawdata; - iEvent.getByToken(tok_data_,rawdata); - - if (!rawdata.isValid()) { - edm::LogVerbatim("AnalyzerMB")<<" No valid collection "; - } else { - edm::LogVerbatim("AnalyzerMB")<<" Valid collection "; - int calibType = -1 ; int numEmptyFEDs = 0 ; - std::vector calibTypeCounter(8,0) ; - for (int i=FEDNumbering::MINHCALFEDID; - i<=FEDNumbering::MAXHCALFEDID; i++) { - const FEDRawData& fedData = rawdata->FEDData(i) ; - if ( fedData.size() < 24 ) numEmptyFEDs++ ; - if ( fedData.size() < 24 ) continue ; - // int value = ((const HcalDCCHeader*)(fedData.data()))->getCalibType() ; - // calibTypeCounter.at(value)++ ; // increment the counter for this calib type - } - edm::LogVerbatim("AnalyzerMB")<<" NumFed "< > rawdata1; - iEvent.getManyByType(rawdata1); - - for(std::vector >::const_iterator it = rawdata1.begin();it != rawdata1.end(); it++) { - - edm::LogVerbatim("AnalyzerMB")<<" Many by Type product name "<< (*it).provenance()->processName()<< - " "<<(*it).provenance()->moduleLabel(); - - if((*it).provenance()->moduleLabel() == "hltHcalCalibrationRaw") { - int calibType = -1 ; int numEmptyFEDs = 0 ; - - for (int i=FEDNumbering::MINHCALFEDID; - i<=FEDNumbering::MAXHCALFEDID; i++) { - const FEDRawData& fedData = (*it)->FEDData(i) ; - edm::LogVerbatim("AnalyzerMB")<<" FED size "<getCalibType() ; - edm::LogVerbatim("AnalyzerMB")<<" Value "<gtAlgorithmMap(); - - edm::Handle gtRecord; - iEvent.getByToken(tok_gtRec_, gtRecord); - - if (!gtRecord.isValid()) { - - // LogDebug("L1GlobalTriggerRecordProducer") - // << "\n\n Error: no L1GlobalTriggerReadoutRecord found with input tag " - // << m_l1GtReadoutRecord - // << "\n Returning empty L1GlobalTriggerRecord.\n\n"; - edm::LogVerbatim("AnalyzerMB")<<" No L1 trigger record "; - } else { - - const DecisionWord dWord = gtRecord->decisionWord(); - - for (CItAlgo itAlgo = bitMap.begin(); itAlgo != bitMap.end(); itAlgo++) { - bool decision=menu->gtAlgorithmResult(itAlgo->first,dWord); - if(decision == 1) edm::LogVerbatim("AnalyzerMB")<<" Trigger "<first<<" "< hbheMB; iEvent.getByToken(tok_hbhe_, hbheMB); @@ -459,14 +363,12 @@ namespace cms { if (!hbheMB.isValid()) { edm::LogWarning("AnalyzerMB") << "HcalCalibAlgos: Error! can't get hbhe" << " product! No HBHE MB"; - // return ; } const HBHERecHitCollection HithbheMB = *(hbheMB.product()); edm::LogVerbatim("AnalyzerMB") << " HBHE MB size of collection " << HithbheMB.size(); if (HithbheMB.size() != 5184) { edm::LogWarning("AnalyzerMB") << " HBHE problem " << rnnum << " " << HithbheMB.size(); - // return; } edm::Handle hfNS; @@ -475,7 +377,6 @@ namespace cms { if (!hfNS.isValid()) { edm::LogWarning("AnalyzerMB") << "HcalCalibAlgos: Error! can't get hf" << " product! No HF NS "; - // return ; } const HFRecHitCollection HithfNS = *(hfNS.product()); @@ -483,7 +384,6 @@ namespace cms { hHFsize_vs_run->Fill(rnnum, (float)HithfNS.size()); if (HithfNS.size() != 1728) { edm::LogWarning("AnalyzerMB") << " HF problem " << rnnum << " " << HithfNS.size(); - // return; } edm::Handle hfMB; @@ -492,14 +392,12 @@ namespace cms { if (!hfMB.isValid()) { edm::LogWarning("AnalyzerMB") << "HcalCalibAlgos: Error! can't get hf" << " product! No HF MB"; - // return ; } const HFRecHitCollection HithfMB = *(hfMB.product()); edm::LogVerbatim("AnalyzerMB") << " HF MB size of collection " << HithfMB.size(); if (HithfMB.size() != 1728) { edm::LogWarning("AnalyzerMB") << " HF problem " << rnnum << " " << HithfMB.size(); - // return; } for (HBHERecHitCollection::const_iterator hbheItr = HithbheNS.begin(); hbheItr != HithbheNS.end(); hbheItr++) { @@ -549,14 +447,6 @@ namespace cms { edm::LogVerbatim("AnalyzerMB") << " Run " << rnnum << " ieta,iphi " << hid.ieta() << " " << hid.iphi() << energyhit; - // if( hid.ieta() > 0 ) { - // hCalo1[hid.iphi()][hid.ieta()]->Fill(energyhit-noise_pl[hid.iphi()][hid.ieta()]); - // hCalo1mom2[hid.iphi()][hid.ieta()]->Fill(pow(energyhit,2)); - // } else { - // hCalo2[hid.iphi()][abs(hid.ieta())]->Fill(energyhit-noise_min[hid.iphi()][abs(hid.ieta())]); - // hCalo2mom2[hid.iphi()][abs(hid.ieta())]->Fill(pow(energyhit,2)); - // } // eta><0 - } // depth=1 } // HBHE_NS @@ -671,14 +561,6 @@ namespace cms { if (hid.depth() == 1) { hfNoiseE->Fill(energyhit); - //if( hid.ieta() > 0 ) { - // hCalo1[hid.iphi()][hid.ieta()]->Fill(energyhit-noise_pl[hid.iphi()][hid.ieta()]); - // hCalo1mom2[hid.iphi()][hid.ieta()]->Fill(pow(energyhit,2)); - //} else { - // hCalo2[hid.iphi()][abs(hid.ieta())]->Fill(energyhit-noise_min[hid.iphi()][abs(hid.ieta())]); - // hCalo2mom2[hid.iphi()][abs(hid.ieta())]->Fill(pow(energyhit,2)); - //} // eta><0 - } // depth=1 } // HBHE_NS diff --git a/Calibration/HcalCalibAlgos/plugins/HOCalibAnalyzer.cc b/Calibration/HcalCalibAlgos/plugins/HOCalibAnalyzer.cc index 194dcea9ff41c..16b01a3e24890 100644 --- a/Calibration/HcalCalibAlgos/plugins/HOCalibAnalyzer.cc +++ b/Calibration/HcalCalibAlgos/plugins/HOCalibAnalyzer.cc @@ -27,13 +27,12 @@ April 2015 // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -//#include "DataFormats/HOCalibHit/interface/HOCalibVariables.h" #include "DataFormats/HcalCalibObjects/interface/HOCalibVariables.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ServiceRegistry/interface/Service.h" @@ -59,7 +58,6 @@ April 2015 #include #include #include -//#include // // Look for nearby pixel through eta, phi informations for pixel cross-talk @@ -168,7 +166,6 @@ void fcnbg(Int_t& npar, Double_t* gin, Double_t& f, Double_t* par, Int_t flag) { for (unsigned ij = 0; ij < cro_ssg[ietafit][iphifit].size(); ij++) { double xval = (double)cro_ssg[ietafit][iphifit][ij]; fval += std::log(std::max(1.e-30, par[0] * TMath::Gaus(xval, par[1], par[2], true))); - // fval +=std::log(par[0]*TMath::Gaus(xval, par[1], par[2], 1)); } f = -fval; } @@ -203,7 +200,7 @@ void set_sigma(double& x, bool mdigi) { } } -class HOCalibAnalyzer : public edm::EDAnalyzer { +class HOCalibAnalyzer : public edm::one::EDAnalyzer { public: explicit HOCalibAnalyzer(const edm::ParameterSet&); ~HOCalibAnalyzer() override; @@ -380,8 +377,6 @@ class HOCalibAnalyzer : public edm::EDAnalyzer { TH1F* peak_eta[netamx]; TH1F* const_hpdrm[ringmx]; - // TH1F* stat_hpdrm[ringmx]; - // TH1F* statmn_hpdrm[ringmx]; TH1F* peak_hpdrm[ringmx]; TH1F* mean_eta_ave; @@ -395,7 +390,6 @@ class HOCalibAnalyzer : public edm::EDAnalyzer { TProfile* sigvsevt[15][ncut]; - // int irun, ievt, itrg1, itrg2, isect, nrecht, nfound, nlost, ndof, nmuon; unsigned ievt, hoflag; int irun, ilumi, nprim, isect, isect2, ndof, nmuon; @@ -434,10 +428,10 @@ const int HOCalibAnalyzer::neffip; // constructors and destructor // -HOCalibAnalyzer::HOCalibAnalyzer(const edm::ParameterSet& iConfig) -// It is very likely you want the following in your configuration -// hoCalibVariableCollectionTag = cms.InputTag('hoCalibProducer', 'HOCalibVariableCollection') -{ +HOCalibAnalyzer::HOCalibAnalyzer(const edm::ParameterSet& iConfig) { + // It is very likely you want the following in your configuration + // hoCalibVariableCollectionTag = cms.InputTag('hoCalibProducer', 'HOCalibVariableCollection') + usesResource(TFileService::kSharedResource); tok_ho_ = consumes(iConfig.getParameter("hoCalibVariableCollectionTag")); tok_allho_ = consumes(iConfig.getParameter("hoInputTag")); //now do what ever initialization is needed @@ -467,14 +461,11 @@ HOCalibAnalyzer::HOCalibAnalyzer(const edm::ParameterSet& iConfig) theFile = new TFile(theRootFileName.c_str(), "RECREATE"); theFile->cd(); - T1 = new TTree("T1", "DT+CSC+HO"); + T1 = fs->make("T1", "DT+CSC+HO"); T1->Branch("irun", &irun, "irun/I"); T1->Branch("ievt", &ievt, "ievt/i"); - // T1->Branch("itrg1",&itrg1,"itrg1/I"); - // T1->Branch("itrg2",&itrg2,"itrg2/I"); - T1->Branch("isect", &isect, "isect/I"); T1->Branch("isect2", &isect2, "isect2/I"); T1->Branch("ndof", &ndof, "ndof/I"); @@ -514,9 +505,9 @@ HOCalibAnalyzer::HOCalibAnalyzer(const edm::ParameterSet& iConfig) T1->Branch("hocorsig", hocorsig, "hocorsig[18]/F"); T1->Branch("caloen", caloen, "caloen[3]/F"); - if (m_hbinfo) { // #ifdef HBINFO + if (m_hbinfo) { T1->Branch("hbhesig", hbhesig, "hbhesig[9]/F"); - } //m_hbinfo #endif + } char name[200]; char title[200]; @@ -573,7 +564,7 @@ HOCalibAnalyzer::HOCalibAnalyzer(const edm::ParameterSet& iConfig) if (nbn > nbin) nbn = nbin; - edm::LogInfo("HOCalib") << "nbin " << nbin << " " << alow << " " << ahigh << " " << tmpwid << " " << nbn; + edm::LogVerbatim("HOCalib") << "nbin " << nbin << " " << alow << " " << ahigh << " " << tmpwid << " " << nbn; for (int ij = 0; ij < 15; ij++) { sprintf(title, "sigvsndof_ring%i", ij + 1); @@ -634,20 +625,20 @@ HOCalibAnalyzer::HOCalibAnalyzer(const edm::ParameterSet& iConfig) } for (int ij = 0; ij < nphimx; ij++) { - if (m_hotime) { //#ifdef HOTIME + if (m_hotime) { sprintf(title, "hotime_eta%i_phi%i", (jk <= 14) ? jk + 1 : 14 - jk, ij + 1); hotime[jk][ij] = fs->make(title, title, 10, -0.5, 9.5, -1.0, 30.0); sprintf(title, "hopedtime_eta%i_phi%i", (jk <= 14) ? jk + 1 : 14 - jk, ij + 1); hopedtime[jk][ij] = fs->make(title, title, 10, -0.5, 9.5, -1.0, 30.0); - } //m_hotime #endif - if (m_hbtime) { //#ifdef HBTIME + } //m_hotime + if (m_hbtime) { // HBTIME sprintf(title, "hbtime_eta%i_phi%i", (jk <= 15) ? jk + 1 : 15 - jk, ij + 1); hbtime[jk][ij] = fs->make(title, title, 10, -0.5, 9.5, -1.0, 30.0); - } //m_hbtime #endif + } //m_hbtime - if (m_correl) { //#ifdef CORREL + if (m_correl) { // CORREL sprintf(title, "corrsg_eta%i_phi%i_leftbottom", ieta, ij + 1); corrsglb[jk][ij] = fs->make(title, title, nbin, alow, ahigh); @@ -668,11 +659,11 @@ HOCalibAnalyzer::HOCalibAnalyzer(const edm::ParameterSet& iConfig) sprintf(title, "corrsg_eta%i_phi%i_right", ieta, ij + 1); corrsgr[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - } //m_correl #endif - if (m_checkmap) { // #ifdef CHECKMAP + } //m_correl + if (m_checkmap) { // CHECKMAP sprintf(title, "corrsg_eta%i_phi%i_centrl", ieta, ij + 1); corrsgc[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - } //m_checkmap #endif + } //m_checkmap } } @@ -706,7 +697,7 @@ HOCalibAnalyzer::HOCalibAnalyzer(const edm::ParameterSet& iConfig) sprintf(name, "mean_energy"); mean_energy = fs->make(name, title, netamx + 1, -netamx / 2 - 0.5, netamx / 2 + 0.5, nphimx, 0.5, nphimx + 0.5); - if (m_correl) { //#ifdef CORREL + if (m_correl) { // CORREL mncorrsglb = fs->make("mncorrsglb", "mncorrsglb", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); rmscorrsglb = fs->make("rmscorrsglb", "rmscorrsglb", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); nevcorrsglb = fs->make("nevcorrsglb", "nevcorrsglb", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); @@ -734,15 +725,15 @@ HOCalibAnalyzer::HOCalibAnalyzer(const edm::ParameterSet& iConfig) mncorrsgr = fs->make("mncorrsgr", "mncorrsgr", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); rmscorrsgr = fs->make("rmscorrsgr", "rmscorrsgr", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); nevcorrsgr = fs->make("nevcorrsgr", "nevcorrsgr", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - } //m_correl #endif + } //m_correl - if (m_checkmap) { //#ifdef CHECKMAP + if (m_checkmap) { // CHECKMAP mncorrsgc = fs->make("mncorrsgc", "mncorrsgc", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); rmscorrsgc = fs->make("rmscorrsgc", "rmscorrsgc", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); nevcorrsgc = fs->make("nevcorrsgc", "nevcorrsgc", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - } //m_checkmap #endif + } //m_checkmap - if (m_combined) { //#ifdef COMBINED + if (m_combined) { // COMBINED for (int jk = 0; jk < ringmx; jk++) { for (int ij = 0; ij < routmx + 1; ij++) { if (jk != 2 && ij > rout12mx) @@ -777,19 +768,19 @@ HOCalibAnalyzer::HOCalibAnalyzer(const edm::ParameterSet& iConfig) } for (int ij = 0; ij < sectmx; ij++) { - if (m_hotime) { //#ifdef HOTIME + if (m_hotime) { // HOTIME sprintf(title, "com_hotime_ring%i_sect%i", jk - 2, ij + 1); com_hotime[jk][ij] = fs->make(title, title, 10, -0.5, 9.5, -1.0, 30.0); sprintf(title, "com_hopedtime_ring%i_sect%i", jk - 2, ij + 1); com_hopedtime[jk][ij] = fs->make(title, title, 10, -0.5, 9.5, -1.0, 30.0); - } //m_hotime #endif - if (m_hbtime) { //#ifdef HBTIME + } //m_hotime + if (m_hbtime) { // HBTIME sprintf(title, "_com_hbtime_ring%i_serrct%i", jk - 2, ij + 1); com_hbtime[jk][ij] = fs->make(title, title, 10, -0.5, 9.5, -1.0, 30.0); - } //m_hbtime #endif + } //m_hbtime - if (m_correl) { //#ifdef CORREL + if (m_correl) { // CORREL sprintf(title, "com_corrsg_ring%i_sect%i_leftbottom", jk - 2, ij + 1); com_corrsglb[jk][ij] = fs->make(title, title, nbin, alow, ahigh); @@ -810,15 +801,15 @@ HOCalibAnalyzer::HOCalibAnalyzer(const edm::ParameterSet& iConfig) sprintf(title, "com_corrsg_ring%i_sect%i_right", jk - 2, ij + 1); com_corrsgr[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - } //m_correl #endif + } //m_correl - if (m_checkmap) { // #ifdef CHECKMAP + if (m_checkmap) { // CHECKMAP sprintf(title, "com_corrsg_ring%i_sect%i_centrl", jk - 2, ij + 1); com_corrsgc[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - } //m_checkmap #endif + } //m_checkmap } } - } //m_combined #endif + } //m_combined for (int ij = -1; ij <= 1; ij++) { for (int jk = -1; jk <= 1; jk++) { @@ -839,10 +830,10 @@ HOCalibAnalyzer::HOCalibAnalyzer(const edm::ParameterSet& iConfig) sprintf(title, "hosct2m_eta%i_phi%i", ij, jk); ho_sig2m[kl] = fs->make(title, title, nbin, alow, ahigh); - if (m_hbinfo) { // #ifdef HBINFO + if (m_hbinfo) { // HBINFO sprintf(title, "hbhesig_eta%i_phi%i", ij, jk); hbhe_sig[kl] = fs->make(title, title, 51, -10.5, 40.5); - } //m_hbinfo #endif + } //m_hbinfo } } @@ -895,7 +886,7 @@ HOCalibAnalyzer::HOCalibAnalyzer(const edm::ParameterSet& iConfig) mean_eta_ave = fs->make("mean_eta_ave", "mean_eta_ave", nphimx, 0.5, nphimx + 0.5); - } //m_constant + } // m_constant for (int ij = 0; ij < netamx; ij++) { int ieta = (ij < 15) ? ij + 1 : 14 - ij; @@ -926,7 +917,7 @@ HOCalibAnalyzer::~HOCalibAnalyzer() { theFile->cd(); theFile->Write(); theFile->Close(); - edm::LogInfo("HOCalib") << " Ttoal events = " << Nevents << " Selected events # is " << ipass; + edm::LogVerbatim("HOCalib") << " Ttoal events = " << Nevents << " Selected events # is " << ipass; } // @@ -951,58 +942,6 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i int mypow_2_11 = 2048; // 2^11 int mypow_2_12 = 4096; // 2^12 - /* - //FIXGM Put this is initialiser - int mapx1[6][3]={{1,4,8}, {12,7,3}, {5,9,13}, {11,6,2}, {16,15,14}, {19,18,17}}; - // int etamap1[21]={-1, 0,3,1, 0,2,3, 1,0,2, -1, 3,1,2, 4,4,4, 5,5,5, -1}; - // int phimap1[21]={-1, 0,2,2, 1,0,1, 1,2,1, -1, 0,0,2, 2,1,0, 2,1,0,-1}; - - int mapx2[6][3]={{1,4,8}, {12,7,3}, {5,9,13}, {11,6,2}, {16,15,14}, {-1,-1,-1}}; - // int etamap2[21]={-1, 0,3,1, 0,2,3, 1,0,2, -1, 3,1,2, 4,4,4, -1,-1,-1, -1}; - // int phimap2[21]={-1, 0,2,2, 1,0,1, 1,2,1, -1, 0,0,2, 2,1,0, 2, 1, 0, -1}; - - int mapx0p[9][2]={{3,1}, {7,4}, {6,5}, {12,8}, {0,0}, {11,9}, {16,13}, {15,14}, {19,17}}; - int mapx0m[9][2]={{17,19}, {14,15}, {13,16}, {9,11}, {0,0}, {8,12}, {5,6}, {4,7}, {1,3}}; - - // int etamap0p[21]={-1, 0,-1,0, 1,2,2, 1,3,5, -1, 5,3,6, 7,7,6, 8,-1,8, -1}; - // int phimap0p[21]={-1, 1,-1,0, 1,1,0, 0,1,1, -1, 0,0,1, 1,0,0, 1,-1,0, -1}; - - // int etamap0m[21]={-1, 8,-1,8, 7,6,6, 7,5,3, -1, 3,5,2, 1,1,2, 0,-1,0, -1}; - // int phimap0m[21]={-1, 0,-1,1, 0,0,1, 1,0,0, -1, 1,1,0, 0,1,1, 0,-1,1, -1}; - - int etamap[4][21]={{-1, 0,3,1, 0,2,3, 1,0,2, -1, 3,1,2, 4,4,4, -1,-1,-1, -1}, //etamap2 - {-1, 0,3,1, 0,2,3, 1,0,2, -1, 3,1,2, 4,4,4, 5,5,5, -1}, //etamap1 - {-1, 0,-1,0, 1,2,2, 1,3,5, -1, 5,3,6, 7,7,6, 8,-1,8, -1}, //etamap0p - {-1, 8,-1,8, 7,6,6, 7,5,3, -1, 3,5,2, 1,1,2, 0,-1,0, -1}}; //etamap0m - - int phimap[4][21] ={{-1, 0,2,2, 1,0,1, 1,2,1, -1, 0,0,2, 2,1,0, 2,1,0, -1}, //phimap2 - {-1, 0,2,2, 1,0,1, 1,2,1, -1, 0,0,2, 2,1,0, 2,1,0, -1}, //phimap1 - {-1, 1,-1,0, 1,1,0, 0,1,1, -1, 0,0,1, 1,0,0, 1,-1,0, -1}, //phimap0p - {-1, 0,-1,1, 0,0,1, 1,0,0, -1, 1,1,0, 0,1,1, 0,-1,1, -1}}; //phimap0m - //swapped phi map for R0+/R0- (15/03/07) - for (int ij=0; ij<4; ij++) { - for (int jk=0; jk<21; jk++) { - edm::LogInfo("HOCalib") <<"ieta "<Fill(); @@ -1119,9 +1055,6 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i int ips11 = 0; int ips12 = 0; - // int iselect3 = 0; - // if (ndof >=15 && chisq <30) iselect3 = 1; - if (isect < 0) continue; //FIXGM Is it proper place ? if (fabs(trkth - pival / 2) < 0.000001) @@ -1198,7 +1131,6 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i ips7 = (int)mypow_2_7; ipsall += ips7; } - // if (nmuon ==1) {ips8 = (int)mypow_2_8; ipsall +=ips8;} if (nmuon >= 1 && nmuon <= 4) { ips8 = (int)mypow_2_8; ipsall += ips8; @@ -1292,7 +1224,6 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i ipsall += ips11; } } - // if (m_cosmic || (caloen[0] >0.5 && caloen[0]<5.0)) {ips12=(int)pow_2_12;ipsall +=ips12;} if (ndof > 0 && caloen[0] < 5.0) { ips12 = (int)mypow_2_12; ipsall += ips12; @@ -1408,8 +1339,6 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i sel_muonch->Fill(chisq); } - // if (iselect3) T1->Fill(); - int tmpphi = (iphi + 1) % 3; //pixel mapping int npixel = 0; int itag = -1; @@ -1451,8 +1380,6 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i } } - // edm::LogInfo("HOCalib") <<"cosmic "<Fill(hosig[4]); com_invang[iring2][tmprout - 1] += 1. / fabs(hoang); com_sigrsg[iring2][tmproutmx]->Fill(hosig[4]); com_invang[iring2][tmproutmx] += 1. / fabs(hoang); - } //m_combined #endif + } //m_combined - if (m_checkmap || m_correl) { //#ifdef CHECKMAP + if (m_checkmap || m_correl) { // CHECKMAP tmpeta = etamap[itag][npixel]; tmpphi = phimap[itag][npixel]; if (tmpeta >= 0 && tmpphi >= 0) { @@ -1521,28 +1448,29 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i tmpphi = abs(tmpphi - 2); if (int((hocorsig[fact * tmpeta + tmpphi] - hosig[4]) * 10000) / 10000. != 0) { iaxxx++; - edm::LogInfo("HOCalib") << "iring2xxx " << irun << " " << ievt << " " << isect << " " << iring << " " - << tmpsect << " " << ieta << " " << iphi << " " << npixel << " " << tmpeta << " " - << tmpphi << " " << tmpeta1 << " " << tmpphi1 << " itag " << itag << " " << iflip - << " " << fact << " " << hocorsig[fact * tmpeta + tmpphi] << " " - << fact * tmpeta + tmpphi << " " << hosig[4] << " " << hodx << " " << hody; + edm::LogVerbatim("HOCalib") + << "iring2xxx " << irun << " " << ievt << " " << isect << " " << iring << " " << tmpsect << " " + << ieta << " " << iphi << " " << npixel << " " << tmpeta << " " << tmpphi << " " << tmpeta1 << " " + << tmpphi1 << " itag " << itag << " " << iflip << " " << fact << " " + << hocorsig[fact * tmpeta + tmpphi] << " " << fact * tmpeta + tmpphi << " " << hosig[4] << " " << hodx + << " " << hody; for (int ij = 0; ij < 18; ij++) { - edm::LogInfo("HOCalib") << " " << ij << " " << hocorsig[ij]; + edm::LogVerbatim("HOCalib") << " " << ij << " " << hocorsig[ij]; } - edm::LogInfo("HOCalib") << " ix " << iaxxx << " " << ibxxx; + edm::LogVerbatim("HOCalib") << " ix " << iaxxx << " " << ibxxx; } else { ibxxx++; } corrsgc[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - if (m_combined) { //#ifdef COMBINED + if (m_combined) { // COMBINED com_corrsgc[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - } //m_combined #endif + } //m_combined } - } //m_checkmap #endif + } //m_checkmap - if (m_correl) { //#ifdef CORREL + if (m_correl) { // CORREL float allcorsig = 0.0; tmpeta = etamap[itag][npixleft[npixel]]; @@ -1553,9 +1481,9 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i tmpphi = abs(tmpphi - 2); corrsgl[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]); allcorsig += hocorsig[fact * tmpeta + tmpphi]; - if (m_combined) { //#ifdef COMBINED + if (m_combined) { // COMBINED com_corrsgl[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - } //m_combined #endif + } //m_combined } tmpeta = etamap[itag][npixrigh[npixel]]; @@ -1577,9 +1505,9 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i tmpphi = abs(tmpphi - 2); corrsglb[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]); allcorsig += hocorsig[fact * tmpeta + tmpphi]; - if (m_combined) { //#ifdef COMBINED + if (m_combined) { // COMBINED com_corrsglb[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - } //m_combined #endif + } //m_combined } tmpeta = etamap[itag][npixribt[npixel]]; @@ -1589,9 +1517,9 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i tmpphi = abs(tmpphi - 2); corrsgrb[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]); allcorsig += hocorsig[fact * tmpeta + tmpphi]; - if (m_combined) { // #ifdef COMBINED + if (m_combined) { // COMBINED com_corrsgrb[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - } //m_combined #endif + } //m_combined } tmpeta = etamap[itag][npixleup[npixel]]; @@ -1601,9 +1529,9 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i tmpphi = abs(tmpphi - 2); corrsglu[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]); allcorsig += hocorsig[fact * tmpeta + tmpphi]; - if (m_combined) { // #ifdef COMBINED + if (m_combined) { // COMBINED com_corrsglu[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - } //m_combined #endif + } //m_combined } tmpeta = etamap[itag][npixriup[npixel]]; @@ -1613,16 +1541,16 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i tmpphi = abs(tmpphi - 2); corrsgru[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]); allcorsig += hocorsig[fact * tmpeta + tmpphi]; - if (m_combined) { // #ifdef COMBINED + if (m_combined) { // COMBINED com_corrsgru[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - } //m_combined #endif + } //m_combined } corrsgall[tmpeta1][tmpphi1]->Fill(allcorsig); - if (m_combined) { // #ifdef COMBINED + if (m_combined) { // COMBINED com_corrsgall[iring2][tmpsect - 1]->Fill(allcorsig); - } //m_combined #endif + } //m_combined - } //m_correl #endif + } //m_correl for (int k = 0; k < 9; k++) { switch (iring) { case 2: @@ -1641,10 +1569,9 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i ho_sig2m[k]->Fill(hosig[k]); break; } - if (m_hbinfo) { // #ifdef HBINFO + if (m_hbinfo) { // HBINFO hbhe_sig[k]->Fill(hbhesig[k]); - // edm::LogInfo("HOCalib") <<"hbhe "<Fill(netamx * ij + jk, crossg[jk][ij]->GetMean()); rmscrossg->Fill(netamx * ij + jk, crossg[jk][ij]->GetRMS()); - if (m_correl) { //#ifdef CORREL + if (m_correl) { // CORREL nevcorrsglb->Fill(netamx * ij + jk, corrsglb[jk][ij]->GetEntries()); mncorrsglb->Fill(netamx * ij + jk, corrsglb[jk][ij]->GetMean()); @@ -1718,16 +1645,16 @@ void HOCalibAnalyzer::endJob() { nevcorrsgr->Fill(netamx * ij + jk, corrsgr[jk][ij]->GetEntries()); mncorrsgr->Fill(netamx * ij + jk, corrsgr[jk][ij]->GetMean()); rmscorrsgr->Fill(netamx * ij + jk, corrsgr[jk][ij]->GetRMS()); - } //m_correl #endif - if (m_checkmap) { //#ifdef CHECKMAP + } //m_correl + if (m_checkmap) { // CHECKMAP nevcorrsgc->Fill(netamx * ij + jk, corrsgc[jk][ij]->GetEntries()); mncorrsgc->Fill(netamx * ij + jk, corrsgc[jk][ij]->GetMean()); rmscorrsgc->Fill(netamx * ij + jk, corrsgc[jk][ij]->GetRMS()); - } //m_checkmap #endif + } //m_checkmap } } - if (m_combined) { // #ifdef COMBINED + if (m_combined) { // COMBINED for (int jk = 0; jk < ringmx; jk++) { for (int ij = 0; ij < routmx; ij++) { if (jk != 2 && ij >= rout12mx) @@ -1744,7 +1671,7 @@ void HOCalibAnalyzer::endJob() { for (int ij = 0; ij < sectmx; ij++) { for (int jk = 0; jk < ringmx; jk++) { - if (m_correl) { // #ifdef CORREL + if (m_correl) { // CORREL nevcorrsglb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglb[jk][ij]->GetEntries()); mncorrsglb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglb[jk][ij]->GetMean()); rmscorrsglb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglb[jk][ij]->GetRMS()); @@ -1772,15 +1699,15 @@ void HOCalibAnalyzer::endJob() { nevcorrsgr->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgr[jk][ij]->GetEntries()); mncorrsgr->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgr[jk][ij]->GetMean()); rmscorrsgr->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgr[jk][ij]->GetRMS()); - } //m_correl #endif - if (m_checkmap) { // #ifdef CHECKMAP + } //m_correl + if (m_checkmap) { // CHECKMAP nevcorrsgc->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgc[jk][ij]->GetEntries()); mncorrsgc->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgc[jk][ij]->GetMean()); rmscorrsgc->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgc[jk][ij]->GetRMS()); - } //m_checkmap #endif + } //m_checkmap } } - } //m_combined #endif + } //m_combined for (int ij = 1; ij < neffip; ij++) { sig_effi[ij]->Divide(sig_effi[0]); @@ -1847,56 +1774,6 @@ void HOCalibAnalyzer::endJob() { int xsiz = 700; int ysiz = 500; - // TCanvas *c2 = new TCanvas("c2", "Statistics and efficiency", xsiz, ysiz); - // c2->Divide(2,1); //(3,2); - // for (int ij=0; ijGetXaxis()->SetTitle("#eta"); - // sig_effi[ij]->GetXaxis()->SetTitleSize(0.075); - // sig_effi[ij]->GetXaxis()->SetTitleOffset(0.65); //0.85 - // sig_effi[ij]->GetXaxis()->CenterTitle(); - // sig_effi[ij]->GetXaxis()->SetLabelSize(0.055); - // sig_effi[ij]->GetXaxis()->SetLabelOffset(0.001); - - // sig_effi[ij]->GetYaxis()->SetTitle("#phi"); - // sig_effi[ij]->GetYaxis()->SetTitleSize(0.075); - // sig_effi[ij]->GetYaxis()->SetTitleOffset(0.9); - // sig_effi[ij]->GetYaxis()->CenterTitle(); - // sig_effi[ij]->GetYaxis()->SetLabelSize(0.055); - // sig_effi[ij]->GetYaxis()->SetLabelOffset(0.01); - - // c2->cd(int(ij/3.)+1); sig_effi[ij]->Draw("colz"); - // } - // sprintf(out_file, "comb_hosig_evt_%i.jpg",irunold); - // c2->SaveAs(out_file); - - // gStyle->SetTitleFontSize(0.045); - // gStyle->SetPadRightMargin(0.1); - // gStyle->SetPadLeftMargin(0.1); - // gStyle->SetPadBottomMargin(0.12); - - // TCanvas *c1 = new TCanvas("c1", "Mean signal in each tower", xsiz, ysiz); - - // mean_energy->GetXaxis()->SetTitle("#eta"); - // mean_energy->GetXaxis()->SetTitleSize(0.075); - // mean_energy->GetXaxis()->SetTitleOffset(0.65); //0.6 - // mean_energy->GetXaxis()->CenterTitle(); - // mean_energy->GetXaxis()->SetLabelSize(0.045); - // mean_energy->GetXaxis()->SetLabelOffset(0.001); - - // mean_energy->GetYaxis()->SetTitle("#phi"); - // mean_energy->GetYaxis()->SetTitleSize(0.075); - // mean_energy->GetYaxis()->SetTitleOffset(0.5); - // mean_energy->GetYaxis()->CenterTitle(); - // mean_energy->GetYaxis()->SetLabelSize(0.045); - // mean_energy->GetYaxis()->SetLabelOffset(0.01); - - // mean_energy->Draw("colz"); - // sprintf(out_file, "homean_energy_%i.jpg",irunold); - // c1->SaveAs(out_file); - - // delete c1; - // delete c2; - gStyle->SetPadBottomMargin(0.14); gStyle->SetPadLeftMargin(0.17); gStyle->SetPadRightMargin(0.03); @@ -2046,35 +1923,6 @@ void HOCalibAnalyzer::endJob() { } c0->cd(2 * izone + 1); // (iiter%8)+1); //c0->cd(iiter%8+1); - /* - if (iijj==0 && izone==0) { - gStyle->SetOptLogy(1); - gStyle->SetOptStat(0); - gStyle->SetOptFit(0); - c0->Divide(3,2); - } - - if (iijj>0) { - gStyle->SetOptLogy(0); - gStyle->SetOptStat(1110); - gStyle->SetOptFit(101); - - if (iiter==0) { - int ips=111; - ps = new TPostScript(theoutputpsFile.c_str(),ips); - ps.Range(20,28); - xsiz = 900; //900; - ysiz = 1200; //600; - c0 = new TCanvas("c0", " Pedestal vs signal", xsiz, ysiz); - } - if (izone==0) { - ps.NewPage(); - c0->Divide(4,4); - } - } - if (iijj==0) {c0->cd(izone+1); } else { c0->cd(2*izone+1);} - */ - float mean = pedstll[izone]->GetMean(); float rms = pedstll[izone]->GetRMS(); @@ -2108,11 +1956,7 @@ void HOCalibAnalyzer::endJob() { pedstll[izone]->GetXaxis()->SetLabelSize(.065); pedstll[izone]->GetYaxis()->SetLabelSize(.06); - // if (iijj==0) { - // pedstll[izone]->GetXaxis()->SetRangeUser(alow, ahigh); - // } else { pedstll[izone]->GetXaxis()->SetRangeUser(xmn, xmx); - // } if (iijj == 0) { pedstll[izone]->GetXaxis()->SetTitle("Pedestal/Signal (GeV)"); @@ -2121,7 +1965,6 @@ void HOCalibAnalyzer::endJob() { } pedstll[izone]->GetXaxis()->SetTitleSize(.065); pedstll[izone]->GetXaxis()->CenterTitle(); - // pedstll[izone]->SetLineWidth(2); pedstll[izone]->Draw(); if (m_pedsuppr) { @@ -2176,7 +2019,6 @@ void HOCalibAnalyzer::endJob() { if (step[k] > -10) { gMinuit->mnpout(k, chnam, parv, err, xlo, xup, iuit); gMinuit->mnerrs(k, plerr, mierr, eparab, gcc); - // edm::LogInfo("HOCalib") <<"k "<< k<<" "<SetParameters(gaupr); - char temp[20]; sprintf(temp, "ped0fun_%i", izone); ped0fun[izone] = new TF1(temp, gausX, xmn, xmx, nbgpr); @@ -2206,7 +2046,7 @@ void HOCalibAnalyzer::endJob() { gaupr[2] = 0.15; } } - // if (iijj!=0) + c0->cd(2 * izone + 2); if (signall[izone]->GetEntries() > 5) { Double_t parall[nsgpr]; @@ -2257,7 +2097,6 @@ void HOCalibAnalyzer::endJob() { signal[izone]->FixParameter(3, 0.14); signal[izone]->SetParLimits(5, 0.40 * area, 1.15 * area); - // if (m_histfit) { //GMA if (iijj == 3) { signal[izone]->SetParLimits(4, 0.2 * fitprm[4][jk], 2.0 * fitprm[4][jk]); signal[izone]->SetParLimits(6, 0.2 * fitprm[6][jk], 2.0 * fitprm[6][jk]); @@ -2338,11 +2177,7 @@ void HOCalibAnalyzer::endJob() { delete gMinuit; } - // if (iijj==0) { - // signall[izone]->Draw("same"); - // } else { signall[izone]->Draw(); - // } sprintf(temp, "pedfun_%i", izone); pedfun[izone] = new TF1(temp, gausX, xmn, xmx, nbgpr); @@ -2366,13 +2201,14 @@ void HOCalibAnalyzer::endJob() { int kl = (jk < 15) ? jk + 1 : 14 - jk; - edm::LogInfo("HOCalib") << "histinfo" << iijj << " fit " << std::setw(3) << kl << " " << std::setw(3) - << ij + 1 << " " << std::setw(5) << pedstll[izone]->GetEntries() << " " - << std::setw(6) << pedstll[izone]->GetMean() << " " << std::setw(6) - << pedstll[izone]->GetRMS() << " " << std::setw(5) << signall[izone]->GetEntries() - << " " << std::setw(6) << signall[izone]->GetMean() << " " << std::setw(6) - << signall[izone]->GetRMS() << " " << std::setw(6) << signal[izone]->GetChisquare() - << " " << std::setw(3) << signal[izone]->GetNDF(); + edm::LogVerbatim("HOCalib") << "histinfo" << iijj << " fit " << std::setw(3) << kl << " " << std::setw(3) + << ij + 1 << " " << std::setw(5) << pedstll[izone]->GetEntries() << " " + << std::setw(6) << pedstll[izone]->GetMean() << " " << std::setw(6) + << pedstll[izone]->GetRMS() << " " << std::setw(5) + << signall[izone]->GetEntries() << " " << std::setw(6) + << signall[izone]->GetMean() << " " << std::setw(6) << signall[izone]->GetRMS() + << " " << std::setw(6) << signal[izone]->GetChisquare() << " " << std::setw(3) + << signal[izone]->GetNDF(); file_out << "histinfo" << iijj << " fit " << std::setw(3) << kl << " " << std::setw(3) << ij + 1 << " " << std::setw(5) << pedstll[izone]->GetEntries() << " " << std::setw(6) << pedstll[izone]->GetMean() @@ -2534,15 +2370,6 @@ void HOCalibAnalyzer::endJob() { } //for (int jk=0; jkSaveAs(out_file); - // iiter = 0; - // } else { - // // c0->Update(); - // } - - // iiter = 0; } //end of iijj if (iiter % nsample != 0) { c0->Update(); @@ -2940,8 +2767,6 @@ void HOCalibAnalyzer::endJob() { peak_hpdrm[jk]->GetYaxis()->CenterTitle(); peak_hpdrm[jk]->GetYaxis()->SetLabelSize(0.065); peak_hpdrm[jk]->GetYaxis()->SetLabelOffset(0.01); - // peak_hpdrm[jk]->SetLineWidth(3); - // peak_hpdrm[jk]->SetLineColor(4); peak_hpdrm[jk]->SetMarkerSize(0.60); peak_hpdrm[jk]->SetMarkerColor(2); peak_hpdrm[jk]->SetMarkerStyle(20); @@ -2971,8 +2796,6 @@ void HOCalibAnalyzer::endJob() { const_hpdrm[jk]->GetYaxis()->CenterTitle(); const_hpdrm[jk]->GetYaxis()->SetLabelSize(0.065); const_hpdrm[jk]->GetYaxis()->SetLabelOffset(0.01); - // const_hpdrm[jk]->SetLineWidth(3); - // const_hpdrm[jk]->SetLineColor(4); const_hpdrm[jk]->SetMarkerSize(0.60); const_hpdrm[jk]->SetMarkerColor(2); const_hpdrm[jk]->SetMarkerStyle(20); @@ -2985,11 +2808,7 @@ void HOCalibAnalyzer::endJob() { c1y->SaveAs(out_file); delete c1y; - - } //if (m_figure) { - - // ps.Close(); - // file_out.close(); + } } // if (m_constant){ @@ -3138,10 +2957,3 @@ void HOCalibAnalyzer::endJob() { //define this as a plug-in DEFINE_FWK_MODULE(HOCalibAnalyzer); - -/* -75minute -112MB data -1M events - -*/ diff --git a/Calibration/HcalCalibAlgos/plugins/HcalCalibrator.cc b/Calibration/HcalCalibAlgos/plugins/HcalCalibrator.cc index 0fd20490ab7c1..fe1556c135f89 100644 --- a/Calibration/HcalCalibAlgos/plugins/HcalCalibrator.cc +++ b/Calibration/HcalCalibAlgos/plugins/HcalCalibrator.cc @@ -110,28 +110,27 @@ void HcalCalibrator::beginJob() {} void HcalCalibrator::endJob() { if (mCalibType != "DI_JET" && mCalibType != "ISO_TRACK") { - std::cout << "\n\nUnknown calibration type " << mCalibType << std::endl; - std::cout << "Please select ISO_TRACK or DI_JET in the python file." << std::endl; + edm::LogVerbatim("HcalCalib") << "\n\nUnknown calibration type " << mCalibType; + edm::LogVerbatim("HcalCalib") << "Please select ISO_TRACK or DI_JET in the python file."; return; } if (mCalibMethod != "L3" && mCalibMethod != "MATRIX_INV_OF_ETA_AVE" && mCalibMethod != "L3_AND_MTRX_INV") { - std::cout << "\n\nUnknown calibration method " << mCalibMethod << std::endl; - std::cout << "Supported methods for IsoTrack calibration are: L3, MATRIX_INV_OF_ETA_AVE, L3_AND_MTRX_INV" - << std::endl; - std::cout << "For DiJets the supported method is L3" << std::endl; + edm::LogVerbatim("HcalCalib") << "\n\nUnknown calibration method " << mCalibMethod; + edm::LogVerbatim("HcalCalib") + << "Supported methods for IsoTrack calibration are: L3, MATRIX_INV_OF_ETA_AVE, L3_AND_MTRX_INV"; + edm::LogVerbatim("HcalCalib") << "For DiJets the supported method is L3"; return; } if (mCalibType == "DI_JET" && mCalibMethod != "L3") { - std::cout << "\n\nDiJet calibration can use only the L3 method. Please change the python file." << std::endl; + edm::LogVerbatim("HcalCalib") << "\n\nDiJet calibration can use only the L3 method. Please change the python file."; return; } if (mCalibAbsIEtaMin < 1 || mCalibAbsIEtaMax > 41 || mCalibAbsIEtaMin > mCalibAbsIEtaMax) { - std::cout - << "\n\nInvalid ABS(iEta) calibration range. Check calibAbsIEtaMin and calibAbsIEtaMax in the python file." - << std::endl; + edm::LogVerbatim("HcalCalib") + << "\n\nInvalid ABS(iEta) calibration range. Check calibAbsIEtaMin and calibAbsIEtaMax in the python file."; return; } @@ -189,11 +188,10 @@ void HcalCalibrator::endJob() { } inputFileList.close(); - std::cout << "\nInput files for processing:" << std::endl; + edm::LogVerbatim("HcalCalib") << "\nInput files for processing:"; for (std::vector::iterator it = inputFiles.begin(); it != inputFiles.end(); ++it) { - std::cout << "file: " << it->Data() << std::endl; + edm::LogVerbatim("HcalCalib") << "file: " << it->Data(); } - std::cout << std::endl; TChain* fChain = new TChain("hcalCalibTree"); diff --git a/Calibration/HcalCalibAlgos/plugins/ValidIsoTrkCalib.cc b/Calibration/HcalCalibAlgos/plugins/ValidIsoTrkCalib.cc index 6ad8751df9364..dffecbb577041 100644 --- a/Calibration/HcalCalibAlgos/plugins/ValidIsoTrkCalib.cc +++ b/Calibration/HcalCalibAlgos/plugins/ValidIsoTrkCalib.cc @@ -58,6 +58,8 @@ See the twiki page for details: #include #include +//#define EDM_ML_DEBUG + class ValidIsoTrkCalib : public edm::one::EDAnalyzer { public: explicit ValidIsoTrkCalib(const edm::ParameterSet&); @@ -236,7 +238,7 @@ void ValidIsoTrkCalib::analyze(const edm::Event& iEvent, const edm::EventSetup& try { respRecalib = &iSetup.getData(tok_recalibCorrs_); - edm::LogInfo("CalibConstants") << " Loaded: OK "; + edm::LogVerbatim("CalibConstants") << " Loaded: OK "; } catch (const cms::Exception& e) { edm::LogWarning("CalibConstants") << " Not Found!! "; @@ -274,9 +276,9 @@ void ValidIsoTrkCalib::analyze(const edm::Event& iEvent, const edm::EventSetup& parameters_.useMuon = false; //parameters_.dREcal = taECALCone_; //parameters_.dRHcal = taHCALCone_; - - //cout<<"Hello World. TrackCollectionSize: "<< isoPixelTracks->size()<size(); +#endif if (isoPixelTracks->empty()) return; @@ -305,17 +307,21 @@ void ValidIsoTrkCalib::analyze(const edm::Event& iEvent, const edm::EventSetup& continue; ptNear = isoMatched->maxPtPxl(); - //cout<<"Point 0.1 isoMatch. ptnear: "<hitPattern().numberOfValidHits() < MinNTrackHitsBarrel) continue; if (fabs(trit->eta()) > 1.47 && trit->hitPattern().numberOfValidStripTECHits() < MinNTECHitsEndcap) continue; - //cout<<"Point 0.2.1 after numofvalidhits HB: "<hitPattern().numberOfValidHits()<hitPattern().numberOfValidStripTECHits()<hitPattern().numberOfValidHits(); + edm::LogVerbatim("HcalIsoTrack") << "Point 0.2.2 after numofvalidstrips HE: " + << trit->hitPattern().numberOfValidStripTECHits(); +#endif numVH = trit->hitPattern().numberOfValidHits(); numVS = trit->hitPattern().numberOfValidStripTECHits(); @@ -326,9 +332,11 @@ void ValidIsoTrkCalib::analyze(const edm::Event& iEvent, const edm::EventSetup& emEnergy = isoMatched->energyIn(); - //cout<<"Point 0.3. Matched :: pt: "<pt()<<" wholeEnergy: "<pt() << " wholeEnergy: " << trackE + << " emEnergy: " << emEnergy << " eta: " << trackEta << " phi: " << trackPhi; + edm::LogVerbatim("HcalIsoTrack") << "Point 0.4. EM energy in cone: " << emEnergy; +#endif TrackDetMatchInfo info = trackAssociator_.associate( iEvent, iSetup, @@ -349,11 +357,11 @@ void ValidIsoTrkCalib::analyze(const edm::Event& iEvent, const edm::EventSetup& zTrkHcal = info.trkGlobPosAtHcal.z(); if (xTrkEcal == 0 && yTrkEcal == 0 && zTrkEcal == 0) { - cout << "zero point at Ecal" << endl; + edm::LogVerbatim("HcalIsoTrack") << "zero point at Ecal"; continue; } if (xTrkHcal == 0 && yTrkHcal == 0 && zTrkHcal == 0) { - cout << "zero point at Hcal" << endl; + edm::LogVerbatim("HcalIsoTrack") << "zero point at Hcal"; continue; } @@ -382,8 +390,9 @@ void ValidIsoTrkCalib::analyze(const edm::Event& iEvent, const edm::EventSetup& std::vector usedHits; // usedHits.clear(); - //cout <<"Point 1. Entrance to HBHECollection"< 4.*atan(1.)) dphi = 8.*atan(1.) - dphi; - float deta = fabs(etahcal - etahit); - float dr = sqrt(dphi*dphi + deta*deta); - */ +#ifdef EDM_ML_DEBUG + float dphi = fabs(info.trkGlobPosAtHcal.phi() - pos.phi()); + if (dphi > 4. * atan(1.)) + dphi = 8. * atan(1.) - dphi; + float deta = fabs(info.trkGlobPosAtHcal.eta() - pos.eta()); + float dr = sqrt(dphi * dphi + deta * deta); +#endif //double distAtHcal = getDistInPlaneTrackDir(gPointHcal, trackMomAtHcal, pos); double distAtHcal = getDistInPlaneSimple(gPointHcal, pos); @@ -440,8 +450,10 @@ void ValidIsoTrkCalib::analyze(const edm::Event& iEvent, const edm::EventSetup& enehit = enehit + enehit2; } - //cout<<"IN CONE ieta: "< MaxHit.hitenergy) { @@ -459,18 +471,22 @@ void ValidIsoTrkCalib::analyze(const edm::Event& iEvent, const edm::EventSetup& usedHits.clear(); - //cout<<"Hottest ieta: "< energyMinIso && trackE < energyMaxIso && emEnergy < energyECALmip && MaxHit.hitenergy > 0. && abs(MaxHit.ietahitm) < 29) passCuts = kTRUE; - //cout<<"Pont 0.1.1. trackE:"<id()]; factor = respRecalib->getValues(hhit->id())->getValue(); - //if(i<5){cout<<" calib factors: "<id().ieta() == MaxHit.ietahitm && hhit->id().iphi() == MaxHit.iphihitm) CentHitFactor = factor; @@ -659,7 +677,9 @@ void ValidIsoTrkCalib::analyze(const edm::Event& iEvent, const edm::EventSetup& } //end of isoProdTracks cycle /* ------------------ Some stuff for general tracks ---------- ----*/ - //cout<<" generalTracks Size: "<< generalTracks->size()<size(); +#endif int n = generalTracks->size(); nTracks->Fill(n); @@ -710,8 +730,10 @@ void ValidIsoTrkCalib::analyze(const edm::Event& iEvent, const edm::EventSetup& // ------------ method called once each job just before starting event loop ------------ void ValidIsoTrkCalib::beginJob() { - // if(!ReadCalibFactors(calibFactorsFileName_.c_str() )) {cout<<"Cant read file with cailib coefficients!! ---"< #include #include +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "Utilities/Xerces/interface/Xerces.h" #include #include @@ -34,7 +35,7 @@ void HcalConstantsXMLWriter::writeXML(std::string& newfile0, char const* fend = "\0"; newfile[nn] = *fend; - std::cout << " New file " << newfile << std::endl; + edm::LogVerbatim("HcalCalib") << " New file " << newfile << std::endl; std::filebuf fb; fb.open(newfile, std::ios::out); @@ -68,11 +69,11 @@ void HcalConstantsXMLWriter::writeXML(std::string& newfile0, rootelem->appendChild(theDOMVec[i]); } - std::cout << " Write Doc " << theDOMVec.size() << std::endl; + edm::LogVerbatim("HcalCalib") << " Write Doc " << theDOMVec.size(); DOMLSOutput* output = mDom->createLSOutput(); output->setByteStream(&formTarget); domWriter->write(mDoc, output); - std::cout << " End of Writting " << std::endl; + edm::LogVerbatim("HcalCalib") << " End of Writting "; mDoc->release(); output->release(); domWriter->release(); diff --git a/Calibration/HcalCalibAlgos/src/hcalCalib.cc b/Calibration/HcalCalibAlgos/src/hcalCalib.cc index 1e7d1eaa08bff..c14fc6f828eaf 100644 --- a/Calibration/HcalCalibAlgos/src/hcalCalib.cc +++ b/Calibration/HcalCalibAlgos/src/hcalCalib.cc @@ -9,7 +9,7 @@ // #include "Calibration/HcalCalibAlgos/interface/hcalCalib.h" -#include "Calibration/HcalCalibAlgos/interface/hcalCalibUtils.h" +#include "Calibration/HcalCalibAlgos/src/hcalCalibUtils.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include diff --git a/Calibration/HcalCalibAlgos/src/hcalCalibUtils.cc b/Calibration/HcalCalibAlgos/src/hcalCalibUtils.cc index cd0b396b53856..93d4a64369e81 100644 --- a/Calibration/HcalCalibAlgos/src/hcalCalibUtils.cc +++ b/Calibration/HcalCalibAlgos/src/hcalCalibUtils.cc @@ -5,7 +5,7 @@ #include "TString.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "Calibration/HcalCalibAlgos/interface/hcalCalibUtils.h" +#include "Calibration/HcalCalibAlgos/src/hcalCalibUtils.h" //#include "Calibration/HcalCalibAlgos/plugins/CommonUsefulStuff.h" #include "Calibration/HcalCalibAlgos/interface/CommonUsefulStuff.h" diff --git a/Calibration/HcalCalibAlgos/interface/hcalCalibUtils.h b/Calibration/HcalCalibAlgos/src/hcalCalibUtils.h similarity index 100% rename from Calibration/HcalCalibAlgos/interface/hcalCalibUtils.h rename to Calibration/HcalCalibAlgos/src/hcalCalibUtils.h diff --git a/Calibration/HcalCalibAlgos/test/DiJetAnalyzer.cc b/Calibration/HcalCalibAlgos/test/DiJetAnalyzer.cc index 5b4f96fe22b2d..7ad3da9edb3e5 100644 --- a/Calibration/HcalCalibAlgos/test/DiJetAnalyzer.cc +++ b/Calibration/HcalCalibAlgos/test/DiJetAnalyzer.cc @@ -194,11 +194,11 @@ void DiJetAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& evS return; // dump if (debug_) { - std::cout << "Run: " << iEvent.id().run() << "; Event: " << iEvent.id().event() << std::endl; + edm::LogVerbatim("HcalCalib") << "Run: " << iEvent.id().run() << "; Event: " << iEvent.id().event(); for (reco::PFJetCollection::const_iterator it = pfjets->begin(); it != pfjets->end(); ++it) { const reco::PFJet* jet = &(*it); - std::cout << "istag=" << (jet == pf_tag.jet()) << "; isprobe=" << (jet == pf_probe.jet()) << "; et=" << jet->et() - << "; eta=" << jet->eta() << std::endl; + edm::LogVerbatim("HcalCalib") << "istag=" << (jet == pf_tag.jet()) << "; isprobe=" << (jet == pf_probe.jet()) + << "; et=" << jet->et() << "; eta=" << jet->eta(); } } diff --git a/Calibration/HcalCalibAlgos/test/GammaJetAnalysis.cc b/Calibration/HcalCalibAlgos/test/GammaJetAnalysis.cc index d1899c3264525..809c249e53167 100644 --- a/Calibration/HcalCalibAlgos/test/GammaJetAnalysis.cc +++ b/Calibration/HcalCalibAlgos/test/GammaJetAnalysis.cc @@ -252,7 +252,7 @@ GammaJetAnalysis::~GammaJetAnalysis() {} void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup) { nProcessed_++; - edm::LogInfo("GammaJetAnalysis") << "nProcessed=" << nProcessed_ << "\n"; + edm::LogVerbatim("GammaJetAnalysis") << "nProcessed=" << nProcessed_ << "\n"; // 1st. Get Photons // edm::Handle photons; @@ -264,12 +264,12 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& if ((photons->size() == 0) && !allowNoPhoton_) { if (debug_ > 0) - edm::LogInfo("GammaJetAnalysis") << "No photons in the event"; + edm::LogVerbatim("GammaJetAnalysis") << "No photons in the event"; return; } nPhotons_ = photons->size(); - edm::LogInfo("GammaJetAnalysis") << "nPhotons_=" << nPhotons_; + edm::LogVerbatim("GammaJetAnalysis") << "nPhotons_=" << nPhotons_; // Get photon quality flags edm::Handle> loosePhotonQual, tightPhotonQual; @@ -307,7 +307,7 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& if ((photonpairset.size() == 0) && !allowNoPhoton_) { if (debug_ > 0) - edm::LogInfo("GammaJetAnalysis") << "No good quality photons in the event"; + edm::LogVerbatim("GammaJetAnalysis") << "No good quality photons in the event"; return; } @@ -341,7 +341,7 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& // cut on photon pt if (photon_tag.isValid() && (photon_tag.pt() < photonPtMin_)) { if (debug_ > 0) - edm::LogInfo("GammaJetAnalysis") << "largest photonPt=" << photon_tag.pt(); + edm::LogVerbatim("GammaJetAnalysis") << "largest photonPt=" << photon_tag.pt(); return; } @@ -368,11 +368,11 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& if (anyJetCount == 0) { if (debug_ > 0) - edm::LogInfo("GammaJetAnalysis") << "Event contains no jets"; + edm::LogVerbatim("GammaJetAnalysis") << "Event contains no jets"; return; } if (debug_ > 0) - edm::LogInfo("GammaJetAnalysis") << "nPhotons=" << nPhotons_ << ", nPFJets=" << nPFJets_; + edm::LogVerbatim("GammaJetAnalysis") << "nPhotons=" << nPhotons_ << ", nPFJets=" << nPFJets_; HERE(Form("nPhotons_=%d, nPFJets_=%d", nPhotons_, nPFJets_)); @@ -405,16 +405,16 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& if (debugHLTTrigNames > 0) { if (debug_ > 1) - edm::LogInfo("GammaJetAnalysis") << "debugHLTTrigNames is on"; + edm::LogVerbatim("GammaJetAnalysis") << "debugHLTTrigNames is on"; const std::vector* trNames = &evTrigNames.triggerNames(); for (size_t i = 0; i < trNames->size(); ++i) { if (trNames->at(i).find("_Photon") != std::string::npos) { if (debug_ > 1) - edm::LogInfo("GammaJetAnalysis") << " - " << trNames->at(i); + edm::LogVerbatim("GammaJetAnalysis") << " - " << trNames->at(i); } } if (debug_ > 1) - edm::LogInfo("GammaJetAnalysis") << " "; + edm::LogVerbatim("GammaJetAnalysis") << " "; debugHLTTrigNames--; } @@ -460,7 +460,7 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& if (!photonTrigFlag && !jetTrigFlag) { if (debug_ > 0) - edm::LogInfo("GammaJetAnalysis") << "no trigger fired"; + edm::LogVerbatim("GammaJetAnalysis") << "no trigger fired"; return; } @@ -591,9 +591,6 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& edm::Ref photonRef(photons, photon_tag.idx()); HERE(Form("got photon ref, photon_tag.idx()=%d", photon_tag.idx())); - - //std::cout << "loosePhotonQual->at(photon_tag.idx())=" << loosePhotonQual->at(photon_tag.idx()) << std::endl; - tagPho_idLoose_ = (loosePhotonQual.isValid()) ? (*loosePhotonQual)[photonRef] : -1; tagPho_idTight_ = (tightPhotonQual.isValid()) ? (*tightPhotonQual)[photonRef] : -1; } else { @@ -602,7 +599,7 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& } if (debug_ > 1) - edm::LogInfo("GammaJetAnalysis") << "photon tag ID = " << tagPho_idLoose_ << " and " << tagPho_idTight_; + edm::LogVerbatim("GammaJetAnalysis") << "photon tag ID = " << tagPho_idLoose_ << " and " << tagPho_idTight_; HERE(Form("tagPhoID= %d and %d", tagPho_idLoose_, tagPho_idTight_)); @@ -680,7 +677,7 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& HBHE_n++; if (iEvent.id().event() == debugEvent) { if (debug_ > 1) - edm::LogInfo("GammaJetAnalysis") << (*ith).id().ieta() << " " << (*ith).id().iphi(); + edm::LogVerbatim("GammaJetAnalysis") << (*ith).id().ieta() << " " << (*ith).id().iphi(); } } } @@ -1055,11 +1052,11 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& int HF_type_ = 0; int maxElement = (*it)->elementsInBlocks().size(); if (debug_ > 1) - edm::LogInfo("GammaJetAnalysis") << "maxElement=" << maxElement; + edm::LogVerbatim("GammaJetAnalysis") << "maxElement=" << maxElement; if (workOnAOD_ == 1) { maxElement = 0; if (debug_ > 1) - edm::LogInfo("GammaJetAnalysis") << "forced 0"; + edm::LogVerbatim("GammaJetAnalysis") << "forced 0"; } HERE(Form("maxElement=%d", maxElement)); for (int e = 0; e < maxElement; ++e) { @@ -1119,7 +1116,7 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& float avgphi = (static_cast(cv[0].phi()) + static_cast(cv[2].phi())) / 2.0; if ((cv[0].phi() < cv[2].phi()) && (debug_ > 1)) - edm::LogInfo("GammaJetAnalysis") << "pHB" << cv[0].phi() << " " << cv[2].phi(); + edm::LogVerbatim("GammaJetAnalysis") << "pHB" << cv[0].phi() << " " << cv[2].phi(); if (cv[0].phi() < cv[2].phi()) avgphi = (2.0 * 3.141592653 + static_cast(cv[0].phi()) + static_cast(cv[2].phi())) / @@ -1133,7 +1130,7 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& float avgphi = (static_cast(cv[0].phi()) + static_cast(cv[2].phi())) / 2.0; if ((cv[0].phi() < cv[2].phi()) && (debug_ > 1)) - edm::LogInfo("GammaJetAnalysis") << "pHE" << cv[0].phi() << " " << cv[2].phi(); + edm::LogVerbatim("GammaJetAnalysis") << "pHE" << cv[0].phi() << " " << cv[2].phi(); if (cv[0].phi() < cv[2].phi()) avgphi = (2.0 * 3.141592653 + static_cast(cv[0].phi()) + static_cast(cv[2].phi())) / @@ -1203,7 +1200,7 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& float avgeta = (cv[0].eta() + cv[2].eta()) / 2.0; float avgphi = (static_cast(cv[0].phi()) + static_cast(cv[2].phi())) / 2.0; if ((cv[0].phi() < cv[2].phi()) && (debug_ > 1)) - edm::LogInfo("GammaJetAnalysis") << "pHFhad" << cv[0].phi() << " " << cv[2].phi(); + edm::LogVerbatim("GammaJetAnalysis") << "pHFhad" << cv[0].phi() << " " << cv[2].phi(); if (cv[0].phi() < cv[2].phi()) avgphi = (2.0 * 3.141592653 + static_cast(cv[0].phi()) + static_cast(cv[2].phi())) / @@ -1255,7 +1252,7 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& float avgeta = (cv[0].eta() + cv[2].eta()) / 2.0; float avgphi = (static_cast(cv[0].phi()) + static_cast(cv[2].phi())) / 2.0; if ((cv[0].phi() < cv[2].phi()) && (debug_ > 1)) - edm::LogInfo("GammaJetAnalysis") << "pHFem" << cv[0].phi() << " " << cv[2].phi(); + edm::LogVerbatim("GammaJetAnalysis") << "pHFem" << cv[0].phi() << " " << cv[2].phi(); if (cv[0].phi() < cv[2].phi()) avgphi = (2.0 * 3.141592653 + static_cast(cv[0].phi()) + static_cast(cv[2].phi())) / @@ -1314,7 +1311,7 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& float avgeta = (cv[0].eta() + cv[2].eta()) / 2.0; float avgphi = (static_cast(cv[0].phi()) + static_cast(cv[2].phi())) / 2.0; if ((cv[0].phi() < cv[2].phi()) && (debug_ > 1)) - edm::LogInfo("GammaJetAnalysis") << "pHO" << cv[0].phi() << " " << cv[2].phi(); + edm::LogVerbatim("GammaJetAnalysis") << "pHO" << cv[0].phi() << " " << cv[2].phi(); if (cv[0].phi() < cv[2].phi()) avgphi = (2.0 * 3.141592653 + static_cast(cv[0].phi()) + static_cast(cv[2].phi())) / @@ -1702,7 +1699,7 @@ void GammaJetAnalysis::endJob() { void GammaJetAnalysis::beginRun(const edm::Run& iRun, const edm::EventSetup& setup) { if (debug_ > 1) - edm::LogInfo("GammaJetAnalysis") << "beginRun()"; + edm::LogVerbatim("GammaJetAnalysis") << "beginRun()"; if (!ignoreHLT_) { int noPhotonTrigger = (photonTrigNamesV_.size() == 0) ? 1 : 0; @@ -1714,7 +1711,7 @@ void GammaJetAnalysis::beginRun(const edm::Run& iRun, const edm::EventSetup& set if (noPhotonTrigger && noJetTrigger) { ignoreHLT_ = true; if (debug_ > 1) - edm::LogInfo("GammaJetAnalysis") << "HLT trigger ignored: no trigger requested"; + edm::LogVerbatim("GammaJetAnalysis") << "HLT trigger ignored: no trigger requested"; } } else { // clear trigger names, if needed @@ -1724,7 +1721,7 @@ void GammaJetAnalysis::beginRun(const edm::Run& iRun, const edm::EventSetup& set if (!ignoreHLT_) { if (debug_ > 0) - edm::LogInfo("GammaJetAnalysis") << "Initializing trigger information for individual run"; + edm::LogVerbatim("GammaJetAnalysis") << "Initializing trigger information for individual run"; bool changed(true); std::string processName = "HLT"; if (hltPrescaleProvider_.init(iRun, setup, processName, changed)) { @@ -1758,7 +1755,7 @@ float GammaJetAnalysis::pfEcalIso(const reco::Photon* localPho1, float energyEndcap, reco::PFCandidate::ParticleType pfToUse) { if (debug_ > 1) - edm::LogInfo("GammaJetAnalysis") << "Inside pfEcalIso"; + edm::LogVerbatim("GammaJetAnalysis") << "Inside pfEcalIso"; reco::Photon* localPho = localPho1->clone(); float dRVeto; float etaStrip; @@ -1819,7 +1816,7 @@ float GammaJetAnalysis::pfHcalIso(const reco::Photon* localPho, float dRveto, reco::PFCandidate::ParticleType pfToUse) { if (debug_ > 1) - edm::LogInfo("GammaJetAnalysis") << "Inside pfHcalIso"; + edm::LogVerbatim("GammaJetAnalysis") << "Inside pfHcalIso"; return pfEcalIso(localPho, pfHandle, dRmax, dRveto, dRveto, 0.0, 0.0, 0.0, 0.0, pfToUse); } @@ -1836,7 +1833,7 @@ std::vector GammaJetAnalysis::pfTkIsoWithVertex(const reco::Photon* local float dxyMax, reco::PFCandidate::ParticleType pfToUse) { if (debug_ > 1) - edm::LogInfo("GammaJetAnalysis") << "Inside pfTkIsoWithVertex()"; + edm::LogVerbatim("GammaJetAnalysis") << "Inside pfTkIsoWithVertex()"; reco::Photon* localPho = localPho1->clone(); float dRveto; @@ -1850,34 +1847,34 @@ std::vector GammaJetAnalysis::pfTkIsoWithVertex(const reco::Photon* local //Calculate isolation sum separately for each vertex if (debug_ > 1) - edm::LogInfo("GammaJetAnalysis") << "vtxHandle->size() = " << vtxHandle->size(); + edm::LogVerbatim("GammaJetAnalysis") << "vtxHandle->size() = " << vtxHandle->size(); for (unsigned int ivtx = 0; ivtx < (vtxHandle->size()); ++ivtx) { if (debug_ > 1) - edm::LogInfo("GammaJetAnalysis") << "Vtx " << ivtx; + edm::LogVerbatim("GammaJetAnalysis") << "Vtx " << ivtx; // Shift the photon according to the vertex reco::VertexRef vtx(vtxHandle, ivtx); math::XYZVector photon_directionWrtVtx(localPho->superCluster()->x() - vtx->x(), localPho->superCluster()->y() - vtx->y(), localPho->superCluster()->z() - vtx->z()); if (debug_ > 1) - edm::LogInfo("GammaJetAnalysis") << "pfTkIsoWithVertex :: Will Loop over the PFCandidates"; + edm::LogVerbatim("GammaJetAnalysis") << "pfTkIsoWithVertex :: Will Loop over the PFCandidates"; float sum = 0; // Loop over the PFCandidates for (unsigned i = 0; i < forIsolation->size(); i++) { if (debug_ > 1) - edm::LogInfo("GammaJetAnalysis") << "inside loop"; + edm::LogVerbatim("GammaJetAnalysis") << "inside loop"; const reco::PFCandidate& pfc = (*forIsolation)[i]; //require that PFCandidate is a charged hadron if (debug_ > 1) { - edm::LogInfo("GammaJetAnalysis") << "pfToUse=" << pfToUse; - edm::LogInfo("GammaJetAnalysis") << "pfc.particleId()=" << pfc.particleId(); + edm::LogVerbatim("GammaJetAnalysis") << "pfToUse=" << pfToUse; + edm::LogVerbatim("GammaJetAnalysis") << "pfc.particleId()=" << pfc.particleId(); } if (pfc.particleId() == pfToUse) { if (debug_ > 1) { - edm::LogInfo("GammaJetAnalysis") << "\n ***** HERE pfc.particleId() == pfToUse "; - edm::LogInfo("GammaJetAnalysis") << "pfc.pt()=" << pfc.pt(); + edm::LogVerbatim("GammaJetAnalysis") << "\n ***** HERE pfc.particleId() == pfToUse "; + edm::LogVerbatim("GammaJetAnalysis") << "pfc.pt()=" << pfc.pt(); } if (pfc.pt() < ptMin) continue; @@ -1895,18 +1892,18 @@ std::vector GammaJetAnalysis::pfTkIsoWithVertex(const reco::Photon* local continue; sum += pfc.pt(); if (debug_ > 1) - edm::LogInfo("GammaJetAnalysis") << "pt=" << pfc.pt(); + edm::LogVerbatim("GammaJetAnalysis") << "pt=" << pfc.pt(); } } if (debug_ > 1) - edm::LogInfo("GammaJetAnalysis") << "sum=" << sum; + edm::LogVerbatim("GammaJetAnalysis") << "sum=" << sum; sum = sum * 1.0; result.push_back(sum); } if (debug_ > 1) { - edm::LogInfo("GammaJetAnalysis") << "Will return result"; - edm::LogInfo("GammaJetAnalysis") << "result" << &result; - edm::LogInfo("GammaJetAnalysis") << "Result returned"; + edm::LogVerbatim("GammaJetAnalysis") << "Will return result"; + edm::LogVerbatim("GammaJetAnalysis") << "result" << &result; + edm::LogVerbatim("GammaJetAnalysis") << "Result returned"; } return result; } diff --git a/Calibration/HcalCalibAlgos/test/HcalConstantsASCIIWriter.cc b/Calibration/HcalCalibAlgos/test/HcalConstantsASCIIWriter.cc index 9551da7660335..2a80a5ce0ac14 100644 --- a/Calibration/HcalCalibAlgos/test/HcalConstantsASCIIWriter.cc +++ b/Calibration/HcalCalibAlgos/test/HcalConstantsASCIIWriter.cc @@ -26,6 +26,8 @@ #include #include +//#define EDM_ML_DEBUG + // // constructors and destructor // @@ -49,7 +51,7 @@ namespace cms { myout_hcal = new std::ofstream(fDataFile.c_str()); if (!myout_hcal) - std::cout << " Output file not open!!! " << std::endl; + edm::LogVerbatim("HcalCalib") << " Output file not open!!! "; } void HcalConstantsASCIIWriter::endJob() { delete myout_hcal; } @@ -60,7 +62,7 @@ namespace cms { // ------------ method called to produce the data ------------ void HcalConstantsASCIIWriter::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - std::cout << " Start HcalConstantsASCIIWriter::analyze " << std::endl; + edm::LogVerbatim("HcalCalib") << " Start HcalConstantsASCIIWriter::analyze"; HcalRespCorrs* oldRespCorrs = new HcalRespCorrs(iSetup.getData(tok_resp_)); // std::vector dd = oldRespCorrs->getAllChannels(); @@ -82,11 +84,11 @@ namespace cms { HcalDetId hid = HcalDetId(*i); theVector.push_back(hid); corrold[hid] = (oldRespCorrs->getValues(*i))->getValue(); - std::cout << " Old calibration " << hid.depth() << " " << hid.ieta() << " " << hid.iphi() << std::endl; + edm::LogVerbatim("HcalCalib") << " Old calibration " << hid.depth() << " " << hid.ieta() << " " << hid.iphi(); } } - std::cout << " Get old calibration " << std::endl; + edm::LogVerbatim("HcalCalib") << " Get old calibration "; // Read new corrections from file edm::FileInPath f1(file_input); @@ -97,19 +99,22 @@ namespace cms { double corrnew_p[5][5][45][75]; double corrnew_m[5][5][45][75]; - std::cout << " Start to read txt file " << fDataFile.c_str() << std::endl; + edm::LogVerbatim("HcalCalib") << " Start to read txt file " << fDataFile.c_str() << std::endl; while (std::getline(in, line)) { - // std::cout<<" Line size "<> mysubd >> depth >> ieta >> iphi >> coradd >> corerr; - // DetId mydid(DetId::Hcal,HcalSubdetector(mysubd)); - // HcalDetId hid(HcalSubdetector(mysubd),ieta,iphi,depth); - // HcalDetId hid(mydid); - // std::cout<<" Check mysubd "<topo()); @@ -138,8 +143,9 @@ namespace cms { cc2 = corrnew_m[(*it).subdet()][(*it).depth()][ietak][(*it).iphi()]; float cc = cc1 * cc2; - std::cout << " Multiply " << (*it).subdet() << " " << (*it).depth() << " " << (*it).ieta() << " " << ietak << " " - << (*it).iphi() << " " << (*it).rawId() << " " << cc1 << " " << cc2 << std::endl; + edm::LogVerbatim("HcalCalib") << " Multiply " << (*it).subdet() << " " << (*it).depth() << " " << (*it).ieta() + << " " << ietak << " " << (*it).iphi() << " " << (*it).rawId() << " " << cc1 << " " + << cc2; // now make the basic object for one cell with HcalDetId myDetId containing the value myValue HcalRespCorr item((*it).rawId(), cc); diff --git a/Calibration/HcalCalibAlgos/test/HcalCorrPFCalculation.cc b/Calibration/HcalCalibAlgos/test/HcalCorrPFCalculation.cc index c34e27de9b0dd..62873ec5f6b9e 100644 --- a/Calibration/HcalCalibAlgos/test/HcalCorrPFCalculation.cc +++ b/Calibration/HcalCalibAlgos/test/HcalCorrPFCalculation.cc @@ -32,6 +32,8 @@ #include #include "TProfile.h" +//#define EDM_ML_DEBUG + class HcalCorrPFCalculation : public edm::one::EDAnalyzer { public: HcalCorrPFCalculation(edm::ParameterSet const& conf); @@ -170,7 +172,9 @@ void HcalCorrPFCalculation::analyze(edm::Event const& ev, edm::EventSetup const& pfRecalib = &c.getData(tok_pfcorr_); AddRecalib = kTRUE; - // edm::LogVerbatim("CalibConstants")<<" OK "; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CalibConstants") << " OK "; +#endif } catch (const cms::Exception& e) { edm::LogWarning("CalibConstants") << " Not Found!! "; @@ -244,10 +248,12 @@ void HcalCorrPFCalculation::analyze(edm::Event const& ev, edm::EventSetup const& // ev.getByLabel("generatorSmeared",evtMC); ev.getByToken(tok_gen_, evtMC); if (!evtMC.isValid()) { - std::cout << "no HepMCProduct found" << std::endl; + edm::LogVerbatim("HcalCalib") << "no HepMCProduct found"; } else { //MC=true; - // std::cout << "*** source HepMCProduct found"<< std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalCalib") << "*** source HepMCProduct found"; +#endif } // MC particle with highest pt is taken as a direction reference @@ -373,20 +379,27 @@ void HcalCorrPFCalculation::analyze(edm::Event const& ev, edm::EventSetup const& //zAtHcal = gPointHcal.z(); /* ----------------- ------------------------ */ - if (gPointHcal.x() == 0 && gPointHcal.y() == 0 && gPointHcal.z() == 0) { /*cout <<"gPointHcal is Zero!"< 5.192) continue; - //if (abs(etahcal)>3.0 && abs(etahcal)<5.191) - - //cout < 3.0 && std::abs(etahcal) < 5.191) { + edm::LogVerbatim("HcalCalib") << gPointHcal.x() << " " << gPointHcal.y() << " " << gPointHcal.z() << " " + << gPointHcal.eta() << " " << gPointHcal.phi() << " " << ietatrue << " " + << iphitrue; + if (ietatrue == 100 || iphitrue == -10) { + edm::LogVerbatim("HcalCalib") << "ietatrue: " << ietatrue << " iphitrue: " << iphitrue + << " etahcal: " << etahcal << " phihcal: " << gPointHcal.phi(); + } + } +#endif /* ------------- Calculate Ecal Energy using TrackAssociator ---------------------- */ //float etaecal=info.trkGlobPosAtEcal.eta(); @@ -502,8 +515,9 @@ void HcalCorrPFCalculation::analyze(edm::Event const& ev, edm::EventSetup const& // for (HcalRecHitCollection::const_iterator hhit=Hithcal.begin(); hhit!=Hithcal.end(); hhit++) { recal = RecalibFactor(hhit->detid()); - //cout<<"recal: "<getPosition(hhit->detid()); int iphihit = (hhit->id()).iphi(); @@ -544,9 +558,10 @@ void HcalCorrPFCalculation::analyze(edm::Event const& ev, edm::EventSetup const& !(abs(MaxHit.ietahitm) == 21 && abs((hhit->id()).ieta()) <= 20 && abs(DIPHI) > 1)))) { e3x3 += hhit->energy(); } - - // cout<<"track: ieta "<detid()); int iphihit2 = (hhit2->id()).iphi(); @@ -557,7 +572,10 @@ void HcalCorrPFCalculation::analyze(edm::Event const& ev, edm::EventSetup const& if (iphihitNoise == iphihit2 && ietahitNoise == ietahit2 && depthhitNoise == depthhit2 && enehit2 > 0.) { eHcalConeNoise += hhit2->energy() * recal; UsedCellsNoise++; - //cout<<"Noise: ieta "< 36 ? 72 - diphi_M_P : diphi_M_P; iDr = sqrt(diphi_M_P * diphi_M_P + dieta_M_P * dieta_M_P); - /* if (iDr>15) - { -cout<<"diphi: "< 15) { + edm::LogVerbatim("HcalCalib") << "diphi: " << diphi_M_P << " dieta: " << dieta_M_P << " iDr: " << iDr + << " ietatrue:" << ietatrue << " iphitrue:" << iphitrue; + edm::LogVerbatim("HcalCalib") << "M ieta: " << MaxHit.ietahitm << " M iphi: " << MaxHit.iphihitm; + } +#endif Bool_t passCuts = kFALSE; passCuts = kTRUE; diff --git a/Calibration/HcalCalibAlgos/test/HcalIsoTrackStudy.cc b/Calibration/HcalCalibAlgos/test/HcalIsoTrackStudy.cc index bdfee7c0ce96c..46186a5a906b2 100644 --- a/Calibration/HcalCalibAlgos/test/HcalIsoTrackStudy.cc +++ b/Calibration/HcalCalibAlgos/test/HcalIsoTrackStudy.cc @@ -83,6 +83,8 @@ #include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" +//#define EDM_ML_DEBUG + class HcalIsoTrackStudy : public edm::one::EDAnalyzer { public: explicit HcalIsoTrackStudy(edm::ParameterSet const&); @@ -1226,7 +1228,10 @@ double HcalIsoTrackStudy::trackP(const reco::Track* pTrack, if (dR < mindR) { mindR = dR; pmom = p.momentum().R(); - // std::cout<<"p.E() :"< simTracks; iEvent.getByToken(tok_simTrack_, simTracks); @@ -251,8 +251,8 @@ void ValidationHcalIsoTrackAlCaReco::analyze(const edm::Event& iEvent, const edm for (reco::IsolatedPixelTrackCandidateCollection::const_iterator bll = recoIsoTracks->begin(); bll != recoIsoTracks->end(); bll++) { - std::cout << "ISO Pt " << bll->pt() << " P " << bll->p() << " Eta " << bll->eta() << " Phi " << bll->phi() - << std::endl; + edm::LogVerbatim("HcalIsoTrack") << "ISO Pt " << bll->pt() << " P " << bll->p() << " Eta " << bll->eta() + << " Phi " << bll->phi(); double distanceMin = 1.; double SimPtMatched = 1.; @@ -286,9 +286,10 @@ void ValidationHcalIsoTrackAlCaReco::analyze(const edm::Event& iEvent, const edm tracksCI->momentum().pz() * tracksCI->momentum().pz()); } - std::cout << " Pt " << tracksCI->momentum().pt() << " Energy " << tracksCI->momentum().e() << " Eta " - << tracksCI->momentum().eta() << " Phi " << tracksCI->momentum().phi() << " Ind " << partIndex - << " Cha " << tracksCI->charge() << " Dis " << distance << " DCM " << distanceCM << std::endl; + edm::LogVerbatim("HcalIsoTrack") << " Pt " << tracksCI->momentum().pt() << " Energy " + << tracksCI->momentum().e() << " Eta " << tracksCI->momentum().eta() << " Phi " + << tracksCI->momentum().phi() << " Ind " << partIndex << " Cha " + << tracksCI->charge() << " Dis " << distance << " DCM " << distanceCM; } if (tracksCI->momentum().eta() > (bll->eta() - 0.5) && tracksCI->momentum().eta() < (bll->eta() + 0.5) && @@ -299,9 +300,10 @@ void ValidationHcalIsoTrackAlCaReco::analyze(const edm::Event& iEvent, const edm double distance = getDist(tracksCI->momentum().eta(), tracksCI->momentum().phi(), bll->eta(), bll->phi()); double distanceCM = getDistInCM(tracksCI->momentum().eta(), tracksCI->momentum().phi(), bll->eta(), bll->phi()); - std::cout << "NEU Pt " << tracksCI->momentum().pt() << " Energy " << tracksCI->momentum().e() << " Eta " - << tracksCI->momentum().eta() << " Phi " << tracksCI->momentum().phi() << " Ind " << partIndex - << " Cha " << tracksCI->charge() << " Dis " << distance << " DCM " << distanceCM << std::endl; + edm::LogVerbatim("HcalIsoTrack") << "NEU Pt " << tracksCI->momentum().pt() << " Energy " + << tracksCI->momentum().e() << " Eta " << tracksCI->momentum().eta() << " Phi " + << tracksCI->momentum().phi() << " Ind " << partIndex << " Cha " + << tracksCI->charge() << " Dis " << distance << " DCM " << distanceCM; if (distanceCM < 40.) { neuen = neuen + tracksCI->momentum().e(); @@ -326,7 +328,7 @@ void ValidationHcalIsoTrackAlCaReco::analyze(const edm::Event& iEvent, const edm hSimP->Fill(SimPMatched, 1); hSimN->Fill(1, 1); - std::cout << "S Pt " << SimPtMatched << std::endl; + edm::LogVerbatim("HcalIsoTrack") << "S Pt " << SimPtMatched; } if (distanceMin > 0.1) { diff --git a/Calibration/HcalCalibAlgos/test/ValidationHcalIsoTrackAlCaReco.h b/Calibration/HcalCalibAlgos/test/ValidationHcalIsoTrackAlCaReco.h index 25c31d2ae0b59..0067a1cdb8c41 100644 --- a/Calibration/HcalCalibAlgos/test/ValidationHcalIsoTrackAlCaReco.h +++ b/Calibration/HcalCalibAlgos/test/ValidationHcalIsoTrackAlCaReco.h @@ -22,7 +22,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -64,7 +64,7 @@ #include "TH1F.h" -class ValidationHcalIsoTrackAlCaReco : public edm::EDAnalyzer { +class ValidationHcalIsoTrackAlCaReco : public edm::one::EDAnalyzer<> { public: typedef dqm::legacy::MonitorElement MonitorElement; typedef dqm::legacy::DQMStore DQMStore; diff --git a/Calibration/IsolatedParticles/interface/CaloSimInfo.h b/Calibration/IsolatedParticles/interface/CaloSimInfo.h index db154e603e551..f36893c02a433 100644 --- a/Calibration/IsolatedParticles/interface/CaloSimInfo.h +++ b/Calibration/IsolatedParticles/interface/CaloSimInfo.h @@ -16,7 +16,6 @@ Created: August 2009 // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" - #include "FWCore/Framework/interface/Event.h" #include "DataFormats/Common/interface/Handle.h" @@ -50,6 +49,17 @@ namespace spr { double eTotal; }; + struct energyMap { + energyMap() { pdgId = 0; } + int pdgId; + std::vector > matched; + std::vector > gamma; + std::vector > charged; + std::vector > neutral; + std::vector > rest; + std::vector > all; + }; + // takes the EcalSimHits and returns a map energy matched to SimTrack, photons, neutral hadrons etc. in a symmetric matrix (2*ieta+1)*(2*iphi+1) template void eECALSimInfo(const edm::Event&, @@ -232,6 +242,137 @@ namespace spr { bool debug = false); double timeOfFlight(DetId id, const CaloGeometry* geo, bool debug = false); + + // takes the EcalSimHits and returns a map energy matched to SimTrack, photons, neutral hadrons etc. + template + std::map eECALSimInfo(const edm::Event&, + CaloNavigator& navigator, + const CaloGeometry* geo, + edm::Handle& hits, + edm::Handle& SimTk, + edm::Handle& SimVtx, + const reco::Track* pTrack, + TrackerHitAssociator& associate, + int ieta, + int iphi, + double timeCut = 150, + bool debug = false); + + template + std::map eECALSimInfoTotal(const edm::Event&, + const DetId& det, + const CaloGeometry* geo, + const CaloTopology* caloTopology, + edm::Handle& hitsEB, + edm::Handle& hitsEE, + edm::Handle& SimTk, + edm::Handle& SimVtx, + const reco::Track* pTrack, + TrackerHitAssociator& associate, + int ieta, + int iphi, + int itry = -1, + double timeCut = 150, + bool debug = false); + + template + energyMap eECALSimInfoMatrix(const edm::Event&, + const DetId& det, + const CaloGeometry* geo, + const CaloTopology* caloTopology, + edm::Handle& hitsEB, + edm::Handle& hitsEE, + edm::Handle& SimTk, + edm::Handle& SimVtx, + const reco::Track* pTrack, + TrackerHitAssociator& associate, + int ieta, + int iphi, + double timeCut = 150, + bool debug = false); + + // takes the HcalSimHits and returns a map energy matched to SimTrack, photons, neutral hadrons etc. + template + std::map eHCALSimInfoTotal(const edm::Event&, + const HcalTopology* topology, + const DetId& det, + const CaloGeometry* geo, + edm::Handle& hits, + edm::Handle& SimTk, + edm::Handle& SimVtx, + const reco::Track* pTrack, + TrackerHitAssociator& associate, + int ieta, + int iphi, + int itry = -1, + double timeCut = 150, + bool includeHO = false, + bool debug = false); + + template + energyMap eHCALSimInfoMatrix(const edm::Event&, + const HcalTopology* topology, + const DetId& det, + const CaloGeometry* geo, + edm::Handle& hits, + edm::Handle& SimTk, + edm::Handle& SimVtx, + const reco::Track* pTrack, + TrackerHitAssociator& associate, + int ieta, + int iphi, + double timeCut = 150, + bool includeHO = false, + bool debug = false); + + // Actual function which does the matching of SimHits to SimTracks using geantTrackId + template + energyMap caloSimInfoMatrix(const CaloGeometry* geo, + edm::Handle& hits, + edm::Handle& SimTk, + edm::Handle& SimVtx, + std::vector hit, + edm::SimTrackContainer::const_iterator trkInfo, + double timeCut = 150, + bool includeHO = false, + bool debug = false); + + // Functions to study the Hits for which history cannot be traced back + template + std::vector missedECALHits(const edm::Event&, + CaloNavigator& navigator, + edm::Handle& hits, + edm::Handle& SimTk, + edm::Handle& SimVtx, + const reco::Track* pTrack, + TrackerHitAssociator& associate, + int ieta, + int iphi, + bool flag, + bool debug = false); + + template + std::vector missedHCALHits(const edm::Event&, + const HcalTopology* topology, + const DetId& det, + edm::Handle& hits, + edm::Handle& SimTk, + edm::Handle& SimVtx, + const reco::Track* pTrack, + TrackerHitAssociator& associate, + int ieta, + int iphi, + bool flag, + bool includeHO = false, + bool debug = false); + + template + std::vector missedCaloHits(edm::Handle& hits, + std::vector matchedId, + std::vector caloHits, + bool flag, + bool includeHO = false, + bool debug = false); } // namespace spr #include "Calibration/IsolatedParticles/interface/CaloSimInfo.icc" diff --git a/Calibration/IsolatedParticles/interface/CaloSimInfo.icc b/Calibration/IsolatedParticles/interface/CaloSimInfo.icc index 0df11988356e5..a5a40efaa82e2 100644 --- a/Calibration/IsolatedParticles/interface/CaloSimInfo.icc +++ b/Calibration/IsolatedParticles/interface/CaloSimInfo.icc @@ -3,9 +3,10 @@ #include "Calibration/IsolatedParticles/interface/eECALMatrix.h" #include "Calibration/IsolatedParticles/interface/FindCaloHitCone.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include -#include +#include namespace spr { @@ -61,8 +62,9 @@ namespace spr { double timeCut, bool debug) { if (debug) - std::cout << "Processing eECALSimInfo " << 2 * ieta + 1 << "x" << 2 * iphi + 1 << "\ntrkMom " << pTrack->p() - << " eta " << pTrack->eta() << " trkRecHits " << pTrack->recHitsSize() << std::endl; + edm::LogVerbatim("IsoTrack") << "Processing eECALSimInfo " << 2 * ieta + 1 << "x" << 2 * iphi + 1 << "\ntrkMom " + << pTrack->p() << " eta " << pTrack->eta() << " trkRecHits " + << pTrack->recHitsSize(); //matching SimTrack edm::SimTrackContainer::const_iterator trkInfo = @@ -94,8 +96,9 @@ namespace spr { double timeCut, bool debug) { if (debug) - std::cout << "Processing eECALSimInfo " << ietaE + ietaW + 1 << "x" << iphiN + iphiS + 1 << "\ntrkMom " - << pTrack->p() << " eta " << pTrack->eta() << " trkRecHits " << pTrack->recHitsSize() << std::endl; + edm::LogVerbatim("IsoTrack") << "Processing eECALSimInfo " << ietaE + ietaW + 1 << "x" << iphiN + iphiS + 1 + << "\ntrkMom " << pTrack->p() << " eta " << pTrack->eta() << " trkRecHits " + << pTrack->recHitsSize(); //matching SimTrack edm::SimTrackContainer::const_iterator trkInfo = @@ -147,8 +150,9 @@ namespace spr { bool includeHO, bool debug) { if (debug) - std::cout << "Processing eHCALSimInfo " << 2 * ieta + 1 << "x" << 2 * iphi + 1 << "\ntrkMom " << pTrack->p() - << " eta " << pTrack->eta() << " trkRecHits " << pTrack->recHitsSize() << std::endl; + edm::LogVerbatim("IsoTrack") << "Processing eHCALSimInfo " << 2 * ieta + 1 << "x" << 2 * iphi + 1 << "\ntrkMom " + << pTrack->p() << " eta " << pTrack->eta() << " trkRecHits " + << pTrack->recHitsSize(); // get the matching SimTrack pointer edm::SimTrackContainer::const_iterator trkInfo = @@ -180,8 +184,9 @@ namespace spr { bool includeHO, bool debug) { if (debug) - std::cout << "Processing eHCALSimInfo " << ietaE + ietaW + 1 << "x" << iphiN + iphiS + 1 << "\ntrkMom " - << pTrack->p() << " eta " << pTrack->eta() << " trkRecHits " << pTrack->recHitsSize() << std::endl; + edm::LogVerbatim("IsoTrack") << "Processing eHCALSimInfo " << ietaE + ietaW + 1 << "x" << iphiN + iphiS + 1 + << "\ntrkMom " << pTrack->p() << " eta " << pTrack->eta() << " trkRecHits " + << pTrack->recHitsSize(); // get the matching SimTrack pointer edm::SimTrackContainer::const_iterator trkInfo = @@ -210,9 +215,9 @@ namespace spr { std::vector& multiplicityVector, bool debug) { if (debug) { - std::cout << "Processing HcalSimInfo " << 2 * ieta + 1 << "x" << 2 * iphi + 1 << std::endl; - std::cout << "trkMom " << pTrack->p() << " eta " << pTrack->eta() << " trkRecHits " << pTrack->recHitsSize() - << std::endl; + edm::LogVerbatim("IsoTrack") << "Processing HcalSimInfo " << 2 * ieta + 1 << "x" << 2 * iphi + 1; + edm::LogVerbatim("IsoTrack") << "trkMom " << pTrack->p() << " eta " << pTrack->eta() << " trkRecHits " + << pTrack->recHitsSize(); } // Get SimTrack matched to RecoTrack @@ -343,9 +348,9 @@ namespace spr { info.eRest += eeInfo.eRest; info.eTotal += eeInfo.eTotal; if (debug) { - std::cout << " energyMatched " << info.eMatched << " energyGamma " << info.eGamma << " energyNeutral " - << info.eNeutralHad << " energyCharged " << info.eChargedHad << " energyRest " << info.eRest - << " energyTotal " << info.eTotal << std::endl; + edm::LogVerbatim("IsoTrack") << " energyMatched " << info.eMatched << " energyGamma " << info.eGamma + << " energyNeutral " << info.eNeutralHad << " energyCharged " << info.eChargedHad + << " energyRest " << info.eRest << " energyTotal " << info.eTotal; } } @@ -363,10 +368,10 @@ namespace spr { int matchedId = 0; //pdgid if (debug) { if (trkInfo != SimTk->end()) - std::cout << "In eCaloSimInfo:: matchSimTrk:" << trkInfo->trackId() << " matchedId " << trkInfo->type() - << std::endl; + edm::LogVerbatim("IsoTrack") << "In eCaloSimInfo:: matchSimTrk:" << trkInfo->trackId() << " matchedId " + << trkInfo->type(); else - std::cout << "In eCaloSimInfo:: not valid track pointer" << std::endl; + edm::LogVerbatim("IsoTrack") << "In eCaloSimInfo:: not valid track pointer"; } if (trkInfo != SimTk->end()) { @@ -399,11 +404,12 @@ namespace spr { spr::parentSimTrack(simTrkItr, SimTk, SimVtx, debug); if (debug) { if (parentItr != SimTk->end()) - std::cout << "original parent of " << simTrkItr->trackId() << " " << parentItr->trackId() << ", " - << parentItr->type() << " Energy " << hit[ihit]->energy() << std::endl; + edm::LogVerbatim("IsoTrack") + << "original parent of " << simTrkItr->trackId() << " " << parentItr->trackId() << ", " + << parentItr->type() << " Energy " << hit[ihit]->energy(); else - std::cout << "original parent of " << simTrkItr->trackId() << " not found; Energy " - << hit[ihit]->energy() << std::endl; + edm::LogVerbatim("IsoTrack") << "original parent of " << simTrkItr->trackId() + << " not found; Energy " << hit[ihit]->energy(); } if (parentItr == SimTk->end()) { info.eRest += hit[ihit]->energy(); @@ -420,7 +426,7 @@ namespace spr { if (!found) info.eRest += hit[ihit]->energy(); if (debug) - std::cout << "Hit " << ihit << ": " << *hit[ihit] << std::endl; + edm::LogVerbatim("IsoTrack") << "Hit " << ihit << ": " << *hit[ihit]; } } } // loop over hits @@ -429,9 +435,9 @@ namespace spr { info.eTotal = info.eMatched + info.eGamma + info.eNeutralHad + info.eChargedHad + info.eRest; info.pdgMatched = matchedId; if (debug) { - std::cout << " Energy (matched) " << info.eMatched << " (gamma) " << info.eGamma << " (neutral) " - << info.eNeutralHad << " (charged) " << info.eChargedHad << " (rest) " << info.eRest << " (total) " - << info.eTotal << std::endl; + edm::LogVerbatim("IsoTrack") << " Energy (matched) " << info.eMatched << " (gamma) " << info.eGamma + << " (neutral) " << info.eNeutralHad << " (charged) " << info.eChargedHad + << " (rest) " << info.eRest << " (total) " << info.eTotal; } } @@ -463,10 +469,11 @@ namespace spr { std::vector matchedId = spr::matchedSimTrackId(iEvent, SimTk, SimVtx, pTrack, associate, debug); double energySum = 0.0; if (debug) { - std::cout << "eCaloSimInfo:: Found " << matchedId.size() << " track IDs originating from the current track"; + std::ostringstream st1; for (unsigned int it = 0; it < matchedId.size(); ++it) - std::cout << " " << matchedId[it]; - std::cout << std::endl; + st1 << " " << matchedId[it]; + edm::LogVerbatim("IsoTrack") << "eCaloSimInfo:: Found " << matchedId.size() + << " track IDs originating from the current track" << st1.str(); } if (!matchedId.empty()) { typename T::const_iterator ihit; @@ -491,7 +498,7 @@ namespace spr { if (found) { energySum += ihit->energy(); if (debug) - std::cout << "Hit " << *ihit << std::endl; + edm::LogVerbatim("IsoTrack") << "Hit " << *ihit; } } } @@ -514,10 +521,11 @@ namespace spr { std::vector matchedId = spr::matchedSimTrackId(iEvent, SimTk, SimVtx, pTrack, associate, debug); double energySum = 0.0; if (debug) { - std::cout << "eCaloSimInfo:: Found " << matchedId.size() << " track IDs originating from the current track"; + std::ostringstream st1; for (unsigned int it = 0; it < matchedId.size(); ++it) - std::cout << " " << matchedId[it]; - std::cout << std::endl; + st1 << " " << matchedId[it]; + edm::LogVerbatim("IsoTrack") << "eCaloSimInfo:: Found " << matchedId.size() + << " track IDs originating from the current track" << st1.str(); } if (!matchedId.empty()) { typename T::const_iterator ihit; @@ -536,7 +544,7 @@ namespace spr { if (found) { energySum += ihit->energy(); if (debug) - std::cout << "Hit " << *ihit << std::endl; + edm::LogVerbatim("IsoTrack") << "Hit " << *ihit; } } } @@ -555,7 +563,7 @@ namespace spr { if (found) { energySum += ihit->energy(); if (debug) - std::cout << "Hit " << *ihit << std::endl; + edm::LogVerbatim("IsoTrack") << "Hit " << *ihit; } } } @@ -575,10 +583,10 @@ namespace spr { if (debug) { if (trkInfo != SimTk->end()) { - std::cout << "In eCaloSimInfo:: matchSimTrk:" << trkInfo->trackId() << " matchedId " << trkInfo->type() - << std::endl; + edm::LogVerbatim("IsoTrack") << "In eCaloSimInfo:: matchSimTrk:" << trkInfo->trackId() << " matchedId " + << trkInfo->type(); } else { - std::cout << "In eCaloSimInfo:: not valid track pointer" << std::endl; + edm::LogVerbatim("IsoTrack") << "In eCaloSimInfo:: not valid track pointer"; } } @@ -637,11 +645,12 @@ namespace spr { edm::SimTrackContainer::const_iterator parentItr = spr::parentSimTrack(simTrkItr, SimTk, SimVtx, debug); if (debug) { if (parentItr != SimTk->end()) { - std::cout << "original parent of " << simTrkItr->trackId() << " " << parentItr->trackId() << ", " - << parentItr->type() << " Energy " << spr::getEnergy(hit[ihit]) << std::endl; + edm::LogVerbatim("IsoTrack") + << "original parent of " << simTrkItr->trackId() << " " << parentItr->trackId() << ", " + << parentItr->type() << " Energy " << spr::getEnergy(hit[ihit]); } else { - std::cout << "original parent of " << simTrkItr->trackId() << " not found; Energy " - << spr::getEnergy(hit[ihit]) << std::endl; + edm::LogVerbatim("IsoTrack") << "original parent of " << simTrkItr->trackId() + << " not found; Energy " << spr::getEnergy(hit[ihit]); } } if (parentItr == SimTk->end()) { @@ -678,17 +687,10 @@ namespace spr { } if (debug) - std::cout << "Hit " << ihit << ": " << *hit[ihit] << std::endl; + edm::LogVerbatim("IsoTrack") << "Hit " << ihit << ": " << *hit[ihit]; } // else condition, i.e. (hit[ihit]->geantTrackId() != (int)matchSimTrk ) } // loop over hits - - // std::cout << "nHits = " << nHits << "\n" - // << "nGamma = " << nGamma << "\n" - // << "nNeutralHad = " << nNeutralHad << "\n" - // << "nChargedHad = " << nChargedHad << "\n" - // << "nRest = " << nRest << std::endl; - - } // if (trkInfo != SimTk->end()) + } // if (trkInfo != SimTk->end()) double energyTot = energySum + energyGamma + energyNeutral + energyCharged + energyRest; multiplicityVector.push_back(uniqueIds_matched.size()); @@ -707,11 +709,526 @@ namespace spr { simInfo.insert(std::pair("eRest", energyRest)); simInfo.insert(std::pair("eTotal", energyTot)); if (debug) { - std::cout << " energySum " << energySum << " energyGamma " << energyGamma << " energyNeutral " << energyNeutral - << " energyCharged " << energyCharged << " energyRest " << energyRest << " energyTot " << energyTot - << std::endl; + edm::LogVerbatim("IsoTrack") << " energySum " << energySum << " energyGamma " << energyGamma + << " energyNeutral " << energyNeutral << " energyCharged " << energyCharged + << " energyRest " << energyRest << " energyTot " << energyTot; } return simInfo; } // eCaloSimInfo + template + std::map eECALSimInfo(const edm::Event& iEvent, + CaloNavigator& navigator, + const CaloGeometry* geo, + edm::Handle& hits, + edm::Handle& SimTk, + edm::Handle& SimVtx, + const reco::Track* pTrack, + TrackerHitAssociator& associate, + int ieta, + int iphi, + double timeCut, + bool debug) { + if (debug) + edm::LogVerbatim("IsoTrack") << "Processing eECALSimInfo " << 2 * ieta + 1 << "x" << 2 * iphi + 1 << "\ntrkMom " + << pTrack->p() << " eta " << pTrack->eta() << " trkRecHits " + << pTrack->recHitsSize(); + + //matching SimTrack + edm::SimTrackContainer::const_iterator trkInfo = + spr::matchedSimTrack(iEvent, SimTk, SimVtx, pTrack, associate, debug); + //vector of Ecal hits in NxN + std::vector ecalHits; + spr::hitECALmatrix(navigator, hits, ieta, iphi, ecalHits, debug); + + // return a map of matching type and energy of SimHits + spr::caloSimInfo info; + spr::eCaloSimInfo(geo, hits, SimTk, SimVtx, ecalHits, trkInfo, info, timeCut, false, debug); + return spr::eCaloSimInfo(info); + } + + template + std::map eECALSimInfoTotal(const edm::Event& iEvent, + const DetId& det, + const CaloGeometry* geo, + const CaloTopology* caloTopology, + edm::Handle& hitsEB, + edm::Handle& hitsEE, + edm::Handle& SimTk, + edm::Handle& SimVtx, + const reco::Track* pTrack, + TrackerHitAssociator& associate, + int ieta, + int iphi, + int itry, + double timeCut, + bool debug) { + if (debug) + edm::LogVerbatim("IsoTrack") << "Processing eECALSimInfo " << 2 * ieta + 1 << "x" << 2 * iphi + 1 << "\ntrkMom " + << pTrack->p() << " eta " << pTrack->eta() << " trkRecHits " + << pTrack->recHitsSize(); + + //matching SimTrack + edm::SimTrackContainer::const_iterator trkInfo = + spr::matchedSimTrack(iEvent, SimTk, SimVtx, pTrack, associate, debug); + + spr::EtaPhi etaphi = spr::getEtaPhi(ieta, iphi, debug); + std::map simInfo; + + if (itry >= 0) { + //vector of Ecal cells in NxN + std::vector vdets = spr::matrixECALIds( + det, etaphi.ietaE[itry], etaphi.ietaW[itry], etaphi.iphiN[itry], etaphi.iphiS[itry], geo, caloTopology, debug); + // get a map of matching type and energy of SimHits + spr::caloSimInfo info; + spr::eCaloSimInfo(vdets, geo, hitsEB, hitsEE, SimTk, SimVtx, trkInfo, info, timeCut, debug); + simInfo = spr::eCaloSimInfo(info); + } else { + int itrym = 0; + std::vector vdets = spr::matrixECALIds(det, + etaphi.ietaE[itrym], + etaphi.ietaW[itrym], + etaphi.iphiN[itrym], + etaphi.iphiS[itrym], + geo, + caloTopology, + debug); + // get a map of matching type and energy of SimHits + spr::caloSimInfo info; + spr::eCaloSimInfo(vdets, geo, hitsEB, hitsEE, SimTk, SimVtx, trkInfo, info, timeCut, debug); + simInfo = spr::eCaloSimInfo(info); + for (int itrys = 1; itrys < etaphi.ntrys; ++itrys) { + vdets = spr::matrixECALIds(det, + etaphi.ietaE[itrys], + etaphi.ietaW[itrys], + etaphi.iphiN[itrys], + etaphi.iphiS[itrys], + geo, + caloTopology, + debug); + // get a map of matching type and energy of SimHits + spr::caloSimInfo infox; + spr::eCaloSimInfo(vdets, geo, hitsEB, hitsEE, SimTk, SimVtx, trkInfo, infox, timeCut, debug); + std::map simInfoX = spr::eCaloSimInfo(infox); + if (simInfoX["eTotal"] > simInfo["eTotal"]) { + simInfo = simInfoX; + itrym = itrys; + } + } + } + return simInfo; + } + + template + std::map eHCALSimInfoTotal(const edm::Event& iEvent, + const HcalTopology* topology, + const DetId& det, + const CaloGeometry* geo, + edm::Handle& hits, + edm::Handle& SimTk, + edm::Handle& SimVtx, + const reco::Track* pTrack, + TrackerHitAssociator& associate, + int ieta, + int iphi, + int itry, + double timeCut, + bool includeHO, + bool debug) { + if (debug) + edm::LogVerbatim("IsoTrack") << "Processing eHCALSimInfo " << 2 * ieta + 1 << "x" << 2 * iphi + 1 << "\ntrkMom " + << pTrack->p() << " eta " << pTrack->eta() << " trkRecHits " + << pTrack->recHitsSize(); + + // get the matching SimTrack pointer + edm::SimTrackContainer::const_iterator trkInfo = + spr::matchedSimTrack(iEvent, SimTk, SimVtx, pTrack, associate, debug); + + spr::EtaPhi etaphi = spr::getEtaPhi(ieta, iphi, debug); + std::map simInfo; + + if (itry >= 0) { + // get the hits in Hcal in NxN around det + std::vector hit; + spr::hitHCALmatrixTotal(topology, + det, + hits, + etaphi.ietaE[itry], + etaphi.ietaW[itry], + etaphi.iphiN[itry], + etaphi.iphiS[itry], + hit, + false, + debug); + spr::caloSimInfo info; + spr::eCaloSimInfo(geo, hits, SimTk, SimVtx, hit, trkInfo, info, timeCut, includeHO, debug); + simInfo = spr::eCaloSimInfo(info); + } else { + int itrym = 0; + std::vector hit; + spr::hitHCALmatrixTotal(topology, + det, + hits, + etaphi.ietaE[itrym], + etaphi.ietaW[itrym], + etaphi.iphiN[itrym], + etaphi.iphiS[itrym], + hit, + includeHO, + debug); + spr::caloSimInfo info; + spr::eCaloSimInfo(geo, hits, SimTk, SimVtx, hit, trkInfo, info, timeCut, includeHO, debug); + simInfo = spr::eCaloSimInfo(info); + for (int itrys = 1; itrys < etaphi.ntrys; ++itrys) { + hit.clear(); + spr::hitHCALmatrixTotal(topology, + det, + hits, + etaphi.ietaE[itrys], + etaphi.ietaW[itrys], + etaphi.iphiN[itrys], + etaphi.iphiS[itrys], + hit, + includeHO, + debug); + spr::caloSimInfo infox; + spr::eCaloSimInfo(geo, hits, SimTk, SimVtx, hit, trkInfo, infox, timeCut, includeHO, debug); + std::map simInfoX = spr::eCaloSimInfo(infox); + if (simInfoX["eTotal"] > simInfo["eTotal"]) { + simInfo = simInfoX; + itrym = itrys; + } + } + } + return simInfo; + } + + template + spr::energyMap eHCALSimInfoMatrix(const edm::Event& iEvent, + const HcalTopology* topology, + const DetId& det, + const CaloGeometry* geo, + edm::Handle& hits, + edm::Handle& SimTk, + edm::Handle& SimVtx, + const reco::Track* pTrack, + TrackerHitAssociator& associate, + int ieta, + int iphi, + double timeCut, + bool includeHO, + bool debug) { + if (debug) + edm::LogVerbatim("IsoTrack") << "Processing eHCALSimInfoMatrix " << 2 * ieta + 1 << "x" << 2 * iphi + 1 + << "\ntrkMom " << pTrack->p() << " eta " << pTrack->eta() << " trkRecHits " + << pTrack->recHitsSize(); + + // get the matching SimTrack pointer + edm::SimTrackContainer::const_iterator trkInfo = + spr::matchedSimTrack(iEvent, SimTk, SimVtx, pTrack, associate, debug); + + // get the hits in Hcal in NxN around det + std::vector hit; + spr::hitHCALmatrix(topology, det, hits, ieta, iphi, hit, includeHO, debug); + + return spr::caloSimInfoMatrix(geo, hits, SimTk, SimVtx, hit, trkInfo, timeCut, includeHO, debug); + } + + template + spr::energyMap caloSimInfoMatrix(const CaloGeometry* geo, + edm::Handle& hits, + edm::Handle& SimTk, + edm::Handle& SimVtx, + std::vector hit, + edm::SimTrackContainer::const_iterator trkInfo, + double timeCut, + bool includeHO, + bool debug) { + int matchedId = 0; //pdgid + + if (debug) { + if (trkInfo != SimTk->end()) + edm::LogVerbatim("IsoTrack") << "In eCaloSimInfo:: matchSimTrk:" << trkInfo->trackId() << " matchedId " + << trkInfo->type(); + else + edm::LogVerbatim("IsoTrack") << "In eCaloSimInfo:: not valid track pointer"; + } + + std::vector > detSum, detGamma, detCharged, detNeutral, detRest, detAll; + + if (trkInfo != SimTk->end()) { + unsigned int matchSimTrk = trkInfo->trackId(); + matchedId = trkInfo->type(); //pdgid + + edm::SimTrackContainer::const_iterator simTrkItr; + + for (unsigned int ihit = 0; ihit < hit.size(); ihit++) { + DetId id_ = (DetId)(hit[ihit]->id()); + double tof = timeOfFlight(id_, geo, debug); + double energySum = 0, energyRest = 0; + double energyGamma = 0, energyNeutral = 0, energyCharged = 0; + bool ok = true; + if (((int)(id_.det()) == 4) && (id_.subdetId() == (int)(HcalForward))) + ok = false; + if ((!includeHO) && ((int)(id_.det()) == 4) && (id_.subdetId() == (int)(HcalOuter))) + ok = false; + if ((hit[ihit]->time() <= (tof + timeCut)) && ok) { + // if the hitId matches with matching trackId + if (hit[ihit]->geantTrackId() == (int)matchSimTrk) { + energySum = hit[ihit]->energy(); + } else { + // trace back the history and check the pdgId of origin SimTrack of SimHit + bool found = false; + for (simTrkItr = SimTk->begin(); simTrkItr != SimTk->end(); simTrkItr++) { + if (hit[ihit]->geantTrackId() == (int)simTrkItr->trackId()) { + found = true; + bool match = spr::validSimTrack(matchSimTrk, simTrkItr, SimTk, SimVtx, debug); + if (match) { + energySum = hit[ihit]->energy(); + } else { + edm::SimTrackContainer::const_iterator parentItr = + spr::parentSimTrack(simTrkItr, SimTk, SimVtx, debug); + if (debug) { + if (parentItr != SimTk->end()) + edm::LogVerbatim("IsoTrack") + << "original parent of " << simTrkItr->trackId() << " " << parentItr->trackId() << ", " + << parentItr->type() << " Energy " << hit[ihit]->energy(); + else + edm::LogVerbatim("IsoTrack") << "original parent of " << simTrkItr->trackId() + << " not found; Energy " << hit[ihit]->energy(); + } + if (parentItr == SimTk->end()) { + energyRest = hit[ihit]->energy(); + } else if (parentItr->type() == 22) { + energyGamma = hit[ihit]->energy(); + } else if ((int)parentItr->charge() == 0) { + energyNeutral = hit[ihit]->energy(); + } else + energyCharged = hit[ihit]->energy(); + } + break; + } + } + if (!found) + energyRest = hit[ihit]->energy(); + if (debug) + edm::LogVerbatim("IsoTrack") << "Hit " << ihit << ": " << *hit[ihit]; + found = false; + if (energySum > 0) { + for (unsigned int k = 0; k < detSum.size(); k++) { + if (id_ == detSum[k].first) { + found = true; + detSum[k].second += energySum; + break; + } + } + if (!found) + detSum.push_back(std::pair(id_, energySum)); + } else if (energyRest > 0) { + for (unsigned int k = 0; k < detRest.size(); k++) { + if (id_ == detRest[k].first) { + found = true; + detRest[k].second += energyRest; + break; + } + } + if (!found) + detRest.push_back(std::pair(id_, energyRest)); + } else if (energyGamma > 0) { + for (unsigned int k = 0; k < detGamma.size(); k++) { + if (id_ == detGamma[k].first) { + found = true; + detGamma[k].second += energyGamma; + break; + } + } + if (!found) + detGamma.push_back(std::pair(id_, energyGamma)); + } else if (energyCharged > 0) { + for (unsigned int k = 0; k < detCharged.size(); k++) { + if (id_ == detCharged[k].first) { + found = true; + detCharged[k].second += energyCharged; + break; + } + } + if (!found) + detCharged.push_back(std::pair(id_, energyCharged)); + } else if (energyNeutral > 0) { + for (unsigned int k = 0; k < detNeutral.size(); k++) { + if (id_ == detNeutral[k].first) { + found = true; + detNeutral[k].second += energyNeutral; + break; + } + } + if (!found) + detNeutral.push_back(std::pair(id_, energyNeutral)); + } + found = false; + double energyTot = energySum + energyGamma + energyNeutral + energyCharged + energyRest; + for (unsigned int k = 0; k < detAll.size(); k++) { + if (id_ == detAll[k].first) { + found = true; + detAll[k].second += energyTot; + break; + } + } + if (!found) + detAll.push_back(std::pair(id_, energyTot)); + } + } + } // loop over hits + } + + spr::energyMap simInfo; + simInfo.pdgId = matchedId; + simInfo.matched = detSum; + simInfo.gamma = detGamma; + simInfo.charged = detCharged; + simInfo.neutral = detNeutral; + simInfo.rest = detRest; + simInfo.all = detAll; + if (debug) { + edm::LogVerbatim("IsoTrack") << "CaloSimInfo:: for particle " << simInfo.pdgId << "\n" + << "All detIds " << detAll.size(); + for (unsigned int k = 0; k < detAll.size(); ++k) + edm::LogVerbatim("IsoTrack") << k << " detId 0x" << std::hex << detAll[k].first.rawId() << std::dec + << detAll[k].second; + edm::LogVerbatim("IsoTrack") << "Matched detIds" << detSum.size(); + for (unsigned int k = 0; k < detSum.size(); ++k) + edm::LogVerbatim("IsoTrack") << k << " detId 0x" << std::hex << detSum[k].first.rawId() << std::dec + << detSum[k].second; + edm::LogVerbatim("IsoTrack") << "Gamma detIds" << detGamma.size(); + for (unsigned int k = 0; k < detGamma.size(); ++k) + edm::LogVerbatim("IsoTrack") << k << " detId 0x" << std::hex << detGamma[k].first.rawId() << std::dec + << detGamma[k].second; + edm::LogVerbatim("IsoTrack") << "Charged detIds" << detSum.size(); + for (unsigned int k = 0; k < detCharged.size(); ++k) + edm::LogVerbatim("IsoTrack") << k << " detId 0x" << std::hex << detCharged[k].first.rawId() << std::dec + << detCharged[k].second; + edm::LogVerbatim("IsoTrack") << "Neutral detIds" << detNeutral.size(); + for (unsigned int k = 0; k < detNeutral.size(); ++k) + edm::LogVerbatim("IsoTrack") << k << " detId 0x" << std::hex << detNeutral[k].first.rawId() << std::dec + << detNeutral[k].second; + edm::LogVerbatim("IsoTrack") << "Rest detIds" << detRest.size(); + for (unsigned int k = 0; k < detRest.size(); ++k) + edm::LogVerbatim("IsoTrack") << k << " detId 0x" << std::hex << detRest[k].first.rawId() << std::dec + << detRest[k].second; + } + return simInfo; + } + + template + std::vector missedECALHits(const edm::Event& iEvent, + CaloNavigator& navigator, + edm::Handle& hits, + edm::Handle& SimTk, + edm::Handle& SimVtx, + const reco::Track* pTrack, + TrackerHitAssociator& associate, + int ieta, + int iphi, + bool flag, + bool debug) { + if (debug) { + edm::LogVerbatim("IsoTrack") << "Processing missedECALHits " << 2 * ieta + 1 << "x" << 2 * iphi + 1 + << " and Flag " << flag; + edm::LogVerbatim("IsoTrack") << "trkMom " << pTrack->p() << " eta " << pTrack->eta() << " trkRecHits " + << pTrack->recHitsSize(); + } + + std::vector ecalHits; + spr::hitECALmatrix(navigator, hits, ieta, iphi, ecalHits, debug); + + std::vector matchedId = spr::matchedSimTrackId(iEvent, SimTk, SimVtx, pTrack, associate, debug); + + return spr::missedCaloHits(hits, matchedId, ecalHits, flag, false, debug); + } + + template + std::vector missedHCALHits(const edm::Event& iEvent, + const HcalTopology* topology, + const DetId& det, + edm::Handle& hits, + edm::Handle& SimTk, + edm::Handle& SimVtx, + const reco::Track* pTrack, + TrackerHitAssociator& associate, + int ieta, + int iphi, + bool flag, + bool includeHO, + bool debug) { + if (debug) { + edm::LogVerbatim("IsoTrack") << "Processing missedHCALHits " << 2 * ieta + 1 << "x" << 2 * iphi + 1 + << " and Flag " << flag; + edm::LogVerbatim("IsoTrack") << "trkMom " << pTrack->p() << " eta " << pTrack->eta() << " trkRecHits " + << pTrack->recHitsSize(); + } + + std::vector hit; + spr::hitHCALmatrix(topology, det, hits, ieta, iphi, hit, includeHO, debug); + + std::vector matchedId = spr::matchedSimTrackId(iEvent, SimTk, SimVtx, pTrack, associate, debug); + + return spr::missedCaloHits(hits, matchedId, hit, flag, includeHO, debug); + } + + template + std::vector missedCaloHits(edm::Handle& hits, + std::vector matchedId, + std::vector caloHits, + bool flag, + bool includeHO, + bool debug) { + std::vector missedHits; + std::vector usedHits; + if (!matchedId.empty()) { + typename T::const_iterator ihit; + for (ihit = hits->begin(); ihit != hits->end(); ihit++) { + int id = ihit->geantTrackId(); + bool found = false; + for (unsigned int it = 0; it < matchedId.size(); ++it) { + if (id == matchedId[it]) { + found = true; + break; + } + } + DetId id_ = (DetId)(ihit->id()); + bool ok = true; + if (((int)(id_.det()) == 4) && (id_.subdetId() == (int)(HcalForward))) + ok = false; + if ((!includeHO) && ((int)(id_.det()) == 4) && (id_.subdetId() == (int)(HcalOuter))) + ok = false; + if (found && ok) { + if (flag) { + if (count(caloHits.begin(), caloHits.end(), ihit) == 0) + missedHits.push_back(ihit); + } else { + usedHits.push_back(ihit); + } + } + } + } + if (!flag) { + for (unsigned int ii = 0; ii < caloHits.size(); ii++) { + DetId id_ = (DetId)(caloHits[ii]->id()); + bool ok = true; + if (((int)(id_.det()) == 4) && (id_.subdetId() == (int)(HcalForward))) + ok = false; + if ((!includeHO) && ((int)(id_.det()) == 4) && (id_.subdetId() == (int)(HcalOuter))) + ok = false; + if (count(usedHits.begin(), usedHits.end(), caloHits[ii]) == 0 && ok) + missedHits.push_back(caloHits[ii]); + } + } + if (debug) { + edm::LogVerbatim("IsoTrack") << "missedCaloHits finds " << missedHits.size() << " missed hits"; + for (unsigned int i = 0; i < missedHits.size(); i++) + edm::LogVerbatim("IsoTrack") << "Hit " << i << " " << *missedHits[i]; + } + return missedHits; + } + } // namespace spr diff --git a/Calibration/IsolatedParticles/interface/CaloSimInfoExtra.icc b/Calibration/IsolatedParticles/interface/CaloSimInfoExtra.icc deleted file mode 100644 index e88c2f78fe025..0000000000000 --- a/Calibration/IsolatedParticles/interface/CaloSimInfoExtra.icc +++ /dev/null @@ -1,360 +0,0 @@ -#include "Calibration/IsolatedParticles/interface/MatchingSimTrack.h" -#include "Calibration/IsolatedParticles/interface/eHCALMatrix.h" -#include "Calibration/IsolatedParticles/interface/eECALMatrix.h" -#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" - -#include -#include - -namespace spr{ - - template - std::map eECALSimInfo(const edm::Event& iEvent, CaloNavigator& navigator, const CaloGeometry* geo, edm::Handle& hits, edm::Handle& SimTk, edm::Handle& SimVtx, const reco::Track* pTrack, TrackerHitAssociator& associate, int ieta, int iphi, double timeCut, bool debug) { - - if (debug) - std::cout << "Processing eECALSimInfo " << 2*ieta+1 << "x"<< 2*iphi+1 << "\ntrkMom " << pTrack->p() << " eta " << pTrack->eta() << " trkRecHits " << pTrack->recHitsSize() << std::endl; - - //matching SimTrack - edm::SimTrackContainer::const_iterator trkInfo = spr::matchedSimTrack(iEvent, SimTk, SimVtx, pTrack, associate, debug); - //vector of Ecal hits in NxN - std::vector< typename T::const_iterator> ecalHits; - spr::hitECALmatrix(navigator,hits,ieta,iphi,ecalHits,debug); - - // return a map of matching type and energy of SimHits - spr::caloSimInfo info; - spr::eCaloSimInfo(geo, hits, SimTk, SimVtx, ecalHits, trkInfo, info, timeCut, false, debug); - return spr::eCaloSimInfo(info); - } - - template - std::map eECALSimInfoTotal(const edm::Event& iEvent, const DetId& det, const CaloGeometry* geo, const CaloTopology* caloTopology, edm::Handle& hitsEB, edm::Handle& hitsEE, edm::Handle& SimTk, edm::Handle& SimVtx, const reco::Track* pTrack, TrackerHitAssociator& associate, int ieta, int iphi, int itry, double timeCut, bool debug) { - - if (debug) - std::cout << "Processing eECALSimInfo " << 2*ieta+1 << "x" << 2*iphi+1 << "\ntrkMom " << pTrack->p() << " eta " << pTrack->eta() << " trkRecHits " << pTrack->recHitsSize() << std::endl; - - //matching SimTrack - edm::SimTrackContainer::const_iterator trkInfo = spr::matchedSimTrack(iEvent, SimTk, SimVtx, pTrack, associate, debug); - - spr::EtaPhi etaphi = spr::getEtaPhi(ieta,iphi,debug); - std::map simInfo; - - if (itry >= 0) { - //vector of Ecal cells in NxN - std::vector vdets = spr::matrixECALIds(det, etaphi.ietaE[itry], etaphi.ietaW[itry], etaphi.iphiN[itry], etaphi.iphiS[itry], geo, caloTopology, debug); - // get a map of matching type and energy of SimHits - spr::caloSimInfo info; - spr::eCaloSimInfo(vdets, geo, hitsEB, hitsEE, SimTk, SimVtx, trkInfo, info, timeCut, debug); - simInfo = spr::eCaloSimInfo(info); - } else { - int itrym = 0; - std::vector vdets = spr::matrixECALIds(det, etaphi.ietaE[itrym], etaphi.ietaW[itrym], etaphi.iphiN[itrym], etaphi.iphiS[itrym], geo, caloTopology, debug); - // get a map of matching type and energy of SimHits - spr::caloSimInfo info; - spr::eCaloSimInfo(vdets, geo, hitsEB, hitsEE, SimTk, SimVtx, trkInfo, info, timeCut, debug); - simInfo = spr::eCaloSimInfo(info); - for (int itrys=1; itrys simInfoX = spr::eCaloSimInfo(infox); - if (simInfoX["eTotal"] > simInfo["eTotal"]) { - simInfo = simInfoX; - itrym = itrys; - } - } - } - return simInfo; - } - - template - std::map eHCALSimInfoTotal(const edm::Event& iEvent, const HcalTopology* topology, const DetId& det, const CaloGeometry* geo, edm::Handle& hits,edm::Handle& SimTk, edm::Handle& SimVtx, const reco::Track* pTrack, TrackerHitAssociator& associate, int ieta, int iphi, int itry, double timeCut, bool includeHO, bool debug) { - - if (debug) - std::cout << "Processing eHCALSimInfo " << 2*ieta+1 << "x" << 2*iphi+1 << "\ntrkMom " << pTrack->p() << " eta " << pTrack->eta() << " trkRecHits " << pTrack->recHitsSize() << std::endl; - - // get the matching SimTrack pointer - edm::SimTrackContainer::const_iterator trkInfo = spr::matchedSimTrack(iEvent, SimTk, SimVtx, pTrack,associate, debug); - - spr::EtaPhi etaphi = spr::getEtaPhi(ieta,iphi,debug); - std::map simInfo; - - if (itry >= 0) { - // get the hits in Hcal in NxN around det - std::vector< typename T::const_iterator> hit; - spr::hitHCALmatrixTotal(topology,det,hits,etaphi.ietaE[itry],etaphi.ietaW[itry],etaphi.iphiN[itry],etaphi.iphiS[itry],hit,false, debug); - spr::caloSimInfo info; - spr::eCaloSimInfo(geo, hits, SimTk, SimVtx, hit, trkInfo, info, timeCut, includeHO, debug); - simInfo = spr::eCaloSimInfo(info); - } else { - int itrym = 0; - std::vector< typename T::const_iterator> hit; - spr::hitHCALmatrixTotal(topology,det,hits,etaphi.ietaE[itrym],etaphi.ietaW[itrym],etaphi.iphiN[itrym],etaphi.iphiS[itrym],hit,includeHO,debug); - spr::caloSimInfo info; - spr::eCaloSimInfo(geo, hits, SimTk, SimVtx, hit, trkInfo, info, timeCut, includeHO, debug); - simInfo = spr::eCaloSimInfo(info); - for (int itrys = 1; itrys < etaphi.ntrys; ++itrys) { - hit.clear(); - spr::hitHCALmatrixTotal(topology,det,hits,etaphi.ietaE[itrys],etaphi.ietaW[itrys],etaphi.iphiN[itrys],etaphi.iphiS[itrys],hit,includeHO,debug); - spr::caloSimInfo infox; - spr::eCaloSimInfo(geo, hits, SimTk, SimVtx, hit, trkInfo, infox, timeCut, includeHO, debug); - std::map simInfoX = spr::eCaloSimInfo(infox); - if (simInfoX["eTotal"] > simInfo["eTotal"]) { - simInfo = simInfoX; - itrym = itrys; - } - } - } - return simInfo; - } - - template - spr::energyMap eHCALSimInfoMatrix(const edm::Event& iEvent, const HcalTopology* topology, const DetId& det, const CaloGeometry* geo, edm::Handle& hits,edm::Handle& SimTk, edm::Handle& SimVtx, const reco::Track* pTrack, TrackerHitAssociator& associate, int ieta, int iphi, double timeCut, bool includeHO, bool debug) { - - if (debug) - std::cout << "Processing eHCALSimInfoMatrix " << 2*ieta+1 << "x" << 2*iphi+1 << "\ntrkMom " << pTrack->p() << " eta " << pTrack->eta() << " trkRecHits " << pTrack->recHitsSize() << std::endl; - - // get the matching SimTrack pointer - edm::SimTrackContainer::const_iterator trkInfo = spr::matchedSimTrack(iEvent, SimTk, SimVtx, pTrack,associate, debug); - - // get the hits in Hcal in NxN around det - std::vector< typename T::const_iterator> hit; - spr::hitHCALmatrix(topology,det,hits,ieta,iphi,hit,includeHO,debug); - - return spr::caloSimInfoMatrix(geo, hits, SimTk, SimVtx, hit, trkInfo, timeCut, includeHO, debug); - } - - template - spr::energyMap caloSimInfoMatrix(const CaloGeometry* geo, edm::Handle& hits, edm::Handle& SimTk, edm::Handle& SimVtx, std::vector< typename T::const_iterator> hit, edm::SimTrackContainer::const_iterator trkInfo, double timeCut, bool includeHO, bool debug){ - - int matchedId = 0; //pdgid - - if (debug) { - if( trkInfo != SimTk->end()) std::cout <<"In eCaloSimInfo:: matchSimTrk:"<< trkInfo->trackId() << " matchedId " << trkInfo->type() << std::endl; - else std::cout <<"In eCaloSimInfo:: not valid track pointer" << std::endl; - } - - std::vector > detSum, detGamma, detCharged, detNeutral, detRest, detAll; - - if (trkInfo != SimTk->end()) { - - unsigned int matchSimTrk = trkInfo->trackId(); - matchedId = trkInfo->type(); //pdgid - - edm::SimTrackContainer::const_iterator simTrkItr; - edm::SimVertexContainer::const_iterator simVtxItr; - - for (unsigned int ihit=0; ihitid()); - double tof = timeOfFlight(id_, geo, debug); - double energySum = 0, energyRest=0; - double energyGamma=0, energyNeutral=0, energyCharged=0; - bool ok = true; - if (((int)(id_.det())==4) && (id_.subdetId()==(int)(HcalForward))) ok = false; - if ((!includeHO) && ((int)(id_.det())==4) && (id_.subdetId()==(int)(HcalOuter))) ok = false; - if ((hit[ihit]->time() <= (tof+timeCut)) && ok) { - - // if the hitId matches with matching trackId - if (hit[ihit]->geantTrackId() == (int)matchSimTrk ) { - energySum = hit[ihit]->energy(); - } else { - // trace back the history and check the pdgId of origin SimTrack of SimHit - bool found = false; - for (simTrkItr = SimTk->begin(); simTrkItr!= SimTk->end(); simTrkItr++) { - if (hit[ihit]->geantTrackId() == (int)simTrkItr->trackId()) { - found = true; - bool match = spr::validSimTrack(matchSimTrk, simTrkItr, SimTk, SimVtx, debug); - if (match) {energySum = hit[ihit]->energy();} - else { - edm::SimTrackContainer::const_iterator parentItr = spr::parentSimTrack(simTrkItr, SimTk, SimVtx, debug); - if (debug) { - if (parentItr != SimTk->end() ) std::cout << "original parent of " << simTrkItr->trackId() << " " << parentItr->trackId() << ", " << parentItr->type() << " Energy " << hit[ihit]->energy() << std::endl; - else std::cout << "original parent of " << simTrkItr->trackId() << " not found; Energy " << hit[ihit]->energy() << std::endl; - } - if (parentItr == SimTk->end() ) { energyRest = hit[ihit]->energy();} - else if (parentItr->type() == 22) { energyGamma = hit[ihit]->energy();} - else if ((int)parentItr->charge()== 0) { energyNeutral = hit[ihit]->energy();} - else energyCharged = hit[ihit]->energy(); - } - break; - } - } - if (!found) energyRest = hit[ihit]->energy(); - if (debug) std::cout << "Hit " << ihit << ": " << *hit[ihit] << std::endl; - found = false; - if (energySum > 0) { - for (unsigned int k=0; k(id_,energySum)); - } else if (energyRest > 0) { - for (unsigned int k=0; k(id_,energyRest)); - } else if (energyGamma > 0) { - for (unsigned int k=0; k(id_,energyGamma)); - } else if (energyCharged > 0) { - for (unsigned int k=0; k(id_,energyCharged)); - } else if (energyNeutral > 0) { - for (unsigned int k=0; k(id_,energyNeutral)); - } - found = false; - double energyTot = energySum+energyGamma+energyNeutral+energyCharged+energyRest; - for (unsigned int k=0; k(id_,energyTot)); - } - } - } // loop over hits - } - - spr::energyMap simInfo; - simInfo.pdgId = matchedId; - simInfo.matched = detSum; - simInfo.gamma = detGamma; - simInfo.charged = detCharged; - simInfo.neutral = detNeutral; - simInfo.rest = detRest; - simInfo.all = detAll; - if (debug) { - std::cout << "CaloSimInfo:: for particle " << simInfo.pdgId << "\n" - << "All detIds " << detAll.size() << "\n"; - for (unsigned int k=0; k - std::vector missedECALHits(const edm::Event& iEvent, CaloNavigator& navigator, edm::Handle& hits,edm::Handle& SimTk, edm::Handle& SimVtx, const reco::Track* pTrack, TrackerHitAssociator& associate, int ieta, int iphi, bool flag, bool debug) { - - if (debug) { - std::cout << "Processing missedECALHits " << 2*ieta+1 << "x" << 2*iphi+1 << " and Flag " << flag << std::endl; - std::cout << "trkMom " << pTrack->p() << " eta " << pTrack->eta() << " trkRecHits " << pTrack->recHitsSize() << std::endl; - } - - edm::SimTrackContainer::const_iterator trkInfo = spr::matchedSimTrack(iEvent, SimTk, SimVtx, pTrack, associate, debug); - - std::vector< typename T::const_iterator> ecalHits; - spr::hitECALmatrix(navigator,hits,ieta,iphi,ecalHits,debug); - - std::vector matchedId = spr::matchedSimTrackId(iEvent, SimTk, SimVtx, pTrack, associate, debug); - - return spr::missedCaloHits(hits, matchedId, ecalHits, flag, false, debug); - } - - template - std::vector missedHCALHits(const edm::Event& iEvent, const HcalTopology* topology, const DetId& det, edm::Handle& hits,edm::Handle& SimTk, edm::Handle& SimVtx, const reco::Track* pTrack, TrackerHitAssociator& associate, int ieta, int iphi, bool flag, bool includeHO, bool debug) { - - if (debug) { - std::cout << "Processing missedHCALHits " << 2*ieta+1 << "x" << 2*iphi+1 << " and Flag " << flag << std::endl; - std::cout << "trkMom " << pTrack->p() << " eta " << pTrack->eta() << " trkRecHits " << pTrack->recHitsSize() << std::endl; - } - - edm::SimTrackContainer::const_iterator trkInfo = spr::matchedSimTrack(iEvent, SimTk, SimVtx, pTrack,associate, debug); - - std::vector< typename T::const_iterator> hit; - spr::hitHCALmatrix(topology,det,hits,ieta,iphi,hit,includeHO,debug); - - std::vector matchedId = spr::matchedSimTrackId(iEvent, SimTk, SimVtx, pTrack, associate, debug); - - return spr::missedCaloHits(hits, matchedId, hit, flag, includeHO, debug); - } - - template - std::vector missedCaloHits(edm::Handle& hits, std::vector matchedId, std::vector< typename T::const_iterator> caloHits, bool flag, bool includeHO, bool debug ) { - - std::vector missedHits; - std::vector usedHits; - if (matchedId.size() > 0) { - typename T::const_iterator ihit; - for (ihit=hits->begin(); ihit!=hits->end(); ihit++) { - int id = ihit->geantTrackId(); - bool found = false; - for (unsigned int it = 0; it < matchedId.size(); ++it) { - if (id == matchedId[it]) { - found = true; break; - } - } - DetId id_ = (DetId)(ihit->id()); - bool ok = true; - if (((int)(id_.det())==4) && (id_.subdetId()==(int)(HcalForward))) ok = false; - if ((!includeHO) && ((int)(id_.det())==4) && (id_.subdetId()==(int)(HcalOuter))) ok = false; - if (found && ok) { - if (flag) { - if (count(caloHits.begin(),caloHits.end(),ihit) == 0) missedHits.push_back(ihit); - } else { - usedHits.push_back(ihit); - } - } - } - } - if (!flag) { - for (unsigned int ii=0; iiid()); - bool ok = true; - if (((int)(id_.det())==4) && (id_.subdetId()==(int)(HcalForward))) ok = false; - if ((!includeHO) && ((int)(id_.det())==4) && (id_.subdetId()==(int)(HcalOuter))) ok = false; - if (count(usedHits.begin(),usedHits.end(),caloHits[ii]) == 0 && ok) missedHits.push_back(caloHits[ii]); - } - } - if (debug) { - std::cout << "missedCaloHits finds " << missedHits.size() << " missed hits" << std::endl; - for (unsigned int i=0; i& trkDirs, double dR, int& nNearTRKs, bool debug = false); + std::pair chargeIsolationCone(unsigned int trkIndex, std::vector& trkDirs, double dR, @@ -119,6 +122,50 @@ namespace spr { const GlobalVector& trackMom, double dR); + double chargeIsolation(const edm::Event& iEvent, + const edm::EventSetup& iSetup, + CaloNavigator& navigator, + reco::TrackCollection::const_iterator trkItr, + edm::Handle trkCollection, + const CaloSubdetectorGeometry* gEB, + const CaloSubdetectorGeometry* gEE, + TrackDetectorAssociator& associator, + TrackAssociatorParameters& parameters_, + int ieta, + int iphi, + const std::string& theTrackQuality, + bool debug = false); + + bool chargeIsolation(const DetId anyCell, CaloNavigator& navigator, int deta, int dphi); + + double chargeIsolationEcal(const edm::Event& iEvent, + const edm::EventSetup& iSetup, + const DetId& coreDet, + reco::TrackCollection::const_iterator trkItr, + edm::Handle trkCollection, + const CaloGeometry* geo, + const CaloTopology* caloTopology, + TrackDetectorAssociator& associator, + TrackAssociatorParameters& parameters_, + int ieta, + int iphi, + const std::string& theTrackQuality, + bool debug = false); + + double chargeIsolationHcal(const edm::Event& iEvent, + const edm::EventSetup& iSetup, + reco::TrackCollection::const_iterator trkItr, + edm::Handle trkCollection, + const DetId ClosestCell, + const HcalTopology* topology, + const CaloSubdetectorGeometry* gHB, + TrackDetectorAssociator& associator, + TrackAssociatorParameters& parameters_, + int ieta, + int iphi, + const std::string& theTrackQuality, + bool debug = false); + } // namespace spr #endif diff --git a/Calibration/IsolatedParticles/interface/ChargeIsolationExtra.h b/Calibration/IsolatedParticles/interface/ChargeIsolationExtra.h deleted file mode 100644 index 2fe29b132aec4..0000000000000 --- a/Calibration/IsolatedParticles/interface/ChargeIsolationExtra.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef CalibrationIsolatedParticlesChargeIsolationExtra_h -#define CalibrationIsolatedParticlesChargeIsolationExtra_h - -// system include files -#include -#include -#include -#include -#include - -// user include files -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" - -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/DetId/interface/DetId.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/GeometryVector/interface/GlobalPoint.h" -#include "DataFormats/GeometryVector/interface/GlobalVector.h" - -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" -#include "Geometry/CaloTopology/interface/CaloTopology.h" -#include "Geometry/CaloTopology/interface/HcalTopology.h" -#include "MagneticField/Engine/interface/MagneticField.h" - -#include "TrackingTools/TrackAssociator/interface/TrackDetectorAssociator.h" -#include "RecoCaloTools/Navigation/interface/CaloNavigator.h" - -namespace spr { - - double chargeIsolation(const edm::Event& iEvent, - const edm::EventSetup& iSetup, - CaloNavigator& navigator, - reco::TrackCollection::const_iterator trkItr, - edm::Handle trkCollection, - const CaloSubdetectorGeometry* gEB, - const CaloSubdetectorGeometry* gEE, - TrackDetectorAssociator& associator, - TrackAssociatorParameters& parameters_, - int ieta, - int iphi, - const std::string& theTrackQuality, - bool debug = false); - - bool chargeIsolation(const DetId anyCell, CaloNavigator& navigator, int deta, int dphi); - - double chargeIsolationEcal(const edm::Event& iEvent, - const edm::EventSetup& iSetup, - const DetId& coreDet, - reco::TrackCollection::const_iterator trkItr, - edm::Handle trkCollection, - const CaloGeometry* geo, - const CaloTopology* caloTopology, - TrackDetectorAssociator& associator, - TrackAssociatorParameters& parameters_, - int ieta, - int iphi, - const std::string& theTrackQuality, - bool debug = false); - - double chargeIsolationHcal(const edm::Event& iEvent, - const edm::EventSetup& iSetup, - reco::TrackCollection::const_iterator trkItr, - edm::Handle trkCollection, - const DetId ClosestCell, - const HcalTopology* topology, - const CaloSubdetectorGeometry* gHB, - TrackDetectorAssociator& associator, - TrackAssociatorParameters& parameters_, - int ieta, - int iphi, - const std::string& theTrackQuality, - bool debug = false); - -} // namespace spr - -#endif diff --git a/Calibration/IsolatedParticles/interface/DebugInfo.h b/Calibration/IsolatedParticles/interface/DebugInfo.h index d696169d71fe6..28907b26245cd 100644 --- a/Calibration/IsolatedParticles/interface/DebugInfo.h +++ b/Calibration/IsolatedParticles/interface/DebugInfo.h @@ -1,13 +1,14 @@ #ifndef CalibrationIsolatedParticlesDebugInfo_h #define CalibrationIsolatedParticlesDebugInfo_h +#include #include #include "DataFormats/DetId/interface/DetId.h" #include "Geometry/CaloTopology/interface/CaloDirection.h" namespace spr { - void debugEcalDets(unsigned int, const DetId&, bool); + std::ostringstream debugEcalDet(unsigned int, const DetId&); void debugEcalDets(unsigned int, std::vector&); void debugEcalDets(unsigned int, std::vector&, std::vector&); void debugHcalDets(unsigned int, std::vector&); diff --git a/Calibration/IsolatedParticles/interface/MatchingSimTrack.h b/Calibration/IsolatedParticles/interface/MatchingSimTrack.h index bf1c84d67b76b..65651476041e6 100644 --- a/Calibration/IsolatedParticles/interface/MatchingSimTrack.h +++ b/Calibration/IsolatedParticles/interface/MatchingSimTrack.h @@ -22,7 +22,6 @@ #include "SimDataFormats/Vertex/interface/SimVertexContainer.h" #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h" -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" namespace spr { diff --git a/Calibration/IsolatedParticles/interface/eCone.icc b/Calibration/IsolatedParticles/interface/eCone.icc index 7115cc9b32544..8dd28e0a7ff2e 100644 --- a/Calibration/IsolatedParticles/interface/eCone.icc +++ b/Calibration/IsolatedParticles/interface/eCone.icc @@ -3,6 +3,7 @@ #include "Calibration/IsolatedParticles/interface/FindDistCone.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include namespace spr { @@ -54,7 +55,8 @@ namespace spr { } nRecHits = uniqueIdset.size(); if (debug) { - std::cout << "eCone_hcal: Energy " << energySum << " from " << nRecHits << " in subdet " << detOnly << std::endl; + edm::LogVerbatim("IsoTrack") << "eCone_hcal: Energy " << energySum << " from " << nRecHits << " in subdet " + << detOnly; } return energySum; } @@ -119,9 +121,9 @@ namespace spr { nRecHits = uniqueIdset.size(); if (debug) { - std::cout << "eCone_hcal: Energy " << energySum << " from " << nRecHits << ":" << coneRecHitDetIds.size() - << " in subdet " << detOnly << std::endl; - std::cout << "HotCell " << ietaHotCell << ":" << iphiHotCell << " dist " << distFromHotCell << std::endl; + edm::LogVerbatim("IsoTrack") << "eCone_hcal: Energy " << energySum << " from " << nRecHits << ":" + << coneRecHitDetIds.size() << " in subdet " << detOnly; + edm::LogVerbatim("IsoTrack") << "HotCell " << ietaHotCell << ":" << iphiHotCell << " dist " << distFromHotCell; } return energySum; } @@ -158,10 +160,10 @@ namespace spr { nRecHits = uniqueIdset.size(); if (debug) { - std::cout << "eCone_hcal: Energy " << energySum << " from " << nRecHits << ":" << coneRecHitDetIds.size() - << std::endl; + edm::LogVerbatim("IsoTrack") << "eCone_hcal: Energy " << energySum << " from " << nRecHits << ":" + << coneRecHitDetIds.size(); for (unsigned int k = 0; k < eHit.size(); ++k) - std::cout << "Hit[" << k << "] " << HcalDetId(coneRecHitDetIds[k]) << " energy " << eHit[k] << std::endl; + edm::LogVerbatim("IsoTrack") << "Hit[" << k << "] " << HcalDetId(coneRecHitDetIds[k]) << " energy " << eHit[k]; } return energySum; } @@ -233,9 +235,9 @@ namespace spr { nRecHits = uniqueIdset.size(); if (debug) { - std::cout << "eCone_hcal: Energy " << energySum << " from " << nRecHits << ":" << coneRecHitDetIds.size() - << " in subdet " << detOnly << std::endl; - std::cout << "HotCell " << ietaHotCell << ":" << iphiHotCell << " dist " << distFromHotCell << std::endl; + edm::LogVerbatim("IsoTrack") << "eCone_hcal: Energy " << energySum << " from " << nRecHits << ":" + << coneRecHitDetIds.size() << " in subdet " << detOnly; + edm::LogVerbatim("IsoTrack") << "HotCell " << ietaHotCell << ":" << iphiHotCell << " dist " << distFromHotCell; } return energySum; } @@ -275,7 +277,7 @@ namespace spr { } if (debug) { - std::cout << "eCone_ecal: Energy " << energySum << " from " << hit.size() << " hits" << std::endl; + edm::LogVerbatim("IsoTrack") << "eCone_ecal: Energy " << energySum << " from " << hit.size() << " hits"; } return energySum; } @@ -320,7 +322,7 @@ namespace spr { } if (debug) { - std::cout << "eCone_ecal: Energy " << energySum << " from " << hit.size() << " hits" << std::endl; + edm::LogVerbatim("IsoTrack") << "eCone_ecal: Energy " << energySum << " from " << hit.size() << " hits"; } return energySum; } diff --git a/Calibration/IsolatedParticles/interface/eECALMatrix.h b/Calibration/IsolatedParticles/interface/eECALMatrix.h index 743d04e758f72..5310e0ae8e957 100644 --- a/Calibration/IsolatedParticles/interface/eECALMatrix.h +++ b/Calibration/IsolatedParticles/interface/eECALMatrix.h @@ -189,6 +189,45 @@ namespace spr { double tMin = -500, double tMax = 500, bool debug = false); + + // Energy in NxN crystal matrix + template + double eECALmatrix(CaloNavigator& navigator, edm::Handle& hits, int ieta, int iphi, bool debug = false); + + template + std::vector > eECALmatrixCell(const DetId& detId, + edm::Handle& hitsEB, + edm::Handle& hitsEE, + const CaloGeometry* geo, + const CaloTopology* caloTopology, + int ieta, + int iphi, + double ebThr = -100, + double eeThr = -100, + bool debug = false); + + // Energy in ietaXiphi crystal matrix + template + std::pair eECALmatrixTotal(const DetId& detId, + edm::Handle& hitsEB, + edm::Handle& hitsEE, + const CaloGeometry* geo, + const CaloTopology* caloTopology, + int ieta, + int iphi, + double ebThr = -100, + double eeThr = -100, + bool debug = false); + + // returns vector of hits in NxN matrix + template + std::vector > energyECALCell(std::vector& vdets, + edm::Handle& hitsEB, + edm::Handle& hitsEE, + double ebThr = -100, + double eeThr = -100, + bool debug = false); + } // namespace spr #include "Calibration/IsolatedParticles/interface/eECALMatrix.icc" diff --git a/Calibration/IsolatedParticles/interface/eECALMatrix.icc b/Calibration/IsolatedParticles/interface/eECALMatrix.icc index e2009fb9df5a3..8a57d5931d8f9 100644 --- a/Calibration/IsolatedParticles/interface/eECALMatrix.icc +++ b/Calibration/IsolatedParticles/interface/eECALMatrix.icc @@ -1,7 +1,8 @@ #include "Calibration/IsolatedParticles/interface/DebugInfo.h" #include "Calibration/IsolatedParticles/interface/FindCaloHit.h" #include "Calibration/IsolatedParticles/interface/FindEtaPhi.h" -#include +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include namespace spr { @@ -22,8 +23,8 @@ namespace spr { spr::matrixECALIds(detId, ieta, iphi, geo, caloTopology, vdets, false); if (debug) { - std::cout << "Inside eECALmatrix " << 2 * ieta + 1 << "X" << 2 * iphi + 1 << " nXtals " << vdets.size() - << std::endl; + edm::LogVerbatim("IsoTrack") << "Inside eECALmatrix " << 2 * ieta + 1 << "X" << 2 * iphi + 1 << " nXtals " + << vdets.size(); spr::debugEcalDets(0, vdets); } @@ -48,8 +49,8 @@ namespace spr { spr::matrixECALIds(detId, ieta, iphi, geo, caloTopology, vdets, debug); if (debug) { - std::cout << "Inside eECALmatrix " << 2 * ieta + 1 << "X" << 2 * iphi + 1 << " nXtals " << vdets.size() - << std::endl; + edm::LogVerbatim("IsoTrack") << "Inside eECALmatrix " << 2 * ieta + 1 << "X" << 2 * iphi + 1 << " nXtals " + << vdets.size(); } return spr::energyECAL(vdets, hitsEB, hitsEE, ttMap, ebThr, eeThr, tMin, tMax, debug); @@ -74,8 +75,8 @@ namespace spr { spr::matrixECALIds(detId, ietaE, ietaW, iphiN, iphiS, geo, caloTopology, vdets, debug); if (debug) { - std::cout << "Inside eECALmatrix " << ietaE + ietaW + 1 << "X" << iphiN + iphiS + 1 << " nXtals " << vdets.size() - << std::endl; + edm::LogVerbatim("IsoTrack") << "Inside eECALmatrix " << ietaE + ietaW + 1 << "X" << iphiN + iphiS + 1 + << " nXtals " << vdets.size(); } return spr::energyECAL(vdets, hitsEB, hitsEE, ebThr, eeThr, tMin, tMax, debug); @@ -101,26 +102,27 @@ namespace spr { if (thisDet != DetId(0)) { std::vector hit; spr::findHit(hits, thisDet, hit, debug); + std::ostringstream st1; if (debug && !hit.empty()) { if (thisDet.subdetId() == EcalBarrel) { EBDetId id = thisDet; - std::cout << "hitECALmatrix::Cell 0x" << std::hex << thisDet() << std::dec << " " << id; + st1 << "hitECALmatrix::Cell 0x" << std::hex << thisDet() << std::dec << " " << id; } else if (thisDet.subdetId() == EcalEndcap) { EEDetId id = thisDet; - std::cout << "hitECALmatrix::Cell 0x" << std::hex << thisDet() << std::dec << " " << id; + st1 << "hitECALmatrix::Cell 0x" << std::hex << thisDet() << std::dec << " " << id; } else { - std::cout << "hitECALMatrix::Cell 0x" << std::hex << thisDet() << std::dec << " Unknown Type"; + st1 << "hitECALMatrix::Cell 0x" << std::hex << thisDet() << std::dec << " Unknown Type"; } } for (unsigned int ihit = 0; ihit < hit.size(); ihit++) { if (hit[ihit] != hits->end()) { hitlist.push_back(hit[ihit]); if (debug) - std::cout << " hit " << ihit << " " << hit[ihit]->energy(); + st1 << " hit " << ihit << " " << hit[ihit]->energy(); } } if (debug && !hit.empty()) - std::cout << std::endl; + edm::LogVerbatim("IsoTrack") << st1.str(); } } // iphi @@ -145,8 +147,9 @@ namespace spr { } else if (vdets[i1].subdetId() == EcalEndcap) { spr::findHit(hitsEE, vdets[i1], hit, debug); } + std::ostringstream st1; if (debug) - std::cout << "Crystal 0x" << std::hex << vdets[i1]() << std::dec; + st1 << "Crystal 0x" << std::hex << vdets[i1]() << std::dec; double ener = 0, ethr = ebThr; if (vdets[i1].subdetId() != EcalBarrel) ethr = eeThr; @@ -164,18 +167,18 @@ namespace spr { } } if (debug) - std::cout << " " << ihit << " " << en << " Thr " << ethr; + st1 << " " << ihit << " " << en << " Thr " << ethr; if (tt > tMin && tt < tMax) ener += en; } if (debug) - std::cout << "\n"; + edm::LogVerbatim("IsoTrack") << st1.str(); if (ener > ethr) energySum += ener; } } if (debug) - std::cout << "energyECAL: energySum = " << energySum << std::endl; + edm::LogVerbatim("IsoTrack") << "energyECAL: energySum = " << energySum; return energySum; } @@ -198,8 +201,9 @@ namespace spr { ok = (eTower > ebThr); else if (vdets[i1].subdetId() == EcalEndcap) ok = (eTower > eeThr); + std::ostringstream st1; if (debug) - std::cout << "Crystal 0x" << std::hex << vdets[i1]() << std::dec << " Flag " << ok; + st1 << "Crystal 0x" << std::hex << vdets[i1]() << std::dec << " Flag " << ok; if (ok) { std::vector hit; if (vdets[i1].subdetId() == EcalBarrel) { @@ -222,18 +226,18 @@ namespace spr { } } if (debug) - std::cout << " " << ihit << " E " << en << " time " << tt; + st1 << " " << ihit << " E " << en << " time " << tt; if (tt > tMin && tt < tMax) ener += en; } energySum += ener; } if (debug) - std::cout << "\n"; + edm::LogVerbatim("IsoTrack") << st1.str(); } } if (debug) - std::cout << "energyECAL: energySum = " << energySum << std::endl; + edm::LogVerbatim("IsoTrack") << "energyECAL: energySum = " << energySum; return energySum; } @@ -247,17 +251,18 @@ namespace spr { EcalTrigTowerDetId trId = ttMap.towerOf(detId); std::vector vdets = ttMap.constituentsOf(trId); if (debug) { - std::cout << "energyECALTower: "; + std::ostringstream st1; + st1 << "energyECALTower: "; if (detId.subdetId() == EcalBarrel) { EBDetId id = detId; - std::cout << "Cell 0x" << std::hex << detId() << std::dec << " " << id; + st1 << "Cell 0x" << std::hex << detId() << std::dec << " " << id; } else if (detId.subdetId() == EcalEndcap) { EEDetId id = detId; - std::cout << "Cell 0x" << std::hex << detId() << std::dec << " " << id; + st1 << "Cell 0x" << std::hex << detId() << std::dec << " " << id; } else { - std::cout << "Cell 0x" << std::hex << detId() << std::dec << " Unknown Type"; + st1 << "Cell 0x" << std::hex << detId() << std::dec << " Unknown Type"; } - std::cout << " Tower " << trId << " with " << vdets.size() << " cells" << std::endl; + edm::LogVerbatim("IsoTrack") << st1.str() << " Tower " << trId << " with " << vdets.size() << " cells"; } for (unsigned int i1 = 0; i1 < vdets.size(); i1++) { if (vdets[i1] != DetId(0)) { @@ -267,8 +272,9 @@ namespace spr { } else if (vdets[i1].subdetId() == EcalEndcap) { spr::findHit(hitsEE, vdets[i1], hit, debug); } + std::ostringstream st1; if (debug) - std::cout << "Xtal 0x" << std::hex << vdets[i1]() << std::dec; + st1 << "Xtal 0x" << std::hex << vdets[i1]() << std::dec; double en = 0; for (unsigned int ihit = 0; ihit < hit.size(); ihit++) { if (vdets[i1].subdetId() == EcalBarrel) { @@ -280,12 +286,12 @@ namespace spr { } } if (debug) - std::cout << " " << hit.size() << " E " << en << "\n"; + edm::LogVerbatim("IsoTrack") << st1.str() << " " << hit.size() << " E " << en; ener += en; } } if (debug) - std::cout << "energyECALTower: Energy in the Tower = " << ener << std::endl; + edm::LogVerbatim("IsoTrack") << "energyECALTower: Energy in the Tower = " << ener; return ener; } @@ -304,8 +310,8 @@ namespace spr { spr::matrixECALIds(detId, ieta, iphi, geo, caloTopology, vdets, false); if (debug) { - std::cout << "Inside eECALmatrix " << 2 * ieta + 1 << "X" << 2 * iphi + 1 << " nXtals " << vdets.size() - << std::endl; + edm::LogVerbatim("IsoTrack") << "Inside eECALmatrix " << 2 * ieta + 1 << "X" << 2 * iphi + 1 << " nXtals " + << vdets.size(); spr::debugEcalDets(0, vdets); } @@ -328,8 +334,9 @@ namespace spr { } else if (vdets[i1].subdetId() == EcalEndcap) { spr::findHit(hitsEE, vdets[i1], hit, debug); } + std::ostringstream st1; if (debug) - std::cout << "Crystal 0x" << std::hex << vdets[i1]() << std::dec; + st1 << "Crystal 0x" << std::hex << vdets[i1]() << std::dec; double ener = 0; for (unsigned int ihit = 0; ihit < hit.size(); ihit++) { double en = 0, tt = 0; @@ -345,12 +352,12 @@ namespace spr { } } if (debug) - std::cout << " " << ihit << " " << en << " " << tt; + st1 << " " << ihit << " " << en << " " << tt; if (tt > tMin && tt < tMax) ener += en; } if (debug) - std::cout << "\n"; + edm::LogVerbatim("IsoTrack") << st1.str(); if (ener > eMax) { det = vdets[i1]; eMax = ener; @@ -358,7 +365,144 @@ namespace spr { } } if (debug) - std::cout << "energyECAL: maxEnegy = " << eMax << std::endl; + edm::LogVerbatim("IsoTrack") << "energyECAL: maxEnegy = " << eMax; return det; } + + template + double eECALmatrix(CaloNavigator& navigator, + edm::Handle& hits, + int ieta, + int iphi, + const EcalSeverityLevelAlgo* sevlv, + bool debug) { + std::vector hit; + spr::hitECALmatrix(navigator, hits, ieta, iphi, hit, debug); + + if (debug) { + edm::LogVerbatim("IsoTrack") << "Inside eECALmatrix " << 2 * ieta + 1 << "X" << 2 * iphi + 1; + std::ostringstream st1; + st1 << "nXtals " << hit.size(); + for (unsigned int ihit = 0; ihit < hit.size(); ihit++) + st1 << " ihit:" << ihit << " " << (unsigned int)hit[ihit]->id(); + edm::LogVerbatim("IsoTrack") << st1.str(); + } + + double energySum = 0.0; + for (unsigned int ihit = 0; ihit < hit.size(); ihit++) { + energySum += hit[ihit]->energy(); + } + return energySum; + } + + template + std::vector > eECALmatrixCell(const DetId& detId, + edm::Handle& hitsEB, + edm::Handle& hitsEE, + const CaloGeometry* geo, + const CaloTopology* caloTopology, + int ieta, + int iphi, + double ebThr, + double eeThr, + bool debug) { + std::vector vdets = spr::matrixECALIds(detId, ieta, iphi, geo, caloTopology, debug); + + if (debug) { + edm::LogVerbatim("IsoTrack") << "Inside eECALmatrixCell " << 2 * ieta + 1 << "X" << 2 * iphi + 1 << " nXtals " + << vdets.size(); + } + + return spr::energyECALCell(vdets, hitsEB, hitsEE, ebThr, eeThr, debug); + } + + template + std::pair eECALmatrixTotal(const DetId& detId, + edm::Handle& hitsEB, + edm::Handle& hitsEE, + const CaloGeometry* geo, + const CaloTopology* caloTopology, + int ieta, + int iphi, + double ebThr, + double eeThr, + double tMin, + double tMax, + bool debug) { + spr::EtaPhi etaphi = spr::getEtaPhi(ieta, iphi, debug); + + // Get maximum of all the trials + double energySum = 0; + int itrym = 0; + for (int itry = 0; itry < etaphi.ntrys; itry++) { + std::vector vdets = spr::matrixECALIds(detId, + etaphi.ietaE[itry], + etaphi.ietaW[itry], + etaphi.iphiN[itry], + etaphi.iphiS[itry], + geo, + caloTopology, + debug); + double energy = spr::energyECAL(vdets, hitsEB, hitsEE, ebThr, eeThr, tMin, tMax, debug); + if (energy > energySum) { + energySum = energy; + itrym = itry; + } + } + + if (debug) + edm::LogVerbatim("IsoTrack") << "eECALmatrixTotal:: energy deposit in " << ieta << "X" << iphi << " matrix is " + << energySum << " for trial # " << itrym; + return std::pair(energySum, itrym); + } + + template + std::vector > energyECALCell(std::vector& vdets, + edm::Handle& hitsEB, + edm::Handle& hitsEE, + double ebThr, + double eeThr, + bool debug) { + std::vector > energyDets; + for (unsigned int i1 = 0; i1 < vdets.size(); i1++) { + double energySum = 0.0; + if (vdets[i1] != DetId(0)) { + std::vector hit; + if (vdets[i1].subdetId() == EcalBarrel) { + hit = spr::findHit(hitsEB, vdets[i1]); + } else if (vdets[i1].subdetId() == EcalEndcap) { + hit = spr::findHit(hitsEE, vdets[i1]); + } + std::ostringstream st1; + if (debug) + st1 << "Xtal 0x" << std::hex << vdets[i1]() << std::dec; + bool ok = false; + double ethr = ebThr; + for (unsigned int ihit = 0; ihit < hit.size(); ihit++) { + double en = 0; + if (vdets[i1].subdetId() == EcalBarrel) { + if (hit[ihit] != hitsEB->end()) { + en = hit[ihit]->energy(); + ok = true; + } + } else if (vdets[i1].subdetId() == EcalEndcap) { + if (hit[ihit] != hitsEE->end()) { + en = hit[ihit]->energy(); + ok = true; + ethr = eeThr; + } + } + if (debug) + st1 << " " << ihit << " " << en; + energySum += en; + } + if (debug) + edm::LogVerbatim("IsoTrack") << st1.str() << "\nenergyECALCell: energySum = " << energySum; + if (ok && energySum > ethr) + energyDets.push_back(std::pair(vdets[i1], energySum)); + } + } + return energyDets; + } + } // namespace spr diff --git a/Calibration/IsolatedParticles/interface/eECALMatrixExtra.icc b/Calibration/IsolatedParticles/interface/eECALMatrixExtra.icc deleted file mode 100644 index 582020c7400eb..0000000000000 --- a/Calibration/IsolatedParticles/interface/eECALMatrixExtra.icc +++ /dev/null @@ -1,101 +0,0 @@ -#include "Calibration/IsolatedParticles/interface/FindCaloHit.h" -#include "Calibration/IsolatedParticles/interface/FindEtaPhi.h" -#include - -namespace spr{ - - template - double eECALmatrix(CaloNavigator& navigator,edm::Handle& hits, int ieta, int iphi, const EcalSeverityLevelAlgo * sevlv, bool debug) { - - std::vector< typename T::const_iterator> hit; - spr::hitECALmatrix(navigator,hits,ieta,iphi,hit,debug); - - if (debug) { - std::cout << "Inside eECALmatrix " << 2*ieta+1 << "X" << 2*iphi+1 << std::endl; - std::cout << "nXtals " << hit.size(); - for (unsigned int ihit=0; ihitid(); - std::cout << "\n" << std::endl; - } - - double energySum = 0.0; - for (unsigned int ihit=0; ihitenergy(); - } - return energySum; - } - - template< typename T> - std::vector > eECALmatrixCell(const DetId& detId, edm::Handle& hitsEB, edm::Handle& hitsEE, const CaloGeometry* geo, const CaloTopology* caloTopology, int ieta, int iphi, double ebThr, double eeThr, bool debug) { - - std::vector vdets = spr::matrixECALIds(detId, ieta, iphi, geo, caloTopology, debug); - - if (debug) { - std::cout << "Inside eECALmatrixCell " << 2*ieta+1 << "X" << 2*iphi+1 - << " nXtals " << vdets.size() << std::endl; - } - - return spr::energyECALCell(vdets, hitsEB, hitsEE, ebThr, eeThr, debug); - } - - template< typename T> - std::pair eECALmatrixTotal(const DetId& detId, edm::Handle& hitsEB, edm::Handle& hitsEE, const CaloGeometry* geo, const CaloTopology* caloTopology, int ieta, int iphi, double ebThr, double eeThr, double tMin, double tMax, bool debug) { - - spr::EtaPhi etaphi = spr::getEtaPhi(ieta,iphi,debug); - - // Get maximum of all the trials - double energySum = 0; - int itrym = 0; - for (int itry=0; itry vdets = spr::matrixECALIds(detId, etaphi.ietaE[itry], etaphi.ietaW[itry], etaphi.iphiN[itry], etaphi.iphiS[itry], geo, caloTopology, debug); - double energy = spr::energyECAL(vdets, hitsEB, hitsEE, ebThr, eeThr, tMin, tMax, debug); - if (energy > energySum) { - energySum = energy; - itrym = itry; - } - } - - if (debug) std::cout << "eECALmatrixTotal:: energy deposit in " << ieta << "X" << iphi << " matrix is " << energySum << " for trial # " << itrym << std::endl; - return std::pair(energySum,itrym); - } - - template - std::vector > energyECALCell(std::vector& vdets, edm::Handle& hitsEB, edm::Handle& hitsEE, double ebThr, double eeThr, bool debug) { - - std::vector > energyDets; - for (unsigned int i1=0; i1 hit; - if (vdets[i1].subdetId()==EcalBarrel) { - hit = spr::findHit(hitsEB,vdets[i1]); - } else if (vdets[i1].subdetId()==EcalEndcap) { - hit = spr::findHit(hitsEE,vdets[i1]); - } - if (debug) std::cout << "Xtal 0x" <end()) { - en = hit[ihit]->energy(); ok = true; - } - } else if (vdets[i1].subdetId()==EcalEndcap) { - if (hit[ihit] != hitsEE->end()) { - en = hit[ihit]->energy(); ok = true; ethr = eeThr; - } - } - if (debug) std::cout << " " << ihit << " " << en; - energySum += en; - } - if (debug) std::cout << "\nenergyECALCell: energySum = " <ethr) energyDets.push_back(std::pair(vdets[i1],energySum)); - } - } - return energyDets; - } - -} - - diff --git a/Calibration/IsolatedParticles/interface/eHCALMatrix.icc b/Calibration/IsolatedParticles/interface/eHCALMatrix.icc index 935efe1b79c38..f930823baecdc 100644 --- a/Calibration/IsolatedParticles/interface/eHCALMatrix.icc +++ b/Calibration/IsolatedParticles/interface/eHCALMatrix.icc @@ -4,9 +4,11 @@ #include "Calibration/IsolatedParticles/interface/FindDistCone.h" #include "Calibration/IsolatedParticles/interface/MatrixHCALDetIds.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include #include +#include namespace spr { @@ -32,20 +34,20 @@ namespace spr { HcalDetId hcid(hcid0.subdet(), hcid0.ieta(), hcid0.iphi(), 1); DetId det(hcid.rawId()); if (debug) - std::cout << "Inside eHCALmatrix " << 2 * ieta + 1 << "X" << 2 * iphi + 1 << " AlgoNew " << algoNew - << " Inclusion of HO Flag " << includeHO << std::endl; + edm::LogVerbatim("IsoTrack") << "Inside eHCALmatrix " << 2 * ieta + 1 << "X" << 2 * iphi + 1 << " AlgoNew " + << algoNew << " Inclusion of HO Flag " << includeHO; double energySum = 0.0; if (algoNew) { energySum = spr::energyHCALmatrixNew( topology, det, hits, ieta, iphi, includeHO, hbThr, heThr, hfThr, hoThr, tMin, tMax, useRaw, debug); } else { - std::cout << "eHCALmatrix:: Algorithm New = " << algoNew - << " not supported - call directly spr::energyHCALmatrix " << std::endl; + edm::LogVerbatim("IsoTrack") << "eHCALmatrix:: Algorithm New = " << algoNew + << " not supported - call directly spr::energyHCALmatrix "; // energySum = spr::energyHCALmatrix(topology, det, hits, ieta, iphi, includeHO, hbThr, heThr, hfThr, hoThr, tMin, tMax, useRaw, debug); } if (debug) - std::cout << "eHCALmatrix::Total energy " << energySum << std::endl; + edm::LogVerbatim("IsoTrack") << "eHCALmatrix::Total energy " << energySum; return energySum; } @@ -70,8 +72,8 @@ namespace spr { HcalDetId hcid(hcid0.subdet(), hcid0.ieta(), hcid0.iphi(), 1); DetId det(hcid.rawId()); if (debug) - std::cout << "Inside eHCALmatrix " << ietaE + ietaW + 1 << "X" << iphiN + iphiS + 1 << " Inclusion of HO Flag " - << includeHO << std::endl; + edm::LogVerbatim("IsoTrack") << "Inside eHCALmatrix " << ietaE + ietaW + 1 << "X" << iphiN + iphiS + 1 + << " Inclusion of HO Flag " << includeHO; return spr::energyHCALmatrixTotal(topology, det, @@ -236,7 +238,7 @@ namespace spr { std::vector dets(1, det); std::vector vdets = spr::matrixHCALIds(dets, topology, ieta, iphi, includeHO, false); if (debug) { - std::cout << "matrixHCALIds::Total number of cells found is " << vdets.size() << std::endl; + edm::LogVerbatim("IsoTrack") << "matrixHCALIds::Total number of cells found is " << vdets.size(); spr::debugHcalDets(0, vdets); } return spr::energyHCAL(vdets, hits, hbThr, heThr, hfThr, hoThr, tMin, tMax, useRaw, debug); @@ -317,8 +319,8 @@ namespace spr { if (hit[ihit] != hits->end()) { khit++; if (debug) - std::cout << "energyHCAL:: Hit " << khit << " " << (HcalDetId)vdets[i] << " E " << hit[ihit]->energy() - << " t " << hit[ihit]->time() << std::endl; + edm::LogVerbatim("IsoTrack") << "energyHCAL:: Hit " << khit << " " << (HcalDetId)vdets[i] << " E " + << hit[ihit]->energy() << " t " << hit[ihit]->time(); if (hit[ihit]->time() > tMin && hit[ihit]->time() < tMax) { energy += getRawEnergy(hit[ihit], useRaw); } @@ -329,7 +331,7 @@ namespace spr { } if (debug) - std::cout << "energyHCAL::Total Energy " << energySum << " from " << khit << " hits" << std::endl; + edm::LogVerbatim("IsoTrack") << "energyHCAL::Total Energy " << energySum << " from " << khit << " hits"; return energySum; } @@ -352,8 +354,8 @@ namespace spr { double eThr = spr::eHCALThreshold(subdet, hbThr, heThr, hfThr, hoThr); bool hbhe = (detID.ietaAbs() == 16); if (debug) - std::cout << "energyHCALCell: input ID " << detID << " MaxDepth " << maxDepth << " Threshold (E) " << eThr - << " (T) " << tMin << ":" << tMax << std::endl; + edm::LogVerbatim("IsoTrack") << "energyHCALCell: input ID " << detID << " MaxDepth " << maxDepth + << " Threshold (E) " << eThr << " (T) " << tMin << ":" << tMax; for (int i = 0; i < maxDepth; i++) { HcalSubdetector subdet0 = (hbhe) ? ((i + 1 >= depthHE) ? HcalEndcap : HcalBarrel) : detID.subdet(); HcalDetId hcid(subdet0, detID.ieta(), detID.iphi(), i + 1); @@ -364,22 +366,24 @@ namespace spr { if (hit[ihit]->time() > tMin && hit[ihit]->time() < tMax) energy += getRawEnergy(hit[ihit], useRaw); if (debug) - std::cout << "energyHCALCell:: Hit[" << ihit << "] " << hcid << " E " << hit[ihit]->energy() << " t " - << hit[ihit]->time() << std::endl; + edm::LogVerbatim("IsoTrack") << "energyHCALCell:: Hit[" << ihit << "] " << hcid << " E " + << hit[ihit]->energy() << " t " << hit[ihit]->time(); } if (debug) - std::cout << "energyHCALCell:: Cell " << hcid << " E " << energy << " from " << hit.size() << " threshold " - << eThr << std::endl; + edm::LogVerbatim("IsoTrack") << "energyHCALCell:: Cell " << hcid << " E " << energy << " from " << hit.size() + << " threshold " << eThr; if (energy > eThr && !(hit.empty())) { energyCell.push_back(std::pair(energy, i + 1)); } } if (debug) { - std::cout << "energyHCALCell:: " << energyCell.size() << " entries from " << maxDepth << " depths:"; + edm::LogVerbatim("IsoTrack") << "energyHCALCell:: " << energyCell.size() << " entries from " << maxDepth + << " depths:"; + std::ostringstream st1; for (unsigned int i = 0; i < energyCell.size(); ++i) { - std::cout << " [" << i << "] (" << energyCell[i].first << ":" << energyCell[i].second << ")"; + st1 << " [" << i << "] (" << energyCell[i].first << ":" << energyCell[i].second << ")"; } - std::cout << std::endl; + edm::LogVerbatim("IsoTrack") << st1.str(); } } @@ -395,6 +399,6 @@ namespace spr { } if (debug) - std::cout << "hitsHCAL::Number of hits " << hitlist.size() << std::endl; + edm::LogVerbatim("IsoTrack") << "hitsHCAL::Number of hits " << hitlist.size(); } } // namespace spr diff --git a/Calibration/IsolatedParticles/plugins/IsolatedGenParticles.cc b/Calibration/IsolatedParticles/plugins/IsolatedGenParticles.cc index 7ec5dc03c3392..9363fde7f1ca7 100644 --- a/Calibration/IsolatedParticles/plugins/IsolatedGenParticles.cc +++ b/Calibration/IsolatedParticles/plugins/IsolatedGenParticles.cc @@ -71,7 +71,6 @@ #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" #include "SimGeneral/HepPDTRecord/interface/ParticleDataTable.h" -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" // track associator #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h" diff --git a/Calibration/IsolatedParticles/plugins/IsolatedTracksCone.cc b/Calibration/IsolatedParticles/plugins/IsolatedTracksCone.cc index c5c53bec52563..4d9a6fc653808 100644 --- a/Calibration/IsolatedParticles/plugins/IsolatedTracksCone.cc +++ b/Calibration/IsolatedParticles/plugins/IsolatedTracksCone.cc @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -70,6 +71,7 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Common/interface/TriggerNames.h" #include "FWCore/Framework/interface/LuminosityBlock.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" //TFile Service @@ -99,7 +101,6 @@ #include "TrackingTools/TrackAssociator/interface/TrackDetectorAssociator.h" // tracker hit associator -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h" #include "RecoCaloTools/Navigation/interface/CaloNavigator.h" @@ -1721,7 +1722,9 @@ void IsolatedTracksCone::printTrack(const reco::Track* pTrack) { if (printTrkHitPattern_) { const reco::HitPattern& p = pTrack->hitPattern(); for (int i = 0; i < p.numberOfAllHits(reco::HitPattern::TRACK_HITS); i++) { - p.printHitPattern(reco::HitPattern::TRACK_HITS, i, std::cout); + std::ostringstream st1; + p.printHitPattern(reco::HitPattern::TRACK_HITS, i, st1); + edm::LogVerbatim("IsoTrack") << st1.str(); } } } diff --git a/Calibration/IsolatedParticles/plugins/IsolatedTracksHcalScale.cc b/Calibration/IsolatedParticles/plugins/IsolatedTracksHcalScale.cc index e3670218df38b..446b3ea5c36e8 100644 --- a/Calibration/IsolatedParticles/plugins/IsolatedTracksHcalScale.cc +++ b/Calibration/IsolatedParticles/plugins/IsolatedTracksHcalScale.cc @@ -92,7 +92,6 @@ #include "SimDataFormats/Vertex/interface/SimVertexContainer.h" // track associator -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h" #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h" #include "TrackingTools/TrackAssociator/interface/TrackDetectorAssociator.h" diff --git a/Calibration/IsolatedParticles/plugins/IsolatedTracksNxN.cc b/Calibration/IsolatedParticles/plugins/IsolatedTracksNxN.cc index 259a05b66da96..72967463cfc1a 100644 --- a/Calibration/IsolatedParticles/plugins/IsolatedTracksNxN.cc +++ b/Calibration/IsolatedParticles/plugins/IsolatedTracksNxN.cc @@ -134,7 +134,6 @@ #include "SimDataFormats/Vertex/interface/SimVertexContainer.h" // track associator -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h" #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h" #include "TrackingTools/TrackAssociator/interface/TrackDetectorAssociator.h" diff --git a/Calibration/IsolatedParticles/plugins/StudyCaloGen.cc b/Calibration/IsolatedParticles/plugins/StudyCaloGen.cc index e15be0e8a046d..5ae0ae1fb3e00 100644 --- a/Calibration/IsolatedParticles/plugins/StudyCaloGen.cc +++ b/Calibration/IsolatedParticles/plugins/StudyCaloGen.cc @@ -35,7 +35,6 @@ #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" #include "SimGeneral/HepPDTRecord/interface/ParticleDataTable.h" -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" // track associator #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h" diff --git a/Calibration/IsolatedParticles/src/CaloPropagateTrack.cc b/Calibration/IsolatedParticles/src/CaloPropagateTrack.cc index f614558ad70bd..b9d2368815d85 100644 --- a/Calibration/IsolatedParticles/src/CaloPropagateTrack.cc +++ b/Calibration/IsolatedParticles/src/CaloPropagateTrack.cc @@ -6,14 +6,14 @@ #include "DataFormats/EcalDetId/interface/EEDetId.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" #include "Calibration/IsolatedParticles/interface/CaloConstants.h" #include "Calibration/IsolatedParticles/interface/CaloPropagateTrack.h" #include - -//#define EDM_ML_DEBUG +#include namespace spr { @@ -38,11 +38,9 @@ namespace spr { vdet.detIdECAL = DetId(0); vdet.detIdHCAL = DetId(0); vdet.detIdEHCAL = DetId(0); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "Propagate track " << indx << " p " << trkItr->p() << " eta " << trkItr->eta() << " phi " - << trkItr->phi() << " Flag " << vdet.ok << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "Propagate track " << indx << " p " << trkItr->p() << " eta " << trkItr->eta() + << " phi " << trkItr->phi() << " Flag " << vdet.ok; GlobalPoint vertex; GlobalVector momentum; int charge(pTrack->charge()); @@ -57,16 +55,12 @@ namespace spr { momentum = GlobalVector( ((pTrack->outerMomentum()).X()), ((pTrack->outerMomentum()).Y()), ((pTrack->outerMomentum()).Z())); } -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "Track charge " << charge << " p " << momentum << " position " << vertex << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "Track charge " << charge << " p " << momentum << " position " << vertex; std::pair info = spr::propagateECAL(vertex, momentum, charge, bField, debug); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "Propagate to ECAL " << info.second << " at (" << info.first.x() << ", " << info.first.y() << ", " - << info.first.z() << ")\n"; -#endif + edm::LogVerbatim("IsoTrack") << "Propagate to ECAL " << info.second << " at (" << info.first.x() << ", " + << info.first.y() << ", " << info.first.z() << ")"; vdet.okECAL = info.second; if (vdet.okECAL) { @@ -82,23 +76,20 @@ namespace spr { vdet.okECAL = false; } vdet.detIdEHCAL = gHB->getClosestCell(point); -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "Point at ECAL (" << vdet.etaECAL << ", " << vdet.phiECAL << " "; + std::ostringstream st1; if (std::abs(point.eta()) < spr::etaBEEcal) - std::cout << EBDetId(vdet.detIdECAL); + st1 << EBDetId(vdet.detIdECAL); else - std::cout << EEDetId(vdet.detIdECAL); - std::cout << " " << HcalDetId(vdet.detIdEHCAL) << std::endl; + st1 << EEDetId(vdet.detIdECAL); + edm::LogVerbatim("IsoTrack") << "Point at ECAL (" << vdet.etaECAL << ", " << vdet.phiECAL << " " << st1.str() + << " " << HcalDetId(vdet.detIdEHCAL); } -#endif } info = spr::propagateHCAL(vertex, momentum, charge, bField, debug); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "Propagate to HCAL " << info.second << " at (" << info.first.x() << ", " << info.first.y() << ", " - << info.first.z() << ")\n"; -#endif + edm::LogVerbatim("IsoTrack") << "Propagate to HCAL " << info.second << " at (" << info.first.x() << ", " + << info.first.y() << ", " << info.first.z() << ")"; vdet.okHCAL = info.second; if (vdet.okHCAL) { const GlobalPoint point(info.first.x(), info.first.y(), info.first.z()); @@ -106,35 +97,33 @@ namespace spr { vdet.phiHCAL = point.phi(); vdet.detIdHCAL = gHB->getClosestCell(point); } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "Track [" << indx << "] Flag: " << vdet.ok << " ECAL (" << vdet.okECAL << ") "; + std::ostringstream st1; if (vdet.detIdECAL.subdetId() == EcalBarrel) - std::cout << (EBDetId)(vdet.detIdECAL); + st1 << (EBDetId)(vdet.detIdECAL); else - std::cout << (EEDetId)(vdet.detIdECAL); - std::cout << " HCAL (" << vdet.okHCAL << ") " << (HcalDetId)(vdet.detIdHCAL) << " Or " - << (HcalDetId)(vdet.detIdEHCAL) << std::endl; + st1 << (EEDetId)(vdet.detIdECAL); + edm::LogVerbatim("IsoTrack") << "Track [" << indx << "] Flag: " << vdet.ok << " ECAL (" << vdet.okECAL << ") " + << st1.str() << " HCAL (" << vdet.okHCAL << ") " << (HcalDetId)(vdet.detIdHCAL) + << " Or " << (HcalDetId)(vdet.detIdEHCAL); } -#endif vdets.push_back(vdet); } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "propagateCALO:: for " << vdets.size() << " tracks" << std::endl; + edm::LogVerbatim("IsoTrack") << "propagateCALO:: for " << vdets.size() << " tracks"; for (unsigned int i = 0; i < vdets.size(); ++i) { - std::cout << "Track [" << i << "] Flag: " << vdets[i].ok << " ECAL (" << vdets[i].okECAL << ") "; + std::ostringstream st1; if (vdets[i].detIdECAL.subdetId() == EcalBarrel) { - std::cout << (EBDetId)(vdets[i].detIdECAL); + st1 << (EBDetId)(vdets[i].detIdECAL); } else { - std::cout << (EEDetId)(vdets[i].detIdECAL); + st1 << (EEDetId)(vdets[i].detIdECAL); } - std::cout << " HCAL (" << vdets[i].okHCAL << ") " << (HcalDetId)(vdets[i].detIdHCAL) << " Or " - << (HcalDetId)(vdets[i].detIdEHCAL) << std::endl; + edm::LogVerbatim("IsoTrack") << "Track [" << i << "] Flag: " << vdets[i].ok << " ECAL (" << vdets[i].okECAL + << ") " << st1.str() << " HCAL (" << vdets[i].okHCAL << ") " + << (HcalDetId)(vdets[i].detIdHCAL) << " Or " << (HcalDetId)(vdets[i].detIdEHCAL); } } -#endif return vdets; } @@ -169,11 +158,9 @@ namespace spr { vdet.detIdECAL = DetId(0); vdet.detIdHCAL = DetId(0); vdet.detIdEHCAL = DetId(0); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "Propagate track " << indx << " p " << trkItr->p() << " eta " << trkItr->eta() << " phi " - << trkItr->phi() << " Flag " << vdet.ok << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "Propagate track " << indx << " p " << trkItr->p() << " eta " << trkItr->eta() + << " phi " << trkItr->phi() << " Flag " << vdet.ok; std::pair info = spr::propagateECAL(pTrack, bField, debug); vdet.okECAL = info.second; if (vdet.okECAL) { @@ -198,34 +185,32 @@ namespace spr { vdet.phiHCAL = point.phi(); vdet.detIdHCAL = gHB->getClosestCell(point); } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "Track [" << indx << "] Flag: " << vdet.ok << " ECAL (" << vdet.okECAL << ") "; + std::ostringstream st1; if (vdet.detIdECAL.subdetId() == EcalBarrel) - std::cout << (EBDetId)(vdet.detIdECAL); + st1 << (EBDetId)(vdet.detIdECAL); else - std::cout << (EEDetId)(vdet.detIdECAL); - std::cout << " HCAL (" << vdet.okHCAL << ") " << (HcalDetId)(vdet.detIdHCAL) << " Or " - << (HcalDetId)(vdet.detIdEHCAL) << std::endl; + st1 << (EEDetId)(vdet.detIdECAL); + edm::LogVerbatim("IsoTrack") << "Track [" << indx << "] Flag: " << vdet.ok << " ECAL (" << vdet.okECAL << ") " + << st1.str() << " HCAL (" << vdet.okHCAL << ") " << (HcalDetId)(vdet.detIdHCAL) + << " Or " << (HcalDetId)(vdet.detIdEHCAL); } -#endif vdets.push_back(vdet); } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "propagateCALO:: for " << vdets.size() << " tracks" << std::endl; + edm::LogVerbatim("IsoTrack") << "propagateCALO:: for " << vdets.size() << " tracks"; for (unsigned int i = 0; i < vdets.size(); ++i) { - std::cout << "Track [" << i << "] Flag: " << vdets[i].ok << " ECAL (" << vdets[i].okECAL << ") "; + std::ostringstream st1; if (vdets[i].detIdECAL.subdetId() == EcalBarrel) { - std::cout << (EBDetId)(vdets[i].detIdECAL); + st1 << (EBDetId)(vdets[i].detIdECAL); } else { - std::cout << (EEDetId)(vdets[i].detIdECAL); + st1 << (EEDetId)(vdets[i].detIdECAL); } - std::cout << " HCAL (" << vdets[i].okHCAL << ") " << (HcalDetId)(vdets[i].detIdHCAL) << " Or " - << (HcalDetId)(vdets[i].detIdEHCAL) << std::endl; + edm::LogVerbatim("IsoTrack") << "Track [" << i << "] Flag: " << vdets[i].ok << " ECAL (" << vdets[i].okECAL + << ") " << st1.str() << " HCAL (" << vdets[i].okHCAL << ") " + << (HcalDetId)(vdets[i].detIdHCAL) << " Or " << (HcalDetId)(vdets[i].detIdEHCAL); } } -#endif } void propagateCALO(edm::Handle& trkCollection, @@ -249,11 +234,9 @@ namespace spr { trkD.detIdECAL = DetId(0); trkD.detIdHCAL = DetId(0); trkD.detIdEHCAL = DetId(0); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "Propagate track " << indx << " p " << trkItr->p() << " eta " << trkItr->eta() << " phi " - << trkItr->phi() << " Flag " << trkD.ok << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "Propagate track " << indx << " p " << trkItr->p() << " eta " << trkItr->eta() + << " phi " << trkItr->phi() << " Flag " << trkD.ok; spr::propagatedTrack info = spr::propagateTrackToECAL(pTrack, bField, debug); GlobalPoint point(info.point.x(), info.point.y(), info.point.z()); trkD.okECAL = info.ok; @@ -280,28 +263,27 @@ namespace spr { } trkDir.push_back(trkD); } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "propagateCALO:: for " << trkDir.size() << " tracks" << std::endl; + edm::LogVerbatim("IsoTrack") << "propagateCALO:: for " << trkDir.size() << " tracks"; for (unsigned int i = 0; i < trkDir.size(); ++i) { - std::cout << "Track [" << i << "] Flag: " << trkDir[i].ok << " ECAL (" << trkDir[i].okECAL << ")"; + std::ostringstream st1, st2; if (trkDir[i].okECAL) { - std::cout << " point " << trkDir[i].pointECAL << " direction " << trkDir[i].directionECAL << " "; + st1 << " point " << trkDir[i].pointECAL << " direction " << trkDir[i].directionECAL << " "; if (trkDir[i].detIdECAL.subdetId() == EcalBarrel) { - std::cout << (EBDetId)(trkDir[i].detIdECAL); + st1 << (EBDetId)(trkDir[i].detIdECAL); } else { - std::cout << (EEDetId)(trkDir[i].detIdECAL); + st1 << (EEDetId)(trkDir[i].detIdECAL); } } - std::cout << " HCAL (" << trkDir[i].okHCAL << ")"; if (trkDir[i].okHCAL) { - std::cout << " point " << trkDir[i].pointHCAL << " direction " << trkDir[i].directionHCAL << " " - << (HcalDetId)(trkDir[i].detIdHCAL); + st2 << " point " << trkDir[i].pointHCAL << " direction " << trkDir[i].directionHCAL << " " + << (HcalDetId)(trkDir[i].detIdHCAL); } - std::cout << " Or " << (HcalDetId)(trkDir[i].detIdEHCAL) << std::endl; + edm::LogVerbatim("IsoTrack") << "Track [" << i << "] Flag: " << trkDir[i].ok << " ECAL (" << trkDir[i].okECAL + << ")" << st1.str() << " HCAL (" << trkDir[i].okHCAL << ")" << st2.str() << " Or " + << (HcalDetId)(trkDir[i].detIdEHCAL); } } -#endif } spr::propagatedTrackID propagateCALO(const reco::Track* pTrack, @@ -317,11 +299,9 @@ namespace spr { vdet.detIdECAL = DetId(0); vdet.detIdHCAL = DetId(0); vdet.detIdEHCAL = DetId(0); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "Propagate track: p " << pTrack->p() << " eta " << pTrack->eta() << " phi " << pTrack->phi() - << " Flag " << vdet.ok << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "Propagate track: p " << pTrack->p() << " eta " << pTrack->eta() << " phi " + << pTrack->phi() << " Flag " << vdet.ok; std::pair info = spr::propagateECAL(pTrack, bField, debug); vdet.okECAL = info.second; if (vdet.okECAL) { @@ -346,19 +326,18 @@ namespace spr { vdet.phiHCAL = point.phi(); vdet.detIdHCAL = gHB->getClosestCell(point); } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "propagateCALO:: for 1 track" << std::endl; - std::cout << "Track [0] Flag: " << vdet.ok << " ECAL (" << vdet.okECAL << ") "; + edm::LogVerbatim("IsoTrack") << "propagateCALO:: for 1 track"; + std::ostringstream st1; if (vdet.detIdECAL.subdetId() == EcalBarrel) { - std::cout << (EBDetId)(vdet.detIdECAL); + st1 << (EBDetId)(vdet.detIdECAL); } else { - std::cout << (EEDetId)(vdet.detIdECAL); + st1 << (EEDetId)(vdet.detIdECAL); } - std::cout << " HCAL (" << vdet.okHCAL << ") " << (HcalDetId)(vdet.detIdHCAL) << " Or " - << (HcalDetId)(vdet.detIdEHCAL) << std::endl; + edm::LogVerbatim("IsoTrack") << "Track [0] Flag: " << vdet.ok << " ECAL (" << vdet.okECAL << ") " << st1.str() + << " HCAL (" << vdet.okHCAL << ") " << (HcalDetId)(vdet.detIdHCAL) << " Or " + << (HcalDetId)(vdet.detIdEHCAL); } -#endif return vdet; } @@ -384,11 +363,9 @@ namespace spr { trkD.pdgId = ((*p)->pdg_id()); trkD.charge = ((pdt->particle(trkD.pdgId))->ID().threeCharge()) / 3; const GlobalVector momentum = GlobalVector((*p)->momentum().px(), (*p)->momentum().py(), (*p)->momentum().pz()); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "Propagate track " << indx << " pdg " << trkD.pdgId << " charge " << trkD.charge << " p " - << momentum << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "Propagate track " << indx << " pdg " << trkD.pdgId << " charge " << trkD.charge + << " p " << momentum; // consider stable particles if ((*p)->status() == 1 && std::abs((*p)->momentum().eta()) < etaMax) { const GlobalPoint vertex = GlobalPoint(0.1 * (*p)->production_vertex()->position().x(), @@ -425,31 +402,27 @@ namespace spr { } trkDir.push_back(trkD); } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "propagateCALO:: for " << trkDir.size() << " tracks" << std::endl; + edm::LogVerbatim("IsoTrack") << "propagateCALO:: for " << trkDir.size() << " tracks"; for (unsigned int i = 0; i < trkDir.size(); ++i) { - if (trkDir[i].okECAL) - std::cout << "Track [" << i << "] Flag: " << trkDir[i].ok << " ECAL (" << trkDir[i].okECAL << ")"; + std::ostringstream st1, st2; if (trkDir[i].okECAL) { - std::cout << " point " << trkDir[i].pointECAL << " direction " << trkDir[i].directionECAL << " "; + st1 << " point " << trkDir[i].pointECAL << " direction " << trkDir[i].directionECAL << " "; if (trkDir[i].detIdECAL.subdetId() == EcalBarrel) { - std::cout << (EBDetId)(trkDir[i].detIdECAL); + st1 << (EBDetId)(trkDir[i].detIdECAL); } else { - std::cout << (EEDetId)(trkDir[i].detIdECAL); + st1 << (EEDetId)(trkDir[i].detIdECAL); } } - if (trkDir[i].okECAL) - std::cout << " HCAL (" << trkDir[i].okHCAL << ")"; + st2 << " HCAL (" << trkDir[i].okHCAL << ")"; if (trkDir[i].okHCAL) { - std::cout << " point " << trkDir[i].pointHCAL << " direction " << trkDir[i].directionHCAL << " " - << (HcalDetId)(trkDir[i].detIdHCAL); + st2 << " point " << trkDir[i].pointHCAL << " direction " << trkDir[i].directionHCAL << " " + << (HcalDetId)(trkDir[i].detIdHCAL); } - if (trkDir[i].okECAL) - std::cout << " Or " << (HcalDetId)(trkDir[i].detIdEHCAL) << std::endl; + edm::LogVerbatim("IsoTrack") << "Track [" << i << "] Flag: " << trkDir[i].ok << " ECAL (" << trkDir[i].okECAL + << ")" << st1.str() << st2.str() << " Or " << (HcalDetId)(trkDir[i].detIdEHCAL); } } -#endif return trkDir; } @@ -475,11 +448,9 @@ namespace spr { trkD.pdgId = (p->pdgId()); trkD.charge = p->charge(); const GlobalVector momentum = GlobalVector(p->momentum().x(), p->momentum().y(), p->momentum().z()); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "Propagate track " << indx << " pdg " << trkD.pdgId << " charge " << trkD.charge << " p " - << momentum << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "Propagate track " << indx << " pdg " << trkD.pdgId << " charge " << trkD.charge + << " p " << momentum; // consider stable particles if (p->status() == 1 && std::abs(momentum.eta()) < etaMax) { const GlobalPoint vertex = GlobalPoint(p->vertex().x(), p->vertex().y(), p->vertex().z()); @@ -514,31 +485,27 @@ namespace spr { } trkDir.push_back(trkD); } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "propagateCALO:: for " << trkDir.size() << " tracks" << std::endl; + edm::LogVerbatim("IsoTrack") << "propagateCALO:: for " << trkDir.size() << " tracks" << std::endl; for (unsigned int i = 0; i < trkDir.size(); ++i) { - if (trkDir[i].okECAL) - std::cout << "Track [" << i << "] Flag: " << trkDir[i].ok << " ECAL (" << trkDir[i].okECAL << ")"; + std::ostringstream st1, st2; if (trkDir[i].okECAL) { - std::cout << " point " << trkDir[i].pointECAL << " direction " << trkDir[i].directionECAL << " "; + st1 << " point " << trkDir[i].pointECAL << " direction " << trkDir[i].directionECAL << " "; if (trkDir[i].detIdECAL.subdetId() == EcalBarrel) { - std::cout << (EBDetId)(trkDir[i].detIdECAL); + st1 << (EBDetId)(trkDir[i].detIdECAL); } else { - std::cout << (EEDetId)(trkDir[i].detIdECAL); + st1 << (EEDetId)(trkDir[i].detIdECAL); } } - if (trkDir[i].okECAL) - std::cout << " HCAL (" << trkDir[i].okHCAL << ")"; + st2 << " HCAL (" << trkDir[i].okHCAL << ")"; if (trkDir[i].okHCAL) { - std::cout << " point " << trkDir[i].pointHCAL << " direction " << trkDir[i].directionHCAL << " " - << (HcalDetId)(trkDir[i].detIdHCAL); + st2 << " point " << trkDir[i].pointHCAL << " direction " << trkDir[i].directionHCAL << " " + << (HcalDetId)(trkDir[i].detIdHCAL); } - if (trkDir[i].okECAL) - std::cout << " Or " << (HcalDetId)(trkDir[i].detIdEHCAL) << std::endl; + edm::LogVerbatim("IsoTrack") << "Track [" << i << "] Flag: " << trkDir[i].ok << " ECAL (" << trkDir[i].okECAL + << ")" << st1.str() << st2.str() << " Or " << (HcalDetId)(trkDir[i].detIdEHCAL); } } -#endif return trkDir; } @@ -558,11 +525,9 @@ namespace spr { trkD.detIdECAL = DetId(0); trkD.detIdHCAL = DetId(0); trkD.detIdEHCAL = DetId(0); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "Propagate track " << thisTrk << " charge " << trk.charge << " position " << trk.position << " p " - << trk.momentum << " Flag " << trkD.ok << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "Propagate track " << thisTrk << " charge " << trk.charge << " position " + << trk.position << " p " << trk.momentum << " Flag " << trkD.ok; if (trkD.ok) { spr::propagatedTrack info = spr::propagateCalo( trk.position, trk.momentum, trk.charge, bField, spr::zFrontEE, spr::rFrontEB, spr::etaBEEcal, debug); @@ -592,27 +557,26 @@ namespace spr { trkD.detIdHCAL = gHB->getClosestCell(point); } } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "propagateCALO:: for track [" << thisTrk << "] Flag: " << trkD.ok << " ECAL (" << trkD.okECAL - << ") HCAL (" << trkD.okHCAL << ")" << std::endl; + edm::LogVerbatim("IsoTrack") << "propagateCALO:: for track [" << thisTrk << "] Flag: " << trkD.ok << " ECAL (" + << trkD.okECAL << ") HCAL (" << trkD.okHCAL << ")"; + std::ostringstream st1; if (trkD.okECAL) { - std::cout << "ECAL point " << trkD.pointECAL << " direction " << trkD.directionECAL << " "; + st1 << "ECAL point " << trkD.pointECAL << " direction " << trkD.directionECAL << " "; if (trkD.detIdECAL.subdetId() == EcalBarrel) { - std::cout << (EBDetId)(trkD.detIdECAL); + st1 << (EBDetId)(trkD.detIdECAL); } else { - std::cout << (EEDetId)(trkD.detIdECAL); + st1 << (EEDetId)(trkD.detIdECAL); } } if (trkD.okHCAL) { - std::cout << " HCAL point " << trkD.pointHCAL << " direction " << trkD.directionHCAL << " " - << (HcalDetId)(trkD.detIdHCAL); + st1 << " HCAL point " << trkD.pointHCAL << " direction " << trkD.directionHCAL << " " + << (HcalDetId)(trkD.detIdHCAL); } if (trkD.okECAL) - std::cout << " Or " << (HcalDetId)(trkD.detIdEHCAL); - std::cout << std::endl; + st1 << " Or " << (HcalDetId)(trkD.detIdEHCAL); + edm::LogVerbatim("IsoTrack") << st1.str(); } -#endif return trkD; } @@ -629,11 +593,9 @@ namespace spr { trkD.detIdECAL = DetId(0); trkD.detIdHCAL = DetId(0); trkD.detIdEHCAL = DetId(0); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "Propagate track " << thisTrk << " charge " << trk.charge << " position " << trk.position << " p " - << trk.momentum << " Flag " << trkD.ok << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "Propagate track " << thisTrk << " charge " << trk.charge << " position " + << trk.position << " p " << trk.momentum << " Flag " << trkD.ok; if (trkD.ok) { spr::propagatedTrack info = spr::propagateCalo( trk.position, trk.momentum, trk.charge, bField, spr::zBackHE, spr::rBackHB, spr::etaBEHcal, debug); @@ -645,16 +607,15 @@ namespace spr { trkD.detIdHCAL = gHB->getClosestCell(point); } } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "propagateCALO:: for track [" << thisTrk << "] Flag: " << trkD.ok << " ECAL (" << trkD.okECAL - << ") HCAL (" << trkD.okHCAL << ")" << std::endl; + std::ostringstream st1; if (trkD.okHCAL) { - std::cout << " HCAL point " << trkD.pointHCAL << " direction " << trkD.directionHCAL << " " - << (HcalDetId)(trkD.detIdHCAL); + st1 << " HCAL point " << trkD.pointHCAL << " direction " << trkD.directionHCAL << " " + << (HcalDetId)(trkD.detIdHCAL); } + edm::LogVerbatim("IsoTrack") << "propagateCALO:: for track [" << thisTrk << "] Flag: " << trkD.ok << " ECAL (" + << trkD.okECAL << ") HCAL (" << trkD.okHCAL << ")" << st1.str(); } -#endif return trkD; } @@ -781,22 +742,15 @@ namespace spr { std::pair propagateTrackerEnd(const reco::Track* track, const MagneticField* bField, - bool -#ifdef EDM_ML_DEBUG - debug -#endif - ) { - + bool debug) { const GlobalPoint vertex(track->vx(), track->vy(), track->vz()); const GlobalVector momentum(track->px(), track->py(), track->pz()); int charge(track->charge()); float radius = track->outerPosition().Rho(); float zdist = track->outerPosition().Z(); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "propagateTrackerEnd:: Vertex " << vertex << " Momentum " << momentum << " Charge " << charge - << " Radius " << radius << " Z " << zdist << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "propagateTrackerEnd:: Vertex " << vertex << " Momentum " << momentum + << " Charge " << charge << " Radius " << radius << " Z " << zdist; FreeTrajectoryState fts(vertex, momentum, charge, bField); Plane::PlanePointer endcap = Plane::build(Plane::PositionType(0, 0, zdist), Plane::RotationType()); Cylinder::CylinderPointer barrel = @@ -829,13 +783,11 @@ namespace spr { double dZ = vDiff.z(); double dS = rdist * rat; //dZ*momentum.z()/momentum.perp(); length = std::sqrt(dS * dS + dZ * dZ); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "propagateTracker:: Barrel " << tsosb.isValid() << " Endcap " << tsose.isValid() << " OverAll " - << ok << " Point " << point << " RDist " << rdist << " dS " << dS << " dS/pt " - << rdist * rat / momentum.perp() << " zdist " << dZ << " dz/pz " << dZ / momentum.z() << " Length " - << length << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "propagateTracker:: Barrel " << tsosb.isValid() << " Endcap " << tsose.isValid() + << " OverAll " << ok << " Point " << point << " RDist " << rdist << " dS " << dS + << " dS/pt " << rdist * rat / momentum.perp() << " zdist " << dZ << " dz/pz " + << dZ / momentum.z() << " Length " << length; } return std::pair(point, length); @@ -848,18 +800,11 @@ namespace spr { float zdist, float radius, float corner, - bool -#ifdef EDM_ML_DEBUG - debug -#endif - ) { - + bool debug) { spr::propagatedTrack track; -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "propagateCalo:: Vertex " << tpVertex << " Momentum " << tpMomentum << " Charge " << tpCharge - << " Radius " << radius << " Z " << zdist << " Corner " << corner << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "propagateCalo:: Vertex " << tpVertex << " Momentum " << tpMomentum << " Charge " + << tpCharge << " Radius " << radius << " Z " << zdist << " Corner " << corner; FreeTrajectoryState fts(tpVertex, tpMomentum, tpCharge, bField); Plane::PlanePointer lendcap = Plane::build(Plane::PositionType(0, 0, -zdist), Plane::RotationType()); @@ -900,10 +845,10 @@ namespace spr { track.direction = GlobalVector(0, 0, 1); track.ok = false; } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "propagateCalo:: Barrel " << tsosb.isValid() << " Endcap " << tsose.isValid() << " OverAll " - << track.ok << " Point " << track.point << " Direction " << track.direction << std::endl; + edm::LogVerbatim("IsoTrack") << "propagateCalo:: Barrel " << tsosb.isValid() << " Endcap " << tsose.isValid() + << " OverAll " << track.ok << " Point " << track.point << " Direction " + << track.direction; if (track.ok) { math::XYZPoint vDiff( track.point.x() - tpVertex.x(), track.point.y() - tpVertex.y(), track.point.z() - tpVertex.z()); @@ -911,32 +856,26 @@ namespace spr { double rdist = std::sqrt(vDiff.x() * vDiff.x() + vDiff.y() * vDiff.y()); double pt = tpMomentum.perp(); double rat = 0.5 * dphi / std::sin(0.5 * dphi); - std::cout << "RDist " << rdist << " pt " << pt << " r/pt " << rdist * rat / pt << " zdist " << vDiff.z() - << " pz " << tpMomentum.z() << " z/pz " << vDiff.z() / tpMomentum.z() << std::endl; + edm::LogVerbatim("IsoTrack") << "RDist " << rdist << " pt " << pt << " r/pt " << rdist * rat / pt << " zdist " + << vDiff.z() << " pz " << tpMomentum.z() << " z/pz " << vDiff.z() / tpMomentum.z() + << std::endl; } } -#endif return track; } spr::trackAtOrigin simTrackAtOrigin(unsigned int thisTrk, edm::Handle& SimTk, edm::Handle& SimVtx, - bool -#ifdef EDM_ML_DEBUG - debug -#endif - ) { - + bool debug) { spr::trackAtOrigin trk; edm::SimTrackContainer::const_iterator itr = SimTk->end(); for (edm::SimTrackContainer::const_iterator simTrkItr = SimTk->begin(); simTrkItr != SimTk->end(); simTrkItr++) { if (simTrkItr->trackId() == thisTrk) { -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "matched trackId (maximum occurance) " << thisTrk << " type " << simTrkItr->type() << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "matched trackId (maximum occurance) " << thisTrk << " type " + << simTrkItr->type(); itr = simTrkItr; break; } @@ -956,10 +895,9 @@ namespace spr { trk.momentum = GlobalVector(mom.x(), mom.y(), mom.z()); } } -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "Track flag " << trk.ok << " Position " << trk.position << " Momentum " << trk.momentum << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "Track flag " << trk.ok << " Position " << trk.position << " Momentum " + << trk.momentum; return trk; } @@ -972,10 +910,9 @@ namespace spr { const GlobalPoint vertex(track->vx(), track->vy(), track->vz()); const GlobalVector momentum(track->px(), track->py(), track->pz()); int charge(track->charge()); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "Propagate track with charge " << charge << " position " << vertex << " p " << momentum << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "Propagate track with charge " << charge << " position " << vertex << " p " + << momentum; std::pair ids = propagateHCAL(geo, bField, vertex, momentum, charge, typeRZ, rz, debug); bool ok = ((ids.first != HcalDetId()) && (ids.first.ieta() == ids.second.ieta()) && (ids.first.iphi() == ids.second.iphi())); @@ -991,11 +928,9 @@ namespace spr { const std::pair rz, bool debug) { spr::trackAtOrigin trk = spr::simTrackAtOrigin(thisTrk, SimTk, SimVtx, debug); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "Propagate track " << thisTrk << " charge " << trk.charge << " position " << trk.position << " p " - << trk.momentum << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "Propagate track " << thisTrk << " charge " << trk.charge << " position " + << trk.position << " p " << trk.momentum; std::pair ids = propagateHCAL(geo, bField, trk.position, trk.momentum, trk.charge, typeRZ, rz, debug); bool ok = ((ids.first != HcalDetId()) && (ids.first.ieta() == ids.second.ieta()) && @@ -1010,17 +945,10 @@ namespace spr { int charge, bool typeRZ, const std::pair rz, - bool -#ifdef EDM_ML_DEBUG - debug -#endif - ) { - -#ifdef EDM_ML_DEBUG + bool debug) { if (debug) - std::cout << "propagateCalo:: Vertex " << vertex << " Momentum " << momentum << " Charge " << charge << " R/Z " - << rz.first << " : " << rz.second << " Type " << typeRZ << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "propagateCalo:: Vertex " << vertex << " Momentum " << momentum << " Charge " + << charge << " R/Z " << rz.first << " : " << rz.second << " Type " << typeRZ; const CaloSubdetectorGeometry* gHB = geo->getSubdetectorGeometry(DetId::Hcal, HcalBarrel); FreeTrajectoryState fts(vertex, momentum, charge, bField); AnalyticalPropagator myAP(bField, alongMomentum, 2 * M_PI); @@ -1044,22 +972,18 @@ namespace spr { id1 = gHB->getClosestCell(point); else id2 = gHB->getClosestCell(point); -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "Iteration " << k << " Point " << point << " ID "; + std::ostringstream st1; if (k == 0) - std::cout << id1; + st1 << id1; else - std::cout << id2; - std::cout << std::endl; + st1 << id2; + edm::LogVerbatim("IsoTrack") << "Iteration " << k << " Point " << point << " ID " << st1.str(); } -#endif } } -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "propagateCalo:: Front " << id1 << " Back " << id2 << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "propagateCalo:: Front " << id1 << " Back " << id2; return std::pair(id1, id2); } } // namespace spr diff --git a/Calibration/IsolatedParticles/src/CaloSimInfo.cc b/Calibration/IsolatedParticles/src/CaloSimInfo.cc index 2ab2cf2b0e8b6..d87a516c537cc 100644 --- a/Calibration/IsolatedParticles/src/CaloSimInfo.cc +++ b/Calibration/IsolatedParticles/src/CaloSimInfo.cc @@ -8,9 +8,7 @@ #include "CLHEP/Units/PhysicalConstants.h" #include "CLHEP/Units/SystemOfUnits.h" -#include - -//#define EDM_ML_DEBUG +#include namespace spr { @@ -20,7 +18,6 @@ namespace spr { : geo->getPosition(id); double R = point.mag(); double tmp = R / CLHEP::c_light / CLHEP::ns; -#ifdef EDM_ML_DEBUG if (debug) { DetId::Detector det = id.det(); int subdet = id.subdetId(); @@ -55,10 +52,10 @@ namespace spr { } double tmp1 = dist / CLHEP::c_light / CLHEP::ns; - std::cout << "Detector " << det << "/" << subdet << " Eta/Theta " << eta << "/" << theta / CLHEP::deg << " Dist " - << dist / CLHEP::cm << " R " << R << " TOF " << tmp << ":" << tmp1 << std::endl; + edm::LogVerbatim("IsoTrack") << "Detector " << det << "/" << subdet << " Eta/Theta " << eta << "/" + << theta / CLHEP::deg << " Dist " << dist / CLHEP::cm << " R " << R << " TOF " << tmp + << ":" << tmp1; } -#endif return tmp; } diff --git a/Calibration/IsolatedParticles/src/ChargeIsolation.cc b/Calibration/IsolatedParticles/src/ChargeIsolation.cc index bdd29d2bc9752..df5943e481749 100644 --- a/Calibration/IsolatedParticles/src/ChargeIsolation.cc +++ b/Calibration/IsolatedParticles/src/ChargeIsolation.cc @@ -4,12 +4,9 @@ #include "Calibration/IsolatedParticles/interface/FindDistCone.h" #include "Calibration/IsolatedParticles/interface/MatrixECALDetIds.h" #include "Calibration/IsolatedParticles/interface/MatrixHCALDetIds.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h" -#include - -//#define EDM_ML_DEBUG - namespace spr { double chargeIsolationEcal(unsigned int trkIndex, @@ -20,21 +17,18 @@ namespace spr { int iphi, bool debug) { const DetId coreDet = vdetIds[trkIndex].detIdECAL; -#ifdef EDM_ML_DEBUG if (debug) { if (coreDet.subdetId() == EcalBarrel) - std::cout << "DetId " << (EBDetId)(coreDet) << " Flag " << vdetIds[trkIndex].okECAL << std::endl; + edm::LogVerbatim("IsoTrack") << "DetId " << (EBDetId)(coreDet) << " Flag " << vdetIds[trkIndex].okECAL; else - std::cout << "DetId " << (EEDetId)(coreDet) << " Flag " << vdetIds[trkIndex].okECAL << std::endl; + edm::LogVerbatim("IsoTrack") << "DetId " << (EEDetId)(coreDet) << " Flag " << vdetIds[trkIndex].okECAL; } -#endif double maxNearP = -1.0; if (vdetIds[trkIndex].okECAL) { std::vector vdets = spr::matrixECALIds(coreDet, ieta, iphi, geo, caloTopology, debug); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "chargeIsolationEcal:: eta/phi/dets " << ieta << " " << iphi << " " << vdets.size() << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "chargeIsolationEcal:: eta/phi/dets " << ieta << " " << iphi << " " + << vdets.size(); for (unsigned int indx = 0; indx < vdetIds.size(); ++indx) { if (indx != trkIndex && vdetIds[indx].ok && vdetIds[indx].okECAL) { @@ -64,10 +58,9 @@ namespace spr { const CaloSubdetectorGeometry* endcapGeom = (geo->getSubdetectorGeometry(DetId::Ecal, EcalEndcap)); std::vector vdets = spr::matrixECALIds(coreDet, ieta, iphi, geo, caloTopology, debug); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "chargeIsolation:: eta/phi/dets " << ieta << " " << iphi << " " << vdets.size() << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "chargeIsolation:: eta/phi/dets " << ieta << " " << iphi << " " << vdets.size(); + double maxNearP = -1.0; reco::TrackBase::TrackQuality trackQuality_ = reco::TrackBase::qualityByName(theTrackQuality); @@ -85,10 +78,9 @@ namespace spr { if (std::abs(point2.eta()) < spr::etaBEEcal) { const DetId anyCell = barrelGeom->getClosestCell(point2); if (!spr::chargeIsolation(anyCell, vdets)) { -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "chargeIsolationEcal Cell " << (EBDetId)(anyCell) << " pt " << pTrack2->p() << std::endl; -#endif + edm::LogVerbatim("IsoTrack") + << "chargeIsolationEcal Cell " << (EBDetId)(anyCell) << " pt " << pTrack2->p(); if (maxNearP < pTrack2->p()) maxNearP = pTrack2->p(); } @@ -96,10 +88,9 @@ namespace spr { if (endcapGeom) { const DetId anyCell = endcapGeom->getClosestCell(point2); if (!spr::chargeIsolation(anyCell, vdets)) { -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "chargeIsolationEcal Cell " << (EEDetId)(anyCell) << " pt " << pTrack2->p() << std::endl; -#endif + edm::LogVerbatim("IsoTrack") + << "chargeIsolationEcal Cell " << (EEDetId)(anyCell) << " pt " << pTrack2->p(); if (maxNearP < pTrack2->p()) maxNearP = pTrack2->p(); } @@ -118,27 +109,25 @@ namespace spr { int iphi, bool debug) { std::vector dets(1, vdetIds[trkIndex].detIdHCAL); -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "DetId " << (HcalDetId)(dets[0]) << " Flag " << vdetIds[trkIndex].okHCAL << std::endl; + edm::LogVerbatim("IsoTrack") << "DetId " << (HcalDetId)(dets[0]) << " Flag " << vdetIds[trkIndex].okHCAL; } -#endif + double maxNearP = -1.0; if (vdetIds[trkIndex].okHCAL) { std::vector vdets = spr::matrixHCALIds(dets, topology, ieta, iphi, false, debug); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "chargeIsolationHcal:: eta/phi/dets " << ieta << " " << iphi << " " << vdets.size() << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "chargeIsolationHcal:: eta/phi/dets " << ieta << " " << iphi << " " + << vdets.size(); + for (unsigned indx = 0; indx < vdetIds.size(); ++indx) { if (indx != trkIndex && vdetIds[indx].ok && vdetIds[indx].okHCAL) { const DetId anyCell = vdetIds[indx].detIdHCAL; if (!spr::chargeIsolation(anyCell, vdets)) { const reco::Track* pTrack = &(*(vdetIds[indx].trkItr)); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "chargeIsolationHcal Cell " << (HcalDetId)(anyCell) << " pt " << pTrack->p() << std::endl; -#endif + edm::LogVerbatim("IsoTrack") + << "chargeIsolationHcal Cell " << (HcalDetId)(anyCell) << " pt " << pTrack->p(); if (maxNearP < pTrack->p()) maxNearP = pTrack->p(); } @@ -161,19 +150,17 @@ namespace spr { const std::string& theTrackQuality, bool debug) { std::vector dets(1, ClosestCell); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << (HcalDetId)ClosestCell << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << (HcalDetId)ClosestCell; std::vector vdets = spr::matrixHCALIds(dets, topology, ieta, iphi, false, debug); -#ifdef EDM_ML_DEBUG if (debug) { for (unsigned int i = 0; i < vdets.size(); i++) { - std::cout << "HcalDetId in " << 2 * ieta + 1 << "x" << 2 * iphi + 1 << " " << (HcalDetId)vdets[i] << std::endl; + edm::LogVerbatim("IsoTrack") << "HcalDetId in " << 2 * ieta + 1 << "x" << 2 * iphi + 1 << " " + << static_cast(vdets[i]); } } -#endif + double maxNearP = -1.0; reco::TrackBase::TrackQuality trackQuality_ = reco::TrackBase::qualityByName(theTrackQuality); @@ -186,24 +173,20 @@ namespace spr { std::pair info = spr::propagateHCAL(pTrack2, bField); const GlobalPoint point2(info.first.x(), info.first.y(), info.first.z()); -#ifdef EDM_ML_DEBUG - if (debug) { - std::cout << "Track2 (p,eta,phi) " << pTrack2->p() << " " << pTrack2->eta() << " " << pTrack2->phi() - << std::endl; - } -#endif + if (debug) + edm::LogVerbatim("IsoTrack") << "Track2 (p,eta,phi) " << pTrack2->p() << " " << pTrack2->eta() << " " + << pTrack2->phi(); if (info.second) { const DetId anyCell = gHB->getClosestCell(point2); if (!spr::chargeIsolation(anyCell, vdets)) { if (maxNearP < pTrack2->p()) maxNearP = pTrack2->p(); } -#ifdef EDM_ML_DEBUG - if (debug) { - std::cout << "maxNearP " << maxNearP << " thisCell " << (HcalDetId)anyCell << " (" << info.first.x() << "," - << info.first.y() << "," << info.first.z() << ")" << std::endl; - } -#endif + + if (debug) + edm::LogVerbatim("IsoTrack") << "maxNearP " << maxNearP << " thisCell " << static_cast(anyCell) + << " (" << info.first.x() << "," << info.first.y() << "," << info.first.z() + << ")"; } } } @@ -293,10 +276,8 @@ namespace spr { double maxNearP = -1.0; nNearTRKs = 0; if (trkDirs[trkIndex].okHCAL) { -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "chargeIsolationCone with " << trkDirs.size() << " tracks " << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "chargeIsolationCone with " << trkDirs.size() << " tracks "; for (unsigned int indx = 0; indx < trkDirs.size(); ++indx) { if (indx != trkIndex && trkDirs[indx].ok && trkDirs[indx].okHCAL) { int isConeChargedIso = spr::coneChargeIsolation( @@ -310,10 +291,10 @@ namespace spr { } } } -#ifdef EDM_ML_DEBUG + if (debug) - std::cout << "chargeIsolationCone Track " << trkDirs[trkIndex].okHCAL << " maxNearP " << maxNearP << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "chargeIsolationCone Track " << trkDirs[trkIndex].okHCAL << " maxNearP " + << maxNearP; return maxNearP; } @@ -324,10 +305,8 @@ namespace spr { double maxNearP = -1.0; double sumP = 0; if (trkDirs[trkIndex].okHCAL) { -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "chargeIsolationCone with " << trkDirs.size() << " tracks " << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "chargeIsolationCone with " << trkDirs.size() << " tracks "; for (unsigned int indx = 0; indx < trkDirs.size(); ++indx) { if (indx != trkIndex && trkDirs[indx].ok && trkDirs[indx].okHCAL) { int isConeChargedIso = spr::coneChargeIsolation( @@ -341,11 +320,10 @@ namespace spr { } } } -#ifdef EDM_ML_DEBUG + if (debug) - std::cout << "chargeIsolationCone Track " << trkDirs[trkIndex].okHCAL << " maxNearP " << maxNearP << ":" << sumP - << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "chargeIsolationCone Track " << trkDirs[trkIndex].okHCAL << " maxNearP " + << maxNearP << ":" << sumP; return std::pair(maxNearP, sumP); } @@ -361,4 +339,210 @@ namespace spr { return isIsolated; } + double chargeIsolation(const edm::Event& iEvent, + const edm::EventSetup& iSetup, + CaloNavigator& theNavigator, + reco::TrackCollection::const_iterator trkItr, + edm::Handle trkCollection, + const CaloSubdetectorGeometry* gEB, + const CaloSubdetectorGeometry* gEE, + TrackDetectorAssociator& associator, + TrackAssociatorParameters& parameters_, + int ieta, + int iphi, + const std::string& theTrackQuality, + bool debug) { + double maxNearP = -1.0; + reco::TrackBase::TrackQuality trackQuality_ = reco::TrackBase::qualityByName(theTrackQuality); + + // const DetId anyCell, + reco::TrackCollection::const_iterator trkItr2; + for (trkItr2 = trkCollection->begin(); trkItr2 != trkCollection->end(); ++trkItr2) { + const reco::Track* pTrack2 = &(*trkItr2); + + bool trkQuality = pTrack2->quality(trackQuality_); + if ((trkItr2 != trkItr) && trkQuality) { + const FreeTrajectoryState fts2 = + associator.getFreeTrajectoryState(&iSetup.getData(parameters_.bFieldToken), *pTrack2); + TrackDetMatchInfo info2 = associator.associate(iEvent, iSetup, fts2, parameters_); + const GlobalPoint point2(info2.trkGlobPosAtEcal.x(), info2.trkGlobPosAtEcal.y(), info2.trkGlobPosAtEcal.z()); + + if (info2.isGoodEcal) { + if (std::abs(point2.eta()) < spr::etaBEEcal) { + const DetId anyCell = gEB->getClosestCell(point2); + if (debug) + edm::LogVerbatim("IsoTrack") + << "chargeIsolation:: EB cell " << (EBDetId)(anyCell) << " for pt " << pTrack2->p(); + if (!spr::chargeIsolation(anyCell, theNavigator, ieta, iphi)) { + if (maxNearP < pTrack2->p()) + maxNearP = pTrack2->p(); + } + } else { + const DetId anyCell = gEE->getClosestCell(point2); + if (debug) + edm::LogVerbatim("IsoTrack") + << "chargeIsolation:: EE cell " << (EEDetId)(anyCell) << " for pt " << pTrack2->p(); + if (!spr::chargeIsolation(anyCell, theNavigator, ieta, iphi)) { + if (maxNearP < pTrack2->p()) + maxNearP = pTrack2->p(); + } + } + } //info2.isGoodEcal + } + } + return maxNearP; + } + + //=========================================================================================================== + + bool chargeIsolation(const DetId anyCell, CaloNavigator& navigator, int ieta, int iphi) { + bool isIsolated = false; + + DetId thisDet; + + for (int dx = -ieta; dx < ieta + 1; ++dx) { + for (int dy = -iphi; dy < iphi + 1; ++dy) { + thisDet = navigator.offsetBy(dx, dy); + navigator.home(); + + if (thisDet != DetId(0)) { + if (thisDet == anyCell) { + isIsolated = false; + return isIsolated; + } + } + } + } + return isIsolated; + } + + //=========================================================================================================== + + double chargeIsolationEcal(const edm::Event& iEvent, + const edm::EventSetup& iSetup, + const DetId& coreDet, + reco::TrackCollection::const_iterator trkItr, + edm::Handle trkCollection, + const CaloGeometry* geo, + const CaloTopology* caloTopology, + TrackDetectorAssociator& associator, + TrackAssociatorParameters& parameters_, + int ieta, + int iphi, + const std::string& theTrackQuality, + bool debug) { + const CaloSubdetectorGeometry* barrelGeom = (geo->getSubdetectorGeometry(DetId::Ecal, EcalBarrel)); + const CaloSubdetectorGeometry* endcapGeom = (geo->getSubdetectorGeometry(DetId::Ecal, EcalEndcap)); + + std::vector vdets = spr::matrixECALIds(coreDet, ieta, iphi, geo, caloTopology, debug); + if (debug) + edm::LogVerbatim("IsoTrack") << "chargeIsolation:: eta/phi/dets " << ieta << " " << iphi << " " << vdets.size(); + + double maxNearP = -1.0; + reco::TrackBase::TrackQuality trackQuality_ = reco::TrackBase::qualityByName(theTrackQuality); + + // const DetId anyCell, + reco::TrackCollection::const_iterator trkItr2; + for (trkItr2 = trkCollection->begin(); trkItr2 != trkCollection->end(); ++trkItr2) { + const reco::Track* pTrack2 = &(*trkItr2); + + bool trkQuality = pTrack2->quality(trackQuality_); + if ((trkItr2 != trkItr) && trkQuality) { + const FreeTrajectoryState fts2 = + associator.getFreeTrajectoryState(&iSetup.getData(parameters_.bFieldToken), *pTrack2); + TrackDetMatchInfo info2 = associator.associate(iEvent, iSetup, fts2, parameters_); + const GlobalPoint point2(info2.trkGlobPosAtEcal.x(), info2.trkGlobPosAtEcal.y(), info2.trkGlobPosAtEcal.z()); + + if (info2.isGoodEcal) { + if (std::abs(point2.eta()) < spr::etaBEEcal) { + const DetId anyCell = barrelGeom->getClosestCell(point2); + if (debug) + edm::LogVerbatim("IsoTrack") + << "chargeIsolation:: EB cell " << (EBDetId)(anyCell) << " for pt " << pTrack2->p(); + if (!spr::chargeIsolation(anyCell, vdets)) { + if (maxNearP < pTrack2->p()) + maxNearP = pTrack2->p(); + } + } else { + const DetId anyCell = endcapGeom->getClosestCell(point2); + if (debug) + edm::LogVerbatim("IsoTrack") + << "chargeIsolation:: EE cell " << (EEDetId)(anyCell) << " for pt " << pTrack2->p(); + if (!spr::chargeIsolation(anyCell, vdets)) { + if (maxNearP < pTrack2->p()) + maxNearP = pTrack2->p(); + } + } + } //info2.isGoodEcal + } + } + return maxNearP; + } + + //=========================================================================================================== + + double chargeIsolationHcal(const edm::Event& iEvent, + const edm::EventSetup& iSetup, + reco::TrackCollection::const_iterator trkItr, + edm::Handle trkCollection, + const DetId ClosestCell, + const HcalTopology* topology, + const CaloSubdetectorGeometry* gHB, + TrackDetectorAssociator& associator, + TrackAssociatorParameters& parameters_, + int ieta, + int iphi, + const std::string& theTrackQuality, + bool debug) { + std::vector dets(1, ClosestCell); + + if (debug) + edm::LogVerbatim("IsoTrack") << static_cast(ClosestCell); + std::vector vdets = spr::matrixHCALIds(dets, topology, ieta, iphi, false, debug); + + if (debug) { + for (unsigned int i = 0; i < vdets.size(); i++) { + edm::LogVerbatim("IsoTrack") << "HcalDetId in " << 2 * ieta + 1 << "x" << 2 * iphi + 1 << " " + << static_cast(vdets[i]); + } + } + + double maxNearP = -1.0; + reco::TrackBase::TrackQuality trackQuality_ = reco::TrackBase::qualityByName(theTrackQuality); + + reco::TrackCollection::const_iterator trkItr2; + for (trkItr2 = trkCollection->begin(); trkItr2 != trkCollection->end(); ++trkItr2) { + const reco::Track* pTrack2 = &(*trkItr2); + + bool trkQuality = pTrack2->quality(trackQuality_); + if ((trkItr2 != trkItr) && trkQuality) { + const FreeTrajectoryState fts2 = + associator.getFreeTrajectoryState(&iSetup.getData(parameters_.bFieldToken), *pTrack2); + TrackDetMatchInfo info2 = associator.associate(iEvent, iSetup, fts2, parameters_); + const GlobalPoint point2(info2.trkGlobPosAtHcal.x(), info2.trkGlobPosAtHcal.y(), info2.trkGlobPosAtHcal.z()); + + if (debug) + edm::LogVerbatim("IsoTrack") << "Track2 (p,eta,phi) " << pTrack2->p() << " " << pTrack2->eta() << " " + << pTrack2->phi(); + + if (info2.isGoodHcal) { + const DetId anyCell = gHB->getClosestCell(point2); + if (debug) + edm::LogVerbatim("IsoTrack") << "chargeIsolation:: HCAL cell " << static_cast(anyCell) + << " for pt " << pTrack2->p(); + if (!spr::chargeIsolation(anyCell, vdets)) { + if (maxNearP < pTrack2->p()) + maxNearP = pTrack2->p(); + } + if (debug) { + edm::LogVerbatim("IsoTrack") << "maxNearP " << maxNearP << " thisCell " << static_cast(anyCell) + << " (" << info2.trkGlobPosAtHcal.x() << "," << info2.trkGlobPosAtHcal.y() + << "," << info2.trkGlobPosAtHcal.z() << ")"; + } + } + } + } + return maxNearP; + } + } // namespace spr diff --git a/Calibration/IsolatedParticles/src/ChargeIsolationExtra.cc b/Calibration/IsolatedParticles/src/ChargeIsolationExtra.cc deleted file mode 100644 index 9435a41ff830a..0000000000000 --- a/Calibration/IsolatedParticles/src/ChargeIsolationExtra.cc +++ /dev/null @@ -1,244 +0,0 @@ -#include "Calibration/IsolatedParticles/interface/CaloConstants.h" -#include "Calibration/IsolatedParticles/interface/ChargeIsolationExtra.h" -#include "Calibration/IsolatedParticles/interface/ChargeIsolation.h" -#include "Calibration/IsolatedParticles/interface/CaloPropagateTrack.h" -#include "Calibration/IsolatedParticles/interface/FindDistCone.h" -#include "Calibration/IsolatedParticles/interface/MatrixECALDetIds.h" -#include "Calibration/IsolatedParticles/interface/MatrixHCALDetIds.h" -#include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h" - -#include - -//#define EDM_ML_DEBUG - -namespace spr { - - double chargeIsolation(const edm::Event& iEvent, - const edm::EventSetup& iSetup, - CaloNavigator& theNavigator, - reco::TrackCollection::const_iterator trkItr, - edm::Handle trkCollection, - const CaloSubdetectorGeometry* gEB, - const CaloSubdetectorGeometry* gEE, - TrackDetectorAssociator& associator, - TrackAssociatorParameters& parameters_, - int ieta, - int iphi, - const std::string& theTrackQuality, - bool -#ifdef EDM_ML_DEBUG - debug -#endif - ) { - - double maxNearP = -1.0; - reco::TrackBase::TrackQuality trackQuality_ = reco::TrackBase::qualityByName(theTrackQuality); - - // const DetId anyCell, - reco::TrackCollection::const_iterator trkItr2; - for (trkItr2 = trkCollection->begin(); trkItr2 != trkCollection->end(); ++trkItr2) { - const reco::Track* pTrack2 = &(*trkItr2); - - bool trkQuality = pTrack2->quality(trackQuality_); - if ((trkItr2 != trkItr) && trkQuality) { - const FreeTrajectoryState fts2 = - associator.getFreeTrajectoryState(&iSetup.getData(parameters_.bFieldToken), *pTrack2); - TrackDetMatchInfo info2 = associator.associate(iEvent, iSetup, fts2, parameters_); - const GlobalPoint point2(info2.trkGlobPosAtEcal.x(), info2.trkGlobPosAtEcal.y(), info2.trkGlobPosAtEcal.z()); - - if (info2.isGoodEcal) { - if (std::abs(point2.eta()) < spr::etaBEEcal) { - const DetId anyCell = gEB->getClosestCell(point2); -#ifdef EDM_ML_DEBUG - if (debug) - std::cout << "chargeIsolation:: EB cell " << (EBDetId)(anyCell) << " for pt " << pTrack2->p() - << std::endl; -#endif - if (!spr::chargeIsolation(anyCell, theNavigator, ieta, iphi)) { - if (maxNearP < pTrack2->p()) - maxNearP = pTrack2->p(); - } - } else { - const DetId anyCell = gEE->getClosestCell(point2); -#ifdef EDM_ML_DEBUG - if (debug) - std::cout << "chargeIsolation:: EE cell " << (EEDetId)(anyCell) << " for pt " << pTrack2->p() - << std::endl; -#endif - if (!spr::chargeIsolation(anyCell, theNavigator, ieta, iphi)) { - if (maxNearP < pTrack2->p()) - maxNearP = pTrack2->p(); - } - } - } //info2.isGoodEcal - } - } - return maxNearP; - } - - //=========================================================================================================== - - bool chargeIsolation(const DetId anyCell, CaloNavigator& navigator, int ieta, int iphi) { - bool isIsolated = false; - - DetId thisDet; - - for (int dx = -ieta; dx < ieta + 1; ++dx) { - for (int dy = -iphi; dy < iphi + 1; ++dy) { - thisDet = navigator.offsetBy(dx, dy); - navigator.home(); - - if (thisDet != DetId(0)) { - if (thisDet == anyCell) { - isIsolated = false; - return isIsolated; - } - } - } - } - return isIsolated; - } - - //=========================================================================================================== - - double chargeIsolationEcal(const edm::Event& iEvent, - const edm::EventSetup& iSetup, - const DetId& coreDet, - reco::TrackCollection::const_iterator trkItr, - edm::Handle trkCollection, - const CaloGeometry* geo, - const CaloTopology* caloTopology, - TrackDetectorAssociator& associator, - TrackAssociatorParameters& parameters_, - int ieta, - int iphi, - const std::string& theTrackQuality, - bool debug) { - const CaloSubdetectorGeometry* barrelGeom = (geo->getSubdetectorGeometry(DetId::Ecal, EcalBarrel)); - const CaloSubdetectorGeometry* endcapGeom = (geo->getSubdetectorGeometry(DetId::Ecal, EcalEndcap)); - - std::vector vdets = spr::matrixECALIds(coreDet, ieta, iphi, geo, caloTopology, debug); -#ifdef EDM_ML_DEBUG - if (debug) - std::cout << "chargeIsolation:: eta/phi/dets " << ieta << " " << iphi << " " << vdets.size() << std::endl; -#endif - double maxNearP = -1.0; - reco::TrackBase::TrackQuality trackQuality_ = reco::TrackBase::qualityByName(theTrackQuality); - - // const DetId anyCell, - reco::TrackCollection::const_iterator trkItr2; - for (trkItr2 = trkCollection->begin(); trkItr2 != trkCollection->end(); ++trkItr2) { - const reco::Track* pTrack2 = &(*trkItr2); - - bool trkQuality = pTrack2->quality(trackQuality_); - if ((trkItr2 != trkItr) && trkQuality) { - const FreeTrajectoryState fts2 = - associator.getFreeTrajectoryState(&iSetup.getData(parameters_.bFieldToken), *pTrack2); - TrackDetMatchInfo info2 = associator.associate(iEvent, iSetup, fts2, parameters_); - const GlobalPoint point2(info2.trkGlobPosAtEcal.x(), info2.trkGlobPosAtEcal.y(), info2.trkGlobPosAtEcal.z()); - - if (info2.isGoodEcal) { - if (std::abs(point2.eta()) < spr::etaBEEcal) { - const DetId anyCell = barrelGeom->getClosestCell(point2); -#ifdef EDM_ML_DEBUG - if (debug) - std::cout << "chargeIsolation:: EB cell " << (EBDetId)(anyCell) << " for pt " << pTrack2->p() - << std::endl; -#endif - if (!spr::chargeIsolation(anyCell, vdets)) { - if (maxNearP < pTrack2->p()) - maxNearP = pTrack2->p(); - } - } else { - const DetId anyCell = endcapGeom->getClosestCell(point2); -#ifdef EDM_ML_DEBUG - if (debug) - std::cout << "chargeIsolation:: EE cell " << (EEDetId)(anyCell) << " for pt " << pTrack2->p() - << std::endl; -#endif - if (!spr::chargeIsolation(anyCell, vdets)) { - if (maxNearP < pTrack2->p()) - maxNearP = pTrack2->p(); - } - } - } //info2.isGoodEcal - } - } - return maxNearP; - } - - //=========================================================================================================== - - double chargeIsolationHcal(const edm::Event& iEvent, - const edm::EventSetup& iSetup, - reco::TrackCollection::const_iterator trkItr, - edm::Handle trkCollection, - const DetId ClosestCell, - const HcalTopology* topology, - const CaloSubdetectorGeometry* gHB, - TrackDetectorAssociator& associator, - TrackAssociatorParameters& parameters_, - int ieta, - int iphi, - const std::string& theTrackQuality, - bool debug) { - std::vector dets(1, ClosestCell); - -#ifdef EDM_ML_DEBUG - if (debug) - std::cout << (HcalDetId)ClosestCell << std::endl; -#endif - std::vector vdets = spr::matrixHCALIds(dets, topology, ieta, iphi, false, debug); - -#ifdef EDM_ML_DEBUG - if (debug) { - for (unsigned int i = 0; i < vdets.size(); i++) { - std::cout << "HcalDetId in " << 2 * ieta + 1 << "x" << 2 * iphi + 1 << " " << (HcalDetId)vdets[i] << std::endl; - } - } -#endif - double maxNearP = -1.0; - reco::TrackBase::TrackQuality trackQuality_ = reco::TrackBase::qualityByName(theTrackQuality); - - reco::TrackCollection::const_iterator trkItr2; - for (trkItr2 = trkCollection->begin(); trkItr2 != trkCollection->end(); ++trkItr2) { - const reco::Track* pTrack2 = &(*trkItr2); - - bool trkQuality = pTrack2->quality(trackQuality_); - if ((trkItr2 != trkItr) && trkQuality) { - const FreeTrajectoryState fts2 = - associator.getFreeTrajectoryState(&iSetup.getData(parameters_.bFieldToken), *pTrack2); - TrackDetMatchInfo info2 = associator.associate(iEvent, iSetup, fts2, parameters_); - const GlobalPoint point2(info2.trkGlobPosAtHcal.x(), info2.trkGlobPosAtHcal.y(), info2.trkGlobPosAtHcal.z()); - -#ifdef EDM_ML_DEBUG - if (debug) { - std::cout << "Track2 (p,eta,phi) " << pTrack2->p() << " " << pTrack2->eta() << " " << pTrack2->phi() - << std::endl; - } -#endif - if (info2.isGoodHcal) { - const DetId anyCell = gHB->getClosestCell(point2); -#ifdef EDM_ML_DEBUG - if (debug) - std::cout << "chargeIsolation:: HCAL cell " << (HcalDetId)(anyCell) << " for pt " << pTrack2->p() - << std::endl; -#endif - if (!spr::chargeIsolation(anyCell, vdets)) { - if (maxNearP < pTrack2->p()) - maxNearP = pTrack2->p(); - } -#ifdef EDM_ML_DEBUG - if (debug) { - std::cout << "maxNearP " << maxNearP << " thisCell " << (HcalDetId)anyCell << " (" - << info2.trkGlobPosAtHcal.x() << "," << info2.trkGlobPosAtHcal.y() << "," - << info2.trkGlobPosAtHcal.z() << ")" << std::endl; - } -#endif - } - } - } - return maxNearP; - } - -} // namespace spr diff --git a/Calibration/IsolatedParticles/src/DebugInfo.cc b/Calibration/IsolatedParticles/src/DebugInfo.cc index 1370e9c58f4df..087948fad68b4 100644 --- a/Calibration/IsolatedParticles/src/DebugInfo.cc +++ b/Calibration/IsolatedParticles/src/DebugInfo.cc @@ -3,43 +3,43 @@ #include "DataFormats/EcalDetId/interface/EcalSubdetector.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include namespace spr { - void debugEcalDets(unsigned int i, const DetId& det, bool flag) { - std::cout << "Cell [" << i << "] 0x"; + std::ostringstream debugEcalDet(unsigned int i, const DetId& det) { + std::ostringstream st1; + st1 << "Cell [" << i << "] 0x"; if (det.subdetId() == EcalBarrel) { - EBDetId id = det; - std::cout << std::hex << det() << std::dec << " " << id; + EBDetId id(det); + st1 << std::hex << det() << std::dec << " " << id; } else if (det.subdetId() == EcalEndcap) { - EEDetId id = det; - std::cout << std::hex << det() << std::dec << " " << id; + EEDetId id(det); + st1 << std::hex << det() << std::dec << " " << id; } else { - std::cout << std::hex << det() << std::dec << " Unknown Type"; + st1 << std::hex << det() << std::dec << " Unknown Type"; } - if (flag) - std::cout << std::endl; + return st1; } void debugEcalDets(unsigned int last, std::vector& vdets) { for (unsigned int i = last; i < vdets.size(); ++i) { - debugEcalDets(i, vdets[i], true); + edm::LogVerbatim("IsoTrack") << spr::debugEcalDet(i, vdets[i]).str(); } } void debugEcalDets(unsigned int last, std::vector& vdets, std::vector& dirs) { for (unsigned int i = last; i < vdets.size(); ++i) { - debugEcalDets(i, vdets[i], false); - std::cout << " along " << dirs[i] << std::endl; + edm::LogVerbatim("IsoTrack") << spr::debugEcalDet(i, vdets[i]).str() << " along " << dirs[i] << std::endl; } } void debugHcalDets(unsigned int last, std::vector& vdets) { for (unsigned int i = last; i < vdets.size(); ++i) { HcalDetId id = vdets[i](); - std::cout << "Cell [" << i << "] 0x" << std::hex << vdets[i]() << std::dec << " " << id << std::endl; + edm::LogVerbatim("IsoTrack") << "Cell [" << i << "] 0x" << std::hex << vdets[i]() << std::dec << " " << id; } } } // namespace spr diff --git a/Calibration/IsolatedParticles/src/DetIdFromEtaPhi.cc b/Calibration/IsolatedParticles/src/DetIdFromEtaPhi.cc index e3a3fff87a64f..bcbda20cd11ea 100644 --- a/Calibration/IsolatedParticles/src/DetIdFromEtaPhi.cc +++ b/Calibration/IsolatedParticles/src/DetIdFromEtaPhi.cc @@ -6,8 +6,9 @@ #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" -//#define EDM_ML_DEBUG +#include namespace spr { @@ -23,11 +24,9 @@ namespace spr { subdet = EcalBarrel; } const CaloSubdetectorGeometry* gECAL = geo->getSubdetectorGeometry(DetId::Ecal, subdet); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "findDetIdECAL: eta " << eta << " theta " << theta << " phi " << phi << " radius " << radius - << " subdet " << subdet << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "findDetIdECAL: eta " << eta << " theta " << theta << " phi " << phi << " radius " + << radius << " subdet " << subdet; return spr::findDetIdCalo(gECAL, theta, phi, radius, debug); } @@ -39,42 +38,30 @@ namespace spr { else radius = spr::rFrontHB / std::sin(theta); const CaloSubdetectorGeometry* gHCAL = geo->getSubdetectorGeometry(DetId::Hcal, HcalBarrel); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "findDetIdHCAL: eta " << eta << " theta " << theta << " phi " << phi << " radius " << radius - << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "findDetIdHCAL: eta " << eta << " theta " << theta << " phi " << phi << " radius " + << radius; return spr::findDetIdCalo(gHCAL, theta, phi, radius, debug); } - const DetId findDetIdCalo(const CaloSubdetectorGeometry* geo, - double theta, - double phi, - double radius, - bool -#ifdef EDM_ML_DEBUG - debug -#endif - ) { - + const DetId findDetIdCalo(const CaloSubdetectorGeometry* geo, double theta, double phi, double radius, bool debug) { double rcyl = radius * std::sin(theta); double z = radius * std::cos(theta); GlobalPoint point(rcyl * std::cos(phi), rcyl * std::sin(phi), z); const DetId cell = geo->getClosestCell(point); -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "findDetIdCalo: rcyl " << rcyl << " z " << z << " Point " << point << " DetId "; + std::ostringstream st1; if (cell.det() == DetId::Ecal) { if (cell.subdetId() == EcalBarrel) - std::cout << (EBDetId)(cell); + st1 << (EBDetId)(cell); else - std::cout << (EEDetId)(cell); + st1 << (EEDetId)(cell); } else { - std::cout << (HcalDetId)(cell); + st1 << (HcalDetId)(cell); } - std::cout << std::endl; + edm::LogVerbatim("IsoTrack") << "findDetIdCalo: rcyl " << rcyl << " z " << z << " Point " << point << " DetId " + << st1.str(); } -#endif return cell; } diff --git a/Calibration/IsolatedParticles/src/FindCaloHitCone.cc b/Calibration/IsolatedParticles/src/FindCaloHitCone.cc index 181724629c696..c49b5ad5fa4f2 100644 --- a/Calibration/IsolatedParticles/src/FindCaloHitCone.cc +++ b/Calibration/IsolatedParticles/src/FindCaloHitCone.cc @@ -3,6 +3,7 @@ #include "Calibration/IsolatedParticles/interface/FindDistCone.h" #include "DataFormats/EcalDetId/interface/EcalSubdetector.h" #include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include namespace spr { @@ -67,7 +68,7 @@ namespace spr { if (spr::getDistInPlaneTrackDir(point1, trackMom, rechitPoint, debug) < dR) keepHit = true; } else { - std::cout << "PROBLEM : Endcap RecHits in Barrel Collection!?" << std::endl; + edm::LogWarning("IsoTrack") << "PROBLEM : Endcap RecHits in Barrel Collection!?"; } if (keepHit) hit.push_back(j); @@ -84,7 +85,7 @@ namespace spr { if (spr::getDistInPlaneTrackDir(point1, trackMom, rechitPoint, debug) < dR) keepHit = true; } else { - std::cout << "PROBLEM : Barrel RecHits in Endcap Collection!?" << std::endl; + edm::LogWarning("IsoTrack") << "PROBLEM : Barrel RecHits in Endcap Collection!?"; } if (keepHit) hit.push_back(j); diff --git a/Calibration/IsolatedParticles/src/FindDistCone.cc b/Calibration/IsolatedParticles/src/FindDistCone.cc index e6fc815b0266b..e7774bc0f7b8e 100644 --- a/Calibration/IsolatedParticles/src/FindDistCone.cc +++ b/Calibration/IsolatedParticles/src/FindDistCone.cc @@ -1,10 +1,7 @@ #include "Calibration/IsolatedParticles/interface/CaloConstants.h" #include "Calibration/IsolatedParticles/interface/FindDistCone.h" #include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" - -#include - -//#define EDM_ML_DEBUG +#include "FWCore/MessageLogger/interface/MessageLogger.h" namespace spr { @@ -12,12 +9,7 @@ namespace spr { double getDistInPlaneTrackDir(const GlobalPoint& caloPoint, const GlobalVector& caloVector, const GlobalPoint& rechitPoint, - bool -#ifdef EDM_ML_DEBUG - debug -#endif - ) { - + bool debug) { const GlobalVector caloIntersectVector(caloPoint.x(), caloPoint.y(), caloPoint.z()); //p @@ -31,13 +23,11 @@ namespace spr { const GlobalPoint effectiveRechitPoint( effectiveRechitVector.x(), effectiveRechitVector.y(), effectiveRechitVector.z()); GlobalVector distance_vector = effectiveRechitPoint - caloPoint; -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "getDistInPlaneTrackDir: point " << caloPoint << " dirn " << caloVector << " numerator " - << dotprod_numerator << " denominator " << dotprod_denominator << " distance " << distance_vector.mag() - << std::endl; + edm::LogVerbatim("IsoTrack") << "getDistInPlaneTrackDir: point " << caloPoint << " dirn " << caloVector + << " numerator " << dotprod_numerator << " denominator " << dotprod_denominator + << " distance " << distance_vector.mag(); } -#endif if (dotprod_denominator > 0. && dotprod_numerator > 0.) { return distance_vector.mag(); } else { @@ -46,16 +36,7 @@ namespace spr { } // Not used, but here for reference - double getDistInCMatEcal(double eta1, - double phi1, - double eta2, - double phi2, - bool -#ifdef EDM_ML_DEBUG - debug -#endif - ) { - + double getDistInCMatEcal(double eta1, double phi1, double eta2, double phi2, bool debug) { double dR, Rec; if (fabs(eta1) < spr::etaBEEcal) Rec = spr::rFrontEB; @@ -71,25 +52,14 @@ namespace spr { dR = fabs(Rec * ce1 * sqrt(1. / z / z - 1.)); else dR = 999999.; -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "getDistInCMatEcal: between (" << eta1 << ", " << phi1 << ") and (" << eta2 << ", " << phi2 << " is " - << dR << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "getDistInCMatEcal: between (" << eta1 << ", " << phi1 << ") and (" << eta2 + << ", " << phi2 << " is " << dR; return dR; } // Not used, but here for reference - double getDistInCMatHcal(double eta1, - double phi1, - double eta2, - double phi2, - bool -#ifdef EDM_ML_DEBUG - debug -#endif - ) { - + double getDistInCMatHcal(double eta1, double phi1, double eta2, double phi2, bool debug) { // Radii and eta from Geometry/HcalCommonData/data/hcalendcapalgo.xml // and Geometry/HcalCommonData/data/hcalbarrelalgo.xml @@ -109,11 +79,9 @@ namespace spr { else dR = 999999.; return dR; -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "getDistInCMatHcal: between (" << eta1 << ", " << phi1 << ") and (" << eta2 << ", " << phi2 << " is " - << dR << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "getDistInCMatHcal: between (" << eta1 << ", " << phi1 << ") and (" << eta2 + << ", " << phi2 << " is " << dR; } void getEtaPhi(HBHERecHitCollection::const_iterator hit, diff --git a/Calibration/IsolatedParticles/src/FindEtaPhi.cc b/Calibration/IsolatedParticles/src/FindEtaPhi.cc index 2971b7e2c7b0c..71bb383622ac3 100644 --- a/Calibration/IsolatedParticles/src/FindEtaPhi.cc +++ b/Calibration/IsolatedParticles/src/FindEtaPhi.cc @@ -1,18 +1,9 @@ #include "Calibration/IsolatedParticles/interface/FindEtaPhi.h" -#include - -//#define EDM_ML_DEBUG +#include "FWCore/MessageLogger/interface/MessageLogger.h" namespace spr { - spr::EtaPhi getEtaPhi(int ieta, - int iphi, - bool -#ifdef EDM_ML_DEBUG - debug -#endif - ) { - + spr::EtaPhi getEtaPhi(int ieta, int iphi, bool debug) { int ietal = (ieta - 1) / 2; int ietar = ieta - ietal - 1; int iphil = (iphi - 1) / 2; @@ -46,16 +37,15 @@ namespace spr { etaphi.iphiS[1] = iphil; } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "getEtaPhi:: Has " << etaphi.ntrys << " possibilites for " << ieta << "X" << iphi << " matrix" - << std::endl; + edm::LogVerbatim("IsoTrack") << "getEtaPhi:: Has " << etaphi.ntrys << " possibilites for " << ieta << "X" << iphi + << " matrix"; for (int itry = 0; itry < etaphi.ntrys; itry++) { - std::cout << "Trial " << itry << " with etaE|etaW " << etaphi.ietaE[itry] << "|" << etaphi.ietaW[itry] - << " and phiN|PhiS " << etaphi.iphiN[itry] << "|" << etaphi.iphiS[itry] << std::endl; + edm::LogVerbatim("IsoTrack") << "Trial " << itry << " with etaE|etaW " << etaphi.ietaE[itry] << "|" + << etaphi.ietaW[itry] << " and phiN|PhiS " << etaphi.iphiN[itry] << "|" + << etaphi.iphiS[itry]; } } -#endif return etaphi; } } // namespace spr diff --git a/Calibration/IsolatedParticles/src/GenSimInfo.cc b/Calibration/IsolatedParticles/src/GenSimInfo.cc index cdadff7b96618..d765ef536811d 100644 --- a/Calibration/IsolatedParticles/src/GenSimInfo.cc +++ b/Calibration/IsolatedParticles/src/GenSimInfo.cc @@ -3,10 +3,7 @@ #include "Calibration/IsolatedParticles/interface/ChargeIsolation.h" #include "Calibration/IsolatedParticles/interface/GenSimInfo.h" #include "Calibration/IsolatedParticles/interface/DebugInfo.h" - -#include - -//#define EDM_ML_DEBUG +#include "FWCore/MessageLogger/interface/MessageLogger.h" namespace spr { @@ -19,16 +16,14 @@ namespace spr { int iphi, genSimInfo& info, bool debug) { -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "eGenSimInfo:: For track " << (*trkItr)->momentum().rho() << "/" << (*trkItr)->momentum().eta() - << "/" << (*trkItr)->momentum().phi() << " with ieta:iphi " << ieta << ":" << iphi << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "eGenSimInfo:: For track " << (*trkItr)->momentum().rho() << "/" + << (*trkItr)->momentum().eta() << "/" << (*trkItr)->momentum().phi() + << " with ieta:iphi " << ieta << ":" << iphi; + std::vector vdets = spr::matrixECALIds(coreDet, ieta, iphi, geo, caloTopology, false); -#ifdef EDM_ML_DEBUG if (debug) spr::debugEcalDets(0, vdets); -#endif spr::cGenSimInfo(vdets, trkItr, trackIds, true, info, debug); } @@ -41,16 +36,14 @@ namespace spr { const GlobalVector& trackMom, spr::genSimInfo& info, bool debug) { -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "eGenSimInfo:: For track " << (*trkItr)->momentum().rho() << "/" << (*trkItr)->momentum().eta() - << "/" << (*trkItr)->momentum().phi() << " with dR,tMom " << dR << " " << trackMom << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "eGenSimInfo:: For track " << (*trkItr)->momentum().rho() << "/" + << (*trkItr)->momentum().eta() << "/" << (*trkItr)->momentum().phi() + << " with dR,tMom " << dR << " " << trackMom; + std::vector vdets = spr::matrixECALIds(coreDet, dR, trackMom, geo, caloTopology, false); -#ifdef EDM_ML_DEBUG if (debug) spr::debugEcalDets(0, vdets); -#endif spr::cGenSimInfo(vdets, trkItr, trackIds, true, info, debug); } @@ -63,16 +56,14 @@ namespace spr { int iphi, genSimInfo& info, bool debug) { -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "eGenSimInfo:: For track " << trkItr->momentum().R() << "/" << trkItr->momentum().eta() << "/" - << trkItr->momentum().phi() << " with ieta:iphi " << ieta << ":" << iphi << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "eGenSimInfo:: For track " << trkItr->momentum().R() << "/" + << trkItr->momentum().eta() << "/" << trkItr->momentum().phi() << " with ieta:iphi " + << ieta << ":" << iphi; + std::vector vdets = spr::matrixECALIds(coreDet, ieta, iphi, geo, caloTopology, false); -#ifdef EDM_ML_DEBUG if (debug) spr::debugEcalDets(0, vdets); -#endif spr::cGenSimInfo(vdets, trkItr, trackIds, true, info, debug); } @@ -85,16 +76,14 @@ namespace spr { const GlobalVector& trackMom, spr::genSimInfo& info, bool debug) { -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "eGenSimInfo:: For track " << trkItr->momentum().R() << "/" << trkItr->momentum().eta() << "/" - << trkItr->momentum().phi() << " with dR,tMom " << dR << " " << trackMom << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "eGenSimInfo:: For track " << trkItr->momentum().R() << "/" + << trkItr->momentum().eta() << "/" << trkItr->momentum().phi() << " with dR,tMom " + << dR << " " << trackMom; + std::vector vdets = spr::matrixECALIds(coreDet, dR, trackMom, geo, caloTopology, false); -#ifdef EDM_ML_DEBUG if (debug) spr::debugEcalDets(0, vdets); -#endif spr::cGenSimInfo(vdets, trkItr, trackIds, true, info, debug); } @@ -107,18 +96,16 @@ namespace spr { genSimInfo& info, bool includeHO, bool debug) { -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "hGenSimInfo:: For track " << (*trkItr)->momentum().rho() << "/" << (*trkItr)->momentum().eta() - << "/" << (*trkItr)->momentum().phi() << " with ieta:iphi " << ieta << ":" << iphi << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "hGenSimInfo:: For track " << (*trkItr)->momentum().rho() << "/" + << (*trkItr)->momentum().eta() << "/" << (*trkItr)->momentum().phi() + << " with ieta:iphi " << ieta << ":" << iphi; + std::vector dets; dets.push_back(coreDet); std::vector vdets = spr::matrixHCALIds(dets, topology, ieta, iphi, includeHO, false); -#ifdef EDM_ML_DEBUG if (debug) spr::debugHcalDets(0, vdets); -#endif spr::cGenSimInfo(vdets, trkItr, trackIds, false, info, debug); } @@ -132,16 +119,14 @@ namespace spr { spr::genSimInfo& info, bool includeHO, bool debug) { -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "hGenSimInfo:: For track " << (*trkItr)->momentum().rho() << "/" << (*trkItr)->momentum().eta() - << "/" << (*trkItr)->momentum().phi() << " with dR,tMom " << dR << " " << trackMom << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "hGenSimInfo:: For track " << (*trkItr)->momentum().rho() << "/" + << (*trkItr)->momentum().eta() << "/" << (*trkItr)->momentum().phi() + << " with dR,tMom " << dR << " " << trackMom; + std::vector vdets = spr::matrixHCALIds(coreDet, geo, topology, dR, trackMom, includeHO, false); -#ifdef EDM_ML_DEBUG if (debug) spr::debugHcalDets(0, vdets); -#endif spr::cGenSimInfo(vdets, trkItr, trackIds, false, info, debug); } @@ -154,18 +139,16 @@ namespace spr { genSimInfo& info, bool includeHO, bool debug) { -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "hGenSimInfo:: For track " << trkItr->momentum().R() << "/" << trkItr->momentum().eta() << "/" - << trkItr->momentum().phi() << " with ieta:iphi " << ieta << ":" << iphi << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "hGenSimInfo:: For track " << trkItr->momentum().R() << "/" + << trkItr->momentum().eta() << "/" << trkItr->momentum().phi() << " with ieta:iphi " + << ieta << ":" << iphi; + std::vector dets; dets.push_back(coreDet); std::vector vdets = spr::matrixHCALIds(dets, topology, ieta, iphi, includeHO, false); -#ifdef EDM_ML_DEBUG if (debug) spr::debugHcalDets(0, vdets); -#endif spr::cGenSimInfo(vdets, trkItr, trackIds, false, info, debug); } @@ -179,16 +162,14 @@ namespace spr { spr::genSimInfo& info, bool includeHO, bool debug) { -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "hGenSimInfo:: For track " << trkItr->momentum().R() << "/" << trkItr->momentum().eta() << "/" - << trkItr->momentum().phi() << " with dR,tMom " << dR << " " << trackMom << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "hGenSimInfo:: For track " << trkItr->momentum().R() << "/" + << trkItr->momentum().eta() << "/" << trkItr->momentum().phi() << " with dR,tMom " + << dR << " " << trackMom; + std::vector vdets = spr::matrixHCALIds(coreDet, geo, topology, dR, trackMom, includeHO, false); -#ifdef EDM_ML_DEBUG if (debug) spr::debugHcalDets(0, vdets); -#endif spr::cGenSimInfo(vdets, trkItr, trackIds, false, info, debug); } @@ -222,14 +203,14 @@ namespace spr { spr::cGenSimInfo(charge, pdgid, p, info, debug); } } -#ifdef EDM_ML_DEBUG + if (debug) { - std::cout << "Isolation variables: isChargedIso :" << info.isChargedIso << " maxNearP " << info.maxNearP - << " Energy e/mu/g/ch/nh " << info.eleEne << "," << info.muEne << "," << info.photonEne << "," - << info.cHadronEne << "," << info.nHadronEne << " charge " << info.cHadronEne_[0] << "," - << info.cHadronEne_[1] << "," << info.cHadronEne_[2] << std::endl; + edm::LogVerbatim("IsoTrack") << "Isolation variables: isChargedIso :" << info.isChargedIso << " maxNearP " + << info.maxNearP << " Energy e/mu/g/ch/nh " << info.eleEne << "," << info.muEne + << "," << info.photonEne << "," << info.cHadronEne << "," << info.nHadronEne + << " charge " << info.cHadronEne_[0] << "," << info.cHadronEne_[1] << "," + << info.cHadronEne_[2]; } -#endif } void cGenSimInfo(std::vector& vdets, @@ -263,14 +244,13 @@ namespace spr { } } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "Isolation variables: isChargedIso :" << info.isChargedIso << " maxNearP " << info.maxNearP - << " Energy e/mu/g/ch/nh " << info.eleEne << "," << info.muEne << "," << info.photonEne << "," - << info.cHadronEne << "," << info.nHadronEne << " charge " << info.cHadronEne_[0] << "," - << info.cHadronEne_[1] << "," << info.cHadronEne_[2] << std::endl; + edm::LogVerbatim("IsoTrack") << "Isolation variables: isChargedIso :" << info.isChargedIso << " maxNearP " + << info.maxNearP << " Energy e/mu/g/ch/nh " << info.eleEne << "," << info.muEne + << "," << info.photonEne << "," << info.cHadronEne << "," << info.nHadronEne + << " charge " << info.cHadronEne_[0] << "," << info.cHadronEne_[1] << "," + << info.cHadronEne_[2]; } -#endif } void cGenSimInfo(int charge, int pdgid, double p, spr::genSimInfo& info, bool) { diff --git a/Calibration/IsolatedParticles/src/MatchingSimTrack.cc b/Calibration/IsolatedParticles/src/MatchingSimTrack.cc index ce846255fb9d4..fba502bde11c2 100644 --- a/Calibration/IsolatedParticles/src/MatchingSimTrack.cc +++ b/Calibration/IsolatedParticles/src/MatchingSimTrack.cc @@ -1,11 +1,9 @@ #include "DataFormats/TrackingRecHit/interface/TrackingRecHitFwd.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" - #include "Calibration/IsolatedParticles/interface/MatchingSimTrack.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include - -//#define EDM_ML_DEBUG +#include namespace spr { @@ -14,12 +12,7 @@ namespace spr { edm::Handle& SimVtx, const reco::Track* pTrack, TrackerHitAssociator& associate, - bool -#ifdef EDM_ML_DEBUG - debug -#endif - ) { - + bool debug) { edm::SimTrackContainer::const_iterator itr = SimTk->end(); ; @@ -45,15 +38,14 @@ namespace spr { } } -#ifdef EDM_ML_DEBUG if (debug) { + std::ostringstream st1; for (unsigned int isim = 0; isim < trkId.size(); isim++) { - std::cout << "\n trkId " << trkId[isim] << " Occurance " << trkOcc[isim] << ", "; + st1 << "\n trkId " << trkId[isim] << " Occurance " << trkOcc[isim] << ", "; } - std::cout << std::endl; + edm::LogVerbatim("IsoTrack") << st1.str(); } int matchedId = 0; -#endif unsigned int matchSimTrk = 0; if (!trkOcc.empty()) { @@ -67,22 +59,19 @@ namespace spr { matchSimTrk = trkId[idxMax]; for (auto simTrkItr = SimTk->begin(); simTrkItr != SimTk->end(); simTrkItr++) { if (simTrkItr->trackId() == matchSimTrk) { -#ifdef EDM_ML_DEBUG matchedId = simTrkItr->type(); if (debug) - std::cout << "matched trackId (maximum occurance) " << matchSimTrk << " type " << matchedId << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "matched trackId (maximum occurance) " << matchSimTrk << " type " + << matchedId; itr = simTrkItr; break; } } } -#ifdef EDM_ML_DEBUG if (matchedId == 0 && debug) { - std::cout << "Could not find matched SimTrk and track history now " << std::endl; + edm::LogVerbatim("IsoTrack") << "Could not find matched SimTrk and track history now "; } -#endif return itr; } @@ -97,15 +86,14 @@ namespace spr { edm::SimTrackContainer::const_iterator trkInfo = spr::matchedSimTrack(iEvent, SimTk, SimVtx, pTrack, associate, debug); unsigned int matchSimTrk = trkInfo->trackId(); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "matchedSimTrackId finds the SimTrk ID of the current track to be " << matchSimTrk << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "matchedSimTrackId finds the SimTrk ID of the current track to be " + << matchSimTrk; std::vector matchTkid; if (trkInfo->type() != 0) { for (auto simTrkItr = SimTk->begin(); simTrkItr != SimTk->end(); simTrkItr++) { if (validSimTrack(matchSimTrk, simTrkItr, SimTk, SimVtx, false)) - matchTkid.push_back((int)simTrkItr->trackId()); + matchTkid.push_back(static_cast(simTrkItr->trackId())); } } return matchTkid; @@ -124,15 +112,13 @@ namespace spr { info.charge = simTrkItr->charge(); } else { edm::SimTrackContainer::const_iterator parentItr = spr::parentSimTrack(simTrkItr, SimTk, SimVtx, debug); -#ifdef EDM_ML_DEBUG if (debug) { if (parentItr != SimTk->end()) - std::cout << "original parent of " << simTrkItr->trackId() << " " << parentItr->trackId() << ", " - << parentItr->type() << std::endl; + edm::LogVerbatim("IsoTrack") << "original parent of " << simTrkItr->trackId() << " " + << parentItr->trackId() << ", " << parentItr->type(); else - std::cout << "original parent of " << simTrkItr->trackId() << " not found" << std::endl; + edm::LogVerbatim("IsoTrack") << "original parent of " << simTrkItr->trackId() << " not found"; } -#endif if (parentItr != SimTk->end()) { info.found = true; info.pdgId = parentItr->type(); @@ -151,28 +137,26 @@ namespace spr { edm::Handle& SimTk, edm::Handle& SimVtx, bool debug) { -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "Inside validSimTrack: trackId " << thisTrkItr->trackId() << " vtxIndex " << thisTrkItr->vertIndex() - << " to be matched to " << simTkId << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "Inside validSimTrack: trackId " << thisTrkItr->trackId() << " vtxIndex " + << thisTrkItr->vertIndex() << " to be matched to " << simTkId; + //This track originates from simTkId if (thisTrkItr->trackId() == simTkId) return true; //Otherwise trace back the history using SimTracks and SimVertices int vertIndex = thisTrkItr->vertIndex(); - if (vertIndex == -1 || vertIndex >= (int)SimVtx->size()) + if (vertIndex == -1 || vertIndex >= static_cast(SimVtx->size())) return false; edm::SimVertexContainer::const_iterator simVtxItr = SimVtx->begin(); for (int iv = 0; iv < vertIndex; iv++) simVtxItr++; int parent = simVtxItr->parentIndex(); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "validSimTrack:: parent index " << parent << " "; -#endif + edm::LogVerbatim("IsoTrack") << "validSimTrack:: parent index " << parent << " "; + if (parent < 0 && simVtxItr != SimVtx->begin()) { const math::XYZTLorentzVectorD pos1 = simVtxItr->position(); for (simVtxItr = SimVtx->begin(); simVtxItr != SimVtx->end(); ++simVtxItr) { @@ -186,13 +170,11 @@ namespace spr { } } } -#ifdef EDM_ML_DEBUG + if (debug) - std::cout << "final index " << parent << std::endl; - ; -#endif + edm::LogVerbatim("IsoTrack") << "final index " << parent; for (edm::SimTrackContainer::const_iterator simTrkItr = SimTk->begin(); simTrkItr != SimTk->end(); simTrkItr++) { - if ((int)simTrkItr->trackId() == parent && simTrkItr != thisTrkItr) + if (static_cast(simTrkItr->trackId()) == parent && simTrkItr != thisTrkItr) return validSimTrack(simTkId, simTrkItr, SimTk, SimVtx, debug); } @@ -207,14 +189,12 @@ namespace spr { edm::SimTrackContainer::const_iterator itr = SimTk->end(); int vertIndex = thisTrkItr->vertIndex(); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "SimTrackParent " << thisTrkItr->trackId() << " Vertex " << vertIndex << " Type " - << thisTrkItr->type() << " Charge " << (int)thisTrkItr->charge() << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "SimTrackParent " << thisTrkItr->trackId() << " Vertex " << vertIndex << " Type " + << thisTrkItr->type() << " Charge " << static_cast(thisTrkItr->charge()); if (vertIndex == -1) return thisTrkItr; - else if (vertIndex >= (int)SimVtx->size()) + else if (vertIndex >= static_cast(SimVtx->size())) return itr; edm::SimVertexContainer::const_iterator simVtxItr = SimVtx->begin(); @@ -236,7 +216,7 @@ namespace spr { } } for (edm::SimTrackContainer::const_iterator simTrkItr = SimTk->begin(); simTrkItr != SimTk->end(); simTrkItr++) { - if ((int)simTrkItr->trackId() == parent && simTrkItr != thisTrkItr) + if (static_cast(simTrkItr->trackId()) == parent && simTrkItr != thisTrkItr) return parentSimTrack(simTrkItr, SimTk, SimVtx, debug); } diff --git a/Calibration/IsolatedParticles/src/MatrixECALDetIds.cc b/Calibration/IsolatedParticles/src/MatrixECALDetIds.cc index 3b341f02eeff3..0a26e5b433ab3 100644 --- a/Calibration/IsolatedParticles/src/MatrixECALDetIds.cc +++ b/Calibration/IsolatedParticles/src/MatrixECALDetIds.cc @@ -6,11 +6,11 @@ #include "Calibration/IsolatedParticles/interface/FindDistCone.h" #include "Calibration/IsolatedParticles/interface/DebugInfo.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + #include #include -//#define EDM_ML_DEBUG - namespace spr { void matrixECALIds(const DetId& det, @@ -28,12 +28,10 @@ namespace spr { const EcalEndcapGeometry* endcapGeom = (dynamic_cast(geo->getSubdetectorGeometry(DetId::Ecal, EcalEndcap))); -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "matrixECALIds::Add " << ieta << " rows and " << iphi << " columns of cells for 1 cell" << std::endl; - spr::debugEcalDets(0, det, true); + edm::LogVerbatim("IsoTrack") << "matrixECALIds::Add " << ieta << " rows and " << iphi + << " columns of cells for 1 cell" << spr::debugEcalDet(0, det).str(); } -#endif std::vector dets(1, det); std::vector dirs(1, NORTH); vdets = spr::newECALIdNS( @@ -53,12 +51,10 @@ namespace spr { vdets.insert(vdets.end(), vdetExtra.begin(), vdetExtra.end()); } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "matrixECALIds::Total number of cells found is " << vdets.size() << std::endl; + edm::LogVerbatim("IsoTrack") << "matrixECALIds::Total number of cells found is " << vdets.size(); spr::debugEcalDets(0, vdets); } -#endif } std::vector matrixECALIds(const DetId& det, @@ -105,13 +101,11 @@ namespace spr { } } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "matrixECALIds::Final List of cells for dR " << dR << " is with " << vdetx.size() - << " from original list of " << vdets.size() << std::endl; + edm::LogVerbatim("IsoTrack") << "matrixECALIds::Final List of cells for dR " << dR << " is with " << vdetx.size() + << " from original list of " << vdets.size(); spr::debugEcalDets(0, vdetx); } -#endif return vdetx; } @@ -132,13 +126,10 @@ namespace spr { const EcalEndcapGeometry* endcapGeom = (dynamic_cast(geo->getSubdetectorGeometry(DetId::Ecal, EcalEndcap))); -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "matrixECALIds::Add " << ietaE << "|" << ietaW << " rows and " << iphiN << "|" << iphiS - << " columns of cells for 1 cell" << std::endl; - debugEcalDets(0, det, true); + edm::LogVerbatim("IsoTrack") << "matrixECALIds::Add " << ietaE << "|" << ietaW << " rows and " << iphiN << "|" + << iphiS << " columns of cells for 1 cell" << spr::debugEcalDet(0, det).str(); } -#endif std::vector dets(1, det); std::vector dirs(1, NORTH); std::vector jetaE(1, ietaE), jetaW(1, ietaW); @@ -183,12 +174,10 @@ namespace spr { vdets.insert(vdets.end(), vdetExtra.begin(), vdetExtra.end()); } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "matrixECALIds::Total number of cells found is " << vdets.size() << std::endl; + edm::LogVerbatim("IsoTrack") << "matrixECALIds::Total number of cells found is " << vdets.size(); spr::debugEcalDets(0, vdets); } -#endif } std::vector matrixECALIds(const DetId& det, @@ -216,13 +205,11 @@ namespace spr { const EcalEndcapGeometry* endcapGeom, bool debug, bool ignoreTransition) { -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newECALIdNS::Add " << iphi << " columns of cells for " << (dets.size() - last) << " cells (last " - << last << ")" << std::endl; + edm::LogVerbatim("IsoTrack") << "newECALIdNS::Add " << iphi << " columns of cells for " << (dets.size() - last) + << " cells (last " << last << ")"; spr::debugEcalDets(last, dets, dir); } -#endif std::vector vdets; std::vector dirs; vdets.insert(vdets.end(), dets.begin(), dets.end()); @@ -248,13 +235,11 @@ namespace spr { dirs.push_back(dir[0]); } } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newECALIdNS::With Added cells along E/W results a set of " << (vdets.size() - dets.size()) - << " new cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "newECALIdNS::With Added cells along E/W results a set of " + << (vdets.size() - dets.size()) << " new cells"; spr::debugEcalDets(dets.size(), vdets, dirs); } -#endif } unsigned int last0 = vdets.size(); @@ -310,13 +295,11 @@ namespace spr { dirs.push_back(dirnew[i2]); } } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newECALIdNS::Addition results a set of " << (vdets.size() - last0) << " new cells (last " - << last0 << ", iphi " << iphi << ")" << std::endl; + edm::LogVerbatim("IsoTrack") << "newECALIdNS::Addition results a set of " << (vdets.size() - last0) + << " new cells (last " << last0 << ", iphi " << iphi << ")"; spr::debugEcalDets(last0, vdets, dirs); } -#endif last0 = last; } @@ -325,12 +308,10 @@ namespace spr { return spr::newECALIdNS( vdets, last, ieta, iphi, dirs, barrelTopo, endcapTopo, barrelGeom, endcapGeom, debug, ignoreTransition); } else { -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newECALIdNS::Final list consists of " << vdets.size() << " cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "newECALIdNS::Final list consists of " << vdets.size() << " cells"; spr::debugEcalDets(0, vdets); } -#endif return vdets; } } @@ -348,16 +329,14 @@ namespace spr { const EcalEndcapGeometry* endcapGeom, bool debug, bool ignoreTransition) { -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newECALIdNS::Add columns of cells for " << (dets.size() - last) << " cells (last) " << last - << std::endl; + edm::LogVerbatim("IsoTrack") << "newECALIdNS::Add columns of cells for " << (dets.size() - last) + << " cells (last) " << last; for (unsigned int i1 = last; i1 < dets.size(); i1++) { - spr::debugEcalDets(i1, dets[i1], false); - std::cout << " along " << dir[i1] << " # " << iphiN[i1] << "|" << iphiS[i1] << std::endl; + edm::LogVerbatim("IsoTrack") << spr::debugEcalDet(i1, dets[i1]).str() << " along " << dir[i1] << " # " + << iphiN[i1] << "|" << iphiS[i1]; } } -#endif std::vector vdets; std::vector dirs; std::vector jetaE, jetaW, jphiN, jphiS; @@ -395,13 +374,11 @@ namespace spr { jphiS.push_back(iphiS[0]); } } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newECALIdNS::With Added cells along E/W results a set of " << (vdets.size() - dets.size()) - << " new cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "newECALIdNS::With Added cells along E/W results a set of " + << (vdets.size() - dets.size()) << " new cells"; spr::debugEcalDets(dets.size(), vdets, dirs); } -#endif } unsigned int last0 = vdets.size(); @@ -495,17 +472,14 @@ namespace spr { jphiS.push_back(kphiS[i2]); } } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newECALIdNS::Addition results a set of " << (vdets.size() - last0) << " new cells (last " << last0 - << ", iphi " << kphi << ")" << std::endl; + edm::LogVerbatim("IsoTrack") << "newECALIdNS::Addition results a set of " << (vdets.size() - last0) + << " new cells (last " << last0 << ", iphi " << kphi << ")"; for (unsigned int i1 = last0; i1 < vdets.size(); i1++) { - spr::debugEcalDets(i1, vdets[i1], false); - std::cout << " along " << dirs[i1] << " iphi " << jphiN[i1] << "|" << jphiS[i1] << " ieta " << jetaE[i1] << "|" - << jetaW[i1] << std::endl; + edm::LogVerbatim("IsoTrack") << spr::debugEcalDet(i1, vdets[i1]).str() << " along " << dirs[i1] << " iphi " + << jphiN[i1] << "|" << jphiS[i1] << " ieta " << jetaE[i1] << "|" << jetaW[i1]; } } -#endif last0 = last; if (kphi > 0) { @@ -524,12 +498,10 @@ namespace spr { debug, ignoreTransition); } else { -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newECALIdNS::Final list consists of " << vdets.size() << " cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "newECALIdNS::Final list consists of " << vdets.size() << " cells"; spr::debugEcalDets(0, vdets); } -#endif return vdets; } } @@ -544,13 +516,11 @@ namespace spr { const EcalEndcapGeometry* endcapGeom, bool debug, bool ignoreTransition) { -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newECALIdEW::Add " << ieta << " rows of cells for " << last << ":" << dets.size() << ":" - << (dets.size() - last) << " cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "newECALIdEW::Add " << ieta << " rows of cells for " << last << ":" << dets.size() + << ":" << (dets.size() - last) << " cells" << std::endl; spr::debugEcalDets(last, dets, dir); } -#endif std::vector vdets; vdets.clear(); std::vector dirs; @@ -581,24 +551,20 @@ namespace spr { ieta--; } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newECALIdEW::Addition results a set of " << (vdets.size() - dets.size()) << " new cells" - << std::endl; + edm::LogVerbatim("IsoTrack") << "newECALIdEW::Addition results a set of " << (vdets.size() - dets.size()) + << " new cells"; spr::debugEcalDets(dets.size(), vdets, dirs); } -#endif if (ieta > 0) { last = dets.size(); return spr::newECALIdEW( vdets, last, ieta, dirs, barrelTopo, endcapTopo, barrelGeom, endcapGeom, debug, ignoreTransition); } else { -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newECALIdEW::Final list (EW) consists of " << vdets.size() << " cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "newECALIdEW::Final list (EW) consists of " << vdets.size() << " cells"; spr::debugEcalDets(0, vdets); } -#endif return vdets; } } @@ -614,13 +580,11 @@ namespace spr { const EcalEndcapGeometry* endcapGeom, bool debug, bool ignoreTransition) { -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newECALIdEW::Add " << ietaE[0] << "|" << ietaW[0] << " rows of cells for " << (dets.size() - last) - << " cells (last " << last << ")" << std::endl; + edm::LogVerbatim("IsoTrack") << "newECALIdEW::Add " << ietaE[0] << "|" << ietaW[0] << " rows of cells for " + << (dets.size() - last) << " cells (last " << last << ")"; spr::debugEcalDets(last, dets, dir); } -#endif std::vector vdets; vdets.insert(vdets.end(), dets.begin(), dets.end()); std::vector dirs; @@ -672,24 +636,20 @@ namespace spr { } } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newECALIdEW::Addition results a set of " << (vdets.size() - dets.size()) << " new cells (last " - << dets.size() << ", ieta " << keta << ")" << std::endl; + edm::LogVerbatim("IsoTrack") << "newECALIdEW::Addition results a set of " << (vdets.size() - dets.size()) + << " new cells (last " << dets.size() << ", ieta " << keta << ")"; spr::debugEcalDets(dets.size(), vdets); } -#endif if (keta > 0) { last = dets.size(); return spr::newECALIdEW( vdets, last, jetaE, jetaW, dirs, barrelTopo, endcapTopo, barrelGeom, endcapGeom, debug, ignoreTransition); } else { -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newECALIdEW::Final list (EW) consists of " << vdets.size() << " cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "newECALIdEW::Final list (EW) consists of " << vdets.size() << " cells"; spr::debugEcalDets(0, vdets); } -#endif return vdets; } } @@ -702,13 +662,8 @@ namespace spr { const EcalEndcapGeometry* endcapGeom, std::vector& cells, int& ok, - bool -#ifdef EDM_ML_DEBUG - debug -#endif - , + bool debug, bool ignoreTransition) { - DetId cell; ok = 0; if (det.subdetId() == EcalBarrel) { @@ -760,15 +715,14 @@ namespace spr { } } } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "simpleMove:: Move DetId 0x" << std::hex << det() << std::dec << " along " << dir << " to get 0x" - << std::hex << cell() << std::dec << " with flag " << ok << " # " << cells.size(); + std::ostringstream st1; for (unsigned int i1 = 0; i1 < cells.size(); ++i1) - std::cout << " " << std::hex << cells[0]() << std::dec; - std::cout << std::endl; + st1 << " " << std::hex << cells[0]() << std::dec; + edm::LogVerbatim("IsoTrack") << "simpleMove:: Move DetId 0x" << std::hex << det() << std::dec << " along " << dir + << " to get 0x" << std::hex << cell() << std::dec << " with flag " << ok << " # " + << cells.size() << st1.str(); } -#endif } void extraIds(const DetId& det, @@ -780,19 +734,12 @@ namespace spr { const EcalBarrelGeometry* barrelGeom, const EcalEndcapGeometry* endcapGeom, std::vector& cells, - bool -#ifdef EDM_ML_DEBUG - debug -#endif - ) { - + bool debug) { if (det.subdetId() == EcalBarrel) { EBDetId id = det; -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "extraIds::Cell " << id << " rows " << ietaW << "|" << ietaE << " columns " << iphiS << "|" - << iphiN << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "extraIds::Cell " << id << " rows " << ietaW << "|" << ietaE << " columns " + << iphiS << "|" << iphiN; int etaC = id.ietaAbs(); int phiC = id.iphi(); int zsid = id.zside(); @@ -816,11 +763,9 @@ namespace spr { } } else if (det.subdetId() == EcalEndcap && endcapGeom) { EEDetId id = det; -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "extraIds::Cell " << id << " rows " << ietaW << "|" << ietaE << " columns " << iphiS << "|" - << iphiN << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "extraIds::Cell " << id << " rows " << ietaW << "|" << ietaE << " columns " + << iphiS << "|" << iphiN; int ixC = id.ix(); int iyC = id.iy(); int zsid = id.zside(); @@ -840,11 +785,9 @@ namespace spr { } } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "extraIds:: finds " << cells.size() << " new cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "extraIds:: finds " << cells.size() << " new cells"; spr::debugEcalDets(0, cells); } -#endif } } // namespace spr diff --git a/Calibration/IsolatedParticles/src/MatrixHCALDetIds.cc b/Calibration/IsolatedParticles/src/MatrixHCALDetIds.cc index e994c05ee2a62..7d5dec6f8516c 100644 --- a/Calibration/IsolatedParticles/src/MatrixHCALDetIds.cc +++ b/Calibration/IsolatedParticles/src/MatrixHCALDetIds.cc @@ -4,23 +4,20 @@ #include "Calibration/IsolatedParticles/interface/FindDistCone.h" #include "Calibration/IsolatedParticles/interface/DebugInfo.h" #include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include -#include - -//#define EDM_ML_DEBUG namespace spr { std::vector matrixHCALIds( std::vector& dets, const HcalTopology* topology, int ieta, int iphi, bool includeHO, bool debug) { -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "matrixHCALIds::Add " << ieta << " rows and " << iphi << " columns of cells for " << dets.size() - << " cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "matrixHCALIds::Add " << ieta << " rows and " << iphi << " columns of cells for " + << dets.size() << " cells"; spr::debugHcalDets(0, dets); } -#endif + std::vector vdetN = spr::newHCALIdNS(dets, 0, topology, true, ieta, iphi, debug); std::vector vdetS = spr::newHCALIdNS(dets, 0, topology, false, ieta, iphi, debug); for (unsigned int i1 = 0; i1 < vdetS.size(); i1++) { @@ -30,12 +27,10 @@ namespace spr { vdetS = spr::matrixHCALIdsDepth(vdetN, topology, includeHO, debug); -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "matrixHCALIds::Total number of cells found is " << vdetS.size() << std::endl; + edm::LogVerbatim("IsoTrack") << "matrixHCALIds::Total number of cells found is " << vdetS.size(); spr::debugHcalDets(0, vdetS); } -#endif return vdetS; } @@ -60,13 +55,11 @@ namespace spr { } } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "matrixHCALIds::Final List of cells for dR " << dR << " is with " << vdetx.size() - << " from original list of " << vdets.size() << " cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "matrixHCALIds::Final List of cells for dR " << dR << " is with " << vdetx.size() + << " from original list of " << vdets.size() << " cells"; spr::debugHcalDets(0, vdetx); } -#endif return vdetx; } @@ -78,13 +71,12 @@ namespace spr { int iphiS, bool includeHO, bool debug) { -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "matrixHCALIds::Add " << ietaE << "|" << ietaW << " rows and " << iphiN << "|" << iphiS - << " columns of cells for " << dets.size() << " cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "matrixHCALIds::Add " << ietaE << "|" << ietaW << " rows and " << iphiN << "|" + << iphiS << " columns of cells for " << dets.size() << " cells"; spr::debugHcalDets(0, dets); } -#endif + std::vector vdetN = spr::newHCALIdNS(dets, 0, topology, true, ietaE, ietaW, iphiN, iphiS, debug); std::vector vdetS = spr::newHCALIdNS(dets, 0, topology, false, ietaE, ietaW, iphiN, iphiS, debug); for (unsigned int i1 = 0; i1 < vdetS.size(); i1++) { @@ -94,12 +86,10 @@ namespace spr { vdetS = spr::matrixHCALIdsDepth(vdetN, topology, includeHO, debug); -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "matrixHCALIds::Total number of cells found is " << vdetS.size() << std::endl; + edm::LogVerbatim("IsoTrack") << "matrixHCALIds::Total number of cells found is " << vdetS.size(); spr::debugHcalDets(0, vdetS); } -#endif return vdetS; } @@ -110,13 +100,12 @@ namespace spr { int ieta, int iphi, bool debug) { -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newHCALIdNS::Add " << iphi << " columns of cells along " << shiftNorth << " for " - << (dets.size() - last) << " cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "newHCALIdNS::Add " << iphi << " columns of cells along " << shiftNorth << " for " + << (dets.size() - last) << " cells"; spr::debugHcalDets(last, dets); } -#endif + std::vector vdets; vdets.insert(vdets.end(), dets.begin(), dets.end()); std::vector vdetE, vdetW; @@ -131,13 +120,12 @@ namespace spr { if (std::count(vdets.begin(), vdets.end(), vdetE[i1]) == 0) vdets.push_back(vdetE[i1]); } -#ifdef EDM_ML_DEBUG + if (debug) { - std::cout << "newHCALIdNS::With Added cells along E/W results a set of " << (vdets.size() - dets.size()) - << " new cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "newHCALIdNS::With Added cells along E/W results a set of " + << (vdets.size() - dets.size()) << " new cells"; spr::debugHcalDets(dets.size(), vdets); } -#endif } unsigned int last0 = vdets.size(); if (iphi > 0) { @@ -168,12 +156,12 @@ namespace spr { } last = vdets.size(); vdets.insert(vdets.end(), vdetnew.begin(), vdetnew.end()); -#ifdef EDM_ML_DEBUG + if (debug) { - std::cout << "newHCALIdNS::Addition results a set of " << (vdets.size() - last0) << " new cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "newHCALIdNS::Addition results a set of " << (vdets.size() - last0) + << " new cells"; spr::debugHcalDets(last0, vdets); } -#endif last0 = last; } @@ -181,12 +169,10 @@ namespace spr { last = last0; return spr::newHCALIdNS(vdets, last, topology, shiftNorth, ieta, iphi, debug); } else { -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newHCALIdNS::Final list consists of " << vdets.size() << " cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "newHCALIdNS::Final list consists of " << vdets.size() << " cells"; spr::debugHcalDets(0, vdets); } -#endif return vdets; } } @@ -200,13 +186,12 @@ namespace spr { int iphiN, int iphiS, bool debug) { -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newHCALIdNS::Add " << iphiN << "|" << iphiS << " columns of cells along " << shiftNorth << " for " - << (dets.size() - last) << " cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "newHCALIdNS::Add " << iphiN << "|" << iphiS << " columns of cells along " + << shiftNorth << " for " << (dets.size() - last) << " cells"; spr::debugHcalDets(last, dets); } -#endif + std::vector vdets; vdets.insert(vdets.end(), dets.begin(), dets.end()); std::vector vdetE, vdetW; @@ -221,13 +206,12 @@ namespace spr { if (std::count(vdets.begin(), vdets.end(), vdetE[i1]) == 0) vdets.push_back(vdetE[i1]); } -#ifdef EDM_ML_DEBUG + if (debug) { - std::cout << "newHCALIdNS::With Added cells along E/W results a set of " << (vdets.size() - dets.size()) - << " new cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "newHCALIdNS::With Added cells along E/W results a set of " + << (vdets.size() - dets.size()) << " new cells"; spr::debugHcalDets(dets.size(), vdets); } -#endif } unsigned int last0 = vdets.size(); int iphi = iphiS; @@ -261,12 +245,12 @@ namespace spr { } last = vdets.size(); vdets.insert(vdets.end(), vdetnew.begin(), vdetnew.end()); -#ifdef EDM_ML_DEBUG + if (debug) { - std::cout << "newHCALIdNS::Addition results a set of " << (vdets.size() - last0) << " new cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "newHCALIdNS::Addition results a set of " << (vdets.size() - last0) + << " new cells"; spr::debugHcalDets(last0, vdets); } -#endif last0 = last; } if (shiftNorth) @@ -278,25 +262,22 @@ namespace spr { last = last0; return spr::newHCALIdNS(vdets, last, topology, shiftNorth, ietaE, ietaW, iphiN, iphiS, debug); } else { -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newHCALIdNS::Final list consists of " << vdets.size() << " cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "newHCALIdNS::Final list consists of " << vdets.size() << " cells"; spr::debugHcalDets(0, vdets); } -#endif return vdets; } } std::vector newHCALIdEW( std::vector& dets, unsigned int last, const HcalTopology* topology, bool shiftEast, int ieta, bool debug) { -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newHCALIdEW::Add " << ieta << " rows of cells along " << shiftEast << " for " - << (dets.size() - last) << " cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "newHCALIdEW::Add " << ieta << " rows of cells along " << shiftEast << " for " + << (dets.size() - last) << " cells"; spr::debugHcalDets(last, dets); } -#endif + std::vector vdets; vdets.insert(vdets.end(), dets.begin(), dets.end()); if (ieta > 0) { @@ -314,23 +295,19 @@ namespace spr { ieta--; } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newHCALIdEW::Addition results a set of " << (vdets.size() - dets.size()) << " new cells" - << std::endl; + edm::LogVerbatim("IsoTrack") << "newHCALIdEW::Addition results a set of " << (vdets.size() - dets.size()) + << " new cells"; spr::debugHcalDets(dets.size(), vdets); } -#endif if (ieta > 0) { last = dets.size(); return spr::newHCALIdEW(vdets, last, topology, shiftEast, ieta, debug); } else { -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newHCALIdEW::Final list (EW) consists of " << vdets.size() << " cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "newHCALIdEW::Final list (EW) consists of " << vdets.size() << " cells"; spr::debugHcalDets(0, vdets); } -#endif return vdets; } } @@ -342,13 +319,12 @@ namespace spr { int ietaE, int ietaW, bool debug) { -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newHCALIdEW::Add " << ietaE << "|" << ietaW << " rows of cells along " << shiftEast << " for " - << (dets.size() - last) << " cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "newHCALIdEW::Add " << ietaE << "|" << ietaW << " rows of cells along " + << shiftEast << " for " << (dets.size() - last) << " cells"; spr::debugHcalDets(last, dets); } -#endif + int ieta = ietaW; if (shiftEast) ieta = ietaE; @@ -373,23 +349,20 @@ namespace spr { else ietaW = ieta; -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newHCALIdEW::Addition results a set of " << (vdets.size() - dets.size()) << " new cells" - << std::endl; + edm::LogVerbatim("IsoTrack") << "newHCALIdEW::Addition results a set of " << (vdets.size() - dets.size()) + << " new cells"; spr::debugHcalDets(dets.size(), vdets); } -#endif + if (ieta > 0) { last = dets.size(); return spr::newHCALIdEW(vdets, last, topology, shiftEast, ietaE, ietaW, debug); } else { -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "newHCALIdEW::Final list (EW) consists of " << vdets.size() << " cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "newHCALIdEW::Final list (EW) consists of " << vdets.size() << " cells"; spr::debugHcalDets(0, vdets); } -#endif return vdets; } } @@ -397,19 +370,12 @@ namespace spr { std::vector matrixHCALIdsDepth(std::vector& dets, const HcalTopology* topology, bool includeHO, - bool -#ifdef EDM_ML_DEBUG - debug -#endif - ) { - -#ifdef EDM_ML_DEBUG + bool debug) { if (debug) { - std::cout << "matrixHCALIdsDepth::Add cells with higher depths with HO" - << "Flag set to " << includeHO << " to existing " << dets.size() << " cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "matrixHCALIdsDepth::Add cells with higher depths with HO" + << "Flag set to " << includeHO << " to existing " << dets.size() << " cells"; spr::debugHcalDets(0, dets); } -#endif std::vector vdets(dets); for (unsigned int i1 = 0; i1 < dets.size(); i1++) { HcalDetId vdet = dets[i1]; @@ -419,11 +385,9 @@ namespace spr { if (includeHO || vUpDetId[0].subdetId() != (int)(HcalOuter)) { int n = std::count(vdets.begin(), vdets.end(), vUpDetId[0]); if (n == 0) { -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "matrixHCALIdsDepth:: Depth " << idepth << " " << vdet << " " << (HcalDetId)vUpDetId[0] - << std::endl; -#endif + edm::LogVerbatim("IsoTrack") + << "matrixHCALIdsDepth:: Depth " << idepth << " " << vdet << " " << (HcalDetId)vUpDetId[0]; vdets.push_back(vUpDetId[0]); } } @@ -432,12 +396,10 @@ namespace spr { } } -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "matrixHCALIdsDepth::Final list contains " << vdets.size() << " cells" << std::endl; + edm::LogVerbatim("IsoTrack") << "matrixHCALIdsDepth::Final list contains " << vdets.size() << " cells"; spr::debugHcalDets(0, vdets); } -#endif return vdets; } diff --git a/Calibration/IsolatedParticles/src/TrackSelection.cc b/Calibration/IsolatedParticles/src/TrackSelection.cc index 8a730412dfadb..1dc921c3e66b7 100644 --- a/Calibration/IsolatedParticles/src/TrackSelection.cc +++ b/Calibration/IsolatedParticles/src/TrackSelection.cc @@ -1,21 +1,15 @@ #include "Calibration/IsolatedParticles/interface/TrackSelection.h" #include "DataFormats/TrackReco/interface/HitPattern.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include - -//#define EDM_ML_DEBUG +#include namespace spr { bool goodTrack(const reco::Track* pTrack, math::XYZPoint leadPV, spr::trackSelectionParameters parameters, - bool -#ifdef EDM_ML_DEBUG - debug -#endif - ) { - + bool debug) { bool select = pTrack->quality(parameters.minQuality); double dxy = pTrack->dxy(leadPV); double dz = pTrack->dz(leadPV); @@ -23,11 +17,10 @@ namespace spr { if (std::abs(pTrack->qoverp()) > 0.0000001) dpbyp = std::abs(pTrack->qoverpError() / pTrack->qoverp()); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "Track:: Pt " << pTrack->pt() << " dxy " << dxy << " dz " << dz << " Chi2 " - << pTrack->normalizedChi2() << " dpbyp " << dpbyp << " Quality " << select << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "Track:: Pt " << pTrack->pt() << " dxy " << dxy << " dz " << dz << " Chi2 " + << pTrack->normalizedChi2() << " dpbyp " << dpbyp << " Quality " << select; + if (pTrack->pt() < parameters.minPt) select = false; if (dxy > parameters.maxDxyPV || dz > parameters.maxDzPV) @@ -44,45 +37,47 @@ namespace spr { if (parameters.minOuterHit > 0 && (hitp.stripTOBLayersWithMeasurement() + hitp.stripTECLayersWithMeasurement()) < parameters.minOuterHit) select = false; -#ifdef EDM_ML_DEBUG + if (debug) { - std::cout << "Default Hit Pattern with " << hitp.numberOfAllHits(reco::HitPattern::TRACK_HITS) << " hits" - << std::endl; - for (int i = 0; i < hitp.numberOfAllHits(reco::HitPattern::TRACK_HITS); i++) - hitp.printHitPattern(reco::HitPattern::TRACK_HITS, i, std::cout); + edm::LogVerbatim("IsoTrack") << "Default Hit Pattern with " + << hitp.numberOfAllHits(reco::HitPattern::TRACK_HITS) << " hits"; + for (int i = 0; i < hitp.numberOfAllHits(reco::HitPattern::TRACK_HITS); i++) { + std::ostringstream st1; + hitp.printHitPattern(reco::HitPattern::TRACK_HITS, i, st1); + edm::LogVerbatim("IsoTrack") << st1.str(); + } } -#endif } if (parameters.maxInMiss >= 0) { const reco::HitPattern& hitp = pTrack->hitPattern(); if (hitp.trackerLayersWithoutMeasurement(reco::HitPattern::MISSING_INNER_HITS) > parameters.maxInMiss) select = false; -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "Inner Hit Pattern with " << hitp.numberOfAllHits(reco::HitPattern::MISSING_INNER_HITS) << " hits" - << std::endl; - for (int i = 0; i < hitp.numberOfAllHits(reco::HitPattern::MISSING_INNER_HITS); i++) - hitp.printHitPattern(reco::HitPattern::MISSING_INNER_HITS, i, std::cout); + edm::LogVerbatim("IsoTrack") << "Inner Hit Pattern with " + << hitp.numberOfAllHits(reco::HitPattern::MISSING_INNER_HITS) << " hits"; + for (int i = 0; i < hitp.numberOfAllHits(reco::HitPattern::MISSING_INNER_HITS); i++) { + std::ostringstream st1; + hitp.printHitPattern(reco::HitPattern::MISSING_INNER_HITS, i, st1); + edm::LogVerbatim("IsoTrack") << st1.str(); + } } -#endif } if (parameters.maxOutMiss >= 0) { const reco::HitPattern& hitp = pTrack->hitPattern(); if (hitp.trackerLayersWithoutMeasurement(reco::HitPattern::MISSING_OUTER_HITS) > parameters.maxOutMiss) select = false; -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "Outer Hit Pattern with " << hitp.numberOfAllHits(reco::HitPattern::MISSING_OUTER_HITS) << " hits" - << std::endl; - for (int i = 0; i < hitp.numberOfAllHits(reco::HitPattern::MISSING_OUTER_HITS); i++) - hitp.printHitPattern(reco::HitPattern::MISSING_OUTER_HITS, i, std::cout); + edm::LogVerbatim("IsoTrack") << "Outer Hit Pattern with " + << hitp.numberOfAllHits(reco::HitPattern::MISSING_OUTER_HITS) << " hits"; + for (int i = 0; i < hitp.numberOfAllHits(reco::HitPattern::MISSING_OUTER_HITS); i++) { + std::ostringstream st1; + hitp.printHitPattern(reco::HitPattern::MISSING_OUTER_HITS, i, st1); + edm::LogVerbatim("IsoTrack") << st1.str(); + } } -#endif } -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "Final Selection Result " << select << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "Final Selection Result " << select; return select; } } // namespace spr diff --git a/Calibration/IsolatedParticles/src/eECALMatrix.cc b/Calibration/IsolatedParticles/src/eECALMatrix.cc index 9d6e17bf1fc0f..f2f06355db46e 100644 --- a/Calibration/IsolatedParticles/src/eECALMatrix.cc +++ b/Calibration/IsolatedParticles/src/eECALMatrix.cc @@ -5,10 +5,10 @@ #include "DataFormats/EcalDetId/interface/EEDetId.h" #include "DataFormats/EcalDetId/interface/ESDetId.h" #include "DataFormats/EcalDetId/interface/EcalSubdetector.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h" -#include -//#define EDM_ML_DEBUG +#include namespace spr { @@ -21,10 +21,10 @@ namespace spr { bool debug) { std::vector hits; spr::findHit(hitsEC, id, hits, debug); -#ifdef EDM_ML_DEBUG + + std::ostringstream st1; if (debug) - std::cout << "Xtal 0x" << std::hex << id() << std::dec; -#endif + st1 << "Xtal 0x" << std::hex << id() << std::dec; const EcalRecHitCollection* recHitsEC = (hitsEC.isValid()) ? hitsEC.product() : nullptr; bool flag = (!testSpike) ? true : (sevlv->severityLevel(id, (*recHitsEC)) != EcalSeverityLevel::kWeird); double ener(0); @@ -34,19 +34,16 @@ namespace spr { en = hit->energy(); tt = hit->time(); } -#ifdef EDM_ML_DEBUG if (debug) - std::cout << " " << tt << " " << en; -#endif + st1 << " " << tt << " " << en; if (tt > tMin && tt < tMax) ener += en; } -#ifdef EDM_ML_DEBUG - if (!flag && debug) - std::cout << " detected to be a spike"; - if (debug) - std::cout << std::endl; -#endif + if (debug) { + if (!flag) + st1 << " detected to be a spike"; + edm::LogVerbatim("IsoTrack") << st1.str(); + } return std::pair(ener, flag); } @@ -70,10 +67,8 @@ namespace spr { energySum += ecalEn.first; } } -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "energyECAL: energySum = " << energySum << " flag = " << flag << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "energyECAL: energySum = " << energySum << " flag = " << flag; return std::pair(energySum, flag); } @@ -93,12 +88,9 @@ namespace spr { bool debug) { std::vector vdets; spr::matrixECALIds(detId, ieta, iphi, geo, caloTopology, vdets, debug); -#ifdef EDM_ML_DEBUG - if (debug) { - std::cout << "Inside eECALmatrix " << 2 * ieta + 1 << "X" << 2 * iphi + 1 << " nXtals " << vdets.size() - << std::endl; - } -#endif + if (debug) + edm::LogVerbatim("IsoTrack") << "Inside eECALmatrix " << 2 * ieta + 1 << "X" << 2 * iphi + 1 << " nXtals " + << vdets.size(); bool flag(true); for (const auto& id : vdets) { if ((id.det() == DetId::Ecal) && (id.subdetId() == EcalBarrel)) { @@ -129,12 +121,9 @@ namespace spr { bool debug) { std::vector vdets; spr::matrixECALIds(detId, ieta, iphi, geo, caloTopology, vdets, debug); -#ifdef EDM_ML_DEBUG - if (debug) { - std::cout << "Inside eECALmatrix " << 2 * ieta + 1 << "X" << 2 * iphi + 1 << " nXtals " << vdets.size() - << std::endl; - } -#endif + if (debug) + edm::LogVerbatim("IsoTrack") << "Inside eECALmatrix " << 2 * ieta + 1 << "X" << 2 * iphi + 1 << " nXtals " + << vdets.size(); bool flag(true); double energySum = 0.0; @@ -143,10 +132,8 @@ namespace spr { ((id.subdetId() == EcalBarrel) || (id.subdetId() == EcalEndcap))) { double eTower = spr::energyECALTower(id, hitsEB, hitsEE, ttMap, debug); bool ok = (id.subdetId() == EcalBarrel) ? (eTower > ebThr) : (eTower > eeThr); -#ifdef EDM_ML_DEBUG if (debug && (!ok)) - std::cout << "Crystal 0x" << std::hex << id() << std::dec << " Flag " << ok << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "Crystal 0x" << std::hex << id() << std::dec << " Flag " << ok; if (ok) { std::pair ecalEn = (id.subdetId() == EcalBarrel) ? spr::energyECAL(id, hitsEB, sevlv, true, tMin, tMax, debug) @@ -157,10 +144,8 @@ namespace spr { } } } -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "energyECAL: energySum = " << energySum << " flag = " << flag << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "energyECAL: energySum = " << energySum << " flag = " << flag; return std::pair(energySum, flag); } @@ -177,26 +162,25 @@ namespace spr { bool debug) { CaloTowerDetId tower = ctmap->towerOf(detId); std::vector ids = ctmap->constituentsOf(tower); -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "eECALmatrix: " << detId << " belongs to " << tower << " which has " << ids.size() << " constituents" - << std::endl; + edm::LogVerbatim("IsoTrack") << "eECALmatrix: " << detId << " belongs to " << tower << " which has " << ids.size() + << " constituents"; for (unsigned int i = 0; i < ids.size(); ++i) { - std::cout << "[" << i << "] " << std::hex << ids[i].rawId() << std::dec; + std::ostringstream st1; + st1 << "[" << i << "] " << std::hex << ids[i].rawId() << std::dec; if (ids[i].det() == DetId::Ecal && ids[i].subdetId() == EcalBarrel) { - std::cout << " " << EBDetId(ids[i]) << std::endl; + st1 << " " << EBDetId(ids[i]); } else if (ids[i].det() == DetId::Ecal && ids[i].subdetId() == EcalEndcap) { - std::cout << " " << EEDetId(ids[i]) << std::endl; + st1 << " " << EEDetId(ids[i]); } else if (ids[i].det() == DetId::Ecal && ids[i].subdetId() == EcalPreshower) { - std::cout << " " << ESDetId(ids[i]) << std::endl; + st1 << " " << ESDetId(ids[i]); } else if (ids[i].det() == DetId::Hcal) { - std::cout << " " << HcalDetId(ids[i]) << std::endl; - } else { - std::cout << std::endl; + st1 << " " << HcalDetId(ids[i]); } + edm::LogVerbatim("IsoTrack") << st1.str(); } } -#endif + std::vector idEBEE; bool flag(true); for (const auto& id : ids) { @@ -210,11 +194,10 @@ namespace spr { flag = false; } } -#ifdef EDM_ML_DEBUG + if (debug) - std::cout << "eECALmatrix: with " << idEBEE.size() << " EB+EE hits and " - << "spike flag " << flag << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "eECALmatrix: with " << idEBEE.size() << " EB+EE hits and " + << "spike flag " << flag; double etot = (!idEBEE.empty()) ? spr::energyECAL(idEBEE, hitsEB, hitsEE, ebThr, eeThr, tMin, tMax, debug) : 0; return std::pair(etot, flag); } diff --git a/Calibration/IsolatedParticles/src/eHCALMatrix.cc b/Calibration/IsolatedParticles/src/eHCALMatrix.cc index 12be9e9671323..bdc07837da2e4 100644 --- a/Calibration/IsolatedParticles/src/eHCALMatrix.cc +++ b/Calibration/IsolatedParticles/src/eHCALMatrix.cc @@ -1,11 +1,10 @@ #include "Calibration/IsolatedParticles/interface/DebugInfo.h" #include "Calibration/IsolatedParticles/interface/eHCALMatrix.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include -#include - -//#define EDM_ML_DEBUG +#include namespace spr { double eHCALmatrix(const HcalTopology* topology, @@ -20,29 +19,22 @@ namespace spr { double hoThr, double tMin, double tMax, - bool -#ifdef EDM_ML_DEBUG - debug -#endif - ) { - + bool debug) { HcalDetId hcid0(det0.rawId()); HcalDetId hcid(hcid0.subdet(), hcid0.ieta(), hcid0.iphi(), 1); DetId det(hcid.rawId()); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "Inside eHCALmatrix " << 2 * ieta + 1 << "X" << 2 * iphi + 1 << " Inclusion of HO Flag " << includeHO - << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "Inside eHCALmatrix " << 2 * ieta + 1 << "X" << 2 * iphi + 1 + << " Inclusion of HO Flag " << includeHO; + double energySum(0); std::vector dets(1, det); std::vector vdets = spr::matrixHCALIds(dets, topology, ieta, iphi, includeHO, false); -#ifdef EDM_ML_DEBUG if (debug) { - std::cout << "matrixHCALIds::Total number of cells found is " << vdets.size() << std::endl; + edm::LogVerbatim("IsoTrack") << "matrixHCALIds::Total number of cells found is " << vdets.size(); spr::debugHcalDets(0, vdets); } -#endif + int khit(0); for (unsigned int i = 0; i < vdets.size(); i++) { std::vector::const_iterator> hit = spr::findHit(hits, vdets[i]); @@ -52,11 +44,10 @@ namespace spr { for (unsigned int ihit = 0; ihit < hit.size(); ihit++) { if (hit[ihit] != hits.end()) { khit++; -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "energyHCAL:: Hit " << khit << " " << (HcalDetId)vdets[i] << " E " << hit[ihit]->energy() - << " t " << hit[ihit]->time() << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "energyHCAL:: Hit " << khit << " " << (HcalDetId)vdets[i] << " E " + << hit[ihit]->energy() << " t " << hit[ihit]->time(); + if (hit[ihit]->time() > tMin && hit[ihit]->time() < tMax) { energy += hit[ihit]->energy(); } @@ -66,10 +57,8 @@ namespace spr { energySum += energy; } -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "eHCALmatrix::Total energy " << energySum << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "eHCALmatrix::Total energy " << energySum; return energySum; } @@ -142,21 +131,15 @@ namespace spr { double tMin, double tMax, int depthHE, - bool -#ifdef EDM_ML_DEBUG - debug -#endif - ) { - + bool debug) { energyCell.clear(); int subdet = detId.subdet(); double eThr = spr::eHCALThreshold(subdet, hbThr, heThr, hfThr, hoThr); bool hbhe = (detId.ietaAbs() == 16); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "energyHCALCell: input ID " << detId << " MaxDepth " << maxDepth << " Threshold (E) " << eThr - << " (T) " << tMin << ":" << tMax << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "energyHCALCell: input ID " << detId << " MaxDepth " << maxDepth + << " Threshold (E) " << eThr << " (T) " << tMin << ":" << tMax; + for (int i = 0; i < maxDepth; i++) { HcalSubdetector subdet0 = (hbhe) ? ((i + 1 >= depthHE) ? HcalEndcap : HcalBarrel) : detId.subdet(); HcalDetId hcid(subdet0, detId.ieta(), detId.iphi(), i + 1); @@ -166,30 +149,27 @@ namespace spr { for (unsigned int ihit = 0; ihit < hit.size(); ++ihit) { if (hit[ihit]->time() > tMin && hit[ihit]->time() < tMax) energy += hit[ihit]->energy(); -#ifdef EDM_ML_DEBUG if (debug) - std::cout << "energyHCALCell:: Hit[" << ihit << "] " << hcid << " E " << hit[ihit]->energy() << " t " - << hit[ihit]->time() << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "energyHCALCell:: Hit[" << ihit << "] " << hcid << " E " + << hit[ihit]->energy() << " t " << hit[ihit]->time(); } -#ifdef EDM_ML_DEBUG + if (debug) - std::cout << "energyHCALCell:: Cell " << hcid << " E " << energy << " from " << hit.size() << " threshold " - << eThr << std::endl; -#endif + edm::LogVerbatim("IsoTrack") << "energyHCALCell:: Cell " << hcid << " E " << energy << " from " << hit.size() + << " threshold " << eThr; if (energy > eThr && !hit.empty()) { energyCell.push_back(std::pair(energy, i + 1)); } } -#ifdef EDM_ML_DEBUG + if (debug) { - std::cout << "energyHCALCell:: " << energyCell.size() << " entries from " << maxDepth << " depths:"; + std::ostringstream st1; + st1 << "energyHCALCell:: " << energyCell.size() << " entries from " << maxDepth << " depths:"; for (unsigned int i = 0; i < energyCell.size(); ++i) { - std::cout << " [" << i << "] (" << energyCell[i].first << ":" << energyCell[i].second << ")"; + st1 << " [" << i << "] (" << energyCell[i].first << ":" << energyCell[i].second << ")"; } - std::cout << std::endl; + edm::LogVerbatim("IsoTrack") << st1.str(); } -#endif } HcalDetId getHotCell(std::vector& hit, bool includeHO, int useRaw, bool) { diff --git a/Calibration/IsolatedParticles/test/CaloPropagationTest.cc b/Calibration/IsolatedParticles/test/CaloPropagationTest.cc index 3fd4fdf4d3f8d..036e09e3ccfa8 100644 --- a/Calibration/IsolatedParticles/test/CaloPropagationTest.cc +++ b/Calibration/IsolatedParticles/test/CaloPropagationTest.cc @@ -19,11 +19,11 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/one/EDAnalyzer.h" - #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "Calibration/IsolatedParticles/interface/CaloPropagateTrack.h" @@ -77,7 +77,7 @@ void CaloPropagationTest::analyze(const edm::Event& iEvent, const edm::EventSetu const HcalDetId hid(id); std::pair info = spr::propagateIdECAL(hid, geo, bField, debug); if (!info.second) { - std::cout << "No valid Ecal Id found for " << hid << std::endl; + edm::LogVerbatim("IsoTrack") << "No valid Ecal Id found for " << hid; } else { CaloTowerDetId tower = ctmap->towerOf(id); std::vector idts = ctmap->constituentsOf(tower); @@ -89,11 +89,11 @@ void CaloPropagationTest::analyze(const edm::Event& iEvent, const edm::EventSetu } } if ((info.first).subdetId() == EcalBarrel) { - std::cout << "Find " << EBDetId(info.first) << " as partner of " << hid << " and mtaching with tower " - << found << std::endl; + edm::LogVerbatim("IsoTrack") << "Find " << EBDetId(info.first) << " as partner of " << hid + << " and mtaching with tower " << found; } else { - std::cout << "Find " << EEDetId(info.first) << " as partner of " << hid << " and mtaching with tower " - << found << std::endl; + edm::LogVerbatim("IsoTrack") << "Find " << EEDetId(info.first) << " as partner of " << hid + << " and mtaching with tower " << found; } } } diff --git a/CaloOnlineTools/HcalOnlineDb/interface/HcalLutManager.h b/CaloOnlineTools/HcalOnlineDb/interface/HcalLutManager.h index cacab5ae0e10d..fb14974b5981e 100644 --- a/CaloOnlineTools/HcalOnlineDb/interface/HcalLutManager.h +++ b/CaloOnlineTools/HcalOnlineDb/interface/HcalLutManager.h @@ -21,7 +21,7 @@ #include "CaloOnlineTools/HcalOnlineDb/interface/HCALConfigDB.h" #include "CaloOnlineTools/HcalOnlineDb/interface/LMap.h" #include "CalibFormats/HcalObjects/interface/HcalTPGCoder.h" -#include "CalibCalorimetry/CaloTPG/src/CaloTPGTranscoderULUT.h" +#include "CalibCalorimetry/CaloTPG/interface/CaloTPGTranscoderULUT.h" #include "CaloOnlineTools/HcalOnlineDb/interface/HcalAssistant.h" #include "CaloOnlineTools/HcalOnlineDb/interface/HcalChannelIterator.h" #include "SimCalorimetry/HcalTrigPrimAlgos/interface/HcalFinegrainBit.h" diff --git a/CommonTools/CandAlgos/plugins/BuildFile.xml b/CommonTools/CandAlgos/plugins/BuildFile.xml index 6ffafad1a1bf3..003f0e0b1d21e 100644 --- a/CommonTools/CandAlgos/plugins/BuildFile.xml +++ b/CommonTools/CandAlgos/plugins/BuildFile.xml @@ -8,5 +8,4 @@ - diff --git a/CommonTools/RecoAlgos/src/CandidateProducer.h b/CommonTools/RecoAlgos/interface/CandidateProducer.h similarity index 100% rename from CommonTools/RecoAlgos/src/CandidateProducer.h rename to CommonTools/RecoAlgos/interface/CandidateProducer.h diff --git a/CommonTools/RecoAlgos/src/MassiveCandidateConverter.h b/CommonTools/RecoAlgos/interface/MassiveCandidateConverter.h similarity index 100% rename from CommonTools/RecoAlgos/src/MassiveCandidateConverter.h rename to CommonTools/RecoAlgos/interface/MassiveCandidateConverter.h diff --git a/CommonTools/RecoAlgos/interface/TrackToRefCandidate.h b/CommonTools/RecoAlgos/interface/TrackToRefCandidate.h index 394f9aae48cf6..224c9ec603cf1 100644 --- a/CommonTools/RecoAlgos/interface/TrackToRefCandidate.h +++ b/CommonTools/RecoAlgos/interface/TrackToRefCandidate.h @@ -1,7 +1,7 @@ #ifndef RecoAlgos_TrackToRefCandidate_h #define RecoAlgos_TrackToRefCandidate_h -#include "CommonTools/RecoAlgos/src/MassiveCandidateConverter.h" -#include "CommonTools/RecoAlgos/src/CandidateProducer.h" +#include "CommonTools/RecoAlgos/interface/MassiveCandidateConverter.h" +#include "CommonTools/RecoAlgos/interface/CandidateProducer.h" #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/RecoCandidate/interface/RecoChargedRefCandidate.h" #include "DataFormats/RecoCandidate/interface/RecoChargedRefCandidateFwd.h" diff --git a/CommonTools/RecoAlgos/plugins/RecoChargedRefCandidateToTrackRefProducer.cc b/CommonTools/RecoAlgos/plugins/RecoChargedRefCandidateToTrackRefProducer.cc index 35ed449396ee0..12018c6de5d0f 100644 --- a/CommonTools/RecoAlgos/plugins/RecoChargedRefCandidateToTrackRefProducer.cc +++ b/CommonTools/RecoAlgos/plugins/RecoChargedRefCandidateToTrackRefProducer.cc @@ -1,5 +1,5 @@ #include "CommonTools/RecoAlgos/src/RecoChargedRefCandidateToTrackRef.h" -#include "CommonTools/RecoAlgos/src/CandidateProducer.h" +#include "CommonTools/RecoAlgos/interface/CandidateProducer.h" #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/CommonTools/RecoAlgos/src/MassiveCandidateConverter.cc b/CommonTools/RecoAlgos/src/MassiveCandidateConverter.cc index fdbbdb645c852..9f2733b32d829 100644 --- a/CommonTools/RecoAlgos/src/MassiveCandidateConverter.cc +++ b/CommonTools/RecoAlgos/src/MassiveCandidateConverter.cc @@ -1,4 +1,4 @@ -#include "CommonTools/RecoAlgos/src/MassiveCandidateConverter.h" +#include "CommonTools/RecoAlgos/interface/MassiveCandidateConverter.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "HepPDT/ParticleData.hh" #include "FWCore/Framework/interface/ESHandle.h" diff --git a/CommonTools/RecoAlgos/src/PFClusterToRefCandidate.h b/CommonTools/RecoAlgos/src/PFClusterToRefCandidate.h index e4d69d8d750a2..e8c99a1287aef 100644 --- a/CommonTools/RecoAlgos/src/PFClusterToRefCandidate.h +++ b/CommonTools/RecoAlgos/src/PFClusterToRefCandidate.h @@ -1,7 +1,7 @@ #ifndef RecoAlgos_PFClusterToRefCandidate_h #define RecoAlgos_PFClusterToRefCandidate_h -#include "CommonTools/RecoAlgos/src/MassiveCandidateConverter.h" -#include "CommonTools/RecoAlgos/src/CandidateProducer.h" +#include "CommonTools/RecoAlgos/interface/MassiveCandidateConverter.h" +#include "CommonTools/RecoAlgos/interface/CandidateProducer.h" #include "DataFormats/ParticleFlowReco/interface/PFCluster.h" #include "DataFormats/ParticleFlowReco/interface/RecoPFClusterRefCandidate.h" #include "DataFormats/ParticleFlowReco/interface/RecoPFClusterRefCandidateFwd.h" diff --git a/CommonTools/RecoAlgos/src/StandAloneMuonTrackToCandidate.h b/CommonTools/RecoAlgos/src/StandAloneMuonTrackToCandidate.h index dc33670a700d2..0a00f7f809f7f 100644 --- a/CommonTools/RecoAlgos/src/StandAloneMuonTrackToCandidate.h +++ b/CommonTools/RecoAlgos/src/StandAloneMuonTrackToCandidate.h @@ -1,7 +1,7 @@ #ifndef RecoAlgos_StandAloneMuonTrackToCandidate_h #define RecoAlgos_StandAloneMuonTrackToCandidate_h -#include "CommonTools/RecoAlgos/src/MassiveCandidateConverter.h" -#include "CommonTools/RecoAlgos/src/CandidateProducer.h" +#include "CommonTools/RecoAlgos/interface/MassiveCandidateConverter.h" +#include "CommonTools/RecoAlgos/interface/CandidateProducer.h" #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/RecoCandidate/interface/RecoStandAloneMuonCandidate.h" #include "DataFormats/RecoCandidate/interface/RecoStandAloneMuonCandidateFwd.h" diff --git a/CommonTools/RecoAlgos/src/SuperClusterToCandidate.h b/CommonTools/RecoAlgos/src/SuperClusterToCandidate.h index 5f473303cc282..54bc8652ec80d 100644 --- a/CommonTools/RecoAlgos/src/SuperClusterToCandidate.h +++ b/CommonTools/RecoAlgos/src/SuperClusterToCandidate.h @@ -1,7 +1,7 @@ #ifndef RecoAlgos_SuperClusterToCandidate_h #define RecoAlgos_SuperClusterToCandidate_h -#include "CommonTools/RecoAlgos/src/MassiveCandidateConverter.h" -#include "CommonTools/RecoAlgos/src/CandidateProducer.h" +#include "CommonTools/RecoAlgos/interface/MassiveCandidateConverter.h" +#include "CommonTools/RecoAlgos/interface/CandidateProducer.h" #include "DataFormats/EgammaReco/interface/SuperCluster.h" #include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h" #include "DataFormats/RecoCandidate/interface/RecoEcalCandidateFwd.h" diff --git a/CommonTools/RecoAlgos/src/TrackToCandidate.h b/CommonTools/RecoAlgos/src/TrackToCandidate.h index 4764c0d8c6b2a..593772ef97157 100644 --- a/CommonTools/RecoAlgos/src/TrackToCandidate.h +++ b/CommonTools/RecoAlgos/src/TrackToCandidate.h @@ -1,7 +1,7 @@ #ifndef RecoAlgos_TrackToCandidate_h #define RecoAlgos_TrackToCandidate_h -#include "CommonTools/RecoAlgos/src/MassiveCandidateConverter.h" -#include "CommonTools/RecoAlgos/src/CandidateProducer.h" +#include "CommonTools/RecoAlgos/interface/MassiveCandidateConverter.h" +#include "CommonTools/RecoAlgos/interface/CandidateProducer.h" #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h" #include "DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h" diff --git a/CommonTools/Utils/src/AnyMethodArgument.h b/CommonTools/Utils/interface/AnyMethodArgument.h similarity index 100% rename from CommonTools/Utils/src/AnyMethodArgument.h rename to CommonTools/Utils/interface/AnyMethodArgument.h diff --git a/CommonTools/Utils/src/BinaryCutSetter.h b/CommonTools/Utils/interface/BinaryCutSetter.h similarity index 86% rename from CommonTools/Utils/src/BinaryCutSetter.h rename to CommonTools/Utils/interface/BinaryCutSetter.h index 98a3881561e9b..b0ddcc8e785d5 100644 --- a/CommonTools/Utils/src/BinaryCutSetter.h +++ b/CommonTools/Utils/interface/BinaryCutSetter.h @@ -10,8 +10,8 @@ * \version $Revision: 1.2 $ * */ -#include "CommonTools/Utils/src/SelectorStack.h" -#include "CommonTools/Utils/src/LogicalBinaryOperator.h" +#include "CommonTools/Utils/interface/SelectorStack.h" +#include "CommonTools/Utils/interface/LogicalBinaryOperator.h" namespace reco { namespace parser { diff --git a/CommonTools/Utils/src/BinarySelector.h b/CommonTools/Utils/interface/BinarySelector.h similarity index 94% rename from CommonTools/Utils/src/BinarySelector.h rename to CommonTools/Utils/interface/BinarySelector.h index acfe31fdf62fe..08e789945c626 100644 --- a/CommonTools/Utils/src/BinarySelector.h +++ b/CommonTools/Utils/interface/BinarySelector.h @@ -12,7 +12,7 @@ */ #include "CommonTools/Utils/interface/SelectorBase.h" #include "CommonTools/Utils/interface/ExpressionBase.h" -#include "CommonTools/Utils/src/ComparisonBase.h" +#include "CommonTools/Utils/interface/ComparisonBase.h" namespace reco { namespace parser { diff --git a/CommonTools/Utils/src/BinarySelectorSetter.h b/CommonTools/Utils/interface/BinarySelectorSetter.h similarity index 87% rename from CommonTools/Utils/src/BinarySelectorSetter.h rename to CommonTools/Utils/interface/BinarySelectorSetter.h index 60602ea43a23f..13dc51209c0c4 100644 --- a/CommonTools/Utils/src/BinarySelectorSetter.h +++ b/CommonTools/Utils/interface/BinarySelectorSetter.h @@ -10,10 +10,10 @@ * \version $Revision: 1.2 $ * */ -#include "CommonTools/Utils/src/SelectorStack.h" -#include "CommonTools/Utils/src/ComparisonStack.h" -#include "CommonTools/Utils/src/ExpressionStack.h" -#include "CommonTools/Utils/src/BinarySelector.h" +#include "CommonTools/Utils/interface/SelectorStack.h" +#include "CommonTools/Utils/interface/ComparisonStack.h" +#include "CommonTools/Utils/interface/ExpressionStack.h" +#include "CommonTools/Utils/interface/BinarySelector.h" #include "CommonTools/Utils/interface/Exception.h" namespace reco { diff --git a/CommonTools/Utils/src/Comparison.h b/CommonTools/Utils/interface/Comparison.h similarity index 90% rename from CommonTools/Utils/src/Comparison.h rename to CommonTools/Utils/interface/Comparison.h index 36b93d10600a6..c9e551f133d86 100644 --- a/CommonTools/Utils/src/Comparison.h +++ b/CommonTools/Utils/interface/Comparison.h @@ -10,7 +10,7 @@ * \version $Revision: 1.2 $ * */ -#include "CommonTools/Utils/src/ComparisonBase.h" +#include "CommonTools/Utils/interface/ComparisonBase.h" namespace reco { namespace parser { diff --git a/CommonTools/Utils/src/ComparisonBase.h b/CommonTools/Utils/interface/ComparisonBase.h similarity index 100% rename from CommonTools/Utils/src/ComparisonBase.h rename to CommonTools/Utils/interface/ComparisonBase.h diff --git a/CommonTools/Utils/src/ComparisonSetter.h b/CommonTools/Utils/interface/ComparisonSetter.h similarity index 90% rename from CommonTools/Utils/src/ComparisonSetter.h rename to CommonTools/Utils/interface/ComparisonSetter.h index d939b5af68671..37359abed80fc 100644 --- a/CommonTools/Utils/src/ComparisonSetter.h +++ b/CommonTools/Utils/interface/ComparisonSetter.h @@ -10,8 +10,8 @@ * \version $Revision: 1.2 $ * */ -#include "CommonTools/Utils/src/ComparisonStack.h" -#include "CommonTools/Utils/src/Comparison.h" +#include "CommonTools/Utils/interface/ComparisonStack.h" +#include "CommonTools/Utils/interface/Comparison.h" #ifdef BOOST_SPIRIT_DEBUG #include #include diff --git a/CommonTools/Utils/src/ComparisonStack.h b/CommonTools/Utils/interface/ComparisonStack.h similarity index 100% rename from CommonTools/Utils/src/ComparisonStack.h rename to CommonTools/Utils/interface/ComparisonStack.h diff --git a/CommonTools/Utils/src/CutSetter.h b/CommonTools/Utils/interface/CutSetter.h similarity index 93% rename from CommonTools/Utils/src/CutSetter.h rename to CommonTools/Utils/interface/CutSetter.h index 5c4f37a85fc5f..43c5a67ec9d94 100644 --- a/CommonTools/Utils/src/CutSetter.h +++ b/CommonTools/Utils/interface/CutSetter.h @@ -11,7 +11,7 @@ * */ #include "CommonTools/Utils/interface/SelectorPtr.h" -#include "CommonTools/Utils/src/SelectorStack.h" +#include "CommonTools/Utils/interface/SelectorStack.h" #include namespace reco { diff --git a/CommonTools/Utils/src/ExpressionBinaryOperator.h b/CommonTools/Utils/interface/ExpressionBinaryOperator.h similarity index 94% rename from CommonTools/Utils/src/ExpressionBinaryOperator.h rename to CommonTools/Utils/interface/ExpressionBinaryOperator.h index aaa7c479881db..1bff443ea24be 100644 --- a/CommonTools/Utils/src/ExpressionBinaryOperator.h +++ b/CommonTools/Utils/interface/ExpressionBinaryOperator.h @@ -11,7 +11,7 @@ * */ #include "CommonTools/Utils/interface/ExpressionBase.h" -#include "CommonTools/Utils/src/ExpressionStack.h" +#include "CommonTools/Utils/interface/ExpressionStack.h" namespace reco { namespace parser { diff --git a/CommonTools/Utils/src/ExpressionBinaryOperatorSetter.h b/CommonTools/Utils/interface/ExpressionBinaryOperatorSetter.h similarity index 88% rename from CommonTools/Utils/src/ExpressionBinaryOperatorSetter.h rename to CommonTools/Utils/interface/ExpressionBinaryOperatorSetter.h index 0e85de62b2f70..d695a9eeed6a6 100644 --- a/CommonTools/Utils/src/ExpressionBinaryOperatorSetter.h +++ b/CommonTools/Utils/interface/ExpressionBinaryOperatorSetter.h @@ -10,8 +10,8 @@ * \version $Revision: 1.2 $ * */ -#include "CommonTools/Utils/src/ExpressionBinaryOperator.h" -#include "CommonTools/Utils/src/ExpressionStack.h" +#include "CommonTools/Utils/interface/ExpressionBinaryOperator.h" +#include "CommonTools/Utils/interface/ExpressionStack.h" #include namespace reco { diff --git a/CommonTools/Utils/src/ExpressionConditionSetter.h b/CommonTools/Utils/interface/ExpressionConditionSetter.h similarity index 85% rename from CommonTools/Utils/src/ExpressionConditionSetter.h rename to CommonTools/Utils/interface/ExpressionConditionSetter.h index d62a4a2bfc8fe..e72435f507b2c 100644 --- a/CommonTools/Utils/src/ExpressionConditionSetter.h +++ b/CommonTools/Utils/interface/ExpressionConditionSetter.h @@ -9,8 +9,8 @@ * \version $Revision: 1.1 $ * */ -#include "CommonTools/Utils/src/ExpressionStack.h" -#include "CommonTools/Utils/src/SelectorStack.h" +#include "CommonTools/Utils/interface/ExpressionStack.h" +#include "CommonTools/Utils/interface/SelectorStack.h" namespace reco { namespace parser { diff --git a/CommonTools/Utils/src/ExpressionFunctionSetter.h b/CommonTools/Utils/interface/ExpressionFunctionSetter.h similarity index 85% rename from CommonTools/Utils/src/ExpressionFunctionSetter.h rename to CommonTools/Utils/interface/ExpressionFunctionSetter.h index 8a6c2b02d051c..00fddcb5793e5 100644 --- a/CommonTools/Utils/src/ExpressionFunctionSetter.h +++ b/CommonTools/Utils/interface/ExpressionFunctionSetter.h @@ -9,8 +9,8 @@ * \version $Revision: 1.1 $ * */ -#include "CommonTools/Utils/src/ExpressionStack.h" -#include "CommonTools/Utils/src/FunctionStack.h" +#include "CommonTools/Utils/interface/ExpressionStack.h" +#include "CommonTools/Utils/interface/FunctionStack.h" namespace reco { namespace parser { diff --git a/CommonTools/Utils/src/ExpressionNumber.h b/CommonTools/Utils/interface/ExpressionNumber.h similarity index 100% rename from CommonTools/Utils/src/ExpressionNumber.h rename to CommonTools/Utils/interface/ExpressionNumber.h diff --git a/CommonTools/Utils/src/ExpressionNumberSetter.h b/CommonTools/Utils/interface/ExpressionNumberSetter.h similarity index 85% rename from CommonTools/Utils/src/ExpressionNumberSetter.h rename to CommonTools/Utils/interface/ExpressionNumberSetter.h index 87f5a8d752886..bc78f6629b50b 100644 --- a/CommonTools/Utils/src/ExpressionNumberSetter.h +++ b/CommonTools/Utils/interface/ExpressionNumberSetter.h @@ -10,8 +10,8 @@ * \version $Revision: 1.3 $ * */ -#include "CommonTools/Utils/src/ExpressionNumber.h" -#include "CommonTools/Utils/src/ExpressionStack.h" +#include "CommonTools/Utils/interface/ExpressionNumber.h" +#include "CommonTools/Utils/interface/ExpressionStack.h" namespace reco { namespace parser { diff --git a/CommonTools/Utils/src/ExpressionSelectorSetter.h b/CommonTools/Utils/interface/ExpressionSelectorSetter.h similarity index 84% rename from CommonTools/Utils/src/ExpressionSelectorSetter.h rename to CommonTools/Utils/interface/ExpressionSelectorSetter.h index 0383ea68a8198..72de53f5c4938 100644 --- a/CommonTools/Utils/src/ExpressionSelectorSetter.h +++ b/CommonTools/Utils/interface/ExpressionSelectorSetter.h @@ -10,11 +10,11 @@ * \version $Revision: 1.2 $ * */ -#include "CommonTools/Utils/src/SelectorStack.h" -#include "CommonTools/Utils/src/ExpressionStack.h" -#include "CommonTools/Utils/src/BinarySelector.h" -#include "CommonTools/Utils/src/ExpressionNumber.h" -#include "CommonTools/Utils/src/Comparison.h" +#include "CommonTools/Utils/interface/SelectorStack.h" +#include "CommonTools/Utils/interface/ExpressionStack.h" +#include "CommonTools/Utils/interface/BinarySelector.h" +#include "CommonTools/Utils/interface/ExpressionNumber.h" +#include "CommonTools/Utils/interface/Comparison.h" #include "CommonTools/Utils/interface/Exception.h" #include diff --git a/CommonTools/Utils/src/ExpressionSetter.h b/CommonTools/Utils/interface/ExpressionSetter.h similarity index 92% rename from CommonTools/Utils/src/ExpressionSetter.h rename to CommonTools/Utils/interface/ExpressionSetter.h index b1538e0a304e2..41d035b5628ad 100644 --- a/CommonTools/Utils/src/ExpressionSetter.h +++ b/CommonTools/Utils/interface/ExpressionSetter.h @@ -11,7 +11,7 @@ * */ #include "CommonTools/Utils/interface/ExpressionPtr.h" -#include "CommonTools/Utils/src/ExpressionStack.h" +#include "CommonTools/Utils/interface/ExpressionStack.h" namespace reco { namespace parser { diff --git a/CommonTools/Utils/src/ExpressionStack.h b/CommonTools/Utils/interface/ExpressionStack.h similarity index 100% rename from CommonTools/Utils/src/ExpressionStack.h rename to CommonTools/Utils/interface/ExpressionStack.h diff --git a/CommonTools/Utils/src/ExpressionUnaryOperator.h b/CommonTools/Utils/interface/ExpressionUnaryOperator.h similarity index 93% rename from CommonTools/Utils/src/ExpressionUnaryOperator.h rename to CommonTools/Utils/interface/ExpressionUnaryOperator.h index 8657673931dab..6126c03655141 100644 --- a/CommonTools/Utils/src/ExpressionUnaryOperator.h +++ b/CommonTools/Utils/interface/ExpressionUnaryOperator.h @@ -11,7 +11,7 @@ * */ #include "CommonTools/Utils/interface/ExpressionBase.h" -#include "CommonTools/Utils/src/ExpressionStack.h" +#include "CommonTools/Utils/interface/ExpressionStack.h" namespace reco { namespace parser { diff --git a/CommonTools/Utils/src/ExpressionUnaryOperatorSetter.h b/CommonTools/Utils/interface/ExpressionUnaryOperatorSetter.h similarity index 90% rename from CommonTools/Utils/src/ExpressionUnaryOperatorSetter.h rename to CommonTools/Utils/interface/ExpressionUnaryOperatorSetter.h index 8f0cfc1c61ca7..19463fa92ffde 100644 --- a/CommonTools/Utils/src/ExpressionUnaryOperatorSetter.h +++ b/CommonTools/Utils/interface/ExpressionUnaryOperatorSetter.h @@ -10,8 +10,8 @@ * \version $Revision: 1.2 $ * */ -#include "CommonTools/Utils/src/ExpressionUnaryOperator.h" -#include "CommonTools/Utils/src/ExpressionStack.h" +#include "CommonTools/Utils/interface/ExpressionUnaryOperator.h" +#include "CommonTools/Utils/interface/ExpressionStack.h" #ifdef BOOST_SPIRIT_DEBUG #include #include diff --git a/CommonTools/Utils/src/ExpressionVarSetter.h b/CommonTools/Utils/interface/ExpressionVarSetter.h similarity index 86% rename from CommonTools/Utils/src/ExpressionVarSetter.h rename to CommonTools/Utils/interface/ExpressionVarSetter.h index bbcaab3007a31..f101e195a1bd0 100644 --- a/CommonTools/Utils/src/ExpressionVarSetter.h +++ b/CommonTools/Utils/interface/ExpressionVarSetter.h @@ -10,9 +10,9 @@ * \version $Revision: 1.3 $ * */ -#include "CommonTools/Utils/src/ExpressionStack.h" -#include "CommonTools/Utils/src/MethodStack.h" -#include "CommonTools/Utils/src/TypeStack.h" +#include "CommonTools/Utils/interface/ExpressionStack.h" +#include "CommonTools/Utils/interface/MethodStack.h" +#include "CommonTools/Utils/interface/TypeStack.h" namespace reco { namespace parser { diff --git a/CommonTools/Utils/src/Function.h b/CommonTools/Utils/interface/Function.h similarity index 100% rename from CommonTools/Utils/src/Function.h rename to CommonTools/Utils/interface/Function.h diff --git a/CommonTools/Utils/src/FunctionSetter.h b/CommonTools/Utils/interface/FunctionSetter.h similarity index 90% rename from CommonTools/Utils/src/FunctionSetter.h rename to CommonTools/Utils/interface/FunctionSetter.h index d64aad5163c88..69995e32db702 100644 --- a/CommonTools/Utils/src/FunctionSetter.h +++ b/CommonTools/Utils/interface/FunctionSetter.h @@ -9,8 +9,8 @@ * \version $Revision: 1.2 $ * */ -#include "CommonTools/Utils/src/Function.h" -#include "CommonTools/Utils/src/FunctionStack.h" +#include "CommonTools/Utils/interface/Function.h" +#include "CommonTools/Utils/interface/FunctionStack.h" namespace reco { namespace parser { diff --git a/CommonTools/Utils/src/FunctionStack.h b/CommonTools/Utils/interface/FunctionStack.h similarity index 87% rename from CommonTools/Utils/src/FunctionStack.h rename to CommonTools/Utils/interface/FunctionStack.h index addad24d49ba9..0583e62d18cb8 100644 --- a/CommonTools/Utils/src/FunctionStack.h +++ b/CommonTools/Utils/interface/FunctionStack.h @@ -9,7 +9,7 @@ * \version $Revision: 1.1 $ * */ -#include "CommonTools/Utils/src/Function.h" +#include "CommonTools/Utils/interface/Function.h" #include namespace reco { diff --git a/CommonTools/Utils/interface/Grammar.h b/CommonTools/Utils/interface/Grammar.h index b4e729053a5d0..4fbcd546b0d51 100644 --- a/CommonTools/Utils/interface/Grammar.h +++ b/CommonTools/Utils/interface/Grammar.h @@ -14,31 +14,30 @@ #include "boost/spirit/include/classic_grammar_def.hpp" #include "boost/spirit/include/classic_chset.hpp" #include -#include "CommonTools/Utils/src/ExpressionNumberSetter.h" -#include "CommonTools/Utils/src/ExpressionVarSetter.h" -#include "CommonTools/Utils/src/ExpressionFunctionSetter.h" -#include "CommonTools/Utils/src/ExpressionConditionSetter.h" -#include "CommonTools/Utils/src/ComparisonSetter.h" -#include "CommonTools/Utils/src/BinarySelectorSetter.h" -#include "CommonTools/Utils/src/TrinarySelectorSetter.h" -#include "CommonTools/Utils/src/IntSetter.h" -#include "CommonTools/Utils/src/MethodStack.h" -#include "CommonTools/Utils/src/MethodArgumentStack.h" -#include "CommonTools/Utils/src/TypeStack.h" -#include "CommonTools/Utils/src/IntStack.h" -#include "CommonTools/Utils/src/FunctionSetter.h" -#include "CommonTools/Utils/src/CutSetter.h" -#include "CommonTools/Utils/src/BinaryCutSetter.h" -#include "CommonTools/Utils/src/UnaryCutSetter.h" -#include "CommonTools/Utils/src/ExpressionSetter.h" -#include "CommonTools/Utils/src/ExpressionBinaryOperatorSetter.h" -#include "CommonTools/Utils/src/ExpressionUnaryOperatorSetter.h" -#include "CommonTools/Utils/src/ExpressionSelectorSetter.h" -#include "CommonTools/Utils/src/MethodSetter.h" -#include "CommonTools/Utils/src/MethodArgumentSetter.h" +#include "CommonTools/Utils/interface/ExpressionNumberSetter.h" +#include "CommonTools/Utils/interface/ExpressionVarSetter.h" +#include "CommonTools/Utils/interface/ExpressionFunctionSetter.h" +#include "CommonTools/Utils/interface/ExpressionConditionSetter.h" +#include "CommonTools/Utils/interface/ComparisonSetter.h" +#include "CommonTools/Utils/interface/BinarySelectorSetter.h" +#include "CommonTools/Utils/interface/TrinarySelectorSetter.h" +#include "CommonTools/Utils/interface/IntSetter.h" +#include "CommonTools/Utils/interface/MethodStack.h" +#include "CommonTools/Utils/interface/MethodArgumentStack.h" +#include "CommonTools/Utils/interface/TypeStack.h" +#include "CommonTools/Utils/interface/IntStack.h" +#include "CommonTools/Utils/interface/FunctionSetter.h" +#include "CommonTools/Utils/interface/CutSetter.h" +#include "CommonTools/Utils/interface/BinaryCutSetter.h" +#include "CommonTools/Utils/interface/UnaryCutSetter.h" +#include "CommonTools/Utils/interface/ExpressionSetter.h" +#include "CommonTools/Utils/interface/ExpressionBinaryOperatorSetter.h" +#include "CommonTools/Utils/interface/ExpressionUnaryOperatorSetter.h" +#include "CommonTools/Utils/interface/ExpressionSelectorSetter.h" +#include "CommonTools/Utils/interface/MethodSetter.h" +#include "CommonTools/Utils/interface/MethodArgumentSetter.h" #include "CommonTools/Utils/interface/Exception.h" #include "FWCore/Reflection/interface/TypeWithDict.h" -// #include "CommonTools/Utils/src/Abort.h" namespace reco { namespace parser { diff --git a/CommonTools/Utils/src/IntSetter.h b/CommonTools/Utils/interface/IntSetter.h similarity index 90% rename from CommonTools/Utils/src/IntSetter.h rename to CommonTools/Utils/interface/IntSetter.h index ffe76828f6579..e0bd74c71a6ea 100644 --- a/CommonTools/Utils/src/IntSetter.h +++ b/CommonTools/Utils/interface/IntSetter.h @@ -9,7 +9,7 @@ * \version $Revision: 1.1 $ * */ -#include "CommonTools/Utils/src/IntStack.h" +#include "CommonTools/Utils/interface/IntStack.h" namespace reco { namespace parser { diff --git a/CommonTools/Utils/src/IntStack.h b/CommonTools/Utils/interface/IntStack.h similarity index 100% rename from CommonTools/Utils/src/IntStack.h rename to CommonTools/Utils/interface/IntStack.h diff --git a/CommonTools/Utils/src/LogicalBinaryOperator.h b/CommonTools/Utils/interface/LogicalBinaryOperator.h similarity index 95% rename from CommonTools/Utils/src/LogicalBinaryOperator.h rename to CommonTools/Utils/interface/LogicalBinaryOperator.h index 0f2cfadd3da49..8dc6112e25caa 100644 --- a/CommonTools/Utils/src/LogicalBinaryOperator.h +++ b/CommonTools/Utils/interface/LogicalBinaryOperator.h @@ -11,7 +11,7 @@ * */ #include "CommonTools/Utils/interface/SelectorBase.h" -#include "CommonTools/Utils/src/SelectorStack.h" +#include "CommonTools/Utils/interface/SelectorStack.h" namespace reco { namespace parser { diff --git a/CommonTools/Utils/src/LogicalUnaryOperator.h b/CommonTools/Utils/interface/LogicalUnaryOperator.h similarity index 93% rename from CommonTools/Utils/src/LogicalUnaryOperator.h rename to CommonTools/Utils/interface/LogicalUnaryOperator.h index d24d64ffe3469..5a60d9c057d58 100644 --- a/CommonTools/Utils/src/LogicalUnaryOperator.h +++ b/CommonTools/Utils/interface/LogicalUnaryOperator.h @@ -11,7 +11,7 @@ * */ #include "CommonTools/Utils/interface/SelectorBase.h" -#include "CommonTools/Utils/src/SelectorStack.h" +#include "CommonTools/Utils/interface/SelectorStack.h" namespace reco { namespace parser { diff --git a/CommonTools/Utils/src/MethodArgumentSetter.h b/CommonTools/Utils/interface/MethodArgumentSetter.h similarity index 94% rename from CommonTools/Utils/src/MethodArgumentSetter.h rename to CommonTools/Utils/interface/MethodArgumentSetter.h index e6dbc6ce011ca..4f8542e065eaf 100644 --- a/CommonTools/Utils/src/MethodArgumentSetter.h +++ b/CommonTools/Utils/interface/MethodArgumentSetter.h @@ -9,7 +9,7 @@ * \version $Revision: 1.1 $ * */ -#include "CommonTools/Utils/src/MethodArgumentStack.h" +#include "CommonTools/Utils/interface/MethodArgumentStack.h" #include namespace reco { diff --git a/CommonTools/Utils/src/MethodArgumentStack.h b/CommonTools/Utils/interface/MethodArgumentStack.h similarity index 88% rename from CommonTools/Utils/src/MethodArgumentStack.h rename to CommonTools/Utils/interface/MethodArgumentStack.h index f0427b0ca5220..21cec691679b9 100644 --- a/CommonTools/Utils/src/MethodArgumentStack.h +++ b/CommonTools/Utils/interface/MethodArgumentStack.h @@ -9,7 +9,7 @@ * */ -#include "CommonTools/Utils/src/MethodInvoker.h" +#include "CommonTools/Utils/interface/MethodInvoker.h" #include namespace reco { diff --git a/CommonTools/Utils/src/MethodInvoker.h b/CommonTools/Utils/interface/MethodInvoker.h similarity index 97% rename from CommonTools/Utils/src/MethodInvoker.h rename to CommonTools/Utils/interface/MethodInvoker.h index ff133b17a8ac9..dde8be30764ab 100644 --- a/CommonTools/Utils/src/MethodInvoker.h +++ b/CommonTools/Utils/interface/MethodInvoker.h @@ -1,8 +1,8 @@ #ifndef CommonTools_Utils_MethodInvoker_h #define CommonTools_Utils_MethodInvoker_h -#include "CommonTools/Utils/src/AnyMethodArgument.h" -#include "CommonTools/Utils/src/TypeCode.h" +#include "CommonTools/Utils/interface/AnyMethodArgument.h" +#include "CommonTools/Utils/interface/TypeCode.h" #include "FWCore/Reflection/interface/FunctionWithDict.h" #include "FWCore/Reflection/interface/MemberWithDict.h" #include "FWCore/Reflection/interface/ObjectWithDict.h" diff --git a/CommonTools/Utils/src/MethodSetter.h b/CommonTools/Utils/interface/MethodSetter.h similarity index 93% rename from CommonTools/Utils/src/MethodSetter.h rename to CommonTools/Utils/interface/MethodSetter.h index beab8a579c478..28120cab06119 100644 --- a/CommonTools/Utils/src/MethodSetter.h +++ b/CommonTools/Utils/interface/MethodSetter.h @@ -7,9 +7,9 @@ * */ -#include "CommonTools/Utils/src/MethodStack.h" -#include "CommonTools/Utils/src/TypeStack.h" -#include "CommonTools/Utils/src/MethodArgumentStack.h" +#include "CommonTools/Utils/interface/MethodStack.h" +#include "CommonTools/Utils/interface/TypeStack.h" +#include "CommonTools/Utils/interface/MethodArgumentStack.h" namespace reco { namespace parser { diff --git a/CommonTools/Utils/src/MethodStack.h b/CommonTools/Utils/interface/MethodStack.h similarity index 88% rename from CommonTools/Utils/src/MethodStack.h rename to CommonTools/Utils/interface/MethodStack.h index 4cec5795c426c..bcd11a0b31323 100644 --- a/CommonTools/Utils/src/MethodStack.h +++ b/CommonTools/Utils/interface/MethodStack.h @@ -9,7 +9,7 @@ * */ -#include "CommonTools/Utils/src/MethodInvoker.h" +#include "CommonTools/Utils/interface/MethodInvoker.h" #include namespace reco { diff --git a/CommonTools/Utils/src/SelectorStack.h b/CommonTools/Utils/interface/SelectorStack.h similarity index 100% rename from CommonTools/Utils/src/SelectorStack.h rename to CommonTools/Utils/interface/SelectorStack.h diff --git a/CommonTools/Utils/src/TrinarySelector.h b/CommonTools/Utils/interface/TrinarySelector.h similarity index 95% rename from CommonTools/Utils/src/TrinarySelector.h rename to CommonTools/Utils/interface/TrinarySelector.h index 56af002d5783b..c3f1696cc3c1d 100644 --- a/CommonTools/Utils/src/TrinarySelector.h +++ b/CommonTools/Utils/interface/TrinarySelector.h @@ -12,7 +12,7 @@ */ #include "CommonTools/Utils/interface/SelectorBase.h" #include "CommonTools/Utils/interface/ExpressionBase.h" -#include "CommonTools/Utils/src/ComparisonBase.h" +#include "CommonTools/Utils/interface/ComparisonBase.h" namespace reco { namespace parser { diff --git a/CommonTools/Utils/src/TrinarySelectorSetter.h b/CommonTools/Utils/interface/TrinarySelectorSetter.h similarity index 86% rename from CommonTools/Utils/src/TrinarySelectorSetter.h rename to CommonTools/Utils/interface/TrinarySelectorSetter.h index 8ce5277ada70e..1019e90a51e4c 100644 --- a/CommonTools/Utils/src/TrinarySelectorSetter.h +++ b/CommonTools/Utils/interface/TrinarySelectorSetter.h @@ -10,10 +10,10 @@ * \version $Revision: 1.2 $ * */ -#include "CommonTools/Utils/src/SelectorStack.h" -#include "CommonTools/Utils/src/ComparisonStack.h" -#include "CommonTools/Utils/src/ExpressionStack.h" -#include "CommonTools/Utils/src/TrinarySelector.h" +#include "CommonTools/Utils/interface/SelectorStack.h" +#include "CommonTools/Utils/interface/ComparisonStack.h" +#include "CommonTools/Utils/interface/ExpressionStack.h" +#include "CommonTools/Utils/interface/TrinarySelector.h" namespace reco { namespace parser { diff --git a/CommonTools/Utils/src/TypeCode.h b/CommonTools/Utils/interface/TypeCode.h similarity index 100% rename from CommonTools/Utils/src/TypeCode.h rename to CommonTools/Utils/interface/TypeCode.h diff --git a/CommonTools/Utils/src/TypeStack.h b/CommonTools/Utils/interface/TypeStack.h similarity index 100% rename from CommonTools/Utils/src/TypeStack.h rename to CommonTools/Utils/interface/TypeStack.h diff --git a/CommonTools/Utils/src/UnaryCutSetter.h b/CommonTools/Utils/interface/UnaryCutSetter.h similarity index 86% rename from CommonTools/Utils/src/UnaryCutSetter.h rename to CommonTools/Utils/interface/UnaryCutSetter.h index 7c94daeffc8cb..9c4d8c88918b8 100644 --- a/CommonTools/Utils/src/UnaryCutSetter.h +++ b/CommonTools/Utils/interface/UnaryCutSetter.h @@ -10,8 +10,8 @@ * \version $Revision: 1.2 $ * */ -#include "CommonTools/Utils/src/SelectorStack.h" -#include "CommonTools/Utils/src/LogicalUnaryOperator.h" +#include "CommonTools/Utils/interface/SelectorStack.h" +#include "CommonTools/Utils/interface/LogicalUnaryOperator.h" namespace reco { namespace parser { diff --git a/CommonTools/Utils/interface/returnType.h b/CommonTools/Utils/interface/returnType.h index 23dd7d7370735..0b506fcf4a645 100644 --- a/CommonTools/Utils/interface/returnType.h +++ b/CommonTools/Utils/interface/returnType.h @@ -7,7 +7,7 @@ * */ -#include "CommonTools/Utils/src/TypeCode.h" +#include "CommonTools/Utils/interface/TypeCode.h" #include "FWCore/Reflection/interface/TypeWithDict.h" namespace edm { diff --git a/CommonTools/Utils/src/ComparisonSetter.cc b/CommonTools/Utils/src/ComparisonSetter.cc index c04bd0f4d0149..c4ddb5c96b8bc 100644 --- a/CommonTools/Utils/src/ComparisonSetter.cc +++ b/CommonTools/Utils/src/ComparisonSetter.cc @@ -1,4 +1,4 @@ -#include "CommonTools/Utils/src/ComparisonSetter.h" +#include "CommonTools/Utils/interface/ComparisonSetter.h" #ifdef BOOST_SPIRIT_DEBUG namespace reco { diff --git a/CommonTools/Utils/src/ExpressionCondition.h b/CommonTools/Utils/src/ExpressionCondition.h index 5a59facbd527b..06d8b0d48ac9b 100644 --- a/CommonTools/Utils/src/ExpressionCondition.h +++ b/CommonTools/Utils/src/ExpressionCondition.h @@ -12,8 +12,8 @@ */ #include "CommonTools/Utils/interface/ExpressionBase.h" #include "CommonTools/Utils/interface/SelectorBase.h" -#include "CommonTools/Utils/src/SelectorStack.h" -#include "CommonTools/Utils/src/ExpressionStack.h" +#include "CommonTools/Utils/interface/SelectorStack.h" +#include "CommonTools/Utils/interface/ExpressionStack.h" namespace reco { namespace parser { diff --git a/CommonTools/Utils/src/ExpressionConditionSetter.cc b/CommonTools/Utils/src/ExpressionConditionSetter.cc index 2dd869078913f..de3e1f1ee8769 100644 --- a/CommonTools/Utils/src/ExpressionConditionSetter.cc +++ b/CommonTools/Utils/src/ExpressionConditionSetter.cc @@ -1,4 +1,4 @@ -#include "CommonTools/Utils/src/ExpressionConditionSetter.h" +#include "CommonTools/Utils/interface/ExpressionConditionSetter.h" #include "CommonTools/Utils/src/ExpressionCondition.h" using namespace reco::parser; diff --git a/CommonTools/Utils/src/ExpressionFunctionSetter.cc b/CommonTools/Utils/src/ExpressionFunctionSetter.cc index bbddeb2206e68..7d118c3a6ef6a 100644 --- a/CommonTools/Utils/src/ExpressionFunctionSetter.cc +++ b/CommonTools/Utils/src/ExpressionFunctionSetter.cc @@ -1,6 +1,6 @@ -#include "CommonTools/Utils/src/ExpressionFunctionSetter.h" -#include "CommonTools/Utils/src/ExpressionUnaryOperator.h" -#include "CommonTools/Utils/src/ExpressionBinaryOperator.h" +#include "CommonTools/Utils/interface/ExpressionFunctionSetter.h" +#include "CommonTools/Utils/interface/ExpressionUnaryOperator.h" +#include "CommonTools/Utils/interface/ExpressionBinaryOperator.h" #include "CommonTools/Utils/src/ExpressionQuaterOperator.h" #include #include diff --git a/CommonTools/Utils/src/ExpressionQuaterOperator.h b/CommonTools/Utils/src/ExpressionQuaterOperator.h index e3c856f184340..d79bc4ec5d275 100644 --- a/CommonTools/Utils/src/ExpressionQuaterOperator.h +++ b/CommonTools/Utils/src/ExpressionQuaterOperator.h @@ -11,7 +11,7 @@ * */ #include "CommonTools/Utils/interface/ExpressionBase.h" -#include "CommonTools/Utils/src/ExpressionStack.h" +#include "CommonTools/Utils/interface/ExpressionStack.h" namespace reco { namespace parser { diff --git a/CommonTools/Utils/src/ExpressionSetter.cc b/CommonTools/Utils/src/ExpressionSetter.cc index 6738c0851eb7c..775983bea771e 100644 --- a/CommonTools/Utils/src/ExpressionSetter.cc +++ b/CommonTools/Utils/src/ExpressionSetter.cc @@ -1,4 +1,4 @@ -#include "CommonTools/Utils/src/ExpressionSetter.h" +#include "CommonTools/Utils/interface/ExpressionSetter.h" #include "CommonTools/Utils/src/AndCombiner.h" #include "CommonTools/Utils/src/OrCombiner.h" #include "CommonTools/Utils/src/NotCombiner.h" diff --git a/CommonTools/Utils/src/ExpressionUnaryOperatorSetter.cc b/CommonTools/Utils/src/ExpressionUnaryOperatorSetter.cc index d73c97318d7a8..3bc728b198ad9 100644 --- a/CommonTools/Utils/src/ExpressionUnaryOperatorSetter.cc +++ b/CommonTools/Utils/src/ExpressionUnaryOperatorSetter.cc @@ -1,4 +1,4 @@ -#include "CommonTools/Utils/src/ExpressionUnaryOperatorSetter.h" +#include "CommonTools/Utils/interface/ExpressionUnaryOperatorSetter.h" using namespace reco::parser; diff --git a/CommonTools/Utils/src/ExpressionVar.cc b/CommonTools/Utils/src/ExpressionVar.cc index dd374c5eaef17..8d47b7629a597 100644 --- a/CommonTools/Utils/src/ExpressionVar.cc +++ b/CommonTools/Utils/src/ExpressionVar.cc @@ -1,5 +1,5 @@ #include "CommonTools/Utils/src/ExpressionVar.h" -#include "CommonTools/Utils/src/MethodInvoker.h" +#include "CommonTools/Utils/interface/MethodInvoker.h" #include "FWCore/Reflection/interface/ObjectWithDict.h" #include "FWCore/Reflection/interface/FunctionWithDict.h" diff --git a/CommonTools/Utils/src/ExpressionVar.h b/CommonTools/Utils/src/ExpressionVar.h index f79f897b70a21..41e17e2b84614 100644 --- a/CommonTools/Utils/src/ExpressionVar.h +++ b/CommonTools/Utils/src/ExpressionVar.h @@ -11,8 +11,8 @@ */ #include "CommonTools/Utils/interface/ExpressionBase.h" -#include "CommonTools/Utils/src/MethodInvoker.h" -#include "CommonTools/Utils/src/TypeCode.h" +#include "CommonTools/Utils/interface/MethodInvoker.h" +#include "CommonTools/Utils/interface/TypeCode.h" #include diff --git a/CommonTools/Utils/src/ExpressionVarSetter.cc b/CommonTools/Utils/src/ExpressionVarSetter.cc index 4942868b400d7..1ad0cdd0d9fc4 100644 --- a/CommonTools/Utils/src/ExpressionVarSetter.cc +++ b/CommonTools/Utils/src/ExpressionVarSetter.cc @@ -1,4 +1,4 @@ -#include "CommonTools/Utils/src/ExpressionVarSetter.h" +#include "CommonTools/Utils/interface/ExpressionVarSetter.h" #include "CommonTools/Utils/src/ExpressionVar.h" #include "CommonTools/Utils/interface/returnType.h" #include "CommonTools/Utils/interface/Exception.h" diff --git a/CommonTools/Utils/src/LogicalBinaryOperator.cc b/CommonTools/Utils/src/LogicalBinaryOperator.cc index e0c150e2da86c..537bea87c35f6 100644 --- a/CommonTools/Utils/src/LogicalBinaryOperator.cc +++ b/CommonTools/Utils/src/LogicalBinaryOperator.cc @@ -1,4 +1,4 @@ -#include "CommonTools/Utils/src/LogicalBinaryOperator.h" +#include "CommonTools/Utils/interface/LogicalBinaryOperator.h" using namespace reco::parser; template <> diff --git a/CommonTools/Utils/src/MethodInvoker.cc b/CommonTools/Utils/src/MethodInvoker.cc index 787a94ce81362..2370c22428970 100644 --- a/CommonTools/Utils/src/MethodInvoker.cc +++ b/CommonTools/Utils/src/MethodInvoker.cc @@ -1,7 +1,7 @@ -#include "CommonTools/Utils/src/MethodInvoker.h" +#include "CommonTools/Utils/interface/MethodInvoker.h" #include "CommonTools/Utils/src/ExpressionVar.h" -#include "CommonTools/Utils/src/MethodSetter.h" +#include "CommonTools/Utils/interface/MethodSetter.h" #include "CommonTools/Utils/src/findMethod.h" #include "CommonTools/Utils/interface/returnType.h" #include "FWCore/Utilities/interface/EDMException.h" diff --git a/CommonTools/Utils/src/MethodSetter.cc b/CommonTools/Utils/src/MethodSetter.cc index 36457fbda939d..9fadeaf248579 100644 --- a/CommonTools/Utils/src/MethodSetter.cc +++ b/CommonTools/Utils/src/MethodSetter.cc @@ -1,8 +1,8 @@ -#include "CommonTools/Utils/src/MethodSetter.h" +#include "CommonTools/Utils/interface/MethodSetter.h" #include "CommonTools/Utils/interface/Exception.h" #include "CommonTools/Utils/src/ErrorCodes.h" -#include "CommonTools/Utils/src/MethodInvoker.h" +#include "CommonTools/Utils/interface/MethodInvoker.h" #include "CommonTools/Utils/src/findDataMember.h" #include "CommonTools/Utils/src/findMethod.h" #include "CommonTools/Utils/interface/returnType.h" diff --git a/CommonTools/Utils/src/findMethod.h b/CommonTools/Utils/src/findMethod.h index 4d18410aeefee..367d539f3fb2a 100644 --- a/CommonTools/Utils/src/findMethod.h +++ b/CommonTools/Utils/src/findMethod.h @@ -3,7 +3,7 @@ #include "FWCore/Reflection/interface/FunctionWithDict.h" #include "FWCore/Reflection/interface/TypeWithDict.h" #include -#include "CommonTools/Utils/src/AnyMethodArgument.h" +#include "CommonTools/Utils/interface/AnyMethodArgument.h" namespace reco { // second pair member is true if a reference is found diff --git a/CondCore/CTPPSPlugins/src/plugin.cc b/CondCore/CTPPSPlugins/src/plugin.cc index 28eab28ee1ade..7f9f109e123f1 100644 --- a/CondCore/CTPPSPlugins/src/plugin.cc +++ b/CondCore/CTPPSPlugins/src/plugin.cc @@ -19,6 +19,8 @@ #include "CondFormats/DataRecord/interface/PPSDirectSimulationDataRcd.h" #include "CondFormats/PPSObjects/interface/PPSPixelTopology.h" #include "CondFormats/DataRecord/interface/PPSPixelTopologyRcd.h" +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfig.h" +#include "CondFormats/DataRecord/interface/PPSAlignmentConfigRcd.h" REGISTER_PLUGIN(CTPPSBeamParametersRcd, CTPPSBeamParameters); REGISTER_PLUGIN(CTPPSPixelDAQMappingRcd, CTPPSPixelDAQMapping); @@ -31,3 +33,4 @@ REGISTER_PLUGIN(PPSTimingCalibrationRcd, PPSTimingCalibration); REGISTER_PLUGIN(CTPPSOpticsRcd, LHCOpticalFunctionsSetCollection); REGISTER_PLUGIN(PPSDirectSimulationDataRcd, PPSDirectSimulationData); REGISTER_PLUGIN(PPSPixelTopologyRcd, PPSPixelTopology); +REGISTER_PLUGIN(PPSAlignmentConfigRcd, PPSAlignmentConfig); diff --git a/CondCore/CondDB/interface/Utils.h b/CondCore/CondDB/interface/Utils.h index aa40dd3622944..321f80940ce83 100644 --- a/CondCore/CondDB/interface/Utils.h +++ b/CondCore/CondDB/interface/Utils.h @@ -12,8 +12,7 @@ #include #include #include -// -#include +#include namespace cond { @@ -123,10 +122,10 @@ namespace cond { if (input.find("sqlite") == 0 || input.find("oracle") == 0) return input; - //static const boost::regex trivial("oracle://(cms_orcon_adg|cms_orcoff_prep)/([_[:alnum:]]+?)"); - static const boost::regex short_frontier("frontier://([[:alnum:]]+?)/([_[:alnum:]]+?)"); - static const boost::regex long_frontier("frontier://((\\([-[:alnum:]]+?=[^\\)]+?\\))+)/([_[:alnum:]]+?)"); - static const boost::regex long_frontier_serverurl("\\(serverurl=[^\\)]+?/([[:alnum:]]+?)\\)"); + //static const std::regex trivial("oracle://(cms_orcon_adg|cms_orcoff_prep)/([_[:alnum:]]+?)"); + static const std::regex short_frontier("frontier://([[:alnum:]]+?)/([_[:alnum:]]+?)"); + static const std::regex long_frontier("frontier://((\\([-[:alnum:]]+?=[^\\)]+?\\))+)/([_[:alnum:]]+?)"); + static const std::regex long_frontier_serverurl("\\(serverurl=[^\\)]+?/([[:alnum:]]+?)\\)"); static const std::map frontierMap = { {"PromptProd", "cms_orcon_adg"}, @@ -136,23 +135,21 @@ namespace cond { {"FrontierPrep", "cms_orcoff_prep"}, }; - boost::smatch matches; + std::smatch matches; static const std::string technology("oracle://"); std::string service(""); std::string account(""); bool match = false; - if (boost::regex_match(input, matches, short_frontier)) { + if (std::regex_match(input, matches, short_frontier)) { service = matches[1]; account = matches[2]; match = true; - } - - if (boost::regex_match(input, matches, long_frontier)) { + } else if (std::regex_match(input, matches, long_frontier)) { std::string frontier_config(matches[1]); - boost::smatch matches2; - if (not boost::regex_search(frontier_config, matches2, long_frontier_serverurl)) + std::smatch matches2; + if (not std::regex_search(frontier_config, matches2, long_frontier_serverurl)) throwException("No serverurl in matched long frontier", "convertoToOracleConnection"); service = matches2[1]; account = matches[3]; diff --git a/CondCore/EcalPlugins/plugins/EcalFloatCondObjectContainer_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalFloatCondObjectContainer_PayloadInspector.cc index 812443274bdf4..6e7ff3549f0b3 100644 --- a/CondCore/EcalPlugins/plugins/EcalFloatCondObjectContainer_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalFloatCondObjectContainer_PayloadInspector.cc @@ -109,7 +109,7 @@ namespace { float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; - TPad** pad = new TPad*; + TPad** pad = new TPad*[3]; for (int obj = 0; obj < 3; obj++) { pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); pad[obj]->Draw(); @@ -262,7 +262,7 @@ namespace { } float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; - TPad** pad = new TPad*; + TPad** pad = new TPad*[3]; for (int obj = 0; obj < 3; obj++) { pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); pad[obj]->Draw(); diff --git a/CondCore/EcalPlugins/plugins/EcalIntercalibConstantsMC_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalIntercalibConstantsMC_PayloadInspector.cc index 9705da5a95933..45947d0e84666 100644 --- a/CondCore/EcalPlugins/plugins/EcalIntercalibConstantsMC_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalIntercalibConstantsMC_PayloadInspector.cc @@ -16,6 +16,7 @@ #include #include +#include namespace { enum { kEBChannels = 61200, kEEChannels = 14648 }; @@ -194,9 +195,9 @@ namespace { float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; - TPad** pad = new TPad*; + std::array, 3> pad; for (int obj = 0; obj < 3; obj++) { - pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); + pad[obj] = std::make_unique(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); pad[obj]->Draw(); } // EcalDrawMaps ICMap; @@ -305,10 +306,10 @@ namespace { float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; - TPad** pad = new TPad*; + std::array, 3> pad; for (int obj = 0; obj < 3; obj++) { - pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); + pad[obj] = std::make_unique(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); pad[obj]->Draw(); } @@ -376,9 +377,9 @@ namespace { t1.SetTextColor(2); t1.DrawLatex(0.5, 0.96, Form("Ecal Intercalib Constants MC Summary, IOV %i", run)); - TPad* pad = new TPad("pad", "pad", 0.0, 0.0, 1.0, 0.94); - pad->Draw(); - pad->cd(); + TPad pad("pad", "pad", 0.0, 0.0, 1.0, 0.94); + pad.Draw(); + pad.cd(); align->Draw("TEXT"); drawTable(NbRows, 4); diff --git a/CondCore/EcalPlugins/plugins/EcalIntercalibConstants_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalIntercalibConstants_PayloadInspector.cc index 8f7603f320efa..21d76a5d39cb1 100644 --- a/CondCore/EcalPlugins/plugins/EcalIntercalibConstants_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalIntercalibConstants_PayloadInspector.cc @@ -16,6 +16,7 @@ #include #include +#include namespace { enum { kEBChannels = 61200, kEEChannels = 14648 }; @@ -180,9 +181,9 @@ namespace { float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; - TPad** pad = new TPad*; + std::array, 3> pad; for (int obj = 0; obj < 3; obj++) { - pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); + pad[obj] = std::make_unique(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); pad[obj]->Draw(); } // EcalDrawMaps ICMap; @@ -286,9 +287,9 @@ namespace { } float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; - TPad** pad = new TPad*; + std::array, 3> pad; for (int obj = 0; obj < 3; obj++) { - pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); + pad[obj] = std::make_unique(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); pad[obj]->Draw(); } pad[0]->cd(); @@ -354,9 +355,9 @@ namespace { t1.SetTextColor(2); t1.DrawLatex(0.5, 0.96, Form("Ecal Intercalib Constants Summary, IOV %i", run)); - TPad* pad = new TPad("pad", "pad", 0.0, 0.0, 1.0, 0.94); - pad->Draw(); - pad->cd(); + TPad pad("pad", "pad", 0.0, 0.0, 1.0, 0.94); + pad.Draw(); + pad.cd(); align->Draw("TEXT"); TLine* l = new TLine; l->SetLineWidth(1); diff --git a/CondCore/EcalPlugins/plugins/EcalIntercalibErrors_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalIntercalibErrors_PayloadInspector.cc index 612a6e86fb1d5..eebc9dbfa79a0 100644 --- a/CondCore/EcalPlugins/plugins/EcalIntercalibErrors_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalIntercalibErrors_PayloadInspector.cc @@ -16,6 +16,7 @@ #include #include +#include namespace { @@ -190,9 +191,9 @@ namespace { float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; - TPad** pad = new TPad*; + std::array, 3> pad; for (int obj = 0; obj < 3; obj++) { - pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); + pad[obj] = std::make_unique(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); pad[obj]->Draw(); } // EcalDrawMaps ICMap; @@ -295,10 +296,10 @@ namespace { float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; - TPad** pad = new TPad*; + std::array, 3> pad; for (int obj = 0; obj < 3; obj++) { - pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); + pad[obj] = std::make_unique(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); pad[obj]->Draw(); } @@ -365,9 +366,9 @@ namespace { t1.SetTextColor(2); t1.DrawLatex(0.5, 0.96, Form("Ecal Intercalib Errors Summary, IOV %i", run)); - TPad* pad = new TPad("pad", "pad", 0.0, 0.0, 1.0, 0.94); - pad->Draw(); - pad->cd(); + TPad pad("pad", "pad", 0.0, 0.0, 1.0, 0.94); + pad.Draw(); + pad.cd(); align->Draw("TEXT"); drawTable(NbRows, 4); diff --git a/CondCore/EcalPlugins/plugins/EcalLaserAPDPNRatiosRef_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalLaserAPDPNRatiosRef_PayloadInspector.cc index 9ae8a5cb993d3..82768a7ff135e 100644 --- a/CondCore/EcalPlugins/plugins/EcalLaserAPDPNRatiosRef_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalLaserAPDPNRatiosRef_PayloadInspector.cc @@ -16,6 +16,7 @@ #include #include +#include namespace { enum { kEBChannels = 61200, kEEChannels = 14648 }; @@ -190,9 +191,9 @@ namespace { float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; - TPad** pad = new TPad*; + std::array, 3> pad; for (int obj = 0; obj < 3; obj++) { - pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); + pad[obj] = std::make_unique(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); pad[obj]->Draw(); } // EcalDrawMaps ICMap; @@ -279,10 +280,10 @@ namespace { float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; - TPad** pad = new TPad*; + std::array, 3> pad; for (int obj = 0; obj < 3; obj++) { - pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); + pad[obj] = std::make_unique(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); pad[obj]->Draw(); } @@ -350,9 +351,9 @@ namespace { t1.SetTextColor(2); t1.DrawLatex(0.5, 0.96, Form("Ecal Laser APDPN Ratios Ref Summary, IOV %i", run)); - TPad* pad = new TPad("pad", "pad", 0.0, 0.0, 1.0, 0.94); - pad->Draw(); - pad->cd(); + TPad pad("pad", "pad", 0.0, 0.0, 1.0, 0.94); + pad.Draw(); + pad.cd(); align->Draw("TEXT"); drawTable(NbRows, 4); diff --git a/CondCore/EcalPlugins/plugins/EcalLaserAlphas_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalLaserAlphas_PayloadInspector.cc index a7589dd70fbfa..bcc09ddb1c912 100644 --- a/CondCore/EcalPlugins/plugins/EcalLaserAlphas_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalLaserAlphas_PayloadInspector.cc @@ -16,6 +16,7 @@ #include #include +#include namespace { enum { kEBChannels = 61200, kEEChannels = 14648 }; @@ -185,9 +186,9 @@ namespace { float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; - TPad** pad = new TPad*; + std::array, 3> pad; for (int obj = 0; obj < 3; obj++) { - pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); + pad[obj] = std::make_unique(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); pad[obj]->Draw(); } // EcalDrawMaps ICMap; @@ -293,10 +294,10 @@ namespace { } float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; - TPad** pad = new TPad*; + std::array, 3> pad; for (int obj = 0; obj < 3; obj++) { - pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); + pad[obj] = std::make_unique(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); pad[obj]->Draw(); } @@ -363,9 +364,9 @@ namespace { t1.SetTextColor(2); t1.DrawLatex(0.5, 0.96, Form("Ecal Laser Alphas Summary, IOV %i", run)); - TPad* pad = new TPad("pad", "pad", 0.0, 0.0, 1.0, 0.94); - pad->Draw(); - pad->cd(); + TPad pad("pad", "pad", 0.0, 0.0, 1.0, 0.94); + pad.Draw(); + pad.cd(); align->Draw("TEXT"); drawTable(NbRows, 4); diff --git a/CondCore/EcalPlugins/plugins/EcalPFRecHitThresholds_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalPFRecHitThresholds_PayloadInspector.cc index db9cbc4a9881b..73296272e4138 100644 --- a/CondCore/EcalPlugins/plugins/EcalPFRecHitThresholds_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalPFRecHitThresholds_PayloadInspector.cc @@ -15,6 +15,7 @@ #include "TLatex.h" #include +#include #include namespace { @@ -192,9 +193,9 @@ namespace { float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; - TPad** pad = new TPad*; + std::array, 3> pad; for (int obj = 0; obj < 3; obj++) { - pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); + pad[obj] = std::make_unique(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); pad[obj]->Draw(); } // EcalDrawMaps ICMap; @@ -298,10 +299,10 @@ namespace { float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; - TPad** pad = new TPad*; + std::array, 3> pad; for (int obj = 0; obj < 3; obj++) { - pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); + pad[obj] = std::make_unique(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); pad[obj]->Draw(); } @@ -368,9 +369,9 @@ namespace { t1.SetTextColor(2); t1.DrawLatex(0.5, 0.96, Form("Ecal PFRec Hit Thresholds Summary, IOV %i", run)); - TPad* pad = new TPad("pad", "pad", 0.0, 0.0, 1.0, 0.94); - pad->Draw(); - pad->cd(); + TPad pad("pad", "pad", 0.0, 0.0, 1.0, 0.94); + pad.Draw(); + pad.cd(); align->Draw("TEXT"); drawTable(NbRows, 4); diff --git a/CondCore/EcalPlugins/plugins/EcalTPGCrystalStatus_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalTPGCrystalStatus_PayloadInspector.cc index 73a04734c8c01..071b35d6dab00 100644 --- a/CondCore/EcalPlugins/plugins/EcalTPGCrystalStatus_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalTPGCrystalStatus_PayloadInspector.cc @@ -14,6 +14,8 @@ #include "TLatex.h" #include +#include +#include namespace { enum { kEBChannels = 61200, kEEChannels = 14648, kSides = 2 }; @@ -30,7 +32,7 @@ namespace { setSingleIov(true); } - bool fill(const std::vector >& iovs) override { + bool fill(const std::vector>& iovs) override { TH2F* barrel = new TH2F("EB", "EB TPG Crystal Status", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA); TH2F* endc_p = new TH2F("EE+", "EE+ TPG Crystal Status", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1); TH2F* endc_m = new TH2F("EE-", "EE- TPG Crystal Status", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1); @@ -100,9 +102,9 @@ namespace { float xma[3] = {1.0, 0.5, 1.0}; float ymi[3] = {0.47, 0.0, 0.0}; float yma[3] = {0.94, 0.47, 0.47}; - TPad** pad = new TPad*; + std::array, 3> pad; for (int obj = 0; obj < 3; obj++) { - pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], ymi[obj], xma[obj], yma[obj]); + pad[obj] = std::make_unique(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], ymi[obj], xma[obj], yma[obj]); pad[obj]->Draw(); } @@ -248,9 +250,9 @@ namespace { float xma[3] = {1.0, 0.5, 1.0}; float ymi[3] = {0.47, 0.0, 0.0}; float yma[3] = {0.94, 0.47, 0.47}; - std::vector pad; + std::vector> pad; for (int obj = 0; obj < 3; obj++) { - pad.push_back(new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], ymi[obj], xma[obj], yma[obj])); + pad.emplace_back(new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], ymi[obj], xma[obj], yma[obj])); pad[obj]->Draw(); } @@ -282,7 +284,7 @@ namespace { setSingleIov(true); } - bool fill(const std::vector >& iovs) override { + bool fill(const std::vector>& iovs) override { auto iov = iovs.front(); //get reference to 1st element in the vector iovs std::shared_ptr payload = fetchPayload(std::get<1>(iov)); //std::get<1>(iov) refers to the Hash in the tuple iov @@ -349,9 +351,9 @@ namespace { t1.SetTextColor(2); t1.DrawLatex(0.5, 0.96, Form("EcalTPGCrystalStatus Error Summary, IOV %i", run)); - TPad* pad = new TPad("pad", "pad", 0.0, 0.0, 1.0, 0.94); - pad->Draw(); - pad->cd(); + TPad pad("pad", "pad", 0.0, 0.0, 1.0, 0.94); + pad.Draw(); + pad.cd(); align->Draw("TEXT"); drawTable(NbRows, NbColumns); diff --git a/CondCore/EcalPlugins/plugins/EcalTPGFineGrainStripEE_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalTPGFineGrainStripEE_PayloadInspector.cc index 46b0938cf6aa9..6d2d55aa1c398 100644 --- a/CondCore/EcalPlugins/plugins/EcalTPGFineGrainStripEE_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalTPGFineGrainStripEE_PayloadInspector.cc @@ -15,6 +15,8 @@ #include "TLatex.h" #include +#include +#include namespace { enum { NTCC = 108, NTower = 28, NStrip = 5, NXtal = 5 }; @@ -164,9 +166,9 @@ namespace { float ymi[4] = {0.47, 0.47, 0.0, 0.0}; float yma[4] = {0.94, 0.94, 0.47, 0.47}; - TPad** pad = new TPad*; + std::array, 4> pad; for (int obj = 0; obj < 4; obj++) { - pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], ymi[obj], xma[obj], yma[obj]); + pad[obj] = std::make_unique(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], ymi[obj], xma[obj], yma[obj]); pad[obj]->Draw(); } @@ -192,7 +194,6 @@ namespace { canvas.SaveAs(ImageName.c_str()); - delete pad; delete endc_lut_p; delete endc_lut_m; delete endc_thresh_p; @@ -204,4 +205,4 @@ namespace { } // namespace // Register the classes as boost python plugin -PAYLOAD_INSPECTOR_MODULE(EcalTPGFineGrainStripEE) { PAYLOAD_INSPECTOR_CLASS(EcalTPGFineGrainStripEEPlot); } \ No newline at end of file +PAYLOAD_INSPECTOR_MODULE(EcalTPGFineGrainStripEE) { PAYLOAD_INSPECTOR_CLASS(EcalTPGFineGrainStripEEPlot); } diff --git a/CondCore/EcalPlugins/plugins/EcalTPGStripStatus_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalTPGStripStatus_PayloadInspector.cc index ca67b4b597e55..dea0df97092c2 100644 --- a/CondCore/EcalPlugins/plugins/EcalTPGStripStatus_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalTPGStripStatus_PayloadInspector.cc @@ -15,6 +15,8 @@ #include "TLatex.h" #include +#include +#include namespace { enum { NTCC = 108, NTower = 28, NStrip = 5, NXtal = 5 }; @@ -138,9 +140,9 @@ namespace { float xmi[2] = {0.0, 0.5}; float xma[2] = {0.5, 1.0}; - TPad** pad = new TPad*; + std::array, 2> pad; for (int obj = 0; obj < 2; obj++) { - pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); + pad[obj] = std::make_unique(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); pad[obj]->Draw(); } @@ -365,9 +367,9 @@ namespace { float xmi[2] = {0.0, 0.5}; float xma[2] = {0.5, 1.0}; - TPad** pad = new TPad*; + std::array, 2> pad; for (int obj = 0; obj < 2; obj++) { - pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); + pad[obj] = std::make_unique(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); pad[obj]->Draw(); } @@ -442,9 +444,9 @@ namespace { t1.SetTextColor(2); t1.DrawLatex(0.5, 0.96, Form("Endcap:Number of masked Trigger Strips, IOV %i", run)); - TPad* pad = new TPad("pad", "pad", 0.0, 0.0, 1.0, 0.94); - pad->Draw(); - pad->cd(); + TPad pad("pad", "pad", 0.0, 0.0, 1.0, 0.94); + pad.Draw(); + pad.cd(); align->Draw("TEXT"); drawTable(NbRows, NbColumns); diff --git a/CondCore/EcalPlugins/plugins/EcalTimeCalibConstants_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalTimeCalibConstants_PayloadInspector.cc index 4674dcb2dd5a6..9fcf9e2b30809 100644 --- a/CondCore/EcalPlugins/plugins/EcalTimeCalibConstants_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalTimeCalibConstants_PayloadInspector.cc @@ -16,6 +16,7 @@ #include #include +#include namespace { @@ -191,9 +192,9 @@ namespace { float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; - TPad** pad = new TPad*; + std::array, 3> pad; for (int obj = 0; obj < 3; obj++) { - pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); + pad[obj] = std::make_unique(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); pad[obj]->Draw(); } // EcalDrawMaps ICMap; @@ -297,10 +298,10 @@ namespace { float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; - TPad** pad = new TPad*; + std::array, 3> pad; for (int obj = 0; obj < 3; obj++) { - pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); + pad[obj] = std::make_unique(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); pad[obj]->Draw(); } @@ -367,9 +368,9 @@ namespace { t1.SetTextColor(2); t1.DrawLatex(0.5, 0.96, Form("Ecal Time Calib Constants Summary, IOV %i", run)); - TPad* pad = new TPad("pad", "pad", 0.0, 0.0, 1.0, 0.94); - pad->Draw(); - pad->cd(); + TPad pad("pad", "pad", 0.0, 0.0, 1.0, 0.94); + pad.Draw(); + pad.cd(); align->Draw("TEXT"); drawTable(NbRows, 4); diff --git a/CondCore/EcalPlugins/plugins/EcalTimeCalibErrors_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalTimeCalibErrors_PayloadInspector.cc index 6b227b7997577..8fb771b0e734b 100644 --- a/CondCore/EcalPlugins/plugins/EcalTimeCalibErrors_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalTimeCalibErrors_PayloadInspector.cc @@ -16,6 +16,7 @@ #include #include +#include namespace { @@ -193,9 +194,9 @@ namespace { float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; - TPad** pad = new TPad*; + std::array, 3> pad; for (int obj = 0; obj < 3; obj++) { - pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); + pad[obj] = std::make_unique(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); pad[obj]->Draw(); } // EcalDrawMaps ICMap; @@ -301,10 +302,10 @@ namespace { } float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; - TPad** pad = new TPad*; + std::array, 3> pad; for (int obj = 0; obj < 3; obj++) { - pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); + pad[obj] = std::make_unique(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); pad[obj]->Draw(); } @@ -371,9 +372,9 @@ namespace { t1.SetTextColor(2); t1.DrawLatex(0.5, 0.96, Form("Ecal Time Calib Errors Summary, IOV %i", run)); - TPad* pad = new TPad("pad", "pad", 0.0, 0.0, 1.0, 0.94); - pad->Draw(); - pad->cd(); + TPad pad("pad", "pad", 0.0, 0.0, 1.0, 0.94); + pad.Draw(); + pad.cd(); align->Draw("TEXT"); drawTable(NbRows, 4); diff --git a/CondCore/EcalPlugins/plugins/EcalWeightXtalGroups_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalWeightXtalGroups_PayloadInspector.cc index 00e3b9546a762..1294c4b47f890 100644 --- a/CondCore/EcalPlugins/plugins/EcalWeightXtalGroups_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalWeightXtalGroups_PayloadInspector.cc @@ -14,6 +14,8 @@ #include "TLatex.h" #include +#include +#include namespace { @@ -100,9 +102,9 @@ namespace { float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; - TPad** pad = new TPad*; + std::array, 3> pad; for (int obj = 0; obj < 3; obj++) { - pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); + pad[obj] = std::make_unique(Form("p_%i", obj), Form("p_%i", obj), xmi[obj], 0.0, xma[obj], 0.94); pad[obj]->Draw(); } // EcalDrawMaps ICMap; @@ -125,4 +127,4 @@ namespace { } // namespace // Register the classes as boost python plugin -PAYLOAD_INSPECTOR_MODULE(EcalWeightXtalGroups) { PAYLOAD_INSPECTOR_CLASS(EcalWeightXtalGroupsPlot); } \ No newline at end of file +PAYLOAD_INSPECTOR_MODULE(EcalWeightXtalGroups) { PAYLOAD_INSPECTOR_CLASS(EcalWeightXtalGroupsPlot); } diff --git a/CondCore/Utilities/bin/conddb_test_gt_perf.cpp b/CondCore/Utilities/bin/conddb_test_gt_perf.cpp index f9ddb33cb5bed..c2ebecd795130 100644 --- a/CondCore/Utilities/bin/conddb_test_gt_perf.cpp +++ b/CondCore/Utilities/bin/conddb_test_gt_perf.cpp @@ -2,8 +2,6 @@ #include "CondCore/CondDB/interface/IOVProxy.h" #include "CondCore/CondDB/interface/GTProxy.h" -#include "CondCore/CondDB/src/IOVSchema.cc" - #include "CondCore/Utilities/interface/Utilities.h" #include "CondCore/Utilities/interface/CondDBImport.h" #include @@ -189,12 +187,6 @@ bool cond::UntypedPayloadProxy::get(cond::Time_t targetTime, bool debug) { if (debug) std::cout << "Loaded payload of type \"" << payloadType << "\" (" << m_buffer.size() << " bytes)" << std::endl; } - // check if hash is correct: - cond::Hash localHash = cond::persistency::makeHash(payloadType, m_buffer); - if (localHash != m_data->current.payloadId) { - std::cout << "ERROR: payload of type " << payloadType << " with id " << m_data->current.payloadId - << " in DB has wrong local hash: " << localHash << std::endl; - } } return loaded; } diff --git a/CondCore/Utilities/interface/PayloadInspector.h b/CondCore/Utilities/interface/PayloadInspector.h index 11d873675082d..4898e6c336e31 100644 --- a/CondCore/Utilities/interface/PayloadInspector.h +++ b/CondCore/Utilities/interface/PayloadInspector.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "FWCore/Utilities/interface/GlobalIdentifier.h" diff --git a/CondCore/Utilities/plugins/Module_2XML.cc b/CondCore/Utilities/plugins/Module_2XML.cc index deae196480a72..ad1e52c5724d5 100644 --- a/CondCore/Utilities/plugins/Module_2XML.cc +++ b/CondCore/Utilities/plugins/Module_2XML.cc @@ -30,6 +30,7 @@ PAYLOAD_2XML_MODULE(pluginUtilities_payload2xml) { PAYLOAD_2XML_CLASS(CTPPSPixelAnalysisMask); PAYLOAD_2XML_CLASS(CTPPSPixelDAQMapping); PAYLOAD_2XML_CLASS(CTPPSPixelGainCalibrations); + PAYLOAD_2XML_CLASS(PPSAlignmentConfig) PAYLOAD_2XML_CLASS(CastorChannelQuality); PAYLOAD_2XML_CLASS(CastorElectronicsMap); PAYLOAD_2XML_CLASS(CastorGainWidths); diff --git a/CondCore/Utilities/python/o2olib.py b/CondCore/Utilities/python/o2olib.py index 4aff86dd894d2..f76fc65d645db 100644 --- a/CondCore/Utilities/python/o2olib.py +++ b/CondCore/Utilities/python/o2olib.py @@ -133,22 +133,6 @@ def getSession( self, db_service, role, authPath ): self.logger.error( str(dberror) ) return session - def readConfiguration( self, config_filename ): - config = '' - try: - with open( config_filename, 'r' ) as config_file: - config = config_file.read() - if config == '': - self.logger.error( 'The file %s contains an empty string.', config_filename ) - else: - json.loads(config) - except IOError as e: - self.logger.error( 'The file %s cannot be open.', config_filename ) - except ValueError as e: - config = '' - self.logger.error( 'The file %s contains an invalid json string.', config_filename ) - return config - def connect( self, service, args ): self.session = self.getSession( service, args.role, args.auth ) self.verbose = args.verbose @@ -161,7 +145,9 @@ def connect( self, service, args ): def runManager( self ): return O2ORunMgr( self.db_connection, self.session, self.logger ) - def add( self, job_name, config_filename, int_val, freq_flag, en_flag ): + def add( self, job_name, configJson, int_val, freq_flag, en_flag ): + if configJson == '': + return False res = self.session.query(O2OJob.enabled).filter_by(name=job_name) enabled = None for r in res: @@ -169,9 +155,6 @@ def add( self, job_name, config_filename, int_val, freq_flag, en_flag ): if enabled: self.logger.error( "A job called '%s' exists already.", job_name ) return False - configJson = self.readConfiguration( config_filename ) - if configJson == '': - return False freq_val = 0 if freq_flag: freq_val = 1 @@ -208,7 +191,9 @@ def set( self, job_name, en_flag, fr_val=None ): else: self.logger.info( "Job '%s' unset 'frequent'" %job_name) - def setConfig( self, job_name, config_filename ): + def setConfig( self, job_name, configJson ): + if configJson == '': + return False res = self.session.query(O2OJob.enabled).filter_by(name=job_name) enabled = None for r in res: @@ -216,13 +201,11 @@ def setConfig( self, job_name, config_filename ): if enabled is None: self.logger.error( "A job called '%s' does not exist.", job_name ) return - configJson = self.readConfiguration( config_filename ) - if configJson == '': - return False config = O2OJobConf( job_name=job_name, insertion_time = datetime.utcnow(), configuration = configJson ) self.session.add(config) self.session.commit() self.logger.info( "New configuration inserted for job '%s'", job_name ) + return True def setInterval( self, job_name, int_val ): res = self.session.query(O2OJob.enabled).filter_by(name=job_name) @@ -396,15 +379,15 @@ def executeJob( self, args ): self.logger.error( "Unresolved template key %s in the command." %str(exc) ) return 3 self.logger.info('Command: "%s"', command ) + out = '' try: self.logger.info('Executing command...' ) pipe = subprocess.Popen( command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT ) - out = '' - for line in iter(pipe.stdout.readline, ''): + for line in pipe.stdout: if args.verbose is not None and args.verbose>=1: - sys.stdout.write(line) + sys.stdout.write(line.decode()) sys.stdout.flush() - out += line + out += line.decode() pipe.communicate() self.logger.info( 'Command returned code: %s' %pipe.returncode ) ret = pipe.returncode @@ -417,6 +400,32 @@ def executeJob( self, args ): with open(logFile,'a') as logF: logF.write(out) return ret + +def readConfiguration( config_filename ): + config = '' + try: + with open( config_filename, 'r' ) as config_file: + config = config_file.read().strip('\n') + if config == '': + logging.error( 'The file %s contains an empty string.', config_filename ) + else: + json.loads(config) + except IOError as e: + logging.error( 'The file %s cannot be open.', config_filename ) + except ValueError as e: + config = '' + logging.error( 'The file "%s" contains an invalid json string.', config_filename ) + return config + +def checkConfiguration( config_string ): + config = config_string + try: + json.loads(config) + except ValueError as e: + config = '' + logging.error( 'The string "%s" is an invalid json format.', config_string ) + return config + import optparse import argparse @@ -431,13 +440,15 @@ def execute(self): parser_subparsers = parser.add_subparsers(title='Available subcommands') parser_create = parser_subparsers.add_parser('create', description='Create a new O2O job') parser_create.add_argument('--name', '-n', type=str, help='The o2o job name',required=True) - parser_create.add_argument('--configFile', '-c', type=str, help='the JSON configuration file path',required=True) + parser_create.add_argument('--configFile', '-c', type=str, help='the JSON configuration file path') + parser_create.add_argument('--configString', '-s', type=str, help='the JSON configuration string') parser_create.add_argument('--interval', '-i', type=int, help='the chron job interval',default=0) - parser_create.add_argument('--frequent', '-f',action='store_true',help='set the "frequent" flag for this job') + parser_create.add_argument('--frequent', '-f',action='store_true',help='set the "frequent" flag for this job ("false" by default)') parser_create.set_defaults(func=self.create,role=auth.admin_role) parser_setConfig = parser_subparsers.add_parser('setConfig', description='Set a new configuration for the specified job. The configuration is expected as a list of entries "param": "value" (dictionary). The "param" labels will be used to inject the values in the command to execute. The dictionary is stored in JSON format.') parser_setConfig.add_argument('--name', '-n', type=str, help='The o2o job name',required=True) - parser_setConfig.add_argument('--configFile', '-c', type=str, help='the JSON configuration file path',required=True) + parser_setConfig.add_argument('--configFile', '-c', type=str, help='the JSON configuration file path') + parser_setConfig.add_argument('--configString', '-s', type=str, help='the JSON configuration string') parser_setConfig.set_defaults(func=self.setConfig,role=auth.admin_role) parser_setFrequent = parser_subparsers.add_parser('setFrequent',description='Set the "frequent" flag for the specified job') parser_setFrequent.add_argument('--name', '-n', type=str, help='The o2o job name',required=True) @@ -496,10 +507,36 @@ def setup(self, args): return self.mgr.connect( db_service, args ) def create(self): - self.mgr.add( self.args.name, self.args.configFile, self.args.interval, True ) + configJson = None + if self.args.configFile is not None: + if self.args.configString is not None: + logging.error('Ambigouous input provided: please specify a configFile OR a configString') + return False + else: + configJson = readConfiguration( self.args.configFile ) + else: + if self.args.configString is None: + logging.error('No configuration has been provided: please specify "configFile" or "configString" param.') + return False + else: + configJson = checkConfiguration( self.args.configString ) + self.mgr.add( self.args.name, configJson, self.args.interval, self.args.frequent, True ) def setConfig(self): - self.mgr.setConfig( self.args.name, self.args.configFile ) + configJson = None + if self.args.configFile is not None: + if self.args.configString is not None: + logging.error('Ambigouous input provided: please specify a configFile OR a configString') + return False + else: + configJson = readConfiguration( self.args.configFile ) + else: + if self.args.configString is None: + logging.error('No configuration has been provided: please specify "configFile" or "configString" param.') + return False + else: + configJson = checkConfiguration( self.args.configString ) + self.mgr.setConfig( self.args.name, configJson ) def setInterval(self): self.mgr.setInterval( self.args.name, self.args.interval ) diff --git a/CondCore/Utilities/scripts/getPayloadData.py b/CondCore/Utilities/scripts/getPayloadData.py index a585fa17a306b..a052e69123f80 100755 --- a/CondCore/Utilities/scripts/getPayloadData.py +++ b/CondCore/Utilities/scripts/getPayloadData.py @@ -191,10 +191,10 @@ def discover(): two_tags = plot_method.isTwoTags() output(' - is Two Tags: ', two_tags) plot_dict = { 'plot': plot, 'plugin_name': plugin_name, 'title': plot_title, 'plot_type': plot_type, 'single_iov': single_iov, 'two_tags': two_tags } - #if modv.label == '2.0': - # input_params = plot_method.inputParams() - # output(' - input params: ', len(input_params)) - # plot_dict[ 'input_params'] = input_params + if modv.label == '2.0': + input_params = plot_method.inputParams() + output(' - input params: ', len(input_params)) + plot_dict[ 'input_params'] = input_params result.setdefault(payload_type, []).append( plot_dict ) output('currently discovered info: ', result) output('*** final output:', '') diff --git a/CondCore/Utilities/src/CondDBFetch.cc b/CondCore/Utilities/src/CondDBFetch.cc index d950d7145e5ce..25aa9d1e16edd 100644 --- a/CondCore/Utilities/src/CondDBFetch.cc +++ b/CondCore/Utilities/src/CondDBFetch.cc @@ -56,6 +56,7 @@ namespace cond { FETCH_PAYLOAD_CASE(CTPPSPixelAnalysisMask) FETCH_PAYLOAD_CASE(CTPPSPixelGainCalibrations) FETCH_PAYLOAD_CASE(CTPPSRPAlignmentCorrectionsData) + FETCH_PAYLOAD_CASE(PPSAlignmentConfig) FETCH_PAYLOAD_CASE(LHCOpticalFunctionsSetCollection) FETCH_PAYLOAD_CASE(CastorChannelQuality) FETCH_PAYLOAD_CASE(CastorElectronicsMap) diff --git a/CondCore/Utilities/src/CondDBImport.cc b/CondCore/Utilities/src/CondDBImport.cc index 06f2569ff44a2..0a93d0b0346b4 100644 --- a/CondCore/Utilities/src/CondDBImport.cc +++ b/CondCore/Utilities/src/CondDBImport.cc @@ -76,6 +76,7 @@ namespace cond { IMPORT_PAYLOAD_CASE(CTPPSPixelAnalysisMask) IMPORT_PAYLOAD_CASE(CTPPSPixelGainCalibrations) IMPORT_PAYLOAD_CASE(CTPPSRPAlignmentCorrectionsData) + IMPORT_PAYLOAD_CASE(PPSAlignmentConfig) IMPORT_PAYLOAD_CASE(LHCOpticalFunctionsSetCollection) IMPORT_PAYLOAD_CASE(CastorChannelQuality) IMPORT_PAYLOAD_CASE(CastorElectronicsMap) diff --git a/CondCore/Utilities/src/CondDBTools.cc b/CondCore/Utilities/src/CondDBTools.cc index cf1cce5a50178..52303ba94f30c 100644 --- a/CondCore/Utilities/src/CondDBTools.cc +++ b/CondCore/Utilities/src/CondDBTools.cc @@ -2,11 +2,8 @@ #include "CondCore/Utilities/interface/CondDBImport.h" #include "CondCore/CondDB/interface/ConnectionPool.h" // -#include "CondCore/CondDB/src/DbCore.h" -// -#include - #include +#include namespace cond { diff --git a/CondCore/Utilities/src/CondFormats.h b/CondCore/Utilities/src/CondFormats.h index ef04fcb0035bf..48fe8f23f996b 100644 --- a/CondCore/Utilities/src/CondFormats.h +++ b/CondCore/Utilities/src/CondFormats.h @@ -34,6 +34,7 @@ #include "CondFormats/PPSObjects/interface/CTPPSRPAlignmentCorrectionsData.h" #include "CondFormats/PPSObjects/interface/PPSTimingCalibration.h" #include "CondFormats/PPSObjects/interface/LHCOpticalFunctionsSetCollection.h" +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfig.h" #include "CondFormats/DTObjects/interface/DTCCBConfig.h" #include "CondFormats/DTObjects/interface/DTDeadFlag.h" #include "CondFormats/DTObjects/interface/DTHVStatus.h" diff --git a/CondFormats/HGCalObjects/interface/HeterogeneousHGCalHEFCellPositionsConditions.h b/CondFormats/HGCalObjects/interface/HeterogeneousHGCalHEFCellPositionsConditions.h index 5dea507cc7432..1a258736c7136 100644 --- a/CondFormats/HGCalObjects/interface/HeterogeneousHGCalHEFCellPositionsConditions.h +++ b/CondFormats/HGCalObjects/interface/HeterogeneousHGCalHEFCellPositionsConditions.h @@ -10,7 +10,6 @@ #include "CUDADataFormats/HGCal/interface/HGCConditions.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" #include "Geometry/HGCalCommonData/interface/HGCalParameters.h" -#include "RecoLocalCalo/HGCalRecProducers/plugins/KernelManagerHGCalCellPositions.h" namespace cpar = hgcal_conditions::parameters; namespace cpos = hgcal_conditions::positions; diff --git a/CondFormats/PPSObjects/interface/PPSAlignmentConfig.h b/CondFormats/PPSObjects/interface/PPSAlignmentConfig.h index cc4edb997b557..c75bedf888c7e 100644 --- a/CondFormats/PPSObjects/interface/PPSAlignmentConfig.h +++ b/CondFormats/PPSObjects/interface/PPSAlignmentConfig.h @@ -87,6 +87,8 @@ struct Binning { unsigned int n_bins_y_; double y_min_, y_max_; + + COND_SERIALIZABLE; }; std::ostream &operator<<(std::ostream &os, Binning &b); diff --git a/CondFormats/PPSObjects/src/PPSAlignmentConfig.cc b/CondFormats/PPSObjects/src/PPSAlignmentConfig.cc index 6cd6a35f90bf5..427269cbdd42c 100644 --- a/CondFormats/PPSObjects/src/PPSAlignmentConfig.cc +++ b/CondFormats/PPSObjects/src/PPSAlignmentConfig.cc @@ -10,10 +10,7 @@ * ****************************************************************************/ -#include "FWCore/Utilities/interface/typelookup.h" - #include "CondFormats/PPSObjects/interface/PPSAlignmentConfig.h" -TYPELOOKUP_DATA_REG(PPSAlignmentConfig); #include #include diff --git a/CondFormats/PPSObjects/src/T_EventSetup_PPSAlignmentConfig.cc b/CondFormats/PPSObjects/src/T_EventSetup_PPSAlignmentConfig.cc new file mode 100644 index 0000000000000..5c45035747026 --- /dev/null +++ b/CondFormats/PPSObjects/src/T_EventSetup_PPSAlignmentConfig.cc @@ -0,0 +1,4 @@ +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfig.h" +#include "FWCore/Utilities/interface/typelookup.h" + +TYPELOOKUP_DATA_REG(PPSAlignmentConfig); diff --git a/CondFormats/PPSObjects/src/classes_def.xml b/CondFormats/PPSObjects/src/classes_def.xml index 2b8be486f99ef..74cfa9a9761dc 100644 --- a/CondFormats/PPSObjects/src/classes_def.xml +++ b/CondFormats/PPSObjects/src/classes_def.xml @@ -68,4 +68,17 @@ - \ No newline at end of file + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CondFormats/PPSObjects/src/headers.h b/CondFormats/PPSObjects/src/headers.h index bb179fd8df892..1b77a578cb8ca 100644 --- a/CondFormats/PPSObjects/src/headers.h +++ b/CondFormats/PPSObjects/src/headers.h @@ -13,3 +13,5 @@ #include "CondFormats/PPSObjects/interface/PPSDirectSimulationData.h" #include "CondFormats/PPSObjects/interface/PPSPixelTopology.h" + +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfig.h" diff --git a/CondFormats/PPSObjects/test/BuildFile.xml b/CondFormats/PPSObjects/test/BuildFile.xml index b4b34bf621ee7..edb32ad3438ca 100644 --- a/CondFormats/PPSObjects/test/BuildFile.xml +++ b/CondFormats/PPSObjects/test/BuildFile.xml @@ -9,3 +9,7 @@ + + + + diff --git a/CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfig.cc b/CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfig.cc new file mode 100644 index 0000000000000..e979996e0d532 --- /dev/null +++ b/CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfig.cc @@ -0,0 +1,17 @@ +#include "CondFormats/Serialization/interface/Test.h" + +#include "../src/headers.h" + +int main() { + testSerialization(); + testSerialization(); + testSerialization(); + testSerialization(); + testSerialization(); + + testSerialization>(); + testSerialization>>(); + testSerialization>(); + + testSerialization(); +} diff --git a/CondFormats/SiPixelTransient/src/SiPixelTemplate.cc b/CondFormats/SiPixelTransient/src/SiPixelTemplate.cc index ebf7fe3550807..57e7806db0326 100644 --- a/CondFormats/SiPixelTransient/src/SiPixelTemplate.cc +++ b/CondFormats/SiPixelTransient/src/SiPixelTemplate.cc @@ -106,6 +106,7 @@ #include "CondFormats/SiPixelTransient/interface/SimplePixel.h" #include "FWCore/Utilities/interface/FileInPath.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Utilities/interface/isFinite.h" #define LOGERROR(x) LogError(x) #define LOGINFO(x) LogInfo(x) #define LOGWARNING(x) LogWarning(x) @@ -1392,6 +1393,12 @@ bool SiPixelTemplate::interpolate(int id, float cotalpha, float cotbeta, float l throw cms::Exception("DataCorrupt") << "SiPixelTemplate::interpolate can't find needed template ID = " << id << std::endl; } + + //check for nan's + if (!edm::isFinite(cotalpha) || !edm::isFinite(cotbeta)) { + success_ = false; + return success_; + } #else assert(index_id_ >= 0 && index_id_ < (int)thePixelTemp_.size()); #endif diff --git a/CondFormats/SiPixelTransient/src/SiPixelTemplate2D.cc b/CondFormats/SiPixelTransient/src/SiPixelTemplate2D.cc index 7b52e28902c57..d9e3441e357d0 100644 --- a/CondFormats/SiPixelTransient/src/SiPixelTemplate2D.cc +++ b/CondFormats/SiPixelTransient/src/SiPixelTemplate2D.cc @@ -40,6 +40,7 @@ #include "CondFormats/SiPixelTransient/interface/SiPixelTemplate2D.h" #include "FWCore/Utilities/interface/FileInPath.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Utilities/interface/isFinite.h" #define LOGERROR(x) LogError(x) #define LOGINFO(x) LogInfo(x) #define ENDL " " @@ -679,6 +680,12 @@ bool SiPixelTemplate2D::interpolate(int id, float cotalpha, float cotbeta, float #ifndef SI_PIXEL_TEMPLATE_STANDALONE throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::illegal subdetector ID = " << thePixelTemp_[index_id_].head.Dtype << std::endl; + + //check for nan's + if (!edm::isFinite(cotalpha) || !edm::isFinite(cotbeta)) { + success_ = false; + return success_; + } #else std::cout << "SiPixelTemplate:2D:illegal subdetector ID = " << thePixelTemp_[index_id_].head.Dtype << std::endl; #endif diff --git a/CondTools/CTPPS/plugins/RetrievePPSAlignmentConfig.cc b/CondTools/CTPPS/plugins/RetrievePPSAlignmentConfig.cc new file mode 100644 index 0000000000000..b780cf149ce30 --- /dev/null +++ b/CondTools/CTPPS/plugins/RetrievePPSAlignmentConfig.cc @@ -0,0 +1,42 @@ +/**************************************************************************** +* Author: +* Mateusz Kocot (mateuszkocot99@gmail.com) +****************************************************************************/ + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfig.h" +#include "CondFormats/DataRecord/interface/PPSAlignmentConfigRcd.h" + +#include + +class RetrievePPSAlignmentConfig : public edm::one::EDAnalyzer<> { +public: + explicit RetrievePPSAlignmentConfig(const edm::ParameterSet &); + +private: + void analyze(const edm::Event &, const edm::EventSetup &) override; + + edm::ESGetToken esToken_; +}; + +RetrievePPSAlignmentConfig::RetrievePPSAlignmentConfig(const edm::ParameterSet &iConfig) : esToken_(esConsumes()) {} + +void RetrievePPSAlignmentConfig::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { + // get the data + const auto &ppsAlignmentConfig = iSetup.getData(esToken_); + + edm::LogInfo("PPS") << ppsAlignmentConfig; +} + +//define this as a plug-in +DEFINE_FWK_MODULE(RetrievePPSAlignmentConfig); diff --git a/CondTools/CTPPS/plugins/WritePPSAlignmentConfig.cc b/CondTools/CTPPS/plugins/WritePPSAlignmentConfig.cc new file mode 100644 index 0000000000000..84437bd4e3728 --- /dev/null +++ b/CondTools/CTPPS/plugins/WritePPSAlignmentConfig.cc @@ -0,0 +1,51 @@ +/**************************************************************************** +* Author: +* Mateusz Kocot (mateuszkocot99@gmail.com) +****************************************************************************/ + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" + +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfig.h" +#include "CondFormats/DataRecord/interface/PPSAlignmentConfigRcd.h" + +#include + +class WritePPSAlignmentConfig : public edm::one::EDAnalyzer<> { +public: + explicit WritePPSAlignmentConfig(const edm::ParameterSet &); + +private: + void analyze(const edm::Event &, const edm::EventSetup &) override; + + edm::ESGetToken esToken_; +}; + +WritePPSAlignmentConfig::WritePPSAlignmentConfig(const edm::ParameterSet &iConfig) + : esToken_(esConsumes( + edm::ESInputTag("", iConfig.getParameter("label")))) {} + +void WritePPSAlignmentConfig::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { + // get the data + const auto &ppsAlignmentConfig = iSetup.getData(esToken_); + + // store the data in a DB object + edm::Service poolDbService; + if (poolDbService.isAvailable()) { + poolDbService->writeOne(&ppsAlignmentConfig, poolDbService->currentTime(), "PPSAlignmentConfigRcd"); + } else { + throw cms::Exception("WritePPSAlignmentConfig") << "PoolDBService required."; + } +} + +//define this as a plug-in +DEFINE_FWK_MODULE(WritePPSAlignmentConfig); diff --git a/CondTools/CTPPS/test/retrieve_PPSAlignmentConfig_cfg.py b/CondTools/CTPPS/test/retrieve_PPSAlignmentConfig_cfg.py new file mode 100644 index 0000000000000..5614bfe76bc4f --- /dev/null +++ b/CondTools/CTPPS/test/retrieve_PPSAlignmentConfig_cfg.py @@ -0,0 +1,52 @@ +##### configuration ##### +input_conditions = 'sqlite_file:alignment_config.db' # input database +run_number = 1 # used to select the IOV +db_tag = 'PPSAlignmentConfig_test_v1_prompt' # database tag +######################### + +import FWCore.ParameterSet.Config as cms + +process = cms.Process("retrievePPSAlignmentConfig") + +# Message Logger +process.MessageLogger = cms.Service("MessageLogger", + destinations = cms.untracked.vstring('retrieve_PPSAlignmentConfig'), + retrieve_PPSAlignmentConfig = cms.untracked.PSet( + threshold = cms.untracked.string('INFO') + ) +) + +# Load CondDB service +process.load("CondCore.CondDB.CondDB_cfi") + +# input database (in this case the local sqlite file) +process.CondDB.connect = input_conditions + +# A data source must always be defined. We don't need it, so here's a dummy one. +process.source = cms.Source("EmptyIOVSource", + timetype = cms.string('runnumber'), + firstValue = cms.uint64(run_number), + lastValue = cms.uint64(run_number), + interval = cms.uint64(1) +) + +# input service +process.PoolDBESSource = cms.ESSource("PoolDBESSource", + process.CondDB, + DumbStat = cms.untracked.bool(True), + toGet = cms.VPSet(cms.PSet( + record = cms.string('PPSAlignmentConfigRcd'), + tag = cms.string(db_tag) + )) +) + +# DB object retrieve module +process.retrieve_config = cms.EDAnalyzer("RetrievePPSAlignmentConfig", + toGet = cms.VPSet(cms.PSet( + record = cms.string('PPSAlignmentConfigRcd'), + data = cms.vstring('PPSAlignmentConfig') + )), + verbose = cms.untracked.bool(True) +) + +process.path = cms.Path(process.retrieve_config) diff --git a/CondTools/CTPPS/test/write_PPSAlignmentConfig_cfg.py b/CondTools/CTPPS/test/write_PPSAlignmentConfig_cfg.py new file mode 100644 index 0000000000000..0a1fe540a76be --- /dev/null +++ b/CondTools/CTPPS/test/write_PPSAlignmentConfig_cfg.py @@ -0,0 +1,88 @@ +##### configuration ##### +output_conditions = 'sqlite_file:alignment_config.db' # output database +run_number = 1 # beginning of the IOV +db_tag = 'PPSAlignmentConfig_test_v1_prompt' # database tag +produce_logs = True # if set to True, a file with logs will be produced. +product_instance_label = 'db_test' # ES product label +######################### + +import FWCore.ParameterSet.Config as cms + +process = cms.Process("writePPSAlignmentConfig") + +# Message Logger +if produce_logs: + process.MessageLogger = cms.Service("MessageLogger", + destinations = cms.untracked.vstring('write_PPSAlignmentConfig', + 'cout' + ), + write_PPSAlignmentConfig = cms.untracked.PSet( + threshold = cms.untracked.string('INFO') + ), + cout = cms.untracked.PSet( + threshold = cms.untracked.string('WARNING') + ) + ) +else: + process.MessageLogger = cms.Service("MessageLogger", + destinations = cms.untracked.vstring('cout'), + cout = cms.untracked.PSet( + threshold = cms.untracked.string('WARNING') + ) + ) + +# Load CondDB service +process.load("CondCore.CondDB.CondDB_cfi") + +# output database +process.CondDB.connect = output_conditions + +# A data source must always be defined. We don't need it, so here's a dummy one. +process.source = cms.Source("EmptyIOVSource", + timetype = cms.string('runnumber'), + firstValue = cms.uint64(run_number), + lastValue = cms.uint64(run_number), + interval = cms.uint64(1) +) + +# output service +process.PoolDBOutputService = cms.Service("PoolDBOutputService", + process.CondDB, + timetype = cms.untracked.string('runnumber'), + toPut = cms.VPSet(cms.PSet( + record = cms.string('PPSAlignmentConfigRcd'), + tag = cms.string(db_tag) + )) +) + +# ESSource +process.ppsAlignmentConfigESSource = cms.ESSource("PPSAlignmentConfigESSource", + # PPSAlignmentConfigESSource parameters, defaults will be taken from fillDescriptions + label = cms.string(product_instance_label), + sector_45 = cms.PSet( + rp_N = cms.PSet( + name = cms.string('db_test_RP'), + id = cms.int32(44), + y_max_fit_mode = cms.double(66.6) + ) + ), + y_alignment = cms.PSet( + rp_L_F = cms.PSet( + x_min = cms.double(102), + x_max = cms.double(210.0) + ) + ) +) + +# DB object maker +process.config_writer = cms.EDAnalyzer("WritePPSAlignmentConfig", + record = cms.string('PPSAlignmentConfigRcd'), + loggingOn = cms.untracked.bool(True), + SinceAppendMode = cms.bool(True), + Source = cms.PSet( + IOVRun = cms.untracked.uint32(1) + ), + label = cms.string(product_instance_label) +) + +process.path = cms.Path(process.config_writer) \ No newline at end of file diff --git a/CondTools/DT/test/validate/DTMtimeValidateDBRead.cc b/CondTools/DT/test/validate/DTMtimeValidateDBRead.cc index 775e675300a91..39e3fbf6c5ea5 100644 --- a/CondTools/DT/test/validate/DTMtimeValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTMtimeValidateDBRead.cc @@ -23,9 +23,13 @@ Toy EDAnalyzer for testing purposes only. #include "CondTools/DT/test/validate/DTMtimeValidateDBRead.h" #include "CondFormats/DTObjects/interface/DTMtime.h" #include "CondFormats/DataRecord/interface/DTMtimeRcd.h" +#include "CondFormats/DTObjects/interface/DTRecoConditions.h" +#include "CondFormats/DataRecord/interface/DTRecoConditionsVdriftRcd.h" DTMtimeValidateDBRead::DTMtimeValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + readLegacyVDriftDB(p.getParameter("readLegacyVDriftDB")) {} DTMtimeValidateDBRead::DTMtimeValidateDBRead(int i) {} @@ -40,11 +44,7 @@ void DTMtimeValidateDBRead::analyze(const edm::Event& e, const edm::EventSetup& run_fn << "run" << e.id().run() << dataFileName; std::ifstream chkFile(run_fn.str().c_str()); std::ofstream logFile(elogFileName.c_str(), std::ios_base::app); - edm::ESHandle mT; - context.get().get(mT); - std::cout << mT->version() << std::endl; - std::cout << std::distance(mT->begin(), mT->end()) << " data in the container" << std::endl; - int status; + int whe; int sta; int sec; @@ -53,27 +53,50 @@ void DTMtimeValidateDBRead::analyze(const edm::Event& e, const edm::EventSetup& float mTrms; float ckmt; float ckrms; - DTMtime::const_iterator iter = mT->begin(); - DTMtime::const_iterator iend = mT->end(); - while (iter != iend) { - const DTMtimeId& mTId = iter->first; - const DTMtimeData& mTData = iter->second; - status = mT->get(mTId.wheelId, mTId.stationId, mTId.sectorId, mTId.slId, mTime, mTrms, DTTimeUnits::counts); - if (status) - logFile << "ERROR while getting sl Mtime " << mTId.wheelId << " " << mTId.stationId << " " << mTId.sectorId << " " - << mTId.slId << " , status = " << status << std::endl; - if ((fabs(mTData.mTime - mTime) > 0.01) || (fabs(mTData.mTrms - mTrms) > 0.0001)) - logFile << "MISMATCH WHEN READING sl Mtime " << mTId.wheelId << " " << mTId.stationId << " " << mTId.sectorId - << " " << mTId.slId << " : " << mTData.mTime << " " << mTData.mTrms << " -> " << mTime << " " << mTrms - << std::endl; - iter++; - } + if (readLegacyVDriftDB) { //legacy format + edm::ESHandle mT; + context.get().get(mT); + std::cout << mT->version() << std::endl; + std::cout << std::distance(mT->begin(), mT->end()) << " data in the container" << std::endl; + + int status; + DTMtime::const_iterator iter = mT->begin(); + DTMtime::const_iterator iend = mT->end(); + while (iter != iend) { + const DTMtimeId& mTId = iter->first; + const DTMtimeData& mTData = iter->second; + status = mT->get(mTId.wheelId, mTId.stationId, mTId.sectorId, mTId.slId, mTime, mTrms, DTTimeUnits::counts); + if (status) + logFile << "ERROR while getting sl Mtime " << mTId.wheelId << " " << mTId.stationId << " " << mTId.sectorId + << " " << mTId.slId << " , status = " << status << std::endl; + if ((fabs(mTData.mTime - mTime) > 0.01) || (fabs(mTData.mTrms - mTrms) > 0.0001)) + logFile << "MISMATCH WHEN READING sl Mtime " << mTId.wheelId << " " << mTId.stationId << " " << mTId.sectorId + << " " << mTId.slId << " : " << mTData.mTime << " " << mTData.mTrms << " -> " << mTime << " " << mTrms + << std::endl; + iter++; + } - while (chkFile >> whe >> sta >> sec >> qua >> ckmt >> ckrms) { - status = mT->get(whe, sta, sec, qua, mTime, mTrms, DTTimeUnits::counts); - if ((fabs(ckmt - mTime) > 0.01) || (fabs(ckrms - mTrms) > 0.0001)) - logFile << "MISMATCH IN WRITING AND READING sl Mtime " << whe << " " << sta << " " << sec << " " << qua << " : " - << ckmt << " " << ckrms << " -> " << mTime << " " << mTrms << std::endl; + while (chkFile >> whe >> sta >> sec >> qua >> ckmt >> ckrms) { + status = mT->get(whe, sta, sec, qua, mTime, mTrms, DTTimeUnits::counts); + if ((fabs(ckmt - mTime) > 0.01) || (fabs(ckrms - mTrms) > 0.0001)) + logFile << "MISMATCH IN WRITING AND READING sl Mtime " << whe << " " << sta << " " << sec << " " << qua << " : " + << ckmt << " " << ckrms << " -> " << mTime << " " << mTrms << std::endl; + } + } else { + edm::ESHandle hVdrift; + context.get().get(hVdrift); + const DTRecoConditions* vDriftMap_ = &*hVdrift; + // Consistency check: no parametrization is implemented for the time being + int version = vDriftMap_->version(); + if (version != 1) { + throw cms::Exception("Configuration") << "only version 1 is presently supported for VDriftDB"; + } + while (chkFile >> whe >> sta >> sec >> qua >> ckmt >> ckrms) { + mTime = vDriftMap_->get(DTWireId(whe, sta, sec, 1, 0, 0)); + if ((fabs(ckmt - mTime) > 0.01)) + logFile << "MISMATCH IN WRITING AND READING sl Mtime " << whe << " " << sta << " " << sec << " " << qua << " : " + << ckmt << " " << ckrms << " -> " << mTime << " --- " << std::endl; + } } } diff --git a/CondTools/DT/test/validate/DTMtimeValidateDBRead.h b/CondTools/DT/test/validate/DTMtimeValidateDBRead.h index a213f8b971e38..d59c29e7bae6c 100644 --- a/CondTools/DT/test/validate/DTMtimeValidateDBRead.h +++ b/CondTools/DT/test/validate/DTMtimeValidateDBRead.h @@ -22,4 +22,5 @@ class DTMtimeValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + bool readLegacyVDriftDB; // which DB to use }; diff --git a/CondTools/RunInfo/test/BuildFile.xml b/CondTools/RunInfo/test/BuildFile.xml index 831fe9b570583..07301e711c422 100644 --- a/CondTools/RunInfo/test/BuildFile.xml +++ b/CondTools/RunInfo/test/BuildFile.xml @@ -1,6 +1,6 @@ - + diff --git a/Configuration/AlCa/python/autoCond.py b/Configuration/AlCa/python/autoCond.py index 3e0d8af7ddc1d..dad86350fa96b 100644 --- a/Configuration/AlCa/python/autoCond.py +++ b/Configuration/AlCa/python/autoCond.py @@ -64,17 +64,17 @@ # GlobalTag for MC production (cosmics) with realistic conditions for full Phase1 2018 detector, Strip tracker in PEAK mode 'phase1_2018_cosmics_peak' : '120X_upgrade2018cosmics_realistic_peak_v1', # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2021 - 'phase1_2021_design' : '120X_mcRun3_2021_design_v3', # GT containing design conditions for Phase1 2021 + 'phase1_2021_design' : '121X_mcRun3_2021_design_v1', # GT containing design conditions for Phase1 2021 # GlobalTag for MC production with realistic conditions for Phase1 2021 - 'phase1_2021_realistic' : '120X_mcRun3_2021_realistic_v4', # GT containing realistic conditions for Phase1 2021 + 'phase1_2021_realistic' : '121X_mcRun3_2021_realistic_v1', # GT containing realistic conditions for Phase1 2021 # GlobalTag for MC production (cosmics) with realistic conditions for Phase1 2021, Strip tracker in DECO mode - 'phase1_2021_cosmics' : '120X_mcRun3_2021cosmics_realistic_deco_v3', + 'phase1_2021_cosmics' : '121X_mcRun3_2021cosmics_realistic_deco_v1', # GlobalTag for MC production with realistic conditions for Phase1 2021 detector for Heavy Ion - 'phase1_2021_realistic_hi' : '120X_mcRun3_2021_realistic_HI_v3', + 'phase1_2021_realistic_hi' : '121X_mcRun3_2021_realistic_HI_v1', # GlobalTag for MC production with realistic conditions for Phase1 2023 - 'phase1_2023_realistic' : '120X_mcRun3_2023_realistic_v4', # GT containing realistic conditions for Phase1 2023 + 'phase1_2023_realistic' : '121X_mcRun3_2023_realistic_v1', # GT containing realistic conditions for Phase1 2023 # GlobalTag for MC production with realistic conditions for Phase1 2024 - 'phase1_2024_realistic' : '120X_mcRun3_2024_realistic_v4', # GT containing realistic conditions for Phase1 2024 + 'phase1_2024_realistic' : '121X_mcRun3_2024_realistic_v1', # GT containing realistic conditions for Phase1 2024 # GlobalTag for MC production with realistic conditions for Phase2 'phase2_realistic' : '113X_mcRun4_realistic_v7' } diff --git a/Configuration/Applications/python/ConfigBuilder.py b/Configuration/Applications/python/ConfigBuilder.py index 0d8d7617471cc..ab050086b91ab 100644 --- a/Configuration/Applications/python/ConfigBuilder.py +++ b/Configuration/Applications/python/ConfigBuilder.py @@ -1848,7 +1848,7 @@ def NFI(index): if self._options.restoreRNDSeeds==False and not self._options.restoreRNDSeeds==True: self._options.restoreRNDSeeds=True - if not 'DIGI' in self.stepMap and not self._options.fast: + if not 'DIGI' in self.stepMap and not self._options.isData and not self._options.fast: self.executeAndRemember("process.mix.playback = True") self.executeAndRemember("process.mix.digitizers = cms.PSet()") self.executeAndRemember("for a in process.aliases: delattr(process, a)") diff --git a/Configuration/Applications/python/cmsDriverOptions.py b/Configuration/Applications/python/cmsDriverOptions.py index d7db1e394ded9..6d3643231cdb5 100755 --- a/Configuration/Applications/python/cmsDriverOptions.py +++ b/Configuration/Applications/python/cmsDriverOptions.py @@ -229,10 +229,15 @@ def OptionsFromItems(items): options.isMC=True if 'SIM' in options.datatier: options.isMC=True + if 'VALIDATION' in options.trimmedStep: + options.isMC=True + if options.era and 'Phase2' in options.era: + options.isMC=True if options.isMC: print('We have determined that this is simulation (if not, rerun cmsDriver.py with --data)') else: print('We have determined that this is real data (if not, rerun cmsDriver.py with --mc)') + options.isData=True if options.profile: if options.profile and options.prefix: diff --git a/Configuration/Generator/python/ADDMonoJet_13TeV_d3MD3_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ADDMonoJet_13TeV_d3MD3_TuneCUETP8M1_cfi.py index eccfa2766d29a..ca1b2c1ebe96a 100644 --- a/Configuration/Generator/python/ADDMonoJet_13TeV_d3MD3_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ADDMonoJet_13TeV_d3MD3_TuneCUETP8M1_cfi.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(1), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/ADDMonoJet_13TeV_d3MD3_cfi.py b/Configuration/Generator/python/ADDMonoJet_13TeV_d3MD3_cfi.py index ccf56b72f7b2d..06c8d611ce7d0 100644 --- a/Configuration/Generator/python/ADDMonoJet_13TeV_d3MD3_cfi.py +++ b/Configuration/Generator/python/ADDMonoJet_13TeV_d3MD3_cfi.py @@ -1,5 +1,5 @@ import FWCore.ParameterSet.Config as cms -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(1), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/ADDMonoJet_8TeV_d3MD3_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ADDMonoJet_8TeV_d3MD3_TuneCUETP8M1_cfi.py index 8d0bd20e3f1c1..286fab3da0bf2 100644 --- a/Configuration/Generator/python/ADDMonoJet_8TeV_d3MD3_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ADDMonoJet_8TeV_d3MD3_TuneCUETP8M1_cfi.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(1), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/AMPT_PPb_5020GeV_MinimumBias_ExtGen_cfi.py b/Configuration/Generator/python/AMPT_PPb_5020GeV_MinimumBias_ExtGen_cfi.py new file mode 100644 index 0000000000000..6e65e6b357683 --- /dev/null +++ b/Configuration/Generator/python/AMPT_PPb_5020GeV_MinimumBias_ExtGen_cfi.py @@ -0,0 +1,57 @@ +import FWCore.ParameterSet.Config as cms + +_generator = cms.EDFilter("AMPTGeneratorFilter", + diquarky = cms.double(0.0), + diquarkx = cms.double(0.0), + diquarkpx = cms.double(7.0), + ntmax = cms.int32(1000), + dpcoal = cms.double(1000000.0), + diquarkembedding = cms.int32(0), + maxmiss = cms.int32(1000), + ktkick = cms.int32(1), + mu = cms.double(3.2264), + quenchingpar = cms.double(2.0), + popcornpar = cms.double(1.0), + drcoal = cms.double(1000000.0), + amptmode = cms.int32(1), + izpc = cms.int32(0), + popcornmode = cms.bool(True), + minijetpt = cms.double(-7.0), + ks0decay = cms.bool(False), + alpha = cms.double(0.47140452), + dt = cms.double(0.2), + rotateEventPlane = cms.bool(True), + shadowingmode = cms.bool(True), + diquarkpy = cms.double(0.0), + deuteronfactor = cms.int32(5), + stringFragB = cms.double(0.9),#default value in Hijing. Good for pA + quenchingmode = cms.bool(False), + stringFragA = cms.double(0.5), + deuteronmode = cms.int32(0), + doInitialAndFinalRadiation = cms.int32(3), + phidecay = cms.bool(True), + deuteronxsec = cms.int32(1), + pthard = cms.double(2.0), + firstRun = cms.untracked.uint32(1), + frame = cms.string('CMS'), + targ = cms.string('P'), + izp = cms.int32(82), + bMin = cms.double(0), + firstEvent = cms.untracked.uint32(1), + izt = cms.int32(1), + proj = cms.string('A'), + comEnergy = cms.double(5020.0), + iat = cms.int32(1), + bMax = cms.double(15), + iap = cms.int32(208) +) + +from GeneratorInterface.Core.ExternalGeneratorFilter import ExternalGeneratorFilter +generator = ExternalGeneratorFilter(_generator) + +configurationMetadata = cms.untracked.PSet( + version = cms.untracked.string('$Revision$'), + name = cms.untracked.string('$Source$'), + annotation = cms.untracked.string('AMPT PPb 5020 GeV Minimum Bias') +) + diff --git a/Configuration/Generator/python/BsToMuMu_forSTEAM_13TeV_ExtGen_cfi.py b/Configuration/Generator/python/BsToMuMu_forSTEAM_13TeV_ExtGen_cfi.py new file mode 100644 index 0000000000000..936788c9dcd3e --- /dev/null +++ b/Configuration/Generator/python/BsToMuMu_forSTEAM_13TeV_ExtGen_cfi.py @@ -0,0 +1,68 @@ +import FWCore.ParameterSet.Config as cms +from Configuration.Generator.Pythia8CommonSettings_cfi import * +from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * +from GeneratorInterface.EvtGenInterface.EvtGenSetting_cff import * + +_generator = cms.EDFilter("Pythia8GeneratorFilter", + comEnergy = cms.double(13000.0), + crossSection = cms.untracked.double(54000000000), + filterEfficiency = cms.untracked.double(3.0e-4), + pythiaHepMCVerbosity = cms.untracked.bool(False), + maxEventsToPrint = cms.untracked.int32(0), + pythiaPylistVerbosity = cms.untracked.int32(0), + ExternalDecays = cms.PSet( + #using alternative name for decayer + EvtGen1 = cms.untracked.PSet( + #uses latest evt and decay tables from evtgen + decay_table = cms.string('GeneratorInterface/EvtGenInterface/data/DECAY_NOLONGLIFE.DEC'), + particle_property_file = cms.FileInPath('GeneratorInterface/EvtGenInterface/data/evt.pdl'), + convertPythiaCodes = cms.untracked.bool(False), + #here we will use the user.dec store in the release + user_decay_file = cms.vstring('GeneratorInterface/ExternalDecays/data/Bs_mumu.dec'), + list_forced_decays = cms.vstring('MyB_s0','Myanti-B_s0'), + operates_on_particles = cms.vint32() + ), + parameterSets = cms.vstring('EvtGen1') + ), + PythiaParameters = cms.PSet( + pythia8CommonSettingsBlock, + pythia8CP5SettingsBlock, + processParameters = cms.vstring( + #filter of a b-quark before hadronizing, and use a better data-like process + 'PTFilter:filter = on', + 'PTFilter:quarkToFilter = 5', + 'PTFilter:scaleToFilter = 1.0', + 'SoftQCD:nonDiffractive = on', + ), + parameterSets = cms.vstring('pythia8CommonSettings', + 'pythia8CP5Settings', + 'processParameters', + ) + ) +) + +from GeneratorInterface.Core.ExternalGeneratorFilter import ExternalGeneratorFilter +generator = ExternalGeneratorFilter(_generator) + +generator.PythiaParameters.processParameters.extend(EvtGenExtraParticles) + +MuMuFilter = cms.EDFilter("MCParticlePairFilter", + Status = cms.untracked.vint32(1, 1), + MinPt = cms.untracked.vdouble(3., 3.), + MaxEta = cms.untracked.vdouble(2.5, 2.5), + MinEta = cms.untracked.vdouble(-2.5, -2.5), + ParticleCharge = cms.untracked.int32(-1), + ParticleID1 = cms.untracked.vint32(13,-13), + ) + +# -- Require Muon from Bs +MuFilter = cms.EDFilter("PythiaFilter", + Status = cms.untracked.int32(1), + MotherID = cms.untracked.int32(531), + MinPt = cms.untracked.double(3.), + ParticleID = cms.untracked.int32(13), + MaxEta = cms.untracked.double(2.5), + MinEta = cms.untracked.double(-2.5) + ) + +ProductionFilterSequence = cms.Sequence(generator*MuMuFilter*MuFilter) diff --git a/Configuration/Generator/python/BuToJPsiPrimePhiToJPsiPiKK_14TeV_TuneCP5_pythia8_cfi.py b/Configuration/Generator/python/BuToJPsiPrimeKToJPsiPiPiK_14TeV_TuneCP5_pythia8_cfi.py similarity index 100% rename from Configuration/Generator/python/BuToJPsiPrimePhiToJPsiPiKK_14TeV_TuneCP5_pythia8_cfi.py rename to Configuration/Generator/python/BuToJPsiPrimeKToJPsiPiPiK_14TeV_TuneCP5_pythia8_cfi.py diff --git a/Configuration/Generator/python/BuToKstarJPsiToMuMu_forSTEAM_13TeV_ExtGen_cfi.py b/Configuration/Generator/python/BuToKstarJPsiToMuMu_forSTEAM_13TeV_ExtGen_cfi.py new file mode 100644 index 0000000000000..7960f0138482d --- /dev/null +++ b/Configuration/Generator/python/BuToKstarJPsiToMuMu_forSTEAM_13TeV_ExtGen_cfi.py @@ -0,0 +1,106 @@ +import FWCore.ParameterSet.Config as cms +from Configuration.Generator.Pythia8CommonSettings_cfi import * +from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * +from GeneratorInterface.EvtGenInterface.EvtGenSetting_cff import * + +_generator = cms.EDFilter("Pythia8GeneratorFilter", + pythiaPylistVerbosity = cms.untracked.int32(0), + pythiaHepMCVerbosity = cms.untracked.bool(False), + comEnergy = cms.double(13000.0), + maxEventsToPrint = cms.untracked.int32(0), + ExternalDecays = cms.PSet( + EvtGen130 = cms.untracked.PSet( + #uses latest evt and decay tables from evtgen + decay_table = cms.string('GeneratorInterface/EvtGenInterface/data/DECAY_NOLONGLIFE.DEC'), + particle_property_file = cms.FileInPath('GeneratorInterface/EvtGenInterface/data/evt.pdl'), + convertPythiaCodes = cms.untracked.bool(False), + #user_decay_file = cms.vstring('GeneratorInterface/ExternalDecays/data/Bu_Kstarmumu_Kspi.dec'), + #content was dump in the embed string below. This should test this feature. + list_forced_decays = cms.vstring('MyB+','MyB-'), + operates_on_particles = cms.vint32(), + user_decay_embedded= cms.vstring( + '# This is the decay file for the decay B+ -> MU+ MU- K*+(-> Ks pi+)', + '#', + '# Descriptor: [B+ -> mu+ mu- {,gamma} {,gamma} (K*+ -> Ks pi+)]cc', + '#', + '# NickName:', + '#', + '# Physics: Includes radiative mode', + '#', + '# Tested: Yes', + '# By: K. Ulmer', + '# Date: 2-26-08', + '#', + 'Alias MyB+ B+', + 'Alias MyB- B-', + 'ChargeConj MyB+ MyB-', + 'Alias MyK*+ K*+', + 'Alias MyK*- K*-', + 'ChargeConj MyK*+ MyK*-', + 'Alias MyK_S0 K_S0', + 'ChargeConj MyK_S0 MyK_S0', + '#', + 'Decay MyB+', + ' 1.000 MyK*+ mu+ mu- BTOSLLBALL;', + 'Enddecay', + 'CDecay MyB-', + '#', + 'Decay MyK*+', + ' 1.000 MyK_S0 pi+ VSS;', + 'Enddecay', + 'CDecay MyK*-', + '#', + 'Decay MyK_S0', + ' 1.000 pi+ pi- PHSP;', + 'Enddecay', + 'End' + ), + ), + parameterSets = cms.vstring('EvtGen130') + ), + PythiaParameters = cms.PSet( + pythia8CommonSettingsBlock, + pythia8CP5SettingsBlock, + processParameters = cms.vstring( + 'HardQCD:gg2bbbar = on ', + 'HardQCD:qqbar2bbbar = on ', + 'HardQCD:hardbbbar = on', + 'PhaseSpace:pTHatMin = 20.', + ), + parameterSets = cms.vstring('pythia8CommonSettings', + 'pythia8CP5Settings', + 'processParameters', + ) + ) + ) + +from GeneratorInterface.Core.ExternalGeneratorFilter import ExternalGeneratorFilter +generator = ExternalGeneratorFilter(_generator) + +generator.PythiaParameters.processParameters.extend(EvtGenExtraParticles) + +configurationMetadata = cms.untracked.PSet( + version = cms.untracked.string('$Revision: 1.1 $'), + name = cms.untracked.string('$Source: Configuration/Generator/python/BuToKstarMuMu_forSTEAM_13TeV_cfi.py $'), + annotation = cms.untracked.string('Summer14: Pythia8+EvtGen130 generation of Bu --> K* Mu+Mu-, 13TeV, Tune CP5') + ) + +########### +# Filters # +########### +# Filter only pp events which produce a B+: +bufilter = cms.EDFilter("PythiaFilter", ParticleID = cms.untracked.int32(521)) + +# Filter on final state muons +mumugenfilter = cms.EDFilter("MCParticlePairFilter", + Status = cms.untracked.vint32(1, 1), + MinPt = cms.untracked.vdouble(2.8, 2.8), + MinP = cms.untracked.vdouble(2.8, 2.8), + MaxEta = cms.untracked.vdouble(2.3, 2.3), + MinEta = cms.untracked.vdouble(-2.3, -2.3), + ParticleID1 = cms.untracked.vint32(13,-13), + ParticleID2 = cms.untracked.vint32(13,-13) + ) + + +ProductionFilterSequence = cms.Sequence(generator*bufilter*mumugenfilter) diff --git a/Configuration/Generator/python/BulkG_M1200_narrow_2L2Q_LHE_13TeV_cff.py b/Configuration/Generator/python/BulkG_M1200_narrow_2L2Q_LHE_13TeV_cff.py index 012fbd5cd4e4e..243ff1eb70539 100644 --- a/Configuration/Generator/python/BulkG_M1200_narrow_2L2Q_LHE_13TeV_cff.py +++ b/Configuration/Generator/python/BulkG_M1200_narrow_2L2Q_LHE_13TeV_cff.py @@ -10,5 +10,6 @@ nEvents = cms.untracked.uint32(5000), numberOfParameters = cms.uint32(1), outputFile = cms.string('cmsgrid_final.lhe'), - scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh') + scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh'), + generateConcurrently = cms.untracked.bool(True) ) diff --git a/Configuration/Generator/python/DYToLL_M-50_13TeV_pythia8_cff.py b/Configuration/Generator/python/DYToLL_M-50_13TeV_pythia8_cff.py index ad1ceb86cec57..40613ea13825b 100644 --- a/Configuration/Generator/python/DYToLL_M-50_13TeV_pythia8_cff.py +++ b/Configuration/Generator/python/DYToLL_M-50_13TeV_pythia8_cff.py @@ -5,7 +5,7 @@ -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", comEnergy = cms.double(13000.0), crossSection = cms.untracked.double(6.44), filterEfficiency = cms.untracked.double(1), diff --git a/Configuration/Generator/python/DYToLL_M-50_14TeV_pythia8_cff.py b/Configuration/Generator/python/DYToLL_M-50_14TeV_pythia8_cff.py index 2520f4ef884b5..0b101f26d9500 100644 --- a/Configuration/Generator/python/DYToLL_M-50_14TeV_pythia8_cff.py +++ b/Configuration/Generator/python/DYToLL_M-50_14TeV_pythia8_cff.py @@ -5,7 +5,7 @@ -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", comEnergy = cms.double(14000.0), crossSection = cms.untracked.double(6.44), filterEfficiency = cms.untracked.double(1), diff --git a/Configuration/Generator/python/DYToll012Jets_5f_LO_MLM_Madgraph_LHE_13TeV_cff.py b/Configuration/Generator/python/DYToll012Jets_5f_LO_MLM_Madgraph_LHE_13TeV_cff.py index 67fdc7fd16773..5a8ce265714e6 100644 --- a/Configuration/Generator/python/DYToll012Jets_5f_LO_MLM_Madgraph_LHE_13TeV_cff.py +++ b/Configuration/Generator/python/DYToll012Jets_5f_LO_MLM_Madgraph_LHE_13TeV_cff.py @@ -5,5 +5,6 @@ outputFile = cms.string("cmsgrid_final.lhe"), numberOfParameters = cms.uint32(4), args = cms.vstring('/cvmfs/cms.cern.ch/phys_generator/gridpacks/UL/13TeV/madgraph/V5_2.6.5/dyellell012j_5f_LO_MLM/dyellell012j_5f_LO_MLM_slc6_amd64_gcc630_CMSSW_9_3_16_tarball.tar.xz','false','slc6_amd64_gcc630','CMSSW_9_3_16'), - nEvents = cms.untracked.uint32(10) + nEvents = cms.untracked.uint32(10), + generateConcurrently = cms.untracked.bool(True) ) diff --git a/Configuration/Generator/python/DarkSUSY_mH_125_mN1_60_mGammaD_10_cT_10_Madgraph_LHE_13TeV_cfi.py b/Configuration/Generator/python/DarkSUSY_mH_125_mN1_60_mGammaD_10_cT_10_Madgraph_LHE_13TeV_cfi.py index 26a43f44634af..4fc71bdfcbcdf 100644 --- a/Configuration/Generator/python/DarkSUSY_mH_125_mN1_60_mGammaD_10_cT_10_Madgraph_LHE_13TeV_cfi.py +++ b/Configuration/Generator/python/DarkSUSY_mH_125_mN1_60_mGammaD_10_cT_10_Madgraph_LHE_13TeV_cfi.py @@ -5,7 +5,8 @@ nEvents = cms.untracked.uint32(5000), numberOfParameters = cms.uint32(1), outputFile = cms.string('cmsgrid_final.lhe'), - scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh') + scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh'), + generateConcurrently = cms.untracked.bool(True) ) #Link to datacards: diff --git a/Configuration/Generator/python/DisplacedSUSY_stopToBottom_M_300_1000mm_TuneCUETP8M1_13TeV_pythia8_cff.py b/Configuration/Generator/python/DisplacedSUSY_stopToBottom_M_300_1000mm_TuneCUETP8M1_13TeV_pythia8_cff.py index 064453f26450b..2dad86ae027a4 100644 --- a/Configuration/Generator/python/DisplacedSUSY_stopToBottom_M_300_1000mm_TuneCUETP8M1_13TeV_pythia8_cff.py +++ b/Configuration/Generator/python/DisplacedSUSY_stopToBottom_M_300_1000mm_TuneCUETP8M1_13TeV_pythia8_cff.py @@ -757,7 +757,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/DisplacedSUSY_stopToBottom_M_800_500mm_TuneCP5_13TeV_pythia8_cff.py b/Configuration/Generator/python/DisplacedSUSY_stopToBottom_M_800_500mm_TuneCP5_13TeV_pythia8_cff.py index cf7e9ec6f0473..ad9f657e7462d 100644 --- a/Configuration/Generator/python/DisplacedSUSY_stopToBottom_M_800_500mm_TuneCP5_13TeV_pythia8_cff.py +++ b/Configuration/Generator/python/DisplacedSUSY_stopToBottom_M_800_500mm_TuneCP5_13TeV_pythia8_cff.py @@ -758,7 +758,7 @@ from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * from Configuration.Generator.PSweightsPythia.PythiaPSweightsSettings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/DisplacedSUSY_stopToBottom_M_800_500mm_TuneCP5_14TeV_pythia8_cff.py b/Configuration/Generator/python/DisplacedSUSY_stopToBottom_M_800_500mm_TuneCP5_14TeV_pythia8_cff.py index d52aec8471eb3..8eecd4c64736a 100644 --- a/Configuration/Generator/python/DisplacedSUSY_stopToBottom_M_800_500mm_TuneCP5_14TeV_pythia8_cff.py +++ b/Configuration/Generator/python/DisplacedSUSY_stopToBottom_M_800_500mm_TuneCP5_14TeV_pythia8_cff.py @@ -758,7 +758,7 @@ from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * from Configuration.Generator.PSweightsPythia.PythiaPSweightsSettings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/EtaBToJpsiJpsi_14TeV_TuneCP5_pythia8_cfi.py b/Configuration/Generator/python/EtaBToJpsiJpsi_14TeV_TuneCP5_pythia8_cfi.py index f49837db3d6fe..92f6cdec4da68 100644 --- a/Configuration/Generator/python/EtaBToJpsiJpsi_14TeV_TuneCP5_pythia8_cfi.py +++ b/Configuration/Generator/python/EtaBToJpsiJpsi_14TeV_TuneCP5_pythia8_cfi.py @@ -3,7 +3,7 @@ from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * from GeneratorInterface.EvtGenInterface.EvtGenSetting_cff import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", maxEventsToPrint = cms.untracked.int32(1), pythiaPylistVerbosity = cms.untracked.int32(1), filterEfficiency = cms.untracked.double(0.4045), diff --git a/Configuration/Generator/python/EtaBToJpsiJpsi_forSTEAM_TuneCUEP8M1_13TeV_cfi.py b/Configuration/Generator/python/EtaBToJpsiJpsi_forSTEAM_TuneCUEP8M1_13TeV_cfi.py index 1f887fc068ed4..8b827afd949a7 100644 --- a/Configuration/Generator/python/EtaBToJpsiJpsi_forSTEAM_TuneCUEP8M1_13TeV_cfi.py +++ b/Configuration/Generator/python/EtaBToJpsiJpsi_forSTEAM_TuneCUEP8M1_13TeV_cfi.py @@ -2,7 +2,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", maxEventsToPrint = cms.untracked.int32(1), pythiaPylistVerbosity = cms.untracked.int32(1), filterEfficiency = cms.untracked.double(1.0), diff --git a/Configuration/Generator/python/GGHZZ4L_JHUGen_Pow_NNPDF30_LHE_13TeV_cff.py b/Configuration/Generator/python/GGHZZ4L_JHUGen_Pow_NNPDF30_LHE_13TeV_cff.py index 256dad0eef046..d146b81a64f0b 100644 --- a/Configuration/Generator/python/GGHZZ4L_JHUGen_Pow_NNPDF30_LHE_13TeV_cff.py +++ b/Configuration/Generator/python/GGHZZ4L_JHUGen_Pow_NNPDF30_LHE_13TeV_cff.py @@ -9,6 +9,7 @@ nEvents = cms.untracked.uint32(5000), numberOfParameters = cms.uint32(1), outputFile = cms.string('cmsgrid_final.lhe'), - scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh') + scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh'), + generateConcurrently = cms.untracked.bool(True) ) diff --git a/Configuration/Generator/python/GGHZZ4L_JHUGen_Pow_NNPDF30_LHE_13TeV_cfi.py b/Configuration/Generator/python/GGHZZ4L_JHUGen_Pow_NNPDF30_LHE_13TeV_cfi.py index be19bfb780025..3fbff127b2a35 100644 --- a/Configuration/Generator/python/GGHZZ4L_JHUGen_Pow_NNPDF30_LHE_13TeV_cfi.py +++ b/Configuration/Generator/python/GGHZZ4L_JHUGen_Pow_NNPDF30_LHE_13TeV_cfi.py @@ -12,7 +12,8 @@ nEvents = cms.untracked.uint32(5000), numberOfParameters = cms.uint32(1), outputFile = cms.string('cmsgrid_final.lhe'), - scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh') + scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh'), + generateConcurrently = cms.untracked.bool(True) ) diff --git a/Configuration/Generator/python/GGToHtautau_13TeV_pythia8_cff.py b/Configuration/Generator/python/GGToHtautau_13TeV_pythia8_cff.py index 6f2110b9288e7..489ae93671bbe 100644 --- a/Configuration/Generator/python/GGToHtautau_13TeV_pythia8_cff.py +++ b/Configuration/Generator/python/GGToHtautau_13TeV_pythia8_cff.py @@ -5,7 +5,7 @@ -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", comEnergy = cms.double(13000.0), crossSection = cms.untracked.double(6.44), filterEfficiency = cms.untracked.double(1), diff --git a/Configuration/Generator/python/GGToHtautau_13TeV_pythia8_taupinu_cff.py b/Configuration/Generator/python/GGToHtautau_13TeV_pythia8_taupinu_cff.py index 3fb6ee3d3ed90..003623718f3ce 100644 --- a/Configuration/Generator/python/GGToHtautau_13TeV_pythia8_taupinu_cff.py +++ b/Configuration/Generator/python/GGToHtautau_13TeV_pythia8_taupinu_cff.py @@ -2,7 +2,7 @@ -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", comEnergy = cms.double(13000.0), crossSection = cms.untracked.double(6.44), filterEfficiency = cms.untracked.double(1), diff --git a/Configuration/Generator/python/GGToHtautau_13TeV_pythia8_taurhonu_cff.py b/Configuration/Generator/python/GGToHtautau_13TeV_pythia8_taurhonu_cff.py index c71ae928fabbd..414a5e5752cac 100644 --- a/Configuration/Generator/python/GGToHtautau_13TeV_pythia8_taurhonu_cff.py +++ b/Configuration/Generator/python/GGToHtautau_13TeV_pythia8_taurhonu_cff.py @@ -5,7 +5,7 @@ -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", comEnergy = cms.double(13000.0), crossSection = cms.untracked.double(6.44), filterEfficiency = cms.untracked.double(1), diff --git a/Configuration/Generator/python/H125GGgluonfusion_13TeV_TuneCP5_cfi.py b/Configuration/Generator/python/H125GGgluonfusion_13TeV_TuneCP5_cfi.py index e5d363e086885..0a80b1448b316 100644 --- a/Configuration/Generator/python/H125GGgluonfusion_13TeV_TuneCP5_cfi.py +++ b/Configuration/Generator/python/H125GGgluonfusion_13TeV_TuneCP5_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(1), # put here the efficiency of your filter (1. if no filter) filterEfficiency = cms.untracked.double(1.0), diff --git a/Configuration/Generator/python/H125GGgluonfusion_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/H125GGgluonfusion_13TeV_TuneCUETP8M1_cfi.py index e74b47238fa93..591f44f70fa17 100644 --- a/Configuration/Generator/python/H125GGgluonfusion_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/H125GGgluonfusion_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(1), # put here the efficiency of your filter (1. if no filter) filterEfficiency = cms.untracked.double(1.0), diff --git a/Configuration/Generator/python/H125GGgluonfusion_14TeV_TuneCP5_cfi.py b/Configuration/Generator/python/H125GGgluonfusion_14TeV_TuneCP5_cfi.py index b2dd1adfb5837..d7b1e94280a1b 100644 --- a/Configuration/Generator/python/H125GGgluonfusion_14TeV_TuneCP5_cfi.py +++ b/Configuration/Generator/python/H125GGgluonfusion_14TeV_TuneCP5_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(1), # put here the efficiency of your filter (1. if no filter) filterEfficiency = cms.untracked.double(1.0), diff --git a/Configuration/Generator/python/H125GGgluonfusion_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/H125GGgluonfusion_14TeV_TuneCUETP8M1_cfi.py index 263fb35457362..bd7a95fe62a65 100644 --- a/Configuration/Generator/python/H125GGgluonfusion_14TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/H125GGgluonfusion_14TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(1), # put here the efficiency of your filter (1. if no filter) filterEfficiency = cms.untracked.double(1.0), diff --git a/Configuration/Generator/python/H130GGgluonfusion_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/H130GGgluonfusion_14TeV_TuneCUETP8M1_cfi.py index 904e8c2bb288b..fdbbed9c735da 100644 --- a/Configuration/Generator/python/H130GGgluonfusion_14TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/H130GGgluonfusion_14TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(1), # put here the efficiency of your filter (1. if no filter) filterEfficiency = cms.untracked.double(1.0), diff --git a/Configuration/Generator/python/H130GGgluonfusion_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/H130GGgluonfusion_8TeV_TuneCUETP8M1_cfi.py index 4c5e9b3f70022..0857d444b9873 100644 --- a/Configuration/Generator/python/H130GGgluonfusion_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/H130GGgluonfusion_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(1), # put here the efficiency of your filter (1. if no filter) filterEfficiency = cms.untracked.double(1.0), diff --git a/Configuration/Generator/python/H165WW2L_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/H165WW2L_8TeV_TuneCUETP8M1_cfi.py index 9501fc5739225..d7413e709270f 100644 --- a/Configuration/Generator/python/H165WW2L_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/H165WW2L_8TeV_TuneCUETP8M1_cfi.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(1), # put here the efficiency of your filter (1. if no filter) filterEfficiency = cms.untracked.double(1.0), diff --git a/Configuration/Generator/python/H200ZZ4L_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/H200ZZ4L_13TeV_TuneCUETP8M1_cfi.py index 6c163d1ab2b56..7761c64b0e97f 100644 --- a/Configuration/Generator/python/H200ZZ4L_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/H200ZZ4L_13TeV_TuneCUETP8M1_cfi.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/H200ZZ4L_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/H200ZZ4L_8TeV_TuneCUETP8M1_cfi.py index 6de3fd6100542..61746ac6f07aa 100644 --- a/Configuration/Generator/python/H200ZZ4L_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/H200ZZ4L_8TeV_TuneCUETP8M1_cfi.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/HSCPstop_M_200_TuneCUETP8M1_13TeV_pythia8_cff.py b/Configuration/Generator/python/HSCPstop_M_200_TuneCUETP8M1_13TeV_pythia8_cff.py index 14dc17a365e82..96100a86ed019 100644 --- a/Configuration/Generator/python/HSCPstop_M_200_TuneCUETP8M1_13TeV_pythia8_cff.py +++ b/Configuration/Generator/python/HSCPstop_M_200_TuneCUETP8M1_13TeV_pythia8_cff.py @@ -12,7 +12,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(-1), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/Hydjet_Quenched_B12_5020GeV_ExtGen_cfi.py b/Configuration/Generator/python/Hydjet_Quenched_B12_5020GeV_ExtGen_cfi.py new file mode 100644 index 0000000000000..b4d10b568aae7 --- /dev/null +++ b/Configuration/Generator/python/Hydjet_Quenched_B12_5020GeV_ExtGen_cfi.py @@ -0,0 +1,31 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Generator.Pyquen2015Settings_cff import * + +_generator = cms.EDFilter("HydjetGeneratorFilter", + collisionParameters5020GeV, + qgpParameters, + hydjetParameters, + hydjetMode = cms.string('kHydroQJets'), + PythiaParameters = cms.PSet(pyquenPythiaDefaultBlock, + # Quarkonia and Weak Bosons added back upon dilepton group's request. + parameterSets = cms.vstring('pythiaUESettings', + 'hydjetPythiaDefault', + 'myParameters', + 'pythiaJets', + 'pythiaPromptPhotons', + 'pythiaZjets', + 'pythiaBottomoniumNRQCD', + 'pythiaCharmoniumNRQCD', + 'pythiaQuarkoniaSettings', + 'pythiaWeakBosons' + ) + ), + cFlag = cms.int32(0), + bMin = cms.double(0), + bMax = cms.double(30), + bFixed = cms.double(12) + ) + +from GeneratorInterface.Core.ExternalGeneratorFilter import ExternalGeneratorFilter +generator = ExternalGeneratorFilter(_generator) \ No newline at end of file diff --git a/Configuration/Generator/python/InclusiveppMuX_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/InclusiveppMuX_8TeV_TuneCUETP8M1_cfi.py index 8e3920ccc6f60..e676c404a675a 100644 --- a/Configuration/Generator/python/InclusiveppMuX_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/InclusiveppMuX_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/JpsiMM_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/JpsiMM_13TeV_TuneCUETP8M1_cfi.py index 37f34a5e24dbb..739a214f521bb 100644 --- a/Configuration/Generator/python/JpsiMM_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/JpsiMM_13TeV_TuneCUETP8M1_cfi.py @@ -3,7 +3,7 @@ from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * from Configuration.Generator.Pythia8CharmoniumSettings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(0.138), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/JpsiMM_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/JpsiMM_14TeV_TuneCUETP8M1_cfi.py index 522ad64501344..cd04ad09e8f91 100644 --- a/Configuration/Generator/python/JpsiMM_14TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/JpsiMM_14TeV_TuneCUETP8M1_cfi.py @@ -3,7 +3,7 @@ from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * from Configuration.Generator.Pythia8CharmoniumSettings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(0.138), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/JpsiMM_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/JpsiMM_8TeV_TuneCUETP8M1_cfi.py index 497077b280fa7..7b175bfbd862d 100644 --- a/Configuration/Generator/python/JpsiMM_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/JpsiMM_8TeV_TuneCUETP8M1_cfi.py @@ -3,7 +3,7 @@ from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * from Configuration.Generator.Pythia8CharmoniumSettings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(0.138), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/JpsiMM_Pt_20_inf_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/JpsiMM_Pt_20_inf_8TeV_TuneCUETP8M1_cfi.py index f04318bc903ef..cc22060b845d3 100644 --- a/Configuration/Generator/python/JpsiMM_Pt_20_inf_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/JpsiMM_Pt_20_inf_8TeV_TuneCUETP8M1_cfi.py @@ -3,7 +3,7 @@ from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * from Configuration.Generator.Pythia8CharmoniumSettings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(0.0154), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/JpsiMuMu_Pt-8_forSTEAM_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/JpsiMuMu_Pt-8_forSTEAM_13TeV_TuneCUETP8M1_cfi.py index 710707e361f0f..e6a59e1c47c67 100644 --- a/Configuration/Generator/python/JpsiMuMu_Pt-8_forSTEAM_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/JpsiMuMu_Pt-8_forSTEAM_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(0.026), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/MinBias_13TeV_pythia8_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/MinBias_13TeV_pythia8_TuneCUETP8M1_cfi.py index dd9253e4549f7..47377fc1bc40d 100644 --- a/Configuration/Generator/python/MinBias_13TeV_pythia8_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/MinBias_13TeV_pythia8_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", crossSection = cms.untracked.double(71.39e+09), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/MinBias_13TeV_pythia8_cff.py b/Configuration/Generator/python/MinBias_13TeV_pythia8_cff.py index e047804ebbbb8..44dc2213ffbb3 100644 --- a/Configuration/Generator/python/MinBias_13TeV_pythia8_cff.py +++ b/Configuration/Generator/python/MinBias_13TeV_pythia8_cff.py @@ -5,7 +5,7 @@ -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", crossSection = cms.untracked.double(71.39e+09), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/MinBias_14TeV_pythia8_TuneCP5_cfi.py b/Configuration/Generator/python/MinBias_14TeV_pythia8_TuneCP5_cfi.py index 75cfa58f7b907..9fbc560e7b5ee 100644 --- a/Configuration/Generator/python/MinBias_14TeV_pythia8_TuneCP5_cfi.py +++ b/Configuration/Generator/python/MinBias_14TeV_pythia8_TuneCP5_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", crossSection = cms.untracked.double(71.39e+09), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/MinBias_14TeV_pythia8_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/MinBias_14TeV_pythia8_TuneCUETP8M1_cfi.py index 0667e1bebb2e0..a721d0a43c162 100644 --- a/Configuration/Generator/python/MinBias_14TeV_pythia8_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/MinBias_14TeV_pythia8_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", crossSection = cms.untracked.double(71.39e+09), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/MinBias_8TeV_pythia8_TuneCUETP8M1_cff.py b/Configuration/Generator/python/MinBias_8TeV_pythia8_TuneCUETP8M1_cff.py index d47b0715a38b9..310ffd0fa7484 100644 --- a/Configuration/Generator/python/MinBias_8TeV_pythia8_TuneCUETP8M1_cff.py +++ b/Configuration/Generator/python/MinBias_8TeV_pythia8_TuneCUETP8M1_cff.py @@ -5,7 +5,7 @@ -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", crossSection = cms.untracked.double(71.39e+09), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/MinBias_TuneCUETP8M1_13TeV_pythia8_cff.py b/Configuration/Generator/python/MinBias_TuneCUETP8M1_13TeV_pythia8_cff.py index b416e2ed685ff..ffaaab9e6cc0e 100644 --- a/Configuration/Generator/python/MinBias_TuneCUETP8M1_13TeV_pythia8_cff.py +++ b/Configuration/Generator/python/MinBias_TuneCUETP8M1_13TeV_pythia8_cff.py @@ -3,7 +3,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", maxEventsToPrint = cms.untracked.int32(1), pythiaPylistVerbosity = cms.untracked.int32(1), filterEfficiency = cms.untracked.double(1.0), diff --git a/Configuration/Generator/python/PYTHIA8_PhiToMuMu_TuneCUETP8M1_13TeV_cff.py b/Configuration/Generator/python/PYTHIA8_PhiToMuMu_TuneCUETP8M1_13TeV_cff.py index 88fd27297769b..744af2ad59184 100644 --- a/Configuration/Generator/python/PYTHIA8_PhiToMuMu_TuneCUETP8M1_13TeV_cff.py +++ b/Configuration/Generator/python/PYTHIA8_PhiToMuMu_TuneCUETP8M1_13TeV_cff.py @@ -3,7 +3,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", maxEventsToPrint = cms.untracked.int32(1), pythiaPylistVerbosity = cms.untracked.int32(1), filterEfficiency = cms.untracked.double(1.0), diff --git a/Configuration/Generator/python/PhotonJet_Pt_10_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/PhotonJet_Pt_10_13TeV_TuneCUETP8M1_cfi.py index 23c3d97b31e7a..5f72f55ea2ffd 100644 --- a/Configuration/Generator/python/PhotonJet_Pt_10_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/PhotonJet_Pt_10_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/PhotonJet_Pt_10_14TeV_TuneCP5_cfi.py b/Configuration/Generator/python/PhotonJet_Pt_10_14TeV_TuneCP5_cfi.py index f4725c67d460e..d2e47ff6686b9 100644 --- a/Configuration/Generator/python/PhotonJet_Pt_10_14TeV_TuneCP5_cfi.py +++ b/Configuration/Generator/python/PhotonJet_Pt_10_14TeV_TuneCP5_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/PhotonJet_Pt_10_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/PhotonJet_Pt_10_14TeV_TuneCUETP8M1_cfi.py index f729ee85fe98c..abbe8efadae4e 100644 --- a/Configuration/Generator/python/PhotonJet_Pt_10_14TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/PhotonJet_Pt_10_14TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/PhotonJet_Pt_10_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/PhotonJet_Pt_10_8TeV_TuneCUETP8M1_cfi.py index 5472a330b7e4a..03826a60529c2 100644 --- a/Configuration/Generator/python/PhotonJet_Pt_10_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/PhotonJet_Pt_10_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/Psi2SToJPsiPiPi_14TeV_TuneCP5_pythia8_cfi.py b/Configuration/Generator/python/Psi2SToJPsiPiPi_14TeV_TuneCP5_pythia8_cfi.py index 03b89fe9f385e..5349fbdc0af3a 100644 --- a/Configuration/Generator/python/Psi2SToJPsiPiPi_14TeV_TuneCP5_pythia8_cfi.py +++ b/Configuration/Generator/python/Psi2SToJPsiPiPi_14TeV_TuneCP5_pythia8_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/Pyquen_ZeemumuJets_pt10_2760GeV_ExtGen_cfi.py b/Configuration/Generator/python/Pyquen_ZeemumuJets_pt10_2760GeV_ExtGen_cfi.py new file mode 100644 index 0000000000000..b81f6578e004a --- /dev/null +++ b/Configuration/Generator/python/Pyquen_ZeemumuJets_pt10_2760GeV_ExtGen_cfi.py @@ -0,0 +1,36 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Generator.PyquenDefaultSettings_cff import * + +_generator = cms.EDFilter("PyquenGeneratorFilter", + collisionParameters, + qgpParameters, + pyquenParameters, + doQuench = cms.bool(True), + bFixed = cms.double(0.0), ## fixed impact param (fm); valid only if cflag_=0 + PythiaParameters = cms.PSet(pyquenPythiaDefaultBlock, + parameterSets = cms.vstring('pythiaUESettings','customProcesses','pythiaZjets','pythiaZtoMuonsAndElectrons','kinematics'), + kinematics = cms.vstring ("CKIN(3)=10", #min pthat + "CKIN(4)=9999", #max pthat + "CKIN(7)=-2.", #min rapidity + "CKIN(8)=2." #max rapidity + ) + + ), + cFlag = cms.int32(0), ## centrality flag + bMin = cms.double(0.0), ## min impact param (fm); valid only if cflag_!=0 + bMax = cms.double(0.0) ## max impact param (fm); valid only if cflag_!=0 + ) + +from GeneratorInterface.Core.ExternalGeneratorFilter import ExternalGeneratorFilter +generator = ExternalGeneratorFilter(_generator) + +_generator.embeddingMode = False + +configurationMetadata = cms.untracked.PSet( + version = cms.untracked.string('$Revision: 1.3 $'), + name = cms.untracked.string('$Source: /local/projects/CMSSW/rep/CMSSW/Configuration/Generator/python/Pyquen_ZeemumuJets_pt10_2760GeV_cfi.py,v $'), + annotation = cms.untracked.string('PYQUEN Z->mumu and Z->ee (pt-hat > 10 GeV) at sqrt(s) = 2.76TeV') + ) + +ProductionFilterSequence = cms.Sequence(generator) diff --git a/Configuration/Generator/python/Pythia8_PhotonJetpt15_20_10TeV_cff.py b/Configuration/Generator/python/Pythia8_PhotonJetpt15_20_10TeV_cff.py index d3d387cf9cfa9..45958f49988f3 100644 --- a/Configuration/Generator/python/Pythia8_PhotonJetpt15_20_10TeV_cff.py +++ b/Configuration/Generator/python/Pythia8_PhotonJetpt15_20_10TeV_cff.py @@ -2,7 +2,7 @@ ##from Configuration.Generator.PythiaUESettings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/QCDForPF_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QCDForPF_13TeV_TuneCUETP8M1_cfi.py index 2f0376ee68e23..083c006ba80a7 100644 --- a/Configuration/Generator/python/QCDForPF_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QCDForPF_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/QCDForPF_14TeV_TuneCP5_cfi.py b/Configuration/Generator/python/QCDForPF_14TeV_TuneCP5_cfi.py index 68a3f3f890540..a29ebc25467dc 100644 --- a/Configuration/Generator/python/QCDForPF_14TeV_TuneCP5_cfi.py +++ b/Configuration/Generator/python/QCDForPF_14TeV_TuneCP5_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/QCDForPF_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QCDForPF_14TeV_TuneCUETP8M1_cfi.py index 646c726cd429d..6ad025942a5af 100644 --- a/Configuration/Generator/python/QCDForPF_14TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QCDForPF_14TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/QCDForPF_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QCDForPF_8TeV_TuneCUETP8M1_cfi.py index 6345fd177f2b4..401d87ff95ce6 100644 --- a/Configuration/Generator/python/QCDForPF_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QCDForPF_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/QCD_Pt-15To7000_TuneCUETP8M1_Flat_14TeV-pythia8_cff.py b/Configuration/Generator/python/QCD_Pt-15To7000_TuneCUETP8M1_Flat_14TeV-pythia8_cff.py index b891f4b97e3fe..0e2b075b24a65 100644 --- a/Configuration/Generator/python/QCD_Pt-15To7000_TuneCUETP8M1_Flat_14TeV-pythia8_cff.py +++ b/Configuration/Generator/python/QCD_Pt-15To7000_TuneCUETP8M1_Flat_14TeV-pythia8_cff.py @@ -4,7 +4,7 @@ from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", comEnergy = cms.double(14000.0), crossSection = cms.untracked.double(2.0221e+09), filterEfficiency = cms.untracked.double(1.0), diff --git a/Configuration/Generator/python/QCD_Pt-20toInf_MuEnrichedPt15_TuneCUETP8M1_13TeV_pythia8_cff.py b/Configuration/Generator/python/QCD_Pt-20toInf_MuEnrichedPt15_TuneCUETP8M1_13TeV_pythia8_cff.py index 7ca22905e2e7c..68c1432259061 100644 --- a/Configuration/Generator/python/QCD_Pt-20toInf_MuEnrichedPt15_TuneCUETP8M1_13TeV_pythia8_cff.py +++ b/Configuration/Generator/python/QCD_Pt-20toInf_MuEnrichedPt15_TuneCUETP8M1_13TeV_pythia8_cff.py @@ -3,7 +3,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", maxEventsToPrint = cms.untracked.int32(1), pythiaPylistVerbosity = cms.untracked.int32(1), filterEfficiency = cms.untracked.double(0.00042), diff --git a/Configuration/Generator/python/QCD_Pt-20toInf_MuEnrichedPt15_TuneCUETP8M1_14TeV_pythia8_cff.py b/Configuration/Generator/python/QCD_Pt-20toInf_MuEnrichedPt15_TuneCUETP8M1_14TeV_pythia8_cff.py index 951546046d24d..a24d3ecfea70a 100644 --- a/Configuration/Generator/python/QCD_Pt-20toInf_MuEnrichedPt15_TuneCUETP8M1_14TeV_pythia8_cff.py +++ b/Configuration/Generator/python/QCD_Pt-20toInf_MuEnrichedPt15_TuneCUETP8M1_14TeV_pythia8_cff.py @@ -3,7 +3,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", maxEventsToPrint = cms.untracked.int32(1), pythiaPylistVerbosity = cms.untracked.int32(1), filterEfficiency = cms.untracked.double(0.00042), diff --git a/Configuration/Generator/python/QCD_Pt15To7000_Flat_14TeV_TuneCP5_cff.py b/Configuration/Generator/python/QCD_Pt15To7000_Flat_14TeV_TuneCP5_cff.py index 60a038e4be76c..1a0136de21ddf 100644 --- a/Configuration/Generator/python/QCD_Pt15To7000_Flat_14TeV_TuneCP5_cff.py +++ b/Configuration/Generator/python/QCD_Pt15To7000_Flat_14TeV_TuneCP5_cff.py @@ -4,7 +4,7 @@ from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", comEnergy = cms.double(14000.0), crossSection = cms.untracked.double(2.0221e+09), filterEfficiency = cms.untracked.double(1.0), diff --git a/Configuration/Generator/python/QCD_Pt20toInf_MuEnrichedPt15_14TeV_TuneCP5_cff.py b/Configuration/Generator/python/QCD_Pt20toInf_MuEnrichedPt15_14TeV_TuneCP5_cff.py index 36d1e912bf0df..db66cd4bd43c3 100644 --- a/Configuration/Generator/python/QCD_Pt20toInf_MuEnrichedPt15_14TeV_TuneCP5_cff.py +++ b/Configuration/Generator/python/QCD_Pt20toInf_MuEnrichedPt15_14TeV_TuneCP5_cff.py @@ -3,7 +3,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", maxEventsToPrint = cms.untracked.int32(1), pythiaPylistVerbosity = cms.untracked.int32(1), filterEfficiency = cms.untracked.double(0.00042), diff --git a/Configuration/Generator/python/QCD_Pt_120_170_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QCD_Pt_120_170_13TeV_TuneCUETP8M1_cfi.py index f6fa34c97571c..d28901a35cdfe 100644 --- a/Configuration/Generator/python/QCD_Pt_120_170_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QCD_Pt_120_170_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/QCD_Pt_120_170_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QCD_Pt_120_170_8TeV_TuneCUETP8M1_cfi.py index 7755b29b155f0..e8a30864b74bb 100644 --- a/Configuration/Generator/python/QCD_Pt_120_170_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QCD_Pt_120_170_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/QCD_Pt_15_20_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QCD_Pt_15_20_8TeV_TuneCUETP8M1_cfi.py index 78f774d7e8c7c..954c3996af69f 100644 --- a/Configuration/Generator/python/QCD_Pt_15_20_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QCD_Pt_15_20_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/QCD_Pt_170_230_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QCD_Pt_170_230_8TeV_TuneCUETP8M1_cfi.py index 831b40da414d5..1c3f52e0ce89f 100644 --- a/Configuration/Generator/python/QCD_Pt_170_230_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QCD_Pt_170_230_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/QCD_Pt_1800_2400_13TeV_TuneCP5_cfi.py b/Configuration/Generator/python/QCD_Pt_1800_2400_13TeV_TuneCP5_cfi.py index a622e9c1ab058..c19ae06f8e454 100644 --- a/Configuration/Generator/python/QCD_Pt_1800_2400_13TeV_TuneCP5_cfi.py +++ b/Configuration/Generator/python/QCD_Pt_1800_2400_13TeV_TuneCP5_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/QCD_Pt_1800_2400_14TeV_TuneCP5_cfi.py b/Configuration/Generator/python/QCD_Pt_1800_2400_14TeV_TuneCP5_cfi.py index 91afc5d319358..f75b98564bb5b 100644 --- a/Configuration/Generator/python/QCD_Pt_1800_2400_14TeV_TuneCP5_cfi.py +++ b/Configuration/Generator/python/QCD_Pt_1800_2400_14TeV_TuneCP5_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/QCD_Pt_20_30_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QCD_Pt_20_30_8TeV_TuneCUETP8M1_cfi.py index 4e9025a6aac5a..c0837c6eb2e59 100644 --- a/Configuration/Generator/python/QCD_Pt_20_30_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QCD_Pt_20_30_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/QCD_Pt_3000_3500_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QCD_Pt_3000_3500_13TeV_TuneCUETP8M1_cfi.py index 38c6aaab7d074..b27ee99ff3d5c 100644 --- a/Configuration/Generator/python/QCD_Pt_3000_3500_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QCD_Pt_3000_3500_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/QCD_Pt_3000_3500_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QCD_Pt_3000_3500_14TeV_TuneCUETP8M1_cfi.py index e09e7383534ca..f72a41c562cc6 100644 --- a/Configuration/Generator/python/QCD_Pt_3000_3500_14TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QCD_Pt_3000_3500_14TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/QCD_Pt_3000_3500_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QCD_Pt_3000_3500_8TeV_TuneCUETP8M1_cfi.py index 46330e955246d..f6af723433716 100644 --- a/Configuration/Generator/python/QCD_Pt_3000_3500_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QCD_Pt_3000_3500_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/QCD_Pt_30_13TeV_pythia8_cff.py b/Configuration/Generator/python/QCD_Pt_30_13TeV_pythia8_cff.py index d9898f05e7ceb..4be3beb69f78a 100644 --- a/Configuration/Generator/python/QCD_Pt_30_13TeV_pythia8_cff.py +++ b/Configuration/Generator/python/QCD_Pt_30_13TeV_pythia8_cff.py @@ -5,7 +5,7 @@ -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", crossSection = cms.untracked.double(5.72e+07), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/QCD_Pt_30_50_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QCD_Pt_30_50_13TeV_TuneCUETP8M1_cfi.py index a306aedc54a43..c2eb43bcb32e7 100644 --- a/Configuration/Generator/python/QCD_Pt_30_50_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QCD_Pt_30_50_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/QCD_Pt_30_50_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QCD_Pt_30_50_8TeV_TuneCUETP8M1_cfi.py index cccadc7516c0e..e7d358a710b50 100644 --- a/Configuration/Generator/python/QCD_Pt_30_50_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QCD_Pt_30_50_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/QCD_Pt_30_80_BCtoE_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QCD_Pt_30_80_BCtoE_8TeV_TuneCUETP8M1_cfi.py index 1bbf55b643ffa..06f269ebe4bda 100644 --- a/Configuration/Generator/python/QCD_Pt_30_80_BCtoE_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QCD_Pt_30_80_BCtoE_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/QCD_Pt_50_80_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QCD_Pt_50_80_8TeV_TuneCUETP8M1_cfi.py index 9101d03939f84..573be5b005cde 100644 --- a/Configuration/Generator/python/QCD_Pt_50_80_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QCD_Pt_50_80_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/QCD_Pt_600_800_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QCD_Pt_600_800_13TeV_TuneCUETP8M1_cfi.py index 3609adc003fb1..e429c3030623e 100644 --- a/Configuration/Generator/python/QCD_Pt_600_800_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QCD_Pt_600_800_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/QCD_Pt_600_800_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QCD_Pt_600_800_14TeV_TuneCUETP8M1_cfi.py index f10b163c66827..c044543c9b718 100644 --- a/Configuration/Generator/python/QCD_Pt_600_800_14TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QCD_Pt_600_800_14TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/QCD_Pt_600_800_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QCD_Pt_600_800_8TeV_TuneCUETP8M1_cfi.py index eb1f5054986b3..f362186d751c6 100644 --- a/Configuration/Generator/python/QCD_Pt_600_800_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QCD_Pt_600_800_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/QCD_Pt_80_120_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QCD_Pt_80_120_13TeV_TuneCUETP8M1_cfi.py index bcf6aed30dba7..7ecbfb5812301 100644 --- a/Configuration/Generator/python/QCD_Pt_80_120_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QCD_Pt_80_120_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/QCD_Pt_80_120_14TeV_TuneCP5_cfi.py b/Configuration/Generator/python/QCD_Pt_80_120_14TeV_TuneCP5_cfi.py index 72b2178de7be1..75a45397830d8 100644 --- a/Configuration/Generator/python/QCD_Pt_80_120_14TeV_TuneCP5_cfi.py +++ b/Configuration/Generator/python/QCD_Pt_80_120_14TeV_TuneCP5_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/QCD_Pt_80_120_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QCD_Pt_80_120_14TeV_TuneCUETP8M1_cfi.py index 668777bd52b2c..d7177b97b7e8f 100644 --- a/Configuration/Generator/python/QCD_Pt_80_120_14TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QCD_Pt_80_120_14TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/QCD_Pt_80_120_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QCD_Pt_80_120_8TeV_TuneCUETP8M1_cfi.py index 56c0817d5992e..6ffa64d23a34a 100644 --- a/Configuration/Generator/python/QCD_Pt_80_120_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QCD_Pt_80_120_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/QCD_Pt_80_170_BCtoE_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QCD_Pt_80_170_BCtoE_8TeV_TuneCUETP8M1_cfi.py index 77afa1e413734..5a626bed4a129 100644 --- a/Configuration/Generator/python/QCD_Pt_80_170_BCtoE_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QCD_Pt_80_170_BCtoE_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/QQH120Inv_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QQH120Inv_8TeV_TuneCUETP8M1_cfi.py index af44fd49ad985..ab9ff54fb3168 100644 --- a/Configuration/Generator/python/QQH120Inv_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QQH120Inv_8TeV_TuneCUETP8M1_cfi.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(1), # put here the efficiency of your filter (1. if no filter) filterEfficiency = cms.untracked.double(1.0), diff --git a/Configuration/Generator/python/QQH1352T_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QQH1352T_13TeV_TuneCUETP8M1_cfi.py index 8255ba54ce734..0d7822dbea238 100644 --- a/Configuration/Generator/python/QQH1352T_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QQH1352T_13TeV_TuneCUETP8M1_cfi.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(1), # put here the efficiency of your filter (1. if no filter) filterEfficiency = cms.untracked.double(1.0), diff --git a/Configuration/Generator/python/QQH1352T_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/QQH1352T_8TeV_TuneCUETP8M1_cfi.py index 89a5673f5e211..8a8cc8928a57e 100644 --- a/Configuration/Generator/python/QQH1352T_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/QQH1352T_8TeV_TuneCUETP8M1_cfi.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(1), # put here the efficiency of your filter (1. if no filter) filterEfficiency = cms.untracked.double(1.0), diff --git a/Configuration/Generator/python/QQToHToTauTau_mh125_TuneCP5_14TeV_pythia8_cfi.py b/Configuration/Generator/python/QQToHToTauTau_mh125_TuneCP5_14TeV_pythia8_cfi.py index 68648d19e2bd6..4f60b75d2bde0 100644 --- a/Configuration/Generator/python/QQToHToTauTau_mh125_TuneCP5_14TeV_pythia8_cfi.py +++ b/Configuration/Generator/python/QQToHToTauTau_mh125_TuneCP5_14TeV_pythia8_cfi.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(1), # put here the efficiency of your filter (1. if no filter) filterEfficiency = cms.untracked.double(1.0), diff --git a/Configuration/Generator/python/RS750_quarks_and_leptons_8TeV_TuneCUETP8M1_cff.py b/Configuration/Generator/python/RS750_quarks_and_leptons_8TeV_TuneCUETP8M1_cff.py index ef55039c6aa8d..4db26dd7f60ac 100644 --- a/Configuration/Generator/python/RS750_quarks_and_leptons_8TeV_TuneCUETP8M1_cff.py +++ b/Configuration/Generator/python/RS750_quarks_and_leptons_8TeV_TuneCUETP8M1_cff.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(1), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/RSGravitonToGammaGamma_kMpl01_M_3000_TuneCUETP8M1_13TeV_pythia8_cfi.py b/Configuration/Generator/python/RSGravitonToGammaGamma_kMpl01_M_3000_TuneCUETP8M1_13TeV_pythia8_cfi.py index 88e4f9a858ae5..434df7c217e66 100644 --- a/Configuration/Generator/python/RSGravitonToGammaGamma_kMpl01_M_3000_TuneCUETP8M1_13TeV_pythia8_cfi.py +++ b/Configuration/Generator/python/RSGravitonToGammaGamma_kMpl01_M_3000_TuneCUETP8M1_13TeV_pythia8_cfi.py @@ -3,7 +3,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", comEnergy = cms.double(13000.0), crossSection = cms.untracked.double(1), filterEfficiency = cms.untracked.double(1), diff --git a/Configuration/Generator/python/RSKKGluon_m3000GeV_13TeV_TuneCUETP8M1_cff.py b/Configuration/Generator/python/RSKKGluon_m3000GeV_13TeV_TuneCUETP8M1_cff.py index 6bc8fd0ec63b7..c2377395bf0d6 100644 --- a/Configuration/Generator/python/RSKKGluon_m3000GeV_13TeV_TuneCUETP8M1_cff.py +++ b/Configuration/Generator/python/RSKKGluon_m3000GeV_13TeV_TuneCUETP8M1_cff.py @@ -3,7 +3,7 @@ from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", crossSection = cms.untracked.double(1.0), pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), diff --git a/Configuration/Generator/python/RSKKGluon_m3000GeV_13TeV_cff.py b/Configuration/Generator/python/RSKKGluon_m3000GeV_13TeV_cff.py index e3b98fd91b6b7..dc4149d3f4bdb 100644 --- a/Configuration/Generator/python/RSKKGluon_m3000GeV_13TeV_cff.py +++ b/Configuration/Generator/python/RSKKGluon_m3000GeV_13TeV_cff.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", crossSection = cms.untracked.double(1.0), pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), diff --git a/Configuration/Generator/python/ReggeGribovPartonMC_EposLHC_4080_4080GeV_pPb_ExtGen_cfi.py b/Configuration/Generator/python/ReggeGribovPartonMC_EposLHC_4080_4080GeV_pPb_ExtGen_cfi.py new file mode 100644 index 0000000000000..0225adc6dc657 --- /dev/null +++ b/Configuration/Generator/python/ReggeGribovPartonMC_EposLHC_4080_4080GeV_pPb_ExtGen_cfi.py @@ -0,0 +1,17 @@ +import FWCore.ParameterSet.Config as cms + +_generator = cms.EDFilter("ReggeGribovPartonMCGeneratorFilter", + + bmin = cms.double(0), #impact parameter min in fm + bmax = cms.double(10000),#impact parameter max in fm + paramFileName = cms.untracked.string("Configuration/Generator/data/ReggeGribovPartonMC.param"), #file with more parameters specific to crmc interface + skipNuclFrag = cms.bool(True), #in HI collisions nuclear fragments with pt=0 can be in the hep event. to skip those activate this option + beammomentum = cms.double(4080), + targetmomentum = cms.double(-4080), + beamid = cms.int32(208), + targetid = cms.int32(1), + model = cms.int32(0), + ) + +from GeneratorInterface.Core.ExternalGeneratorFilter import ExternalGeneratorFilter +generator = ExternalGeneratorFilter(_generator) \ No newline at end of file diff --git a/Configuration/Generator/python/SMS-T1tttt_mGl-1500_mLSP-100_13TeV-pythia8_cfi.py b/Configuration/Generator/python/SMS-T1tttt_mGl-1500_mLSP-100_13TeV-pythia8_cfi.py index c7f0b156728ec..4a53d3e688faa 100644 --- a/Configuration/Generator/python/SMS-T1tttt_mGl-1500_mLSP-100_13TeV-pythia8_cfi.py +++ b/Configuration/Generator/python/SMS-T1tttt_mGl-1500_mLSP-100_13TeV-pythia8_cfi.py @@ -247,7 +247,7 @@ DECAY 1000035 0.00000000E+00 # neutralino4 decays """ -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/SMS-T1tttt_mGl-1500_mLSP-100_TuneCP5_14TeV_pythia8_cfi.py b/Configuration/Generator/python/SMS-T1tttt_mGl-1500_mLSP-100_TuneCP5_14TeV_pythia8_cfi.py index c303f50a5bb72..0e21f5399c5b0 100644 --- a/Configuration/Generator/python/SMS-T1tttt_mGl-1500_mLSP-100_TuneCP5_14TeV_pythia8_cfi.py +++ b/Configuration/Generator/python/SMS-T1tttt_mGl-1500_mLSP-100_TuneCP5_14TeV_pythia8_cfi.py @@ -247,7 +247,7 @@ DECAY 1000035 0.00000000E+00 # neutralino4 decays """ -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/SoftQCDDiffractive_13TeV_pythia8_cff.py b/Configuration/Generator/python/SoftQCDDiffractive_13TeV_pythia8_cff.py index f905f933f4a0f..77015a618d6de 100644 --- a/Configuration/Generator/python/SoftQCDDiffractive_13TeV_pythia8_cff.py +++ b/Configuration/Generator/python/SoftQCDDiffractive_13TeV_pythia8_cff.py @@ -5,7 +5,7 @@ -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", crossSection = cms.untracked.double(71.39e+09), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/SoftQCDelastic_13TeV_pythia8_cff.py b/Configuration/Generator/python/SoftQCDelastic_13TeV_pythia8_cff.py index d03797ff95a7f..c6f3c42ac2626 100644 --- a/Configuration/Generator/python/SoftQCDelastic_13TeV_pythia8_cff.py +++ b/Configuration/Generator/python/SoftQCDelastic_13TeV_pythia8_cff.py @@ -5,7 +5,7 @@ -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", crossSection = cms.untracked.double(71.39e+09), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/SoftQCDinelastic_13TeV_pythia8_cff.py b/Configuration/Generator/python/SoftQCDinelastic_13TeV_pythia8_cff.py index 0b6549b3804e1..1afa5e18a6131 100644 --- a/Configuration/Generator/python/SoftQCDinelastic_13TeV_pythia8_cff.py +++ b/Configuration/Generator/python/SoftQCDinelastic_13TeV_pythia8_cff.py @@ -5,7 +5,7 @@ -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", crossSection = cms.untracked.double(71.39e+09), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/SoftQCDnonDiffractive_13TeV_pythia8_cff.py b/Configuration/Generator/python/SoftQCDnonDiffractive_13TeV_pythia8_cff.py index 6b4b50b1838e4..948b0a5729b30 100644 --- a/Configuration/Generator/python/SoftQCDnonDiffractive_13TeV_pythia8_cff.py +++ b/Configuration/Generator/python/SoftQCDnonDiffractive_13TeV_pythia8_cff.py @@ -5,7 +5,7 @@ -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", crossSection = cms.untracked.double(71.39e+09), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/TTbar012Jets_5f_NLO_FXFX_Madgraph_LHE_13TeV_cfi.py b/Configuration/Generator/python/TTbar012Jets_5f_NLO_FXFX_Madgraph_LHE_13TeV_cfi.py index cf4725da618d0..3128d2d78cd68 100644 --- a/Configuration/Generator/python/TTbar012Jets_5f_NLO_FXFX_Madgraph_LHE_13TeV_cfi.py +++ b/Configuration/Generator/python/TTbar012Jets_5f_NLO_FXFX_Madgraph_LHE_13TeV_cfi.py @@ -8,7 +8,8 @@ nEvents = cms.untracked.uint32(5000), numberOfParameters = cms.uint32(1), outputFile = cms.string('cmsgrid_final.lhe'), - scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh') + scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh'), + generateConcurrently = cms.untracked.bool(True) ) #Link to datacards: diff --git a/Configuration/Generator/python/TTbarLepton_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/TTbarLepton_13TeV_TuneCUETP8M1_cfi.py index ecba70bf9500c..bf29b0affac9e 100644 --- a/Configuration/Generator/python/TTbarLepton_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/TTbarLepton_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/TTbarLepton_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/TTbarLepton_8TeV_TuneCUETP8M1_cfi.py index 52b6889a037ff..124c34db722cd 100644 --- a/Configuration/Generator/python/TTbarLepton_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/TTbarLepton_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/TTbarToDilepton_mt172p5_TuneCP5_14TeV_pythia8_cfi.py b/Configuration/Generator/python/TTbarToDilepton_mt172p5_TuneCP5_14TeV_pythia8_cfi.py index d94cb5b3caed2..7a6a8d05d77b2 100644 --- a/Configuration/Generator/python/TTbarToDilepton_mt172p5_TuneCP5_14TeV_pythia8_cfi.py +++ b/Configuration/Generator/python/TTbarToDilepton_mt172p5_TuneCP5_14TeV_pythia8_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/TTbar_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/TTbar_13TeV_TuneCUETP8M1_cfi.py index 2f2a164bcfe41..23dc9ebbb35a0 100644 --- a/Configuration/Generator/python/TTbar_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/TTbar_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/TTbar_14TeV_TuneCP5_cfi.py b/Configuration/Generator/python/TTbar_14TeV_TuneCP5_cfi.py index 2adc0878812f7..156823d1b6790 100644 --- a/Configuration/Generator/python/TTbar_14TeV_TuneCP5_cfi.py +++ b/Configuration/Generator/python/TTbar_14TeV_TuneCP5_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/TTbar_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/TTbar_14TeV_TuneCUETP8M1_cfi.py index 4cf4f54b47f94..f8c932a4c28dd 100644 --- a/Configuration/Generator/python/TTbar_14TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/TTbar_14TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/TTbar_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/TTbar_8TeV_TuneCUETP8M1_cfi.py index bdb6616c13ba6..e6962a0df592a 100644 --- a/Configuration/Generator/python/TTbar_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/TTbar_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/TauToMuMuMu_14TeV_TuneCP5_cfi.py b/Configuration/Generator/python/TauToMuMuMu_14TeV_TuneCP5_cfi.py index acab51bd844e9..9a85c27131d01 100644 --- a/Configuration/Generator/python/TauToMuMuMu_14TeV_TuneCP5_cfi.py +++ b/Configuration/Generator/python/TauToMuMuMu_14TeV_TuneCP5_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/UpsMM_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/UpsMM_8TeV_TuneCUETP8M1_cfi.py index 236cf933aa97c..debb3ba6e2226 100644 --- a/Configuration/Generator/python/UpsMM_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/UpsMM_8TeV_TuneCUETP8M1_cfi.py @@ -3,7 +3,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * import FWCore.ParameterSet.Config as cms -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(0.0757), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/Upsilon1SToMuMu_forSTEAM_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/Upsilon1SToMuMu_forSTEAM_13TeV_TuneCUETP8M1_cfi.py index 21a77bda0dc78..1e3e73ae91d42 100644 --- a/Configuration/Generator/python/Upsilon1SToMuMu_forSTEAM_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/Upsilon1SToMuMu_forSTEAM_13TeV_TuneCUETP8M1_cfi.py @@ -3,7 +3,7 @@ from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * from Configuration.Generator.Pythia8BottomoniumSettings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(0.53), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/Upsilon1SToMuMu_forSTEAM_14TeV_TuneCP5_cfi.py b/Configuration/Generator/python/Upsilon1SToMuMu_forSTEAM_14TeV_TuneCP5_cfi.py index 338f243b74140..a43ad8d24357d 100644 --- a/Configuration/Generator/python/Upsilon1SToMuMu_forSTEAM_14TeV_TuneCP5_cfi.py +++ b/Configuration/Generator/python/Upsilon1SToMuMu_forSTEAM_14TeV_TuneCP5_cfi.py @@ -3,7 +3,7 @@ from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * from Configuration.Generator.Pythia8BottomoniumSettings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(0.53), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/VBFHZZ4Nu_Pow_NNPDF30_LHE_13TeV_cff.py b/Configuration/Generator/python/VBFHZZ4Nu_Pow_NNPDF30_LHE_13TeV_cff.py index b843ca714c6c5..3656b6c35a6ba 100644 --- a/Configuration/Generator/python/VBFHZZ4Nu_Pow_NNPDF30_LHE_13TeV_cff.py +++ b/Configuration/Generator/python/VBFHZZ4Nu_Pow_NNPDF30_LHE_13TeV_cff.py @@ -8,5 +8,6 @@ nEvents = cms.untracked.uint32(5000), numberOfParameters = cms.uint32(1), outputFile = cms.string('cmsgrid_final.lhe'), - scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh') + scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh'), + generateConcurrently = cms.untracked.bool(True) ) diff --git a/Configuration/Generator/python/VBFHZZ4Nu_Pow_NNPDF30_LHE_13TeV_cfi.py b/Configuration/Generator/python/VBFHZZ4Nu_Pow_NNPDF30_LHE_13TeV_cfi.py index 2a6d918a81d3f..ea3435ffb8d8b 100644 --- a/Configuration/Generator/python/VBFHZZ4Nu_Pow_NNPDF30_LHE_13TeV_cfi.py +++ b/Configuration/Generator/python/VBFHZZ4Nu_Pow_NNPDF30_LHE_13TeV_cfi.py @@ -11,7 +11,8 @@ nEvents = cms.untracked.uint32(5000), numberOfParameters = cms.uint32(1), outputFile = cms.string('cmsgrid_final.lhe'), - scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh') + scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh'), + generateConcurrently = cms.untracked.bool(True) ) diff --git a/Configuration/Generator/python/VBFHZZ4Nu_TuneCP5_14TeV_pythia8_cfi.py b/Configuration/Generator/python/VBFHZZ4Nu_TuneCP5_14TeV_pythia8_cfi.py index 84cafcd9d62c4..d4b29e8f6e0d5 100644 --- a/Configuration/Generator/python/VBFHZZ4Nu_TuneCP5_14TeV_pythia8_cfi.py +++ b/Configuration/Generator/python/VBFHZZ4Nu_TuneCP5_14TeV_pythia8_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), comEnergy = cms.double(14000.0), maxEventsToPrint = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/VBFHbb_Pow_NNPDF30_LHE_13TeV_cff.py b/Configuration/Generator/python/VBFHbb_Pow_NNPDF30_LHE_13TeV_cff.py index d7918efaca278..62d5934907233 100644 --- a/Configuration/Generator/python/VBFHbb_Pow_NNPDF30_LHE_13TeV_cff.py +++ b/Configuration/Generator/python/VBFHbb_Pow_NNPDF30_LHE_13TeV_cff.py @@ -8,5 +8,6 @@ nEvents = cms.untracked.uint32(5000), numberOfParameters = cms.uint32(1), outputFile = cms.string('cmsgrid_final.lhe'), - scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh') + scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh'), + generateConcurrently = cms.untracked.bool(True) ) diff --git a/Configuration/Generator/python/VBFHbb_Pow_NNPDF30_LHE_13TeV_cfi.py b/Configuration/Generator/python/VBFHbb_Pow_NNPDF30_LHE_13TeV_cfi.py index d4b107e50d1ba..aa5c396c252cc 100644 --- a/Configuration/Generator/python/VBFHbb_Pow_NNPDF30_LHE_13TeV_cfi.py +++ b/Configuration/Generator/python/VBFHbb_Pow_NNPDF30_LHE_13TeV_cfi.py @@ -11,7 +11,8 @@ nEvents = cms.untracked.uint32(5000), numberOfParameters = cms.uint32(1), outputFile = cms.string('cmsgrid_final.lhe'), - scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh') + scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh'), + generateConcurrently = cms.untracked.bool(True) ) diff --git a/Configuration/Generator/python/WE_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/WE_13TeV_TuneCUETP8M1_cfi.py index 1b68a919d7bf3..1f9b60ba4bdd0 100644 --- a/Configuration/Generator/python/WE_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/WE_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/WE_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/WE_14TeV_TuneCUETP8M1_cfi.py index 9d367ff5f746f..c788251974d7f 100644 --- a/Configuration/Generator/python/WE_14TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/WE_14TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/WE_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/WE_8TeV_TuneCUETP8M1_cfi.py index 8196b6fc9ad99..b114df6e87fda 100644 --- a/Configuration/Generator/python/WE_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/WE_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/WM_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/WM_13TeV_TuneCUETP8M1_cfi.py index bd9ca9538771e..11bed8b85d1dc 100644 --- a/Configuration/Generator/python/WM_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/WM_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/WM_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/WM_8TeV_TuneCUETP8M1_cfi.py index ab1f7675b1224..0b70bb38daa5f 100644 --- a/Configuration/Generator/python/WM_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/WM_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/WToLNu_13TeV_pythia8_cff.py b/Configuration/Generator/python/WToLNu_13TeV_pythia8_cff.py index e2a2f419daa4a..d605e41ad8927 100644 --- a/Configuration/Generator/python/WToLNu_13TeV_pythia8_cff.py +++ b/Configuration/Generator/python/WToLNu_13TeV_pythia8_cff.py @@ -5,7 +5,7 @@ -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", comEnergy = cms.double(13000.0), crossSection = cms.untracked.double(6.44), filterEfficiency = cms.untracked.double(1), diff --git a/Configuration/Generator/python/WToLNu_14TeV_TuneCP5_pythia8_cfi.py b/Configuration/Generator/python/WToLNu_14TeV_TuneCP5_pythia8_cfi.py index 0ab27b9359f09..f64588a1b1f84 100644 --- a/Configuration/Generator/python/WToLNu_14TeV_TuneCP5_pythia8_cfi.py +++ b/Configuration/Generator/python/WToLNu_14TeV_TuneCP5_pythia8_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/WToMuNu_14TeV_TuneCP5_pythia8_cfi.py b/Configuration/Generator/python/WToMuNu_14TeV_TuneCP5_pythia8_cfi.py index d6f2fd727959d..d33bae46c6139 100644 --- a/Configuration/Generator/python/WToMuNu_14TeV_TuneCP5_pythia8_cfi.py +++ b/Configuration/Generator/python/WToMuNu_14TeV_TuneCP5_pythia8_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(1.0), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/Wjet_Pt_3000_3500_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/Wjet_Pt_3000_3500_13TeV_TuneCUETP8M1_cfi.py index a44e154070ccc..399705abccc66 100644 --- a/Configuration/Generator/python/Wjet_Pt_3000_3500_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/Wjet_Pt_3000_3500_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/Wjet_Pt_3000_3500_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/Wjet_Pt_3000_3500_14TeV_TuneCUETP8M1_cfi.py index a3402d0258d5d..9fef3ee8dc1e3 100644 --- a/Configuration/Generator/python/Wjet_Pt_3000_3500_14TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/Wjet_Pt_3000_3500_14TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/Wjet_Pt_3000_3500_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/Wjet_Pt_3000_3500_8TeV_TuneCUETP8M1_cfi.py index 46c827d6ed6b0..121c989dd5a3c 100644 --- a/Configuration/Generator/python/Wjet_Pt_3000_3500_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/Wjet_Pt_3000_3500_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/Wjet_Pt_80_120_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/Wjet_Pt_80_120_13TeV_TuneCUETP8M1_cfi.py index 76d1fc7c54a49..e609bb9a19bcb 100644 --- a/Configuration/Generator/python/Wjet_Pt_80_120_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/Wjet_Pt_80_120_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/Wjet_Pt_80_120_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/Wjet_Pt_80_120_14TeV_TuneCUETP8M1_cfi.py index 44d4a001e7243..40a3757878b9a 100644 --- a/Configuration/Generator/python/Wjet_Pt_80_120_14TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/Wjet_Pt_80_120_14TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/Wjet_Pt_80_120_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/Wjet_Pt_80_120_8TeV_TuneCUETP8M1_cfi.py index e6d8862d55f04..d080966ad8244 100644 --- a/Configuration/Generator/python/Wjet_Pt_80_120_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/Wjet_Pt_80_120_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/WpM_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/WpM_13TeV_TuneCUETP8M1_cfi.py index a7daf31830b75..4bc78d6e92c5c 100644 --- a/Configuration/Generator/python/WpM_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/WpM_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/WpM_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/WpM_8TeV_TuneCUETP8M1_cfi.py index a4b411d6e49b5..8ec1fb7fe94c9 100644 --- a/Configuration/Generator/python/WpM_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/WpM_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/WprimeToENu_M-2000_TuneCUETP8M1_13TeV-pythia8_cff.py b/Configuration/Generator/python/WprimeToENu_M-2000_TuneCUETP8M1_13TeV-pythia8_cff.py index f3b3bf5b72fdb..2f6db18b8e8ee 100644 --- a/Configuration/Generator/python/WprimeToENu_M-2000_TuneCUETP8M1_13TeV-pythia8_cff.py +++ b/Configuration/Generator/python/WprimeToENu_M-2000_TuneCUETP8M1_13TeV-pythia8_cff.py @@ -5,7 +5,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(1), filterEfficiency = cms.untracked.double(1), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCP5_pythia8_cfi.py b/Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCP5_pythia8_cfi.py index 5f3c2c32ba905..e52494c368268 100644 --- a/Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCP5_pythia8_cfi.py +++ b/Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCP5_pythia8_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(1), diff --git a/Configuration/Generator/python/WprimeTolNu_M3000_13TeV_pythia8_cff.py b/Configuration/Generator/python/WprimeTolNu_M3000_13TeV_pythia8_cff.py index cebfe1a256b5c..3343d2d14c0e2 100644 --- a/Configuration/Generator/python/WprimeTolNu_M3000_13TeV_pythia8_cff.py +++ b/Configuration/Generator/python/WprimeTolNu_M3000_13TeV_pythia8_cff.py @@ -3,7 +3,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", comEnergy = cms.double(13000.0), crossSection = cms.untracked.double(0.013), filterEfficiency = cms.untracked.double(1), diff --git a/Configuration/Generator/python/ZEEMM_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ZEEMM_13TeV_TuneCUETP8M1_cfi.py index d64cb3dc117fe..4a5474b7dbffe 100644 --- a/Configuration/Generator/python/ZEEMM_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ZEEMM_13TeV_TuneCUETP8M1_cfi.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZEE_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ZEE_13TeV_TuneCUETP8M1_cfi.py index 85805ba09807c..67a0a3f265376 100644 --- a/Configuration/Generator/python/ZEE_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ZEE_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZEE_14TeV_TuneCP5_cfi.py b/Configuration/Generator/python/ZEE_14TeV_TuneCP5_cfi.py index 309ef6743b07e..966bcbb04d7af 100644 --- a/Configuration/Generator/python/ZEE_14TeV_TuneCP5_cfi.py +++ b/Configuration/Generator/python/ZEE_14TeV_TuneCP5_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZEE_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ZEE_14TeV_TuneCUETP8M1_cfi.py index 3d8c9a19c9f0e..ca4b20cb0fa51 100644 --- a/Configuration/Generator/python/ZEE_14TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ZEE_14TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZEE_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ZEE_8TeV_TuneCUETP8M1_cfi.py index 654d7c12ee3f0..643accb4678d5 100644 --- a/Configuration/Generator/python/ZEE_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ZEE_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZMM_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ZMM_13TeV_TuneCUETP8M1_cfi.py index 625ef9b224450..619e4560eb2a9 100644 --- a/Configuration/Generator/python/ZMM_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ZMM_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZMM_14TeV_TuneCP5_cfi.py b/Configuration/Generator/python/ZMM_14TeV_TuneCP5_cfi.py index dae81d9149055..75bda3ce3e01c 100644 --- a/Configuration/Generator/python/ZMM_14TeV_TuneCP5_cfi.py +++ b/Configuration/Generator/python/ZMM_14TeV_TuneCP5_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZMM_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ZMM_14TeV_TuneCUETP8M1_cfi.py index fd2a3735e44fa..e090854eefc81 100644 --- a/Configuration/Generator/python/ZMM_14TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ZMM_14TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZMM_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ZMM_8TeV_TuneCUETP8M1_cfi.py index 7f18fbfa5c9cf..476454143653e 100644 --- a/Configuration/Generator/python/ZMM_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ZMM_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZPrime5000JJ_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ZPrime5000JJ_8TeV_TuneCUETP8M1_cfi.py index 946e637bb8b70..26dc0b20ea679 100644 --- a/Configuration/Generator/python/ZPrime5000JJ_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ZPrime5000JJ_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", #pythiaHepMCVerbosity = cms.untracked.bool(False), comEnergy = cms.double(13000.0), maxEventsToPrint = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZTT_All_hadronic_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ZTT_All_hadronic_13TeV_TuneCUETP8M1_cfi.py index e121555ef959e..05d4e44d5c934 100644 --- a/Configuration/Generator/python/ZTT_All_hadronic_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ZTT_All_hadronic_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZTT_All_hadronic_14TeV_TuneCP5_cfi.py b/Configuration/Generator/python/ZTT_All_hadronic_14TeV_TuneCP5_cfi.py index 942f178ad5432..88a3dfe88c096 100644 --- a/Configuration/Generator/python/ZTT_All_hadronic_14TeV_TuneCP5_cfi.py +++ b/Configuration/Generator/python/ZTT_All_hadronic_14TeV_TuneCP5_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZTT_All_hadronic_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ZTT_All_hadronic_14TeV_TuneCUETP8M1_cfi.py index e7ec7bfe423cf..0c34757662742 100644 --- a/Configuration/Generator/python/ZTT_All_hadronic_14TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ZTT_All_hadronic_14TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZTT_All_hadronic_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ZTT_All_hadronic_8TeV_TuneCUETP8M1_cfi.py index b4824f236e099..040510dc48470 100644 --- a/Configuration/Generator/python/ZTT_All_hadronic_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ZTT_All_hadronic_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZTT_Tauola_OneLepton_OtherHadrons_8TeV_TuneCUETP8M1_ExtGen_cfi.py b/Configuration/Generator/python/ZTT_Tauola_OneLepton_OtherHadrons_8TeV_TuneCUETP8M1_ExtGen_cfi.py new file mode 100644 index 0000000000000..4efa414036615 --- /dev/null +++ b/Configuration/Generator/python/ZTT_Tauola_OneLepton_OtherHadrons_8TeV_TuneCUETP8M1_ExtGen_cfi.py @@ -0,0 +1,40 @@ +import FWCore.ParameterSet.Config as cms +from Configuration.Generator.Pythia8CommonSettings_cfi import * +from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * +from GeneratorInterface.ExternalDecays.TauolaSettings_cff import * + +_generator = cms.EDFilter("Pythia8GeneratorFilter", + pythiaHepMCVerbosity = cms.untracked.bool(False), + maxEventsToPrint = cms.untracked.int32(0), + pythiaPylistVerbosity = cms.untracked.int32(0), + filterEfficiency = cms.untracked.double(1.0), + comEnergy = cms.double(8000.0), + ExternalDecays = cms.PSet( + Tauola = cms.untracked.PSet( + TauolaPolar, + InputCards = cms.PSet( + pjak1 = cms.int32(0), + pjak2 = cms.int32(0), + mdtau = cms.int32(214) + ), + ), + parameterSets = cms.vstring('Tauola') + ), + PythiaParameters = cms.PSet( + pythia8CommonSettingsBlock, + pythia8CUEP8M1SettingsBlock, + processParameters = cms.vstring( + 'WeakSingleBoson:ffbar2gmZ = on', + '23:onMode = off', + '23:onIfAny = 15', + 'PhaseSpace:mHatMin = 75.', + ), + parameterSets = cms.vstring('pythia8CommonSettings', + 'pythia8CUEP8M1Settings', + 'processParameters', + ) + ) + ) + +from GeneratorInterface.Core.ExternalGeneratorFilter import ExternalGeneratorFilter +generator = ExternalGeneratorFilter(_generator, _external_process_components_=cms.vstring("HepPDTESSource")) \ No newline at end of file diff --git a/Configuration/Generator/python/ZmumuJets_Pt_20_300_GEN_13TeV_TuneCUETP8M1_cfg.py b/Configuration/Generator/python/ZmumuJets_Pt_20_300_GEN_13TeV_TuneCUETP8M1_cfg.py index ac0806b9d21eb..3bcffa5bf479d 100644 --- a/Configuration/Generator/python/ZmumuJets_Pt_20_300_GEN_13TeV_TuneCUETP8M1_cfg.py +++ b/Configuration/Generator/python/ZmumuJets_Pt_20_300_GEN_13TeV_TuneCUETP8M1_cfg.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", #pythiaHepMCVerbosity = cms.untracked.bool(False), maxEventsToPrint = cms.untracked.int32(0), pythiaPylistVerbosity = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZpEE_2250_13TeV_Tauola_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ZpEE_2250_13TeV_Tauola_TuneCUETP8M1_cfi.py index c71f8e5819813..131a9fff76d7d 100644 --- a/Configuration/Generator/python/ZpEE_2250_13TeV_Tauola_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ZpEE_2250_13TeV_Tauola_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", #pythiaHepMCVerbosity = cms.untracked.bool(False), comEnergy = cms.double(13000.0), maxEventsToPrint = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZpEE_2250_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ZpEE_2250_13TeV_TuneCUETP8M1_cfi.py index c71f8e5819813..131a9fff76d7d 100644 --- a/Configuration/Generator/python/ZpEE_2250_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ZpEE_2250_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", #pythiaHepMCVerbosity = cms.untracked.bool(False), comEnergy = cms.double(13000.0), maxEventsToPrint = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZpEE_2250_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ZpEE_2250_8TeV_TuneCUETP8M1_cfi.py index 70c828f67a3ce..a2c141672676b 100644 --- a/Configuration/Generator/python/ZpEE_2250_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ZpEE_2250_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", #pythiaHepMCVerbosity = cms.untracked.bool(False), comEnergy = cms.double(8000.0), maxEventsToPrint = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZpMM_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ZpMM_13TeV_TuneCUETP8M1_cfi.py index 138950a1e4eb1..aa1deb9b22790 100644 --- a/Configuration/Generator/python/ZpMM_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ZpMM_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), comEnergy = cms.double(13000.0), maxEventsToPrint = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZpMM_2250_13TeV_Tauola_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ZpMM_2250_13TeV_Tauola_TuneCUETP8M1_cfi.py index 5cbcd9e4eb7e1..b606e0906d648 100644 --- a/Configuration/Generator/python/ZpMM_2250_13TeV_Tauola_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ZpMM_2250_13TeV_Tauola_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", #pythiaHepMCVerbosity = cms.untracked.bool(False), comEnergy = cms.double(13000.0), maxEventsToPrint = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZpMM_2250_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ZpMM_2250_13TeV_TuneCUETP8M1_cfi.py index 5cbcd9e4eb7e1..b606e0906d648 100644 --- a/Configuration/Generator/python/ZpMM_2250_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ZpMM_2250_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", #pythiaHepMCVerbosity = cms.untracked.bool(False), comEnergy = cms.double(13000.0), maxEventsToPrint = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZpMM_2250_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ZpMM_2250_8TeV_TuneCUETP8M1_cfi.py index a9bb1855a36ed..ba08583d51a03 100644 --- a/Configuration/Generator/python/ZpMM_2250_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ZpMM_2250_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", #pythiaHepMCVerbosity = cms.untracked.bool(False), comEnergy = cms.double(8000.0), maxEventsToPrint = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZpMM_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ZpMM_8TeV_TuneCUETP8M1_cfi.py index d7e1d96107cd4..cf3c598d7e846 100644 --- a/Configuration/Generator/python/ZpMM_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ZpMM_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), comEnergy = cms.double(8000.0), maxEventsToPrint = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZpTT_1500_13TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ZpTT_1500_13TeV_TuneCUETP8M1_cfi.py index 8aa09a04bedda..abdee33185345 100644 --- a/Configuration/Generator/python/ZpTT_1500_13TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ZpTT_1500_13TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", #pythiaHepMCVerbosity = cms.untracked.bool(False), comEnergy = cms.double(13000.0), maxEventsToPrint = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZpTT_1500_14TeV_TuneCP5_cfi.py b/Configuration/Generator/python/ZpTT_1500_14TeV_TuneCP5_cfi.py index a0875b36c1bd0..c85e0c7061fde 100644 --- a/Configuration/Generator/python/ZpTT_1500_14TeV_TuneCP5_cfi.py +++ b/Configuration/Generator/python/ZpTT_1500_14TeV_TuneCP5_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", #pythiaHepMCVerbosity = cms.untracked.bool(False), comEnergy = cms.double(14000.0), maxEventsToPrint = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZpTT_1500_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/ZpTT_1500_8TeV_TuneCUETP8M1_cfi.py index 2dbd2b551b1d9..758a21cc4a6e7 100644 --- a/Configuration/Generator/python/ZpTT_1500_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/ZpTT_1500_8TeV_TuneCUETP8M1_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", #pythiaHepMCVerbosity = cms.untracked.bool(False), comEnergy = cms.double(8000.0), maxEventsToPrint = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZpToEE_m6000_TuneCP5_14TeV_pythia8_cfi.py b/Configuration/Generator/python/ZpToEE_m6000_TuneCP5_14TeV_pythia8_cfi.py index 30501a7412bb2..bd1dc7b2f1cac 100644 --- a/Configuration/Generator/python/ZpToEE_m6000_TuneCP5_14TeV_pythia8_cfi.py +++ b/Configuration/Generator/python/ZpToEE_m6000_TuneCP5_14TeV_pythia8_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), comEnergy = cms.double(14000.0), maxEventsToPrint = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZpToMM_m6000_TuneCP5_14TeV_pythia8_cfi.py b/Configuration/Generator/python/ZpToMM_m6000_TuneCP5_14TeV_pythia8_cfi.py index d160723c7b466..c1dd5179b91e9 100644 --- a/Configuration/Generator/python/ZpToMM_m6000_TuneCP5_14TeV_pythia8_cfi.py +++ b/Configuration/Generator/python/ZpToMM_m6000_TuneCP5_14TeV_pythia8_cfi.py @@ -2,7 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), comEnergy = cms.double(14000.0), maxEventsToPrint = cms.untracked.int32(0), diff --git a/Configuration/Generator/python/ZprimeToll_M3000_13TeV_pythia8_cff.py b/Configuration/Generator/python/ZprimeToll_M3000_13TeV_pythia8_cff.py index 5752a0c94bbb9..a94aaa948cab0 100644 --- a/Configuration/Generator/python/ZprimeToll_M3000_13TeV_pythia8_cff.py +++ b/Configuration/Generator/python/ZprimeToll_M3000_13TeV_pythia8_cff.py @@ -3,7 +3,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", comEnergy = cms.double(13000.0), crossSection = cms.untracked.double(0.013), filterEfficiency = cms.untracked.double(1), diff --git a/Configuration/Generator/python/bJpsiX_8TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/bJpsiX_8TeV_TuneCUETP8M1_cfi.py index 564a2e2ead1e4..b5694d5f6132b 100644 --- a/Configuration/Generator/python/bJpsiX_8TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/bJpsiX_8TeV_TuneCUETP8M1_cfi.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -generator = cms.EDFilter("Pythia8GeneratorFilter", +generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), filterEfficiency = cms.untracked.double(0.00013), pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/sherpa_ttbar_2j_MENLOPS_13TeV_MASTER_ExtGen_cff.py b/Configuration/Generator/python/sherpa_ttbar_2j_MENLOPS_13TeV_MASTER_ExtGen_cff.py new file mode 100644 index 0000000000000..4c6e0621f529d --- /dev/null +++ b/Configuration/Generator/python/sherpa_ttbar_2j_MENLOPS_13TeV_MASTER_ExtGen_cff.py @@ -0,0 +1,69 @@ +import FWCore.ParameterSet.Config as cms +import os + +source = cms.Source("EmptySource") + +_generator = cms.EDFilter("SherpaGeneratorFilter", + maxEventsToPrint = cms.int32(0), + filterEfficiency = cms.untracked.double(1.0), + crossSection = cms.untracked.double(-1), + SherpaProcess = cms.string('ttbar_2j_MENLOPS_13TeV'), + SherpackLocation = cms.string('/cvmfs/cms.cern.ch/phys_generator/gridpacks/slc7_amd64_gcc820/13TeV/sherpa/2.2.8'), + SherpackChecksum = cms.string('4efdf38e0d189d58c65a554ef901d027'), + FetchSherpack = cms.bool(True), + SherpaPath = cms.string('./'), + SherpaPathPiece = cms.string('./'), + SherpaResultDir = cms.string('Result'), + SherpaDefaultWeight = cms.double(1.0), + SherpaParameters = cms.PSet(parameterSets = cms.vstring( + "MPI_Cross_Sections", + "Run"), + MPI_Cross_Sections = cms.vstring( + " MPIs in Sherpa, Model = Amisic:", + " semihard xsec = 39.5554 mb,", + " non-diffractive xsec = 17.0318 mb with nd factor = 0.3142." + ), + Run = cms.vstring( + " (run){", + " CORE_SCALE TTBar;", + " METS_BBAR_MODE 5;", + " NJET:=2; LJET:=2; QCUT:=20.;", + " ME_SIGNAL_GENERATOR Comix Amegic LOOPGEN;", + " OL_PREFIX={0} ".format(os.environ['CMS_OPENLOOPS_PREFIX']), + " LOOPGEN:=OpenLoops;", + " MI_HANDLER=Amisic;", + " NLO_SMEAR_THRESHOLD 1;", + " NLO_SMEAR_POWER 2;", + " HARD_DECAYS On;", + " HARD_SPIN_CORRELATIONS=1;", + " SOFT_SPIN_CORRELATIONS=1;", + " PDF_LIBRARY LHAPDFSherpa;", + " PDF_SET NNPDF31_nnlo_hessian_pdfas;", + " USE_PDF_ALPHAS=1;", + " BEAM_1=2212; BEAM_ENERGY_1=6500;", + " BEAM_2=2212; BEAM_ENERGY_2=6500;", + " STABLE[6] 0; WIDTH[6] 0; STABLE[24] 0;", + " EXCLUSIVE_CLUSTER_MODE 1;", + " HEPMC_TREE_LIKE=1;", + " PRETTY_PRINT=Off;", + "}(run)", + " (processes){", + " Process : 93 93 -> 6 -6 93{NJET};", + " Order (*,0); CKKW sqr(QCUT/E_CMS);", + " NLO_QCD_Mode MC@NLO {LJET};", + " ME_Generator Amegic {LJET};", + " RS_ME_Generator Comix {LJET};", + " Loop_Generator LOOPGEN {LJET};", + " Integration_Error 0.05 {3,4};", + " End process;", + "}(processes)" + ), + ) +) + +from GeneratorInterface.Core.ExternalGeneratorFilter import ExternalGeneratorFilter +generator = ExternalGeneratorFilter(_generator, + _external_process_waitTime_=cms.untracked.uint32(1200), # increase the max waitTime for Sherpa + ) + +ProductionFilterSequence = cms.Sequence(generator) diff --git a/Configuration/Geometry/python/dict2021Geometry.py b/Configuration/Geometry/python/dict2021Geometry.py index 46936c6ef792a..0c4a301809036 100644 --- a/Configuration/Geometry/python/dict2021Geometry.py +++ b/Configuration/Geometry/python/dict2021Geometry.py @@ -143,6 +143,34 @@ ], "era" : "run3_common, stage2L1Trigger_2021", }, + "O6" : { + 1 : [ + 'Geometry/CMSCommonData/data/materials/2021/v3/materials.xml', + 'Geometry/TrackerCommonData/data/trackermaterial/2021/v1/trackermaterial.xml', + 'Geometry/CMSCommonData/data/rotations.xml', + 'Geometry/CMSCommonData/data/extend/v3/cmsextent.xml', + 'Geometry/CMSCommonData/data/cavernData/2021/v1/cavernData.xml', + 'Geometry/CMSCommonData/data/cms/2021/v3/cms.xml', + 'Geometry/CMSCommonData/data/cmsMother.xml', + 'Geometry/CMSCommonData/data/eta3/etaMax.xml', + 'Geometry/CMSCommonData/data/cmsTracker.xml', + 'Geometry/CMSCommonData/data/caloBase/2017/v1/caloBase.xml', + 'Geometry/CMSCommonData/data/cmsCalo.xml', + 'Geometry/CMSCommonData/data/muonBase/2018/v1/muonBase.xml', + 'Geometry/CMSCommonData/data/cmsMuon.xml', + 'Geometry/CMSCommonData/data/mgnt.xml', + 'Geometry/CMSCommonData/data/beampipe/2021/v1/beampipe.xml', + 'Geometry/CMSCommonData/data/cmsBeam/2021/v1/cmsBeam.xml', + 'Geometry/CMSCommonData/data/muonMB.xml', + 'Geometry/CMSCommonData/data/muonMagnet.xml', + 'Geometry/CMSCommonData/data/cavern/2021/v1/cavern.xml', + 'Geometry/CMSCommonData/data/cavernFloor/2017/v1/cavernFloor.xml', + ], + 5 : [ + 'Geometry/CMSCommonData/data/FieldParameters.xml', + ], + "era" : "run3_common, stage2L1Trigger_2021", + }, } trackerDict = { @@ -2465,6 +2493,105 @@ ], "reco" :[ + ], + }, + "P6" : { + 2 : [ + 'Geometry/VeryForwardData/data/RP_Box.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_000.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_001.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_002.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_003.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_004.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_005.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_020.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_021.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_022.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_023.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_024.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_025.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_100.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_101.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_102.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_103.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_104.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_105.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_120.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_121.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_122.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_123.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_124.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_125.xml', + 'Geometry/VeryForwardData/data/RP_Hybrid/v2/RP_Hybrid.xml', + 'Geometry/VeryForwardData/data/RP_Materials/v4/RP_Materials.xml', + 'Geometry/VeryForwardData/data/RP_Transformations.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_000.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_001.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_002.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_004.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_005.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_020.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_021.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_024.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_025.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_100.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_101.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_102.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_104.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_105.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_120.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_121.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_124.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_125.xml', + 'Geometry/VeryForwardData/data/RP_Device/v1/RP_Device.xml', + 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/Simu/v2/RP_Vertical_Device.xml', + 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/Simu/v2/RP_Horizontal_Device.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_220_Right_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_220_Left_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_210_Right_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_210_Left_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Cuts_Per_Region/Simu/v1/CTPPS_Cuts_Per_Region.xml', + 'Geometry/VeryForwardData/data/RP_Sensitive_Dets.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Transformations.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Parameters.xml', + 'Geometry/VeryForwardData/data/CTPPS_Timing_Station_Parameters.xml', + 'Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot/v2/CTPPS_Timing_Horizontal_Pot.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern1_Segment1.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment1.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment2.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment1.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment2.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment4.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment1.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment2.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment4.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment5.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane1.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane2.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane4.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Detector_Assembly/v1/CTPPS_Diamond_Detector_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/Simu/v1/CTPPS_Detectors_Assembly_022.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/Simu/v1/CTPPS_Detectors_Assembly_122.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Sensitive_Dets_TimingHits.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v2/ppstrackerMaterials.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v2/PPS_Pixel_Module_2x2_Run3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v2/PPS_Pixel_Sens.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_003.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_023.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_103.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_123.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/RP_Dist_Beam_Cent/Simu/v1/RP_Dist_Beam_Cent.xml', + ], + "sim" : [ + + ], + "reco" :[ + ], }, } @@ -2472,12 +2599,12 @@ allDicts = [ commonDict, trackerDict, caloDict, muonDict, forwardDict, ppsDict ] detectorVersionDict = { - ("O3","T3","C1","M1","F1","P4") : "2021", - ("O4","T4","C1","M1","F1","P4") : "2021ZeroMaterial", - ("O5","T5","C1","M1","F1","P4") : "2021FlatMinus05Percent", - ("O5","T6","C1","M1","F1","P4") : "2021FlatMinus10Percent", - ("O5","T7","C1","M1","F1","P4") : "2021FlatPlus05Percent", - ("O5","T8","C1","M1","F1","P4") : "2021FlatPlus10Percent", + ("O3","T3","C1","M1","F1","P5") : "2021", + ("O4","T4","C1","M1","F1","P5") : "2021ZeroMaterial", + ("O5","T5","C1","M1","F1","P5") : "2021FlatMinus05Percent", + ("O5","T6","C1","M1","F1","P5") : "2021FlatMinus10Percent", + ("O5","T7","C1","M1","F1","P5") : "2021FlatPlus05Percent", + ("O5","T8","C1","M1","F1","P5") : "2021FlatPlus10Percent", } -deprecatedSubdets = set([ "T1", "T2", "O1", "O2", "P1", "P2", "P3" ]) +deprecatedSubdets = set([ "T1", "T2", "O1", "O2", "P1", "P2", "P3", "P4" ]) diff --git a/Configuration/Geometry/python/generateGeometry.py b/Configuration/Geometry/python/generateGeometry.py index af5ef6c4d33bf..a64a012778eca 100644 --- a/Configuration/Geometry/python/generateGeometry.py +++ b/Configuration/Geometry/python/generateGeometry.py @@ -25,14 +25,15 @@ def __init__(self, scriptName, detectorVersionDefault, detectorPrefix, detectorY self.deprecatedDets = deprecatedDets self.deprecatedSubdets = deprecatedSubdets self.detectorVersionType = detectorVersionType + self.detectorVersionNull = self.detectorVersionType(0) def generateGeom(self, detectorTuple, args): detectorVersion = self.detectorPrefix+str(args.detectorVersionManual) # reverse dict search if overall D# specified - if args.v_detector>0: + if args.v_detector!=self.detectorVersionNull: detectorVersion = self.detectorPrefix+str(args.v_detector) if detectorVersion in self.detectorVersionDict.values(): - detectorTuple = self.detectorVersionDict.keys()[self.detectorVersionDict.values().index(detectorVersion)] + detectorTuple = list(self.detectorVersionDict.keys())[list(self.detectorVersionDict.values()).index(detectorVersion)] else: print("Unknown detector "+detectorVersion) sys.exit(1) @@ -249,7 +250,7 @@ def run(self): for aDict in self.allDicts: parser.add_argument("-"+aDict["abbrev"], "--"+aDict["name"], dest="v_"+aDict["name"], default=aDict["default"], type=int, help="version for "+aDict["name"]) parser.add_argument("-V", "--version", dest="detectorVersionManual", default=self.detectorVersionDefault, type=int, help="manual detector version number") - parser.add_argument("-D", "--detector", dest="v_detector", default=0, type=self.detectorVersionType, help="version for whole detector, ignored if 0, overrides subdet versions otherwise") + parser.add_argument("-D", "--detector", dest="v_detector", default=self.detectorVersionNull, type=self.detectorVersionType, help="version for whole detector, ignored if 0, overrides subdet versions otherwise") parser.add_argument("-l", "--list", dest="doList", default=False, action="store_true", help="list known detector versions and exit") parser.add_argument("-t", "--test", dest="doTest", default=False, action="store_true", help="enable unit test mode") args = parser.parse_args() diff --git a/Configuration/ProcessModifiers/python/siPixelDigiMorphing_cff.py b/Configuration/ProcessModifiers/python/siPixelDigiMorphing_cff.py new file mode 100644 index 0000000000000..10f6ed57eea3c --- /dev/null +++ b/Configuration/ProcessModifiers/python/siPixelDigiMorphing_cff.py @@ -0,0 +1,4 @@ +import FWCore.ParameterSet.Config as cms + +# This modifier is to run the SiPixelDigiMorphing +siPixelDigiMorphing = cms.Modifier() diff --git a/Configuration/PyReleaseValidation/python/relval_extendedgen.py b/Configuration/PyReleaseValidation/python/relval_extendedgen.py index 233578a08bab4..043a9e9e5d096 100644 --- a/Configuration/PyReleaseValidation/python/relval_extendedgen.py +++ b/Configuration/PyReleaseValidation/python/relval_extendedgen.py @@ -68,3 +68,14 @@ workflows[560]=['',['ZprimeToll_M3000_13TeV_pythia8','HARVESTGEN']] workflows[561]=['',['WprimeTolNu_M3000_13TeV_pythia8','HARVESTGEN']] workflows[562]=['BulkG_ZZ_2L2Q_M1200_narrow_13TeV_pythia8',['BulkG_M1200_narrow_2L2Q_LHE_13TeV','Hadronizer_TuneCUETP8M1_Mad_pythia8','HARVESTGEN2']] + +# ExternalGeneratorFilter +# validated GEN fragments are taken from other workflows. Annotation: generator, origin workflow id +workflows[570]=['',['BuToKstarJPsiToMuMu_forSTEAM_13TeV_ExtGen','HARVESTGEN']] # Pythia8+EvtGen130, 541 +workflows[571]=['',['BsToMuMu_forSTEAM_13TeV_ExtGen','HARVESTGEN']] # Pythia8+EvtGen1, 545 +workflows[572]=['',['ZTTFS_ExtGen','HARVESTGEN']] # Pythia8+Tauola, 124.2 +workflows[573]=['',['sherpa_ttbar_2j_MENLOPS_13TeV_MASTER_ExtGen','HARVESTGEN']] # Sherpa, 536 +workflows[574]=['',['HydjetQ_B12_5020GeV_2018_ExtGen','HARVESTGEN']] # Hydjet, 150 +workflows[575]=['',['AMPT_PPb_5020GeV_MinimumBias_ExtGen','HARVESTGEN']] # AMPT, 280 +workflows[576]=['',['EPOS_PPb_8160GeV_MinimumBias_ExtGen','HARVESTGEN']] # ReggeGribovPartonMC, 281 +workflows[577]=['',['Pyquen_ZeemumuJets_pt10_2760GeV_ExtGen','HARVESTGEN']] # Pyquen, 302 diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index 3c6bd56721c47..a6d51b37517b8 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -1354,6 +1354,15 @@ def identityFS(wf): steps['ZprimeToll_M3000_13TeV_pythia8']=genvalid('ZprimeToll_M3000_13TeV_pythia8_cff',step1GenDefaults) steps['WprimeTolNu_M3000_13TeV_pythia8']=genvalid('WprimeTolNu_M3000_13TeV_pythia8_cff',step1GenDefaults) +steps['BsToMuMu_forSTEAM_13TeV_ExtGen']=genvalid('BsToMuMu_forSTEAM_13TeV_ExtGen_cfi',step1GenDefaults) +steps['BuToKstarJPsiToMuMu_forSTEAM_13TeV_ExtGen']=genvalid('BuToKstarJPsiToMuMu_forSTEAM_13TeV_ExtGen_cfi',step1GenDefaults) +steps['ZTTFS_ExtGen']=genvalid('ZTT_Tauola_OneLepton_OtherHadrons_8TeV_TuneCUETP8M1_ExtGen_cfi',step1GenDefaults) +steps['sherpa_ttbar_2j_MENLOPS_13TeV_MASTER_ExtGen']=genvalid('sherpa_ttbar_2j_MENLOPS_13TeV_MASTER_ExtGen_cff',step1GenDefaults) +steps['HydjetQ_B12_5020GeV_2018_ExtGen']=genvalid('Hydjet_Quenched_B12_5020GeV_ExtGen_cfi',step1GenDefaults) +steps['AMPT_PPb_5020GeV_MinimumBias_ExtGen']=genvalid('AMPT_PPb_5020GeV_MinimumBias_ExtGen_cfi',step1GenDefaults) +steps['EPOS_PPb_8160GeV_MinimumBias_ExtGen']=genvalid('ReggeGribovPartonMC_EposLHC_4080_4080GeV_pPb_ExtGen_cfi',step1GenDefaults) +steps['Pyquen_ZeemumuJets_pt10_2760GeV_ExtGen']=genvalid('Pyquen_ZeemumuJets_pt10_2760GeV_ExtGen_cfi',step1GenDefaults) + # Generator Hadronization (Hadronization of LHE) steps['WJetsLNu_13TeV_madgraph-pythia8']=genvalid('Hadronizer_MgmMatchTuneCUETP8M1_13TeV_madgraph_pythia8_cff',step1GenDefaults,dataSet='/WJetsToLNu_13TeV-madgraph/Fall13wmLHE-START62_V1-v1/GEN') steps['Hadronizer_TuneCUETP8M1_13TeV_MLM_5f_max4j_LHE_pythia8']=genvalid('Hadronizer_TuneCUETP8M1_13TeV_MLM_5f_max4j_LHE_pythia8_cff',step1HadronizerDefaults) @@ -1543,7 +1552,7 @@ def gen2018RD(fragment,howMuch): #Herwig7 steps['TTbar_13TeV_Pow_herwig7']=genvalid('Configuration/Generator/python/TT_13TeV_Pow_Herwig7_cff',step1LHEGenDQM) -steps['DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7']=genvalid('Configuration/Generator/python/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cff',step1LHEGenDQM) +steps['DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7']=genvalid('Configuration/Generator/python/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cff',merge([{'-n':'12'},step1LHEGenDQM])) steps['DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7']=genvalid('Configuration/Generator/python/DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cff',step1LHEGenDQM) diff --git a/Configuration/Skimming/BuildFile.xml b/Configuration/Skimming/BuildFile.xml index ccef0059d56f2..44376092763be 100644 --- a/Configuration/Skimming/BuildFile.xml +++ b/Configuration/Skimming/BuildFile.xml @@ -15,7 +15,6 @@ - diff --git a/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py b/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py index ff65846206acf..d1348f9e6ae95 100644 --- a/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py +++ b/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py @@ -215,7 +215,7 @@ pathALCARECOHcalCalIsoTrk = cms.Path(seqALCARECOHcalCalIsoTrk*ALCARECOHcalCalIsoTrackDQM) pathALCARECOHcalCalIsoTrkFilter = cms.Path(seqALCARECOHcalCalIsoTrkFilter) pathALCARECOHcalCalNoise = cms.Path(seqALCARECOHcalCalNoise) -pathALCARECOHcalCalIterativePhiSym = cms.Path(seqALCARECOHcalCalIterativePhiSym*ALCARECOHcalCalPhisymDQM) +pathALCARECOHcalCalIterativePhiSym = cms.Path(seqALCARECOHcalCalIterativePhiSym*ALCARECOHcalCalIterativePhisymDQM) pathALCARECOHcalCalIsolatedBunchFilter = cms.Path(seqALCARECOHcalCalIsolatedBunchFilter) pathALCARECOHcalCalIsolatedBunchSelector = cms.Path(seqALCARECOHcalCalIsolatedBunchSelector*ALCARECOHcalCalIsolatedBunchDQM) pathALCARECOHcalCalHBHEMuonFilter = cms.Path(seqALCARECOHcalCalHBHEMuonFilter) diff --git a/DQM/CastorMonitor/interface/CastorRecHitMonitor.h b/DQM/CastorMonitor/interface/CastorRecHitMonitor.h index 460c7302e2cb5..dbb6a930d09bc 100644 --- a/DQM/CastorMonitor/interface/CastorRecHitMonitor.h +++ b/DQM/CastorMonitor/interface/CastorRecHitMonitor.h @@ -13,7 +13,6 @@ #include "DataFormats/JetReco/interface/CastorJetID.h" #include "DataFormats/JetReco/interface/Jet.h" #include "RecoJets/JetProducers/interface/CastorJetIDHelper.h" -#include "RecoJets/JetProducers/plugins/CastorJetIDProducer.h" #include "DataFormats/Common/interface/TriggerResults.h" diff --git a/DQM/DTMonitorClient/python/dtRunConditionVarClient_cfi.py b/DQM/DTMonitorClient/python/dtRunConditionVarClient_cfi.py index a9f2a64f60cc6..a1cca0c6d1b6b 100644 --- a/DQM/DTMonitorClient/python/dtRunConditionVarClient_cfi.py +++ b/DQM/DTMonitorClient/python/dtRunConditionVarClient_cfi.py @@ -20,4 +20,6 @@ maxGoodT0Sigma = cms.untracked.double(2.), minBadT0Sigma = cms.untracked.double(4.), + readLegacyVDriftDB =cms.bool(True), + ) diff --git a/DQM/DTMonitorClient/src/DTRunConditionVarClient.cc b/DQM/DTMonitorClient/src/DTRunConditionVarClient.cc index 5025d3ee88058..161c09d01400b 100644 --- a/DQM/DTMonitorClient/src/DTRunConditionVarClient.cc +++ b/DQM/DTMonitorClient/src/DTRunConditionVarClient.cc @@ -30,8 +30,7 @@ using namespace edm; using namespace std; -DTRunConditionVarClient::DTRunConditionVarClient(const ParameterSet& pSet) - : mTimeMapToken_(esConsumes()) { +DTRunConditionVarClient::DTRunConditionVarClient(const ParameterSet& pSet) { LogVerbatim("DTDQM|DTMonitorClient|DTRunConditionVarClient") << "DTRunConditionVarClient: Constructor called"; minRangeVDrift = pSet.getUntrackedParameter("minRangeVDrift"); @@ -49,9 +48,17 @@ DTRunConditionVarClient::DTRunConditionVarClient(const ParameterSet& pSet) maxGoodT0Sigma = pSet.getUntrackedParameter("maxGoodT0Sigma"); minBadT0Sigma = pSet.getUntrackedParameter("minBadT0Sigma"); + readLegacyVDriftDB = pSet.getParameter("readLegacyVDriftDB"); + nevents = 0; bookingdone = false; + + if (readLegacyVDriftDB) { + mTimeMapToken_ = esConsumes(); + } else { + vDriftToken_ = esConsumes(); + } } DTRunConditionVarClient::~DTRunConditionVarClient() { @@ -61,7 +68,18 @@ DTRunConditionVarClient::~DTRunConditionVarClient() { void DTRunConditionVarClient::beginRun(const Run& run, const EventSetup& context) { LogTrace("DTDQM|DTMonitorClient|DTResolutionAnalysisTest") << "[DTRunConditionVarClient]: BeginRun"; // Get the map of vdrift from the setup - mTimeMap_ = &context.getData(mTimeMapToken_); + if (readLegacyVDriftDB) { + mTimeMap_ = &context.getData(mTimeMapToken_); + vDriftMap_ = nullptr; + } else { + vDriftMap_ = &context.getData(vDriftToken_); + mTimeMap_ = nullptr; + // Consistency check: no parametrization is implemented for the time being + int version = vDriftMap_->version(); + if (version != 1) { + throw cms::Exception("Configuration") << "only version 1 is presently supported for VDriftDB"; + } + } } void DTRunConditionVarClient::dqmEndLuminosityBlock(DQMStore::IBooker& ibooker, @@ -251,12 +269,17 @@ void DTRunConditionVarClient::percDevVDrift( float vDriftPhi1(0.), vDriftPhi2(0.); float ResPhi1(0.), ResPhi2(0.); - int status1 = mTimeMap_->get(indexSLPhi1, vDriftPhi1, ResPhi1, DTVelocityUnits::cm_per_ns); - int status2 = mTimeMap_->get(indexSLPhi2, vDriftPhi2, ResPhi2, DTVelocityUnits::cm_per_ns); + if (readLegacyVDriftDB) { // Legacy format + int status1 = mTimeMap_->get(indexSLPhi1, vDriftPhi1, ResPhi1, DTVelocityUnits::cm_per_ns); + int status2 = mTimeMap_->get(indexSLPhi2, vDriftPhi2, ResPhi2, DTVelocityUnits::cm_per_ns); - if (status1 != 0 || status2 != 0) { - DTSuperLayerId sl = (status1 != 0) ? indexSLPhi1 : indexSLPhi2; - throw cms::Exception("DTRunConditionVarClient") << "Could not find vDrift entry in DB for" << sl << endl; + if (status1 != 0 || status2 != 0) { + DTSuperLayerId sl = (status1 != 0) ? indexSLPhi1 : indexSLPhi2; + throw cms::Exception("DTRunConditionVarClient") << "Could not find vDrift entry in DB for" << sl << endl; + } + } else { + vDriftPhi1 = vDriftMap_->get(DTWireId(indexSLPhi1.rawId())); + vDriftPhi2 = vDriftMap_->get(DTWireId(indexSLPhi2.rawId())); } float vDriftMed = (vDriftPhi1 + vDriftPhi2) / 2.; diff --git a/DQM/DTMonitorClient/src/DTRunConditionVarClient.h b/DQM/DTMonitorClient/src/DTRunConditionVarClient.h index e9a35f7da9118..5327cec4b9b9a 100644 --- a/DQM/DTMonitorClient/src/DTRunConditionVarClient.h +++ b/DQM/DTMonitorClient/src/DTRunConditionVarClient.h @@ -27,6 +27,8 @@ #include "CondFormats/DTObjects/interface/DTMtime.h" #include "CondFormats/DataRecord/interface/DTMtimeRcd.h" +#include "CondFormats/DTObjects/interface/DTRecoConditions.h" +#include "CondFormats/DataRecord/interface/DTRecoConditionsVdriftRcd.h" #include "DQMServices/Core/interface/DQMStore.h" #include "FWCore/ServiceRegistry/interface/Service.h" @@ -43,6 +45,8 @@ class DTGeometry; class DTChamberId; class DTLayerId; +class DTMtime; +class DTRecoConditions; class DTRunConditionVarClient : public DQMEDHarvester { public: @@ -99,7 +103,11 @@ class DTRunConditionVarClient : public DQMEDHarvester { float minBadT0Sigma; edm::ESGetToken mTimeMapToken_; - const DTMtime* mTimeMap_; + const DTMtime* mTimeMap_; // legacy DB object + + edm::ESGetToken vDriftToken_; + const DTRecoConditions* vDriftMap_; // DB object in new format + bool readLegacyVDriftDB; // which one to use bool bookingdone; diff --git a/DQM/DTMonitorModule/python/dtRunConditionVar_cfi.py b/DQM/DTMonitorModule/python/dtRunConditionVar_cfi.py index 4f32437642974..766b8a36637b4 100644 --- a/DQM/DTMonitorModule/python/dtRunConditionVar_cfi.py +++ b/DQM/DTMonitorModule/python/dtRunConditionVar_cfi.py @@ -5,6 +5,7 @@ debug = cms.untracked.bool(False), nMinHitsPhi = cms.untracked.int32(5), maxAnglePhiSegm = cms.untracked.double(30.), - recoSegments = cms.InputTag('dt4DSegments'), + recoSegments = cms.InputTag('dt4DSegments'), + readLegacyVDriftDB =cms.bool(True), ) diff --git a/DQM/DTMonitorModule/src/DTRunConditionVar.cc b/DQM/DTMonitorModule/src/DTRunConditionVar.cc index 3833f965f7a28..163ff0e8e085c 100644 --- a/DQM/DTMonitorModule/src/DTRunConditionVar.cc +++ b/DQM/DTMonitorModule/src/DTRunConditionVar.cc @@ -46,7 +46,13 @@ DTRunConditionVar::DTRunConditionVar(const ParameterSet& pSet) maxAnglePhiSegm(pSet.getUntrackedParameter("maxAnglePhiSegm")), dt4DSegmentsToken_(consumes(pSet.getParameter("recoSegments"))), muonGeomToken_(esConsumes()), - mTimeToken_(esConsumes()) {} + readLegacyVDriftDB(pSet.getParameter("readLegacyVDriftDB")) { + if (readLegacyVDriftDB) { + mTimeToken_ = esConsumes(); + } else { + vDriftToken_ = esConsumes(); + } +} DTRunConditionVar::~DTRunConditionVar() { LogTrace("DTDQM|DTMonitorModule|DTRunConditionVar") << "DTRunConditionVar: destructor called"; @@ -83,8 +89,18 @@ void DTRunConditionVar::analyze(const Event& event, const EventSetup& eventSetup << endl; // Get the map of vdrift from the setup - mTime = &eventSetup.getData(mTimeToken_); - mTimeMap_ = &*mTime; + if (readLegacyVDriftDB) { + mTimeMap_ = &eventSetup.getData(mTimeToken_); + vDriftMap_ = nullptr; + } else { + vDriftMap_ = &eventSetup.getData(vDriftToken_); + mTimeMap_ = nullptr; + // Consistency check: no parametrization is implemented for the time being + int version = vDriftMap_->version(); + if (version != 1) { + throw cms::Exception("Configuration") << "only version 1 is presently supported for VDriftDB"; + } + } // Get the segment collection from the event Handle all4DSegments; @@ -113,12 +129,17 @@ void DTRunConditionVar::analyze(const Event& event, const EventSetup& eventSetup float vDriftPhi1(0.), vDriftPhi2(0.); float ResPhi1(0.), ResPhi2(0.); - int status1 = mTimeMap_->get(indexSLPhi1, vDriftPhi1, ResPhi1, DTVelocityUnits::cm_per_ns); - int status2 = mTimeMap_->get(indexSLPhi2, vDriftPhi2, ResPhi2, DTVelocityUnits::cm_per_ns); - - if (status1 != 0 || status2 != 0) { - DTSuperLayerId sl = (status1 != 0) ? indexSLPhi1 : indexSLPhi2; - throw cms::Exception("DTRunConditionVarClient") << "Could not find vDrift entry in DB for" << sl << endl; + if (readLegacyVDriftDB) { // Legacy format + int status1 = mTimeMap_->get(indexSLPhi1, vDriftPhi1, ResPhi1, DTVelocityUnits::cm_per_ns); + int status2 = mTimeMap_->get(indexSLPhi2, vDriftPhi2, ResPhi2, DTVelocityUnits::cm_per_ns); + + if (status1 != 0 || status2 != 0) { + DTSuperLayerId sl = (status1 != 0) ? indexSLPhi1 : indexSLPhi2; + throw cms::Exception("DTRunConditionVarClient") << "Could not find vDrift entry in DB for" << sl << endl; + } + } else { + vDriftPhi1 = vDriftMap_->get(DTWireId(indexSLPhi1.rawId())); + vDriftPhi2 = vDriftMap_->get(DTWireId(indexSLPhi2.rawId())); } float vDriftMed = (vDriftPhi1 + vDriftPhi2) / 2.; diff --git a/DQM/DTMonitorModule/src/DTRunConditionVar.h b/DQM/DTMonitorModule/src/DTRunConditionVar.h index d16ada1a5d206..a8e5d87c7a8cb 100644 --- a/DQM/DTMonitorModule/src/DTRunConditionVar.h +++ b/DQM/DTMonitorModule/src/DTRunConditionVar.h @@ -33,6 +33,8 @@ #include "MagneticField/Engine/interface/MagneticField.h" #include "CondFormats/DTObjects/interface/DTMtime.h" #include "CondFormats/DataRecord/interface/DTMtimeRcd.h" +#include "CondFormats/DTObjects/interface/DTRecoConditions.h" +#include "CondFormats/DataRecord/interface/DTRecoConditionsVdriftRcd.h" #include "RecoMuon/MeasurementDet/interface/MuonDetLayerMeasurements.h" #include "DQMServices/Core/interface/DQMStore.h" @@ -71,8 +73,11 @@ class DTRunConditionVar : public DQMEDAnalyzer { const DTGeometry* dtGeom; edm::ESGetToken mTimeToken_; - const DTMtime* mTime; - const DTMtime* mTimeMap_; + const DTMtime* mTimeMap_; // legacy DB object + + edm::ESGetToken vDriftToken_; + const DTRecoConditions* vDriftMap_; // DB object in new format + bool readLegacyVDriftDB; // which one to use std::map > chamberHistos; diff --git a/DQM/EcalMonitorDbModule/interface/EcalCondDBReader.h b/DQM/EcalMonitorDbModule/interface/EcalCondDBReader.h index 5a47624e56afe..09370dbf65098 100644 --- a/DQM/EcalMonitorDbModule/interface/EcalCondDBReader.h +++ b/DQM/EcalMonitorDbModule/interface/EcalCondDBReader.h @@ -5,6 +5,7 @@ #include "DQM/EcalCommon/interface/MESet.h" #include "DQMServices/Core/interface/DQMEDHarvester.h" #include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h" +#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" class EcalCondDBReader : public DQMEDHarvester { public: @@ -46,6 +47,7 @@ class EcalCondDBReader : public DQMEDHarvester { int verbosity_; bool executed_; + edm::ESGetToken elecMapHandle; }; #endif diff --git a/DQM/EcalMonitorDbModule/interface/EcalDQMStatusWriter.h b/DQM/EcalMonitorDbModule/interface/EcalDQMStatusWriter.h index 0b58719e6846a..56ee6decfeabb 100644 --- a/DQM/EcalMonitorDbModule/interface/EcalDQMStatusWriter.h +++ b/DQM/EcalMonitorDbModule/interface/EcalDQMStatusWriter.h @@ -1,7 +1,7 @@ #ifndef EcalDQMStatusWriter_H #define EcalDQMStatusWriter_H -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "CondFormats/EcalObjects/interface/EcalDQMChannelStatus.h" #include "CondFormats/EcalObjects/interface/EcalDQMTowerStatus.h" @@ -11,14 +11,14 @@ #include -class EcalDQMStatusWriter : public edm::EDAnalyzer { +class EcalDQMStatusWriter : public edm::one::EDAnalyzer<> { public: EcalDQMStatusWriter(edm::ParameterSet const &); ~EcalDQMStatusWriter() override {} private: void analyze(edm::Event const &, edm::EventSetup const &) override; - void beginRun(edm::Run const &, edm::EventSetup const &) override; + void beginRun(edm::Run const &, edm::EventSetup const &); EcalDQMChannelStatus channelStatus_; EcalDQMTowerStatus towerStatus_; @@ -28,6 +28,7 @@ class EcalDQMStatusWriter : public edm::EDAnalyzer { EcalElectronicsMapping const *electronicsMap; void setElectronicsMap(edm::EventSetup const &); EcalElectronicsMapping const *GetElectronicsMap(); + edm::ESGetToken elecMapHandle; }; #endif diff --git a/DQM/EcalMonitorDbModule/plugins/EcalCondDBReader.cc b/DQM/EcalMonitorDbModule/plugins/EcalCondDBReader.cc index 0fa79be46288a..e5cfcd3e301dd 100644 --- a/DQM/EcalMonitorDbModule/plugins/EcalCondDBReader.cc +++ b/DQM/EcalMonitorDbModule/plugins/EcalCondDBReader.cc @@ -9,15 +9,14 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" -#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" - EcalCondDBReader::EcalCondDBReader(edm::ParameterSet const &_ps) : db_(nullptr), monIOV_(), worker_(nullptr), formula_(_ps.getUntrackedParameter("formula")), meSet_(ecaldqm::createMESet(_ps.getUntrackedParameterSet("plot"))), - verbosity_(_ps.getUntrackedParameter("verbosity")) { + verbosity_(_ps.getUntrackedParameter("verbosity")), + elecMapHandle(esConsumes()) { std::string table(_ps.getUntrackedParameter("table")); edm::ParameterSet const &workerParams(_ps.getUntrackedParameterSet("workerParams")); @@ -159,11 +158,7 @@ void EcalCondDBReader::dqmEndRun(DQMStore::IBooker &_ibooker, meSet_->setBinContent(getEcalDQMSetupObjects(), vItr->first, vItr->second); } -void EcalCondDBReader::setElectronicsMap(edm::EventSetup const &_es) { - edm::ESHandle elecMapHandle; - _es.get().get(elecMapHandle); - electronicsMap = elecMapHandle.product(); -} +void EcalCondDBReader::setElectronicsMap(edm::EventSetup const &_es) { electronicsMap = &_es.getData(elecMapHandle); } EcalElectronicsMapping const *EcalCondDBReader::GetElectronicsMap() { if (!electronicsMap) diff --git a/DQM/EcalMonitorDbModule/plugins/EcalDQMStatusWriter.cc b/DQM/EcalMonitorDbModule/plugins/EcalDQMStatusWriter.cc index 7808034340355..84e3377f925e6 100644 --- a/DQM/EcalMonitorDbModule/plugins/EcalDQMStatusWriter.cc +++ b/DQM/EcalMonitorDbModule/plugins/EcalDQMStatusWriter.cc @@ -15,7 +15,8 @@ EcalDQMStatusWriter::EcalDQMStatusWriter(edm::ParameterSet const &_ps) : channelStatus_(), towerStatus_(), firstRun_(_ps.getUntrackedParameter("firstRun")), - inputFile_(_ps.getUntrackedParameter("inputFile")) { + inputFile_(_ps.getUntrackedParameter("inputFile")), + elecMapHandle(esConsumes()) { if (!inputFile_.is_open()) throw cms::Exception("Invalid input for EcalDQMStatusWriter"); } @@ -41,9 +42,7 @@ void EcalDQMStatusWriter::analyze(edm::Event const &, edm::EventSetup const &_es } void EcalDQMStatusWriter::setElectronicsMap(edm::EventSetup const &_es) { - edm::ESHandle elecMapHandle; - _es.get().get(elecMapHandle); - electronicsMap = elecMapHandle.product(); + electronicsMap = &_es.getData(elecMapHandle); } EcalElectronicsMapping const *EcalDQMStatusWriter::GetElectronicsMap() { diff --git a/DQM/EcalMonitorTasks/python/TrigPrimTask_cfi.py b/DQM/EcalMonitorTasks/python/TrigPrimTask_cfi.py index 940c0121324a9..be022a7fbba80 100644 --- a/DQM/EcalMonitorTasks/python/TrigPrimTask_cfi.py +++ b/DQM/EcalMonitorTasks/python/TrigPrimTask_cfi.py @@ -267,14 +267,14 @@ ), RealvEmulEt = cms.untracked.PSet( kind = cms.untracked.string('TH2F'), - yaxis = cms.untracked.PSet( + xaxis = cms.untracked.PSet( high = cms.untracked.double(256.0), nbins = cms.untracked.int32(128), low = cms.untracked.double(0.0), title = cms.untracked.string('Real data TP Et (ADC)') ), otype = cms.untracked.string('Ecal3P'), - xaxis = cms.untracked.PSet( + yaxis = cms.untracked.PSet( high = cms.untracked.double(256.0), nbins = cms.untracked.int32(128), low = cms.untracked.double(0.0), diff --git a/DQM/GEM/interface/GEMDigiSource.h b/DQM/GEM/interface/GEMDigiSource.h index 0e8f2192b7284..fa89c01dfa2fd 100644 --- a/DQM/GEM/interface/GEMDigiSource.h +++ b/DQM/GEM/interface/GEMDigiSource.h @@ -40,6 +40,7 @@ class GEMDigiSource : public GEMDQMBase { private: int ProcessWithMEMap2WithEta(BookingHelper& bh, ME3IdsKey key) override; + int ProcessWithMEMap2(BookingHelper& bh, ME2IdsKey key) override; int ProcessWithMEMap3(BookingHelper& bh, ME3IdsKey key) override; int ProcessWithMEMap3WithChamber(BookingHelper& bh, ME4IdsKey key) override; @@ -52,7 +53,7 @@ class GEMDigiSource : public GEMDQMBase { MEMap3Inf mapDigiOcc_phi_; MEMap3Inf mapTotalDigiPerEvtLayer_; MEMap3Inf mapTotalDigiPerEvtIEta_; - MEMap3Inf mapBX_iEta_; + MEMap2Inf mapBX_; MEMap4Inf mapDigiOccPerCh_; diff --git a/DQM/GEM/plugins/BuildFile.xml b/DQM/GEM/plugins/BuildFile.xml index a469275194e23..b811f938f2f7d 100644 --- a/DQM/GEM/plugins/BuildFile.xml +++ b/DQM/GEM/plugins/BuildFile.xml @@ -2,10 +2,6 @@ - - - - diff --git a/DQM/GEM/plugins/GEMDigiSource.cc b/DQM/GEM/plugins/GEMDigiSource.cc index db97a4b4845a1..34ae5d5d6e4d2 100644 --- a/DQM/GEM/plugins/GEMDigiSource.cc +++ b/DQM/GEM/plugins/GEMDigiSource.cc @@ -48,7 +48,7 @@ void GEMDigiSource::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const&, "Number of fired digis", "Events"); - mapBX_iEta_ = MEMap3Inf(this, "bx", "Digi Bunch Crossing", 21, nBXMin_ - 0.5, nBXMax_ + 0.5, "Bunch crossing"); + mapBX_ = MEMap2Inf(this, "bx", "Digi Bunch Crossing", 21, nBXMin_ - 0.5, nBXMax_ + 0.5, "Bunch crossing"); mapDigiOccPerCh_ = MEMap4Inf(this, "occ", "Digi Occupancy", 1, -0.5, 1.5, 1, 0.5, 1.5, "Digi", "iEta"); @@ -69,8 +69,13 @@ void GEMDigiSource::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const&, } } +int GEMDigiSource::ProcessWithMEMap2(BookingHelper& bh, ME2IdsKey key) { + mapBX_.bookND(bh, key); + + return 0; +} + int GEMDigiSource::ProcessWithMEMap2WithEta(BookingHelper& bh, ME3IdsKey key) { - mapBX_iEta_.bookND(bh, key); mapTotalDigiPerEvtIEta_.bookND(bh, key); return 0; @@ -157,7 +162,7 @@ void GEMDigiSource::analyze(edm::Event const& event, edm::EventSetup const& even // Filling of bx Int_t nBX = std::min(std::max((Int_t)d->bx(), nBXMin_), nBXMax_); // For under/overflow if (bTagVFAT.find(nIdxVFAT) == bTagVFAT.end()) { - mapBX_iEta_.Fill(key3IEta, nBX); + mapBX_.Fill(key2, nBX); } // Occupancy on a chamber diff --git a/DQM/GEM/python/GEMDQM_cff.py b/DQM/GEM/python/GEMDQM_cff.py index 61f49aec52acf..48a09b0413584 100644 --- a/DQM/GEM/python/GEMDQM_cff.py +++ b/DQM/GEM/python/GEMDQM_cff.py @@ -16,3 +16,6 @@ GEMDigiSource *GEMRecHitSource ) + +from Configuration.Eras.Modifier_phase2_GEM_cff import phase2_GEM +phase2_GEM.toModify(GEMDigiSource, digisInputLabel = "simMuonGEMDigis") diff --git a/DQM/GEM/src/GEMDQMBase.cc b/DQM/GEM/src/GEMDQMBase.cc index 2ef57115190ad..c2aa3349b4fea 100644 --- a/DQM/GEM/src/GEMDQMBase.cc +++ b/DQM/GEM/src/GEMDQMBase.cc @@ -211,8 +211,8 @@ int GEMDQMBase::GenerateMEPerChamber(DQMStore::IBooker& ibooker) { MEMap2WithEtaCheck_[key2WithEta] = true; } if (!MEMap2AbsReWithEtaCheck_[key2AbsReWithEta]) { - auto strSuffixName = Form("_GE%i%i-E%02i", std::abs(gid.region()), gid.station(), eId.ieta()); - auto strSuffixTitle = Form(" GE%i%i-E%02i", std::abs(gid.region()), gid.station(), eId.ieta()); + auto strSuffixName = Form("_GE%d1-E%02i", gid.station(), eId.ieta()); + auto strSuffixTitle = Form(" GE%d1-E%02i", gid.station(), eId.ieta()); BookingHelper bh3(ibooker, strSuffixName, strSuffixTitle); ProcessWithMEMap2AbsReWithEta(bh3, key2AbsReWithEta); MEMap2AbsReWithEtaCheck_[key2AbsReWithEta] = true; diff --git a/DQM/Integration/python/clients/sistrip_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/sistrip_dqm_sourceclient-live_cfg.py index 7b074f7ad715a..f6c0a82d59682 100644 --- a/DQM/Integration/python/clients/sistrip_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/sistrip_dqm_sourceclient-live_cfg.py @@ -288,6 +288,17 @@ ) +### COMMISSIONING RUN SETTINGS +if (process.runType.getRunType() == process.runType.commissioning_run): + #event selection for commissioning runs + if ((process.runType.getRunType() == process.runType.commissioning_run) and live): + process.source.SelectEvents = ['HLT_*'] + + process.SiStripFedMonitor = cms.Sequence(process.siStripFEDMonitor) + process.p = cms.Path( + process.siStripFEDCheck * + process.SiStripFedMonitor + ) #else : ### pp COLLISION SETTING diff --git a/DQM/Integration/python/config/dqmPythonTypes.py b/DQM/Integration/python/config/dqmPythonTypes.py index c12f2757a05a8..79fc6e2a8594d 100644 --- a/DQM/Integration/python/config/dqmPythonTypes.py +++ b/DQM/Integration/python/config/dqmPythonTypes.py @@ -2,7 +2,7 @@ from FWCore.ParameterSet.Types import PSet import FWCore.ParameterSet.Config as cms class RunType(PSet): - def __init__(self,types=['pp_run','pp_run_stage1','cosmic_run','cosmic_run_stage1','hi_run','hpu_run']): + def __init__(self,types=['pp_run','pp_run_stage1','cosmic_run','cosmic_run_stage1','hi_run','hpu_run','commissioning_run']): PSet.__init__(self) self.__runTypesDict = {} t=[(x,types.index(x)) for x in types ] diff --git a/DQM/L1TMonitor/src/L1TBPTX.cc b/DQM/L1TMonitor/src/L1TBPTX.cc index 80f258e6f6a0c..85c4f8abdc333 100644 --- a/DQM/L1TMonitor/src/L1TBPTX.cc +++ b/DQM/L1TMonitor/src/L1TBPTX.cc @@ -415,44 +415,29 @@ void L1TBPTX::analyze(const Event& iEvent, const EventSetup& eventSetup) { triggerName = "tech_" + std::to_string(bit); } - int evBxStart = -2; - int evBxEnd = 2; - - if (offset < 0) { - evBxStart += -1 * offset; - } - if (offset > 0) { - evBxEnd += -1 * offset; - } - for (unsigned a = 0; a < gtFdlVectorData.size(); a++) { int testBx = gtFdlVectorData[a].localBxNr() - offset; bool lhcBxFilled = m_beamConfig.beam1[testBx] && m_beamConfig.beam2[testBx]; bool algoFired = false; if (isAlgo) { - if (gtFdlVectorData[a].gtDecisionWord()[bit]) { + if (gtFdlVectorData[a].gtDecisionWord()[bit]) algoFired = true; - } } else { - if (gtFdlVectorData[a].gtTechnicalTriggerWord()[bit]) { + if (gtFdlVectorData[a].gtTechnicalTriggerWord()[bit]) algoFired = true; - } } if (lhcBxFilled) { m_effDenominator[triggerName]++; + if (algoFired) + m_effNumerator[triggerName]++; } - if (lhcBxFilled && algoFired) { - m_effNumerator[triggerName]++; - } - if (algoFired) { - m_missFireNumerator[triggerName]++; - } - if (algoFired && !lhcBxFilled) { - m_missFireNumerator[triggerName]++; + m_missFireDenominator[triggerName]++; + if (!lhcBxFilled) + m_missFireNumerator[triggerName]++; } } } diff --git a/DQM/L1TMonitor/src/L1TdeGCT.cc b/DQM/L1TMonitor/src/L1TdeGCT.cc index 47af6d219c578..f561dbd136ef8 100644 --- a/DQM/L1TMonitor/src/L1TdeGCT.cc +++ b/DQM/L1TMonitor/src/L1TdeGCT.cc @@ -421,7 +421,7 @@ void L1TdeGCT::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) it->rank(rankarr); float rnkv = rankarr[0]; - double wei = 1.; + double wei; unsigned int mask = (~0x0); @@ -433,16 +433,14 @@ void L1TdeGCT::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) } //type: 0:agree 1:loc.agree, 2:loc.disagree, 3:data.only, 4:emul.only - if (it->type() < 4) + if (type < 4) sysncand[0]->Fill(ccid); - if (it->type() < 5 && it->type() != 3) + if (type < 5 && type != 3) sysncand[1]->Fill(ccid); errortype[ccid]->Fill(type); - wei = 1.; - if (!type) - wei = 0.; + wei = (type == 0) ? 0. : 1.; if (etav != nullVal && phiv != nullVal) etaphi[ccid]->Fill(etav, phiv, wei); if (etav != nullVal) @@ -452,15 +450,12 @@ void L1TdeGCT::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) rnk[ccid]->Fill(rnkv, wei); //exclude e-only cands (only data) - wei = 1.; - if (type == 4) - wei = 0.; + wei = (type == 4) ? 0. : 1.; if (etav != nullVal) etaData[ccid]->Fill(etav, wei); if (phiv != nullVal) phiData[ccid]->Fill(phiv, wei); rnkData[ccid]->Fill(rnkv, wei); - wei = 1; // GCT trigger bits unsigned int word[2]; @@ -484,10 +479,8 @@ void L1TdeGCT::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) ///bitset loop for (int ibit = 0; ibit < 32; ibit++) { - wei = 1.; //comparison gives no info if there's only 1 candidate - if (type == 3 || type == 4) - wei = 0.; + wei = (type == 3 || type == 4) ? 0. : 1.; if (dbits[ibit]) dword[ccid]->Fill(ibit, wei); if (ebits[ibit]) @@ -496,7 +489,6 @@ void L1TdeGCT::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) deword[ccid]->Fill(ibit, wei); //if(dembits[ibit])masked[sid]->Fill(ibit,wei); } - wei = 1; } //error rates per GCT trigger object type @@ -606,7 +598,7 @@ void L1TdeGCT::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) it->rank(rankarr); float rnkv = rankarr[0]; - double wei = 1.; + double wei; unsigned int mask = (~0x0); @@ -618,14 +610,12 @@ void L1TdeGCT::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) } //type: 0:agree 1:loc.agree, 2:loc.disagree, 3:data.only, 4:emul.only - if (it->type() < 4) + if (type < 4) sysncand[0]->Fill(ccid); - if (it->type() < 5 && it->type() != 3) + if (type < 5 && type != 3) sysncand[1]->Fill(ccid); errortype_stage1layer2[ccid]->Fill(type); - wei = 1.; - if (!type) - wei = 0.; + wei = (type == 0) ? 0. : 1.; if (etav != nullVal && phiv != nullVal) etaphi_stage1layer2[ccid]->Fill(etav, phiv, wei); if (etav != nullVal) @@ -635,15 +625,12 @@ void L1TdeGCT::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) rnk_stage1layer2[ccid]->Fill(rnkv, wei); //exclude e-only cands (only data) - wei = 1.; - if (type == 4) - wei = 0.; + wei = (type == 4) ? 0. : 1.; if (etav != nullVal) etaData_stage1layer2[ccid]->Fill(etav, wei); if (phiv != nullVal) phiData_stage1layer2[ccid]->Fill(phiv, wei); rnkData_stage1layer2[ccid]->Fill(rnkv, wei); - wei = 1; // GCT trigger bits unsigned int word_stage1layer2[2]; @@ -667,10 +654,8 @@ void L1TdeGCT::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) ///bitset loop for (int ibit = 0; ibit < 32; ibit++) { - wei = 1.; //comparison gives no info if there's only 1 candidate - if (type == 3 || type == 4) - wei = 0.; + wei = (type == 3 || type == 4) ? 0. : 1.; if (dbits[ibit]) dword_stage1layer2[ccid]->Fill(ibit, wei); if (ebits[ibit]) @@ -679,7 +664,6 @@ void L1TdeGCT::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) deword_stage1layer2[ccid]->Fill(ibit, wei); //if(dembits[ibit])masked[sid]->Fill(ibit,wei); } - wei = 1; } //error rates per GCT trigger object type int hasCol[nStage1Layer2Coll_] = {0}; diff --git a/DQM/Physics/src/QcdUeDQM.cc b/DQM/Physics/src/QcdUeDQM.cc index cf42e21baf121..9fe3cb09d7158 100644 --- a/DQM/Physics/src/QcdUeDQM.cc +++ b/DQM/Physics/src/QcdUeDQM.cc @@ -17,7 +17,6 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "Geometry/CommonDetUnit/interface/GeomDet.h" -#include "CommonTools/RecoAlgos/interface/TrackToRefCandidate.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetType.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" diff --git a/DQM/SiPixelMonitorClient/src/SiPixelActionExecutor.cc b/DQM/SiPixelMonitorClient/src/SiPixelActionExecutor.cc index dfb1bfadf7273..f7ed01fdb6462 100644 --- a/DQM/SiPixelMonitorClient/src/SiPixelActionExecutor.cc +++ b/DQM/SiPixelMonitorClient/src/SiPixelActionExecutor.cc @@ -1875,9 +1875,9 @@ void SiPixelActionExecutor::normaliseAvDigiOcc(DQMStore::IBooker &iBooker, DQMSt float averageFPIXOcc = totalDigisFPIX / 8.; for (int i = 1; i != 41; i++) { if (i < 33) - roccupancyPlot->setBinContent(i, roccupancyPlot->getBinContent(i) / averageBPIXOcc); + roccupancyPlot->setBinContent(i, averageBPIXOcc != 0. ? roccupancyPlot->getBinContent(i) / averageBPIXOcc : 0.); else - roccupancyPlot->setBinContent(i, roccupancyPlot->getBinContent(i) / averageFPIXOcc); + roccupancyPlot->setBinContent(i, averageFPIXOcc != 0. ? roccupancyPlot->getBinContent(i) / averageFPIXOcc : 0.); } iGetter.setCurrentFolder(iBooker.pwd()); @@ -1903,10 +1903,13 @@ void SiPixelActionExecutor::normaliseAvDigiOccVsLumi(DQMStore::IBooker &iBooker, float averageBPIXOcc = totalDigisBPIX / 32.; float averageFPIXOcc = totalDigisFPIX / 8.; for (int i = 1; i != 41; i++) { - if (i < 33) - avgfedDigiOccvsLumi->setBinContent(lumisec, i, avgfedDigiOccvsLumi->getBinContent(lumisec, i) / averageBPIXOcc); - else - avgfedDigiOccvsLumi->setBinContent(lumisec, i, avgfedDigiOccvsLumi->getBinContent(lumisec, i) / averageFPIXOcc); + if (i < 33) { + avgfedDigiOccvsLumi->setBinContent( + lumisec, i, averageBPIXOcc != 0. ? avgfedDigiOccvsLumi->getBinContent(lumisec, i) / averageBPIXOcc : 0.); + } else { + avgfedDigiOccvsLumi->setBinContent( + lumisec, i, averageFPIXOcc != 0. ? avgfedDigiOccvsLumi->getBinContent(lumisec, i) / averageFPIXOcc : 0.); + } } iGetter.setCurrentFolder(iBooker.pwd()); diff --git a/DQM/SiPixelMonitorDigi/src/SiPixelDigiSource.cc b/DQM/SiPixelMonitorDigi/src/SiPixelDigiSource.cc index e8f3903623e19..cff88ed7e3327 100644 --- a/DQM/SiPixelMonitorDigi/src/SiPixelDigiSource.cc +++ b/DQM/SiPixelMonitorDigi/src/SiPixelDigiSource.cc @@ -137,11 +137,12 @@ void SiPixelDigiSource::globalEndLuminosityBlock(const edm::LuminosityBlock& lb, averageDigiOccupancy->Fill( i, averageOcc); // "modOn" basically mean Online DQM, in this case fill histos with actual value of digi fraction per fed for each ten lumisections - if (avgfedDigiOccvsLumi && thisls % 5 == 0) + if (avgfedDigiOccvsLumi && thisls % 5 == 0) { avgfedDigiOccvsLumi->setBinContent( int(thisls / 5), i + 1, averageOcc); //fill with the mean over 5 lumisections, previous code was filling this histo only with last event of each 10th lumisection + } } } diff --git a/DQM/SiStripCommissioningDbClients/src/FastFedCablingHistosUsingDb.cc b/DQM/SiStripCommissioningDbClients/src/FastFedCablingHistosUsingDb.cc index 8f2eccae99fdf..b8fa023310d3a 100644 --- a/DQM/SiStripCommissioningDbClients/src/FastFedCablingHistosUsingDb.cc +++ b/DQM/SiStripCommissioningDbClients/src/FastFedCablingHistosUsingDb.cc @@ -468,7 +468,7 @@ void FastFedCablingHistosUsingDb::connections(SiStripConfigDb::DeviceDescription if (idet == detids.end()) { continue; } - if (idet->second) { + if (!idet->second) { continue; } diff --git a/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcher.cc b/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcher.cc index 40edaf5ed2f0d..241003a5b4d25 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcher.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcher.cc @@ -6,7 +6,7 @@ #include "FWCore/Sources/interface/VectorInputSource.h" #include "FWCore/Sources/interface/VectorInputSourceDescription.h" #include "FWCore/Sources/interface/VectorInputSourceFactory.h" -#include "FWCore/Framework/src/SignallingProductRegistry.h" +#include "FWCore/Framework/interface/SignallingProductRegistry.h" #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h" #include "DataFormats/Common/interface/DetSetVector.h" diff --git a/DQMOffline/CalibCalo/BuildFile.xml b/DQMOffline/CalibCalo/BuildFile.xml deleted file mode 100644 index 67b730da69801..0000000000000 --- a/DQMOffline/CalibCalo/BuildFile.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DQMOffline/CalibCalo/interface/DQMSourceEleCalib.h b/DQMOffline/CalibCalo/interface/DQMSourceEleCalib.h deleted file mode 100644 index c6584b99bb980..0000000000000 --- a/DQMOffline/CalibCalo/interface/DQMSourceEleCalib.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef DQMSourceEleCalib_H -#define DQMSourceEleCalib_H - -/** \class DQMSourceEleCalib - * * - * DQM Source for phi symmetry stream - * - * \author Stefano Argiro' - * Andrea Gozzelino - Universita  e INFN Torino - * - */ - -#include "DataFormats/DetId/interface/DetId.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" - -#include "DQMServices/Core/interface/DQMEDAnalyzer.h" -#include "DQMServices/Core/interface/DQMStore.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" - -class DQMSourceEleCalib : public DQMEDAnalyzer { -public: - DQMSourceEleCalib(const edm::ParameterSet &); - ~DQMSourceEleCalib() override; - -protected: - void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; - - void analyze(const edm::Event &e, const edm::EventSetup &c) override; - -private: - //! find the MOX - DetId findMaxHit(const std::vector> &, - const EcalRecHitCollection *, - const EcalRecHitCollection *); - //! fills local occupancy graphs - void fillAroundBarrel(const EcalRecHitCollection *, int, int); - void fillAroundEndcap(const EcalRecHitCollection *, int, int); - - int eventCounter_; - - //! Number of recHits per electron - MonitorElement *recHitsPerElectron_; - //! Number of electrons - MonitorElement *ElectronsNumber_; - //! ESCoP - MonitorElement *ESCoP_; - //! Occupancy - MonitorElement *OccupancyEB_; - MonitorElement *OccupancyEEP_; - MonitorElement *OccupancyEEM_; - MonitorElement *LocalOccupancyEB_; - MonitorElement *LocalOccupancyEE_; - - //! recHits over associated recHits - MonitorElement *HitsVsAssociatedHits_; - - /// object to monitor - edm::EDGetTokenT productMonitoredEB_; - - /// object to monitor - edm::EDGetTokenT productMonitoredEE_; - //! electrons to monitor - edm::EDGetTokenT productMonitoredElectrons_; - - /// Monitor every prescaleFactor_ events - unsigned int prescaleFactor_; - - /// DQM folder name - std::string folderName_; - - /// Write to file - bool saveToFile_; - - /// Output file name if required - std::string fileName_; -}; - -#endif diff --git a/DQMOffline/CalibCalo/plugins/BuildFile.xml b/DQMOffline/CalibCalo/plugins/BuildFile.xml index b7903a0d73b16..c2d5fb1806da4 100644 --- a/DQMOffline/CalibCalo/plugins/BuildFile.xml +++ b/DQMOffline/CalibCalo/plugins/BuildFile.xml @@ -1,4 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + - diff --git a/DQMOffline/CalibCalo/src/DQMHOAlCaRecoStream.cc b/DQMOffline/CalibCalo/plugins/DQMHOAlCaRecoStream.cc similarity index 78% rename from DQMOffline/CalibCalo/src/DQMHOAlCaRecoStream.cc rename to DQMOffline/CalibCalo/plugins/DQMHOAlCaRecoStream.cc index 74244d4f71bf9..fe7cde9188ab1 100644 --- a/DQMOffline/CalibCalo/src/DQMHOAlCaRecoStream.cc +++ b/DQMOffline/CalibCalo/plugins/DQMHOAlCaRecoStream.cc @@ -18,38 +18,67 @@ // // system include files -#include +#include // user include files +#include "DataFormats/HcalCalibObjects/interface/HOCalibVariables.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" - -#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" - #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DQMOffline/CalibCalo/src/DQMHOAlCaRecoStream.h" +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" +#include "DQMServices/Core/interface/DQMStore.h" #include "DQMServices/Core/interface/DQMStore.h" #include "FWCore/ServiceRegistry/interface/Service.h" -#include - // // class decleration // -using namespace std; -using namespace edm; -// -// constants, enums and typedefs -// +class DQMHOAlCaRecoStream : public DQMEDAnalyzer { +public: + explicit DQMHOAlCaRecoStream(const edm::ParameterSet &); + ~DQMHOAlCaRecoStream() override; -// -// static data member definitions -// +private: + void analyze(const edm::Event &, const edm::EventSetup &) override; + void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + + // ----------member data --------------------------- + + MonitorElement *hMuonMultipl; + MonitorElement *hMuonMom; + MonitorElement *hMuonEta; + MonitorElement *hMuonPhi; + + MonitorElement *hDirCosine; + MonitorElement *hHOTime; + + MonitorElement *hSigRing[5]; + MonitorElement *hPedRing[5]; + MonitorElement *hSignal3x3[9]; + + int Nevents; + int Nmuons; + + std::string theRootFileName; + std::string folderName_; + double m_sigmaValue; + + double m_lowRadPosInMuch; + double m_highRadPosInMuch; + + int m_nbins; + double m_lowEdge; + double m_highEdge; + + bool saveToFile_; + edm::EDGetTokenT hoCalibVariableCollectionTag; +}; // // constructors and destructor @@ -59,8 +88,8 @@ DQMHOAlCaRecoStream::DQMHOAlCaRecoStream(const edm::ParameterSet &iConfig) consumes(iConfig.getParameter("hoCalibVariableCollectionTag"))) { // now do what ever initialization is needed - theRootFileName = iConfig.getUntrackedParameter("RootFileName", "tmp.root"); - folderName_ = iConfig.getUntrackedParameter("folderName"); + theRootFileName = iConfig.getUntrackedParameter("RootFileName", "tmp.root"); + folderName_ = iConfig.getUntrackedParameter("folderName"); m_sigmaValue = iConfig.getUntrackedParameter("sigmaval", 0.2); m_lowRadPosInMuch = iConfig.getUntrackedParameter("lowradposinmuch", 400.0); m_highRadPosInMuch = iConfig.getUntrackedParameter("highradposinmuch", 480.0); @@ -81,8 +110,6 @@ DQMHOAlCaRecoStream::~DQMHOAlCaRecoStream() { // ------------ method called to for each event ------------ void DQMHOAlCaRecoStream::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { - using namespace edm; - Nevents++; edm::Handle HOCalib; @@ -188,27 +215,6 @@ void DQMHOAlCaRecoStream::bookHistograms(DQMStore::IBooker &ibooker, hPedRing[i]->setAxisTitle(title, 1); } - // hSigRingm1 = ibooker.book1D("hSigRingm1", "HO signal in Ring-1", m_nbins, - // m_lowEdge, m_highEdge); hSigRingm1->setAxisTitle("HO signal in Ring-1",1); - - // hSigRing00 = ibooker.book1D("hSigRing00", "HO signal in Ring_0", m_nbins, - // m_lowEdge, m_highEdge); hSigRing00->setAxisTitle("HO signal in Ring_0",1); - - // hSigRingp1 = ibooker.book1D("hSigRingp1", "HO signal in Ring-1", m_nbins, - // m_lowEdge, m_highEdge); hSigRingp1->setAxisTitle("HO signal in Ring+1",1); - - // hSigRingp2 = ibooker.book1D("hSigRingp2", "HO signal in Ring-2", m_nbins, - // m_lowEdge, m_highEdge); hSigRingp2->setAxisTitle("HO signal in Ring+2",1); - - // hPedRingm2 = ibooker.book1D("hPedRingm2", "HO pedestal in Ring-2", - // m_nbins, m_lowEdge, m_highEdge); hPedRingm1 = ibooker.book1D("hPedRingm1", - // "HO pedestal in Ring-1", m_nbins, m_lowEdge, m_highEdge); hPedRing00 = - // ibooker.book1D("hPedRing00", "HO pedestal in Ring_0", m_nbins, m_lowEdge, - // m_highEdge); hPedRingp1 = ibooker.book1D("hPedRingp1", "HO pedestal in - // Ring-1", m_nbins, m_lowEdge, m_highEdge); hPedRingp2 = - // ibooker.book1D("hPedRingp2", "HO pedestal in Ring-2", m_nbins, m_lowEdge, - // m_highEdge); - for (int i = -1; i <= 1; i++) { for (int j = -1; j <= 1; j++) { int k = 3 * (i + 1) + j + 1; @@ -222,3 +228,5 @@ void DQMHOAlCaRecoStream::bookHistograms(DQMStore::IBooker &ibooker, Nevents = 0; Nmuons = 0; } + +DEFINE_FWK_MODULE(DQMHOAlCaRecoStream); diff --git a/DQMOffline/CalibCalo/src/DQMHcalDiJetsAlCaReco.cc b/DQMOffline/CalibCalo/plugins/DQMHcalDiJetsAlCaReco.cc similarity index 71% rename from DQMOffline/CalibCalo/src/DQMHcalDiJetsAlCaReco.cc rename to DQMOffline/CalibCalo/plugins/DQMHcalDiJetsAlCaReco.cc index deddafdd89135..ae36a2854f42b 100644 --- a/DQMOffline/CalibCalo/src/DQMHcalDiJetsAlCaReco.cc +++ b/DQMOffline/CalibCalo/plugins/DQMHcalDiJetsAlCaReco.cc @@ -8,31 +8,81 @@ * Description: Monitoring of Phi Symmetry Calibration Stream */ +// work on collections + +#include "DataFormats/CaloTowers/interface/CaloTowerDetId.h" +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "DataFormats/JetReco/interface/CaloJet.h" +#include "DataFormats/JetReco/interface/CaloJetCollection.h" + +#include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" // DQM include files +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" +#include "DQMServices/Core/interface/DQMStore.h" #include "DQMServices/Core/interface/DQMStore.h" -// work on collections +#include -#include "DataFormats/CaloTowers/interface/CaloTowerDetId.h" -#include "DataFormats/DetId/interface/DetId.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" +class DQMHcalDiJetsAlCaReco : public DQMEDAnalyzer { +public: + DQMHcalDiJetsAlCaReco(const edm::ParameterSet &); + ~DQMHcalDiJetsAlCaReco() override; + +protected: + void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + void analyze(const edm::Event &e, const edm::EventSetup &c) override; + +private: + int eventCounter_; + + // + // Monitor elements + // + MonitorElement *hiDistrRecHitEnergyEBEE_; + MonitorElement *hiDistrRecHitEnergyHBHE_; + MonitorElement *hiDistrRecHitEnergyHF_; + MonitorElement *hiDistrRecHitEnergyHO_; -// #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" -// #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" -// #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" + MonitorElement *hiDistrProbeJetEnergy_; + MonitorElement *hiDistrProbeJetEta_; + MonitorElement *hiDistrProbeJetPhi_; -#include "DQMOffline/CalibCalo/src/DQMHcalDiJetsAlCaReco.h" + MonitorElement *hiDistrTagJetEnergy_; + MonitorElement *hiDistrTagJetEta_; + MonitorElement *hiDistrTagJetPhi_; -using namespace std; -using namespace edm; -using namespace reco; + MonitorElement *hiDistrEtThirdJet_; + + /// object to monitor + edm::EDGetTokenT jets_; + edm::EDGetTokenT ec_; + edm::EDGetTokenT hbhe_; + edm::EDGetTokenT ho_; + edm::EDGetTokenT hf_; + + /// DQM folder name + std::string folderName_; + + /// Write to file + bool saveToFile_; + + /// Output file name if required + std::string fileName_; + + bool allowMissingInputs_; +}; // ****************************************** // constructors @@ -42,16 +92,16 @@ DQMHcalDiJetsAlCaReco::DQMHcalDiJetsAlCaReco(const edm::ParameterSet &iConfig) : // // Input from configurator file // - folderName_ = iConfig.getUntrackedParameter("FolderName", "ALCAStreamHcalDiJets"); + folderName_ = iConfig.getUntrackedParameter("FolderName", "ALCAStreamHcalDiJets"); - jets_ = consumes(iConfig.getParameter("jetsInput")); + jets_ = consumes(iConfig.getParameter("jetsInput")); ec_ = consumes(iConfig.getParameter("ecInput")); hbhe_ = consumes(iConfig.getParameter("hbheInput")); ho_ = consumes(iConfig.getParameter("hoInput")); hf_ = consumes(iConfig.getParameter("hfInput")); saveToFile_ = iConfig.getUntrackedParameter("SaveToFile", false); - fileName_ = iConfig.getUntrackedParameter("FileName", "MonitorAlCaHcalDiJets.root"); + fileName_ = iConfig.getUntrackedParameter("FileName", "MonitorAlCaHcalDiJets.root"); } DQMHcalDiJetsAlCaReco::~DQMHcalDiJetsAlCaReco() {} @@ -111,13 +161,13 @@ void DQMHcalDiJetsAlCaReco::bookHistograms(DQMStore::IBooker &ibooker, //------------------------------------------------------------- -void DQMHcalDiJetsAlCaReco::analyze(const Event &iEvent, const EventSetup &iSetup) { +void DQMHcalDiJetsAlCaReco::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { eventCounter_++; - CaloJet jet1, jet2, jet3; + reco::CaloJet jet1, jet2, jet3; Float_t etVetoJet; - edm::Handle jets; + edm::Handle jets; iEvent.getByToken(jets_, jets); if (!jets.isValid()) { @@ -129,7 +179,7 @@ void DQMHcalDiJetsAlCaReco::analyze(const Event &iEvent, const EventSetup &iSetu jet1 = (*jets)[0]; jet2 = (*jets)[1]; if (fabs(jet1.eta()) > fabs(jet2.eta())) { - CaloJet jet = jet1; + reco::CaloJet jet = jet1; jet1 = jet2; jet2 = jet; } @@ -156,7 +206,7 @@ void DQMHcalDiJetsAlCaReco::analyze(const Event &iEvent, const EventSetup &iSetu hiDistrEtThirdJet_->Fill(etVetoJet); } - Handle ec; + edm::Handle ec; iEvent.getByToken(ec_, ec); if (!ec.isValid()) { @@ -168,7 +218,7 @@ void DQMHcalDiJetsAlCaReco::analyze(const Event &iEvent, const EventSetup &iSetu hiDistrRecHitEnergyEBEE_->Fill(ecItr->energy()); } - Handle hbhe; + edm::Handle hbhe; iEvent.getByToken(hbhe_, hbhe); if (!hbhe.isValid()) { @@ -180,7 +230,7 @@ void DQMHcalDiJetsAlCaReco::analyze(const Event &iEvent, const EventSetup &iSetu hiDistrRecHitEnergyHBHE_->Fill(hbheItr->energy()); } - Handle ho; + edm::Handle ho; iEvent.getByToken(ho_, ho); if (!ho.isValid()) { @@ -192,7 +242,7 @@ void DQMHcalDiJetsAlCaReco::analyze(const Event &iEvent, const EventSetup &iSetu hiDistrRecHitEnergyHO_->Fill(hoItr->energy()); } - Handle hf; + edm::Handle hf; iEvent.getByToken(hf_, hf); if (!hf.isValid()) { @@ -205,3 +255,5 @@ void DQMHcalDiJetsAlCaReco::analyze(const Event &iEvent, const EventSetup &iSetu } } // analyze + +DEFINE_FWK_MODULE(DQMHcalDiJetsAlCaReco); diff --git a/DQMOffline/CalibCalo/src/DQMHcalIsoTrackAlCaReco.cc b/DQMOffline/CalibCalo/plugins/DQMHcalIsoTrackAlCaReco.cc similarity index 86% rename from DQMOffline/CalibCalo/src/DQMHcalIsoTrackAlCaReco.cc rename to DQMOffline/CalibCalo/plugins/DQMHcalIsoTrackAlCaReco.cc index 2f574a39bdd37..5f680cf1b3598 100644 --- a/DQMOffline/CalibCalo/src/DQMHcalIsoTrackAlCaReco.cc +++ b/DQMOffline/CalibCalo/plugins/DQMHcalIsoTrackAlCaReco.cc @@ -20,11 +20,54 @@ // system include files #include +#include +#include // user include files +#include "DataFormats/HLTReco/interface/TriggerEvent.h" +#include "DataFormats/HcalIsolatedTrack/interface/HcalIsolatedTrackCandidate.h" +#include "DataFormats/HcalIsolatedTrack/interface/HcalIsolatedTrackCandidateFwd.h" +#include "DataFormats/Math/interface/deltaR.h" -#include "DQMOffline/CalibCalo/src/DQMHcalIsoTrackAlCaReco.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" +#include "DQMServices/Core/interface/DQMStore.h" + +class DQMHcalIsoTrackAlCaReco : public DQMEDAnalyzer { +public: + explicit DQMHcalIsoTrackAlCaReco(const edm::ParameterSet &); + ~DQMHcalIsoTrackAlCaReco() override; + + void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + void analyze(const edm::Event &, const edm::EventSetup &) override; + +private: + std::string folderName_; + std::vector l1FilterTag_, hltFilterTag_; + std::vector type_; + edm::InputTag labelTrigger_, labelTrack_; + edm::EDGetTokenT tokTrigger_; + edm::EDGetTokenT tokTrack_; + + double pThr_; + + std::vector hL1Pt_, hL1Eta_, hL1phi_; + std::vector hHltP_, hHltEta_, hHltPhi_; + MonitorElement *hL3Dr_, *hL3Rat_; + std::vector hOffP_; + MonitorElement *hMaxP_, *hEnEcal_, *hIeta_, *hIphi_; + + int nTotal_, nHLTaccepts_; + std::vector etaRange_; + std::vector indexH_; + std::vector ifL3_; +}; DQMHcalIsoTrackAlCaReco::DQMHcalIsoTrackAlCaReco(const edm::ParameterSet &iConfig) { folderName_ = iConfig.getParameter("FolderName"); @@ -244,3 +287,5 @@ void DQMHcalIsoTrackAlCaReco::bookHistograms(DQMStore::IBooker &iBooker, edm::Ru hIphi_ = iBooker.book1D("hIPhi", "i#phi for HCAL tower", 72, 0, 72); hIphi_->setAxisTitle("i#phi", 1); } + +DEFINE_FWK_MODULE(DQMHcalIsoTrackAlCaReco); diff --git a/DQMOffline/CalibCalo/src/DQMHcalIsoTrackPostProcessor.cc b/DQMOffline/CalibCalo/plugins/DQMHcalIsoTrackPostProcessor.cc similarity index 90% rename from DQMOffline/CalibCalo/src/DQMHcalIsoTrackPostProcessor.cc rename to DQMOffline/CalibCalo/plugins/DQMHcalIsoTrackPostProcessor.cc index 8c4552bbd66e3..9b6eb38829ba1 100644 --- a/DQMOffline/CalibCalo/src/DQMHcalIsoTrackPostProcessor.cc +++ b/DQMOffline/CalibCalo/plugins/DQMHcalIsoTrackPostProcessor.cc @@ -1,19 +1,11 @@ #include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "DQMServices/Core/interface/DQMEDHarvester.h" #include "DQMServices/Core/interface/DQMStore.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/Frameworkfwd.h" - -#include -#include -#include -#include -#include - -#define DebugLog +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ServiceRegistry/interface/Service.h" class DQMHcalIsoTrackPostProcessor : public DQMEDHarvester { public: @@ -74,15 +66,13 @@ void DQMHcalIsoTrackPostProcessor::dqmEndJob(DQMStore::IBooker &ibooker, DQMStor for (int i = 0; i < 4; ++i) { sprintf(name, "/heta%s", types[i].c_str()); std::string hname1 = ibooker.pwd() + std::string(name); -#ifdef DebugLog - std::cout << "PostProcesor " << hname1 << " " << igetter.get(hname1) << std::endl; -#endif + edm::LogVerbatim("DQMHcal") << "PostProcesor " << hname1 << " " << igetter.get(hname1); + hSumEta[i]->getTH1F()->Add(igetter.get(hname1)->getTH1F(), 1); sprintf(name, "/hphi%s", types[i].c_str()); std::string hname2 = ibooker.pwd() + std::string(name); -#ifdef DebugLog - std::cout << "PostProcesor " << hname2 << " " << igetter.get(hname2) << std::endl; -#endif + edm::LogVerbatim("DQMHcal") << "PostProcesor " << hname2 << " " << igetter.get(hname2); + hSumPhi[i]->getTH1F()->Add(igetter.get(hname2)->getTH1F(), 1); } diff --git a/DQMOffline/CalibCalo/src/DQMHcalIsolatedBunchAlCaReco.cc b/DQMOffline/CalibCalo/plugins/DQMHcalIsolatedBunchAlCaReco.cc similarity index 78% rename from DQMOffline/CalibCalo/src/DQMHcalIsolatedBunchAlCaReco.cc rename to DQMOffline/CalibCalo/plugins/DQMHcalIsolatedBunchAlCaReco.cc index 89823584319fa..fb554af3ddfcf 100644 --- a/DQMOffline/CalibCalo/src/DQMHcalIsolatedBunchAlCaReco.cc +++ b/DQMOffline/CalibCalo/plugins/DQMHcalIsolatedBunchAlCaReco.cc @@ -11,30 +11,61 @@ #include "FWCore/Common/interface/TriggerNames.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" - #include "CommonTools/UtilAlgos/interface/TFileService.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" // DQM include files +#include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "DQMServices/Core/interface/DQMStore.h" // work on collections #include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" -#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" - #include "DataFormats/FEDRawData/interface/FEDHeader.h" #include "DataFormats/FEDRawData/interface/FEDNumbering.h" #include "DataFormats/FEDRawData/interface/FEDRawData.h" +#include "DataFormats/Common/interface/TriggerResults.h" +#include "DataFormats/HLTReco/interface/TriggerEvent.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" + +#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" + #include "EventFilter/HcalRawToDigi/interface/HcalDCCHeader.h" #include "EventFilter/HcalRawToDigi/interface/HcalHTRData.h" -#include "DQMOffline/CalibCalo/src/DQMHcalIsolatedBunchAlCaReco.h" +class DQMHcalIsolatedBunchAlCaReco : public DQMEDAnalyzer { +public: + DQMHcalIsolatedBunchAlCaReco(const edm::ParameterSet &); + ~DQMHcalIsolatedBunchAlCaReco() override; + +protected: + void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + void analyze(const edm::Event &e, const edm::EventSetup &c) override; + +private: + // + // Monitor elements + // + MonitorElement *h_Event_, *h_hbhehit_, *h_hfhit_, *h_hohit_; + + /// DQM folder name + std::string folderName_, trigName_; + bool plotAll_; + + /// object to monitor + edm::EDGetTokenT hbhereco_; + edm::EDGetTokenT horeco_; + edm::EDGetTokenT hfreco_; + edm::EDGetTokenT trigResult_; +}; // ****************************************** // constructors @@ -119,3 +150,5 @@ void DQMHcalIsolatedBunchAlCaReco::analyze(const edm::Event &iEvent, const edm:: } } // analyze + +DEFINE_FWK_MODULE(DQMHcalIsolatedBunchAlCaReco); diff --git a/DQMOffline/CalibCalo/plugins/DQMHcalIterativePhiSymAlCaReco.cc b/DQMOffline/CalibCalo/plugins/DQMHcalIterativePhiSymAlCaReco.cc new file mode 100644 index 0000000000000..ce91a25ffb561 --- /dev/null +++ b/DQMOffline/CalibCalo/plugins/DQMHcalIterativePhiSymAlCaReco.cc @@ -0,0 +1,197 @@ +/* + * \file DQMHcalIterativePhiSymAlCaReco.cc + * + * \author Sunanda Banerjee + * + * + * + * Description: Monitoring of Iterative Phi Symmetry Calibration Stream + */ + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +// DQM include files + +#include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/DQMOneEDAnalyzer.h" + +// work on collections + +#include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" + +#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" + +#include + +class DQMHcalIterativePhiSymAlCaReco : public DQMOneEDAnalyzer<> { +public: + DQMHcalIterativePhiSymAlCaReco(const edm::ParameterSet &); + ~DQMHcalIterativePhiSymAlCaReco() override; + + static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); + +protected: + // void beginRun(const edm::Run& r, const edm::EventSetup& c); + void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + void analyze(const edm::Event &e, const edm::EventSetup &c) override; + + void dqmEndRun(const edm::Run &r, const edm::EventSetup &c) override {} + +private: + static constexpr int maxDepth_ = 7; + // + // Monitor elements + // + MonitorElement *hiDistr2D_[maxDepth_]; + + MonitorElement *hiDistrHBHEsize1D_; + MonitorElement *hiDistrHFsize1D_; + MonitorElement *hiDistrHOsize1D_; + + std::string folderName_; + int hiDistr_y_nbin_; + int hiDistr_x_nbin_; + double hiDistr_y_min_; + double hiDistr_y_max_; + double hiDistr_x_min_; + double hiDistr_x_max_; + /// object to monitor + + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; +}; + +// ****************************************** +// constructors +// ***************************************** + +DQMHcalIterativePhiSymAlCaReco::DQMHcalIterativePhiSymAlCaReco(const edm::ParameterSet &ps) { + // + // Input from configurator file + // + folderName_ = ps.getParameter("folderName"); + + // histogram parameters + tok_ho_ = consumes(ps.getParameter("hoInput")); + tok_hf_ = consumes(ps.getParameter("hfInput")); + tok_hbhe_ = consumes(ps.getParameter("hbheInput")); + + // Distribution of rechits in iPhi, iEta + hiDistr_y_nbin_ = ps.getUntrackedParameter("hiDistr_y_nbin", 72); + hiDistr_y_min_ = ps.getUntrackedParameter("hiDistr_y_min", 0.5); + hiDistr_y_max_ = ps.getUntrackedParameter("hiDistr_y_max", 72.5); + hiDistr_x_nbin_ = ps.getUntrackedParameter("hiDistr_x_nbin", 83); + hiDistr_x_min_ = ps.getUntrackedParameter("hiDistr_x_min", -41.5); + hiDistr_x_max_ = ps.getUntrackedParameter("hiDistr_x_max", 41.5); +} + +DQMHcalIterativePhiSymAlCaReco::~DQMHcalIterativePhiSymAlCaReco() {} + +void DQMHcalIterativePhiSymAlCaReco::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { + edm::ParameterSetDescription desc; + desc.add("folderName", "ALCAStreamHcalIterativePhiSym"); + desc.add("hbheInput", edm::InputTag("hbhereco")); + desc.add("hfInput", edm::InputTag("hfreco")); + desc.add("hoInput", edm::InputTag("horeco")); + desc.addUntracked("hiDistr_y_nbin", 72); + desc.addUntracked("hiDistr_y_min", 0.5); + desc.addUntracked("hiDistr_y_max", 72.5); + desc.addUntracked("hiDistr_x_nbin", 83); + desc.addUntracked("hiDistr_x_min", -41.5); + desc.addUntracked("hiDistr_x_max", 41.5); + descriptions.add("dqmHcalIterativePhiSymAlCaReco", desc); +} + +//-------------------------------------------------------- +void DQMHcalIterativePhiSymAlCaReco::bookHistograms(DQMStore::IBooker &ibooker, + edm::Run const &irun, + edm::EventSetup const &isetup) { + // create and cd into new folder + ibooker.setCurrentFolder(folderName_); + + // book some histograms 1D + hiDistrHBHEsize1D_ = ibooker.book1D("DistrHBHEsize", "Size of HBHE Collection", 100, 0.0, 10000.0); + hiDistrHFsize1D_ = ibooker.book1D("DistrHFsize", "Size of HF Collection", 100, 0.0, 10000.0); + hiDistrHOsize1D_ = ibooker.book1D("DistrHOsize", "Size of HO Collection", 100, 0.0, 3000.0); + + // Eta-phi occupancy + for (int k = 0; k < maxDepth_; ++k) { + char name[20], title[20]; + sprintf(name, "MBdepth%d", (k + 1)); + sprintf(title, "Depth %d", (k + 1)); + hiDistr2D_[k] = ibooker.book2D( + name, title, hiDistr_x_nbin_, hiDistr_x_min_, hiDistr_x_max_, hiDistr_y_nbin_, hiDistr_y_min_, hiDistr_y_max_); + hiDistr2D_[k]->setAxisTitle("i#phi ", 2); + hiDistr2D_[k]->setAxisTitle("i#eta ", 1); + } +} + +//-------------------------------------------------------- + +//------------------------------------------------------------- + +void DQMHcalIterativePhiSymAlCaReco::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { + // First HBHE RecHits + edm::Handle hbheMB; + iEvent.getByToken(tok_hbhe_, hbheMB); + if (!hbheMB.isValid()) { + edm::LogWarning("DQMHcal") << "DQMHcalIterativePhiSymAlCaReco: Error! can't get HBHE RecHit Collection!"; + } else { + const HBHERecHitCollection Hithbhe = *(hbheMB.product()); + hiDistrHBHEsize1D_->Fill(Hithbhe.size()); + for (HBHERecHitCollection::const_iterator hbheItr = Hithbhe.begin(); hbheItr != Hithbhe.end(); hbheItr++) { + HcalDetId hid = HcalDetId(hbheItr->detid()); + int id = hid.depth() - 1; + if ((id >= 0) && (id < maxDepth_)) + hiDistr2D_[id]->Fill(hid.ieta(), hid.iphi(), hbheItr->energy()); + } + } + + // Then HF RecHits + edm::Handle hfMB; + iEvent.getByToken(tok_hf_, hfMB); + if (!hfMB.isValid()) { + edm::LogWarning("DQMHcal") << "DQMHcalIterativePhiSymAlCaReco: Error! can't get HF RecHit Collection!"; + } else { + const HFRecHitCollection Hithf = *(hfMB.product()); + hiDistrHFsize1D_->Fill(Hithf.size()); + for (HFRecHitCollection::const_iterator hfItr = Hithf.begin(); hfItr != Hithf.end(); hfItr++) { + HcalDetId hid = HcalDetId(hfItr->detid()); + int id = hid.depth() - 1; + if ((id >= 0) && (id < maxDepth_)) + hiDistr2D_[id]->Fill(hid.ieta(), hid.iphi(), hfItr->energy()); + } + } + + // And finally HO RecHits + edm::Handle hoMB; + iEvent.getByToken(tok_ho_, hoMB); + if (!hoMB.isValid()) { + edm::LogWarning("DQMHcal") << "DQMHcalIterativePhiSymAlCaReco: Error! can't get HO RecHit Collection!"; + } else { + const HORecHitCollection Hitho = *(hoMB.product()); + hiDistrHOsize1D_->Fill(Hitho.size()); + for (HORecHitCollection::const_iterator hoItr = Hitho.begin(); hoItr != Hitho.end(); hoItr++) { + HcalDetId hid = HcalDetId(hoItr->detid()); + int id = hid.depth() - 1; + if ((id >= 0) && (id < maxDepth_)) + hiDistr2D_[id]->Fill(hid.ieta(), hid.iphi(), hoItr->energy()); + } + } + +} // analyze + +DEFINE_FWK_MODULE(DQMHcalIterativePhiSymAlCaReco); diff --git a/DQMOffline/CalibCalo/src/DQMHcalPhiSymAlCaReco.cc b/DQMOffline/CalibCalo/plugins/DQMHcalPhiSymAlCaReco.cc similarity index 86% rename from DQMOffline/CalibCalo/src/DQMHcalPhiSymAlCaReco.cc rename to DQMOffline/CalibCalo/plugins/DQMHcalPhiSymAlCaReco.cc index 712bfee58744d..50fb72e341b83 100644 --- a/DQMOffline/CalibCalo/src/DQMHcalPhiSymAlCaReco.cc +++ b/DQMOffline/CalibCalo/plugins/DQMHcalPhiSymAlCaReco.cc @@ -10,32 +10,110 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - // DQM include files #include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/DQMOneEDAnalyzer.h" // work on collections #include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" -#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" - +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "DataFormats/FEDRawData/interface/FEDHeader.h" #include "DataFormats/FEDRawData/interface/FEDNumbering.h" #include "DataFormats/FEDRawData/interface/FEDRawData.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" + +#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" + #include "EventFilter/HcalRawToDigi/interface/HcalDCCHeader.h" #include "EventFilter/HcalRawToDigi/interface/HcalHTRData.h" -#include "DQMOffline/CalibCalo/src/DQMHcalPhiSymAlCaReco.h" +class DQMHcalPhiSymAlCaReco : public DQMOneEDAnalyzer<> { +public: + DQMHcalPhiSymAlCaReco(const edm::ParameterSet &); + ~DQMHcalPhiSymAlCaReco() override; + +protected: + // void beginRun(const edm::Run& r, const edm::EventSetup& c); + void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + void analyze(const edm::Event &e, const edm::EventSetup &c) override; + + void dqmEndRun(const edm::Run &r, const edm::EventSetup &c) override; + +private: + int eventCounter_; + + // + // Monitor elements + // + MonitorElement *hiDistrMBPl2D_; + MonitorElement *hiDistrNoisePl2D_; + MonitorElement *hiDistrMBMin2D_; + MonitorElement *hiDistrNoiseMin2D_; -using namespace std; -using namespace edm; + MonitorElement *hiDistrMB2Pl2D_; + MonitorElement *hiDistrNoise2Pl2D_; + MonitorElement *hiDistrMB2Min2D_; + MonitorElement *hiDistrNoise2Min2D_; + + MonitorElement *hiDistrVarMBPl2D_; + MonitorElement *hiDistrVarNoisePl2D_; + MonitorElement *hiDistrVarMBMin2D_; + MonitorElement *hiDistrVarNoiseMin2D_; + + MonitorElement *hiDistrHBHEsize1D_; + MonitorElement *hiDistrHFsize1D_; + + MonitorElement *hFEDsize; + MonitorElement *hHcalIsZS; + MonitorElement *hL1Id; + + int hiDistr_y_nbin_; + int hiDistr_x_nbin_; + double hiDistr_y_min_; + double hiDistr_y_max_; + double hiDistr_x_min_; + double hiDistr_x_max_; + + int hiDistr_r_nbin_; + double ihbhe_size_; + double ihf_size_; + + bool perLSsaving_; //to avoid nanoDQMIO crashing, driven by DQMServices/Core/python/DQMStore_cfi.py + + /// object to monitor + + edm::EDGetTokenT hbherecoMB; + edm::InputTag horecoMB; + edm::EDGetTokenT hfrecoMB; + + edm::EDGetTokenT hbherecoNoise; + edm::InputTag horecoNoise; + edm::EDGetTokenT hfrecoNoise; + + edm::EDGetTokenT rawInLabel_; + + /// DQM folder name + std::string folderName_; + + /// Write to file + bool saveToFile_; + + // period of ZS + unsigned int period_; + + /// Output file name if required + std::string fileName_; +}; // ****************************************** // constructors @@ -45,7 +123,7 @@ DQMHcalPhiSymAlCaReco::DQMHcalPhiSymAlCaReco(const edm::ParameterSet &ps) : even // // Input from configurator file // - folderName_ = ps.getUntrackedParameter("FolderName", "ALCAStreamHcalPhiSym"); + folderName_ = ps.getUntrackedParameter("FolderName", "ALCAStreamHcalPhiSym"); hbherecoMB = consumes(ps.getParameter("hbheInputMB")); horecoMB = ps.getParameter("hoInputMB"); @@ -60,7 +138,7 @@ DQMHcalPhiSymAlCaReco::DQMHcalPhiSymAlCaReco(const edm::ParameterSet &ps) : even period_ = ps.getParameter("period"); saveToFile_ = ps.getUntrackedParameter("SaveToFile", false); - fileName_ = ps.getUntrackedParameter("FileName", "MonitorAlCaHcalPhiSym.root"); + fileName_ = ps.getUntrackedParameter("FileName", "MonitorAlCaHcalPhiSym.root"); perLSsaving_ = (ps.getUntrackedParameter("perLSsaving", false)); @@ -268,7 +346,7 @@ void DQMHcalPhiSymAlCaReco::bookHistograms(DQMStore::IBooker &ibooker, //------------------------------------------------------------- -void DQMHcalPhiSymAlCaReco::analyze(const Event &iEvent, const EventSetup &iSetup) { +void DQMHcalPhiSymAlCaReco::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { eventCounter_++; edm::Handle rawIn; @@ -441,7 +519,7 @@ void DQMHcalPhiSymAlCaReco::analyze(const Event &iEvent, const EventSetup &iSetu //-------------------------------------------------------- //-------------------------------------------------------- -void DQMHcalPhiSymAlCaReco::dqmEndRun(const Run &r, const EventSetup &context) { +void DQMHcalPhiSymAlCaReco::dqmEndRun(const edm::Run &r, const edm::EventSetup &context) { // Keep Variances if (eventCounter_ > 0 && !perLSsaving_) { for (int k = 0; k <= hiDistr_x_nbin_; k++) { @@ -472,3 +550,5 @@ void DQMHcalPhiSymAlCaReco::dqmEndRun(const Run &r, const EventSetup &context) { } } } + +DEFINE_FWK_MODULE(DQMHcalPhiSymAlCaReco); diff --git a/DQMOffline/CalibCalo/src/DQMSourceEleCalib.cc b/DQMOffline/CalibCalo/plugins/DQMSourceEleCalib.cc similarity index 73% rename from DQMOffline/CalibCalo/src/DQMSourceEleCalib.cc rename to DQMOffline/CalibCalo/plugins/DQMSourceEleCalib.cc index 6e73d0a28cceb..03792b60ce8a7 100644 --- a/DQMOffline/CalibCalo/src/DQMSourceEleCalib.cc +++ b/DQMOffline/CalibCalo/plugins/DQMSourceEleCalib.cc @@ -11,37 +11,97 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" // DQM include files +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "DQMServices/Core/interface/DQMStore.h" // work on collections #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" - #include "DataFormats/EcalRecHit/interface/EcalRecHit.h" +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" + +class DQMSourceEleCalib : public DQMEDAnalyzer { +public: + DQMSourceEleCalib(const edm::ParameterSet &); + ~DQMSourceEleCalib() override; + +protected: + void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + + void analyze(const edm::Event &e, const edm::EventSetup &c) override; + +private: + //! find the MOX + DetId findMaxHit(const std::vector> &, + const EcalRecHitCollection *, + const EcalRecHitCollection *); + //! fills local occupancy graphs + void fillAroundBarrel(const EcalRecHitCollection *, int, int); + void fillAroundEndcap(const EcalRecHitCollection *, int, int); + + int eventCounter_; -#include "DQMOffline/CalibCalo/interface/DQMSourceEleCalib.h" + //! Number of recHits per electron + MonitorElement *recHitsPerElectron_; + //! Number of electrons + MonitorElement *ElectronsNumber_; + //! ESCoP + MonitorElement *ESCoP_; + //! Occupancy + MonitorElement *OccupancyEB_; + MonitorElement *OccupancyEEP_; + MonitorElement *OccupancyEEM_; + MonitorElement *LocalOccupancyEB_; + MonitorElement *LocalOccupancyEE_; -using namespace std; -using namespace edm; + //! recHits over associated recHits + MonitorElement *HitsVsAssociatedHits_; + + /// object to monitor + edm::EDGetTokenT productMonitoredEB_; + + /// object to monitor + edm::EDGetTokenT productMonitoredEE_; + //! electrons to monitor + edm::EDGetTokenT productMonitoredElectrons_; + + /// Monitor every prescaleFactor_ events + unsigned int prescaleFactor_; + + /// DQM folder name + std::string folderName_; + + /// Write to file + bool saveToFile_; + + /// Output file name if required + std::string fileName_; +}; // ****************************************** // constructors // ***************************************** DQMSourceEleCalib::DQMSourceEleCalib(const edm::ParameterSet &ps) : eventCounter_(0) { - folderName_ = ps.getUntrackedParameter("FolderName", "ALCAStreamEcalSingleEle"); + folderName_ = ps.getUntrackedParameter("FolderName", "ALCAStreamEcalSingleEle"); productMonitoredEB_ = consumes(ps.getParameter("AlCaStreamEBTag")); productMonitoredEE_ = consumes(ps.getParameter("AlCaStreamEETag")); saveToFile_ = ps.getUntrackedParameter("SaveToFile", false); - fileName_ = ps.getUntrackedParameter("FileName", "MonitorAlCaEcalSingleEle.root"); - productMonitoredElectrons_ = consumes(ps.getParameter("electronCollection")); + fileName_ = ps.getUntrackedParameter("FileName", "MonitorAlCaEcalSingleEle.root"); + productMonitoredElectrons_ = + consumes(ps.getParameter("electronCollection")); prescaleFactor_ = ps.getUntrackedParameter("prescaleFactor", 1); } @@ -70,7 +130,7 @@ void DQMSourceEleCalib::bookHistograms(DQMStore::IBooker &ibooker, //------------------------------------------------------------- -void DQMSourceEleCalib::analyze(const Event &iEvent, const EventSetup &iSetup) { +void DQMSourceEleCalib::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { // if (eventCounter_% prescaleFactor_ ) return; //FIXME eventCounter_++; int numberOfHits = 0; @@ -193,3 +253,5 @@ void DQMSourceEleCalib::fillAroundEndcap(const EcalRecHitCollection *recHits, in } return; } + +DEFINE_FWK_MODULE(DQMSourceEleCalib); diff --git a/DQMOffline/CalibCalo/src/DQMSourcePi0.cc b/DQMOffline/CalibCalo/plugins/DQMSourcePi0.cc similarity index 83% rename from DQMOffline/CalibCalo/src/DQMSourcePi0.cc rename to DQMOffline/CalibCalo/plugins/DQMSourcePi0.cc index 0161b1279c351..11388c2454f2e 100644 --- a/DQMOffline/CalibCalo/src/DQMSourcePi0.cc +++ b/DQMOffline/CalibCalo/plugins/DQMSourcePi0.cc @@ -1,49 +1,328 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Utilities/interface/InputTag.h" // DQM include files +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "DQMServices/Core/interface/DQMStore.h" // work on collections +#include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" - #include "DataFormats/EcalRecHit/interface/EcalRecHit.h" - -#include "DQMOffline/CalibCalo/src/DQMSourcePi0.h" - -#include "DataFormats/DetId/interface/DetId.h" -#include "DataFormats/EcalDetId/interface/EBDetId.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/EgammaReco/interface/BasicCluster.h" #include "DataFormats/Math/interface/Point3D.h" - #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - #include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h" #include "DataFormats/RecoCandidate/interface/RecoEcalCandidateFwd.h" +// Geometry +#include "Geometry/Records/interface/CaloTopologyRecord.h" +#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" +#include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h" +#include "Geometry/CaloTopology/interface/CaloTopology.h" +#include "Geometry/CaloTopology/interface/EcalBarrelTopology.h" +#include "Geometry/CaloTopology/interface/EcalEndcapTopology.h" +#include "Geometry/Records/interface/IdealGeometryRecord.h" +#include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h" + #include "TVector3.h" -#define TWOPI 6.283185308 +// Less than operator for sorting EcalRecHits according to energy. +inline bool ecalRecHitGreater(EcalRecHit x, EcalRecHit y) { return (x.energy() > y.energy()); } + +class DQMSourcePi0 : public DQMEDAnalyzer { +public: + DQMSourcePi0(const edm::ParameterSet &); + ~DQMSourcePi0() override; + +protected: + void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + void analyze(const edm::Event &e, const edm::EventSetup &c) override; + + void convxtalid(int &, int &); + int diff_neta_s(int, int); + int diff_nphi_s(int, int); + +private: + int eventCounter_; + PositionCalc posCalculator_; + + /// Distribution of rechits in iPhi (pi0) + MonitorElement *hiPhiDistrEBpi0_; + + /// Distribution of rechits in ix EE (pi0) + MonitorElement *hiXDistrEEpi0_; + + /// Distribution of rechits in iPhi (eta) + MonitorElement *hiPhiDistrEBeta_; + + /// Distribution of rechits in ix EE (eta) + MonitorElement *hiXDistrEEeta_; + + /// Distribution of rechits in iEta (pi0) + MonitorElement *hiEtaDistrEBpi0_; + + /// Distribution of rechits in iy EE (pi0) + MonitorElement *hiYDistrEEpi0_; + + /// Distribution of rechits in iEta (eta) + MonitorElement *hiEtaDistrEBeta_; + + /// Distribution of rechits in iy EE (eta) + MonitorElement *hiYDistrEEeta_; + + /// Energy Distribution of rechits EB (pi0) + MonitorElement *hRechitEnergyEBpi0_; + + /// Energy Distribution of rechits EE (pi0) + MonitorElement *hRechitEnergyEEpi0_; + + /// Energy Distribution of rechits EB (eta) + MonitorElement *hRechitEnergyEBeta_; + + /// Energy Distribution of rechits EE (eta) + MonitorElement *hRechitEnergyEEeta_; + + /// Distribution of total event energy EB (pi0) + MonitorElement *hEventEnergyEBpi0_; + + /// Distribution of total event energy EE (pi0) + MonitorElement *hEventEnergyEEpi0_; + + /// Distribution of total event energy EB (eta) + MonitorElement *hEventEnergyEBeta_; + + /// Distribution of total event energy EE (eta) + MonitorElement *hEventEnergyEEeta_; + + /// Distribution of number of RecHits EB (pi0) + MonitorElement *hNRecHitsEBpi0_; + + /// Distribution of number of RecHits EE (pi0) + MonitorElement *hNRecHitsEEpi0_; + + /// Distribution of number of RecHits EB (eta) + MonitorElement *hNRecHitsEBeta_; + + /// Distribution of number of RecHits EE (eta) + MonitorElement *hNRecHitsEEeta_; + + /// Distribution of Mean energy per rechit EB (pi0) + MonitorElement *hMeanRecHitEnergyEBpi0_; + + /// Distribution of Mean energy per rechit EE (pi0) + MonitorElement *hMeanRecHitEnergyEEpi0_; -using namespace std; -using namespace edm; + /// Distribution of Mean energy per rechit EB (eta) + MonitorElement *hMeanRecHitEnergyEBeta_; + + /// Distribution of Mean energy per rechit EE (eta) + MonitorElement *hMeanRecHitEnergyEEeta_; + + /// Pi0 invariant mass in EB + MonitorElement *hMinvPi0EB_; + + /// Pi0 invariant mass in EE + MonitorElement *hMinvPi0EE_; + + /// Eta invariant mass in EB + MonitorElement *hMinvEtaEB_; + + /// Eta invariant mass in EE + MonitorElement *hMinvEtaEE_; + + /// Pt of the 1st most energetic Pi0 photon in EB + MonitorElement *hPt1Pi0EB_; + + /// Pt of the 1st most energetic Pi0 photon in EE + MonitorElement *hPt1Pi0EE_; + + /// Pt of the 1st most energetic Eta photon in EB + MonitorElement *hPt1EtaEB_; + + /// Pt of the 1st most energetic Eta photon in EE + MonitorElement *hPt1EtaEE_; + + /// Pt of the 2nd most energetic Pi0 photon in EB + MonitorElement *hPt2Pi0EB_; + + /// Pt of the 2nd most energetic Pi0 photon in EE + MonitorElement *hPt2Pi0EE_; + + /// Pt of the 2nd most energetic Eta photon in EB + MonitorElement *hPt2EtaEB_; + + /// Pt of the 2nd most energetic Eta photon in EE + MonitorElement *hPt2EtaEE_; + + /// Pi0 Pt in EB + MonitorElement *hPtPi0EB_; + + /// Pi0 Pt in EE + MonitorElement *hPtPi0EE_; + + /// Eta Pt in EB + MonitorElement *hPtEtaEB_; + + /// Eta Pt in EE + MonitorElement *hPtEtaEE_; + + /// Pi0 Iso EB + MonitorElement *hIsoPi0EB_; + + /// Pi0 Iso EE + MonitorElement *hIsoPi0EE_; + + /// Eta Iso EB + MonitorElement *hIsoEtaEB_; + + /// Eta Iso EE + MonitorElement *hIsoEtaEE_; + + /// S4S9 of the 1st most energetic pi0 photon + MonitorElement *hS4S91Pi0EB_; + + /// S4S9 of the 1st most energetic pi0 photon EE + MonitorElement *hS4S91Pi0EE_; + + /// S4S9 of the 1st most energetic eta photon + MonitorElement *hS4S91EtaEB_; + + /// S4S9 of the 1st most energetic eta photon EE + MonitorElement *hS4S91EtaEE_; + + /// S4S9 of the 2nd most energetic pi0 photon + MonitorElement *hS4S92Pi0EB_; + + /// S4S9 of the 2nd most energetic pi0 photon EE + MonitorElement *hS4S92Pi0EE_; + + /// S4S9 of the 2nd most energetic eta photon + MonitorElement *hS4S92EtaEB_; + + /// S4S9 of the 2nd most energetic eta photon EE + MonitorElement *hS4S92EtaEE_; + + /// object to monitor + edm::EDGetTokenT productMonitoredEBpi0_; + edm::EDGetTokenT productMonitoredEBeta_; + + /// object to monitor + edm::EDGetTokenT productMonitoredEEpi0_; + edm::EDGetTokenT productMonitoredEEeta_; + + edm::ESGetToken caloTopoToken_; + edm::ESGetToken caloGeomToken_; + + int gammaCandEtaSize_; + int gammaCandPhiSize_; + + double seleXtalMinEnergy_; + double seleXtalMinEnergyEndCap_; + + double clusSeedThr_; + int clusEtaSize_; + int clusPhiSize_; + + double clusSeedThrEndCap_; + + //// for pi0->gg barrel + double selePtGamma_; + double selePtPi0_; + double seleMinvMaxPi0_; + double seleMinvMinPi0_; + double seleS4S9Gamma_; + double selePi0BeltDR_; + double selePi0BeltDeta_; + double selePi0Iso_; + double ptMinForIsolation_; + + /// for pi0->gg endcap + double selePtGammaEndCap_; + double selePtPi0EndCap_; + double seleMinvMaxPi0EndCap_; + double seleMinvMinPi0EndCap_; + double seleS4S9GammaEndCap_; + double selePi0IsoEndCap_; + double selePi0BeltDREndCap_; + double selePi0BeltDetaEndCap_; + double ptMinForIsolationEndCap_; + + /// for eta->gg barrel + double selePtGammaEta_; + double selePtEta_; + double seleS4S9GammaEta_; + double seleS9S25GammaEta_; + double seleMinvMaxEta_; + double seleMinvMinEta_; + double ptMinForIsolationEta_; + double seleEtaIso_; + double seleEtaBeltDR_; + double seleEtaBeltDeta_; + + /// for eta->gg endcap + double selePtGammaEtaEndCap_; + double seleS4S9GammaEtaEndCap_; + double seleS9S25GammaEtaEndCap_; + double selePtEtaEndCap_; + double seleMinvMaxEtaEndCap_; + double seleMinvMinEtaEndCap_; + double ptMinForIsolationEtaEndCap_; + double seleEtaIsoEndCap_; + double seleEtaBeltDREndCap_; + double seleEtaBeltDetaEndCap_; + + bool ParameterLogWeighted_; + double ParameterX0_; + double ParameterT0_barl_; + double ParameterT0_endc_; + double ParameterT0_endcPresh_; + double ParameterW0_; + + std::vector detIdEBRecHits; + std::vector EBRecHits; + + std::vector detIdEERecHits; + std::vector EERecHits; + + /// Monitor every prescaleFactor_ events + unsigned int prescaleFactor_; + + /// DQM folder name + std::string folderName_; + + /// Write to file + bool saveToFile_; + + /// which subdet will be monitored + bool isMonEBpi0_; + bool isMonEBeta_; + bool isMonEEpi0_; + bool isMonEEeta_; + + /// Output file name if required + std::string fileName_; +}; + +#define TWOPI 6.283185308 // ****************************************** // constructors // ***************************************** DQMSourcePi0::DQMSourcePi0(const edm::ParameterSet &ps) : eventCounter_(0) { - folderName_ = ps.getUntrackedParameter("FolderName", "HLT/AlCaEcalPi0"); + folderName_ = ps.getUntrackedParameter("FolderName", "HLT/AlCaEcalPi0"); prescaleFactor_ = ps.getUntrackedParameter("prescaleFactor", 1); productMonitoredEBpi0_ = consumes(ps.getUntrackedParameter("AlCaStreamEBpi0Tag")); @@ -62,7 +341,7 @@ DQMSourcePi0::DQMSourcePi0(const edm::ParameterSet &ps) : eventCounter_(0) { isMonEEeta_ = ps.getUntrackedParameter("isMonEEeta", false); saveToFile_ = ps.getUntrackedParameter("SaveToFile", false); - fileName_ = ps.getUntrackedParameter("FileName", "MonitorAlCaEcalPi0.root"); + fileName_ = ps.getUntrackedParameter("FileName", "MonitorAlCaEcalPi0.root"); clusSeedThr_ = ps.getParameter("clusSeedThr"); clusSeedThrEndCap_ = ps.getParameter("clusSeedThrEndCap"); @@ -304,7 +583,7 @@ void DQMSourcePi0::bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &ir } //------------------------------------------------------------- -void DQMSourcePi0::analyze(const Event &iEvent, const EventSetup &iSetup) { +void DQMSourcePi0::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { if (eventCounter_ % prescaleFactor_) return; eventCounter_++; @@ -314,7 +593,7 @@ void DQMSourcePi0::analyze(const Event &iEvent, const EventSetup &iSetup) { std::vector seeds; seeds.clear(); - vector usedXtals; + std::vector usedXtals; usedXtals.clear(); detIdEBRecHits.clear(); //// EBDetId @@ -387,22 +666,22 @@ void DQMSourcePi0::analyze(const Event &iEvent, const EventSetup &iSetup) { // cout<< " Pi0 seeds: "< eClus; - vector etClus; - vector etaClus; - vector thetaClus; - vector phiClus; - vector max_hit; - - vector> RecHitsCluster; - vector> RecHitsCluster5x5; - vector s4s9Clus; - vector s9s25Clus; + std::vector eClus; + std::vector etClus; + std::vector etaClus; + std::vector thetaClus; + std::vector phiClus; + std::vector max_hit; + + std::vector> RecHitsCluster; + std::vector> RecHitsCluster5x5; + std::vector s4s9Clus; + std::vector s9s25Clus; nClus = 0; // Make own simple clusters (3x3, 5x5 or clusPhiSize_ x clusEtaSize_) - sort(seeds.begin(), seeds.end(), ecalRecHitGreater); + std::sort(seeds.begin(), seeds.end(), ecalRecHitGreater); for (std::vector::iterator itseed = seeds.begin(); itseed != seeds.end(); itseed++) { EBDetId seed_id = itseed->id(); @@ -424,8 +703,8 @@ void DQMSourcePi0::analyze(const Event &iEvent, const EventSetup &iSetup) { // Reject the seed if not able to build the cluster around it correctly // if(clus_v.size() < clusEtaSize_*clusPhiSize_){cout<<" Not enough // RecHits "< RecHitsInWindow; - vector RecHitsInWindow5x5; + std::vector RecHitsInWindow; + std::vector RecHitsInWindow5x5; double simple_energy = 0; @@ -522,7 +801,7 @@ void DQMSourcePi0::analyze(const Event &iEvent, const EventSetup &iSetup) { if (e3x3 <= 0) continue; - float s4s9_max = *max_element(s4s9_tmp, s4s9_tmp + 4) / e3x3; + float s4s9_max = *std::max_element(s4s9_tmp, s4s9_tmp + 4) / e3x3; /// calculate e5x5 std::vector clus_v5x5 = topology_p->getWindow(seed_id, 5, 5); @@ -596,7 +875,7 @@ void DQMSourcePi0::analyze(const Event &iEvent, const EventSetup &iSetup) { (p0y + p1y) * (p0y + p1y) - (p0z + p1z) * (p0z + p1z)); if ((m_inv < seleMinvMaxPi0_) && (m_inv > seleMinvMinPi0_)) { // New Loop on cluster to measure isolation: - vector IsoClus; + std::vector IsoClus; IsoClus.clear(); float Iso = 0; TVector3 pairVect = TVector3((p0x + p1x), (p0y + p1y), (p0z + p1z)); @@ -696,22 +975,22 @@ void DQMSourcePi0::analyze(const Event &iEvent, const EventSetup &iSetup) { // cout<< " Eta seeds: "< eClus; - vector etClus; - vector etaClus; - vector thetaClus; - vector phiClus; - vector max_hit; - - vector> RecHitsCluster; - vector> RecHitsCluster5x5; - vector s4s9Clus; - vector s9s25Clus; + std::vector eClus; + std::vector etClus; + std::vector etaClus; + std::vector thetaClus; + std::vector phiClus; + std::vector max_hit; + + std::vector> RecHitsCluster; + std::vector> RecHitsCluster5x5; + std::vector s4s9Clus; + std::vector s9s25Clus; nClus = 0; // Make own simple clusters (3x3, 5x5 or clusPhiSize_ x clusEtaSize_) - sort(seeds.begin(), seeds.end(), ecalRecHitGreater); + std::sort(seeds.begin(), seeds.end(), ecalRecHitGreater); for (std::vector::iterator itseed = seeds.begin(); itseed != seeds.end(); itseed++) { EBDetId seed_id = itseed->id(); @@ -733,8 +1012,8 @@ void DQMSourcePi0::analyze(const Event &iEvent, const EventSetup &iSetup) { // Reject the seed if not able to build the cluster around it correctly // if(clus_v.size() < clusEtaSize_*clusPhiSize_){cout<<" Not enough // RecHits "< RecHitsInWindow; - vector RecHitsInWindow5x5; + std::vector RecHitsInWindow; + std::vector RecHitsInWindow5x5; double simple_energy = 0; @@ -831,7 +1110,7 @@ void DQMSourcePi0::analyze(const Event &iEvent, const EventSetup &iSetup) { if (e3x3 <= 0) continue; - float s4s9_max = *max_element(s4s9_tmp, s4s9_tmp + 4) / e3x3; + float s4s9_max = *std::max_element(s4s9_tmp, s4s9_tmp + 4) / e3x3; /// calculate e5x5 std::vector clus_v5x5 = topology_p->getWindow(seed_id, 5, 5); @@ -905,7 +1184,7 @@ void DQMSourcePi0::analyze(const Event &iEvent, const EventSetup &iSetup) { (p0y + p1y) * (p0y + p1y) - (p0z + p1z) * (p0z + p1z)); if ((m_inv < seleMinvMaxEta_) && (m_inv > seleMinvMinEta_)) { // New Loop on cluster to measure isolation: - vector IsoClus; + std::vector IsoClus; IsoClus.clear(); float Iso = 0; TVector3 pairVect = TVector3((p0x + p1x), (p0y + p1y), (p0z + p1z)); @@ -982,7 +1261,7 @@ void DQMSourcePi0::analyze(const Event &iEvent, const EventSetup &iSetup) { std::vector seedsEndCap; seedsEndCap.clear(); - vector usedXtalsEndCap; + std::vector usedXtalsEndCap; usedXtalsEndCap.clear(); ////make seeds. @@ -1016,20 +1295,20 @@ void DQMSourcePi0::analyze(const Event &iEvent, const EventSetup &iSetup) { // "<size()<<" "<size()<<" "< eClusEndCap; - vector etClusEndCap; - vector etaClusEndCap; - vector thetaClusEndCap; - vector phiClusEndCap; - vector> RecHitsClusterEndCap; - vector> RecHitsCluster5x5EndCap; - vector s4s9ClusEndCap; - vector s9s25ClusEndCap; + std::vector eClusEndCap; + std::vector etClusEndCap; + std::vector etaClusEndCap; + std::vector thetaClusEndCap; + std::vector phiClusEndCap; + std::vector> RecHitsClusterEndCap; + std::vector> RecHitsCluster5x5EndCap; + std::vector s4s9ClusEndCap; + std::vector s9s25ClusEndCap; nClusEndCap = 0; // Make own simple clusters (3x3, 5x5 or clusPhiSize_ x clusEtaSize_) - sort(seedsEndCap.begin(), seedsEndCap.end(), ecalRecHitGreater); + std::sort(seedsEndCap.begin(), seedsEndCap.end(), ecalRecHitGreater); for (std::vector::iterator itseed = seedsEndCap.begin(); itseed != seedsEndCap.end(); itseed++) { EEDetId seed_id = itseed->id(); @@ -1048,8 +1327,8 @@ void DQMSourcePi0::analyze(const Event &iEvent, const EventSetup &iSetup) { std::vector clus_v = topology_ee->getWindow(seed_id, clusEtaSize_, clusPhiSize_); std::vector> clus_used; - vector RecHitsInWindow; - vector RecHitsInWindow5x5; + std::vector RecHitsInWindow; + std::vector RecHitsInWindow5x5; float simple_energy = 0; @@ -1131,7 +1410,7 @@ void DQMSourcePi0::analyze(const Event &iEvent, const EventSetup &iSetup) { etaClusEndCap.push_back(clus_pos.eta()); thetaClusEndCap.push_back(theta_s); phiClusEndCap.push_back(clus_pos.phi()); - s4s9ClusEndCap.push_back(*max_element(s4s9_tmp, s4s9_tmp + 4) / e3x3); + s4s9ClusEndCap.push_back(*std::max_element(s4s9_tmp, s4s9_tmp + 4) / e3x3); s9s25ClusEndCap.push_back(e3x3 / e5x5); RecHitsClusterEndCap.push_back(RecHitsInWindow); RecHitsCluster5x5EndCap.push_back(RecHitsInWindow5x5); @@ -1168,7 +1447,7 @@ void DQMSourcePi0::analyze(const Event &iEvent, const EventSetup &iSetup) { if ((m_inv < seleMinvMaxPi0EndCap_) && (m_inv > seleMinvMinPi0EndCap_)) { // New Loop on cluster to measure isolation: - vector IsoClus; + std::vector IsoClus; IsoClus.clear(); float Iso = 0; TVector3 pairVect = TVector3((p0x + p1x), (p0y + p1y), (p0z + p1z)); @@ -1234,7 +1513,7 @@ void DQMSourcePi0::analyze(const Event &iEvent, const EventSetup &iSetup) { std::vector seedsEndCap; seedsEndCap.clear(); - vector usedXtalsEndCap; + std::vector usedXtalsEndCap; usedXtalsEndCap.clear(); ////make seeds. @@ -1268,20 +1547,20 @@ void DQMSourcePi0::analyze(const Event &iEvent, const EventSetup &iSetup) { // "<size()<<" "<size()<<" "< eClusEndCap; - vector etClusEndCap; - vector etaClusEndCap; - vector thetaClusEndCap; - vector phiClusEndCap; - vector> RecHitsClusterEndCap; - vector> RecHitsCluster5x5EndCap; - vector s4s9ClusEndCap; - vector s9s25ClusEndCap; + std::vector eClusEndCap; + std::vector etClusEndCap; + std::vector etaClusEndCap; + std::vector thetaClusEndCap; + std::vector phiClusEndCap; + std::vector> RecHitsClusterEndCap; + std::vector> RecHitsCluster5x5EndCap; + std::vector s4s9ClusEndCap; + std::vector s9s25ClusEndCap; nClusEndCap = 0; // Make own simple clusters (3x3, 5x5 or clusPhiSize_ x clusEtaSize_) - sort(seedsEndCap.begin(), seedsEndCap.end(), ecalRecHitGreater); + std::sort(seedsEndCap.begin(), seedsEndCap.end(), ecalRecHitGreater); for (std::vector::iterator itseed = seedsEndCap.begin(); itseed != seedsEndCap.end(); itseed++) { EEDetId seed_id = itseed->id(); @@ -1300,8 +1579,8 @@ void DQMSourcePi0::analyze(const Event &iEvent, const EventSetup &iSetup) { std::vector clus_v = topology_ee->getWindow(seed_id, clusEtaSize_, clusPhiSize_); std::vector> clus_used; - vector RecHitsInWindow; - vector RecHitsInWindow5x5; + std::vector RecHitsInWindow; + std::vector RecHitsInWindow5x5; float simple_energy = 0; @@ -1383,7 +1662,7 @@ void DQMSourcePi0::analyze(const Event &iEvent, const EventSetup &iSetup) { etaClusEndCap.push_back(clus_pos.eta()); thetaClusEndCap.push_back(theta_s); phiClusEndCap.push_back(clus_pos.phi()); - s4s9ClusEndCap.push_back(*max_element(s4s9_tmp, s4s9_tmp + 4) / e3x3); + s4s9ClusEndCap.push_back(*std::max_element(s4s9_tmp, s4s9_tmp + 4) / e3x3); s9s25ClusEndCap.push_back(e3x3 / e5x5); RecHitsClusterEndCap.push_back(RecHitsInWindow); RecHitsCluster5x5EndCap.push_back(RecHitsInWindow5x5); @@ -1420,7 +1699,7 @@ void DQMSourcePi0::analyze(const Event &iEvent, const EventSetup &iSetup) { if ((m_inv < seleMinvMaxEtaEndCap_) && (m_inv > seleMinvMinEtaEndCap_)) { // New Loop on cluster to measure isolation: - vector IsoClus; + std::vector IsoClus; IsoClus.clear(); float Iso = 0; TVector3 pairVect = TVector3((p0x + p1x), (p0y + p1y), (p0z + p1z)); @@ -1506,3 +1785,5 @@ int DQMSourcePi0::diff_nphi_s(Int_t nphi1, Int_t nphi2) { } return mdiff; } + +DEFINE_FWK_MODULE(DQMSourcePi0); diff --git a/DQMOffline/CalibCalo/plugins/SealModule.cc b/DQMOffline/CalibCalo/plugins/SealModule.cc deleted file mode 100644 index b471a894d2a7c..0000000000000 --- a/DQMOffline/CalibCalo/plugins/SealModule.cc +++ /dev/null @@ -1,18 +0,0 @@ -#include "FWCore/Framework/interface/MakerMacros.h" - -// The PhiSym and Pi0 source module -#include "DQMOffline/CalibCalo/interface/DQMSourceEleCalib.h" -#include "DQMOffline/CalibCalo/src/DQMHOAlCaRecoStream.h" -#include "DQMOffline/CalibCalo/src/DQMHcalDiJetsAlCaReco.h" -#include "DQMOffline/CalibCalo/src/DQMHcalIsoTrackAlCaReco.h" -#include "DQMOffline/CalibCalo/src/DQMHcalIsolatedBunchAlCaReco.h" -#include "DQMOffline/CalibCalo/src/DQMHcalPhiSymAlCaReco.h" -#include "DQMOffline/CalibCalo/src/DQMSourcePi0.h" - -DEFINE_FWK_MODULE(DQMHcalPhiSymAlCaReco); -DEFINE_FWK_MODULE(DQMSourcePi0); -DEFINE_FWK_MODULE(DQMSourceEleCalib); -DEFINE_FWK_MODULE(DQMHcalIsoTrackAlCaReco); -DEFINE_FWK_MODULE(DQMHcalDiJetsAlCaReco); -DEFINE_FWK_MODULE(DQMHOAlCaRecoStream); -DEFINE_FWK_MODULE(DQMHcalIsolatedBunchAlCaReco); diff --git a/DQMOffline/CalibCalo/python/MonitorAlCaHcalIterativePhisym_cfi.py b/DQMOffline/CalibCalo/python/MonitorAlCaHcalIterativePhisym_cfi.py new file mode 100644 index 0000000000000..95093e0b9f8fe --- /dev/null +++ b/DQMOffline/CalibCalo/python/MonitorAlCaHcalIterativePhisym_cfi.py @@ -0,0 +1,17 @@ +import FWCore.ParameterSet.Config as cms + +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer + +HcalIterativePhiSymMon = DQMEDAnalyzer('DQMHcalIterativePhiSymAlCaReco', + folderName = cms.string('ALCAStreamHcalIterativePhiSym'), + hbheInput = cms.InputTag('hbhereco'), + hfInput = cms.InputTag('hfreco'), + hoInput = cms.InputTag('horeco'), + hiDistr_y_nbin = cms.untracked.int32(72), + hiDistr_y_min = cms.untracked.double(0.5), + hiDistr_y_max = cms.untracked.double(72.5), + hiDistr_x_nbin = cms.untracked.int32(83), + hiDistr_x_min = cms.untracked.double(-41.5), + hiDistr_x_max = cms.untracked.double(41.5), + mightGet = cms.optional.untracked.vstring +) diff --git a/DQMOffline/CalibCalo/src/DQMHOAlCaRecoStream.h b/DQMOffline/CalibCalo/src/DQMHOAlCaRecoStream.h deleted file mode 100644 index 11973499eff80..0000000000000 --- a/DQMOffline/CalibCalo/src/DQMHOAlCaRecoStream.h +++ /dev/null @@ -1,58 +0,0 @@ - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Utilities/interface/InputTag.h" - -#include "DQMServices/Core/interface/DQMEDAnalyzer.h" -#include "DQMServices/Core/interface/DQMStore.h" -#include "DataFormats/HcalCalibObjects/interface/HOCalibVariables.h" - -class DQMHOAlCaRecoStream : public DQMEDAnalyzer { -public: - explicit DQMHOAlCaRecoStream(const edm::ParameterSet &); - ~DQMHOAlCaRecoStream() override; - -private: - void analyze(const edm::Event &, const edm::EventSetup &) override; - void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; - - MonitorElement *hMuonMultipl; - MonitorElement *hMuonMom; - MonitorElement *hMuonEta; - MonitorElement *hMuonPhi; - - MonitorElement *hDirCosine; - MonitorElement *hHOTime; - - MonitorElement *hSigRing[5]; - // MonitorElement* hSigRingm1; - // MonitorElement* hSigRing00; - // MonitorElement* hSigRingp1; - // MonitorElement* hSigRingp2; - - MonitorElement *hPedRing[5]; - // MonitorElement* hPedRingm1; - // MonitorElement* hPedRing00; - // MonitorElement* hPedRingp1; - // MonitorElement* hPedRingp2; - - MonitorElement *hSignal3x3[9]; - - int Nevents; - int Nmuons; - - std::string theRootFileName; - std::string folderName_; - double m_sigmaValue; - - double m_lowRadPosInMuch; - double m_highRadPosInMuch; - - int m_nbins; - double m_lowEdge; - double m_highEdge; - - bool saveToFile_; - edm::EDGetTokenT hoCalibVariableCollectionTag; - - // ----------member data --------------------------- -}; diff --git a/DQMOffline/CalibCalo/src/DQMHcalDiJetsAlCaReco.h b/DQMOffline/CalibCalo/src/DQMHcalDiJetsAlCaReco.h deleted file mode 100644 index 8da6174706078..0000000000000 --- a/DQMOffline/CalibCalo/src/DQMHcalDiJetsAlCaReco.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef DQMHcalDiJetsAlCaReco_H -#define DQMHcalDiJetsAlCaReco_H - -/** \class DQMHcalPhiSymAlCaReco - * * - * DQM Source for phi symmetry stream - * - * \author Stefano Argiro' - * Andrea Gozzelino - Universita  e INFN Torino - * - */ - -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" - -#include "DQMServices/Core/interface/DQMEDAnalyzer.h" -#include "DQMServices/Core/interface/DQMStore.h" -#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "DataFormats/JetReco/interface/CaloJet.h" -#include "DataFormats/JetReco/interface/CaloJetCollection.h" - -class DQMHcalDiJetsAlCaReco : public DQMEDAnalyzer { -public: - DQMHcalDiJetsAlCaReco(const edm::ParameterSet &); - ~DQMHcalDiJetsAlCaReco() override; - -protected: - void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; - void analyze(const edm::Event &e, const edm::EventSetup &c) override; - -private: - int eventCounter_; - - // - // Monitor elements - // - MonitorElement *hiDistrRecHitEnergyEBEE_; - MonitorElement *hiDistrRecHitEnergyHBHE_; - MonitorElement *hiDistrRecHitEnergyHF_; - MonitorElement *hiDistrRecHitEnergyHO_; - - MonitorElement *hiDistrProbeJetEnergy_; - MonitorElement *hiDistrProbeJetEta_; - MonitorElement *hiDistrProbeJetPhi_; - - MonitorElement *hiDistrTagJetEnergy_; - MonitorElement *hiDistrTagJetEta_; - MonitorElement *hiDistrTagJetPhi_; - - MonitorElement *hiDistrEtThirdJet_; - - /// object to monitor - edm::EDGetTokenT jets_; - edm::EDGetTokenT ec_; - edm::EDGetTokenT hbhe_; - edm::EDGetTokenT ho_; - edm::EDGetTokenT hf_; - - /// DQM folder name - std::string folderName_; - - /// Write to file - bool saveToFile_; - - /// Output file name if required - std::string fileName_; - - bool allowMissingInputs_; -}; - -#endif diff --git a/DQMOffline/CalibCalo/src/DQMHcalIsoTrackAlCaReco.h b/DQMOffline/CalibCalo/src/DQMHcalIsoTrackAlCaReco.h deleted file mode 100644 index 9d35b73080752..0000000000000 --- a/DQMOffline/CalibCalo/src/DQMHcalIsoTrackAlCaReco.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef DQMHcalIsoTrackAlCaReco_H -#define DQMHcalIsoTrackAlCaReco_H - -// -*- C++ -*- -// -// Package: DQMOffline/CalibCalo -// Class: DQMHcalIsoTrackAlCaReco -// -/**\class DQMHcalIsoTrackAlCaReco DQMHcalIsoTrackAlCaReco.cc - DQMOffline/CalibCalo/src/DQMHcalIsoTrackAlCaReco.cc - - Description: - - Implementation: - -*/ -// -// Original Author: Grigory SAFRONOV -// Created: Tue Oct 14 16:10:31 CEST 2008 -// Modified: Tue Mar 3 16:10:31 CEST 2015 -// -// - -// system include files -#include -#include -#include - -// user include files - -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/HLTReco/interface/TriggerEvent.h" -#include "DataFormats/HcalIsolatedTrack/interface/HcalIsolatedTrackCandidate.h" -#include "DataFormats/HcalIsolatedTrack/interface/HcalIsolatedTrackCandidateFwd.h" -#include "DataFormats/Math/interface/deltaR.h" - -#include "DQMServices/Core/interface/DQMEDAnalyzer.h" -#include "DQMServices/Core/interface/DQMStore.h" -#include "FWCore/ServiceRegistry/interface/Service.h" - -class DQMHcalIsoTrackAlCaReco : public DQMEDAnalyzer { -public: - explicit DQMHcalIsoTrackAlCaReco(const edm::ParameterSet &); - ~DQMHcalIsoTrackAlCaReco() override; - - void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; - void analyze(const edm::Event &, const edm::EventSetup &) override; - -private: - std::string folderName_; - std::vector l1FilterTag_, hltFilterTag_; - std::vector type_; - edm::InputTag labelTrigger_, labelTrack_; - edm::EDGetTokenT tokTrigger_; - edm::EDGetTokenT tokTrack_; - - double pThr_; - - std::vector hL1Pt_, hL1Eta_, hL1phi_; - std::vector hHltP_, hHltEta_, hHltPhi_; - MonitorElement *hL3Dr_, *hL3Rat_; - std::vector hOffP_; - MonitorElement *hMaxP_, *hEnEcal_, *hIeta_, *hIphi_; - - int nTotal_, nHLTaccepts_; - std::vector etaRange_; - std::vector indexH_; - std::vector ifL3_; -}; - -#endif diff --git a/DQMOffline/CalibCalo/src/DQMHcalIsolatedBunchAlCaReco.h b/DQMOffline/CalibCalo/src/DQMHcalIsolatedBunchAlCaReco.h deleted file mode 100644 index 96fabbb61996c..0000000000000 --- a/DQMOffline/CalibCalo/src/DQMHcalIsolatedBunchAlCaReco.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef DQMHcalIsolatedBunchAlCaReco_H -#define DQMHcalIsolatedBunchAlCaReco_H - -/** \class DQMHcalIsolatedBunchAlCaReco - * * - * DQM Source for Hcal iolated bunch stream - * - * - */ - -#include - -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DQMServices/Core/interface/DQMEDAnalyzer.h" -#include "DQMServices/Core/interface/DQMStore.h" -#include "DataFormats/Common/interface/TriggerResults.h" -#include "DataFormats/HLTReco/interface/TriggerEvent.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" - -class DQMHcalIsolatedBunchAlCaReco : public DQMEDAnalyzer { -public: - DQMHcalIsolatedBunchAlCaReco(const edm::ParameterSet &); - ~DQMHcalIsolatedBunchAlCaReco() override; - -protected: - void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; - void analyze(const edm::Event &e, const edm::EventSetup &c) override; - -private: - // - // Monitor elements - // - MonitorElement *h_Event_, *h_hbhehit_, *h_hfhit_, *h_hohit_; - - /// DQM folder name - std::string folderName_, trigName_; - bool plotAll_; - - /// object to monitor - edm::EDGetTokenT hbhereco_; - edm::EDGetTokenT horeco_; - edm::EDGetTokenT hfreco_; - edm::EDGetTokenT trigResult_; -}; - -#endif diff --git a/DQMOffline/CalibCalo/src/DQMHcalPhiSymAlCaReco.h b/DQMOffline/CalibCalo/src/DQMHcalPhiSymAlCaReco.h deleted file mode 100644 index 378a3bcbfc420..0000000000000 --- a/DQMOffline/CalibCalo/src/DQMHcalPhiSymAlCaReco.h +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef DQMHcalPhiSymAlCaReco_H -#define DQMHcalPhiSymAlCaReco_H - -/** \class DQMHcalPhiSymAlCaReco - * * - * DQM Source for phi symmetry stream - * - * \author Stefano Argiro' - * Andrea Gozzelino - Universita  e INFN Torino - * - */ - -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" - -#include "DQMServices/Core/interface/DQMOneEDAnalyzer.h" -#include "DQMServices/Core/interface/DQMStore.h" -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" - -class DQMHcalPhiSymAlCaReco : public DQMOneEDAnalyzer<> { -public: - DQMHcalPhiSymAlCaReco(const edm::ParameterSet &); - ~DQMHcalPhiSymAlCaReco() override; - -protected: - // void beginRun(const edm::Run& r, const edm::EventSetup& c); - void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; - void analyze(const edm::Event &e, const edm::EventSetup &c) override; - - void dqmEndRun(const edm::Run &r, const edm::EventSetup &c) override; - -private: - int eventCounter_; - - // - // Monitor elements - // - MonitorElement *hiDistrMBPl2D_; - MonitorElement *hiDistrNoisePl2D_; - MonitorElement *hiDistrMBMin2D_; - MonitorElement *hiDistrNoiseMin2D_; - - MonitorElement *hiDistrMB2Pl2D_; - MonitorElement *hiDistrNoise2Pl2D_; - MonitorElement *hiDistrMB2Min2D_; - MonitorElement *hiDistrNoise2Min2D_; - - MonitorElement *hiDistrVarMBPl2D_; - MonitorElement *hiDistrVarNoisePl2D_; - MonitorElement *hiDistrVarMBMin2D_; - MonitorElement *hiDistrVarNoiseMin2D_; - - MonitorElement *hiDistrHBHEsize1D_; - MonitorElement *hiDistrHFsize1D_; - - MonitorElement *hFEDsize; - MonitorElement *hHcalIsZS; - MonitorElement *hL1Id; - - int hiDistr_y_nbin_; - int hiDistr_x_nbin_; - double hiDistr_y_min_; - double hiDistr_y_max_; - double hiDistr_x_min_; - double hiDistr_x_max_; - - int hiDistr_r_nbin_; - double ihbhe_size_; - double ihf_size_; - - bool perLSsaving_; //to avoid nanoDQMIO crashing, driven by DQMServices/Core/python/DQMStore_cfi.py - - /// object to monitor - - edm::EDGetTokenT hbherecoMB; - edm::InputTag horecoMB; - edm::EDGetTokenT hfrecoMB; - - edm::EDGetTokenT hbherecoNoise; - edm::InputTag horecoNoise; - edm::EDGetTokenT hfrecoNoise; - - edm::EDGetTokenT rawInLabel_; - - /// DQM folder name - std::string folderName_; - - /// Write to file - bool saveToFile_; - - // period of ZS - unsigned int period_; - - /// Output file name if required - std::string fileName_; -}; - -#endif diff --git a/DQMOffline/CalibCalo/src/DQMSourcePi0.h b/DQMOffline/CalibCalo/src/DQMSourcePi0.h deleted file mode 100644 index b8370dbfc9a34..0000000000000 --- a/DQMOffline/CalibCalo/src/DQMSourcePi0.h +++ /dev/null @@ -1,303 +0,0 @@ -#ifndef DQMSourcePi0_H -#define DQMSourcePi0_H - -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" - -#include "DataFormats/EcalRecHit/interface/EcalRecHit.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" - -// Geometry -#include "DQMServices/Core/interface/DQMEDAnalyzer.h" -#include "DQMServices/Core/interface/DQMStore.h" -#include "Geometry/Records/interface/CaloTopologyRecord.h" -#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" -#include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h" -#include "Geometry/CaloTopology/interface/CaloTopology.h" -#include "Geometry/CaloTopology/interface/EcalBarrelTopology.h" -#include "Geometry/CaloTopology/interface/EcalEndcapTopology.h" -#include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h" - -// Less than operator for sorting EcalRecHits according to energy. -inline bool ecalRecHitGreater(EcalRecHit x, EcalRecHit y) { return (x.energy() > y.energy()); } - -class DQMSourcePi0 : public DQMEDAnalyzer { -public: - DQMSourcePi0(const edm::ParameterSet &); - ~DQMSourcePi0() override; - -protected: - void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; - void analyze(const edm::Event &e, const edm::EventSetup &c) override; - - void convxtalid(int &, int &); - int diff_neta_s(int, int); - int diff_nphi_s(int, int); - -private: - int eventCounter_; - PositionCalc posCalculator_; - - /// Distribution of rechits in iPhi (pi0) - MonitorElement *hiPhiDistrEBpi0_; - - /// Distribution of rechits in ix EE (pi0) - MonitorElement *hiXDistrEEpi0_; - - /// Distribution of rechits in iPhi (eta) - MonitorElement *hiPhiDistrEBeta_; - - /// Distribution of rechits in ix EE (eta) - MonitorElement *hiXDistrEEeta_; - - /// Distribution of rechits in iEta (pi0) - MonitorElement *hiEtaDistrEBpi0_; - - /// Distribution of rechits in iy EE (pi0) - MonitorElement *hiYDistrEEpi0_; - - /// Distribution of rechits in iEta (eta) - MonitorElement *hiEtaDistrEBeta_; - - /// Distribution of rechits in iy EE (eta) - MonitorElement *hiYDistrEEeta_; - - /// Energy Distribution of rechits EB (pi0) - MonitorElement *hRechitEnergyEBpi0_; - - /// Energy Distribution of rechits EE (pi0) - MonitorElement *hRechitEnergyEEpi0_; - - /// Energy Distribution of rechits EB (eta) - MonitorElement *hRechitEnergyEBeta_; - - /// Energy Distribution of rechits EE (eta) - MonitorElement *hRechitEnergyEEeta_; - - /// Distribution of total event energy EB (pi0) - MonitorElement *hEventEnergyEBpi0_; - - /// Distribution of total event energy EE (pi0) - MonitorElement *hEventEnergyEEpi0_; - - /// Distribution of total event energy EB (eta) - MonitorElement *hEventEnergyEBeta_; - - /// Distribution of total event energy EE (eta) - MonitorElement *hEventEnergyEEeta_; - - /// Distribution of number of RecHits EB (pi0) - MonitorElement *hNRecHitsEBpi0_; - - /// Distribution of number of RecHits EE (pi0) - MonitorElement *hNRecHitsEEpi0_; - - /// Distribution of number of RecHits EB (eta) - MonitorElement *hNRecHitsEBeta_; - - /// Distribution of number of RecHits EE (eta) - MonitorElement *hNRecHitsEEeta_; - - /// Distribution of Mean energy per rechit EB (pi0) - MonitorElement *hMeanRecHitEnergyEBpi0_; - - /// Distribution of Mean energy per rechit EE (pi0) - MonitorElement *hMeanRecHitEnergyEEpi0_; - - /// Distribution of Mean energy per rechit EB (eta) - MonitorElement *hMeanRecHitEnergyEBeta_; - - /// Distribution of Mean energy per rechit EE (eta) - MonitorElement *hMeanRecHitEnergyEEeta_; - - /// Pi0 invariant mass in EB - MonitorElement *hMinvPi0EB_; - - /// Pi0 invariant mass in EE - MonitorElement *hMinvPi0EE_; - - /// Eta invariant mass in EB - MonitorElement *hMinvEtaEB_; - - /// Eta invariant mass in EE - MonitorElement *hMinvEtaEE_; - - /// Pt of the 1st most energetic Pi0 photon in EB - MonitorElement *hPt1Pi0EB_; - - /// Pt of the 1st most energetic Pi0 photon in EE - MonitorElement *hPt1Pi0EE_; - - /// Pt of the 1st most energetic Eta photon in EB - MonitorElement *hPt1EtaEB_; - - /// Pt of the 1st most energetic Eta photon in EE - MonitorElement *hPt1EtaEE_; - - /// Pt of the 2nd most energetic Pi0 photon in EB - MonitorElement *hPt2Pi0EB_; - - /// Pt of the 2nd most energetic Pi0 photon in EE - MonitorElement *hPt2Pi0EE_; - - /// Pt of the 2nd most energetic Eta photon in EB - MonitorElement *hPt2EtaEB_; - - /// Pt of the 2nd most energetic Eta photon in EE - MonitorElement *hPt2EtaEE_; - - /// Pi0 Pt in EB - MonitorElement *hPtPi0EB_; - - /// Pi0 Pt in EE - MonitorElement *hPtPi0EE_; - - /// Eta Pt in EB - MonitorElement *hPtEtaEB_; - - /// Eta Pt in EE - MonitorElement *hPtEtaEE_; - - /// Pi0 Iso EB - MonitorElement *hIsoPi0EB_; - - /// Pi0 Iso EE - MonitorElement *hIsoPi0EE_; - - /// Eta Iso EB - MonitorElement *hIsoEtaEB_; - - /// Eta Iso EE - MonitorElement *hIsoEtaEE_; - - /// S4S9 of the 1st most energetic pi0 photon - MonitorElement *hS4S91Pi0EB_; - - /// S4S9 of the 1st most energetic pi0 photon EE - MonitorElement *hS4S91Pi0EE_; - - /// S4S9 of the 1st most energetic eta photon - MonitorElement *hS4S91EtaEB_; - - /// S4S9 of the 1st most energetic eta photon EE - MonitorElement *hS4S91EtaEE_; - - /// S4S9 of the 2nd most energetic pi0 photon - MonitorElement *hS4S92Pi0EB_; - - /// S4S9 of the 2nd most energetic pi0 photon EE - MonitorElement *hS4S92Pi0EE_; - - /// S4S9 of the 2nd most energetic eta photon - MonitorElement *hS4S92EtaEB_; - - /// S4S9 of the 2nd most energetic eta photon EE - MonitorElement *hS4S92EtaEE_; - - /// object to monitor - edm::EDGetTokenT productMonitoredEBpi0_; - edm::EDGetTokenT productMonitoredEBeta_; - - /// object to monitor - edm::EDGetTokenT productMonitoredEEpi0_; - edm::EDGetTokenT productMonitoredEEeta_; - - edm::ESGetToken caloTopoToken_; - edm::ESGetToken caloGeomToken_; - - int gammaCandEtaSize_; - int gammaCandPhiSize_; - - double seleXtalMinEnergy_; - double seleXtalMinEnergyEndCap_; - - double clusSeedThr_; - int clusEtaSize_; - int clusPhiSize_; - - double clusSeedThrEndCap_; - - //// for pi0->gg barrel - double selePtGamma_; - double selePtPi0_; - double seleMinvMaxPi0_; - double seleMinvMinPi0_; - double seleS4S9Gamma_; - double selePi0BeltDR_; - double selePi0BeltDeta_; - double selePi0Iso_; - double ptMinForIsolation_; - - /// for pi0->gg endcap - double selePtGammaEndCap_; - double selePtPi0EndCap_; - double seleMinvMaxPi0EndCap_; - double seleMinvMinPi0EndCap_; - double seleS4S9GammaEndCap_; - double selePi0IsoEndCap_; - double selePi0BeltDREndCap_; - double selePi0BeltDetaEndCap_; - double ptMinForIsolationEndCap_; - - /// for eta->gg barrel - double selePtGammaEta_; - double selePtEta_; - double seleS4S9GammaEta_; - double seleS9S25GammaEta_; - double seleMinvMaxEta_; - double seleMinvMinEta_; - double ptMinForIsolationEta_; - double seleEtaIso_; - double seleEtaBeltDR_; - double seleEtaBeltDeta_; - - /// for eta->gg endcap - double selePtGammaEtaEndCap_; - double seleS4S9GammaEtaEndCap_; - double seleS9S25GammaEtaEndCap_; - double selePtEtaEndCap_; - double seleMinvMaxEtaEndCap_; - double seleMinvMinEtaEndCap_; - double ptMinForIsolationEtaEndCap_; - double seleEtaIsoEndCap_; - double seleEtaBeltDREndCap_; - double seleEtaBeltDetaEndCap_; - - bool ParameterLogWeighted_; - double ParameterX0_; - double ParameterT0_barl_; - double ParameterT0_endc_; - double ParameterT0_endcPresh_; - double ParameterW0_; - - std::vector detIdEBRecHits; - std::vector EBRecHits; - - std::vector detIdEERecHits; - std::vector EERecHits; - - /// Monitor every prescaleFactor_ events - unsigned int prescaleFactor_; - - /// DQM folder name - std::string folderName_; - - /// Write to file - bool saveToFile_; - - /// which subdet will be monitored - bool isMonEBpi0_; - bool isMonEBeta_; - bool isMonEEpi0_; - bool isMonEEeta_; - - /// Output file name if required - std::string fileName_; -}; - -#endif diff --git a/DQMOffline/Configuration/python/ALCARECOHcalCalDQMHI_cff.py b/DQMOffline/Configuration/python/ALCARECOHcalCalDQMHI_cff.py index 4f04d745fe3b8..7edf371123da2 100644 --- a/DQMOffline/Configuration/python/ALCARECOHcalCalDQMHI_cff.py +++ b/DQMOffline/Configuration/python/ALCARECOHcalCalDQMHI_cff.py @@ -1,6 +1,7 @@ import FWCore.ParameterSet.Config as cms import DQMOffline.CalibCalo.MonitorAlCaHcalPhisym_cfi +import DQMOffline.CalibCalo.MonitorAlCaHcalIterativePhisym_cfi import DQMOffline.CalibCalo.MonitorHcalDiJetsAlCaReco_cfi import DQMOffline.CalibCalo.MonitorHcalIsoTrackAlCaReco_cfi import DQMOffline.CalibCalo.MonitorHcalIsolatedBunchAlCaReco_cfi @@ -15,6 +16,8 @@ ALCARECOHcalCalPhisymDQM.hbheInputMB = "hbhereco" ALCARECOHcalCalPhisymDQM.hbheInputMB = "horeco" +ALCARECOHcalCalIterativePhisymDQM = DQMOffline.CalibCalo.MonitorAlCaHcalIterativePhisym_cfi.HcalIterativePhiSymMon.clone() + ALCARECOHcalCalDiJetsDQM = DQMOffline.CalibCalo.MonitorHcalDiJetsAlCaReco_cfi.MonitorHcalDiJetsAlCaReco.clone() ALCARECOHcalCalIsoTrackDQM = DQMOffline.CalibCalo.MonitorHcalIsoTrackAlCaReco_cfi.MonitorHcalIsoTrackAlCaReco.clone() diff --git a/DQMOffline/Configuration/python/ALCARECOHcalCalDQM_cff.py b/DQMOffline/Configuration/python/ALCARECOHcalCalDQM_cff.py index 5457b8f9bbd53..4035084f7500b 100644 --- a/DQMOffline/Configuration/python/ALCARECOHcalCalDQM_cff.py +++ b/DQMOffline/Configuration/python/ALCARECOHcalCalDQM_cff.py @@ -1,6 +1,7 @@ import FWCore.ParameterSet.Config as cms import DQMOffline.CalibCalo.MonitorAlCaHcalPhisym_cfi +import DQMOffline.CalibCalo.MonitorAlCaHcalIterativePhisym_cfi import DQMOffline.CalibCalo.MonitorHcalDiJetsAlCaReco_cfi import DQMOffline.CalibCalo.MonitorHcalIsoTrackAlCaReco_cfi import DQMOffline.CalibCalo.MonitorHcalIsolatedBunchAlCaReco_cfi @@ -12,6 +13,8 @@ ALCARECOHcalCalPhisymDQM = DQMOffline.CalibCalo.MonitorAlCaHcalPhisym_cfi.HcalPhiSymMon.clone() +ALCARECOHcalCalIterativePhisymDQM = DQMOffline.CalibCalo.MonitorAlCaHcalIterativePhisym_cfi.HcalIterativePhiSymMon.clone() + ALCARECOHcalCalDiJetsDQM = DQMOffline.CalibCalo.MonitorHcalDiJetsAlCaReco_cfi.MonitorHcalDiJetsAlCaReco.clone() ALCARECOHcalCalIsoTrackDQM = DQMOffline.CalibCalo.MonitorHcalIsoTrackAlCaReco_cfi.MonitorHcalIsoTrackAlCaReco.clone() diff --git a/DQMOffline/EGamma/plugins/SealModule.cc b/DQMOffline/EGamma/plugins/SealModule.cc index 4f1ae003ca558..8d0479a17a524 100644 --- a/DQMOffline/EGamma/plugins/SealModule.cc +++ b/DQMOffline/EGamma/plugins/SealModule.cc @@ -1,7 +1,6 @@ #include "FWCore/PluginManager/interface/ModuleDef.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "DQMOffline/EGamma/plugins/PhotonAnalyzer.h" -#include "DQMOffline/EGamma/plugins/ZToMuMuGammaAnalyzer.h" #include "DQMOffline/EGamma/plugins/PhotonOfflineClient.h" #include "DQMOffline/EGamma/plugins/PhotonDataCertification.h" #include "DQMOffline/EGamma/plugins/PiZeroAnalyzer.h" @@ -11,7 +10,6 @@ #include "DQMOffline/EGamma/plugins/ElectronOfflineClient.h" DEFINE_FWK_MODULE(PhotonAnalyzer); -DEFINE_FWK_MODULE(ZToMuMuGammaAnalyzer); DEFINE_FWK_MODULE(PhotonOfflineClient); DEFINE_FWK_MODULE(PhotonDataCertification); DEFINE_FWK_MODULE(PiZeroAnalyzer); diff --git a/DQMOffline/EGamma/plugins/ZToMuMuGammaAnalyzer.cc b/DQMOffline/EGamma/plugins/ZToMuMuGammaAnalyzer.cc index fd61f1acb53ba..a3369c2545189 100644 --- a/DQMOffline/EGamma/plugins/ZToMuMuGammaAnalyzer.cc +++ b/DQMOffline/EGamma/plugins/ZToMuMuGammaAnalyzer.cc @@ -1,18 +1,304 @@ -#include -#include - -#include "DQMOffline/EGamma/plugins/ZToMuMuGammaAnalyzer.h" /** \class ZToMuMuGammaAnalyzer - ** + ** ** ** $Id: ZToMuMuGammaAnalyzer - ** authors: - ** Nancy Marinelli, U. of Notre Dame, US - ** Nathan Kellams, U. of Notre Dame, US - ** + ** authors: + ** Nancy Marinelli, U. of Notre Dame, US + ** Jamie Antonelli, U. of Notre Dame, US + ** Nathan Kellams, U. of Notre Dame, US + ** ***/ +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "CommonTools/UtilAlgos/interface/TFileService.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/Exception.h" + +// DataFormats +#include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/TrackReco/interface/TrackExtra.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "DataFormats/Common/interface/ValueMap.h" +#include "DataFormats/EgammaCandidates/interface/Conversion.h" +#include "DataFormats/EgammaCandidates/interface/ConversionFwd.h" +#include "DataFormats/EgammaCandidates/interface/Photon.h" +#include "DataFormats/EgammaCandidates/interface/PhotonFwd.h" +#include "DataFormats/MuonReco/interface/MuonFwd.h" +#include "DataFormats/MuonReco/interface/MuonSelectors.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "DataFormats/EgammaReco/interface/SuperCluster.h" +#include "DataFormats/EcalDetId/interface/EBDetId.h" +#include "DataFormats/EcalDetId/interface/EEDetId.h" +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHit.h" +#include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h" +#include "DataFormats/RecoCandidate/interface/RecoEcalCandidateFwd.h" +#include "DataFormats/HLTReco/interface/TriggerEvent.h" + +/// EgammaCoreTools +#include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h" +#include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h" + +#include "CommonTools/Statistics/interface/ChiSquaredProbability.h" + +// Geometry +#include "Geometry/Records/interface/CaloTopologyRecord.h" +#include "Geometry/CaloTopology/interface/CaloTopology.h" +#include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h" +#include "Geometry/Records/interface/IdealGeometryRecord.h" +#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/CaloTopology/interface/EcalEndcapTopology.h" +#include "Geometry/CaloTopology/interface/EcalBarrelTopology.h" + +#include "TFile.h" +#include "TH1.h" +#include "TH2.h" +#include "TTree.h" +#include "TVector3.h" +#include "TProfile.h" + +//DQM services +#include +#include + +#include +#include +#include +#include + +class ZToMuMuGammaAnalyzer : public DQMEDAnalyzer { +public: + explicit ZToMuMuGammaAnalyzer(const edm::ParameterSet&); + ~ZToMuMuGammaAnalyzer() override; + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + +private: + edm::EDGetTokenT > photon_token_; + edm::EDGetTokenT > muon_token_; + edm::EDGetTokenT > PhotonIDLoose_token_; + edm::EDGetTokenT > PhotonIDTight_token_; + edm::EDGetTokenT > > barrelRecHit_token_; + edm::EDGetTokenT > > endcapRecHit_token_; + edm::EDGetTokenT triggerEvent_token_; + edm::EDGetTokenT beamSpot_token_; + edm::EDGetTokenT pfCandidates_; + edm::EDGetTokenT offline_pvToken_; + edm::EDGetTokenT > > photonIsoValmap_token_; + + std::string fName_; + bool use2DHistos_; + bool makeProfiles_; + unsigned int prescaleFactor_; + std::stringstream currentFolder_; + int nEvt_; + + // muon selection + float muonMinPt_; + int minPixStripHits_; + float muonMaxChi2_; + float muonMaxDxy_; + int muonMatches_; + int validPixHits_; + int validMuonHits_; + float muonTrackIso_; + float muonTightEta_; + // dimuon selection + float minMumuInvMass_; + float maxMumuInvMass_; + // photon selection + float photonMinEt_; + float photonMaxEta_; + float photonTrackIso_; + + // mu mu gamma selection + float nearMuonDr2_; + float nearMuonHcalIso_; + float farMuonEcalIso_; + float farMuonTrackIso_; + float farMuonMinPt_; + float minMumuGammaInvMass_; + float maxMumuGammaInvMass_; + + // Histogram parameters + double eMin_; + double eMax_; + int eBin_; + + double etMin_; + double etMax_; + int etBin_; + + double sumMin_; + double sumMax_; + int sumBin_; + + double etaMin_; + double etaMax_; + int etaBin_; + + double phiMin_; + double phiMax_; + int phiBin_; + + double r9Min_; + double r9Max_; + int r9Bin_; + + double hOverEMin_; + double hOverEMax_; + int hOverEBin_; + + double numberMin_; + double numberMax_; + int numberBin_; + + double sigmaIetaMin_; + double sigmaIetaMax_; + int sigmaIetaBin_; + + int reducedEtBin_; + int reducedEtaBin_; + int reducedSumBin_; + int reducedR9Bin_; + + float mumuInvMass(const reco::Muon& m1, const reco::Muon& m2); + float mumuGammaInvMass(const reco::Muon& mu1, const reco::Muon& mu2, const reco::PhotonRef& pho); + bool basicMuonSelection(const reco::Muon& m); + bool muonSelection(const reco::Muon& m, const reco::BeamSpot& bs); + bool photonSelection(const reco::PhotonRef& p); + + MonitorElement* h_nRecoVtx_; + ///photon histos + MonitorElement* h1_mumuInvMass_[3]; + MonitorElement* h1_mumuGammaInvMass_[3]; + + MonitorElement* h_phoE_[3]; + MonitorElement* h_phoSigmaEoverE_[3]; + MonitorElement* p_phoSigmaEoverEVsNVtx_[3]; + MonitorElement* h_phoEt_[3]; + + MonitorElement* h_nPho_[3]; + + MonitorElement* h_phoEta_[3]; + MonitorElement* h_phoPhi_[3]; + MonitorElement* h_scEta_[3]; + MonitorElement* h_scPhi_[3]; + + MonitorElement* h_r9_[3]; + MonitorElement* h2_r9VsEt_[3]; + MonitorElement* p_r9VsEt_[3]; + MonitorElement* h2_r9VsEta_[3]; + MonitorElement* p_r9VsEta_[3]; + + MonitorElement* h_e1x5_[3]; + MonitorElement* h2_e1x5VsEta_[3]; + MonitorElement* p_e1x5VsEta_[3]; + MonitorElement* h2_e1x5VsEt_[3]; + MonitorElement* p_e1x5VsEt_[3]; + + MonitorElement* h_e2x5_[3]; + MonitorElement* h2_e2x5VsEta_[3]; + MonitorElement* p_e2x5VsEta_[3]; + MonitorElement* h2_e2x5VsEt_[3]; + MonitorElement* p_e2x5VsEt_[3]; + + MonitorElement* h_r1x5_[3]; + MonitorElement* h2_r1x5VsEta_[3]; + MonitorElement* p_r1x5VsEta_[3]; + MonitorElement* h2_r1x5VsEt_[3]; + MonitorElement* p_r1x5VsEt_[3]; + + MonitorElement* h_r2x5_[3]; + MonitorElement* h2_r2x5VsEta_[3]; + MonitorElement* p_r2x5VsEta_[3]; + MonitorElement* h2_r2x5VsEt_[3]; + MonitorElement* p_r2x5VsEt_[3]; + + MonitorElement* h_phoSigmaIetaIeta_[3]; + MonitorElement* h2_sigmaIetaIetaVsEta_[3]; + MonitorElement* p_sigmaIetaIetaVsEta_[3]; + + MonitorElement* h_nTrackIsolSolid_[3]; + MonitorElement* h2_nTrackIsolSolidVsEt_[3]; + MonitorElement* p_nTrackIsolSolidVsEt_[3]; + MonitorElement* h2_nTrackIsolSolidVsEta_[3]; + MonitorElement* p_nTrackIsolSolidVsEta_[3]; + + MonitorElement* h_nTrackIsolHollow_[3]; + MonitorElement* h2_nTrackIsolHollowVsEt_[3]; + MonitorElement* p_nTrackIsolHollowVsEt_[3]; + MonitorElement* h2_nTrackIsolHollowVsEta_[3]; + MonitorElement* p_nTrackIsolHollowVsEta_[3]; + + MonitorElement* h_trackPtSumSolid_[3]; + MonitorElement* h2_trackPtSumSolidVsEt_[3]; + MonitorElement* p_trackPtSumSolidVsEt_[3]; + MonitorElement* h2_trackPtSumSolidVsEta_[3]; + MonitorElement* p_trackPtSumSolidVsEta_[3]; + + MonitorElement* h_trackPtSumHollow_[3]; + MonitorElement* h2_trackPtSumHollowVsEt_[3]; + MonitorElement* p_trackPtSumHollowVsEt_[3]; + MonitorElement* h2_trackPtSumHollowVsEta_[3]; + MonitorElement* p_trackPtSumHollowVsEta_[3]; + + MonitorElement* h_ecalSum_[3]; + MonitorElement* h2_ecalSumVsEt_[3]; + MonitorElement* p_ecalSumVsEt_[3]; + MonitorElement* h2_ecalSumVsEta_[3]; + MonitorElement* p_ecalSumVsEta_[3]; + + MonitorElement* h_hcalSum_[3]; + MonitorElement* h2_hcalSumVsEt_[3]; + MonitorElement* p_hcalSumVsEt_[3]; + MonitorElement* h2_hcalSumVsEta_[3]; + MonitorElement* p_hcalSumVsEta_[3]; + + MonitorElement* h_hOverE_[3]; + MonitorElement* p_hOverEVsEt_[3]; + MonitorElement* p_hOverEVsEta_[3]; + MonitorElement* h_h1OverE_[3]; + MonitorElement* h_h2OverE_[3]; + + MonitorElement* h_newhOverE_[3]; + MonitorElement* p_newhOverEVsEta_[3]; + MonitorElement* p_newhOverEVsEt_[3]; + // Information from Particle Flow + // Isolation + MonitorElement* h_chHadIso_[3]; + MonitorElement* h_nHadIso_[3]; + MonitorElement* h_phoIso_[3]; + // Identification + MonitorElement* h_nCluOutsideMustache_[3]; + MonitorElement* h_etOutsideMustache_[3]; + MonitorElement* h_pfMva_[3]; + //// particle based isolation from ValueMap + MonitorElement* h_dRPhoPFcand_ChHad_Cleaned_[3]; + MonitorElement* h_dRPhoPFcand_NeuHad_Cleaned_[3]; + MonitorElement* h_dRPhoPFcand_Pho_Cleaned_[3]; + MonitorElement* h_dRPhoPFcand_ChHad_unCleaned_[3]; + MonitorElement* h_dRPhoPFcand_NeuHad_unCleaned_[3]; + MonitorElement* h_dRPhoPFcand_Pho_unCleaned_[3]; + MonitorElement* h_SumPtOverPhoPt_ChHad_Cleaned_[3]; + MonitorElement* h_SumPtOverPhoPt_NeuHad_Cleaned_[3]; + MonitorElement* h_SumPtOverPhoPt_Pho_Cleaned_[3]; + MonitorElement* h_SumPtOverPhoPt_ChHad_unCleaned_[3]; + MonitorElement* h_SumPtOverPhoPt_NeuHad_unCleaned_[3]; + MonitorElement* h_SumPtOverPhoPt_Pho_unCleaned_[3]; +}; + using namespace std; ZToMuMuGammaAnalyzer::ZToMuMuGammaAnalyzer(const edm::ParameterSet& pset) { @@ -55,7 +341,8 @@ ZToMuMuGammaAnalyzer::ZToMuMuGammaAnalyzer(const edm::ParameterSet& pset) { photonMaxEta_ = pset.getParameter("photonMaxEta"); photonTrackIso_ = pset.getParameter("photonTrackIso"); // mumuGamma selection - nearMuonDr_ = pset.getParameter("nearMuonDr"); + nearMuonDr2_ = pset.getParameter("nearMuonDr"); + nearMuonDr2_ *= nearMuonDr2_; nearMuonHcalIso_ = pset.getParameter("nearMuonHcalIso"); farMuonEcalIso_ = pset.getParameter("farMuonEcalIso"); farMuonTrackIso_ = pset.getParameter("farMuonTrackIso"); @@ -979,9 +1266,9 @@ void ZToMuMuGammaAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& e for (unsigned int iPho = 0; iPho < photonHandle->size(); iPho++) { reco::PhotonRef aPho(reco::PhotonRef(photonHandle, iPho)); // - double dr1 = deltaR((*iMu).eta(), aPho->eta(), (*iMu).phi(), aPho->phi()); - double dr2 = deltaR((*iMu2).eta(), aPho->eta(), (*iMu2).phi(), aPho->phi()); - double drNear = dr1; + double dr1 = deltaR2((*iMu).eta(), aPho->eta(), (*iMu).phi(), aPho->phi()); + double dr2 = deltaR2((*iMu2).eta(), aPho->eta(), (*iMu2).phi(), aPho->phi()); + double drNear; if (dr1 < dr2) { nearMuon = *iMu; farMuon = *iMu2; @@ -1000,7 +1287,7 @@ void ZToMuMuGammaAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& e continue; if (farMuon.pt() < farMuonMinPt_) continue; - if (drNear > nearMuonDr_) + if (drNear > nearMuonDr2_) continue; // if (!photonSelection(aPho)) @@ -1106,14 +1393,15 @@ void ZToMuMuGammaAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& e for (unsigned int lCand = 0; lCand < pfCandidateHandle->size(); lCand++) { reco::PFCandidateRef pfCandRef(reco::PFCandidateRef(pfCandidateHandle, lCand)); - float dR = deltaR(aPho->eta(), aPho->phi(), pfCandRef->eta(), pfCandRef->phi()); - if (dR < 0.4) { + float dR = deltaR2(aPho->eta(), aPho->phi(), pfCandRef->eta(), pfCandRef->phi()); + if (dR < 0.4 * 0.4) { /// uncleaned reco::PFCandidate::ParticleType type = pfCandRef->particleId(); if (type == reco::PFCandidate::e) continue; if (type == reco::PFCandidate::gamma && pfCandRef->mva_nothing_gamma() > 0.) continue; + dR = sqrt(dR); if (type == reco::PFCandidate::h) { SumPtIsoValCh += pfCandRef->pt(); @@ -1347,3 +1635,8 @@ float ZToMuMuGammaAnalyzer::mumuGammaInvMass(const reco::Muon& mu1, const reco:: float invMass = sqrt(Mass2); return invMass; } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(ZToMuMuGammaAnalyzer); diff --git a/DQMOffline/EGamma/plugins/ZToMuMuGammaAnalyzer.h b/DQMOffline/EGamma/plugins/ZToMuMuGammaAnalyzer.h deleted file mode 100644 index 953ae31329090..0000000000000 --- a/DQMOffline/EGamma/plugins/ZToMuMuGammaAnalyzer.h +++ /dev/null @@ -1,320 +0,0 @@ -#ifndef ZToMuMuGammaAnalyzer_H -#define ZToMuMuGammaAnalyzer_H - -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "CommonTools/UtilAlgos/interface/TFileService.h" - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/Exception.h" -// DataFormats -#include "DataFormats/Math/interface/deltaR.h" -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackReco/interface/TrackExtra.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "DataFormats/Common/interface/ValueMap.h" -#include "DataFormats/EgammaCandidates/interface/Conversion.h" -#include "DataFormats/EgammaCandidates/interface/ConversionFwd.h" -#include "DataFormats/EgammaCandidates/interface/Photon.h" -#include "DataFormats/EgammaCandidates/interface/PhotonFwd.h" -#include "DataFormats/MuonReco/interface/MuonFwd.h" -#include "DataFormats/MuonReco/interface/MuonSelectors.h" -#include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "DataFormats/EgammaReco/interface/BasicCluster.h" -#include "DataFormats/EgammaReco/interface/BasicClusterFwd.h" -#include "DataFormats/CaloRecHit/interface/CaloCluster.h" -#include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h" -#include "DataFormats/EgammaReco/interface/SuperCluster.h" -#include "DataFormats/EcalDetId/interface/EBDetId.h" -#include "DataFormats/EcalDetId/interface/EEDetId.h" -#include "DataFormats/DetId/interface/DetId.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHit.h" -#include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h" -#include "DataFormats/RecoCandidate/interface/RecoEcalCandidateFwd.h" -#include "DataFormats/HLTReco/interface/TriggerEvent.h" - -/// EgammaCoreTools -#include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h" -#include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h" - -#include "CommonTools/Statistics/interface/ChiSquaredProbability.h" - -// Geometry -#include "Geometry/Records/interface/CaloTopologyRecord.h" -#include "Geometry/CaloTopology/interface/CaloTopology.h" -#include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h" -#include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/CaloTopology/interface/EcalEndcapTopology.h" -#include "Geometry/CaloTopology/interface/EcalBarrelTopology.h" - -#include "TFile.h" -#include "TH1.h" -#include "TH2.h" -#include "TTree.h" -#include "TVector3.h" -#include "TProfile.h" - -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/CaloTopology/interface/CaloTopology.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" - -//DQM services -#include -#include - -#include -#include - -/** \class ZToMuMuGammaAnalyzer - ** - ** - ** $Id: ZToMuMuGammaAnalyzer - ** authors: - ** Nancy Marinelli, U. of Notre Dame, US - ** Jamie Antonelli, U. of Notre Dame, US - ** Nathan Kellams, U. of Notre Dame, US - ** - ***/ - -// forward declarations -class TFile; -class TH1F; -class TH2F; -class TProfile; -class TTree; -class SimVertex; -class SimTrack; - -class ZToMuMuGammaAnalyzer : public DQMEDAnalyzer { -public: - explicit ZToMuMuGammaAnalyzer(const edm::ParameterSet&); - ~ZToMuMuGammaAnalyzer() override; - void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; - void analyze(const edm::Event&, const edm::EventSetup&) override; - -private: - edm::EDGetTokenT > photon_token_; - edm::EDGetTokenT > muon_token_; - edm::EDGetTokenT > PhotonIDLoose_token_; - edm::EDGetTokenT > PhotonIDTight_token_; - edm::EDGetTokenT > > barrelRecHit_token_; - edm::EDGetTokenT > > endcapRecHit_token_; - edm::EDGetTokenT triggerEvent_token_; - edm::EDGetTokenT beamSpot_token_; - edm::EDGetTokenT pfCandidates_; - edm::EDGetTokenT offline_pvToken_; - edm::EDGetTokenT > > photonIsoValmap_token_; - - std::string fName_; - bool use2DHistos_; - bool makeProfiles_; - unsigned int prescaleFactor_; - std::stringstream currentFolder_; - int nEvt_; - - // muon selection - float muonMinPt_; - int minPixStripHits_; - float muonMaxChi2_; - float muonMaxDxy_; - int muonMatches_; - int validPixHits_; - int validMuonHits_; - float muonTrackIso_; - float muonTightEta_; - // dimuon selection - float minMumuInvMass_; - float maxMumuInvMass_; - // photon selection - float photonMinEt_; - float photonMaxEta_; - float photonTrackIso_; - - // mu mu gamma selection - float nearMuonDr_; - float nearMuonHcalIso_; - float farMuonEcalIso_; - float farMuonTrackIso_; - float farMuonMinPt_; - float minMumuGammaInvMass_; - float maxMumuGammaInvMass_; - - // Histogram parameters - double eMin_; - double eMax_; - int eBin_; - - double etMin_; - double etMax_; - int etBin_; - - double sumMin_; - double sumMax_; - int sumBin_; - - double etaMin_; - double etaMax_; - int etaBin_; - - double phiMin_; - double phiMax_; - int phiBin_; - - double r9Min_; - double r9Max_; - int r9Bin_; - - double hOverEMin_; - double hOverEMax_; - int hOverEBin_; - - double numberMin_; - double numberMax_; - int numberBin_; - - double sigmaIetaMin_; - double sigmaIetaMax_; - int sigmaIetaBin_; - - int reducedEtBin_; - int reducedEtaBin_; - int reducedSumBin_; - int reducedR9Bin_; - - float mumuInvMass(const reco::Muon& m1, const reco::Muon& m2); - float mumuGammaInvMass(const reco::Muon& mu1, const reco::Muon& mu2, const reco::PhotonRef& pho); - bool basicMuonSelection(const reco::Muon& m); - bool muonSelection(const reco::Muon& m, const reco::BeamSpot& bs); - bool photonSelection(const reco::PhotonRef& p); - - MonitorElement* h_nRecoVtx_; - ///photon histos - MonitorElement* h1_mumuInvMass_[3]; - MonitorElement* h1_mumuGammaInvMass_[3]; - - MonitorElement* h_phoE_[3]; - MonitorElement* h_phoSigmaEoverE_[3]; - MonitorElement* p_phoSigmaEoverEVsNVtx_[3]; - MonitorElement* h_phoEt_[3]; - - MonitorElement* h_nPho_[3]; - - MonitorElement* h_phoEta_[3]; - MonitorElement* h_phoPhi_[3]; - MonitorElement* h_scEta_[3]; - MonitorElement* h_scPhi_[3]; - - MonitorElement* h_r9_[3]; - MonitorElement* h2_r9VsEt_[3]; - MonitorElement* p_r9VsEt_[3]; - MonitorElement* h2_r9VsEta_[3]; - MonitorElement* p_r9VsEta_[3]; - - MonitorElement* h_e1x5_[3]; - MonitorElement* h2_e1x5VsEta_[3]; - MonitorElement* p_e1x5VsEta_[3]; - MonitorElement* h2_e1x5VsEt_[3]; - MonitorElement* p_e1x5VsEt_[3]; - - MonitorElement* h_e2x5_[3]; - MonitorElement* h2_e2x5VsEta_[3]; - MonitorElement* p_e2x5VsEta_[3]; - MonitorElement* h2_e2x5VsEt_[3]; - MonitorElement* p_e2x5VsEt_[3]; - - MonitorElement* h_r1x5_[3]; - MonitorElement* h2_r1x5VsEta_[3]; - MonitorElement* p_r1x5VsEta_[3]; - MonitorElement* h2_r1x5VsEt_[3]; - MonitorElement* p_r1x5VsEt_[3]; - - MonitorElement* h_r2x5_[3]; - MonitorElement* h2_r2x5VsEta_[3]; - MonitorElement* p_r2x5VsEta_[3]; - MonitorElement* h2_r2x5VsEt_[3]; - MonitorElement* p_r2x5VsEt_[3]; - - MonitorElement* h_phoSigmaIetaIeta_[3]; - MonitorElement* h2_sigmaIetaIetaVsEta_[3]; - MonitorElement* p_sigmaIetaIetaVsEta_[3]; - - MonitorElement* h_nTrackIsolSolid_[3]; - MonitorElement* h2_nTrackIsolSolidVsEt_[3]; - MonitorElement* p_nTrackIsolSolidVsEt_[3]; - MonitorElement* h2_nTrackIsolSolidVsEta_[3]; - MonitorElement* p_nTrackIsolSolidVsEta_[3]; - - MonitorElement* h_nTrackIsolHollow_[3]; - MonitorElement* h2_nTrackIsolHollowVsEt_[3]; - MonitorElement* p_nTrackIsolHollowVsEt_[3]; - MonitorElement* h2_nTrackIsolHollowVsEta_[3]; - MonitorElement* p_nTrackIsolHollowVsEta_[3]; - - MonitorElement* h_trackPtSumSolid_[3]; - MonitorElement* h2_trackPtSumSolidVsEt_[3]; - MonitorElement* p_trackPtSumSolidVsEt_[3]; - MonitorElement* h2_trackPtSumSolidVsEta_[3]; - MonitorElement* p_trackPtSumSolidVsEta_[3]; - - MonitorElement* h_trackPtSumHollow_[3]; - MonitorElement* h2_trackPtSumHollowVsEt_[3]; - MonitorElement* p_trackPtSumHollowVsEt_[3]; - MonitorElement* h2_trackPtSumHollowVsEta_[3]; - MonitorElement* p_trackPtSumHollowVsEta_[3]; - - MonitorElement* h_ecalSum_[3]; - MonitorElement* h2_ecalSumVsEt_[3]; - MonitorElement* p_ecalSumVsEt_[3]; - MonitorElement* h2_ecalSumVsEta_[3]; - MonitorElement* p_ecalSumVsEta_[3]; - - MonitorElement* h_hcalSum_[3]; - MonitorElement* h2_hcalSumVsEt_[3]; - MonitorElement* p_hcalSumVsEt_[3]; - MonitorElement* h2_hcalSumVsEta_[3]; - MonitorElement* p_hcalSumVsEta_[3]; - - MonitorElement* h_hOverE_[3]; - MonitorElement* p_hOverEVsEt_[3]; - MonitorElement* p_hOverEVsEta_[3]; - MonitorElement* h_h1OverE_[3]; - MonitorElement* h_h2OverE_[3]; - - MonitorElement* h_newhOverE_[3]; - MonitorElement* p_newhOverEVsEta_[3]; - MonitorElement* p_newhOverEVsEt_[3]; - // Information from Particle Flow - // Isolation - MonitorElement* h_chHadIso_[3]; - MonitorElement* h_nHadIso_[3]; - MonitorElement* h_phoIso_[3]; - // Identification - MonitorElement* h_nCluOutsideMustache_[3]; - MonitorElement* h_etOutsideMustache_[3]; - MonitorElement* h_pfMva_[3]; - //// particle based isolation from ValueMap - MonitorElement* h_dRPhoPFcand_ChHad_Cleaned_[3]; - MonitorElement* h_dRPhoPFcand_NeuHad_Cleaned_[3]; - MonitorElement* h_dRPhoPFcand_Pho_Cleaned_[3]; - MonitorElement* h_dRPhoPFcand_ChHad_unCleaned_[3]; - MonitorElement* h_dRPhoPFcand_NeuHad_unCleaned_[3]; - MonitorElement* h_dRPhoPFcand_Pho_unCleaned_[3]; - MonitorElement* h_SumPtOverPhoPt_ChHad_Cleaned_[3]; - MonitorElement* h_SumPtOverPhoPt_NeuHad_Cleaned_[3]; - MonitorElement* h_SumPtOverPhoPt_Pho_Cleaned_[3]; - MonitorElement* h_SumPtOverPhoPt_ChHad_unCleaned_[3]; - MonitorElement* h_SumPtOverPhoPt_NeuHad_unCleaned_[3]; - MonitorElement* h_SumPtOverPhoPt_Pho_unCleaned_[3]; -}; - -#endif diff --git a/DQMOffline/EGamma/python/egammaDQMOffline_cff.py b/DQMOffline/EGamma/python/egammaDQMOffline_cff.py index e16f0eff527d7..4dddd7915fecb 100644 --- a/DQMOffline/EGamma/python/egammaDQMOffline_cff.py +++ b/DQMOffline/EGamma/python/egammaDQMOffline_cff.py @@ -13,13 +13,14 @@ photonAnalysis.standAlone = cms.bool(False) -stdPhotonAnalysis = DQMOffline.EGamma.photonAnalyzer_cfi.photonAnalysis.clone() -stdPhotonAnalysis.ComponentName = cms.string('stdPhotonAnalysis') -stdPhotonAnalysis.analyzerName = cms.string('stdPhotonAnalyzer') -stdPhotonAnalysis.phoProducer = cms.InputTag('photons') -stdPhotonAnalysis.OutputMEsInRootFile = cms.bool(False) -stdPhotonAnalysis.Verbosity = cms.untracked.int32(0) -stdPhotonAnalysis.standAlone = cms.bool(False) +stdPhotonAnalysis = DQMOffline.EGamma.photonAnalyzer_cfi.photonAnalysis.clone( + ComponentName = cms.string('stdPhotonAnalysis'), + analyzerName = cms.string('stdPhotonAnalyzer'), + phoProducer = cms.InputTag('photons'), + OutputMEsInRootFile = cms.bool(False), + Verbosity = cms.untracked.int32(0), + standAlone = cms.bool(False), +) piZeroAnalysis.OutputMEsInRootFile = cms.bool(False) piZeroAnalysis.Verbosity = cms.untracked.int32(0) @@ -33,14 +34,15 @@ # HGCal customizations from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal -stdPhotonAnalysisHGCal = stdPhotonAnalysis.clone() -stdPhotonAnalysisHGCal.ComponentName = 'stdPhotonAnalyzerHGCalFromMultiCl' -stdPhotonAnalysisHGCal.analyzerName = 'stdPhotonAnalyzerHGCalFromMultiCl' -stdPhotonAnalysisHGCal.phoProducer = 'photonsFromMultiCl' -stdPhotonAnalysisHGCal.isolationStrength = 2 -stdPhotonAnalysisHGCal.etaMin = -3.0 -stdPhotonAnalysisHGCal.etaMax = 3.0 -stdPhotonAnalysisHGCal.maxPhoEta = 3.0 +stdPhotonAnalysisHGCal = stdPhotonAnalysis.clone( + ComponentName = 'stdPhotonAnalyzerHGCal', + analyzerName = 'stdPhotonAnalyzerHGCal', + phoProducer = 'photonsHGC', + isolationStrength = 2, + etaMin = -3.0, + etaMax = 3.0, + maxPhoEta = 3.0, +) egammaDQMOffline = cms.Sequence(photonAnalysis*stdPhotonAnalysis*zmumugammaOldAnalysis*zmumugammaAnalysis*piZeroAnalysis*electronAnalyzerSequence) _egammaDQMOfflineHGCal = egammaDQMOffline.copy() diff --git a/DQMOffline/EGamma/python/electronAnalyzerSequence_cff.py b/DQMOffline/EGamma/python/electronAnalyzerSequence_cff.py index 42a48748593df..4c6662963d985 100644 --- a/DQMOffline/EGamma/python/electronAnalyzerSequence_cff.py +++ b/DQMOffline/EGamma/python/electronAnalyzerSequence_cff.py @@ -48,28 +48,28 @@ * dqmElectronTagProbeAnalysis ) -mergedSuperClustersFromMultiCl = mergedSuperClusters.clone() -mergedSuperClustersFromMultiCl.src = cms.VInputTag( +mergedSuperClustersHGC = mergedSuperClusters.clone() +mergedSuperClustersHGC.src = cms.VInputTag( cms.InputTag("particleFlowSuperClusterECAL","particleFlowSuperClusterECALBarrel"), - cms.InputTag("particleFlowSuperClusterHGCalFromMultiCl","") + cms.InputTag("particleFlowSuperClusterHGCal","") ) -dqmElectronAnalysisAllElectronsFromMultiCl = dqmElectronAnalysisAllElectrons.clone() -dqmElectronAnalysisAllElectronsFromMultiCl.OutputFolderName = 'Egamma/Electrons/Ele2FromMultiCl_All' -dqmElectronAnalysisAllElectronsFromMultiCl.MaxAbsEtaMatchingObject = 3.0 -dqmElectronAnalysisAllElectronsFromMultiCl.EtaMax = 3.0 -dqmElectronAnalysisAllElectronsFromMultiCl.EtaMin = -3.0 -dqmElectronAnalysisAllElectronsFromMultiCl.MaxAbsEta = 3.0 -dqmElectronAnalysisAllElectronsFromMultiCl.ElectronCollection = 'ecalDrivenGsfElectronsFromMultiCl' -dqmElectronAnalysisAllElectronsFromMultiCl.MatchingObjectCollection = 'mergedSuperClustersFromMultiCl' - -_electronAnalyzerSequenceFromMultiCl = electronAnalyzerSequence.copy() -_electronAnalyzerSequenceFromMultiCl += cms.Sequence(mergedSuperClustersFromMultiCl+dqmElectronAnalysisAllElectronsFromMultiCl) +dqmElectronAnalysisAllElectronsHGC = dqmElectronAnalysisAllElectrons.clone() +dqmElectronAnalysisAllElectronsHGC.OutputFolderName = 'Egamma/Electrons/Ele2HGC_All' +dqmElectronAnalysisAllElectronsHGC.MaxAbsEtaMatchingObject = 3.0 +dqmElectronAnalysisAllElectronsHGC.EtaMax = 3.0 +dqmElectronAnalysisAllElectronsHGC.EtaMin = -3.0 +dqmElectronAnalysisAllElectronsHGC.MaxAbsEta = 3.0 +dqmElectronAnalysisAllElectronsHGC.ElectronCollection = 'ecalDrivenGsfElectronsHGC' +dqmElectronAnalysisAllElectronsHGC.MatchingObjectCollection = 'mergedSuperClustersHGC' + +_electronAnalyzerSequenceHGC = electronAnalyzerSequence.copy() +_electronAnalyzerSequenceHGC += cms.Sequence(mergedSuperClustersHGC+dqmElectronAnalysisAllElectronsHGC) from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal phase2_hgcal.toModify( mergedSuperClusters, src = cms.VInputTag( cms.InputTag("particleFlowSuperClusterECAL","particleFlowSuperClusterECALBarrel"), cms.InputTag("particleFlowSuperClusterHGCal","") ) ) phase2_hgcal.toReplaceWith( -electronAnalyzerSequence, _electronAnalyzerSequenceFromMultiCl +electronAnalyzerSequence, _electronAnalyzerSequenceHGC ) diff --git a/DQMOffline/EGamma/python/electronOfflineClientSequence_cff.py b/DQMOffline/EGamma/python/electronOfflineClientSequence_cff.py index 013b0c6c32d00..9ae0541bfd17f 100644 --- a/DQMOffline/EGamma/python/electronOfflineClientSequence_cff.py +++ b/DQMOffline/EGamma/python/electronOfflineClientSequence_cff.py @@ -6,9 +6,9 @@ dqmElectronClientAllElectrons.InputFolderName = cms.string("Egamma/Electrons/Ele2_All") ; dqmElectronClientAllElectrons.OutputFolderName = cms.string("Egamma/Electrons/Ele2_All") ; -dqmElectronClientAllElectronsFromMultiCl = dqmElectronOfflineClient.clone() ; -dqmElectronClientAllElectronsFromMultiCl.InputFolderName = cms.string("Egamma/Electrons/Ele2FromMultiCl_All") ; -dqmElectronClientAllElectronsFromMultiCl.OutputFolderName = cms.string("Egamma/Electrons/Ele2FromMultiCl_All") ; +dqmElectronClientAllElectronsHGC = dqmElectronOfflineClient.clone() ; +dqmElectronClientAllElectronsHGC.InputFolderName = cms.string("Egamma/Electrons/Ele2HGC_All") ; +dqmElectronClientAllElectronsHGC.OutputFolderName = cms.string("Egamma/Electrons/Ele2HGC_All") ; dqmElectronClientSelectionEt = dqmElectronOfflineClient.clone() ; dqmElectronClientSelectionEt.InputFolderName = cms.string("Egamma/Electrons/Ele3_Et10") ; @@ -34,11 +34,11 @@ # * dqmElectronClientSelectionEtIsoElID * dqmElectronClientTagAndProbe ) -_electronOfflineClientSequenceFromMultiCl = electronOfflineClientSequence.copy() -_electronOfflineClientSequenceFromMultiCl += dqmElectronClientAllElectronsFromMultiCl +_electronOfflineClientSequenceHGC = electronOfflineClientSequence.copy() +_electronOfflineClientSequenceHGC += dqmElectronClientAllElectronsHGC from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal phase2_hgcal.toReplaceWith( - electronOfflineClientSequence, _electronOfflineClientSequenceFromMultiCl + electronOfflineClientSequence, _electronOfflineClientSequenceHGC ) diff --git a/DQMOffline/EGamma/python/photonOfflineDQMClient_cff.py b/DQMOffline/EGamma/python/photonOfflineDQMClient_cff.py index 243396b60ef92..0ae282d51ec9d 100644 --- a/DQMOffline/EGamma/python/photonOfflineDQMClient_cff.py +++ b/DQMOffline/EGamma/python/photonOfflineDQMClient_cff.py @@ -10,7 +10,7 @@ from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal stdPhotonOfflineClientHGCal = stdPhotonOfflineClient.clone() -stdPhotonOfflineClientHGCal.analyzerName = 'stdPhotonAnalyzerHGCalFromMultiCl' +stdPhotonOfflineClientHGCal.analyzerName = 'stdPhotonAnalyzerHGCal' from DQMOffline.EGamma.egammaDQMOffline_cff import stdPhotonAnalysisHGCal stdPhotonOfflineClientHGCal.etaBin = stdPhotonAnalysisHGCal.etaBin stdPhotonOfflineClientHGCal.etaMin = stdPhotonAnalysisHGCal.etaMin diff --git a/DQMOffline/Ecal/plugins/EcalZmassClient.cc b/DQMOffline/Ecal/plugins/EcalZmassClient.cc index 4e2a99d666514..c2c9cb4141666 100644 --- a/DQMOffline/Ecal/plugins/EcalZmassClient.cc +++ b/DQMOffline/Ecal/plugins/EcalZmassClient.cc @@ -21,7 +21,6 @@ #include // user include files -#include "DQM/Physics/src/EwkDQM.h" #include "DQMServices/Core/interface/DQMEDHarvester.h" #include "DQMServices/Core/interface/DQMStore.h" #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/DQMOffline/Ecal/plugins/EcalZmassTask.cc b/DQMOffline/Ecal/plugins/EcalZmassTask.cc index 67e146602d729..7f39c55b30d50 100644 --- a/DQMOffline/Ecal/plugins/EcalZmassTask.cc +++ b/DQMOffline/Ecal/plugins/EcalZmassTask.cc @@ -21,7 +21,6 @@ Description: [one line class summary] // user include files -#include "DQM/Physics/src/EwkDQM.h" #include "DataFormats/Candidate/interface/Candidate.h" #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" diff --git a/DQMServices/Components/bin/fastHadd.cc b/DQMServices/Components/bin/fastHadd.cc index ac22742c82a3b..c7327c0a8e4af 100644 --- a/DQMServices/Components/bin/fastHadd.cc +++ b/DQMServices/Components/bin/fastHadd.cc @@ -88,7 +88,7 @@ PATH=/afs/cern.ch/work/r/rovere/protocolbuf/bin #include #include #include -#include "DQMServices/Core/src/ROOTFilePB.pb.h" +#include "DQMServices/Core/interface/ROOTFilePB.pb.h" #include #include #include diff --git a/DQMServices/Core/interface/MonitorElement.h b/DQMServices/Core/interface/MonitorElement.h index f39f88d97fab0..4b0cd2e890650 100644 --- a/DQMServices/Core/interface/MonitorElement.h +++ b/DQMServices/Core/interface/MonitorElement.h @@ -119,7 +119,7 @@ namespace dqm::impl { return std::make_tuple(std::reference_wrapper(me->getPathname()), std::reference_wrapper(me->getName())); } auto make_tuple(MonitorElementData::Path const &path) const { - return std::make_tuple(path.getDirname(), path.getObjectname()); + return std::make_tuple(std::reference_wrapper(path.getDirname()), std::reference_wrapper(path.getObjectname())); } bool operator()(MonitorElement *left, MonitorElement *right) const { return make_tuple(left) < make_tuple(right); diff --git a/DQMServices/Core/src/ROOTFilePB.pb.h b/DQMServices/Core/interface/ROOTFilePB.pb.h similarity index 100% rename from DQMServices/Core/src/ROOTFilePB.pb.h rename to DQMServices/Core/interface/ROOTFilePB.pb.h diff --git a/DQMServices/Core/src/ROOTFilePB.pb.cc b/DQMServices/Core/src/ROOTFilePB.pb.cc index 88f9bb236431c..0c3b9bf11b5cb 100644 --- a/DQMServices/Core/src/ROOTFilePB.pb.cc +++ b/DQMServices/Core/src/ROOTFilePB.pb.cc @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: DQMServices/Core/src/ROOTFilePB.proto -#include "DQMServices/Core/src/ROOTFilePB.pb.h" +#include "DQMServices/Core/interface/ROOTFilePB.pb.h" #include diff --git a/DQMServices/FileIO/plugins/DQMFileSaverPB.cc b/DQMServices/FileIO/plugins/DQMFileSaverPB.cc index ed6a4e10d824b..eb826c8dbd503 100644 --- a/DQMServices/FileIO/plugins/DQMFileSaverPB.cc +++ b/DQMServices/FileIO/plugins/DQMFileSaverPB.cc @@ -21,7 +21,7 @@ #include "zlib.h" #include "DQMServices/Core/interface/DQMStore.h" -#include "DQMServices/Core/src/ROOTFilePB.pb.h" +#include "DQMServices/Core/interface/ROOTFilePB.pb.h" #include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" diff --git a/DQMServices/StreamerIO/plugins/DQMProtobufReader.cc b/DQMServices/StreamerIO/plugins/DQMProtobufReader.cc index a1f007305899f..27629dae49d04 100644 --- a/DQMServices/StreamerIO/plugins/DQMProtobufReader.cc +++ b/DQMServices/StreamerIO/plugins/DQMProtobufReader.cc @@ -7,7 +7,7 @@ #include "FWCore/Utilities/interface/UnixSignalHandlers.h" // #include "FWCore/Sources/interface/ProducerSourceBase.h" -#include "DQMServices/Core/src/ROOTFilePB.pb.h" +#include "DQMServices/Core/interface/ROOTFilePB.pb.h" #include #include #include diff --git a/DataFormats/ForwardDetId/interface/HGCalTriggerBackendCommon.h b/DataFormats/ForwardDetId/interface/HGCalTriggerBackendCommon.h new file mode 100644 index 0000000000000..6189240bd397d --- /dev/null +++ b/DataFormats/ForwardDetId/interface/HGCalTriggerBackendCommon.h @@ -0,0 +1,6 @@ +#ifndef DataFormats_ForwardDetId_HGCalTriggerBackendCommon_H +#define DataFormats_ForwardDetId_HGCalTriggerBackendCommon_H 1 + +enum HGCalTriggerClassIdentifier { ModuleDetId, BackendDetId }; + +#endif diff --git a/DataFormats/ForwardDetId/interface/HGCalTriggerBackendDetId.h b/DataFormats/ForwardDetId/interface/HGCalTriggerBackendDetId.h new file mode 100644 index 0000000000000..042db42e46940 --- /dev/null +++ b/DataFormats/ForwardDetId/interface/HGCalTriggerBackendDetId.h @@ -0,0 +1,76 @@ +#ifndef DataFormats_ForwardDetId_HGCalTriggerBackendDetId_H +#define DataFormats_ForwardDetId_HGCalTriggerBackendDetId_H 1 + +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/ForwardDetId/interface/HGCalTriggerBackendCommon.h" +#include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" + +/* \brief description of the bit assigment + [0:10] ID of the lpGBT or Stage 1 FPGA in sector 0 + [11:12] sector (0,1,2 counter-clockwise from u-axis) + [13:15] Type (0 lpGBT + 1 Stage 1 FPGA + 2 Stage 1 link + 3 Stage 2 FPGA) + [16:16] z-side (0 for +z; 1 for -z) + [19:23] reserved for future use + [24:24] Class identifier (0 for HGCalTriggerModuleDetID, 1 for HGCalTriggerBackendDetID) + [25:27] Subdetector Type (HGCTrigger) + [28:31] Detector type (Forward) +*/ + +class HGCalTriggerBackendDetId : public DetId { +public: + /** Create a null backend id*/ + HGCalTriggerBackendDetId(); + /** Create backend id from raw id (0=invalid id) */ + HGCalTriggerBackendDetId(uint32_t rawid); + /** Constructor from zplus, type, sector, label */ + HGCalTriggerBackendDetId(int zp, int type, int sector, int label); + /** Constructor from a generic det id */ + HGCalTriggerBackendDetId(const DetId& id); + /** Assignment from a generic det id */ + HGCalTriggerBackendDetId& operator=(const DetId& id); + + /// get the class + int classId() const { return (id_ >> kHGCalTriggerClassIdentifierOffset) & kHGCalTriggerClassIdentifierMask; } + + /// get the type + int type() const { return (id_ >> kHGCalTypeOffset) & kHGCalTypeMask; } + + /// get the z-side of the backend object (1/-1) + int zside() const { return ((id_ >> kHGCalZsideOffset) & kHGCalZsideMask ? -1 : 1); } + + /// get the sector # + int sector() const { return (id_ >> kHGCalSectorOffset) & kHGCalSectorMask; } + + /// get the value + int label() const { return (id_ >> kHGCalLabelOffset) & kHGCalLabelMask; } + + bool isLpGBT() const { return (type() == BackendType::LpGBT); } + bool isStage1FPGA() const { return (type() == BackendType::Stage1FPGA); } + bool isStage1Link() const { return (type() == BackendType::Stage1Link); } + bool isStage2FPGA() const { return (type() == BackendType::Stage2FPGA); } + bool isForward() const { return true; } + bool isHGCalModuleDetId() const { return (classId() == HGCalTriggerClassIdentifier::ModuleDetId); } + bool isHGCalBackendDetId() const { return (classId() == HGCalTriggerClassIdentifier::BackendDetId); } + + static const HGCalTriggerBackendDetId Undefined; + + static const int kHGCalLabelOffset = 0; + static const int kHGCalLabelMask = 0x7FF; + static const int kHGCalSectorOffset = 11; + static const int kHGCalSectorMask = 0x3; + static const int kHGCalTypeOffset = 13; + static const int kHGCalTypeMask = 0x7; + static const int kHGCalZsideOffset = 16; + static const int kHGCalZsideMask = 0x1; + static const int kHGCalTriggerClassIdentifierOffset = 24; + static const int kHGCalTriggerClassIdentifierMask = 0x1; + + enum BackendType { LpGBT, Stage1FPGA, Stage1Link, Stage2FPGA }; +}; + +std::ostream& operator<<(std::ostream&, const HGCalTriggerBackendDetId& id); + +#endif diff --git a/DataFormats/ForwardDetId/interface/HGCalTriggerModuleDetId.h b/DataFormats/ForwardDetId/interface/HGCalTriggerModuleDetId.h new file mode 100644 index 0000000000000..e4b48d6040e41 --- /dev/null +++ b/DataFormats/ForwardDetId/interface/HGCalTriggerModuleDetId.h @@ -0,0 +1,107 @@ +#ifndef DataFormats_ForwardDetId_HGCalTriggerModuleDetId_H +#define DataFormats_ForwardDetId_HGCalTriggerModuleDetId_H 1 + +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/ForwardDetId/interface/HGCalTriggerBackendCommon.h" +#include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" + +/* \brief description of the bit assigment + [0:3] u-coordinate of the silicon module (u-axis points along -x axis) + or eta-coordinate of the scintillator module + [4:7] v-coordinate of the silicon module (v-axis points 60-degree wrt x-axis) + or phi-coordinate of the scintillator module + [8:9] sector (0,1,2 counter-clockwise from u-axis) + + [10:13] reserved for future use + + [14:18] layer number + [19:20] Type (0 fine divisions of wafer with 120 mum thick silicon + 1 coarse divisions of wafer with 200 mum thick silicon + 2 coarse divisions of wafer with 300 mum thick silicon + 0 fine divisions of scintillators + 1 coarse divisions of scintillators) + + [21:21] z-side (0 for +z; 1 for -z) + [22:23] Trigger Subdetector Type(HGCEE/HGCHEF/HGCHEB/HFNose) + [24:24] Class identifier (0 for HGCalTriggerModuleDetID, 1 for HGCalTriggerBackendDetID) + [25:27] Subdetector Type (HGCTrigger) + [28:31] Detector type (Forward) +*/ + +class HGCalTriggerModuleDetId : public DetId { +public: + /** Create a null module id*/ + HGCalTriggerModuleDetId(); + /** Create module id from raw id (0=invalid id) */ + HGCalTriggerModuleDetId(uint32_t rawid); + /** Constructor from subdetector, zplus, type, layer, sector, module numbers */ + HGCalTriggerModuleDetId( + HGCalTriggerSubdetector subdet, int zp, int type, int layer, int sector, int moduleU, int moduleV); + /** Constructor from a generic det id */ + HGCalTriggerModuleDetId(const DetId& id); + /** Assignment from a generic det id */ + HGCalTriggerModuleDetId& operator=(const DetId& id); + + /// get the trigger sub-detector + int triggerSubdetId() const { return (id_ >> kHGCalTriggerSubdetOffset) & kHGCalTriggerSubdetMask; } + + /// get the class + int classId() const { return (id_ >> kHGCalTriggerClassIdentifierOffset) & kHGCalTriggerClassIdentifierMask; } + + /// get the type + int type() const { return (id_ >> kHGCalTypeOffset) & kHGCalTypeMask; } + + /// get the z-side of the module (1/-1) + int zside() const { return ((id_ >> kHGCalZsideOffset) & kHGCalZsideMask ? -1 : 1); } + + /// get the layer # + int layer() const { return (id_ >> kHGCalLayerOffset) & kHGCalLayerMask; } + + /// get the sector # + int sector() const { return (id_ >> kHGCalSectorOffset) & kHGCalSectorMask; } + + /// get the module U + int moduleU() const { return (id_ >> kHGCalModuleUOffset) & kHGCalModuleUMask; } + + /// get the module V + int moduleV() const { return (id_ >> kHGCalModuleVOffset) & kHGCalModuleVMask; } + + /// get the scintillator panel eta + int eta() const { return moduleU(); } + + /// get the scintillator panel phi + int phi() const { return moduleV(); } + + /// consistency check : no bits left => no overhead + bool isHFNose() const { return (triggerSubdetId() == HFNoseTrigger); } + bool isEE() const { return (triggerSubdetId() == HGCalEETrigger); } + bool isHSilicon() const { return (triggerSubdetId() == HGCalHSiTrigger); } + bool isHScintillator() const { return (triggerSubdetId() == HGCalHScTrigger); } + bool isForward() const { return true; } + bool isHGCTrigger() const { return true; } + bool isHGCalModuleDetId() const { return (classId() == HGCalTriggerClassIdentifier::ModuleDetId); } + bool isHGCalBackendDetId() const { return (classId() == HGCalTriggerClassIdentifier::BackendDetId); } + + static const HGCalTriggerModuleDetId Undefined; + + static const int kHGCalModuleUOffset = 0; + static const int kHGCalModuleUMask = 0xF; + static const int kHGCalModuleVOffset = 4; + static const int kHGCalModuleVMask = 0xF; + static const int kHGCalSectorOffset = 8; + static const int kHGCalSectorMask = 0x3; + static const int kHGCalLayerOffset = 14; + static const int kHGCalLayerMask = 0x1F; + static const int kHGCalTypeOffset = 19; + static const int kHGCalTypeMask = 0x3; + static const int kHGCalZsideOffset = 24; + static const int kHGCalZsideMask = 0x1; + static const int kHGCalTriggerSubdetOffset = 22; + static const int kHGCalTriggerSubdetMask = 0x3; + static const int kHGCalTriggerClassIdentifierOffset = 24; + static const int kHGCalTriggerClassIdentifierMask = 0x1; +}; + +std::ostream& operator<<(std::ostream&, const HGCalTriggerModuleDetId& id); + +#endif diff --git a/DataFormats/ForwardDetId/src/HGCalTriggerBackendDetId.cc b/DataFormats/ForwardDetId/src/HGCalTriggerBackendDetId.cc new file mode 100644 index 0000000000000..a52141795d281 --- /dev/null +++ b/DataFormats/ForwardDetId/src/HGCalTriggerBackendDetId.cc @@ -0,0 +1,43 @@ +#include "DataFormats/ForwardDetId/interface/HGCalTriggerBackendDetId.h" +#include "FWCore/Utilities/interface/Exception.h" +#include + +HGCalTriggerBackendDetId::HGCalTriggerBackendDetId() : DetId() {} + +HGCalTriggerBackendDetId::HGCalTriggerBackendDetId(uint32_t rawid) : DetId(rawid) {} + +HGCalTriggerBackendDetId::HGCalTriggerBackendDetId(int zp, int type, int sector, int label) + : DetId(Forward, HGCTrigger) { + int classid = HGCalTriggerClassIdentifier::ModuleDetId; + int zside = (zp < 0) ? 1 : 0; + id_ |= (((label & kHGCalLabelMask) << kHGCalLabelOffset) | ((sector & kHGCalSectorMask) << kHGCalSectorOffset) | + ((zside & kHGCalZsideMask) << kHGCalZsideOffset) | ((type & kHGCalTypeMask) << kHGCalTypeOffset) | + ((classid & kHGCalTriggerClassIdentifierMask) << kHGCalTriggerClassIdentifierOffset)); +} + +HGCalTriggerBackendDetId::HGCalTriggerBackendDetId(const DetId& gen) { + if (!gen.null()) { + if (gen.det() != Forward) { + throw cms::Exception("Invalid DetId") + << "Cannot initialize HGCalTriggerBackendDetId from " << std::hex << gen.rawId() << std::dec; + } + } + id_ = gen.rawId(); +} + +HGCalTriggerBackendDetId& HGCalTriggerBackendDetId::operator=(const DetId& gen) { + if (!gen.null()) { + if (gen.det() != Forward) { + throw cms::Exception("Invalid DetId") + << "Cannot assign HGCalTriggerBackendDetId from " << std::hex << gen.rawId() << std::dec; + } + } + id_ = gen.rawId(); + return (*this); +} + +std::ostream& operator<<(std::ostream& s, const HGCalTriggerBackendDetId& id) { + return s << "HGCalTriggerBackendDetId::lpGBT:Stage1 FPGA:Stage2 FPGA= " << id.isLpGBT() << ":" << id.isStage1FPGA() + << ":" << id.isStage1Link() << ":" << id.isStage2FPGA() << " z= " << id.zside() << " sector= " << id.sector() + << " id= " << id.label(); +} diff --git a/DataFormats/ForwardDetId/src/HGCalTriggerModuleDetId.cc b/DataFormats/ForwardDetId/src/HGCalTriggerModuleDetId.cc new file mode 100644 index 0000000000000..92c74c469a65c --- /dev/null +++ b/DataFormats/ForwardDetId/src/HGCalTriggerModuleDetId.cc @@ -0,0 +1,49 @@ +#include "DataFormats/ForwardDetId/interface/HGCalTriggerModuleDetId.h" +#include "FWCore/Utilities/interface/Exception.h" +#include + +HGCalTriggerModuleDetId::HGCalTriggerModuleDetId() : DetId() {} + +HGCalTriggerModuleDetId::HGCalTriggerModuleDetId(uint32_t rawid) : DetId(rawid) {} + +HGCalTriggerModuleDetId::HGCalTriggerModuleDetId( + HGCalTriggerSubdetector subdet, int zp, int type, int layer, int sector, int moduleU, int moduleV) + : DetId(Forward, HGCTrigger) { + int classid = HGCalTriggerClassIdentifier::ModuleDetId; + int zside = (zp < 0) ? 1 : 0; + + id_ |= + (((moduleU & kHGCalModuleUMask) << kHGCalModuleUOffset) | ((moduleV & kHGCalModuleVMask) << kHGCalModuleVOffset) | + ((sector & kHGCalSectorMask) << kHGCalSectorOffset) | ((layer & kHGCalLayerMask) << kHGCalLayerOffset) | + ((zside & kHGCalZsideMask) << kHGCalZsideOffset) | ((type & kHGCalTypeMask) << kHGCalTypeOffset) | + ((subdet & kHGCalTriggerSubdetMask) << kHGCalTriggerSubdetOffset) | + ((classid & kHGCalTriggerClassIdentifierMask) << kHGCalTriggerClassIdentifierOffset)); +} + +HGCalTriggerModuleDetId::HGCalTriggerModuleDetId(const DetId& gen) { + if (!gen.null()) { + if (gen.det() != Forward) { + throw cms::Exception("Invalid DetId") + << "Cannot initialize HGCalTriggerModuleDetId from " << std::hex << gen.rawId() << std::dec; + } + } + id_ = gen.rawId(); +} + +HGCalTriggerModuleDetId& HGCalTriggerModuleDetId::operator=(const DetId& gen) { + if (!gen.null()) { + if (gen.det() != Forward) { + throw cms::Exception("Invalid DetId") + << "Cannot assign HGCalTriggerModuleDetId from " << std::hex << gen.rawId() << std::dec; + } + } + id_ = gen.rawId(); + return (*this); +} + +std::ostream& operator<<(std::ostream& s, const HGCalTriggerModuleDetId& id) { + return s << "HGCalTriggerModuleDetId::HFNose:EE:HSil:HScin= " << id.isHFNose() << ":" << id.isEE() << ":" + << id.isHSilicon() << ":" << id.isHScintillator() << " type= " << id.type() << " z= " << id.zside() + << " layer= " << id.layer() << " sector= " << id.sector() << " module(u,v)= (" << id.moduleU() << "," + << id.moduleV() << ")"; +} diff --git a/DataFormats/GEMDigi/interface/AMC13Event.h b/DataFormats/GEMDigi/interface/AMC13Event.h deleted file mode 100644 index f659ff208f2fa..0000000000000 --- a/DataFormats/GEMDigi/interface/AMC13Event.h +++ /dev/null @@ -1,126 +0,0 @@ -#ifndef DataFormats_GEMDigi_AMC13Event_h -#define DataFormats_GEMDigi_AMC13Event_h -#include -#include "AMCdata.h" - -namespace gem { - - union CDFHeader { - uint64_t word; - struct { - uint64_t fov : 8; // not used - uint64_t sourceId : 12; // FED number assigned by CDAQ - uint64_t bxId : 12; // BX number, Reset by BC0 - uint64_t lv1Id : 24; // L1A / event number, Reset by EC0 - uint64_t eventType : 4; // Event Type (1 for normal, 2 for calibration) - uint64_t cb5 : 4; // 0x5 - }; - }; - union AMC13Header { - uint64_t word; - struct { - uint64_t cb0 : 4; // 0x0 - uint64_t orbitN : 32; // Orbit Number - uint64_t reserved0 : 16; // reserved - uint64_t nAMC : 4; // Number of AMCs following (0 to 12) - uint64_t calType : 4; // Calibration event type - uint64_t uFov : 4; // Format version: 0x1 - }; - }; - union AMC13Trailer { - uint64_t word; - struct { - uint64_t bxIdT : 12; // bx id - uint64_t lv1IdT : 8; // level 1 id - uint64_t blkN : 8; // block number - uint64_t : 4; - uint64_t crc32 : 32; // Overall CRC - }; - }; - union CDFTrailer { - uint64_t word; - struct { - uint64_t res1 : 2; - uint64_t crcModified : 1; - uint64_t moreTrailers : 1; - uint64_t tts : 4; // tts - uint64_t evtStat : 4; // event status - uint64_t res2 : 2; - uint64_t slinkError : 1; - uint64_t wrongFedId : 1; - uint64_t crcCDF : 16; // CDF crc - uint64_t evtLength : 24; // event length - uint64_t eventType : 4; // Event Type - uint64_t cbA : 4; // 0xA - }; - }; - union AMCHeader { - uint64_t word; - struct { - uint64_t boardId : 16; // board id - uint64_t amcNo : 4; // amc number - uint64_t blkNo : 8; // block number - uint64_t unused : 4; // unused - uint64_t amcSize : 24; // amc size - uint64_t errStrip : 8; // errStrip - }; - }; - - class AMC13Event { - public: - AMC13Event() : cdfh_(0), amc13h_(0), amc13t_(0), cdft_(0) {} - ~AMC13Event() { - amcHeaders_.clear(); - amcs_.clear(); - } - - void setCDFHeader(uint64_t word) { cdfh_ = word; } - void setCDFHeader(uint8_t Evt_ty, uint32_t LV1_id, uint16_t BX_id, uint16_t Source_id); - uint64_t getCDFHeader() const { return cdfh_; } - - void setAMC13Header(uint64_t word) { amc13h_ = word; } - void setAMC13Header(uint8_t CalTyp, uint8_t nAMC, uint32_t OrN); - uint64_t getAMC13Header() const { return amc13h_; } - - void setAMC13Trailer(uint64_t word) { amc13t_ = word; } - void setAMC13Trailer(uint8_t Blk_NoT, uint8_t LV1_idT, uint16_t BX_idT); - uint64_t getAMC13Trailer() const { return amc13t_; } - - void setCDFTrailer(uint64_t word) { cdft_ = word; } - void setCDFTrailer(uint32_t EvtLength); - uint64_t getCDFTrailer() const { return cdft_; } - uint32_t fragmentLength() const { return CDFTrailer{cdft_}.evtLength; } - uint8_t evtStatus() const { return CDFTrailer{cdft_}.evtStat; } - uint8_t ttsBits() const { return CDFTrailer{cdft_}.tts; } - - uint16_t bunchCrossing() const { return CDFHeader{cdfh_}.bxId; } - uint32_t lv1Id() const { return CDFHeader{cdfh_}.lv1Id; } - uint16_t sourceId() const { return CDFHeader{cdfh_}.sourceId; } - - uint16_t orbitNumber() const { return AMC13Header{amc13h_}.orbitN; } - uint8_t nAMC() const { return AMC13Header{amc13h_}.nAMC; } - - const std::vector* getAMCheaders() const { return &amcHeaders_; } - uint32_t getAMCsize(int i) const { return AMCHeader{amcHeaders_.at(i)}.amcSize; } - void addAMCheader(uint64_t word); - void addAMCheader(uint32_t AMC_size, uint8_t Blk_No, uint8_t AMC_No, uint16_t BoardID); - - uint32_t crc() const { return AMC13Trailer{amc13t_}.crc32; } - - const std::vector* getAMCpayloads() const { return &amcs_; } - void addAMCpayload(const AMCdata& a) { amcs_.push_back(a); } - void clearAMCpayloads() { amcs_.clear(); } - - private: - uint64_t cdfh_; // CDFHeader - uint64_t amc13h_; // AMC13Header - uint64_t amc13t_; // AMC13Trailer - uint64_t cdft_; // CDFTrailer - - // AMC headers - std::vector amcHeaders_; - // AMCs payload - std::vector amcs_; - }; -} // namespace gem -#endif diff --git a/DataFormats/GEMDigi/interface/AMCdata.h b/DataFormats/GEMDigi/interface/AMCdata.h deleted file mode 100644 index eaae41fdcbc79..0000000000000 --- a/DataFormats/GEMDigi/interface/AMCdata.h +++ /dev/null @@ -1,138 +0,0 @@ -#ifndef DataFormats_GEMDigi_AMCdata_h -#define DataFormats_GEMDigi_AMCdata_h -#include "GEBdata.h" -#include - -namespace gem { - - union AMCheader1 { - uint64_t word; - struct { - uint64_t dataLength : 20; // Always 0xfffff, use trailer dataLengthT - uint64_t bxID : 12; // Bunch crossing ID - uint64_t l1AID : 24; // L1A number – basically this is like event number, but reset by resync - uint64_t AMCnum : 4; // Slot number of the AMC - uint64_t reserved : 4; // not used - }; - }; - union AMCheader2 { - uint64_t word; - struct { - uint64_t boardID : 16; // 8bit long GLIB serial number - uint64_t orbitNum : 16; // Orbit number, Reset by EC0 - uint64_t param3 : 8; // RunPar - Controlled by software, normally used only for calibrations - uint64_t param2 : 8; // RunPar - Controlled by software, normally used only for calibrations - uint64_t param1 : 8; // RunPar - Controlled by software, normally used only for calibrations - uint64_t runType : 4; // run types like physics, cosmics, threshold scan, latency scan, etc.. - uint64_t formatVer : 4; // Current format version = 0x0 - }; - }; - union AMCTrailer { - uint64_t word; - struct { - uint64_t dataLength : 20; // Number of 64bit words in this event - uint64_t : 4; - uint64_t l1AID : 8; // L1A number (first 8 bits) - uint64_t crc : 32; // CRC added by the AMC13 - }; - }; - union EventHeader { - uint64_t word; - struct { - uint64_t ttsState : 4; // GLIB TTS state at the moment when this event was built. - uint64_t pType : 4; // Payload type: can be one refering to different zero suppression schemes - // in normal data taking or calibration type. - // Note in calibration type the entire GCT (GEM Chamber Trailer) is skipped - uint64_t pVer : 3; // Version of the payload type - uint64_t davCnt : 5; // Number of chamber blocks in this event - uint64_t buffState : 24; // Buffer status, Always 0 in current fw - uint64_t davList : 24; // Data Available list: a bitmask indicating which chambers have data in this event - }; - }; - union EventTrailer { - uint64_t word; - struct { - uint64_t BCL : 4; // 1st bit, BC0 locked - If 0, this is a bad condition indicating a - // problem in the clock or TTC command stream (critical condition) - uint64_t DR : 1; // DAQ Ready - If 0, this means that AMC13 is not ready to take data (critical condition) - uint64_t CL : 1; // DAQ clock locked- If 0, this indicates a problem in the DAQ clock (critical condition) - uint64_t ML : 1; // MMCM locked - Should always be 1 - uint64_t BP : 1; // Backpressure - If this is 1, it means that we are receiving backpressure from AMC13 - uint64_t oosGlib : 32; // GLIB is outâ€ofâ€sync (critical): L1A ID is different for - // different chambers in this event (1 bit) - uint64_t linkTo : 24; // Link timeout flags (one bit for each link indicating timeout condition) - }; - }; - - class AMCdata { - public: - AMCdata() : amch1_(0), amch2_(0), amct_(0), eh_(0), et_(0){}; - ~AMCdata() { gebd_.clear(); } - - int status(); - - void setAMCheader1(uint64_t word) { amch1_ = word; } - void setAMCheader1(uint32_t dataLength, uint16_t bxID, uint32_t l1AID, uint8_t AMCnum); - uint64_t getAMCheader1() const { return amch1_; } - - void setAMCheader2(uint64_t word) { amch2_ = word; } - void setAMCheader2(uint16_t boardID, uint16_t orbitNum, uint8_t runType); - uint64_t getAMCheader2() const { return amch2_; } - - void setAMCTrailer(uint64_t word) { amct_ = word; } - uint64_t getAMCTrailer() const { return amct_; } - - void setGEMeventHeader(uint64_t word) { eh_ = word; } - void setGEMeventHeader(uint8_t davCnt, uint32_t davList); - uint64_t getGEMeventHeader() const { return eh_; } - - void setGEMeventTrailer(uint64_t word) { et_ = word; } - uint64_t getGEMeventTrailer() const { return et_; } - - uint32_t dataLength() const { return AMCTrailer{amct_}.dataLength; } - uint16_t bunchCrossing() const { return AMCheader1{amch1_}.bxID; } - uint32_t lv1Id() const { return AMCheader1{amch1_}.l1AID; } - uint8_t amcNum() const { return AMCheader1{amch1_}.AMCnum; } - - uint16_t boardId() const { return AMCheader2{amch2_}.boardID; } - uint16_t orbitNumber() const { return AMCheader2{amch2_}.orbitNum; } - uint8_t param3() const { return AMCheader2{amch2_}.param3; } - uint8_t param2() const { return AMCheader2{amch2_}.param2; } - uint8_t param1() const { return AMCheader2{amch2_}.param1; } - uint8_t runType() const { return AMCheader2{amch2_}.runType; } - uint8_t formatVer() const { return AMCheader2{amch2_}.formatVer; } - - uint8_t lv1Idt() const { return AMCTrailer{amct_}.l1AID; } - uint32_t crc() const { return AMCTrailer{amct_}.crc; } - - uint16_t ttsState() const { return EventHeader{eh_}.ttsState; } - uint8_t davCnt() const { return EventHeader{eh_}.davCnt; } - uint32_t buffState() const { return EventHeader{eh_}.buffState; } - uint32_t davList() const { return EventHeader{eh_}.davList; } - - uint8_t bc0locked() const { return EventTrailer{et_}.BCL; } - uint8_t daqReady() const { return EventTrailer{et_}.DR; } - uint8_t daqClockLocked() const { return EventTrailer{et_}.CL; } - uint8_t mmcmLocked() const { return EventTrailer{et_}.ML; } - uint8_t backPressure() const { return EventTrailer{et_}.BP; } - uint8_t oosGlib() const { return EventTrailer{et_}.oosGlib; } - uint32_t linkTo() const { return EventTrailer{et_}.linkTo; } - - //!Adds GEB data to vector - void addGEB(GEBdata g) { gebd_.push_back(g); } - //!Returns a vector of GEB data - const std::vector* gebs() const { return &gebd_; } - //!Clear a vector of GEB data - void clearGEBs() { gebd_.clear(); } - - private: - uint64_t amch1_; - uint64_t amch2_; - uint64_t amct_; - uint64_t eh_; - uint64_t et_; - - std::vector gebd_; /// - -namespace gem { - - union GEBchamberHeader { - uint64_t word; - struct { - uint64_t : 10; // unused - uint64_t BxmVvV : 1; // 1st bit BX mismatch VFAT vs VFAT - uint64_t BxmAvV : 1; // BX mismatch AMC vs VFAT - uint64_t OOScVvV : 1; // Out of Sync (EC mismatch) VFAT vs VFAT - uint64_t OOScAvV : 1; // Out of Sync (EC mismatch) AMC vs VFAT - uint64_t Inv : 1; // Invalid event - uint64_t EvtSzW : 1; // Event size warning - uint64_t L1aNF : 1; // L1A FIFO near full - uint64_t InNF : 1; // Input FIFO near full - uint64_t EvtNF : 1; // Event FIFO near full - uint64_t EvtSzOFW : 1; // Event size overflow - uint64_t L1aF : 1; // L1A FIFO full - uint64_t InF : 1; // Input FIFO full - uint64_t EvtF : 1; // Event FIFO full - uint64_t VfWdCnt : 12; // VFAT word count (in number of 64-bit words) - uint64_t InputID : 5; // Input link ID - uint64_t CALIB_CHAN : 7; // Calibration channel number - uint64_t : 17; // unused - }; - }; - - union GEBchamberTrailer { - uint64_t word; - struct { - uint64_t ecOH : 20; // NOT USED - OptoHybrid event counter - uint64_t bcOH : 13; // NOT USED - OptoHybrid bunch crossing - uint64_t InUfw : 1; // Input FIFO underflow - uint64_t SkD : 1; // NOT USED - Stuck data - uint64_t EvUfw : 1; // NOT USED - Event FIFO underflow - uint64_t VfWdCntT : 12; // VFAT word count (in number of 64-bit words) - uint64_t crc16 : 16; // CRC of OptoHybrid data (currently not available – filled with 0) - }; - }; - - class GEBdata { - public: - GEBdata() : ch_(0), ct_(0){}; - ~GEBdata() { vfatd_.clear(); } - - //!Read chamberHeader from the block. - void setChamberHeader(uint64_t word) { ch_ = word; } - void setChamberHeader(uint16_t vfatWordCnt, uint8_t inputID) { - GEBchamberHeader u{0}; - u.VfWdCnt = vfatWordCnt; - u.InputID = inputID; - ch_ = u.word; - } - uint64_t getChamberHeader() const { return ch_; } - - //!Read chamberTrailer from the block. - void setChamberTrailer(uint64_t word) { ct_ = word; } - void setChamberTrailer(uint32_t ecOH, uint16_t bcOH, uint16_t vfatWordCntT) { - GEBchamberTrailer u{0}; - u.ecOH = ecOH; - u.bcOH = bcOH; - u.VfWdCntT = vfatWordCntT; - ct_ = u.word; - } - uint64_t getChamberTrailer() const { return ct_; } - - uint16_t vfatWordCnt() const { return GEBchamberHeader{ch_}.VfWdCnt; } - uint8_t inputID() const { return GEBchamberHeader{ch_}.InputID; } - uint16_t vfatWordCntT() const { return GEBchamberTrailer{ct_}.VfWdCntT; } - - bool bxmVvV() const { return GEBchamberHeader{ch_}.BxmVvV; } - bool bxmAvV() const { return GEBchamberHeader{ch_}.BxmAvV; } - bool oOScVvV() const { return GEBchamberHeader{ch_}.OOScVvV; } - bool oOScAvV() const { return GEBchamberHeader{ch_}.OOScAvV; } - bool inv() const { return GEBchamberHeader{ch_}.Inv; } - bool evtSzW() const { return GEBchamberHeader{ch_}.EvtSzW; } - bool l1aNF() const { return GEBchamberHeader{ch_}.L1aNF; } - bool inNF() const { return GEBchamberHeader{ch_}.InNF; } - bool evtNF() const { return GEBchamberHeader{ch_}.EvtNF; } - bool evtSzOFW() const { return GEBchamberHeader{ch_}.EvtSzOFW; } - bool l1aF() const { return GEBchamberHeader{ch_}.L1aF; } - bool inF() const { return GEBchamberHeader{ch_}.InF; } - bool evtF() const { return GEBchamberHeader{ch_}.EvtF; } - bool inUfw() const { return GEBchamberTrailer{ct_}.InUfw; } - - bool noVFAT() const { return false; } // to be removed - bool stuckData() const { return false; } // to be removed - bool evUfw() const { return false; } // to be removed - - //!Adds VFAT data to the vector - void addVFAT(VFATdata v) { vfatd_.push_back(v); } - //!Returns the vector of VFAT data - const std::vector* vFATs() const { return &vfatd_; } - //!Clear the vector rof VFAT data - void clearVFATs() { vfatd_.clear(); } - - static const int sizeGebID = 5; - - private: - uint64_t ch_; // GEBchamberHeader - uint64_t ct_; // GEBchamberTrailer - - std::vector vfatd_; - }; -} // namespace gem -#endif diff --git a/DataFormats/GEMDigi/interface/GEMAMC.h b/DataFormats/GEMDigi/interface/GEMAMC.h new file mode 100644 index 0000000000000..129dec4be1af7 --- /dev/null +++ b/DataFormats/GEMDigi/interface/GEMAMC.h @@ -0,0 +1,135 @@ +#ifndef DataFormats_GEMDigi_GEMAMC_h +#define DataFormats_GEMDigi_GEMAMC_h +#include "GEMOptoHybrid.h" +#include + +class GEMAMC { +public: + union AMCheader1 { + uint64_t word; + struct { + uint64_t dataLength : 20; // Always 0xfffff, use trailer dataLengthT + uint64_t bxID : 12; // Bunch crossing ID + uint64_t l1AID : 24; // L1A number – basically this is like event number, but reset by resync + uint64_t AMCnum : 4; // Slot number of the AMC + uint64_t reserved : 4; // not used + }; + }; + union AMCheader2 { + uint64_t word; + struct { + uint64_t boardID : 16; // 8bit long GLIB serial number + uint64_t orbitNum : 16; // Orbit number, Reset by EC0 + uint64_t param3 : 8; // RunPar - Controlled by software, normally used only for calibrations + uint64_t param2 : 8; // RunPar - Controlled by software, normally used only for calibrations + uint64_t param1 : 8; // RunPar - Controlled by software, normally used only for calibrations + uint64_t runType : 4; // run types like physics, cosmics, threshold scan, latency scan, etc.. + uint64_t formatVer : 4; // Current format version = 0x0 + }; + }; + union AMCTrailer { + uint64_t word; + struct { + uint64_t dataLength : 20; // Number of 64bit words in this event + uint64_t : 4; + uint64_t l1AID : 8; // L1A number (first 8 bits) + uint64_t crc : 32; // CRC added by the AMC13 + }; + }; + union EventHeader { + uint64_t word; + struct { + uint64_t ttsState : 4; // GLIB TTS state at the moment when this event was built. + uint64_t pType : 4; // Payload type: can be one refering to different zero suppression schemes + // in normal data taking or calibration type. + // Note in calibration type the entire GCT (GEM Chamber Trailer) is skipped + uint64_t pVer : 3; // Version of the payload type + uint64_t davCnt : 5; // Number of chamber blocks in this event + uint64_t buffState : 24; // Buffer status, Always 0 in current fw + uint64_t davList : 24; // Data Available list: a bitmask indicating which chambers have data in this event + }; + }; + union EventTrailer { + uint64_t word; + struct { + uint64_t BCL : 4; // 1st bit, BC0 locked - If 0, this is a bad condition indicating a + // problem in the clock or TTC command stream (critical condition) + uint64_t DR : 1; // DAQ Ready - If 0, this means that AMC13 is not ready to take data (critical condition) + uint64_t CL : 1; // DAQ clock locked- If 0, this indicates a problem in the DAQ clock (critical condition) + uint64_t ML : 1; // MMCM locked - Should always be 1 + uint64_t BP : 1; // Backpressure - If this is 1, it means that we are receiving backpressure from AMC13 + uint64_t oosGlib : 32; // GLIB is outâ€ofâ€sync (critical): L1A ID is different for + // different chambers in this event (1 bit) + uint64_t linkTo : 24; // Link timeout flags (one bit for each link indicating timeout condition) + }; + }; + + GEMAMC() : amch1_(0), amch2_(0), amct_(0), eh_(0), et_(0){}; + ~GEMAMC() { gebd_.clear(); } + + int status(); + + void setAMCheader1(uint64_t word) { amch1_ = word; } + void setAMCheader1(uint32_t dataLength, uint16_t bxID, uint32_t l1AID, uint8_t AMCnum); + uint64_t getAMCheader1() const { return amch1_; } + + void setAMCheader2(uint64_t word) { amch2_ = word; } + void setAMCheader2(uint16_t boardID, uint16_t orbitNum, uint8_t runType); + uint64_t getAMCheader2() const { return amch2_; } + + void setAMCTrailer(uint64_t word) { amct_ = word; } + uint64_t getAMCTrailer() const { return amct_; } + + void setGEMeventHeader(uint64_t word) { eh_ = word; } + void setGEMeventHeader(uint8_t davCnt, uint32_t davList); + uint64_t getGEMeventHeader() const { return eh_; } + + void setGEMeventTrailer(uint64_t word) { et_ = word; } + uint64_t getGEMeventTrailer() const { return et_; } + + uint32_t dataLength() const { return AMCTrailer{amct_}.dataLength; } + uint16_t bunchCrossing() const { return AMCheader1{amch1_}.bxID; } + uint32_t lv1Id() const { return AMCheader1{amch1_}.l1AID; } + uint8_t amcNum() const { return AMCheader1{amch1_}.AMCnum; } + + uint16_t boardId() const { return AMCheader2{amch2_}.boardID; } + uint16_t orbitNumber() const { return AMCheader2{amch2_}.orbitNum; } + uint8_t param3() const { return AMCheader2{amch2_}.param3; } + uint8_t param2() const { return AMCheader2{amch2_}.param2; } + uint8_t param1() const { return AMCheader2{amch2_}.param1; } + uint8_t runType() const { return AMCheader2{amch2_}.runType; } + uint8_t formatVer() const { return AMCheader2{amch2_}.formatVer; } + + uint8_t lv1Idt() const { return AMCTrailer{amct_}.l1AID; } + uint32_t crc() const { return AMCTrailer{amct_}.crc; } + + uint16_t ttsState() const { return EventHeader{eh_}.ttsState; } + uint8_t davCnt() const { return EventHeader{eh_}.davCnt; } + uint32_t buffState() const { return EventHeader{eh_}.buffState; } + uint32_t davList() const { return EventHeader{eh_}.davList; } + + uint8_t bc0locked() const { return EventTrailer{et_}.BCL; } + uint8_t daqReady() const { return EventTrailer{et_}.DR; } + uint8_t daqClockLocked() const { return EventTrailer{et_}.CL; } + uint8_t mmcmLocked() const { return EventTrailer{et_}.ML; } + uint8_t backPressure() const { return EventTrailer{et_}.BP; } + uint8_t oosGlib() const { return EventTrailer{et_}.oosGlib; } + uint32_t linkTo() const { return EventTrailer{et_}.linkTo; } + + //!Adds GEB data to vector + void addGEB(GEMOptoHybrid g) { gebd_.push_back(g); } + //!Returns a vector of GEB data + const std::vector* gebs() const { return &gebd_; } + //!Clear a vector of GEB data + void clearGEBs() { gebd_.clear(); } + +private: + uint64_t amch1_; + uint64_t amch2_; + uint64_t amct_; + uint64_t eh_; + uint64_t et_; + + std::vector gebd_; /// +#include "GEMAMC.h" + +class GEMAMC13 { +public: + union CDFHeader { + uint64_t word; + struct { + uint64_t fov : 8; // not used + uint64_t sourceId : 12; // FED number assigned by CDAQ + uint64_t bxId : 12; // BX number, Reset by BC0 + uint64_t lv1Id : 24; // L1A / event number, Reset by EC0 + uint64_t eventType : 4; // Event Type (1 for normal, 2 for calibration) + uint64_t cb5 : 4; // 0x5 + }; + }; + union AMC13Header { + uint64_t word; + struct { + uint64_t cb0 : 4; // 0x0 + uint64_t orbitN : 32; // Orbit Number + uint64_t reserved0 : 16; // reserved + uint64_t nAMC : 4; // Number of AMCs following (0 to 12) + uint64_t calType : 4; // Calibration event type + uint64_t uFov : 4; // Format version: 0x1 + }; + }; + union AMC13Trailer { + uint64_t word; + struct { + uint64_t bxIdT : 12; // bx id + uint64_t lv1IdT : 8; // level 1 id + uint64_t blkN : 8; // block number + uint64_t : 4; + uint64_t crc32 : 32; // Overall CRC + }; + }; + union CDFTrailer { + uint64_t word; + struct { + uint64_t res1 : 2; + uint64_t crcModified : 1; + uint64_t moreTrailers : 1; + uint64_t tts : 4; // tts + uint64_t evtStat : 4; // event status + uint64_t res2 : 2; + uint64_t slinkError : 1; + uint64_t wrongFedId : 1; + uint64_t crcCDF : 16; // CDF crc + uint64_t evtLength : 24; // event length + uint64_t eventType : 4; // Event Type + uint64_t cbA : 4; // 0xA + }; + }; + union AMCHeader { + uint64_t word; + struct { + uint64_t boardId : 16; // board id + uint64_t amcNo : 4; // amc number + uint64_t blkNo : 8; // block number + uint64_t unused : 4; // unused + uint64_t amcSize : 24; // amc size + uint64_t errStrip : 8; // errStrip + }; + }; + + GEMAMC13() : cdfh_(0), amc13h_(0), amc13t_(0), cdft_(0) {} + ~GEMAMC13() { + amcHeaders_.clear(); + amcs_.clear(); + } + + void setCDFHeader(uint64_t word) { cdfh_ = word; } + void setCDFHeader(uint8_t Evt_ty, uint32_t LV1_id, uint16_t BX_id, uint16_t Source_id); + uint64_t getCDFHeader() const { return cdfh_; } + + void setAMC13Header(uint64_t word) { amc13h_ = word; } + void setAMC13Header(uint8_t CalTyp, uint8_t nAMC, uint32_t OrN); + uint64_t getAMC13Header() const { return amc13h_; } + + void setAMC13Trailer(uint64_t word) { amc13t_ = word; } + void setAMC13Trailer(uint8_t Blk_NoT, uint8_t LV1_idT, uint16_t BX_idT); + uint64_t getAMC13Trailer() const { return amc13t_; } + + void setCDFTrailer(uint64_t word) { cdft_ = word; } + void setCDFTrailer(uint32_t EvtLength); + uint64_t getCDFTrailer() const { return cdft_; } + uint32_t fragmentLength() const { return CDFTrailer{cdft_}.evtLength; } + uint8_t evtStatus() const { return CDFTrailer{cdft_}.evtStat; } + uint8_t ttsBits() const { return CDFTrailer{cdft_}.tts; } + + uint16_t bunchCrossing() const { return CDFHeader{cdfh_}.bxId; } + uint32_t lv1Id() const { return CDFHeader{cdfh_}.lv1Id; } + uint16_t sourceId() const { return CDFHeader{cdfh_}.sourceId; } + + uint16_t orbitNumber() const { return AMC13Header{amc13h_}.orbitN; } + uint8_t nAMC() const { return AMC13Header{amc13h_}.nAMC; } + + const std::vector* getAMCheaders() const { return &amcHeaders_; } + uint32_t getAMCsize(int i) const { return AMCHeader{amcHeaders_.at(i)}.amcSize; } + void addAMCheader(uint64_t word); + void addAMCheader(uint32_t AMC_size, uint8_t Blk_No, uint8_t AMC_No, uint16_t BoardID); + + uint32_t crc() const { return AMC13Trailer{amc13t_}.crc32; } + + const std::vector* getAMCpayloads() const { return &amcs_; } + void addAMCpayload(const GEMAMC& a) { amcs_.push_back(a); } + void clearAMCpayloads() { amcs_.clear(); } + +private: + uint64_t cdfh_; // CDFHeader + uint64_t amc13h_; // AMC13Header + uint64_t amc13t_; // AMC13Trailer + uint64_t cdft_; // CDFTrailer + + // AMC headers + std::vector amcHeaders_; + // AMCs payload + std::vector amcs_; +}; + +#endif diff --git a/DataFormats/GEMDigi/interface/GEMAMC13EventCollection.h b/DataFormats/GEMDigi/interface/GEMAMC13EventCollection.h deleted file mode 100644 index 2eb053e303f3b..0000000000000 --- a/DataFormats/GEMDigi/interface/GEMAMC13EventCollection.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef DataFormats_GEMDigi_GEMAMC13EventCollection_h -#define DataFormats_GEMDigi_GEMAMC13EventCollection_h - -#include "DataFormats/MuonData/interface/MuonDigiCollection.h" -#include "DataFormats/GEMDigi/interface/AMC13Event.h" - -typedef MuonDigiCollection GEMAMC13EventCollection; - -#endif diff --git a/DataFormats/GEMDigi/interface/GEMAMC13Status.h b/DataFormats/GEMDigi/interface/GEMAMC13Status.h index 6c848ed005fad..a1ad46fcc86c7 100644 --- a/DataFormats/GEMDigi/interface/GEMAMC13Status.h +++ b/DataFormats/GEMDigi/interface/GEMAMC13Status.h @@ -1,7 +1,7 @@ #ifndef DataFormats_GEMDigi_GEMAMC13Status_h #define DataFormats_GEMDigi_GEMAMC13Status_h -#include "AMC13Event.h" -#include "AMCdata.h" +#include "GEMAMC13.h" +#include "GEMAMC.h" #include "DataFormats/FEDRawData/interface/FEDRawData.h" #include "DataFormats/FEDRawData/interface/FEDTrailer.h" #include diff --git a/DataFormats/GEMDigi/interface/GEMAMCStatus.h b/DataFormats/GEMDigi/interface/GEMAMCStatus.h index d66d59c55dadc..abb9d6f66f026 100644 --- a/DataFormats/GEMDigi/interface/GEMAMCStatus.h +++ b/DataFormats/GEMDigi/interface/GEMAMCStatus.h @@ -1,7 +1,7 @@ #ifndef DataFormats_GEMDigi_GEMAMCStatus_h #define DataFormats_GEMDigi_GEMAMCStatus_h -#include "AMC13Event.h" -#include "AMCdata.h" +#include "GEMAMC13.h" +#include "GEMAMC.h" #include #include @@ -30,7 +30,7 @@ class GEMAMCStatus { }; GEMAMCStatus() {} - GEMAMCStatus(const gem::AMC13Event* amc13, const gem::AMCdata& amc) { + GEMAMCStatus(const GEMAMC13* amc13, const GEMAMC& amc) { amcNum_ = amc.amcNum(); Errors error{0}; error.badEC = (amc13->lv1Id() != amc.lv1Id()); diff --git a/DataFormats/GEMDigi/interface/GEMAMCdataCollection.h b/DataFormats/GEMDigi/interface/GEMAMCdataCollection.h deleted file mode 100644 index 3065dd3dc5306..0000000000000 --- a/DataFormats/GEMDigi/interface/GEMAMCdataCollection.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef DataFormats_GEMDigi_GEMAMCdataCollection_h -#define DataFormats_GEMDigi_GEMAMCdataCollection_h - -#include "DataFormats/MuonData/interface/MuonDigiCollection.h" -#include "DataFormats/GEMDigi/interface/AMCdata.h" - -typedef MuonDigiCollection GEMAMCdataCollection; - -#endif diff --git a/DataFormats/GEMDigi/interface/GEMGEBdataCollection.h b/DataFormats/GEMDigi/interface/GEMGEBdataCollection.h deleted file mode 100644 index c18a7176363ad..0000000000000 --- a/DataFormats/GEMDigi/interface/GEMGEBdataCollection.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef DataFormats_GEMDigi_GEMGEBdataCollection_h -#define DataFormats_GEMDigi_GEMGEBdataCollection_h - -#include "DataFormats/GEMDigi/interface/GEBdata.h" -#include "DataFormats/MuonDetId/interface/GEMDetId.h" -#include "DataFormats/MuonData/interface/MuonDigiCollection.h" - -typedef MuonDigiCollection GEMGEBdataCollection; - -#endif diff --git a/DataFormats/GEMDigi/interface/GEMOHStatus.h b/DataFormats/GEMDigi/interface/GEMOHStatus.h index c62675e1ece15..850356cb1618c 100644 --- a/DataFormats/GEMDigi/interface/GEMOHStatus.h +++ b/DataFormats/GEMDigi/interface/GEMOHStatus.h @@ -1,6 +1,6 @@ #ifndef DataFormats_GEMDigi_GEMOHStatus_h #define DataFormats_GEMDigi_GEMOHStatus_h -#include "GEBdata.h" +#include "GEMOptoHybrid.h" #include #include @@ -35,7 +35,7 @@ class GEMOHStatus { }; GEMOHStatus() {} - GEMOHStatus(const gem::GEBdata& oh) { + GEMOHStatus(const GEMOptoHybrid& oh) { Errors error{0}; error.EvtF = oh.evtF(); error.InF = oh.inF(); diff --git a/DataFormats/GEMDigi/interface/GEMOptoHybrid.h b/DataFormats/GEMDigi/interface/GEMOptoHybrid.h new file mode 100644 index 0000000000000..b0054f5fd2a5d --- /dev/null +++ b/DataFormats/GEMDigi/interface/GEMOptoHybrid.h @@ -0,0 +1,107 @@ +#ifndef DataFormats_GEMDigi_GEMOptoHybrid_h +#define DataFormats_GEMDigi_GEMOptoHybrid_h +#include "GEMVFAT.h" +#include + +class GEMOptoHybrid { +public: + union GEBchamberHeader { + uint64_t word; + struct { + uint64_t : 10; // unused + uint64_t BxmVvV : 1; // 1st bit BX mismatch VFAT vs VFAT + uint64_t BxmAvV : 1; // BX mismatch AMC vs VFAT + uint64_t OOScVvV : 1; // Out of Sync (EC mismatch) VFAT vs VFAT + uint64_t OOScAvV : 1; // Out of Sync (EC mismatch) AMC vs VFAT + uint64_t Inv : 1; // Invalid event + uint64_t EvtSzW : 1; // Event size warning + uint64_t L1aNF : 1; // L1A FIFO near full + uint64_t InNF : 1; // Input FIFO near full + uint64_t EvtNF : 1; // Event FIFO near full + uint64_t EvtSzOFW : 1; // Event size overflow + uint64_t L1aF : 1; // L1A FIFO full + uint64_t InF : 1; // Input FIFO full + uint64_t EvtF : 1; // Event FIFO full + uint64_t VfWdCnt : 12; // VFAT word count (in number of 64-bit words) + uint64_t InputID : 5; // Input link ID + uint64_t CALIB_CHAN : 7; // Calibration channel number + uint64_t : 17; // unused + }; + }; + + union GEBchamberTrailer { + uint64_t word; + struct { + uint64_t ecOH : 20; // NOT USED - OptoHybrid event counter + uint64_t bcOH : 13; // NOT USED - OptoHybrid bunch crossing + uint64_t InUfw : 1; // Input FIFO underflow + uint64_t SkD : 1; // NOT USED - Stuck data + uint64_t EvUfw : 1; // NOT USED - Event FIFO underflow + uint64_t VfWdCntT : 12; // VFAT word count (in number of 64-bit words) + uint64_t crc16 : 16; // CRC of OptoHybrid data (currently not available – filled with 0) + }; + }; + + GEMOptoHybrid() : ch_(0), ct_(0){}; + ~GEMOptoHybrid() { vfatd_.clear(); } + + //!Read chamberHeader from the block. + void setChamberHeader(uint64_t word) { ch_ = word; } + void setChamberHeader(uint16_t vfatWordCnt, uint8_t inputID) { + GEBchamberHeader u{0}; + u.VfWdCnt = vfatWordCnt; + u.InputID = inputID; + ch_ = u.word; + } + uint64_t getChamberHeader() const { return ch_; } + + //!Read chamberTrailer from the block. + void setChamberTrailer(uint64_t word) { ct_ = word; } + void setChamberTrailer(uint32_t ecOH, uint16_t bcOH, uint16_t vfatWordCntT) { + GEBchamberTrailer u{0}; + u.ecOH = ecOH; + u.bcOH = bcOH; + u.VfWdCntT = vfatWordCntT; + ct_ = u.word; + } + uint64_t getChamberTrailer() const { return ct_; } + + uint16_t vfatWordCnt() const { return GEBchamberHeader{ch_}.VfWdCnt; } + uint8_t inputID() const { return GEBchamberHeader{ch_}.InputID; } + uint16_t vfatWordCntT() const { return GEBchamberTrailer{ct_}.VfWdCntT; } + + bool bxmVvV() const { return GEBchamberHeader{ch_}.BxmVvV; } + bool bxmAvV() const { return GEBchamberHeader{ch_}.BxmAvV; } + bool oOScVvV() const { return GEBchamberHeader{ch_}.OOScVvV; } + bool oOScAvV() const { return GEBchamberHeader{ch_}.OOScAvV; } + bool inv() const { return GEBchamberHeader{ch_}.Inv; } + bool evtSzW() const { return GEBchamberHeader{ch_}.EvtSzW; } + bool l1aNF() const { return GEBchamberHeader{ch_}.L1aNF; } + bool inNF() const { return GEBchamberHeader{ch_}.InNF; } + bool evtNF() const { return GEBchamberHeader{ch_}.EvtNF; } + bool evtSzOFW() const { return GEBchamberHeader{ch_}.EvtSzOFW; } + bool l1aF() const { return GEBchamberHeader{ch_}.L1aF; } + bool inF() const { return GEBchamberHeader{ch_}.InF; } + bool evtF() const { return GEBchamberHeader{ch_}.EvtF; } + bool inUfw() const { return GEBchamberTrailer{ct_}.InUfw; } + + bool noVFAT() const { return false; } // to be removed + bool stuckData() const { return false; } // to be removed + bool evUfw() const { return false; } // to be removed + + //!Adds VFAT data to the vector + void addVFAT(GEMVFAT v) { vfatd_.push_back(v); } + //!Returns the vector of VFAT data + const std::vector* vFATs() const { return &vfatd_; } + //!Clear the vector rof VFAT data + void clearVFATs() { vfatd_.clear(); } + + static const int sizeGebID = 5; + +private: + uint64_t ch_; // GEBchamberHeader + uint64_t ct_; // GEBchamberTrailer + + std::vector vfatd_; +}; +#endif diff --git a/DataFormats/GEMDigi/interface/GEMVFAT.h b/DataFormats/GEMDigi/interface/GEMVFAT.h new file mode 100644 index 0000000000000..94811bac22e2b --- /dev/null +++ b/DataFormats/GEMDigi/interface/GEMVFAT.h @@ -0,0 +1,128 @@ +#ifndef DataFormats_GEMDigi_GEMVFAT_h +#define DataFormats_GEMDigi_GEMVFAT_h +#include + +class GEMVFAT { +public: + /// VFAT data structure - 3 words of 64 bits each + union VFATfirst { + uint64_t word; + // v3 dataformat + struct { + uint64_t msData1 : 16; /// #include @@ -25,7 +25,7 @@ class GEMVFATStatus { }; GEMVFATStatus() {} - GEMVFATStatus(const gem::AMCdata& amc, const gem::VFATdata& vfat, uint16_t position, bool readMultiBX) { + GEMVFATStatus(const GEMAMC& amc, const GEMVFAT& vfat, uint16_t position, bool readMultiBX) { Errors error{0}; Warnings warn{0}; diff --git a/DataFormats/GEMDigi/interface/GEMVfatStatusDigi.h b/DataFormats/GEMDigi/interface/GEMVfatStatusDigi.h deleted file mode 100644 index 6cb72edbef637..0000000000000 --- a/DataFormats/GEMDigi/interface/GEMVfatStatusDigi.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef DataFormats_GEMDigi_GEMVfatStatusDigi_H -#define DataFormats_GEMDigi_GEMVfatStatusDigi_H - -#include -#include "DataFormats/GEMDigi/interface/VFATdata.h" - -class GEMVfatStatusDigi { -public: - GEMVfatStatusDigi(gem::VFATdata &vfat); - GEMVfatStatusDigi() {} - - uint8_t quality() const { return quality_; } - uint8_t flag() const { return flag_; } - int phi() const { return phi_; } - uint16_t bc() const { return bc_; } - uint8_t ec() const { return ec_; } - -private: - uint8_t quality_; /// quality flag - bit: 0 good, 1 crc fail, 2 b1010 fail, 3 b1100 fail, 4 b1110 - uint8_t flag_; /// Control Flags: 4 bits, Hamming Error/AFULL/SEUlogic/SUEI2C - int phi_; /// vfat local phi postion in chamber - uint16_t bc_; - uint8_t ec_; -}; -#endif diff --git a/DataFormats/GEMDigi/interface/GEMVfatStatusDigiCollection.h b/DataFormats/GEMDigi/interface/GEMVfatStatusDigiCollection.h deleted file mode 100644 index 2fd3b2527b8bc..0000000000000 --- a/DataFormats/GEMDigi/interface/GEMVfatStatusDigiCollection.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef DataFormats_GEMDigi_GEMVfatStatusDigiCollection_h -#define DataFormats_GEMDigi_GEMVfatStatusDigiCollection_h - -#include "DataFormats/GEMDigi/interface/GEMVfatStatusDigi.h" -#include "DataFormats/MuonDetId/interface/GEMDetId.h" -#include "DataFormats/MuonData/interface/MuonDigiCollection.h" - -typedef MuonDigiCollection GEMVfatStatusDigiCollection; - -#endif diff --git a/DataFormats/GEMDigi/interface/VFATdata.h b/DataFormats/GEMDigi/interface/VFATdata.h deleted file mode 100644 index 64f59f482038d..0000000000000 --- a/DataFormats/GEMDigi/interface/VFATdata.h +++ /dev/null @@ -1,130 +0,0 @@ -#ifndef DataFormats_GEMDigi_VFATdata_h -#define DataFormats_GEMDigi_VFATdata_h - -#include - -namespace gem { - /// VFAT data structure - 3 words of 64 bits each - union VFATfirst { - uint64_t word; - // v3 dataformat - struct { - uint64_t msData1 : 16; /// -#include "DataFormats/GEMDigi/interface/AMCdata.h" +#include "DataFormats/GEMDigi/interface/GEMAMC.h" #include -using namespace gem; -void AMCdata::setAMCheader1(uint32_t dataLength, uint16_t bxID, uint32_t l1AID, uint8_t AMCnum) { +void GEMAMC::setAMCheader1(uint32_t dataLength, uint16_t bxID, uint32_t l1AID, uint8_t AMCnum) { AMCheader1 u{0}; u.dataLength = dataLength; u.bxID = bxID; @@ -17,7 +16,7 @@ void AMCdata::setAMCheader1(uint32_t dataLength, uint16_t bxID, uint32_t l1AID, amct_ = ut.word; } -void AMCdata::setAMCheader2(uint16_t boardID, uint16_t orbitNum, uint8_t runType) { +void GEMAMC::setAMCheader2(uint16_t boardID, uint16_t orbitNum, uint8_t runType) { AMCheader2 u{0}; u.boardID = boardID; u.orbitNum = orbitNum; @@ -25,7 +24,7 @@ void AMCdata::setAMCheader2(uint16_t boardID, uint16_t orbitNum, uint8_t runType amch2_ = u.word; } -void AMCdata::setGEMeventHeader(uint8_t davCnt, uint32_t davList) { +void GEMAMC::setGEMeventHeader(uint8_t davCnt, uint32_t davList) { EventHeader u{0}; u.davCnt = davCnt; u.davList = davList; diff --git a/DataFormats/GEMDigi/src/AMC13Event.cc b/DataFormats/GEMDigi/src/GEMAMC13.cc similarity index 60% rename from DataFormats/GEMDigi/src/AMC13Event.cc rename to DataFormats/GEMDigi/src/GEMAMC13.cc index 171af2c09a919..2d357995aaf1a 100644 --- a/DataFormats/GEMDigi/src/AMC13Event.cc +++ b/DataFormats/GEMDigi/src/GEMAMC13.cc @@ -1,9 +1,7 @@ #include -#include "DataFormats/GEMDigi/interface/AMC13Event.h" +#include "DataFormats/GEMDigi/interface/GEMAMC13.h" -using namespace gem; - -void AMC13Event::setCDFHeader(uint8_t Evt_ty, uint32_t LV1_id, uint16_t BX_id, uint16_t Source_id) { +void GEMAMC13::setCDFHeader(uint8_t Evt_ty, uint32_t LV1_id, uint16_t BX_id, uint16_t Source_id) { CDFHeader u{0}; u.cb5 = 0x5; u.eventType = Evt_ty; @@ -13,7 +11,7 @@ void AMC13Event::setCDFHeader(uint8_t Evt_ty, uint32_t LV1_id, uint16_t BX_id, u cdfh_ = u.word; } -void AMC13Event::setAMC13Header(uint8_t CalTyp, uint8_t nAMC, uint32_t OrN) { +void GEMAMC13::setAMC13Header(uint8_t CalTyp, uint8_t nAMC, uint32_t OrN) { AMC13Header u{0}; u.cb0 = 0x0; u.calType = CalTyp; @@ -22,7 +20,7 @@ void AMC13Event::setAMC13Header(uint8_t CalTyp, uint8_t nAMC, uint32_t OrN) { amc13h_ = u.word; } -void AMC13Event::setAMC13Trailer(uint8_t Blk_NoT, uint8_t LV1_idT, uint16_t BX_idT) { +void GEMAMC13::setAMC13Trailer(uint8_t Blk_NoT, uint8_t LV1_idT, uint16_t BX_idT) { AMC13Trailer u{0}; u.blkN = Blk_NoT; u.lv1IdT = LV1_idT; @@ -30,7 +28,7 @@ void AMC13Event::setAMC13Trailer(uint8_t Blk_NoT, uint8_t LV1_idT, uint16_t BX_i amc13t_ = u.word; } -void AMC13Event::setCDFTrailer(uint32_t EvtLength) { +void GEMAMC13::setCDFTrailer(uint32_t EvtLength) { CDFTrailer u{0}; u.cbA = 0xA; u.eventType = CDFHeader{cdfh_}.eventType; @@ -38,9 +36,9 @@ void AMC13Event::setCDFTrailer(uint32_t EvtLength) { cdft_ = u.word; } -void AMC13Event::addAMCheader(uint64_t word) { amcHeaders_.push_back(word); } +void GEMAMC13::addAMCheader(uint64_t word) { amcHeaders_.push_back(word); } -void AMC13Event::addAMCheader(uint32_t AMC_size, uint8_t Blk_No, uint8_t AMC_No, uint16_t BoardID) { +void GEMAMC13::addAMCheader(uint32_t AMC_size, uint8_t Blk_No, uint8_t AMC_No, uint16_t BoardID) { // AMC Header word // 55 - 32 | 27 - 20 | 19 - 16 | 15 - 0 | // AMC_size | Blk_No | AMC_No | BoardID | diff --git a/DataFormats/GEMDigi/src/VFATdata.cc b/DataFormats/GEMDigi/src/GEMVFAT.cc similarity index 82% rename from DataFormats/GEMDigi/src/VFATdata.cc rename to DataFormats/GEMDigi/src/GEMVFAT.cc index 41ad6e81124f5..1282be867d96b 100644 --- a/DataFormats/GEMDigi/src/VFATdata.cc +++ b/DataFormats/GEMDigi/src/GEMVFAT.cc @@ -1,15 +1,14 @@ -#include "DataFormats/GEMDigi/interface/VFATdata.h" +#include "DataFormats/GEMDigi/interface/GEMVFAT.h" #include -using namespace gem; -VFATdata::VFATdata() : ver_(0), phiPos_(0), fw_(0), sw_(0), tw_(0) {} +GEMVFAT::GEMVFAT() : ver_(0), phiPos_(0), fw_(0), sw_(0), tw_(0) {} -VFATdata::VFATdata(const int vfatVer, - const uint16_t BC, - const uint32_t EC, - const uint16_t chipID, - const uint64_t lsDatas, - const uint64_t msDatas) { +GEMVFAT::GEMVFAT(const int vfatVer, + const uint16_t BC, + const uint32_t EC, + const uint16_t chipID, + const uint64_t lsDatas, + const uint64_t msDatas) { // this constructor only used for packing sim digis VFATfirst fw{0}; VFATsecond sw{0}; @@ -47,7 +46,7 @@ VFATdata::VFATdata(const int vfatVer, tw_ = tw.word; } -uint8_t VFATdata::quality() { +uint8_t GEMVFAT::quality() { uint8_t q = 0; if (ver_ == 2) { if (VFATthird{tw_}.crc != checkCRC()) @@ -63,7 +62,7 @@ uint8_t VFATdata::quality() { return q; } -uint16_t VFATdata::crc_cal(uint16_t crc_in, uint16_t dato) { +uint16_t GEMVFAT::crc_cal(uint16_t crc_in, uint16_t dato) { uint16_t v = 0x0001; uint16_t mask = 0x0001; uint16_t d = 0x0000; @@ -83,7 +82,7 @@ uint16_t VFATdata::crc_cal(uint16_t crc_in, uint16_t dato) { return crc_temp; } -uint16_t VFATdata::checkCRC() { +uint16_t GEMVFAT::checkCRC() { uint16_t vfatBlockWords[12]; vfatBlockWords[11] = ((0x000f & VFATfirst{fw_}.b1010) << 12) | VFATfirst{fw_}.bcV2; vfatBlockWords[10] = diff --git a/DataFormats/GEMDigi/src/GEMVfatStatusDigi.cc b/DataFormats/GEMDigi/src/GEMVfatStatusDigi.cc deleted file mode 100644 index 0f39fc7488787..0000000000000 --- a/DataFormats/GEMDigi/src/GEMVfatStatusDigi.cc +++ /dev/null @@ -1,10 +0,0 @@ -#include "DataFormats/GEMDigi/interface/GEMVfatStatusDigi.h" -#include - -GEMVfatStatusDigi::GEMVfatStatusDigi(gem::VFATdata &vfat) { - quality_ = vfat.quality(); - flag_ = vfat.flag(); - phi_ = vfat.phi(); - ec_ = vfat.ec(); - bc_ = vfat.bc(); -}; diff --git a/DataFormats/GEMDigi/src/classes.h b/DataFormats/GEMDigi/src/classes.h index f3ae200dca21e..1d516137794a2 100644 --- a/DataFormats/GEMDigi/src/classes.h +++ b/DataFormats/GEMDigi/src/classes.h @@ -22,18 +22,6 @@ #include "DataFormats/GEMDigi/interface/GEMVFATStatus.h" #include "DataFormats/GEMDigi/interface/GEMVFATStatusCollection.h" -#include "DataFormats/GEMDigi/interface/GEMVfatStatusDigi.h" -#include "DataFormats/GEMDigi/interface/GEMVfatStatusDigiCollection.h" - -#include "DataFormats/GEMDigi/interface/GEBdata.h" -#include "DataFormats/GEMDigi/interface/GEMGEBdataCollection.h" - -#include "DataFormats/GEMDigi/interface/AMCdata.h" -#include "DataFormats/GEMDigi/interface/GEMAMCdataCollection.h" - -#include "DataFormats/GEMDigi/interface/AMC13Event.h" -#include "DataFormats/GEMDigi/interface/GEMAMC13EventCollection.h" - #include "DataFormats/GEMDigi/interface/ME0DigiPreReco.h" #include "DataFormats/GEMDigi/interface/ME0DigiPreRecoCollection.h" diff --git a/DataFormats/GEMDigi/src/classes_def.xml b/DataFormats/GEMDigi/src/classes_def.xml index c21b9c62bad44..2046f2f9f66b6 100644 --- a/DataFormats/GEMDigi/src/classes_def.xml +++ b/DataFormats/GEMDigi/src/classes_def.xml @@ -78,43 +78,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DataFormats/HGCalReco/interface/Trackster.h b/DataFormats/HGCalReco/interface/Trackster.h index 2067ac2151d80..c0eab45d9bc3a 100644 --- a/DataFormats/HGCalReco/interface/Trackster.h +++ b/DataFormats/HGCalReco/interface/Trackster.h @@ -37,7 +37,8 @@ namespace ticl { enum class PCAOrdering { ascending = 0, descending }; Trackster() - : seedIndex_(0), + : iterationIndex_(0), + seedIndex_(0), time_(0.f), timeError_(-1.f), regressed_energy_(0.f), diff --git a/DataFormats/Histograms/interface/MonitorElementCollection.h b/DataFormats/Histograms/interface/MonitorElementCollection.h index 2d65ddb35ef15..0e86719a96c20 100644 --- a/DataFormats/Histograms/interface/MonitorElementCollection.h +++ b/DataFormats/Histograms/interface/MonitorElementCollection.h @@ -36,7 +36,6 @@ #include #include #include -#include #include "TH1.h" @@ -179,36 +178,63 @@ struct MonitorElementData { // Type of string `path` could be just directory name, or // directory name followed by the name of the monitor element void set(std::string path, Path::Type type) { - std::string in(path); - std::vector buf; - static std::regex const dir("^/*([^/]+)"); - std::smatch m; - - while (std::regex_search(in, m, dir)) { - if (m[1] == "..") { - if (!buf.empty()) { - buf.pop_back(); + //rebuild 'path' to be in canonical form + + //remove any leading '/' + while (not path.empty() and path.front() == '/') { + path.erase(path.begin()); + } + + //handle '..' and '//' + // the 'dir' tokens are separate by a single '/' + std::string::size_type tokenStartPos = 0; + while (tokenStartPos < path.size()) { + auto tokenEndPos = path.find('/', tokenStartPos); + if (tokenEndPos == std::string::npos) { + tokenEndPos = path.size(); + } + if (0 == tokenEndPos - tokenStartPos) { + //we are sitting on a '/' + path.erase(path.begin() + tokenStartPos); + continue; + } else if (2 == tokenEndPos - tokenStartPos) { + if (path[tokenStartPos] == '.' and path[tokenStartPos + 1] == '.') { + //need to go backwards and remove previous directory + auto endOfLastToken = tokenStartPos; + if (tokenStartPos > 1) { + endOfLastToken -= 2; + } + auto startOfLastToken = path.rfind('/', endOfLastToken); + if (startOfLastToken == std::string::npos) { + //we are at the very beginning of 'path' since no '/' found + path.erase(path.begin(), path.begin() + tokenEndPos); + tokenStartPos = 0; + } else { + path.erase(path.begin() + startOfLastToken + 1, path.begin() + tokenEndPos); + tokenStartPos = startOfLastToken + 1; + } + continue; } - } else { - buf.push_back(m[1]); } - in = m.suffix().str(); + tokenStartPos = tokenEndPos + 1; } - // Construct dirname_ and object_name - dirname_ = ""; - objname_ = ""; - int numberOfItems = buf.size(); - for (int i = 0; i < numberOfItems; i++) { - if (i == numberOfItems - 1) { - // Processing last component... - if (type == Path::Type::DIR_AND_NAME) { - objname_ = buf[i]; - } else if (type == Path::Type::DIR) { - dirname_ += buf[i] + "/"; - } + //separate into objname_ and dirname_; + objname_.clear(); + if (type == Path::Type::DIR) { + if (not path.empty() and path.back() != '/') { + path.append(1, '/'); + } + dirname_ = std::move(path); + } else { + auto lastSlash = path.rfind('/'); + if (lastSlash == std::string::npos) { + objname_ = std::move(path); + dirname_.clear(); } else { - dirname_ += buf[i] + "/"; + objname_ = path.substr(lastSlash + 1); + path.erase(path.begin() + lastSlash + 1, path.end()); + dirname_ = std::move(path); } } } diff --git a/DataFormats/Histograms/test/BuildFile.xml b/DataFormats/Histograms/test/BuildFile.xml index 0022f83a4ea85..65ea107db573a 100644 --- a/DataFormats/Histograms/test/BuildFile.xml +++ b/DataFormats/Histograms/test/BuildFile.xml @@ -2,3 +2,8 @@ + + + + + diff --git a/DataFormats/Histograms/test/MonitorElementData_Path_catch.cc b/DataFormats/Histograms/test/MonitorElementData_Path_catch.cc new file mode 100644 index 0000000000000..2409a087a819d --- /dev/null +++ b/DataFormats/Histograms/test/MonitorElementData_Path_catch.cc @@ -0,0 +1,264 @@ +// -*- C++ -*- +// +// Package: Histograms +// Class : metoemdformat_t +// +// Implementation: +// +// +// Original Author: +// Created: Tue Jul 21 11:00:06 CDT 2009 +// + +// system include files + +#define CATCH_CONFIG_MAIN +#include "catch.hpp" + +// user include files +#include "DataFormats/Histograms/interface/MonitorElementCollection.h" + +TEST_CASE("MonitorElementData::Path", "[MonitorElementData_Path]") { + MonitorElementData::Path p; + + SECTION("Canonical Paths") { + SECTION("short path") { + std::string pathName = "Foo/"; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == pathName); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == pathName); + } + + SECTION("2 dirs") { + std::string pathName = "Foo/Bar/"; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == pathName); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == pathName); + } + + SECTION("long path") { + std::string pathName = "This/Is/A/Very/Long/Path/Name/"; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == pathName); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == pathName); + } + } + SECTION("extra /") { + SECTION("only /") { + std::string pathName = "/"; + std::string canonical = ""; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == canonical); + } + SECTION("only //") { + std::string pathName = "//"; + std::string canonical = ""; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == canonical); + } + SECTION("leading /") { + std::string pathName = "/Foo/"; + std::string canonical = "Foo/"; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == canonical); + } + SECTION("ending //") { + std::string pathName = "Foo//"; + std::string canonical = "Foo/"; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == canonical); + } + SECTION("middle //") { + std::string pathName = "Foo//Bar/"; + std::string canonical = "Foo/Bar/"; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == canonical); + } + } + SECTION("missing end /") { + SECTION("blank") { + std::string pathName = ""; + std::string canonical = ""; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == canonical); + } + SECTION("one dir") { + std::string pathName = "Foo"; + std::string canonical = "Foo/"; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == canonical); + } + SECTION("two dir") { + std::string pathName = "Foo/Bar"; + std::string canonical = "Foo/Bar/"; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == canonical); + } + } + SECTION("up dir") { + SECTION("to beginning") { + SECTION("end /") { + std::string pathName = "Foo/../"; + std::string canonical = ""; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == canonical); + } + SECTION("missing end /") { + std::string pathName = "Foo/.."; + std::string canonical = ""; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == canonical); + } + } + SECTION("beyond beginning") { + SECTION("end /") { + std::string pathName = "Foo/../.."; + std::string canonical = ""; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == canonical); + } + SECTION("missing end /") { + std::string pathName = "Foo/../.."; + std::string canonical = ""; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == canonical); + } + } + SECTION("middle") { + SECTION("back to beginning") { + std::string pathName = "Foo/../Bar/"; + std::string canonical = "Bar/"; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == canonical); + } + SECTION("midway") { + std::string pathName = "Foo/Bar/../Biz/"; + std::string canonical = "Foo/Biz/"; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == canonical); + } + SECTION("last") { + std::string pathName = "Foo/Bar/../"; + std::string canonical = "Foo/"; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == canonical); + } + } + SECTION("multiple consecutive") { + SECTION("two") { + SECTION("back to beginning") { + std::string pathName = "Foo/Biz/../../Bar/"; + std::string canonical = "Bar/"; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == canonical); + } + SECTION("midway") { + std::string pathName = "Foo/Bar/Blah/../../Biz/"; + std::string canonical = "Foo/Biz/"; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == canonical); + } + SECTION("last") { + std::string pathName = "Foo/Bar/Blah/../../"; + std::string canonical = "Foo/"; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == canonical); + } + } + SECTION("three") { + SECTION("back to beginning") { + std::string pathName = "Foo/Biz/Bleep/../../../Bar/"; + std::string canonical = "Bar/"; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == canonical); + } + SECTION("midway") { + std::string pathName = "Foo/Bar/Blah/Bleep/../../../Biz/"; + std::string canonical = "Foo/Biz/"; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == canonical); + } + SECTION("last") { + std::string pathName = "Foo/Bar/Blah/Bleep/../../../"; + std::string canonical = "Foo/"; + p.set(pathName, MonitorElementData::Path::Type::DIR); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname().empty()); + REQUIRE(p.getFullname() == canonical); + } + } + } + } + SECTION("object") { + SECTION("no dir") { + std::string pathName = "bar"; + std::string canonical = ""; + std::string objectName = "bar"; + p.set(pathName, MonitorElementData::Path::Type::DIR_AND_NAME); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname() == objectName); + REQUIRE(p.getFullname() == canonical + objectName); + } + SECTION("1 dir") { + std::string pathName = "Foo/bar"; + std::string canonical = "Foo/"; + std::string objectName = "bar"; + p.set(pathName, MonitorElementData::Path::Type::DIR_AND_NAME); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname() == objectName); + REQUIRE(p.getFullname() == canonical + objectName); + } + SECTION("2 dir") { + std::string pathName = "Foo/Biz/bar"; + std::string canonical = "Foo/Biz/"; + std::string objectName = "bar"; + p.set(pathName, MonitorElementData::Path::Type::DIR_AND_NAME); + REQUIRE(p.getDirname() == canonical); + REQUIRE(p.getObjectname() == objectName); + REQUIRE(p.getFullname() == canonical + objectName); + } + } +} diff --git a/DataFormats/L1THGCal/interface/HGCalClusterT.h b/DataFormats/L1THGCal/interface/HGCalClusterT.h index 15c0e9d4cf7bf..80bcef1d0300c 100644 --- a/DataFormats/L1THGCal/interface/HGCalClusterT.h +++ b/DataFormats/L1THGCal/interface/HGCalClusterT.h @@ -7,7 +7,6 @@ #include "DataFormats/L1Trigger/interface/L1Candidate.h" #include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h" #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" -#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" #include "DataFormats/ForwardDetId/interface/HGCalTriggerDetId.h" #include "DataFormats/ForwardDetId/interface/HFNoseTriggerDetId.h" @@ -110,7 +109,7 @@ namespace l1t { DetId id(id_constituent.first); auto id_fraction = constituentsFraction_.find(id_constituent.first); double fraction = (id_fraction != constituentsFraction_.end() ? id_fraction->second : 1.); - if ((id.det() == DetId::Forward && id.subdetId() == HGCEE) || (id.det() == DetId::HGCalEE) || + if ((id.det() == DetId::HGCalEE) || (id.det() == DetId::HGCalTrigger && HGCalTriggerDetId(id).subdet() == HGCalTriggerSubdetector::HGCalEETrigger) || (id.det() == DetId::Forward && id.subdetId() == ForwardSubdetector::HFNose && HFNoseDetId(id).isEE()) || @@ -118,9 +117,7 @@ namespace l1t { HGCalTriggerDetId(id).subdet() == HGCalTriggerSubdetector::HFNoseTrigger && HFNoseTriggerDetId(id).isEE())) { pt_em += id_constituent.second->pt() * fraction; - } else if ((id.det() == DetId::Forward && id.subdetId() == HGCHEF) || - (id.det() == DetId::Hcal && id.subdetId() == HcalEndcap) || (id.det() == DetId::HGCalHSi) || - (id.det() == DetId::HGCalHSc) || + } else if ((id.det() == DetId::HGCalHSi) || (id.det() == DetId::HGCalHSc) || (id.det() == DetId::HGCalTrigger && HGCalTriggerDetId(id).subdet() == HGCalTriggerSubdetector::HGCalHSiTrigger) || (id.det() == DetId::Forward && id.subdetId() == ForwardSubdetector::HFNose && diff --git a/DataFormats/PatCandidates/interface/PackedCandidate.h b/DataFormats/PatCandidates/interface/PackedCandidate.h index 6bca9f611d4d0..47e79e956dfe7 100644 --- a/DataFormats/PatCandidates/interface/PackedCandidate.h +++ b/DataFormats/PatCandidates/interface/PackedCandidate.h @@ -661,6 +661,16 @@ namespace pat { setTrackProperties(tk, tk.covariance(), quality, covarianceVersion); } + void setTrackPropertiesLite(unsigned int covSchema, + unsigned int covarianceVersion, + unsigned int nHits, + unsigned int nPixelHits) { + covarianceVersion_ = covarianceVersion; + covarianceSchema_ = covSchema; + packedHits_ = + (nPixelHits & trackPixelHitsMask) | (((nHits - nPixelHits) & trackStripHitsMask) << trackStripHitsShift); + } + int numberOfPixelHits() const { return (packedHits_ & trackPixelHitsMask) + pixelLayersWithMeasurement(); } int numberOfHits() const { return (packedHits_ >> trackStripHitsShift) + stripLayersWithMeasurement() + numberOfPixelHits(); @@ -742,6 +752,7 @@ namespace pat { maybeUnpackBoth(); return dxy_; } + /// dz with respect to the PV[ipv] virtual float dz(size_t ipv = 0) const { maybeUnpackBoth(); @@ -752,6 +763,7 @@ namespace pat { maybeUnpackBoth(); return dz_; } + /// dxy with respect to another point virtual float dxy(const Point &p) const; /// dz with respect to another point @@ -786,7 +798,9 @@ namespace pat { } /// Return true if a bestTrack can be extracted from this Candidate bool hasTrackDetails() const { return (packedHits_ != 0 || packedLayers_ != 0); } - + /// Return true if the original candidate had a track associated + /// even if the PackedCandidate has no track + bool fromTrackCandidate() const { return (packedDz_ != 0 || (packedDxy_ != 0 && packedDxy_ != 32768)); } /// true if the track had the highPurity quality bit bool trackHighPurity() const { return (qualityFlags_ & trackHighPurityMask) >> trackHighPurityShift; } /// set to true if the track had the highPurity quality bit diff --git a/EventFilter/GEMRawToDigi/interface/GEMRawToDigi.h b/EventFilter/GEMRawToDigi/interface/GEMRawToDigi.h index f5997127a4756..075cb4b14e112 100644 --- a/EventFilter/GEMRawToDigi/interface/GEMRawToDigi.h +++ b/EventFilter/GEMRawToDigi/interface/GEMRawToDigi.h @@ -4,11 +4,11 @@ * \author J. Lee, Yechan Kang - UoS */ #include -#include "DataFormats/GEMDigi/interface/AMC13Event.h" +#include "DataFormats/GEMDigi/interface/GEMAMC13.h" class GEMRawToDigi { public: - std::unique_ptr convertWordToAMC13Event(const uint64_t* word); + std::unique_ptr convertWordToGEMAMC13(const uint64_t* word); bool vfatError() const { return vfatError_; } bool amcError() const { return amcError_; } diff --git a/EventFilter/GEMRawToDigi/plugins/GEMDigiToRawModule.cc b/EventFilter/GEMRawToDigi/plugins/GEMDigiToRawModule.cc index ec3f76c8ba5e3..45323c8af0522 100644 --- a/EventFilter/GEMRawToDigi/plugins/GEMDigiToRawModule.cc +++ b/EventFilter/GEMRawToDigi/plugins/GEMDigiToRawModule.cc @@ -13,7 +13,7 @@ #include "DataFormats/FEDRawData/interface/FEDRawData.h" #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "DataFormats/FEDRawData/interface/FEDTrailer.h" -#include "DataFormats/GEMDigi/interface/AMC13Event.h" +#include "DataFormats/GEMDigi/interface/GEMAMC13.h" #include "DataFormats/GEMDigi/interface/GEMDigiCollection.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -49,8 +49,6 @@ class GEMDigiToRawModule : public edm::global::EDProducer("eventType")), digi_token(consumes(pset.getParameter("gemDigi"))), @@ -97,15 +95,15 @@ void GEMDigiToRawModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve auto gemROMap = runCache(iEvent.getRun().index()); - std::vector> amc13Events; - amc13Events.reserve(FEDNumbering::MAXGEMFEDID - FEDNumbering::MINGEMFEDID + 1); + std::vector> amc13s; + amc13s.reserve(FEDNumbering::MAXGEMFEDID - FEDNumbering::MINGEMFEDID + 1); int LV1_id = iEvent.id().event(); uint8_t BX_id(iEvent.bunchCrossing()); int OrN = iEvent.orbitNumber(); // making map of bx GEMDigiCollection - // each bx will be saved as new AMC13Event, so GEMDigiCollection needs to be split into bx + // each bx will be saved as new GEMAMC13, so GEMDigiCollection needs to be split into bx std::map gemBxMap; for (auto const& etaPart : *gemDigis) { GEMDetId gemId = etaPart.first; @@ -125,14 +123,14 @@ void GEMDigiToRawModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve for (unsigned int fedId = FEDNumbering::MINGEMFEDID; fedId <= FEDNumbering::MAXGEMFEDID; ++fedId) { uint32_t amc13EvtLength = 0; - std::unique_ptr amc13Event = std::make_unique(); + std::unique_ptr amc13 = std::make_unique(); for (uint8_t amcNum = 0; amcNum <= GEMeMap::maxAMCs_; ++amcNum) { uint32_t amcSize = 0; - std::unique_ptr amcData = std::make_unique(); + std::unique_ptr amc = std::make_unique(); for (uint8_t gebId = 0; gebId <= GEMeMap::maxGEBs_; ++gebId) { - std::unique_ptr gebData = std::make_unique(); + std::unique_ptr optoH = std::make_unique(); GEMROMapping::chamEC geb_ec{fedId, amcNum, gebId}; if (!gemROMap->isValidChamber(geb_ec)) @@ -182,47 +180,47 @@ void GEMDigiToRawModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve continue; // only make vfat with hits amcSize += 3; - auto vfatData = std::make_unique(geb_dc.vfatVer, bc, LV1_id, vfatId, lsData, msData); - gebData->addVFAT(*vfatData); + auto vfat = std::make_unique(geb_dc.vfatVer, bc, LV1_id, vfatId, lsData, msData); + optoH->addVFAT(*vfat); } } // end of vfats in GEB - if (!gebData->vFATs()->empty()) { + if (!optoH->vFATs()->empty()) { amcSize += 2; - gebData->setChamberHeader(gebData->vFATs()->size() * 3, gebId); - gebData->setChamberTrailer(LV1_id, BX_id, gebData->vFATs()->size() * 3); - amcData->addGEB(*gebData); + optoH->setChamberHeader(optoH->vFATs()->size() * 3, gebId); + optoH->setChamberTrailer(LV1_id, BX_id, optoH->vFATs()->size() * 3); + amc->addGEB(*optoH); } } // end of GEB loop - if (!amcData->gebs()->empty()) { + if (!amc->gebs()->empty()) { amcSize += 5; - amcData->setAMCheader1(amcSize, BX_id, LV1_id, amcNum); - amcData->setAMCheader2(amcNum, OrN, 1); - amcData->setGEMeventHeader(amcData->gebs()->size(), 0); - amc13Event->addAMCpayload(*amcData); - // AMC header in AMC13Event - amc13Event->addAMCheader(amcSize, 0, amcNum, 0); + amc->setAMCheader1(amcSize, BX_id, LV1_id, amcNum); + amc->setAMCheader2(amcNum, OrN, 1); + amc->setGEMeventHeader(amc->gebs()->size(), 0); + amc13->addAMCpayload(*amc); + // AMC header in GEMAMC13 + amc13->addAMCheader(amcSize, 0, amcNum, 0); amc13EvtLength += amcSize + 1; // AMC data size + AMC header size } } // end of AMC loop - if (!amc13Event->getAMCpayloads()->empty()) { + if (!amc13->getAMCpayloads()->empty()) { // CDFHeader - amc13Event->setCDFHeader(event_type_, LV1_id, BX_id, fedId); + amc13->setCDFHeader(event_type_, LV1_id, BX_id, fedId); // AMC13header - uint8_t nAMC = amc13Event->getAMCpayloads()->size(); - amc13Event->setAMC13Header(1, nAMC, OrN); - amc13Event->setAMC13Trailer(BX_id, LV1_id, BX_id); + uint8_t nAMC = amc13->getAMCpayloads()->size(); + amc13->setAMC13Header(1, nAMC, OrN); + amc13->setAMC13Trailer(BX_id, LV1_id, BX_id); //CDF trailer uint32_t EvtLength = amc13EvtLength + 4; // 2 header and 2 trailer - amc13Event->setCDFTrailer(EvtLength); - amc13Events.emplace_back(std::move(amc13Event)); - } // finished making amc13Event data + amc13->setCDFTrailer(EvtLength); + amc13s.emplace_back(std::move(amc13)); + } // finished making amc13 data } // end of FED loop - // read out amc13Events into fedRawData - for (const auto& amc13e : amc13Events) { + // read out amc13s into fedRawData + for (const auto& amc13e : amc13s) { std::vector words; words.emplace_back(amc13e->getCDFHeader()); words.emplace_back(amc13e->getAMC13Header()); diff --git a/EventFilter/GEMRawToDigi/plugins/GEMRawToDigiModule.cc b/EventFilter/GEMRawToDigi/plugins/GEMRawToDigiModule.cc index 3b1e04ea88291..668a86868a26c 100644 --- a/EventFilter/GEMRawToDigi/plugins/GEMRawToDigiModule.cc +++ b/EventFilter/GEMRawToDigi/plugins/GEMRawToDigiModule.cc @@ -15,13 +15,7 @@ #include "DataFormats/GEMDigi/interface/GEMAMCStatusCollection.h" #include "DataFormats/GEMDigi/interface/GEMOHStatusCollection.h" #include "DataFormats/GEMDigi/interface/GEMVFATStatusCollection.h" -#include "DataFormats/GEMDigi/interface/AMC13Event.h" -#include "DataFormats/GEMDigi/interface/GEMAMC13EventCollection.h" -#include "DataFormats/GEMDigi/interface/GEMAMCdataCollection.h" #include "DataFormats/GEMDigi/interface/GEMDigiCollection.h" -#include "DataFormats/GEMDigi/interface/GEMGEBdataCollection.h" -#include "DataFormats/GEMDigi/interface/GEMVfatStatusDigiCollection.h" -#include "DataFormats/GEMDigi/interface/VFATdata.h" #include "EventFilter/GEMRawToDigi/interface/GEMRawToDigi.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -59,14 +53,11 @@ class GEMRawToDigiModule : public edm::global::EDProducer(pset.getParameter("InputLabel"))), useDBEMap_(pset.getParameter("useDBEMap")), keepDAQStatus_(pset.getParameter("keepDAQStatus")), readMultiBX_(pset.getParameter("readMultiBX")), - unPackStatusDigis_(pset.getParameter("unPackStatusDigis")), gemRawToDigi_(std::make_unique()) { produces(); if (keepDAQStatus_) { @@ -75,13 +66,6 @@ GEMRawToDigiModule::GEMRawToDigiModule(const edm::ParameterSet& pset) produces("OHStatus"); produces("VFATStatus"); } - if (unPackStatusDigis_) { - // to be removed - produces("vfatStatus"); - produces("gebStatus"); - produces("AMCdata"); - produces("AMC13Event"); - } if (useDBEMap_) { gemEMapToken_ = esConsumes(); } @@ -91,7 +75,6 @@ void GEMRawToDigiModule::fillDescriptions(edm::ConfigurationDescriptions& descri edm::ParameterSetDescription desc; desc.add("InputLabel", edm::InputTag("rawDataCollector")); desc.add("useDBEMap", false); - desc.add("unPackStatusDigis", false); desc.add("keepDAQStatus", false); desc.add("readMultiBX", false); descriptions.add("muonGEMDigisDefault", desc); @@ -120,12 +103,6 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve auto outOHStatus = std::make_unique(); auto outVFATStatus = std::make_unique(); - // to be removed - auto outVFATStatusOld = std::make_unique(); - auto outGEBStatus = std::make_unique(); - auto outAMCdata = std::make_unique(); - auto outAMC13Event = std::make_unique(); - // Take raw from the event edm::Handle fed_buffers; iEvent.getByToken(fed_token, fed_buffers); @@ -147,23 +124,22 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve } const uint64_t* word = reinterpret_cast(fedData.data()); - auto amc13Event = gemRawToDigi_->convertWordToAMC13Event(word); + auto amc13 = gemRawToDigi_->convertWordToGEMAMC13(word); LogDebug("GEMRawToDigiModule") << "Event bx:" << iEvent.bunchCrossing() << " lv1Id:" << iEvent.id().event() << " orbitNumber:" << iEvent.orbitNumber(); - LogDebug("GEMRawToDigiModule") << "AMC13 bx:" << amc13Event->bunchCrossing() - << " lv1Id:" << int(amc13Event->lv1Id()) - << " orbitNumber:" << amc13Event->orbitNumber(); + LogDebug("GEMRawToDigiModule") << "AMC13 bx:" << amc13->bunchCrossing() << " lv1Id:" << int(amc13->lv1Id()) + << " orbitNumber:" << amc13->orbitNumber(); // Read AMC data - for (auto amcData : *(amc13Event->getAMCpayloads())) { - uint8_t amcNum = amcData.amcNum(); + for (const auto& amc : *(amc13->getAMCpayloads())) { + uint8_t amcNum = amc.amcNum(); GEMROMapping::sectorEC amcEC{fedId, amcNum}; if (!gemROMap->isValidAMC(amcEC)) { st_amc13.inValidAMC(); continue; } - GEMAMCStatus st_amc(amc13Event.get(), amcData); + GEMAMCStatus st_amc(amc13.get(), amc); if (st_amc.isBad()) { LogDebug("GEMRawToDigiModule") << st_amc; if (keepDAQStatus_) { @@ -172,13 +148,12 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve continue; } - uint16_t amcBx = amcData.bunchCrossing(); - LogDebug("GEMRawToDigiModule") << "AMC no.:" << int(amcData.amcNum()) << " bx:" << int(amcData.bunchCrossing()) - << " lv1Id:" << int(amcData.lv1Id()) - << " orbitNumber:" << int(amcData.orbitNumber()); + uint16_t amcBx = amc.bunchCrossing(); + LogDebug("GEMRawToDigiModule") << "AMC no.:" << int(amc.amcNum()) << " bx:" << int(amc.bunchCrossing()) + << " lv1Id:" << int(amc.lv1Id()) << " orbitNumber:" << int(amc.orbitNumber()); // Read GEB data - for (auto optoHybrid : *amcData.gebs()) { + for (const auto& optoHybrid : *amc.gebs()) { uint8_t gebId = optoHybrid.inputID(); GEMROMapping::chamEC geb_ec{fedId, amcNum, gebId}; @@ -199,10 +174,10 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve } //Read vfat data - for (auto vfatData : *optoHybrid.vFATs()) { + for (auto vfat : *optoHybrid.vFATs()) { // set vfat fw version - vfatData.setVersion(geb_dc.vfatVer); - uint16_t vfatId = vfatData.vfatId(); + vfat.setVersion(geb_dc.vfatVer); + uint16_t vfatId = vfat.vfatId(); GEMROMapping::vfatEC vfat_ec{vfatId, gemChId}; if (!gemROMap->isValidChipID(vfat_ec)) { @@ -211,10 +186,10 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve } GEMROMapping::vfatDC vfat_dc = gemROMap->vfatPos(vfat_ec); - vfatData.setPhi(vfat_dc.localPhi); + vfat.setPhi(vfat_dc.localPhi); GEMDetId gemId = vfat_dc.detId; - GEMVFATStatus st_vfat(amcData, vfatData, vfatData.phi(), readMultiBX_); + GEMVFATStatus st_vfat(amc, vfat, vfat.phi(), readMultiBX_); if (st_vfat.isBad()) { LogDebug("GEMRawToDigiModule") << st_vfat; if (keepDAQStatus_) { @@ -223,14 +198,14 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve continue; } - int bx(vfatData.bc() - amcBx); + int bx(vfat.bc() - amcBx); - for (int chan = 0; chan < VFATdata::nChannels; ++chan) { + for (int chan = 0; chan < GEMVFAT::nChannels; ++chan) { uint8_t chan0xf = 0; if (chan < 64) - chan0xf = ((vfatData.lsData() >> chan) & 0x1); + chan0xf = ((vfat.lsData() >> chan) & 0x1); else - chan0xf = ((vfatData.msData() >> (chan - 64)) & 0x1); + chan0xf = ((vfat.msData() >> (chan - 64)) & 0x1); // no hits if (chan0xf == 0) @@ -239,7 +214,7 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve GEMROMapping::channelNum chMap{vfat_dc.vfatType, chan}; GEMROMapping::stripNum stMap = gemROMap->hitPos(chMap); - int stripId = stMap.stNum + vfatData.phi() * GEMeMap::maxChan_; + int stripId = stMap.stNum + vfat.phi() * GEMeMap::maxChan_; GEMDigi digi(stripId, bx); @@ -255,29 +230,18 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve if (keepDAQStatus_) { outVFATStatus.get()->insertDigi(gemId, st_vfat); } - if (unPackStatusDigis_) { - outVFATStatusOld.get()->insertDigi(gemId, GEMVfatStatusDigi(vfatData)); - } } // end of vfat loop if (keepDAQStatus_) { outOHStatus.get()->insertDigi(gemChId, st_oh); } - if (unPackStatusDigis_) { - optoHybrid.clearVFATs(); - outGEBStatus.get()->insertDigi(gemChId.chamberId(), (optoHybrid)); - } } // end of optohybrid loop if (keepDAQStatus_) { outAMCStatus.get()->insertDigi(fedId, st_amc); } - if (unPackStatusDigis_) { - amcData.clearGEBs(); - outAMCdata.get()->insertDigi(amcData.boardId(), (amcData)); - } } // end of amc loop @@ -285,11 +249,7 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve outAMC13Status.get()->insertDigi(fedId, st_amc13); } - if (unPackStatusDigis_) { - amc13Event->clearAMCpayloads(); - } - - } // end of amc13Event + } // end of amc13 iEvent.put(std::move(outGEMDigis)); @@ -299,11 +259,4 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve iEvent.put(std::move(outOHStatus), "OHStatus"); iEvent.put(std::move(outVFATStatus), "VFATStatus"); } - if (unPackStatusDigis_) { - // to be removed - iEvent.put(std::move(outVFATStatusOld), "vfatStatus"); - iEvent.put(std::move(outGEBStatus), "gebStatus"); - iEvent.put(std::move(outAMCdata), "AMCdata"); - iEvent.put(std::move(outAMC13Event), "AMC13Event"); - } } diff --git a/EventFilter/GEMRawToDigi/src/GEMRawToDigi.cc b/EventFilter/GEMRawToDigi/src/GEMRawToDigi.cc index 3151d7a180332..6adaaff75fdbf 100644 --- a/EventFilter/GEMRawToDigi/src/GEMRawToDigi.cc +++ b/EventFilter/GEMRawToDigi/src/GEMRawToDigi.cc @@ -3,56 +3,55 @@ */ #include "EventFilter/GEMRawToDigi/interface/GEMRawToDigi.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -using namespace gem; -std::unique_ptr GEMRawToDigi::convertWordToAMC13Event(const uint64_t* word) { +std::unique_ptr GEMRawToDigi::convertWordToGEMAMC13(const uint64_t* word) { vfatError_ = false; amcError_ = false; - auto amc13Event = std::make_unique(); + auto amc13 = std::make_unique(); - amc13Event->setCDFHeader(*word); - amc13Event->setAMC13Header(*(++word)); + amc13->setCDFHeader(*word); + amc13->setAMC13Header(*(++word)); // Readout out AMC headers - for (uint8_t i = 0; i < amc13Event->nAMC(); ++i) - amc13Event->addAMCheader(*(++word)); + for (uint8_t i = 0; i < amc13->nAMC(); ++i) + amc13->addAMCheader(*(++word)); // Readout out AMC payloads - for (uint8_t i = 0; i < amc13Event->nAMC(); ++i) { - auto amcData = AMCdata(); - amcData.setAMCheader1(*(++word)); - amcData.setAMCheader2(*(++word)); - amcData.setGEMeventHeader(*(++word)); + for (uint8_t i = 0; i < amc13->nAMC(); ++i) { + auto amc = GEMAMC(); + amc.setAMCheader1(*(++word)); + amc.setAMCheader2(*(++word)); + amc.setGEMeventHeader(*(++word)); // Fill GEB - for (uint8_t j = 0; j < amcData.davCnt(); ++j) { - auto gebData = GEBdata(); - gebData.setChamberHeader(*(++word)); + for (uint8_t j = 0; j < amc.davCnt(); ++j) { + auto oh = GEMOptoHybrid(); + oh.setChamberHeader(*(++word)); // Fill vfat - for (uint16_t k = 0; k < gebData.vfatWordCnt() / 3; k++) { - auto vfatData = VFATdata(); - vfatData.read_fw(*(++word)); - vfatData.read_sw(*(++word)); - vfatData.read_tw(*(++word)); - gebData.addVFAT(vfatData); + for (uint16_t k = 0; k < oh.vfatWordCnt() / 3; k++) { + auto vfat = GEMVFAT(); + vfat.read_fw(*(++word)); + vfat.read_sw(*(++word)); + vfat.read_tw(*(++word)); + oh.addVFAT(vfat); } // end of vfat loop - gebData.setChamberTrailer(*(++word)); - amcData.addGEB(gebData); + oh.setChamberTrailer(*(++word)); + amc.addGEB(oh); } // end of geb loop - amcData.setGEMeventTrailer(*(++word)); - amcData.setAMCTrailer(*(++word)); - amc13Event->addAMCpayload(amcData); + amc.setGEMeventTrailer(*(++word)); + amc.setAMCTrailer(*(++word)); + amc13->addAMCpayload(amc); } // end of amc loop - amc13Event->setAMC13Trailer(*(++word)); - amc13Event->setCDFTrailer(*(++word)); + amc13->setAMC13Trailer(*(++word)); + amc13->setCDFTrailer(*(++word)); - return amc13Event; + return amc13; } diff --git a/EventFilter/GEMRawToDigi/test/gemUnPackerTester.py b/EventFilter/GEMRawToDigi/test/gemUnPackerTester.py index ac7bfdfeab3e1..b21d5f3d2820f 100755 --- a/EventFilter/GEMRawToDigi/test/gemUnPackerTester.py +++ b/EventFilter/GEMRawToDigi/test/gemUnPackerTester.py @@ -1,8 +1,6 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Era_Run3_cff import Run3 -from Configuration.Eras.Era_Phase2C11I13M9_cff import Phase2C11I13M9 -process = cms.Process('gemTester', Phase2C11I13M9) +process = cms.Process('gemTester') process.load('FWCore.MessageService.MessageLogger_cfi') process.load('Configuration.StandardSequences.DigiToRaw_cff') @@ -11,14 +9,13 @@ process.load('Configuration.EventContent.EventContent_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') -process.maxEvents.input = cms.untracked.int32(10) +process.maxEvents.input = cms.untracked.int32(1000) from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, '113X_mcRun4_realistic_v4', '') process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T21', '') -#process.gemPacker.useDBEMap = True -#process.muonGEMDigis.readMultiBX = True +process.gemPacker.useDBEMap = False +process.muonGEMDigis.readMultiBX = True process.muonGEMDigis.useDBEMap = process.gemPacker.useDBEMap process.muonGEMDigis.keepDAQStatus = True @@ -49,5 +46,5 @@ process.p = cms.Path(process.gemPacker+process.rawDataCollector+process.muonGEMDigis+process.GEMPackingTester) -print 'useDBEMap', process.gemPacker.useDBEMap, process.muonGEMDigis.useDBEMap -print 'readMultiBX', process.muonGEMDigis.readMultiBX +print('useDBEMap', process.gemPacker.useDBEMap, process.muonGEMDigis.useDBEMap) +print('readMultiBX', process.muonGEMDigis.readMultiBX) diff --git a/EventFilter/Utilities/interface/EvFDaqDirector.h b/EventFilter/Utilities/interface/EvFDaqDirector.h index fbc0881ead2d4..2043ce884727e 100644 --- a/EventFilter/Utilities/interface/EvFDaqDirector.h +++ b/EventFilter/Utilities/interface/EvFDaqDirector.h @@ -172,6 +172,7 @@ namespace evf { void createProcessingNotificationMaybe() const; int readLastLSEntry(std::string const& file); unsigned int getLumisectionToStart() const; + unsigned int getStartLumisectionFromEnv() const { return startFromLS_; } void setDeleteTracking(std::mutex* fileDeleteLock, std::list>>* filesToDelete) { fileDeleteLockPtr_ = fileDeleteLock; diff --git a/EventFilter/Utilities/src/EvFDaqDirector.cc b/EventFilter/Utilities/src/EvFDaqDirector.cc index 5943bee8c0c48..1a8aa796e8ed5 100644 --- a/EventFilter/Utilities/src/EvFDaqDirector.cc +++ b/EventFilter/Utilities/src/EvFDaqDirector.cc @@ -123,7 +123,7 @@ namespace evf { socket_ = std::make_unique(io_service_); } - char* startFromLSPtr = std::getenv("FFF_STARTFROMLS"); + char* startFromLSPtr = std::getenv("FFF_START_LUMISECTION"); if (startFromLSPtr) { try { startFromLS_ = boost::lexical_cast(std::string(startFromLSPtr)); @@ -1863,7 +1863,7 @@ namespace evf { std::string fileprefix = run_dir_ + "/" + run_string_ + "_ls"; std::string fullpath; struct stat buf; - unsigned int lscount = startFromLS_; + unsigned int lscount = 1; do { std::stringstream ss; ss << fileprefix << std::setfill('0') << std::setw(4) << lscount << "_EoLS.jsn"; diff --git a/EventFilter/Utilities/src/FedRawDataInputSource.cc b/EventFilter/Utilities/src/FedRawDataInputSource.cc index e39363529cbaa..486b11633c15a 100644 --- a/EventFilter/Utilities/src/FedRawDataInputSource.cc +++ b/EventFilter/Utilities/src/FedRawDataInputSource.cc @@ -921,7 +921,21 @@ void FedRawDataInputSource::readSupervisor() { } else { //new file service if (currentLumiSection == 0 && !alwaysStartFromFirstLS_) { - if (ls < 100) { + if (daqDirector_->getStartLumisectionFromEnv() > 1) { + //start transitions from LS specified by env, continue if not reached + if (ls < daqDirector_->getStartLumisectionFromEnv()) { + //skip file if from earlier LS than specified by env + if (rawFd != -1) { + close(rawFd); + rawFd = -1; + } + status = evf::EvFDaqDirector::noFile; + continue; + } else { + std::unique_ptr inf(new InputFile(evf::EvFDaqDirector::newLumi, ls)); + fileQueue_.push(std::move(inf)); + } + } else if (ls < 100) { //look at last LS file on disk to start from that lumisection (only within first 100 LS) unsigned int lsToStart = daqDirector_->getLumisectionToStart(); diff --git a/FWCore/Framework/interface/ConstProductRegistry.h b/FWCore/Framework/interface/ConstProductRegistry.h index 5800d492eb7cd..1cbf38671a011 100644 --- a/FWCore/Framework/interface/ConstProductRegistry.h +++ b/FWCore/Framework/interface/ConstProductRegistry.h @@ -23,7 +23,7 @@ Description: Provides a 'service' interface to the ProductRegistry #include // user include files -#include "FWCore/Framework/src/SignallingProductRegistry.h" +#include "FWCore/Framework/interface/SignallingProductRegistry.h" #include "FWCore/ServiceRegistry/interface/connect_but_block_self.h" #include "FWCore/Utilities/interface/propagate_const.h" diff --git a/FWCore/Framework/src/EarlyDeleteHelper.h b/FWCore/Framework/interface/EarlyDeleteHelper.h similarity index 100% rename from FWCore/Framework/src/EarlyDeleteHelper.h rename to FWCore/Framework/interface/EarlyDeleteHelper.h diff --git a/FWCore/Framework/interface/EventProcessor.h b/FWCore/Framework/interface/EventProcessor.h index 8f4cf4b1264d8..89c604e946a95 100644 --- a/FWCore/Framework/interface/EventProcessor.h +++ b/FWCore/Framework/interface/EventProcessor.h @@ -18,9 +18,9 @@ configured in the user's main() function, and is set running. #include "FWCore/Framework/interface/MergeableRunProductProcesses.h" #include "FWCore/Framework/interface/PathsAndConsumesOfModules.h" #include "FWCore/Framework/interface/SharedResourcesAcquirer.h" -#include "FWCore/Framework/src/PrincipalCache.h" -#include "FWCore/Framework/src/SignallingProductRegistry.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PrincipalCache.h" +#include "FWCore/Framework/interface/SignallingProductRegistry.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" diff --git a/FWCore/Framework/src/EventSetupsController.h b/FWCore/Framework/interface/EventSetupsController.h similarity index 100% rename from FWCore/Framework/src/EventSetupsController.h rename to FWCore/Framework/interface/EventSetupsController.h diff --git a/FWCore/Framework/src/GlobalSchedule.h b/FWCore/Framework/interface/GlobalSchedule.h similarity index 98% rename from FWCore/Framework/src/GlobalSchedule.h rename to FWCore/Framework/interface/GlobalSchedule.h index 43e8b24a0f38c..6cc5f427efcb0 100644 --- a/FWCore/Framework/src/GlobalSchedule.h +++ b/FWCore/Framework/interface/GlobalSchedule.h @@ -15,8 +15,8 @@ #include "FWCore/Framework/interface/ProcessBlockPrincipal.h" #include "FWCore/Framework/interface/RunPrincipal.h" #include "FWCore/Framework/interface/WorkerManager.h" -#include "FWCore/Framework/src/Worker.h" -#include "FWCore/Framework/src/WorkerRegistry.h" +#include "FWCore/Framework/interface/maker/Worker.h" +#include "FWCore/Framework/interface/WorkerRegistry.h" #include "FWCore/MessageLogger/interface/ExceptionMessages.h" #include "FWCore/ServiceRegistry/interface/GlobalContext.h" #include "FWCore/Utilities/interface/Algorithms.h" diff --git a/FWCore/Framework/interface/InputSourceDescription.h b/FWCore/Framework/interface/InputSourceDescription.h index 5aafcbc743b22..f865fdc8cb65c 100644 --- a/FWCore/Framework/interface/InputSourceDescription.h +++ b/FWCore/Framework/interface/InputSourceDescription.h @@ -9,7 +9,7 @@ input source that does not come in through the ParameterSet #include #include "DataFormats/Provenance/interface/ModuleDescription.h" #include "FWCore/Common/interface/FWCoreCommonFwd.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" namespace edm { class ProductRegistry; diff --git a/FWCore/Framework/interface/InputSourceMacros.h b/FWCore/Framework/interface/InputSourceMacros.h index 14d4fd393f4bc..6ec8e239ffbf8 100644 --- a/FWCore/Framework/interface/InputSourceMacros.h +++ b/FWCore/Framework/interface/InputSourceMacros.h @@ -1,7 +1,7 @@ #ifndef FWCore_Framework_InputSourceMacros_h #define FWCore_Framework_InputSourceMacros_h -#include "FWCore/Framework/src/InputSourceFactory.h" +#include "FWCore/Framework/interface/maker/InputSourceFactory.h" #include "FWCore/Framework/interface/InputSource.h" #include "FWCore/ParameterSet/interface/ParameterSetDescriptionFillerPluginFactory.h" diff --git a/FWCore/Framework/interface/MakerMacros.h b/FWCore/Framework/interface/MakerMacros.h index b2edd882fdf3b..756e599d09807 100644 --- a/FWCore/Framework/interface/MakerMacros.h +++ b/FWCore/Framework/interface/MakerMacros.h @@ -1,8 +1,8 @@ #ifndef Framework_MakerMacros_h #define Framework_MakerMacros_h -#include "FWCore/Framework/src/Factory.h" -#include "FWCore/Framework/src/WorkerMaker.h" +#include "FWCore/Framework/interface/maker/MakerPluginFactory.h" +#include "FWCore/Framework/interface/maker/WorkerMaker.h" #include "FWCore/ParameterSet/interface/ParameterSetDescriptionFillerPluginFactory.h" // The following includes are temporary until a better // solution can be found. Placing these includes here @@ -11,7 +11,7 @@ // implementation file (one every for each XXXWorker) and // then include all the relevent worker headers in the // implementation file only. -#include "FWCore/Framework/src/WorkerT.h" +#include "FWCore/Framework/interface/maker/WorkerT.h" #define DEFINE_FWK_MODULE(type) \ DEFINE_EDM_PLUGIN(edm::MakerPluginFactory, edm::WorkerMaker, #type); \ diff --git a/FWCore/Framework/src/ModuleRegistry.h b/FWCore/Framework/interface/ModuleRegistry.h similarity index 98% rename from FWCore/Framework/src/ModuleRegistry.h rename to FWCore/Framework/interface/ModuleRegistry.h index 4978ee6e2c6ee..9f2ab2cf4ea07 100644 --- a/FWCore/Framework/src/ModuleRegistry.h +++ b/FWCore/Framework/interface/ModuleRegistry.h @@ -5,7 +5,7 @@ // Package: FWCore/Framework // Class : ModuleRegistry // -/**\class edm::ModuleRegistry ModuleRegistry.h "FWCore/Framework/src/ModuleRegistry.h" +/**\class edm::ModuleRegistry ModuleRegistry.h "FWCore/Framework/interface/ModuleRegistry.h" Description: Constructs and owns framework modules diff --git a/FWCore/Framework/interface/OccurrenceTraits.h b/FWCore/Framework/interface/OccurrenceTraits.h index 0844cc1c8588b..6cff691267140 100644 --- a/FWCore/Framework/interface/OccurrenceTraits.h +++ b/FWCore/Framework/interface/OccurrenceTraits.h @@ -15,7 +15,7 @@ #include "FWCore/Framework/interface/ProcessBlockPrincipal.h" #include "FWCore/Utilities/interface/RunIndex.h" #include "FWCore/Framework/interface/RunPrincipal.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h" #include "FWCore/ServiceRegistry/interface/GlobalContext.h" #include "FWCore/ServiceRegistry/interface/ModuleCallingContext.h" diff --git a/FWCore/Framework/src/OutputModuleCommunicator.h b/FWCore/Framework/interface/OutputModuleCommunicator.h similarity index 100% rename from FWCore/Framework/src/OutputModuleCommunicator.h rename to FWCore/Framework/interface/OutputModuleCommunicator.h diff --git a/FWCore/Framework/src/OutputModuleCommunicatorT.h b/FWCore/Framework/interface/OutputModuleCommunicatorT.h similarity index 98% rename from FWCore/Framework/src/OutputModuleCommunicatorT.h rename to FWCore/Framework/interface/OutputModuleCommunicatorT.h index b4ee6165a646e..67db5a94be5fb 100644 --- a/FWCore/Framework/src/OutputModuleCommunicatorT.h +++ b/FWCore/Framework/interface/OutputModuleCommunicatorT.h @@ -4,7 +4,7 @@ /*---------------------------------------------------------------------- ----------------------------------------------------------------------*/ -#include "FWCore/Framework/src/OutputModuleCommunicator.h" +#include "FWCore/Framework/interface/OutputModuleCommunicator.h" #include "FWCore/Common/interface/FWCoreCommonFwd.h" namespace edm { diff --git a/FWCore/Framework/src/Path.h b/FWCore/Framework/interface/Path.h similarity index 98% rename from FWCore/Framework/src/Path.h rename to FWCore/Framework/interface/Path.h index ac340a48ac681..4f95fc872cbf1 100644 --- a/FWCore/Framework/src/Path.h +++ b/FWCore/Framework/interface/Path.h @@ -11,8 +11,8 @@ can be kept for each worker. */ -#include "FWCore/Framework/src/WorkerInPath.h" -#include "FWCore/Framework/src/Worker.h" +#include "FWCore/Framework/interface/WorkerInPath.h" +#include "FWCore/Framework/interface/maker/Worker.h" #include "DataFormats/Common/interface/HLTenums.h" #include "DataFormats/Common/interface/TriggerResults.h" #include "FWCore/ServiceRegistry/interface/PathContext.h" diff --git a/FWCore/Framework/src/PreallocationConfiguration.h b/FWCore/Framework/interface/PreallocationConfiguration.h similarity index 100% rename from FWCore/Framework/src/PreallocationConfiguration.h rename to FWCore/Framework/interface/PreallocationConfiguration.h diff --git a/FWCore/Framework/src/PrincipalCache.h b/FWCore/Framework/interface/PrincipalCache.h similarity index 100% rename from FWCore/Framework/src/PrincipalCache.h rename to FWCore/Framework/interface/PrincipalCache.h diff --git a/FWCore/Framework/interface/ProducerBase.h b/FWCore/Framework/interface/ProducerBase.h index 98eff23835fbb..4a971b3bdf85c 100644 --- a/FWCore/Framework/interface/ProducerBase.h +++ b/FWCore/Framework/interface/ProducerBase.h @@ -9,6 +9,7 @@ EDProducts into an Event. ----------------------------------------------------------------------*/ #include "FWCore/Framework/interface/ProductRegistryHelper.h" +#include "FWCore/Framework/interface/ProducesCollector.h" #include "FWCore/Utilities/interface/ProductResolverIndex.h" #include diff --git a/FWCore/Framework/interface/ProducesCollector.h b/FWCore/Framework/interface/ProducesCollector.h index ae2abb2d324ee..d31ceaa7d66dd 100644 --- a/FWCore/Framework/interface/ProducesCollector.h +++ b/FWCore/Framework/interface/ProducesCollector.h @@ -39,6 +39,8 @@ a functor passed to the Framework with a call to callWhenNewProductsRegistered. namespace edm { class TypeID; + template + class ProducesCollectorAdaptor; class ProducesCollector { public: @@ -68,6 +70,15 @@ namespace edm { return helper_->produces(std::move(instanceName)); } + template + [[nodiscard]] auto produces(std::string instanceName) noexcept { + return ProducesCollectorAdaptor
(*this, std::move(instanceName)); + } + template + [[nodiscard]] auto produces() noexcept { + return ProducesCollectorAdaptor
(*this); + } + ProductRegistryHelper::BranchAliasSetter produces(const TypeID& id, std::string instanceName = std::string(), bool recordProvenance = true); @@ -86,5 +97,27 @@ namespace edm { propagate_const helper_; }; + template + class ProducesCollectorAdaptor { + public: + using Adapter = ProducesCollectorAdaptor
; + + template + EDPutTokenT produces() { + return m_producer.template produces(m_label); + } + + private: + //only ProducesCollector is allowed to make an instance of this class + friend class ProducesCollector; + + ProducesCollectorAdaptor(ProducesCollector iBase, std::string iLabel) + : m_producer(iBase), m_label(std::move(iLabel)) {} + ProducesCollectorAdaptor(ProducesCollector iBase) : m_producer(iBase), m_label() {} + + ProducesCollector m_producer; + std::string const m_label; + }; + } // namespace edm #endif diff --git a/FWCore/Framework/src/ProductPutterBase.h b/FWCore/Framework/interface/ProductPutterBase.h similarity index 100% rename from FWCore/Framework/src/ProductPutterBase.h rename to FWCore/Framework/interface/ProductPutterBase.h diff --git a/FWCore/Framework/interface/ProductRegistryHelper.h b/FWCore/Framework/interface/ProductRegistryHelper.h index 72c0087dd2278..c13a95a11fe16 100644 --- a/FWCore/Framework/interface/ProductRegistryHelper.h +++ b/FWCore/Framework/interface/ProductRegistryHelper.h @@ -20,6 +20,9 @@ namespace edm { class ProductRegistry; struct DoNotRecordParents; + template + class ProductRegistryHelperAdaptor; + class ProductRegistryHelper { public: virtual ~ProductRegistryHelper() noexcept(false); @@ -79,6 +82,12 @@ namespace edm { TypeLabelItem& value_; EDPutTokenT token_; + template + EDPutTokenT produces() { + static_assert(std::is_same_v); + return token_; + } + operator EDPutTokenT() { return token_; } operator EDPutToken() { return EDPutToken(token_.index()); } }; @@ -104,6 +113,15 @@ namespace edm { \endcode should be added to the producer ctor for every product */ + template + [[nodiscard]] auto produces(std::string instanceName) noexcept { + return ProductRegistryHelperAdaptor(*this, std::move(instanceName)); + } + template + [[nodiscard]] auto produces() noexcept { + return ProductRegistryHelperAdaptor(*this); + } + template BranchAliasSetterT produces() { return produces(std::string()); @@ -177,6 +195,26 @@ namespace edm { std::vector recordProvenanceList_; }; + template + class ProductRegistryHelperAdaptor { + public: + template + EDPutTokenT produces() { + return m_helper.template produces(m_label); + } + + private: + //only ProductRegistryHelper is allowed to make an instance of this class + friend class ProductRegistryHelper; + + ProductRegistryHelperAdaptor(ProductRegistryHelper& iBase, std::string iLabel) + : m_helper(iBase), m_label(std::move(iLabel)) {} + explicit ProductRegistryHelperAdaptor(ProductRegistryHelper& iBase) : m_helper(iBase), m_label() {} + + ProductRegistryHelper& m_helper; + std::string const m_label; + }; + } // namespace edm #endif diff --git a/FWCore/Framework/interface/Schedule.h b/FWCore/Framework/interface/Schedule.h index ad3204e8246a0..4bf25e4c2f935 100644 --- a/FWCore/Framework/interface/Schedule.h +++ b/FWCore/Framework/interface/Schedule.h @@ -64,12 +64,12 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" #include "FWCore/Framework/interface/WorkerManager.h" -#include "FWCore/Framework/src/Worker.h" -#include "FWCore/Framework/src/WorkerRegistry.h" -#include "FWCore/Framework/src/GlobalSchedule.h" -#include "FWCore/Framework/src/StreamSchedule.h" -#include "FWCore/Framework/src/SystemTimeKeeper.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/maker/Worker.h" +#include "FWCore/Framework/interface/WorkerRegistry.h" +#include "FWCore/Framework/interface/GlobalSchedule.h" +#include "FWCore/Framework/interface/StreamSchedule.h" +#include "FWCore/Framework/interface/SystemTimeKeeper.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/MessageLogger/interface/ExceptionMessages.h" #include "FWCore/MessageLogger/interface/JobReport.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" diff --git a/FWCore/Framework/src/SharedResourcesRegistry.h b/FWCore/Framework/interface/SharedResourcesRegistry.h similarity index 100% rename from FWCore/Framework/src/SharedResourcesRegistry.h rename to FWCore/Framework/interface/SharedResourcesRegistry.h diff --git a/FWCore/Framework/src/SignallingProductRegistry.h b/FWCore/Framework/interface/SignallingProductRegistry.h similarity index 100% rename from FWCore/Framework/src/SignallingProductRegistry.h rename to FWCore/Framework/interface/SignallingProductRegistry.h diff --git a/FWCore/Framework/src/StreamSchedule.h b/FWCore/Framework/interface/StreamSchedule.h similarity index 98% rename from FWCore/Framework/src/StreamSchedule.h rename to FWCore/Framework/interface/StreamSchedule.h index d2dcfcde48f5c..563b03a03f767 100644 --- a/FWCore/Framework/src/StreamSchedule.h +++ b/FWCore/Framework/interface/StreamSchedule.h @@ -67,11 +67,11 @@ #include "FWCore/Framework/interface/UnscheduledCallProducer.h" #include "FWCore/Framework/interface/WorkerManager.h" #include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/src/Path.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" -#include "FWCore/Framework/src/Worker.h" -#include "FWCore/Framework/src/WorkerRegistry.h" -#include "FWCore/Framework/src/EarlyDeleteHelper.h" +#include "FWCore/Framework/interface/Path.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/maker/Worker.h" +#include "FWCore/Framework/interface/WorkerRegistry.h" +#include "FWCore/Framework/interface/EarlyDeleteHelper.h" #include "FWCore/MessageLogger/interface/ExceptionMessages.h" #include "FWCore/MessageLogger/interface/JobReport.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" diff --git a/FWCore/Framework/src/SystemTimeKeeper.h b/FWCore/Framework/interface/SystemTimeKeeper.h similarity index 96% rename from FWCore/Framework/src/SystemTimeKeeper.h rename to FWCore/Framework/interface/SystemTimeKeeper.h index 6361d72e728f1..7fbc9e917dd2c 100644 --- a/FWCore/Framework/src/SystemTimeKeeper.h +++ b/FWCore/Framework/interface/SystemTimeKeeper.h @@ -26,6 +26,7 @@ // user include files #include "FWCore/Utilities/interface/CPUTimer.h" +#include "FWCore/Utilities/interface/ChildrenCPUTimer.h" #include "FWCore/Utilities/interface/WallclockTimer.h" // forward declarations @@ -106,6 +107,7 @@ namespace edm { std::vector> m_modulesOnPaths; CPUTimer m_processingLoopTimer; + ChildrenCPUTimer m_processingLoopChildrenTimer; ProcessContext const* m_processContext; unsigned int m_minModuleID; diff --git a/FWCore/Framework/src/TransitionInfoTypes.h b/FWCore/Framework/interface/TransitionInfoTypes.h similarity index 100% rename from FWCore/Framework/src/TransitionInfoTypes.h rename to FWCore/Framework/interface/TransitionInfoTypes.h diff --git a/FWCore/Framework/src/UnscheduledAuxiliary.h b/FWCore/Framework/interface/UnscheduledAuxiliary.h similarity index 89% rename from FWCore/Framework/src/UnscheduledAuxiliary.h rename to FWCore/Framework/interface/UnscheduledAuxiliary.h index 9767372687d80..5b587e1c6aab9 100644 --- a/FWCore/Framework/src/UnscheduledAuxiliary.h +++ b/FWCore/Framework/interface/UnscheduledAuxiliary.h @@ -5,7 +5,7 @@ // Package: FWCore/Framework // Class : UnscheduledAuxiliary // -/**\class UnscheduledAuxiliary UnscheduledAuxiliary.h "UnscheduledAuxiliary.h" +/**\class UnscheduledAuxiliary UnscheduledAuxiliary.h "FWCore/Framework/interface/UnscheduledAuxiliary.h" Description: Holds auxiliary information needed for unscheduled calls to EDProducers @@ -21,7 +21,7 @@ // system include files // user include files -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/Utilities/interface/Signal.h" // forward declarations diff --git a/FWCore/Framework/interface/UnscheduledCallProducer.h b/FWCore/Framework/interface/UnscheduledCallProducer.h index 543085b3c8ac6..65d5b29ab1950 100644 --- a/FWCore/Framework/interface/UnscheduledCallProducer.h +++ b/FWCore/Framework/interface/UnscheduledCallProducer.h @@ -18,8 +18,8 @@ #include "FWCore/Framework/interface/BranchActionType.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" -#include "FWCore/Framework/src/Worker.h" -#include "FWCore/Framework/src/UnscheduledAuxiliary.h" +#include "FWCore/Framework/interface/maker/Worker.h" +#include "FWCore/Framework/interface/UnscheduledAuxiliary.h" #include "FWCore/Concurrency/interface/WaitingTaskHolder.h" #include "FWCore/ServiceRegistry/interface/ParentContext.h" #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h" diff --git a/FWCore/Framework/src/WorkerInPath.h b/FWCore/Framework/interface/WorkerInPath.h similarity index 98% rename from FWCore/Framework/src/WorkerInPath.h rename to FWCore/Framework/interface/WorkerInPath.h index 36292cc3981f8..f57721a6e8b3a 100644 --- a/FWCore/Framework/src/WorkerInPath.h +++ b/FWCore/Framework/interface/WorkerInPath.h @@ -11,7 +11,7 @@ */ -#include "FWCore/Framework/src/Worker.h" +#include "FWCore/Framework/interface/maker/Worker.h" #include "FWCore/Concurrency/interface/WaitingTaskHolder.h" #include "FWCore/ServiceRegistry/interface/ParentContext.h" #include "FWCore/ServiceRegistry/interface/PlaceInPathContext.h" diff --git a/FWCore/Framework/interface/WorkerManager.h b/FWCore/Framework/interface/WorkerManager.h index 01b212849364e..d6e185628f3f5 100644 --- a/FWCore/Framework/interface/WorkerManager.h +++ b/FWCore/Framework/interface/WorkerManager.h @@ -9,8 +9,8 @@ #include "FWCore/Framework/interface/ExceptionHelpers.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/UnscheduledCallProducer.h" -#include "FWCore/Framework/src/Worker.h" -#include "FWCore/Framework/src/WorkerRegistry.h" +#include "FWCore/Framework/interface/maker/Worker.h" +#include "FWCore/Framework/interface/WorkerRegistry.h" #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" #include "FWCore/Concurrency/interface/WaitingTaskHolder.h" #include "FWCore/Utilities/interface/ConvertException.h" diff --git a/FWCore/Framework/src/WorkerRegistry.h b/FWCore/Framework/interface/WorkerRegistry.h similarity index 100% rename from FWCore/Framework/src/WorkerRegistry.h rename to FWCore/Framework/interface/WorkerRegistry.h diff --git a/FWCore/Framework/src/globalTransitionAsync.h b/FWCore/Framework/interface/globalTransitionAsync.h similarity index 62% rename from FWCore/Framework/src/globalTransitionAsync.h rename to FWCore/Framework/interface/globalTransitionAsync.h index b0ee00f7a6c96..c54b58af08e25 100644 --- a/FWCore/Framework/src/globalTransitionAsync.h +++ b/FWCore/Framework/interface/globalTransitionAsync.h @@ -20,9 +20,10 @@ #include "FWCore/Framework/interface/Schedule.h" #include "FWCore/Framework/src/SubProcess.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/Concurrency/interface/WaitingTask.h" #include "FWCore/Concurrency/interface/WaitingTaskHolder.h" +#include "FWCore/Concurrency/interface/chain_first.h" #include #include @@ -85,25 +86,29 @@ namespace edm { bool cleaningUpAfterException = false) { // When we are done processing the global for this process, // we need to run the global for all SubProcesses - auto subs = make_waiting_task([&iSubProcesses, iWait, info = transitionInfo, cleaningUpAfterException]( - std::exception_ptr const* iPtr) mutable { - if (iPtr) { - auto excpt = *iPtr; - auto delayError = - make_waiting_task([iWait, excpt](std::exception_ptr const*) mutable { iWait.doneWaiting(excpt); }); - WaitingTaskHolder h(*iWait.group(), delayError); - for (auto& subProcess : iSubProcesses) { - subProcessDoGlobalBeginTransitionAsync(h, subProcess, info, cleaningUpAfterException); - } - } else { - for (auto& subProcess : iSubProcesses) { - subProcessDoGlobalBeginTransitionAsync(iWait, subProcess, info, cleaningUpAfterException); - } - } - }); - - WaitingTaskHolder h(*iWait.group(), subs); - iSchedule.processOneGlobalAsync(std::move(h), transitionInfo, token, cleaningUpAfterException); + using namespace edm::waiting_task; + + chain::first([&](auto nextTask) { + iSchedule.processOneGlobalAsync(std::move(nextTask), transitionInfo, token, cleaningUpAfterException); + }) | + chain::then([&iSubProcesses, info = transitionInfo, cleaningUpAfterException](std::exception_ptr const* iPtr, + auto nextTask) { + if (iPtr) { + //delay handling exception until after subProcesses run + chain::first([&](auto nextTask) { + for (auto& subProcess : iSubProcesses) { + subProcessDoGlobalBeginTransitionAsync(nextTask, subProcess, info, cleaningUpAfterException); + } + }) | chain::then([excpt = *iPtr](std::exception_ptr const*, auto nextTask) { + nextTask.doneWaiting(excpt); + }) | chain::runLast(nextTask); + } else { + for (auto& subProcess : iSubProcesses) { + subProcessDoGlobalBeginTransitionAsync(nextTask, subProcess, info, cleaningUpAfterException); + } + } + }) | + chain::runLast(iWait); } template @@ -113,27 +118,30 @@ namespace edm { ServiceToken const& token, std::vector& iSubProcesses, bool cleaningUpAfterException) { - // When we are done processing the global for this process, - // we need to run the global for all SubProcesses - auto subs = make_waiting_task([&iSubProcesses, iWait, info = transitionInfo, cleaningUpAfterException]( - std::exception_ptr const* iPtr) mutable { - if (iPtr) { - auto excpt = *iPtr; - auto delayError = - make_waiting_task([iWait, excpt](std::exception_ptr const*) mutable { iWait.doneWaiting(excpt); }); - WaitingTaskHolder h(*iWait.group(), delayError); - for (auto& subProcess : iSubProcesses) { - subProcessDoGlobalEndTransitionAsync(h, subProcess, info, cleaningUpAfterException); - } - } else { - for (auto& subProcess : iSubProcesses) { - subProcessDoGlobalEndTransitionAsync(iWait, subProcess, info, cleaningUpAfterException); - } - } - }); - - WaitingTaskHolder h(*iWait.group(), subs); - iSchedule.processOneGlobalAsync(std::move(h), transitionInfo, token, cleaningUpAfterException); + using namespace edm::waiting_task; + chain::first([&](auto nextTask) { + iSchedule.processOneGlobalAsync(std::move(nextTask), transitionInfo, token, cleaningUpAfterException); + }) + // When we are done processing the global for this process, + // we need to run the global for all SubProcesses + | chain::then([&iSubProcesses, info = transitionInfo, cleaningUpAfterException](std::exception_ptr const* iPtr, + auto nextTask) { + if (iPtr) { + //still run the sub process but pass this exception to the nextTask + auto excpt = *iPtr; + chain::first([&](auto nextTask) { + for (auto& subProcess : iSubProcesses) { + subProcessDoGlobalEndTransitionAsync(nextTask, subProcess, info, cleaningUpAfterException); + } + }) | chain::then([excpt](std::exception_ptr const*, auto nextTask) { nextTask.doneWaiting(excpt); }) | + chain::runLast(std::move(nextTask)); + } else { + for (auto& subProcess : iSubProcesses) { + subProcessDoGlobalEndTransitionAsync(nextTask, subProcess, info, cleaningUpAfterException); + } + } + }) | + chain::runLast(iWait); } }; // namespace edm diff --git a/FWCore/Framework/src/InputSourceFactory.h b/FWCore/Framework/interface/maker/InputSourceFactory.h similarity index 100% rename from FWCore/Framework/src/InputSourceFactory.h rename to FWCore/Framework/interface/maker/InputSourceFactory.h diff --git a/FWCore/Framework/src/MakeModuleHelper.h b/FWCore/Framework/interface/maker/MakeModuleHelper.h similarity index 100% rename from FWCore/Framework/src/MakeModuleHelper.h rename to FWCore/Framework/interface/maker/MakeModuleHelper.h diff --git a/FWCore/Framework/src/MakeModuleParams.h b/FWCore/Framework/interface/maker/MakeModuleParams.h similarity index 100% rename from FWCore/Framework/src/MakeModuleParams.h rename to FWCore/Framework/interface/maker/MakeModuleParams.h diff --git a/FWCore/Framework/interface/maker/MakerPluginFactory.h b/FWCore/Framework/interface/maker/MakerPluginFactory.h new file mode 100644 index 0000000000000..ec2cf491aa4bb --- /dev/null +++ b/FWCore/Framework/interface/maker/MakerPluginFactory.h @@ -0,0 +1,12 @@ +#ifndef FWCore_Framework_MakerPluginFactory_h +#define FWCore_Framework_MakerPluginFactory_h + +#include "FWCore/PluginManager/interface/PluginFactory.h" + +namespace edm { + class Maker; + + using MakerPluginFactory = edmplugin::PluginFactory; +} // namespace edm + +#endif diff --git a/FWCore/Framework/src/ModuleHolder.h b/FWCore/Framework/interface/maker/ModuleHolder.h similarity index 94% rename from FWCore/Framework/src/ModuleHolder.h rename to FWCore/Framework/interface/maker/ModuleHolder.h index 9aead896b929b..6c223c024a16a 100644 --- a/FWCore/Framework/src/ModuleHolder.h +++ b/FWCore/Framework/interface/maker/ModuleHolder.h @@ -5,7 +5,7 @@ // Package: FWCore/Framework // Class : ModuleHolder // -/**\class edm::maker::ModuleHolder ModuleHolder.h "FWCore/Framework/src/ModuleHolder.h" +/**\class edm::maker::ModuleHolder ModuleHolder.h "FWCore/Framework/interface/maker/ModuleHolder.h" Description: Base class used to own a module for the framework @@ -22,8 +22,8 @@ #include // user include files -#include "FWCore/Framework/src/WorkerT.h" -#include "FWCore/Framework/src/OutputModuleCommunicatorT.h" +#include "FWCore/Framework/interface/maker/WorkerT.h" +#include "FWCore/Framework/interface/OutputModuleCommunicatorT.h" // forward declarations namespace edm { diff --git a/FWCore/Framework/src/Worker.h b/FWCore/Framework/interface/maker/Worker.h similarity index 99% rename from FWCore/Framework/src/Worker.h rename to FWCore/Framework/interface/maker/Worker.h index a0d6a61c2f6a7..c49515c02a7bd 100644 --- a/FWCore/Framework/src/Worker.h +++ b/FWCore/Framework/interface/maker/Worker.h @@ -24,8 +24,8 @@ the worker is reset(). #include "DataFormats/Provenance/interface/ModuleDescription.h" #include "FWCore/Common/interface/FWCoreCommonFwd.h" #include "FWCore/MessageLogger/interface/ExceptionMessages.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" -#include "FWCore/Framework/src/WorkerParams.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/maker/WorkerParams.h" #include "FWCore/Framework/interface/ExceptionActions.h" #include "FWCore/Framework/interface/ModuleContextSentry.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" diff --git a/FWCore/Framework/src/WorkerMaker.h b/FWCore/Framework/interface/maker/WorkerMaker.h similarity index 94% rename from FWCore/Framework/src/WorkerMaker.h rename to FWCore/Framework/interface/maker/WorkerMaker.h index 6ab378994eb59..8052585d2ede0 100644 --- a/FWCore/Framework/src/WorkerMaker.h +++ b/FWCore/Framework/interface/maker/WorkerMaker.h @@ -5,10 +5,10 @@ #include #include -#include "FWCore/Framework/src/WorkerT.h" -#include "FWCore/Framework/src/MakeModuleParams.h" -#include "FWCore/Framework/src/ModuleHolder.h" -#include "FWCore/Framework/src/MakeModuleHelper.h" +#include "FWCore/Framework/interface/maker/WorkerT.h" +#include "FWCore/Framework/interface/maker/MakeModuleParams.h" +#include "FWCore/Framework/interface/maker/ModuleHolder.h" +#include "FWCore/Framework/interface/maker/MakeModuleHelper.h" #include "FWCore/Utilities/interface/Signal.h" @@ -16,7 +16,6 @@ namespace edm { class ConfigurationDescriptions; class ModuleDescription; class ParameterSet; - class Maker; class ExceptionToActionTable; class Maker { diff --git a/FWCore/Framework/src/WorkerParams.h b/FWCore/Framework/interface/maker/WorkerParams.h similarity index 100% rename from FWCore/Framework/src/WorkerParams.h rename to FWCore/Framework/interface/maker/WorkerParams.h diff --git a/FWCore/Framework/src/WorkerT.h b/FWCore/Framework/interface/maker/WorkerT.h similarity index 97% rename from FWCore/Framework/src/WorkerT.h rename to FWCore/Framework/interface/maker/WorkerT.h index 007a50c7dd65a..fa566f29c64ac 100644 --- a/FWCore/Framework/src/WorkerT.h +++ b/FWCore/Framework/interface/maker/WorkerT.h @@ -9,9 +9,9 @@ WorkerT: Code common to all workers. #include "FWCore/Common/interface/FWCoreCommonFwd.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" -#include "FWCore/Framework/src/Worker.h" -#include "FWCore/Framework/src/WorkerParams.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/maker/Worker.h" +#include "FWCore/Framework/interface/maker/WorkerParams.h" #include "FWCore/ServiceRegistry/interface/ConsumesInfo.h" #include "FWCore/Utilities/interface/propagate_const.h" diff --git a/FWCore/Framework/interface/stream/EDAnalyzerAdaptor.h b/FWCore/Framework/interface/stream/EDAnalyzerAdaptor.h index 6d420137af8cc..1bb532737f2d7 100644 --- a/FWCore/Framework/interface/stream/EDAnalyzerAdaptor.h +++ b/FWCore/Framework/interface/stream/EDAnalyzerAdaptor.h @@ -31,8 +31,8 @@ #include "FWCore/Framework/interface/stream/callAbilities.h" #include "FWCore/Framework/interface/stream/dummy_helpers.h" #include "FWCore/Framework/interface/stream/makeGlobal.h" -#include "FWCore/Framework/src/MakeModuleHelper.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/maker/MakeModuleHelper.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/ServiceRegistry/interface/ESParentContext.h" // forward declarations diff --git a/FWCore/Framework/interface/stream/EDFilterAdaptor.h b/FWCore/Framework/interface/stream/EDFilterAdaptor.h index b69fab70c4fe5..0c20c7a744555 100644 --- a/FWCore/Framework/interface/stream/EDFilterAdaptor.h +++ b/FWCore/Framework/interface/stream/EDFilterAdaptor.h @@ -23,7 +23,7 @@ // user include files #include "FWCore/Framework/interface/stream/EDFilterAdaptorBase.h" #include "FWCore/Framework/interface/stream/ProducingModuleAdaptor.h" -#include "FWCore/Framework/src/MakeModuleHelper.h" +#include "FWCore/Framework/interface/maker/MakeModuleHelper.h" // forward declarations diff --git a/FWCore/Framework/interface/stream/EDProducerAdaptor.h b/FWCore/Framework/interface/stream/EDProducerAdaptor.h index d3a7d5b347e6a..92eeb269e6428 100644 --- a/FWCore/Framework/interface/stream/EDProducerAdaptor.h +++ b/FWCore/Framework/interface/stream/EDProducerAdaptor.h @@ -23,7 +23,7 @@ // user include files #include "FWCore/Framework/interface/stream/EDProducerAdaptorBase.h" #include "FWCore/Framework/interface/stream/ProducingModuleAdaptor.h" -#include "FWCore/Framework/src/MakeModuleHelper.h" +#include "FWCore/Framework/interface/maker/MakeModuleHelper.h" // forward declarations namespace edm { diff --git a/FWCore/Framework/interface/stream/ProducingModuleAdaptor.h b/FWCore/Framework/interface/stream/ProducingModuleAdaptor.h index 374eca94e63f6..499691f733430 100644 --- a/FWCore/Framework/interface/stream/ProducingModuleAdaptor.h +++ b/FWCore/Framework/interface/stream/ProducingModuleAdaptor.h @@ -30,7 +30,7 @@ #include "FWCore/Framework/interface/stream/callAbilities.h" #include "FWCore/Framework/interface/stream/dummy_helpers.h" #include "FWCore/Framework/interface/stream/makeGlobal.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/ServiceRegistry/interface/ESParentContext.h" // forward declarations diff --git a/FWCore/Framework/src/streamTransitionAsync.h b/FWCore/Framework/interface/streamTransitionAsync.h similarity index 70% rename from FWCore/Framework/src/streamTransitionAsync.h rename to FWCore/Framework/interface/streamTransitionAsync.h index 3a171b2392c0b..31ec59805bd7f 100644 --- a/FWCore/Framework/src/streamTransitionAsync.h +++ b/FWCore/Framework/interface/streamTransitionAsync.h @@ -20,9 +20,10 @@ #include "FWCore/Framework/interface/Schedule.h" #include "FWCore/Framework/src/SubProcess.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/Concurrency/interface/WaitingTask.h" #include "FWCore/Concurrency/interface/WaitingTaskHolder.h" +#include "FWCore/Concurrency/interface/chain_first.h" #include @@ -69,25 +70,28 @@ namespace edm { //When we are done processing the stream for this process, // we need to run the stream for all SubProcesses //NOTE: The subprocesses set their own service tokens - auto subs = make_waiting_task( - [&iSubProcesses, iWait, iStreamIndex, info = transitionInfo](std::exception_ptr const* iPtr) mutable { - if (iPtr) { - auto excpt = *iPtr; - auto delayError = - make_waiting_task([iWait, excpt](std::exception_ptr const*) mutable { iWait.doneWaiting(excpt); }); - WaitingTaskHolder h(*iWait.group(), delayError); - for (auto& subProcess : iSubProcesses) { - subProcessDoStreamBeginTransitionAsync(h, subProcess, iStreamIndex, info); - }; - } else { - for (auto& subProcess : iSubProcesses) { - subProcessDoStreamBeginTransitionAsync(iWait, subProcess, iStreamIndex, info); - }; - } - }); - - WaitingTaskHolder h(*iWait.group(), subs); - iSchedule.processOneStreamAsync(std::move(h), iStreamIndex, transitionInfo, token); + using namespace edm::waiting_task; + chain::first([&](auto nextTask) { + iSchedule.processOneStreamAsync(std::move(nextTask), iStreamIndex, transitionInfo, token); + }) | + chain::then( + [&iSubProcesses, iStreamIndex, info = transitionInfo](std::exception_ptr const* iPtr, auto nextTask) { + if (iPtr) { + auto excpt = *iPtr; + //defer handling exception until after sub processes run + chain::first([&](std::exception_ptr const*, auto nextTask) { + for (auto& subProcess : iSubProcesses) { + subProcessDoStreamBeginTransitionAsync(nextTask, subProcess, iStreamIndex, info); + }; + }) | chain::then([excpt](std::exception_ptr const*, auto nextTask) { nextTask.doneWaiting(excpt); }) | + chain::runLast(nextTask); + } else { + for (auto& subProcess : iSubProcesses) { + subProcessDoStreamBeginTransitionAsync(nextTask, subProcess, iStreamIndex, info); + }; + } + }) | + chain::runLast(iWait); } template @@ -114,26 +118,28 @@ namespace edm { // we need to run the stream for all SubProcesses //NOTE: The subprocesses set their own service tokens - auto subs = - make_waiting_task([&iSubProcesses, iWait, iStreamIndex, info = transitionInfo, cleaningUpAfterException]( - std::exception_ptr const* iPtr) mutable { + using namespace edm::waiting_task; + chain::first([&](auto nextTask) { + iSchedule.processOneStreamAsync(nextTask, iStreamIndex, transitionInfo, token, cleaningUpAfterException); + }) | + chain::then([&iSubProcesses, iStreamIndex, info = transitionInfo, cleaningUpAfterException]( + std::exception_ptr const* iPtr, auto nextTask) { if (iPtr) { auto excpt = *iPtr; - auto delayError = - make_waiting_task([iWait, excpt](std::exception_ptr const*) mutable { iWait.doneWaiting(excpt); }); - WaitingTaskHolder h(*iWait.group(), delayError); - for (auto& subProcess : iSubProcesses) { - subProcessDoStreamEndTransitionAsync(h, subProcess, iStreamIndex, info, cleaningUpAfterException); - } + chain::first([&](std::exception_ptr const*, auto nextTask) { + for (auto& subProcess : iSubProcesses) { + subProcessDoStreamEndTransitionAsync( + nextTask, subProcess, iStreamIndex, info, cleaningUpAfterException); + } + }) | chain::then([excpt](std::exception_ptr const*, auto nextTask) { nextTask.doneWaiting(excpt); }) | + chain::runLast(nextTask); } else { for (auto& subProcess : iSubProcesses) { - subProcessDoStreamEndTransitionAsync(iWait, subProcess, iStreamIndex, info, cleaningUpAfterException); + subProcessDoStreamEndTransitionAsync(nextTask, subProcess, iStreamIndex, info, cleaningUpAfterException); } } - }); - - iSchedule.processOneStreamAsync( - WaitingTaskHolder(*iWait.group(), subs), iStreamIndex, transitionInfo, token, cleaningUpAfterException); + }) | + chain::runLast(iWait); } template diff --git a/FWCore/Framework/src/EDAnalyzer.cc b/FWCore/Framework/src/EDAnalyzer.cc index a451efb264bd2..83031d6daadbf 100644 --- a/FWCore/Framework/src/EDAnalyzer.cc +++ b/FWCore/Framework/src/EDAnalyzer.cc @@ -11,9 +11,9 @@ #include "FWCore/Framework/src/edmodule_mightGet_config.h" #include "FWCore/Framework/interface/ConstProductRegistry.h" #include "FWCore/Framework/src/EventSignalsSentry.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" -#include "SharedResourcesRegistry.h" +#include "FWCore/Framework/interface/SharedResourcesRegistry.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" diff --git a/FWCore/Framework/src/EDFilter.cc b/FWCore/Framework/src/EDFilter.cc index 0fe1cc68d28d5..573d89bd68da4 100644 --- a/FWCore/Framework/src/EDFilter.cc +++ b/FWCore/Framework/src/EDFilter.cc @@ -10,10 +10,10 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/src/edmodule_mightGet_config.h" #include "FWCore/Framework/src/EventSignalsSentry.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/ServiceRegistry/interface/ESParentContext.h" -#include "SharedResourcesRegistry.h" +#include "FWCore/Framework/interface/SharedResourcesRegistry.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" diff --git a/FWCore/Framework/src/EDProducer.cc b/FWCore/Framework/src/EDProducer.cc index d6ac5da139aff..eda5ba67128b3 100644 --- a/FWCore/Framework/src/EDProducer.cc +++ b/FWCore/Framework/src/EDProducer.cc @@ -10,12 +10,12 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/src/edmodule_mightGet_config.h" #include "FWCore/Framework/src/EventSignalsSentry.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/ServiceRegistry/interface/ESParentContext.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" -#include "SharedResourcesRegistry.h" +#include "FWCore/Framework/interface/SharedResourcesRegistry.h" namespace edm { EDProducer::EDProducer() : ProducerBase(), moduleDescription_(), previousParentage_(), previousParentageId_() { diff --git a/FWCore/Framework/src/ESProducer.cc b/FWCore/Framework/src/ESProducer.cc index ea237cee53107..963092ff86ffe 100644 --- a/FWCore/Framework/src/ESProducer.cc +++ b/FWCore/Framework/src/ESProducer.cc @@ -15,7 +15,7 @@ // user include files #include "FWCore/Framework/interface/ESProducer.h" #include "FWCore/Framework/interface/ESRecordsToProxyIndices.h" -#include "FWCore/Framework/src/SharedResourcesRegistry.h" +#include "FWCore/Framework/interface/SharedResourcesRegistry.h" // // constants, enums and typedefs // diff --git a/FWCore/Framework/src/EarlyDeleteHelper.cc b/FWCore/Framework/src/EarlyDeleteHelper.cc index c565aeef73b3f..ea09448a94058 100644 --- a/FWCore/Framework/src/EarlyDeleteHelper.cc +++ b/FWCore/Framework/src/EarlyDeleteHelper.cc @@ -16,7 +16,7 @@ #include "DataFormats/Provenance/interface/BranchID.h" #include "FWCore/Framework/interface/EventPrincipal.h" -#include "FWCore/Framework/src/EarlyDeleteHelper.h" +#include "FWCore/Framework/interface/EarlyDeleteHelper.h" using namespace edm; // diff --git a/FWCore/Framework/src/EndPathStatusInserter.cc b/FWCore/Framework/src/EndPathStatusInserter.cc index 292739efd9703..5c040e4fd32b2 100644 --- a/FWCore/Framework/src/EndPathStatusInserter.cc +++ b/FWCore/Framework/src/EndPathStatusInserter.cc @@ -7,7 +7,7 @@ #include namespace edm { - EndPathStatusInserter::EndPathStatusInserter(unsigned int) : token_{produces()} {} + EndPathStatusInserter::EndPathStatusInserter(unsigned int) : token_{produces()} {} void EndPathStatusInserter::produce(StreamID, edm::Event& event, edm::EventSetup const&) const { //Puts a default constructed EndPathStatus diff --git a/FWCore/Framework/src/Event.cc b/FWCore/Framework/src/Event.cc index 54dfb44246144..00974f938aba6 100644 --- a/FWCore/Framework/src/Event.cc +++ b/FWCore/Framework/src/Event.cc @@ -7,8 +7,8 @@ #include "FWCore/Common/interface/TriggerResultsByName.h" #include "FWCore/Framework/interface/EventPrincipal.h" #include "FWCore/Framework/interface/LuminosityBlock.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" -#include "FWCore/Framework/src/ProductPutterBase.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/ProductPutterBase.h" #include "FWCore/ParameterSet/interface/Registry.h" #include "FWCore/Utilities/interface/Algorithms.h" #include "FWCore/Utilities/interface/InputTag.h" diff --git a/FWCore/Framework/src/EventForOutput.cc b/FWCore/Framework/src/EventForOutput.cc index 74a8a2d8c55e8..6b37b2804dc8a 100644 --- a/FWCore/Framework/src/EventForOutput.cc +++ b/FWCore/Framework/src/EventForOutput.cc @@ -4,7 +4,7 @@ #include "FWCore/Common/interface/TriggerResultsByName.h" #include "FWCore/Framework/interface/EventPrincipal.h" #include "FWCore/Framework/interface/LuminosityBlockForOutput.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/ParameterSet/interface/Registry.h" #include "FWCore/Utilities/interface/Algorithms.h" #include "FWCore/Utilities/interface/InputTag.h" diff --git a/FWCore/Framework/src/EventPrincipal.cc b/FWCore/Framework/src/EventPrincipal.cc index 089aec3b05d46..88b6b048f9846 100644 --- a/FWCore/Framework/src/EventPrincipal.cc +++ b/FWCore/Framework/src/EventPrincipal.cc @@ -18,7 +18,7 @@ #include "FWCore/Framework/interface/ProductResolverBase.h" #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h" #include "FWCore/Framework/src/ProductDeletedException.h" -#include "FWCore/Framework/src/ProductPutterBase.h" +#include "FWCore/Framework/interface/ProductPutterBase.h" #include "FWCore/Framework/interface/SharedResourcesAcquirer.h" #include "FWCore/Utilities/interface/Algorithms.h" #include "FWCore/Utilities/interface/EDMException.h" diff --git a/FWCore/Framework/src/EventProcessor.cc b/FWCore/Framework/src/EventProcessor.cc index 59c25aaec6767..2e2ea5f735510 100644 --- a/FWCore/Framework/src/EventProcessor.cc +++ b/FWCore/Framework/src/EventProcessor.cc @@ -32,12 +32,12 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/ESRecordsToProxyIndices.h" #include "FWCore/Framework/src/Breakpoints.h" -#include "FWCore/Framework/src/EventSetupsController.h" -#include "FWCore/Framework/src/InputSourceFactory.h" -#include "FWCore/Framework/src/SharedResourcesRegistry.h" -#include "FWCore/Framework/src/streamTransitionAsync.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" -#include "FWCore/Framework/src/globalTransitionAsync.h" +#include "FWCore/Framework/interface/EventSetupsController.h" +#include "FWCore/Framework/interface/maker/InputSourceFactory.h" +#include "FWCore/Framework/interface/SharedResourcesRegistry.h" +#include "FWCore/Framework/interface/streamTransitionAsync.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/globalTransitionAsync.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -1294,159 +1294,149 @@ namespace edm { // destroyed inside this function and lumiWork. auto status = std::make_shared(this, preallocations_.numberOfStreams(), iRunResource); - - auto lumiWork = [this, iHolder, status](edm::LimitedTaskQueue::Resumer iResumer) mutable { - if (iHolder.taskHasFailed()) { - status->resetResources(); - return; - } - - status->setResumer(std::move(iResumer)); - - sourceResourcesAcquirer_.serialQueueChain().push( - *iHolder.group(), [this, iHolder, status = std::move(status)]() mutable { - //make the services available - ServiceRegistry::Operate operate(serviceToken_); - // Caught exception is propagated via WaitingTaskHolder - CMS_SA_ALLOW try { - readLuminosityBlock(*status); - - LuminosityBlockPrincipal& lumiPrincipal = *status->lumiPrincipal(); - { - SendSourceTerminationSignalIfException sentry(actReg_.get()); - - input_->doBeginLumi(lumiPrincipal, &processContext_); - sentry.completedSuccessfully(); - } - - Service rng; - if (rng.isAvailable()) { - LuminosityBlock lb(lumiPrincipal, ModuleDescription(), nullptr, false); - rng->preBeginLumi(lb); - } - - EventSetupImpl const& es = status->eventSetupImpl(esp_->subProcessIndex()); - - using namespace edm::waiting_task::chain; - chain::first([this, status, &lumiPrincipal](auto nextTask) { - EventSetupImpl const& es = status->eventSetupImpl(esp_->subProcessIndex()); - { - LumiTransitionInfo transitionInfo(lumiPrincipal, es, &status->eventSetupImpls()); - using Traits = OccurrenceTraits; - beginGlobalTransitionAsync( - nextTask, *schedule_, transitionInfo, serviceToken_, subProcesses_); - } - }) | ifThen(looper_, [this, status, &es](auto nextTask) { - looper_->prefetchAsync( - nextTask, serviceToken_, Transition::BeginLuminosityBlock, *(status->lumiPrincipal()), es); - }) | ifThen(looper_, [this, status, &es](auto nextTask) { - status->globalBeginDidSucceed(); - //make the services available - ServiceRegistry::Operate operateLooper(serviceToken_); - looper_->doBeginLuminosityBlock(*(status->lumiPrincipal()), es, &processContext_); - }) | then([this, status](std::exception_ptr const* iPtr, auto holder) mutable { - if (iPtr) { - status->resetResources(); - holder.doneWaiting(*iPtr); - } else { - if (not looper_) { - status->globalBeginDidSucceed(); - } - EventSetupImpl const& es = status->eventSetupImpl(esp_->subProcessIndex()); - using Traits = OccurrenceTraits; - - for (unsigned int i = 0; i < preallocations_.numberOfStreams(); ++i) { - streamQueues_[i].push(*holder.group(), [this, i, status, holder, &es]() mutable { - streamQueues_[i].pause(); - - auto& event = principalCache_.eventPrincipal(i); - //We need to be sure that 'status' and its internal shared_ptr are only - // held by the container as this lambda may not finish executing before all the tasks it - // spawns have already started to run. - auto eventSetupImpls = &status->eventSetupImpls(); - auto lp = status->lumiPrincipal().get(); - streamLumiStatus_[i] = std::move(status); - ++streamLumiActive_; - event.setLuminosityBlockPrincipal(lp); - LumiTransitionInfo transitionInfo(*lp, es, eventSetupImpls); - using namespace edm::waiting_task::chain; - chain::first([this, i, &transitionInfo](auto nextTask) { - beginStreamTransitionAsync( - std::move(nextTask), *schedule_, i, transitionInfo, serviceToken_, subProcesses_); - }) | then([this, i](std::exception_ptr const* exceptionFromBeginStreamLumi, auto nextTask) { - if (exceptionFromBeginStreamLumi) { - WaitingTaskHolder tmp(nextTask); - tmp.doneWaiting(*exceptionFromBeginStreamLumi); - streamEndLumiAsync(nextTask, i); - } else { - handleNextEventForStreamAsync(std::move(nextTask), i); - } - }) | runLast(holder); - }); - } - } - }) | runLast(iHolder); - - } catch (...) { - status->resetResources(); - iHolder.doneWaiting(std::current_exception()); - } - }); // task in sourceResourcesAcquirer - }; // end lumiWork - - auto queueLumiWorkTask = make_waiting_task( - [this, lumiWorkLambda = std::move(lumiWork), iHolder](std::exception_ptr const* iPtr) mutable { - if (iPtr) { - iHolder.doneWaiting(*iPtr); - } - lumiQueue_->pushAndPause(*iHolder.group(), std::move(lumiWorkLambda)); - }); - - if (espController_->doWeNeedToWaitForIOVsToFinish(iSync)) { - // We only get here inside this block if there is an EventSetup - // module not able to handle concurrent IOVs (usually an ESSource) - // and the new sync value is outside the current IOV of that module. - - WaitingTaskHolder queueLumiWorkTaskHolder{*iHolder.group(), queueLumiWorkTask}; - - queueWhichWaitsForIOVsToFinish_.push(*iHolder.group(), [this, queueLumiWorkTaskHolder, iSync, status]() mutable { - // Caught exception is propagated via WaitingTaskHolder + chain::first([&](auto nextTask) { + auto asyncEventSetup = [](ActivityRegistry* actReg, + auto* espController, + auto& queue, + WaitingTaskHolder task, + auto& status, + IOVSyncValue const& iSync) { + queue.pause(); CMS_SA_ALLOW try { - SendSourceTerminationSignalIfException sentry(actReg_.get()); + SendSourceTerminationSignalIfException sentry(actReg); // Pass in iSync to let the EventSetup system know which run and lumi // need to be processed and prepare IOVs for it. // Pass in the endIOVWaitingTasks so the lumi can notify them when the // lumi is done and no longer needs its EventSetup IOVs. - espController_->eventSetupForInstanceAsync( - iSync, queueLumiWorkTaskHolder, status->endIOVWaitingTasks(), status->eventSetupImpls()); + espController->eventSetupForInstanceAsync( + iSync, task, status->endIOVWaitingTasks(), status->eventSetupImpls()); sentry.completedSuccessfully(); } catch (...) { - queueLumiWorkTaskHolder.doneWaiting(std::current_exception()); + task.doneWaiting(std::current_exception()); } - queueWhichWaitsForIOVsToFinish_.pause(); - }); - - } else { - queueWhichWaitsForIOVsToFinish_.pause(); - - // This holder will be used to wait until the EventSetup IOVs are ready - WaitingTaskHolder queueLumiWorkTaskHolder{*iHolder.group(), queueLumiWorkTask}; - // Caught exception is propagated via WaitingTaskHolder - CMS_SA_ALLOW try { - SendSourceTerminationSignalIfException sentry(actReg_.get()); + }; + if (espController_->doWeNeedToWaitForIOVsToFinish(iSync)) { + // We only get here inside this block if there is an EventSetup + // module not able to handle concurrent IOVs (usually an ESSource) + // and the new sync value is outside the current IOV of that module. + auto group = nextTask.group(); + queueWhichWaitsForIOVsToFinish_.push( + *group, [this, task = std::move(nextTask), iSync, status, asyncEventSetup]() mutable { + asyncEventSetup( + actReg_.get(), espController_.get(), queueWhichWaitsForIOVsToFinish_, std::move(task), status, iSync); + }); + } else { + asyncEventSetup( + actReg_.get(), espController_.get(), queueWhichWaitsForIOVsToFinish_, std::move(nextTask), status, iSync); + } + }) | chain::then([this, status](std::exception_ptr const* iPtr, auto nextTask) { + //the call to doneWaiting will cause the count to decrement + auto copyTask = nextTask; + if (iPtr) { + nextTask.doneWaiting(*iPtr); + } + auto group = copyTask.group(); + lumiQueue_->pushAndPause( + *group, [this, task = std::move(copyTask), status](edm::LimitedTaskQueue::Resumer iResumer) mutable { + if (task.taskHasFailed()) { + status->resetResources(); + return; + } - // Pass in iSync to let the EventSetup system know which run and lumi - // need to be processed and prepare IOVs for it. - // Pass in the endIOVWaitingTasks so the lumi can notify them when the - // lumi is done and no longer needs its EventSetup IOVs. - espController_->eventSetupForInstanceAsync( - iSync, queueLumiWorkTaskHolder, status->endIOVWaitingTasks(), status->eventSetupImpls()); - sentry.completedSuccessfully(); + status->setResumer(std::move(iResumer)); + + auto group = task.group(); + sourceResourcesAcquirer_.serialQueueChain().push( + *group, [this, postQueueTask = std::move(task), status = std::move(status)]() mutable { + //make the services available + ServiceRegistry::Operate operate(serviceToken_); + // Caught exception is propagated via WaitingTaskHolder + CMS_SA_ALLOW try { + readLuminosityBlock(*status); + + LuminosityBlockPrincipal& lumiPrincipal = *status->lumiPrincipal(); + { + SendSourceTerminationSignalIfException sentry(actReg_.get()); + + input_->doBeginLumi(lumiPrincipal, &processContext_); + sentry.completedSuccessfully(); + } + + Service rng; + if (rng.isAvailable()) { + LuminosityBlock lb(lumiPrincipal, ModuleDescription(), nullptr, false); + rng->preBeginLumi(lb); + } + + EventSetupImpl const& es = status->eventSetupImpl(esp_->subProcessIndex()); + + using namespace edm::waiting_task::chain; + chain::first([this, status, &lumiPrincipal](auto nextTask) { + EventSetupImpl const& es = status->eventSetupImpl(esp_->subProcessIndex()); + { + LumiTransitionInfo transitionInfo(lumiPrincipal, es, &status->eventSetupImpls()); + using Traits = OccurrenceTraits; + beginGlobalTransitionAsync( + nextTask, *schedule_, transitionInfo, serviceToken_, subProcesses_); + } + }) | ifThen(looper_, [this, status, &es](auto nextTask) { + looper_->prefetchAsync( + nextTask, serviceToken_, Transition::BeginLuminosityBlock, *(status->lumiPrincipal()), es); + }) | ifThen(looper_, [this, status, &es](auto nextTask) { + status->globalBeginDidSucceed(); + //make the services available + ServiceRegistry::Operate operateLooper(serviceToken_); + looper_->doBeginLuminosityBlock(*(status->lumiPrincipal()), es, &processContext_); + }) | then([this, status](std::exception_ptr const* iPtr, auto holder) mutable { + if (iPtr) { + status->resetResources(); + holder.doneWaiting(*iPtr); + } else { + if (not looper_) { + status->globalBeginDidSucceed(); + } + EventSetupImpl const& es = status->eventSetupImpl(esp_->subProcessIndex()); + using Traits = OccurrenceTraits; + + for (unsigned int i = 0; i < preallocations_.numberOfStreams(); ++i) { + streamQueues_[i].push(*holder.group(), [this, i, status, holder, &es]() mutable { + streamQueues_[i].pause(); + + auto& event = principalCache_.eventPrincipal(i); + //We need to be sure that 'status' and its internal shared_ptr are only + // held by the container as this lambda may not finish executing before all the tasks it + // spawns have already started to run. + auto eventSetupImpls = &status->eventSetupImpls(); + auto lp = status->lumiPrincipal().get(); + streamLumiStatus_[i] = std::move(status); + ++streamLumiActive_; + event.setLuminosityBlockPrincipal(lp); + LumiTransitionInfo transitionInfo(*lp, es, eventSetupImpls); + using namespace edm::waiting_task::chain; + chain::first([this, i, &transitionInfo](auto nextTask) { + beginStreamTransitionAsync( + std::move(nextTask), *schedule_, i, transitionInfo, serviceToken_, subProcesses_); + }) | then([this, i](std::exception_ptr const* exceptionFromBeginStreamLumi, auto nextTask) { + if (exceptionFromBeginStreamLumi) { + WaitingTaskHolder tmp(nextTask); + tmp.doneWaiting(*exceptionFromBeginStreamLumi); + streamEndLumiAsync(nextTask, i); + } else { + handleNextEventForStreamAsync(std::move(nextTask), i); + } + }) | runLast(holder); + }); + } + } + }) | runLast(postQueueTask); - } catch (...) { - queueLumiWorkTaskHolder.doneWaiting(std::current_exception()); - } - } + } catch (...) { + status->resetResources(); + postQueueTask.doneWaiting(std::current_exception()); + } + }); // task in sourceResourcesAcquirer + }); + }) | chain::runLast(std::move(iHolder)); } void EventProcessor::continueLumiAsync(edm::WaitingTaskHolder iHolder) { @@ -1691,44 +1681,37 @@ namespace edm { } void EventProcessor::writeProcessBlockAsync(WaitingTaskHolder task, ProcessBlockType processBlockType) { - auto subsT = edm::make_waiting_task([this, task, processBlockType](std::exception_ptr const* iExcept) mutable { - if (iExcept) { - task.doneWaiting(*iExcept); - } else { - ServiceRegistry::Operate op(serviceToken_); - for (auto& s : subProcesses_) { - s.writeProcessBlockAsync(task, processBlockType); - } + using namespace edm::waiting_task; + chain::first([&](auto nextTask) { + ServiceRegistry::Operate op(serviceToken_); + schedule_->writeProcessBlockAsync( + nextTask, principalCache_.processBlockPrincipal(processBlockType), &processContext_, actReg_.get()); + }) | chain::ifThen(not subProcesses_.empty(), [this, processBlockType](auto nextTask) { + ServiceRegistry::Operate op(serviceToken_); + for (auto& s : subProcesses_) { + s.writeProcessBlockAsync(nextTask, processBlockType); } - }); - ServiceRegistry::Operate op(serviceToken_); - schedule_->writeProcessBlockAsync(WaitingTaskHolder(*task.group(), subsT), - principalCache_.processBlockPrincipal(processBlockType), - &processContext_, - actReg_.get()); + }) | chain::runLast(std::move(task)); } void EventProcessor::writeRunAsync(WaitingTaskHolder task, ProcessHistoryID const& phid, RunNumber_t run, MergeableRunProductMetadata const* mergeableRunProductMetadata) { - auto subsT = edm::make_waiting_task( - [this, phid, run, task, mergeableRunProductMetadata](std::exception_ptr const* iExcept) mutable { - if (iExcept) { - task.doneWaiting(*iExcept); - } else { - ServiceRegistry::Operate op(serviceToken_); - for (auto& s : subProcesses_) { - s.writeRunAsync(task, phid, run, mergeableRunProductMetadata); - } - } - }); - ServiceRegistry::Operate op(serviceToken_); - schedule_->writeRunAsync(WaitingTaskHolder(*task.group(), subsT), - principalCache_.runPrincipal(phid, run), - &processContext_, - actReg_.get(), - mergeableRunProductMetadata); + using namespace edm::waiting_task; + chain::first([&](auto nextTask) { + ServiceRegistry::Operate op(serviceToken_); + schedule_->writeRunAsync(nextTask, + principalCache_.runPrincipal(phid, run), + &processContext_, + actReg_.get(), + mergeableRunProductMetadata); + }) | chain::ifThen(not subProcesses_.empty(), [this, phid, run, mergeableRunProductMetadata](auto nextTask) { + ServiceRegistry::Operate op(serviceToken_); + for (auto& s : subProcesses_) { + s.writeRunAsync(nextTask, phid, run, mergeableRunProductMetadata); + } + }) | chain::runLast(std::move(task)); } void EventProcessor::deleteRunFromCache(ProcessHistoryID const& phid, RunNumber_t run) { @@ -1738,21 +1721,18 @@ namespace edm { } void EventProcessor::writeLumiAsync(WaitingTaskHolder task, LuminosityBlockPrincipal& lumiPrincipal) { - auto subsT = edm::make_waiting_task([this, task, &lumiPrincipal](std::exception_ptr const* iExcept) mutable { - if (iExcept) { - task.doneWaiting(*iExcept); - } else { - ServiceRegistry::Operate op(serviceToken_); - for (auto& s : subProcesses_) { - s.writeLumiAsync(task, lumiPrincipal); - } + using namespace edm::waiting_task; + chain::first([&](auto nextTask) { + ServiceRegistry::Operate op(serviceToken_); + + lumiPrincipal.runPrincipal().mergeableRunProductMetadata()->writeLumi(lumiPrincipal.luminosityBlock()); + schedule_->writeLumiAsync(nextTask, lumiPrincipal, &processContext_, actReg_.get()); + }) | chain::ifThen(not subProcesses_.empty(), [this, &lumiPrincipal](auto nextTask) { + ServiceRegistry::Operate op(serviceToken_); + for (auto& s : subProcesses_) { + s.writeLumiAsync(nextTask, lumiPrincipal); } - }); - ServiceRegistry::Operate op(serviceToken_); - - lumiPrincipal.runPrincipal().mergeableRunProductMetadata()->writeLumi(lumiPrincipal.luminosityBlock()); - - schedule_->writeLumiAsync(WaitingTaskHolder{*task.group(), subsT}, lumiPrincipal, &processContext_, actReg_.get()); + }) | chain::lastTask(std::move(task)); } void EventProcessor::deleteLumiFromCache(LuminosityBlockProcessingStatus& iStatus) { diff --git a/FWCore/Framework/src/EventSetupProvider.cc b/FWCore/Framework/src/EventSetupProvider.cc index d8527595f0d85..d20f767b2e169 100644 --- a/FWCore/Framework/src/EventSetupProvider.cc +++ b/FWCore/Framework/src/EventSetupProvider.cc @@ -27,7 +27,7 @@ #include "FWCore/Framework/interface/ModuleFactory.h" #include "FWCore/Framework/interface/ParameterSetIDHolder.h" #include "FWCore/Framework/interface/ESRecordsToProxyIndices.h" -#include "FWCore/Framework/src/EventSetupsController.h" +#include "FWCore/Framework/interface/EventSetupsController.h" #include "FWCore/Framework/src/NumberOfConcurrentIOVs.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" diff --git a/FWCore/Framework/src/EventSetupsController.cc b/FWCore/Framework/src/EventSetupsController.cc index 254d5c17782da..139ad2a348cfb 100644 --- a/FWCore/Framework/src/EventSetupsController.cc +++ b/FWCore/Framework/src/EventSetupsController.cc @@ -10,7 +10,7 @@ // Created: Wed Jan 12 14:30:44 CST 2011 // -#include "FWCore/Framework/src/EventSetupsController.h" +#include "FWCore/Framework/interface/EventSetupsController.h" #include "FWCore/Concurrency/interface/WaitingTaskHolder.h" #include "FWCore/Concurrency/interface/WaitingTaskList.h" diff --git a/FWCore/Framework/src/Factory.cc b/FWCore/Framework/src/Factory.cc index f3568e0b5c9d1..980b3cf35fd8a 100644 --- a/FWCore/Framework/src/Factory.cc +++ b/FWCore/Framework/src/Factory.cc @@ -1,5 +1,6 @@ #include "FWCore/Framework/src/Factory.h" +#include "FWCore/Framework/interface/maker/MakerPluginFactory.h" #include "FWCore/Utilities/interface/DebugMacros.h" #include "FWCore/Utilities/interface/EDMException.h" #include "FWCore/Utilities/interface/Algorithms.h" diff --git a/FWCore/Framework/src/Factory.h b/FWCore/Framework/src/Factory.h index 4b39654f3a277..67fbc04355a81 100644 --- a/FWCore/Framework/src/Factory.h +++ b/FWCore/Framework/src/Factory.h @@ -1,10 +1,9 @@ #ifndef FWCore_Framework_Factory_h #define FWCore_Framework_Factory_h -#include "FWCore/PluginManager/interface/PluginFactory.h" -#include "FWCore/Framework/src/Worker.h" -#include "FWCore/Framework/src/WorkerMaker.h" -#include "FWCore/Framework/src/MakeModuleParams.h" +#include "FWCore/Framework/interface/maker/Worker.h" +#include "FWCore/Framework/interface/maker/WorkerMaker.h" +#include "FWCore/Framework/interface/maker/MakeModuleParams.h" #include #include @@ -14,8 +13,6 @@ #include "FWCore/Utilities/interface/thread_safety_macros.h" namespace edm { - typedef edmplugin::PluginFactory MakerPluginFactory; - class Factory { public: typedef std::map> MakerMap; diff --git a/FWCore/Framework/src/GlobalSchedule.cc b/FWCore/Framework/src/GlobalSchedule.cc index 4d831c798a9aa..453ea07e285cc 100644 --- a/FWCore/Framework/src/GlobalSchedule.cc +++ b/FWCore/Framework/src/GlobalSchedule.cc @@ -1,9 +1,9 @@ -#include "FWCore/Framework/src/GlobalSchedule.h" -#include "FWCore/Framework/src/WorkerMaker.h" +#include "FWCore/Framework/interface/GlobalSchedule.h" +#include "FWCore/Framework/interface/maker/WorkerMaker.h" #include "FWCore/Framework/src/TriggerResultInserter.h" #include "FWCore/Framework/src/PathStatusInserter.h" #include "FWCore/Framework/src/EndPathStatusInserter.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "DataFormats/Provenance/interface/ProcessConfiguration.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" diff --git a/FWCore/Framework/src/InputSourceFactory.cc b/FWCore/Framework/src/InputSourceFactory.cc index 111337ed1582e..5628035036fd1 100644 --- a/FWCore/Framework/src/InputSourceFactory.cc +++ b/FWCore/Framework/src/InputSourceFactory.cc @@ -1,5 +1,5 @@ -#include "FWCore/Framework/src/InputSourceFactory.h" +#include "FWCore/Framework/interface/maker/InputSourceFactory.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/DebugMacros.h" #include "FWCore/Utilities/interface/EDMException.h" diff --git a/FWCore/Framework/src/LuminosityBlock.cc b/FWCore/Framework/src/LuminosityBlock.cc index 1deedf0230ba8..b607ca9acca60 100644 --- a/FWCore/Framework/src/LuminosityBlock.cc +++ b/FWCore/Framework/src/LuminosityBlock.cc @@ -2,8 +2,8 @@ #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h" #include "FWCore/Framework/interface/Run.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" -#include "FWCore/Framework/src/ProductPutterBase.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/ProductPutterBase.h" #include "FWCore/Utilities/interface/Algorithms.h" #include "FWCore/Utilities/interface/get_underlying_safe.h" diff --git a/FWCore/Framework/src/LuminosityBlockForOutput.cc b/FWCore/Framework/src/LuminosityBlockForOutput.cc index fa9a946ca9d21..7e22298c8e074 100644 --- a/FWCore/Framework/src/LuminosityBlockForOutput.cc +++ b/FWCore/Framework/src/LuminosityBlockForOutput.cc @@ -2,7 +2,7 @@ #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h" #include "FWCore/Framework/interface/RunForOutput.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/Utilities/interface/Algorithms.h" #include "FWCore/Utilities/interface/get_underlying_safe.h" diff --git a/FWCore/Framework/src/LuminosityBlockPrincipal.cc b/FWCore/Framework/src/LuminosityBlockPrincipal.cc index e713688b4a065..63994ccb77de9 100644 --- a/FWCore/Framework/src/LuminosityBlockPrincipal.cc +++ b/FWCore/Framework/src/LuminosityBlockPrincipal.cc @@ -1,5 +1,5 @@ #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h" -#include "FWCore/Framework/src/ProductPutterBase.h" +#include "FWCore/Framework/interface/ProductPutterBase.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" namespace edm { diff --git a/FWCore/Framework/src/ModuleFactory.cc b/FWCore/Framework/src/ModuleFactory.cc index 9f9505f05f6c4..dfde3415b8962 100644 --- a/FWCore/Framework/src/ModuleFactory.cc +++ b/FWCore/Framework/src/ModuleFactory.cc @@ -15,7 +15,7 @@ // user include files #include "FWCore/Framework/interface/ModuleFactory.h" #include "FWCore/Framework/interface/EventSetupProvider.h" -#include "FWCore/Framework/src/EventSetupsController.h" +#include "FWCore/Framework/interface/EventSetupsController.h" // // constants, enums and typedefs diff --git a/FWCore/Framework/src/ModuleHolder.cc b/FWCore/Framework/src/ModuleHolder.cc index 22f25d038faeb..ec82fbb843001 100644 --- a/FWCore/Framework/src/ModuleHolder.cc +++ b/FWCore/Framework/src/ModuleHolder.cc @@ -13,8 +13,8 @@ // system include files // user include files -#include "FWCore/Framework/src/ModuleHolder.h" -#include "FWCore/Framework/src/WorkerMaker.h" +#include "FWCore/Framework/interface/maker/ModuleHolder.h" +#include "FWCore/Framework/interface/maker/WorkerMaker.h" namespace edm { namespace maker { @@ -22,4 +22,4 @@ namespace edm { return m_maker->makeWorker(iActions, this); } } // namespace maker -} // namespace edm \ No newline at end of file +} // namespace edm diff --git a/FWCore/Framework/src/ModuleRegistry.cc b/FWCore/Framework/src/ModuleRegistry.cc index c83762beb7640..590348918e100 100644 --- a/FWCore/Framework/src/ModuleRegistry.cc +++ b/FWCore/Framework/src/ModuleRegistry.cc @@ -13,7 +13,7 @@ // system include files // user include files -#include "FWCore/Framework/src/ModuleRegistry.h" +#include "FWCore/Framework/interface/ModuleRegistry.h" #include "FWCore/Framework/src/Factory.h" namespace edm { diff --git a/FWCore/Framework/src/OutputModuleCommunicator.cc b/FWCore/Framework/src/OutputModuleCommunicator.cc index 3fe8b89951498..2fb3881fada15 100644 --- a/FWCore/Framework/src/OutputModuleCommunicator.cc +++ b/FWCore/Framework/src/OutputModuleCommunicator.cc @@ -13,7 +13,7 @@ // system include files // user include files -#include "FWCore/Framework/src/OutputModuleCommunicator.h" +#include "FWCore/Framework/interface/OutputModuleCommunicator.h" using namespace edm; diff --git a/FWCore/Framework/src/OutputModuleCommunicatorT.cc b/FWCore/Framework/src/OutputModuleCommunicatorT.cc index 8bf00d3ff3e66..a7035c178faa3 100644 --- a/FWCore/Framework/src/OutputModuleCommunicatorT.cc +++ b/FWCore/Framework/src/OutputModuleCommunicatorT.cc @@ -15,7 +15,7 @@ #include "FWCore/Utilities/interface/LuminosityBlockIndex.h" #include "FWCore/Utilities/interface/make_sentry.h" -#include "FWCore/Framework/src/OutputModuleCommunicatorT.h" +#include "FWCore/Framework/interface/OutputModuleCommunicatorT.h" #include "FWCore/Framework/interface/global/OutputModuleBase.h" #include "FWCore/Framework/interface/one/OutputModuleBase.h" diff --git a/FWCore/Framework/src/Path.cc b/FWCore/Framework/src/Path.cc index 5545644c010a4..8dbcfa65b272e 100644 --- a/FWCore/Framework/src/Path.cc +++ b/FWCore/Framework/src/Path.cc @@ -1,11 +1,11 @@ -#include "FWCore/Framework/src/Path.h" +#include "FWCore/Framework/interface/Path.h" #include "FWCore/Framework/interface/EventPrincipal.h" #include "FWCore/Framework/interface/ExceptionActions.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" -#include "FWCore/Framework/src/EarlyDeleteHelper.h" +#include "FWCore/Framework/interface/EarlyDeleteHelper.h" #include "FWCore/Framework/src/PathStatusInserter.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/ServiceRegistry/interface/ParentContext.h" #include "FWCore/Utilities/interface/Algorithms.h" #include "FWCore/MessageLogger/interface/ExceptionMessages.h" diff --git a/FWCore/Framework/src/PathStatusInserter.cc b/FWCore/Framework/src/PathStatusInserter.cc index 8a9d9e61e0e24..4917fbecf5c25 100644 --- a/FWCore/Framework/src/PathStatusInserter.cc +++ b/FWCore/Framework/src/PathStatusInserter.cc @@ -7,7 +7,7 @@ namespace edm { PathStatusInserter::PathStatusInserter(unsigned int numberOfStreams) - : hltPathStatus_(numberOfStreams), token_{produces()} {} + : hltPathStatus_(numberOfStreams), token_{produces()} {} void PathStatusInserter::setPathStatus(StreamID const& streamID, HLTPathStatus const& hltPathStatus) { hltPathStatus_[streamID.value()] = hltPathStatus; diff --git a/FWCore/Framework/src/PathsAndConsumesOfModules.cc b/FWCore/Framework/src/PathsAndConsumesOfModules.cc index 646d22834cebe..ff4c083eeccbb 100644 --- a/FWCore/Framework/src/PathsAndConsumesOfModules.cc +++ b/FWCore/Framework/src/PathsAndConsumesOfModules.cc @@ -2,12 +2,13 @@ #include "FWCore/Framework/interface/Schedule.h" #include "FWCore/Framework/interface/ModuleProcessName.h" -#include "FWCore/Framework/src/Worker.h" -#include "throwIfImproperDependencies.h" +#include "FWCore/Framework/interface/maker/Worker.h" #include "FWCore/Utilities/interface/EDMException.h" #include +#include +#include namespace edm { PathsAndConsumesOfModules::PathsAndConsumesOfModules() = default; @@ -266,8 +267,71 @@ namespace edm { // Since this cycle has 0 path only edges it is unrunnable. //==================================== + namespace { + struct ModuleStatus { + std::vector dependsOn_; + std::vector pathsOn_; + unsigned long long lastSearch = 0; + bool onPath_ = false; + bool wasRun_ = false; + }; + + struct PathStatus { + std::vector modulesOnPath_; + unsigned long int activeModuleSlot_ = 0; + unsigned long int nModules_ = 0; + unsigned int index_ = 0; + bool endPath_ = false; + }; + + class CircularDependencyException {}; + + bool checkIfCanRun(unsigned long long searchIndex, + unsigned int iModuleToCheckID, + std::vector& iModules, + std::vector& stackTrace) { + auto& status = iModules[iModuleToCheckID]; + if (status.wasRun_) { + return true; + } + + if (status.lastSearch == searchIndex) { + //check to see if the module is already on the stack + // checking searchIndex is insufficient as multiple modules + // in this search may be dependent upon the same module + auto itFound = std::find(stackTrace.begin(), stackTrace.end(), iModuleToCheckID); + if (itFound != stackTrace.end()) { + stackTrace.push_back(iModuleToCheckID); + throw CircularDependencyException(); + } + //we have already checked this module's dependencies during this search + return false; + } + stackTrace.push_back(iModuleToCheckID); + status.lastSearch = searchIndex; + + bool allDependenciesRan = true; + for (auto index : status.dependsOn_) { + auto& dep = iModules[index]; + if (dep.onPath_) { + if (not dep.wasRun_) { + allDependenciesRan = false; + } + } else if (not checkIfCanRun(searchIndex, index, iModules, stackTrace)) { + allDependenciesRan = false; + } + } + if (allDependenciesRan) { + status.wasRun_ = true; + } + stackTrace.pop_back(); + + return allDependenciesRan; + } + } // namespace void checkForModuleDependencyCorrectness(edm::PathsAndConsumesOfModulesBase const& iPnC, bool iPrintDependencies) { - using namespace edm::graph; + constexpr auto kInvalidIndex = std::numeric_limits::max(); + //Need to lookup ids to names quickly std::unordered_map moduleIndexToNames; @@ -278,8 +342,8 @@ namespace edm { const std::string kPathStatusInserter("PathStatusInserter"); const std::string kEndPathStatusInserter("EndPathStatusInserter"); unsigned int kTriggerResultsIndex = kInvalidIndex; + ModuleStatus triggerResultsStatus; unsigned int largestIndex = 0; - unsigned int kPathToTriggerResultsDependencyLastIndex = kInvalidIndex; for (auto const& description : iPnC.allModules()) { moduleIndexToNames.insert(std::make_pair(description->id(), description->moduleLabel())); if (kTriggerResults == description->moduleLabel()) { @@ -288,196 +352,345 @@ namespace edm { if (description->id() > largestIndex) { largestIndex = description->id(); } + if (description->moduleName() == kPathStatusInserter) { + triggerResultsStatus.dependsOn_.push_back(description->id()); + } if (description->moduleName() == kPathStatusInserter || description->moduleName() == kEndPathStatusInserter) { pathStatusInserterModuleLabelToModuleID[description->moduleLabel()] = description->id(); } } - kPathToTriggerResultsDependencyLastIndex = largestIndex; - /* - { - //We need to explicitly check that modules on Paths do not try to read data from - // Modules which are only on EndPaths. The circular dependency finder has been - // known to miss these. - std::unordered_set modulesOnlyOnEndPaths; - auto const& endPaths = iPnC.endPaths(); - for( unsigned int pathIndex = 0; pathIndex != endPaths.size(); ++pathIndex) { - auto const& moduleDescriptions = iPnC.modulesOnEndPath(pathIndex); - for(auto const& description: moduleDescriptions) { - modulesOnlyOnEndPaths.insert(description->id()); - } - } + std::vector statusOfModules(largestIndex + 1); + for (auto const& nameID : pathStatusInserterModuleLabelToModuleID) { + statusOfModules[nameID.second].onPath_ = true; + } + if (kTriggerResultsIndex != kInvalidIndex) { + statusOfModules[kTriggerResultsIndex] = std::move(triggerResultsStatus); + } + + std::vector statusOfPaths(iPnC.paths().size() + iPnC.endPaths().size()); - std::unordered_set modulesOnPaths; - auto const& paths = iPnC.paths(); - for( unsigned int pathIndex = 0; pathIndex != paths.size(); ++pathIndex) { - auto const& moduleDescriptions = iPnC.modulesOnPath(pathIndex); - for(auto const& description: moduleDescriptions) { - auto itFind =modulesOnlyOnEndPaths.find(description->id()); - if(modulesOnlyOnEndPaths.end() != itFind) { - modulesOnlyOnEndPaths.erase(itFind); + //If there are no paths, no modules will run so nothing to check + if (statusOfPaths.empty()) { + return; + } + + { + auto nPaths = iPnC.paths().size(); + for (unsigned int p = 0; p < nPaths; ++p) { + auto& status = statusOfPaths[p]; + status.index_ = p; + status.modulesOnPath_.reserve(iPnC.modulesOnPath(p).size() + 1); + std::unordered_set uniqueModules; + for (auto const& mod : iPnC.modulesOnPath(p)) { + if (uniqueModules.insert(mod->id()).second) { + status.modulesOnPath_.push_back(mod->id()); + statusOfModules[mod->id()].onPath_ = true; + statusOfModules[mod->id()].pathsOn_.push_back(p); } - modulesOnPaths.insert(description->id()); } + status.nModules_ = uniqueModules.size() + 1; + + //add the PathStatusInserter at the end + auto found = pathStatusInserterModuleLabelToModuleID.find(iPnC.paths()[p]); + assert(found != pathStatusInserterModuleLabelToModuleID.end()); + status.modulesOnPath_.push_back(found->second); } - - for(auto moduleIndex : modulesOnPaths) { - auto const& dependentModules = iPnC.modulesWhoseProductsAreConsumedBy(moduleIndex); - for(auto const& depDescription: dependentModules) { - auto itFind = modulesOnlyOnEndPaths.find(depDescription->id()); - if(itFind != modulesOnlyOnEndPaths.end()) { - throw edm::Exception(edm::errors::ScheduleExecutionFailure, "Unrunnable schedule\n") - <<"The module "<id()]<<" which is on an EndPath."; + } + { + auto offset = iPnC.paths().size(); + auto nPaths = iPnC.endPaths().size(); + for (unsigned int p = 0; p < nPaths; ++p) { + auto& status = statusOfPaths[p + offset]; + status.endPath_ = true; + status.index_ = p; + status.modulesOnPath_.reserve(iPnC.modulesOnEndPath(p).size() + 1); + std::unordered_set uniqueModules; + for (auto const& mod : iPnC.modulesOnEndPath(p)) { + if (uniqueModules.insert(mod->id()).second) { + status.modulesOnPath_.push_back(mod->id()); + statusOfModules[mod->id()].onPath_ = true; + statusOfModules[mod->id()].pathsOn_.push_back(p + offset); } } - } + status.nModules_ = uniqueModules.size() + 1; + //add the EndPathStatusInserter at the end + auto found = pathStatusInserterModuleLabelToModuleID.find(iPnC.endPaths()[p]); + assert(found != pathStatusInserterModuleLabelToModuleID.end()); + status.modulesOnPath_.push_back(found->second); + } } - */ - //If a module to module dependency comes from a path, remember which path - EdgeToPathMap edgeToPathMap; + for (auto const& description : iPnC.allModules()) { + unsigned int const moduleIndex = description->id(); + auto const& dependentModules = iPnC.modulesWhoseProductsAreConsumedBy(moduleIndex); + auto& deps = statusOfModules[moduleIndex]; + deps.dependsOn_.reserve(dependentModules.size()); + for (auto const& depDescription : dependentModules) { + if (iPrintDependencies) { + edm::LogAbsolute("ModuleDependency") + << "ModuleDependency '" << description->moduleLabel() << "' depends on data products from module '" + << depDescription->moduleLabel() << "'"; + } + deps.dependsOn_.push_back(depDescription->id()); + } + } - //Need to be able to quickly look up which paths a module appears on - std::unordered_map> moduleIndexToPathIndex; + unsigned int nPathsFinished = 0; + + //if a circular dependency exception happens, stackTrace has the info + std::vector stackTrace; + bool madeForwardProgress = true; + try { + //'simulate' the running of the paths. On each step mark each module as 'run' + // if all the module's dependencies were fulfilled in a previous step + unsigned long long searchIndex = 0; + while (madeForwardProgress and nPathsFinished != statusOfPaths.size()) { + madeForwardProgress = false; + for (auto& p : statusOfPaths) { + //the path has already completed in an earlier pass + if (p.activeModuleSlot_ == p.nModules_) { + continue; + } + ++searchIndex; + bool didRun = checkIfCanRun(searchIndex, p.modulesOnPath_[p.activeModuleSlot_], statusOfModules, stackTrace); + if (didRun) { + madeForwardProgress = true; + ++p.activeModuleSlot_; + if (p.activeModuleSlot_ == p.nModules_) { + ++nPathsFinished; + } + } + } + } + } catch (CircularDependencyException const&) { + //the last element in stackTrace must appear somewhere earlier in stackTrace + std::ostringstream oStr; + + unsigned int lastIndex = stackTrace.front(); + bool firstSkipped = false; + for (auto id : stackTrace) { + if (firstSkipped) { + oStr << " module '" << moduleIndexToNames[lastIndex] << "' depends on " << moduleIndexToNames[id] << "\n"; + } else { + firstSkipped = true; + } + lastIndex = id; + } + throw edm::Exception(edm::errors::ScheduleExecutionFailure, "Unrunnable schedule\n") + << "Circular module dependency found in configuration\n" + << oStr.str(); + } - //determine the path dependencies - std::vector pathNames = iPnC.paths(); - const unsigned int kFirstEndPathIndex = pathNames.size(); + auto pathName = [&](PathStatus const& iP) { + if (iP.endPath_) { + return iPnC.endPaths()[iP.index_]; + } + return iPnC.paths()[iP.index_]; + }; - const std::string kPathEnded("@PathEnded"); - const std::string kEndPathStart("@EndPathStart"); + //The program would deadlock + if (not madeForwardProgress) { + std::ostringstream oStr; + auto modIndex = std::numeric_limits::max(); + unsigned int presentPath; + for (auto itP = statusOfPaths.begin(); itP != statusOfPaths.end(); ++itP) { + auto const& p = *itP; + if (p.activeModuleSlot_ == p.nModules_) { + continue; + } + //this path is stuck + modIndex = p.modulesOnPath_[p.activeModuleSlot_]; + presentPath = itP - statusOfPaths.begin(); + break; + } + //NOTE the following should always be true as at least 1 path should be stuc. + // I've added the condition just to be paranoid. + if (modIndex != std::numeric_limits::max()) { + struct ProgressInfo { + ProgressInfo(unsigned int iMod, unsigned int iPath, bool iPreceeds = false) + : moduleIndex_(iMod), pathIndex_(iPath), preceeds_(iPreceeds) {} - //The finished processing depends on all paths and end paths - const std::string kFinishedProcessing("@FinishedProcessing"); - const unsigned int kFinishedProcessingIndex{0}; - moduleIndexToNames.insert(std::make_pair(kFinishedProcessingIndex, kFinishedProcessing)); + ProgressInfo(unsigned int iMod) : moduleIndex_(iMod), pathIndex_{}, preceeds_(false) {} - pathNames.insert(pathNames.end(), iPnC.endPaths().begin(), iPnC.endPaths().end()); - std::vector> pathIndexToModuleIndexOrder(pathNames.size()); - { - for (unsigned int pathIndex = 0; pathIndex != pathNames.size(); ++pathIndex) { - std::set alreadySeenIndex; + unsigned int moduleIndex_ = std::numeric_limits::max(); + std::optional pathIndex_; + bool preceeds_; - std::vector const* moduleDescriptions; - if (pathIndex < kFirstEndPathIndex) { - moduleDescriptions = &(iPnC.modulesOnPath(pathIndex)); - } else { - moduleDescriptions = &(iPnC.modulesOnEndPath(pathIndex - kFirstEndPathIndex)); - } - unsigned int lastModuleIndex = kInvalidIndex; - auto& pathOrder = pathIndexToModuleIndexOrder[pathIndex]; - pathOrder.reserve(moduleDescriptions->size() + 1); - for (auto const& description : *moduleDescriptions) { - auto found = alreadySeenIndex.insert(description->id()); - if (found.second) { - //first time for this path - unsigned int const moduleIndex = description->id(); - pathOrder.push_back(moduleIndex); - auto& paths = moduleIndexToPathIndex[moduleIndex]; - paths.push_back(pathIndex); - if (lastModuleIndex != kInvalidIndex) { - edgeToPathMap[std::make_pair(moduleIndex, lastModuleIndex)].push_back(pathIndex); + bool operator==(ProgressInfo const& iOther) const { + return moduleIndex_ == iOther.moduleIndex_ and pathIndex_ == iOther.pathIndex_; + } + }; + + std::vector progressTrace; + progressTrace.emplace_back(modIndex, presentPath); + + //The following starts from the first found unrun module on a path. It then finds + // the first modules it depends on that was not run. If that module is on a Task + // it then repeats the check for that module's dependencies. If that module is on + // a path, it checks to see if that module is the first unrun module of a path + // and if so it repeats the check for that module's dependencies, if not it + // checks the dependencies of the stuck module on that path. + // Eventually, all these checks should allow us to find a cycle of modules. + + //NOTE: the only way foundUnrunModule should ever by false by the end of the + // do{}while loop is if there is a bug in the algorithm. I've included it to + // try to avoid that case causing an infinite loop in the program. + bool foundUnrunModule; + do { + //check dependencies looking for stuff not run and on a path + foundUnrunModule = false; + for (auto depMod : statusOfModules[modIndex].dependsOn_) { + auto const& depStatus = statusOfModules[depMod]; + if (not depStatus.wasRun_ and depStatus.onPath_) { + foundUnrunModule = true; + //last run on a path? + bool lastOnPath = false; + unsigned int foundPath; + for (auto pathOn : depStatus.pathsOn_) { + auto const& depPaths = statusOfPaths[pathOn]; + if (depPaths.modulesOnPath_[depPaths.activeModuleSlot_] == depMod) { + lastOnPath = true; + foundPath = pathOn; + break; + } + } + if (lastOnPath) { + modIndex = depMod; + progressTrace.emplace_back(modIndex, foundPath); + } else { + //some earlier module on the same path is stuck + progressTrace.emplace_back(depMod, depStatus.pathsOn_[0]); + auto const& depPath = statusOfPaths[depStatus.pathsOn_[0]]; + modIndex = depPath.modulesOnPath_[depPath.activeModuleSlot_]; + progressTrace.emplace_back(modIndex, depStatus.pathsOn_[0], true); + } + break; } - lastModuleIndex = moduleIndex; } - } - //Have TriggerResults depend on the end of all paths - // Have all EndPaths depend on TriggerResults - auto labelToID = pathStatusInserterModuleLabelToModuleID.find(pathNames[pathIndex]); - if (labelToID == pathStatusInserterModuleLabelToModuleID.end()) { - // should never happen - throw Exception(errors::LogicError) - << "PathsAndConsumesOfModules::moduleDescription:checkForModuleDependencyCorrectness Could not find " - "PathStatusInserter\n"; - } - unsigned int pathStatusInserterModuleID = labelToID->second; - if (pathIndex < kFirstEndPathIndex) { - if ((lastModuleIndex != kInvalidIndex)) { - edgeToPathMap[std::make_pair(pathStatusInserterModuleID, lastModuleIndex)].push_back(pathIndex); - moduleIndexToNames.insert(std::make_pair(pathStatusInserterModuleID, kPathEnded)); - if (kTriggerResultsIndex != kInvalidIndex) { - edgeToPathMap[std::make_pair(kTriggerResultsIndex, pathStatusInserterModuleID)].push_back( - kDataDependencyIndex); + if (not foundUnrunModule) { + //check unscheduled modules + for (auto depMod : statusOfModules[modIndex].dependsOn_) { + auto const& depStatus = statusOfModules[depMod]; + if (not depStatus.wasRun_ and not depStatus.onPath_) { + foundUnrunModule = true; + progressTrace.emplace_back(depMod); + modIndex = depMod; + break; + } + } + } + } while (foundUnrunModule and (0 == std::count(progressTrace.begin(), + progressTrace.begin() + progressTrace.size() - 1, + progressTrace.back()))); + + auto printTrace = [&](auto& oStr, auto itBegin, auto itEnd) { + for (auto itTrace = itBegin; itTrace != itEnd; ++itTrace) { + if (itTrace != itBegin) { + if (itTrace->preceeds_) { + oStr << " and follows module '" << moduleIndexToNames[itTrace->moduleIndex_] << "' on the path\n"; + } else { + oStr << " and depends on module '" << moduleIndexToNames[itTrace->moduleIndex_] << "'\n"; + } + } + if (itTrace + 1 != itEnd) { + if (itTrace->pathIndex_) { + oStr << " module '" << moduleIndexToNames[itTrace->moduleIndex_] << "' is on path '" + << pathName(statusOfPaths[*itTrace->pathIndex_]) << "'"; + } else { + oStr << " module '" << moduleIndexToNames[itTrace->moduleIndex_] << "' is in a task"; + } } - //Need to make dependency for finished process - edgeToPathMap[std::make_pair(kFinishedProcessingIndex, pathStatusInserterModuleID)].push_back( - kDataDependencyIndex); - pathOrder.push_back(pathStatusInserterModuleID); } + }; + + if (not foundUnrunModule) { + //If we get here, this suggests a problem with either the algorithm that finds problems or the algorithm + // that attempts to report the problem + oStr << "Algorithm Error, unable to find problem. Contact framework group.\n Traced problem this far\n"; + printTrace(oStr, progressTrace.begin(), progressTrace.end()); } else { - if ((not moduleDescriptions->empty())) { - if (kTriggerResultsIndex != kInvalidIndex) { - ++kPathToTriggerResultsDependencyLastIndex; - edgeToPathMap[std::make_pair(moduleDescriptions->front()->id(), kPathToTriggerResultsDependencyLastIndex)] - .push_back(pathIndex); - moduleIndexToNames.insert(std::make_pair(kPathToTriggerResultsDependencyLastIndex, kEndPathStart)); - edgeToPathMap[std::make_pair(kPathToTriggerResultsDependencyLastIndex, kTriggerResultsIndex)].push_back( - kDataDependencyIndex); - pathOrder.insert(pathOrder.begin(), kPathToTriggerResultsDependencyLastIndex); + printTrace( + oStr, std::find(progressTrace.begin(), progressTrace.end(), progressTrace.back()), progressTrace.end()); + } + } + //the schedule deadlocked + throw edm::Exception(edm::errors::ScheduleExecutionFailure, "Unrunnable schedule\n") + << "The Path/EndPath configuration could cause the job to deadlock\n" + << oStr.str(); + } + + //NOTE: although the following conditions are not needed for safe running, they are + // policy choices the collaboration has made. + + //Check to see if for each path if the order of the modules is correct based on dependencies + for (auto& p : statusOfPaths) { + for (unsigned long int i = 0; p.nModules_ > 0 and i < p.nModules_ - 1; ++i) { + auto moduleID = p.modulesOnPath_[i]; + if (not statusOfModules[moduleID].dependsOn_.empty()) { + for (unsigned long int j = i + 1; j < p.nModules_; ++j) { + auto testModuleID = p.modulesOnPath_[j]; + for (auto depModuleID : statusOfModules[moduleID].dependsOn_) { + if (depModuleID == testModuleID) { + throw edm::Exception(edm::errors::ScheduleExecutionFailure, "Unrunnable schedule\n") + << "Dependent module later on Path\n" + << " module '" << moduleIndexToNames[moduleID] << "' depends on '" + << moduleIndexToNames[depModuleID] << "' which is later on path " << pathName(p); + } } - //Need to make dependency for finished process - ++kPathToTriggerResultsDependencyLastIndex; - edgeToPathMap[std::make_pair(pathStatusInserterModuleID, lastModuleIndex)].push_back(pathIndex); - moduleIndexToNames.insert(std::make_pair(pathStatusInserterModuleID, kPathEnded)); - edgeToPathMap[std::make_pair(kFinishedProcessingIndex, pathStatusInserterModuleID)].push_back( - kDataDependencyIndex); - pathOrder.push_back(pathStatusInserterModuleID); } } } } - { - //determine the data dependencies - for (auto const& description : iPnC.allModules()) { - unsigned int const moduleIndex = description->id(); - auto const& dependentModules = iPnC.modulesWhoseProductsAreConsumedBy(moduleIndex); - for (auto const& depDescription : dependentModules) { - if (iPrintDependencies) { - edm::LogAbsolute("ModuleDependency") - << "ModuleDependency '" << description->moduleLabel() << "' depends on data products from module '" - << depDescription->moduleLabel() << "'"; + + //HLT wants all paths to be equivalent. If a path has a module A that needs data from module B and module B appears on one path + // as module A then B must appear on ALL paths that have A. + unsigned int modIndex = 0; + for (auto& mod : statusOfModules) { + for (auto& depIndex : mod.dependsOn_) { + std::size_t count = 0; + std::size_t nonEndPaths = 0; + for (auto modPathID : mod.pathsOn_) { + if (statusOfPaths[modPathID].endPath_) { + continue; } - //see if all paths containing this module also contain the dependent module earlier in the path - // if it does, then treat this only as a path dependency and not a data dependency as this - // simplifies the circular dependency checking logic - auto depID = depDescription->id(); - auto itPathsFound = moduleIndexToPathIndex.find(moduleIndex); - bool keepDataDependency = true; - auto itDepsPathsFound = moduleIndexToPathIndex.find(depID); - if (itPathsFound != moduleIndexToPathIndex.end() and itDepsPathsFound != moduleIndexToPathIndex.end()) { - keepDataDependency = false; - for (auto const pathIndex : itPathsFound->second) { - for (auto idToCheck : pathIndexToModuleIndexOrder[pathIndex]) { - if (idToCheck == depID) { - //found dependent module first so check next path - break; - } - if (idToCheck == moduleIndex) { - //did not find dependent module earlier on path so - // must keep data dependency - keepDataDependency = true; - break; - } - } - if (keepDataDependency) { - break; - } + ++nonEndPaths; + for (auto depPathID : statusOfModules[depIndex].pathsOn_) { + if (depPathID == modPathID) { + ++count; + break; } } - if (keepDataDependency) { - edgeToPathMap[std::make_pair(moduleIndex, depID)].push_back(kDataDependencyIndex); + } + if (count != 0 and count != nonEndPaths) { + std::ostringstream onStr; + std::ostringstream missingStr; + + for (auto modPathID : mod.pathsOn_) { + if (statusOfPaths[modPathID].endPath_) { + continue; + } + bool found = false; + for (auto depPathID : statusOfModules[depIndex].pathsOn_) { + if (depPathID == modPathID) { + found = true; + } + } + auto& s = statusOfPaths[modPathID]; + if (found) { + onStr << pathName(s) << " "; + } else { + missingStr << pathName(s) << " "; + } } + throw edm::Exception(edm::errors::ScheduleExecutionFailure, "Unrunnable schedule\n") + << "Paths are non consistent\n" + << " module '" << moduleIndexToNames[modIndex] << "' depends on '" << moduleIndexToNames[depIndex] + << "' which appears on paths\n " << onStr.str() << "\nbut is missing from\n " << missingStr.str(); } } - } - // Don't bother if there are no modules in any paths (the - // dependence check crashes if the configuration has only Paths - // with Tasks with modules, but nothing to trigger any work to - // run) - if (not moduleIndexToPathIndex.empty()) { - graph::throwIfImproperDependencies(edgeToPathMap, pathIndexToModuleIndexOrder, pathNames, moduleIndexToNames); + ++modIndex; } } } // namespace edm diff --git a/FWCore/Framework/src/Principal.cc b/FWCore/Framework/src/Principal.cc index f249137aa2be1..beefa28fe9424 100644 --- a/FWCore/Framework/src/Principal.cc +++ b/FWCore/Framework/src/Principal.cc @@ -10,7 +10,7 @@ #include "FWCore/Framework/interface/DelayedReader.h" #include "FWCore/Framework/interface/HistoryAppender.h" #include "FWCore/Framework/src/ProductDeletedException.h" -#include "FWCore/Framework/src/ProductPutterBase.h" +#include "FWCore/Framework/interface/ProductPutterBase.h" #include "FWCore/Framework/interface/EDConsumerBase.h" #include "ProductResolvers.h" #include "FWCore/Utilities/interface/EDMException.h" diff --git a/FWCore/Framework/src/PrincipalCache.cc b/FWCore/Framework/src/PrincipalCache.cc index eadcfc5e785c8..6f1f6cea7c4c4 100644 --- a/FWCore/Framework/src/PrincipalCache.cc +++ b/FWCore/Framework/src/PrincipalCache.cc @@ -1,10 +1,10 @@ -#include "FWCore/Framework/src/PrincipalCache.h" +#include "FWCore/Framework/interface/PrincipalCache.h" #include "FWCore/Framework/interface/EventPrincipal.h" #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h" #include "FWCore/Framework/interface/ProcessBlockPrincipal.h" #include "FWCore/Framework/interface/RunPrincipal.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Utilities/interface/EDMException.h" #include "DataFormats/Provenance/interface/ProcessHistoryRegistry.h" diff --git a/FWCore/Framework/src/ProcessBlock.cc b/FWCore/Framework/src/ProcessBlock.cc index e98a33e38ca63..0203b00f10f3f 100644 --- a/FWCore/Framework/src/ProcessBlock.cc +++ b/FWCore/Framework/src/ProcessBlock.cc @@ -1,6 +1,6 @@ #include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/ProcessBlockPrincipal.h" -#include "FWCore/Framework/src/ProductPutterBase.h" +#include "FWCore/Framework/interface/ProductPutterBase.h" namespace edm { diff --git a/FWCore/Framework/src/ProcessBlockPrincipal.cc b/FWCore/Framework/src/ProcessBlockPrincipal.cc index a17c489402d52..2fd05a2a36478 100644 --- a/FWCore/Framework/src/ProcessBlockPrincipal.cc +++ b/FWCore/Framework/src/ProcessBlockPrincipal.cc @@ -1,5 +1,5 @@ #include "FWCore/Framework/interface/ProcessBlockPrincipal.h" -#include "FWCore/Framework/src/ProductPutterBase.h" +#include "FWCore/Framework/interface/ProductPutterBase.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "DataFormats/Provenance/interface/BranchType.h" diff --git a/FWCore/Framework/src/ProductResolvers.cc b/FWCore/Framework/src/ProductResolvers.cc index 17832689a4af6..23b2e65c602a7 100644 --- a/FWCore/Framework/src/ProductResolvers.cc +++ b/FWCore/Framework/src/ProductResolvers.cc @@ -1,15 +1,15 @@ /*---------------------------------------------------------------------- ----------------------------------------------------------------------*/ #include "ProductResolvers.h" -#include "Worker.h" -#include "UnscheduledAuxiliary.h" +#include "FWCore/Framework/interface/maker/Worker.h" +#include "FWCore/Framework/interface/UnscheduledAuxiliary.h" #include "UnscheduledConfigurator.h" #include "FWCore/Framework/interface/EventPrincipal.h" #include "FWCore/Framework/interface/MergeableRunProductMetadata.h" #include "FWCore/Framework/src/ProductDeletedException.h" #include "FWCore/Framework/interface/SharedResourcesAcquirer.h" #include "FWCore/Framework/interface/DelayedReader.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/Framework/interface/ProductProvenanceRetriever.h" #include "DataFormats/Provenance/interface/BranchKey.h" #include "DataFormats/Provenance/interface/ParentageRegistry.h" diff --git a/FWCore/Framework/src/ProductResolvers.h b/FWCore/Framework/src/ProductResolvers.h index bd4326d36a121..2c93aa1e9a6bc 100644 --- a/FWCore/Framework/src/ProductResolvers.h +++ b/FWCore/Framework/src/ProductResolvers.h @@ -8,7 +8,7 @@ a set of related EDProducts. This is the storage unit of such information. ----------------------------------------------------------------------*/ #include "FWCore/Framework/interface/ProductResolverBase.h" -#include "FWCore/Framework/src/ProductPutterBase.h" +#include "FWCore/Framework/interface/ProductPutterBase.h" #include "FWCore/Framework/src/ProductPutOrMergerBase.h" #include "DataFormats/Common/interface/WrapperBase.h" #include "DataFormats/Common/interface/ProductData.h" diff --git a/FWCore/Framework/src/Run.cc b/FWCore/Framework/src/Run.cc index 27d9590b80495..30719cf2afa58 100644 --- a/FWCore/Framework/src/Run.cc +++ b/FWCore/Framework/src/Run.cc @@ -1,8 +1,8 @@ #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/RunPrincipal.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" -#include "FWCore/Framework/src/ProductPutterBase.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/ProductPutterBase.h" #include "FWCore/Utilities/interface/Algorithms.h" #include "FWCore/Utilities/interface/get_underlying_safe.h" diff --git a/FWCore/Framework/src/RunForOutput.cc b/FWCore/Framework/src/RunForOutput.cc index b07c210b24943..9b4843b2c7fe0 100644 --- a/FWCore/Framework/src/RunForOutput.cc +++ b/FWCore/Framework/src/RunForOutput.cc @@ -1,7 +1,7 @@ #include "FWCore/Framework/interface/RunForOutput.h" #include "FWCore/Framework/interface/RunPrincipal.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/Utilities/interface/Algorithms.h" #include "FWCore/Utilities/interface/get_underlying_safe.h" diff --git a/FWCore/Framework/src/RunPrincipal.cc b/FWCore/Framework/src/RunPrincipal.cc index b49e4ece31207..d7de344253e90 100644 --- a/FWCore/Framework/src/RunPrincipal.cc +++ b/FWCore/Framework/src/RunPrincipal.cc @@ -4,7 +4,7 @@ #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "FWCore/Framework/interface/ProductResolverBase.h" #include "FWCore/Framework/interface/MergeableRunProductMetadata.h" -#include "FWCore/Framework/src/ProductPutterBase.h" +#include "FWCore/Framework/interface/ProductPutterBase.h" #include "FWCore/Framework/src/ProductPutOrMergerBase.h" namespace edm { diff --git a/FWCore/Framework/src/Schedule.cc b/FWCore/Framework/src/Schedule.cc index d5dc57141d566..a474c9b937200 100644 --- a/FWCore/Framework/src/Schedule.cc +++ b/FWCore/Framework/src/Schedule.cc @@ -14,15 +14,16 @@ #include "FWCore/Framework/interface/TriggerNamesService.h" #include "FWCore/Framework/src/TriggerReport.h" #include "FWCore/Framework/src/TriggerTimingReport.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Framework/src/Factory.h" -#include "FWCore/Framework/src/OutputModuleCommunicator.h" -#include "FWCore/Framework/src/ModuleHolder.h" -#include "FWCore/Framework/src/ModuleRegistry.h" +#include "FWCore/Framework/interface/OutputModuleCommunicator.h" +#include "FWCore/Framework/interface/maker/ModuleHolder.h" +#include "FWCore/Framework/interface/ModuleRegistry.h" #include "FWCore/Framework/src/TriggerResultInserter.h" #include "FWCore/Framework/src/PathStatusInserter.h" #include "FWCore/Framework/src/EndPathStatusInserter.h" #include "FWCore/Concurrency/interface/WaitingTaskHolder.h" +#include "FWCore/Concurrency/interface/chain_first.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" @@ -648,6 +649,18 @@ namespace edm { } } }; + + template + auto doCleanup(F&& iF) { + auto wrapped = [f = std::move(iF)](std::exception_ptr const* iPtr, edm::WaitingTaskHolder iTask) { + CMS_SA_ALLOW try { f(); } catch (...) { + } + if (iPtr) { + iTask.doneWaiting(*iPtr); + } + }; + return wrapped; + } } // namespace // ----------------------------- @@ -1239,30 +1252,25 @@ namespace edm { LuminosityBlockIndex::invalidLuminosityBlockIndex(), rp.endTime(), processContext); - auto t = - make_waiting_task([task, activityRegistry, globalContext, token](std::exception_ptr const* iExcept) mutable { - // Propagating the exception would be nontrivial, and signal actions are not supposed to throw exceptions - CMS_SA_ALLOW try { - //services can depend on other services - ServiceRegistry::Operate op(token); - - activityRegistry->postGlobalWriteRunSignal_(globalContext); - } catch (...) { - } - std::exception_ptr ptr; - if (iExcept) { - ptr = *iExcept; - } - task.doneWaiting(ptr); - }); - // Propagating the exception would be nontrivial, and signal actions are not supposed to throw exceptions - CMS_SA_ALLOW try { activityRegistry->preGlobalWriteRunSignal_(globalContext); } catch (...) { - } - WaitingTaskHolder tHolder(*task.group(), t); - for (auto& c : all_output_communicators_) { - c->writeRunAsync(tHolder, rp, processContext, activityRegistry, mergeableRunProductMetadata); - } + using namespace edm::waiting_task; + chain::first([&](auto nextTask) { + //services can depend on other services + ServiceRegistry::Operate op(token); + + // Propagating the exception would be nontrivial, and signal actions are not supposed to throw exceptions + CMS_SA_ALLOW try { activityRegistry->preGlobalWriteRunSignal_(globalContext); } catch (...) { + } + for (auto& c : all_output_communicators_) { + c->writeRunAsync(nextTask, rp, processContext, activityRegistry, mergeableRunProductMetadata); + } + }) | chain::then(doCleanup([activityRegistry, globalContext, token]() { + //services can depend on other services + ServiceRegistry::Operate op(token); + + activityRegistry->postGlobalWriteRunSignal_(globalContext); + })) | + chain::runLast(task); } void Schedule::writeProcessBlockAsync(WaitingTaskHolder task, @@ -1277,30 +1285,22 @@ namespace edm { Timestamp::invalidTimestamp(), processContext); - auto t = - make_waiting_task([task, activityRegistry, globalContext, token](std::exception_ptr const* iExcept) mutable { - // Propagating the exception would be nontrivial, and signal actions are not supposed to throw exceptions - CMS_SA_ALLOW try { - //services can depend on other services - ServiceRegistry::Operate op(token); - - activityRegistry->postWriteProcessBlockSignal_(globalContext); - } catch (...) { - } - std::exception_ptr ptr; - if (iExcept) { - ptr = *iExcept; - } - task.doneWaiting(ptr); - }); - // Propagating the exception would be nontrivial, and signal actions are not supposed to throw exceptions - CMS_SA_ALLOW try { activityRegistry->preWriteProcessBlockSignal_(globalContext); } catch (...) { - } - WaitingTaskHolder tHolder(*task.group(), t); + using namespace edm::waiting_task; + chain::first([&](auto nextTask) { + // Propagating the exception would be nontrivial, and signal actions are not supposed to throw exceptions + ServiceRegistry::Operate op(token); + CMS_SA_ALLOW try { activityRegistry->preWriteProcessBlockSignal_(globalContext); } catch (...) { + } + for (auto& c : all_output_communicators_) { + c->writeProcessBlockAsync(nextTask, pbp, processContext, activityRegistry); + } + }) | chain::then(doCleanup([activityRegistry, globalContext, token]() { + //services can depend on other services + ServiceRegistry::Operate op(token); - for (auto& c : all_output_communicators_) { - c->writeProcessBlockAsync(tHolder, pbp, processContext, activityRegistry); - } + activityRegistry->postWriteProcessBlockSignal_(globalContext); + })) | + chain::runLast(std::move(task)); } void Schedule::writeLumiAsync(WaitingTaskHolder task, @@ -1315,29 +1315,21 @@ namespace edm { lbp.beginTime(), processContext); - auto t = - make_waiting_task([task, activityRegistry, globalContext, token](std::exception_ptr const* iExcept) mutable { - // Propagating the exception would be nontrivial, and signal actions are not supposed to throw exceptions - CMS_SA_ALLOW try { - //services can depend on other services - ServiceRegistry::Operate op(token); + using namespace edm::waiting_task; + chain::first([&](auto nextTask) { + ServiceRegistry::Operate op(token); + CMS_SA_ALLOW try { activityRegistry->preGlobalWriteLumiSignal_(globalContext); } catch (...) { + } + for (auto& c : all_output_communicators_) { + c->writeLumiAsync(nextTask, lbp, processContext, activityRegistry); + } + }) | chain::then(doCleanup([activityRegistry, globalContext, token]() { + //services can depend on other services + ServiceRegistry::Operate op(token); - activityRegistry->postGlobalWriteLumiSignal_(globalContext); - } catch (...) { - } - std::exception_ptr ptr; - if (iExcept) { - ptr = *iExcept; - } - task.doneWaiting(ptr); - }); - // Propagating the exception would be nontrivial, and signal actions are not supposed to throw exceptions - CMS_SA_ALLOW try { activityRegistry->preGlobalWriteLumiSignal_(globalContext); } catch (...) { - } - WaitingTaskHolder tHolder(*task.group(), t); - for (auto& c : all_output_communicators_) { - c->writeLumiAsync(tHolder, lbp, processContext, activityRegistry); - } + activityRegistry->postGlobalWriteLumiSignal_(globalContext); + })) | + chain::runLast(task); } bool Schedule::shouldWeCloseOutput() const { diff --git a/FWCore/Framework/src/ScheduleItems.cc b/FWCore/Framework/src/ScheduleItems.cc index 5e1bc2348f3a3..cb6abcf2b5c81 100644 --- a/FWCore/Framework/src/ScheduleItems.cc +++ b/FWCore/Framework/src/ScheduleItems.cc @@ -13,7 +13,7 @@ #include "FWCore/Framework/src/SubProcess.h" #include "FWCore/Framework/interface/Schedule.h" #include "FWCore/Framework/interface/TriggerNamesService.h" -#include "FWCore/Framework/src/SignallingProductRegistry.h" +#include "FWCore/Framework/interface/SignallingProductRegistry.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h" #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" diff --git a/FWCore/Framework/src/SharedResourcesRegistry.cc b/FWCore/Framework/src/SharedResourcesRegistry.cc index 8d5543b162d5e..752f079f52f6d 100644 --- a/FWCore/Framework/src/SharedResourcesRegistry.cc +++ b/FWCore/Framework/src/SharedResourcesRegistry.cc @@ -15,7 +15,7 @@ #include // user include files -#include "SharedResourcesRegistry.h" +#include "FWCore/Framework/interface/SharedResourcesRegistry.h" #include "FWCore/Framework/interface/SharedResourcesAcquirer.h" namespace edm { diff --git a/FWCore/Framework/src/SignallingProductRegistry.cc b/FWCore/Framework/src/SignallingProductRegistry.cc index acf2c13b29f89..9554fcdd769d4 100644 --- a/FWCore/Framework/src/SignallingProductRegistry.cc +++ b/FWCore/Framework/src/SignallingProductRegistry.cc @@ -13,7 +13,7 @@ // system include files // user include files -#include "FWCore/Framework/src/SignallingProductRegistry.h" +#include "FWCore/Framework/interface/SignallingProductRegistry.h" #include "FWCore/Utilities/interface/Exception.h" using namespace edm; diff --git a/FWCore/Framework/src/SourceFactory.cc b/FWCore/Framework/src/SourceFactory.cc index 81b8c93e782e8..4e430e80870d8 100644 --- a/FWCore/Framework/src/SourceFactory.cc +++ b/FWCore/Framework/src/SourceFactory.cc @@ -14,7 +14,7 @@ // user include files #include "FWCore/Framework/interface/SourceFactory.h" -#include "FWCore/Framework/src/EventSetupsController.h" +#include "FWCore/Framework/interface/EventSetupsController.h" #include "FWCore/Utilities/interface/EDMException.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" diff --git a/FWCore/Framework/src/StreamSchedule.cc b/FWCore/Framework/src/StreamSchedule.cc index 32ea3b58d7ae7..43f518d75c1b9 100644 --- a/FWCore/Framework/src/StreamSchedule.cc +++ b/FWCore/Framework/src/StreamSchedule.cc @@ -1,4 +1,4 @@ -#include "FWCore/Framework/src/StreamSchedule.h" +#include "FWCore/Framework/interface/StreamSchedule.h" #include "DataFormats/Provenance/interface/BranchIDListHelper.h" #include "DataFormats/Provenance/interface/ProcessConfiguration.h" @@ -8,14 +8,14 @@ #include "FWCore/Framework/src/TriggerReport.h" #include "FWCore/Framework/src/TriggerTimingReport.h" #include "FWCore/Framework/src/Factory.h" -#include "FWCore/Framework/src/OutputModuleCommunicator.h" +#include "FWCore/Framework/interface/OutputModuleCommunicator.h" #include "FWCore/Framework/src/TriggerResultInserter.h" #include "FWCore/Framework/src/PathStatusInserter.h" #include "FWCore/Framework/src/EndPathStatusInserter.h" -#include "FWCore/Framework/src/WorkerInPath.h" -#include "FWCore/Framework/src/ModuleHolder.h" -#include "FWCore/Framework/src/WorkerT.h" -#include "FWCore/Framework/src/ModuleRegistry.h" +#include "FWCore/Framework/interface/WorkerInPath.h" +#include "FWCore/Framework/interface/maker/ModuleHolder.h" +#include "FWCore/Framework/interface/maker/WorkerT.h" +#include "FWCore/Framework/interface/ModuleRegistry.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" diff --git a/FWCore/Framework/src/SubProcess.cc b/FWCore/Framework/src/SubProcess.cc index ab3e793ebe01d..5aae9d47b243a 100644 --- a/FWCore/Framework/src/SubProcess.cc +++ b/FWCore/Framework/src/SubProcess.cc @@ -24,12 +24,12 @@ #include "FWCore/Framework/interface/getAllTriggerNames.h" #include "FWCore/Framework/interface/TriggerNamesService.h" #include "FWCore/Framework/interface/ScheduleItems.h" -#include "FWCore/Framework/src/EventSetupsController.h" -#include "FWCore/Framework/src/SignallingProductRegistry.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" -#include "FWCore/Framework/src/streamTransitionAsync.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" -#include "FWCore/Framework/src/globalTransitionAsync.h" +#include "FWCore/Framework/interface/EventSetupsController.h" +#include "FWCore/Framework/interface/SignallingProductRegistry.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/streamTransitionAsync.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/globalTransitionAsync.h" #include "FWCore/Framework/interface/ESRecordsToProxyIndices.h" #include "FWCore/ParameterSet/interface/IllegalParameters.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -37,6 +37,7 @@ #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h" #include "FWCore/Concurrency/interface/WaitingTaskHolder.h" #include "FWCore/Concurrency/interface/WaitingTask.h" +#include "FWCore/Concurrency/interface/chain_first.h" #include "FWCore/Utilities/interface/ExceptionCollector.h" #include "boost/range/adaptor/reversed.hpp" @@ -440,33 +441,20 @@ namespace edm { ep.setLuminosityBlockPrincipal(inUseLumiPrincipals_[principal.luminosityBlockPrincipal().index()].get()); propagateProducts(InEvent, principal, ep); - WaitingTaskHolder finalizeEventTask(*iHolder.group(), - make_waiting_task([&ep, iHolder](std::exception_ptr const* iPtr) mutable { - ep.clearEventPrincipal(); - if (iPtr) { - iHolder.doneWaiting(*iPtr); - } else { - iHolder.doneWaiting(std::exception_ptr()); - } - })); - WaitingTaskHolder afterProcessTask; - if (subProcesses_.empty()) { - afterProcessTask = std::move(finalizeEventTask); - } else { - afterProcessTask = WaitingTaskHolder( - *iHolder.group(), - make_waiting_task([this, &ep, finalizeEventTask, iEventSetupImpls](std::exception_ptr const* iPtr) mutable { - if (not iPtr) { - for (auto& subProcess : boost::adaptors::reverse(subProcesses_)) { - subProcess.doEventAsync(finalizeEventTask, ep, iEventSetupImpls); - } - } else { - finalizeEventTask.doneWaiting(*iPtr); - } - })); - } - EventTransitionInfo info(ep, *((*iEventSetupImpls)[esp_->subProcessIndex()])); - schedule_->processOneEventAsync(std::move(afterProcessTask), ep.streamID().value(), info, serviceToken_); + using namespace edm::waiting_task; + chain::first([&](auto nextTask) { + EventTransitionInfo info(ep, *((*iEventSetupImpls)[esp_->subProcessIndex()])); + schedule_->processOneEventAsync(std::move(nextTask), ep.streamID().value(), info, serviceToken_); + }) | chain::ifThen(not subProcesses_.empty(), [this, &ep, iEventSetupImpls](auto nextTask) { + for (auto& subProcess : boost::adaptors::reverse(subProcesses_)) { + subProcess.doEventAsync(nextTask, ep, iEventSetupImpls); + } + }) | chain::then([&ep](std::exception_ptr const* iPtr, auto nextTask) { + ep.clearEventPrincipal(); + if (iPtr) { + nextTask.doneWaiting(*iPtr); + } + }) | chain::runLast(std::move(iHolder)); } template <> @@ -510,48 +498,37 @@ namespace edm { ProcessBlockTransitionInfo transitionInfo(processBlockPrincipal); if (parentProducedProductIsKept(parentPrincipal, processBlockPrincipal)) { - auto& taskGroup = *iHolder.group(); - auto runEndProcessBlock = - make_waiting_task([this, iWait = std::move(iHolder), info = transitionInfo, cleaningUpAfterException]( - std::exception_ptr const* iPtr) mutable { + ProcessBlockPrincipal& inputProcessBlockPrincipal = principalCache_.inputProcessBlockPrincipal(); + inputProcessBlockPrincipal.fillProcessBlockPrincipal(parentPrincipal.processName(), parentPrincipal.reader()); + propagateProducts(InProcess, parentPrincipal, inputProcessBlockPrincipal); + ProcessBlockTransitionInfo inputTransitionInfo(inputProcessBlockPrincipal); + + using namespace edm::waiting_task; + chain::first([&](const std::exception_ptr*, auto nextTask) { + using TraitsInput = OccurrenceTraits; + beginGlobalTransitionAsync(std::move(nextTask), + *schedule_, + inputTransitionInfo, + serviceToken_, + subProcesses_, + cleaningUpAfterException); + }) | chain::then([this](auto nextTask) { writeProcessBlockAsync(nextTask, ProcessBlockType::Input); }) | + chain::then([this, info = transitionInfo, cleaningUpAfterException](std::exception_ptr const* iPtr, + auto nextTask) mutable { ProcessBlockPrincipal& inputProcessBlockPrincipal = principalCache_.inputProcessBlockPrincipal(); inputProcessBlockPrincipal.clearPrincipal(); for (auto& s : subProcesses_) { s.clearProcessBlockPrincipal(ProcessBlockType::Input); } if (iPtr) { - iWait.doneWaiting(*iPtr); + nextTask.doneWaiting(*iPtr); } else { using Traits = OccurrenceTraits; endGlobalTransitionAsync( - std::move(iWait), *schedule_, info, serviceToken_, subProcesses_, cleaningUpAfterException); + std::move(nextTask), *schedule_, info, serviceToken_, subProcesses_, cleaningUpAfterException); } - }); - WaitingTaskHolder holder(taskGroup, runEndProcessBlock); - - auto runWriteProcessBlock = - make_waiting_task([this, iWait = std::move(holder)](std::exception_ptr const* iPtr) mutable { - if (iPtr) { - iWait.doneWaiting(*iPtr); - } else { - writeProcessBlockAsync(iWait, ProcessBlockType::Input); - } - }); - WaitingTaskHolder writeHolder(taskGroup, runWriteProcessBlock); - - ProcessBlockPrincipal& inputProcessBlockPrincipal = principalCache_.inputProcessBlockPrincipal(); - inputProcessBlockPrincipal.fillProcessBlockPrincipal(parentPrincipal.processName(), parentPrincipal.reader()); - propagateProducts(InProcess, parentPrincipal, inputProcessBlockPrincipal); - ProcessBlockTransitionInfo inputTransitionInfo(inputProcessBlockPrincipal); - - using TraitsInput = OccurrenceTraits; - beginGlobalTransitionAsync(std::move(writeHolder), - *schedule_, - inputTransitionInfo, - serviceToken_, - subProcesses_, - cleaningUpAfterException); - + }) | + chain::runLast(std::move(iHolder)); } else { using Traits = OccurrenceTraits; endGlobalTransitionAsync( @@ -603,22 +580,17 @@ namespace edm { } void SubProcess::writeProcessBlockAsync(edm::WaitingTaskHolder task, ProcessBlockType processBlockType) { - ServiceRegistry::Operate operate(serviceToken_); - - auto subTasks = edm::make_waiting_task([this, task, processBlockType](std::exception_ptr const* iExcept) mutable { - if (iExcept) { - task.doneWaiting(*iExcept); - } else { - ServiceRegistry::Operate operate(serviceToken_); - for (auto& s : subProcesses_) { - s.writeProcessBlockAsync(task, processBlockType); - } + using namespace edm::waiting_task; + chain::first([&](std::exception_ptr const*, auto nextTask) { + ServiceRegistry::Operate operate(serviceToken_); + schedule_->writeProcessBlockAsync( + nextTask, principalCache_.processBlockPrincipal(processBlockType), &processContext_, actReg_.get()); + }) | chain::ifThen(not subProcesses_.empty(), [this, processBlockType](auto nextTask) { + ServiceRegistry::Operate operate(serviceToken_); + for (auto& s : subProcesses_) { + s.writeProcessBlockAsync(nextTask, processBlockType); } - }); - schedule_->writeProcessBlockAsync(WaitingTaskHolder(*task.group(), subTasks), - principalCache_.processBlockPrincipal(processBlockType), - &processContext_, - actReg_.get()); + }) | chain::runLast(std::move(task)); } void SubProcess::writeRunAsync(edm::WaitingTaskHolder task, @@ -630,22 +602,23 @@ namespace edm { assert(it != parentToChildPhID_.end()); auto const& childPhID = it->second; - auto subTasks = edm::make_waiting_task( - [this, childPhID, runNumber, task, mergeableRunProductMetadata](std::exception_ptr const* iExcept) mutable { - if (iExcept) { - task.doneWaiting(*iExcept); - } else { - ServiceRegistry::Operate operateWriteRun(serviceToken_); - for (auto& s : subProcesses_) { - s.writeRunAsync(task, childPhID, runNumber, mergeableRunProductMetadata); - } - } - }); - schedule_->writeRunAsync(WaitingTaskHolder(*task.group(), subTasks), - principalCache_.runPrincipal(childPhID, runNumber), - &processContext_, - actReg_.get(), - mergeableRunProductMetadata); + using namespace edm::waiting_task; + chain::first([&](std::exception_ptr const*, auto nextTask) { + ServiceRegistry::Operate operate(serviceToken_); + schedule_->writeRunAsync(nextTask, + principalCache_.runPrincipal(childPhID, runNumber), + &processContext_, + actReg_.get(), + mergeableRunProductMetadata); + }) | + chain::ifThen(not subProcesses_.empty(), + [this, childPhID, runNumber, mergeableRunProductMetadata](auto nextTask) { + ServiceRegistry::Operate operateWriteRun(serviceToken_); + for (auto& s : subProcesses_) { + s.writeRunAsync(nextTask, childPhID, runNumber, mergeableRunProductMetadata); + } + }) | + chain::runLast(task); } void SubProcess::deleteRunFromCache(ProcessHistoryID const& parentPhID, int runNumber) { @@ -702,20 +675,18 @@ namespace edm { } void SubProcess::writeLumiAsync(WaitingTaskHolder task, LuminosityBlockPrincipal& principal) { - ServiceRegistry::Operate operate(serviceToken_); + using namespace edm::waiting_task; auto l = inUseLumiPrincipals_[principal.index()]; - auto subTasks = edm::make_waiting_task([this, l, task](std::exception_ptr const* iExcept) mutable { - if (iExcept) { - task.doneWaiting(*iExcept); - } else { - ServiceRegistry::Operate operateWriteLumi(serviceToken_); - for (auto& s : subProcesses_) { - s.writeLumiAsync(task, *l); - } + chain::first([&](std::exception_ptr const*, auto nextTask) { + ServiceRegistry::Operate operate(serviceToken_); + schedule_->writeLumiAsync(nextTask, *l, &processContext_, actReg_.get()); + }) | chain::ifThen(not subProcesses_.empty(), [this, l](auto nextTask) { + ServiceRegistry::Operate operateWriteLumi(serviceToken_); + for (auto& s : subProcesses_) { + s.writeLumiAsync(nextTask, *l); } - }); - schedule_->writeLumiAsync(WaitingTaskHolder(*task.group(), subTasks), *l, &processContext_, actReg_.get()); + }) | chain::runLast(std::move(task)); } void SubProcess::deleteLumiFromCache(LuminosityBlockPrincipal& principal) { diff --git a/FWCore/Framework/src/SubProcess.h b/FWCore/Framework/src/SubProcess.h index fcd3e811508f8..5ca673eb388f5 100644 --- a/FWCore/Framework/src/SubProcess.h +++ b/FWCore/Framework/src/SubProcess.h @@ -6,7 +6,7 @@ #include "FWCore/Framework/interface/EventSetupProvider.h" #include "FWCore/Framework/interface/EDConsumerBase.h" #include "FWCore/Framework/interface/PathsAndConsumesOfModules.h" -#include "FWCore/Framework/src/PrincipalCache.h" +#include "FWCore/Framework/interface/PrincipalCache.h" #include "FWCore/Framework/interface/Schedule.h" #include "FWCore/Framework/interface/TriggerResultsBasedEventSelector.h" #include "FWCore/Framework/interface/ProductSelectorRules.h" diff --git a/FWCore/Framework/src/SynchronousEventSetupsController.h b/FWCore/Framework/src/SynchronousEventSetupsController.h index a5cf62bf48a89..56963dfe21eb8 100644 --- a/FWCore/Framework/src/SynchronousEventSetupsController.h +++ b/FWCore/Framework/src/SynchronousEventSetupsController.h @@ -18,7 +18,7 @@ // Created: Wed Jan 12 14:30:42 CST 2011 // -#include "EventSetupsController.h" +#include "FWCore/Framework/interface/EventSetupsController.h" #include "tbb/task_group.h" #include "tbb/global_control.h" diff --git a/FWCore/Framework/src/SystemTimeKeeper.cc b/FWCore/Framework/src/SystemTimeKeeper.cc index b50799f953658..9b4fe82d26a50 100644 --- a/FWCore/Framework/src/SystemTimeKeeper.cc +++ b/FWCore/Framework/src/SystemTimeKeeper.cc @@ -24,7 +24,7 @@ #include "FWCore/Framework/src/TriggerTimingReport.h" #include "FWCore/Framework/interface/TriggerNamesService.h" #include "FWCore/Utilities/interface/Algorithms.h" -#include "SystemTimeKeeper.h" +#include "FWCore/Framework/interface/SystemTimeKeeper.h" using namespace edm; @@ -202,9 +202,15 @@ void SystemTimeKeeper::restartModuleEvent(StreamContext const& iStream, ModuleCa } } -void SystemTimeKeeper::startProcessingLoop() { m_processingLoopTimer.start(); } +void SystemTimeKeeper::startProcessingLoop() { + m_processingLoopTimer.start(); + m_processingLoopChildrenTimer.start(); +} -void SystemTimeKeeper::stopProcessingLoop() { m_processingLoopTimer.stop(); } +void SystemTimeKeeper::stopProcessingLoop() { + m_processingLoopTimer.stop(); + m_processingLoopChildrenTimer.stop(); +} static void fillPathSummary(unsigned int iStartIndex, unsigned int iEndIndex, @@ -248,7 +254,7 @@ void SystemTimeKeeper::fillTriggerTimingReport(TriggerTimingReport& rep) const { sumEventTime += stream.realTime(); } rep.eventSummary.realTime = m_processingLoopTimer.realTime(); - rep.eventSummary.cpuTime = m_processingLoopTimer.cpuTime(); + rep.eventSummary.cpuTime = m_processingLoopTimer.cpuTime() + m_processingLoopChildrenTimer.cpuTime(); rep.eventSummary.sumStreamRealTime = sumEventTime; } diff --git a/FWCore/Framework/src/TriggerResultInserter.cc b/FWCore/Framework/src/TriggerResultInserter.cc index 0460b610efa70..83a45c348cabe 100644 --- a/FWCore/Framework/src/TriggerResultInserter.cc +++ b/FWCore/Framework/src/TriggerResultInserter.cc @@ -8,7 +8,7 @@ namespace edm { TriggerResultInserter::TriggerResultInserter(const ParameterSet& pset, unsigned int iNStreams) - : resultsPerStream_(iNStreams), pset_id_(pset.id()), token_{produces()} {} + : resultsPerStream_(iNStreams), pset_id_(pset.id()), token_{produces()} {} void TriggerResultInserter::setTrigResultForStream(unsigned int iStreamIndex, const TrigResPtr& trptr) { resultsPerStream_[iStreamIndex] = trptr; diff --git a/FWCore/Framework/src/UnscheduledAuxiliary.cc b/FWCore/Framework/src/UnscheduledAuxiliary.cc index 94679bb5de21a..3acdcf1a9ca18 100644 --- a/FWCore/Framework/src/UnscheduledAuxiliary.cc +++ b/FWCore/Framework/src/UnscheduledAuxiliary.cc @@ -13,7 +13,7 @@ // system include files // user include files -#include "UnscheduledAuxiliary.h" +#include "FWCore/Framework/interface/UnscheduledAuxiliary.h" // // constants, enums and typedefs diff --git a/FWCore/Framework/src/Worker.cc b/FWCore/Framework/src/Worker.cc index 4eea40ca1ba64..a08036f070c38 100644 --- a/FWCore/Framework/src/Worker.cc +++ b/FWCore/Framework/src/Worker.cc @@ -2,8 +2,8 @@ /*---------------------------------------------------------------------- ----------------------------------------------------------------------*/ #include "FWCore/Concurrency/interface/include_first_syncWait.h" -#include "FWCore/Framework/src/Worker.h" -#include "FWCore/Framework/src/EarlyDeleteHelper.h" +#include "FWCore/Framework/interface/maker/Worker.h" +#include "FWCore/Framework/interface/EarlyDeleteHelper.h" #include "FWCore/Framework/interface/EventPrincipal.h" #include "FWCore/Framework/interface/EventSetupImpl.h" #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h" diff --git a/FWCore/Framework/src/WorkerInPath.cc b/FWCore/Framework/src/WorkerInPath.cc index 5beb28b13e4c7..4c58839ca8b33 100644 --- a/FWCore/Framework/src/WorkerInPath.cc +++ b/FWCore/Framework/src/WorkerInPath.cc @@ -1,6 +1,6 @@ -#include "FWCore/Framework/src/WorkerInPath.h" +#include "FWCore/Framework/interface/WorkerInPath.h" namespace edm { WorkerInPath::WorkerInPath(Worker* w, FilterAction theFilterAction, unsigned int placeInPath, bool runConcurrently) diff --git a/FWCore/Framework/src/WorkerMaker.cc b/FWCore/Framework/src/WorkerMaker.cc index 84813794ff061..7cee114f9d48b 100644 --- a/FWCore/Framework/src/WorkerMaker.cc +++ b/FWCore/Framework/src/WorkerMaker.cc @@ -1,5 +1,5 @@ -#include "FWCore/Framework/src/WorkerMaker.h" +#include "FWCore/Framework/interface/maker/WorkerMaker.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/Registry.h" #include "DataFormats/Provenance/interface/ModuleDescription.h" diff --git a/FWCore/Framework/src/WorkerRegistry.cc b/FWCore/Framework/src/WorkerRegistry.cc index 8c24d3a3df2cf..f0464ce57a050 100644 --- a/FWCore/Framework/src/WorkerRegistry.cc +++ b/FWCore/Framework/src/WorkerRegistry.cc @@ -6,11 +6,11 @@ \date 18 May 2005 */ #include -#include "FWCore/Framework/src/WorkerRegistry.h" -#include "FWCore/Framework/src/Worker.h" -#include "FWCore/Framework/src/ModuleHolder.h" -#include "FWCore/Framework/src/MakeModuleParams.h" -#include "FWCore/Framework/src/ModuleRegistry.h" +#include "FWCore/Framework/interface/WorkerRegistry.h" +#include "FWCore/Framework/interface/maker/Worker.h" +#include "FWCore/Framework/interface/maker/ModuleHolder.h" +#include "FWCore/Framework/interface/maker/MakeModuleParams.h" +#include "FWCore/Framework/interface/ModuleRegistry.h" #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h" namespace edm { diff --git a/FWCore/Framework/src/WorkerT.cc b/FWCore/Framework/src/WorkerT.cc index a3d10062dc97d..77ae243fecaaf 100644 --- a/FWCore/Framework/src/WorkerT.cc +++ b/FWCore/Framework/src/WorkerT.cc @@ -1,4 +1,4 @@ -#include "FWCore/Framework/src/WorkerT.h" +#include "FWCore/Framework/interface/maker/WorkerT.h" #include "FWCore/Framework/interface/EventPrincipal.h" #include "FWCore/Framework/interface/EDProducer.h" diff --git a/FWCore/Framework/src/global/EDAnalyzerBase.cc b/FWCore/Framework/src/global/EDAnalyzerBase.cc index 64ca4ad3fce9a..f1a1c2125029b 100644 --- a/FWCore/Framework/src/global/EDAnalyzerBase.cc +++ b/FWCore/Framework/src/global/EDAnalyzerBase.cc @@ -20,9 +20,9 @@ #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/src/edmodule_mightGet_config.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Framework/src/EventSignalsSentry.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" diff --git a/FWCore/Framework/src/global/EDFilterBase.cc b/FWCore/Framework/src/global/EDFilterBase.cc index 488d8799c37c0..7ee20416e40c9 100644 --- a/FWCore/Framework/src/global/EDFilterBase.cc +++ b/FWCore/Framework/src/global/EDFilterBase.cc @@ -23,9 +23,9 @@ #include "FWCore/Framework/interface/global/EDFilterBase.h" #include "FWCore/Framework/src/EventAcquireSignalsSentry.h" #include "FWCore/Framework/src/EventSignalsSentry.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Framework/src/edmodule_mightGet_config.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/ServiceRegistry/interface/ESParentContext.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" diff --git a/FWCore/Framework/src/global/EDProducerBase.cc b/FWCore/Framework/src/global/EDProducerBase.cc index 8d24bcb498b70..b3ef3bf4c50b5 100644 --- a/FWCore/Framework/src/global/EDProducerBase.cc +++ b/FWCore/Framework/src/global/EDProducerBase.cc @@ -23,9 +23,9 @@ #include "FWCore/Framework/interface/global/EDProducerBase.h" #include "FWCore/Framework/src/EventAcquireSignalsSentry.h" #include "FWCore/Framework/src/EventSignalsSentry.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Framework/src/edmodule_mightGet_config.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/ServiceRegistry/interface/ESParentContext.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" diff --git a/FWCore/Framework/src/global/OutputModuleBase.cc b/FWCore/Framework/src/global/OutputModuleBase.cc index 19dd868d6de41..1931724b4e9f8 100644 --- a/FWCore/Framework/src/global/OutputModuleBase.cc +++ b/FWCore/Framework/src/global/OutputModuleBase.cc @@ -29,7 +29,7 @@ #include "FWCore/Framework/src/OutputModuleDescription.h" #include "FWCore/Framework/interface/TriggerNamesService.h" #include "FWCore/Framework/src/EventSignalsSentry.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Framework/src/EventAcquireSignalsSentry.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" diff --git a/FWCore/Framework/src/limited/EDAnalyzerBase.cc b/FWCore/Framework/src/limited/EDAnalyzerBase.cc index af70265548374..51e8b2e2e1eab 100644 --- a/FWCore/Framework/src/limited/EDAnalyzerBase.cc +++ b/FWCore/Framework/src/limited/EDAnalyzerBase.cc @@ -20,9 +20,9 @@ #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/src/edmodule_mightGet_config.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Framework/src/EventSignalsSentry.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" diff --git a/FWCore/Framework/src/limited/EDFilterBase.cc b/FWCore/Framework/src/limited/EDFilterBase.cc index 2f26a2e03f8a4..c89a64405e530 100644 --- a/FWCore/Framework/src/limited/EDFilterBase.cc +++ b/FWCore/Framework/src/limited/EDFilterBase.cc @@ -22,9 +22,9 @@ #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/limited/EDFilterBase.h" #include "FWCore/Framework/src/EventSignalsSentry.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Framework/src/edmodule_mightGet_config.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/ServiceRegistry/interface/ESParentContext.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" diff --git a/FWCore/Framework/src/limited/EDProducerBase.cc b/FWCore/Framework/src/limited/EDProducerBase.cc index 8d167ec15ea73..7e8058fa07847 100644 --- a/FWCore/Framework/src/limited/EDProducerBase.cc +++ b/FWCore/Framework/src/limited/EDProducerBase.cc @@ -22,9 +22,9 @@ #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/limited/EDProducerBase.h" #include "FWCore/Framework/src/EventSignalsSentry.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Framework/src/edmodule_mightGet_config.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/ServiceRegistry/interface/ESParentContext.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" diff --git a/FWCore/Framework/src/limited/OutputModuleBase.cc b/FWCore/Framework/src/limited/OutputModuleBase.cc index 67fcd9916ec72..0a5156070efc5 100644 --- a/FWCore/Framework/src/limited/OutputModuleBase.cc +++ b/FWCore/Framework/src/limited/OutputModuleBase.cc @@ -29,7 +29,7 @@ #include "FWCore/Framework/src/OutputModuleDescription.h" #include "FWCore/Framework/interface/TriggerNamesService.h" #include "FWCore/Framework/src/EventSignalsSentry.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" diff --git a/FWCore/Framework/src/one/EDAnalyzerBase.cc b/FWCore/Framework/src/one/EDAnalyzerBase.cc index 30518265e1382..a35ba9eb02c69 100644 --- a/FWCore/Framework/src/one/EDAnalyzerBase.cc +++ b/FWCore/Framework/src/one/EDAnalyzerBase.cc @@ -21,8 +21,8 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/src/edmodule_mightGet_config.h" #include "FWCore/Framework/src/EventSignalsSentry.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" diff --git a/FWCore/Framework/src/one/EDFilterBase.cc b/FWCore/Framework/src/one/EDFilterBase.cc index 60395400dacb2..cc3322c0253c4 100644 --- a/FWCore/Framework/src/one/EDFilterBase.cc +++ b/FWCore/Framework/src/one/EDFilterBase.cc @@ -20,9 +20,9 @@ #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/src/edmodule_mightGet_config.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Framework/src/EventSignalsSentry.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/ServiceRegistry/interface/ESParentContext.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" diff --git a/FWCore/Framework/src/one/EDProducerBase.cc b/FWCore/Framework/src/one/EDProducerBase.cc index 8b8e369c87d47..621eb4d1e56a8 100644 --- a/FWCore/Framework/src/one/EDProducerBase.cc +++ b/FWCore/Framework/src/one/EDProducerBase.cc @@ -20,9 +20,9 @@ #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/src/edmodule_mightGet_config.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Framework/src/EventSignalsSentry.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/ServiceRegistry/interface/ESParentContext.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" diff --git a/FWCore/Framework/src/one/OutputModuleBase.cc b/FWCore/Framework/src/one/OutputModuleBase.cc index 87a879f1aa983..9a85555ff6b32 100644 --- a/FWCore/Framework/src/one/OutputModuleBase.cc +++ b/FWCore/Framework/src/one/OutputModuleBase.cc @@ -31,7 +31,7 @@ #include "FWCore/Framework/src/OutputModuleDescription.h" #include "FWCore/Framework/interface/TriggerNamesService.h" #include "FWCore/Framework/src/EventSignalsSentry.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" diff --git a/FWCore/Framework/src/one/implementorsMethods.h b/FWCore/Framework/src/one/implementorsMethods.h index 46fba4548e164..726b73d06abe0 100644 --- a/FWCore/Framework/src/one/implementorsMethods.h +++ b/FWCore/Framework/src/one/implementorsMethods.h @@ -22,7 +22,7 @@ // user include files #include "FWCore/Framework/interface/one/implementors.h" -#include "FWCore/Framework/src/SharedResourcesRegistry.h" +#include "FWCore/Framework/interface/SharedResourcesRegistry.h" #include "FWCore/Framework/interface/SharedResourcesAcquirer.h" // forward declarations diff --git a/FWCore/Framework/src/stream/EDAnalyzerAdaptorBase.cc b/FWCore/Framework/src/stream/EDAnalyzerAdaptorBase.cc index 87b0da0833f4d..2cff309ee689c 100644 --- a/FWCore/Framework/src/stream/EDAnalyzerAdaptorBase.cc +++ b/FWCore/Framework/src/stream/EDAnalyzerAdaptorBase.cc @@ -25,9 +25,9 @@ #include "FWCore/Framework/interface/RunPrincipal.h" #include "FWCore/ServiceRegistry/interface/ESParentContext.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Framework/src/EventSignalsSentry.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" using namespace edm::stream; // diff --git a/FWCore/Framework/src/stream/EDFilterAdaptorBase.cc b/FWCore/Framework/src/stream/EDFilterAdaptorBase.cc index 7cb496bd7f209..8ce606196fe2d 100644 --- a/FWCore/Framework/src/stream/EDFilterAdaptorBase.cc +++ b/FWCore/Framework/src/stream/EDFilterAdaptorBase.cc @@ -25,7 +25,7 @@ #include "FWCore/Framework/src/EventAcquireSignalsSentry.h" #include "FWCore/Framework/src/EventSignalsSentry.h" #include "FWCore/Framework/src/stream/ProducingModuleAdaptorBase.cc" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/ServiceRegistry/interface/ESParentContext.h" using namespace edm::stream; diff --git a/FWCore/Framework/src/stream/EDProducerAdaptorBase.cc b/FWCore/Framework/src/stream/EDProducerAdaptorBase.cc index b48358274bffa..8e515516c548d 100644 --- a/FWCore/Framework/src/stream/EDProducerAdaptorBase.cc +++ b/FWCore/Framework/src/stream/EDProducerAdaptorBase.cc @@ -25,7 +25,7 @@ #include "FWCore/Framework/src/EventAcquireSignalsSentry.h" #include "FWCore/Framework/src/EventSignalsSentry.h" #include "FWCore/Framework/src/stream/ProducingModuleAdaptorBase.cc" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/ServiceRegistry/interface/ESParentContext.h" using namespace edm::stream; diff --git a/FWCore/Framework/src/stream/ProducingModuleAdaptorBase.cc b/FWCore/Framework/src/stream/ProducingModuleAdaptorBase.cc index 39ee2326670f2..b34073bfe8425 100644 --- a/FWCore/Framework/src/stream/ProducingModuleAdaptorBase.cc +++ b/FWCore/Framework/src/stream/ProducingModuleAdaptorBase.cc @@ -20,8 +20,8 @@ #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/RunPrincipal.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/ServiceRegistry/interface/ESParentContext.h" // diff --git a/FWCore/Framework/src/throwIfImproperDependencies.cc b/FWCore/Framework/src/throwIfImproperDependencies.cc deleted file mode 100644 index fc3aa87610fed..0000000000000 --- a/FWCore/Framework/src/throwIfImproperDependencies.cc +++ /dev/null @@ -1,517 +0,0 @@ -// -*- ++ -*- -// -// Package: FWCore/Framework -// Function: throwIfImproperDependencies -// -// Implementation: -// [Notes on implementation] -// -// Original Author: root -// Created: Tue, 06 Sep 2016 16:04:28 GMT -// - -// system include files - -// user include files -#include "FWCore/Framework/src/throwIfImproperDependencies.h" -#include "FWCore/Utilities/interface/EDMException.h" - -#include "boost/graph/graph_traits.hpp" -#include "boost/graph/adjacency_list.hpp" -#include "boost/graph/depth_first_search.hpp" -#include "boost/graph/visitors.hpp" - -namespace { - //==================================== - // checkForCorrectness algorithm - // - // The code creates a 'dependency' graph between all - // modules. A module depends on another module if - // 1) it 'consumes' data produced by that module - // 2) it appears directly after the module within a Path - // - // If there is a cycle in the 'dependency' graph then - // the schedule may be unrunnable. The schedule is still - // runnable if all cycles have at least two edges which - // connect modules only by Path dependencies (i.e. not - // linked by a data dependency). - // - // Example 1: - // C consumes data from B - // Path 1: A + B + C - // Path 2: B + C + A - // - // Cycle: A after C [p2], C consumes B, B after A [p1] - // Since this cycle has 2 path only edges it is OK since - // A and (B+C) are independent so their run order doesn't matter - // - // Example 2: - // B consumes A - // C consumes B - // Path: C + A - // - // Cycle: A after C [p], C consumes B, B consumes A - // Since this cycle has 1 path only edge it is unrunnable. - // - // Example 3: - // A consumes B - // B consumes C - // C consumes A - // (no Path since unscheduled execution) - // - // Cycle: A consumes B, B consumes C, C consumes A - // Since this cycle has 0 path only edges it is unrunnable. - //==================================== - - typedef std::pair SimpleEdge; - typedef std::map> EdgeToPathMap; - - typedef boost::adjacency_list Graph; - - typedef boost::graph_traits::edge_descriptor Edge; - - template - std::unordered_set intersect(std::unordered_set const& iLHS, std::unordered_set const& iRHS) { - std::unordered_set result; - if (iLHS.size() < iRHS.size()) { - result.reserve(iLHS.size()); - for (auto const& l : iLHS) { - if (iRHS.find(l) != iRHS.end()) { - result.insert(l); - } - } - return result; - } - result.reserve(iRHS.size()); - for (auto const& r : iRHS) { - if (iLHS.find(r) != iLHS.end()) { - result.insert(r); - } - } - return result; - } - - struct cycle_detector : public boost::dfs_visitor<> { - static const unsigned int kRootVertexIndex = 0; - - cycle_detector(EdgeToPathMap const& iEdgeToPathMap, - std::vector> const& iPathIndexToModuleIndexOrder, - std::vector const& iPathNames, - std::unordered_map const& iModuleIndexToNames) - : m_edgeToPathMap(iEdgeToPathMap), - m_pathIndexToModuleIndexOrder(iPathIndexToModuleIndexOrder), - m_pathNames(iPathNames), - m_indexToNames(iModuleIndexToNames) {} - - bool compare(Edge const& iLHS, Edge const& iRHS) const; - - void tree_edge(Edge const& iEdge, Graph const& iGraph) { - auto const& index = get(boost::vertex_index, iGraph); - - auto in = index[source(iEdge, iGraph)]; - for (auto it = m_stack.begin(); it != m_stack.end(); ++it) { - if (in == index[source(*it, iGraph)]) { - //this vertex is now being used to probe a new edge - // so we should drop the rest of the tree - m_stack.erase(it, m_stack.end()); - break; - } - } - - m_stack.push_back(iEdge); - } - - void finish_vertex(unsigned int iVertex, Graph const& iGraph) { - if (not m_stack.empty()) { - auto const& index = get(boost::vertex_index, iGraph); - - if (iVertex == index[source(m_stack.back(), iGraph)]) { - m_stack.pop_back(); - } - } - } - - //Called if a cycle happens - void back_edge(Edge const& iEdge, Graph const& iGraph) { - auto const& index = get(boost::vertex_index, iGraph); - - if (kRootVertexIndex != index[source(m_stack.front(), iGraph)]) { - //this part of the graph is not connected to data processing - return; - } - - m_stack.push_back(iEdge); - - auto pop_stack = [](std::vector* stack) { stack->pop_back(); }; - std::unique_ptr, decltype(pop_stack)> guard(&m_stack, pop_stack); - - //This edge has not been added to the stack yet - // making a copy allows us to add it in but not worry - // about removing it at the end of the routine - std::vector tempStack; - - tempStack = findMinimumCycle(m_stack, iGraph); - checkCycleForProblem(tempStack, iGraph); - for (auto const& edge : tempStack) { - unsigned int in = index[source(edge, iGraph)]; - unsigned int out = index[target(edge, iGraph)]; - - m_verticiesInFundamentalCycles.insert(in); - m_verticiesInFundamentalCycles.insert(out); - } - - //NOTE: Need to remove any 'extra' bits at beginning of stack - // which may not be part of the cycle - m_fundamentalCycles.emplace_back(std::move(tempStack)); - } - - void forward_or_cross_edge(Edge iEdge, Graph const& iGraph) { - typedef typename boost::property_map::type IndexMap; - IndexMap const& index = get(boost::vertex_index, iGraph); - - if (kRootVertexIndex != index[source(m_stack.front(), iGraph)]) { - //this part of the graph is not connected to data processing - return; - } - - const unsigned int out = index[target(iEdge, iGraph)]; - - //If this is a crossing edge whose out vertex is part of a fundamental cycle - // then this path is also part of a cycle - if (m_verticiesInFundamentalCycles.end() == m_verticiesInFundamentalCycles.find(out)) { - return; - } - - for (auto const& cycle : m_fundamentalCycles) { - //Is the out vertex in this cycle? - auto itStartMatch = cycle.end(); - for (auto it = cycle.begin(); it != cycle.end(); ++it) { - unsigned int inCycle = index[source(*it, iGraph)]; - - if (out == inCycle) { - itStartMatch = it; - break; - } - } - if (itStartMatch == cycle.end()) { - //this cycle isn't the one which uses the vertex from the stack - continue; - } - - //tempStack will hold a stack that could have been found by depth first - // search if module to index ordering had been different - m_stack.push_back(iEdge); - auto pop_stack = [](std::vector* stack) { stack->pop_back(); }; - std::unique_ptr, decltype(pop_stack)> guard(&m_stack, pop_stack); - auto tempStack = findMinimumCycle(m_stack, iGraph); - - //the set of 'in' verticies presently in the stack is used to find where an 'out' - // vertex from the fundamental cycle connects into the present stack - std::set verticiesInStack; - for (auto const& edge : tempStack) { - verticiesInStack.insert(index[source(edge, iGraph)]); - } - - //Now find place in the fundamental cycle that attaches to the stack - // First see if that happens later in the stack - auto itLastMatch = cycle.end(); - for (auto it = itStartMatch; it != cycle.end(); ++it) { - unsigned int outCycle = index[target(*it, iGraph)]; - if (verticiesInStack.end() != verticiesInStack.find(outCycle)) { - itLastMatch = it; - break; - } - } - if (itLastMatch == cycle.end()) { - //See if we can find the attachment to the stack earlier in the cycle - tempStack.insert(tempStack.end(), itStartMatch, cycle.end()); - for (auto it = cycle.begin(); it != itStartMatch; ++it) { - unsigned int outCycle = index[target(*it, iGraph)]; - if (verticiesInStack.end() != verticiesInStack.find(outCycle)) { - itLastMatch = it; - break; - } - } - if (itLastMatch == cycle.end()) { - //need to use the full cycle - //NOTE: this should just retest the same cycle but starting - // from a different position. If everything is correct, then - // this should also pass so in principal we could return here. - //However, as long as this isn't a performance problem, having - // this additional check could catch problems in the algorithm. - tempStack.insert(tempStack.end(), cycle.begin(), itStartMatch); - } else { - tempStack.insert(tempStack.end(), cycle.begin(), itLastMatch + 1); - } - } else { - if ((itStartMatch == cycle.begin()) and (cycle.end() == (itLastMatch + 1))) { - //This is just the entire cycle starting where we've already started - // before. Given the cycle was OK before, it would also be OK this time - return; - } - tempStack.insert(tempStack.end(), itStartMatch, itLastMatch + 1); - } - - tempStack = findMinimumCycle(tempStack, iGraph); - checkCycleForProblem(tempStack, iGraph); - } - } - - private: - std::string const& pathName(unsigned int iIndex) const { return m_pathNames[iIndex]; } - - std::string const& moduleName(unsigned int iIndex) const { - auto itFound = m_indexToNames.find(iIndex); - assert(itFound != m_indexToNames.end()); - return itFound->second; - } - - void throwOnError(std::vector const& iEdges, - boost::property_map::type const& iIndex, - Graph const& iGraph) const { - std::stringstream oStream; - oStream << "Module run order problem found: \n"; - bool first_edge = true; - for (auto const& edge : iEdges) { - unsigned int in = iIndex[source(edge, iGraph)]; - unsigned int out = iIndex[target(edge, iGraph)]; - - if (first_edge) { - first_edge = false; - } else { - oStream << ", "; - } - oStream << moduleName(in); - - auto iFound = m_edgeToPathMap.find(SimpleEdge(in, out)); - bool pathDependencyOnly = true; - for (auto dependency : iFound->second) { - if (dependency == edm::graph::kDataDependencyIndex) { - pathDependencyOnly = false; - break; - } - } - if (pathDependencyOnly) { - oStream << " after " << moduleName(out) << " [path " << pathName(iFound->second[0]) << "]"; - } else { - oStream << " consumes " << moduleName(out); - } - } - oStream << "\n Running in the threaded framework would lead to indeterminate results." - "\n Please change order of modules in mentioned Path(s) to avoid inconsistent module ordering."; - - throw edm::Exception(edm::errors::ScheduleExecutionFailure, "Unrunnable schedule\n") << oStream.str() << "\n"; - } - - std::vector findMinimumCycle(std::vector const& iCycleEdges, Graph const& iGraph) const { - //Remove unnecessary edges - // The graph library scans the verticies so we have edges in the list which are - // not part of the cycle but are associated to a vertex contributes to the cycle. - // To find these unneeded edges we work backwards on the edge list looking for cases - // where the 'in' on the previous edge is not the 'out' for the next edge. When this - // happens we know that there are additional edges for that same 'in' which can be - // removed. - - typedef typename boost::property_map::type IndexMap; - IndexMap const& index = get(boost::vertex_index, iGraph); - - std::vector reducedEdges; - reducedEdges.reserve(iCycleEdges.size()); - reducedEdges.push_back(iCycleEdges.back()); - unsigned int lastIn = index[source(iCycleEdges.back(), iGraph)]; - const unsigned int finalVertex = index[target(iCycleEdges.back(), iGraph)]; - for (auto it = iCycleEdges.rbegin() + 1; it != iCycleEdges.rend(); ++it) { - unsigned int in = index[source(*it, iGraph)]; - unsigned int out = index[target(*it, iGraph)]; - if (lastIn == out) { - reducedEdges.push_back(*it); - lastIn = in; - if (in == finalVertex) { - break; - } - } - } - std::reverse(reducedEdges.begin(), reducedEdges.end()); - - return reducedEdges; - } - - void checkCycleForProblem(std::vector const& iCycleEdges, Graph const& iGraph) { - //For a real problem, we need at least one data dependency - // we already know we originate from a path because all tests - // require starting from the root node which connects to all paths - bool hasDataDependency = false; - //Since we are dealing with a circle, we initialize the 'last' info with the end of the graph - typedef typename boost::property_map::type IndexMap; - IndexMap const& index = get(boost::vertex_index, iGraph); - - unsigned int lastIn = index[source(iCycleEdges.back(), iGraph)]; - unsigned int lastOut = index[target(iCycleEdges.back(), iGraph)]; - bool lastEdgeHasDataDepencency = false; - - std::unordered_set lastPathsSeen; - - //If a data dependency appears to make us jump off a path but that module actually - // appears on the path that was left, we need to see if we later come back to that - // path somewhere before that module. If not than it is a false cycle - std::unordered_multimap pathToModulesWhichMustAppearLater; - bool moduleAppearedEarlierInPath = false; - - for (auto dependency : m_edgeToPathMap.find(SimpleEdge(lastIn, lastOut))->second) { - if (dependency != edm::graph::kDataDependencyIndex) { - lastPathsSeen.insert(dependency); - } else { - lastEdgeHasDataDepencency = true; - } - } - //Need to check that the - bool minimumInitialPathsSet = false; - std::unordered_set initialPaths(lastPathsSeen); - std::unordered_set sharedPaths; - for (auto const& edge : iCycleEdges) { - unsigned int in = index[source(edge, iGraph)]; - unsigned int out = index[target(edge, iGraph)]; - - auto iFound = m_edgeToPathMap.find(SimpleEdge(in, out)); - std::unordered_set pathsOnEdge; - bool edgeHasDataDependency = false; - for (auto dependency : iFound->second) { - if (dependency == edm::graph::kDataDependencyIndex) { - //need to count only if this moves us to a new path - hasDataDependency = true; - edgeHasDataDependency = true; - } else { - pathsOnEdge.insert(dependency); - - auto const& pathIndicies = m_pathIndexToModuleIndexOrder[dependency]; - auto pathToCheckRange = pathToModulesWhichMustAppearLater.equal_range(dependency); - for (auto it = pathToCheckRange.first; it != pathToCheckRange.second;) { - auto moduleIDToCheck = it->second; - if (moduleIDToCheck == in or moduleIDToCheck == out) { - auto toErase = it; - ++it; - pathToModulesWhichMustAppearLater.erase(toErase); - continue; - } - bool alreadyAdvanced = false; - for (auto pathIndex : pathIndicies) { - if (pathIndex == out) { - //we must have skipped over the module so the earlier worry about the - // module being called on the path was wrong - auto toErase = it; - ++it; - alreadyAdvanced = true; - pathToModulesWhichMustAppearLater.erase(toErase); - break; - } - if (pathIndex == moduleIDToCheck) { - //module still earlier on the path - break; - } - } - if (not alreadyAdvanced) { - ++it; - } - } - } - } - sharedPaths = intersect(pathsOnEdge, lastPathsSeen); - if (sharedPaths.empty()) { - minimumInitialPathsSet = true; - if ((not edgeHasDataDependency) and (not lastEdgeHasDataDepencency) and (not lastPathsSeen.empty())) { - //If we jumped from one path to another without a data dependency - // than the cycle is just because two independent modules were - // scheduled in different arbitrary order on different paths - return; - } - if (edgeHasDataDependency and not lastPathsSeen.empty()) { - //If the paths we were on had this module we are going to earlier - // on their paths than we do not have a real cycle - bool atLeastOnePathFailed = false; - std::vector pathsToWatch; - pathsToWatch.reserve(lastPathsSeen.size()); - for (auto seenPath : lastPathsSeen) { - if (pathsOnEdge.end() == pathsOnEdge.find(seenPath)) { - //we left this path so we now need to see if the module 'out' - // is on this path ahead of the module 'in' - bool foundOut = false; - for (auto seenPathIndex : m_pathIndexToModuleIndexOrder[seenPath]) { - if (seenPathIndex == out) { - foundOut = true; - pathsToWatch.push_back(seenPath); - } - if (seenPathIndex == lastOut) { - if (not foundOut) { - atLeastOnePathFailed = true; - } - break; - } - if (atLeastOnePathFailed) { - break; - } - } - } - } - //If all the paths have the module earlier in their paths - // then there was no need to jump between paths to get it - // and this breaks the data cycle - if (not atLeastOnePathFailed) { - moduleAppearedEarlierInPath = true; - for (auto p : pathsToWatch) { - pathToModulesWhichMustAppearLater.emplace(p, out); - } - } - } - lastPathsSeen = pathsOnEdge; - } else { - lastPathsSeen = sharedPaths; - if (not minimumInitialPathsSet) { - initialPaths = sharedPaths; - } - } - lastOut = out; - lastEdgeHasDataDepencency = edgeHasDataDependency; - } - if (moduleAppearedEarlierInPath and not pathToModulesWhichMustAppearLater.empty()) { - return; - } - if (not hasDataDependency) { - return; - } - if ((not initialPaths.empty()) and intersect(initialPaths, sharedPaths).empty()) { - //The effective start and end paths for the first graph - // node do not match. This can happen if the node - // appears on multiple paths - return; - } - throwOnError(iCycleEdges, index, iGraph); - } - - EdgeToPathMap const& m_edgeToPathMap; - std::vector> const& m_pathIndexToModuleIndexOrder; - std::vector const& m_pathNames; - std::unordered_map m_indexToNames; - std::unordered_map> m_pathToModuleIndex; - - std::vector m_stack; - std::vector> m_fundamentalCycles; - std::set m_verticiesInFundamentalCycles; - }; -} // namespace - -void edm::graph::throwIfImproperDependencies(EdgeToPathMap const& iEdgeToPathMap, - std::vector> const& iPathIndexToModuleIndexOrder, - std::vector const& iPathNames, - std::unordered_map const& iModuleIndexToNames) { - //Now use boost graph library to find cycles in the dependencies - std::vector outList; - outList.reserve(iEdgeToPathMap.size()); - for (auto const& edgeInfo : iEdgeToPathMap) { - outList.push_back(edgeInfo.first); - } - - Graph g(outList.begin(), outList.end(), iModuleIndexToNames.size()); - - cycle_detector detector(iEdgeToPathMap, iPathIndexToModuleIndexOrder, iPathNames, iModuleIndexToNames); - boost::depth_first_search(g, boost::visitor(detector)); -} diff --git a/FWCore/Framework/src/throwIfImproperDependencies.h b/FWCore/Framework/src/throwIfImproperDependencies.h deleted file mode 100644 index 6912577710bc8..0000000000000 --- a/FWCore/Framework/src/throwIfImproperDependencies.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef FWCore_Framework_throwIfImproperDependencies_h -#define FWCore_Framework_throwIfImproperDependencies_h -// -*- C++ -*- -// -// Package: FWCore/Framework -// Function: throwIfImproperDependencies -// -/**\function throwIfImproperDependencies throwIfImproperDependencies.h "throwIfImproperDependencies.h" - - Description: Function which uses the graph of dependencies to determine if there are any cycles - - Usage: - - -*/ -// -// Original Author: Chris Jones -// Created: Tue, 06 Sep 2016 16:04:26 GMT -// - -// system include files -#include -#include -#include -#include -#include - -// user include files - -// forward declarations - -namespace edm { - namespace graph { - constexpr auto kInvalidIndex = std::numeric_limits::max(); - //This index is used as the Path index for the case where we are - // describing a data dependency and not a dependency on a Path - constexpr auto kDataDependencyIndex = std::numeric_limits::max(); - - using SimpleEdge = std::pair; - using EdgeToPathMap = std::map>; - - void throwIfImproperDependencies(EdgeToPathMap const&, - std::vector> const& iPathIndexToModuleIndexOrder, - std::vector const& iPathNames, - std::unordered_map const& iModuleIndexToNames); - } // namespace graph -}; // namespace edm - -#endif diff --git a/FWCore/Framework/test/BuildFile.xml b/FWCore/Framework/test/BuildFile.xml index 970412381d6a9..329e5cdacd736 100644 --- a/FWCore/Framework/test/BuildFile.xml +++ b/FWCore/Framework/test/BuildFile.xml @@ -189,7 +189,7 @@ - + @@ -396,3 +396,11 @@ + + + + + + + + diff --git a/FWCore/Framework/test/Event_t.cpp b/FWCore/Framework/test/Event_t.cpp index f57128a2a74f2..793e6bccae147 100644 --- a/FWCore/Framework/test/Event_t.cpp +++ b/FWCore/Framework/test/Event_t.cpp @@ -83,7 +83,7 @@ namespace { template class TestProducer : public edm::ProducerBase { public: - TestProducer(std::string const& productInstanceName) { token_ = produces(productInstanceName); } + TestProducer(std::string const& productInstanceName) { token_ = produces(productInstanceName); } EDPutTokenT token_; }; } // namespace diff --git a/FWCore/Framework/test/throwIfImproperDependencies_t.cppunit.cc b/FWCore/Framework/test/checkForModuleDependencyCorrectness_t.cppunit.cc similarity index 61% rename from FWCore/Framework/test/throwIfImproperDependencies_t.cppunit.cc rename to FWCore/Framework/test/checkForModuleDependencyCorrectness_t.cppunit.cc index 9daaf5207f9d7..ae0e48814510b 100644 --- a/FWCore/Framework/test/throwIfImproperDependencies_t.cppunit.cc +++ b/FWCore/Framework/test/checkForModuleDependencyCorrectness_t.cppunit.cc @@ -10,18 +10,164 @@ #include #include #include +#include -#include "FWCore/Framework/src/throwIfImproperDependencies.h" +#include "FWCore/Framework/interface/PathsAndConsumesOfModules.h" #include "FWCore/Utilities/interface/Exception.h" +#include "DataFormats/Provenance/interface/ParameterSetID.h" +#include "DataFormats/Provenance/interface/ModuleDescription.h" +#include "DataFormats/Provenance/interface/ProcessConfiguration.h" #include "cppunit/extensions/HelperMacros.h" -class test_throwIfImproperDependencies : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(test_throwIfImproperDependencies); +using ModuleDependsOnMap = std::map>; +using PathToModules = std::unordered_map>; + +namespace { + class PathsAndConsumesOfModulesForTest : public edm::PathsAndConsumesOfModulesBase { + public: + PathsAndConsumesOfModulesForTest(ModuleDependsOnMap const&, PathToModules const&); + + private: + std::vector const& doPaths() const final { return m_paths; } + std::vector const& doEndPaths() const final { return m_endPaths; } + std::vector const& doAllModules() const final { return m_modules; } + edm::ModuleDescription const* doModuleDescription(unsigned int moduleID) const final { return m_modules[moduleID]; } + std::vector const& doModulesOnPath(unsigned int pathIndex) const final { + return m_modulesOnPath[pathIndex]; + } + std::vector const& doModulesOnEndPath(unsigned int endPathIndex) const final { + return m_modulesOnEndPath[endPathIndex]; + } + std::vector const& doModulesWhoseProductsAreConsumedBy( + unsigned int moduleID, edm::BranchType branchType) const final { + return m_modulesWhoseProductsAreConsumedBy[moduleID]; + } + std::vector doConsumesInfo(unsigned int moduleID) const final { + return m_moduleConsumesInfo[moduleID]; + } + unsigned int doLargestModuleID() const final { + if (m_modules.empty()) { + return 0; + } + return m_modules.size() - 1; + } + + std::vector m_paths; + std::vector m_endPaths; + std::vector m_modules; + std::vector> m_moduleConsumesInfo; + std::vector> m_modulesOnPath; + std::vector> m_modulesOnEndPath; + std::vector> m_modulesWhoseProductsAreConsumedBy; + std::vector m_cache; + + static unsigned int indexForModule(std::string const& iName, + std::unordered_map& modsToIndex, + std::unordered_map& indexToMods) { + auto found = modsToIndex.find(iName); + unsigned int fromIndex; + if (found == modsToIndex.end()) { + fromIndex = modsToIndex.size(); + modsToIndex.emplace(iName, fromIndex); + indexToMods.emplace(fromIndex, iName); + } else { + fromIndex = found->second; + } + return fromIndex; + } + }; + PathsAndConsumesOfModulesForTest::PathsAndConsumesOfModulesForTest(ModuleDependsOnMap const& iModDeps, + PathToModules const& iPaths) { + //setup module indicies + std::unordered_map modsToIndex; + std::unordered_map indexToMods; + + const edm::ProcessConfiguration pc("TEST", edm::ParameterSetID{}, "CMSSW_x_y_z", "??"); + + //In actual configuration building, the source is always assigned id==0 + m_cache.emplace_back( + edm::ParameterSetID{}, "source", "source", &pc, indexForModule("source", modsToIndex, indexToMods)); + + for (auto const& md : iModDeps) { + auto const lastSize = modsToIndex.size(); + auto index = indexForModule(md.first, modsToIndex, indexToMods); + if (index == lastSize) { + m_cache.emplace_back(edm::ParameterSetID{}, md.first, md.first, &pc, index); + } + } + m_paths.reserve(iPaths.size()); + for (auto const& pToM : iPaths) { + m_paths.push_back(pToM.first); + + for (auto const& mod : pToM.second) { + auto const lastSize = modsToIndex.size(); + unsigned int index = indexForModule(mod, modsToIndex, indexToMods); + if (index == lastSize) { + m_cache.emplace_back(edm::ParameterSetID{}, mod, mod, &pc, index); + } + } + } + for (auto const& md : iModDeps) { + for (auto const& dep : md.second) { + auto const lastSize = modsToIndex.size(); + auto index = indexForModule(dep, modsToIndex, indexToMods); + if (index == lastSize) { + m_cache.emplace_back(edm::ParameterSetID{}, dep, dep, &pc, index); + } + } + } + + if (not iPaths.empty()) { + auto indexForTriggerResults = indexForModule("TriggerResults", modsToIndex, indexToMods); + for (auto const& pToM : iPaths) { + auto index = indexForModule(pToM.first, modsToIndex, indexToMods); + m_cache.emplace_back(edm::ParameterSetID{}, "PathStatusInserter", pToM.first, &pc, index); + } + m_cache.emplace_back( + edm::ParameterSetID{}, "TriggerResultInserter", "TriggerResults", &pc, indexForTriggerResults); + } + + m_modules.reserve(m_cache.size()); + for (auto const& desc : m_cache) { + m_modules.push_back(&desc); + } + + //do consumes + edm::TypeID dummy; + m_moduleConsumesInfo.resize(m_modules.size()); + m_modulesWhoseProductsAreConsumedBy.resize(m_modules.size()); + for (auto const& md : iModDeps) { + auto moduleID = modsToIndex[md.first]; + auto& consumes = m_moduleConsumesInfo[moduleID]; + consumes.reserve(md.second.size()); + for (auto const& dep : md.second) { + consumes.emplace_back(dummy, dep.c_str(), "", "TEST", edm::InEvent, edm::PRODUCT_TYPE, true, false); + m_modulesWhoseProductsAreConsumedBy[moduleID].push_back(m_modules[modsToIndex[dep]]); + //m_modulesWhoseProductsAreConsumedBy[modsToIndex[dep]].push_back(m_modules[moduleID]); + } + } + + m_modulesOnPath.reserve(m_paths.size()); + for (auto const& pToM : iPaths) { + m_modulesOnPath.emplace_back(); + auto& newPath = m_modulesOnPath.back(); + newPath.reserve(pToM.second.size()); + for (auto const& mod : pToM.second) { + newPath.push_back(m_modules[modsToIndex[mod]]); + } + } + } +} // namespace + +class test_checkForModuleDependencyCorrectness : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(test_checkForModuleDependencyCorrectness); CPPUNIT_TEST(onePathNoCycleTest); CPPUNIT_TEST(onePathHasCycleTest); CPPUNIT_TEST(twoPathsNoCycleTest); CPPUNIT_TEST(twoPathsWithCycleTest); + CPPUNIT_TEST(duplicateModuleOnPathTest); + CPPUNIT_TEST(selfCycleTest); CPPUNIT_TEST_SUITE_END(); @@ -35,122 +181,23 @@ class test_throwIfImproperDependencies : public CppUnit::TestFixture { void twoPathsNoCycleTest(); void twoPathsWithCycleTest(); - using ModuleDependsOnMap = std::map>; - using PathToModules = std::unordered_map>; + void selfCycleTest(); -private: - static unsigned int indexForModule(std::string const& iName, - std::unordered_map& modsToIndex, - std::unordered_map& indexToMods) { - auto found = modsToIndex.find(iName); - unsigned int fromIndex; - if (found == modsToIndex.end()) { - fromIndex = modsToIndex.size(); - modsToIndex.emplace(iName, fromIndex); - indexToMods.emplace(fromIndex, iName); - } else { - fromIndex = found->second; - } - return fromIndex; - } + void duplicateModuleOnPathTest(); +private: bool testCase(ModuleDependsOnMap const& iModDeps, PathToModules const& iPaths) const { - using namespace edm::graph; - - EdgeToPathMap edgeToPathMap; - - std::unordered_map modsToIndex; - std::unordered_map indexToMods; - - //We have an artificial case to be the root of the graph - const std::string kFinishedProcessing("FinishedProcessing"); - const unsigned int kFinishedProcessingIndex{0}; - modsToIndex.emplace(kFinishedProcessing, kFinishedProcessingIndex); - indexToMods.emplace(kFinishedProcessingIndex, kFinishedProcessing); - - //Setup the module to index map by using all module names used in both containers - //Start with keys from the module dependency to allow control of the numbering scheme - for (auto const& md : iModDeps) { - indexForModule(md.first, modsToIndex, indexToMods); - } - - std::vector> pathIndexToModuleIndexOrder(iPaths.size()); - - //Need to be able to quickly look up which paths a module appears on - std::unordered_map> moduleIndexToPathIndex; - - std::vector pathNames; - std::unordered_map pathToIndexMap; - for (auto const& path : iPaths) { - unsigned int lastModuleIndex = kInvalidIndex; - pathNames.push_back(path.first); - unsigned int pathIndex = pathToIndexMap.size(); - auto& pathOrder = pathIndexToModuleIndexOrder[pathIndex]; - pathToIndexMap.emplace(path.first, pathIndex); - for (auto const& mod : path.second) { - unsigned int index = indexForModule(mod, modsToIndex, indexToMods); - pathOrder.push_back(index); - moduleIndexToPathIndex[index].push_back(pathIndex); - - if (lastModuleIndex != kInvalidIndex) { - edgeToPathMap[std::make_pair(index, lastModuleIndex)].push_back(pathIndex); - } - lastModuleIndex = index; - } - pathOrder.push_back(kFinishedProcessingIndex); - if (lastModuleIndex != kInvalidIndex) { - edgeToPathMap[std::make_pair(kFinishedProcessingIndex, lastModuleIndex)].push_back(pathIndex); - } - } - - for (auto const& md : iModDeps) { - unsigned int fromIndex = indexForModule(md.first, modsToIndex, indexToMods); - for (auto const& dependsOn : md.second) { - unsigned int toIndex = indexForModule(dependsOn, modsToIndex, indexToMods); - - //see if all paths containing this module also contain the dependent module earlier in the path - // if it does, then treat this only as a path dependency and not a data dependency as this - // simplifies the circular dependency checking logic - - auto itPathsFound = moduleIndexToPathIndex.find(fromIndex); - bool keepDataDependency = true; - if (itPathsFound != moduleIndexToPathIndex.end() and - moduleIndexToPathIndex.find(toIndex) != moduleIndexToPathIndex.end()) { - keepDataDependency = false; - for (auto const pathIndex : itPathsFound->second) { - for (auto idToCheck : pathIndexToModuleIndexOrder[pathIndex]) { - if (idToCheck == toIndex) { - //found dependent module first so check next path - break; - } - if (idToCheck == fromIndex) { - //did not find dependent module earlier on path so - // must keep data dependency - keepDataDependency = true; - break; - } - } - if (keepDataDependency) { - break; - } - } - } - if (keepDataDependency) { - edgeToPathMap[std::make_pair(fromIndex, toIndex)].push_back(kDataDependencyIndex); - } - } - } - - throwIfImproperDependencies(edgeToPathMap, pathIndexToModuleIndexOrder, pathNames, indexToMods); + PathsAndConsumesOfModulesForTest pAndC(iModDeps, iPaths); + checkForModuleDependencyCorrectness(pAndC, false); return true; } }; ///registration of the test so that the runner can find it -CPPUNIT_TEST_SUITE_REGISTRATION(test_throwIfImproperDependencies); +CPPUNIT_TEST_SUITE_REGISTRATION(test_checkForModuleDependencyCorrectness); -void test_throwIfImproperDependencies::onePathNoCycleTest() { +void test_checkForModuleDependencyCorrectness::onePathNoCycleTest() { { ModuleDependsOnMap md = {{"C", {"B"}}, {"B", {"A"}}}; PathToModules paths = {{"p", {"A", "B", "C"}}}; @@ -177,7 +224,7 @@ void test_throwIfImproperDependencies::onePathNoCycleTest() { } } -void test_throwIfImproperDependencies::onePathHasCycleTest() { +void test_checkForModuleDependencyCorrectness::onePathHasCycleTest() { { ModuleDependsOnMap md = {{"C", {"B"}}, {"B", {"A"}}}; { @@ -222,7 +269,7 @@ void test_throwIfImproperDependencies::onePathHasCycleTest() { } } -void test_throwIfImproperDependencies::twoPathsNoCycleTest() { +void test_checkForModuleDependencyCorrectness::twoPathsNoCycleTest() { { ModuleDependsOnMap md = {{"C", {"B"}}}; @@ -472,9 +519,35 @@ void test_throwIfImproperDependencies::twoPathsNoCycleTest() { CPPUNIT_ASSERT(testCase(md, paths)); } + + { + //Have a module which can not be run initially be needed by two other modules + ModuleDependsOnMap md = {{"out", {"A", "B"}}, {"A", {"D"}}, {"B", {"D"}}}; + PathToModules paths = {{"p1", {"filter", "D"}}, {"p2", {"out"}}}; + CPPUNIT_ASSERT(testCase(md, paths)); + } + { + //like above, but with path names reversed + ModuleDependsOnMap md = {{"out", {"A", "B"}}, {"A", {"D"}}, {"B", {"D"}}}; + PathToModules paths = {{"p1", {"out"}}, {"p2", {"filter", "D"}}}; + CPPUNIT_ASSERT(testCase(md, paths)); + } + + { + //Have a module which can not be run initially be needed by two other modules + ModuleDependsOnMap md = {{"out", {"A", "B"}}, {"A", {"D"}}, {"B", {"D"}}, {"D", {"E"}}}; + PathToModules paths = {{"p1", {"filter", "E"}}, {"p2", {"out"}}}; + CPPUNIT_ASSERT(testCase(md, paths)); + } + { + //like above, but with path names reversed + ModuleDependsOnMap md = {{"out", {"A", "B"}}, {"A", {"D"}}, {"B", {"D"}}, {"D", {"E"}}}; + PathToModules paths = {{"p1", {"out"}}, {"p2", {"filter", "E"}}}; + CPPUNIT_ASSERT(testCase(md, paths)); + } } -void test_throwIfImproperDependencies::twoPathsWithCycleTest() { +void test_checkForModuleDependencyCorrectness::twoPathsWithCycleTest() { { ModuleDependsOnMap md = {{"C", {"B"}}, {"A", {"D"}}}; PathToModules paths = {{"p1", {"A", "B"}}, {"p2", {"C", "D"}}}; @@ -572,4 +645,35 @@ void test_throwIfImproperDependencies::twoPathsWithCycleTest() { CPPUNIT_ASSERT_THROW(testCase(md, paths), cms::Exception); } + + { + ModuleDependsOnMap md = {{"B", {"A"}}, {"C", {"B"}}, {"cFilter", {"C"}}}; + PathToModules paths = {{"p1", {"C", "cFilter", "D", "E", "F", "A", "B"}}, {"p2", {"oFilter", "D", "F", "B"}}}; + + CPPUNIT_ASSERT_THROW(testCase(md, paths), cms::Exception); + } +} + +void test_checkForModuleDependencyCorrectness::selfCycleTest() { + { + ModuleDependsOnMap md = {{"A", {"A"}}}; + PathToModules paths = {{"p", {"A"}}}; + + CPPUNIT_ASSERT_THROW(testCase(md, paths), cms::Exception); + } + { + ModuleDependsOnMap md = {{"A", {"A"}}, {"B", {"A"}}}; + PathToModules paths = {{"p", {"B"}}}; + + CPPUNIT_ASSERT_THROW(testCase(md, paths), cms::Exception); + } +} + +void test_checkForModuleDependencyCorrectness::duplicateModuleOnPathTest() { + { + ModuleDependsOnMap md = {{"C", {"B"}}, {"B", {"A"}}}; + PathToModules paths = {{"p", {"A", "B", "C", "A"}}}; + + CPPUNIT_ASSERT(testCase(md, paths)); + } } diff --git a/FWCore/Framework/test/edproducer_productregistry_callback.cc b/FWCore/Framework/test/edproducer_productregistry_callback.cc index 87ec7f75f0da7..569fed0a69ce8 100644 --- a/FWCore/Framework/test/edproducer_productregistry_callback.cc +++ b/FWCore/Framework/test/edproducer_productregistry_callback.cc @@ -12,17 +12,17 @@ #include "FWCore/Utilities/interface/GetPassID.h" #include "FWCore/Version/interface/GetReleaseVersion.h" -#include "FWCore/Framework/src/SignallingProductRegistry.h" +#include "FWCore/Framework/interface/SignallingProductRegistry.h" #include "FWCore/Framework/interface/ConstProductRegistry.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Framework/interface/EDProducer.h" #include "FWCore/Framework/interface/ExceptionActions.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "DataFormats/Provenance/interface/ProcessConfiguration.h" -#include "FWCore/Framework/src/WorkerMaker.h" -#include "FWCore/Framework/src/MakeModuleParams.h" -#include "FWCore/Framework/src/WorkerT.h" +#include "FWCore/Framework/interface/maker/WorkerMaker.h" +#include "FWCore/Framework/interface/maker/MakeModuleParams.h" +#include "FWCore/Framework/interface/maker/WorkerT.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" diff --git a/FWCore/Framework/test/eventsetupplugin_t.cppunit.cc b/FWCore/Framework/test/eventsetupplugin_t.cppunit.cc index 8d56d5cfbd356..5a53b5041d6a1 100644 --- a/FWCore/Framework/test/eventsetupplugin_t.cppunit.cc +++ b/FWCore/Framework/test/eventsetupplugin_t.cppunit.cc @@ -21,7 +21,7 @@ #include "FWCore/Framework/interface/SourceFactory.h" #include "FWCore/Framework/interface/ModuleFactory.h" #include "FWCore/Framework/interface/EventSetupProvider.h" -#include "FWCore/Framework/src/EventSetupsController.h" +#include "FWCore/Framework/interface/EventSetupsController.h" #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h" using namespace edm::eventsetup; diff --git a/FWCore/Framework/test/eventsetupscontroller_t.cppunit.cc b/FWCore/Framework/test/eventsetupscontroller_t.cppunit.cc index 66e35b5eef95f..04466e30ecde7 100644 --- a/FWCore/Framework/test/eventsetupscontroller_t.cppunit.cc +++ b/FWCore/Framework/test/eventsetupscontroller_t.cppunit.cc @@ -5,7 +5,7 @@ #include "cppunit/extensions/HelperMacros.h" #include "DataFormats/Provenance/interface/ParameterSetID.h" #include "FWCore/Framework/interface/EventSetupProvider.h" -#include "FWCore/Framework/src/EventSetupsController.h" +#include "FWCore/Framework/interface/EventSetupsController.h" #include "FWCore/Framework/interface/ParameterSetIDHolder.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/test/DummyFinder.h" diff --git a/FWCore/Framework/test/global_filter_t.cppunit.cc b/FWCore/Framework/test/global_filter_t.cppunit.cc index 6fef924e85609..c1882c48f90dc 100644 --- a/FWCore/Framework/test/global_filter_t.cppunit.cc +++ b/FWCore/Framework/test/global_filter_t.cppunit.cc @@ -12,10 +12,10 @@ #include #include "tbb/global_control.h" #include "FWCore/Framework/interface/global/EDFilter.h" -#include "FWCore/Framework/src/WorkerT.h" -#include "FWCore/Framework/src/ModuleHolder.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/maker/WorkerT.h" +#include "FWCore/Framework/interface/maker/ModuleHolder.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "DataFormats/Provenance/interface/BranchIDListHelper.h" diff --git a/FWCore/Framework/test/global_outputmodule_t.cppunit.cc b/FWCore/Framework/test/global_outputmodule_t.cppunit.cc index 998792b76968a..d68b23a1dba85 100644 --- a/FWCore/Framework/test/global_outputmodule_t.cppunit.cc +++ b/FWCore/Framework/test/global_outputmodule_t.cppunit.cc @@ -10,9 +10,9 @@ #include #include "tbb/global_control.h" #include "FWCore/Framework/interface/global/OutputModule.h" -#include "FWCore/Framework/src/OutputModuleCommunicatorT.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" -#include "FWCore/Framework/src/WorkerT.h" +#include "FWCore/Framework/interface/OutputModuleCommunicatorT.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/maker/WorkerT.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "DataFormats/Provenance/interface/BranchIDListHelper.h" @@ -25,7 +25,7 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" #include "FWCore/Framework/interface/FileBlock.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Concurrency/interface/WaitingTaskHolder.h" #include "FWCore/Utilities/interface/Exception.h" diff --git a/FWCore/Framework/test/global_producer_t.cppunit.cc b/FWCore/Framework/test/global_producer_t.cppunit.cc index 3da30b7400da6..ee0936d55f61b 100644 --- a/FWCore/Framework/test/global_producer_t.cppunit.cc +++ b/FWCore/Framework/test/global_producer_t.cppunit.cc @@ -12,10 +12,10 @@ #include #include "tbb/global_control.h" #include "FWCore/Framework/interface/global/EDProducer.h" -#include "FWCore/Framework/src/WorkerT.h" -#include "FWCore/Framework/src/ModuleHolder.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/maker/WorkerT.h" +#include "FWCore/Framework/interface/maker/ModuleHolder.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "DataFormats/Provenance/interface/BranchIDListHelper.h" diff --git a/FWCore/Framework/test/limited_filter_t.cppunit.cc b/FWCore/Framework/test/limited_filter_t.cppunit.cc index ca89678e4a754..da797c329a6bd 100644 --- a/FWCore/Framework/test/limited_filter_t.cppunit.cc +++ b/FWCore/Framework/test/limited_filter_t.cppunit.cc @@ -12,10 +12,10 @@ #include #include "tbb/global_control.h" #include "FWCore/Framework/interface/limited/EDFilter.h" -#include "FWCore/Framework/src/WorkerT.h" -#include "FWCore/Framework/src/ModuleHolder.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/maker/WorkerT.h" +#include "FWCore/Framework/interface/maker/ModuleHolder.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "DataFormats/Provenance/interface/BranchIDListHelper.h" diff --git a/FWCore/Framework/test/limited_outputmodule_t.cppunit.cc b/FWCore/Framework/test/limited_outputmodule_t.cppunit.cc index 40d6230b8f2c8..43cc689f59188 100644 --- a/FWCore/Framework/test/limited_outputmodule_t.cppunit.cc +++ b/FWCore/Framework/test/limited_outputmodule_t.cppunit.cc @@ -10,9 +10,9 @@ #include #include "tbb/global_control.h" #include "FWCore/Framework/interface/limited/OutputModule.h" -#include "FWCore/Framework/src/OutputModuleCommunicatorT.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" -#include "FWCore/Framework/src/WorkerT.h" +#include "FWCore/Framework/interface/OutputModuleCommunicatorT.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/maker/WorkerT.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "DataFormats/Provenance/interface/BranchIDListHelper.h" @@ -25,7 +25,7 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" #include "FWCore/Framework/interface/FileBlock.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Concurrency/interface/WaitingTaskHolder.h" #include "FWCore/Utilities/interface/Exception.h" diff --git a/FWCore/Framework/test/limited_producer_t.cppunit.cc b/FWCore/Framework/test/limited_producer_t.cppunit.cc index c526ffbdd870e..1e36ac7b66398 100644 --- a/FWCore/Framework/test/limited_producer_t.cppunit.cc +++ b/FWCore/Framework/test/limited_producer_t.cppunit.cc @@ -12,10 +12,10 @@ #include #include "tbb/global_control.h" #include "FWCore/Framework/interface/limited/EDProducer.h" -#include "FWCore/Framework/src/WorkerT.h" -#include "FWCore/Framework/src/ModuleHolder.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/maker/WorkerT.h" +#include "FWCore/Framework/interface/maker/ModuleHolder.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "DataFormats/Provenance/interface/BranchIDListHelper.h" diff --git a/FWCore/Framework/test/maker2_t.cppunit.cc b/FWCore/Framework/test/maker2_t.cppunit.cc index cca1dd12f942f..bafc82a116890 100644 --- a/FWCore/Framework/test/maker2_t.cppunit.cc +++ b/FWCore/Framework/test/maker2_t.cppunit.cc @@ -7,12 +7,12 @@ #include "FWCore/Version/interface/GetReleaseVersion.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/src/WorkerT.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/maker/WorkerT.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Framework/interface/ExceptionActions.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" -#include "FWCore/Framework/src/WorkerMaker.h" -#include "FWCore/Framework/src/MakeModuleParams.h" +#include "FWCore/Framework/interface/maker/WorkerMaker.h" +#include "FWCore/Framework/interface/maker/MakeModuleParams.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" diff --git a/FWCore/Framework/test/one_outputmodule_t.cppunit.cc b/FWCore/Framework/test/one_outputmodule_t.cppunit.cc index b303dfb188e2f..c305456e0118d 100644 --- a/FWCore/Framework/test/one_outputmodule_t.cppunit.cc +++ b/FWCore/Framework/test/one_outputmodule_t.cppunit.cc @@ -12,9 +12,9 @@ #include #include "tbb/global_control.h" #include "FWCore/Framework/interface/one/OutputModule.h" -#include "FWCore/Framework/src/OutputModuleCommunicatorT.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" -#include "FWCore/Framework/src/WorkerT.h" +#include "FWCore/Framework/interface/OutputModuleCommunicatorT.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/maker/WorkerT.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "DataFormats/Provenance/interface/BranchIDListHelper.h" @@ -27,7 +27,7 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" #include "FWCore/Framework/interface/FileBlock.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Concurrency/interface/WaitingTaskHolder.h" #include "FWCore/Utilities/interface/Exception.h" diff --git a/FWCore/Framework/test/productregistry.cppunit.cc b/FWCore/Framework/test/productregistry.cppunit.cc index 5ed4ee8c0e10e..820b0d3946b2c 100644 --- a/FWCore/Framework/test/productregistry.cppunit.cc +++ b/FWCore/Framework/test/productregistry.cppunit.cc @@ -11,7 +11,7 @@ #include "DataFormats/TestObjects/interface/ToyProducts.h" #include "FWCore/Framework/interface/ConstProductRegistry.h" #include "FWCore/Framework/interface/EventProcessor.h" -#include "FWCore/Framework/src/SignallingProductRegistry.h" +#include "FWCore/Framework/interface/SignallingProductRegistry.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/PluginManager/interface/ProblemTracker.h" #include "FWCore/Utilities/interface/Exception.h" diff --git a/FWCore/Framework/test/sharedresourcesregistry_t.cppunit.cc b/FWCore/Framework/test/sharedresourcesregistry_t.cppunit.cc index 00fdad3479e54..4b89854b3d10a 100644 --- a/FWCore/Framework/test/sharedresourcesregistry_t.cppunit.cc +++ b/FWCore/Framework/test/sharedresourcesregistry_t.cppunit.cc @@ -9,7 +9,7 @@ #include "cppunit/extensions/HelperMacros.h" #define SHAREDRESOURCETESTACCESSORS 1 -#include "FWCore/Framework/src/SharedResourcesRegistry.h" +#include "FWCore/Framework/interface/SharedResourcesRegistry.h" #include "FWCore/Framework/interface/SharedResourcesAcquirer.h" using namespace edm; diff --git a/FWCore/Framework/test/stream_filter_t.cppunit.cc b/FWCore/Framework/test/stream_filter_t.cppunit.cc index d28c2e8ecbb0d..4beaf1aa19c84 100644 --- a/FWCore/Framework/test/stream_filter_t.cppunit.cc +++ b/FWCore/Framework/test/stream_filter_t.cppunit.cc @@ -10,11 +10,11 @@ #include #include #include "tbb/global_control.h" -#include "FWCore/Framework/src/Worker.h" -#include "FWCore/Framework/src/WorkerT.h" -#include "FWCore/Framework/src/ModuleHolder.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/maker/Worker.h" +#include "FWCore/Framework/interface/maker/WorkerT.h" +#include "FWCore/Framework/interface/maker/ModuleHolder.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/stream/EDProducerAdaptor.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" diff --git a/FWCore/Framework/test/stream_producer_t.cppunit.cc b/FWCore/Framework/test/stream_producer_t.cppunit.cc index b75abb1104c5e..cc5af5f558a67 100644 --- a/FWCore/Framework/test/stream_producer_t.cppunit.cc +++ b/FWCore/Framework/test/stream_producer_t.cppunit.cc @@ -10,11 +10,11 @@ #include #include #include "tbb/global_control.h" -#include "FWCore/Framework/src/Worker.h" -#include "FWCore/Framework/src/WorkerT.h" -#include "FWCore/Framework/src/ModuleHolder.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/maker/Worker.h" +#include "FWCore/Framework/interface/maker/WorkerT.h" +#include "FWCore/Framework/interface/maker/ModuleHolder.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/stream/EDProducerAdaptor.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" diff --git a/FWCore/Framework/test/stubs/TestGlobalFilters.cc b/FWCore/Framework/test/stubs/TestGlobalFilters.cc index 1465a9060ad7f..50800b415d1ff 100644 --- a/FWCore/Framework/test/stubs/TestGlobalFilters.cc +++ b/FWCore/Framework/test/stubs/TestGlobalFilters.cc @@ -503,8 +503,7 @@ namespace edmtest { class TestBeginProcessBlockFilter : public edm::global::EDFilter { public: explicit TestBeginProcessBlockFilter(edm::ParameterSet const& p) - : trans_(p.getParameter("transitions")), - token_(produces("begin")) { + : trans_(p.getParameter("transitions")), token_(produces("begin")) { produces(); auto tag = p.getParameter("consumesBeginProcessBlock"); diff --git a/FWCore/Framework/test/stubs/TestGlobalProducers.cc b/FWCore/Framework/test/stubs/TestGlobalProducers.cc index ee05190d9d74e..09bbf09b7cbbc 100644 --- a/FWCore/Framework/test/stubs/TestGlobalProducers.cc +++ b/FWCore/Framework/test/stubs/TestGlobalProducers.cc @@ -793,7 +793,7 @@ namespace edmtest { public: explicit TestAccumulator(edm::ParameterSet const& p) : m_expectedCount(p.getParameter("expectedCount")), - m_putToken(produces()) {} + m_putToken(produces()) {} void accumulate(edm::StreamID iID, edm::Event const&, edm::EventSetup const&) const override { ++m_count; } diff --git a/FWCore/Framework/test/stubs/TestStreamAnalyzers.cc b/FWCore/Framework/test/stubs/TestStreamAnalyzers.cc index 5137ede36ee54..6a132abda0dd8 100644 --- a/FWCore/Framework/test/stubs/TestStreamAnalyzers.cc +++ b/FWCore/Framework/test/stubs/TestStreamAnalyzers.cc @@ -16,7 +16,7 @@ for testing purposes only. #include "FWCore/Framework/interface/CacheHandle.h" #include "FWCore/Framework/interface/stream/EDAnalyzer.h" -#include "FWCore/Framework/src/WorkerT.h" +#include "FWCore/Framework/interface/maker/WorkerT.h" #include "FWCore/Framework/interface/HistoryAppender.h" #include "FWCore/ServiceRegistry/interface/ParentContext.h" #include "FWCore/ServiceRegistry/interface/StreamContext.h" diff --git a/FWCore/Framework/test/stubs/TestStreamFilters.cc b/FWCore/Framework/test/stubs/TestStreamFilters.cc index 57ac06456e930..0dd2d6c4a2c73 100644 --- a/FWCore/Framework/test/stubs/TestStreamFilters.cc +++ b/FWCore/Framework/test/stubs/TestStreamFilters.cc @@ -17,7 +17,7 @@ for testing purposes only. #include "FWCore/Framework/interface/CacheHandle.h" #include "FWCore/Framework/interface/stream/EDFilter.h" -#include "FWCore/Framework/src/WorkerT.h" +#include "FWCore/Framework/interface/maker/WorkerT.h" #include "FWCore/Framework/interface/HistoryAppender.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ServiceRegistry/interface/ParentContext.h" diff --git a/FWCore/Framework/test/stubs/TestStreamProducers.cc b/FWCore/Framework/test/stubs/TestStreamProducers.cc index e9a64713d1978..c5b21fce93564 100644 --- a/FWCore/Framework/test/stubs/TestStreamProducers.cc +++ b/FWCore/Framework/test/stubs/TestStreamProducers.cc @@ -17,7 +17,7 @@ for testing purposes only. #include "FWCore/Framework/interface/CacheHandle.h" #include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/src/WorkerT.h" +#include "FWCore/Framework/interface/maker/WorkerT.h" #include "FWCore/Framework/interface/HistoryAppender.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ServiceRegistry/interface/ParentContext.h" diff --git a/FWCore/Framework/test/test_bad_schedule_exception_message_cfg.py b/FWCore/Framework/test/test_bad_schedule_exception_message_cfg.py new file mode 100644 index 0000000000000..3ba21b8d91f5d --- /dev/null +++ b/FWCore/Framework/test/test_bad_schedule_exception_message_cfg.py @@ -0,0 +1,101 @@ +import FWCore.ParameterSet.Config as cms +import sys + +process = cms.Process("Test") + + +process.source = cms.Source("EmptySource") + + +mod = int(sys.argv[2]) + +process.load('FWCore.MessageService.MessageLogger_cfi') +process.MessageLogger.cerr.enable = False +process.MessageLogger.files.exceptionMessage = dict(filename="test_bad_schedule_{}".format(mod), + noTimeStamps= True) + +if mod == 0 : + #directly depends on + process.a = cms.EDProducer("AddIntsProducer", + labels=cms.VInputTag(cms.InputTag("a"))) + process.p = cms.Path(process.a) +elif mod == 1: + #cross path dependency + process.a = cms.EDProducer("AddIntsProducer", + labels=cms.VInputTag(cms.InputTag("b"))) + + process.b = cms.EDProducer("AddIntsProducer", + labels=cms.VInputTag(cms.InputTag("a"))) + + process.p = cms.Path(process.a) + process.p2 = cms.Path(process.b) + +elif mod == 2: + #path ordering + process.a = cms.EDProducer("AddIntsProducer", + labels=cms.VInputTag(cms.InputTag("b"))) + + process.b = cms.EDProducer("AddIntsProducer", + labels=cms.VInputTag(cms.InputTag(""))) + process.p = cms.Path(process.a + process.b) + +elif mod == 3: + #path ordering, extra path 1 + process.a = cms.EDProducer("AddIntsProducer", + labels=cms.VInputTag(cms.InputTag("b"))) + + process.b = cms.EDProducer("AddIntsProducer", + labels=cms.VInputTag(cms.InputTag(""))) + process.p = cms.Path(process.a + process.b) + process.p2 = cms.Path(process.a) + +elif mod == 4: + #path ordering, extra path 1 + process.a = cms.EDProducer("AddIntsProducer", + labels=cms.VInputTag(cms.InputTag("b"))) + + process.b = cms.EDProducer("AddIntsProducer", + labels=cms.VInputTag(cms.InputTag(""))) + process.p2 = cms.Path(process.a + process.b) + process.p = cms.Path(process.a) + +elif mod == 5: + #cycle with unscheduled + process.a = cms.EDProducer("AddIntsProducer", + labels=cms.VInputTag(cms.InputTag("b"))) + + process.b = cms.EDProducer("AddIntsProducer", + labels=cms.VInputTag(cms.InputTag("a"))) + + process.p = cms.Path(process.a, cms.Task(process.b)) + +elif mod == 6: + #multi-path cycle with unscheduled + process.a = cms.EDProducer("AddIntsProducer", + labels=cms.VInputTag(cms.InputTag("b"))) + + process.b = cms.EDProducer("AddIntsProducer", + labels=cms.VInputTag(cms.InputTag("c"))) + + process.c = cms.EDProducer("AddIntsProducer", + labels=cms.VInputTag(cms.InputTag("d"))) + process.d = cms.EDProducer("AddIntsProducer", + labels=cms.VInputTag(cms.InputTag("a"))) + + process.p1 = cms.Path(process.a, cms.Task(process.b)) + process.p2 = cms.Path(process.c, cms.Task(process.d)) + +elif mod == 7: + #cycle with unscheduled + process.a = cms.EDProducer("AddIntsProducer", + labels=cms.VInputTag(cms.InputTag("b"))) + + process.b = cms.EDProducer("AddIntsProducer", + labels=cms.VInputTag(cms.InputTag("c"))) + + process.c = cms.EDProducer("AddIntsProducer", + labels=cms.VInputTag(cms.InputTag("b"))) + + process.p1 = cms.Path(process.a, cms.Task(process.b, process.c)) + + diff --git a/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_0.log b/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_0.log new file mode 100644 index 0000000000000..5e079d1cb162f --- /dev/null +++ b/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_0.log @@ -0,0 +1,6 @@ +An exception of category 'ScheduleExecutionFailure' occurred while + [0] Calling beginJob +Exception Message: +Unrunnable schedule +The Path/EndPath configuration could cause the job to deadlock + module 'a' is on path 'p' and depends on module 'a' diff --git a/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_1.log b/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_1.log new file mode 100644 index 0000000000000..90889024d6f71 --- /dev/null +++ b/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_1.log @@ -0,0 +1,7 @@ +An exception of category 'ScheduleExecutionFailure' occurred while + [0] Calling beginJob +Exception Message: +Unrunnable schedule +The Path/EndPath configuration could cause the job to deadlock + module 'a' is on path 'p' and depends on module 'b' + module 'b' is on path 'p2' and depends on module 'a' diff --git a/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_2.log b/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_2.log new file mode 100644 index 0000000000000..f4fa8eb31e860 --- /dev/null +++ b/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_2.log @@ -0,0 +1,7 @@ +An exception of category 'ScheduleExecutionFailure' occurred while + [0] Calling beginJob +Exception Message: +Unrunnable schedule +The Path/EndPath configuration could cause the job to deadlock + module 'a' is on path 'p' and depends on module 'b' + module 'b' is on path 'p' and follows module 'a' on the path diff --git a/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_3.log b/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_3.log new file mode 100644 index 0000000000000..f4fa8eb31e860 --- /dev/null +++ b/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_3.log @@ -0,0 +1,7 @@ +An exception of category 'ScheduleExecutionFailure' occurred while + [0] Calling beginJob +Exception Message: +Unrunnable schedule +The Path/EndPath configuration could cause the job to deadlock + module 'a' is on path 'p' and depends on module 'b' + module 'b' is on path 'p' and follows module 'a' on the path diff --git a/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_4.log b/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_4.log new file mode 100644 index 0000000000000..6f4594ce95143 --- /dev/null +++ b/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_4.log @@ -0,0 +1,7 @@ +An exception of category 'ScheduleExecutionFailure' occurred while + [0] Calling beginJob +Exception Message: +Unrunnable schedule +The Path/EndPath configuration could cause the job to deadlock + module 'a' is on path 'p2' and depends on module 'b' + module 'b' is on path 'p2' and follows module 'a' on the path diff --git a/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_5.log b/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_5.log new file mode 100644 index 0000000000000..3e642e23c9c63 --- /dev/null +++ b/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_5.log @@ -0,0 +1,7 @@ +An exception of category 'ScheduleExecutionFailure' occurred while + [0] Calling beginJob +Exception Message: +Unrunnable schedule +The Path/EndPath configuration could cause the job to deadlock + module 'a' is on path 'p' and depends on module 'b' + module 'b' is in a task and depends on module 'a' diff --git a/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_6.log b/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_6.log new file mode 100644 index 0000000000000..fb9b905e8a38f --- /dev/null +++ b/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_6.log @@ -0,0 +1,9 @@ +An exception of category 'ScheduleExecutionFailure' occurred while + [0] Calling beginJob +Exception Message: +Unrunnable schedule +The Path/EndPath configuration could cause the job to deadlock + module 'a' is on path 'p1' and depends on module 'b' + module 'b' is in a task and depends on module 'c' + module 'c' is on path 'p2' and depends on module 'd' + module 'd' is in a task and depends on module 'a' diff --git a/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_7.log b/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_7.log new file mode 100644 index 0000000000000..f1cc00d369fd2 --- /dev/null +++ b/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_7.log @@ -0,0 +1,8 @@ +An exception of category 'ScheduleExecutionFailure' occurred while + [0] Calling beginJob +Exception Message: +Unrunnable schedule +Circular module dependency found in configuration + module 'a' depends on b + module 'b' depends on c + module 'c' depends on b diff --git a/FWCore/Integration/test/AcquireIntFilter.cc b/FWCore/Integration/test/AcquireIntFilter.cc index c9c5d20ce581f..b162a84c8e49a 100644 --- a/FWCore/Integration/test/AcquireIntFilter.cc +++ b/FWCore/Integration/test/AcquireIntFilter.cc @@ -4,7 +4,7 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/global/EDFilter.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Integration/test/WaitingServer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/EDGetToken.h" diff --git a/FWCore/Integration/test/AcquireIntProducer.cc b/FWCore/Integration/test/AcquireIntProducer.cc index 5053c8f77cce3..4debcf6838094 100644 --- a/FWCore/Integration/test/AcquireIntProducer.cc +++ b/FWCore/Integration/test/AcquireIntProducer.cc @@ -4,7 +4,7 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Integration/test/WaitingServer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/EDGetToken.h" diff --git a/FWCore/Modules/src/LogErrorHarvester.cc b/FWCore/Modules/src/LogErrorHarvester.cc index 85439397c18cb..dce5163639078 100644 --- a/FWCore/Modules/src/LogErrorHarvester.cc +++ b/FWCore/Modules/src/LogErrorHarvester.cc @@ -50,7 +50,7 @@ namespace edm { EDPutTokenT> token_; }; - LogErrorHarvester::LogErrorHarvester(ParameterSet const& iPSet) : token_{produces>()} { + LogErrorHarvester::LogErrorHarvester(ParameterSet const& iPSet) : token_{produces()} { const edm::TypeID endPathStatusType{typeid(edm::EndPathStatus)}; const edm::TypeID pathStatusType{typeid(edm::PathStatus)}; const edm::TypeID triggerResultsType{typeid(edm::TriggerResults)}; diff --git a/FWCore/Services/bin/cmsGetFnConnect.cc b/FWCore/Services/bin/cmsGetFnConnect.cc index c3ada5e5b4d4d..602a3679b4d4c 100644 --- a/FWCore/Services/bin/cmsGetFnConnect.cc +++ b/FWCore/Services/bin/cmsGetFnConnect.cc @@ -13,8 +13,7 @@ #include "FWCore/Catalog/interface/SiteLocalConfig.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/Services/src/SiteLocalConfigService.h" -#include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" +#include "FWCore/Services/interface/setupSiteLocalConfig.h" #include "FWCore/Utilities/interface/Exception.h" #include #include @@ -27,11 +26,7 @@ int main(int argc, char* argv[]) { } try { - std::unique_ptr slcptr = - std::make_unique(edm::ParameterSet()); - auto slc = std::make_shared >(std::move(slcptr)); - edm::ServiceToken slcToken = edm::ServiceRegistry::createContaining(slc); - edm::ServiceRegistry::Operate operate(slcToken); + auto operate = edm::setupSiteLocalConfig(); edm::Service localconfservice; diff --git a/FWCore/Services/interface/setupSiteLocalConfig.h b/FWCore/Services/interface/setupSiteLocalConfig.h new file mode 100644 index 0000000000000..e87466a791095 --- /dev/null +++ b/FWCore/Services/interface/setupSiteLocalConfig.h @@ -0,0 +1,16 @@ +#ifndef FWCore_Services_setupSiteLocalConfig_h +#define FWCore_Services_setupSiteLocalConfig_h + +/** \function edm::setupSiteLocalConfig + + Description: Setups up the SiteLocalConfig service. + + Usage: +*/ + +#include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" + +namespace edm { + ServiceRegistry::Operate setupSiteLocalConfig(); +} // namespace edm +#endif diff --git a/FWCore/Services/plugins/Timing.cc b/FWCore/Services/plugins/Timing.cc index 911ea28eec42f..d4550cb1a9c5f 100644 --- a/FWCore/Services/plugins/Timing.cc +++ b/FWCore/Services/plugins/Timing.cc @@ -104,8 +104,8 @@ namespace edm { double curr_job_cpu_; // seconds std::atomic extra_job_cpu_; //seconds //use last run time for determining end of processing - std::atomic last_run_time_; - std::atomic last_run_cpu_; + std::atomic end_loop_time_; + std::atomic end_loop_cpu_; std::vector curr_events_time_; // seconds bool summary_only_; bool report_summary_; @@ -161,6 +161,16 @@ namespace edm { return static_cast(t.tv_sec) + (static_cast(t.tv_usec) * 1E-6); } + static double getChildrenCPU() { + struct rusage usage; + + getrusage(RUSAGE_CHILDREN, &usage); + double totalCPUTime = (double)usage.ru_utime.tv_sec + (double(usage.ru_utime.tv_usec) * 1E-6); + totalCPUTime += (double)usage.ru_stime.tv_sec + (double(usage.ru_stime.tv_usec) * 1E-6); + + return totalCPUTime; + } + static double getCPU() { struct rusage usage; getrusage(RUSAGE_SELF, &usage); @@ -208,8 +218,8 @@ namespace edm { : curr_job_time_(0.), curr_job_cpu_(0.), extra_job_cpu_(0.0), - last_run_time_(0.0), - last_run_cpu_(0.0), + end_loop_time_(0.0), + end_loop_cpu_(0.0), curr_events_time_(), summary_only_(iPS.getUntrackedParameter("summaryOnly")), report_summary_(iPS.getUntrackedParameter("useJobReport")), @@ -228,6 +238,10 @@ namespace edm { nSubProcesses_{0} { iRegistry.watchPreBeginJob(this, &Timing::preBeginJob); iRegistry.watchPostBeginJob(this, &Timing::postBeginJob); + iRegistry.preEndJobSignal_.connect([this]() { + end_loop_time_ = getTime(); + end_loop_cpu_ = getCPU(); + }); iRegistry.watchPostEndJob(this, &Timing::postEndJob); iRegistry.watchPreEvent(this, &Timing::preEvent); @@ -311,11 +325,6 @@ namespace edm { countSubProcessesPostEvent_.emplace_back(std::make_unique>(0)); } }); - - iRegistry.postGlobalEndRunSignal_.connect([this](edm::GlobalContext const&) { - last_run_time_ = getTime(); - last_run_cpu_ = getCPU(); - }); } Timing::~Timing() {} @@ -383,6 +392,8 @@ namespace edm { double total_job_cpu = job_end_cpu + extra_job_cpu_; + const double job_end_children_cpu = getChildrenCPU(); + const double total_initialization_time = curr_job_time_ - jobStartTime(); const double total_initialization_cpu = curr_job_cpu_; @@ -395,10 +406,10 @@ namespace edm { double min_event_time = *(std::min_element(min_events_time_.begin(), min_events_time_.end())); double max_event_time = *(std::max_element(max_events_time_.begin(), max_events_time_.end())); - auto total_loop_time = last_run_time_ - curr_job_time_; - auto total_loop_cpu = last_run_cpu_ + extra_job_cpu_ - curr_job_cpu_; + auto total_loop_time = end_loop_time_ - curr_job_time_; + auto total_loop_cpu = end_loop_cpu_ + extra_job_cpu_ - curr_job_cpu_; - if (last_run_time_ == 0.0) { + if (end_loop_time_ == 0.0) { total_loop_time = 0.0; total_loop_cpu = 0.0; } @@ -427,14 +438,15 @@ namespace edm { << " - Total loop: " << total_loop_time << "\n" << " - Total init: " << total_initialization_time << "\n" << " - Total job: " << total_job_time << "\n" - << " - EventSetup Lock: " << accumulatedTimeForLock_ << "\n" - << " - EventSetup Get: " << accumulatedTimeForGet_ << "\n" + << " - EventSetup Lock: " << accumulatedTimeForLock_ << "\n" + << " - EventSetup Get: " << accumulatedTimeForGet_ << "\n" << " Event Throughput: " << event_throughput << " ev/s\n" << " CPU Summary: \n" - << " - Total loop: " << total_loop_cpu << "\n" - << " - Total init: " << total_initialization_cpu << "\n" - << " - Total extra: " << extra_job_cpu_ << "\n" - << " - Total job: " << total_job_cpu << "\n" + << " - Total loop: " << total_loop_cpu << "\n" + << " - Total init: " << total_initialization_cpu << "\n" + << " - Total extra: " << extra_job_cpu_ << "\n" + << " - Total children: " << job_end_children_cpu << "\n" + << " - Total job: " << total_job_cpu << "\n" << " Processing Summary: \n" << " - Number of Events: " << total_event_count_ << "\n" << " - Number of Global Begin Lumi Calls: " << begin_lumi_count_ << "\n" @@ -450,6 +462,7 @@ namespace edm { reportData.insert(std::make_pair("EventThroughput", d2str(event_throughput))); reportData.insert(std::make_pair("TotalJobTime", d2str(total_job_time))); reportData.insert(std::make_pair("TotalJobCPU", d2str(total_job_cpu))); + reportData.insert(std::make_pair("TotalJobChildrenCPU", d2str(job_end_children_cpu))); reportData.insert(std::make_pair("TotalLoopTime", d2str(total_loop_time))); reportData.insert(std::make_pair("TotalLoopCPU", d2str(total_loop_cpu))); reportData.insert(std::make_pair("TotalInitTime", d2str(total_initialization_time))); diff --git a/FWCore/Services/src/setupSiteLocalConfig.cc b/FWCore/Services/src/setupSiteLocalConfig.cc new file mode 100644 index 0000000000000..ce65681fc07fe --- /dev/null +++ b/FWCore/Services/src/setupSiteLocalConfig.cc @@ -0,0 +1,22 @@ +/////////////////////////////////////// +// +// data catalogs are filled in "parse" +// +/////////////////////////////////////// + +//<<<<<< INCLUDES >>>>>> + +#include "FWCore/Services/src/SiteLocalConfigService.h" +#include "FWCore/Services/interface/setupSiteLocalConfig.h" + +#include + +namespace edm { + ServiceRegistry::Operate setupSiteLocalConfig() { + std::unique_ptr slcptr = + std::make_unique(edm::ParameterSet()); + auto slc = std::make_shared >(std::move(slcptr)); + edm::ServiceToken slcToken = edm::ServiceRegistry::createContaining(slc); + return edm::ServiceRegistry::Operate(slcToken); + } +} // namespace edm diff --git a/FWCore/SharedMemory/interface/ControllerChannel.h b/FWCore/SharedMemory/interface/ControllerChannel.h index 79bde6bf93b70..b919026350fbd 100644 --- a/FWCore/SharedMemory/interface/ControllerChannel.h +++ b/FWCore/SharedMemory/interface/ControllerChannel.h @@ -59,9 +59,9 @@ namespace edm::shared_memory { iF(); using namespace boost::posix_time; //std::cout << id_ << " waiting for external process" << std::endl; - - if (not cndToMain_.timed_wait(lock, microsec_clock::universal_time() + seconds(maxWaitInSeconds_))) { + if (not wait(lock)) { //std::cout << id_ << " FAILED waiting for external process" << std::endl; + *stop_ = true; throw cms::Exception("ExternalFailed") << "Failed waiting for external process while setting up the process. Timed out after " << maxWaitInSeconds_ << " seconds."; @@ -70,13 +70,40 @@ namespace edm::shared_memory { } } + /** setupWorkerWithRetry works just like setupWorker except it gives a way to continue waiting. The functor iRetry should return true if, after a timeout, + the code should continue to wait. + */ + template + void setupWorkerWithRetry(F&& iF, FRETRY&& iRetry) { + using namespace boost::interprocess; + scoped_lock lock(mutex_); + iF(); + using namespace boost::posix_time; + //std::cout << id_ << " waiting for external process" << std::endl; + bool shouldContinue = true; + long long int retryCount = 0; + do { + if (not wait(lock)) { + if (not iRetry()) { + *stop_ = true; + throw cms::Exception("ExternalFailed") + << "Failed waiting for external process while setting up the process. Timed out after " + << maxWaitInSeconds_ << " seconds with " << retryCount << " retries."; + } + //std::cerr<<"retrying\n"; + ++retryCount; + } else { + shouldContinue = false; + } + } while (shouldContinue); + } + template bool doTransition(F&& iF, edm::Transition iTrans, unsigned long long iTransitionID) { using namespace boost::interprocess; //std::cout << id_ << " taking from lock" << std::endl; scoped_lock lock(mutex_); - if (not wait(lock, iTrans, iTransitionID)) { return false; } @@ -85,6 +112,33 @@ namespace edm::shared_memory { return true; } + template + bool doTransitionWithRetry(F&& iF, FRETRY&& iRetry, edm::Transition iTrans, unsigned long long iTransitionID) { + using namespace boost::interprocess; + + //std::cout << id_ << " taking from lock" << std::endl; + scoped_lock lock(mutex_); + if (not wait(lock, iTrans, iTransitionID)) { + if (not iRetry()) { + return false; + } + bool shouldContinue = true; + do { + using namespace boost::posix_time; + if (not continueWait(lock)) { + if (not iRetry()) { + return false; + } + } else { + shouldContinue = false; + } + } while (shouldContinue); + } + //std::cout <& lock, edm::Transition iTrans, unsigned long long iTransID); + bool wait(boost::interprocess::scoped_lock& lock); + bool continueWait(boost::interprocess::scoped_lock& lock); // ---------- member data -------------------------------- int id_; diff --git a/FWCore/SharedMemory/interface/WorkerChannel.h b/FWCore/SharedMemory/interface/WorkerChannel.h index 9e7aa42c257fa..e7f2b6a72a956 100644 --- a/FWCore/SharedMemory/interface/WorkerChannel.h +++ b/FWCore/SharedMemory/interface/WorkerChannel.h @@ -63,6 +63,9 @@ namespace edm::shared_memory { */ template void handleTransitions(F&& iF) { + if (stopRequested()) { + return; + } while (true) { waitForController(); if (stopRequested()) { @@ -78,7 +81,11 @@ namespace edm::shared_memory { void shouldKeepEvent(bool iChoice) { *keepEvent_ = iChoice; } ///These are here for expert use - void notifyController() { cndToController_.notify_all(); } + void notifyController() { + //change in transitionID_ used to signal worker finished + *transitionID_ = ~(*transitionID_); + cndToController_.notify_all(); + } void waitForController() { cndFromController_.wait(lock_); } // ---------- const member functions --------------------------- diff --git a/FWCore/SharedMemory/src/ControllerChannel.cc b/FWCore/SharedMemory/src/ControllerChannel.cc index 5190d326cd96d..cfcfce46527f8 100644 --- a/FWCore/SharedMemory/src/ControllerChannel.cc +++ b/FWCore/SharedMemory/src/ControllerChannel.cc @@ -90,7 +90,37 @@ bool ControllerChannel::wait(scoped_lock& lock, edm::Transition iTr //std::cout << id_ << " waiting" << std::endl; using namespace boost::posix_time; - if (not cndToMain_.timed_wait(lock, microsec_clock::universal_time() + seconds(maxWaitInSeconds_))) { + //this has to be after change to *transitionID_ as that is the variable re-used for the check + auto workerStatus = initCheckWorkerStatus(transitionID_); + if (not cndToMain_.timed_wait(lock, microsec_clock::universal_time() + seconds(maxWaitInSeconds_)) and + not workerStatus.workerFinished()) { + //std::cout << id_ << " waiting FAILED" << std::endl; + return false; + } + return true; +} + +bool ControllerChannel::wait(scoped_lock& lock) { + //std::cout << id_ << " waiting" << std::endl; + using namespace boost::posix_time; + *transitionID_ = 0; + auto workerStatus = initCheckWorkerStatus(transitionID_); + if (not cndToMain_.timed_wait(lock, microsec_clock::universal_time() + seconds(maxWaitInSeconds_)) and + not workerStatus.workerFinished()) { + //std::cout << id_ << " waiting FAILED" << std::endl; + return false; + } + return true; +} + +bool ControllerChannel::continueWait(scoped_lock& lock) { + //std::cout << id_ << " waiting" << std::endl; + using namespace boost::posix_time; + //NOTE: value of *transitionID_ can not have been changed by the worker since call to wait() + // as we've had the lock since the end of that call. + auto workerStatus = initCheckWorkerStatus(transitionID_); + if (not cndToMain_.timed_wait(lock, microsec_clock::universal_time() + seconds(maxWaitInSeconds_)) and + not workerStatus.workerFinished()) { //std::cout << id_ << " waiting FAILED" << std::endl; return false; } diff --git a/FWCore/SharedMemory/test/BuildFile.xml b/FWCore/SharedMemory/test/BuildFile.xml index 540498c546473..91bd05dc7bfe4 100644 --- a/FWCore/SharedMemory/test/BuildFile.xml +++ b/FWCore/SharedMemory/test/BuildFile.xml @@ -9,6 +9,27 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/FWCore/SharedMemory/test/controller.h b/FWCore/SharedMemory/test/controller.h new file mode 100644 index 0000000000000..51e7b2b4b2f4c --- /dev/null +++ b/FWCore/SharedMemory/test/controller.h @@ -0,0 +1,95 @@ +#if !defined(TEST_CONTROLLER) +#define TEST_CONTROLLER +#include "FWCore/SharedMemory/interface/ControllerChannel.h" +#include "FWCore/Utilities/interface/Exception.h" + +#include +#include +#include +int controller(int argc, char** argv, unsigned int iTimeout) { + using namespace edm::shared_memory; + + ControllerChannel channel("TestChannel", 0, iTimeout); + + //Pipe has to close AFTER we tell the worker to stop + auto closePipe = [](FILE* iFile) { pclose(iFile); }; + std::unique_ptr pipe(nullptr, closePipe); + + auto stopWorkerCmd = [](ControllerChannel* iChannel) { iChannel->stopWorker(); }; + std::unique_ptr stopWorkerGuard(&channel, stopWorkerCmd); + + { + std::string command(argv[0]); + command += " "; + command += channel.sharedMemoryName(); + command += " "; + command += channel.uniqueID(); + //make sure output is flushed before popen does any writing + fflush(stdout); + fflush(stderr); + + channel.setupWorker([&]() { + pipe.reset(popen(command.c_str(), "w")); + + if (not pipe) { + throw cms::Exception("PipeFailed") << "pipe failed to open " << command; + } + }); + } + { + *channel.toWorkerBufferInfo() = {0, 0}; + auto result = channel.doTransition( + [&]() { + if (channel.fromWorkerBufferInfo()->index_ != 1) { + throw cms::Exception("BadValue") << "wrong index value of fromWorkerBufferInfo " + << static_cast(channel.fromWorkerBufferInfo()->index_); + } + if (channel.fromWorkerBufferInfo()->identifier_ != 1) { + throw cms::Exception("BadValue") + << "wrong identifier value of fromWorkerBufferInfo " << channel.fromWorkerBufferInfo()->identifier_; + } + if (not channel.shouldKeepEvent()) { + throw cms::Exception("BadValue") << "told not to keep event"; + } + }, + edm::Transition::Event, + 2); + if (not result) { + throw cms::Exception("TimeOut") << "doTransition timed out"; + } + } + { + *channel.toWorkerBufferInfo() = {1, 1}; + auto result = channel.doTransition( + [&]() { + if (channel.fromWorkerBufferInfo()->index_ != 0) { + throw cms::Exception("BadValue") << "wrong index value of fromWorkerBufferInfo " + << static_cast(channel.fromWorkerBufferInfo()->index_); + } + if (channel.fromWorkerBufferInfo()->identifier_ != 2) { + throw cms::Exception("BadValue") + << "wrong identifier value of fromWorkerBufferInfo " << channel.fromWorkerBufferInfo()->identifier_; + } + if (channel.shouldKeepEvent()) { + throw cms::Exception("BadValue") << "told to keep event"; + } + }, + edm::Transition::Event, + 3); + if (not result) { + throw cms::Exception("TimeOut") << "doTransition timed out"; + } + } + + { + auto result = channel.doTransition([&]() {}, edm::Transition::EndLuminosityBlock, 1); + if (not result) { + throw cms::Exception("TimeOut") << "doTransition timed out"; + } + } + + //std::cout <<"controller going to stop"< #include #include -namespace { - int controller(int argc, char** argv) { - using namespace edm::shared_memory; - - ControllerChannel channel("TestChannel", 0, 60); - - //Pipe has to close AFTER we tell the worker to stop - auto closePipe = [](FILE* iFile) { pclose(iFile); }; - std::unique_ptr pipe(nullptr, closePipe); - - auto stopWorkerCmd = [](ControllerChannel* iChannel) { iChannel->stopWorker(); }; - std::unique_ptr stopWorkerGuard(&channel, stopWorkerCmd); - { - std::string command(argv[0]); - command += " "; - command += channel.sharedMemoryName(); - command += " "; - command += channel.uniqueID(); - //make sure output is flushed before popen does any writing - fflush(stdout); - fflush(stderr); - - channel.setupWorker([&]() { - pipe.reset(popen(command.c_str(), "w")); - - if (not pipe) { - throw cms::Exception("PipeFailed") << "pipe failed to open " << command; - } - }); - } - { - *channel.toWorkerBufferInfo() = {0, 0}; - auto result = channel.doTransition( - [&]() { - if (channel.fromWorkerBufferInfo()->index_ != 1) { - throw cms::Exception("BadValue") << "wrong index value of fromWorkerBufferInfo " - << static_cast(channel.fromWorkerBufferInfo()->index_); - } - if (channel.fromWorkerBufferInfo()->identifier_ != 1) { - throw cms::Exception("BadValue") - << "wrong identifier value of fromWorkerBufferInfo " << channel.fromWorkerBufferInfo()->identifier_; - } - if (not channel.shouldKeepEvent()) { - throw cms::Exception("BadValue") << "told not to keep event"; - } - }, - edm::Transition::Event, - 2); - if (not result) { - throw cms::Exception("TimeOut") << "doTransition timed out"; - } - } - { - *channel.toWorkerBufferInfo() = {1, 1}; - auto result = channel.doTransition( - [&]() { - if (channel.fromWorkerBufferInfo()->index_ != 0) { - throw cms::Exception("BadValue") << "wrong index value of fromWorkerBufferInfo " - << static_cast(channel.fromWorkerBufferInfo()->index_); - } - if (channel.fromWorkerBufferInfo()->identifier_ != 2) { - throw cms::Exception("BadValue") - << "wrong identifier value of fromWorkerBufferInfo " << channel.fromWorkerBufferInfo()->identifier_; - } - if (channel.shouldKeepEvent()) { - throw cms::Exception("BadValue") << "told to keep event"; - } - }, - edm::Transition::Event, - 3); - if (not result) { - throw cms::Exception("TimeOut") << "doTransition timed out"; - } - } - - { - auto result = channel.doTransition([&]() {}, edm::Transition::EndLuminosityBlock, 1); - if (not result) { - throw cms::Exception("TimeOut") << "doTransition timed out"; - } - } - - //std::cout <<"controller going to stop"<(iTransition); - } - if (iTransitionID != 2ULL) { - throw cms::Exception("BadValue") << "wrong transitionID received " << static_cast(iTransitionID); - } - - if (channel.toWorkerBufferInfo()->index_ != 0) { - throw cms::Exception("BadValue") - << "wrong toWorkerBufferInfo index received " << static_cast(channel.toWorkerBufferInfo()->index_); - } - if (channel.toWorkerBufferInfo()->identifier_ != 0) { - throw cms::Exception("BadValue") - << "wrong toWorkerBufferInfo identifier received " << channel.toWorkerBufferInfo()->identifier_; - } - *channel.fromWorkerBufferInfo() = {1, 1}; - channel.shouldKeepEvent(true); - break; - } - - case 1: { - if (iTransition != edm::Transition::Event) { - throw cms::Exception("BadValue") << "wrong transition received " << static_cast(iTransition); - } - if (iTransitionID != 3ULL) { - throw cms::Exception("BadValue") << "wrong transitionID received " << static_cast(iTransitionID); - } - - if (channel.toWorkerBufferInfo()->index_ != 1) { - throw cms::Exception("BadValue") - << "wrong toWorkerBufferInfo index received " << static_cast(channel.toWorkerBufferInfo()->index_); - } - if (channel.toWorkerBufferInfo()->identifier_ != 1) { - throw cms::Exception("BadValue") - << "wrong toWorkerBufferInfo identifier received " << channel.toWorkerBufferInfo()->identifier_; - } - *channel.fromWorkerBufferInfo() = {2, 0}; - channel.shouldKeepEvent(false); - break; - } - - case 2: { - if (iTransition != edm::Transition::EndLuminosityBlock) { - throw cms::Exception("BadValue") << "wrong transition received " << static_cast(iTransition); - } - if (iTransitionID != 1ULL) { - throw cms::Exception("BadValue") << "wrong transitionID received " << static_cast(iTransitionID); - } - break; - } - default: { - throw cms::Exception("MissingStop") << "stopRequested not set"; - } - } - ++transitionCount; - }); - if (transitionCount != 3) { - throw cms::Exception("MissingStop") << "stop requested too soon " << transitionCount; - } - return 0; - } +#include "controller.h" +#include "worker.h" +namespace { const char* jobType(bool isWorker) { if (isWorker) { return "Worker"; } return "Controller"; } - } // namespace int main(int argc, char** argv) { @@ -181,10 +23,10 @@ int main(int argc, char** argv) { int retValue = 0; try { if (argc > 1) { - retValue = worker(argc, argv); + retValue = worker(argc, argv, WorkerType::kStandard); } else { isWorker = false; - retValue = controller(argc, argv); + retValue = controller(argc, argv, 60); } } catch (std::exception const& iException) { std::cerr << "Caught exception\n" << iException.what() << "\n"; diff --git a/FWCore/SharedMemory/test/test_channels_okTimeout.cc b/FWCore/SharedMemory/test/test_channels_okTimeout.cc new file mode 100644 index 0000000000000..29cbacfc46715 --- /dev/null +++ b/FWCore/SharedMemory/test/test_channels_okTimeout.cc @@ -0,0 +1,48 @@ +#include "FWCore/SharedMemory/interface/ControllerChannel.h" +#include "FWCore/SharedMemory/interface/WorkerChannel.h" +#include "FWCore/Utilities/interface/Exception.h" + +#include +#include +#include +#include +#include + +#include "controller.h" +#include "worker.h" +namespace { + + const char* jobType(bool isWorker) { + if (isWorker) { + return "Worker"; + } + return "Controller"; + } +} // namespace + +int main(int argc, char** argv) { + bool isWorker = true; + int retValue = 0; + try { + if (argc > 1) { + retValue = worker(argc, argv, WorkerType::kOKTimeout); + } else { + isWorker = false; + retValue = controller(argc, argv, 5); + } + } catch (std::exception const& iException) { + std::cerr << "Caught exception\n" << iException.what() << "\n"; + if (isWorker) { + std::cerr << "in worker\n"; + } else { + std::cerr << "in controller\n"; + } + return 1; + } + if (0 == retValue) { + std::cout << jobType(isWorker) << " success" << std::endl; + } else { + std::cout << jobType(isWorker) << " failed" << std::endl; + } + return 0; +} diff --git a/FWCore/SharedMemory/test/test_channels_retry.cc b/FWCore/SharedMemory/test/test_channels_retry.cc new file mode 100644 index 0000000000000..dc0817e26225d --- /dev/null +++ b/FWCore/SharedMemory/test/test_channels_retry.cc @@ -0,0 +1,240 @@ +#include "FWCore/SharedMemory/interface/ControllerChannel.h" +#include "FWCore/SharedMemory/interface/WorkerChannel.h" +#include "FWCore/Utilities/interface/Exception.h" + +#include +#include +#include +#include +#include +namespace { + int controller(int argc, char** argv) { + using namespace edm::shared_memory; + + ControllerChannel channel("TestChannel", 0, 5); + + //Pipe has to close AFTER we tell the worker to stop + auto closePipe = [](FILE* iFile) { pclose(iFile); }; + std::unique_ptr pipe(nullptr, closePipe); + + auto stopWorkerCmd = [](ControllerChannel* iChannel) { iChannel->stopWorker(); }; + std::unique_ptr stopWorkerGuard(&channel, stopWorkerCmd); + + { + std::string command(argv[0]); + command += " "; + command += channel.sharedMemoryName(); + command += " "; + command += channel.uniqueID(); + //make sure output is flushed before popen does any writing + fflush(stdout); + fflush(stderr); + + channel.setupWorkerWithRetry( + [&]() { + pipe.reset(popen(command.c_str(), "w")); + + if (not pipe) { + throw cms::Exception("PipeFailed") << "pipe failed to open " << command; + } + }, + []() { + std::cerr << " retry requested\n"; + return true; + }); + } + { + *channel.toWorkerBufferInfo() = {0, 0}; + auto result = channel.doTransitionWithRetry( + [&]() { + if (channel.fromWorkerBufferInfo()->index_ != 1) { + throw cms::Exception("BadValue") << "wrong index value of fromWorkerBufferInfo " + << static_cast(channel.fromWorkerBufferInfo()->index_); + } + if (channel.fromWorkerBufferInfo()->identifier_ != 1) { + throw cms::Exception("BadValue") + << "wrong identifier value of fromWorkerBufferInfo " << channel.fromWorkerBufferInfo()->identifier_; + } + if (not channel.shouldKeepEvent()) { + throw cms::Exception("BadValue") << "told not to keep event"; + } + }, + []() { + std::cerr << " retry requested 0\n"; + return true; + }, + edm::Transition::Event, + 2); + if (not result) { + throw cms::Exception("TimeOut") << "doTransition timed out"; + } + } + { + *channel.toWorkerBufferInfo() = {1, 1}; + auto result = channel.doTransitionWithRetry( + [&]() { + if (channel.fromWorkerBufferInfo()->index_ != 0) { + throw cms::Exception("BadValue") << "wrong index value of fromWorkerBufferInfo " + << static_cast(channel.fromWorkerBufferInfo()->index_); + } + if (channel.fromWorkerBufferInfo()->identifier_ != 2) { + throw cms::Exception("BadValue") + << "wrong identifier value of fromWorkerBufferInfo " << channel.fromWorkerBufferInfo()->identifier_; + } + if (channel.shouldKeepEvent()) { + throw cms::Exception("BadValue") << "told to keep event"; + } + }, + []() { + std::cerr << " retry requested 1\n"; + return true; + }, + + edm::Transition::Event, + 3); + if (not result) { + throw cms::Exception("TimeOut") << "doTransition timed out"; + } + } + + { + auto result = channel.doTransitionWithRetry([&]() {}, + []() { + std::cerr << " retry requested 2\n"; + return true; + }, + edm::Transition::EndLuminosityBlock, + 1); + if (not result) { + throw cms::Exception("TimeOut") << "doTransition timed out"; + } + } + + //std::cout <<"controller going to stop"<(iTransition); + } + if (iTransitionID != 2ULL) { + throw cms::Exception("BadValue") << "wrong transitionID received " << static_cast(iTransitionID); + } + + if (channel.toWorkerBufferInfo()->index_ != 0) { + throw cms::Exception("BadValue") + << "wrong toWorkerBufferInfo index received " << static_cast(channel.toWorkerBufferInfo()->index_); + } + if (channel.toWorkerBufferInfo()->identifier_ != 0) { + throw cms::Exception("BadValue") + << "wrong toWorkerBufferInfo identifier received " << channel.toWorkerBufferInfo()->identifier_; + } + *channel.fromWorkerBufferInfo() = {1, 1}; + channel.shouldKeepEvent(true); + break; + } + + case 1: { + if (iTransition != edm::Transition::Event) { + throw cms::Exception("BadValue") << "wrong transition received " << static_cast(iTransition); + } + if (iTransitionID != 3ULL) { + throw cms::Exception("BadValue") << "wrong transitionID received " << static_cast(iTransitionID); + } + + if (channel.toWorkerBufferInfo()->index_ != 1) { + throw cms::Exception("BadValue") + << "wrong toWorkerBufferInfo index received " << static_cast(channel.toWorkerBufferInfo()->index_); + } + if (channel.toWorkerBufferInfo()->identifier_ != 1) { + throw cms::Exception("BadValue") + << "wrong toWorkerBufferInfo identifier received " << channel.toWorkerBufferInfo()->identifier_; + } + *channel.fromWorkerBufferInfo() = {2, 0}; + channel.shouldKeepEvent(false); + break; + } + + case 2: { + if (iTransition != edm::Transition::EndLuminosityBlock) { + throw cms::Exception("BadValue") << "wrong transition received " << static_cast(iTransition); + } + if (iTransitionID != 1ULL) { + throw cms::Exception("BadValue") << "wrong transitionID received " << static_cast(iTransitionID); + } + break; + } + default: { + throw cms::Exception("MissingStop") << "stopRequested not set"; + } + } + ++transitionCount; + }); + if (transitionCount != 3) { + throw cms::Exception("MissingStop") << "stop requested too soon " << transitionCount; + } + return 0; + } + const char* jobType(bool isWorker) { + if (isWorker) { + return "Worker"; + } + return "Controller"; + } + +} // namespace + +int main(int argc, char** argv) { + bool isWorker = true; + int retValue = 0; + try { + if (argc > 1) { + retValue = worker(argc, argv); + } else { + isWorker = false; + retValue = controller(argc, argv); + } + } catch (std::exception const& iException) { + std::cerr << "Caught exception\n" << iException.what() << "\n"; + if (isWorker) { + std::cerr << "in worker\n"; + } else { + std::cerr << "in controller\n"; + } + return 1; + } + if (0 == retValue) { + std::cout << jobType(isWorker) << " success" << std::endl; + } else { + std::cout << jobType(isWorker) << " failed" << std::endl; + } + return 0; +} diff --git a/FWCore/SharedMemory/test/test_channels_startupTimeout.cc b/FWCore/SharedMemory/test/test_channels_startupTimeout.cc new file mode 100644 index 0000000000000..0f76badc40ef2 --- /dev/null +++ b/FWCore/SharedMemory/test/test_channels_startupTimeout.cc @@ -0,0 +1,54 @@ +#include "FWCore/SharedMemory/interface/ControllerChannel.h" +#include "FWCore/SharedMemory/interface/WorkerChannel.h" +#include "FWCore/Utilities/interface/Exception.h" + +#include +#include +#include +#include +#include + +#include "controller.h" +#include "worker.h" +namespace { + const char* jobType(bool isWorker) { + if (isWorker) { + return "Worker"; + } + return "Controller"; + } +} // namespace + +int main(int argc, char** argv) { + bool isWorker = true; + int retValue = 0; + try { + if (argc > 1) { + retValue = worker(argc, argv, WorkerType::kStartupTimeout); + } else { + isWorker = false; + retValue = controller(argc, argv, 5); + } + } catch (cms::Exception const& iException) { + if (iException.category() != "ExternalFailed") { + throw; + } else { + std::cout << "expected failure occurred\n"; + return 0; + } + } catch (std::exception const& iException) { + std::cerr << "Caught exception\n" << iException.what() << "\n"; + if (isWorker) { + std::cerr << "in worker\n"; + } else { + std::cerr << "in controller\n"; + } + return 1; + } + if (0 == retValue) { + std::cout << jobType(isWorker) << " success" << std::endl; + } else { + std::cout << jobType(isWorker) << " failed" << std::endl; + } + return 1; +} diff --git a/FWCore/SharedMemory/test/test_channels_transitionTimeout.cc b/FWCore/SharedMemory/test/test_channels_transitionTimeout.cc new file mode 100644 index 0000000000000..bae1bce18e3b6 --- /dev/null +++ b/FWCore/SharedMemory/test/test_channels_transitionTimeout.cc @@ -0,0 +1,68 @@ +#include "FWCore/SharedMemory/interface/ControllerChannel.h" +#include "FWCore/SharedMemory/interface/WorkerChannel.h" +#include "FWCore/Utilities/interface/Exception.h" + +#include +#include +#include +#include +#include + +#include "controller.h" +namespace { + int worker(int argc, char** argv) { + using namespace edm::shared_memory; + + assert(argc == 3); + WorkerChannel channel(argv[1], argv[2]); + + //std::cerr<<"worker setup\n"; + channel.workerSetupDone(); + + channel.handleTransitions( + [&](edm::Transition iTransition, unsigned long long iTransitionID) { throw cms::Exception("BAD"); }); + return 0; + } + const char* jobType(bool isWorker) { + if (isWorker) { + return "Worker"; + } + return "Controller"; + } + +} // namespace + +int main(int argc, char** argv) { + bool isWorker = true; + int retValue = 0; + try { + if (argc > 1) { + retValue = worker(argc, argv); + } else { + isWorker = false; + retValue = controller(argc, argv, 5); + } + } catch (cms::Exception const& iException) { + if (iException.category() != "TimeOut") { + std::cerr << "Caught exception\n" << iException.what() << "\n"; + return 1; + } else { + std::cout << "expected failure occurred\n"; + return 0; + } + } catch (std::exception const& iException) { + std::cerr << "Caught exception\n" << iException.what() << "\n"; + if (isWorker) { + std::cerr << "in worker\n"; + } else { + std::cerr << "in controller\n"; + } + return 1; + } + if (0 == retValue) { + std::cout << jobType(isWorker) << " success" << std::endl; + } else { + std::cout << jobType(isWorker) << " failed" << std::endl; + } + return 1; +} diff --git a/FWCore/SharedMemory/test/worker.h b/FWCore/SharedMemory/test/worker.h new file mode 100644 index 0000000000000..746af77b84d30 --- /dev/null +++ b/FWCore/SharedMemory/test/worker.h @@ -0,0 +1,105 @@ +#if !defined(TEST_WORKER) +#define TEST_WORKER +#include "FWCore/SharedMemory/interface/WorkerChannel.h" +#include "FWCore/Utilities/interface/Exception.h" + +#include +#include +#include +#include +#include + +enum class WorkerType { kStandard, kOKTimeout, kStartupTimeout }; + +int worker(int argc, char** argv, WorkerType iType) { + using namespace edm::shared_memory; + + using namespace std::chrono_literals; + if (iType == WorkerType::kStartupTimeout) { + //Take too long before openning the worker channel + std::this_thread::sleep_for(20s); + } + + assert(argc == 3); + WorkerChannel channel(argv[1], argv[2]); + + if (iType == WorkerType::kOKTimeout) { + //simulate long time setting up + std::this_thread::sleep_for(20s); + } + //std::cerr<<"worker setup\n"; + channel.workerSetupDone(); + + if (iType == WorkerType::kOKTimeout) { + std::this_thread::sleep_for(20s); + } + int transitionCount = 0; + channel.handleTransitions([&](edm::Transition iTransition, unsigned long long iTransitionID) { + if (iType == WorkerType::kOKTimeout) { + using namespace std::chrono_literals; + std::this_thread::sleep_for(20s); + } + switch (transitionCount) { + case 0: { + if (iTransition != edm::Transition::Event) { + throw cms::Exception("BadValue") << "wrong transition received " << static_cast(iTransition); + } + if (iTransitionID != 2ULL) { + throw cms::Exception("BadValue") << "wrong transitionID received " << static_cast(iTransitionID); + } + + if (channel.toWorkerBufferInfo()->index_ != 0) { + throw cms::Exception("BadValue") + << "wrong toWorkerBufferInfo index received " << static_cast(channel.toWorkerBufferInfo()->index_); + } + if (channel.toWorkerBufferInfo()->identifier_ != 0) { + throw cms::Exception("BadValue") + << "wrong toWorkerBufferInfo identifier received " << channel.toWorkerBufferInfo()->identifier_; + } + *channel.fromWorkerBufferInfo() = {1, 1}; + channel.shouldKeepEvent(true); + break; + } + + case 1: { + if (iTransition != edm::Transition::Event) { + throw cms::Exception("BadValue") << "wrong transition received " << static_cast(iTransition); + } + if (iTransitionID != 3ULL) { + throw cms::Exception("BadValue") << "wrong transitionID received " << static_cast(iTransitionID); + } + + if (channel.toWorkerBufferInfo()->index_ != 1) { + throw cms::Exception("BadValue") + << "wrong toWorkerBufferInfo index received " << static_cast(channel.toWorkerBufferInfo()->index_); + } + if (channel.toWorkerBufferInfo()->identifier_ != 1) { + throw cms::Exception("BadValue") + << "wrong toWorkerBufferInfo identifier received " << channel.toWorkerBufferInfo()->identifier_; + } + *channel.fromWorkerBufferInfo() = {2, 0}; + channel.shouldKeepEvent(false); + break; + } + + case 2: { + if (iTransition != edm::Transition::EndLuminosityBlock) { + throw cms::Exception("BadValue") << "wrong transition received " << static_cast(iTransition); + } + if (iTransitionID != 1ULL) { + throw cms::Exception("BadValue") << "wrong transitionID received " << static_cast(iTransitionID); + } + break; + } + default: { + throw cms::Exception("MissingStop") << "stopRequested not set"; + } + } + ++transitionCount; + }); + if (transitionCount != 3) { + throw cms::Exception("MissingStop") << "stop requested too soon " << transitionCount; + } + return 0; +} +#endif diff --git a/FWCore/Sources/interface/VectorInputSourceDescription.h b/FWCore/Sources/interface/VectorInputSourceDescription.h index 1d170327aa649..42b8874ed23fa 100644 --- a/FWCore/Sources/interface/VectorInputSourceDescription.h +++ b/FWCore/Sources/interface/VectorInputSourceDescription.h @@ -7,7 +7,7 @@ VectorInputSourceDescription : the stuff that is needed to configure a VectorinputSource that does not come in through the ParameterSet ----------------------------------------------------------------------*/ -#include "FWCore/Framework/src/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" #include diff --git a/FWCore/TestProcessor/interface/TestProcessor.h b/FWCore/TestProcessor/interface/TestProcessor.h index aa8f11dcf984c..6ddff5bba5bb3 100644 --- a/FWCore/TestProcessor/interface/TestProcessor.h +++ b/FWCore/TestProcessor/interface/TestProcessor.h @@ -29,10 +29,10 @@ // user include files #include "FWCore/Common/interface/FWCoreCommonFwd.h" #include "FWCore/Framework/interface/SharedResourcesAcquirer.h" -#include "FWCore/Framework/src/PrincipalCache.h" -#include "FWCore/Framework/src/SignallingProductRegistry.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" -#include "FWCore/Framework/src/ModuleRegistry.h" +#include "FWCore/Framework/interface/PrincipalCache.h" +#include "FWCore/Framework/interface/SignallingProductRegistry.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/ModuleRegistry.h" #include "FWCore/Framework/interface/Schedule.h" #include "FWCore/Framework/interface/EventSetupRecordKey.h" #include "FWCore/Framework/interface/DataKey.h" diff --git a/FWCore/TestProcessor/src/TestProcessor.cc b/FWCore/TestProcessor/src/TestProcessor.cc index 34f6c3b913670..1893faaddcc17 100644 --- a/FWCore/TestProcessor/src/TestProcessor.cc +++ b/FWCore/TestProcessor/src/TestProcessor.cc @@ -26,11 +26,11 @@ #include "FWCore/Framework/interface/PathsAndConsumesOfModules.h" #include "FWCore/Framework/interface/RunPrincipal.h" #include "FWCore/Framework/interface/ESRecordsToProxyIndices.h" -#include "FWCore/Framework/src/EventSetupsController.h" -#include "FWCore/Framework/src/globalTransitionAsync.h" -#include "FWCore/Framework/src/streamTransitionAsync.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" -#include "FWCore/Framework/src/ProductPutterBase.h" +#include "FWCore/Framework/interface/EventSetupsController.h" +#include "FWCore/Framework/interface/globalTransitionAsync.h" +#include "FWCore/Framework/interface/streamTransitionAsync.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/ProductPutterBase.h" #include "FWCore/Framework/interface/DelayedReader.h" #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" diff --git a/FWCore/Utilities/interface/ChildrenCPUTimer.h b/FWCore/Utilities/interface/ChildrenCPUTimer.h new file mode 100644 index 0000000000000..4f10777a8e3f5 --- /dev/null +++ b/FWCore/Utilities/interface/ChildrenCPUTimer.h @@ -0,0 +1,59 @@ +#ifndef FWCore_Utilities_ChildrenCPUTimer_h +#define FWCore_Utilities_ChildrenCPUTimer_h +// -*- C++ -*- +// +// Package: Utilities +// Class : ChildrenCPUTimer +// +/**\class ChildrenCPUTimer ChildrenCPUTimer.h FWCore/Utilities/interface/ChildrenCPUTimer.h + + Description: Timer which measures the CPU time for child processes + + Usage: + + +*/ +// +// Original Author: Chris Jones +// Created: Sun Apr 16 20:32:13 EDT 2006 +// + +// system include files +#include + +// user include files + +// forward declarations +namespace edm { + class ChildrenCPUTimer { + public: + ChildrenCPUTimer(); + ~ChildrenCPUTimer(); + ChildrenCPUTimer(ChildrenCPUTimer&&) = default; + ChildrenCPUTimer(const ChildrenCPUTimer&) = delete; + ChildrenCPUTimer& operator=(const ChildrenCPUTimer&) = delete; + + // ---------- const member functions --------------------- + double cpuTime() const; + + // ---------- static member functions -------------------- + + // ---------- member functions --------------------------- + void start(); + double stop(); //returns delta time + void reset(); + + void add(double t); + + private: + double calculateDeltaTime() const; + + // ---------- member data -------------------------------- + enum State { kRunning, kStopped } state_; + struct timeval startCPUTime_; + + double accumulatedCPUTime_; + }; +} // namespace edm + +#endif diff --git a/FWCore/Utilities/interface/EDPutToken.h b/FWCore/Utilities/interface/EDPutToken.h index de878e3ccf289..7bb124c435b23 100644 --- a/FWCore/Utilities/interface/EDPutToken.h +++ b/FWCore/Utilities/interface/EDPutToken.h @@ -41,22 +41,22 @@ namespace edm { public: using value_type = unsigned int; - EDPutToken() : m_value{s_uninitializedValue} {} + constexpr EDPutToken() noexcept : m_value{s_uninitializedValue} {} template - EDPutToken(EDPutTokenT iOther) : m_value{iOther.m_value} {} + constexpr EDPutToken(EDPutTokenT iOther) noexcept : m_value{iOther.m_value} {} // ---------- const member functions --------------------- - value_type index() const { return m_value; } - bool isUninitialized() const { return m_value == s_uninitializedValue; } + constexpr value_type index() const noexcept { return m_value; } + constexpr bool isUninitialized() const noexcept { return m_value == s_uninitializedValue; } private: //for testing friend class TestEDPutToken; - static const unsigned int s_uninitializedValue = 0xFFFFFFFF; + static constexpr unsigned int s_uninitializedValue = 0xFFFFFFFF; - explicit EDPutToken(unsigned int iValue) : m_value(iValue) {} + explicit constexpr EDPutToken(unsigned int iValue) noexcept : m_value(iValue) {} // ---------- member data -------------------------------- value_type m_value; @@ -71,19 +71,42 @@ namespace edm { public: using value_type = EDPutToken::value_type; - EDPutTokenT() : m_value{s_uninitializedValue} {} + constexpr EDPutTokenT() noexcept : m_value{s_uninitializedValue} {} + + constexpr EDPutTokenT(const EDPutTokenT&) noexcept = default; + constexpr EDPutTokenT(EDPutTokenT&&) noexcept = default; + constexpr EDPutTokenT(EDPutTokenT& iToken) noexcept : EDPutTokenT(const_cast const&>(iToken)) {} + + template + constexpr explicit EDPutTokenT(ADAPTER&& iAdapter) noexcept : EDPutTokenT(iAdapter.template produces()) {} + + constexpr EDPutTokenT& operator=(const EDPutTokenT&) noexcept = default; + constexpr EDPutTokenT& operator=(EDPutTokenT&&) noexcept = default; + constexpr EDPutTokenT& operator=(EDPutTokenT& iOther) noexcept { + m_value = iOther.m_value; + return *this; + } + + template + constexpr EDPutTokenT& operator=(ADAPTER&& iAdapter) noexcept { + EDPutTokenT temp(iAdapter.template produces()); + m_value = temp.m_value; + + return *this; + } // ---------- const member functions --------------------- - value_type index() const { return m_value; } - bool isUninitialized() const { return m_value == s_uninitializedValue; } + constexpr value_type index() const noexcept { return m_value; } + constexpr bool isUninitialized() const noexcept { return m_value == s_uninitializedValue; } private: //for testing friend class TestEDPutToken; - static const unsigned int s_uninitializedValue = 0xFFFFFFFF; + static constexpr unsigned int s_uninitializedValue = 0xFFFFFFFF; - explicit EDPutTokenT(unsigned int iValue) : m_value(iValue) {} + constexpr explicit EDPutTokenT(unsigned int iValue) noexcept : m_value(iValue) {} + constexpr explicit EDPutTokenT(unsigned long int iValue) noexcept : m_value(iValue) {} // ---------- member data -------------------------------- value_type m_value; diff --git a/FWCore/Utilities/src/Guid.h b/FWCore/Utilities/interface/Guid.h similarity index 100% rename from FWCore/Utilities/src/Guid.h rename to FWCore/Utilities/interface/Guid.h diff --git a/FWCore/Utilities/src/ChildrenCPUTimer.cc b/FWCore/Utilities/src/ChildrenCPUTimer.cc new file mode 100644 index 0000000000000..ad59ee040f614 --- /dev/null +++ b/FWCore/Utilities/src/ChildrenCPUTimer.cc @@ -0,0 +1,95 @@ +// -*- C++ -*- +// +// Package: Utilities +// Class : ChildrenCPUTimer +// +// Implementation: +// +// +// Original Author: Chris Jones +// Created: Sun Apr 16 20:32:20 EDT 2006 +// + +// system include files +#include +#include + +// user include files +#include "FWCore/Utilities/interface/ChildrenCPUTimer.h" +#include "FWCore/Utilities/interface/Exception.h" + +// +// constants, enums and typedefs +// +using namespace edm; + +// +// static data member definitions +// + +// +// constructors and destructor +// +ChildrenCPUTimer::ChildrenCPUTimer() : state_(kStopped), startCPUTime_(), accumulatedCPUTime_(0) { + startCPUTime_.tv_sec = 0; + startCPUTime_.tv_usec = 0; +} + +ChildrenCPUTimer::~ChildrenCPUTimer() {} + +// +// member functions +// +void ChildrenCPUTimer::start() { + if (kStopped == state_) { + rusage theUsage; + if (0 != getrusage(RUSAGE_CHILDREN, &theUsage)) { + throw cms::Exception("ChildrenCPUTimerFailed") << errno; + } + startCPUTime_.tv_sec = theUsage.ru_stime.tv_sec + theUsage.ru_utime.tv_sec; + startCPUTime_.tv_usec = theUsage.ru_stime.tv_usec + theUsage.ru_utime.tv_usec; + state_ = kRunning; + } +} + +double ChildrenCPUTimer::stop() { + if (kRunning == state_) { + auto t = calculateDeltaTime(); + accumulatedCPUTime_ += t; + + state_ = kStopped; + return t; + } + return 0.; +} + +void ChildrenCPUTimer::reset() { accumulatedCPUTime_ = 0; } + +void ChildrenCPUTimer::add(double t) { accumulatedCPUTime_ += t; } + +double ChildrenCPUTimer::calculateDeltaTime() const { + double returnValue; + double const microsecToSec = 1E-6; + + rusage theUsage; + if (0 != getrusage(RUSAGE_CHILDREN, &theUsage)) { + throw cms::Exception("CPUTimerFailed") << errno; + } + + returnValue = theUsage.ru_stime.tv_sec + theUsage.ru_utime.tv_sec - startCPUTime_.tv_sec + + microsecToSec * (theUsage.ru_stime.tv_usec + theUsage.ru_utime.tv_usec - startCPUTime_.tv_usec); + return returnValue; +} +// +// const member functions +// +double ChildrenCPUTimer::cpuTime() const { + if (kStopped == state_) { + return accumulatedCPUTime_; + } + return accumulatedCPUTime_ + calculateDeltaTime(); +} + +// +// static member functions +// diff --git a/FWCore/Utilities/src/GlobalIdentifier.cc b/FWCore/Utilities/src/GlobalIdentifier.cc index d83fd800ee88a..a4117e08a791f 100644 --- a/FWCore/Utilities/src/GlobalIdentifier.cc +++ b/FWCore/Utilities/src/GlobalIdentifier.cc @@ -1,5 +1,5 @@ #include "FWCore/Utilities/interface/GlobalIdentifier.h" -#include "Guid.h" +#include "FWCore/Utilities/interface/Guid.h" namespace edm { std::string createGlobalIdentifier(bool binary) { diff --git a/FWCore/Utilities/src/Guid.cc b/FWCore/Utilities/src/Guid.cc index fc8796402f980..fe482ea2f45a4 100644 --- a/FWCore/Utilities/src/Guid.cc +++ b/FWCore/Utilities/src/Guid.cc @@ -9,7 +9,7 @@ // Author : Markus Frank // // ==================================================================== -#include "Guid.h" +#include "FWCore/Utilities/interface/Guid.h" #include #include diff --git a/FWCore/Utilities/test/Guid_t.cpp b/FWCore/Utilities/test/Guid_t.cpp index d1845a48285c3..af52b8c880843 100644 --- a/FWCore/Utilities/test/Guid_t.cpp +++ b/FWCore/Utilities/test/Guid_t.cpp @@ -1,4 +1,4 @@ -#include "FWCore/Utilities/src/Guid.h" +#include "FWCore/Utilities/interface/Guid.h" #include #include diff --git a/FastSimulation/Utilities/src/RandomEngineAndDistribution.cc b/FastSimulation/Utilities/src/RandomEngineAndDistribution.cc index f6fcfd88b0405..2b4c9e3a428c5 100644 --- a/FastSimulation/Utilities/src/RandomEngineAndDistribution.cc +++ b/FastSimulation/Utilities/src/RandomEngineAndDistribution.cc @@ -3,7 +3,6 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Utilities/interface/RandomNumberGenerator.h" #include "FWCore/Utilities/interface/Exception.h" -#include "IOMC/RandomEngine/src/TRandomAdaptor.h" #include "CLHEP/Random/RandomEngine.h" diff --git a/Fireworks/Calo/interface/FWCaloDataHistProxyBuilder.h b/Fireworks/Calo/interface/FWCaloDataHistProxyBuilder.h index 1c209b298ca3c..fee11abfbd940 100644 --- a/Fireworks/Calo/interface/FWCaloDataHistProxyBuilder.h +++ b/Fireworks/Calo/interface/FWCaloDataHistProxyBuilder.h @@ -2,7 +2,7 @@ #define Fireworks_Calo_FWCaloHistDataProxyBuilder_h #include "Fireworks/Calo/interface/FWCaloDataProxyBuilderBase.h" -#include "Fireworks/Calo/src/FWFromTEveCaloDataSelector.h" +#include "Fireworks/Calo/interface/FWFromTEveCaloDataSelector.h" class TH2F; class FWHistSliceSelector; diff --git a/Fireworks/Calo/interface/FWECALDetailViewBase.h b/Fireworks/Calo/interface/FWECALDetailViewBase.h index 2b6600c56c629..36e894cfc81b9 100644 --- a/Fireworks/Calo/interface/FWECALDetailViewBase.h +++ b/Fireworks/Calo/interface/FWECALDetailViewBase.h @@ -28,6 +28,6 @@ class FWECALDetailViewBase : public FWDetailViewGL { void setTextInfo(const FWModelId &id, const T *) override; }; -#include "Fireworks/Calo/src/FWECALDetailViewBase.icc" +#include "Fireworks/Calo/interface/FWECALDetailViewBase.icc" #endif diff --git a/Fireworks/Calo/src/FWECALDetailViewBase.icc b/Fireworks/Calo/interface/FWECALDetailViewBase.icc similarity index 100% rename from Fireworks/Calo/src/FWECALDetailViewBase.icc rename to Fireworks/Calo/interface/FWECALDetailViewBase.icc diff --git a/Fireworks/Calo/src/FWFromSliceSelector.h b/Fireworks/Calo/interface/FWFromSliceSelector.h similarity index 100% rename from Fireworks/Calo/src/FWFromSliceSelector.h rename to Fireworks/Calo/interface/FWFromSliceSelector.h diff --git a/Fireworks/Calo/src/FWFromTEveCaloDataSelector.h b/Fireworks/Calo/interface/FWFromTEveCaloDataSelector.h similarity index 96% rename from Fireworks/Calo/src/FWFromTEveCaloDataSelector.h rename to Fireworks/Calo/interface/FWFromTEveCaloDataSelector.h index 734cd8e8200c0..fdd75159d8941 100644 --- a/Fireworks/Calo/src/FWFromTEveCaloDataSelector.h +++ b/Fireworks/Calo/interface/FWFromTEveCaloDataSelector.h @@ -23,7 +23,7 @@ // user include files #include "Fireworks/Core/interface/FWFromEveSelectorBase.h" -#include "Fireworks/Calo/src/FWFromSliceSelector.h" +#include "Fireworks/Calo/interface/FWFromSliceSelector.h" // forward declarations class FWEventItem; diff --git a/Fireworks/Calo/interface/FWHistSliceSelector.h b/Fireworks/Calo/interface/FWHistSliceSelector.h index fda3544aaf7fb..c346053002167 100644 --- a/Fireworks/Calo/interface/FWHistSliceSelector.h +++ b/Fireworks/Calo/interface/FWHistSliceSelector.h @@ -1,7 +1,7 @@ #ifndef Fireworks_Calo_FWHistSliceSelector_h #define Fireworks_Calo_FWHistSliceSelector_h -#include "Fireworks/Calo/src/FWFromSliceSelector.h" +#include "Fireworks/Calo/interface/FWFromSliceSelector.h" class TH2F; class FWHistSliceSelector : public FWFromSliceSelector { diff --git a/Fireworks/Calo/plugins/FWCaloTowerProxyBuilder.h b/Fireworks/Calo/plugins/FWCaloTowerProxyBuilder.h index 2ef006a44c028..233cff8e5b89a 100644 --- a/Fireworks/Calo/plugins/FWCaloTowerProxyBuilder.h +++ b/Fireworks/Calo/plugins/FWCaloTowerProxyBuilder.h @@ -22,7 +22,7 @@ #include #include "Fireworks/Calo/interface/FWCaloDataHistProxyBuilder.h" -#include "Fireworks/Calo/src/FWFromTEveCaloDataSelector.h" +#include "Fireworks/Calo/interface/FWFromTEveCaloDataSelector.h" #include "DataFormats/CaloTowers/interface/CaloTower.h" #include "DataFormats/CaloTowers/interface/CaloTowerDefs.h" diff --git a/Fireworks/Calo/plugins/FWHFTowerProxyBuilder.h b/Fireworks/Calo/plugins/FWHFTowerProxyBuilder.h index 1f89d4153a11e..dd808f6bb3984 100644 --- a/Fireworks/Calo/plugins/FWHFTowerProxyBuilder.h +++ b/Fireworks/Calo/plugins/FWHFTowerProxyBuilder.h @@ -22,7 +22,7 @@ // user include files #include "Fireworks/Calo/interface/FWCaloDataProxyBuilderBase.h" -#include "Fireworks/Calo/src/FWFromTEveCaloDataSelector.h" +#include "Fireworks/Calo/interface/FWFromTEveCaloDataSelector.h" #include "DataFormats/HcalRecHit/interface/HFRecHit.h" #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" diff --git a/Fireworks/Calo/plugins/FWHFTowerSliceSelector.h b/Fireworks/Calo/plugins/FWHFTowerSliceSelector.h index f971bd2f3b94b..d5d010239452c 100644 --- a/Fireworks/Calo/plugins/FWHFTowerSliceSelector.h +++ b/Fireworks/Calo/plugins/FWHFTowerSliceSelector.h @@ -24,7 +24,7 @@ class HcalDetId; class TEveCaloDataVec; -#include "Fireworks/Calo/src/FWFromSliceSelector.h" +#include "Fireworks/Calo/interface/FWFromSliceSelector.h" // forward declarations diff --git a/Fireworks/Calo/plugins/FWHGTowerProxyBuilder.h b/Fireworks/Calo/plugins/FWHGTowerProxyBuilder.h index 60f764f70e975..fd1e8ab47d26d 100644 --- a/Fireworks/Calo/plugins/FWHGTowerProxyBuilder.h +++ b/Fireworks/Calo/plugins/FWHGTowerProxyBuilder.h @@ -22,7 +22,7 @@ // user include files #include "Fireworks/Calo/interface/FWCaloDataProxyBuilderBase.h" -#include "Fireworks/Calo/src/FWFromTEveCaloDataSelector.h" +#include "Fireworks/Calo/interface/FWFromTEveCaloDataSelector.h" // #include "DataFormats/HGCRecHit/interface/HGRecHit.h" #include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h" diff --git a/Fireworks/Calo/plugins/FWHGTowerSliceSelector.h b/Fireworks/Calo/plugins/FWHGTowerSliceSelector.h index e5d4418da2fc8..74c8b314887cc 100644 --- a/Fireworks/Calo/plugins/FWHGTowerSliceSelector.h +++ b/Fireworks/Calo/plugins/FWHGTowerSliceSelector.h @@ -24,7 +24,7 @@ class DetId; class TEveCaloDataVec; -#include "Fireworks/Calo/src/FWFromSliceSelector.h" +#include "Fireworks/Calo/interface/FWFromSliceSelector.h" // forward declarations diff --git a/Fireworks/Calo/src/FWCaloDataProxyBuilderBase.cc b/Fireworks/Calo/src/FWCaloDataProxyBuilderBase.cc index 84f00c0f967bd..40f3943eb37e0 100644 --- a/Fireworks/Calo/src/FWCaloDataProxyBuilderBase.cc +++ b/Fireworks/Calo/src/FWCaloDataProxyBuilderBase.cc @@ -25,7 +25,7 @@ #include "Fireworks/Core/interface/FWEventItem.h" #include "Fireworks/Calo/interface/FWCaloDataProxyBuilderBase.h" -#include "Fireworks/Calo/src/FWFromTEveCaloDataSelector.h" +#include "Fireworks/Calo/interface/FWFromTEveCaloDataSelector.h" #include "DataFormats/CaloTowers/interface/CaloTower.h" diff --git a/Fireworks/Calo/src/FWFromSliceSelector.cc b/Fireworks/Calo/src/FWFromSliceSelector.cc index 2cef90802459a..17d6aa43eb8a8 100644 --- a/Fireworks/Calo/src/FWFromSliceSelector.cc +++ b/Fireworks/Calo/src/FWFromSliceSelector.cc @@ -13,7 +13,7 @@ // system include files // user include files -#include "Fireworks/Calo/src/FWFromSliceSelector.h" +#include "Fireworks/Calo/interface/FWFromSliceSelector.h" #include "Fireworks/Core/interface/FWEventItem.h" // diff --git a/Fireworks/Calo/src/FWFromTEveCaloDataSelector.cc b/Fireworks/Calo/src/FWFromTEveCaloDataSelector.cc index 671a8368a64d9..c6d86198119c9 100644 --- a/Fireworks/Calo/src/FWFromTEveCaloDataSelector.cc +++ b/Fireworks/Calo/src/FWFromTEveCaloDataSelector.cc @@ -16,7 +16,7 @@ #include // user include files -#include "Fireworks/Calo/src/FWFromTEveCaloDataSelector.h" +#include "Fireworks/Calo/interface/FWFromTEveCaloDataSelector.h" #include "Fireworks/Core/interface/FWModelChangeManager.h" #include "Fireworks/Core/interface/FWEventItem.h" diff --git a/Fireworks/Core/interface/CmsShowTaskExecutor.h b/Fireworks/Core/interface/CmsShowTaskExecutor.h index bf1de8c87a39f..27e54b79faa56 100644 --- a/Fireworks/Core/interface/CmsShowTaskExecutor.h +++ b/Fireworks/Core/interface/CmsShowTaskExecutor.h @@ -23,7 +23,7 @@ #include // user include files -#include "Fireworks/Core/src/CmsShowTaskExecutorBase.h" +#include "Fireworks/Core/interface/CmsShowTaskExecutorBase.h" // forward declarations diff --git a/Fireworks/Core/src/CmsShowTaskExecutorBase.h b/Fireworks/Core/interface/CmsShowTaskExecutorBase.h similarity index 100% rename from Fireworks/Core/src/CmsShowTaskExecutorBase.h rename to Fireworks/Core/interface/CmsShowTaskExecutorBase.h diff --git a/Fireworks/Core/interface/FWDetailViewCanvas.h b/Fireworks/Core/interface/FWDetailViewCanvas.h index e396137f7ef9e..5d0b5f66c0b18 100644 --- a/Fireworks/Core/interface/FWDetailViewCanvas.h +++ b/Fireworks/Core/interface/FWDetailViewCanvas.h @@ -21,5 +21,5 @@ class FWDetailViewCanvas : public FWDetailView { TCanvas* m_viewCanvas; }; -#include "Fireworks/Core/src/FWDetailViewCanvas.icc" +#include "Fireworks/Core/interface/FWDetailViewCanvas.icc" #endif diff --git a/Fireworks/Core/src/FWDetailViewCanvas.icc b/Fireworks/Core/interface/FWDetailViewCanvas.icc similarity index 100% rename from Fireworks/Core/src/FWDetailViewCanvas.icc rename to Fireworks/Core/interface/FWDetailViewCanvas.icc diff --git a/Fireworks/Core/interface/FWDetailViewGL.h b/Fireworks/Core/interface/FWDetailViewGL.h index 6896d5f80f5c7..c51cd08dd98a9 100644 --- a/Fireworks/Core/interface/FWDetailViewGL.h +++ b/Fireworks/Core/interface/FWDetailViewGL.h @@ -29,6 +29,6 @@ class FWDetailViewGL : public FWDetailView { TEveScene *m_eveScene; }; -#include "Fireworks/Core/src/FWDetailViewGL.icc" +#include "Fireworks/Core/interface/FWDetailViewGL.icc" #endif diff --git a/Fireworks/Core/src/FWDetailViewGL.icc b/Fireworks/Core/interface/FWDetailViewGL.icc similarity index 100% rename from Fireworks/Core/src/FWDetailViewGL.icc rename to Fireworks/Core/interface/FWDetailViewGL.icc diff --git a/Fireworks/Core/interface/FWHLTValidator.h b/Fireworks/Core/interface/FWHLTValidator.h index e82a9df129702..07804593594e7 100644 --- a/Fireworks/Core/interface/FWHLTValidator.h +++ b/Fireworks/Core/interface/FWHLTValidator.h @@ -6,7 +6,7 @@ // Class : FWHLTValidator // -#include "Fireworks/Core/src/FWValidatorBase.h" +#include "Fireworks/Core/interface/FWValidatorBase.h" namespace edm { class TriggerNames; diff --git a/Fireworks/Core/interface/FWItemAccessorRegistry.h b/Fireworks/Core/interface/FWItemAccessorRegistry.h index efdbf34938f4b..37be3f5100c91 100644 --- a/Fireworks/Core/interface/FWItemAccessorRegistry.h +++ b/Fireworks/Core/interface/FWItemAccessorRegistry.h @@ -5,7 +5,7 @@ // Package: Core // Class : FWItemAccessorRegistry // -/**\class FWItemAccessorRegistry FWItemAccessorRegistry.h Fireworks/Core/src/FWItemAccessorRegistry.h +/**\class FWItemAccessorRegistry FWItemAccessorRegistry.h Fireworks/Core/interface/FWItemAccessorRegistry.h Description: Registry for all th FWItemAccessorBase derived classes that can be loaded via the plugin manager. Those classes are to be used to have specialized versions of diff --git a/Fireworks/Core/interface/FWTEventList.h b/Fireworks/Core/interface/FWTEventList.h index da4ce1cec4b8d..432e768bcbb56 100644 --- a/Fireworks/Core/interface/FWTEventList.h +++ b/Fireworks/Core/interface/FWTEventList.h @@ -2,7 +2,7 @@ #define Fireworks_Core_FWTEventList_h // There was a bug in ROOT ... fixed on Dec 9 2009: -// http://root.cern.ch/viewcvs/trunk/tree/tree/src/TEventList.cxx?view=log +// http://root.cern.ch/viewcvs/trunk/tree/tree/interface/TEventList.cxx?view=log // // We need to keep this intermediate class until we switch to // root-5.26 or later. diff --git a/Fireworks/Core/src/FWValidatorBase.h b/Fireworks/Core/interface/FWValidatorBase.h similarity index 100% rename from Fireworks/Core/src/FWValidatorBase.h rename to Fireworks/Core/interface/FWValidatorBase.h diff --git a/Fireworks/Core/interface/FWXMLConfigParser.h b/Fireworks/Core/interface/FWXMLConfigParser.h index befebb5e2f10d..d265a399091bc 100644 --- a/Fireworks/Core/interface/FWXMLConfigParser.h +++ b/Fireworks/Core/interface/FWXMLConfigParser.h @@ -2,7 +2,7 @@ #define Fireworks_Core_FWXMLConfigParser #include #include -#include "Fireworks/Core/src/SimpleSAXParser.h" +#include "Fireworks/Core/interface/SimpleSAXParser.h" #include "Fireworks/Core/interface/FWConfiguration.h" diff --git a/Fireworks/Core/src/SimpleSAXParser.h b/Fireworks/Core/interface/SimpleSAXParser.h similarity index 100% rename from Fireworks/Core/src/SimpleSAXParser.h rename to Fireworks/Core/interface/SimpleSAXParser.h diff --git a/Fireworks/Core/src/CmsShowMainBase.cc b/Fireworks/Core/src/CmsShowMainBase.cc index 42f88fe97da45..0e430b14d5b87 100644 --- a/Fireworks/Core/src/CmsShowMainBase.cc +++ b/Fireworks/Core/src/CmsShowMainBase.cc @@ -41,7 +41,7 @@ #include "Fireworks/Core/interface/FWViewManagerManager.h" #include "Fireworks/Core/interface/CmsShowTaskExecutor.h" #include "Fireworks/Core/src/FWColorSelect.h" -#include "Fireworks/Core/src/SimpleSAXParser.h" +#include "Fireworks/Core/interface/SimpleSAXParser.h" #include "Fireworks/Core/interface/CmsShowCommon.h" #include "Fireworks/Core/interface/fwLog.h" #include "Fireworks/Core/interface/fwPaths.h" diff --git a/Fireworks/Core/src/CmsShowTaskExecutorBase.cc b/Fireworks/Core/src/CmsShowTaskExecutorBase.cc index 0aa49a8c1d583..193a5d2654b49 100644 --- a/Fireworks/Core/src/CmsShowTaskExecutorBase.cc +++ b/Fireworks/Core/src/CmsShowTaskExecutorBase.cc @@ -15,7 +15,7 @@ #include // user include files -#include "Fireworks/Core/src/CmsShowTaskExecutorBase.h" +#include "Fireworks/Core/interface/CmsShowTaskExecutorBase.h" #include "Fireworks/Core/src/CmsShowTaskTimer.h" // diff --git a/Fireworks/Core/src/CmsShowTaskTimer.cc b/Fireworks/Core/src/CmsShowTaskTimer.cc index a664ab16e995a..7cc58497b2f3b 100644 --- a/Fireworks/Core/src/CmsShowTaskTimer.cc +++ b/Fireworks/Core/src/CmsShowTaskTimer.cc @@ -14,7 +14,7 @@ // user include files #include "Fireworks/Core/src/CmsShowTaskTimer.h" -#include "Fireworks/Core/src/CmsShowTaskExecutorBase.h" +#include "Fireworks/Core/interface/CmsShowTaskExecutorBase.h" // // constants, enums and typedefs diff --git a/Fireworks/Core/src/FWConfigurationManager.cc b/Fireworks/Core/src/FWConfigurationManager.cc index 2d7ad9fb6c84c..84419b634c208 100644 --- a/Fireworks/Core/src/FWConfigurationManager.cc +++ b/Fireworks/Core/src/FWConfigurationManager.cc @@ -24,7 +24,7 @@ #include "Fireworks/Core/interface/FWConfiguration.h" #include "Fireworks/Core/interface/FWConfigurable.h" #include "Fireworks/Core/interface/fwLog.h" -#include "Fireworks/Core/src/SimpleSAXParser.h" +#include "Fireworks/Core/interface/SimpleSAXParser.h" #include "Fireworks/Core/interface/FWJobMetadataManager.h" #include "Fireworks/Core/interface/fwLog.h" #include "Fireworks/Core/interface/FWXMLConfigParser.h" diff --git a/Fireworks/Core/src/FWExpressionValidator.h b/Fireworks/Core/src/FWExpressionValidator.h index 061fda44955b7..c5100d45156bb 100644 --- a/Fireworks/Core/src/FWExpressionValidator.h +++ b/Fireworks/Core/src/FWExpressionValidator.h @@ -24,7 +24,7 @@ #include "FWCore/Reflection/interface/TypeWithDict.h" // user include files -#include "Fireworks/Core/src/FWValidatorBase.h" +#include "Fireworks/Core/interface/FWValidatorBase.h" // forward declarations namespace fireworks { diff --git a/Fireworks/Core/src/FWGeometryTableView.cc b/Fireworks/Core/src/FWGeometryTableView.cc index da3efb88b6e17..0d4f9cf1e82cd 100644 --- a/Fireworks/Core/src/FWGeometryTableView.cc +++ b/Fireworks/Core/src/FWGeometryTableView.cc @@ -27,7 +27,7 @@ #include "Fireworks/Core/src/FWGUIValidatingTextEntry.h" #include "Fireworks/Core/interface/FWGUIManager.h" -#include "Fireworks/Core/src/FWValidatorBase.h" +#include "Fireworks/Core/interface/FWValidatorBase.h" #include "Fireworks/Core/src/FWEveDetectorGeo.h" #include "KeySymbols.h" diff --git a/Fireworks/Core/src/FWOverlapTableView.cc b/Fireworks/Core/src/FWOverlapTableView.cc index 6495366a3283c..ba85b65fb732a 100644 --- a/Fireworks/Core/src/FWOverlapTableView.cc +++ b/Fireworks/Core/src/FWOverlapTableView.cc @@ -24,7 +24,7 @@ #include "Fireworks/Core/interface/fwLog.h" #include "Fireworks/Core/src/FWGUIValidatingTextEntry.h" -#include "Fireworks/Core/src/FWValidatorBase.h" +#include "Fireworks/Core/interface/FWValidatorBase.h" #include "Fireworks/Core/src/FWEveDigitSetScalableMarker.h" #include "TEveScene.h" diff --git a/Fireworks/Core/src/FWPartialConfig.cc b/Fireworks/Core/src/FWPartialConfig.cc index 94a4ce7e22a86..aeb0fff0ee700 100644 --- a/Fireworks/Core/src/FWPartialConfig.cc +++ b/Fireworks/Core/src/FWPartialConfig.cc @@ -8,7 +8,7 @@ #include "TSystem.h" #include "TROOT.h" -#include "Fireworks/Core/src/SimpleSAXParser.h" +#include "Fireworks/Core/interface/SimpleSAXParser.h" #include "Fireworks/Core/interface/FWXMLConfigParser.h" #include "Fireworks/Core/interface/FWEventItemsManager.h" #include "Fireworks/Core/interface/FWGUIManager.h" diff --git a/Fireworks/Core/src/SimpleSAXParser.cc b/Fireworks/Core/src/SimpleSAXParser.cc index f9608ff89bda9..6ba1997a76ef4 100644 --- a/Fireworks/Core/src/SimpleSAXParser.cc +++ b/Fireworks/Core/src/SimpleSAXParser.cc @@ -1,4 +1,4 @@ -#include "Fireworks/Core/src/SimpleSAXParser.h" +#include "Fireworks/Core/interface/SimpleSAXParser.h" /** Helper function to handle entities, i.e. characters specified with the "&label;" syntax. diff --git a/Fireworks/Geometry/src/FWRecoGeometryESProducer.cc b/Fireworks/Geometry/src/FWRecoGeometryESProducer.cc index ff6fcb790d3ae..b0820b0b10e81 100644 --- a/Fireworks/Geometry/src/FWRecoGeometryESProducer.cc +++ b/Fireworks/Geometry/src/FWRecoGeometryESProducer.cc @@ -60,36 +60,39 @@ void FWRecoGeometryESProducer::ADD_PIXEL_TOPOLOGY(unsigned int rawid, using Phase2TrackerGeomDetUnit = PixelGeomDetUnit; using Phase2TrackerTopology = PixelTopology; -#define ADD_SISTRIP_TOPOLOGY(rawid, detUnit) \ - const StripGeomDetUnit* det = dynamic_cast(detUnit); \ - if (det) { \ - if (const StripTopology* topo = dynamic_cast(&det->specificTopology())) { \ - fwRecoGeometry.idToName[rawid].topology[0] = 0; \ - fwRecoGeometry.idToName[rawid].topology[1] = topo->nstrips(); \ - fwRecoGeometry.idToName[rawid].topology[2] = topo->stripLength(); \ - } else if (const RadialStripTopology* rtop = \ - dynamic_cast(&(det->specificType().specificTopology()))) { \ - fwRecoGeometry.idToName[rawid].topology[0] = 1; \ - fwRecoGeometry.idToName[rawid].topology[3] = rtop->yAxisOrientation(); \ - fwRecoGeometry.idToName[rawid].topology[4] = rtop->originToIntersection(); \ - fwRecoGeometry.idToName[rawid].topology[5] = rtop->phiOfOneEdge(); \ - fwRecoGeometry.idToName[rawid].topology[6] = rtop->angularWidth(); \ - } else if (dynamic_cast(&(det->specificType().specificTopology()))) { \ - fwRecoGeometry.idToName[rawid].topology[0] = 2; \ - fwRecoGeometry.idToName[rawid].topology[3] = topo->pitch(); \ - } else if (dynamic_cast(&(det->specificType().specificTopology()))) { \ - fwRecoGeometry.idToName[rawid].topology[0] = 3; \ - fwRecoGeometry.idToName[rawid].topology[3] = topo->pitch(); \ - } \ - } else { \ - const Phase2TrackerGeomDetUnit* det = dynamic_cast(detUnit); \ - if (det) { \ - if (const Phase2TrackerTopology* topo = \ - dynamic_cast(&(det->specificTopology()))) { \ - fwRecoGeometry.idToName[rawid].topology[0] = topo->pitch().first; \ - fwRecoGeometry.idToName[rawid].topology[1] = topo->pitch().second; \ - } \ - } \ +#define ADD_SISTRIP_TOPOLOGY(rawid, detUnit) \ + const StripGeomDetUnit* det = dynamic_cast(detUnit); \ + if (det) { \ + if (const StripTopology* topo = dynamic_cast(&det->specificTopology())) { \ + fwRecoGeometry.idToName[rawid].topology[0] = 0; \ + fwRecoGeometry.idToName[rawid].topology[1] = topo->nstrips(); \ + fwRecoGeometry.idToName[rawid].topology[2] = topo->stripLength(); \ + } \ + if (const RadialStripTopology* rtop = \ + dynamic_cast(&(det->specificType().specificTopology()))) { \ + fwRecoGeometry.idToName[rawid].topology[0] = 1; \ + fwRecoGeometry.idToName[rawid].topology[3] = rtop->yAxisOrientation(); \ + fwRecoGeometry.idToName[rawid].topology[4] = rtop->originToIntersection(); \ + fwRecoGeometry.idToName[rawid].topology[5] = rtop->phiOfOneEdge(); \ + fwRecoGeometry.idToName[rawid].topology[6] = rtop->angularWidth(); \ + } else if (const RectangularStripTopology* topo = \ + dynamic_cast(&(det->specificType().specificTopology()))) { \ + fwRecoGeometry.idToName[rawid].topology[0] = 2; \ + fwRecoGeometry.idToName[rawid].topology[3] = topo->pitch(); \ + } else if (const TrapezoidalStripTopology* topo = \ + dynamic_cast(&(det->specificType().specificTopology()))) { \ + fwRecoGeometry.idToName[rawid].topology[0] = 3; \ + fwRecoGeometry.idToName[rawid].topology[3] = topo->pitch(); \ + } \ + } else { \ + const Phase2TrackerGeomDetUnit* det = dynamic_cast(detUnit); \ + if (det) { \ + if (const Phase2TrackerTopology* topo = \ + dynamic_cast(&(det->specificTopology()))) { \ + fwRecoGeometry.idToName[rawid].topology[0] = topo->pitch().first; \ + fwRecoGeometry.idToName[rawid].topology[1] = topo->pitch().second; \ + } \ + } \ } namespace { diff --git a/GeneratorInterface/CosmicMuonGenerator/src/Point5MaterialMap.cc b/GeneratorInterface/CosmicMuonGenerator/interface/Point5MaterialMap.h similarity index 100% rename from GeneratorInterface/CosmicMuonGenerator/src/Point5MaterialMap.cc rename to GeneratorInterface/CosmicMuonGenerator/interface/Point5MaterialMap.h diff --git a/GeneratorInterface/CosmicMuonGenerator/interface/SingleParticleEvent.h b/GeneratorInterface/CosmicMuonGenerator/interface/SingleParticleEvent.h index 35dcee9214c97..d1ebf906808d9 100644 --- a/GeneratorInterface/CosmicMuonGenerator/interface/SingleParticleEvent.h +++ b/GeneratorInterface/CosmicMuonGenerator/interface/SingleParticleEvent.h @@ -6,7 +6,7 @@ // include files #include "GeneratorInterface/CosmicMuonGenerator/interface/CosmicMuonParameters.h" -#include "GeneratorInterface/CosmicMuonGenerator/src/Point5MaterialMap.cc" +#include "GeneratorInterface/CosmicMuonGenerator/interface/Point5MaterialMap.h" #include class SingleParticleEvent { diff --git a/GeneratorInterface/Hydjet2Interface/interface/EquationSolver.h b/GeneratorInterface/Hydjet2Interface/interface/EquationSolver.h index 0dd890e3ae93a..1e37d8e74de74 100644 --- a/GeneratorInterface/Hydjet2Interface/interface/EquationSolver.h +++ b/GeneratorInterface/Hydjet2Interface/interface/EquationSolver.h @@ -64,6 +64,6 @@ class NAEquationSolver { bool Brent(Function& theFunction); }; -#include "GeneratorInterface/Hydjet2Interface/src/EquationSolver.icc" +#include "GeneratorInterface/Hydjet2Interface/interface/EquationSolver.icc" #endif diff --git a/GeneratorInterface/Hydjet2Interface/src/EquationSolver.icc b/GeneratorInterface/Hydjet2Interface/interface/EquationSolver.icc similarity index 100% rename from GeneratorInterface/Hydjet2Interface/src/EquationSolver.icc rename to GeneratorInterface/Hydjet2Interface/interface/EquationSolver.icc diff --git a/GeneratorInterface/LHEInterface/scripts/mergeLHE.py b/GeneratorInterface/LHEInterface/scripts/mergeLHE.py index 89ad68233755c..7810f8d6b7a78 100755 --- a/GeneratorInterface/LHEInterface/scripts/mergeLHE.py +++ b/GeneratorInterface/LHEInterface/scripts/mergeLHE.py @@ -196,7 +196,7 @@ def merge(self): for i in range(len(self._f)): header = [] line = next(self._f[i]) - while not line.startswith('') and not line.startswith('|\s)', line): header.append(line) line = next(self._f[i]) # 'header' includes all contents before reaches @@ -207,7 +207,7 @@ def merge(self): for i in range(len(self._f)): init = [] line = next(self._f[i]) - while not line.startswith(''): + while not re.search('\s*', line): init.append(line) line = next(self._f[i]) # 'init_str' includes all contents inside ... @@ -220,9 +220,9 @@ def merge(self): nevent = 0 while True: line = next(self._f[i]) - if line.startswith(''): + if re.search('\s*', line): nevent += 1 - if line.startswith(''): + if re.search('\s*', line): break _fwtmp.write(line) self._nevent.append(nevent) @@ -253,7 +253,7 @@ def merge(self): sign = lambda x: -1 if x < 0 else 1 for line in ftmp: event_line += 1 - if line.startswith('', line): event_line = 0 if event_line == 1: # modify the XWGTUP appeared in the first line of the @@ -261,8 +261,8 @@ def merge(self): orig_wgt = float(line.split()[2]) fw.write(re.sub(r'(^\s*\S+\s+\S+\s+)\S+(.+)', r'\g<1>%+.7E\g<2>' \ % (sign(orig_wgt) * self._uwgt), line)) - elif line.startswith('\s*(\S+)\s*\<\/wgt\>', line).group(1) + elif re.search('\s*.*', line): + addi_wgt_str = re.search(r'\\s*(\S+)\s*\<\/wgt\>', line).group(1) fw.write(line.replace( addi_wgt_str, '%+.7E' % (float(addi_wgt_str) / orig_wgt * self._uwgt))) else: diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021.xml index 7027b81b1fdee..47d2c724c6356 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021.xml @@ -299,7 +299,6 @@ - @@ -309,18 +308,17 @@ - - - - - - - - - + + + + + + + + @@ -338,21 +336,22 @@ - - - - - + + + + + + + - - - - - - - - - + + + + + + + + diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus05Percent.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus05Percent.xml index c41d03751f415..1a722a1b65c5b 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus05Percent.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus05Percent.xml @@ -299,7 +299,6 @@ - @@ -309,18 +308,17 @@ - - - - - - - - - + + + + + + + + @@ -338,21 +336,22 @@ - - - - - + + + + + + + - - - - - - - - - + + + + + + + + diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus10Percent.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus10Percent.xml index 6b0d7f3e95cda..29fd1a1ca1975 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus10Percent.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus10Percent.xml @@ -299,7 +299,6 @@ - @@ -309,18 +308,17 @@ - - - - - - - - - + + + + + + + + @@ -338,21 +336,22 @@ - - - - - + + + + + + + - - - - - - - - - + + + + + + + + diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus05Percent.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus05Percent.xml index 27e6d28ae6465..d49782e5d80bf 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus05Percent.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus05Percent.xml @@ -299,7 +299,6 @@ - @@ -309,18 +308,17 @@ - - - - - - - - - + + + + + + + + @@ -338,21 +336,22 @@ - - - - - + + + + + + + - - - - - - - - - + + + + + + + + diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus10Percent.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus10Percent.xml index 5ded176316ff6..7bc4e3cffcc9a 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus10Percent.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus10Percent.xml @@ -299,7 +299,6 @@ - @@ -309,18 +308,17 @@ - - - - - - - - - + + + + + + + + @@ -338,21 +336,22 @@ - - - - - + + + + + + + - - - - - - - - - + + + + + + + + diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021ZeroMaterial.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021ZeroMaterial.xml index dccbe55b3b91d..b84e9e4d3c0f2 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021ZeroMaterial.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021ZeroMaterial.xml @@ -299,7 +299,6 @@ - @@ -309,18 +308,17 @@ - - - - - - - - - + + + + + + + + @@ -338,21 +336,22 @@ - - - - - + + + + + + + - - - - - - - - - + + + + + + + + diff --git a/Geometry/CMSCommonData/data/materials/2021/v3/materials.xml b/Geometry/CMSCommonData/data/materials/2021/v3/materials.xml new file mode 100644 index 0000000000000..ca9b104e5ae63 --- /dev/null +++ b/Geometry/CMSCommonData/data/materials/2021/v3/materials.xml @@ -0,0 +1,4405 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus05PercentXML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus05PercentXML_cfi.py index 13341bd7e345e..f1b316338916f 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus05PercentXML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus05PercentXML_cfi.py @@ -302,7 +302,6 @@ 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_005.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_020.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_021.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_022.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_024.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_025.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_100.xml', @@ -312,18 +311,17 @@ 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_105.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_120.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_121.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_122.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_124.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_125.xml', 'Geometry/VeryForwardData/data/RP_Device.xml', - 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/v1/RP_Vertical_Device.xml', - 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/v1/RP_Horizontal_Device.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Right_Station/v2/CTPPS_220_Right_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Left_Station/v2/CTPPS_220_Left_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Right_Station/v2/CTPPS_210_Right_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Left_Station/v2/CTPPS_210_Left_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_Stations_Assembly.xml', - 'Geometry/VeryForwardData/data/CTPPS_Cuts_Per_Region.xml', + 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/Simu/v1/RP_Vertical_Device.xml', + 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/Simu/v1/RP_Horizontal_Device.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_220_Right_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_220_Left_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_210_Right_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_210_Left_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Cuts_Per_Region/Simu/v1/CTPPS_Cuts_Per_Region.xml', 'Geometry/VeryForwardData/data/RP_Sensitive_Dets.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Transformations.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Parameters.xml', @@ -341,21 +339,22 @@ 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment3.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment4.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment5.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane3.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane4.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Detector_Assembly/2021/v1/CTPPS_Diamond_Detector_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane1.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane2.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane4.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Detector_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/Simu/v1/CTPPS_Detectors_Assembly_022.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/Simu/v1/CTPPS_Detectors_Assembly_122.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Sensitive_Dets_TimingHits.xml', - 'Geometry/VeryForwardData/data/ppstrackerMaterials/v2/ppstrackerMaterials.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module/v3/CTPPS_Pixel_Module.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module_2x2/v3/CTPPS_Pixel_Module_2x2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_003.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_023.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_103.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_123.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Sens.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/RP_Dist_Beam_Cent.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/ppstrackerMaterials.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/PPS_Pixel_Module_2x2_Run3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/PPS_Pixel_Sens.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_003.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_023.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_103.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_123.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/RP_Dist_Beam_Cent/Simu/v1/RP_Dist_Beam_Cent.xml', 'Geometry/EcalSimData/data/ecalsens.xml', 'Geometry/HcalCommonData/data/hcalsens/2021/v1/hcalsenspmf.xml', 'Geometry/HcalSimData/data/hf.xml', diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus10PercentXML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus10PercentXML_cfi.py index 3421543e9b38c..cfe93eb6c66e4 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus10PercentXML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus10PercentXML_cfi.py @@ -302,7 +302,6 @@ 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_005.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_020.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_021.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_022.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_024.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_025.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_100.xml', @@ -312,18 +311,17 @@ 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_105.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_120.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_121.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_122.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_124.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_125.xml', 'Geometry/VeryForwardData/data/RP_Device.xml', - 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/v1/RP_Vertical_Device.xml', - 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/v1/RP_Horizontal_Device.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Right_Station/v2/CTPPS_220_Right_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Left_Station/v2/CTPPS_220_Left_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Right_Station/v2/CTPPS_210_Right_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Left_Station/v2/CTPPS_210_Left_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_Stations_Assembly.xml', - 'Geometry/VeryForwardData/data/CTPPS_Cuts_Per_Region.xml', + 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/Simu/v1/RP_Vertical_Device.xml', + 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/Simu/v1/RP_Horizontal_Device.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_220_Right_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_220_Left_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_210_Right_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_210_Left_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Cuts_Per_Region/Simu/v1/CTPPS_Cuts_Per_Region.xml', 'Geometry/VeryForwardData/data/RP_Sensitive_Dets.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Transformations.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Parameters.xml', @@ -341,21 +339,22 @@ 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment3.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment4.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment5.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane3.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane4.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Detector_Assembly/2021/v1/CTPPS_Diamond_Detector_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane1.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane2.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane4.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Detector_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/Simu/v1/CTPPS_Detectors_Assembly_022.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/Simu/v1/CTPPS_Detectors_Assembly_122.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Sensitive_Dets_TimingHits.xml', - 'Geometry/VeryForwardData/data/ppstrackerMaterials/v2/ppstrackerMaterials.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module/v3/CTPPS_Pixel_Module.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module_2x2/v3/CTPPS_Pixel_Module_2x2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_003.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_023.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_103.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_123.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Sens.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/RP_Dist_Beam_Cent.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/ppstrackerMaterials.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/PPS_Pixel_Module_2x2_Run3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/PPS_Pixel_Sens.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_003.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_023.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_103.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_123.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/RP_Dist_Beam_Cent/Simu/v1/RP_Dist_Beam_Cent.xml', 'Geometry/EcalSimData/data/ecalsens.xml', 'Geometry/HcalCommonData/data/hcalsens/2021/v1/hcalsenspmf.xml', 'Geometry/HcalSimData/data/hf.xml', diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus05PercentXML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus05PercentXML_cfi.py index bf5635935257b..52af7764ef58f 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus05PercentXML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus05PercentXML_cfi.py @@ -302,7 +302,6 @@ 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_005.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_020.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_021.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_022.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_024.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_025.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_100.xml', @@ -312,18 +311,17 @@ 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_105.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_120.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_121.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_122.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_124.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_125.xml', 'Geometry/VeryForwardData/data/RP_Device.xml', - 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/v1/RP_Vertical_Device.xml', - 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/v1/RP_Horizontal_Device.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Right_Station/v2/CTPPS_220_Right_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Left_Station/v2/CTPPS_220_Left_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Right_Station/v2/CTPPS_210_Right_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Left_Station/v2/CTPPS_210_Left_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_Stations_Assembly.xml', - 'Geometry/VeryForwardData/data/CTPPS_Cuts_Per_Region.xml', + 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/Simu/v1/RP_Vertical_Device.xml', + 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/Simu/v1/RP_Horizontal_Device.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_220_Right_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_220_Left_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_210_Right_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_210_Left_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Cuts_Per_Region/Simu/v1/CTPPS_Cuts_Per_Region.xml', 'Geometry/VeryForwardData/data/RP_Sensitive_Dets.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Transformations.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Parameters.xml', @@ -341,21 +339,22 @@ 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment3.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment4.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment5.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane3.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane4.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Detector_Assembly/2021/v1/CTPPS_Diamond_Detector_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane1.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane2.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane4.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Detector_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/Simu/v1/CTPPS_Detectors_Assembly_022.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/Simu/v1/CTPPS_Detectors_Assembly_122.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Sensitive_Dets_TimingHits.xml', - 'Geometry/VeryForwardData/data/ppstrackerMaterials/v2/ppstrackerMaterials.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module/v3/CTPPS_Pixel_Module.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module_2x2/v3/CTPPS_Pixel_Module_2x2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_003.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_023.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_103.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_123.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Sens.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/RP_Dist_Beam_Cent.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/ppstrackerMaterials.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/PPS_Pixel_Module_2x2_Run3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/PPS_Pixel_Sens.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_003.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_023.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_103.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_123.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/RP_Dist_Beam_Cent/Simu/v1/RP_Dist_Beam_Cent.xml', 'Geometry/EcalSimData/data/ecalsens.xml', 'Geometry/HcalCommonData/data/hcalsens/2021/v1/hcalsenspmf.xml', 'Geometry/HcalSimData/data/hf.xml', diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus10PercentXML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus10PercentXML_cfi.py index 5c39d8884d31f..234a5c798fa82 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus10PercentXML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus10PercentXML_cfi.py @@ -302,7 +302,6 @@ 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_005.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_020.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_021.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_022.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_024.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_025.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_100.xml', @@ -312,18 +311,17 @@ 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_105.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_120.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_121.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_122.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_124.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_125.xml', 'Geometry/VeryForwardData/data/RP_Device.xml', - 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/v1/RP_Vertical_Device.xml', - 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/v1/RP_Horizontal_Device.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Right_Station/v2/CTPPS_220_Right_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Left_Station/v2/CTPPS_220_Left_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Right_Station/v2/CTPPS_210_Right_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Left_Station/v2/CTPPS_210_Left_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_Stations_Assembly.xml', - 'Geometry/VeryForwardData/data/CTPPS_Cuts_Per_Region.xml', + 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/Simu/v1/RP_Vertical_Device.xml', + 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/Simu/v1/RP_Horizontal_Device.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_220_Right_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_220_Left_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_210_Right_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_210_Left_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Cuts_Per_Region/Simu/v1/CTPPS_Cuts_Per_Region.xml', 'Geometry/VeryForwardData/data/RP_Sensitive_Dets.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Transformations.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Parameters.xml', @@ -341,21 +339,22 @@ 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment3.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment4.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment5.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane3.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane4.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Detector_Assembly/2021/v1/CTPPS_Diamond_Detector_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane1.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane2.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane4.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Detector_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/Simu/v1/CTPPS_Detectors_Assembly_022.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/Simu/v1/CTPPS_Detectors_Assembly_122.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Sensitive_Dets_TimingHits.xml', - 'Geometry/VeryForwardData/data/ppstrackerMaterials/v2/ppstrackerMaterials.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module/v3/CTPPS_Pixel_Module.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module_2x2/v3/CTPPS_Pixel_Module_2x2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_003.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_023.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_103.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_123.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Sens.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/RP_Dist_Beam_Cent.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/ppstrackerMaterials.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/PPS_Pixel_Module_2x2_Run3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/PPS_Pixel_Sens.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_003.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_023.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_103.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_123.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/RP_Dist_Beam_Cent/Simu/v1/RP_Dist_Beam_Cent.xml', 'Geometry/EcalSimData/data/ecalsens.xml', 'Geometry/HcalCommonData/data/hcalsens/2021/v1/hcalsenspmf.xml', 'Geometry/HcalSimData/data/hf.xml', diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021XML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021XML_cfi.py index f9b563cc5be65..0f9eded3f30b4 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021XML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021XML_cfi.py @@ -302,7 +302,6 @@ 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_005.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_020.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_021.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_022.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_024.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_025.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_100.xml', @@ -312,18 +311,17 @@ 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_105.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_120.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_121.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_122.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_124.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_125.xml', 'Geometry/VeryForwardData/data/RP_Device.xml', - 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/v1/RP_Vertical_Device.xml', - 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/v1/RP_Horizontal_Device.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Right_Station/v2/CTPPS_220_Right_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Left_Station/v2/CTPPS_220_Left_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Right_Station/v2/CTPPS_210_Right_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Left_Station/v2/CTPPS_210_Left_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_Stations_Assembly.xml', - 'Geometry/VeryForwardData/data/CTPPS_Cuts_Per_Region.xml', + 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/Simu/v1/RP_Vertical_Device.xml', + 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/Simu/v1/RP_Horizontal_Device.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_220_Right_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_220_Left_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_210_Right_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_210_Left_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Cuts_Per_Region/Simu/v1/CTPPS_Cuts_Per_Region.xml', 'Geometry/VeryForwardData/data/RP_Sensitive_Dets.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Transformations.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Parameters.xml', @@ -341,21 +339,22 @@ 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment3.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment4.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment5.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane3.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane4.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Detector_Assembly/2021/v1/CTPPS_Diamond_Detector_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane1.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane2.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane4.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Detector_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/Simu/v1/CTPPS_Detectors_Assembly_022.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/Simu/v1/CTPPS_Detectors_Assembly_122.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Sensitive_Dets_TimingHits.xml', - 'Geometry/VeryForwardData/data/ppstrackerMaterials/v2/ppstrackerMaterials.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module/v3/CTPPS_Pixel_Module.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module_2x2/v3/CTPPS_Pixel_Module_2x2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_003.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_023.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_103.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_123.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Sens.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/RP_Dist_Beam_Cent.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/ppstrackerMaterials.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/PPS_Pixel_Module_2x2_Run3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/PPS_Pixel_Sens.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_003.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_023.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_103.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_123.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/RP_Dist_Beam_Cent/Simu/v1/RP_Dist_Beam_Cent.xml', 'Geometry/EcalSimData/data/ecalsens.xml', 'Geometry/HcalCommonData/data/hcalsens/2021/v1/hcalsenspmf.xml', 'Geometry/HcalSimData/data/hf.xml', diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021ZeroMaterialXML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021ZeroMaterialXML_cfi.py index fa1db67bae0d7..7c99d1bb6c6e5 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021ZeroMaterialXML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021ZeroMaterialXML_cfi.py @@ -302,7 +302,6 @@ 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_005.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_020.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_021.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_022.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_024.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_025.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_100.xml', @@ -312,18 +311,17 @@ 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_105.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_120.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_121.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_122.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_124.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_125.xml', 'Geometry/VeryForwardData/data/RP_Device.xml', - 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/v1/RP_Vertical_Device.xml', - 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/v1/RP_Horizontal_Device.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Right_Station/v2/CTPPS_220_Right_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Left_Station/v2/CTPPS_220_Left_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Right_Station/v2/CTPPS_210_Right_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Left_Station/v2/CTPPS_210_Left_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_Stations_Assembly.xml', - 'Geometry/VeryForwardData/data/CTPPS_Cuts_Per_Region.xml', + 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/Simu/v1/RP_Vertical_Device.xml', + 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/Simu/v1/RP_Horizontal_Device.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_220_Right_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_220_Left_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_210_Right_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_210_Left_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Cuts_Per_Region/Simu/v1/CTPPS_Cuts_Per_Region.xml', 'Geometry/VeryForwardData/data/RP_Sensitive_Dets.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Transformations.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Parameters.xml', @@ -341,21 +339,22 @@ 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment3.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment4.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment5.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane3.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane4.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Detector_Assembly/2021/v1/CTPPS_Diamond_Detector_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane1.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane2.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane4.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Detector_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/Simu/v1/CTPPS_Detectors_Assembly_022.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/Simu/v1/CTPPS_Detectors_Assembly_122.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Sensitive_Dets_TimingHits.xml', - 'Geometry/VeryForwardData/data/ppstrackerMaterials/v2/ppstrackerMaterials.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module/v3/CTPPS_Pixel_Module.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module_2x2/v3/CTPPS_Pixel_Module_2x2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_003.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_023.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_103.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_123.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Sens.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/RP_Dist_Beam_Cent.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/ppstrackerMaterials.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/PPS_Pixel_Module_2x2_Run3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/PPS_Pixel_Sens.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_003.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_023.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_103.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_123.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/RP_Dist_Beam_Cent/Simu/v1/RP_Dist_Beam_Cent.xml', 'Geometry/EcalSimData/data/ecalsens.xml', 'Geometry/HcalCommonData/data/hcalsens/2021/v1/hcalsenspmf.xml', 'Geometry/HcalSimData/data/hf.xml', diff --git a/Geometry/CSCGeometry/src/CSCWireGrouping.h b/Geometry/CSCGeometry/interface/CSCWireGrouping.h similarity index 100% rename from Geometry/CSCGeometry/src/CSCWireGrouping.h rename to Geometry/CSCGeometry/interface/CSCWireGrouping.h diff --git a/Geometry/CSCGeometry/interface/CSCWireTopology.h b/Geometry/CSCGeometry/interface/CSCWireTopology.h index afcb2d7b94807..14dc2c4cd5774 100644 --- a/Geometry/CSCGeometry/interface/CSCWireTopology.h +++ b/Geometry/CSCGeometry/interface/CSCWireTopology.h @@ -11,7 +11,7 @@ #include "Geometry/CSCGeometry/interface/WireTopology.h" #include "Geometry/CSCGeometry/interface/CSCWireGeometry.h" -#include "Geometry/CSCGeometry/src/CSCWireGrouping.h" +#include "Geometry/CSCGeometry/interface/CSCWireGrouping.h" #include "Geometry/CSCGeometry/interface/CSCWireGroupPackage.h" #include // for std::pair diff --git a/Geometry/CSCGeometry/src/CSCGangedWireGrouping.h b/Geometry/CSCGeometry/src/CSCGangedWireGrouping.h index c8bb22942a563..c81693675529f 100644 --- a/Geometry/CSCGeometry/src/CSCGangedWireGrouping.h +++ b/Geometry/CSCGeometry/src/CSCGangedWireGrouping.h @@ -12,7 +12,7 @@ * */ -#include "Geometry/CSCGeometry/src/CSCWireGrouping.h" +#include "Geometry/CSCGeometry/interface/CSCWireGrouping.h" #include class CSCGangedWireGrouping : public CSCWireGrouping { diff --git a/Geometry/CSCGeometry/src/CSCUngangedWireGrouping.h b/Geometry/CSCGeometry/src/CSCUngangedWireGrouping.h index d278e4cb8d1d9..c75ee94dcb020 100644 --- a/Geometry/CSCGeometry/src/CSCUngangedWireGrouping.h +++ b/Geometry/CSCGeometry/src/CSCUngangedWireGrouping.h @@ -8,13 +8,12 @@ * */ -#include "Geometry/CSCGeometry/src/CSCWireGrouping.h" +#include "Geometry/CSCGeometry/interface/CSCWireGrouping.h" class CSCUngangedWireGrouping : public CSCWireGrouping { - public: +public: virtual ~CSCUngangedWireGrouping() {} - explicit CSCUngangedWireGrouping( int nwires ) : - theNumberOfWires( nwires ) {} + explicit CSCUngangedWireGrouping(int nwires) : theNumberOfWires(nwires) {} /** * Total number of (virtual) wires. @@ -22,26 +21,22 @@ class CSCUngangedWireGrouping : public CSCWireGrouping { * This is the number which would fill the region covered * by wires, assuming the constant wire spacing. */ - int numberOfWires() const { - return theNumberOfWires; } + int numberOfWires() const { return theNumberOfWires; } /** * How many wire groups. Unganged so #groups = #wires. */ - int numberOfWireGroups() const { - return numberOfWires(); } + int numberOfWireGroups() const { return numberOfWires(); } /** * How many wires in a wiregroup. Unganged so 1 wire/group. */ - int numberOfWiresPerGroup( int wireGroup ) const { - return 1; } + int numberOfWiresPerGroup(int wireGroup) const { return 1; } /** * Wire group containing a given wire. Unganged means wire group is wire. */ - int wireGroup(int wire) const { - return wire; } + int wireGroup(int wire) const { return wire; } /** * Middle of wire-group. @@ -50,20 +45,16 @@ class CSCUngangedWireGrouping : public CSCWireGrouping { * Accordingly, it is non-integer. * Unganged, wire group is wire is middle! */ - float middleWireOfGroup( int wireGroup ) const { - return static_cast( wireGroup ); } + float middleWireOfGroup(int wireGroup) const { return static_cast(wireGroup); } - /** + /** * Clone to handle correct copy of component objects referenced * by base class pointer. */ - CSCWireGrouping* clone() const { - return new CSCUngangedWireGrouping(*this); - } + CSCWireGrouping* clone() const { return new CSCUngangedWireGrouping(*this); } - private: +private: int theNumberOfWires; - }; #endif diff --git a/Geometry/MuonNumbering/src/LevelBaseNumber.h b/Geometry/MuonNumbering/interface/LevelBaseNumber.h similarity index 100% rename from Geometry/MuonNumbering/src/LevelBaseNumber.h rename to Geometry/MuonNumbering/interface/LevelBaseNumber.h diff --git a/Geometry/MuonNumbering/interface/MuonBaseNumber.h b/Geometry/MuonNumbering/interface/MuonBaseNumber.h index d9378f4028aa0..d248297befc33 100644 --- a/Geometry/MuonNumbering/interface/MuonBaseNumber.h +++ b/Geometry/MuonNumbering/interface/MuonBaseNumber.h @@ -16,7 +16,7 @@ #include -#include "Geometry/MuonNumbering/src/LevelBaseNumber.h" +#include "Geometry/MuonNumbering/interface/LevelBaseNumber.h" class MuonBaseNumber { public: diff --git a/Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_210_Left_Station.xml b/Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_210_Left_Station.xml new file mode 100644 index 0000000000000..a0d910ecf39a1 --- /dev/null +++ b/Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_210_Left_Station.xml @@ -0,0 +1,235 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_210_Right_Station.xml b/Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_210_Right_Station.xml new file mode 100644 index 0000000000000..80adbd70bbfbb --- /dev/null +++ b/Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_210_Right_Station.xml @@ -0,0 +1,236 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_220_Left_Station.xml b/Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_220_Left_Station.xml new file mode 100644 index 0000000000000..a0bf4a7c1cdc0 --- /dev/null +++ b/Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_220_Left_Station.xml @@ -0,0 +1,212 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_220_Right_Station.xml b/Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_220_Right_Station.xml new file mode 100644 index 0000000000000..e992c23e05597 --- /dev/null +++ b/Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_220_Right_Station.xml @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_Stations_Assembly.xml b/Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_Stations_Assembly.xml new file mode 100644 index 0000000000000..34207037b52e8 --- /dev/null +++ b/Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_Stations_Assembly.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Detector_Assembly/v1/CTPPS_Diamond_Detector_Assembly.xml b/Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Detector_Assembly/v1/CTPPS_Diamond_Detector_Assembly.xml new file mode 100644 index 0000000000000..57c1e8cc2ce62 --- /dev/null +++ b/Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Detector_Assembly/v1/CTPPS_Diamond_Detector_Assembly.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v2/PPS_Pixel_Module_2x2_Run3.xml b/Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v2/PPS_Pixel_Module_2x2_Run3.xml new file mode 100644 index 0000000000000..72c145d61279d --- /dev/null +++ b/Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v2/PPS_Pixel_Module_2x2_Run3.xml @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v2/PPS_Pixel_Sens.xml b/Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v2/PPS_Pixel_Sens.xml new file mode 100644 index 0000000000000..1a436505ecbf5 --- /dev/null +++ b/Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v2/PPS_Pixel_Sens.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v2/ppstrackerMaterials.xml b/Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v2/ppstrackerMaterials.xml new file mode 100644 index 0000000000000..0c9dd4040863e --- /dev/null +++ b/Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v2/ppstrackerMaterials.xml @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot/v2/CTPPS_Timing_Horizontal_Pot.xml b/Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot/v2/CTPPS_Timing_Horizontal_Pot.xml new file mode 100644 index 0000000000000..24197a4fb693d --- /dev/null +++ b/Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot/v2/CTPPS_Timing_Horizontal_Pot.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_000.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_000.xml new file mode 100644 index 0000000000000..5bcd35e2b16de --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_000.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_001.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_001.xml new file mode 100644 index 0000000000000..922f9546f7a46 --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_001.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_002.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_002.xml new file mode 100644 index 0000000000000..5b0d05b9b9b14 --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_002.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_003.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_003.xml new file mode 100644 index 0000000000000..528bb7df417e3 --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_003.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_004.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_004.xml new file mode 100644 index 0000000000000..8708f0eb22e6d --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_004.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_005.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_005.xml new file mode 100644 index 0000000000000..638a91e558093 --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_005.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_020.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_020.xml new file mode 100644 index 0000000000000..c26c071ac5ac6 --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_020.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_021.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_021.xml new file mode 100644 index 0000000000000..1f486ccff623c --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_021.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_022.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_022.xml new file mode 100644 index 0000000000000..e973fb3ef6278 --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_022.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_023.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_023.xml new file mode 100644 index 0000000000000..53ceeca6ad6ab --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_023.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_024.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_024.xml new file mode 100644 index 0000000000000..8324260559a2f --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_024.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_025.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_025.xml new file mode 100644 index 0000000000000..2dabbe3c312a6 --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_025.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_100.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_100.xml new file mode 100644 index 0000000000000..f2ec002a15db8 --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_100.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_101.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_101.xml new file mode 100644 index 0000000000000..b64dbb963cf55 --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_101.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_102.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_102.xml new file mode 100644 index 0000000000000..171a07adf6abe --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_102.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_103.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_103.xml new file mode 100644 index 0000000000000..16a38c07d5e98 --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_103.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_104.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_104.xml new file mode 100644 index 0000000000000..aa75a3daa5eb7 --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_104.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_105.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_105.xml new file mode 100644 index 0000000000000..4d63d087fca13 --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_105.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_120.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_120.xml new file mode 100644 index 0000000000000..dd52721773222 --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_120.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_121.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_121.xml new file mode 100644 index 0000000000000..ee927f28d403e --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_121.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_122.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_122.xml new file mode 100644 index 0000000000000..946efff9a7c90 --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_122.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_123.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_123.xml new file mode 100644 index 0000000000000..b95c047735bca --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_123.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_124.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_124.xml new file mode 100644 index 0000000000000..28dee2d17d58f --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_124.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_125.xml b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_125.xml new file mode 100644 index 0000000000000..e0c1467056557 --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_125.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Device/v1/RP_Device.xml b/Geometry/VeryForwardData/data/RP_Device/v1/RP_Device.xml new file mode 100644 index 0000000000000..651ef664d212e --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Device/v1/RP_Device.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/Simu/v2/RP_Horizontal_Device.xml b/Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/Simu/v2/RP_Horizontal_Device.xml new file mode 100644 index 0000000000000..ce5bed66a2c05 --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/Simu/v2/RP_Horizontal_Device.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Hybrid/v2/RP_Hybrid.xml b/Geometry/VeryForwardData/data/RP_Hybrid/v2/RP_Hybrid.xml new file mode 100644 index 0000000000000..883acca8cabe7 --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Hybrid/v2/RP_Hybrid.xml @@ -0,0 +1,240 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Materials/v4/RP_Materials.xml b/Geometry/VeryForwardData/data/RP_Materials/v4/RP_Materials.xml new file mode 100644 index 0000000000000..cd1b82ce82e55 --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Materials/v4/RP_Materials.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Vertical_Device/2021/Simu/v2/RP_Vertical_Device.xml b/Geometry/VeryForwardData/data/RP_Vertical_Device/2021/Simu/v2/RP_Vertical_Device.xml new file mode 100644 index 0000000000000..34b2af92ff314 --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Vertical_Device/2021/Simu/v2/RP_Vertical_Device.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/dd4hep/cmsExtendedGeometry2021.xml b/Geometry/VeryForwardData/data/dd4hep/cmsExtendedGeometry2021.xml new file mode 100644 index 0000000000000..7e43b537e9595 --- /dev/null +++ b/Geometry/VeryForwardData/data/dd4hep/cmsExtendedGeometry2021.xml @@ -0,0 +1,377 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/python/cmsExtendedGeometry2021XML_cfi.py b/Geometry/VeryForwardData/python/cmsExtendedGeometry2021XML_cfi.py new file mode 100644 index 0000000000000..09e627234f5d7 --- /dev/null +++ b/Geometry/VeryForwardData/python/cmsExtendedGeometry2021XML_cfi.py @@ -0,0 +1,381 @@ +import FWCore.ParameterSet.Config as cms + +# This config was generated automatically using generate2021Geometry.py +# If you notice a mistake, please update the generating script, not just this config + +XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", + geomXMLFiles = cms.vstring( + 'Geometry/CMSCommonData/data/materials/2021/v3/materials.xml', + 'Geometry/TrackerCommonData/data/trackermaterial/2021/v1/trackermaterial.xml', + 'Geometry/CMSCommonData/data/rotations.xml', + 'Geometry/CMSCommonData/data/extend/v3/cmsextent.xml', + 'Geometry/CMSCommonData/data/cavernData/2021/v1/cavernData.xml', + 'Geometry/CMSCommonData/data/cms/2021/v3/cms.xml', + 'Geometry/CMSCommonData/data/cmsMother.xml', + 'Geometry/CMSCommonData/data/eta3/etaMax.xml', + 'Geometry/CMSCommonData/data/cmsTracker.xml', + 'Geometry/CMSCommonData/data/caloBase/2017/v1/caloBase.xml', + 'Geometry/CMSCommonData/data/cmsCalo.xml', + 'Geometry/CMSCommonData/data/muonBase/2018/v1/muonBase.xml', + 'Geometry/CMSCommonData/data/cmsMuon.xml', + 'Geometry/CMSCommonData/data/mgnt.xml', + 'Geometry/CMSCommonData/data/beampipe/2021/v1/beampipe.xml', + 'Geometry/CMSCommonData/data/cmsBeam/2021/v1/cmsBeam.xml', + 'Geometry/CMSCommonData/data/muonMB.xml', + 'Geometry/CMSCommonData/data/muonMagnet.xml', + 'Geometry/CMSCommonData/data/cavern/2021/v1/cavern.xml', + 'Geometry/CMSCommonData/data/cavernFloor/2017/v1/cavernFloor.xml', + 'Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml', + 'Geometry/TrackerCommonData/data/pixfwdMaterials/2021/v3/pixfwdMaterials.xml', + 'Geometry/TrackerCommonData/data/pixfwdCommon.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixfwdCylinder.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixfwdDisks.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixfwd.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixfwdSupportRingParameters.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixfwdInnerDiskZplus.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixfwdInnerDiskZminus.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixfwdOuterDiskZplus.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixfwdOuterDiskZminus.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixfwdbladeInnerZplus.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixfwdbladeInnerZminus.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixfwdbladeOuterZplus.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixfwdbladeOuterZminus.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarmaterial.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarladder.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarladderfull0.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarladderfull1.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarladderfull2.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarladderfull3.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarlayer.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarlayer0.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarlayer1.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarlayer2.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarlayer3.xml', + 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbar.xml', + 'Geometry/TrackerCommonData/data/Run2/trackerpatchpannel.xml', + 'Geometry/TrackerCommonData/data/Run2/trackerpixelnose.xml', + 'Geometry/TrackerCommonData/data/tibtidcommonmaterial/2021/v1/tibtidcommonmaterial.xml', + 'Geometry/TrackerCommonData/data/tibmaterial/2021/v1/tibmaterial.xml', + 'Geometry/TrackerCommonData/data/tibmodpar.xml', + 'Geometry/TrackerCommonData/data/tibmodule0.xml', + 'Geometry/TrackerCommonData/data/tibmodule0a.xml', + 'Geometry/TrackerCommonData/data/tibmodule0b.xml', + 'Geometry/TrackerCommonData/data/tibmodule2.xml', + 'Geometry/TrackerCommonData/data/tibstringpar.xml', + 'Geometry/TrackerCommonData/data/tibstring0ll.xml', + 'Geometry/TrackerCommonData/data/tibstring0lr.xml', + 'Geometry/TrackerCommonData/data/tibstring0ul.xml', + 'Geometry/TrackerCommonData/data/tibstring0ur.xml', + 'Geometry/TrackerCommonData/data/tibstring0.xml', + 'Geometry/TrackerCommonData/data/tibstring1ll.xml', + 'Geometry/TrackerCommonData/data/tibstring1lr.xml', + 'Geometry/TrackerCommonData/data/tibstring1ul.xml', + 'Geometry/TrackerCommonData/data/tibstring1ur.xml', + 'Geometry/TrackerCommonData/data/tibstring1.xml', + 'Geometry/TrackerCommonData/data/tibstring2ll.xml', + 'Geometry/TrackerCommonData/data/tibstring2lr.xml', + 'Geometry/TrackerCommonData/data/tibstring2ul.xml', + 'Geometry/TrackerCommonData/data/tibstring2ur.xml', + 'Geometry/TrackerCommonData/data/tibstring2.xml', + 'Geometry/TrackerCommonData/data/tibstring3ll.xml', + 'Geometry/TrackerCommonData/data/tibstring3lr.xml', + 'Geometry/TrackerCommonData/data/tibstring3ul.xml', + 'Geometry/TrackerCommonData/data/tibstring3ur.xml', + 'Geometry/TrackerCommonData/data/tibstring3.xml', + 'Geometry/TrackerCommonData/data/tiblayerpar.xml', + 'Geometry/TrackerCommonData/data/tiblayer0.xml', + 'Geometry/TrackerCommonData/data/tiblayer1.xml', + 'Geometry/TrackerCommonData/data/tiblayer2.xml', + 'Geometry/TrackerCommonData/data/tiblayer3.xml', + 'Geometry/TrackerCommonData/data/tib.xml', + 'Geometry/TrackerCommonData/data/tidmaterial/2021/v1/tidmaterial.xml', + 'Geometry/TrackerCommonData/data/tidmodpar.xml', + 'Geometry/TrackerCommonData/data/tidmodule0.xml', + 'Geometry/TrackerCommonData/data/tidmodule0r.xml', + 'Geometry/TrackerCommonData/data/tidmodule0l.xml', + 'Geometry/TrackerCommonData/data/tidmodule1.xml', + 'Geometry/TrackerCommonData/data/tidmodule1r.xml', + 'Geometry/TrackerCommonData/data/tidmodule1l.xml', + 'Geometry/TrackerCommonData/data/tidmodule2.xml', + 'Geometry/TrackerCommonData/data/tidringpar.xml', + 'Geometry/TrackerCommonData/data/tidring0.xml', + 'Geometry/TrackerCommonData/data/tidring0f.xml', + 'Geometry/TrackerCommonData/data/tidring0b.xml', + 'Geometry/TrackerCommonData/data/tidring1.xml', + 'Geometry/TrackerCommonData/data/tidring1f.xml', + 'Geometry/TrackerCommonData/data/tidring1b.xml', + 'Geometry/TrackerCommonData/data/tidring2.xml', + 'Geometry/TrackerCommonData/data/tid.xml', + 'Geometry/TrackerCommonData/data/tidf.xml', + 'Geometry/TrackerCommonData/data/tidb.xml', + 'Geometry/TrackerCommonData/data/tibtidservices.xml', + 'Geometry/TrackerCommonData/data/tibtidservicesf.xml', + 'Geometry/TrackerCommonData/data/tibtidservicesb.xml', + 'Geometry/TrackerCommonData/data/tobmaterial/2021/v1/tobmaterial.xml', + 'Geometry/TrackerCommonData/data/tobmodpar.xml', + 'Geometry/TrackerCommonData/data/tobmodule0.xml', + 'Geometry/TrackerCommonData/data/tobmodule2.xml', + 'Geometry/TrackerCommonData/data/tobmodule4.xml', + 'Geometry/TrackerCommonData/data/tobrodpar.xml', + 'Geometry/TrackerCommonData/data/tobrod0c.xml', + 'Geometry/TrackerCommonData/data/tobrod0l.xml', + 'Geometry/TrackerCommonData/data/tobrod0h.xml', + 'Geometry/TrackerCommonData/data/tobrod0.xml', + 'Geometry/TrackerCommonData/data/tobrod1l.xml', + 'Geometry/TrackerCommonData/data/tobrod1h.xml', + 'Geometry/TrackerCommonData/data/tobrod1.xml', + 'Geometry/TrackerCommonData/data/tobrod2c.xml', + 'Geometry/TrackerCommonData/data/tobrod2l.xml', + 'Geometry/TrackerCommonData/data/tobrod2h.xml', + 'Geometry/TrackerCommonData/data/tobrod2.xml', + 'Geometry/TrackerCommonData/data/tobrod3l.xml', + 'Geometry/TrackerCommonData/data/tobrod3h.xml', + 'Geometry/TrackerCommonData/data/tobrod3.xml', + 'Geometry/TrackerCommonData/data/tobrod4c.xml', + 'Geometry/TrackerCommonData/data/tobrod4l.xml', + 'Geometry/TrackerCommonData/data/tobrod4h.xml', + 'Geometry/TrackerCommonData/data/tobrod4.xml', + 'Geometry/TrackerCommonData/data/tobrod5l.xml', + 'Geometry/TrackerCommonData/data/tobrod5h.xml', + 'Geometry/TrackerCommonData/data/tobrod5.xml', + 'Geometry/TrackerCommonData/data/tob/v3/tob.xml', + 'Geometry/TrackerCommonData/data/tecmaterial/2021/v1/tecmaterial.xml', + 'Geometry/TrackerCommonData/data/tecmodpar.xml', + 'Geometry/TrackerCommonData/data/tecmodule0.xml', + 'Geometry/TrackerCommonData/data/tecmodule0r.xml', + 'Geometry/TrackerCommonData/data/tecmodule0s.xml', + 'Geometry/TrackerCommonData/data/tecmodule1.xml', + 'Geometry/TrackerCommonData/data/tecmodule1r.xml', + 'Geometry/TrackerCommonData/data/tecmodule1s.xml', + 'Geometry/TrackerCommonData/data/tecmodule2.xml', + 'Geometry/TrackerCommonData/data/tecmodule3.xml', + 'Geometry/TrackerCommonData/data/tecmodule4.xml', + 'Geometry/TrackerCommonData/data/tecmodule4r.xml', + 'Geometry/TrackerCommonData/data/tecmodule4s.xml', + 'Geometry/TrackerCommonData/data/tecmodule5.xml', + 'Geometry/TrackerCommonData/data/tecmodule6.xml', + 'Geometry/TrackerCommonData/data/tecpetpar.xml', + 'Geometry/TrackerCommonData/data/tecring0.xml', + 'Geometry/TrackerCommonData/data/tecring1.xml', + 'Geometry/TrackerCommonData/data/tecring2.xml', + 'Geometry/TrackerCommonData/data/tecring3.xml', + 'Geometry/TrackerCommonData/data/tecring4.xml', + 'Geometry/TrackerCommonData/data/tecring5.xml', + 'Geometry/TrackerCommonData/data/tecring6.xml', + 'Geometry/TrackerCommonData/data/tecring0f.xml', + 'Geometry/TrackerCommonData/data/tecring1f.xml', + 'Geometry/TrackerCommonData/data/tecring2f.xml', + 'Geometry/TrackerCommonData/data/tecring3f.xml', + 'Geometry/TrackerCommonData/data/tecring4f.xml', + 'Geometry/TrackerCommonData/data/tecring5f.xml', + 'Geometry/TrackerCommonData/data/tecring6f.xml', + 'Geometry/TrackerCommonData/data/tecring0b.xml', + 'Geometry/TrackerCommonData/data/tecring1b.xml', + 'Geometry/TrackerCommonData/data/tecring2b.xml', + 'Geometry/TrackerCommonData/data/tecring3b.xml', + 'Geometry/TrackerCommonData/data/tecring4b.xml', + 'Geometry/TrackerCommonData/data/tecring5b.xml', + 'Geometry/TrackerCommonData/data/tecring6b.xml', + 'Geometry/TrackerCommonData/data/tecpetalf.xml', + 'Geometry/TrackerCommonData/data/tecpetalb.xml', + 'Geometry/TrackerCommonData/data/tecpetal0.xml', + 'Geometry/TrackerCommonData/data/tecpetal0f.xml', + 'Geometry/TrackerCommonData/data/tecpetal0b.xml', + 'Geometry/TrackerCommonData/data/tecpetal3.xml', + 'Geometry/TrackerCommonData/data/tecpetal3f.xml', + 'Geometry/TrackerCommonData/data/tecpetal3b.xml', + 'Geometry/TrackerCommonData/data/tecpetal6f.xml', + 'Geometry/TrackerCommonData/data/tecpetal6b.xml', + 'Geometry/TrackerCommonData/data/tecpetal8f.xml', + 'Geometry/TrackerCommonData/data/tecpetal8b.xml', + 'Geometry/TrackerCommonData/data/tecwheel/2021/v1/tecwheel.xml', + 'Geometry/TrackerCommonData/data/tecwheela.xml', + 'Geometry/TrackerCommonData/data/tecwheelb.xml', + 'Geometry/TrackerCommonData/data/tecwheelc.xml', + 'Geometry/TrackerCommonData/data/tecwheeld.xml', + 'Geometry/TrackerCommonData/data/tecwheel6.xml', + 'Geometry/TrackerCommonData/data/tecservices.xml', + 'Geometry/TrackerCommonData/data/tecbackplate.xml', + 'Geometry/TrackerCommonData/data/tec.xml', + 'Geometry/TrackerCommonData/data/Run2/tracker.xml', + 'Geometry/TrackerCommonData/data/trackerpixbar.xml', + 'Geometry/TrackerCommonData/data/PhaseI/trackerpixfwd.xml', + 'Geometry/TrackerCommonData/data/trackertibtidservices.xml', + 'Geometry/TrackerCommonData/data/trackertib.xml', + 'Geometry/TrackerCommonData/data/trackertid.xml', + 'Geometry/TrackerCommonData/data/trackertob.xml', + 'Geometry/TrackerCommonData/data/trackertec.xml', + 'Geometry/TrackerCommonData/data/v2/trackerbulkhead.xml', + 'Geometry/TrackerCommonData/data/trackerother.xml', + 'Geometry/TrackerCommonData/data/PhaseI/trackerStructureTopology.xml', + 'Geometry/TrackerSimData/data/PhaseI/trackersens.xml', + 'Geometry/TrackerRecoData/data/PhaseI/v1/trackerRecoMaterial.xml', + 'SimTracker/TrackerMaterialAnalysis/data/trackingMaterialGroups_ForPhaseI/v1/trackingMaterialGroups_ForPhaseI.xml', + 'Geometry/TrackerSimData/data/PhaseI/trackerProdCuts.xml', + 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', + 'Geometry/EcalCommonData/data/ebcon/2021/v1/ebcon.xml', + 'Geometry/EcalCommonData/data/eecon.xml', + 'Geometry/EcalCommonData/data/escon.xml', + 'Geometry/EcalCommonData/data/eregalgo/2017/v1/eregalgo.xml', + 'Geometry/EcalCommonData/data/ebalgo.xml', + 'Geometry/EcalCommonData/data/ebrot.xml', + 'Geometry/EcalCommonData/data/eefixed/2021/v1/eefixed.xml', + 'Geometry/EcalCommonData/data/eehier.xml', + 'Geometry/EcalCommonData/data/eealgo.xml', + 'Geometry/EcalCommonData/data/esalgo.xml', + 'Geometry/EcalCommonData/data/eeF.xml', + 'Geometry/EcalCommonData/data/eeB.xml', + 'Geometry/EcalCommonData/data/ectkcable.xml', + 'Geometry/HcalCommonData/data/hcalrotations.xml', + 'Geometry/HcalCommonData/data/hcal/PhaseI/hcalalgo.xml', + 'Geometry/HcalCommonData/data/hcalcablealgo.xml', + 'Geometry/HcalCommonData/data/hcalbarrelalgo.xml', + 'Geometry/HcalCommonData/data/hcalendcap/PhaseI/hcalendcapalgo.xml', + 'Geometry/HcalCommonData/data/hcalouteralgo/v1/hcalouteralgo.xml', + 'Geometry/HcalCommonData/data/hcalforwardalgo.xml', + 'Geometry/HcalCommonData/data/average/hcalforwardmaterial.xml', + 'Geometry/HcalCommonData/data/hcalSimNumbering/2021/v1/hcalSimNumbering.xml', + 'Geometry/HcalCommonData/data/hcalRecNumbering/2021/hcalRecNumbering.xml', + 'Geometry/MuonCommonData/data/mbCommon/2021/v2/mbCommon.xml', + 'Geometry/MuonCommonData/data/mb1/2021/v1/mb1.xml', + 'Geometry/MuonCommonData/data/mb2/2021/v1/mb2.xml', + 'Geometry/MuonCommonData/data/mb3/2021/v1/mb3.xml', + 'Geometry/MuonCommonData/data/mb4/2015/v2/mb4.xml', + 'Geometry/MuonCommonData/data/mb4Shield/2021/v1/mb4Shield.xml', + 'Geometry/MuonCommonData/data/muonYoke/2021/v5/muonYoke.xml', + 'Geometry/MuonCommonData/data/mf/2021/v2/mf.xml', + 'Geometry/MuonCommonData/data/rpcf/2015/v1/rpcf.xml', + 'Geometry/MuonCommonData/data/gemf/TDR_BaseLine/gemf.xml', + 'Geometry/MuonCommonData/data/gem11/TDR_BaseLine/gem11.xml', + 'Geometry/MuonCommonData/data/csc/2021/v3/csc.xml', + 'Geometry/MuonCommonData/data/mfshield/2017/v2/mfshield.xml', + )+ + cms.vstring( + 'Geometry/MuonCommonData/data/muonNumbering/2021/v3/muonNumbering.xml', + 'Geometry/ForwardCommonData/data/forward/2021/v1/forward.xml', + 'Geometry/ForwardCommonData/data/totemt2/2021/v1/totemt2.xml', + 'Geometry/ForwardCommonData/data/forwardshield/2021/v1/forwardshield.xml', + 'Geometry/ForwardCommonData/data/brmrotations.xml', + 'Geometry/ForwardCommonData/data/brm/2021/v1/brm.xml', + 'Geometry/ForwardCommonData/data/zdcmaterials/2021/v1/zdcmaterials.xml', + 'Geometry/ForwardCommonData/data/lumimaterials.xml', + 'Geometry/ForwardCommonData/data/zdcrotations.xml', + 'Geometry/ForwardCommonData/data/lumirotations.xml', + 'Geometry/ForwardCommonData/data/zdc/2021/v1/zdc.xml', + 'Geometry/ForwardCommonData/data/zdclumi/2021/v2/zdclumi.xml', + 'Geometry/ForwardCommonData/data/cmszdc.xml', + 'Geometry/VeryForwardData/data/RP_Box.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_000.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_001.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_002.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_003.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_004.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_005.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_020.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_021.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_022.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_023.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_024.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_025.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_100.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_101.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_102.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_103.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_104.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_105.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_120.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_121.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_122.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_123.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_124.xml', + 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_125.xml', + 'Geometry/VeryForwardData/data/RP_Hybrid/v2/RP_Hybrid.xml', + 'Geometry/VeryForwardData/data/RP_Materials/v4/RP_Materials.xml', + 'Geometry/VeryForwardData/data/RP_Transformations.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_000.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_001.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_002.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_004.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_005.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_020.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_021.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_024.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_025.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_100.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_101.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_102.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_104.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_105.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_120.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_121.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_124.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_125.xml', + 'Geometry/VeryForwardData/data/RP_Device/v1/RP_Device.xml', + 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/Simu/v2/RP_Vertical_Device.xml', + 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/Simu/v2/RP_Horizontal_Device.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_220_Right_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_220_Left_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_210_Right_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_210_Left_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v3/CTPPS_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/Cuts_Per_Region/Simu/v1/CTPPS_Cuts_Per_Region.xml', + 'Geometry/VeryForwardData/data/RP_Sensitive_Dets.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Transformations.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Parameters.xml', + 'Geometry/VeryForwardData/data/CTPPS_Timing_Station_Parameters.xml', + 'Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot/v2/CTPPS_Timing_Horizontal_Pot.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern1_Segment1.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment1.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment2.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment1.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment2.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment4.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment1.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment2.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment4.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment5.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane1.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane2.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane4.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Detector_Assembly/v1/CTPPS_Diamond_Detector_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/Simu/v1/CTPPS_Detectors_Assembly_022.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/Simu/v1/CTPPS_Detectors_Assembly_122.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Sensitive_Dets_TimingHits.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v2/ppstrackerMaterials.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v2/PPS_Pixel_Module_2x2_Run3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v2/PPS_Pixel_Sens.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_003.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_023.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_103.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_123.xml', + 'Geometry/VeryForwardData/data/CTPPS_2021/RP_Dist_Beam_Cent/Simu/v1/RP_Dist_Beam_Cent.xml', + 'Geometry/EcalSimData/data/ecalsens.xml', + 'Geometry/HcalCommonData/data/hcalsens/2021/v1/hcalsenspmf.xml', + 'Geometry/HcalSimData/data/hf.xml', + 'Geometry/HcalSimData/data/hfpmt.xml', + 'Geometry/HcalSimData/data/hffibrebundle.xml', + 'Geometry/HcalSimData/data/CaloUtil/2021/v1/CaloUtil.xml', + 'Geometry/MuonSimData/data/v2/muonSens.xml', + 'Geometry/DTGeometryBuilder/data/dtSpecsFilter/2021/v1/dtSpecsFilter.xml', + 'Geometry/CSCGeometryBuilder/data/cscSpecsFilter.xml', + 'Geometry/CSCGeometryBuilder/data/cscSpecs.xml', + 'Geometry/RPCGeometryBuilder/data/RPCSpecs.xml', + 'Geometry/GEMGeometryBuilder/data/GEMSpecsFilter17.xml', + 'Geometry/GEMGeometryBuilder/data/v4/GEMSpecs.xml', + 'Geometry/ForwardCommonData/data/brmsens.xml', + 'Geometry/ForwardSimData/data/totemsensT2/2021/totemsensT2.xml', + 'Geometry/ForwardSimData/data/zdcsens.xml', + 'Geometry/HcalSimData/data/HcalProdCuts/2021/v2/HcalProdCuts.xml', + 'Geometry/EcalSimData/data/EcalProdCuts.xml', + 'Geometry/EcalSimData/data/ESProdCuts.xml', + 'Geometry/MuonSimData/data/muonProdCuts/2021/v1/muonProdCuts.xml', + 'Geometry/ForwardSimData/data/zdcProdCuts/2021/v2/zdcProdCuts.xml', + 'Geometry/ForwardSimData/data/ForwardShieldProdCuts.xml', + 'Geometry/CMSCommonData/data/FieldParameters.xml', + ), + rootNodeName = cms.string('cms:OCMS') +) diff --git a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py index 104df35b34944..33f789a000eb3 100644 --- a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py +++ b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py @@ -17,6 +17,20 @@ # pset.minGoodStripCharge = cms.PSet(refToPSet_ = cms.string('HLTSiStripClusterChargeCutNone')) # return process +# New cards in DT local reco to control which format for DT DB is used +def customiseFor34612(process): + for producer in producers_by_type(process, "DTRecHitProducer"): + producer.recAlgoConfig.readLegacyTTrigDB = cms.bool(True) + producer.recAlgoConfig.readLegacyVDriftDB = cms.bool(True) + + for producer in producers_by_type(process, "DTRecSegment4DProducer"): + producer.Reco4DAlgoConfig.recAlgoConfig.readLegacyTTrigDB = cms.bool(True) + producer.Reco4DAlgoConfig.recAlgoConfig.readLegacyVDriftDB = cms.bool(True) + producer.Reco4DAlgoConfig.Reco2DAlgoConfig.recAlgoConfig.readLegacyTTrigDB = cms.bool(True) + producer.Reco4DAlgoConfig.Reco2DAlgoConfig.recAlgoConfig.readLegacyVDriftDB = cms.bool(True) + + return process + def customiseHCALFor2018Input(process): """Customise the HLT to run on Run 2 data/MC using the old readout for the HCAL barel""" @@ -136,4 +150,7 @@ def customizeHLTforCMSSW(process, menuType="GRun"): # add call to action function in proper order: newest last! # process = customiseFor12718(process) + # New cards for DT local reco + process = customiseFor34612(process) + return process diff --git a/HLTrigger/Configuration/python/customizeHLTforPatatrack.py b/HLTrigger/Configuration/python/customizeHLTforPatatrack.py new file mode 100644 index 0000000000000..218b95007672c --- /dev/null +++ b/HLTrigger/Configuration/python/customizeHLTforPatatrack.py @@ -0,0 +1,759 @@ +import copy +import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA +from HLTrigger.Configuration.common import * +from Configuration.Eras.Modifier_run3_common_cff import run3_common + + +# force the SwitchProducerCUDA choice to pick a specific backend: True for offloading to a gpu, False for running on cpu +def forceGpuOffload(status = True): + import HeterogeneousCore.CUDACore.SwitchProducerCUDA + HeterogeneousCore.CUDACore.SwitchProducerCUDA._cuda_enabled_cached = bool(status) + + +# reset the SwitchProducerCUDA choice to pick a backend depending on the availability of a supported gpu +def resetGpuOffload(): + import HeterogeneousCore.CUDACore.SwitchProducerCUDA + HeterogeneousCore.CUDACore.SwitchProducerCUDA._cuda_enabled_cached = None + HeterogeneousCore.CUDACore.SwitchProducerCUDA._switch_cuda() + + +# customisation for running the Patatrack reconstruction, common parts +def customiseCommon(process): + + # Services + + process.load("HeterogeneousCore.CUDAServices.CUDAService_cfi") + + # NVProfilerService is broken in CMSSW 12.0,x and later + #process.load("HeterogeneousCore.CUDAServices.NVProfilerService_cfi") + + + # Paths and EndPaths + + # the hltGetConditions module would force gpu-specific ESProducers to run even if no supported gpu is present + if 'hltGetConditions' in process.__dict__: + del process.hltGetConditions + + # produce a boolean to track if the events ar being processed on gpu (true) or cpu (false) + process.statusOnGPU = SwitchProducerCUDA( + cpu = cms.EDProducer("BooleanProducer", value = cms.bool(False)), + cuda = cms.EDProducer("BooleanProducer", value = cms.bool(True)) + ) + + process.statusOnGPUFilter = cms.EDFilter("BooleanFilter", + src = cms.InputTag("statusOnGPU") + ) + + if 'Status_OnCPU' in process.__dict__: + replace_with(process.Status_OnCPU, cms.Path(process.statusOnGPU + ~process.statusOnGPUFilter)) + else: + process.Status_OnCPU = cms.Path(process.statusOnGPU + ~process.statusOnGPUFilter) + if 'HLTSchedule' in process.__dict__: + process.HLTSchedule.append(process.Status_OnCPU) + if process.schedule is not None: + process.schedule.append(process.Status_OnCPU) + + if 'Status_OnGPU' in process.__dict__: + replace_with(process.Status_OnGPU, cms.Path(process.statusOnGPU + process.statusOnGPUFilter)) + else: + process.Status_OnGPU = cms.Path(process.statusOnGPU + process.statusOnGPUFilter) + if 'HLTSchedule' in process.__dict__: + process.HLTSchedule.append(process.Status_OnGPU) + if process.schedule is not None: + process.schedule.append(process.Status_OnGPU) + + + # make the ScoutingCaloMuonOutput endpath compatible with using Tasks in the Scouting paths + if 'hltOutputScoutingCaloMuon' in process.__dict__ and not 'hltPreScoutingCaloMuonOutputSmart' in process.__dict__: + process.hltPreScoutingCaloMuonOutputSmart = cms.EDFilter( "TriggerResultsFilter", + l1tIgnoreMaskAndPrescale = cms.bool( False ), + l1tResults = cms.InputTag( "" ), + hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), + triggerConditions = process.hltOutputScoutingCaloMuon.SelectEvents.SelectEvents, + throw = cms.bool( True ) + ) + insert_modules_after(process, process.hltPreScoutingCaloMuonOutput, process.hltPreScoutingCaloMuonOutputSmart) + + # make the ScoutingPFOutput endpath compatible with using Tasks in the Scouting paths + if 'hltOutputScoutingPF' in process.__dict__ and not 'hltPreScoutingPFOutputSmart' in process.__dict__: + process.hltPreScoutingPFOutputSmart = cms.EDFilter( "TriggerResultsFilter", + l1tIgnoreMaskAndPrescale = cms.bool( False ), + l1tResults = cms.InputTag( "" ), + hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), + triggerConditions = process.hltOutputScoutingPF.SelectEvents.SelectEvents, + throw = cms.bool( True ) + ) + insert_modules_after(process, process.hltPreScoutingPFOutput, process.hltPreScoutingPFOutputSmart) + + + # done + return process + + +# customisation for running the "Patatrack" pixel local reconstruction +def customisePixelLocalReconstruction(process): + + if not 'HLTDoLocalPixelSequence' in process.__dict__: + return process + + + # FIXME replace the Sequences with empty ones to avoid exanding them during the (re)definition of Modules and EDAliases + + process.HLTDoLocalPixelSequence = cms.Sequence() + + + # Event Setup + + process.load("CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTGPU_cfi") # this should be used only on GPUs, will crash otherwise + process.load("CalibTracker.SiPixelESProducers.siPixelROCsStatusAndMappingWrapperESProducer_cfi") # this should be used only on GPUs, will crash otherwise + process.load("RecoLocalTracker.SiPixelRecHits.PixelCPEFastESProducer_cfi") + + + # Modules and EDAliases + + # referenced in HLTDoLocalPixelTask + + # transfer the beamspot to the gpu + from RecoVertex.BeamSpotProducer.offlineBeamSpotToCUDA_cfi import offlineBeamSpotToCUDA as _offlineBeamSpotToCUDA + process.hltOnlineBeamSpotToCUDA = _offlineBeamSpotToCUDA.clone( + src = "hltOnlineBeamSpot" + ) + + # reconstruct the pixel digis and clusters on the gpu + from RecoLocalTracker.SiPixelClusterizer.siPixelRawToClusterCUDA_cfi import siPixelRawToClusterCUDA as _siPixelRawToClusterCUDA + process.hltSiPixelClustersCUDA = _siPixelRawToClusterCUDA.clone() + # use the pixel channel calibrations scheme for Run 3 + run3_common.toModify(process.hltSiPixelClustersCUDA, isRun2 = False) + + # copy the pixel digis errors to the host + from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsSoAFromCUDA_cfi import siPixelDigiErrorsSoAFromCUDA as _siPixelDigiErrorsSoAFromCUDA + process.hltSiPixelDigiErrorsSoA = _siPixelDigiErrorsSoAFromCUDA.clone( + src = "hltSiPixelClustersCUDA" + ) + + # convert the pixel digis errors to the legacy format + from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsFromSoA_cfi import siPixelDigiErrorsFromSoA as _siPixelDigiErrorsFromSoA + process.hltSiPixelDigiErrors = _siPixelDigiErrorsFromSoA.clone( + digiErrorSoASrc = "hltSiPixelDigiErrorsSoA", + UsePhase1 = True + ) + + # copy the pixel digis (except errors) and clusters to the host + from EventFilter.SiPixelRawToDigi.siPixelDigisSoAFromCUDA_cfi import siPixelDigisSoAFromCUDA as _siPixelDigisSoAFromCUDA + process.hltSiPixelDigisSoA = _siPixelDigisSoAFromCUDA.clone( + src = "hltSiPixelClustersCUDA" + ) + + # convert the pixel digis (except errors) and clusters to the legacy format + from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoA_cfi import siPixelDigisClustersFromSoA as _siPixelDigisClustersFromSoA + process.hltSiPixelDigisClusters = _siPixelDigisClustersFromSoA.clone( + src = "hltSiPixelDigisSoA" + ) + + # SwitchProducer wrapping the legacy pixel digis producer or an alias combining the pixel digis information converted from SoA + process.hltSiPixelDigis = SwitchProducerCUDA( + # legacy producer + cpu = process.hltSiPixelDigis, + # alias used to access products from multiple conversion modules + cuda = cms.EDAlias( + hltSiPixelDigisClusters = cms.VPSet( + cms.PSet(type = cms.string("PixelDigiedmDetSetVector")) + ), + hltSiPixelDigiErrors = cms.VPSet( + cms.PSet(type = cms.string("DetIdedmEDCollection")), + cms.PSet(type = cms.string("SiPixelRawDataErroredmDetSetVector")), + cms.PSet(type = cms.string("PixelFEDChanneledmNewDetSetVector")) + ) + ) + ) + + # SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA + process.hltSiPixelClusters = SwitchProducerCUDA( + # legacy producer + cpu = process.hltSiPixelClusters, + # alias used to access products from multiple conversion modules + cuda = cms.EDAlias( + hltSiPixelDigisClusters = cms.VPSet( + cms.PSet(type = cms.string("SiPixelClusteredmNewDetSetVector")) + ) + ) + ) + + # reconstruct the pixel rechits on the gpu + from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi import siPixelRecHitCUDA as _siPixelRecHitCUDA + process.hltSiPixelRecHitsCUDA = _siPixelRecHitCUDA.clone( + src = "hltSiPixelClustersCUDA", + beamSpot = "hltOnlineBeamSpotToCUDA" + ) + + # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA + from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDA_cfi import siPixelRecHitFromCUDA as _siPixelRecHitFromCUDA + process.hltSiPixelRecHits = SwitchProducerCUDA( + # legacy producer + cpu = process.hltSiPixelRecHits, + # converter to legacy format + cuda = _siPixelRecHitFromCUDA.clone( + pixelRecHitSrc = "hltSiPixelRecHitsCUDA", + src = "hltSiPixelClusters" + ) + ) + + + # Tasks and Sequences + + process.HLTDoLocalPixelTask = cms.Task( + process.hltOnlineBeamSpotToCUDA, # transfer the beamspot to the gpu + process.hltSiPixelClustersCUDA, # reconstruct the pixel digis and clusters on the gpu + process.hltSiPixelRecHitsCUDA, # reconstruct the pixel rechits on the gpu + process.hltSiPixelDigisSoA, # copy the pixel digis (except errors) and clusters to the host + process.hltSiPixelDigisClusters, # convert the pixel digis (except errors) and clusters to the legacy format + process.hltSiPixelDigiErrorsSoA, # copy the pixel digis errors to the host + process.hltSiPixelDigiErrors, # convert the pixel digis errors to the legacy format + process.hltSiPixelDigis, # SwitchProducer wrapping the legacy pixel digis producer or an alias combining the pixel digis information converted from SoA + process.hltSiPixelClusters, # SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA + process.hltSiPixelClustersCache, # legacy module, used by the legacy pixel quadruplet producer + process.hltSiPixelRecHits) # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA + + process.HLTDoLocalPixelSequence = cms.Sequence(process.HLTDoLocalPixelTask) + + + # done + return process + + +# customisation for running the "Patatrack" pixel track reconstruction +def customisePixelTrackReconstruction(process): + + if not 'HLTRecoPixelTracksSequence' in process.__dict__: + return process + + + # FIXME replace the Sequences with empty ones to avoid exanding them during the (re)definition of Modules and EDAliases + + process.HLTRecoPixelTracksSequence = cms.Sequence() + process.HLTRecopixelvertexingSequence = cms.Sequence() + + + # Modules and EDAliases + + # referenced in process.HLTRecoPixelTracksTask + + # cpu only: convert the pixel rechits from legacy to SoA format + from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacy_cfi import siPixelRecHitSoAFromLegacy as _siPixelRecHitSoAFromLegacy + process.hltSiPixelRecHitSoA = _siPixelRecHitSoAFromLegacy.clone( + src = "hltSiPixelClusters", + beamSpot = "hltOnlineBeamSpot", + convertToLegacy = True + ) + + # build pixel ntuplets and pixel tracks in SoA format on gpu + from RecoPixelVertexing.PixelTriplets.pixelTracksCUDA_cfi import pixelTracksCUDA as _pixelTracksCUDA + process.hltPixelTracksCUDA = _pixelTracksCUDA.clone( + idealConditions = False, + pixelRecHitSrc = "hltSiPixelRecHitsCUDA", + onGPU = True + ) + # use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows + run3_common.toModify(process.hltPixelTracksCUDA, idealConditions = True) + + # SwitchProducer providing the pixel tracks in SoA format on cpu + from RecoPixelVertexing.PixelTrackFitting.pixelTracksSoA_cfi import pixelTracksSoA as _pixelTracksSoA + process.hltPixelTracksSoA = SwitchProducerCUDA( + # build pixel ntuplets and pixel tracks in SoA format on cpu + cpu = _pixelTracksCUDA.clone( + idealConditions = False, + pixelRecHitSrc = "hltSiPixelRecHitSoA", + onGPU = False + ), + # transfer the pixel tracks in SoA format to the host + cuda = _pixelTracksSoA.clone( + src = "hltPixelTracksCUDA" + ) + ) + # use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows + run3_common.toModify(process.hltPixelTracksSoA.cpu, idealConditions = True) + + # convert the pixel tracks from SoA to legacy format + from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA as _pixelTrackProducerFromSoA + process.hltPixelTracks = _pixelTrackProducerFromSoA.clone( + beamSpot = "hltOnlineBeamSpot", + pixelRecHitLegacySrc = "hltSiPixelRecHits", + trackSrc = "hltPixelTracksSoA" + ) + + + # referenced in process.HLTRecopixelvertexingTask + + # build pixel vertices in SoA format on gpu + from RecoPixelVertexing.PixelVertexFinding.pixelVerticesCUDA_cfi import pixelVerticesCUDA as _pixelVerticesCUDA + process.hltPixelVerticesCUDA = _pixelVerticesCUDA.clone( + pixelTrackSrc = "hltPixelTracksCUDA", + onGPU = True + ) + + # build or transfer pixel vertices in SoA format on cpu + from RecoPixelVertexing.PixelVertexFinding.pixelVerticesSoA_cfi import pixelVerticesSoA as _pixelVerticesSoA + process.hltPixelVerticesSoA = SwitchProducerCUDA( + # build pixel vertices in SoA format on cpu + cpu = _pixelVerticesCUDA.clone( + pixelTrackSrc = "hltPixelTracksSoA", + onGPU = False + ), + # transfer the pixel vertices in SoA format to cpu + cuda = _pixelVerticesSoA.clone( + src = "hltPixelVerticesCUDA" + ) + ) + + # convert the pixel vertices from SoA to legacy format + from RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA as _pixelVertexFromSoA + process.hltPixelVertices = _pixelVertexFromSoA.clone( + src = "hltPixelVerticesSoA", + TrackCollection = "hltPixelTracks", + beamSpot = "hltOnlineBeamSpot" + ) + + + # Tasks and Sequences + + process.HLTRecoPixelTracksTask = cms.Task( + process.hltPixelTracksTrackingRegions, # from the original sequence + process.hltSiPixelRecHitSoA, # pixel rechits on cpu, converted to SoA + process.hltPixelTracksCUDA, # pixel ntuplets on gpu, in SoA format + process.hltPixelTracksSoA, # pixel ntuplets on cpu, in SoA format + process.hltPixelTracks) # pixel tracks on cpu, in legacy format + + + process.HLTRecoPixelTracksSequence = cms.Sequence(process.HLTRecoPixelTracksTask) + + process.HLTRecopixelvertexingTask = cms.Task( + process.HLTRecoPixelTracksTask, + process.hltPixelVerticesCUDA, # pixel vertices on gpu, in SoA format + process.hltPixelVerticesSoA, # pixel vertices on cpu, in SoA format + process.hltPixelVertices, # pixel vertices on cpu, in legacy format + process.hltTrimmedPixelVertices) # from the original sequence + + process.HLTRecopixelvertexingSequence = cms.Sequence( + process.hltPixelTracksFitter + # not used here, kept for compatibility with legacy sequences + process.hltPixelTracksFilter, # not used here, kept for compatibility with legacy sequences + process.HLTRecopixelvertexingTask) + + + # done + return process + + +# customisation for offloading the ECAL local reconstruction via CUDA if a supported gpu is present +def customiseEcalLocalReconstruction(process): + + if not 'HLTDoFullUnpackingEgammaEcalSequence' in process.__dict__: + return process + + + # FIXME replace the Sequences with empty ones to avoid exanding them during the (re)definition of Modules and EDAliases + + process.HLTDoFullUnpackingEgammaEcalMFSequence = cms.Sequence() + process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence = cms.Sequence() + process.HLTDoFullUnpackingEgammaEcalSequence = cms.Sequence() + + + # Event Setup + + process.load("EventFilter.EcalRawToDigi.ecalElectronicsMappingGPUESProducer_cfi") + process.load("RecoLocalCalo.EcalRecProducers.ecalGainRatiosGPUESProducer_cfi") + process.load("RecoLocalCalo.EcalRecProducers.ecalPedestalsGPUESProducer_cfi") + process.load("RecoLocalCalo.EcalRecProducers.ecalPulseCovariancesGPUESProducer_cfi") + process.load("RecoLocalCalo.EcalRecProducers.ecalPulseShapesGPUESProducer_cfi") + process.load("RecoLocalCalo.EcalRecProducers.ecalSamplesCorrelationGPUESProducer_cfi") + process.load("RecoLocalCalo.EcalRecProducers.ecalTimeBiasCorrectionsGPUESProducer_cfi") + process.load("RecoLocalCalo.EcalRecProducers.ecalTimeCalibConstantsGPUESProducer_cfi") + process.load("RecoLocalCalo.EcalRecProducers.ecalMultifitParametersGPUESProducer_cfi") + + process.load("RecoLocalCalo.EcalRecProducers.ecalRechitADCToGeVConstantGPUESProducer_cfi") + process.load("RecoLocalCalo.EcalRecProducers.ecalRechitChannelStatusGPUESProducer_cfi") + process.load("RecoLocalCalo.EcalRecProducers.ecalIntercalibConstantsGPUESProducer_cfi") + process.load("RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosGPUESProducer_cfi") + process.load("RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosRefGPUESProducer_cfi") + process.load("RecoLocalCalo.EcalRecProducers.ecalLaserAlphasGPUESProducer_cfi") + process.load("RecoLocalCalo.EcalRecProducers.ecalLinearCorrectionsGPUESProducer_cfi") + process.load("RecoLocalCalo.EcalRecProducers.ecalRecHitParametersGPUESProducer_cfi") + + + # Modules and EDAliases + + # ECAL unpacker running on gpu + from EventFilter.EcalRawToDigi.ecalRawToDigiGPU_cfi import ecalRawToDigiGPU as _ecalRawToDigiGPU + process.hltEcalDigisGPU = _ecalRawToDigiGPU.clone() + + # SwitchProducer wrapping the legacy ECAL unpacker or the ECAL digi converter from SoA format on gpu to legacy format on cpu + process.hltEcalDigisLegacy = process.hltEcalDigis.clone() + from EventFilter.EcalRawToDigi.ecalCPUDigisProducer_cfi import ecalCPUDigisProducer as _ecalCPUDigisProducer + + process.hltEcalDigis = SwitchProducerCUDA( + # legacy producer + cpu = cms.EDAlias( + hltEcalDigisLegacy = cms.VPSet( + cms.PSet(type = cms.string("EBDigiCollection")), + cms.PSet(type = cms.string("EEDigiCollection")), + cms.PSet(type = cms.string("EBDetIdedmEDCollection")), + cms.PSet(type = cms.string("EEDetIdedmEDCollection")), + cms.PSet(type = cms.string("EBSrFlagsSorted")), + cms.PSet(type = cms.string("EESrFlagsSorted")), + cms.PSet(type = cms.string("EcalElectronicsIdedmEDCollection"), fromProductInstance = cms.string("EcalIntegrityBlockSizeErrors")), + cms.PSet(type = cms.string("EcalElectronicsIdedmEDCollection"), fromProductInstance = cms.string("EcalIntegrityTTIdErrors")), + cms.PSet(type = cms.string("EcalElectronicsIdedmEDCollection"), fromProductInstance = cms.string("EcalIntegrityZSXtalIdErrors")), + cms.PSet(type = cms.string("EcalPnDiodeDigisSorted")), + cms.PSet(type = cms.string("EcalPseudoStripInputDigisSorted"), fromProductInstance = cms.string("EcalPseudoStripInputs")), + cms.PSet(type = cms.string("EcalTriggerPrimitiveDigisSorted"), fromProductInstance = cms.string("EcalTriggerPrimitives")), + ) + ), + # convert ECAL digis from SoA format on gpu to legacy format on cpu + cuda = _ecalCPUDigisProducer.clone( + digisInLabelEB = ("hltEcalDigisGPU", "ebDigis"), + digisInLabelEE = ("hltEcalDigisGPU", "eeDigis"), + produceDummyIntegrityCollections = cms.bool(True) + ) + ) + + # ECAL multifit running on gpu + from RecoLocalCalo.EcalRecProducers.ecalUncalibRecHitProducerGPU_cfi import ecalUncalibRecHitProducerGPU as _ecalUncalibRecHitProducerGPU + process.hltEcalUncalibRecHitGPU = _ecalUncalibRecHitProducerGPU.clone( + digisLabelEB = ("hltEcalDigisGPU", "ebDigis"), + digisLabelEE = ("hltEcalDigisGPU", "eeDigis"), + shouldRunTimingComputation = False + ) + + # copy the ECAL uncalibrated rechits from gpu to cpu in SoA format + from RecoLocalCalo.EcalRecProducers.ecalCPUUncalibRecHitProducer_cfi import ecalCPUUncalibRecHitProducer as _ecalCPUUncalibRecHitProducer + process.hltEcalUncalibRecHitSoA = _ecalCPUUncalibRecHitProducer.clone( + recHitsInLabelEB = ("hltEcalUncalibRecHitGPU", "EcalUncalibRecHitsEB"), + recHitsInLabelEE = ("hltEcalUncalibRecHitGPU", "EcalUncalibRecHitsEE"), + ) + + # SwitchProducer wrapping the legacy ECAL uncalibrated rechits producer or a converter from SoA to legacy format + from RecoLocalCalo.EcalRecProducers.ecalUncalibRecHitConvertGPU2CPUFormat_cfi import ecalUncalibRecHitConvertGPU2CPUFormat as _ecalUncalibRecHitConvertGPU2CPUFormat + process.hltEcalUncalibRecHit = SwitchProducerCUDA( + # legacy producer + cpu = process.hltEcalUncalibRecHit, + # convert the ECAL uncalibrated rechits from SoA to legacy format + cuda = _ecalUncalibRecHitConvertGPU2CPUFormat.clone( + recHitsLabelGPUEB = ("hltEcalUncalibRecHitSoA", "EcalUncalibRecHitsEB"), + recHitsLabelGPUEE = ("hltEcalUncalibRecHitSoA", "EcalUncalibRecHitsEE"), + ) + ) + + # Reconstructing the ECAL calibrated rechits on gpu works, but is extremely slow. + # Disable it for the time being, until the performance has been addressed. + """ + from RecoLocalCalo.EcalRecProducers.ecalRecHitGPU_cfi import ecalRecHitGPU as _ecalRecHitGPU + process.hltEcalRecHitGPU = _ecalRecHitGPU.clone( + uncalibrecHitsInLabelEB = ("hltEcalUncalibRecHitGPU","EcalUncalibRecHitsEB"), + uncalibrecHitsInLabelEE = ("hltEcalUncalibRecHitGPU","EcalUncalibRecHitsEE"), + ) + + from RecoLocalCalo.EcalRecProducers.ecalCPURecHitProducer_cfi import ecalCPURecHitProducer as _ecalCPURecHitProducer + process.hltEcalRecHitSoA = _ecalCPURecHitProducer.clone( + recHitsInLabelEB = ("hltEcalRecHitGPU", "EcalRecHitsEB"), + recHitsInLabelEE = ("hltEcalRecHitGPU", "EcalRecHitsEE"), + ) + + # SwitchProducer wrapping the legacy ECAL calibrated rechits producer or a converter from SoA to legacy format + from RecoLocalCalo.EcalRecProducers.ecalRecHitConvertGPU2CPUFormat_cfi import ecalRecHitConvertGPU2CPUFormat as _ecalRecHitConvertGPU2CPUFormat + process.hltEcalRecHit = SwitchProducerCUDA( + # legacy producer + cpu = process.hltEcalRecHit, + # convert the ECAL calibrated rechits from SoA to legacy format + cuda = _ecalRecHitConvertGPU2CPUFormat.clone( + recHitsLabelGPUEB = ("hltEcalRecHitSoA", "EcalRecHitsEB"), + recHitsLabelGPUEE = ("hltEcalRecHitSoA", "EcalRecHitsEE"), + ) + ) + """ + + # SwitchProducer wrapping the legacy ECAL rechits producer + # the gpu unpacker does not produce the TPs used for the recovery, so the SwitchProducer alias does not provide them: + # - the cpu uncalibrated rechit producer may mark them for recovery, read the TPs explicitly from the legacy unpacker + # - the gpu uncalibrated rechit producer does not flag them for recovery, so the TPs are not necessary + process.hltEcalRecHit = SwitchProducerCUDA( + cpu = process.hltEcalRecHit.clone( + triggerPrimitiveDigiCollection = ('hltEcalDigisLegacy', 'EcalTriggerPrimitives') + ), + cuda = process.hltEcalRecHit.clone( + triggerPrimitiveDigiCollection = 'unused' + ) + ) + + # Tasks and Sequences + + process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask = cms.Task( + process.hltEcalDigisGPU, # unpack ECAL digis on gpu + process.hltEcalDigisLegacy, # legacy producer, referenced in the SwitchProducer + process.hltEcalDigis, # SwitchProducer + process.hltEcalUncalibRecHitGPU, # run ECAL local reconstruction and multifit on gpu + process.hltEcalUncalibRecHitSoA, # needed by hltEcalPhiSymFilter - copy to host + process.hltEcalUncalibRecHit, # needed by hltEcalPhiSymFilter - convert to legacy format + # process.hltEcalRecHitGPU, # make ECAL calibrated rechits on gpu + # process.hltEcalRecHitSoA, # copy to host + process.hltEcalDetIdToBeRecovered, # legacy producer + process.hltEcalRecHit) # legacy producer + + process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence = cms.Sequence( + process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask) + + process.HLTPreshowerTask = cms.Task( + process.hltEcalPreshowerDigis, # unpack ECAL preshower digis on the host + process.hltEcalPreshowerRecHit) # build ECAL preshower rechits on the host + + process.HLTPreshowerSequence = cms.Sequence(process.HLTPreshowerTask) + + process.HLTDoFullUnpackingEgammaEcalTask = cms.Task( + process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask, + process.HLTPreshowerTask) + + process.HLTDoFullUnpackingEgammaEcalSequence = cms.Sequence( + process.HLTDoFullUnpackingEgammaEcalTask) + + process.HLTDoFullUnpackingEgammaEcalMFSequence = cms.Sequence( + process.HLTDoFullUnpackingEgammaEcalTask) + + + # done + return process + +# customisation for offloading the HCAL local reconstruction via CUDA if a supported gpu is present +def customiseHcalLocalReconstruction(process): + + if not 'HLTDoLocalHcalSequence' in process.__dict__: + return process + + + # FIXME replace the Sequences with empty ones to avoid exanding them during the (re)definition of Modules and EDAliases + + process.HLTDoLocalHcalSequence = cms.Sequence() + process.HLTStoppedHSCPLocalHcalReco = cms.Sequence() + + + # Event Setup + + process.load("EventFilter.HcalRawToDigi.hcalElectronicsMappingGPUESProducer_cfi") + + process.load("RecoLocalCalo.HcalRecProducers.hcalGainsGPUESProducer_cfi") + process.load("RecoLocalCalo.HcalRecProducers.hcalGainWidthsGPUESProducer_cfi") + process.load("RecoLocalCalo.HcalRecProducers.hcalLUTCorrsGPUESProducer_cfi") + process.load("RecoLocalCalo.HcalRecProducers.hcalConvertedPedestalsGPUESProducer_cfi") + process.load("RecoLocalCalo.HcalRecProducers.hcalConvertedEffectivePedestalsGPUESProducer_cfi") + process.hcalConvertedEffectivePedestalsGPUESProducer.label0 = "withTopoEff" + process.load("RecoLocalCalo.HcalRecProducers.hcalConvertedPedestalWidthsGPUESProducer_cfi") + process.load("RecoLocalCalo.HcalRecProducers.hcalConvertedEffectivePedestalWidthsGPUESProducer_cfi") + process.hcalConvertedEffectivePedestalWidthsGPUESProducer.label0 = "withTopoEff" + process.hcalConvertedEffectivePedestalWidthsGPUESProducer.label1 = "withTopoEff" + process.load("RecoLocalCalo.HcalRecProducers.hcalQIECodersGPUESProducer_cfi") + process.load("RecoLocalCalo.HcalRecProducers.hcalRecoParamsWithPulseShapesGPUESProducer_cfi") + process.load("RecoLocalCalo.HcalRecProducers.hcalRespCorrsGPUESProducer_cfi") + process.load("RecoLocalCalo.HcalRecProducers.hcalTimeCorrsGPUESProducer_cfi") + process.load("RecoLocalCalo.HcalRecProducers.hcalQIETypesGPUESProducer_cfi") + process.load("RecoLocalCalo.HcalRecProducers.hcalSiPMParametersGPUESProducer_cfi") + process.load("RecoLocalCalo.HcalRecProducers.hcalSiPMCharacteristicsGPUESProducer_cfi") + process.load("RecoLocalCalo.HcalRecProducers.hcalMahiPulseOffsetsGPUESProducer_cfi") + + + # Modules and EDAliases + + # The HCAL unpacker running on the gpu supports only the HB and HE digis. + # So, run the legacy unacker on the cpu, then convert the HB and HE digis + # to SoA format and copy them to the gpu. + from EventFilter.HcalRawToDigi.hcalDigisProducerGPU_cfi import hcalDigisProducerGPU as _hcalDigisProducerGPU + process.hltHcalDigisGPU = _hcalDigisProducerGPU.clone( + hbheDigisLabel = "hltHcalDigis", + qie11DigiLabel = "hltHcalDigis", + digisLabelF01HE = "", + digisLabelF5HB = "", + digisLabelF3HB = "" + ) + + # run the HCAL local reconstruction (including Method 0 and MAHI) on gpu + from RecoLocalCalo.HcalRecProducers.hbheRecHitProducerGPU_cfi import hbheRecHitProducerGPU as _hbheRecHitProducerGPU + process.hltHbherecoGPU = _hbheRecHitProducerGPU.clone( + digisLabelF01HE = "hltHcalDigisGPU", + digisLabelF5HB = "hltHcalDigisGPU", + digisLabelF3HB = "hltHcalDigisGPU", + recHitsLabelM0HBHE = "" + ) + + # transfer the HCAL rechits to the cpu, and convert them to the legacy format + from RecoLocalCalo.HcalRecProducers.hcalCPURecHitsProducer_cfi import hcalCPURecHitsProducer as _hcalCPURecHitsProducer + process.hltHbherecoFromGPU = _hcalCPURecHitsProducer.clone( + recHitsM0LabelIn = "hltHbherecoGPU", + recHitsM0LabelOut = "", + recHitsLegacyLabelOut = "" + ) + + # SwitchProducer between the legacy producer and the copy from gpu with conversion + process.hltHbhereco = SwitchProducerCUDA( + # legacy producer + cpu = process.hltHbhereco.clone(), + # alias to the rechits converted to legacy format + cuda = cms.EDAlias( + hltHbherecoFromGPU = cms.VPSet( + cms.PSet(type = cms.string("HBHERecHitsSorted")) + ) + ) + ) + + + # Tasks and Sequences + + process.HLTDoLocalHcalTask = cms.Task( + process.hltHcalDigis, # legacy producer, unpack HCAL digis on cpu + process.hltHcalDigisGPU, # copy to gpu and convert to SoA format + process.hltHbherecoGPU, # run the HCAL local reconstruction (including Method 0 and MAHI) on gpu + process.hltHbherecoFromGPU, # transfer the HCAL rechits to the cpu, and convert them to the legacy format + process.hltHbhereco, # SwitchProducer between the legacy producer and the copy from gpu with conversion + process.hltHfprereco, # legacy producer + process.hltHfreco, # legacy producer + process.hltHoreco) # legacy producer + + process.HLTDoLocalHcalSequence = cms.Sequence( + process.HLTDoLocalHcalTask) + + process.HLTStoppedHSCPLocalHcalRecoTask = cms.Task( + process.hltHcalDigis, # legacy producer, unpack HCAL digis on cpu + process.hltHcalDigisGPU, # copy to gpu and convert to SoA format + process.hltHbherecoGPU, # run the HCAL local reconstruction (including Method 0 and MAHI) on gpu + process.hltHbherecoFromGPU, # transfer the HCAL rechits to the cpu, and convert them to the legacy format + process.hltHbhereco) # SwitchProducer between the legacy producer and the copy from gpu with conversion + + process.HLTStoppedHSCPLocalHcalReco = cms.Sequence( + process.HLTStoppedHSCPLocalHcalRecoTask) + + + # done + return process + + +# customisation to enable pixel triplets instead of quadruplets +def enablePatatrackPixelTriplets(process): + + # configure GPU pixel tracks for triplets + process.hltPixelTracksCUDA.minHitsPerNtuplet = 3 + process.hltPixelTracksCUDA.includeJumpingForwardDoublets = True + + # configure CPU pixel tracks for triplets + process.hltPixelTracksSoA.cpu.minHitsPerNtuplet = 3 + process.hltPixelTracksSoA.cpu.includeJumpingForwardDoublets = True + + # done + return process + + +# customisation for running the Patatrack reconstruction, with automatic offload via CUDA when a supported gpu is available +def customizeHLTforPatatrack(process): + process = customiseCommon(process) + process = customisePixelLocalReconstruction(process) + process = customisePixelTrackReconstruction(process) + process = customiseEcalLocalReconstruction(process) + process = customiseHcalLocalReconstruction(process) + return process + + +# customisation for running the Patatrack triplets reconstruction, with automatic offload via CUDA when a supported gpu is available +def customizeHLTforPatatrackTriplets(process): + process = customiseCommon(process) + process = customisePixelLocalReconstruction(process) + process = customisePixelTrackReconstruction(process) + process = customiseEcalLocalReconstruction(process) + process = customiseHcalLocalReconstruction(process) + process = enablePatatrackPixelTriplets(process) + return process + + +def _addConsumerPath(process): + # add to a path all consumers and the tasks that define the producers + process.Consumer = cms.Path( + process.HLTBeginSequence + + process.hltPixelConsumer + + process.hltEcalConsumer + + process.hltHbheConsumer, + process.HLTDoLocalPixelTask, + process.HLTRecoPixelTracksTask, + process.HLTRecopixelvertexingTask, + process.HLTDoFullUnpackingEgammaEcalTask, + process.HLTDoLocalHcalTask, + ) + + if 'HLTSchedule' in process.__dict__: + process.HLTSchedule.append(process.Consumer) + if process.schedule is not None: + process.schedule.append(process.Consumer) + + # done + return process + + +def consumeGPUSoAProducts(process): + # consume the Pixel tracks and vertices on the GPU in SoA format + process.hltPixelConsumer = cms.EDAnalyzer("GenericConsumer", + eventProducts = cms.untracked.vstring( 'hltPixelTracksCUDA', 'hltPixelVerticesCUDA' ) + ) + + # consume the ECAL uncalibrated rechits on the GPU in SoA format + process.hltEcalConsumer = cms.EDAnalyzer("GenericConsumer", + eventProducts = cms.untracked.vstring( 'hltEcalUncalibRecHitGPU' ) + ) + + # consume the HCAL rechits on the GPU in SoA format + process.hltHbheConsumer = cms.EDAnalyzer("GenericConsumer", + eventProducts = cms.untracked.vstring( 'hltHbherecoGPU' ) + ) + + # add to a path all consumers and the tasks that define the producers + process = _addConsumerPath(process) + + # done + return process + + +def consumeCPUSoAProducts(process): + # consume the Pixel tracks and vertices on the CPU in SoA format + process.hltPixelConsumer = cms.EDAnalyzer("GenericConsumer", + eventProducts = cms.untracked.vstring( 'hltPixelTracksSoA', 'hltPixelVerticesSoA' ) + ) + + # consume the ECAL uncalibrated rechits on the CPU in SoA format + process.hltEcalConsumer = cms.EDAnalyzer("GenericConsumer", + eventProducts = cms.untracked.vstring( 'hltEcalUncalibRecHitSoA' ) + ) + + # consume the HCAL rechits on the CPU in legacy format + process.hltHbheConsumer = cms.EDAnalyzer("GenericConsumer", + eventProducts = cms.untracked.vstring( 'hltHbhereco' ) + ) + + # add to a path all consumers and the tasks that define the producers + process = _addConsumerPath(process) + + # done + return process + +def consumeCPULegacyProducts(process): + # consume the Pixel tracks and vertices on the CPU in legacy format + process.hltPixelConsumer = cms.EDAnalyzer("GenericConsumer", + eventProducts = cms.untracked.vstring( 'hltPixelTracks', 'hltPixelVertices' ) + ) + + # consume the ECAL runcalibrated echits on the CPU in legacy format + process.hltEcalConsumer = cms.EDAnalyzer("GenericConsumer", + eventProducts = cms.untracked.vstring( 'hltEcalUncalibRecHit' ) + ) + + # consume the HCAL rechits on the CPU in legacy format + process.hltHbheConsumer = cms.EDAnalyzer("GenericConsumer", + eventProducts = cms.untracked.vstring( 'hltHbhereco' ) + ) + + # add to a path all consumers and the tasks that define the producers + process = _addConsumerPath(process) + + # done + return process diff --git a/HLTrigger/Egamma/plugins/HLTDisplacedEgammaFilter.cc b/HLTrigger/Egamma/plugins/HLTDisplacedEgammaFilter.cc index efa55e07fa7eb..a47e6bc6283b6 100644 --- a/HLTrigger/Egamma/plugins/HLTDisplacedEgammaFilter.cc +++ b/HLTrigger/Egamma/plugins/HLTDisplacedEgammaFilter.cc @@ -6,14 +6,11 @@ */ #include "HLTDisplacedEgammaFilter.h" - #include "DataFormats/Common/interface/Handle.h" - #include "FWCore/MessageLogger/interface/MessageLogger.h" - +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h" #include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h" -#include "RecoTracker/TrackProducer/plugins/TrackProducer.h" #include "DataFormats/Math/interface/LorentzVector.h" // diff --git a/HLTrigger/Muon/plugins/BuildFile.xml b/HLTrigger/Muon/plugins/BuildFile.xml index 46ab459e79184..c77c3e955e71a 100644 --- a/HLTrigger/Muon/plugins/BuildFile.xml +++ b/HLTrigger/Muon/plugins/BuildFile.xml @@ -21,4 +21,5 @@ + diff --git a/HLTrigger/Muon/plugins/HLTMuonTrackSelector.h b/HLTrigger/Muon/plugins/HLTMuonTrackSelector.h index fadce10a09059..b6089ba2747fe 100644 --- a/HLTrigger/Muon/plugins/HLTMuonTrackSelector.h +++ b/HLTrigger/Muon/plugins/HLTMuonTrackSelector.h @@ -12,7 +12,7 @@ * */ -#include "RecoTracker/FinalTrackSelectors/src/TrackCollectionCloner.cc" +#include "RecoTracker/FinalTrackSelectors/interface/TrackCollectionCloner.h" #include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/Framework/interface/Event.h" diff --git a/HLTriggerOffline/Higgs/BuildFile.xml b/HLTriggerOffline/Higgs/plugins/BuildFile.xml similarity index 100% rename from HLTriggerOffline/Higgs/BuildFile.xml rename to HLTriggerOffline/Higgs/plugins/BuildFile.xml diff --git a/HLTriggerOffline/Higgs/src/EVTColContainer.cc b/HLTriggerOffline/Higgs/plugins/EVTColContainer.h similarity index 100% rename from HLTriggerOffline/Higgs/src/EVTColContainer.cc rename to HLTriggerOffline/Higgs/plugins/EVTColContainer.h diff --git a/HLTriggerOffline/Higgs/src/HLTHiggsPlotter.cc b/HLTriggerOffline/Higgs/plugins/HLTHiggsPlotter.cc similarity index 98% rename from HLTriggerOffline/Higgs/src/HLTHiggsPlotter.cc rename to HLTriggerOffline/Higgs/plugins/HLTHiggsPlotter.cc index 5e9d69624b746..9571590f3b00b 100644 --- a/HLTriggerOffline/Higgs/src/HLTHiggsPlotter.cc +++ b/HLTriggerOffline/Higgs/plugins/HLTHiggsPlotter.cc @@ -11,9 +11,9 @@ #include "DataFormats/HLTReco/interface/TriggerEvent.h" -#include "HLTriggerOffline/Higgs/interface/HLTHiggsPlotter.h" -#include "HLTriggerOffline/Higgs/interface/HLTHiggsSubAnalysis.h" -#include "HLTriggerOffline/Higgs/src/EVTColContainer.cc" +#include "HLTHiggsPlotter.h" +#include "HLTHiggsSubAnalysis.h" +#include "EVTColContainer.h" #include "TPRegexp.h" diff --git a/HLTriggerOffline/Higgs/interface/HLTHiggsPlotter.h b/HLTriggerOffline/Higgs/plugins/HLTHiggsPlotter.h similarity index 98% rename from HLTriggerOffline/Higgs/interface/HLTHiggsPlotter.h rename to HLTriggerOffline/Higgs/plugins/HLTHiggsPlotter.h index b9ee5d42e2d3f..b46d634fb0bfb 100644 --- a/HLTriggerOffline/Higgs/interface/HLTHiggsPlotter.h +++ b/HLTriggerOffline/Higgs/plugins/HLTHiggsPlotter.h @@ -32,7 +32,7 @@ #include "DQMServices/Core/interface/DQMStore.h" -#include "HLTriggerOffline/Higgs/src/MatchStruct.cc" +#include "MatchStruct.h" #include #include diff --git a/HLTriggerOffline/Higgs/src/HLTHiggsSubAnalysis.cc b/HLTriggerOffline/Higgs/plugins/HLTHiggsSubAnalysis.cc similarity index 99% rename from HLTriggerOffline/Higgs/src/HLTHiggsSubAnalysis.cc rename to HLTriggerOffline/Higgs/plugins/HLTHiggsSubAnalysis.cc index 5acef2d146a8f..a1b999bb128ed 100644 --- a/HLTriggerOffline/Higgs/src/HLTHiggsSubAnalysis.cc +++ b/HLTriggerOffline/Higgs/plugins/HLTHiggsSubAnalysis.cc @@ -7,9 +7,9 @@ #include "DataFormats/Common/interface/Handle.h" -#include "HLTriggerOffline/Higgs/interface/HLTHiggsSubAnalysis.h" -#include "HLTriggerOffline/Higgs/src/EVTColContainer.cc" -#include "HLTriggerOffline/Higgs/src/MatchStruct.cc" +#include "HLTHiggsSubAnalysis.h" +#include "EVTColContainer.h" +#include "MatchStruct.h" #include "FWCore/Common/interface/TriggerNames.h" @@ -19,9 +19,6 @@ #include "DataFormats/Common/interface/TriggerResults.h" #include "FWCore/Common/interface/TriggerNames.h" -#include "HLTriggerOffline/Higgs/interface/HLTHiggsSubAnalysis.h" -#include "HLTriggerOffline/Higgs/src/MatchStruct.cc" - #include "TPRegexp.h" #include "TRegexp.h" #include "TString.h" diff --git a/HLTriggerOffline/Higgs/interface/HLTHiggsSubAnalysis.h b/HLTriggerOffline/Higgs/plugins/HLTHiggsSubAnalysis.h similarity index 99% rename from HLTriggerOffline/Higgs/interface/HLTHiggsSubAnalysis.h rename to HLTriggerOffline/Higgs/plugins/HLTHiggsSubAnalysis.h index e8950e468d696..0ba7a84eee7c8 100644 --- a/HLTriggerOffline/Higgs/interface/HLTHiggsSubAnalysis.h +++ b/HLTriggerOffline/Higgs/plugins/HLTHiggsSubAnalysis.h @@ -47,7 +47,7 @@ #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" -#include "HLTriggerOffline/Higgs/interface/HLTHiggsPlotter.h" +#include "HLTHiggsPlotter.h" #include #include diff --git a/HLTriggerOffline/Higgs/src/HLTHiggsValidator.cc b/HLTriggerOffline/Higgs/plugins/HLTHiggsValidator.cc similarity index 94% rename from HLTriggerOffline/Higgs/src/HLTHiggsValidator.cc rename to HLTriggerOffline/Higgs/plugins/HLTHiggsValidator.cc index 5f0cbc88a7b25..f456647e124fb 100644 --- a/HLTriggerOffline/Higgs/src/HLTHiggsValidator.cc +++ b/HLTriggerOffline/Higgs/plugins/HLTHiggsValidator.cc @@ -16,8 +16,8 @@ //#include "FWCore/Framework/interface/MakerMacros.h" -#include "HLTriggerOffline/Higgs/interface/HLTHiggsValidator.h" -#include "HLTriggerOffline/Higgs/src/EVTColContainer.cc" +#include "HLTHiggsValidator.h" +#include "EVTColContainer.h" //////// Class Methods /////////////////////////////////////////////////////// // Constructor diff --git a/HLTriggerOffline/Higgs/interface/HLTHiggsValidator.h b/HLTriggerOffline/Higgs/plugins/HLTHiggsValidator.h similarity index 96% rename from HLTriggerOffline/Higgs/interface/HLTHiggsValidator.h rename to HLTriggerOffline/Higgs/plugins/HLTHiggsValidator.h index 207b3831a0bdd..208b240274a59 100644 --- a/HLTriggerOffline/Higgs/interface/HLTHiggsValidator.h +++ b/HLTriggerOffline/Higgs/plugins/HLTHiggsValidator.h @@ -21,7 +21,7 @@ #include "DQMServices/Core/interface/DQMStore.h" -#include "HLTriggerOffline/Higgs/interface/HLTHiggsSubAnalysis.h" +#include "HLTHiggsSubAnalysis.h" #include #include diff --git a/HLTriggerOffline/Higgs/src/MatchStruct.cc b/HLTriggerOffline/Higgs/plugins/MatchStruct.h similarity index 100% rename from HLTriggerOffline/Higgs/src/MatchStruct.cc rename to HLTriggerOffline/Higgs/plugins/MatchStruct.h diff --git a/HLTriggerOffline/Higgs/src/SealModules.cc b/HLTriggerOffline/Higgs/plugins/SealModules.cc similarity index 69% rename from HLTriggerOffline/Higgs/src/SealModules.cc rename to HLTriggerOffline/Higgs/plugins/SealModules.cc index 17c6f67a91a0a..8a9da5d613fe5 100644 --- a/HLTriggerOffline/Higgs/src/SealModules.cc +++ b/HLTriggerOffline/Higgs/plugins/SealModules.cc @@ -2,6 +2,6 @@ #include "FWCore/PluginManager/interface/ModuleDef.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "HLTriggerOffline/Higgs/interface/HLTHiggsValidator.h" +#include "HLTHiggsValidator.h" DEFINE_FWK_MODULE(HLTHiggsValidator); diff --git a/HeterogeneousCore/CUDACore/interface/ESProduct.h b/HeterogeneousCore/CUDACore/interface/ESProduct.h index 676d3e9d1c0d9..fbe1825b0fa4d 100644 --- a/HeterogeneousCore/CUDACore/interface/ESProduct.h +++ b/HeterogeneousCore/CUDACore/interface/ESProduct.h @@ -9,6 +9,7 @@ #include "FWCore/Utilities/interface/thread_safety_macros.h" #include "HeterogeneousCore/CUDAServices/interface/numberOfDevices.h" #include "HeterogeneousCore/CUDAUtilities/interface/EventCache.h" +#include "HeterogeneousCore/CUDAUtilities/interface/ScopedSetDevice.h" #include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h" #include "HeterogeneousCore/CUDAUtilities/interface/currentDevice.h" #include "HeterogeneousCore/CUDAUtilities/interface/eventWorkHasCompleted.h" @@ -19,10 +20,15 @@ namespace cms { class ESProduct { public: ESProduct() : gpuDataPerDevice_(numberOfDevices()) { - for (size_t i = 0; i < gpuDataPerDevice_.size(); ++i) { - gpuDataPerDevice_[i].m_event = getEventCache().get(); + if (not gpuDataPerDevice_.empty()) { + cms::cuda::ScopedSetDevice scopedDevice; + for (size_t i = 0; i < gpuDataPerDevice_.size(); ++i) { + scopedDevice.set(i); + gpuDataPerDevice_[i].m_event = getEventCache().get(); + } } } + ~ESProduct() = default; // transferAsync should be a function of (T&, cudaStream_t) @@ -30,12 +36,10 @@ namespace cms { // to the CUDA stream template const T& dataForCurrentDeviceAsync(cudaStream_t cudaStream, F transferAsync) const { - auto device = currentDevice(); - + int device = currentDevice(); auto& data = gpuDataPerDevice_[device]; - // If GPU data has already been filled, we can return it - // immediately + // If the GPU data has already been filled, we can return it immediately if (not data.m_filled.load()) { // It wasn't, so need to fill it std::scoped_lock lk{data.m_mutex}; @@ -103,4 +107,4 @@ namespace cms { } // namespace cuda } // namespace cms -#endif +#endif // HeterogeneousCore_CUDACore_ESProduct_h diff --git a/HeterogeneousCore/CUDAServices/src/CUDAService.cc b/HeterogeneousCore/CUDAServices/src/CUDAService.cc index 5d1bd30264186..d7f194829d159 100644 --- a/HeterogeneousCore/CUDAServices/src/CUDAService.cc +++ b/HeterogeneousCore/CUDAServices/src/CUDAService.cc @@ -16,8 +16,7 @@ #include "HeterogeneousCore/CUDAUtilities/interface/device_unique_ptr.h" #include "HeterogeneousCore/CUDAUtilities/interface/host_unique_ptr.h" #include "HeterogeneousCore/CUDAUtilities/interface/currentDevice.h" -#include "HeterogeneousCore/CUDAUtilities/src/getCachingDeviceAllocator.h" -#include "HeterogeneousCore/CUDAUtilities/src/getCachingHostAllocator.h" +#include "HeterogeneousCore/CUDAUtilities/interface/cachingAllocators.h" void setCudaLimit(cudaLimit limit, const char* name, size_t request) { // read the current device @@ -300,8 +299,7 @@ CUDAService::CUDAService(edm::ParameterSet const& config) { // Make sure the caching allocators and stream/event caches are constructed before declaring successful construction if constexpr (cms::cuda::allocator::useCaching) { - cms::cuda::allocator::getCachingDeviceAllocator(); - cms::cuda::allocator::getCachingHostAllocator(); + cms::cuda::allocator::cachingAllocatorsConstruct(); } cms::cuda::getEventCache().clear(); cms::cuda::getStreamCache().clear(); @@ -319,8 +317,7 @@ CUDAService::~CUDAService() { if (enabled_) { // Explicitly destruct the allocator before the device resets below if constexpr (cms::cuda::allocator::useCaching) { - cms::cuda::allocator::getCachingDeviceAllocator().FreeAllCached(); - cms::cuda::allocator::getCachingHostAllocator().FreeAllCached(); + cms::cuda::allocator::cachingAllocatorsFreeCached(); } cms::cuda::getEventCache().clear(); cms::cuda::getStreamCache().clear(); diff --git a/HeterogeneousCore/CUDAUtilities/interface/ScopedSetDevice.h b/HeterogeneousCore/CUDAUtilities/interface/ScopedSetDevice.h index 9b296dd390ea3..44480bf0eb5c6 100644 --- a/HeterogeneousCore/CUDAUtilities/interface/ScopedSetDevice.h +++ b/HeterogeneousCore/CUDAUtilities/interface/ScopedSetDevice.h @@ -9,20 +9,35 @@ namespace cms { namespace cuda { class ScopedSetDevice { public: - explicit ScopedSetDevice(int newDevice) { - cudaCheck(cudaGetDevice(&prevDevice_)); - cudaCheck(cudaSetDevice(newDevice)); + // Store the original device, without setting a new one + ScopedSetDevice() { + // Store the original device + cudaCheck(cudaGetDevice(&originalDevice_)); } + // Store the original device, and set a new current device + explicit ScopedSetDevice(int device) : ScopedSetDevice() { + // Change the current device + set(device); + } + + // Restore the original device ~ScopedSetDevice() { // Intentionally don't check the return value to avoid // exceptions to be thrown. If this call fails, the process is // doomed anyway. - cudaSetDevice(prevDevice_); + cudaSetDevice(originalDevice_); + } + + // Set a new current device, without changing the original device + // that will be restored when this object is destroyed + void set(int device) { + // Change the current device + cudaCheck(cudaSetDevice(device)); } private: - int prevDevice_; + int originalDevice_; }; } // namespace cuda } // namespace cms diff --git a/HeterogeneousCore/CUDAUtilities/interface/cachingAllocators.h b/HeterogeneousCore/CUDAUtilities/interface/cachingAllocators.h new file mode 100644 index 0000000000000..3eede5cf5c5ed --- /dev/null +++ b/HeterogeneousCore/CUDAUtilities/interface/cachingAllocators.h @@ -0,0 +1,13 @@ +#ifndef HeterogeneousCore_CUDAUtilities_interface_cachingAllocators_h +#define HeterogeneousCore_CUDAUtilities_interface_cachingAllocators_h + +namespace cms::cuda::allocator { + // Use caching or not + constexpr bool useCaching = true; + + // these intended to be called only from CUDAService + void cachingAllocatorsConstruct(); + void cachingAllocatorsFreeCached(); +} // namespace cms::cuda::allocator + +#endif diff --git a/HeterogeneousCore/CUDAUtilities/interface/deviceAllocatorStatus.h b/HeterogeneousCore/CUDAUtilities/interface/deviceAllocatorStatus.h index 92f9f87e890ac..ad335cb7f7fad 100644 --- a/HeterogeneousCore/CUDAUtilities/interface/deviceAllocatorStatus.h +++ b/HeterogeneousCore/CUDAUtilities/interface/deviceAllocatorStatus.h @@ -1,15 +1,17 @@ #ifndef HeterogeneousCore_CUDAUtilities_deviceAllocatorStatus_h #define HeterogeneousCore_CUDAUtilities_deviceAllocatorStatus_h +#include #include namespace cms { namespace cuda { namespace allocator { struct TotalBytes { - size_t free; - size_t live; - size_t liveRequested; // CMS: monitor also requested amount + // CMS: add explicit std namespace + std::size_t free; + std::size_t live; + std::size_t liveRequested; // CMS: monitor also requested amount TotalBytes() { free = live = liveRequested = 0; } }; /// Map type of device ordinals to the number of cached bytes cached by each device diff --git a/HeterogeneousCore/CUDAUtilities/src/cachingAllocatorCommon.h b/HeterogeneousCore/CUDAUtilities/src/cachingAllocatorCommon.h new file mode 100644 index 0000000000000..c7f2fd038c297 --- /dev/null +++ b/HeterogeneousCore/CUDAUtilities/src/cachingAllocatorCommon.h @@ -0,0 +1,42 @@ +#ifndef HeterogeneousCore_CUDACore_src_cachingAllocatorCommon +#define HeterogeneousCore_CUDACore_src_cachingAllocatorCommon + +#include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h" +#include "HeterogeneousCore/CUDAUtilities/interface/deviceCount.h" + +#include +#include + +namespace cms::cuda::allocator { + // Growth factor (bin_growth in cub::CachingDeviceAllocator + constexpr unsigned int binGrowth = 2; + // Smallest bin, corresponds to binGrowth^minBin bytes (min_bin in cub::CacingDeviceAllocator + constexpr unsigned int minBin = 8; + // Largest bin, corresponds to binGrowth^maxBin bytes (max_bin in cub::CachingDeviceAllocator). Note that unlike in cub, allocations larger than binGrowth^maxBin are set to fail. + constexpr unsigned int maxBin = 30; + // Total storage for the allocator. 0 means no limit. + constexpr size_t maxCachedBytes = 0; + // Fraction of total device memory taken for the allocator. In case there are multiple devices with different amounts of memory, the smallest of them is taken. If maxCachedBytes is non-zero, the smallest of them is taken. + constexpr double maxCachedFraction = 0.8; + constexpr bool debug = false; + + inline size_t minCachedBytes() { + size_t ret = std::numeric_limits::max(); + int currentDevice; + cudaCheck(cudaGetDevice(¤tDevice)); + const int numberOfDevices = deviceCount(); + for (int i = 0; i < numberOfDevices; ++i) { + size_t freeMemory, totalMemory; + cudaCheck(cudaSetDevice(i)); + cudaCheck(cudaMemGetInfo(&freeMemory, &totalMemory)); + ret = std::min(ret, static_cast(maxCachedFraction * freeMemory)); + } + cudaCheck(cudaSetDevice(currentDevice)); + if (maxCachedBytes > 0) { + ret = std::min(ret, maxCachedBytes); + } + return ret; + } +} // namespace cms::cuda::allocator + +#endif diff --git a/HeterogeneousCore/CUDAUtilities/src/cachingAllocators.cc b/HeterogeneousCore/CUDAUtilities/src/cachingAllocators.cc new file mode 100644 index 0000000000000..8a4511eb3ac60 --- /dev/null +++ b/HeterogeneousCore/CUDAUtilities/src/cachingAllocators.cc @@ -0,0 +1,16 @@ +#include "HeterogeneousCore/CUDAUtilities/interface/cachingAllocators.h" + +#include "getCachingDeviceAllocator.h" +#include "getCachingHostAllocator.h" + +namespace cms::cuda::allocator { + void cachingAllocatorsConstruct() { + cms::cuda::allocator::getCachingDeviceAllocator(); + cms::cuda::allocator::getCachingHostAllocator(); + } + + void cachingAllocatorsFreeCached() { + cms::cuda::allocator::getCachingDeviceAllocator().FreeAllCached(); + cms::cuda::allocator::getCachingHostAllocator().FreeAllCached(); + } +} // namespace cms::cuda::allocator diff --git a/HeterogeneousCore/CUDAUtilities/src/getCachingDeviceAllocator.h b/HeterogeneousCore/CUDAUtilities/src/getCachingDeviceAllocator.h index 3770dbac574d9..492d97f800e69 100644 --- a/HeterogeneousCore/CUDAUtilities/src/getCachingDeviceAllocator.h +++ b/HeterogeneousCore/CUDAUtilities/src/getCachingDeviceAllocator.h @@ -4,44 +4,14 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/thread_safety_macros.h" #include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h" -#include "HeterogeneousCore/CUDAUtilities/interface/deviceCount.h" +#include "HeterogeneousCore/CUDAUtilities/interface/cachingAllocators.h" + #include "CachingDeviceAllocator.h" +#include "cachingAllocatorCommon.h" #include namespace cms::cuda::allocator { - // Use caching or not - constexpr bool useCaching = true; - // Growth factor (bin_growth in cub::CachingDeviceAllocator - constexpr unsigned int binGrowth = 2; - // Smallest bin, corresponds to binGrowth^minBin bytes (min_bin in cub::CacingDeviceAllocator - constexpr unsigned int minBin = 8; - // Largest bin, corresponds to binGrowth^maxBin bytes (max_bin in cub::CachingDeviceAllocator). Note that unlike in cub, allocations larger than binGrowth^maxBin are set to fail. - constexpr unsigned int maxBin = 30; - // Total storage for the allocator. 0 means no limit. - constexpr size_t maxCachedBytes = 0; - // Fraction of total device memory taken for the allocator. In case there are multiple devices with different amounts of memory, the smallest of them is taken. If maxCachedBytes is non-zero, the smallest of them is taken. - constexpr double maxCachedFraction = 0.8; - constexpr bool debug = false; - - inline size_t minCachedBytes() { - size_t ret = std::numeric_limits::max(); - int currentDevice; - cudaCheck(cudaGetDevice(¤tDevice)); - const int numberOfDevices = deviceCount(); - for (int i = 0; i < numberOfDevices; ++i) { - size_t freeMemory, totalMemory; - cudaCheck(cudaSetDevice(i)); - cudaCheck(cudaMemGetInfo(&freeMemory, &totalMemory)); - ret = std::min(ret, static_cast(maxCachedFraction * freeMemory)); - } - cudaCheck(cudaSetDevice(currentDevice)); - if (maxCachedBytes > 0) { - ret = std::min(ret, maxCachedBytes); - } - return ret; - } - inline notcub::CachingDeviceAllocator& getCachingDeviceAllocator() { LogDebug("CachingDeviceAllocator").log([](auto& log) { log << "cub::CachingDeviceAllocator settings\n" diff --git a/HeterogeneousCore/CUDAUtilities/src/getCachingHostAllocator.h b/HeterogeneousCore/CUDAUtilities/src/getCachingHostAllocator.h index 6e74648696dd8..a937278be01c4 100644 --- a/HeterogeneousCore/CUDAUtilities/src/getCachingHostAllocator.h +++ b/HeterogeneousCore/CUDAUtilities/src/getCachingHostAllocator.h @@ -4,9 +4,11 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/thread_safety_macros.h" #include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h" -#include "CachingHostAllocator.h" +#include "HeterogeneousCore/CUDAUtilities/interface/cachingAllocators.h" -#include "getCachingDeviceAllocator.h" +#include "CachingDeviceAllocator.h" +#include "CachingHostAllocator.h" +#include "cachingAllocatorCommon.h" #include diff --git a/HeterogeneousCore/CUDAUtilities/test/radixSort_t.cu b/HeterogeneousCore/CUDAUtilities/test/radixSort_t.cu index e96a9d8eae83b..209ce97347e25 100644 --- a/HeterogeneousCore/CUDAUtilities/test/radixSort_t.cu +++ b/HeterogeneousCore/CUDAUtilities/test/radixSort_t.cu @@ -1,12 +1,14 @@ #include #include #include +#include #include #include #include #include #include #include +#include #include "HeterogeneousCore/CUDAUtilities/interface/device_unique_ptr.h" #include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h" @@ -32,6 +34,50 @@ struct RS { static constexpr int imax = std::numeric_limits::max(); }; +// A templated unsigned integer type with N bytes +template +struct uintN; + +template <> +struct uintN<8> { + using type = uint8_t; +}; + +template <> +struct uintN<16> { + using type = uint16_t; +}; + +template <> +struct uintN<32> { + using type = uint32_t; +}; + +template <> +struct uintN<64> { + using type = uint64_t; +}; + +template +using uintN_t = typename uintN::type; + +// A templated unsigned integer type with the same size as T +template +using uintT_t = uintN_t; + +// Keep only the `N` most significant bytes of `t`, and set the others to zero +template > +void truncate(T& t) { + const int shift = 8 * (sizeof(T) - N); + union { + T t; + uintT_t u; + } c; + c.t = t; + c.u = c.u >> shift << shift; + t = c.t; +} + template void go(bool useShared) { std::mt19937 eng; @@ -100,7 +146,7 @@ void go(bool useShared) { cudaCheck(cudaMemcpy(off_d.get(), offsets, 4 * (blocks + 1), cudaMemcpyHostToDevice)); if (i < 2) - std::cout << "lauch for " << offsets[blocks] << std::endl; + std::cout << "launch for " << offsets[blocks] << std::endl; auto ntXBl __attribute__((unused)) = 1 == i % 4 ? 256 : 256; @@ -138,14 +184,8 @@ void go(bool useShared) { auto a = v + offsets[ib]; auto k1 = a[ind[j]]; auto k2 = a[ind[j - 1]]; - auto sh = sizeof(uint64_t) - NS; - sh *= 8; - auto shorten = [sh](T& t) { - auto k = (uint64_t*)(&t); - *k = (*k >> sh) << sh; - }; - shorten(k1); - shorten(k2); + truncate(k1); + truncate(k2); if (k1 < k2) std::cout << ib << " not ordered at " << ind[j] << " : " << a[ind[j]] << ' ' << a[ind[j - 1]] << std::endl; } diff --git a/IOMC/EventVertexGenerators/test/BuildFile.xml b/IOMC/EventVertexGenerators/test/BuildFile.xml index ae538e4126d8e..d0e3d4cfa3028 100644 --- a/IOMC/EventVertexGenerators/test/BuildFile.xml +++ b/IOMC/EventVertexGenerators/test/BuildFile.xml @@ -1,11 +1,11 @@ + - diff --git a/IOMC/RandomEngine/src/TRandomAdaptor.h b/IOMC/RandomEngine/interface/TRandomAdaptor.h similarity index 100% rename from IOMC/RandomEngine/src/TRandomAdaptor.h rename to IOMC/RandomEngine/interface/TRandomAdaptor.h diff --git a/IOMC/RandomEngine/src/RandomNumberGeneratorService.cc b/IOMC/RandomEngine/src/RandomNumberGeneratorService.cc index 49017f5bcead9..f1843a0b59528 100644 --- a/IOMC/RandomEngine/src/RandomNumberGeneratorService.cc +++ b/IOMC/RandomEngine/src/RandomNumberGeneratorService.cc @@ -34,7 +34,7 @@ #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Utilities/interface/LuminosityBlockIndex.h" #include "FWCore/Utilities/interface/StreamID.h" -#include "IOMC/RandomEngine/src/TRandomAdaptor.h" +#include "IOMC/RandomEngine/interface/TRandomAdaptor.h" #include "SimDataFormats/RandomEngine/interface/RandomEngineState.h" #include "SimDataFormats/RandomEngine/interface/RandomEngineStates.h" diff --git a/IOMC/RandomEngine/src/TRandomAdaptor.cc b/IOMC/RandomEngine/src/TRandomAdaptor.cc index 719fe277f4773..2910610de5ca8 100644 --- a/IOMC/RandomEngine/src/TRandomAdaptor.cc +++ b/IOMC/RandomEngine/src/TRandomAdaptor.cc @@ -1,4 +1,4 @@ -#include "IOMC/RandomEngine/src/TRandomAdaptor.h" +#include "IOMC/RandomEngine/interface/TRandomAdaptor.h" #include "FWCore/Utilities/interface/EDMException.h" #include "CLHEP/Random/engineIDulong.h" diff --git a/IOMC/RandomEngine/test/TestRandomNumberServiceGlobal.cc b/IOMC/RandomEngine/test/TestRandomNumberServiceGlobal.cc index f13ec96c6419e..32a77d519a6f6 100644 --- a/IOMC/RandomEngine/test/TestRandomNumberServiceGlobal.cc +++ b/IOMC/RandomEngine/test/TestRandomNumberServiceGlobal.cc @@ -65,7 +65,7 @@ the text file containing the states. #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Utilities/interface/RandomNumberGenerator.h" #include "FWCore/Utilities/interface/propagate_const.h" -#include "IOMC/RandomEngine/src/TRandomAdaptor.h" +#include "IOMC/RandomEngine/interface/TRandomAdaptor.h" #include "CLHEP/Random/RandExponential.h" #include "CLHEP/Random/RandomEngine.h" diff --git a/IOPool/Common/bin/EdmCopyUtil.cpp b/IOPool/Common/bin/EdmCopyUtil.cpp index e8eb3d10758a4..f04e2cf988234 100644 --- a/IOPool/Common/bin/EdmCopyUtil.cpp +++ b/IOPool/Common/bin/EdmCopyUtil.cpp @@ -14,18 +14,13 @@ #include "Utilities/StorageFactory/interface/Storage.h" #include "Utilities/StorageFactory/interface/StorageFactory.h" #include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" -#include "FWCore/Services/src/SiteLocalConfigService.h" +#include "FWCore/Services/interface/setupSiteLocalConfig.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Catalog/interface/InputFileCatalog.h" #include "FWCore/Catalog/interface/SiteLocalConfig.h" static int copy_files(const boost::program_options::variables_map& vm) { - std::unique_ptr slcptr = - std::make_unique(edm::ParameterSet()); - auto slc = std::make_shared >(std::move(slcptr)); - edm::ServiceToken slcToken = edm::ServiceRegistry::createContaining(slc); - edm::ServiceRegistry::Operate operate(slcToken); + auto operate = edm::setupSiteLocalConfig(); auto in = (vm.count("file") ? vm["file"].as >() : std::vector()); diff --git a/IOPool/Common/bin/EdmFileUtil.cpp b/IOPool/Common/bin/EdmFileUtil.cpp index 697326b61f335..964e89cd844a2 100644 --- a/IOPool/Common/bin/EdmFileUtil.cpp +++ b/IOPool/Common/bin/EdmFileUtil.cpp @@ -17,7 +17,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/PluginManager/interface/PluginManager.h" #include "FWCore/PluginManager/interface/standard.h" -#include "FWCore/Services/src/SiteLocalConfigService.h" +#include "FWCore/Services/interface/setupSiteLocalConfig.h" #include "FWCore/Utilities/interface/Adler32Calculator.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" @@ -76,11 +76,7 @@ int main(int argc, char* argv[]) { int rc = 0; try { - std::unique_ptr slcptr = - std::make_unique(edm::ParameterSet()); - auto slc = std::make_shared >(std::move(slcptr)); - edm::ServiceToken slcToken = edm::ServiceRegistry::createContaining(slc); - edm::ServiceRegistry::Operate operate(slcToken); + auto operate = edm::setupSiteLocalConfig(); std::vector in = (vm.count("file") ? vm["file"].as >() : std::vector()); diff --git a/IOPool/Common/bin/EdmProvDump.cc b/IOPool/Common/bin/EdmProvDump.cc index 3cc9fb487cce3..e837709b8cfea 100644 --- a/IOPool/Common/bin/EdmProvDump.cc +++ b/IOPool/Common/bin/EdmProvDump.cc @@ -13,8 +13,7 @@ #include "FWCore/Catalog/interface/InputFileCatalog.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/Registry.h" -#include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" -#include "FWCore/Services/src/SiteLocalConfigService.h" +#include "FWCore/Services/interface/setupSiteLocalConfig.h" #include "FWCore/Utilities/interface/Algorithms.h" #include "FWCore/Utilities/interface/Exception.h" @@ -333,11 +332,7 @@ void HistoryNode::printTopLevelPSetsHistory(ParameterSetMap const& iPSM, namespace { std::unique_ptr makeTFileWithLookup(std::string const& filename) { // See if it is a logical file name. - std::unique_ptr slcptr = - std::make_unique(edm::ParameterSet()); - auto slc = std::make_shared>(std::move(slcptr)); - edm::ServiceToken slcToken = edm::ServiceRegistry::createContaining(slc); - edm::ServiceRegistry::Operate operate(slcToken); + auto operate = edm::setupSiteLocalConfig(); std::string override; std::vector fileNames; fileNames.push_back(filename); diff --git a/IOPool/Input/src/PoolSource.cc b/IOPool/Input/src/PoolSource.cc index 052b77f184a20..033c0bede04dd 100644 --- a/IOPool/Input/src/PoolSource.cc +++ b/IOPool/Input/src/PoolSource.cc @@ -14,8 +14,8 @@ #include "FWCore/Framework/interface/FileBlock.h" #include "FWCore/Framework/interface/InputSourceDescription.h" #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" -#include "FWCore/Framework/src/SharedResourcesRegistry.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/SharedResourcesRegistry.h" #include "FWCore/Framework/interface/SharedResourcesAcquirer.h" #include "FWCore/Framework/interface/RunPrincipal.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" diff --git a/IOPool/Input/src/RootDelayedReader.cc b/IOPool/Input/src/RootDelayedReader.cc index c10eea97cf315..37ec63f105cfd 100644 --- a/IOPool/Input/src/RootDelayedReader.cc +++ b/IOPool/Input/src/RootDelayedReader.cc @@ -7,7 +7,7 @@ #include "DataFormats/Common/interface/RefCoreStreamer.h" #include "FWCore/Framework/interface/SharedResourcesAcquirer.h" -#include "FWCore/Framework/src/SharedResourcesRegistry.h" +#include "FWCore/Framework/interface/SharedResourcesRegistry.h" #include "IOPool/Common/interface/getWrapperBasePtr.h" diff --git a/IOPool/Input/src/RootFile.cc b/IOPool/Input/src/RootFile.cc index 8d65a460884a4..e1ea9ed283c0e 100644 --- a/IOPool/Input/src/RootFile.cc +++ b/IOPool/Input/src/RootFile.cc @@ -32,7 +32,7 @@ #include "FWCore/Framework/interface/ProcessBlockPrincipal.h" #include "FWCore/Framework/interface/RunPrincipal.h" #include "FWCore/Framework/interface/SharedResourcesAcquirer.h" -#include "FWCore/Framework/src/SharedResourcesRegistry.h" +#include "FWCore/Framework/interface/SharedResourcesRegistry.h" #include "FWCore/Framework/interface/DelayedReader.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" diff --git a/IOPool/SecondaryInput/test/SecondaryProducer.cc b/IOPool/SecondaryInput/test/SecondaryProducer.cc index 47b49d57a8123..c2ef4d80fa17c 100644 --- a/IOPool/SecondaryInput/test/SecondaryProducer.cc +++ b/IOPool/SecondaryInput/test/SecondaryProducer.cc @@ -20,7 +20,7 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "DataFormats/Provenance/interface/BranchIDListHelper.h" #include "DataFormats/Provenance/interface/ModuleDescription.h" -#include "FWCore/Framework/src/SignallingProductRegistry.h" +#include "FWCore/Framework/interface/SignallingProductRegistry.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h" #include "FWCore/ServiceRegistry/interface/Service.h" diff --git a/IOPool/Streamer/test/ReadStreamerFile.cpp b/IOPool/Streamer/test/ReadStreamerFile.cpp index 9ac834fecb95b..d9dcf17fbcc99 100644 --- a/IOPool/Streamer/test/ReadStreamerFile.cpp +++ b/IOPool/Streamer/test/ReadStreamerFile.cpp @@ -33,7 +33,7 @@ Disclaimer: Most of the code here is randomly written during #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/PluginManager/interface/PluginManager.h" #include "FWCore/PluginManager/interface/standard.h" -#include "FWCore/Services/src/SiteLocalConfigService.h" +#include "FWCore/Services/interface/setupSiteLocalConfig.h" #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" #include @@ -71,11 +71,7 @@ int readSingleStream(bool verbose) { int readMultipleStreams(bool verbose) { try { - std::unique_ptr slcptr = - std::make_unique(edm::ParameterSet()); - auto slc = std::make_shared >(std::move(slcptr)); - edm::ServiceToken slcToken = edm::ServiceRegistry::createContaining(slc); - edm::ServiceRegistry::Operate operate(slcToken); + auto operate = edm::setupSiteLocalConfig(); int evCount = 0; std::vector streamFiles; @@ -122,11 +118,7 @@ int readMultipleStreams(bool verbose) { int readInvalidLFN(bool verbose) { try { - std::unique_ptr slcptr = - std::make_unique(edm::ParameterSet()); - auto slc = std::make_shared >(std::move(slcptr)); - edm::ServiceToken slcToken = edm::ServiceRegistry::createContaining(slc); - edm::ServiceRegistry::Operate operate(slcToken); + auto operate = edm::setupSiteLocalConfig(); int evCount = 0; std::vector streamFiles; diff --git a/IORawData/CSCCommissioning/src/CSCFileReader.h b/IORawData/CSCCommissioning/src/CSCFileReader.h index 79f0fac2e4be2..2a599dac02b5d 100644 --- a/IORawData/CSCCommissioning/src/CSCFileReader.h +++ b/IORawData/CSCCommissioning/src/CSCFileReader.h @@ -2,7 +2,6 @@ #define CSCFileReader_h #include "FWCore/Framework/interface/EDProducer.h" -#include "IORawData/DTCommissioning/plugins/RawFile.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "DataFormats/Provenance/interface/EventID.h" diff --git a/L1Trigger/DTTrigger/src/DTTrigTest.cc b/L1Trigger/DTTrigger/src/DTTrigTest.cc index 99299492e4ae4..f22c326c499d8 100644 --- a/L1Trigger/DTTrigger/src/DTTrigTest.cc +++ b/L1Trigger/DTTrigger/src/DTTrigTest.cc @@ -194,11 +194,9 @@ void DTTrigTest::beginJob() { } void DTTrigTest::beginRun(const edm::Run& iRun, const edm::EventSetup& iEventSetup) { - if (!my_trig) { - my_trig->createTUs(iEventSetup); - if (my_debug) - cout << "[DTTrigTest] TU's Created" << endl; - } + my_trig->createTUs(iEventSetup); + if (my_debug) + cout << "[DTTrigTest] TU's Created" << endl; } void DTTrigTest::analyze(const Event& iEvent, const EventSetup& iEventSetup) { diff --git a/L1Trigger/L1TGEM/test/BuildFile.xml b/L1Trigger/L1TGEM/test/BuildFile.xml index 30c126414009d..fc512bbf34a72 100644 --- a/L1Trigger/L1TGEM/test/BuildFile.xml +++ b/L1Trigger/L1TGEM/test/BuildFile.xml @@ -1,7 +1,3 @@ - - - - diff --git a/L1Trigger/L1THGCal/BuildFile.xml b/L1Trigger/L1THGCal/BuildFile.xml index 53a2755c0e367..1e9dbfa2bc3a8 100644 --- a/L1Trigger/L1THGCal/BuildFile.xml +++ b/L1Trigger/L1THGCal/BuildFile.xml @@ -6,6 +6,7 @@ + diff --git a/L1Trigger/L1THGCal/interface/HGCalCoarseTriggerCellMapping.h b/L1Trigger/L1THGCal/interface/HGCalCoarseTriggerCellMapping.h index 44631088f7b87..5dfc93cc5ef96 100644 --- a/L1Trigger/L1THGCal/interface/HGCalCoarseTriggerCellMapping.h +++ b/L1Trigger/L1THGCal/interface/HGCalCoarseTriggerCellMapping.h @@ -24,28 +24,22 @@ class HGCalCoarseTriggerCellMapping { private: static const std::map kSplit_; - static const std::map kSplit_v9_; - static const std::map kSplit_v9_Scin_; - static constexpr int kSTCidMaskInv_ = ~0x3f; - static constexpr int kSTCidMaskInv_v9_ = ~0xf; - static constexpr int kSplit_v8_Coarse_ = 0x30; - static constexpr int kSplit_v8_Mid_ = 0x38; - static constexpr int kSplit_v8_Fine_ = 0x3a; - static constexpr int kSplit_v8_VeryFine_ = 0x3e; - static constexpr int kSplit_v8_Individual_ = 0x3f; + static const std::map kSplit_Scin_; + static constexpr int kSTCidMaskInv_ = ~0xf; static constexpr int kNThicknesses_ = 4; static constexpr int kNHGCalLayersMax_ = 52; - static constexpr int kSplit_v9_Coarse_ = 0; - static constexpr int kSplit_v9_Mid_ = 0x2; - static constexpr int kSplit_v9_Fine_ = 0xa; - static constexpr int kSplit_v9_VeryFine_ = 0xb; - static constexpr int kSplit_v9_Individual_ = 0xf; - static constexpr int kSplit_v9_Scin_Coarse_ = 0x1f9fc; - static constexpr int kSplit_v9_Scin_Mid_ = 0x1fdfc; - static constexpr int kSplit_v9_Scin_Fine_ = 0x1fdfe; - static constexpr int kSplit_v9_Scin_VeryFine_ = 0x1fffe; - static constexpr int kSplit_v9_Scin_Individual_ = 0x1ffff; + static constexpr int kSplit_Coarse_ = 0; + static constexpr int kSplit_Mid_ = 0x2; + static constexpr int kSplit_Fine_ = 0xa; + static constexpr int kSplit_VeryFine_ = 0xb; + static constexpr int kSplit_Individual_ = 0xf; + + static constexpr int kSplit_Scin_Coarse_ = 0x1f9fc; + static constexpr int kSplit_Scin_Mid_ = 0x1fdfc; + static constexpr int kSplit_Scin_Fine_ = 0x1fdfe; + static constexpr int kSplit_Scin_VeryFine_ = 0x1fffe; + static constexpr int kSplit_Scin_Individual_ = 0x1ffff; //For coarse TCs static constexpr int kRocShift_ = 4; @@ -56,7 +50,7 @@ class HGCalCoarseTriggerCellMapping { static constexpr int kVShift_ = 0; static constexpr int kUMask_ = 0x3; static constexpr int kVMask_ = 0x3; - static constexpr int kHGCalCellMaskV9Inv_ = ~0xff; + static constexpr int kHGCalCellMaskInv_ = ~0xff; static constexpr int kHGCalScinCellMaskInv_ = ~0x1ffff; static constexpr int kRoc0deg_ = 1; diff --git a/L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h b/L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h index 533c6a26f7e8a..6f4ba1c4f4331 100644 --- a/L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h +++ b/L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h @@ -8,11 +8,8 @@ #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/CaloTopology/interface/HGCalTopology.h" #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" -#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" // Pure virtual trigger geometry class // Provides the interface to access trigger cell and module mappings @@ -27,51 +24,22 @@ class HGCalTriggerGeometryBase { const std::string& name() const { return name_; } - bool isV9Geometry() const { return !calo_geometry_; } bool isWithNoseGeometry() const { return isNose_; } - const CaloGeometry* caloGeometry() const { return calo_geometry_; } - - const HGCalGeometry* noseGeometry() const { - return (hgc_nose_geometry_ - ? hgc_nose_geometry_ - : (static_cast(calo_geometry_->getSubdetectorGeometry(DetId::Forward, HFNose)))); - } - - const HGCalGeometry* eeGeometry() const { - return (hgc_ee_geometry_ - ? hgc_ee_geometry_ - : (static_cast(calo_geometry_->getSubdetectorGeometry(DetId::Forward, HGCEE)))); - } - const HGCalGeometry* fhGeometry() const { - return (hgc_hsi_geometry_ - ? hgc_hsi_geometry_ - : (static_cast(calo_geometry_->getSubdetectorGeometry(DetId::Forward, HGCHEF)))); - } - const HcalGeometry* bhGeometry() const { - if (hgc_hsc_geometry_) { - throw cms::Exception("HGCalTriggerGeometry") << "bhGeometry cannot be used with the V9 geometry"; - } - return (static_cast(calo_geometry_->getSubdetectorGeometry(DetId::Hcal, HcalEndcap))); - } + const HGCalGeometry* noseGeometry() const { return hgc_nose_geometry_; } + const HGCalGeometry* eeGeometry() const { return hgc_ee_geometry_; } + const HGCalGeometry* fhGeometry() const { return hgc_hsi_geometry_; } const HGCalGeometry* hsiGeometry() const { return fhGeometry(); } - const HGCalGeometry* hscGeometry() const { - if (!hgc_hsc_geometry_) { - throw cms::Exception("HGCalTriggerGeometry") << "hscGeometry cannot be used with the V7 and V8 geometries"; - } - return hgc_hsc_geometry_; - } + const HGCalGeometry* hscGeometry() const { return hgc_hsc_geometry_; } const HGCalTopology& noseTopology() const { return noseGeometry()->topology(); } const HGCalTopology& eeTopology() const { return eeGeometry()->topology(); } const HGCalTopology& fhTopology() const { return fhGeometry()->topology(); } - const HcalTopology& bhTopology() const { return bhGeometry()->topology(); } const HGCalTopology& hsiTopology() const { return hsiGeometry()->topology(); } const HGCalTopology& hscTopology() const { return hscGeometry()->topology(); } void setWithNoseGeometry(const bool isNose) { isNose_ = isNose; } // non-const access to the geometry class - virtual void initialize(const CaloGeometry*) = 0; virtual void initialize(const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*) = 0; virtual void initialize(const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*) = 0; virtual void reset(); @@ -85,6 +53,19 @@ class HGCalTriggerGeometryBase { virtual geom_set getCellsFromModule(const unsigned cell_det_id) const = 0; virtual geom_set getTriggerCellsFromModule(const unsigned trigger_cell_det_id) const = 0; + virtual geom_set getStage1FpgasFromStage2Fpga(const unsigned stage2_id) const = 0; + virtual geom_set getStage2FpgasFromStage1Fpga(const unsigned stage1_id) const = 0; + + virtual geom_set getStage1LinksFromStage2Fpga(const unsigned) const = 0; + virtual unsigned getStage1FpgaFromStage1Link(const unsigned) const = 0; + virtual unsigned getStage2FpgaFromStage1Link(const unsigned) const = 0; + virtual geom_set getStage1LinksFromStage1Fpga(const unsigned) const = 0; + virtual geom_set getLpgbtsFromStage1Fpga(const unsigned stage1_id) const = 0; + virtual unsigned getStage1FpgaFromLpgbt(const unsigned lpgbt_id) const = 0; + virtual geom_set getModulesFromLpgbt(const unsigned lpgbt_id) const = 0; + virtual geom_set getLpgbtsFromModule(const unsigned module_id) const = 0; + virtual unsigned getStage1FpgaFromModule(const unsigned module_id) const = 0; + virtual geom_ordered_set getOrderedCellsFromModule(const unsigned cell_det_id) const = 0; virtual geom_ordered_set getOrderedTriggerCellsFromModule(const unsigned trigger_cell_det_id) const = 0; @@ -103,7 +84,6 @@ class HGCalTriggerGeometryBase { virtual unsigned triggerLayer(const unsigned id) const = 0; protected: - void setCaloGeometry(const CaloGeometry* geom) { calo_geometry_ = geom; } void setEEGeometry(const HGCalGeometry* geom) { hgc_ee_geometry_ = geom; } void setHSiGeometry(const HGCalGeometry* geom) { hgc_hsi_geometry_ = geom; } void setHScGeometry(const HGCalGeometry* geom) { hgc_hsc_geometry_ = geom; } @@ -113,7 +93,6 @@ class HGCalTriggerGeometryBase { const std::string name_; bool isNose_ = false; - const CaloGeometry* calo_geometry_ = nullptr; const HGCalGeometry* hgc_ee_geometry_ = nullptr; const HGCalGeometry* hgc_hsi_geometry_ = nullptr; const HGCalGeometry* hgc_hsc_geometry_ = nullptr; diff --git a/L1Trigger/L1THGCal/interface/HGCalTriggerTools.h b/L1Trigger/L1THGCal/interface/HGCalTriggerTools.h index ceb9c1a9b354d..239d65ddde182 100644 --- a/L1Trigger/L1THGCal/interface/HGCalTriggerTools.h +++ b/L1Trigger/L1THGCal/interface/HGCalTriggerTools.h @@ -21,7 +21,6 @@ #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" -#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" #include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h" namespace edm { @@ -46,10 +45,7 @@ class HGCalTriggerTools { bool isScintillator(const DetId& id) const { return !isSilicon(id); } bool isNose(const DetId&) const; int zside(const DetId&) const; - // tc argument is needed because of the impossibility - // to know whether the ID is a TC or a sensor cell - // in the v8 geometry detid scheme - int thicknessIndex(const DetId&, bool tc = false) const; + int thicknessIndex(const DetId&) const; unsigned lastLayerEE(bool nose = false) const { return (nose ? HFNoseDetId::HFNoseLayerEEmax : eeLayers_); } unsigned lastLayerFH() const { return eeLayers_ + fhLayers_; } @@ -81,7 +77,6 @@ class HGCalTriggerTools { } DetId simToReco(const DetId&, const HGCalTopology&) const; - DetId simToReco(const DetId&, const HcalTopology&) const; unsigned triggerLayer(const unsigned id) const { return geom_->triggerLayer(id); } static constexpr unsigned kScintillatorPseudoThicknessIndex_ = 3; @@ -100,8 +95,6 @@ class HGCalTriggerTools { unsigned bhLayers_; unsigned noseLayers_; unsigned totalLayers_; - - int sensorCellThicknessV8(const DetId& id) const; }; #endif diff --git a/L1Trigger/L1THGCal/plugins/HGCalTriggerGeometryESProducer.cc b/L1Trigger/L1THGCal/plugins/HGCalTriggerGeometryESProducer.cc index 2887b7772d90f..918b12179a04e 100644 --- a/L1Trigger/L1THGCal/plugins/HGCalTriggerGeometryESProducer.cc +++ b/L1Trigger/L1THGCal/plugins/HGCalTriggerGeometryESProducer.cc @@ -21,7 +21,6 @@ class HGCalTriggerGeometryESProducer : public edm::ESProducer { private: edm::ParameterSet geometry_config_; std::string geometry_name_; - edm::ESGetToken calo_geometry_token_; edm::ESGetToken ee_geometry_token_; edm::ESGetToken hsi_geometry_token_; edm::ESGetToken hsc_geometry_token_; @@ -31,17 +30,12 @@ class HGCalTriggerGeometryESProducer : public edm::ESProducer { HGCalTriggerGeometryESProducer::HGCalTriggerGeometryESProducer(const edm::ParameterSet& iConfig) : geometry_config_(iConfig.getParameterSet("TriggerGeometry")), - geometry_name_(geometry_config_.getParameter("TriggerGeometryName")), - isV9Geometry_(iConfig.getParameter("isV9Geometry")) { + geometry_name_(geometry_config_.getParameter("TriggerGeometryName")) { auto cc = setWhatProduced(this); - if (isV9Geometry_) { - ee_geometry_token_ = cc.consumes(edm::ESInputTag{"", "HGCalEESensitive"}); - hsi_geometry_token_ = cc.consumes(edm::ESInputTag{"", "HGCalHESiliconSensitive"}); - hsc_geometry_token_ = cc.consumes(edm::ESInputTag{"", "HGCalHEScintillatorSensitive"}); - nose_geometry_token_ = cc.consumes(edm::ESInputTag{"", "HGCalHFNoseSensitive"}); - } else { - calo_geometry_token_ = cc.consumes(); - } + ee_geometry_token_ = cc.consumes(edm::ESInputTag{"", "HGCalEESensitive"}); + hsi_geometry_token_ = cc.consumes(edm::ESInputTag{"", "HGCalHESiliconSensitive"}); + hsc_geometry_token_ = cc.consumes(edm::ESInputTag{"", "HGCalHEScintillatorSensitive"}); + nose_geometry_token_ = cc.consumes(edm::ESInputTag{"", "HGCalHFNoseSensitive"}); } HGCalTriggerGeometryESProducer::~HGCalTriggerGeometryESProducer() { @@ -50,32 +44,18 @@ HGCalTriggerGeometryESProducer::~HGCalTriggerGeometryESProducer() { } HGCalTriggerGeometryESProducer::ReturnType HGCalTriggerGeometryESProducer::produce(const CaloGeometryRecord& iRecord) { - // using namespace edm::es; ReturnType geometry(HGCalTriggerGeometryFactory::get()->create(geometry_name_, geometry_config_)); - if (isV9Geometry_) { - // Initialize trigger geometry for V9 HGCAL geometry - - if (iRecord.getHandle(nose_geometry_token_)) { - geometry->setWithNoseGeometry(true); - geometry->initialize(&iRecord.get(ee_geometry_token_), - &iRecord.get(hsi_geometry_token_), - &iRecord.get(hsc_geometry_token_), - &iRecord.get(nose_geometry_token_)); - } else { - geometry->initialize( - &iRecord.get(ee_geometry_token_), &iRecord.get(hsi_geometry_token_), &iRecord.get(hsc_geometry_token_)); - } + // Initialization with or without nose geometry + if (iRecord.getHandle(nose_geometry_token_)) { + geometry->setWithNoseGeometry(true); + geometry->initialize(&iRecord.get(ee_geometry_token_), + &iRecord.get(hsi_geometry_token_), + &iRecord.get(hsc_geometry_token_), + &iRecord.get(nose_geometry_token_)); } else { - // Initialize trigger geometry for V7/V8 HGCAL geometry - const auto& calo_geometry = iRecord.get(calo_geometry_token_); - if (not(calo_geometry.getSubdetectorGeometry(DetId::Forward, HGCEE) && - calo_geometry.getSubdetectorGeometry(DetId::Forward, HGCHEF) && - calo_geometry.getSubdetectorGeometry(DetId::Hcal, HcalEndcap))) { - throw cms::Exception("LogicError") - << "Configuration asked for non-V9 geometry, but the CaloGeometry does not look like one"; - } - geometry->initialize(&calo_geometry); + geometry->initialize( + &iRecord.get(ee_geometry_token_), &iRecord.get(hsi_geometry_token_), &iRecord.get(hsc_geometry_token_)); } return geometry; } diff --git a/L1Trigger/L1THGCal/plugins/concentrator/HGCalConcentratorProcessorSelection.cc b/L1Trigger/L1THGCal/plugins/concentrator/HGCalConcentratorProcessorSelection.cc index 60a3a6b0fcf5e..b56a0948d3eb3 100644 --- a/L1Trigger/L1THGCal/plugins/concentrator/HGCalConcentratorProcessorSelection.cc +++ b/L1Trigger/L1THGCal/plugins/concentrator/HGCalConcentratorProcessorSelection.cc @@ -90,7 +90,7 @@ void HGCalConcentratorProcessorSelection::run(const edm::Handle trigSumsVecOutput; std::vector ae_EncodedLayerOutput; - int thickness = triggerTools_.thicknessIndex(module_trigcell.second.at(0).detId(), true); + int thickness = triggerTools_.thicknessIndex(module_trigcell.second.at(0).detId()); HGCalTriggerTools::SubDetectorType subdet = triggerTools_.getSubDetectorType(module_trigcell.second.at(0).detId()); diff --git a/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryHexLayerBasedImp1.cc b/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryHexLayerBasedImp1.cc deleted file mode 100644 index 1c4cba6969393..0000000000000 --- a/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryHexLayerBasedImp1.cc +++ /dev/null @@ -1,790 +0,0 @@ -#include "FWCore/ParameterSet/interface/FileInPath.h" - -#include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" -#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h" - -#include -#include -#include -#include - -class HGCalTriggerGeometryHexLayerBasedImp1 : public HGCalTriggerGeometryBase { -public: - HGCalTriggerGeometryHexLayerBasedImp1(const edm::ParameterSet& conf); - - void initialize(const CaloGeometry*) final; - void initialize(const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*) final; - void initialize(const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*) final; - void reset() final; - - unsigned getTriggerCellFromCell(const unsigned) const final; - unsigned getModuleFromCell(const unsigned) const final; - unsigned getModuleFromTriggerCell(const unsigned) const final; - - geom_set getCellsFromTriggerCell(const unsigned) const final; - geom_set getCellsFromModule(const unsigned) const final; - geom_set getTriggerCellsFromModule(const unsigned) const final; - - geom_ordered_set getOrderedCellsFromModule(const unsigned) const final; - geom_ordered_set getOrderedTriggerCellsFromModule(const unsigned) const final; - - geom_set getNeighborsFromTriggerCell(const unsigned) const final; - - unsigned getLinksInModule(const unsigned module_id) const final; - unsigned getModuleSize(const unsigned module_id) const final; - - GlobalPoint getTriggerCellPosition(const unsigned) const final; - GlobalPoint getModulePosition(const unsigned) const final; - - bool validCell(const unsigned) const final; - bool validTriggerCell(const unsigned) const final; - bool disconnectedModule(const unsigned) const final; - unsigned lastTriggerLayer() const final { return last_trigger_layer_; } - unsigned triggerLayer(const unsigned) const final; - -private: - edm::FileInPath l1tCellsMapping_; - edm::FileInPath l1tCellsBHMapping_; - edm::FileInPath l1tModulesMapping_; - edm::FileInPath l1tCellNeighborsMapping_; - edm::FileInPath l1tCellNeighborsBHMapping_; - - // module related maps - std::unordered_map wafer_to_module_; - std::unordered_multimap module_to_wafers_; - - // trigger cell related maps - std::unordered_map cells_to_trigger_cells_; - std::unordered_multimap trigger_cells_to_cells_; - std::unordered_map cells_to_trigger_cells_bh_; - std::unordered_multimap trigger_cells_to_cells_bh_; - std::unordered_map number_trigger_cells_in_wafers_; - std::unordered_map number_trigger_cells_in_wafers_bh_; - std::unordered_set invalid_triggercells_; - - // neighbor related maps - // trigger cell neighbors: - // - The key includes the module and trigger cell id - // - The value is a set of (module_id, trigger_cell_id) - std::unordered_map>> trigger_cell_neighbors_; - std::unordered_map>> trigger_cell_neighbors_bh_; - - // Disconnected modules and layers - std::unordered_set disconnected_modules_; - std::unordered_set disconnected_layers_; - std::vector trigger_layers_; - unsigned last_trigger_layer_ = 0; - - // layer offsets - unsigned fhOffset_ = 0; - unsigned bhOffset_ = 0; - unsigned totalLayers_ = 0; - - void fillMaps(); - void fillNeighborMaps(const edm::FileInPath&, std::unordered_map>>&); - void fillInvalidTriggerCells(); - unsigned packTriggerCell(unsigned, unsigned) const; - bool validCellId(unsigned subdet, unsigned cell_id) const; - bool validTriggerCellFromCells(const unsigned) const; - - // returns transverse wafer type: -1=coarse, 1=fine, 0=undefined - int detIdWaferType(unsigned subdet, short wafer) const; - unsigned packWaferCellId(unsigned subdet, unsigned wafer, unsigned cell) const; - unsigned packIetaIphi(unsigned ieta, unsigned iphi) const; - void unpackWaferCellId(unsigned wafer_cell, unsigned& wafer, unsigned& cell) const; - void unpackIetaIphi(unsigned ieta_iphi, unsigned& ieta, unsigned& iphi) const; - - unsigned layerWithOffset(unsigned) const; -}; - -HGCalTriggerGeometryHexLayerBasedImp1::HGCalTriggerGeometryHexLayerBasedImp1(const edm::ParameterSet& conf) - : HGCalTriggerGeometryBase(conf), - l1tCellsMapping_(conf.getParameter("L1TCellsMapping")), - l1tCellsBHMapping_(conf.getParameter("L1TCellsBHMapping")), - l1tModulesMapping_(conf.getParameter("L1TModulesMapping")), - l1tCellNeighborsMapping_(conf.getParameter("L1TCellNeighborsMapping")), - l1tCellNeighborsBHMapping_(conf.getParameter("L1TCellNeighborsBHMapping")) { - std::vector tmp_vector = conf.getParameter>("DisconnectedModules"); - std::move(tmp_vector.begin(), tmp_vector.end(), std::inserter(disconnected_modules_, disconnected_modules_.end())); - tmp_vector = conf.getParameter>("DisconnectedLayers"); - std::move(tmp_vector.begin(), tmp_vector.end(), std::inserter(disconnected_layers_, disconnected_layers_.end())); -} - -void HGCalTriggerGeometryHexLayerBasedImp1::reset() { - cells_to_trigger_cells_.clear(); - trigger_cells_to_cells_.clear(); - cells_to_trigger_cells_bh_.clear(); - trigger_cells_to_cells_bh_.clear(); - wafer_to_module_.clear(); - module_to_wafers_.clear(); - number_trigger_cells_in_wafers_.clear(); - number_trigger_cells_in_wafers_bh_.clear(); - trigger_cell_neighbors_.clear(); - trigger_cell_neighbors_bh_.clear(); -} - -void HGCalTriggerGeometryHexLayerBasedImp1::initialize(const CaloGeometry* calo_geometry) { - setCaloGeometry(calo_geometry); - fhOffset_ = eeTopology().dddConstants().layers(true); - bhOffset_ = fhOffset_ + fhTopology().dddConstants().layers(true); - totalLayers_ = bhOffset_ + bhTopology().dddConstants()->getMaxDepth(1); - trigger_layers_.resize(totalLayers_ + 1); - trigger_layers_[0] = 0; // layer number 0 doesn't exist - unsigned trigger_layer = 1; - for (unsigned layer = 1; layer < trigger_layers_.size(); layer++) { - if (disconnected_layers_.find(layer) == disconnected_layers_.end()) { - // Increase trigger layer number if the layer is not disconnected - trigger_layers_[layer] = trigger_layer; - trigger_layer++; - } else { - trigger_layers_[layer] = 0; - } - } - last_trigger_layer_ = trigger_layer - 1; - fillMaps(); - fillNeighborMaps(l1tCellNeighborsMapping_, trigger_cell_neighbors_); - fillNeighborMaps(l1tCellNeighborsBHMapping_, trigger_cell_neighbors_bh_); - fillInvalidTriggerCells(); -} - -void HGCalTriggerGeometryHexLayerBasedImp1::initialize(const HGCalGeometry* hgc_ee_geometry, - const HGCalGeometry* hgc_hsi_geometry, - const HGCalGeometry* hgc_hsc_geometry) { - throw cms::Exception("BadGeometry") - << "HGCalTriggerGeometryHexLayerBasedImp1 geometry cannot be initialized with the V9 HGCAL geometry"; -} - -void HGCalTriggerGeometryHexLayerBasedImp1::initialize(const HGCalGeometry* hgc_ee_geometry, - const HGCalGeometry* hgc_hsi_geometry, - const HGCalGeometry* hgc_hsc_geometry, - const HGCalGeometry* hgc_nose_geometry) { - throw cms::Exception("BadGeometry") - << "HGCalTriggerGeometryHexLayerBasedImp1 geometry cannot be initialized with the V9 HGCAL+Nose geometry"; -} - -unsigned HGCalTriggerGeometryHexLayerBasedImp1::getTriggerCellFromCell(const unsigned cell_id) const { - unsigned subdet = 0; - int zside = 0; - unsigned layer = 0; - unsigned wafer_trigger_cell = 0; - unsigned trigger_cell = 0; - // BH - if (DetId(cell_id).det() == DetId::Hcal) { - HcalDetId cell_det_id(cell_id); - if (cell_det_id.subdetId() != HcalEndcap) - return 0; - unsigned ieta = cell_det_id.ietaAbs(); - unsigned iphi = cell_det_id.iphi(); - layer = cell_det_id.depth(); - subdet = ForwardSubdetector::HGCHEB; - zside = cell_det_id.zside(); - auto trigger_cell_itr = cells_to_trigger_cells_bh_.find(packIetaIphi(ieta, iphi)); - if (trigger_cell_itr == cells_to_trigger_cells_bh_.end()) { - throw cms::Exception("BadGeometry") - << "HGCalTriggerGeometry: Hcal cell ieta=" << ieta << ", iphi=" << iphi - << " is not mapped to any trigger cell. The trigger cell mapping should be modified.\n"; - } - trigger_cell = 0; - wafer_trigger_cell = 0; - unpackWaferCellId(trigger_cell_itr->second, wafer_trigger_cell, trigger_cell); - } - // EE or FH - else if (DetId(cell_id).det() == DetId::Forward) { - HGCalDetId cell_det_id(cell_id); - subdet = cell_det_id.subdetId(); - layer = cell_det_id.layer(); - zside = cell_det_id.zside(); - unsigned wafer = cell_det_id.wafer(); - unsigned cell = cell_det_id.cell(); - auto trigger_cell_itr = cells_to_trigger_cells_.find(packWaferCellId(subdet, wafer, cell)); - if (trigger_cell_itr == cells_to_trigger_cells_.end()) { - throw cms::Exception("BadGeometry") - << "HGCalTriggerGeometry: HGCal cell " << cell << " in wafer " << wafer - << " is not mapped to any trigger cell. The trigger cell mapping should be modified.\n"; - } - trigger_cell = 0; - wafer_trigger_cell = 0; - unpackWaferCellId(trigger_cell_itr->second, wafer_trigger_cell, trigger_cell); - } - return HGCalDetId((ForwardSubdetector)subdet, zside, layer, 1, wafer_trigger_cell, trigger_cell).rawId(); -} - -unsigned HGCalTriggerGeometryHexLayerBasedImp1::getModuleFromCell(const unsigned cell_id) const { - return getModuleFromTriggerCell(getTriggerCellFromCell(cell_id)); -} - -unsigned HGCalTriggerGeometryHexLayerBasedImp1::getModuleFromTriggerCell(const unsigned trigger_cell_id) const { - HGCalDetId trigger_cell_det_id(trigger_cell_id); - unsigned module = 0; - // BH - if (trigger_cell_det_id.subdetId() == ForwardSubdetector::HGCHEB) { - // For BH, the module ID is currently encoded as the wafer in HGCalDetId - module = trigger_cell_det_id.wafer(); - } - // EE or FH - else { - auto module_itr = wafer_to_module_.find(trigger_cell_det_id.wafer()); - if (module_itr == wafer_to_module_.end()) { - throw cms::Exception("BadGeometry") - << trigger_cell_det_id << "HGCalTriggerGeometry: Wafer " << trigger_cell_det_id.wafer() - << " is not mapped to any trigger module. The module mapping should be modified. See " - "https://twiki.cern.ch/twiki/bin/viewauth/CMS/HGCALTriggerPrimitivesSimulation#Trigger_geometry for " - "details.\n"; - } - module = module_itr->second; - } - return HGCalDetId((ForwardSubdetector)trigger_cell_det_id.subdetId(), - trigger_cell_det_id.zside(), - trigger_cell_det_id.layer(), - (trigger_cell_det_id.waferType() == 1 ? 1 : 0), - module, - HGCalDetId::kHGCalCellMask) - .rawId(); -} - -HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryHexLayerBasedImp1::getCellsFromTriggerCell( - const unsigned trigger_cell_id) const { - HGCalDetId trigger_cell_det_id(trigger_cell_id); - geom_set cell_det_ids; - // BH - if (trigger_cell_det_id.subdetId() == ForwardSubdetector::HGCHEB) { - unsigned subdet = trigger_cell_det_id.subdetId(); - unsigned trigger_wafer = trigger_cell_det_id.wafer(); - unsigned trigger_cell = trigger_cell_det_id.cell(); - const auto& cell_range = - trigger_cells_to_cells_bh_.equal_range(packWaferCellId(subdet, trigger_wafer, trigger_cell)); - for (auto tc_c_itr = cell_range.first; tc_c_itr != cell_range.second; tc_c_itr++) { - unsigned ieta = 0; - unsigned iphi = 0; - unpackIetaIphi(tc_c_itr->second, ieta, iphi); - unsigned cell_det_id = - HcalDetId(HcalEndcap, trigger_cell_det_id.zside() * ieta, iphi, trigger_cell_det_id.layer()).rawId(); - if (validCellId(subdet, cell_det_id)) - cell_det_ids.emplace(cell_det_id); - } - } - // EE or FH - else { - unsigned subdet = trigger_cell_det_id.subdetId(); - unsigned trigger_wafer = trigger_cell_det_id.wafer(); - unsigned trigger_cell = trigger_cell_det_id.cell(); - const auto& cell_range = trigger_cells_to_cells_.equal_range(packWaferCellId(subdet, trigger_wafer, trigger_cell)); - for (auto tc_c_itr = cell_range.first; tc_c_itr != cell_range.second; tc_c_itr++) { - unsigned wafer = 0; - unsigned cell = 0; - unpackWaferCellId(tc_c_itr->second, wafer, cell); - unsigned wafer_type = (detIdWaferType(subdet, wafer) == 1 ? 1 : 0); - unsigned cell_det_id = HGCalDetId((ForwardSubdetector)trigger_cell_det_id.subdetId(), - trigger_cell_det_id.zside(), - trigger_cell_det_id.layer(), - wafer_type, - wafer, - cell) - .rawId(); - if (validCellId(subdet, cell_det_id)) - cell_det_ids.emplace(cell_det_id); - } - } - return cell_det_ids; -} - -HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryHexLayerBasedImp1::getCellsFromModule( - const unsigned module_id) const { - geom_set cell_det_ids; - geom_set trigger_cells = getTriggerCellsFromModule(module_id); - for (auto trigger_cell_id : trigger_cells) { - geom_set cells = getCellsFromTriggerCell(trigger_cell_id); - cell_det_ids.insert(cells.begin(), cells.end()); - } - return cell_det_ids; -} - -HGCalTriggerGeometryBase::geom_ordered_set HGCalTriggerGeometryHexLayerBasedImp1::getOrderedCellsFromModule( - const unsigned module_id) const { - geom_ordered_set cell_det_ids; - geom_ordered_set trigger_cells = getOrderedTriggerCellsFromModule(module_id); - for (auto trigger_cell_id : trigger_cells) { - geom_set cells = getCellsFromTriggerCell(trigger_cell_id); - cell_det_ids.insert(cells.begin(), cells.end()); - } - return cell_det_ids; -} - -HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryHexLayerBasedImp1::getTriggerCellsFromModule( - const unsigned module_id) const { - HGCalDetId module_det_id(module_id); - geom_set trigger_cell_det_ids; - // BH - if (module_det_id.subdetId() == ForwardSubdetector::HGCHEB) { - unsigned module = module_det_id.wafer(); - // loop on the trigger cells in each module - for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_bh_.at(module); trigger_cell++) { - HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(), - module_det_id.zside(), - module_det_id.layer(), - 1, - module, - trigger_cell); - if (validTriggerCell(trigger_cell_id)) - trigger_cell_det_ids.emplace(trigger_cell_id.rawId()); - } - } - // EE or FH - else { - unsigned module = module_det_id.wafer(); - auto wafer_itrs = module_to_wafers_.equal_range(module); - // loop on the wafers included in the module - for (auto wafer_itr = wafer_itrs.first; wafer_itr != wafer_itrs.second; wafer_itr++) { - unsigned wafer = wafer_itr->second; - // loop on the trigger cells in each wafer - for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(wafer); trigger_cell++) { - HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(), - module_det_id.zside(), - module_det_id.layer(), - 1, - wafer, - trigger_cell); - if (validTriggerCell(trigger_cell_id)) - trigger_cell_det_ids.emplace(trigger_cell_id.rawId()); - } - } - } - return trigger_cell_det_ids; -} - -HGCalTriggerGeometryBase::geom_ordered_set HGCalTriggerGeometryHexLayerBasedImp1::getOrderedTriggerCellsFromModule( - const unsigned module_id) const { - HGCalDetId module_det_id(module_id); - geom_ordered_set trigger_cell_det_ids; - // BH - if (module_det_id.subdetId() == ForwardSubdetector::HGCHEB) { - unsigned module = module_det_id.wafer(); - // loop on the trigger cells in each module - for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_bh_.at(module); trigger_cell++) { - HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(), - module_det_id.zside(), - module_det_id.layer(), - 1, - module, - trigger_cell); - if (validTriggerCell(trigger_cell_id)) - trigger_cell_det_ids.emplace(trigger_cell_id.rawId()); - } - } - // EE or FH - else { - unsigned module = module_det_id.wafer(); - auto wafer_itrs = module_to_wafers_.equal_range(module); - // loop on the wafers included in the module - for (auto wafer_itr = wafer_itrs.first; wafer_itr != wafer_itrs.second; wafer_itr++) { - unsigned wafer = wafer_itr->second; - // loop on the trigger cells in each wafer - for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(wafer); trigger_cell++) { - HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(), - module_det_id.zside(), - module_det_id.layer(), - 1, - wafer, - trigger_cell); - if (validTriggerCell(trigger_cell_id)) - trigger_cell_det_ids.emplace(trigger_cell_id.rawId()); - } - } - } - return trigger_cell_det_ids; -} - -HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryHexLayerBasedImp1::getNeighborsFromTriggerCell( - const unsigned trigger_cell_id) const { - HGCalDetId trigger_cell_det_id(trigger_cell_id); - // Choose scintillator or silicon map - const auto& neighbors_map = (trigger_cell_det_id.subdetId() == ForwardSubdetector::HGCHEB ? trigger_cell_neighbors_bh_ - : trigger_cell_neighbors_); - unsigned module = trigger_cell_det_id.wafer(); - unsigned trigger_cell = trigger_cell_det_id.cell(); - // retrieve neighbors - unsigned trigger_cell_key = packTriggerCell(module, trigger_cell); - geom_set neighbor_detids; - auto neighbors_itr = neighbors_map.find(trigger_cell_key); - if (neighbors_itr == neighbors_map.end()) { - throw cms::Exception("BadGeometry") << "HGCalTriggerGeometry: Neighbors are not defined for trigger cell " - << trigger_cell << " in module " << module - << ". The trigger cell neighbor mapping should be modified. \n"; - } - const auto& neighbors = neighbors_itr->second; - // create HGCalDetId of neighbors and check their validity - neighbor_detids.reserve(neighbors.size()); - for (const auto& module_tc : neighbors) { - HGCalDetId neighbor_det_id((ForwardSubdetector)trigger_cell_det_id.subdetId(), - trigger_cell_det_id.zside(), - trigger_cell_det_id.layer(), - 1, - module_tc.first, - module_tc.second); - if (validTriggerCell(neighbor_det_id.rawId())) { - neighbor_detids.emplace(neighbor_det_id.rawId()); - } - } - return neighbor_detids; -} - -unsigned HGCalTriggerGeometryHexLayerBasedImp1::getLinksInModule(const unsigned module_id) const { return 1; } - -unsigned HGCalTriggerGeometryHexLayerBasedImp1::getModuleSize(const unsigned module_id) const { return 1; } - -GlobalPoint HGCalTriggerGeometryHexLayerBasedImp1::getTriggerCellPosition(const unsigned trigger_cell_det_id) const { - unsigned subdet = HGCalDetId(trigger_cell_det_id).subdetId(); - // Position: barycenter of the trigger cell. - Basic3DVector triggerCellVector(0., 0., 0.); - const auto cell_ids = getCellsFromTriggerCell(trigger_cell_det_id); - // BH - if (subdet == ForwardSubdetector::HGCHEB) { - for (const auto& cell : cell_ids) { - HcalDetId cellDetId(cell); - triggerCellVector += bhGeometry()->getPosition(cellDetId).basicVector(); - } - } - // EE or FH - else { - for (const auto& cell : cell_ids) { - HGCalDetId cellDetId(cell); - triggerCellVector += (cellDetId.subdetId() == ForwardSubdetector::HGCEE ? eeGeometry()->getPosition(cellDetId) - : fhGeometry()->getPosition(cellDetId)) - .basicVector(); - } - } - return GlobalPoint(triggerCellVector / cell_ids.size()); -} - -GlobalPoint HGCalTriggerGeometryHexLayerBasedImp1::getModulePosition(const unsigned module_det_id) const { - unsigned subdet = HGCalDetId(module_det_id).subdetId(); - // Position: barycenter of the module. - Basic3DVector moduleVector(0., 0., 0.); - const auto cell_ids = getCellsFromModule(module_det_id); - // BH - if (subdet == ForwardSubdetector::HGCHEB) { - for (const auto& cell : cell_ids) { - HcalDetId cellDetId(cell); - moduleVector += bhGeometry()->getPosition(cellDetId).basicVector(); - } - } - // EE or FH - else { - for (const auto& cell : cell_ids) { - HGCalDetId cellDetId(cell); - moduleVector += (cellDetId.subdetId() == ForwardSubdetector::HGCEE ? eeGeometry()->getPosition(cellDetId) - : fhGeometry()->getPosition(cellDetId)) - .basicVector(); - } - } - return GlobalPoint(moduleVector / cell_ids.size()); -} - -void HGCalTriggerGeometryHexLayerBasedImp1::fillMaps() { - // - // read module mapping file - std::ifstream l1tModulesMappingStream(l1tModulesMapping_.fullPath()); - if (!l1tModulesMappingStream.is_open()) { - throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TModulesMapping file\n"; - } - short trigger_wafer = 0; - short module = 0; - for (; l1tModulesMappingStream >> trigger_wafer >> module;) { - wafer_to_module_.emplace(trigger_wafer, module); - module_to_wafers_.emplace(module, trigger_wafer); - // Default number of trigger cell in wafer is 0 - number_trigger_cells_in_wafers_.emplace(trigger_wafer, 0); - } - if (!l1tModulesMappingStream.eof()) - edm::LogWarning("HGCalTriggerGeometry") - << "Error reading L1TModulesMapping '" << trigger_wafer << " " << module << "' \n"; - l1tModulesMappingStream.close(); - // read trigger cell mapping file - std::ifstream l1tCellsMappingStream(l1tCellsMapping_.fullPath()); - if (!l1tCellsMappingStream.is_open()) { - throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TCellsMapping file\n"; - } - short subdet = 0; - short wafer = 0; - short cell = 0; - trigger_wafer = 0; - short trigger_cell = 0; - for (; l1tCellsMappingStream >> subdet >> wafer >> cell >> trigger_wafer >> trigger_cell;) { - unsigned cell_key = packWaferCellId(subdet, wafer, cell); - unsigned trigger_cell_key = packWaferCellId(subdet, trigger_wafer, trigger_cell); - // fill cell <-> trigger cell mappings - cells_to_trigger_cells_.emplace(cell_key, trigger_cell_key); - trigger_cells_to_cells_.emplace(trigger_cell_key, cell_key); - // fill number of trigger cells in wafers - auto itr_insert = number_trigger_cells_in_wafers_.emplace(trigger_wafer, 0); - if (trigger_cell + 1 > itr_insert.first->second) - itr_insert.first->second = trigger_cell + 1; - } - if (!l1tCellsMappingStream.eof()) - edm::LogWarning("HGCalTriggerGeometry") << "Error reading L1TCellsMapping '" << subdet << " " << wafer << " " - << cell << " " << trigger_wafer << " " << trigger_cell << "' \n"; - l1tCellsMappingStream.close(); - // read BH trigger cell mapping file - std::ifstream l1tCellsBHMappingStream(l1tCellsBHMapping_.fullPath()); - if (!l1tCellsBHMappingStream.is_open()) { - throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TCellsBHMapping file\n"; - } - short ieta = 0; - short iphi = 0; - trigger_wafer = 0; - trigger_cell = 0; - for (; l1tCellsBHMappingStream >> ieta >> iphi >> trigger_wafer >> trigger_cell;) { - unsigned cell_key = packIetaIphi(ieta, iphi); - unsigned trigger_cell_key = packWaferCellId(ForwardSubdetector::HGCHEB, trigger_wafer, trigger_cell); - // fill cell <-> trigger cell mappings - cells_to_trigger_cells_bh_.emplace(cell_key, trigger_cell_key); - trigger_cells_to_cells_bh_.emplace(trigger_cell_key, cell_key); - // fill number of trigger cells in wafers - auto itr_insert = number_trigger_cells_in_wafers_bh_.emplace(trigger_wafer, 0); - if (trigger_cell + 1 > itr_insert.first->second) - itr_insert.first->second = trigger_cell + 1; - } - if (!l1tCellsBHMappingStream.eof()) - edm::LogWarning("HGCalTriggerGeometry") << "Error reading L1TCellsBHMapping '" << ieta << " " << iphi << " " - << trigger_wafer << " " << trigger_cell << "' \n"; - l1tCellsBHMappingStream.close(); -} - -void HGCalTriggerGeometryHexLayerBasedImp1::fillNeighborMaps( - const edm::FileInPath& file, std::unordered_map>>& neighbors_map) { - // Fill trigger neighbor map - std::ifstream l1tCellNeighborsMappingStream(file.fullPath()); - if (!l1tCellNeighborsMappingStream.is_open()) { - throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TCellNeighborsMapping file\n"; - } - for (std::array buffer; l1tCellNeighborsMappingStream.getline(&buffer[0], 512);) { - std::string line(&buffer[0]); - // Extract keys consisting of the module id - // and of the trigger cell id - // Match patterns (X,Y) - // where X is a number with less than 4 digis - // and Y is a number with less than 4 digits - std::regex key_regex("\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)"); - std::vector key_tokens{std::sregex_token_iterator(line.begin(), line.end(), key_regex), {}}; - if (key_tokens.empty()) { - throw cms::Exception("BadGeometry") << "Syntax error in the L1TCellNeighborsMapping:\n" - << " Cannot find the trigger cell key in line:\n" - << " '" << &buffer[0] << "'\n"; - } - std::regex digits_regex("\\d{1,3}"); - std::vector module_tc{ - std::sregex_token_iterator(key_tokens[0].begin(), key_tokens[0].end(), digits_regex), {}}; - // get module and cell id - int module = std::stoi(module_tc[0]); - int trigger_cell = std::stoi(module_tc[1]); - unsigned map_key = packTriggerCell(module, trigger_cell); - // Extract neighbors - // Match patterns (X,Y) - // where X is a number with less than 4 digits - // and Y is a number with less than 4 digits - std::regex neighbors_regex("\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)"); - std::vector neighbors_tokens{std::sregex_token_iterator(line.begin(), line.end(), neighbors_regex), - {}}; - if (neighbors_tokens.size() < 2) { - throw cms::Exception("BadGeometry") << "Syntax error in the L1TCellNeighborsMapping:\n" - << " Cannot find any neighbor in line:\n" - << " '" << &buffer[0] << "'\n"; - } - auto itr_insert = neighbors_map.emplace(map_key, std::set>()); - // The first element is the key, so start at index 1 - for (unsigned i = 1; i < neighbors_tokens.size(); i++) { - const auto& neighbor = neighbors_tokens[i]; - std::vector pair_neighbor{std::sregex_token_iterator(neighbor.begin(), neighbor.end(), digits_regex), - {}}; - short neighbor_module(std::stoi(pair_neighbor[0])); - short neighbor_cell(std::stoi(pair_neighbor[1])); - itr_insert.first->second.emplace(neighbor_module, neighbor_cell); - } - } - if (!l1tCellNeighborsMappingStream.eof()) - edm::LogWarning("HGCalTriggerGeometry") << "Error reading L1TCellNeighborsMapping'\n"; - l1tCellNeighborsMappingStream.close(); -} - -void HGCalTriggerGeometryHexLayerBasedImp1::fillInvalidTriggerCells() { - unsigned n_layers_ee = eeTopology().dddConstants().layers(true); - for (unsigned layer = 1; layer <= n_layers_ee; layer++) { - for (const auto& wafer_module : wafer_to_module_) { - unsigned wafer = wafer_module.first; - // loop on the trigger cells in each wafer - for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(wafer); trigger_cell++) { - std::set trigger_cell_ids; - trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCEE, -1, layer, 1, wafer, trigger_cell)); - trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCEE, 1, layer, 1, wafer, trigger_cell)); - trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCHEF, -1, layer, 1, wafer, trigger_cell)); - trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCHEF, 1, layer, 1, wafer, trigger_cell)); - for (unsigned trigger_cell : trigger_cell_ids) { - if (!validTriggerCellFromCells(trigger_cell)) - invalid_triggercells_.emplace(trigger_cell); - for (unsigned neighbor : getNeighborsFromTriggerCell(trigger_cell)) { - if (!validTriggerCellFromCells(neighbor)) - invalid_triggercells_.emplace(neighbor); - } - } - } - } - } -} - -unsigned HGCalTriggerGeometryHexLayerBasedImp1::packWaferCellId(unsigned subdet, unsigned wafer, unsigned cell) const { - unsigned packed_value = 0; - const int kSubdetMask = 0x7; - packed_value |= ((cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset); - packed_value |= ((wafer & HGCalDetId::kHGCalWaferMask) << HGCalDetId::kHGCalWaferOffset); - packed_value |= ((subdet & kSubdetMask) << (HGCalDetId::kHGCalWaferTypeOffset)); - return packed_value; -} - -unsigned HGCalTriggerGeometryHexLayerBasedImp1::packIetaIphi(unsigned ieta, unsigned iphi) const { - unsigned packed_value = 0; - packed_value |= (iphi & HcalDetId::kHcalPhiMask2); - packed_value |= ((ieta & HcalDetId::kHcalEtaMask2) << HcalDetId::kHcalEtaOffset2); - return packed_value; -} - -void HGCalTriggerGeometryHexLayerBasedImp1::unpackWaferCellId(unsigned wafer_cell, - unsigned& wafer, - unsigned& cell) const { - cell = wafer_cell & HGCalDetId::kHGCalCellMask; - wafer = (wafer_cell >> HGCalDetId::kHGCalWaferOffset) & HGCalDetId::kHGCalWaferMask; -} - -void HGCalTriggerGeometryHexLayerBasedImp1::unpackIetaIphi(unsigned ieta_iphi, unsigned& ieta, unsigned& iphi) const { - iphi = ieta_iphi & HcalDetId::kHcalPhiMask2; - ieta = (ieta_iphi >> HcalDetId::kHcalEtaOffset2) & HcalDetId::kHcalEtaMask2; -} - -bool HGCalTriggerGeometryHexLayerBasedImp1::validCell(unsigned cell_id) const { - bool is_valid = false; - if (DetId(cell_id).det() == DetId::Hcal) { - HcalDetId cell_det_id(cell_id); - if (cell_det_id.subdetId() != HcalEndcap) - is_valid = false; - else - is_valid = bhTopology().valid(cell_id); - } else if (DetId(cell_id).det() == DetId::Forward) { - HGCalDetId cell_det_id(cell_id); - unsigned subdet = cell_det_id.subdetId(); - switch (subdet) { - case ForwardSubdetector::HGCEE: - is_valid = eeTopology().valid(cell_id); - break; - case ForwardSubdetector::HGCHEF: - is_valid = fhTopology().valid(cell_id); - break; - default: - is_valid = false; - break; - } - } - return is_valid; -} - -bool HGCalTriggerGeometryHexLayerBasedImp1::validTriggerCell(const unsigned trigger_cell_id) const { - return invalid_triggercells_.find(trigger_cell_id) == invalid_triggercells_.end(); -} - -bool HGCalTriggerGeometryHexLayerBasedImp1::disconnectedModule(const unsigned module_id) const { - bool disconnected = false; - if (disconnected_modules_.find(HGCalDetId(module_id).wafer()) != disconnected_modules_.end()) - disconnected = true; - if (disconnected_layers_.find(layerWithOffset(module_id)) != disconnected_layers_.end()) - disconnected = true; - return disconnected; -} - -unsigned HGCalTriggerGeometryHexLayerBasedImp1::triggerLayer(const unsigned id) const { - unsigned layer = layerWithOffset(id); - if (layer >= trigger_layers_.size()) - return 0; - return trigger_layers_[layer]; -} - -bool HGCalTriggerGeometryHexLayerBasedImp1::validTriggerCellFromCells(const unsigned trigger_cell_id) const { - // Check the validity of a trigger cell with the - // validity of the cells. One valid cell in the - // trigger cell is enough to make the trigger cell - // valid. - HGCalDetId trigger_cell_det_id(trigger_cell_id); - unsigned subdet = trigger_cell_det_id.subdetId(); - const geom_set cells = getCellsFromTriggerCell(trigger_cell_id); - bool is_valid = false; - for (const auto cell_id : cells) { - is_valid |= validCellId(subdet, cell_id); - if (is_valid) - break; - } - return is_valid; -} - -bool HGCalTriggerGeometryHexLayerBasedImp1::validCellId(unsigned subdet, unsigned cell_id) const { - bool is_valid = false; - switch (subdet) { - case ForwardSubdetector::HGCEE: - is_valid = eeTopology().valid(cell_id); - break; - case ForwardSubdetector::HGCHEF: - is_valid = fhTopology().valid(cell_id); - break; - case ForwardSubdetector::HGCHEB: - is_valid = bhTopology().valid(cell_id); - break; - default: - is_valid = false; - break; - } - return is_valid; -} - -unsigned HGCalTriggerGeometryHexLayerBasedImp1::packTriggerCell(unsigned module, unsigned trigger_cell) const { - unsigned packed_value = 0; - packed_value |= ((trigger_cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset); - packed_value |= ((module & HGCalDetId::kHGCalWaferMask) << HGCalDetId::kHGCalWaferOffset); - return packed_value; -} - -int HGCalTriggerGeometryHexLayerBasedImp1::detIdWaferType(unsigned subdet, short wafer) const { - int wafer_type = 0; - switch (subdet) { - // HGCalDDDConstants::waferTypeT() returns 2=coarse, 1=fine - // HGCalDetId::waferType() returns -1=coarse, 1=fine - // Convert to HGCalDetId waferType - case ForwardSubdetector::HGCEE: - wafer_type = (eeTopology().dddConstants().waferTypeT(wafer) == 2 ? -1 : 1); - break; - case ForwardSubdetector::HGCHEF: - wafer_type = (fhTopology().dddConstants().waferTypeT(wafer) == 2 ? -1 : 1); - break; - default: - break; - }; - return wafer_type; -} - -unsigned HGCalTriggerGeometryHexLayerBasedImp1::layerWithOffset(unsigned id) const { - HGCalDetId detid(id); - unsigned layer = 0; - switch (detid.subdetId()) { - case ForwardSubdetector::HGCEE: - layer = detid.layer(); - break; - case ForwardSubdetector::HGCHEF: - layer = fhOffset_ + detid.layer(); - break; - case ForwardSubdetector::HGCHEB: - layer = bhOffset_ + detid.layer(); - break; - }; - return layer; -} - -DEFINE_EDM_PLUGIN(HGCalTriggerGeometryFactory, - HGCalTriggerGeometryHexLayerBasedImp1, - "HGCalTriggerGeometryHexLayerBasedImp1"); diff --git a/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryV9Imp1.cc b/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryV9Imp1.cc deleted file mode 100644 index 0f4e0552ce9ef..0000000000000 --- a/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryV9Imp1.cc +++ /dev/null @@ -1,1031 +0,0 @@ -#include "FWCore/ParameterSet/interface/FileInPath.h" - -#include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" -#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h" - -#include -#include -#include -#include - -class HGCalTriggerGeometryV9Imp1 : public HGCalTriggerGeometryBase { -public: - HGCalTriggerGeometryV9Imp1(const edm::ParameterSet& conf); - - void initialize(const CaloGeometry*) final; - void initialize(const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*) final; - void initialize(const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*) final; - - void reset() final; - - unsigned getTriggerCellFromCell(const unsigned) const final; - unsigned getModuleFromCell(const unsigned) const final; - unsigned getModuleFromTriggerCell(const unsigned) const final; - - geom_set getCellsFromTriggerCell(const unsigned) const final; - geom_set getCellsFromModule(const unsigned) const final; - geom_set getTriggerCellsFromModule(const unsigned) const final; - - geom_ordered_set getOrderedCellsFromModule(const unsigned) const final; - geom_ordered_set getOrderedTriggerCellsFromModule(const unsigned) const final; - - geom_set getNeighborsFromTriggerCell(const unsigned) const final; - - unsigned getLinksInModule(const unsigned module_id) const final; - unsigned getModuleSize(const unsigned module_id) const final; - - GlobalPoint getTriggerCellPosition(const unsigned) const final; - GlobalPoint getModulePosition(const unsigned) const final; - - bool validCell(const unsigned) const final; - bool validTriggerCell(const unsigned) const final; - bool disconnectedModule(const unsigned) const final; - unsigned lastTriggerLayer() const final { return last_trigger_layer_; } - unsigned triggerLayer(const unsigned) const final; - -private: - edm::FileInPath l1tCellsMapping_; - edm::FileInPath l1tCellsSciMapping_; - edm::FileInPath l1tWafersMapping_; - edm::FileInPath l1tModulesMapping_; - edm::FileInPath l1tLinksMapping_; - edm::FileInPath l1tCellNeighborsMapping_; - edm::FileInPath l1tCellNeighborsSciMapping_; - - unsigned hSc_links_per_module_ = 1; - unsigned hSc_wafers_per_module_ = 3; - - // module related maps - std::unordered_map wafer_to_module_; - std::unordered_multimap module_to_wafers_; - std::unordered_map links_per_module_; - - // trigger cell related maps - std::unordered_map cells_to_trigger_cells_; - std::unordered_multimap trigger_cells_to_cells_; - std::unordered_map cells_to_trigger_cells_sci_; - std::unordered_multimap trigger_cells_to_cells_sci_; - std::unordered_map number_trigger_cells_in_wafers_; - std::unordered_map number_trigger_cells_in_wafers_sci_; - std::unordered_map wafers_to_wafers_old_; - std::unordered_map wafers_old_to_wafers_; - std::unordered_set invalid_triggercells_; - - // neighbor related maps - // trigger cell neighbors: - // - The key includes the module and trigger cell id - // - The value is a set of (module_id, trigger_cell_id) - typedef std::unordered_map>> neighbor_map; - neighbor_map trigger_cell_neighbors_; - neighbor_map trigger_cell_neighbors_sci_; - - // Disconnected modules and layers - std::unordered_set disconnected_modules_; - std::unordered_set disconnected_layers_; - std::vector trigger_layers_; - unsigned last_trigger_layer_ = 0; - - // layer offsets - unsigned heOffset_ = 0; - unsigned totalLayers_ = 0; - - void fillMaps(); - void fillNeighborMap(const edm::FileInPath&, neighbor_map&, bool); - void fillInvalidTriggerCells(); - unsigned packTriggerCell(unsigned, unsigned) const; - unsigned packTriggerCellWithType(unsigned, unsigned, unsigned) const; - bool validCellId(unsigned det, unsigned cell_id) const; - bool validTriggerCellFromCells(const unsigned) const; - - int detIdWaferType(unsigned det, unsigned layer, short waferU, short waferV) const; - unsigned packWaferCellId(unsigned subdet, unsigned wafer, unsigned cell) const; - unsigned packLayerWaferId(unsigned layer, unsigned wafer) const; - unsigned packWaferId(int waferU, int waferV) const; - unsigned packCellId(unsigned type, unsigned cellU, unsigned cellV) const; - unsigned packCellId(unsigned type, unsigned cell) const; - unsigned packIetaIphi(unsigned ieta, unsigned iphi) const; - void unpackWaferCellId(unsigned wafer_cell, unsigned& wafer, unsigned& cell) const; - void unpackLayerWaferId(unsigned layer_wafer, unsigned& layer, unsigned& wafer) const; - void unpackWaferId(unsigned wafer, int& waferU, int& waferV) const; - void unpackCellId(unsigned cell, unsigned& cellU, unsigned& cellV) const; - void unpackIetaIphi(unsigned ieta_iphi, unsigned& ieta, unsigned& iphi) const; - - unsigned layerWithOffset(unsigned) const; -}; - -HGCalTriggerGeometryV9Imp1::HGCalTriggerGeometryV9Imp1(const edm::ParameterSet& conf) - : HGCalTriggerGeometryBase(conf), - l1tCellsMapping_(conf.getParameter("L1TCellsMapping")), - l1tCellsSciMapping_(conf.getParameter("L1TCellsSciMapping")), - l1tWafersMapping_(conf.getParameter("L1TWafersMapping")), - l1tModulesMapping_(conf.getParameter("L1TModulesMapping")), - l1tLinksMapping_(conf.getParameter("L1TLinksMapping")), - l1tCellNeighborsMapping_(conf.getParameter("L1TCellNeighborsMapping")), - l1tCellNeighborsSciMapping_(conf.getParameter("L1TCellNeighborsSciMapping")), - hSc_links_per_module_(conf.getParameter("ScintillatorLinksPerModule")), - hSc_wafers_per_module_(conf.getParameter("ScintillatorWafersPerModule")) { - std::vector tmp_vector = conf.getParameter>("DisconnectedModules"); - std::move(tmp_vector.begin(), tmp_vector.end(), std::inserter(disconnected_modules_, disconnected_modules_.end())); - tmp_vector = conf.getParameter>("DisconnectedLayers"); - std::move(tmp_vector.begin(), tmp_vector.end(), std::inserter(disconnected_layers_, disconnected_layers_.end())); -} - -void HGCalTriggerGeometryV9Imp1::reset() { - cells_to_trigger_cells_.clear(); - trigger_cells_to_cells_.clear(); - cells_to_trigger_cells_sci_.clear(); - trigger_cells_to_cells_sci_.clear(); - wafers_to_wafers_old_.clear(); - wafers_old_to_wafers_.clear(); - wafer_to_module_.clear(); - module_to_wafers_.clear(); - number_trigger_cells_in_wafers_.clear(); - number_trigger_cells_in_wafers_sci_.clear(); - trigger_cell_neighbors_.clear(); - trigger_cell_neighbors_sci_.clear(); -} - -void HGCalTriggerGeometryV9Imp1::initialize(const CaloGeometry* calo_geometry) { - throw cms::Exception("BadGeometry") - << "HGCalTriggerGeometryV9Imp1 geometry cannot be initialized with the V7/V8 HGCAL geometry"; -} - -void HGCalTriggerGeometryV9Imp1::initialize(const HGCalGeometry* hgc_ee_geometry, - const HGCalGeometry* hgc_hsi_geometry, - const HGCalGeometry* hgc_hsc_geometry) { - setEEGeometry(hgc_ee_geometry); - setHSiGeometry(hgc_hsi_geometry); - setHScGeometry(hgc_hsc_geometry); - heOffset_ = eeTopology().dddConstants().layers(true); - totalLayers_ = heOffset_ + hsiTopology().dddConstants().layers(true); - trigger_layers_.resize(totalLayers_ + 1); - trigger_layers_[0] = 0; // layer number 0 doesn't exist - unsigned trigger_layer = 1; - for (unsigned layer = 1; layer < trigger_layers_.size(); layer++) { - if (disconnected_layers_.find(layer) == disconnected_layers_.end()) { - // Increase trigger layer number if the layer is not disconnected - trigger_layers_[layer] = trigger_layer; - trigger_layer++; - } else { - trigger_layers_[layer] = 0; - } - } - last_trigger_layer_ = trigger_layer - 1; - fillMaps(); - fillNeighborMap(l1tCellNeighborsMapping_, trigger_cell_neighbors_, false); // silicon - fillNeighborMap(l1tCellNeighborsSciMapping_, trigger_cell_neighbors_sci_, true); // scintillator - fillInvalidTriggerCells(); -} - -void HGCalTriggerGeometryV9Imp1::initialize(const HGCalGeometry* hgc_ee_geometry, - const HGCalGeometry* hgc_hsi_geometry, - const HGCalGeometry* hgc_hsc_geometry, - const HGCalGeometry* hgc_nose_geometry) { - throw cms::Exception("BadGeometry") << "HGCalTriggerGeometryV9Imp1 geometry cannot be initialized with the " - "HFNose geometry; use HGCalTriggerGeometryV9Imp2"; -} - -unsigned HGCalTriggerGeometryV9Imp1::getTriggerCellFromCell(const unsigned cell_id) const { - unsigned det = DetId(cell_id).det(); - unsigned subdet = 0; - int zside = 0; - unsigned tc_type = 1; - unsigned layer = 0; - unsigned wafer_trigger_cell = 0; - unsigned trigger_cell = 0; - // Scintillator - if (det == DetId::HGCalHSc) { - HGCScintillatorDetId cell_det_id(cell_id); - unsigned ieta = cell_det_id.ietaAbs(); - unsigned iphi = cell_det_id.iphi(); - tc_type = cell_det_id.type(); - layer = cell_det_id.layer(); - subdet = ForwardSubdetector::HGCHEB; - zside = cell_det_id.zside(); - auto trigger_cell_itr = cells_to_trigger_cells_sci_.find(packIetaIphi(ieta, iphi)); - if (trigger_cell_itr == cells_to_trigger_cells_sci_.end()) { - throw cms::Exception("BadGeometry") - << "HGCalTriggerGeometry: scintillator cell ieta=" << ieta << ", iphi=" << iphi - << " is not mapped to any trigger cell. The trigger cell mapping should be modified.\n"; - } - trigger_cell = 0; - wafer_trigger_cell = 0; - unpackWaferCellId(trigger_cell_itr->second, wafer_trigger_cell, trigger_cell); - } - // Silicon - else if (det == DetId::HGCalEE || det == DetId::HGCalHSi) { - HGCSiliconDetId cell_det_id(cell_id); - subdet = (det == DetId::HGCalEE ? ForwardSubdetector::HGCEE : ForwardSubdetector::HGCHEF); - layer = cell_det_id.layer(); - zside = cell_det_id.zside(); - int type = cell_det_id.type(); - int waferu = cell_det_id.waferU(); - int waferv = cell_det_id.waferV(); - unsigned cellu = cell_det_id.cellU(); - unsigned cellv = cell_det_id.cellV(); - auto trigger_cell_itr = cells_to_trigger_cells_.find(packCellId(type, cellu, cellv)); - if (trigger_cell_itr == cells_to_trigger_cells_.end()) { - throw cms::Exception("BadGeometry") - << "HGCalTriggerGeometry: HGCal cell " << cellu << "," << cellv << " in wafer type " << type - << " is not mapped to any trigger cell. The trigger cell mapping should be modified.\n"; - } - auto wafer_trigger_cell_itr = wafers_to_wafers_old_.find(packWaferId(waferu, waferv)); - if (wafer_trigger_cell_itr == wafers_to_wafers_old_.end()) { - throw cms::Exception("BadGeometry") - << "HGCalTriggerGeometry: Wafer " << waferu << "," << waferv - << " is not mapped to any trigger wafer ID. The wafer mapping should be modified.\n"; - } - trigger_cell = trigger_cell_itr->second; - wafer_trigger_cell = wafer_trigger_cell_itr->second; - } - // Using the old HGCalDetId for trigger cells is temporary - // For easy switch between V8 and V9 geometries - return HGCalDetId((ForwardSubdetector)subdet, zside, layer, tc_type, wafer_trigger_cell, trigger_cell).rawId(); -} - -unsigned HGCalTriggerGeometryV9Imp1::getModuleFromCell(const unsigned cell_id) const { - return getModuleFromTriggerCell(getTriggerCellFromCell(cell_id)); -} - -unsigned HGCalTriggerGeometryV9Imp1::getModuleFromTriggerCell(const unsigned trigger_cell_id) const { - HGCalDetId trigger_cell_det_id(trigger_cell_id); - unsigned module = 0; - // Scintillator - if (trigger_cell_det_id.subdetId() == ForwardSubdetector::HGCHEB) { - // For scintillator, the module ID is currently encoded as the wafer in HGCalDetId - module = trigger_cell_det_id.wafer(); - } - // Silicon - else { - unsigned layer_with_offset = layerWithOffset(trigger_cell_id); - auto module_itr = wafer_to_module_.find(packLayerWaferId(layer_with_offset, trigger_cell_det_id.wafer())); - if (module_itr == wafer_to_module_.end()) { - throw cms::Exception("BadGeometry") - << trigger_cell_det_id << "HGCalTriggerGeometry: Wafer " << trigger_cell_det_id.wafer() - << " is not mapped to any trigger module. The module mapping should be modified. See " - "https://twiki.cern.ch/twiki/bin/viewauth/CMS/HGCALTriggerPrimitivesSimulation#Trigger_geometry for " - "details.\n"; - } - module = module_itr->second; - } - return HGCalDetId((ForwardSubdetector)trigger_cell_det_id.subdetId(), - trigger_cell_det_id.zside(), - trigger_cell_det_id.layer(), - trigger_cell_det_id.waferType(), - module, - HGCalDetId::kHGCalCellMask) - .rawId(); -} - -HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp1::getCellsFromTriggerCell( - const unsigned trigger_cell_id) const { - HGCalDetId trigger_cell_det_id(trigger_cell_id); - geom_set cell_det_ids; - unsigned subdet = trigger_cell_det_id.subdetId(); - unsigned trigger_wafer = trigger_cell_det_id.wafer(); - unsigned trigger_cell = trigger_cell_det_id.cell(); - unsigned layer = trigger_cell_det_id.layer(); - // Scintillator - if (subdet == ForwardSubdetector::HGCHEB) { - int type = hscTopology().dddConstants().getTypeTrap(layer); - const auto& cell_range = - trigger_cells_to_cells_sci_.equal_range(packWaferCellId(subdet, trigger_wafer, trigger_cell)); - for (auto tc_c_itr = cell_range.first; tc_c_itr != cell_range.second; tc_c_itr++) { - unsigned ieta = 0; - unsigned iphi = 0; - unpackIetaIphi(tc_c_itr->second, ieta, iphi); - unsigned cell_det_id = HGCScintillatorDetId(type, layer, trigger_cell_det_id.zside() * ieta, iphi).rawId(); - if (validCellId(subdet, cell_det_id)) - cell_det_ids.emplace(cell_det_id); - } - } - // Silicon - else { - int waferu = 0; - int waferv = 0; - auto wafer_itr = wafers_old_to_wafers_.find(trigger_wafer); - if (wafer_itr == wafers_old_to_wafers_.end()) { - throw cms::Exception("BadGeometry") << "HGCalTriggerGeometry: Trigger wafer ID " << trigger_wafer - << " is not mapped to any wafer. The wafer mapping should be modified.\n"; - } - unpackWaferId(wafer_itr->second, waferu, waferv); - DetId::Detector det = - (trigger_cell_det_id.subdetId() == ForwardSubdetector::HGCEE ? DetId::HGCalEE : DetId::HGCalHSi); - unsigned wafer_type = detIdWaferType(det, layer, waferu, waferv); - const auto& cell_range = trigger_cells_to_cells_.equal_range(packCellId(wafer_type, trigger_cell)); - for (auto tc_c_itr = cell_range.first; tc_c_itr != cell_range.second; tc_c_itr++) { - unsigned cellu = 0; - unsigned cellv = 0; - unpackCellId(tc_c_itr->second, cellu, cellv); - unsigned cell_det_id = - HGCSiliconDetId(det, trigger_cell_det_id.zside(), wafer_type, layer, waferu, waferv, cellu, cellv).rawId(); - if (validCellId(subdet, cell_det_id)) - cell_det_ids.emplace(cell_det_id); - } - } - return cell_det_ids; -} - -HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp1::getCellsFromModule(const unsigned module_id) const { - geom_set cell_det_ids; - geom_set trigger_cells = getTriggerCellsFromModule(module_id); - for (auto trigger_cell_id : trigger_cells) { - geom_set cells = getCellsFromTriggerCell(trigger_cell_id); - cell_det_ids.insert(cells.begin(), cells.end()); - } - return cell_det_ids; -} - -HGCalTriggerGeometryBase::geom_ordered_set HGCalTriggerGeometryV9Imp1::getOrderedCellsFromModule( - const unsigned module_id) const { - geom_ordered_set cell_det_ids; - geom_ordered_set trigger_cells = getOrderedTriggerCellsFromModule(module_id); - for (auto trigger_cell_id : trigger_cells) { - geom_set cells = getCellsFromTriggerCell(trigger_cell_id); - cell_det_ids.insert(cells.begin(), cells.end()); - } - return cell_det_ids; -} - -HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp1::getTriggerCellsFromModule( - const unsigned module_id) const { - HGCalDetId module_det_id(module_id); - geom_set trigger_cell_det_ids; - unsigned module = module_det_id.wafer(); - unsigned layer = module_det_id.layer(); - // Scintillator - if (module_det_id.subdetId() == ForwardSubdetector::HGCHEB) { - // loop on the trigger cells in each module - for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_sci_.at(module); trigger_cell++) { - HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(), - module_det_id.zside(), - layer, - module_det_id.waferType(), - module, - trigger_cell); - if (validTriggerCell(trigger_cell_id)) - trigger_cell_det_ids.emplace(trigger_cell_id.rawId()); - } - } - // Silicon - else { - auto wafer_itrs = module_to_wafers_.equal_range(packLayerWaferId(layerWithOffset(module_id), module)); - // loop on the wafers included in the module - for (auto wafer_itr = wafer_itrs.first; wafer_itr != wafer_itrs.second; wafer_itr++) { - unsigned wafer = wafer_itr->second; - auto waferuv_itr = wafers_old_to_wafers_.find(wafer); - if (waferuv_itr == wafers_old_to_wafers_.end()) - continue; - int waferu = 0; - int waferv = 0; - unpackWaferId(waferuv_itr->second, waferu, waferv); - DetId::Detector det = (module_det_id.subdetId() == ForwardSubdetector::HGCEE ? DetId::HGCalEE : DetId::HGCalHSi); - unsigned wafer_type = detIdWaferType(det, layer, waferu, waferv); - // loop on the trigger cells in each wafer - for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(wafer_type); trigger_cell++) { - HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(), - module_det_id.zside(), - layer, - module_det_id.waferType(), - wafer, - trigger_cell); - if (validTriggerCell(trigger_cell_id)) - trigger_cell_det_ids.emplace(trigger_cell_id.rawId()); - } - } - } - return trigger_cell_det_ids; -} - -HGCalTriggerGeometryBase::geom_ordered_set HGCalTriggerGeometryV9Imp1::getOrderedTriggerCellsFromModule( - const unsigned module_id) const { - HGCalDetId module_det_id(module_id); - geom_ordered_set trigger_cell_det_ids; - unsigned module = module_det_id.wafer(); - unsigned layer = module_det_id.layer(); - // Scintillator - if (module_det_id.subdetId() == ForwardSubdetector::HGCHEB) { - // loop on the trigger cells in each module - for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_sci_.at(module); trigger_cell++) { - HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(), - module_det_id.zside(), - layer, - module_det_id.waferType(), - module, - trigger_cell); - if (validTriggerCell(trigger_cell_id)) - trigger_cell_det_ids.emplace(trigger_cell_id.rawId()); - } - } - // EE or FH - else { - auto wafer_itrs = module_to_wafers_.equal_range(packLayerWaferId(layerWithOffset(module_id), module)); - // loop on the wafers included in the module - for (auto wafer_itr = wafer_itrs.first; wafer_itr != wafer_itrs.second; wafer_itr++) { - unsigned wafer = wafer_itr->second; - auto waferuv_itr = wafers_old_to_wafers_.find(wafer); - if (waferuv_itr == wafers_old_to_wafers_.end()) - continue; - int waferu = 0; - int waferv = 0; - unpackWaferId(waferuv_itr->second, waferu, waferv); - DetId::Detector det = (module_det_id.subdetId() == ForwardSubdetector::HGCEE ? DetId::HGCalEE : DetId::HGCalHSi); - unsigned wafer_type = detIdWaferType(det, layer, waferu, waferv); - // loop on the trigger cells in each wafer - for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(wafer_type); trigger_cell++) { - HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(), - module_det_id.zside(), - layer, - module_det_id.waferType(), - wafer, - trigger_cell); - if (validTriggerCell(trigger_cell_id)) - trigger_cell_det_ids.emplace(trigger_cell_id.rawId()); - } - } - } - return trigger_cell_det_ids; -} - -HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp1::getNeighborsFromTriggerCell( - const unsigned trigger_cell_id) const { - HGCalDetId trigger_cell_det_id(trigger_cell_id); - // Choose scintillator or silicon map - const auto& neighbors_map = - (trigger_cell_det_id.subdetId() == ForwardSubdetector::HGCHEB ? trigger_cell_neighbors_sci_ - : trigger_cell_neighbors_); - unsigned layer = trigger_cell_det_id.layer(); - unsigned type = - (trigger_cell_det_id.subdetId() == ForwardSubdetector::HGCHEB ? hscTopology().dddConstants().getTypeTrap(layer) - : 1); - unsigned module = trigger_cell_det_id.wafer(); - unsigned trigger_cell = trigger_cell_det_id.cell(); - // retrieve neighbors - unsigned trigger_cell_key = (trigger_cell_det_id.subdetId() == ForwardSubdetector::HGCHEB - ? packTriggerCellWithType(type, module, trigger_cell) - : packTriggerCell(module, trigger_cell)); - geom_set neighbor_detids; - auto neighbors_itr = neighbors_map.find(trigger_cell_key); - if (neighbors_itr == neighbors_map.end()) { - throw cms::Exception("BadGeometry") << "HGCalTriggerGeometry: Neighbors are not defined for trigger cell " - << trigger_cell << " in module " << module - << ". The trigger cell neighbor mapping should be modified. \n"; - } - const auto& neighbors = neighbors_itr->second; - // create HGCalDetId of neighbors and check their validity - neighbor_detids.reserve(neighbors.size()); - for (const auto& module_tc : neighbors) { - HGCalDetId neighbor_det_id((ForwardSubdetector)trigger_cell_det_id.subdetId(), - trigger_cell_det_id.zside(), - layer, - type, - module_tc.first, - module_tc.second); - if (validTriggerCell(neighbor_det_id.rawId())) { - neighbor_detids.emplace(neighbor_det_id.rawId()); - } - } - return neighbor_detids; -} - -unsigned HGCalTriggerGeometryV9Imp1::getLinksInModule(const unsigned module_id) const { - HGCalDetId module_det_id(module_id); - unsigned links = 0; - unsigned module = module_det_id.wafer(); - unsigned layer = layerWithOffset(module_det_id); - // Scintillator - if (module_det_id.subdetId() == ForwardSubdetector::HGCHEB) { - links = hSc_links_per_module_; - } - // Silicon - else { - const unsigned sector0_mask = 0x7F; - module = (module & sector0_mask); - links = links_per_module_.at(packLayerWaferId(layer, module)); - } - return links; -} - -unsigned HGCalTriggerGeometryV9Imp1::getModuleSize(const unsigned module_id) const { - HGCalDetId module_det_id(module_id); - unsigned module = module_det_id.wafer(); - unsigned layer = layerWithOffset(module_det_id); - unsigned nWafers = 1; - // Scintillator - if (module_det_id.subdetId() == ForwardSubdetector::HGCHEB) { - nWafers = hSc_wafers_per_module_; - } - // Silicon - else { - nWafers = module_to_wafers_.count(packLayerWaferId(layer, module)); - } - return nWafers; -} - -GlobalPoint HGCalTriggerGeometryV9Imp1::getTriggerCellPosition(const unsigned trigger_cell_det_id) const { - unsigned subdet = HGCalDetId(trigger_cell_det_id).subdetId(); - // Position: barycenter of the trigger cell. - Basic3DVector triggerCellVector(0., 0., 0.); - const auto cell_ids = getCellsFromTriggerCell(trigger_cell_det_id); - // Scintillator - if (subdet == ForwardSubdetector::HGCHEB) { - for (const auto& cell : cell_ids) { - triggerCellVector += hscGeometry()->getPosition(cell).basicVector(); - } - } - // Silicon - else { - for (const auto& cell : cell_ids) { - HGCSiliconDetId cellDetId(cell); - triggerCellVector += (cellDetId.det() == DetId::HGCalEE ? eeGeometry()->getPosition(cellDetId) - : hsiGeometry()->getPosition(cellDetId)) - .basicVector(); - } - } - return GlobalPoint(triggerCellVector / cell_ids.size()); -} - -GlobalPoint HGCalTriggerGeometryV9Imp1::getModulePosition(const unsigned module_det_id) const { - unsigned subdet = HGCalDetId(module_det_id).subdetId(); - // Position: barycenter of the module. - Basic3DVector moduleVector(0., 0., 0.); - const auto cell_ids = getCellsFromModule(module_det_id); - // Scintillator - if (subdet == ForwardSubdetector::HGCHEB) { - for (const auto& cell : cell_ids) { - moduleVector += hscGeometry()->getPosition(cell).basicVector(); - } - } - // Silicon - else { - for (const auto& cell : cell_ids) { - HGCSiliconDetId cellDetId(cell); - moduleVector += (cellDetId.det() == DetId::HGCalEE ? eeGeometry()->getPosition(cellDetId) - : hsiGeometry()->getPosition(cellDetId)) - .basicVector(); - } - } - return GlobalPoint(moduleVector / cell_ids.size()); -} - -void HGCalTriggerGeometryV9Imp1::fillMaps() { - // - // read module mapping file - std::ifstream l1tModulesMappingStream(l1tModulesMapping_.fullPath()); - if (!l1tModulesMappingStream.is_open()) { - throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TModulesMapping file\n"; - } - short trigger_wafer = 0; - short module = 0; - short layer = 0; - for (; l1tModulesMappingStream >> layer >> trigger_wafer >> module;) { - wafer_to_module_.emplace(packLayerWaferId(layer, trigger_wafer), module); - module_to_wafers_.emplace(packLayerWaferId(layer, module), trigger_wafer); - } - if (!l1tModulesMappingStream.eof()) { - throw cms::Exception("BadGeometryFile") - << "Error reading L1TModulesMapping '" << layer << " " << trigger_wafer << " " << module << "' \n"; - } - l1tModulesMappingStream.close(); - // read links mapping file - std::ifstream l1tLinksMappingStream(l1tLinksMapping_.fullPath()); - if (!l1tLinksMappingStream.is_open()) { - throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TLinksMapping file\n"; - } - short links = 0; - for (; l1tLinksMappingStream >> layer >> module >> links;) { - if (module_to_wafers_.find(packLayerWaferId(layer, module)) == module_to_wafers_.end()) { - throw cms::Exception("BadGeometryFile") - << "Error reading L1TLinksMapping: (" << layer << "," << module << ") is not defined in the module file \n"; - } - links_per_module_.emplace(packLayerWaferId(layer, module), links); - } - if (!l1tLinksMappingStream.eof()) { - throw cms::Exception("BadGeometryFile") - << "Error reading L1TLinksMapping '" << layer << " " << module << " " << links << "' \n"; - } - l1tLinksMappingStream.close(); - // read trigger cell mapping file - std::ifstream l1tCellsMappingStream(l1tCellsMapping_.fullPath()); - if (!l1tCellsMappingStream.is_open()) { - throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TCellsMapping file\n"; - } - short type = 0; - short cellu = 0; - short cellv = 0; - short trigger_cell = 0; - for (; l1tCellsMappingStream >> type >> cellu >> cellv >> trigger_cell;) { - unsigned cell_key = packCellId(type, cellu, cellv); - unsigned trigger_cell_key = packCellId(type, trigger_cell); - // fill cell <-> trigger cell mappings - cells_to_trigger_cells_.emplace(cell_key, trigger_cell); - trigger_cells_to_cells_.emplace(trigger_cell_key, cell_key); - // fill number of trigger cells in wafers - auto itr_insert = number_trigger_cells_in_wafers_.emplace(type, 0); - if (trigger_cell + 1 > itr_insert.first->second) - itr_insert.first->second = trigger_cell + 1; - } - if (!l1tCellsMappingStream.eof()) { - throw cms::Exception("BadGeometryFile") - << "Error reading L1TCellsMapping '" << type << " " << cellu << " " << cellv << " " << trigger_cell << "' \n"; - } - l1tCellsMappingStream.close(); - // read scintillator trigger cell mapping file - std::ifstream l1tCellsSciMappingStream(l1tCellsSciMapping_.fullPath()); - if (!l1tCellsSciMappingStream.is_open()) { - throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TCellsSciMapping file\n"; - } - short ieta = 0; - short iphi = 0; - trigger_wafer = 0; - trigger_cell = 0; - for (; l1tCellsSciMappingStream >> ieta >> iphi >> trigger_wafer >> trigger_cell;) { - unsigned cell_key = packIetaIphi(ieta, iphi); - unsigned trigger_cell_key = packWaferCellId(ForwardSubdetector::HGCHEB, trigger_wafer, trigger_cell); - // fill cell <-> trigger cell mappings - cells_to_trigger_cells_sci_.emplace(cell_key, trigger_cell_key); - trigger_cells_to_cells_sci_.emplace(trigger_cell_key, cell_key); - // fill number of trigger cells in wafers - auto itr_insert = number_trigger_cells_in_wafers_sci_.emplace(trigger_wafer, 0); - if (trigger_cell + 1 > itr_insert.first->second) - itr_insert.first->second = trigger_cell + 1; - } - if (!l1tCellsSciMappingStream.eof()) { - throw cms::Exception("BadGeometryFile") << "Error reading L1TCellsSciMapping '" << ieta << " " << iphi << " " - << trigger_wafer << " " << trigger_cell << "' \n"; - } - l1tCellsSciMappingStream.close(); - // read wafer mapping file - std::ifstream l1tWafersMappingStream(l1tWafersMapping_.fullPath()); - if (!l1tWafersMappingStream.is_open()) { - throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TWafersMapping file\n"; - } - short waferu = 0; - short waferv = 0; - trigger_wafer = 0; - for (; l1tWafersMappingStream >> waferu >> waferv >> trigger_wafer;) { - unsigned wafer_key = packWaferId(waferu, waferv); - // fill wafer u,v <-> old wafer ID mappings - wafers_to_wafers_old_.emplace(wafer_key, trigger_wafer); - wafers_old_to_wafers_.emplace(trigger_wafer, wafer_key); - } - if (!l1tWafersMappingStream.eof()) { - throw cms::Exception("BadGeometryFile") - << "Error reading L1TWafersMapping '" << waferu << " " << waferv << " " << trigger_wafer << "' \n"; - } - l1tWafersMappingStream.close(); -} - -void HGCalTriggerGeometryV9Imp1::fillNeighborMap(const edm::FileInPath& file, - neighbor_map& neighbors_map, - bool scintillator) { - // Fill trigger neighbor map - std::ifstream l1tCellNeighborsMappingStream(file.fullPath()); - if (!l1tCellNeighborsMappingStream.is_open()) { - throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TCellNeighborsMapping file\n"; - } - const unsigned line_size = 512; - for (std::array buffer; l1tCellNeighborsMappingStream.getline(&buffer[0], line_size);) { - std::string line(&buffer[0]); - // Extract keys consisting of the module id - // and of the trigger cell id - // Match patterns (X,Y) - // where X is a number with less than 4 digis - // and Y is a number with less than 4 digits - // For the scintillator case, match instead (X,Y,Z) patterns - std::regex key_regex(scintillator ? "\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)" - : "\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)"); - std::vector key_tokens{std::sregex_token_iterator(line.begin(), line.end(), key_regex), {}}; - if (key_tokens.empty()) { - throw cms::Exception("BadGeometry") << "Syntax error in the L1TCellNeighborsMapping:\n" - << " Cannot find the trigger cell key in line:\n" - << " '" << &buffer[0] << "'\n"; - } - std::regex digits_regex("\\d{1,3}"); - std::vector module_tc{ - std::sregex_token_iterator(key_tokens[0].begin(), key_tokens[0].end(), digits_regex), {}}; - // get module and cell id - unsigned map_key = 0; - if (scintillator) { - int type = std::stoi(module_tc[0]); - int module = std::stoi(module_tc[1]); - int trigger_cell = std::stoi(module_tc[2]); - map_key = packTriggerCellWithType(type, module, trigger_cell); - } else { - int module = std::stoi(module_tc[0]); - int trigger_cell = std::stoi(module_tc[1]); - map_key = packTriggerCell(module, trigger_cell); - } - // Extract neighbors - // Match patterns (X,Y) - // where X is a number with less than 4 digits - // and Y is a number with less than 4 digits - std::regex neighbors_regex("\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)"); - std::vector neighbors_tokens{std::sregex_token_iterator(line.begin(), line.end(), neighbors_regex), - {}}; - if ((scintillator && neighbors_tokens.empty()) || (!scintillator && neighbors_tokens.size() < 2)) { - throw cms::Exception("BadGeometry") << "Syntax error in the L1TCellNeighborsMapping:\n" - << " Cannot find any neighbor in line:\n" - << " '" << &buffer[0] << "'\n"; - } - auto itr_insert = neighbors_map.emplace(map_key, std::set>()); - // The first element for silicon neighbors is the key, so start at index 1 - unsigned first_element = (scintillator ? 0 : 1); - for (unsigned i = first_element; i < neighbors_tokens.size(); i++) { - const auto& neighbor = neighbors_tokens[i]; - std::vector pair_neighbor{std::sregex_token_iterator(neighbor.begin(), neighbor.end(), digits_regex), - {}}; - short neighbor_module(std::stoi(pair_neighbor[0])); - short neighbor_cell(std::stoi(pair_neighbor[1])); - itr_insert.first->second.emplace(neighbor_module, neighbor_cell); - } - } - if (!l1tCellNeighborsMappingStream.eof()) { - throw cms::Exception("BadGeometryFile") << "Error reading L1TCellNeighborsMapping'\n"; - } - l1tCellNeighborsMappingStream.close(); -} - -void HGCalTriggerGeometryV9Imp1::fillInvalidTriggerCells() { - unsigned n_layers_ee = eeTopology().dddConstants().layers(true); - for (unsigned layer = 1; layer <= n_layers_ee; layer++) { - for (const auto& waferuv_wafer : wafers_to_wafers_old_) { - int waferu = 0; - int waferv = 0; - unpackWaferId(waferuv_wafer.first, waferu, waferv); - unsigned waferee_type = detIdWaferType(DetId::HGCalEE, layer, waferu, waferv); - unsigned waferfh_type = detIdWaferType(DetId::HGCalHSi, layer, waferu, waferv); - unsigned trigger_wafer = waferuv_wafer.second; - // loop on the trigger cells in each wafer - for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(waferee_type); trigger_cell++) { - for (int zside : {-1, 1}) { - HGCalDetId trigger_cell_id(ForwardSubdetector::HGCEE, zside, layer, 1, trigger_wafer, trigger_cell); - if (!validTriggerCellFromCells(trigger_cell_id)) - invalid_triggercells_.emplace(trigger_cell_id); - for (unsigned neighbor : getNeighborsFromTriggerCell(trigger_cell_id)) { - auto wafer_itr = wafers_old_to_wafers_.find(HGCalDetId(neighbor).wafer()); - if (wafer_itr == wafers_old_to_wafers_.end()) - invalid_triggercells_.emplace(neighbor); - else if (!validTriggerCellFromCells(neighbor)) - invalid_triggercells_.emplace(neighbor); - } - } - } - for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(waferfh_type); trigger_cell++) { - for (int zside : {-1, 1}) { - HGCalDetId trigger_cell_id(ForwardSubdetector::HGCHEF, zside, layer, 1, trigger_wafer, trigger_cell); - if (!validTriggerCellFromCells(trigger_cell_id)) - invalid_triggercells_.emplace(trigger_cell_id); - for (unsigned neighbor : getNeighborsFromTriggerCell(trigger_cell_id)) { - auto wafer_itr = wafers_old_to_wafers_.find(HGCalDetId(neighbor).wafer()); - if (wafer_itr == wafers_old_to_wafers_.end()) - invalid_triggercells_.emplace(neighbor); - else if (!validTriggerCellFromCells(neighbor)) - invalid_triggercells_.emplace(neighbor); - } - } - } - } - } - unsigned n_layers_hsc = hscTopology().dddConstants().layers(true); - unsigned first_layer_hsc = hscTopology().dddConstants().firstLayer(); - for (unsigned layer = first_layer_hsc; layer <= first_layer_hsc + n_layers_hsc; layer++) { - int type = hscTopology().dddConstants().getTypeTrap(layer); - for (const auto& module_ncells : number_trigger_cells_in_wafers_sci_) { - unsigned trigger_wafer = module_ncells.first; - // loop on the trigger cells in each wafer - for (int trigger_cell = 1; trigger_cell < module_ncells.second; trigger_cell++) { - for (int zside : {-1, 1}) { - HGCalDetId trigger_cell_id(ForwardSubdetector::HGCHEB, zside, layer, type, trigger_wafer, trigger_cell); - if (!validTriggerCellFromCells(trigger_cell_id)) - invalid_triggercells_.emplace(trigger_cell_id); - for (unsigned neighbor : getNeighborsFromTriggerCell(trigger_cell_id)) { - if (!validTriggerCellFromCells(neighbor)) - invalid_triggercells_.emplace(neighbor); - } - } - } - } - } -} - -unsigned HGCalTriggerGeometryV9Imp1::packWaferCellId(unsigned subdet, unsigned wafer, unsigned cell) const { - unsigned packed_value = 0; - const int kSubdetMask = 0x7; - packed_value |= ((cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset); - packed_value |= ((wafer & HGCalDetId::kHGCalWaferMask) << HGCalDetId::kHGCalWaferOffset); - packed_value |= ((subdet & kSubdetMask) << (HGCalDetId::kHGCalWaferTypeOffset)); - return packed_value; -} - -unsigned HGCalTriggerGeometryV9Imp1::packLayerWaferId(unsigned layer, unsigned wafer) const { - unsigned packed_value = 0; - unsigned subdet = ForwardSubdetector::HGCEE; - if (layer > heOffset_) { - layer -= heOffset_; - subdet = ForwardSubdetector::HGCHEF; - } - packed_value |= ((layer & HGCalDetId::kHGCalLayerMask) << HGCalDetId::kHGCalLayerOffset); - packed_value |= ((wafer & HGCalDetId::kHGCalWaferMask) << HGCalDetId::kHGCalWaferOffset); - packed_value |= ((subdet & DetId::kSubdetMask) << DetId::kSubdetOffset); - return packed_value; -} - -unsigned HGCalTriggerGeometryV9Imp1::packCellId(unsigned type, unsigned cell) const { - unsigned packed_value = 0; - packed_value |= ((cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset); - packed_value |= ((type & HGCSiliconDetId::kHGCalTypeMask) << HGCSiliconDetId::kHGCalTypeOffset); - return packed_value; -} - -unsigned HGCalTriggerGeometryV9Imp1::packCellId(unsigned type, unsigned cellU, unsigned cellV) const { - unsigned packed_value = 0; - packed_value |= ((cellU & HGCSiliconDetId::kHGCalCellUMask) << HGCSiliconDetId::kHGCalCellUOffset); - packed_value |= ((cellV & HGCSiliconDetId::kHGCalCellVMask) << HGCSiliconDetId::kHGCalCellVOffset); - packed_value |= ((type & HGCSiliconDetId::kHGCalTypeMask) << HGCSiliconDetId::kHGCalTypeOffset); - return packed_value; -} - -unsigned HGCalTriggerGeometryV9Imp1::packWaferId(int waferU, int waferV) const { - unsigned packed_value = 0; - unsigned waferUabs = std::abs(waferU); - unsigned waferVabs = std::abs(waferV); - unsigned waferUsign = (waferU >= 0) ? 0 : 1; - unsigned waferVsign = (waferV >= 0) ? 0 : 1; - packed_value |= ((waferUabs & HGCSiliconDetId::kHGCalWaferUMask) << HGCSiliconDetId::kHGCalWaferUOffset); - packed_value |= ((waferUsign & HGCSiliconDetId::kHGCalWaferUSignMask) << HGCSiliconDetId::kHGCalWaferUSignOffset); - packed_value |= ((waferVabs & HGCSiliconDetId::kHGCalWaferVMask) << HGCSiliconDetId::kHGCalWaferVOffset); - packed_value |= ((waferVsign & HGCSiliconDetId::kHGCalWaferVSignMask) << HGCSiliconDetId::kHGCalWaferVSignOffset); - return packed_value; -} - -unsigned HGCalTriggerGeometryV9Imp1::packIetaIphi(unsigned ieta, unsigned iphi) const { - unsigned packed_value = 0; - packed_value |= ((iphi & HGCScintillatorDetId::kHGCalPhiMask) << HGCScintillatorDetId::kHGCalPhiOffset); - packed_value |= ((ieta & HGCScintillatorDetId::kHGCalRadiusMask) << HGCScintillatorDetId::kHGCalRadiusOffset); - return packed_value; -} - -void HGCalTriggerGeometryV9Imp1::unpackWaferCellId(unsigned wafer_cell, unsigned& wafer, unsigned& cell) const { - cell = wafer_cell & HGCalDetId::kHGCalCellMask; - wafer = (wafer_cell >> HGCalDetId::kHGCalWaferOffset) & HGCalDetId::kHGCalWaferMask; -} - -void HGCalTriggerGeometryV9Imp1::unpackLayerWaferId(unsigned layer_wafer, unsigned& layer, unsigned& wafer) const { - layer = (layer_wafer >> HGCalDetId::kHGCalLayerOffset) & HGCalDetId::kHGCalLayerMask; - wafer = (layer_wafer >> HGCalDetId::kHGCalWaferOffset) & HGCalDetId::kHGCalWaferMask; - unsigned subdet = (layer_wafer >> DetId::kSubdetOffset) & DetId::kSubdetMask; - if (subdet == ForwardSubdetector::HGCHEF) - layer += heOffset_; -} - -void HGCalTriggerGeometryV9Imp1::unpackCellId(unsigned cell, unsigned& cellU, unsigned& cellV) const { - cellU = (cell >> HGCSiliconDetId::kHGCalCellUOffset) & HGCSiliconDetId::kHGCalCellUMask; - cellV = (cell >> HGCSiliconDetId::kHGCalCellVOffset) & HGCSiliconDetId::kHGCalCellVMask; -} - -void HGCalTriggerGeometryV9Imp1::unpackWaferId(unsigned wafer, int& waferU, int& waferV) const { - unsigned waferUAbs = (wafer >> HGCSiliconDetId::kHGCalWaferUOffset) & HGCSiliconDetId::kHGCalWaferUMask; - unsigned waferVAbs = (wafer >> HGCSiliconDetId::kHGCalWaferVOffset) & HGCSiliconDetId::kHGCalWaferVMask; - waferU = (((wafer >> HGCSiliconDetId::kHGCalWaferUSignOffset) & HGCSiliconDetId::kHGCalWaferUSignMask) ? -waferUAbs - : waferUAbs); - waferV = (((wafer >> HGCSiliconDetId::kHGCalWaferVSignOffset) & HGCSiliconDetId::kHGCalWaferVSignMask) ? -waferVAbs - : waferVAbs); -} - -void HGCalTriggerGeometryV9Imp1::unpackIetaIphi(unsigned ieta_iphi, unsigned& ieta, unsigned& iphi) const { - iphi = (ieta_iphi >> HGCScintillatorDetId::kHGCalPhiOffset) & HGCScintillatorDetId::kHGCalPhiMask; - ieta = (ieta_iphi >> HGCScintillatorDetId::kHGCalRadiusOffset) & HGCScintillatorDetId::kHGCalRadiusMask; -} - -bool HGCalTriggerGeometryV9Imp1::validCell(unsigned cell_id) const { - bool is_valid = false; - unsigned det = DetId(cell_id).det(); - switch (det) { - case DetId::HGCalEE: - is_valid = eeTopology().valid(cell_id); - break; - case DetId::HGCalHSi: - is_valid = hsiTopology().valid(cell_id); - break; - case DetId::HGCalHSc: - is_valid = hscTopology().valid(cell_id); - break; - case DetId::Forward: - is_valid = noseTopology().valid(cell_id); - break; - default: - is_valid = false; - break; - } - return is_valid; -} - -bool HGCalTriggerGeometryV9Imp1::validTriggerCell(const unsigned trigger_cell_id) const { - return invalid_triggercells_.find(trigger_cell_id) == invalid_triggercells_.end(); -} - -bool HGCalTriggerGeometryV9Imp1::disconnectedModule(const unsigned module_id) const { - bool disconnected = false; - if (disconnected_modules_.find(HGCalDetId(module_id).wafer()) != disconnected_modules_.end()) - disconnected = true; - if (disconnected_layers_.find(layerWithOffset(module_id)) != disconnected_layers_.end()) - disconnected = true; - return disconnected; -} - -unsigned HGCalTriggerGeometryV9Imp1::triggerLayer(const unsigned id) const { - unsigned layer = layerWithOffset(id); - if (layer >= trigger_layers_.size()) - return 0; - return trigger_layers_[layer]; -} - -bool HGCalTriggerGeometryV9Imp1::validTriggerCellFromCells(const unsigned trigger_cell_id) const { - // Check the validity of a trigger cell with the - // validity of the cells. One valid cell in the - // trigger cell is enough to make the trigger cell - // valid. - HGCalDetId trigger_cell_det_id(trigger_cell_id); - unsigned subdet = trigger_cell_det_id.subdetId(); - const geom_set cells = getCellsFromTriggerCell(trigger_cell_id); - bool is_valid = false; - for (const auto cell_id : cells) { - is_valid |= validCellId(subdet, cell_id); - if (is_valid) - break; - } - return is_valid; -} - -bool HGCalTriggerGeometryV9Imp1::validCellId(unsigned subdet, unsigned cell_id) const { - bool is_valid = false; - switch (subdet) { - case ForwardSubdetector::HGCEE: - is_valid = eeTopology().valid(cell_id); - break; - case ForwardSubdetector::HGCHEF: - is_valid = hsiTopology().valid(cell_id); - break; - case ForwardSubdetector::HGCHEB: - is_valid = hscTopology().valid(cell_id); - break; - default: - is_valid = false; - break; - } - return is_valid; -} - -unsigned HGCalTriggerGeometryV9Imp1::packTriggerCell(unsigned module, unsigned trigger_cell) const { - unsigned packed_value = 0; - packed_value |= ((trigger_cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset); - packed_value |= ((module & HGCalDetId::kHGCalWaferMask) << HGCalDetId::kHGCalWaferOffset); - return packed_value; -} - -unsigned HGCalTriggerGeometryV9Imp1::packTriggerCellWithType(unsigned type, - unsigned module, - unsigned trigger_cell) const { - unsigned packed_value = 0; - packed_value |= ((trigger_cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset); - packed_value |= ((module & HGCalDetId::kHGCalWaferMask) << HGCalDetId::kHGCalWaferOffset); - packed_value |= ((type & HGCalDetId::kHGCalWaferTypeMask) << HGCalDetId::kHGCalWaferTypeOffset); - return packed_value; -} - -int HGCalTriggerGeometryV9Imp1::detIdWaferType(unsigned det, unsigned layer, short waferU, short waferV) const { - int wafer_type = 0; - switch (det) { - case DetId::HGCalEE: - wafer_type = eeTopology().dddConstants().getTypeHex(layer, waferU, waferV); - break; - case DetId::HGCalHSi: - wafer_type = hsiTopology().dddConstants().getTypeHex(layer, waferU, waferV); - break; - default: - break; - }; - return wafer_type; -} - -unsigned HGCalTriggerGeometryV9Imp1::layerWithOffset(unsigned id) const { - HGCalDetId detid(id); - unsigned layer = 0; - switch (detid.subdetId()) { - case ForwardSubdetector::HGCEE: - layer = detid.layer(); - break; - case ForwardSubdetector::HGCHEF: - layer = heOffset_ + detid.layer(); - break; - case ForwardSubdetector::HGCHEB: - layer = heOffset_ + detid.layer(); - break; - }; - return layer; -} - -DEFINE_EDM_PLUGIN(HGCalTriggerGeometryFactory, HGCalTriggerGeometryV9Imp1, "HGCalTriggerGeometryV9Imp1"); diff --git a/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryV9Imp2.cc b/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryV9Imp2.cc index a78add1871c75..5b3f9949839c1 100644 --- a/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryV9Imp2.cc +++ b/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryV9Imp2.cc @@ -4,7 +4,6 @@ #include "DataFormats/ForwardDetId/interface/HGCSiliconDetIdToROC.h" #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" #include "DataFormats/ForwardDetId/interface/HGCalTriggerDetId.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "FWCore/ParameterSet/interface/FileInPath.h" #include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h" #include "DataFormats/ForwardDetId/interface/HFNoseDetIdToModule.h" @@ -19,7 +18,6 @@ class HGCalTriggerGeometryV9Imp2 : public HGCalTriggerGeometryBase { public: HGCalTriggerGeometryV9Imp2(const edm::ParameterSet& conf); - void initialize(const CaloGeometry*) final; void initialize(const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*) final; void initialize(const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*) final; void reset() final; @@ -37,6 +35,19 @@ class HGCalTriggerGeometryV9Imp2 : public HGCalTriggerGeometryBase { geom_set getNeighborsFromTriggerCell(const unsigned) const final; + geom_set getStage1FpgasFromStage2Fpga(const unsigned) const final; + geom_set getStage2FpgasFromStage1Fpga(const unsigned) const final; + + geom_set getStage1LinksFromStage2Fpga(const unsigned) const final; + unsigned getStage1FpgaFromStage1Link(const unsigned) const final; + unsigned getStage2FpgaFromStage1Link(const unsigned) const final; + geom_set getStage1LinksFromStage1Fpga(const unsigned) const final; + geom_set getLpgbtsFromStage1Fpga(const unsigned) const final; + unsigned getStage1FpgaFromLpgbt(const unsigned) const final; + geom_set getModulesFromLpgbt(const unsigned) const final; + geom_set getLpgbtsFromModule(const unsigned) const final; + unsigned getStage1FpgaFromModule(const unsigned module_id) const final; + unsigned getLinksInModule(const unsigned module_id) const final; unsigned getModuleSize(const unsigned module_id) const final; @@ -116,11 +127,6 @@ void HGCalTriggerGeometryV9Imp2::reset() { cache_missing_wafers_.clear(); } -void HGCalTriggerGeometryV9Imp2::initialize(const CaloGeometry* calo_geometry) { - throw cms::Exception("BadGeometry") - << "HGCalTriggerGeometryV9Imp2 geometry cannot be initialized with the V7/V8 HGCAL geometry"; -} - void HGCalTriggerGeometryV9Imp2::initialize(const HGCalGeometry* hgc_ee_geometry, const HGCalGeometry* hgc_hsi_geometry, const HGCalGeometry* hgc_hsc_geometry) { @@ -827,4 +833,59 @@ unsigned HGCalTriggerGeometryV9Imp2::layerWithOffset(unsigned id) const { return layer; } +HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp2::getStage1FpgasFromStage2Fpga(const unsigned) const { + geom_set stage1_ids; + return stage1_ids; +} + +HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp2::getStage2FpgasFromStage1Fpga(const unsigned) const { + geom_set stage2_ids; + return stage2_ids; +} + +HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp2::getStage1LinksFromStage2Fpga(const unsigned) const { + geom_set stage1link_ids; + return stage1link_ids; +} + +unsigned HGCalTriggerGeometryV9Imp2::getStage1FpgaFromStage1Link(const unsigned) const { + unsigned stage1_id = 0; + return stage1_id; +} + +unsigned HGCalTriggerGeometryV9Imp2::getStage2FpgaFromStage1Link(const unsigned) const { + unsigned stage2_id = 0; + return stage2_id; +} + +HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp2::getStage1LinksFromStage1Fpga(const unsigned) const { + geom_set stage1link_ids; + return stage1link_ids; +} + +HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp2::getLpgbtsFromStage1Fpga(const unsigned) const { + geom_set lpgbt_ids; + return lpgbt_ids; +} + +unsigned HGCalTriggerGeometryV9Imp2::getStage1FpgaFromLpgbt(const unsigned) const { + unsigned stage1_id = 0; + return stage1_id; +} + +HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp2::getModulesFromLpgbt(const unsigned) const { + geom_set modules; + return modules; +} + +HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp2::getLpgbtsFromModule(const unsigned) const { + geom_set lpgbt_ids; + return lpgbt_ids; +} + +unsigned HGCalTriggerGeometryV9Imp2::getStage1FpgaFromModule(const unsigned) const { + unsigned stage1_id = 0; + return stage1_id; +} + DEFINE_EDM_PLUGIN(HGCalTriggerGeometryFactory, HGCalTriggerGeometryV9Imp2, "HGCalTriggerGeometryV9Imp2"); diff --git a/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryV9Imp3.cc b/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryV9Imp3.cc new file mode 100644 index 0000000000000..1af3560e4c233 --- /dev/null +++ b/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryV9Imp3.cc @@ -0,0 +1,1094 @@ +#include "Geometry/HGCalCommonData/interface/HGCalGeomRotation.h" +#include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" +#include "DataFormats/ForwardDetId/interface/HFNoseTriggerDetId.h" +#include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" +#include "DataFormats/ForwardDetId/interface/HGCSiliconDetIdToROC.h" +#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" +#include "DataFormats/ForwardDetId/interface/HGCalTriggerDetId.h" +#include "FWCore/ParameterSet/interface/FileInPath.h" +#include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h" +#include "DataFormats/ForwardDetId/interface/HGCalTriggerModuleDetId.h" +#include "DataFormats/ForwardDetId/interface/HGCalTriggerBackendDetId.h" +#include "DataFormats/ForwardDetId/interface/HFNoseDetIdToModule.h" + +#include +#include + +#include +using json = nlohmann::json; + +class HGCalTriggerGeometryV9Imp3 : public HGCalTriggerGeometryBase { +public: + HGCalTriggerGeometryV9Imp3(const edm::ParameterSet& conf); + + void initialize(const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*) final; + void initialize(const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*) final; + void reset() final; + + unsigned getTriggerCellFromCell(const unsigned) const final; + unsigned getModuleFromCell(const unsigned) const final; + unsigned getModuleFromTriggerCell(const unsigned) const final; + + geom_set getCellsFromTriggerCell(const unsigned) const final; + geom_set getCellsFromModule(const unsigned) const final; + geom_set getTriggerCellsFromModule(const unsigned) const final; + + geom_ordered_set getOrderedCellsFromModule(const unsigned) const final; + geom_ordered_set getOrderedTriggerCellsFromModule(const unsigned) const final; + + geom_set getNeighborsFromTriggerCell(const unsigned) const final; + + geom_set getStage1FpgasFromStage2Fpga(const unsigned) const final; + geom_set getStage2FpgasFromStage1Fpga(const unsigned) const final; + + geom_set getStage1LinksFromStage2Fpga(const unsigned) const final; + unsigned getStage1FpgaFromStage1Link(const unsigned) const final; + unsigned getStage2FpgaFromStage1Link(const unsigned) const final; + geom_set getStage1LinksFromStage1Fpga(const unsigned) const final; + geom_set getLpgbtsFromStage1Fpga(const unsigned) const final; + unsigned getStage1FpgaFromLpgbt(const unsigned) const final; + geom_set getModulesFromLpgbt(const unsigned) const final; + geom_set getLpgbtsFromModule(const unsigned) const final; + unsigned getStage1FpgaFromModule(const unsigned module_id) const final; + + unsigned getLinksInModule(const unsigned module_id) const final; + unsigned getModuleSize(const unsigned module_id) const final; + + GlobalPoint getTriggerCellPosition(const unsigned) const final; + GlobalPoint getModulePosition(const unsigned) const final; + + bool validCell(const unsigned) const final; + bool validTriggerCell(const unsigned) const final; + bool disconnectedModule(const unsigned) const final; + unsigned lastTriggerLayer() const final { return last_trigger_layer_; } + unsigned triggerLayer(const unsigned) const final; + +private: + // HSc trigger cell grouping + unsigned hSc_triggercell_size_ = 2; + unsigned hSc_module_size_ = 12; // in TC units (144 TC / panel = 36 e-links) + unsigned hSc_wafers_per_module_ = 3; + + edm::FileInPath jsonMappingFile_; + + // rotation class + HGCalGeomRotation geom_rotation_120_ = {HGCalGeomRotation::SectorType::Sector120Degrees}; + + // module related maps + std::unordered_map links_per_module_; + + std::unordered_multimap stage2_to_stage1links_; + std::unordered_map stage1link_to_stage2_; + std::unordered_map stage1link_to_stage1_; + std::unordered_multimap stage1_to_stage1links_; + std::unordered_multimap stage1_to_lpgbts_; + std::unordered_map lpgbt_to_stage1_; + std::unordered_multimap lpgbt_to_modules_; + std::unordered_multimap module_to_lpgbts_; + std::unordered_map module_to_stage1_; + + // Disconnected modules and layers + std::unordered_set disconnected_layers_; + std::vector trigger_layers_; + std::vector trigger_nose_layers_; + unsigned last_trigger_layer_ = 0; + + //Scintillator layout + unsigned hSc_num_panels_per_sector_ = 8; + + // layer offsets + unsigned heOffset_ = 0; + unsigned noseLayers_ = 0; + unsigned totalLayers_ = 0; + + void fillMaps(); + bool validCellId(unsigned det, unsigned cell_id) const; + bool validTriggerCellFromCells(const unsigned) const; + + int detIdWaferType(unsigned det, unsigned layer, short waferU, short waferV) const; + void layerWithoutOffsetAndSubdetId(unsigned& layer, int& subdetId, bool isSilicon) const; + unsigned packLayerSubdetWaferId(unsigned layer, int subdet, int waferU, int waferV) const; + void unpackLayerSubdetWaferId(unsigned wafer, unsigned& layer, int& subdet, int& waferU, int& waferV) const; + HGCalGeomRotation::WaferCentring getWaferCentring(unsigned layer, int subdet) const; + void etaphiMappingFromSector0(int& ieta, int& iphi, unsigned sector) const; + unsigned etaphiMappingToSector0(int& ieta, int& iphi) const; + unsigned layerWithOffset(unsigned) const; + unsigned getNextSector(const unsigned sector) const; + unsigned getPreviousSector(const unsigned sector) const; +}; + +HGCalTriggerGeometryV9Imp3::HGCalTriggerGeometryV9Imp3(const edm::ParameterSet& conf) + : HGCalTriggerGeometryBase(conf), + hSc_triggercell_size_(conf.getParameter("ScintillatorTriggerCellSize")), + hSc_module_size_(conf.getParameter("ScintillatorModuleSize")), + jsonMappingFile_(conf.getParameter("JsonMappingFile")) { + const unsigned ntc_per_wafer = 48; + hSc_wafers_per_module_ = std::round(hSc_module_size_ * hSc_module_size_ / float(ntc_per_wafer)); + if (ntc_per_wafer * hSc_wafers_per_module_ < hSc_module_size_ * hSc_module_size_) { + hSc_wafers_per_module_++; + } + std::vector tmp_vector = conf.getParameter>("DisconnectedLayers"); + std::move(tmp_vector.begin(), tmp_vector.end(), std::inserter(disconnected_layers_, disconnected_layers_.end())); +} + +void HGCalTriggerGeometryV9Imp3::reset() { + stage2_to_stage1links_.clear(); + stage1link_to_stage2_.clear(); + stage1link_to_stage1_.clear(); + stage1_to_stage1links_.clear(); + stage1_to_lpgbts_.clear(); + lpgbt_to_stage1_.clear(); + lpgbt_to_modules_.clear(); + module_to_lpgbts_.clear(); + module_to_stage1_.clear(); +} + +void HGCalTriggerGeometryV9Imp3::initialize(const HGCalGeometry* hgc_ee_geometry, + const HGCalGeometry* hgc_hsi_geometry, + const HGCalGeometry* hgc_hsc_geometry) { + setEEGeometry(hgc_ee_geometry); + setHSiGeometry(hgc_hsi_geometry); + setHScGeometry(hgc_hsc_geometry); + heOffset_ = eeTopology().dddConstants().layers(true); + totalLayers_ = heOffset_ + hsiTopology().dddConstants().layers(true); + trigger_layers_.resize(totalLayers_ + 1); + trigger_layers_[0] = 0; // layer number 0 doesn't exist + unsigned trigger_layer = 1; + for (unsigned layer = 1; layer < trigger_layers_.size(); layer++) { + if (disconnected_layers_.find(layer) == disconnected_layers_.end()) { + // Increase trigger layer number if the layer is not disconnected + trigger_layers_[layer] = trigger_layer; + trigger_layer++; + } else { + trigger_layers_[layer] = 0; + } + } + last_trigger_layer_ = trigger_layer - 1; + fillMaps(); +} + +void HGCalTriggerGeometryV9Imp3::initialize(const HGCalGeometry* hgc_ee_geometry, + const HGCalGeometry* hgc_hsi_geometry, + const HGCalGeometry* hgc_hsc_geometry, + const HGCalGeometry* hgc_nose_geometry) { + setEEGeometry(hgc_ee_geometry); + setHSiGeometry(hgc_hsi_geometry); + setHScGeometry(hgc_hsc_geometry); + setNoseGeometry(hgc_nose_geometry); + + heOffset_ = eeTopology().dddConstants().layers(true); + totalLayers_ = heOffset_ + hsiTopology().dddConstants().layers(true); + + trigger_layers_.resize(totalLayers_ + 1); + trigger_layers_[0] = 0; // layer number 0 doesn't exist + unsigned trigger_layer = 1; + for (unsigned layer = 1; layer < trigger_layers_.size(); layer++) { + if (disconnected_layers_.find(layer) == disconnected_layers_.end()) { + // Increase trigger layer number if the layer is not disconnected + trigger_layers_[layer] = trigger_layer; + trigger_layer++; + } else { + trigger_layers_[layer] = 0; + } + } + last_trigger_layer_ = trigger_layer - 1; + fillMaps(); + + noseLayers_ = noseTopology().dddConstants().layers(true); + + trigger_nose_layers_.resize(noseLayers_ + 1); + trigger_nose_layers_[0] = 0; // layer number 0 doesn't exist + unsigned trigger_nose_layer = 1; + for (unsigned layer = 1; layer < trigger_nose_layers_.size(); layer++) { + trigger_nose_layers_[layer] = trigger_nose_layer; + trigger_nose_layer++; + } +} + +unsigned HGCalTriggerGeometryV9Imp3::getTriggerCellFromCell(const unsigned cell_id) const { + unsigned det = DetId(cell_id).det(); + unsigned trigger_cell_id = 0; + // Scintillator + if (det == DetId::HGCalHSc) { + // Very rough mapping from cells to TC + HGCScintillatorDetId cell_sc_id(cell_id); + int ieta = ((cell_sc_id.ietaAbs() - 1) / hSc_triggercell_size_ + 1) * cell_sc_id.zside(); + int iphi = (cell_sc_id.iphi() - 1) / hSc_triggercell_size_ + 1; + trigger_cell_id = HGCScintillatorDetId(cell_sc_id.type(), cell_sc_id.layer(), ieta, iphi); + } + // HFNose + else if (det == DetId::Forward && DetId(cell_id).subdetId() == ForwardSubdetector::HFNose) { + HFNoseDetId cell_nose_id(cell_id); + trigger_cell_id = HFNoseTriggerDetId(HGCalTriggerSubdetector::HFNoseTrigger, + cell_nose_id.zside(), + cell_nose_id.type(), + cell_nose_id.layer(), + cell_nose_id.waferU(), + cell_nose_id.waferV(), + cell_nose_id.triggerCellU(), + cell_nose_id.triggerCellV()); + } + // Silicon + else if (det == DetId::HGCalEE || det == DetId::HGCalHSi) { + HGCSiliconDetId cell_si_id(cell_id); + trigger_cell_id = HGCalTriggerDetId( + det == DetId::HGCalEE ? HGCalTriggerSubdetector::HGCalEETrigger : HGCalTriggerSubdetector::HGCalHSiTrigger, + cell_si_id.zside(), + cell_si_id.type(), + cell_si_id.layer(), + cell_si_id.waferU(), + cell_si_id.waferV(), + cell_si_id.triggerCellU(), + cell_si_id.triggerCellV()); + } + return trigger_cell_id; +} + +unsigned HGCalTriggerGeometryV9Imp3::getModuleFromCell(const unsigned cell_id) const { + return getModuleFromTriggerCell(getTriggerCellFromCell(cell_id)); +} + +unsigned HGCalTriggerGeometryV9Imp3::getModuleFromTriggerCell(const unsigned trigger_cell_id) const { + unsigned det = DetId(trigger_cell_id).det(); + int zside = 0; + unsigned tc_type = 1; + unsigned layer = 0; + unsigned module_id = 0; + + // Scintillator + if (det == DetId::HGCalHSc) { + HGCScintillatorDetId trigger_cell_sc_id(trigger_cell_id); + tc_type = trigger_cell_sc_id.type(); + layer = trigger_cell_sc_id.layer(); + zside = trigger_cell_sc_id.zside(); + int ietamin = hscTopology().dddConstants().getREtaRange(layer).first; + int ietamin_tc = ((ietamin - 1) / hSc_triggercell_size_ + 1); + int ieta = ((trigger_cell_sc_id.ietaAbs() - ietamin_tc) / hSc_module_size_ + 1); + int iphi = (trigger_cell_sc_id.iphi() - 1) / hSc_module_size_ + 1; + unsigned sector = etaphiMappingToSector0(ieta, iphi); + module_id = + HGCalTriggerModuleDetId(HGCalTriggerSubdetector::HGCalHScTrigger, zside, tc_type, layer, sector, ieta, iphi); + } + // HFNose + else if (det == DetId::HGCalTrigger and + HGCalTriggerDetId(trigger_cell_id).subdet() == HGCalTriggerSubdetector::HFNoseTrigger) { + HFNoseTriggerDetId trigger_cell_trig_id(trigger_cell_id); + tc_type = trigger_cell_trig_id.type(); + layer = trigger_cell_trig_id.layer(); + zside = trigger_cell_trig_id.zside(); + int waferu = trigger_cell_trig_id.waferU(); + int waferv = trigger_cell_trig_id.waferV(); + unsigned sector = geom_rotation_120_.uvMappingToSector0( + getWaferCentring(layer, HGCalTriggerSubdetector::HFNoseTrigger), waferu, waferv); + module_id = + HGCalTriggerModuleDetId(HGCalTriggerSubdetector::HFNoseTrigger, zside, tc_type, layer, sector, waferu, waferv); + } + // Silicon + else { + HGCalTriggerDetId trigger_cell_trig_id(trigger_cell_id); + unsigned subdet = trigger_cell_trig_id.subdet(); + tc_type = trigger_cell_trig_id.type(); + layer = trigger_cell_trig_id.layer(); + zside = trigger_cell_trig_id.zside(); + int waferu = trigger_cell_trig_id.waferU(); + int waferv = trigger_cell_trig_id.waferV(); + unsigned sector = geom_rotation_120_.uvMappingToSector0(getWaferCentring(layer, subdet), waferu, waferv); + module_id = HGCalTriggerModuleDetId(HGCalTriggerSubdetector(subdet), zside, tc_type, layer, sector, waferu, waferv); + } + return module_id; +} + +HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp3::getCellsFromTriggerCell( + const unsigned trigger_cell_id) const { + DetId trigger_cell_det_id(trigger_cell_id); + unsigned det = trigger_cell_det_id.det(); + geom_set cell_det_ids; + // Scintillator + if (det == DetId::HGCalHSc) { + HGCScintillatorDetId trigger_cell_sc_id(trigger_cell_id); + int ieta0 = (trigger_cell_sc_id.ietaAbs() - 1) * hSc_triggercell_size_ + 1; + int iphi0 = (trigger_cell_sc_id.iphi() - 1) * hSc_triggercell_size_ + 1; + for (int ietaAbs = ieta0; ietaAbs < ieta0 + (int)hSc_triggercell_size_; ietaAbs++) { + int ieta = ietaAbs * trigger_cell_sc_id.zside(); + for (int iphi = iphi0; iphi < iphi0 + (int)hSc_triggercell_size_; iphi++) { + unsigned cell_id = HGCScintillatorDetId(trigger_cell_sc_id.type(), trigger_cell_sc_id.layer(), ieta, iphi); + if (validCellId(DetId::HGCalHSc, cell_id)) + cell_det_ids.emplace(cell_id); + } + } + } + // HFNose + else if (det == DetId::HGCalTrigger and + HGCalTriggerDetId(trigger_cell_id).subdet() == HGCalTriggerSubdetector::HFNoseTrigger) { + HFNoseTriggerDetId trigger_cell_nose_id(trigger_cell_id); + int layer = trigger_cell_nose_id.layer(); + int zside = trigger_cell_nose_id.zside(); + int type = trigger_cell_nose_id.type(); + int waferu = trigger_cell_nose_id.waferU(); + int waferv = trigger_cell_nose_id.waferV(); + std::vector cellus = trigger_cell_nose_id.cellU(); + std::vector cellvs = trigger_cell_nose_id.cellV(); + for (unsigned ic = 0; ic < cellus.size(); ic++) { + HFNoseDetId cell_det_id(zside, type, layer, waferu, waferv, cellus[ic], cellvs[ic]); + cell_det_ids.emplace(cell_det_id); + } + } + // Silicon + else { + HGCalTriggerDetId trigger_cell_trig_id(trigger_cell_id); + unsigned subdet = trigger_cell_trig_id.subdet(); + if (subdet == HGCalTriggerSubdetector::HGCalEETrigger || subdet == HGCalTriggerSubdetector::HGCalHSiTrigger) { + DetId::Detector cell_det = (subdet == HGCalTriggerSubdetector::HGCalEETrigger ? DetId::HGCalEE : DetId::HGCalHSi); + int layer = trigger_cell_trig_id.layer(); + int zside = trigger_cell_trig_id.zside(); + int type = trigger_cell_trig_id.type(); + int waferu = trigger_cell_trig_id.waferU(); + int waferv = trigger_cell_trig_id.waferV(); + std::vector cellus = trigger_cell_trig_id.cellU(); + std::vector cellvs = trigger_cell_trig_id.cellV(); + for (unsigned ic = 0; ic < cellus.size(); ic++) { + HGCSiliconDetId cell_det_id(cell_det, zside, type, layer, waferu, waferv, cellus[ic], cellvs[ic]); + cell_det_ids.emplace(cell_det_id); + } + } + } + return cell_det_ids; +} + +HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp3::getCellsFromModule(const unsigned module_id) const { + geom_set cell_det_ids; + geom_set trigger_cells = getTriggerCellsFromModule(module_id); + + for (auto trigger_cell_id : trigger_cells) { + geom_set cells = getCellsFromTriggerCell(trigger_cell_id); + cell_det_ids.insert(cells.begin(), cells.end()); + } + return cell_det_ids; +} + +HGCalTriggerGeometryBase::geom_ordered_set HGCalTriggerGeometryV9Imp3::getOrderedCellsFromModule( + const unsigned module_id) const { + geom_ordered_set cell_det_ids; + geom_ordered_set trigger_cells = getOrderedTriggerCellsFromModule(module_id); + for (auto trigger_cell_id : trigger_cells) { + geom_set cells = getCellsFromTriggerCell(trigger_cell_id); + cell_det_ids.insert(cells.begin(), cells.end()); + } + return cell_det_ids; +} + +HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp3::getTriggerCellsFromModule( + const unsigned module_id) const { + HGCalTriggerModuleDetId hgc_module_id(module_id); + unsigned subdet = hgc_module_id.triggerSubdetId(); + + geom_set trigger_cell_det_ids; + // Scintillator + if (subdet == HGCalTriggerSubdetector::HGCalHScTrigger) { + int ietamin = hscTopology().dddConstants().getREtaRange(hgc_module_id.layer()).first; + int ietamin_tc = ((ietamin - 1) / hSc_triggercell_size_ + 1); + int ieta0 = (hgc_module_id.eta() - 1) * hSc_module_size_ + ietamin_tc; + int iphi0 = hgc_module_id.phi(); + etaphiMappingFromSector0(ieta0, iphi0, hgc_module_id.sector()); + iphi0 = (iphi0 - 1) * hSc_module_size_ + 1; + for (int ietaAbs = ieta0; ietaAbs < ieta0 + (int)hSc_module_size_; ietaAbs++) { + int ieta = ietaAbs * hgc_module_id.zside(); + for (int iphi = iphi0; iphi < iphi0 + (int)hSc_module_size_; iphi++) { + unsigned trigger_cell_id = HGCScintillatorDetId(hgc_module_id.type(), hgc_module_id.layer(), ieta, iphi); + if (validTriggerCellFromCells(trigger_cell_id)) + trigger_cell_det_ids.emplace(trigger_cell_id); + } + } + } + // HFNose + else if (subdet == HGCalTriggerSubdetector::HFNoseTrigger) { + HFNoseDetId module_nose_id(module_id); + HFNoseDetIdToModule hfn; + std::vector ids = hfn.getTriggerDetIds(module_nose_id); + for (auto const& idx : ids) { + if (validTriggerCellFromCells(idx.rawId())) + trigger_cell_det_ids.emplace(idx); + } + } + // Silicon + else { + HGCSiliconDetIdToROC tc2roc; + int moduleU = hgc_module_id.moduleU(); + int moduleV = hgc_module_id.moduleV(); + unsigned layer = hgc_module_id.layer(); + + //Rotate to sector + geom_rotation_120_.uvMappingFromSector0(getWaferCentring(layer, subdet), moduleU, moduleV, hgc_module_id.sector()); + + DetId::Detector det = (subdet == HGCalTriggerSubdetector::HGCalEETrigger ? DetId::HGCalEE : DetId::HGCalHSi); + + unsigned wafer_type = detIdWaferType(det, layer, moduleU, moduleV); + int nroc = (wafer_type == HGCSiliconDetId::HGCalFine ? 6 : 3); + // Loop on ROCs in wafer + for (int roc = 1; roc <= nroc; roc++) { + // loop on TCs in ROC + auto tc_uvs = tc2roc.getTriggerId(roc, wafer_type); + for (const auto& tc_uv : tc_uvs) { + HGCalTriggerDetId trigger_cell_id( + subdet, hgc_module_id.zside(), wafer_type, layer, moduleU, moduleV, tc_uv.first, tc_uv.second); + if (validTriggerCellFromCells(trigger_cell_id.rawId())) + trigger_cell_det_ids.emplace(trigger_cell_id); + } + } + } + + return trigger_cell_det_ids; +} + +HGCalTriggerGeometryBase::geom_ordered_set HGCalTriggerGeometryV9Imp3::getOrderedTriggerCellsFromModule( + const unsigned module_id) const { + HGCalTriggerModuleDetId hgc_module_id(module_id); + unsigned subdet = hgc_module_id.triggerSubdetId(); + + geom_ordered_set trigger_cell_det_ids; + + // Scintillator + if (subdet == HGCalTriggerSubdetector::HGCalHScTrigger) { + int ieta0 = hgc_module_id.eta() * hSc_module_size_; + int iphi0 = (hgc_module_id.phi() * (hgc_module_id.sector() + 1)) * hSc_module_size_; + + for (int ietaAbs = ieta0; ietaAbs < ieta0 + (int)hSc_module_size_; ietaAbs++) { + int ieta = ietaAbs * hgc_module_id.zside(); + for (int iphi = iphi0; iphi < iphi0 + (int)hSc_module_size_; iphi++) { + unsigned trigger_cell_id = HGCScintillatorDetId(hgc_module_id.type(), hgc_module_id.layer(), ieta, iphi); + if (validTriggerCellFromCells(trigger_cell_id)) + trigger_cell_det_ids.emplace(trigger_cell_id); + } + } + } + + // HFNose + else if (subdet == HGCalTriggerSubdetector::HFNoseTrigger) { + HFNoseDetId module_nose_id(module_id); + HFNoseDetIdToModule hfn; + std::vector ids = hfn.getTriggerDetIds(module_nose_id); + for (auto const& idx : ids) { + if (validTriggerCellFromCells(idx.rawId())) + trigger_cell_det_ids.emplace(idx); + } + } + // Silicon + else { + HGCSiliconDetIdToROC tc2roc; + int moduleU = hgc_module_id.moduleU(); + int moduleV = hgc_module_id.moduleV(); + unsigned layer = hgc_module_id.layer(); + + //Rotate to sector + geom_rotation_120_.uvMappingFromSector0(getWaferCentring(layer, subdet), moduleU, moduleV, hgc_module_id.sector()); + + DetId::Detector det = (subdet == HGCalTriggerSubdetector::HGCalEETrigger ? DetId::HGCalEE : DetId::HGCalHSi); + + unsigned wafer_type = detIdWaferType(det, layer, moduleU, moduleV); + int nroc = (wafer_type == HGCSiliconDetId::HGCalFine ? 6 : 3); + // Loop on ROCs in wafer + for (int roc = 1; roc <= nroc; roc++) { + // loop on TCs in ROC + auto tc_uvs = tc2roc.getTriggerId(roc, wafer_type); + for (const auto& tc_uv : tc_uvs) { + HGCalTriggerDetId trigger_cell_id( + subdet, hgc_module_id.zside(), wafer_type, layer, moduleU, moduleV, tc_uv.first, tc_uv.second); + if (validTriggerCellFromCells(trigger_cell_id.rawId())) + trigger_cell_det_ids.emplace(trigger_cell_id); + } + } + } + + return trigger_cell_det_ids; +} + +HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp3::getNeighborsFromTriggerCell( + const unsigned trigger_cell_id) const { + throw cms::Exception("FeatureNotImplemented") << "Neighbor search is not implemented in HGCalTriggerGeometryV9Imp3"; +} + +unsigned HGCalTriggerGeometryV9Imp3::getLinksInModule(const unsigned module_id) const { + HGCalTriggerModuleDetId module_det_id(module_id); + unsigned subdet = module_det_id.triggerSubdetId(); + + unsigned links = 0; + // HF Nose + if (subdet == HGCalTriggerSubdetector::HFNoseTrigger) { + links = 1; + } + // TO ADD HFNOSE : getLinksInModule + // Silicon and Scintillator + else { + int packed_module = + packLayerSubdetWaferId(module_det_id.layer(), subdet, module_det_id.moduleU(), module_det_id.moduleV()); + links = links_per_module_.at(packed_module); + } + return links; +} + +unsigned HGCalTriggerGeometryV9Imp3::getModuleSize(const unsigned module_id) const { + unsigned nWafers = 1; + return nWafers; +} + +unsigned HGCalTriggerGeometryV9Imp3::getNextSector(const unsigned sector) const { + unsigned next_sector = 0; + if (sector < 2) { + next_sector = sector + 1; + } + return next_sector; +} + +unsigned HGCalTriggerGeometryV9Imp3::getPreviousSector(const unsigned sector) const { + unsigned previous_sector = 2; + if (sector > 0) { + previous_sector = sector - 1; + } + return previous_sector; +} + +HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp3::getStage1FpgasFromStage2Fpga( + const unsigned stage2_id) const { + geom_set stage1_ids; + + geom_set stage1_links = getStage1LinksFromStage2Fpga(stage2_id); + for (const auto& stage1_link : stage1_links) { + stage1_ids.emplace(getStage1FpgaFromStage1Link(stage1_link)); + } + + return stage1_ids; +} + +HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp3::getStage2FpgasFromStage1Fpga( + const unsigned stage1_id) const { + geom_set stage2_ids; + + geom_set stage1_links = getStage1LinksFromStage1Fpga(stage1_id); + for (const auto& stage1_link : stage1_links) { + stage2_ids.emplace(getStage2FpgaFromStage1Link(stage1_link)); + } + + return stage2_ids; +} + +HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp3::getStage1LinksFromStage2Fpga( + const unsigned stage2_id) const { + geom_set stage1link_ids; + HGCalTriggerBackendDetId id(stage2_id); + + auto stage2_itrs = stage2_to_stage1links_.equal_range(id.label()); + for (auto stage2_itr = stage2_itrs.first; stage2_itr != stage2_itrs.second; stage2_itr++) { + if (stage2_itr->second == true) { //link and stage2 FPGA are the same sector + stage1link_ids.emplace(HGCalTriggerBackendDetId( + id.zside(), HGCalTriggerBackendDetId::BackendType::Stage1Link, id.sector(), stage2_itr->second)); + } else { //link is from the next sector (anti-clockwise) + stage1link_ids.emplace(HGCalTriggerBackendDetId(id.zside(), + HGCalTriggerBackendDetId::BackendType::Stage1Link, + getNextSector(id.sector()), + stage2_itr->second)); + } + } + + return stage1link_ids; +} + +unsigned HGCalTriggerGeometryV9Imp3::getStage1FpgaFromStage1Link(const unsigned link_id) const { + HGCalTriggerBackendDetId id(link_id); + unsigned stage1_label = stage1link_to_stage1_.at(id.label()); + + return HGCalTriggerBackendDetId( + id.zside(), HGCalTriggerBackendDetId::BackendType::Stage1FPGA, id.sector(), stage1_label); +} + +unsigned HGCalTriggerGeometryV9Imp3::getStage2FpgaFromStage1Link(const unsigned link_id) const { + HGCalTriggerBackendDetId id(link_id); + bool same_sector = stage1link_to_stage2_.at(id.label()); + unsigned sector = id.sector(); + + if (!same_sector) { + sector = getPreviousSector(sector); + } + + return HGCalTriggerBackendDetId(id.zside(), HGCalTriggerBackendDetId::BackendType::Stage2FPGA, sector, 0); +} + +HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp3::getStage1LinksFromStage1Fpga( + const unsigned stage1_id) const { + geom_set stage1link_ids; + + HGCalTriggerBackendDetId id(stage1_id); + + auto stage1_itrs = stage1_to_stage1links_.equal_range(id.label()); + for (auto stage1_itr = stage1_itrs.first; stage1_itr != stage1_itrs.second; stage1_itr++) { + stage1link_ids.emplace(HGCalTriggerBackendDetId( + id.zside(), HGCalTriggerBackendDetId::BackendType::Stage1Link, id.sector(), stage1_itr->second)); + } + + return stage1link_ids; +} + +HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp3::getLpgbtsFromStage1Fpga(const unsigned stage1_id) const { + geom_set lpgbt_ids; + HGCalTriggerBackendDetId id(stage1_id); + + auto stage1_itrs = stage1_to_lpgbts_.equal_range(id.label()); + for (auto stage1_itr = stage1_itrs.first; stage1_itr != stage1_itrs.second; stage1_itr++) { + lpgbt_ids.emplace(HGCalTriggerBackendDetId( + id.zside(), HGCalTriggerBackendDetId::BackendType::LpGBT, id.sector(), stage1_itr->second)); + } + + return lpgbt_ids; +} + +unsigned HGCalTriggerGeometryV9Imp3::getStage1FpgaFromLpgbt(const unsigned lpgbt_id) const { + HGCalTriggerBackendDetId id(lpgbt_id); + unsigned stage1_label = lpgbt_to_stage1_.at(id.label()); + + return HGCalTriggerBackendDetId( + id.zside(), HGCalTriggerBackendDetId::BackendType::Stage1FPGA, id.sector(), stage1_label); +} + +HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp3::getModulesFromLpgbt(const unsigned lpgbt_id) const { + geom_set modules; + HGCalTriggerBackendDetId id(lpgbt_id); + + auto lpgbt_itrs = lpgbt_to_modules_.equal_range(id.label()); + for (auto lpgbt_itr = lpgbt_itrs.first; lpgbt_itr != lpgbt_itrs.second; lpgbt_itr++) { + unsigned layer = 0; + int moduleU = 0; + int moduleV = 0; + int subdet = 0; + unpackLayerSubdetWaferId(lpgbt_itr->second, layer, subdet, moduleU, moduleV); + unsigned det = 0; + switch (subdet) { + case HGCalTriggerSubdetector::HGCalEETrigger: + det = DetId::HGCalEE; + break; + case HGCalTriggerSubdetector::HGCalHSiTrigger: + det = DetId::HGCalHSi; + break; + case HGCalTriggerSubdetector::HGCalHScTrigger: + det = DetId::HGCalHSc; + break; + default: + det = DetId::HGCalEE; + break; + } + + int type = detIdWaferType(det, layer, moduleU, moduleV); + modules.emplace(HGCalTriggerModuleDetId( + HGCalTriggerSubdetector(subdet), id.zside(), type, layer, id.sector(), moduleU, moduleV)); + } + + return modules; +} + +HGCalTriggerGeometryV9Imp3::geom_set HGCalTriggerGeometryV9Imp3::getLpgbtsFromModule(const unsigned module_id) const { + geom_set lpgbt_ids; + HGCalTriggerModuleDetId id(module_id); + + auto module_itrs = module_to_lpgbts_.equal_range( + packLayerSubdetWaferId(id.layer(), id.triggerSubdetId(), id.moduleU(), id.moduleV())); + for (auto module_itr = module_itrs.first; module_itr != module_itrs.second; module_itr++) { + lpgbt_ids.emplace(HGCalTriggerBackendDetId( + id.zside(), HGCalTriggerBackendDetId::BackendType::LpGBT, id.sector(), module_itr->second)); + } + + return lpgbt_ids; +} + +unsigned HGCalTriggerGeometryV9Imp3::getStage1FpgaFromModule(const unsigned module_id) const { + HGCalTriggerModuleDetId id(module_id); + + unsigned stage1_label = + module_to_stage1_.at(packLayerSubdetWaferId(id.layer(), id.triggerSubdetId(), id.moduleU(), id.moduleV())); + + return HGCalTriggerBackendDetId( + id.zside(), HGCalTriggerBackendDetId::BackendType::Stage1FPGA, id.sector(), stage1_label); +} + +GlobalPoint HGCalTriggerGeometryV9Imp3::getTriggerCellPosition(const unsigned trigger_cell_det_id) const { + unsigned det = DetId(trigger_cell_det_id).det(); + + // Position: barycenter of the trigger cell. + Basic3DVector triggerCellVector(0., 0., 0.); + const auto cell_ids = getCellsFromTriggerCell(trigger_cell_det_id); + // Scintillator + if (det == DetId::HGCalHSc) { + for (const auto& cell : cell_ids) { + triggerCellVector += hscGeometry()->getPosition(cell).basicVector(); + } + } + // HFNose + else if (det == DetId::HGCalTrigger and + HGCalTriggerDetId(trigger_cell_det_id).subdet() == HGCalTriggerSubdetector::HFNoseTrigger) { + for (const auto& cell : cell_ids) { + HFNoseDetId cellDetId(cell); + triggerCellVector += noseGeometry()->getPosition(cellDetId).basicVector(); + } + } + // Silicon + else { + for (const auto& cell : cell_ids) { + HGCSiliconDetId cellDetId(cell); + triggerCellVector += (cellDetId.det() == DetId::HGCalEE ? eeGeometry()->getPosition(cellDetId) + : hsiGeometry()->getPosition(cellDetId)) + .basicVector(); + } + } + return GlobalPoint(triggerCellVector / cell_ids.size()); +} + +GlobalPoint HGCalTriggerGeometryV9Imp3::getModulePosition(const unsigned module_det_id) const { + unsigned subdet = HGCalTriggerModuleDetId(module_det_id).triggerSubdetId(); + // Position: barycenter of the module. + Basic3DVector moduleVector(0., 0., 0.); + const auto cell_ids = getCellsFromModule(module_det_id); + // Scintillator + if (subdet == HGCalTriggerSubdetector::HGCalHScTrigger) { + for (const auto& cell : cell_ids) { + moduleVector += hscGeometry()->getPosition(cell).basicVector(); + } + } + // HFNose + else if (subdet == HGCalTriggerSubdetector::HFNoseTrigger) { + for (const auto& cell : cell_ids) { + HFNoseDetId cellDetId(cell); + moduleVector += noseGeometry()->getPosition(cellDetId).basicVector(); + } + } // Silicon + else { + for (const auto& cell : cell_ids) { + HGCSiliconDetId cellDetId(cell); + moduleVector += (cellDetId.det() == DetId::HGCalEE ? eeGeometry()->getPosition(cellDetId) + : hsiGeometry()->getPosition(cellDetId)) + .basicVector(); + } + } + + return GlobalPoint(moduleVector / cell_ids.size()); +} + +void HGCalTriggerGeometryV9Imp3::fillMaps() { + // read json mapping file + json mapping_config; + std::ifstream json_input_file(jsonMappingFile_.fullPath()); + if (!json_input_file.is_open()) { + throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TMapping file\n"; + } + json_input_file >> mapping_config; + + try { + //Stage 2 to Stage 1 links mapping + for (unsigned stage2_id = 0; stage2_id < mapping_config.at("Stage2").size(); stage2_id++) { + for (auto& link : mapping_config.at("Stage2").at(stage2_id).at("Stage1Links")) { + stage2_to_stage1links_.emplace(stage2_id, link.at("SameSector")); + } + } + } catch (const json::exception& e) { + edm::LogError("HGCalTriggerGeometryV9Imp3") + << "The mapping input json file does not have the expected structure for the Stage2 block"; + } + + try { + for (unsigned link_id = 0; link_id < mapping_config.at("Stage1Links").size(); link_id++) { + //Stage 1 links to Stage 1 FPGAs mapping + stage1link_to_stage1_.emplace(link_id, mapping_config.at("Stage1Links").at(link_id).at("Stage1")); + + //Stage 1 links to Stage 2 mapping + stage1link_to_stage2_.emplace(link_id, mapping_config.at("Stage1Links").at(link_id).at("Stage2SameSector")); + } + } catch (const json::exception& e) { + edm::LogError("HGCalTriggerGeometryV9Imp3") + << "The mapping input json file does not have the expected structure for the Stage1Links block"; + } + + try { + for (unsigned stage1_id = 0; stage1_id < mapping_config.at("Stage1").size(); stage1_id++) { + //Stage 1 to Stage 1 links mapping + for (auto& link_id : mapping_config.at("Stage1").at(stage1_id).at("Stage1Links")) { + stage1_to_stage1links_.emplace(stage1_id, link_id); + } + + //Stage 1 to lpgbt mapping + for (auto& lpgbt_id : mapping_config.at("Stage1").at(stage1_id).at("lpgbts")) { + stage1_to_lpgbts_.emplace(stage1_id, lpgbt_id); + } + } + + } catch (const json::exception& e) { + edm::LogError("HGCalTriggerGeometryV9Imp3") + << "The mapping input json file does not have the expected structure for the Stage1 block"; + } + + try { + for (unsigned lpgbt_id = 0; lpgbt_id < mapping_config.at("lpgbt").size(); lpgbt_id++) { + //lpgbt to Stage 1 mapping + unsigned stage1_id = mapping_config.at("lpgbt").at(lpgbt_id).at("Stage1"); + lpgbt_to_stage1_.emplace(lpgbt_id, stage1_id); + + //lpgbt to module mapping + for (auto& modules : mapping_config.at("lpgbt").at(lpgbt_id).at("Modules")) { + unsigned layer = modules.at("layer"); + int subdetId = 0; + bool isSilicon = modules.at("isSilicon"); + layerWithoutOffsetAndSubdetId(layer, subdetId, isSilicon); + unsigned packed_value = packLayerSubdetWaferId(layer, subdetId, modules.at("u"), modules.at("v")); + lpgbt_to_modules_.emplace(lpgbt_id, packed_value); + + //fill subsiduary module to stage 1 mapping + auto result = module_to_stage1_.emplace(packed_value, stage1_id); + if (result.second == false && + stage1_id != result.first->second) { //check that the stage1_id is the same as in the existing map + edm::LogError("HGCalTriggerGeometryV9Imp3") << "One module is connected to two separate Stage1 FPGAs"; + } + } + } + + } catch (const json::exception& e) { + edm::LogError("HGCalTriggerGeometryV9Imp3") + << "The mapping input json file does not have the expected structure for the lpGBT block"; + } + + try { + //module to lpgbt mapping + for (unsigned module = 0; module < mapping_config.at("Module").size(); module++) { + unsigned num_elinks = 0; //Sum number of e-links in each module over lpGBTs + unsigned layer = mapping_config.at("Module").at(module).at("layer"); + unsigned moduleU = mapping_config.at("Module").at(module).at("u"); + unsigned moduleV = mapping_config.at("Module").at(module).at("v"); + bool isSilicon = mapping_config.at("Module").at(module).at("isSilicon"); + int subdetId = 0; + layerWithoutOffsetAndSubdetId(layer, subdetId, isSilicon); + + for (auto& lpgbt : mapping_config.at("Module").at(module).at("lpgbts")) { + module_to_lpgbts_.emplace(packLayerSubdetWaferId(layer, subdetId, moduleU, moduleV), lpgbt.at("id")); + num_elinks += unsigned(lpgbt.at("nElinks")); + } + int packed_module = packLayerSubdetWaferId(layer, subdetId, moduleU, moduleV); + links_per_module_.emplace(packed_module, num_elinks); + } + } catch (const json::exception& e) { + edm::LogError("HGCalTriggerGeometryV9Imp3") + << "The mapping input json file does not have the expected structure for the Module block"; + } + + json_input_file.close(); +} + +unsigned HGCalTriggerGeometryV9Imp3::packLayerSubdetWaferId(unsigned layer, int subdet, int waferU, int waferV) const { + unsigned packed_value = 0; + + packed_value |= + ((waferU & HGCalTriggerModuleDetId::kHGCalModuleUMask) << HGCalTriggerModuleDetId::kHGCalModuleUOffset); + packed_value |= + ((waferV & HGCalTriggerModuleDetId::kHGCalModuleVMask) << HGCalTriggerModuleDetId::kHGCalModuleVOffset); + packed_value |= ((subdet & HGCalTriggerModuleDetId::kHGCalTriggerSubdetMask) + << HGCalTriggerModuleDetId::kHGCalTriggerSubdetOffset); + packed_value |= ((layer & HGCalTriggerModuleDetId::kHGCalLayerMask) << HGCalTriggerModuleDetId::kHGCalLayerOffset); + return packed_value; +} + +void HGCalTriggerGeometryV9Imp3::unpackLayerSubdetWaferId( + unsigned wafer, unsigned& layer, int& subdet, int& waferU, int& waferV) const { + waferU = (wafer >> HGCalTriggerModuleDetId::kHGCalModuleUOffset) & HGCalTriggerModuleDetId::kHGCalModuleUMask; + waferV = (wafer >> HGCalTriggerModuleDetId::kHGCalModuleVOffset) & HGCalTriggerModuleDetId::kHGCalModuleVMask; + subdet = + (wafer >> HGCalTriggerModuleDetId::kHGCalTriggerSubdetOffset) & HGCalTriggerModuleDetId::kHGCalTriggerSubdetMask; + layer = (wafer >> HGCalTriggerModuleDetId::kHGCalLayerOffset) & HGCalTriggerModuleDetId::kHGCalLayerMask; +} + +void HGCalTriggerGeometryV9Imp3::etaphiMappingFromSector0(int& ieta, int& iphi, unsigned sector) const { + if (sector == 0) { + return; + } + iphi = iphi + (sector * hSc_num_panels_per_sector_); +} + +HGCalGeomRotation::WaferCentring HGCalTriggerGeometryV9Imp3::getWaferCentring(unsigned layer, int subdet) const { + if (subdet == HGCalTriggerSubdetector::HGCalEETrigger) { // CE-E + return HGCalGeomRotation::WaferCentring::WaferCentred; + } else if (subdet == HGCalTriggerSubdetector::HGCalHSiTrigger) { + if ((layer % 2) == 1) { // CE-H Odd + return HGCalGeomRotation::WaferCentring::CornerCentredY; + } else { // CE-H Even + return HGCalGeomRotation::WaferCentring::CornerCentredMercedes; + } + } else if (subdet == HGCalTriggerSubdetector::HFNoseTrigger) { //HFNose + return HGCalGeomRotation::WaferCentring::WaferCentred; + } else { + edm::LogError("HGCalTriggerGeometryV9Imp3") + << "HGCalTriggerGeometryV9Imp3: trigger sub-detector expected to be silicon"; + return HGCalGeomRotation::WaferCentring::WaferCentred; + } +} + +unsigned HGCalTriggerGeometryV9Imp3::etaphiMappingToSector0(int& ieta, int& iphi) const { + unsigned sector = 0; + + if (unsigned(std::abs(iphi)) > 2 * hSc_num_panels_per_sector_) + sector = 2; + else if (unsigned(std::abs(iphi)) > hSc_num_panels_per_sector_) + sector = 1; + else + sector = 0; + + iphi = iphi - (sector * hSc_num_panels_per_sector_); + + return sector; +} + +bool HGCalTriggerGeometryV9Imp3::validTriggerCell(const unsigned trigger_cell_id) const { + return validTriggerCellFromCells(trigger_cell_id); +} + +bool HGCalTriggerGeometryV9Imp3::disconnectedModule(const unsigned module_id) const { + bool disconnected = false; + HGCalTriggerModuleDetId id(module_id); + if (module_to_stage1_.find(packLayerSubdetWaferId(id.layer(), id.triggerSubdetId(), id.moduleU(), id.moduleV())) == + module_to_stage1_.end()) { + disconnected = true; + } + if (disconnected_layers_.find(layerWithOffset(module_id)) != disconnected_layers_.end()) { + disconnected = true; + } + return disconnected; +} + +unsigned HGCalTriggerGeometryV9Imp3::triggerLayer(const unsigned id) const { + unsigned layer = layerWithOffset(id); + + if (DetId(id).det() == DetId::HGCalTrigger and + HGCalTriggerDetId(id).subdet() == HGCalTriggerSubdetector::HFNoseTrigger) { + if (layer >= trigger_nose_layers_.size()) + return 0; + return trigger_nose_layers_[layer]; + } + if (layer >= trigger_layers_.size()) + return 0; + return trigger_layers_[layer]; +} + +bool HGCalTriggerGeometryV9Imp3::validCell(unsigned cell_id) const { + bool is_valid = false; + unsigned det = DetId(cell_id).det(); + switch (det) { + case DetId::HGCalEE: + is_valid = eeTopology().valid(cell_id); + break; + case DetId::HGCalHSi: + is_valid = hsiTopology().valid(cell_id); + break; + case DetId::HGCalHSc: + is_valid = hscTopology().valid(cell_id); + break; + case DetId::Forward: + is_valid = noseTopology().valid(cell_id); + break; + default: + is_valid = false; + break; + } + return is_valid; +} + +bool HGCalTriggerGeometryV9Imp3::validTriggerCellFromCells(const unsigned trigger_cell_id) const { + // Check the validity of a trigger cell with the + // validity of the cells. One valid cell in the + // trigger cell is enough to make the trigger cell + // valid. + const geom_set cells = getCellsFromTriggerCell(trigger_cell_id); + bool is_valid = false; + for (const auto cell_id : cells) { + unsigned det = DetId(cell_id).det(); + is_valid |= validCellId(det, cell_id); + if (is_valid) + break; + } + return is_valid; +} + +bool HGCalTriggerGeometryV9Imp3::validCellId(unsigned subdet, unsigned cell_id) const { + bool is_valid = false; + switch (subdet) { + case DetId::HGCalEE: + is_valid = eeTopology().valid(cell_id); + break; + case DetId::HGCalHSi: + is_valid = hsiTopology().valid(cell_id); + break; + case DetId::HGCalHSc: + is_valid = hscTopology().valid(cell_id); + break; + case DetId::Forward: + is_valid = noseTopology().valid(cell_id); + break; + default: + is_valid = false; + break; + } + return is_valid; +} + +int HGCalTriggerGeometryV9Imp3::detIdWaferType(unsigned det, unsigned layer, short waferU, short waferV) const { + int wafer_type = 0; + switch (det) { + case DetId::HGCalEE: + wafer_type = eeTopology().dddConstants().getTypeHex(layer, waferU, waferV); + break; + case DetId::HGCalHSi: + wafer_type = hsiTopology().dddConstants().getTypeHex(layer, waferU, waferV); + break; + case DetId::HGCalHSc: + wafer_type = hscTopology().dddConstants().getTypeTrap(layer); + break; + default: + break; + }; + return wafer_type; +} + +void HGCalTriggerGeometryV9Imp3::layerWithoutOffsetAndSubdetId(unsigned& layer, int& subdetId, bool isSilicon) const { + if (!isSilicon) { + layer = layer - heOffset_; + subdetId = HGCalTriggerSubdetector::HGCalHScTrigger; + } else { + if (layer > heOffset_) { + subdetId = HGCalTriggerSubdetector::HGCalHSiTrigger; + layer = layer - heOffset_; + } else { + subdetId = HGCalTriggerSubdetector::HGCalEETrigger; + } + } +} + +unsigned HGCalTriggerGeometryV9Imp3::layerWithOffset(unsigned id) const { + unsigned det = DetId(id).det(); + unsigned layer = 0; + + if (det == DetId::HGCalTrigger) { + unsigned subdet = HGCalTriggerDetId(id).subdet(); + if (subdet == HGCalTriggerSubdetector::HGCalEETrigger) { + layer = HGCalTriggerDetId(id).layer(); + } else if (subdet == HGCalTriggerSubdetector::HGCalHSiTrigger) { + layer = heOffset_ + HGCalTriggerDetId(id).layer(); + } else if (subdet == HGCalTriggerSubdetector::HFNoseTrigger) { + layer = HFNoseTriggerDetId(id).layer(); + } + } else if (det == DetId::HGCalHSc) { + layer = heOffset_ + HGCScintillatorDetId(id).layer(); + } else if (det == DetId::Forward) { + unsigned subdet = HGCalTriggerModuleDetId(id).triggerSubdetId(); + if (subdet == HGCalTriggerSubdetector::HGCalEETrigger) { + layer = HGCalTriggerModuleDetId(id).layer(); + } else if (subdet == HGCalTriggerSubdetector::HGCalHSiTrigger || + subdet == HGCalTriggerSubdetector::HGCalHScTrigger) { + layer = heOffset_ + HGCalDetId(id).layer(); + } else if (subdet == HGCalTriggerSubdetector::HFNoseTrigger) { + layer = HGCalTriggerModuleDetId(id).layer(); + } + } + return layer; +} + +DEFINE_EDM_PLUGIN(HGCalTriggerGeometryFactory, HGCalTriggerGeometryV9Imp3, "HGCalTriggerGeometryV9Imp3"); diff --git a/L1Trigger/L1THGCal/plugins/geometries/README.md b/L1Trigger/L1THGCal/plugins/geometries/README.md index 0b219a90dd67a..c8ecb7e3ce6ea 100644 --- a/L1Trigger/L1THGCal/plugins/geometries/README.md +++ b/L1Trigger/L1THGCal/plugins/geometries/README.md @@ -1,15 +1,13 @@ Trigger geometries provide the following interfaces: -* Mapping between HGCAL sensor cells, trigger cells and motherboards -* Navigation between trigger cells +* Mapping between HGCAL sensor cells, trigger cells, modules, lpGBTs and backend FPGAs The available HGCAL trigger geometries are the following: -* `HGCalTriggerGeometryV9Imp2` (DEFAULT for geometries >= V9) - - Implementation without trigger cell external mappings. Makes use of the `HGCSiliconDetId`, `HGCScintillatorDetId`, and `HGCalTriggerDetId` +* `HGCalTriggerGeometryV9Imp3` - Compatible with the HGCAL geometries >= V9 - - The trigger cell neighbors are not defined (no navigation) -* `HGCalTriggerGeometryV9Imp1` - - Similar implementation as `HGCalTriggerGeometryHexLayerBasedImp1`, but for the V9 geometry - - Compatible with the V9 HGCAL geometry -* `HGCalTriggerGeometryHexLayerBasedImp1` (DEFAULT for V8 geometry) - - The trigger cell mapping is defined over a full layer and is not constrained by wafer boundaries - - Compatible with the V8 HGCAL geometry + - All links mapping are available (elinks, lpGBT, BE links) + - Backend FPGA mappings are available + - Links and FPGA mappings are defined in external JSON files +* `HGCalTriggerGeometryV9Imp2` (DEFAULT) + - Compatible with the HGCAL geometries >= V9 + - No links mapping. Only the number of elinks per module/ECON-T is available + - Backend FPGA mappings are not available diff --git a/L1Trigger/L1THGCal/plugins/veryfrontend/HGCalVFEProcessorSums.cc b/L1Trigger/L1THGCal/plugins/veryfrontend/HGCalVFEProcessorSums.cc index 7564fdb08bb1b..4c94a2711bafe 100644 --- a/L1Trigger/L1THGCal/plugins/veryfrontend/HGCalVFEProcessorSums.cc +++ b/L1Trigger/L1THGCal/plugins/veryfrontend/HGCalVFEProcessorSums.cc @@ -66,7 +66,7 @@ void HGCalVFEProcessorSums::run(const HGCalDigiCollection& digiColl, bool isSilicon = triggerTools_.isSilicon(dataframes[0].id()); bool isEM = triggerTools_.isEm(dataframes[0].id()); bool isNose = triggerTools_.isNose(dataframes[0].id()); - int thickness = triggerTools_.thicknessIndex(dataframes[0].id(), true); + int thickness = triggerTools_.thicknessIndex(dataframes[0].id()); // Linearization of ADC and TOT values to the same LSB if (isSilicon) { vfeLinearizationSiImpl_->linearize(dataframes, linearized_dataframes); diff --git a/L1Trigger/L1THGCal/python/customTriggerGeometry.py b/L1Trigger/L1THGCal/python/customTriggerGeometry.py index 43eee7601db09..3a01574901442 100644 --- a/L1Trigger/L1THGCal/python/customTriggerGeometry.py +++ b/L1Trigger/L1THGCal/python/customTriggerGeometry.py @@ -1,107 +1,40 @@ import FWCore.ParameterSet.Config as cms -def custom_geometry_decentralized_V11(process, links='signaldriven'): +def custom_geometry_decentralized_V11(process, links='signaldriven',implementation=1): if links=='signaldriven': links_mapping = 'L1Trigger/L1THGCal/data/links_mapping_V11_decentralized_signaldriven_0.txt' elif links=='pudriven': links_mapping = 'L1Trigger/L1THGCal/data/links_mapping_V11_decentralized_march20_0.txt' else: raise RuntimeError('Unknown links mapping "{}". Options are "signaldriven" or "pudriven".'.format(links)) - process.hgcalTriggerGeometryESProducer.TriggerGeometry.TriggerGeometryName = cms.string('HGCalTriggerGeometryV9Imp2') + if implementation==1: + process.hgcalTriggerGeometryESProducer.TriggerGeometry.TriggerGeometryName = cms.string('HGCalTriggerGeometryV9Imp2') + elif implementation==2: + process.hgcalTriggerGeometryESProducer.TriggerGeometry.TriggerGeometryName = cms.string('HGCalTriggerGeometryV9Imp3') process.hgcalTriggerGeometryESProducer.TriggerGeometry.ScintillatorTriggerCellSize = cms.uint32(2) process.hgcalTriggerGeometryESProducer.TriggerGeometry.ScintillatorModuleSize = cms.uint32(6) process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TModulesMapping = cms.FileInPath("L1Trigger/L1THGCal/data/panel_mapping_V11_decentralized_march20_2.txt") process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TLinksMapping = cms.FileInPath(links_mapping) process.hgcalTriggerGeometryESProducer.TriggerGeometry.DisconnectedModules = cms.vuint32(0) process.hgcalTriggerGeometryESProducer.TriggerGeometry.ScintillatorLinksPerModule = cms.uint32(2) + process.hgcalTriggerGeometryESProducer.TriggerGeometry.JsonMappingFile = cms.FileInPath("L1Trigger/L1THGCal/data/hgcal_trigger_link_mapping_v1.json") return process -def custom_geometry_decentralized_V9(process, links='signaldriven', implementation=2): +def custom_geometry_decentralized_V10(process, links='signaldriven'): if links=='signaldriven': links_mapping = 'L1Trigger/L1THGCal/data/links_mapping_decentralized_signaldriven_0.txt' elif links=='pudriven': links_mapping = 'L1Trigger/L1THGCal/data/links_mapping_decentralized_jun19_0.txt' else: raise RuntimeError('Unknown links mapping "{}". Options are "signaldriven" or "pudriven".'.format(links)) - if implementation==1: - process.hgcalTriggerGeometryESProducer.TriggerGeometry.TriggerGeometryName = cms.string('HGCalTriggerGeometryV9Imp1') - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellsMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_mapping_8inch_aligned_192_432_V9_1.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TWafersMapping = cms.FileInPath("L1Trigger/L1THGCal/data/wafer_mapping_V9_2.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TModulesMapping = cms.FileInPath("L1Trigger/L1THGCal/data/panel_mapping_decentralized_jun19_0.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TLinksMapping = cms.FileInPath(links_mapping) - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellNeighborsMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_neighbor_mapping_8inch_aligned_192_432_0.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellsSciMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_mapping_sci_2x2_12x12_V9_0.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellNeighborsSciMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_neighbor_mapping_sci_2x2_12x12_V9_0.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.ScintillatorWafersPerModule = cms.uint32(1) - process.hgcalTriggerGeometryESProducer.TriggerGeometry.DisconnectedModules = cms.vuint32(0) - elif implementation==2: - process.hgcalTriggerGeometryESProducer.TriggerGeometry.TriggerGeometryName = cms.string('HGCalTriggerGeometryV9Imp2') - process.hgcalTriggerGeometryESProducer.TriggerGeometry.ScintillatorTriggerCellSize = cms.uint32(2) - process.hgcalTriggerGeometryESProducer.TriggerGeometry.ScintillatorModuleSize = cms.uint32(6) - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TModulesMapping = cms.FileInPath("L1Trigger/L1THGCal/data/panel_mapping_V9_decentralized_jun19_0.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TLinksMapping = cms.FileInPath(links_mapping) - process.hgcalTriggerGeometryESProducer.TriggerGeometry.DisconnectedModules = cms.vuint32(0) - process.hgcalTriggerGeometryESProducer.TriggerGeometry.ScintillatorLinksPerModule = cms.uint32(2) - return process - - -def custom_geometry_V9(process, implementation=2): - if implementation==1: - process.hgcalTriggerGeometryESProducer.TriggerGeometry.TriggerGeometryName = cms.string('HGCalTriggerGeometryV9Imp1') - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellsMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_mapping_8inch_aligned_192_432_V9_1.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TWafersMapping = cms.FileInPath("L1Trigger/L1THGCal/data/wafer_mapping_V9_2.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TModulesMapping = cms.FileInPath("L1Trigger/L1THGCal/data/panel_mapping_jan19_1.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TLinksMapping = cms.FileInPath("L1Trigger/L1THGCal/data/links_mapping_jan19_1.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellNeighborsMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_neighbor_mapping_8inch_aligned_192_432_0.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellsSciMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_mapping_sci_2x2_12x12_V9_0.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellNeighborsSciMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_neighbor_mapping_sci_2x2_12x12_V9_0.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.ScintillatorWafersPerModule = cms.uint32(3) - process.hgcalTriggerGeometryESProducer.TriggerGeometry.DisconnectedModules = cms.vuint32(0) - elif implementation==2: - process.hgcalTriggerGeometryESProducer.TriggerGeometry.TriggerGeometryName = cms.string('HGCalTriggerGeometryV9Imp2') - process.hgcalTriggerGeometryESProducer.TriggerGeometry.ScintillatorTriggerCellSize = cms.uint32(2) - process.hgcalTriggerGeometryESProducer.TriggerGeometry.ScintillatorModuleSize = cms.uint32(12) - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TModulesMapping = cms.FileInPath("L1Trigger/L1THGCal/data/panel_mapping_V9_jan19_1.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TLinksMapping = cms.FileInPath("L1Trigger/L1THGCal/data/links_mapping_jan19_1.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.DisconnectedModules = cms.vuint32(0) - process.hgcalTriggerGeometryESProducer.TriggerGeometry.ScintillatorLinksPerModule = cms.uint32(1) - return process - -def custom_geometry_ZoltanSplit_V8(process): - process.hgcalTriggerGeometryESProducer.TriggerGeometry.TriggerGeometryName = cms.string('HGCalTriggerGeometryHexLayerBasedImp1') - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellsMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_mapping_8inch_aligned_192_432_V8_0.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TModulesMapping = cms.FileInPath("L1Trigger/L1THGCal/data/panel_mapping_tdr_0.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellNeighborsMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_neighbor_mapping_8inch_aligned_192_432_0.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellsBHMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_mapping_BH_3x3_30deg_0.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellNeighborsBHMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_neighbor_mapping_BH_3x3_30deg_0.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.DisconnectedModules = cms.vuint32(0) - return process - - -def custom_geometry_ZoltanSplit_V7(process): - process.hgcalTriggerGeometryESProducer.TriggerGeometry.TriggerGeometryName = cms.string('HGCalTriggerGeometryHexLayerBasedImp1') - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellsMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_mapping_8inch_aligned_192_432_V7_0.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TModulesMapping = cms.FileInPath("L1Trigger/L1THGCal/data/panel_mapping_tdr_0.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellNeighborsMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_neighbor_mapping_8inch_aligned_192_432_0.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellsBHMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_mapping_BH_3x3_30deg_0.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellNeighborsBHMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_neighbor_mapping_BH_3x3_30deg_0.txt") + process.hgcalTriggerGeometryESProducer.TriggerGeometry.TriggerGeometryName = cms.string('HGCalTriggerGeometryV9Imp2') + process.hgcalTriggerGeometryESProducer.TriggerGeometry.ScintillatorTriggerCellSize = cms.uint32(2) + process.hgcalTriggerGeometryESProducer.TriggerGeometry.ScintillatorModuleSize = cms.uint32(6) + process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TModulesMapping = cms.FileInPath("L1Trigger/L1THGCal/data/panel_mapping_V9_decentralized_jun19_0.txt") + process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TLinksMapping = cms.FileInPath(links_mapping) process.hgcalTriggerGeometryESProducer.TriggerGeometry.DisconnectedModules = cms.vuint32(0) + process.hgcalTriggerGeometryESProducer.TriggerGeometry.ScintillatorLinksPerModule = cms.uint32(2) return process -def custom_geometry_6inch_V8(process): - process.hgcalTriggerGeometryESProducer.TriggerGeometry.TriggerGeometryName = cms.string('HGCalTriggerGeometryHexImp2') - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellsMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_mapping.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TModulesMapping = cms.FileInPath("L1Trigger/L1THGCal/data/module_mapping_PairsRing_V8_0.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellNeighborsMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_neighbor_mapping_1.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TWaferNeighborsMapping = cms.FileInPath("L1Trigger/L1THGCal/data/wafer_neighbor_mapping_V8_0.txt") - return process - -def custom_geometry_6inch_V7(process): - process.hgcalTriggerGeometryESProducer.TriggerGeometry.TriggerGeometryName = cms.string('HGCalTriggerGeometryHexImp2') - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellsMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_mapping.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TModulesMapping = cms.FileInPath("L1Trigger/L1THGCal/data/module_mapping_PairsRing_V7_0.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellNeighborsMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_neighbor_mapping_1.txt") - process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TWaferNeighborsMapping = cms.FileInPath("L1Trigger/L1THGCal/data/wafer_neighbor_mapping_V7_0.txt") - return process diff --git a/L1Trigger/L1THGCal/python/egammaIdentification.py b/L1Trigger/L1THGCal/python/egammaIdentification.py index af508d022caf2..32afa8459a02f 100644 --- a/L1Trigger/L1THGCal/python/egammaIdentification.py +++ b/L1Trigger/L1THGCal/python/egammaIdentification.py @@ -199,13 +199,15 @@ def __init__(self, eta_min, eta_max, pt_min, pt_max): ) egamma_identification_histomax = cms.PSet( - Inputs=cms.vstring(input_features_histomax['v8_352']), + Inputs=cms.vstring(input_features_histomax['v10_3151']), CategoriesEtaMin=cms.vdouble([cat.eta_min for cat in categories]), CategoriesEtaMax=cms.vdouble([cat.eta_max for cat in categories]), CategoriesPtMin=cms.vdouble([cat.pt_min for cat in categories]), CategoriesPtMax=cms.vdouble([cat.pt_max for cat in categories]), - Weights=cms.vstring(bdt_weights_histomax['v8_352']), - WorkingPoints=cms.vdouble([wps[eff] for wps,eff in zip(working_points_histomax['v8_352'],tight_wp)]), + Weights=cms.vstring(bdt_weights_histomax['v10_3151']), + WorkingPoints=cms.vdouble( + [wps[eff] for wps,eff in zip(working_points_histomax['v10_3151'],tight_wp)] + ) ) phase2_hgcalV10.toModify(egamma_identification_histomax, diff --git a/L1Trigger/L1THGCal/python/hgcalBackEndLayer1Producer_cfi.py b/L1Trigger/L1THGCal/python/hgcalBackEndLayer1Producer_cfi.py index 73fdd5e5d1b18..c00815f959767 100644 --- a/L1Trigger/L1THGCal/python/hgcalBackEndLayer1Producer_cfi.py +++ b/L1Trigger/L1THGCal/python/hgcalBackEndLayer1Producer_cfi.py @@ -17,7 +17,7 @@ clustering_threshold_silicon=cms.double(2.), clustering_threshold_scintillator=cms.double(2.)) -# V9 samples have a different definition of the dEdx calibrations. To account for it +# >= V9 samples have a different definition of the dEdx calibrations. To account for it # we rescale the thresholds for the clustering # (see https://indico.cern.ch/event/806845/contributions/3359859/attachments/1815187/2966402/19-03-20_EGPerf_HGCBE.pdf # for more details) @@ -28,7 +28,7 @@ clustering_threshold_scintillator=1.5, ) -# we still don't have layer calibrations for V9 geometry. Switching this off we +# we still don't have layer calibrations for >=V9 geometry. Switching this off we # use the dEdx calibrated energy of the TCs phase2_hgcalV10.toModify(c2d_calib_pset, applyLayerCalibration=False diff --git a/L1Trigger/L1THGCal/python/hgcalBackEndLayer2Producer_cfi.py b/L1Trigger/L1THGCal/python/hgcalBackEndLayer2Producer_cfi.py index e46620486bbd5..77e6016c44fc5 100644 --- a/L1Trigger/L1THGCal/python/hgcalBackEndLayer2Producer_cfi.py +++ b/L1Trigger/L1THGCal/python/hgcalBackEndLayer2Producer_cfi.py @@ -100,7 +100,7 @@ ) -# V9 samples have a different definition of the dEdx calibrations. To account for it +# >= V9 samples have a different definition of the dEdx calibrations. To account for it # we rescale the thresholds of the clustering seeds # (see https://indico.cern.ch/event/806845/contributions/3359859/attachments/1815187/2966402/19-03-20_EGPerf_HGCBE.pdf # for more details) diff --git a/L1Trigger/L1THGCal/python/hgcalConcentratorProducer_cfi.py b/L1Trigger/L1THGCal/python/hgcalConcentratorProducer_cfi.py index a61d98160cf7f..e7721b35ebcfe 100644 --- a/L1Trigger/L1THGCal/python/hgcalConcentratorProducer_cfi.py +++ b/L1Trigger/L1THGCal/python/hgcalConcentratorProducer_cfi.py @@ -229,7 +229,7 @@ from Configuration.Eras.Modifier_phase2_hgcalV10_cff import phase2_hgcalV10 -# V9 samples have a different definition of the dEdx calibrations. To account for it +# >= V9 samples have a different definition of the dEdx calibrations. To account for it # we rescale the thresholds of the FE selection # (see https://indico.cern.ch/event/806845/contributions/3359859/attachments/1815187/2966402/19-03-20_EGPerf_HGCBE.pdf # for more details) diff --git a/L1Trigger/L1THGCal/python/hgcalTriggerGeometryESProducer_cfi.py b/L1Trigger/L1THGCal/python/hgcalTriggerGeometryESProducer_cfi.py index 6492c948d30c3..988a434e320d9 100644 --- a/L1Trigger/L1THGCal/python/hgcalTriggerGeometryESProducer_cfi.py +++ b/L1Trigger/L1THGCal/python/hgcalTriggerGeometryESProducer_cfi.py @@ -18,18 +18,17 @@ ] -geometry = cms.PSet( TriggerGeometryName = cms.string('HGCalTriggerGeometryHexLayerBasedImp1'), - L1TCellsMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_mapping_8inch_aligned_192_432_V8_0.txt"), - L1TModulesMapping = cms.FileInPath("L1Trigger/L1THGCal/data/panel_mapping_tdr_0.txt"), - L1TCellNeighborsMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_neighbor_mapping_8inch_aligned_192_432_0.txt"), - L1TCellsBHMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_mapping_BH_3x3_30deg_0.txt"), - L1TCellNeighborsBHMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_neighbor_mapping_BH_3x3_30deg_0.txt"), +geometry = cms.PSet( TriggerGeometryName = cms.string('HGCalTriggerGeometryV9Imp2'), + L1TModulesMapping = cms.FileInPath("L1Trigger/L1THGCal/data/panel_mapping_V9_decentralized_jun19_0.txt"), + L1TLinksMapping = cms.FileInPath('L1Trigger/L1THGCal/data/links_mapping_decentralized_signaldriven_0.txt'), + ScintillatorTriggerCellSize = cms.uint32(2), + ScintillatorModuleSize = cms.uint32(6), + ScintillatorLinksPerModule = cms.uint32(2), DisconnectedModules = cms.vuint32(0), DisconnectedLayers = cms.vuint32(disconnectedTriggerLayers) ) hgcalTriggerGeometryESProducer = cms.ESProducer( 'HGCalTriggerGeometryESProducer', - TriggerGeometry = geometry, - isV9Geometry = cms.bool(True) + TriggerGeometry = geometry ) diff --git a/L1Trigger/L1THGCal/python/hgcalTriggerPrimitives_cff.py b/L1Trigger/L1THGCal/python/hgcalTriggerPrimitives_cff.py index 90ae714214bf5..f78a90d20b5af 100644 --- a/L1Trigger/L1THGCal/python/hgcalTriggerPrimitives_cff.py +++ b/L1Trigger/L1THGCal/python/hgcalTriggerPrimitives_cff.py @@ -20,9 +20,9 @@ from Configuration.Eras.Modifier_phase2_hgcalV10_cff import phase2_hgcalV10 from Configuration.Eras.Modifier_phase2_hgcalV11_cff import phase2_hgcalV11 -from L1Trigger.L1THGCal.customTriggerGeometry import custom_geometry_decentralized_V9, custom_geometry_decentralized_V11 +from L1Trigger.L1THGCal.customTriggerGeometry import custom_geometry_decentralized_V10, custom_geometry_decentralized_V11 from L1Trigger.L1THGCal.customCalibration import custom_cluster_calibration_global -modifyHgcalTriggerPrimitivesWithV9Geometry_ = (phase2_hgcalV10 & ~phase2_hgcalV11).makeProcessModifier(custom_geometry_decentralized_V9) +modifyHgcalTriggerPrimitivesWithV10Geometry_ = (phase2_hgcalV10 & ~phase2_hgcalV11).makeProcessModifier(custom_geometry_decentralized_V10) modifyHgcalTriggerPrimitivesWithV11Geometry_ = phase2_hgcalV11.makeProcessModifier(custom_geometry_decentralized_V11) from Configuration.ProcessModifiers.convertHGCalDigisSim_cff import convertHGCalDigisSim diff --git a/L1Trigger/L1THGCal/src/HGCalCoarseTriggerCellMapping.cc b/L1Trigger/L1THGCal/src/HGCalCoarseTriggerCellMapping.cc index 1eb08581975ad..370d350fef533 100644 --- a/L1Trigger/L1THGCal/src/HGCalCoarseTriggerCellMapping.cc +++ b/L1Trigger/L1THGCal/src/HGCalCoarseTriggerCellMapping.cc @@ -13,26 +13,20 @@ HGCalCoarseTriggerCellMapping::HGCalCoarseTriggerCellMapping(const std::vector HGCalCoarseTriggerCellMapping::kSplit_ = {{kCTCsizeIndividual_, kSplit_v8_Individual_}, - {kCTCsizeVeryFine_, kSplit_v8_VeryFine_}, - {kCTCsizeFine_, kSplit_v8_Fine_}, - {kCTCsizeMid_, kSplit_v8_Mid_}, - {kCTCsizeCoarse_, kSplit_v8_Coarse_}}; - -const std::map HGCalCoarseTriggerCellMapping::kSplit_v9_ = { - {kCTCsizeIndividual_, kSplit_v9_Individual_}, - {kCTCsizeVeryFine_, kSplit_v9_VeryFine_}, - {kCTCsizeFine_, kSplit_v9_Fine_}, - {kCTCsizeMid_, kSplit_v9_Mid_}, - {kCTCsizeCoarse_, kSplit_v9_Coarse_}, +const std::map HGCalCoarseTriggerCellMapping::kSplit_ = { + {kCTCsizeIndividual_, kSplit_Individual_}, + {kCTCsizeVeryFine_, kSplit_VeryFine_}, + {kCTCsizeFine_, kSplit_Fine_}, + {kCTCsizeMid_, kSplit_Mid_}, + {kCTCsizeCoarse_, kSplit_Coarse_}, }; -const std::map HGCalCoarseTriggerCellMapping::kSplit_v9_Scin_ = { - {kCTCsizeIndividual_, kSplit_v9_Scin_Individual_}, - {kCTCsizeVeryFine_, kSplit_v9_Scin_VeryFine_}, - {kCTCsizeFine_, kSplit_v9_Scin_Fine_}, - {kCTCsizeMid_, kSplit_v9_Scin_Mid_}, - {kCTCsizeCoarse_, kSplit_v9_Scin_Coarse_}, +const std::map HGCalCoarseTriggerCellMapping::kSplit_Scin_ = { + {kCTCsizeIndividual_, kSplit_Scin_Individual_}, + {kCTCsizeVeryFine_, kSplit_Scin_VeryFine_}, + {kCTCsizeFine_, kSplit_Scin_Fine_}, + {kCTCsizeMid_, kSplit_Scin_Mid_}, + {kCTCsizeCoarse_, kSplit_Scin_Coarse_}, }; void HGCalCoarseTriggerCellMapping::checkSizeValidity(int ctcSize) const { @@ -59,58 +53,44 @@ uint32_t HGCalCoarseTriggerCellMapping::getRepresentativeDetId(uint32_t tcid) co uint32_t HGCalCoarseTriggerCellMapping::getCoarseTriggerCellId(uint32_t detid) const { unsigned int layer = triggerTools_.layerWithOffset(detid); - int thickness = triggerTools_.thicknessIndex(detid, true); + int thickness = triggerTools_.thicknessIndex(detid); int ctcSize = ctcSize_.at(thickness * kNHGCalLayersMax_ + layer); DetId tc_Id(detid); - if (tc_Id.det() == DetId::Forward) { //V8 - - HGCalDetId tc_IdV8(detid); - + if (tc_Id.det() == DetId::HGCalTrigger || tc_Id.det() == DetId::HGCalHSc) { if (triggerTools_.isScintillator(detid)) { - return detid; //stc not available in scintillator for v8 - } else { - int tcSplit = (tc_IdV8.cell() & kSplit_.at(ctcSize)); - detid = (detid & ~(HGCalDetId::kHGCalCellMask)) | tcSplit; - return detid; - } + HGCScintillatorDetId tc_Id(detid); - } - - else if (tc_Id.det() == DetId::HGCalTrigger || tc_Id.det() == DetId::HGCalHSc) { //V9 - if (triggerTools_.isScintillator(detid)) { - HGCScintillatorDetId tc_IdV9(detid); - - int tcSplit = (((tc_IdV9.ietaAbs() - 1) << HGCScintillatorDetId::kHGCalRadiusOffset) | (tc_IdV9.iphi() - 1)) & - kSplit_v9_Scin_.at(ctcSize); + int tcSplit = (((tc_Id.ietaAbs() - 1) << HGCScintillatorDetId::kHGCalRadiusOffset) | (tc_Id.iphi() - 1)) & + kSplit_Scin_.at(ctcSize); detid = (detid & kHGCalScinCellMaskInv_) | tcSplit; return detid; } else { - HGCalTriggerDetId tc_IdV9(detid); + HGCalTriggerDetId tc_Id(detid); int uPrime = 0; int vPrime = 0; - int rocnum = detIdToROC_.getROCNumber(tc_IdV9.triggerCellU(), tc_IdV9.triggerCellV(), 1); + int rocnum = detIdToROC_.getROCNumber(tc_Id.triggerCellU(), tc_Id.triggerCellV(), 1); if (rocnum == kRoc0deg_) { - uPrime = tc_IdV9.triggerCellU(); - vPrime = tc_IdV9.triggerCellV() - tc_IdV9.triggerCellU(); + uPrime = tc_Id.triggerCellU(); + vPrime = tc_Id.triggerCellV() - tc_Id.triggerCellU(); } else if (rocnum == kRoc120deg_) { - uPrime = tc_IdV9.triggerCellU() - tc_IdV9.triggerCellV() - 1; - vPrime = tc_IdV9.triggerCellV(); + uPrime = tc_Id.triggerCellU() - tc_Id.triggerCellV() - 1; + vPrime = tc_Id.triggerCellV(); } else if (rocnum == kRoc240deg_) { - uPrime = tc_IdV9.triggerCellV() - kRotate4_; - vPrime = kRotate7_ - tc_IdV9.triggerCellU(); + uPrime = tc_Id.triggerCellV() - kRotate4_; + vPrime = kRotate7_ - tc_Id.triggerCellU(); } - int tcSplit = (rocnum << kRocShift_) | ((uPrime << kUShift_ | vPrime) & kSplit_v9_.at(ctcSize)); - detid = (detid & kHGCalCellMaskV9Inv_) | tcSplit; + int tcSplit = (rocnum << kRocShift_) | ((uPrime << kUShift_ | vPrime) & kSplit_.at(ctcSize)); + detid = (detid & kHGCalCellMaskInv_) | tcSplit; return detid; } @@ -120,30 +100,16 @@ uint32_t HGCalCoarseTriggerCellMapping::getCoarseTriggerCellId(uint32_t detid) c } std::vector HGCalCoarseTriggerCellMapping::getConstituentTriggerCells(uint32_t ctcId) const { - int thickness = triggerTools_.thicknessIndex(ctcId, true); + int thickness = triggerTools_.thicknessIndex(ctcId); unsigned int layer = triggerTools_.layerWithOffset(ctcId); int ctcSize = ctcSize_.at(thickness * kNHGCalLayersMax_ + layer); std::vector output_ids; DetId tc_Id(ctcId); - if (tc_Id.det() == DetId::Forward) { //V8 - + if (tc_Id.det() == DetId::HGCalTrigger || tc_Id.det() == DetId::HGCalHSc) { if (triggerTools_.isScintillator(ctcId)) { - output_ids.emplace_back(ctcId); //stc not available in scintillator for v8 - } else { - int splitInv = ~(kSTCidMaskInv_ | kSplit_.at(ctcSize)); - for (int i = 0; i < splitInv + 1; i++) { - if ((i & splitInv) != i) - continue; - - output_ids.emplace_back(ctcId | i); - } - } - } else if (tc_Id.det() == DetId::HGCalTrigger || tc_Id.det() == DetId::HGCalHSc) { //V9 - - if (triggerTools_.isScintillator(ctcId)) { - int splitInv = ~(kHGCalScinCellMaskInv_ | kSplit_v9_Scin_.at(ctcSize)); + int splitInv = ~(kHGCalScinCellMaskInv_ | kSplit_Scin_.at(ctcSize)); for (int i = 0; i < splitInv + 1; i++) { if ((i & splitInv) != i) continue; @@ -158,7 +124,7 @@ std::vector HGCalCoarseTriggerCellMapping::getConstituentTriggerCells( } } else { - int splitInv = ~(kSTCidMaskInv_v9_ | kSplit_v9_.at(ctcSize)); + int splitInv = ~(kSTCidMaskInv_ | kSplit_.at(ctcSize)); for (int i = 0; i < splitInv + 1; i++) { if ((i & splitInv) != i) continue; @@ -180,7 +146,7 @@ std::vector HGCalCoarseTriggerCellMapping::getConstituentTriggerCells( v = uPrime + kRotate4_; } - uint32_t outid = ctcId & kHGCalCellMaskV9Inv_; + uint32_t outid = ctcId & kHGCalCellMaskInv_; outid |= (((u & HGCalTriggerDetId::kHGCalCellUMask) << HGCalTriggerDetId::kHGCalCellUOffset) | ((v & HGCalTriggerDetId::kHGCalCellVMask) << HGCalTriggerDetId::kHGCalCellVOffset)); diff --git a/L1Trigger/L1THGCal/src/HGCalTriggerCellCalibration.cc b/L1Trigger/L1THGCal/src/HGCalTriggerCellCalibration.cc index 33e9dd183a799..97ca488f0a2d4 100644 --- a/L1Trigger/L1THGCal/src/HGCalTriggerCellCalibration.cc +++ b/L1Trigger/L1THGCal/src/HGCalTriggerCellCalibration.cc @@ -33,7 +33,7 @@ void HGCalTriggerCellCalibration::calibrateInMipT(l1t::HGCalTriggerCell& trgCell DetId trgdetid(trgCell.detId()); bool isSilicon = triggerTools_.isSilicon(trgdetid); constexpr int kScintillatorIndex = 0; - unsigned thickness = isSilicon ? triggerTools_.thicknessIndex(trgdetid, true) : kScintillatorIndex; + unsigned thickness = isSilicon ? triggerTools_.thicknessIndex(trgdetid) : kScintillatorIndex; if (thickness >= fCperMIP_.size()) { throw cms::Exception("OutOfBound") << "Trying to access thickness index " << thickness << " in fCperMIP, which is of size " << fCperMIP_.size(); @@ -76,7 +76,7 @@ void HGCalTriggerCellCalibration::calibrateMipTinGeV(l1t::HGCalTriggerCell& trgC unsigned trgCellLayer = triggerTools_.layerWithOffset(trgdetid); bool isSilicon = triggerTools_.isSilicon(trgdetid); constexpr int kScintillatorIndex = 0; - unsigned thickness = isSilicon ? triggerTools_.thicknessIndex(trgdetid, true) : kScintillatorIndex; + unsigned thickness = isSilicon ? triggerTools_.thicknessIndex(trgdetid) : kScintillatorIndex; if (thickness >= thicknessCorrection_.size()) { throw cms::Exception("OutOfBound") << "Trying to access thickness index " << thickness << " in thicknessCorrection, which is of size " << thicknessCorrection_.size(); diff --git a/L1Trigger/L1THGCal/src/HGCalTriggerTools.cc b/L1Trigger/L1THGCal/src/HGCalTriggerTools.cc index d6c9781275c6a..fbad7dade5f36 100644 --- a/L1Trigger/L1THGCal/src/HGCalTriggerTools.cc +++ b/L1Trigger/L1THGCal/src/HGCalTriggerTools.cc @@ -4,10 +4,8 @@ #include "DataFormats/ForwardDetId/interface/HFNoseDetId.h" #include "DataFormats/ForwardDetId/interface/HFNoseTriggerDetId.h" -#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" #include "DataFormats/ForwardDetId/interface/HGCalTriggerDetId.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "DataFormats/ForwardDetId/interface/HGCalTriggerModuleDetId.h" #include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" #include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" @@ -42,17 +40,12 @@ void HGCalTriggerTools::eventSetup(const edm::EventSetup& es) { if (geom_->isWithNoseGeometry()) noseLayers_ = geom_->noseTopology().dddConstants().layers(true); - if (geom_->isV9Geometry()) { - bhLayers_ = geom_->hscTopology().dddConstants().layers(true); - totalLayers_ = eeLayers_ + fhLayers_; - } else { - bhLayers_ = geom_->bhTopology().dddConstants()->getMaxDepth(1); - totalLayers_ = eeLayers_ + fhLayers_ + bhLayers_; - } + bhLayers_ = geom_->hscTopology().dddConstants().layers(true); + totalLayers_ = eeLayers_ + fhLayers_; } GlobalPoint HGCalTriggerTools::getTCPosition(const DetId& id) const { - if (id.det() == DetId::Hcal || id.det() == DetId::HGCalEE) { + if (id.det() == DetId::HGCalEE) { throw cms::Exception("hgcal::HGCalTriggerTools") << "method getTCPosition called for DetId not belonging to a TC"; // FIXME: this would actually need a better test...but at the moment I can not think to anything better // to distinguish a TC detId @@ -110,12 +103,10 @@ unsigned HGCalTriggerTools::layers(DetId::Detector type) const { unsigned HGCalTriggerTools::layer(const DetId& id) const { unsigned int layer = std::numeric_limits::max(); - if (id.det() == DetId::Forward && id.subdetId() != ForwardSubdetector::HFNose) { - layer = HGCalDetId(id).layer(); - } else if (id.det() == DetId::Forward && id.subdetId() == ForwardSubdetector::HFNose) { + if (id.det() == DetId::Forward && id.subdetId() == ForwardSubdetector::HFNose) { layer = HFNoseDetId(id).layer(); - } else if (id.det() == DetId::Hcal && id.subdetId() == HcalEndcap) { - layer = HcalDetId(id).depth(); + } else if (id.det() == DetId::Forward && id.subdetId() == ForwardSubdetector::HGCTrigger) { + layer = HGCalTriggerModuleDetId(id).layer(); } else if (id.det() == DetId::HGCalEE || id.det() == DetId::HGCalHSi) { layer = HGCSiliconDetId(id).layer(); } else if (id.det() == DetId::HGCalTrigger && @@ -136,13 +127,8 @@ unsigned HGCalTriggerTools::layerWithOffset(const DetId& id) const { if (isNose(id)) { l = layer(id); // no offset for HFnose - } else if (isHad(id) && isSilicon(id)) { + } else if (isHad(id)) { l += eeLayers_; - } else if (isHad(id) && isScintillator(id)) { - if (geom_->isV9Geometry()) - l += eeLayers_; // mixed silicon and scintillator layers - else - l += eeLayers_ + fhLayers_; } return l; @@ -151,10 +137,10 @@ unsigned HGCalTriggerTools::layerWithOffset(const DetId& id) const { bool HGCalTriggerTools::isEm(const DetId& id) const { bool em = false; - if (id.det() == DetId::Forward && id.subdetId() != ForwardSubdetector::HFNose) { - em = (id.subdetId() == HGCEE); - } else if (id.det() == DetId::Forward && id.subdetId() == ForwardSubdetector::HFNose) { + if (id.det() == DetId::Forward && id.subdetId() == ForwardSubdetector::HFNose) { em = HFNoseDetId(id).isEE(); + } else if (id.det() == DetId::Forward && id.subdetId() == ForwardSubdetector::HGCTrigger) { + em = HGCalTriggerModuleDetId(id).isEE(); } else if (id.det() == DetId::HGCalEE) { em = true; } else if (id.det() == DetId::HGCalTrigger && @@ -180,8 +166,8 @@ bool HGCalTriggerTools::isNose(const DetId& id) const { bool HGCalTriggerTools::isSilicon(const DetId& id) const { bool silicon = false; - if (id.det() == DetId::Forward) { - silicon = (id.subdetId() != HGCHEB); + if (id.det() == DetId::Forward && id.subdetId() == HGCTrigger) { + silicon = (HGCalTriggerModuleDetId(id).triggerSubdetId() != HGCalHScTrigger); } else if (id.det() == DetId::HGCalEE || id.det() == DetId::HGCalHSi) { silicon = true; } else if (id.det() == DetId::HGCalTrigger && @@ -209,12 +195,10 @@ HGCalTriggerTools::SubDetectorType HGCalTriggerTools::getSubDetectorType(const D int HGCalTriggerTools::zside(const DetId& id) const { int zside = 0; - if (id.det() == DetId::Forward && id.subdetId() != ForwardSubdetector::HFNose) { - zside = HGCalDetId(id).zside(); - } else if (id.det() == DetId::Forward && id.subdetId() == ForwardSubdetector::HFNose) { + if (id.det() == DetId::Forward && id.subdetId() == ForwardSubdetector::HFNose) { zside = HFNoseDetId(id).zside(); - } else if (id.det() == DetId::Hcal && id.subdetId() == HcalEndcap) { - zside = HcalDetId(id).zside(); + } else if (id.det() == DetId::Forward && id.subdetId() == ForwardSubdetector::HGCTrigger) { + zside = HGCalTriggerModuleDetId(id).zside(); } else if (id.det() == DetId::HGCalEE || id.det() == DetId::HGCalHSi) { zside = HGCSiliconDetId(id).zside(); } else if (id.det() == DetId::HGCalTrigger && @@ -230,43 +214,18 @@ int HGCalTriggerTools::zside(const DetId& id) const { return zside; } -int HGCalTriggerTools::thicknessIndex(const DetId& id, bool tc) const { +int HGCalTriggerTools::thicknessIndex(const DetId& id) const { if (isScintillator(id)) { return kScintillatorPseudoThicknessIndex_; } unsigned det = id.det(); int thickness = 0; - // For the v8 detid scheme - if (det == DetId::Forward && id.subdetId() != ForwardSubdetector::HFNose) { - if (!tc) - thickness = sensorCellThicknessV8(id); - else { - // For the old geometry, TCs can contain sensor cells - // with different thicknesses. - // Use a majority logic to find the TC thickness - std::array occurences = {{0, 0, 0}}; - for (const auto& c_id : geom_->getCellsFromTriggerCell(id)) { - unsigned c_det = DetId(c_id).det(); - int c_thickness = -1; - // For the v8 detid scheme - if (c_det == DetId::Forward) { - c_thickness = sensorCellThicknessV8(c_id); - } else { - c_thickness = HGCSiliconDetId(c_id).type(); - } - if (c_thickness < 0 || unsigned(c_thickness) >= occurences.size()) { - throw cms::Exception("OutOfBound") << "Found thickness index = " << c_thickness; - } - occurences[c_thickness]++; - } - thickness = std::max_element(occurences.begin(), occurences.end()) - occurences.begin(); - } - } - // For the v9 detid scheme - else if (det == DetId::HGCalEE || det == DetId::HGCalHSi) { + if (det == DetId::HGCalEE || det == DetId::HGCalHSi) { thickness = HGCSiliconDetId(id).type(); } else if (det == DetId::Forward && id.subdetId() == ForwardSubdetector::HFNose) { thickness = HFNoseDetId(id).type(); + } else if (det == DetId::Forward && id.subdetId() == ForwardSubdetector::HGCTrigger) { + thickness = HGCalTriggerModuleDetId(id).type(); } else if (id.det() == DetId::HGCalTrigger && (HGCalTriggerDetId(id).subdet() == HGCalTriggerSubdetector::HGCalEETrigger || HGCalTriggerDetId(id).subdet() == HGCalTriggerSubdetector::HGCalHSiTrigger)) { @@ -331,14 +290,8 @@ float HGCalTriggerTools::getLayerZ(const int& subdet, const unsigned& layer) con layerGlobalZ = geom_->fhTopology().dddConstants().waferZ(layer, true); } else if (subdet == ForwardSubdetector::HFNose) { layerGlobalZ = geom_->noseTopology().dddConstants().waferZ(layer, true); - } else if ((subdet == HcalSubdetector::HcalEndcap) || (subdet == ForwardSubdetector::HGCHEB) || - (subdet == DetId::HGCalHSc)) { - if (geom_->isV9Geometry()) { - layerGlobalZ = geom_->hscTopology().dddConstants().waferZ(layer, true); - } else { - layerGlobalZ = geom_->bhTopology().dddConstants()->getRZ( - HcalSubdetector::HcalEndcap, geom_->bhTopology().dddConstants()->getEtaRange(1).second, layer); - } + } else if ((subdet == ForwardSubdetector::HGCHEB) || (subdet == DetId::HGCalHSc)) { + layerGlobalZ = geom_->hscTopology().dddConstants().waferZ(layer, true); } return layerGlobalZ; } @@ -346,47 +299,8 @@ float HGCalTriggerTools::getLayerZ(const int& subdet, const unsigned& layer) con DetId HGCalTriggerTools::simToReco(const DetId& simid, const HGCalTopology& topo) const { DetId recoid(0); const auto& dddConst = topo.dddConstants(); - // V9 if (dddConst.waferHexagon8() || dddConst.tileTrapezoid()) { recoid = simid; } - // V8 - else { - int subdet(simid.subdetId()); - int layer = 0, cell = 0, sec = 0, subsec = 0, zp = 0; - HGCalTestNumbering::unpackHexagonIndex(simid, subdet, zp, layer, sec, subsec, cell); - // sec is wafer and subsec is celltype - // skip this hit if after ganging it is not valid - auto recoLayerCell = dddConst.simToReco(cell, layer, sec, topo.detectorType()); - cell = recoLayerCell.first; - layer = recoLayerCell.second; - if (layer >= 0 && cell >= 0) { - recoid = HGCalDetId((ForwardSubdetector)subdet, zp, layer, subsec, sec, cell); - } - } - return recoid; -} - -DetId HGCalTriggerTools::simToReco(const DetId& simid, const HcalTopology& topo) const { - DetId recoid(0); - const auto& dddConst = topo.dddConstants(); - HcalDetId id = HcalHitRelabeller::relabel(simid, dddConst); - if (id.subdet() == int(HcalEndcap)) - recoid = id; return recoid; } - -int HGCalTriggerTools::sensorCellThicknessV8(const DetId& id) const { - int thickness = 0; - switch (id.subdetId()) { - case ForwardSubdetector::HGCEE: - thickness = geom_->eeTopology().dddConstants().waferTypeL(HGCalDetId(id).wafer()) - 1; - break; - case ForwardSubdetector::HGCHEF: - thickness = geom_->fhTopology().dddConstants().waferTypeL(HGCalDetId(id).wafer()) - 1; - break; - default: - break; - }; - return thickness; -} diff --git a/L1Trigger/L1THGCal/src/concentrator/HGCalConcentratorAutoEncoderImpl.cc b/L1Trigger/L1THGCal/src/concentrator/HGCalConcentratorAutoEncoderImpl.cc index dd132cf156889..80d87086311f4 100644 --- a/L1Trigger/L1THGCal/src/concentrator/HGCalConcentratorAutoEncoderImpl.cc +++ b/L1Trigger/L1THGCal/src/concentrator/HGCalConcentratorAutoEncoderImpl.cc @@ -1,5 +1,4 @@ #include "L1Trigger/L1THGCal/interface/concentrator/HGCalConcentratorAutoEncoderImpl.h" -#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" #include "DataFormats/ForwardDetId/interface/HGCalTriggerDetId.h" #include diff --git a/L1Trigger/L1THGCal/src/concentrator/HGCalConcentratorCoarsenerImpl.cc b/L1Trigger/L1THGCal/src/concentrator/HGCalConcentratorCoarsenerImpl.cc index 3d1c4ed1d17fb..75c9eed0a1f7f 100644 --- a/L1Trigger/L1THGCal/src/concentrator/HGCalConcentratorCoarsenerImpl.cc +++ b/L1Trigger/L1THGCal/src/concentrator/HGCalConcentratorCoarsenerImpl.cc @@ -36,7 +36,7 @@ void HGCalConcentratorCoarsenerImpl::coarsen(const std::vector kHighDensityThickness_) || coarsenTriggerCells_[subdet]) && @@ -64,17 +64,9 @@ void HGCalConcentratorSuperTriggerCellImpl::createAllTriggerCells( DetId tc_Id(id); - //To guard against the case in v8 geometry where - //there might be different thicknesses within a module - //This is a small effect, but in principle energy might - //be lost. if (superTCmapping_.getCoarseTriggerCellId(id) != s.second.getSTCId()) { - if (triggerTools_.getTriggerGeometry()->isV9Geometry()) { - throw cms::Exception("NonExistingCoarseTC") - << "The coarse trigger cell correponsing to the nominal trigger cell does not exist"; - } else { - continue; - } + throw cms::Exception("NonExistingCoarseTC") + << "The coarse trigger cell correponsing to the nominal trigger cell does not exist"; } trigCellVecOutput.push_back(triggerCell); if (energyDivisionType_ == oneBitFraction) { //Get the 1 bit fractions @@ -99,7 +91,7 @@ void HGCalConcentratorSuperTriggerCellImpl::assignSuperTriggerCellEnergyAndPosit uint32_t compressed_value = getCompressedSTCEnergy(stc); HGCalTriggerTools::SubDetectorType subdet = triggerTools_.getSubDetectorType(c.detId()); - int thickness = triggerTools_.thicknessIndex(c.detId(), true); + int thickness = triggerTools_.thicknessIndex(c.detId()); bool isSilicon = triggerTools_.isSilicon(c.detId()); bool isEM = triggerTools_.isEm(c.detId()); diff --git a/L1Trigger/L1THGCal/test/BuildFile.xml b/L1Trigger/L1THGCal/test/BuildFile.xml index 2ac017b6b45d1..70a9e12ee8810 100644 --- a/L1Trigger/L1THGCal/test/BuildFile.xml +++ b/L1Trigger/L1THGCal/test/BuildFile.xml @@ -2,6 +2,8 @@ - + + + diff --git a/L1Trigger/L1THGCal/test/HGCalTriggerGeomTester.cc b/L1Trigger/L1THGCal/test/HGCalTriggerGeomTester.cc deleted file mode 100644 index d70e8ddac1475..0000000000000 --- a/L1Trigger/L1THGCal/test/HGCalTriggerGeomTester.cc +++ /dev/null @@ -1,978 +0,0 @@ -#include -#include -#include - -#include "TTree.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "CommonTools/UtilAlgos/interface/TFileService.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESTransientHandle.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" -#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" - -#include "Geometry/Records/interface/CaloGeometryRecord.h" - -#include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h" - -#include - -namespace { - template - struct array_deleter { - void operator()(T* arr) { delete[] arr; } - }; -} // namespace - -class HGCalTriggerGeomTester : public edm::EDAnalyzer { -public: - explicit HGCalTriggerGeomTester(const edm::ParameterSet&); - ~HGCalTriggerGeomTester(); - - virtual void beginRun(const edm::Run&, const edm::EventSetup&); - virtual void analyze(const edm::Event&, const edm::EventSetup&); - -private: - void fillTriggerGeometry(); - void checkMappingConsistency(); - void checkNeighborConsistency(); - void setTreeModuleSize(const size_t n); - void setTreeModuleCellSize(const size_t n); - void setTreeTriggerCellSize(const size_t n); - void setTreeTriggerCellNeighborSize(const size_t n); - - edm::ESHandle triggerGeometry_; - edm::Service fs_; - bool no_trigger_; - bool no_neighbors_; - TTree* treeModules_; - TTree* treeTriggerCells_; - TTree* treeCells_; - TTree* treeCellsBH_; - // tree variables - int moduleId_; - int moduleSide_; - int moduleSubdet_; - int moduleLayer_; - int module_; - float moduleX_; - float moduleY_; - float moduleZ_; - int moduleTC_N_; - std::shared_ptr moduleTC_id_; - std::shared_ptr moduleTC_zside_; - std::shared_ptr moduleTC_subdet_; - std::shared_ptr moduleTC_layer_; - std::shared_ptr moduleTC_wafer_; - std::shared_ptr moduleTC_waferType_; - std::shared_ptr moduleTC_cell_; - std::shared_ptr moduleTC_x_; - std::shared_ptr moduleTC_y_; - std::shared_ptr moduleTC_z_; - int moduleCell_N_; - std::shared_ptr moduleCell_id_; - std::shared_ptr moduleCell_zside_; - std::shared_ptr moduleCell_subdet_; - std::shared_ptr moduleCell_layer_; - std::shared_ptr moduleCell_wafer_; - std::shared_ptr moduleCell_cell_; - std::shared_ptr moduleCell_x_; - std::shared_ptr moduleCell_y_; - std::shared_ptr moduleCell_z_; - int triggerCellId_; - int triggerCellSide_; - int triggerCellSubdet_; - int triggerCellLayer_; - int triggerCellWafer_; - int triggerCellWaferType_; - int triggerCell_; - float triggerCellX_; - float triggerCellY_; - float triggerCellZ_; - int triggerCellNeighbor_N_; - std::shared_ptr triggerCellNeighbor_id_; - std::shared_ptr triggerCellNeighbor_zside_; - std::shared_ptr triggerCellNeighbor_subdet_; - std::shared_ptr triggerCellNeighbor_layer_; - std::shared_ptr triggerCellNeighbor_wafer_; - std::shared_ptr triggerCellNeighbor_cell_; - std::shared_ptr triggerCellNeighbor_distance_; - int triggerCellCell_N_; - std::shared_ptr triggerCellCell_id_; - std::shared_ptr triggerCellCell_zside_; - std::shared_ptr triggerCellCell_subdet_; - std::shared_ptr triggerCellCell_layer_; - std::shared_ptr triggerCellCell_wafer_; - std::shared_ptr triggerCellCell_cell_; - std::shared_ptr triggerCellCell_ieta_; - std::shared_ptr triggerCellCell_iphi_; - std::shared_ptr triggerCellCell_x_; - std::shared_ptr triggerCellCell_y_; - std::shared_ptr triggerCellCell_z_; - int cellId_; - int cellSide_; - int cellSubdet_; - int cellLayer_; - int cellWafer_; - int cellWaferType_; - int cellWaferRow_; - int cellWaferColumn_; - int cell_; - float cellX_; - float cellY_; - float cellZ_; - float cellX1_; - float cellY1_; - float cellX2_; - float cellY2_; - float cellX3_; - float cellY3_; - float cellX4_; - float cellY4_; - int cellBHId_; - int cellBHSide_; - int cellBHSubdet_; - int cellBHLayer_; - int cellBHIEta_; - int cellBHIPhi_; - float cellBHEta_; - float cellBHPhi_; - float cellBHX_; - float cellBHY_; - float cellBHZ_; - float cellBHX1_; - float cellBHY1_; - float cellBHX2_; - float cellBHY2_; - float cellBHX3_; - float cellBHY3_; - float cellBHX4_; - float cellBHY4_; -}; - -/*****************************************************************/ -HGCalTriggerGeomTester::HGCalTriggerGeomTester(const edm::ParameterSet& conf) - : no_trigger_(false), - no_neighbors_(false) -/*****************************************************************/ -{ - // initialize output trees - treeModules_ = fs_->make("TreeModules", "Tree of all HGC modules"); - treeModules_->Branch("id", &moduleId_, "id/I"); - treeModules_->Branch("zside", &moduleSide_, "zside/I"); - treeModules_->Branch("subdet", &moduleSubdet_, "subdet/I"); - treeModules_->Branch("layer", &moduleLayer_, "layer/I"); - treeModules_->Branch("module", &module_, "module/I"); - treeModules_->Branch("x", &moduleX_, "x/F"); - treeModules_->Branch("y", &moduleY_, "y/F"); - treeModules_->Branch("z", &moduleZ_, "z/F"); - treeModules_->Branch("tc_n", &moduleTC_N_, "tc_n/I"); - moduleTC_id_.reset(new int[1], array_deleter()); - moduleTC_zside_.reset(new int[1], array_deleter()); - moduleTC_subdet_.reset(new int[1], array_deleter()); - moduleTC_layer_.reset(new int[1], array_deleter()); - moduleTC_wafer_.reset(new int[1], array_deleter()); - moduleTC_waferType_.reset(new int[1], array_deleter()); - moduleTC_cell_.reset(new int[1], array_deleter()); - moduleTC_x_.reset(new float[1], array_deleter()); - moduleTC_y_.reset(new float[1], array_deleter()); - moduleTC_z_.reset(new float[1], array_deleter()); - treeModules_->Branch("tc_id", moduleTC_id_.get(), "tc_id[tc_n]/I"); - treeModules_->Branch("tc_zside", moduleTC_zside_.get(), "tc_zside[tc_n]/I"); - treeModules_->Branch("tc_subdet", moduleTC_subdet_.get(), "tc_subdet[tc_n]/I"); - treeModules_->Branch("tc_layer", moduleTC_layer_.get(), "tc_layer[tc_n]/I"); - treeModules_->Branch("tc_wafer", moduleTC_wafer_.get(), "tc_wafer[tc_n]/I"); - treeModules_->Branch("tc_waferType", moduleTC_waferType_.get(), "tc_waferType[tc_n]/I"); - treeModules_->Branch("tc_cell", moduleTC_cell_.get(), "tc_cell[tc_n]/I"); - treeModules_->Branch("tc_x", moduleTC_x_.get(), "tc_x[tc_n]/F"); - treeModules_->Branch("tc_y", moduleTC_y_.get(), "tc_y[tc_n]/F"); - treeModules_->Branch("tc_z", moduleTC_z_.get(), "tc_z[tc_n]/F"); - treeModules_->Branch("c_n", &moduleCell_N_, "c_n/I"); - moduleCell_id_.reset(new int[1], array_deleter()); - moduleCell_zside_.reset(new int[1], array_deleter()); - moduleCell_subdet_.reset(new int[1], array_deleter()); - moduleCell_layer_.reset(new int[1], array_deleter()); - moduleCell_wafer_.reset(new int[1], array_deleter()); - moduleCell_cell_.reset(new int[1], array_deleter()); - moduleCell_x_.reset(new float[1], array_deleter()); - moduleCell_y_.reset(new float[1], array_deleter()); - moduleCell_z_.reset(new float[1], array_deleter()); - treeModules_->Branch("c_id", moduleCell_id_.get(), "c_id[c_n]/I"); - treeModules_->Branch("c_zside", moduleCell_zside_.get(), "c_zside[c_n]/I"); - treeModules_->Branch("c_subdet", moduleCell_subdet_.get(), "c_subdet[c_n]/I"); - treeModules_->Branch("c_layer", moduleCell_layer_.get(), "c_layer[c_n]/I"); - treeModules_->Branch("c_wafer", moduleCell_wafer_.get(), "c_wafer[c_n]/I"); - treeModules_->Branch("c_cell", moduleCell_cell_.get(), "c_cell[c_n]/I"); - treeModules_->Branch("c_x", moduleCell_x_.get(), "c_x[c_n]/F"); - treeModules_->Branch("c_y", moduleCell_y_.get(), "c_y[c_n]/F"); - treeModules_->Branch("c_z", moduleCell_z_.get(), "c_z[c_n]/F"); - // - treeTriggerCells_ = fs_->make("TreeTriggerCells", "Tree of all HGC trigger cells"); - treeTriggerCells_->Branch("id", &triggerCellId_, "id/I"); - treeTriggerCells_->Branch("zside", &triggerCellSide_, "zside/I"); - treeTriggerCells_->Branch("subdet", &triggerCellSubdet_, "subdet/I"); - treeTriggerCells_->Branch("layer", &triggerCellLayer_, "layer/I"); - treeTriggerCells_->Branch("wafer", &triggerCellWafer_, "wafer/I"); - treeTriggerCells_->Branch("wafertype", &triggerCellWaferType_, "wafertype/I"); - - treeTriggerCells_->Branch("triggercell", &triggerCell_, "triggercell/I"); - treeTriggerCells_->Branch("x", &triggerCellX_, "x/F"); - treeTriggerCells_->Branch("y", &triggerCellY_, "y/F"); - treeTriggerCells_->Branch("z", &triggerCellZ_, "z/F"); - treeTriggerCells_->Branch("neighbor_n", &triggerCellNeighbor_N_, "neighbor_n/I"); - triggerCellNeighbor_id_.reset(new int[1], array_deleter()); - triggerCellNeighbor_zside_.reset(new int[1], array_deleter()); - triggerCellNeighbor_subdet_.reset(new int[1], array_deleter()); - triggerCellNeighbor_layer_.reset(new int[1], array_deleter()); - triggerCellNeighbor_wafer_.reset(new int[1], array_deleter()); - triggerCellNeighbor_cell_.reset(new int[1], array_deleter()); - triggerCellNeighbor_distance_.reset(new float[1], array_deleter()); - treeTriggerCells_->Branch("neighbor_id", triggerCellNeighbor_id_.get(), "neighbor_id[neighbor_n]/I"); - treeTriggerCells_->Branch("neighbor_zside", triggerCellNeighbor_zside_.get(), "neighbor_zside[neighbor_n]/I"); - treeTriggerCells_->Branch("neighbor_subdet", triggerCellNeighbor_subdet_.get(), "neighbor_subdet[neighbor_n]/I"); - treeTriggerCells_->Branch("neighbor_layer", triggerCellNeighbor_layer_.get(), "neighbor_layer[neighbor_n]/I"); - treeTriggerCells_->Branch("neighbor_wafer", triggerCellNeighbor_wafer_.get(), "neighbor_wafer[neighbor_n]/I"); - treeTriggerCells_->Branch("neighbor_cell", triggerCellNeighbor_cell_.get(), "neighbor_cell[neighbor_n]/I"); - treeTriggerCells_->Branch( - "neighbor_distance", triggerCellNeighbor_distance_.get(), "neighbor_distance[neighbor_n]/F"); - treeTriggerCells_->Branch("c_n", &triggerCellCell_N_, "c_n/I"); - triggerCellCell_id_.reset(new int[1], array_deleter()); - triggerCellCell_zside_.reset(new int[1], array_deleter()); - triggerCellCell_subdet_.reset(new int[1], array_deleter()); - triggerCellCell_layer_.reset(new int[1], array_deleter()); - triggerCellCell_wafer_.reset(new int[1], array_deleter()); - triggerCellCell_cell_.reset(new int[1], array_deleter()); - triggerCellCell_ieta_.reset(new int[1], array_deleter()); - triggerCellCell_iphi_.reset(new int[1], array_deleter()); - triggerCellCell_x_.reset(new float[1], array_deleter()); - triggerCellCell_y_.reset(new float[1], array_deleter()); - triggerCellCell_z_.reset(new float[1], array_deleter()); - treeTriggerCells_->Branch("c_id", triggerCellCell_id_.get(), "c_id[c_n]/I"); - treeTriggerCells_->Branch("c_zside", triggerCellCell_zside_.get(), "c_zside[c_n]/I"); - treeTriggerCells_->Branch("c_subdet", triggerCellCell_subdet_.get(), "c_subdet[c_n]/I"); - treeTriggerCells_->Branch("c_layer", triggerCellCell_layer_.get(), "c_layer[c_n]/I"); - treeTriggerCells_->Branch("c_wafer", triggerCellCell_wafer_.get(), "c_wafer[c_n]/I"); - treeTriggerCells_->Branch("c_cell", triggerCellCell_cell_.get(), "c_cell[c_n]/I"); - treeTriggerCells_->Branch("c_ieta", triggerCellCell_ieta_.get(), "c_cell[c_n]/I"); - treeTriggerCells_->Branch("c_iphi", triggerCellCell_iphi_.get(), "c_cell[c_n]/I"); - treeTriggerCells_->Branch("c_x", triggerCellCell_x_.get(), "c_x[c_n]/F"); - treeTriggerCells_->Branch("c_y", triggerCellCell_y_.get(), "c_y[c_n]/F"); - treeTriggerCells_->Branch("c_z", triggerCellCell_z_.get(), "c_z[c_n]/F"); - // - treeCells_ = fs_->make("TreeCells", "Tree of all HGC cells"); - treeCells_->Branch("id", &cellId_, "id/I"); - treeCells_->Branch("zside", &cellSide_, "zside/I"); - treeCells_->Branch("subdet", &cellSubdet_, "subdet/I"); - treeCells_->Branch("layer", &cellLayer_, "layer/I"); - treeCells_->Branch("wafer", &cellWafer_, "wafer/I"); - treeCells_->Branch("wafertype", &cellWaferType_, "wafertype/I"); - treeCells_->Branch("waferrow", &cellWaferRow_, "waferrow/I"); - treeCells_->Branch("wafercolumn", &cellWaferColumn_, "wafercolumn/I"); - treeCells_->Branch("cell", &cell_, "cell/I"); - treeCells_->Branch("x", &cellX_, "x/F"); - treeCells_->Branch("y", &cellY_, "y/F"); - treeCells_->Branch("z", &cellZ_, "z/F"); - treeCells_->Branch("x1", &cellX1_, "x1/F"); - treeCells_->Branch("y1", &cellY1_, "y1/F"); - treeCells_->Branch("x2", &cellX2_, "x2/F"); - treeCells_->Branch("y2", &cellY2_, "y2/F"); - treeCells_->Branch("x3", &cellX3_, "x3/F"); - treeCells_->Branch("y3", &cellY3_, "y3/F"); - treeCells_->Branch("x4", &cellX4_, "x4/F"); - treeCells_->Branch("y4", &cellY4_, "y4/F"); - // - treeCellsBH_ = fs_->make("TreeCellsBH", "Tree of all BH cells"); - treeCellsBH_->Branch("id", &cellBHId_, "id/I"); - treeCellsBH_->Branch("zside", &cellBHSide_, "zside/I"); - treeCellsBH_->Branch("subdet", &cellBHSubdet_, "subdet/I"); - treeCellsBH_->Branch("layer", &cellBHLayer_, "layer/I"); - treeCellsBH_->Branch("ieta", &cellBHIEta_, "ieta/I"); - treeCellsBH_->Branch("iphi", &cellBHIPhi_, "iphi/I"); - treeCellsBH_->Branch("eta", &cellBHEta_, "eta/F"); - treeCellsBH_->Branch("phi", &cellBHPhi_, "phi/F"); - treeCellsBH_->Branch("x", &cellBHX_, "x/F"); - treeCellsBH_->Branch("y", &cellBHY_, "y/F"); - treeCellsBH_->Branch("z", &cellBHZ_, "z/F"); - treeCellsBH_->Branch("x1", &cellBHX1_, "x1/F"); - treeCellsBH_->Branch("y1", &cellBHY1_, "y1/F"); - treeCellsBH_->Branch("x2", &cellBHX2_, "x2/F"); - treeCellsBH_->Branch("y2", &cellBHY2_, "y2/F"); - treeCellsBH_->Branch("x3", &cellBHX3_, "x3/F"); - treeCellsBH_->Branch("y3", &cellBHY3_, "y3/F"); - treeCellsBH_->Branch("x4", &cellBHX4_, "x4/F"); - treeCellsBH_->Branch("y4", &cellBHY4_, "y4/F"); -} - -/*****************************************************************/ -HGCalTriggerGeomTester::~HGCalTriggerGeomTester() -/*****************************************************************/ -{} - -/*****************************************************************/ -void HGCalTriggerGeomTester::beginRun(const edm::Run& /*run*/, const edm::EventSetup& es) -/*****************************************************************/ -{ - es.get().get("", triggerGeometry_); - - try { - checkMappingConsistency(); - } catch (const cms::Exception& e) { - edm::LogWarning("HGCalTriggerGeometryTester") - << "Problem with the trigger geometry detected. Only the basic cells tree will be filled\n"; - edm::LogWarning("HGCalTriggerGeometryTester") << e.message() << "\n"; - no_trigger_ = true; - } - try { - checkNeighborConsistency(); - } catch (const cms::Exception& e) { - edm::LogWarning("HGCalTriggerGeometryTester") - << "Problem with the trigger neighbors detected. No neighbor information will be filled\n"; - edm::LogWarning("HGCalTriggerGeometryTester") << e.message() << "\n"; - no_neighbors_ = true; - } - fillTriggerGeometry(); -} - -void HGCalTriggerGeomTester::checkMappingConsistency() { - std::unordered_map> modules_to_triggercells; - std::unordered_map> modules_to_cells; - std::unordered_map> triggercells_to_cells; - - // EE - for (const auto& id : triggerGeometry_->eeGeometry()->getValidGeomDetIds()) { - if (id.rawId() == 0) - continue; - HGCalDetId waferid(id); - unsigned wafer_type = (triggerGeometry_->eeTopology().dddConstants().waferTypeT(waferid.wafer()) == 2 ? 0 : 1); - int nCells = triggerGeometry_->eeTopology().dddConstants().numberCellsHexagon(waferid.wafer()); - for (int i = 0; i < nCells; i++) { - HGCalDetId id( - ForwardSubdetector(waferid.subdetId()), waferid.zside(), waferid.layer(), wafer_type, waferid.wafer(), i); - if (!triggerGeometry_->eeTopology().valid(id)) - continue; - // fill trigger cells - uint32_t trigger_cell = triggerGeometry_->getTriggerCellFromCell(id); - auto itr_insert = triggercells_to_cells.emplace(trigger_cell, std::unordered_set()); - itr_insert.first->second.emplace(id); - // fill modules - uint32_t module = triggerGeometry_->getModuleFromCell(id); - itr_insert = modules_to_cells.emplace(module, std::unordered_set()); - itr_insert.first->second.emplace(id); - } - } - // FH - for (const auto& id : triggerGeometry_->fhGeometry()->getValidGeomDetIds()) { - if (id.rawId() == 0) - continue; - HGCalDetId waferid(id); - unsigned wafer_type = (triggerGeometry_->fhTopology().dddConstants().waferTypeT(waferid.wafer()) == 2 ? 0 : 1); - int nCells = triggerGeometry_->fhTopology().dddConstants().numberCellsHexagon(waferid.wafer()); - for (int i = 0; i < nCells; i++) { - HGCalDetId id( - ForwardSubdetector(waferid.subdetId()), waferid.zside(), waferid.layer(), wafer_type, waferid.wafer(), i); - if (!triggerGeometry_->fhTopology().valid(id)) - continue; - // fill trigger cells - uint32_t trigger_cell = triggerGeometry_->getTriggerCellFromCell(id); - auto itr_insert = triggercells_to_cells.emplace(trigger_cell, std::unordered_set()); - itr_insert.first->second.emplace(id); - // fill modules - uint32_t module = triggerGeometry_->getModuleFromCell(id); - itr_insert = modules_to_cells.emplace(module, std::unordered_set()); - itr_insert.first->second.emplace(id); - } - } - // BH - for (const auto& id : - triggerGeometry_->caloGeometry()->getSubdetectorGeometry(DetId::Hcal, HcalEndcap)->getValidDetIds()) { - if (id.rawId() == 0 || id.subdetId() != 2) - continue; - // fill trigger cells - uint32_t trigger_cell = triggerGeometry_->getTriggerCellFromCell(id); - auto itr_insert = triggercells_to_cells.emplace(trigger_cell, std::unordered_set()); - itr_insert.first->second.emplace(id); - // fill modules - uint32_t module = triggerGeometry_->getModuleFromCell(id); - itr_insert = modules_to_cells.emplace(module, std::unordered_set()); - itr_insert.first->second.emplace(id); - } - - edm::LogPrint("TriggerCellCheck") << "Checking cell -> trigger cell -> cell consistency"; - // Loop over trigger cells - for (const auto& triggercell_cells : triggercells_to_cells) { - HGCalDetId id(triggercell_cells.first); - // fill modules - uint32_t module = triggerGeometry_->getModuleFromTriggerCell(id); - auto itr_insert = modules_to_triggercells.emplace(module, std::unordered_set()); - itr_insert.first->second.emplace(id); - // Check consistency of cells included in trigger cell - HGCalTriggerGeometryBase::geom_set cells_geom = triggerGeometry_->getCellsFromTriggerCell(id); - const auto& cells = triggercell_cells.second; - for (auto cell : cells) { - if (cells_geom.find(cell) == cells_geom.end()) { - if (id.subdetId() == ForwardSubdetector::HGCHEB) { - edm::LogProblem("BadTriggerCell") << "Error: \n Cell " << cell << "(" << HcalDetId(cell) - << ")\n has not been found in \n trigger cell " << id; - } else { - edm::LogProblem("BadTriggerCell") << "Error: \n Cell " << cell << "(" << HGCalDetId(cell) - << ")\n has not been found in \n trigger cell " << id; - } - std::stringstream output; - output << " Available cells are:\n"; - for (auto cell_geom : cells_geom) { - output << cell_geom << " "; - } - edm::LogProblem("BadTriggerCell") << output.str(); - throw cms::Exception("BadTriggerCell") << "Trigger cell <-> cell inconsistency"; - } - } - } - edm::LogPrint("ModuleCheck") << "Checking trigger cell -> module -> trigger cell consistency"; - // Loop over modules - for (const auto& module_triggercells : modules_to_triggercells) { - HGCalDetId id(module_triggercells.first); - // Check consistency of trigger cells included in module - HGCalTriggerGeometryBase::geom_set triggercells_geom = triggerGeometry_->getTriggerCellsFromModule(id); - const auto& triggercells = module_triggercells.second; - for (auto cell : triggercells) { - if (triggercells_geom.find(cell) == triggercells_geom.end()) { - HGCalDetId cellid(cell); - edm::LogProblem("BadModule") << "Error: \n Trigger cell " << cell << "(" << cellid - << ")\n has not been found in \n module " << id; - std::stringstream output; - output << " Available trigger cells are:\n"; - for (auto cell_geom : triggercells_geom) { - output << cell_geom << " "; - } - edm::LogProblem("BadModule") << output.str(); - throw cms::Exception("BadModule") << "Trigger cell <-> module inconsistency"; - } - } - } - edm::LogPrint("ModuleCheck") << "Checking cell -> module -> cell consistency"; - for (const auto& module_cells : modules_to_cells) { - HGCalDetId id(module_cells.first); - // Check consistency of cells included in module - HGCalTriggerGeometryBase::geom_set cells_geom = triggerGeometry_->getCellsFromModule(id); - const auto& cells = module_cells.second; - for (auto cell : cells) { - if (cells_geom.find(cell) == cells_geom.end()) { - if (id.subdetId() == ForwardSubdetector::HGCHEB) { - edm::LogProblem("BadModule") << "Error: \n Cell " << cell << "(" << HcalDetId(cell) - << ")\n has not been found in \n module " << id; - } else { - edm::LogProblem("BadModule") << "Error: \n Cell " << cell << "(" << HGCalDetId(cell) - << ")\n has not been found in \n module " << id; - } - std::stringstream output; - output << " Available cells are:\n"; - for (auto cell_geom : cells_geom) { - output << cell_geom << " "; - } - edm::LogProblem("BadModule") << output.str(); - throw cms::Exception("BadModule") << "Cell <-> module inconsistency"; - } - } - } -} - -void HGCalTriggerGeomTester::checkNeighborConsistency() { - std::unordered_map> triggercells_to_cells; - - // EE - for (const auto& id : triggerGeometry_->eeGeometry()->getValidGeomDetIds()) { - if (id.rawId() == 0) - continue; - HGCalDetId waferid(id); - unsigned wafer_type = (triggerGeometry_->eeTopology().dddConstants().waferTypeT(waferid.wafer()) == 2 ? 0 : 1); - int nCells = triggerGeometry_->eeTopology().dddConstants().numberCellsHexagon(waferid.wafer()); - for (int i = 0; i < nCells; i++) { - HGCalDetId id( - ForwardSubdetector(waferid.subdetId()), waferid.zside(), waferid.layer(), wafer_type, waferid.wafer(), i); - if (!triggerGeometry_->eeTopology().valid(id)) - continue; - // fill trigger cells - // Skip trigger cells in module 0 - uint32_t trigger_cell = triggerGeometry_->getTriggerCellFromCell(id); - uint32_t module = triggerGeometry_->getModuleFromTriggerCell(trigger_cell); - if (HGCalDetId(module).wafer() == 0) - continue; - auto itr_insert = triggercells_to_cells.emplace(trigger_cell, std::unordered_set()); - itr_insert.first->second.emplace(id); - } - } - // FH - for (const auto& id : triggerGeometry_->fhGeometry()->getValidGeomDetIds()) { - if (id.rawId() == 0) - continue; - HGCalDetId waferid(id); - unsigned wafer_type = (triggerGeometry_->fhTopology().dddConstants().waferTypeT(waferid.wafer()) == 2 ? 0 : 1); - int nCells = triggerGeometry_->fhTopology().dddConstants().numberCellsHexagon(waferid.wafer()); - for (int i = 0; i < nCells; i++) { - HGCalDetId id( - ForwardSubdetector(waferid.subdetId()), waferid.zside(), waferid.layer(), wafer_type, waferid.wafer(), i); - if (!triggerGeometry_->fhTopology().valid(id)) - continue; - // fill trigger cells - // Skip trigger cells in module 0 - uint32_t trigger_cell = triggerGeometry_->getTriggerCellFromCell(id); - uint32_t module = triggerGeometry_->getModuleFromTriggerCell(trigger_cell); - if (HGCalDetId(module).wafer() == 0) - continue; - auto itr_insert = triggercells_to_cells.emplace(trigger_cell, std::unordered_set()); - itr_insert.first->second.emplace(id); - } - } - - // BH - for (const auto& id : - triggerGeometry_->caloGeometry()->getSubdetectorGeometry(DetId::Hcal, HcalEndcap)->getValidDetIds()) { - if (id.rawId() == 0 || id.subdetId() != 2) - continue; - // fill trigger cells - // Skip trigger cells in module 0 - uint32_t trigger_cell = triggerGeometry_->getTriggerCellFromCell(id); - uint32_t module = triggerGeometry_->getModuleFromTriggerCell(trigger_cell); - if (HGCalDetId(module).wafer() == 0) - continue; - auto itr_insert = triggercells_to_cells.emplace(trigger_cell, std::unordered_set()); - itr_insert.first->second.emplace(id); - } - - edm::LogPrint("NeighborCheck") << "Checking trigger cell neighbor consistency"; - // Loop over trigger cells - for (const auto& triggercell_cells : triggercells_to_cells) { - unsigned triggercell_id(triggercell_cells.first); - const auto neighbors = triggerGeometry_->getNeighborsFromTriggerCell(triggercell_id); - for (const auto neighbor : neighbors) { - const auto neighbors_of_neighbor = triggerGeometry_->getNeighborsFromTriggerCell(neighbor); - // check if the original cell is included in the neigbors of neighbor - if (neighbors_of_neighbor.find(triggercell_id) == neighbors_of_neighbor.end()) { - edm::LogProblem("BadNeighbor") << "Error: \n Trigger cell " << HGCalDetId(neighbor) << "\n is a neighbor of \n" - << HGCalDetId(triggercell_id); - edm::LogProblem("BadNeighbor") << " But the opposite is not true"; - std::stringstream output; - output << " List of neighbors of neighbor = \n"; - for (const auto neighbor_of_neighbor : neighbors_of_neighbor) { - output << " " << HGCalDetId(neighbor_of_neighbor) << "\n"; - } - edm::LogProblem("BadNeighbor") << output.str(); - throw cms::Exception("BadNeighbor") << "Neighbor mapping not consistent"; - } - } - } -} - -/*****************************************************************/ -void HGCalTriggerGeomTester::fillTriggerGeometry() -/*****************************************************************/ -{ - std::unordered_map> modules; - std::unordered_map> trigger_cells; - - // Loop over cells - edm::LogPrint("TreeFilling") << "Filling cells tree"; - // EE - for (const auto& id : triggerGeometry_->eeGeometry()->getValidGeomDetIds()) { - if (id.rawId() == 0) - continue; - HGCalDetId waferid(id); - unsigned wafer_type = (triggerGeometry_->eeTopology().dddConstants().waferTypeT(waferid.wafer()) == 2 ? 0 : 1); - int nCells = triggerGeometry_->eeTopology().dddConstants().numberCellsHexagon(waferid.wafer()); - for (int i = 0; i < nCells; i++) { - HGCalDetId id( - ForwardSubdetector(waferid.subdetId()), waferid.zside(), waferid.layer(), wafer_type, waferid.wafer(), i); - if (!triggerGeometry_->eeTopology().valid(id)) - continue; - cellId_ = id.rawId(); - cellSide_ = id.zside(); - cellSubdet_ = id.subdetId(); - cellLayer_ = id.layer(); - cellWafer_ = id.wafer(); - cellWaferType_ = id.waferType(); - auto row_column = triggerGeometry_->eeTopology().dddConstants().rowColumnWafer(id.wafer()); - cellWaferRow_ = row_column.first; - cellWaferColumn_ = row_column.second; - cell_ = id.cell(); - // - GlobalPoint center = triggerGeometry_->eeGeometry()->getPosition(id); - cellX_ = center.x(); - cellY_ = center.y(); - cellZ_ = center.z(); - std::vector corners = triggerGeometry_->eeGeometry()->getCorners(id); - if (corners.size() >= 4) { - cellX1_ = corners.at(0).x(); - cellY1_ = corners.at(0).y(); - cellX2_ = corners.at(1).x(); - cellY2_ = corners.at(1).y(); - cellX3_ = corners.at(2).x(); - cellY3_ = corners.at(2).y(); - cellX4_ = corners.at(3).x(); - cellY4_ = corners.at(3).y(); - } - treeCells_->Fill(); - // fill trigger cells - if (!no_trigger_) { - uint32_t trigger_cell = triggerGeometry_->getTriggerCellFromCell(id); - // Skip trigger cells in module 0 - uint32_t module = triggerGeometry_->getModuleFromTriggerCell(trigger_cell); - if (HGCalDetId(module).wafer() == 0) - continue; - auto itr_insert = trigger_cells.emplace(trigger_cell, std::unordered_set()); - itr_insert.first->second.emplace(id); - } - } - } - // FH - for (const auto& id : triggerGeometry_->fhGeometry()->getValidGeomDetIds()) { - if (id.rawId() == 0) - continue; - HGCalDetId waferid(id); - unsigned wafer_type = (triggerGeometry_->fhTopology().dddConstants().waferTypeT(waferid.wafer()) == 2 ? 0 : 1); - int nCells = triggerGeometry_->fhTopology().dddConstants().numberCellsHexagon(waferid.wafer()); - for (int i = 0; i < nCells; i++) { - HGCalDetId id( - ForwardSubdetector(waferid.subdetId()), waferid.zside(), waferid.layer(), wafer_type, waferid.wafer(), i); - if (!triggerGeometry_->fhTopology().valid(id)) - continue; - cellId_ = id.rawId(); - cellSide_ = id.zside(); - cellSubdet_ = id.subdetId(); - cellLayer_ = id.layer(); - cellWafer_ = id.wafer(); - cellWaferType_ = id.waferType(); - auto row_column = triggerGeometry_->fhTopology().dddConstants().rowColumnWafer(id.wafer()); - cellWaferRow_ = row_column.first; - cellWaferColumn_ = row_column.second; - cell_ = id.cell(); - // - GlobalPoint center = triggerGeometry_->fhGeometry()->getPosition(id); - cellX_ = center.x(); - cellY_ = center.y(); - cellZ_ = center.z(); - std::vector corners = triggerGeometry_->fhGeometry()->getCorners(id); - if (corners.size() >= 4) { - cellX1_ = corners.at(0).x(); - cellY1_ = corners.at(0).y(); - cellX2_ = corners.at(1).x(); - cellY2_ = corners.at(1).y(); - cellX3_ = corners.at(2).x(); - cellY3_ = corners.at(2).y(); - cellX4_ = corners.at(3).x(); - cellY4_ = corners.at(3).y(); - } - treeCells_->Fill(); - // fill trigger cells - if (!no_trigger_) { - uint32_t trigger_cell = triggerGeometry_->getTriggerCellFromCell(id); - // Skip trigger cells in module 0 - uint32_t module = triggerGeometry_->getModuleFromTriggerCell(trigger_cell); - if (HGCalDetId(module).wafer() == 0) - continue; - auto itr_insert = trigger_cells.emplace(trigger_cell, std::unordered_set()); - itr_insert.first->second.emplace(id); - } - } - } - - // BH - for (const auto& id : - triggerGeometry_->caloGeometry()->getSubdetectorGeometry(DetId::Hcal, HcalEndcap)->getValidDetIds()) { - if (id.rawId() == 0 || id.subdetId() != 2) - continue; - HcalDetId cellid(id); - cellBHId_ = cellid.rawId(); - cellBHSide_ = cellid.zside(); - cellBHSubdet_ = cellid.subdetId(); - cellBHLayer_ = cellid.depth(); - cellBHIEta_ = cellid.ieta(); - cellBHIPhi_ = cellid.iphi(); - // - GlobalPoint center = triggerGeometry_->bhGeometry()->getGeometry(id)->getPosition(); - cellBHEta_ = center.eta(); - cellBHPhi_ = center.phi(); - cellBHX_ = center.x(); - cellBHY_ = center.y(); - cellBHZ_ = center.z(); - auto corners = triggerGeometry_->bhGeometry()->getGeometry(id)->getCorners(); - if (corners.size() >= 4) { - cellBHX1_ = corners[0].x(); - cellBHY1_ = corners[0].y(); - cellBHX2_ = corners[1].x(); - cellBHY2_ = corners[1].y(); - cellBHX3_ = corners[2].x(); - cellBHY3_ = corners[2].y(); - cellBHX4_ = corners[3].x(); - cellBHY4_ = corners[3].y(); - } - treeCellsBH_->Fill(); - // fill trigger cells - if (!no_trigger_) { - uint32_t trigger_cell = triggerGeometry_->getTriggerCellFromCell(id); - // Skip trigger cells in module 0 - uint32_t module = triggerGeometry_->getModuleFromTriggerCell(trigger_cell); - if (HGCalDetId(module).wafer() == 0) - continue; - auto itr_insert = trigger_cells.emplace(trigger_cell, std::unordered_set()); - itr_insert.first->second.emplace(id); - } - } - - // if problem detected in the trigger geometry, don't produce trigger trees - if (no_trigger_) - return; - - // Loop over trigger cells - edm::LogPrint("TreeFilling") << "Filling trigger cells tree"; - for (const auto& triggercell_cells : trigger_cells) { - HGCalDetId id(triggercell_cells.first); - GlobalPoint position = triggerGeometry_->getTriggerCellPosition(id); - triggerCellId_ = id.rawId(); - triggerCellSide_ = id.zside(); - triggerCellSubdet_ = id.subdetId(); - triggerCellLayer_ = id.layer(); - triggerCellWafer_ = id.wafer(); - triggerCellWaferType_ = id.waferType(); - triggerCell_ = id.cell(); - triggerCellX_ = position.x(); - triggerCellY_ = position.y(); - triggerCellZ_ = position.z(); - triggerCellCell_N_ = triggercell_cells.second.size(); - // - setTreeTriggerCellSize(triggerCellCell_N_); - size_t ic = 0; - for (const auto& c : triggercell_cells.second) { - if (id.subdetId() == ForwardSubdetector::HGCHEB) { - HcalDetId cId(c); - GlobalPoint cell_position = triggerGeometry_->bhGeometry()->getGeometry(cId)->getPosition(); - triggerCellCell_id_.get()[ic] = c; - triggerCellCell_zside_.get()[ic] = cId.zside(); - triggerCellCell_subdet_.get()[ic] = cId.subdetId(); - triggerCellCell_layer_.get()[ic] = cId.depth(); - triggerCellCell_wafer_.get()[ic] = 0; - triggerCellCell_cell_.get()[ic] = 0; - triggerCellCell_ieta_.get()[ic] = cId.ietaAbs(); - triggerCellCell_iphi_.get()[ic] = cId.iphi(); - triggerCellCell_x_.get()[ic] = cell_position.x(); - triggerCellCell_y_.get()[ic] = cell_position.y(); - triggerCellCell_z_.get()[ic] = cell_position.z(); - } else { - HGCalDetId cId(c); - GlobalPoint cell_position = - (cId.subdetId() == ForwardSubdetector::HGCEE ? triggerGeometry_->eeGeometry()->getPosition(cId) - : triggerGeometry_->fhGeometry()->getPosition(cId)); - triggerCellCell_id_.get()[ic] = c; - triggerCellCell_zside_.get()[ic] = cId.zside(); - triggerCellCell_subdet_.get()[ic] = cId.subdetId(); - triggerCellCell_layer_.get()[ic] = cId.layer(); - triggerCellCell_wafer_.get()[ic] = cId.wafer(); - triggerCellCell_cell_.get()[ic] = cId.cell(); - triggerCellCell_ieta_.get()[ic] = 0; - triggerCellCell_iphi_.get()[ic] = 0; - triggerCellCell_x_.get()[ic] = cell_position.x(); - triggerCellCell_y_.get()[ic] = cell_position.y(); - triggerCellCell_z_.get()[ic] = cell_position.z(); - } - ic++; - } - // Get neighbors - if (!no_neighbors_) { - const auto neighbors = triggerGeometry_->getNeighborsFromTriggerCell(id.rawId()); - triggerCellNeighbor_N_ = neighbors.size(); - setTreeTriggerCellNeighborSize(triggerCellNeighbor_N_); - size_t in = 0; - for (const auto neighbor : neighbors) { - GlobalPoint neighbor_position = triggerGeometry_->getTriggerCellPosition(neighbor); - HGCalDetId nId(neighbor); - triggerCellNeighbor_id_.get()[in] = neighbor; - triggerCellNeighbor_zside_.get()[in] = nId.zside(); - triggerCellNeighbor_subdet_.get()[in] = nId.subdetId(); - triggerCellNeighbor_layer_.get()[in] = nId.layer(); - triggerCellNeighbor_wafer_.get()[in] = nId.wafer(); - triggerCellNeighbor_cell_.get()[in] = nId.cell(); - triggerCellNeighbor_distance_.get()[in] = (neighbor_position - position).mag(); - in++; - } - } - // - treeTriggerCells_->Fill(); - // fill modules - uint32_t module = triggerGeometry_->getModuleFromTriggerCell(id); - auto itr_insert = modules.emplace(module, std::unordered_set()); - itr_insert.first->second.emplace(id); - } - // Loop over modules - edm::LogPrint("TreeFilling") << "Filling modules tree"; - for (const auto& module_triggercells : modules) { - HGCalDetId id(module_triggercells.first); - GlobalPoint position = triggerGeometry_->getModulePosition(id); - moduleId_ = id.rawId(); - moduleSide_ = id.zside(); - moduleSubdet_ = id.subdetId(); - moduleLayer_ = id.layer(); - module_ = id.wafer(); - moduleX_ = position.x(); - moduleY_ = position.y(); - moduleZ_ = position.z(); - moduleTC_N_ = module_triggercells.second.size(); - // - setTreeModuleSize(moduleTC_N_); - size_t itc = 0; - for (const auto& tc : module_triggercells.second) { - HGCalDetId tcId(tc); - GlobalPoint position = triggerGeometry_->getTriggerCellPosition(tcId); - moduleTC_id_.get()[itc] = tc; - moduleTC_zside_.get()[itc] = tcId.zside(); - moduleTC_subdet_.get()[itc] = tcId.subdetId(); - moduleTC_layer_.get()[itc] = tcId.layer(); - moduleTC_wafer_.get()[itc] = tcId.wafer(); - moduleTC_waferType_.get()[itc] = tcId.waferType(); - moduleTC_cell_.get()[itc] = tcId.cell(); - moduleTC_x_.get()[itc] = position.x(); - moduleTC_y_.get()[itc] = position.y(); - moduleTC_z_.get()[itc] = position.z(); - itc++; - } - auto cells_in_module = triggerGeometry_->getCellsFromModule(id); - moduleCell_N_ = cells_in_module.size(); - // - setTreeModuleCellSize(moduleCell_N_); - size_t ic = 0; - for (const auto& c : cells_in_module) { - HGCalDetId cId(c); - const GlobalPoint position = - (cId.subdetId() == ForwardSubdetector::HGCEE ? triggerGeometry_->eeGeometry()->getPosition(cId) - : triggerGeometry_->fhGeometry()->getPosition(cId)); - moduleCell_id_.get()[ic] = c; - moduleCell_zside_.get()[ic] = cId.zside(); - moduleCell_subdet_.get()[ic] = cId.subdetId(); - moduleCell_layer_.get()[ic] = cId.layer(); - moduleCell_wafer_.get()[ic] = cId.wafer(); - moduleCell_cell_.get()[ic] = cId.cell(); - moduleCell_x_.get()[ic] = position.x(); - moduleCell_y_.get()[ic] = position.y(); - moduleCell_z_.get()[ic] = position.z(); - ic++; - } - // - treeModules_->Fill(); - } -} - -/*****************************************************************/ -void HGCalTriggerGeomTester::analyze(const edm::Event& e, const edm::EventSetup& es) -/*****************************************************************/ -{} - -/*****************************************************************/ -void HGCalTriggerGeomTester::setTreeModuleSize(const size_t n) -/*****************************************************************/ -{ - moduleTC_id_.reset(new int[n], array_deleter()); - moduleTC_zside_.reset(new int[n], array_deleter()); - moduleTC_subdet_.reset(new int[n], array_deleter()); - moduleTC_layer_.reset(new int[n], array_deleter()); - moduleTC_wafer_.reset(new int[n], array_deleter()); - moduleTC_waferType_.reset(new int[n], array_deleter()); - moduleTC_cell_.reset(new int[n], array_deleter()); - moduleTC_x_.reset(new float[n], array_deleter()); - moduleTC_y_.reset(new float[n], array_deleter()); - moduleTC_z_.reset(new float[n], array_deleter()); - - treeModules_->GetBranch("tc_id")->SetAddress(moduleTC_id_.get()); - treeModules_->GetBranch("tc_zside")->SetAddress(moduleTC_zside_.get()); - treeModules_->GetBranch("tc_subdet")->SetAddress(moduleTC_subdet_.get()); - treeModules_->GetBranch("tc_layer")->SetAddress(moduleTC_layer_.get()); - treeModules_->GetBranch("tc_wafer")->SetAddress(moduleTC_wafer_.get()); - treeModules_->GetBranch("tc_waferType")->SetAddress(moduleTC_waferType_.get()); - treeModules_->GetBranch("tc_cell")->SetAddress(moduleTC_cell_.get()); - treeModules_->GetBranch("tc_x")->SetAddress(moduleTC_x_.get()); - treeModules_->GetBranch("tc_y")->SetAddress(moduleTC_y_.get()); - treeModules_->GetBranch("tc_z")->SetAddress(moduleTC_z_.get()); -} - -/*****************************************************************/ -void HGCalTriggerGeomTester::setTreeModuleCellSize(const size_t n) -/*****************************************************************/ -{ - moduleCell_id_.reset(new int[n], array_deleter()); - moduleCell_zside_.reset(new int[n], array_deleter()); - moduleCell_subdet_.reset(new int[n], array_deleter()); - moduleCell_layer_.reset(new int[n], array_deleter()); - moduleCell_wafer_.reset(new int[n], array_deleter()); - moduleCell_cell_.reset(new int[n], array_deleter()); - moduleCell_x_.reset(new float[n], array_deleter()); - moduleCell_y_.reset(new float[n], array_deleter()); - moduleCell_z_.reset(new float[n], array_deleter()); - - treeModules_->GetBranch("c_id")->SetAddress(moduleCell_id_.get()); - treeModules_->GetBranch("c_zside")->SetAddress(moduleCell_zside_.get()); - treeModules_->GetBranch("c_subdet")->SetAddress(moduleCell_subdet_.get()); - treeModules_->GetBranch("c_layer")->SetAddress(moduleCell_layer_.get()); - treeModules_->GetBranch("c_wafer")->SetAddress(moduleCell_wafer_.get()); - treeModules_->GetBranch("c_cell")->SetAddress(moduleCell_cell_.get()); - treeModules_->GetBranch("c_x")->SetAddress(moduleCell_x_.get()); - treeModules_->GetBranch("c_y")->SetAddress(moduleCell_y_.get()); - treeModules_->GetBranch("c_z")->SetAddress(moduleCell_z_.get()); -} - -/*****************************************************************/ -void HGCalTriggerGeomTester::setTreeTriggerCellSize(const size_t n) -/*****************************************************************/ -{ - triggerCellCell_id_.reset(new int[n], array_deleter()); - triggerCellCell_zside_.reset(new int[n], array_deleter()); - triggerCellCell_subdet_.reset(new int[n], array_deleter()); - triggerCellCell_layer_.reset(new int[n], array_deleter()); - triggerCellCell_wafer_.reset(new int[n], array_deleter()); - triggerCellCell_cell_.reset(new int[n], array_deleter()); - triggerCellCell_ieta_.reset(new int[n], array_deleter()); - triggerCellCell_iphi_.reset(new int[n], array_deleter()); - triggerCellCell_x_.reset(new float[n], array_deleter()); - triggerCellCell_y_.reset(new float[n], array_deleter()); - triggerCellCell_z_.reset(new float[n], array_deleter()); - - treeTriggerCells_->GetBranch("c_id")->SetAddress(triggerCellCell_id_.get()); - treeTriggerCells_->GetBranch("c_zside")->SetAddress(triggerCellCell_zside_.get()); - treeTriggerCells_->GetBranch("c_subdet")->SetAddress(triggerCellCell_subdet_.get()); - treeTriggerCells_->GetBranch("c_layer")->SetAddress(triggerCellCell_layer_.get()); - treeTriggerCells_->GetBranch("c_wafer")->SetAddress(triggerCellCell_wafer_.get()); - treeTriggerCells_->GetBranch("c_cell")->SetAddress(triggerCellCell_cell_.get()); - treeTriggerCells_->GetBranch("c_ieta")->SetAddress(triggerCellCell_ieta_.get()); - treeTriggerCells_->GetBranch("c_iphi")->SetAddress(triggerCellCell_iphi_.get()); - treeTriggerCells_->GetBranch("c_x")->SetAddress(triggerCellCell_x_.get()); - treeTriggerCells_->GetBranch("c_y")->SetAddress(triggerCellCell_y_.get()); - treeTriggerCells_->GetBranch("c_z")->SetAddress(triggerCellCell_z_.get()); -} - -/*****************************************************************/ -void HGCalTriggerGeomTester::setTreeTriggerCellNeighborSize(const size_t n) -/*****************************************************************/ -{ - triggerCellNeighbor_id_.reset(new int[n], array_deleter()); - triggerCellNeighbor_zside_.reset(new int[n], array_deleter()); - triggerCellNeighbor_subdet_.reset(new int[n], array_deleter()); - triggerCellNeighbor_layer_.reset(new int[n], array_deleter()); - triggerCellNeighbor_wafer_.reset(new int[n], array_deleter()); - triggerCellNeighbor_cell_.reset(new int[n], array_deleter()); - triggerCellNeighbor_distance_.reset(new float[n], array_deleter()); - treeTriggerCells_->GetBranch("neighbor_id")->SetAddress(triggerCellNeighbor_id_.get()); - treeTriggerCells_->GetBranch("neighbor_zside")->SetAddress(triggerCellNeighbor_zside_.get()); - treeTriggerCells_->GetBranch("neighbor_subdet")->SetAddress(triggerCellNeighbor_subdet_.get()); - treeTriggerCells_->GetBranch("neighbor_layer")->SetAddress(triggerCellNeighbor_layer_.get()); - treeTriggerCells_->GetBranch("neighbor_wafer")->SetAddress(triggerCellNeighbor_wafer_.get()); - treeTriggerCells_->GetBranch("neighbor_cell")->SetAddress(triggerCellNeighbor_cell_.get()); - treeTriggerCells_->GetBranch("neighbor_distance")->SetAddress(triggerCellNeighbor_distance_.get()); -} - -//define this as a plug-in -DEFINE_FWK_MODULE(HGCalTriggerGeomTester); diff --git a/L1Trigger/L1THGCal/test/HGCalTriggerGeomTesterV9.cc b/L1Trigger/L1THGCal/test/HGCalTriggerGeomTesterV9Imp3.cc similarity index 57% rename from L1Trigger/L1THGCal/test/HGCalTriggerGeomTesterV9.cc rename to L1Trigger/L1THGCal/test/HGCalTriggerGeomTesterV9Imp3.cc index 10a44dc911c70..9dcd9b719f304 100644 --- a/L1Trigger/L1THGCal/test/HGCalTriggerGeomTesterV9.cc +++ b/L1Trigger/L1THGCal/test/HGCalTriggerGeomTesterV9Imp3.cc @@ -4,31 +4,34 @@ #include "TTree.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CommonTools/UtilAlgos/interface/TFileService.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDAnalyzer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" -#include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ESTransientHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESTransientHandle.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" +#include "DataFormats/ForwardDetId/interface/HFNoseTriggerDetId.h" #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" +#include "DataFormats/ForwardDetId/interface/HGCalTriggerDetId.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/HGCalCommonData/interface/HGCalGeometryMode.h" -#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" #include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" #include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" +#include "Geometry/HGCalCommonData/interface/HGCalGeometryMode.h" +#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/Records/interface/IdealGeometryRecord.h" #include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h" +#include "DataFormats/ForwardDetId/interface/HGCalTriggerModuleDetId.h" +#include "DataFormats/ForwardDetId/interface/HGCalTriggerBackendDetId.h" #include @@ -39,10 +42,10 @@ namespace { }; } // namespace -class HGCalTriggerGeomTesterV9 : public edm::stream::EDAnalyzer<> { +class HGCalTriggerGeomTesterV9Imp3 : public edm::stream::EDAnalyzer<> { public: - explicit HGCalTriggerGeomTesterV9(const edm::ParameterSet&); - ~HGCalTriggerGeomTesterV9(); + explicit HGCalTriggerGeomTesterV9Imp3(const edm::ParameterSet&); + ~HGCalTriggerGeomTesterV9Imp3(); virtual void beginRun(const edm::Run&, const edm::EventSetup&); virtual void analyze(const edm::Event&, const edm::EventSetup&); @@ -50,7 +53,6 @@ class HGCalTriggerGeomTesterV9 : public edm::stream::EDAnalyzer<> { private: void fillTriggerGeometry(); bool checkMappingConsistency(); - bool checkNeighborConsistency(); void setTreeModuleSize(const size_t n); void setTreeModuleCellSize(const size_t n); void setTreeTriggerCellSize(const size_t n); @@ -58,9 +60,6 @@ class HGCalTriggerGeomTesterV9 : public edm::stream::EDAnalyzer<> { void setTreeTriggerCellNeighborSize(const size_t n); edm::ESHandle triggerGeometry_; - edm::ESHandle eeGeometry_; - edm::ESHandle hsiGeometry_; - edm::ESHandle hscGeometry_; edm::Service fs_; bool no_trigger_; bool no_neighbors_; @@ -68,28 +67,35 @@ class HGCalTriggerGeomTesterV9 : public edm::stream::EDAnalyzer<> { TTree* treeTriggerCells_; TTree* treeCells_; TTree* treeCellsBH_; + TTree* treeCellsNose_; TTree* treeModuleErrors_; // tree variables - int moduleId_; - int moduleSide_; - int moduleSubdet_; - int moduleLayer_; - int module_; - int moduleLinks_; - float moduleX_; - float moduleY_; - float moduleZ_; - int moduleTC_N_; + int moduleId_ = 0; + int moduleSide_ = 0; + int moduleSubdet_ = 0; + int moduleLayer_ = 0; + int moduleIEta_ = 0; + int moduleIPhi_ = 0; + int module_ = 0; + float moduleX_ = 0; + float moduleY_ = 0; + float moduleZ_ = 0; + int moduleTC_N_ = 0; + int moduleLinks_ = 0; std::shared_ptr moduleTC_id_; std::shared_ptr moduleTC_zside_; std::shared_ptr moduleTC_subdet_; std::shared_ptr moduleTC_layer_; - std::shared_ptr moduleTC_wafer_; - std::shared_ptr moduleTC_cell_; + std::shared_ptr moduleTC_waferU_; + std::shared_ptr moduleTC_waferV_; + std::shared_ptr moduleTC_cellU_; + std::shared_ptr moduleTC_cellV_; + std::shared_ptr moduleTC_ieta_; + std::shared_ptr moduleTC_iphi_; std::shared_ptr moduleTC_x_; std::shared_ptr moduleTC_y_; std::shared_ptr moduleTC_z_; - int moduleCell_N_; + int moduleCell_N_ = 0; std::shared_ptr moduleCell_id_; std::shared_ptr moduleCell_zside_; std::shared_ptr moduleCell_subdet_; @@ -101,24 +107,32 @@ class HGCalTriggerGeomTesterV9 : public edm::stream::EDAnalyzer<> { std::shared_ptr moduleCell_x_; std::shared_ptr moduleCell_y_; std::shared_ptr moduleCell_z_; - int triggerCellId_; - int triggerCellSide_; - int triggerCellSubdet_; - int triggerCellLayer_; - int triggerCellWafer_; - int triggerCell_; - float triggerCellX_; - float triggerCellY_; - float triggerCellZ_; - int triggerCellNeighbor_N_; + int triggerCellId_ = 0; + int triggerCellSide_ = 0; + int triggerCellSubdet_ = 0; + int triggerCellLayer_ = 0; + int triggerCellWaferU_ = 0; + int triggerCellWaferV_ = 0; + int triggerCellU_ = 0; + int triggerCellV_ = 0; + int triggerCellIEta_ = 0; + int triggerCellIPhi_ = 0; + float triggerCellX_ = 0; + float triggerCellY_ = 0; + float triggerCellZ_ = 0; + int triggerCellNeighbor_N_ = 0; std::shared_ptr triggerCellNeighbor_id_; std::shared_ptr triggerCellNeighbor_zside_; std::shared_ptr triggerCellNeighbor_subdet_; std::shared_ptr triggerCellNeighbor_layer_; - std::shared_ptr triggerCellNeighbor_wafer_; - std::shared_ptr triggerCellNeighbor_cell_; + std::shared_ptr triggerCellNeighbor_waferU_; + std::shared_ptr triggerCellNeighbor_waferV_; + std::shared_ptr triggerCellNeighbor_cellU_; + std::shared_ptr triggerCellNeighbor_cellV_; + std::shared_ptr triggerCellNeighbor_cellIEta_; + std::shared_ptr triggerCellNeighbor_cellIPhi_; std::shared_ptr triggerCellNeighbor_distance_; - int triggerCellCell_N_; + int triggerCellCell_N_ = 0; std::shared_ptr triggerCellCell_id_; std::shared_ptr triggerCellCell_zside_; std::shared_ptr triggerCellCell_subdet_; @@ -132,57 +146,58 @@ class HGCalTriggerGeomTesterV9 : public edm::stream::EDAnalyzer<> { std::shared_ptr triggerCellCell_x_; std::shared_ptr triggerCellCell_y_; std::shared_ptr triggerCellCell_z_; - int cellId_; - int cellSide_; - int cellSubdet_; - int cellLayer_; - int cellWaferU_; - int cellWaferV_; - int cellWaferType_; - int cellWaferRow_; - int cellWaferColumn_; - int cellU_; - int cellV_; - float cellX_; - float cellY_; - float cellZ_; - int cellCornersN_; + int cellId_ = 0; + int cellSide_ = 0; + int cellSubdet_ = 0; + int cellLayer_ = 0; + int cellWaferU_ = 0; + int cellWaferV_ = 0; + int cellWaferType_ = 0; + int cellWaferRow_ = 0; + int cellWaferColumn_ = 0; + int cellU_ = 0; + int cellV_ = 0; + float cellX_ = 0; + float cellY_ = 0; + float cellZ_ = 0; + int cellCornersN_ = 0; std::shared_ptr cellCornersX_; std::shared_ptr cellCornersY_; std::shared_ptr cellCornersZ_; - int cellBHId_; - int cellBHType_; - int cellBHSide_; - int cellBHSubdet_; - int cellBHLayer_; - int cellBHIEta_; - int cellBHIPhi_; - float cellBHEta_; - float cellBHPhi_; - float cellBHX_; - float cellBHY_; - float cellBHZ_; - float cellBHX1_; - float cellBHY1_; - float cellBHX2_; - float cellBHY2_; - float cellBHX3_; - float cellBHY3_; - float cellBHX4_; - float cellBHY4_; + int cellBHId_ = 0; + int cellBHType_ = 0; + int cellBHSide_ = 0; + int cellBHSubdet_ = 0; + int cellBHLayer_ = 0; + int cellBHIEta_ = 0; + int cellBHIPhi_ = 0; + float cellBHEta_ = 0; + float cellBHPhi_ = 0; + float cellBHX_ = 0; + float cellBHY_ = 0; + float cellBHZ_ = 0; + float cellBHX1_ = 0; + float cellBHY1_ = 0; + float cellBHX2_ = 0; + float cellBHY2_ = 0; + float cellBHX3_ = 0; + float cellBHY3_ = 0; + float cellBHX4_ = 0; + float cellBHY4_ = 0; // - int moduleErrorSubdet_; - int moduleErrorLayer_; - int moduleErrorWafer_; + int moduleErrorSubdet_ = 0; + int moduleErrorLayer_ = 0; + int moduleErrorWaferU_ = 0; + int moduleErrorWaferV_ = 0; private: typedef std::unordered_map> trigger_map_set; }; /*****************************************************************/ -HGCalTriggerGeomTesterV9::HGCalTriggerGeomTesterV9(const edm::ParameterSet& conf) +HGCalTriggerGeomTesterV9Imp3::HGCalTriggerGeomTesterV9Imp3(const edm::ParameterSet& conf) : no_trigger_(false), - no_neighbors_(false) + no_neighbors_(true) /*****************************************************************/ { // initialize output trees @@ -191,6 +206,8 @@ HGCalTriggerGeomTesterV9::HGCalTriggerGeomTesterV9(const edm::ParameterSet& conf treeModules_->Branch("zside", &moduleSide_, "zside/I"); treeModules_->Branch("subdet", &moduleSubdet_, "subdet/I"); treeModules_->Branch("layer", &moduleLayer_, "layer/I"); + treeModules_->Branch("ieta", &moduleIEta_, "ieta/I"); + treeModules_->Branch("iphi", &moduleIPhi_, "iphi/I"); treeModules_->Branch("module", &module_, "module/I"); treeModules_->Branch("links", &moduleLinks_, "links/I"); treeModules_->Branch("x", &moduleX_, "x/F"); @@ -201,8 +218,10 @@ HGCalTriggerGeomTesterV9::HGCalTriggerGeomTesterV9(const edm::ParameterSet& conf moduleTC_zside_.reset(new int[1], array_deleter()); moduleTC_subdet_.reset(new int[1], array_deleter()); moduleTC_layer_.reset(new int[1], array_deleter()); - moduleTC_wafer_.reset(new int[1], array_deleter()); - moduleTC_cell_.reset(new int[1], array_deleter()); + moduleTC_waferU_.reset(new int[1], array_deleter()); + moduleTC_waferV_.reset(new int[1], array_deleter()); + moduleTC_cellU_.reset(new int[1], array_deleter()); + moduleTC_cellV_.reset(new int[1], array_deleter()); moduleTC_x_.reset(new float[1], array_deleter()); moduleTC_y_.reset(new float[1], array_deleter()); moduleTC_z_.reset(new float[1], array_deleter()); @@ -210,8 +229,12 @@ HGCalTriggerGeomTesterV9::HGCalTriggerGeomTesterV9(const edm::ParameterSet& conf treeModules_->Branch("tc_zside", moduleTC_zside_.get(), "tc_zside[tc_n]/I"); treeModules_->Branch("tc_subdet", moduleTC_subdet_.get(), "tc_subdet[tc_n]/I"); treeModules_->Branch("tc_layer", moduleTC_layer_.get(), "tc_layer[tc_n]/I"); - treeModules_->Branch("tc_wafer", moduleTC_wafer_.get(), "tc_wafer[tc_n]/I"); - treeModules_->Branch("tc_cell", moduleTC_cell_.get(), "tc_cell[tc_n]/I"); + treeModules_->Branch("tc_waferu", moduleTC_waferU_.get(), "tc_waferu[tc_n]/I"); + treeModules_->Branch("tc_waferv", moduleTC_waferV_.get(), "tc_waferv[tc_n]/I"); + treeModules_->Branch("tc_cellu", moduleTC_cellU_.get(), "tc_cellu[tc_n]/I"); + treeModules_->Branch("tc_cellv", moduleTC_cellV_.get(), "tc_cellv[tc_n]/I"); + treeModules_->Branch("tc_ieta", moduleTC_ieta_.get(), "tc_ieta[tc_n]/I"); + treeModules_->Branch("tc_iphi", moduleTC_iphi_.get(), "tc_iphi[tc_n]/I"); treeModules_->Branch("tc_x", moduleTC_x_.get(), "tc_x[tc_n]/F"); treeModules_->Branch("tc_y", moduleTC_y_.get(), "tc_y[tc_n]/F"); treeModules_->Branch("tc_z", moduleTC_z_.get(), "tc_z[tc_n]/F"); @@ -244,8 +267,12 @@ HGCalTriggerGeomTesterV9::HGCalTriggerGeomTesterV9(const edm::ParameterSet& conf treeTriggerCells_->Branch("zside", &triggerCellSide_, "zside/I"); treeTriggerCells_->Branch("subdet", &triggerCellSubdet_, "subdet/I"); treeTriggerCells_->Branch("layer", &triggerCellLayer_, "layer/I"); - treeTriggerCells_->Branch("wafer", &triggerCellWafer_, "wafer/I"); - treeTriggerCells_->Branch("triggercell", &triggerCell_, "triggercell/I"); + treeTriggerCells_->Branch("waferu", &triggerCellWaferU_, "waferu/I"); + treeTriggerCells_->Branch("waferv", &triggerCellWaferV_, "waferv/I"); + treeTriggerCells_->Branch("triggercellu", &triggerCellU_, "triggercellu/I"); + treeTriggerCells_->Branch("triggercellv", &triggerCellV_, "triggercellv/I"); + treeTriggerCells_->Branch("triggercellieta", &triggerCellIEta_, "triggercellieta/I"); + treeTriggerCells_->Branch("triggercelliphi", &triggerCellIPhi_, "triggercelliphi/I"); treeTriggerCells_->Branch("x", &triggerCellX_, "x/F"); treeTriggerCells_->Branch("y", &triggerCellY_, "y/F"); treeTriggerCells_->Branch("z", &triggerCellZ_, "z/F"); @@ -254,15 +281,19 @@ HGCalTriggerGeomTesterV9::HGCalTriggerGeomTesterV9(const edm::ParameterSet& conf triggerCellNeighbor_zside_.reset(new int[1], array_deleter()); triggerCellNeighbor_subdet_.reset(new int[1], array_deleter()); triggerCellNeighbor_layer_.reset(new int[1], array_deleter()); - triggerCellNeighbor_wafer_.reset(new int[1], array_deleter()); - triggerCellNeighbor_cell_.reset(new int[1], array_deleter()); + triggerCellNeighbor_waferU_.reset(new int[1], array_deleter()); + triggerCellNeighbor_waferV_.reset(new int[1], array_deleter()); + triggerCellNeighbor_cellU_.reset(new int[1], array_deleter()); + triggerCellNeighbor_cellV_.reset(new int[1], array_deleter()); triggerCellNeighbor_distance_.reset(new float[1], array_deleter()); treeTriggerCells_->Branch("neighbor_id", triggerCellNeighbor_id_.get(), "neighbor_id[neighbor_n]/I"); treeTriggerCells_->Branch("neighbor_zside", triggerCellNeighbor_zside_.get(), "neighbor_zside[neighbor_n]/I"); treeTriggerCells_->Branch("neighbor_subdet", triggerCellNeighbor_subdet_.get(), "neighbor_subdet[neighbor_n]/I"); treeTriggerCells_->Branch("neighbor_layer", triggerCellNeighbor_layer_.get(), "neighbor_layer[neighbor_n]/I"); - treeTriggerCells_->Branch("neighbor_wafer", triggerCellNeighbor_wafer_.get(), "neighbor_wafer[neighbor_n]/I"); - treeTriggerCells_->Branch("neighbor_cell", triggerCellNeighbor_cell_.get(), "neighbor_cell[neighbor_n]/I"); + treeTriggerCells_->Branch("neighbor_waferu", triggerCellNeighbor_waferU_.get(), "neighbor_waferu[neighbor_n]/I"); + treeTriggerCells_->Branch("neighbor_waferv", triggerCellNeighbor_waferV_.get(), "neighbor_waferv[neighbor_n]/I"); + treeTriggerCells_->Branch("neighbor_cellu", triggerCellNeighbor_cellU_.get(), "neighbor_cellu[neighbor_n]/I"); + treeTriggerCells_->Branch("neighbor_cellv", triggerCellNeighbor_cellV_.get(), "neighbor_cellv[neighbor_n]/I"); treeTriggerCells_->Branch( "neighbor_distance", triggerCellNeighbor_distance_.get(), "neighbor_distance[neighbor_n]/F"); treeTriggerCells_->Branch("c_n", &triggerCellCell_N_, "c_n/I"); @@ -335,36 +366,56 @@ HGCalTriggerGeomTesterV9::HGCalTriggerGeomTesterV9(const edm::ParameterSet& conf treeCellsBH_->Branch("x4", &cellBHX4_, "x4/F"); treeCellsBH_->Branch("y4", &cellBHY4_, "y4/F"); // + treeCellsNose_ = fs_->make("TreeCellsNose", "Tree of all HGCnose cells"); + treeCellsNose_->Branch("id", &cellId_, "id/I"); + treeCellsNose_->Branch("zside", &cellSide_, "zside/I"); + treeCellsNose_->Branch("subdet", &cellSubdet_, "subdet/I"); + treeCellsNose_->Branch("layer", &cellLayer_, "layer/I"); + treeCellsNose_->Branch("waferu", &cellWaferU_, "waferu/I"); + treeCellsNose_->Branch("waferv", &cellWaferV_, "waferv/I"); + treeCellsNose_->Branch("wafertype", &cellWaferType_, "wafertype/I"); + treeCellsNose_->Branch("waferrow", &cellWaferRow_, "waferrow/I"); + treeCellsNose_->Branch("wafercolumn", &cellWaferColumn_, "wafercolumn/I"); + treeCellsNose_->Branch("cellu", &cellU_, "cellu/I"); + treeCellsNose_->Branch("cellv", &cellV_, "cellv/I"); + treeCellsNose_->Branch("x", &cellX_, "x/F"); + treeCellsNose_->Branch("y", &cellY_, "y/F"); + treeCellsNose_->Branch("z", &cellZ_, "z/F"); + treeCellsNose_->Branch("corner_n", &cellCornersN_, "corner_n/I"); + treeCellsNose_->Branch("corner_x", cellCornersX_.get(), "corner_x[corner_n]/F"); + treeCellsNose_->Branch("corner_y", cellCornersY_.get(), "corner_y[corner_n]/F"); + treeCellsNose_->Branch("corner_z", cellCornersZ_.get(), "corner_z[corner_n]/F"); + // treeModuleErrors_ = fs_->make("TreeModuleErrors", "Tree of module mapping errors"); treeModuleErrors_->Branch("subdet", &moduleErrorSubdet_, "subdet/I"); treeModuleErrors_->Branch("layer", &moduleErrorLayer_, "layer/I"); - treeModuleErrors_->Branch("wafer", &moduleErrorWafer_, "wafer/I"); + treeModuleErrors_->Branch("waferu", &moduleErrorWaferU_, "waferu/I"); + treeModuleErrors_->Branch("waferv", &moduleErrorWaferV_, "waferv/I"); } /*****************************************************************/ -HGCalTriggerGeomTesterV9::~HGCalTriggerGeomTesterV9() +HGCalTriggerGeomTesterV9Imp3::~HGCalTriggerGeomTesterV9Imp3() /*****************************************************************/ {} /*****************************************************************/ -void HGCalTriggerGeomTesterV9::beginRun(const edm::Run& /*run*/, const edm::EventSetup& es) +void HGCalTriggerGeomTesterV9Imp3::beginRun(const edm::Run& /*run*/, const edm::EventSetup& es) /*****************************************************************/ { es.get().get("", triggerGeometry_); no_trigger_ = !checkMappingConsistency(); - no_neighbors_ = !checkNeighborConsistency(); + fillTriggerGeometry(); } -bool HGCalTriggerGeomTesterV9::checkMappingConsistency() { +bool HGCalTriggerGeomTesterV9Imp3::checkMappingConsistency() { try { - // Set of (subdet,layer,wafer) with module mapping errors - std::set> module_errors; + // Set of (subdet,layer,waferU,waferV) with module mapping errors + std::set> module_errors; trigger_map_set modules_to_triggercells; trigger_map_set modules_to_cells; trigger_map_set triggercells_to_cells; - // EE for (const auto& id : triggerGeometry_->eeGeometry()->getValidDetIds()) { HGCSiliconDetId detid(id); @@ -378,17 +429,20 @@ bool HGCalTriggerGeomTesterV9::checkMappingConsistency() { uint32_t module = 0; try { module = triggerGeometry_->getModuleFromCell(id); - } catch (const cms::Exception& e) { - module_errors.emplace(std::make_tuple( - HGCalDetId(trigger_cell).subdetId(), HGCalDetId(trigger_cell).layer(), HGCalDetId(trigger_cell).wafer())); + triggerGeometry_->getLinksInModule(module); + } catch (const std::exception& e) { + module_errors.emplace(std::make_tuple(HGCalTriggerModuleDetId(module).triggerSubdetId(), + HGCalTriggerModuleDetId(module).layer(), + HGCalTriggerModuleDetId(module).moduleU(), + HGCalTriggerModuleDetId(module).moduleV())); continue; } itr_insert = modules_to_cells.emplace(module, std::unordered_set()); itr_insert.first->second.emplace(id); } + // HSi for (const auto& id : triggerGeometry_->hsiGeometry()->getValidDetIds()) { - HGCSiliconDetId detid(id); if (!triggerGeometry_->hsiTopology().valid(id)) continue; // fill trigger cells @@ -399,14 +453,18 @@ bool HGCalTriggerGeomTesterV9::checkMappingConsistency() { uint32_t module = 0; try { module = triggerGeometry_->getModuleFromCell(id); - } catch (const cms::Exception& e) { - module_errors.emplace(std::make_tuple( - HGCalDetId(trigger_cell).subdetId(), HGCalDetId(trigger_cell).layer(), HGCalDetId(trigger_cell).wafer())); + triggerGeometry_->getLinksInModule(module); + } catch (const std::exception& e) { + module_errors.emplace(std::make_tuple(HGCalTriggerModuleDetId(module).triggerSubdetId(), + HGCalTriggerModuleDetId(module).layer(), + HGCalTriggerModuleDetId(module).moduleU(), + HGCalTriggerModuleDetId(module).moduleV())); continue; } itr_insert = modules_to_cells.emplace(module, std::unordered_set()); itr_insert.first->second.emplace(id); } + // HSc for (const auto& id : triggerGeometry_->hscGeometry()->getValidDetIds()) { // fill trigger cells @@ -420,15 +478,36 @@ bool HGCalTriggerGeomTesterV9::checkMappingConsistency() { itr_insert.first->second.emplace(id); // fill modules uint32_t module = triggerGeometry_->getModuleFromCell(id); - itr_insert = modules_to_cells.emplace(module, std::unordered_set()); - itr_insert.first->second.emplace(id); + if (module != 0) { + itr_insert = modules_to_cells.emplace(module, std::unordered_set()); + itr_insert.first->second.emplace(id); + } + } + + // NOSE + if (triggerGeometry_->isWithNoseGeometry()) { + for (const auto& id : triggerGeometry_->noseGeometry()->getValidDetIds()) { + if (!triggerGeometry_->noseTopology().valid(id)) + continue; + // fill trigger cells + uint32_t trigger_cell = triggerGeometry_->getTriggerCellFromCell(id); + auto itr_insert = triggercells_to_cells.emplace(trigger_cell, std::unordered_set()); + itr_insert.first->second.emplace(id); + // fill modules + uint32_t module = triggerGeometry_->getModuleFromCell(id); + if (module != 0) { + itr_insert = modules_to_cells.emplace(module, std::unordered_set()); + itr_insert.first->second.emplace(id); + } + } } if (module_errors.size() > 0) { for (const auto& module : module_errors) { moduleErrorSubdet_ = std::get<0>(module); moduleErrorLayer_ = std::get<1>(module); - moduleErrorWafer_ = std::get<2>(module); + moduleErrorWaferU_ = std::get<2>(module); + moduleErrorWaferV_ = std::get<3>(module); treeModuleErrors_->Fill(); } throw cms::Exception("BadGeometry") << "HGCalTriggerGeometry: Found module mapping problems. Check the produced " @@ -438,32 +517,57 @@ bool HGCalTriggerGeomTesterV9::checkMappingConsistency() { edm::LogPrint("TriggerCellCheck") << "Checking cell -> trigger cell -> cell consistency"; // Loop over trigger cells for (const auto& triggercell_cells : triggercells_to_cells) { - HGCalDetId id(triggercell_cells.first); + DetId id(triggercell_cells.first); + // fill modules uint32_t module = triggerGeometry_->getModuleFromTriggerCell(id); - auto itr_insert = modules_to_triggercells.emplace(module, std::unordered_set()); - itr_insert.first->second.emplace(id); + if (module != 0) { + if (id.det() != DetId::HGCalHSc) { + auto itr_insert = modules_to_triggercells.emplace(module, std::unordered_set()); + itr_insert.first->second.emplace(id); + } + } + // Check consistency of cells included in trigger cell HGCalTriggerGeometryBase::geom_set cells_geom = triggerGeometry_->getCellsFromTriggerCell(id); const auto& cells = triggercell_cells.second; for (auto cell : cells) { if (cells_geom.find(cell) == cells_geom.end()) { - if (id.subdetId() == ForwardSubdetector::HGCHEB) { - edm::LogProblem("BadTriggerCell") << "Error: \n Cell " << cell << "(" << HGCScintillatorDetId(cell) - << ")\n has not been found in \n trigger cell " << id; + if (id.det() == DetId::HGCalHSc) { + edm::LogProblem("BadTriggerCell") + << "Error: \n Cell " << cell << "(" << HGCScintillatorDetId(cell) + << ")\n has not been found in \n trigger cell " << HGCScintillatorDetId(id); std::stringstream output; output << " Available cells are:\n"; for (auto cell_geom : cells_geom) output << " " << HGCScintillatorDetId(cell_geom) << "\n"; edm::LogProblem("BadTriggerCell") << output.str(); - } else { - edm::LogProblem("BadTriggerCell") << "Error: \n Cell " << cell << "(" << HGCSiliconDetId(cell) - << ")\n has not been found in \n trigger cell " << id; + } else if (HFNoseTriggerDetId(id).subdet() == HGCalTriggerSubdetector::HFNoseTrigger) { + edm::LogProblem("BadTriggerCell") + << "Error: \n Cell " << cell << "(" << HFNoseDetId(cell) << ")\n has not been found in \n trigger cell " + << HFNoseTriggerDetId(triggercell_cells.first); + std::stringstream output; + output << " Available cells are:\n"; + for (auto cell_geom : cells_geom) + output << " " << HFNoseDetId(cell_geom) << "\n"; + edm::LogProblem("BadTriggerCell") << output.str(); + } else if (HGCalTriggerDetId(id).subdet() == HGCalTriggerSubdetector::HGCalEETrigger || + HGCalTriggerDetId(id).subdet() == HGCalTriggerSubdetector::HGCalHSiTrigger) { + edm::LogProblem("BadTriggerCell") + << "Error: \n Cell " << cell << "(" << HGCSiliconDetId(cell) + << ")\n has not been found in \n trigger cell " << HGCalTriggerDetId(triggercell_cells.first); std::stringstream output; output << " Available cells are:\n"; for (auto cell_geom : cells_geom) output << " " << HGCSiliconDetId(cell_geom) << "\n"; edm::LogProblem("BadTriggerCell") << output.str(); + } else { + edm::LogProblem("BadTriggerCell") + << "Unknown detector type " << id.det() << " " << id.subdetId() << " " << id.rawId() << "\n"; + edm::LogProblem("BadTriggerCell") << " cell " << std::hex << cell << std::dec << " " + << "\n"; + edm::LogProblem("BadTriggerCell") + << "Cell ID " << HGCSiliconDetId(cell) << " or " << HFNoseDetId(cell) << "\n"; } throw cms::Exception("BadGeometry") << "HGCalTriggerGeometry: Found inconsistency in cell <-> trigger cell mapping"; @@ -473,40 +577,69 @@ bool HGCalTriggerGeomTesterV9::checkMappingConsistency() { edm::LogPrint("ModuleCheck") << "Checking trigger cell -> module -> trigger cell consistency"; // Loop over modules for (const auto& module_triggercells : modules_to_triggercells) { - HGCalDetId id(module_triggercells.first); + DetId id(module_triggercells.first); // Check consistency of trigger cells included in module HGCalTriggerGeometryBase::geom_set triggercells_geom = triggerGeometry_->getTriggerCellsFromModule(id); const auto& triggercells = module_triggercells.second; for (auto cell : triggercells) { if (triggercells_geom.find(cell) == triggercells_geom.end()) { - HGCalDetId cellid(cell); - edm::LogProblem("BadModule") << "Error: \n Trigger cell " << cell << "(" << cellid - << ")\n has not been found in \n module " << id; - std::stringstream output; - output << " Available trigger cells are:\n"; - for (auto cell_geom : triggercells_geom) { - output << " " << HGCalDetId(cell_geom) << "\n"; + if (id.det() == DetId::HGCalHSc) { + HGCScintillatorDetId cellid(cell); + edm::LogProblem("BadModule") << "Error: \n Trigger cell " << cell << "(" << cellid + << ")\n has not been found in \n module " << HGCalTriggerModuleDetId(id); + std::stringstream output; + output << " Available trigger cells are:\n"; + for (auto cell_geom : triggercells_geom) { + output << " " << HGCScintillatorDetId(cell_geom) << "\n"; + } + edm::LogProblem("BadModule") << output.str(); + throw cms::Exception("BadGeometry") + << "HGCalTriggerGeometry: Found inconsistency in trigger cell <-> module mapping"; + } else if (id.det() == DetId::Forward and id.subdetId() == ForwardSubdetector::HFNose) { + HFNoseTriggerDetId cellid(cell); + edm::LogProblem("BadModule") << "Error : \n Trigger cell " << cell << "(" << cellid + << ")\n has not been found in \n module " << HGCalTriggerModuleDetId(id); + std::stringstream output; + output << " Available trigger cells are:\n"; + for (auto cell_geom : triggercells_geom) { + output << " " << HFNoseTriggerDetId(cell_geom) << "\n"; + } + edm::LogProblem("BadModule") << output.str(); + throw cms::Exception("BadGeometry") + << "HGCalTriggerGeometry: Found inconsistency in trigger cell <-> module mapping"; + } else { + HGCalTriggerDetId cellid(cell); + edm::LogProblem("BadModule") << "Error : \n Trigger cell " << cell << "(" << cellid + << ")\n has not been found in \n module " << HGCalTriggerModuleDetId(id); + std::stringstream output; + output << " Available trigger cells are:\n"; + for (auto cell_geom : triggercells_geom) { + output << " " << HGCalTriggerDetId(cell_geom) << "\n"; + } + edm::LogProblem("BadModule") << output.str(); + throw cms::Exception("BadGeometry") + << "HGCalTriggerGeometry: Found inconsistency in trigger cell <-> module mapping"; } - edm::LogProblem("BadModule") << output.str(); - throw cms::Exception("BadGeometry") - << "HGCalTriggerGeometry: Found inconsistency in trigger cell <-> module mapping"; } } } edm::LogPrint("ModuleCheck") << "Checking cell -> module -> cell consistency"; for (const auto& module_cells : modules_to_cells) { - HGCalDetId id(module_cells.first); + HGCalTriggerModuleDetId id(module_cells.first); // Check consistency of cells included in module HGCalTriggerGeometryBase::geom_set cells_geom = triggerGeometry_->getCellsFromModule(id); const auto& cells = module_cells.second; for (auto cell : cells) { if (cells_geom.find(cell) == cells_geom.end()) { - if (id.subdetId() == ForwardSubdetector::HGCHEB) { + if (id.triggerSubdetId() == HGCalTriggerSubdetector::HGCalHScTrigger) { edm::LogProblem("BadModule") << "Error: \n Cell " << cell << "(" << HGCScintillatorDetId(cell) - << ")\n has not been found in \n module " << id; + << ")\n has not been found in \n module " << HGCalTriggerModuleDetId(id); + } else if (id.triggerSubdetId() == HGCalTriggerSubdetector::HFNoseTrigger) { + edm::LogProblem("BadModule") << "Error: \n Cell " << cell << "(" << HFNoseDetId(cell) + << ")\n has not been found in \n module " << HGCalTriggerModuleDetId(id); } else { edm::LogProblem("BadModule") << "Error: \n Cell " << cell << "(" << HGCSiliconDetId(cell) - << ")\n has not been found in \n module " << id; + << ")\n has not been found in \n module " << HGCalTriggerModuleDetId(id); } std::stringstream output; output << " Available cells are:\n"; @@ -514,90 +647,106 @@ bool HGCalTriggerGeomTesterV9::checkMappingConsistency() { output << cell_geom << " "; } edm::LogProblem("BadModule") << output.str(); - throw cms::Exception("BadGeometry") - << "HGCalTriggerGeometry: Found inconsistency in cell <-> module mapping"; + throw cms::Exception("BadGeometry") << "HGCalTriggerGeometry: Found inconsistency in cell <-> module mapping"; } } } - } catch (const cms::Exception& e) { - edm::LogWarning("HGCalTriggerGeometryTester") - << "Problem with the trigger geometry detected. Only the basic cells tree will be filled\n"; - edm::LogWarning("HGCalTriggerGeometryTester") << e.message() << "\n"; - return false; - } - return true; -} -bool HGCalTriggerGeomTesterV9::checkNeighborConsistency() { - try { - trigger_map_set triggercells_to_cells; + // Filling Stage 1 FPGA -> modules - // EE - for (const auto& id : triggerGeometry_->eeGeometry()->getValidDetIds()) { - if (!triggerGeometry_->eeTopology().valid(id)) - continue; - // fill trigger cells - // Skip trigger cells in module 0 - uint32_t trigger_cell = triggerGeometry_->getTriggerCellFromCell(id); - uint32_t module = triggerGeometry_->getModuleFromTriggerCell(trigger_cell); - if (HGCalDetId(module).wafer() == 0) - continue; - auto itr_insert = triggercells_to_cells.emplace(trigger_cell, std::unordered_set()); + edm::LogPrint("ModuleCheck") << "Checking module -> stage-1 -> module consistency"; + trigger_map_set stage1_to_modules; + for (const auto& module_tc : modules_to_triggercells) { + HGCalTriggerModuleDetId id(module_tc.first); + HGCalTriggerGeometryBase::geom_set lpgbts = triggerGeometry_->getLpgbtsFromModule(id); + if (lpgbts.size() == 0) + continue; //Module is not connected to an lpGBT and therefore not to a Stage 1 FPGA + uint32_t stage1 = 0; + for (const auto& lpgbt : lpgbts) { + uint32_t stage1_tmp = triggerGeometry_->getStage1FpgaFromLpgbt(lpgbt); + if (stage1 != 0 && stage1_tmp != stage1) { + throw cms::Exception("BadGeometry") << "HGCalTriggerGeometry: Module " << HGCalTriggerModuleDetId(id) + << " is split is split into more than one Stage-1 FPGA"; + } + stage1 = stage1_tmp; + } + auto itr_insert = stage1_to_modules.emplace(stage1, std::unordered_set()); itr_insert.first->second.emplace(id); } - // HSi - for (const auto& id : triggerGeometry_->hsiGeometry()->getValidDetIds()) { - if (!triggerGeometry_->hsiTopology().valid(id)) - continue; - // fill trigger cells - // Skip trigger cells in module 0 - uint32_t trigger_cell = triggerGeometry_->getTriggerCellFromCell(id); - uint32_t module = triggerGeometry_->getModuleFromTriggerCell(trigger_cell); - if (HGCalDetId(module).wafer() == 0) - continue; - auto itr_insert = triggercells_to_cells.emplace(trigger_cell, std::unordered_set()); - itr_insert.first->second.emplace(id); + // checking S1 -> module consistency + + for (const auto& stage1_modules : stage1_to_modules) { + HGCalTriggerBackendDetId stage1(stage1_modules.first); + HGCalTriggerGeometryBase::geom_set modules_geom; + // Check consistency of modules going to Stage-1 FPGA + HGCalTriggerGeometryBase::geom_set lpgbts = triggerGeometry_->getLpgbtsFromStage1Fpga(stage1); + for (const auto& lpgbt : lpgbts) { + HGCalTriggerGeometryBase::geom_set modules = triggerGeometry_->getModulesFromLpgbt(lpgbt); + modules_geom.insert(modules.begin(), modules.end()); + } + const auto& modules = stage1_modules.second; + for (auto module : modules) { + if (modules_geom.find(module) == modules_geom.end()) { + edm::LogProblem("BadStage1") << "Error: \n Module " << module << "(" << HGCalTriggerModuleDetId(module) + << ")\n has not been found in \n stage-1 " << HGCalTriggerBackendDetId(stage1); + std::stringstream output; + output << " Available modules are:\n"; + for (auto module_geom : modules_geom) { + output << module_geom << " "; + } + output << " Connected lpgbts are:\n"; + for (auto lpgbt : lpgbts) { + output << lpgbt << " "; + } + edm::LogProblem("BadStage1") << output.str(); + throw cms::Exception("BadGeometry") + << "HGCalTriggerGeometry: Found inconsistency in Stage1 <-> module mapping"; + } + } } - // HSc - for (const auto& id : triggerGeometry_->hscGeometry()->getValidDetIds()) { - if (!triggerGeometry_->hscTopology().valid(id)) - continue; - // fill trigger cells - // Skip trigger cells in module 0 - uint32_t trigger_cell = triggerGeometry_->getTriggerCellFromCell(id); - uint32_t module = triggerGeometry_->getModuleFromTriggerCell(trigger_cell); - if (HGCalDetId(module).wafer() == 0) - continue; - auto itr_insert = triggercells_to_cells.emplace(trigger_cell, std::unordered_set()); - itr_insert.first->second.emplace(id); + // Filling Stage 2 FPGA -> Stage 1 FPGA + + edm::LogPrint("ModuleCheck") << "Checking Stage 1 -> Stage 2 -> Stage 1 consistency"; + trigger_map_set stage2_to_stage1; + for (const auto& stage1 : stage1_to_modules) { + HGCalTriggerBackendDetId id(stage1.first); + HGCalTriggerGeometryBase::geom_set stage2FPGAs = triggerGeometry_->getStage2FpgasFromStage1Fpga(id); + for (const auto& stage2 : stage2FPGAs) { + auto itr_insert = stage2_to_stage1.emplace(stage2, std::unordered_set()); + itr_insert.first->second.emplace(id); + } } + // checking S1 -> S2 consistency - edm::LogPrint("NeighborCheck") << "Checking trigger cell neighbor consistency"; - // Loop over trigger cells - for (const auto& triggercell_cells : triggercells_to_cells) { - unsigned triggercell_id(triggercell_cells.first); - const auto neighbors = triggerGeometry_->getNeighborsFromTriggerCell(triggercell_id); - for (const auto neighbor : neighbors) { - const auto neighbors_of_neighbor = triggerGeometry_->getNeighborsFromTriggerCell(neighbor); - // check if the original cell is included in the neigbors of neighbor - if (neighbors_of_neighbor.find(triggercell_id) == neighbors_of_neighbor.end()) { - edm::LogProblem("BadNeighbor") << "Error: \n Trigger cell " << HGCalDetId(neighbor) - << "\n is a neighbor of \n" - << HGCalDetId(triggercell_id); - edm::LogProblem("BadNeighbor") << " But the opposite is not true"; + for (const auto& stage2_modules : stage2_to_stage1) { + HGCalTriggerBackendDetId stage2(stage2_modules.first); + + // Check consistency of Stage-1 FPGA going to Stage 2 FPGA + HGCalTriggerGeometryBase::geom_set stage1FPGAs = triggerGeometry_->getStage1FpgasFromStage2Fpga(stage2); + + const auto& stage1fpgas = stage2_modules.second; + + for (auto stage1fpga : stage1fpgas) { + if (stage1FPGAs.find(stage1fpga) == stage1FPGAs.end()) { + edm::LogProblem("BadStage2") << "Error: \n Stage-1 FPGA " << stage1fpga << "(" + << HGCalTriggerBackendDetId(stage1fpga) + << ")\n has not been found in \n stage-2 " << HGCalTriggerBackendDetId(stage2); std::stringstream output; - output << " List of neighbors of neighbor = \n"; - for (const auto neighbor_of_neighbor : neighbors_of_neighbor) { - output << " " << HGCalDetId(neighbor_of_neighbor) << "\n"; + output << " Available Stage-1 FPGAs are:\n"; + for (auto stage1FPGA : stage1FPGAs) { + output << stage1FPGA << " "; } - edm::LogProblem("BadNeighbor") << output.str(); + edm::LogProblem("BadStage2") << output.str(); + throw cms::Exception("BadGeometry") + << "HGCalTriggerGeometry: Found inconsistency in Stage2 <-> Stage1 mapping"; } } } + } catch (const cms::Exception& e) { edm::LogWarning("HGCalTriggerGeometryTester") - << "Problem with the trigger neighbors detected. No neighbor information will be filled\n"; + << "Problem with the trigger geometry detected. Only the basic cells tree will be filled\n"; edm::LogWarning("HGCalTriggerGeometryTester") << e.message() << "\n"; return false; } @@ -605,7 +754,7 @@ bool HGCalTriggerGeomTesterV9::checkNeighborConsistency() { } /*****************************************************************/ -void HGCalTriggerGeomTesterV9::fillTriggerGeometry() +void HGCalTriggerGeomTesterV9Imp3::fillTriggerGeometry() /*****************************************************************/ { trigger_map_set modules; @@ -617,6 +766,8 @@ void HGCalTriggerGeomTesterV9::fillTriggerGeometry() std::cout << "Filling EE geometry\n"; for (const auto& id : triggerGeometry_->eeGeometry()->getValidDetIds()) { HGCSiliconDetId detid(id); + if (!triggerGeometry_->eeTopology().valid(id)) + continue; cellId_ = detid.rawId(); cellSide_ = detid.zside(); cellSubdet_ = detid.subdet(); @@ -648,9 +799,9 @@ void HGCalTriggerGeomTesterV9::fillTriggerGeometry() if (!no_trigger_) { uint32_t trigger_cell = triggerGeometry_->getTriggerCellFromCell(id); // Skip trigger cells in module 0 - uint32_t module = triggerGeometry_->getModuleFromTriggerCell(trigger_cell); - if (HGCalDetId(module).wafer() == 0) - continue; + // uint32_t module = triggerGeometry_->getModuleFromTriggerCell(trigger_cell); + //if (HGCalDetId(module).wafer() == 0) + // continue; auto itr_insert = trigger_cells.emplace(trigger_cell, std::unordered_set()); itr_insert.first->second.emplace(id); } @@ -658,6 +809,8 @@ void HGCalTriggerGeomTesterV9::fillTriggerGeometry() std::cout << "Filling HSi geometry\n"; for (const auto& id : triggerGeometry_->hsiGeometry()->getValidDetIds()) { HGCSiliconDetId detid(id); + if (!triggerGeometry_->hsiTopology().valid(id)) + continue; cellId_ = detid.rawId(); cellSide_ = detid.zside(); cellSubdet_ = detid.subdet(); @@ -689,9 +842,9 @@ void HGCalTriggerGeomTesterV9::fillTriggerGeometry() if (!no_trigger_) { uint32_t trigger_cell = triggerGeometry_->getTriggerCellFromCell(id); // Skip trigger cells in module 0 - uint32_t module = triggerGeometry_->getModuleFromTriggerCell(trigger_cell); - if (HGCalDetId(module).wafer() == 0) - continue; + // uint32_t module = triggerGeometry_->getModuleFromTriggerCell(trigger_cell); + //if (HGCalDetId(module).wafer() == 0) + // continue; auto itr_insert = trigger_cells.emplace(trigger_cell, std::unordered_set()); itr_insert.first->second.emplace(id); } @@ -702,7 +855,7 @@ void HGCalTriggerGeomTesterV9::fillTriggerGeometry() cellBHId_ = cellid.rawId(); cellBHType_ = cellid.type(); cellBHSide_ = cellid.zside(); - cellBHSubdet_ = cellid.subdetId(); + cellBHSubdet_ = cellid.subdet(); cellBHLayer_ = cellid.layer(); cellBHIEta_ = cellid.ieta(); cellBHIPhi_ = cellid.iphi(); @@ -728,15 +881,55 @@ void HGCalTriggerGeomTesterV9::fillTriggerGeometry() // fill trigger cells if (!no_trigger_) { uint32_t trigger_cell = triggerGeometry_->getTriggerCellFromCell(id); - // Skip trigger cells in module 0 - uint32_t module = triggerGeometry_->getModuleFromTriggerCell(trigger_cell); - if (HGCalDetId(module).wafer() == 0) - continue; auto itr_insert = trigger_cells.emplace(trigger_cell, std::unordered_set()); itr_insert.first->second.emplace(id); } } + if (triggerGeometry_->isWithNoseGeometry()) { + // NOSE + std::cout << "Filling NOSE geometry\n"; + for (const auto& id : triggerGeometry_->noseGeometry()->getValidDetIds()) { + HFNoseDetId detid(id); + cellId_ = detid.rawId(); + cellSide_ = detid.zside(); + cellSubdet_ = detid.subdet(); + cellLayer_ = detid.layer(); + cellWaferU_ = detid.waferU(); + cellWaferV_ = detid.waferV(); + cellU_ = detid.cellU(); + cellV_ = detid.cellV(); + int type1 = detid.type(); + int type2 = triggerGeometry_->noseTopology().dddConstants().getTypeHex(cellLayer_, cellWaferU_, cellWaferV_); + if (type1 != type2) { + std::cout << "Found incompatible wafer types:\n " << detid << "\n"; + } + GlobalPoint center = triggerGeometry_->noseGeometry()->getPosition(id); + cellX_ = center.x(); + cellY_ = center.y(); + cellZ_ = center.z(); + std::vector corners = triggerGeometry_->noseGeometry()->getCorners(id); + cellCornersN_ = corners.size(); + setTreeCellCornerSize(cellCornersN_); + for (unsigned i = 0; i < corners.size(); i++) { + cellCornersX_.get()[i] = corners[i].x(); + cellCornersY_.get()[i] = corners[i].y(); + cellCornersZ_.get()[i] = corners[i].z(); + } + treeCellsNose_->Fill(); + // fill trigger cells + if (!no_trigger_) { + uint32_t trigger_cell = triggerGeometry_->getTriggerCellFromCell(id); + // Skip trigger cells in module 0 + // uint32_t module = triggerGeometry_->getModuleFromTriggerCell(trigger_cell); + //if (HGCalDetId(module).wafer() == 0) + // continue; + auto itr_insert = trigger_cells.emplace(trigger_cell, std::unordered_set()); + itr_insert.first->second.emplace(id); + } + } + } + // if problem detected in the trigger geometry, don't produce trigger trees if (no_trigger_) return; @@ -744,14 +937,36 @@ void HGCalTriggerGeomTesterV9::fillTriggerGeometry() // Loop over trigger cells edm::LogPrint("TreeFilling") << "Filling trigger cells tree"; for (const auto& triggercell_cells : trigger_cells) { - HGCalDetId id(triggercell_cells.first); - GlobalPoint position = triggerGeometry_->getTriggerCellPosition(id); + DetId id(triggercell_cells.first); + GlobalPoint position = triggerGeometry_->getTriggerCellPosition(triggercell_cells.first); triggerCellId_ = id.rawId(); - triggerCellSide_ = id.zside(); - triggerCellSubdet_ = id.subdetId(); - triggerCellLayer_ = id.layer(); - triggerCellWafer_ = id.wafer(); - triggerCell_ = id.cell(); + if (id.det() == DetId::HGCalHSc) { + HGCScintillatorDetId id_sc(triggercell_cells.first); + triggerCellSide_ = id_sc.zside(); + triggerCellSubdet_ = id_sc.subdet(); + triggerCellLayer_ = id_sc.layer(); + triggerCellIEta_ = id_sc.ietaAbs(); + triggerCellIPhi_ = id_sc.iphi(); + } else if (HFNoseTriggerDetId(triggercell_cells.first).det() == DetId::HGCalTrigger && + HFNoseTriggerDetId(triggercell_cells.first).subdet() == HGCalTriggerSubdetector::HFNoseTrigger) { + HFNoseTriggerDetId id_nose_trig(triggercell_cells.first); + triggerCellSide_ = id_nose_trig.zside(); + triggerCellSubdet_ = id_nose_trig.subdet(); + triggerCellLayer_ = id_nose_trig.layer(); + triggerCellWaferU_ = id_nose_trig.waferU(); + triggerCellWaferV_ = id_nose_trig.waferV(); + triggerCellU_ = id_nose_trig.triggerCellU(); + triggerCellV_ = id_nose_trig.triggerCellV(); + } else { + HGCalTriggerDetId id_si_trig(triggercell_cells.first); + triggerCellSide_ = id_si_trig.zside(); + triggerCellSubdet_ = id_si_trig.subdet(); + triggerCellLayer_ = id_si_trig.layer(); + triggerCellWaferU_ = id_si_trig.waferU(); + triggerCellWaferV_ = id_si_trig.waferV(); + triggerCellU_ = id_si_trig.triggerCellU(); + triggerCellV_ = id_si_trig.triggerCellV(); + } triggerCellX_ = position.x(); triggerCellY_ = position.y(); triggerCellZ_ = position.z(); @@ -760,7 +975,7 @@ void HGCalTriggerGeomTesterV9::fillTriggerGeometry() setTreeTriggerCellSize(triggerCellCell_N_); size_t ic = 0; for (const auto& c : triggercell_cells.second) { - if (id.subdetId() == ForwardSubdetector::HGCHEB) { + if (id.det() == DetId::HGCalHSc) { HGCScintillatorDetId cId(c); GlobalPoint cell_position = triggerGeometry_->hscGeometry()->getPosition(cId); triggerCellCell_id_.get()[ic] = c; @@ -776,13 +991,30 @@ void HGCalTriggerGeomTesterV9::fillTriggerGeometry() triggerCellCell_x_.get()[ic] = cell_position.x(); triggerCellCell_y_.get()[ic] = cell_position.y(); triggerCellCell_z_.get()[ic] = cell_position.z(); + } else if (HFNoseTriggerDetId(triggercell_cells.first).det() == DetId::HGCalTrigger && + HFNoseTriggerDetId(triggercell_cells.first).subdet() == HGCalTriggerSubdetector::HFNoseTrigger) { + HFNoseDetId cId(c); + GlobalPoint cell_position = triggerGeometry_->noseGeometry()->getPosition(cId); + triggerCellCell_id_.get()[ic] = c; + triggerCellCell_zside_.get()[ic] = cId.zside(); + triggerCellCell_subdet_.get()[ic] = cId.subdet(); + triggerCellCell_layer_.get()[ic] = cId.layer(); + triggerCellCell_waferU_.get()[ic] = cId.waferU(); + triggerCellCell_waferV_.get()[ic] = cId.waferV(); + triggerCellCell_cellU_.get()[ic] = cId.cellU(); + triggerCellCell_cellV_.get()[ic] = cId.cellV(); + triggerCellCell_ieta_.get()[ic] = 0; + triggerCellCell_iphi_.get()[ic] = 0; + triggerCellCell_x_.get()[ic] = cell_position.x(); + triggerCellCell_y_.get()[ic] = cell_position.y(); + triggerCellCell_z_.get()[ic] = cell_position.z(); } else { HGCSiliconDetId cId(c); GlobalPoint cell_position = (cId.det() == DetId::HGCalEE ? triggerGeometry_->eeGeometry()->getPosition(cId) : triggerGeometry_->hsiGeometry()->getPosition(cId)); triggerCellCell_id_.get()[ic] = c; triggerCellCell_zside_.get()[ic] = cId.zside(); - triggerCellCell_subdet_.get()[ic] = cId.subdetId(); + triggerCellCell_subdet_.get()[ic] = cId.subdet(); triggerCellCell_layer_.get()[ic] = cId.layer(); triggerCellCell_waferU_.get()[ic] = cId.waferU(); triggerCellCell_waferV_.get()[ic] = cId.waferV(); @@ -796,46 +1028,37 @@ void HGCalTriggerGeomTesterV9::fillTriggerGeometry() } ic++; } - // Get neighbors - if (!no_neighbors_) { - const auto neighbors = triggerGeometry_->getNeighborsFromTriggerCell(id.rawId()); - triggerCellNeighbor_N_ = neighbors.size(); - setTreeTriggerCellNeighborSize(triggerCellNeighbor_N_); - size_t in = 0; - for (const auto neighbor : neighbors) { - HGCalDetId nId(neighbor); - // std::cout<<"Neighbor ID "<getTriggerCellPosition(neighbor); - triggerCellNeighbor_id_.get()[in] = neighbor; - triggerCellNeighbor_zside_.get()[in] = nId.zside(); - triggerCellNeighbor_subdet_.get()[in] = nId.subdetId(); - triggerCellNeighbor_layer_.get()[in] = nId.layer(); - triggerCellNeighbor_wafer_.get()[in] = nId.wafer(); - triggerCellNeighbor_cell_.get()[in] = nId.cell(); - triggerCellNeighbor_distance_.get()[in] = (neighbor_position - position).mag(); - in++; - } - } treeTriggerCells_->Fill(); + // fill modules uint32_t module = triggerGeometry_->getModuleFromTriggerCell(id); auto itr_insert = modules.emplace(module, std::unordered_set()); itr_insert.first->second.emplace(id); } + // Loop over modules edm::LogPrint("TreeFilling") << "Filling modules tree"; + for (const auto& module_triggercells : modules) { - HGCalDetId id(module_triggercells.first); + HGCalTriggerModuleDetId id(module_triggercells.first); GlobalPoint position = triggerGeometry_->getModulePosition(id); moduleId_ = id.rawId(); - moduleSide_ = id.zside(); - moduleSubdet_ = id.subdetId(); - moduleLayer_ = id.layer(); - module_ = id.wafer(); moduleX_ = position.x(); moduleY_ = position.y(); moduleZ_ = position.z(); + + moduleSide_ = id.zside(); + moduleSubdet_ = id.triggerSubdetId(); + moduleLayer_ = id.layer(); + module_ = 0; + if (moduleSubdet_ == HGCalTriggerSubdetector::HGCalHScTrigger) { + moduleIEta_ = id.eta(); + moduleIPhi_ = id.phi(); + } else { + moduleIEta_ = 0; + moduleIPhi_ = 0; + } moduleTC_N_ = module_triggercells.second.size(); if (triggerGeometry_->disconnectedModule(id)) { moduleLinks_ = 0; @@ -846,14 +1069,42 @@ void HGCalTriggerGeomTesterV9::fillTriggerGeometry() setTreeModuleSize(moduleTC_N_); size_t itc = 0; for (const auto& tc : module_triggercells.second) { - HGCalDetId tcId(tc); - GlobalPoint position = triggerGeometry_->getTriggerCellPosition(tcId); moduleTC_id_.get()[itc] = tc; - moduleTC_zside_.get()[itc] = tcId.zside(); - moduleTC_subdet_.get()[itc] = tcId.subdetId(); - moduleTC_layer_.get()[itc] = tcId.layer(); - moduleTC_wafer_.get()[itc] = tcId.wafer(); - moduleTC_cell_.get()[itc] = tcId.cell(); + if (moduleSubdet_ == HGCalTriggerSubdetector::HGCalHScTrigger) { + HGCScintillatorDetId tcId(tc); + moduleTC_zside_.get()[itc] = tcId.zside(); + moduleTC_subdet_.get()[itc] = tcId.subdet(); + moduleTC_layer_.get()[itc] = tcId.layer(); + moduleTC_waferU_.get()[itc] = 0; + moduleTC_waferV_.get()[itc] = 0; + moduleTC_cellU_.get()[itc] = 0; + moduleTC_cellV_.get()[itc] = 0; + moduleTC_ieta_.get()[itc] = tcId.ietaAbs(); + moduleTC_iphi_.get()[itc] = tcId.iphi(); + } else if (moduleSubdet_ == HGCalTriggerSubdetector::HFNoseTrigger) { + HFNoseTriggerDetId tcId(tc); + moduleTC_zside_.get()[itc] = tcId.zside(); + moduleTC_subdet_.get()[itc] = tcId.subdet(); + moduleTC_layer_.get()[itc] = tcId.layer(); + moduleTC_waferU_.get()[itc] = tcId.waferU(); + moduleTC_waferV_.get()[itc] = tcId.waferV(); + moduleTC_cellU_.get()[itc] = tcId.triggerCellU(); + moduleTC_cellV_.get()[itc] = tcId.triggerCellV(); + moduleTC_ieta_.get()[itc] = 0; + moduleTC_iphi_.get()[itc] = 0; + } else { + HGCalTriggerDetId tcId(tc); + moduleTC_zside_.get()[itc] = tcId.zside(); + moduleTC_subdet_.get()[itc] = tcId.subdet(); + moduleTC_layer_.get()[itc] = tcId.layer(); + moduleTC_waferU_.get()[itc] = tcId.waferU(); + moduleTC_waferV_.get()[itc] = tcId.waferV(); + moduleTC_cellU_.get()[itc] = tcId.triggerCellU(); + moduleTC_cellV_.get()[itc] = tcId.triggerCellV(); + moduleTC_ieta_.get()[itc] = 0; + moduleTC_iphi_.get()[itc] = 0; + } + GlobalPoint position = triggerGeometry_->getTriggerCellPosition(tc); moduleTC_x_.get()[itc] = position.x(); moduleTC_y_.get()[itc] = position.y(); moduleTC_z_.get()[itc] = position.z(); @@ -865,7 +1116,7 @@ void HGCalTriggerGeomTesterV9::fillTriggerGeometry() setTreeModuleCellSize(moduleCell_N_); size_t ic = 0; for (const auto& c : cells_in_module) { - if (id.subdetId() == ForwardSubdetector::HGCHEB) { + if (moduleSubdet_ == HGCalTriggerSubdetector::HGCalHScTrigger) { HGCScintillatorDetId cId(c); GlobalPoint cell_position = triggerGeometry_->hscGeometry()->getPosition(cId); triggerCellCell_id_.get()[ic] = c; @@ -881,6 +1132,20 @@ void HGCalTriggerGeomTesterV9::fillTriggerGeometry() triggerCellCell_x_.get()[ic] = cell_position.x(); triggerCellCell_y_.get()[ic] = cell_position.y(); triggerCellCell_z_.get()[ic] = cell_position.z(); + } else if (moduleSubdet_ == HGCalTriggerSubdetector::HFNoseTrigger) { + HFNoseDetId cId(c); + const GlobalPoint position = triggerGeometry_->noseGeometry()->getPosition(c); + moduleCell_id_.get()[ic] = c; + moduleCell_zside_.get()[ic] = cId.zside(); + moduleCell_subdet_.get()[ic] = cId.subdetId(); + moduleCell_layer_.get()[ic] = cId.layer(); + moduleCell_waferU_.get()[ic] = cId.waferU(); + moduleCell_waferV_.get()[ic] = cId.waferV(); + moduleCell_cellU_.get()[ic] = cId.cellU(); + moduleCell_cellV_.get()[ic] = cId.cellV(); + moduleCell_x_.get()[ic] = position.x(); + moduleCell_y_.get()[ic] = position.y(); + moduleCell_z_.get()[ic] = position.z(); } else { HGCSiliconDetId cId(c); const GlobalPoint position = (cId.det() == DetId::HGCalEE ? triggerGeometry_->eeGeometry()->getPosition(cId) @@ -899,26 +1164,29 @@ void HGCalTriggerGeomTesterV9::fillTriggerGeometry() ic++; } } - // treeModules_->Fill(); } } /*****************************************************************/ -void HGCalTriggerGeomTesterV9::analyze(const edm::Event& e, const edm::EventSetup& es) +void HGCalTriggerGeomTesterV9Imp3::analyze(const edm::Event& e, const edm::EventSetup& es) /*****************************************************************/ {} /*****************************************************************/ -void HGCalTriggerGeomTesterV9::setTreeModuleSize(const size_t n) +void HGCalTriggerGeomTesterV9Imp3::setTreeModuleSize(const size_t n) /*****************************************************************/ { moduleTC_id_.reset(new int[n], array_deleter()); moduleTC_zside_.reset(new int[n], array_deleter()); moduleTC_subdet_.reset(new int[n], array_deleter()); moduleTC_layer_.reset(new int[n], array_deleter()); - moduleTC_wafer_.reset(new int[n], array_deleter()); - moduleTC_cell_.reset(new int[n], array_deleter()); + moduleTC_waferU_.reset(new int[n], array_deleter()); + moduleTC_waferV_.reset(new int[n], array_deleter()); + moduleTC_cellU_.reset(new int[n], array_deleter()); + moduleTC_cellV_.reset(new int[n], array_deleter()); + moduleTC_ieta_.reset(new int[n], array_deleter()); + moduleTC_iphi_.reset(new int[n], array_deleter()); moduleTC_x_.reset(new float[n], array_deleter()); moduleTC_y_.reset(new float[n], array_deleter()); moduleTC_z_.reset(new float[n], array_deleter()); @@ -927,15 +1195,19 @@ void HGCalTriggerGeomTesterV9::setTreeModuleSize(const size_t n) treeModules_->GetBranch("tc_zside")->SetAddress(moduleTC_zside_.get()); treeModules_->GetBranch("tc_subdet")->SetAddress(moduleTC_subdet_.get()); treeModules_->GetBranch("tc_layer")->SetAddress(moduleTC_layer_.get()); - treeModules_->GetBranch("tc_wafer")->SetAddress(moduleTC_wafer_.get()); - treeModules_->GetBranch("tc_cell")->SetAddress(moduleTC_cell_.get()); + treeModules_->GetBranch("tc_waferu")->SetAddress(moduleTC_waferU_.get()); + treeModules_->GetBranch("tc_waferv")->SetAddress(moduleTC_waferV_.get()); + treeModules_->GetBranch("tc_cellu")->SetAddress(moduleTC_cellU_.get()); + treeModules_->GetBranch("tc_cellv")->SetAddress(moduleTC_cellV_.get()); + treeModules_->GetBranch("tc_ieta")->SetAddress(moduleTC_ieta_.get()); + treeModules_->GetBranch("tc_iphi")->SetAddress(moduleTC_iphi_.get()); treeModules_->GetBranch("tc_x")->SetAddress(moduleTC_x_.get()); treeModules_->GetBranch("tc_y")->SetAddress(moduleTC_y_.get()); treeModules_->GetBranch("tc_z")->SetAddress(moduleTC_z_.get()); } /*****************************************************************/ -void HGCalTriggerGeomTesterV9::setTreeModuleCellSize(const size_t n) +void HGCalTriggerGeomTesterV9Imp3::setTreeModuleCellSize(const size_t n) /*****************************************************************/ { moduleCell_id_.reset(new int[n], array_deleter()); @@ -964,7 +1236,7 @@ void HGCalTriggerGeomTesterV9::setTreeModuleCellSize(const size_t n) } /*****************************************************************/ -void HGCalTriggerGeomTesterV9::setTreeTriggerCellSize(const size_t n) +void HGCalTriggerGeomTesterV9Imp3::setTreeTriggerCellSize(const size_t n) /*****************************************************************/ { triggerCellCell_id_.reset(new int[n], array_deleter()); @@ -997,7 +1269,7 @@ void HGCalTriggerGeomTesterV9::setTreeTriggerCellSize(const size_t n) } /*****************************************************************/ -void HGCalTriggerGeomTesterV9::setTreeCellCornerSize(const size_t n) +void HGCalTriggerGeomTesterV9Imp3::setTreeCellCornerSize(const size_t n) /*****************************************************************/ { cellCornersX_.reset(new float[n], array_deleter()); @@ -1010,24 +1282,28 @@ void HGCalTriggerGeomTesterV9::setTreeCellCornerSize(const size_t n) } /*****************************************************************/ -void HGCalTriggerGeomTesterV9::setTreeTriggerCellNeighborSize(const size_t n) +void HGCalTriggerGeomTesterV9Imp3::setTreeTriggerCellNeighborSize(const size_t n) /*****************************************************************/ { triggerCellNeighbor_id_.reset(new int[n], array_deleter()); triggerCellNeighbor_zside_.reset(new int[n], array_deleter()); triggerCellNeighbor_subdet_.reset(new int[n], array_deleter()); triggerCellNeighbor_layer_.reset(new int[n], array_deleter()); - triggerCellNeighbor_wafer_.reset(new int[n], array_deleter()); - triggerCellNeighbor_cell_.reset(new int[n], array_deleter()); + triggerCellNeighbor_waferU_.reset(new int[n], array_deleter()); + triggerCellNeighbor_waferV_.reset(new int[n], array_deleter()); + triggerCellNeighbor_cellU_.reset(new int[n], array_deleter()); + triggerCellNeighbor_cellV_.reset(new int[n], array_deleter()); triggerCellNeighbor_distance_.reset(new float[n], array_deleter()); treeTriggerCells_->GetBranch("neighbor_id")->SetAddress(triggerCellNeighbor_id_.get()); treeTriggerCells_->GetBranch("neighbor_zside")->SetAddress(triggerCellNeighbor_zside_.get()); treeTriggerCells_->GetBranch("neighbor_subdet")->SetAddress(triggerCellNeighbor_subdet_.get()); treeTriggerCells_->GetBranch("neighbor_layer")->SetAddress(triggerCellNeighbor_layer_.get()); - treeTriggerCells_->GetBranch("neighbor_wafer")->SetAddress(triggerCellNeighbor_wafer_.get()); - treeTriggerCells_->GetBranch("neighbor_cell")->SetAddress(triggerCellNeighbor_cell_.get()); + treeTriggerCells_->GetBranch("neighbor_waferu")->SetAddress(triggerCellNeighbor_waferU_.get()); + treeTriggerCells_->GetBranch("neighbor_waferv")->SetAddress(triggerCellNeighbor_waferV_.get()); + treeTriggerCells_->GetBranch("neighbor_cellu")->SetAddress(triggerCellNeighbor_cellU_.get()); + treeTriggerCells_->GetBranch("neighbor_cellv")->SetAddress(triggerCellNeighbor_cellV_.get()); treeTriggerCells_->GetBranch("neighbor_distance")->SetAddress(triggerCellNeighbor_distance_.get()); } -//define this as a plug-in -DEFINE_FWK_MODULE(HGCalTriggerGeomTesterV9); +// define this as a plug-in +DEFINE_FWK_MODULE(HGCalTriggerGeomTesterV9Imp3); diff --git a/L1Trigger/L1THGCal/test/testHGCalL1TGeometryV11Imp3_cfg.py b/L1Trigger/L1THGCal/test/testHGCalL1TGeometryV11Imp3_cfg.py new file mode 100644 index 0000000000000..6acb990f89c4d --- /dev/null +++ b/L1Trigger/L1THGCal/test/testHGCalL1TGeometryV11Imp3_cfg.py @@ -0,0 +1,122 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Phase2C9_cff import Phase2C9 +process = cms.Process('SIM',Phase2C9) + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff') +process.load('Configuration.Geometry.GeometryExtended2026D49_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.Generator_cff') +process.load('IOMC.EventVertexGenerators.VtxSmearedHLLHC14TeV_cfi') +process.load('GeneratorInterface.Core.genFilterSummary_cff') +process.load('Configuration.StandardSequences.SimIdeal_cff') +process.load('Configuration.StandardSequences.Digi_cff') +process.load('Configuration.StandardSequences.SimL1Emulator_cff') +process.load('Configuration.StandardSequences.DigiToRaw_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1) +) + +# Input source +process.source = cms.Source("EmptySource") + +process.options = cms.untracked.PSet( + +) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + version = cms.untracked.string('$Revision: 1.20 $'), + annotation = cms.untracked.string('SingleElectronPt10_cfi nevts:10'), + name = cms.untracked.string('Applications') +) + +# Output definition + +process.FEVTDEBUGoutput = cms.OutputModule("PoolOutputModule", + splitLevel = cms.untracked.int32(0), + eventAutoFlushCompressedSize = cms.untracked.int32(5242880), + outputCommands = process.FEVTDEBUGHLTEventContent.outputCommands, + fileName = cms.untracked.string('file:junk.root'), + dataset = cms.untracked.PSet( + filterName = cms.untracked.string(''), + dataTier = cms.untracked.string('GEN-SIM-DIGI-RAW') + ), + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('generation_step') + ) +) + +# Additional output definition +process.TFileService = cms.Service( + "TFileService", + fileName = cms.string("test_triggergeom.root") + ) + + + +# Other statements +process.genstepfilter.triggerConditions=cms.vstring("generation_step") +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T15', '') + +process.generator = cms.EDProducer("FlatRandomPtGunProducer", + PGunParameters = cms.PSet( + MaxPt = cms.double(10.01), + MinPt = cms.double(9.99), + PartID = cms.vint32(13), + MaxEta = cms.double(2.5), + MaxPhi = cms.double(3.14159265359), + MinEta = cms.double(-2.5), + MinPhi = cms.double(-3.14159265359) + ), + Verbosity = cms.untracked.int32(0), + psethack = cms.string('single electron pt 10'), + AddAntiParticle = cms.bool(True), + firstRun = cms.untracked.uint32(1) +) + +process.mix.digitizers = cms.PSet(process.theDigitizersValid) + + +# Path and EndPath definitions +process.generation_step = cms.Path(process.pgen) +process.simulation_step = cms.Path(process.psim) +process.genfiltersummary_step = cms.EndPath(process.genFilterSummary) +process.digitisation_step = cms.Path(process.pdigi_valid) +process.L1simulation_step = cms.Path(process.SimL1Emulator) +process.digi2raw_step = cms.Path(process.DigiToRaw) +process.endjob_step = cms.EndPath(process.endOfProcess) +process.FEVTDEBUGoutput_step = cms.EndPath(process.FEVTDEBUGoutput) + +process.load('L1Trigger.L1THGCal.hgcalTriggerPrimitives_cff') +# Eventually modify default geometry parameters +from L1Trigger.L1THGCal.customTriggerGeometry import custom_geometry_decentralized_V11 +process = custom_geometry_decentralized_V11(process, implementation=2) + +process.hgcaltriggergeomtester = cms.EDAnalyzer( + "HGCalTriggerGeomTesterV9Imp3" + ) +process.test_step = cms.Path(process.hgcaltriggergeomtester) + +# Schedule definition +process.schedule = cms.Schedule(process.test_step,process.endjob_step) +# process.schedule = cms.Schedule(process.generation_step,process.genfiltersummary_step,process.simulation_step,process.digitisation_step,process.L1simulation_step,process.digi2raw_step,process.test_step,process.endjob_step,process.FEVTDEBUGoutput_step) +#process.schedule = cms.Schedule(process.generation_step,process.genfiltersummary_step,process.simulation_step,process.digitisation_step,process.L1simulation_step,process.digi2raw_step,process.endjob_step,process.FEVTDEBUGoutput_step) +# filter all path with the production filter sequence +for path in process.paths: + getattr(process,path)._seq = process.generator * getattr(process,path)._seq + +# Add early deletion of temporary data products to reduce peak memory need +from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete +process = customiseEarlyDelete(process) diff --git a/L1Trigger/L1THGCalUtilities/plugins/CaloTruthCellsProducer.cc b/L1Trigger/L1THGCalUtilities/plugins/CaloTruthCellsProducer.cc index 1a7d0ae7abd7e..13fad4113aefa 100644 --- a/L1Trigger/L1THGCalUtilities/plugins/CaloTruthCellsProducer.cc +++ b/L1Trigger/L1THGCalUtilities/plugins/CaloTruthCellsProducer.cc @@ -246,15 +246,9 @@ std::unordered_map CaloTruthCellsProducer::makeHitMap( [this, &geometry](DetId const& simId) -> DetId { return this->triggerTools_.simToReco(simId, geometry.fhTopology()); }}, - {&simHitsTokenHEback_, nullptr}}; - if (geometry.isV9Geometry()) - specs[2].second = [this, &geometry](DetId const& simId) -> DetId { - return this->triggerTools_.simToReco(simId, geometry.hscTopology()); - }; - else - specs[2].second = [this, &geometry](DetId const& simId) -> DetId { - return this->triggerTools_.simToReco(simId, geometry.bhTopology()); - }; + {&simHitsTokenHEback_, [this, &geometry](DetId const& simId) -> DetId { + return this->triggerTools_.simToReco(simId, geometry.hscTopology()); + }}}; for (auto const& tt : specs) { edm::Handle> handle; diff --git a/L1Trigger/L1THGCalUtilities/plugins/ntuples/HGCalTriggerNtupleHGCDigis.cc b/L1Trigger/L1THGCalUtilities/plugins/ntuples/HGCalTriggerNtupleHGCDigis.cc index 491d1279f54b8..95c4b383a437a 100644 --- a/L1Trigger/L1THGCalUtilities/plugins/ntuples/HGCalTriggerNtupleHGCDigis.cc +++ b/L1Trigger/L1THGCalUtilities/plugins/ntuples/HGCalTriggerNtupleHGCDigis.cc @@ -1,7 +1,4 @@ #include "DataFormats/HGCDigi/interface/HGCDigiCollections.h" -#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" #include "L1Trigger/L1THGCalUtilities/interface/HGCalTriggerNtupleBase.h" #include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h" #include "FWCore/Framework/interface/ESHandle.h" @@ -48,10 +45,6 @@ class HGCalTriggerNtupleHGCDigis : public HGCalTriggerNtupleBase { std::vector> hgcdigi_data_; std::vector> hgcdigi_isadc_; std::vector hgcdigi_simenergy_; - // V8 detid scheme - std::vector hgcdigi_wafer_; - std::vector hgcdigi_cell_; - // V9 detid scheme std::vector hgcdigi_waferu_; std::vector hgcdigi_waferv_; std::vector hgcdigi_cellu_; @@ -130,14 +123,10 @@ void HGCalTriggerNtupleHGCDigis::initialize(TTree& tree, tree.Branch(withBX("hgcdigi_data", bxi), &hgcdigi_data_[i]); tree.Branch(withBX("hgcdigi_isadc", bxi), &hgcdigi_isadc_[i]); } - // V9 detid scheme tree.Branch("hgcdigi_waferu", &hgcdigi_waferu_); tree.Branch("hgcdigi_waferv", &hgcdigi_waferv_); tree.Branch("hgcdigi_cellu", &hgcdigi_cellu_); tree.Branch("hgcdigi_cellv", &hgcdigi_cellv_); - // V8 detid scheme - tree.Branch("hgcdigi_wafer", &hgcdigi_wafer_); - tree.Branch("hgcdigi_cell", &hgcdigi_cell_); if (is_Simhit_comp_) tree.Branch("hgcdigi_simenergy", &hgcdigi_simenergy_); @@ -196,15 +185,10 @@ void HGCalTriggerNtupleHGCDigis::fill(const edm::Event& e, const edm::EventSetup hgcdigi_data_[i].reserve(hgcdigi_n_); hgcdigi_isadc_[i].reserve(hgcdigi_n_); } - if (triggerGeometry_->isV9Geometry()) { - hgcdigi_waferu_.reserve(hgcdigi_n_); - hgcdigi_waferv_.reserve(hgcdigi_n_); - hgcdigi_cellu_.reserve(hgcdigi_n_); - hgcdigi_cellv_.reserve(hgcdigi_n_); - } else { - hgcdigi_wafer_.reserve(hgcdigi_n_); - hgcdigi_cell_.reserve(hgcdigi_n_); - } + hgcdigi_waferu_.reserve(hgcdigi_n_); + hgcdigi_waferv_.reserve(hgcdigi_n_); + hgcdigi_cellu_.reserve(hgcdigi_n_); + hgcdigi_cellv_.reserve(hgcdigi_n_); if (is_Simhit_comp_) hgcdigi_simenergy_.reserve(hgcdigi_n_); @@ -228,7 +212,7 @@ void HGCalTriggerNtupleHGCDigis::fill(const edm::Event& e, const edm::EventSetup for (const auto& digi : ee_digis) { const DetId id(digi.id()); hgcdigi_id_.emplace_back(id.rawId()); - hgcdigi_subdet_.emplace_back(id.subdetId()); + hgcdigi_subdet_.emplace_back(id.det()); hgcdigi_side_.emplace_back(triggerTools_.zside(id)); hgcdigi_layer_.emplace_back(triggerTools_.layerWithOffset(id)); GlobalPoint cellpos = triggerGeometry_->eeGeometry()->getPosition(id.rawId()); @@ -239,19 +223,12 @@ void HGCalTriggerNtupleHGCDigis::fill(const edm::Event& e, const edm::EventSetup hgcdigi_data_[i].emplace_back(digi[digiBXselect_[i]].data()); hgcdigi_isadc_[i].emplace_back(!digi[digiBXselect_[i]].mode()); } - if (triggerGeometry_->isV9Geometry()) { - const HGCSiliconDetId idv9(digi.id()); - hgcdigi_waferu_.emplace_back(idv9.waferU()); - hgcdigi_waferv_.emplace_back(idv9.waferV()); - hgcdigi_wafertype_.emplace_back(idv9.type()); - hgcdigi_cellu_.emplace_back(idv9.cellU()); - hgcdigi_cellv_.emplace_back(idv9.cellV()); - } else { - const HGCalDetId idv8(digi.id()); - hgcdigi_wafer_.emplace_back(idv8.wafer()); - hgcdigi_wafertype_.emplace_back(idv8.waferType()); - hgcdigi_cell_.emplace_back(idv8.cell()); - } + const HGCSiliconDetId idsi(digi.id()); + hgcdigi_waferu_.emplace_back(idsi.waferU()); + hgcdigi_waferv_.emplace_back(idsi.waferV()); + hgcdigi_wafertype_.emplace_back(idsi.type()); + hgcdigi_cellu_.emplace_back(idsi.cellU()); + hgcdigi_cellv_.emplace_back(idsi.cellV()); if (is_Simhit_comp_) { double hit_energy = 0; auto itr = simhits_ee.find(id); @@ -264,7 +241,7 @@ void HGCalTriggerNtupleHGCDigis::fill(const edm::Event& e, const edm::EventSetup for (const auto& digi : fh_digis) { const DetId id(digi.id()); hgcdigi_id_.emplace_back(id.rawId()); - hgcdigi_subdet_.emplace_back(id.subdetId()); + hgcdigi_subdet_.emplace_back(id.det()); hgcdigi_side_.emplace_back(triggerTools_.zside(id)); hgcdigi_layer_.emplace_back(triggerTools_.layerWithOffset(id)); GlobalPoint cellpos = triggerGeometry_->hsiGeometry()->getPosition(id.rawId()); @@ -275,19 +252,12 @@ void HGCalTriggerNtupleHGCDigis::fill(const edm::Event& e, const edm::EventSetup hgcdigi_data_[i].emplace_back(digi[digiBXselect_[i]].data()); hgcdigi_isadc_[i].emplace_back(!digi[digiBXselect_[i]].mode()); } - if (triggerGeometry_->isV9Geometry()) { - const HGCSiliconDetId idv9(digi.id()); - hgcdigi_waferu_.emplace_back(idv9.waferU()); - hgcdigi_waferv_.emplace_back(idv9.waferV()); - hgcdigi_wafertype_.emplace_back(idv9.type()); - hgcdigi_cellu_.emplace_back(idv9.cellU()); - hgcdigi_cellv_.emplace_back(idv9.cellV()); - } else { - const HGCalDetId idv8(digi.id()); - hgcdigi_wafer_.emplace_back(idv8.wafer()); - hgcdigi_wafertype_.emplace_back(idv8.waferType()); - hgcdigi_cell_.emplace_back(idv8.cell()); - } + const HGCSiliconDetId idsi(digi.id()); + hgcdigi_waferu_.emplace_back(idsi.waferU()); + hgcdigi_waferv_.emplace_back(idsi.waferV()); + hgcdigi_wafertype_.emplace_back(idsi.type()); + hgcdigi_cellu_.emplace_back(idsi.cellU()); + hgcdigi_cellv_.emplace_back(idsi.cellV()); if (is_Simhit_comp_) { double hit_energy = 0; auto itr = simhits_fh.find(id); @@ -300,11 +270,10 @@ void HGCalTriggerNtupleHGCDigis::fill(const edm::Event& e, const edm::EventSetup for (const auto& digi : bh_digis) { const DetId id(digi.id()); bhdigi_id_.emplace_back(id.rawId()); - bhdigi_subdet_.emplace_back(id.subdetId()); + bhdigi_subdet_.emplace_back(id.det()); bhdigi_side_.emplace_back(triggerTools_.zside(id)); bhdigi_layer_.emplace_back(triggerTools_.layerWithOffset(id)); - GlobalPoint cellpos = (triggerGeometry_->isV9Geometry() ? triggerGeometry_->hscGeometry()->getPosition(id.rawId()) - : triggerGeometry_->bhGeometry()->getPosition(id.rawId())); + GlobalPoint cellpos = triggerGeometry_->hscGeometry()->getPosition(id.rawId()); bhdigi_eta_.emplace_back(cellpos.eta()); bhdigi_phi_.emplace_back(cellpos.phi()); bhdigi_z_.emplace_back(cellpos.z()); @@ -312,15 +281,9 @@ void HGCalTriggerNtupleHGCDigis::fill(const edm::Event& e, const edm::EventSetup bhdigi_data_[i].emplace_back(digi[digiBXselect_[i]].data()); bhdigi_isadc_[i].emplace_back(!digi[digiBXselect_[i]].mode()); } - if (triggerGeometry_->isV9Geometry()) { - const HGCScintillatorDetId idv9(digi.id()); - bhdigi_ieta_.emplace_back(idv9.ietaAbs()); - bhdigi_iphi_.emplace_back(idv9.iphi()); - } else { - const HcalDetId idv8(digi.id()); - bhdigi_ieta_.emplace_back(idv8.ieta()); - bhdigi_iphi_.emplace_back(idv8.iphi()); - } + const HGCScintillatorDetId idsci(digi.id()); + bhdigi_ieta_.emplace_back(idsci.ietaAbs()); + bhdigi_iphi_.emplace_back(idsci.iphi()); if (is_Simhit_comp_) { double hit_energy = 0; auto itr = simhits_bh.find(id); @@ -363,9 +326,7 @@ void HGCalTriggerNtupleHGCDigis::simhits(const edm::Event& e, } // BH for (const auto& simhit : bh_simhits) { - DetId id = - (triggerGeometry_->isV9Geometry() ? triggerTools_.simToReco(simhit.id(), triggerGeometry_->hscTopology()) - : triggerTools_.simToReco(simhit.id(), triggerGeometry_->bhTopology())); + DetId id = triggerTools_.simToReco(simhit.id(), triggerGeometry_->hscTopology()); if (id.rawId() == 0) continue; auto itr_insert = simhits_bh.emplace(id, 0.); @@ -379,11 +340,9 @@ void HGCalTriggerNtupleHGCDigis::clear() { hgcdigi_subdet_.clear(); hgcdigi_side_.clear(); hgcdigi_layer_.clear(); - hgcdigi_wafer_.clear(); hgcdigi_waferu_.clear(); hgcdigi_waferv_.clear(); hgcdigi_wafertype_.clear(); - hgcdigi_cell_.clear(); hgcdigi_cellu_.clear(); hgcdigi_cellv_.clear(); hgcdigi_eta_.clear(); diff --git a/L1Trigger/L1THGCalUtilities/plugins/ntuples/HGCalTriggerNtupleHGCPanels.cc b/L1Trigger/L1THGCalUtilities/plugins/ntuples/HGCalTriggerNtupleHGCPanels.cc deleted file mode 100644 index 5392b058ccbe0..0000000000000 --- a/L1Trigger/L1THGCalUtilities/plugins/ntuples/HGCalTriggerNtupleHGCPanels.cc +++ /dev/null @@ -1,139 +0,0 @@ - -#include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h" -#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h" -#include "L1Trigger/L1THGCalUtilities/interface/HGCalTriggerNtupleBase.h" - -class HGCalTriggerNtupleHGCPanels : public HGCalTriggerNtupleBase { -public: - HGCalTriggerNtupleHGCPanels(const edm::ParameterSet& conf); - ~HGCalTriggerNtupleHGCPanels() override{}; - void initialize(TTree&, const edm::ParameterSet&, edm::ConsumesCollector&&) final; - void fill(const edm::Event& e, const edm::EventSetup& es) final; - -private: - void clear() final; - - edm::EDGetToken trigger_cells_token_; - edm::ESHandle geometry_; - - int panel_n_; - std::vector panel_id_; - std::vector panel_zside_; - std::vector panel_layer_; - std::vector panel_sector_; - std::vector panel_number_; - std::vector panel_tc_n_; - std::vector > panel_tc_id_; - std::vector > panel_tc_mod_; - std::vector > panel_tc_third_; - std::vector > panel_tc_cell_; - std::vector > panel_tc_mipPt_; - std::vector > panel_tc_pt_; - -private: - static const unsigned kPanel_offset_ = 0; - static const unsigned kPanel_mask_ = 0x1F; - static const unsigned kSector_offset_ = 5; - static const unsigned kSector_mask_ = 0x7; - static const unsigned kThird_offset_ = 4; - static const unsigned kThird_mask_ = 0x3; - static const unsigned kCell_mask_ = 0xF; -}; - -DEFINE_EDM_PLUGIN(HGCalTriggerNtupleFactory, HGCalTriggerNtupleHGCPanels, "HGCalTriggerNtupleHGCPanels"); - -HGCalTriggerNtupleHGCPanels::HGCalTriggerNtupleHGCPanels(const edm::ParameterSet& conf) - : HGCalTriggerNtupleBase(conf) {} - -void HGCalTriggerNtupleHGCPanels::initialize(TTree& tree, - const edm::ParameterSet& conf, - edm::ConsumesCollector&& collector) { - trigger_cells_token_ = - collector.consumes(conf.getParameter("TriggerCells")); - - tree.Branch("panel_n", &panel_n_, "panel_n/I"); - tree.Branch("panel_id", &panel_id_); - tree.Branch("panel_zside", &panel_zside_); - tree.Branch("panel_layer", &panel_layer_); - tree.Branch("panel_sector", &panel_sector_); - tree.Branch("panel_number", &panel_number_); - tree.Branch("panel_tc_n", &panel_tc_n_); - tree.Branch("panel_tc_id", &panel_tc_id_); - tree.Branch("panel_tc_mod", &panel_tc_mod_); - tree.Branch("panel_tc_third", &panel_tc_third_); - tree.Branch("panel_tc_cell", &panel_tc_cell_); - tree.Branch("panel_tc_mipPt", &panel_tc_mipPt_); - tree.Branch("panel_tc_pt", &panel_tc_pt_); -} - -void HGCalTriggerNtupleHGCPanels::fill(const edm::Event& e, const edm::EventSetup& es) { - // retrieve trigger cells - edm::Handle trigger_cells_h; - e.getByToken(trigger_cells_token_, trigger_cells_h); - const l1t::HGCalTriggerCellBxCollection& trigger_cells = *trigger_cells_h; - - // retrieve geometry - es.get().get(geometry_); - - clear(); - - // Regroup trigger cells by panel - std::unordered_map > panelids_tcs; - for (auto tc_itr = trigger_cells.begin(0); tc_itr != trigger_cells.end(0); tc_itr++) { - if (tc_itr->hwPt() > 0 && tc_itr->subdetId() != ForwardSubdetector::HGCHEB) { - HGCalDetId id(tc_itr->detId()); - HGCalDetId panelid(geometry_->getModuleFromTriggerCell(id)); - panelids_tcs[panelid].push_back(tc_itr); - } - } - for (const auto& panelid_tcs : panelids_tcs) { - panel_n_++; - HGCalDetId panelid(panelid_tcs.first); - int panel_sector = (panelid.wafer() >> kSector_offset_) & kSector_mask_; - int panel_number = (panelid.wafer() >> kPanel_offset_) & kPanel_mask_; - const auto& tcs = panelid_tcs.second; - panel_id_.emplace_back(panelid); - panel_zside_.emplace_back(panelid.zside()); - panel_layer_.emplace_back(geometry_->triggerLayer(panelid)); - panel_sector_.emplace_back(panel_sector); - panel_number_.emplace_back(panel_number); - panel_tc_n_.emplace_back(tcs.size()); - panel_tc_id_.emplace_back(); - panel_tc_mod_.emplace_back(); - panel_tc_third_.emplace_back(); - panel_tc_cell_.emplace_back(); - panel_tc_mipPt_.emplace_back(); - panel_tc_pt_.emplace_back(); - - for (const auto& tc : tcs) { - panel_tc_id_.back().push_back(tc->detId()); - panel_tc_mipPt_.back().push_back(tc->mipPt()); - panel_tc_pt_.back().push_back(tc->pt()); - HGCalDetId tc_detid(tc->detId()); - unsigned module_id = tc_detid.wafer(); - unsigned third_id = (tc_detid.cell() >> kThird_offset_) & kThird_mask_; - unsigned cell_id = tc_detid.cell() & kCell_mask_; - panel_tc_mod_.back().push_back(module_id); - panel_tc_third_.back().push_back(third_id); - panel_tc_cell_.back().push_back(cell_id); - } - } -} - -void HGCalTriggerNtupleHGCPanels::clear() { - panel_n_ = 0; - panel_id_.clear(); - panel_zside_.clear(); - panel_layer_.clear(); - panel_sector_.clear(); - panel_number_.clear(); - panel_tc_n_.clear(); - panel_tc_id_.clear(); - panel_tc_mod_.clear(); - panel_tc_third_.clear(); - panel_tc_cell_.clear(); - panel_tc_mipPt_.clear(); - panel_tc_pt_.clear(); -} diff --git a/L1Trigger/L1THGCalUtilities/plugins/ntuples/HGCalTriggerNtupleHGCTriggerCells.cc b/L1Trigger/L1THGCalUtilities/plugins/ntuples/HGCalTriggerNtupleHGCTriggerCells.cc index 3b15eba6688fc..538f96e03c47d 100644 --- a/L1Trigger/L1THGCalUtilities/plugins/ntuples/HGCalTriggerNtupleHGCTriggerCells.cc +++ b/L1Trigger/L1THGCalUtilities/plugins/ntuples/HGCalTriggerNtupleHGCTriggerCells.cc @@ -6,7 +6,6 @@ #include "Geometry/Records/interface/CaloGeometryRecord.h" #include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h" #include "DataFormats/L1THGCal/interface/HGCalMulticluster.h" -#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" #include "DataFormats/Common/interface/AssociationMap.h" #include "DataFormats/Common/interface/OneToMany.h" #include "SimDataFormats/CaloAnalysis/interface/CaloParticleFwd.h" @@ -46,23 +45,14 @@ class HGCalTriggerNtupleHGCTriggerCells : public HGCalTriggerNtupleBase { std::vector thicknessCorrections_; edm::ESHandle geometry_; - static const unsigned kPanelOffset_ = 0; - static const unsigned kPanelMask_ = 0x7F; - static const unsigned kSectorOffset_ = 7; - static const unsigned kSectorMask_ = 0x7; - int tc_n_; std::vector tc_id_; std::vector tc_subdet_; std::vector tc_side_; std::vector tc_layer_; - std::vector tc_panel_number_; - std::vector tc_panel_sector_; - std::vector tc_wafer_; std::vector tc_waferu_; std::vector tc_waferv_; std::vector tc_wafertype_; - std::vector tc_cell_; std::vector tc_cellu_; std::vector tc_cellv_; std::vector tc_data_; @@ -128,13 +118,9 @@ void HGCalTriggerNtupleHGCTriggerCells::initialize(TTree& tree, tree.Branch(withPrefix("subdet"), &tc_subdet_); tree.Branch(withPrefix("zside"), &tc_side_); tree.Branch(withPrefix("layer"), &tc_layer_); - tree.Branch(withPrefix("wafer"), &tc_wafer_); tree.Branch(withPrefix("waferu"), &tc_waferu_); tree.Branch(withPrefix("waferv"), &tc_waferv_); tree.Branch(withPrefix("wafertype"), &tc_wafertype_); - tree.Branch(withPrefix("panel_number"), &tc_panel_number_); - tree.Branch(withPrefix("panel_sector"), &tc_panel_sector_); - tree.Branch(withPrefix("cell"), &tc_cell_); tree.Branch(withPrefix("cellu"), &tc_cellu_); tree.Branch(withPrefix("cellv"), &tc_cellv_); tree.Branch(withPrefix("data"), &tc_data_); @@ -218,52 +204,28 @@ void HGCalTriggerNtupleHGCTriggerCells::fill(const edm::Event& e, const edm::Eve tc_n_++; // hardware data DetId id(tc_itr->detId()); - DetId panelId(geometry_->getModuleFromTriggerCell(id)); - int panel_sector = -999; - int panel_number = -999; - if (panelId.det() == DetId::Forward) { - HGCalDetId panelIdHGCal(panelId); - if (panelId.subdetId() == ForwardSubdetector::HGCHEB) { - panel_number = panelIdHGCal.wafer(); - } else { - panel_sector = (panelIdHGCal.wafer() >> kSectorOffset_) & kSectorMask_; - panel_number = (panelIdHGCal.wafer() >> kPanelOffset_) & kPanelMask_; - } - } else if (id.det() == DetId::HGCalHSc) { - HGCScintillatorDetId panelIdSci(panelId); - panel_sector = panelIdSci.iphi(); - panel_number = panelIdSci.ietaAbs(); - } - tc_panel_number_.emplace_back(panel_number); - tc_panel_sector_.emplace_back(panel_sector); tc_id_.emplace_back(tc_itr->detId()); tc_side_.emplace_back(triggerTools_.zside(id)); tc_layer_.emplace_back(triggerTools_.layerWithOffset(id)); - // V9 detids if (id.det() == DetId::HGCalTrigger) { - HGCalTriggerDetId idv9(id); - tc_subdet_.emplace_back(idv9.subdet()); - tc_waferu_.emplace_back(idv9.waferU()); - tc_waferv_.emplace_back(idv9.waferV()); - tc_wafertype_.emplace_back(idv9.type()); - tc_cellu_.emplace_back(idv9.triggerCellU()); - tc_cellv_.emplace_back(idv9.triggerCellV()); + HGCalTriggerDetId idtrg(id); + tc_subdet_.emplace_back(idtrg.subdet()); + tc_waferu_.emplace_back(idtrg.waferU()); + tc_waferv_.emplace_back(idtrg.waferV()); + tc_wafertype_.emplace_back(idtrg.type()); + tc_cellu_.emplace_back(idtrg.triggerCellU()); + tc_cellv_.emplace_back(idtrg.triggerCellV()); } else if (id.det() == DetId::HGCalHSc) { - HGCScintillatorDetId idv9(id); - tc_subdet_.emplace_back(idv9.subdet()); + HGCScintillatorDetId idsci(id); + tc_subdet_.emplace_back(idsci.subdet()); tc_waferu_.emplace_back(-999); tc_waferv_.emplace_back(-999); - tc_wafertype_.emplace_back(idv9.type()); - tc_cellu_.emplace_back(idv9.ietaAbs()); - tc_cellv_.emplace_back(idv9.iphi()); - } - // V8 detids - else { - HGCalDetId idv8(id); - tc_subdet_.emplace_back(id.subdetId()); - tc_wafer_.emplace_back(idv8.wafer()); - tc_wafertype_.emplace_back(idv8.waferType()); - tc_cell_.emplace_back(idv8.cell()); + tc_wafertype_.emplace_back(idsci.type()); + tc_cellu_.emplace_back(idsci.ietaAbs()); + tc_cellv_.emplace_back(idsci.iphi()); + } else { + throw cms::Exception("InvalidHGCalTriggerDetid") + << "Found unexpected trigger cell detid to be filled in HGCal Trigger Cell ntuple."; } tc_data_.emplace_back(tc_itr->hwPt()); tc_uncompressedCharge_.emplace_back(tc_itr->uncompressedCharge()); @@ -338,7 +300,7 @@ void HGCalTriggerNtupleHGCTriggerCells::simhits(const edm::Event& e, e.getByToken(simhits_bh_token_, bh_simhits_h); const edm::PCaloHitContainer& bh_simhits = *bh_simhits_h; - //EE + // EE for (const auto& simhit : ee_simhits) { DetId id = triggerTools_.simToReco(simhit.id(), geometry_->eeTopology()); if (id.rawId() == 0) @@ -356,8 +318,7 @@ void HGCalTriggerNtupleHGCTriggerCells::simhits(const edm::Event& e, } // BH for (const auto& simhit : bh_simhits) { - DetId id = (geometry_->isV9Geometry() ? triggerTools_.simToReco(simhit.id(), geometry_->hscTopology()) - : triggerTools_.simToReco(simhit.id(), geometry_->bhTopology())); + DetId id = triggerTools_.simToReco(simhit.id(), geometry_->hscTopology()); if (id.rawId() == 0) continue; auto itr_insert = simhits_bh.emplace(id, 0.); @@ -371,13 +332,9 @@ void HGCalTriggerNtupleHGCTriggerCells::clear() { tc_subdet_.clear(); tc_side_.clear(); tc_layer_.clear(); - tc_wafer_.clear(); tc_waferu_.clear(); tc_waferv_.clear(); tc_wafertype_.clear(); - tc_panel_number_.clear(); - tc_panel_sector_.clear(); - tc_cell_.clear(); tc_cellu_.clear(); tc_cellv_.clear(); tc_data_.clear(); diff --git a/L1Trigger/L1THGCalUtilities/plugins/ntuples/HGCalTriggerNtupleHGCTriggerSums.cc b/L1Trigger/L1THGCalUtilities/plugins/ntuples/HGCalTriggerNtupleHGCTriggerSums.cc index 5377cfdf427b7..8a5c3d292e550 100644 --- a/L1Trigger/L1THGCalUtilities/plugins/ntuples/HGCalTriggerNtupleHGCTriggerSums.cc +++ b/L1Trigger/L1THGCalUtilities/plugins/ntuples/HGCalTriggerNtupleHGCTriggerSums.cc @@ -21,12 +21,6 @@ class HGCalTriggerNtupleHGCTriggerSums : public HGCalTriggerNtupleBase { HGCalTriggerTools triggerTools_; edm::EDGetToken trigger_sums_token_; - edm::ESHandle geometry_; - - static constexpr unsigned kPanelOffset_ = 0; - static constexpr unsigned kPanelMask_ = 0x7F; - static constexpr unsigned kSectorOffset_ = 7; - static constexpr unsigned kSectorMask_ = 0x7; int ts_n_; std::vector ts_id_; @@ -74,8 +68,6 @@ void HGCalTriggerNtupleHGCTriggerSums::initialize(TTree& tree, tree.Branch(withPrefix("layer"), &ts_layer_); tree.Branch(withPrefix("wafer"), &ts_wafer_); tree.Branch(withPrefix("wafertype"), &ts_wafertype_); - tree.Branch(withPrefix("panel_number"), &ts_panel_number_); - tree.Branch(withPrefix("panel_sector"), &ts_panel_sector_); tree.Branch(withPrefix("data"), &ts_data_); tree.Branch(withPrefix("pt"), &ts_pt_); tree.Branch(withPrefix("mipPt"), &ts_mipPt_); @@ -93,9 +85,6 @@ void HGCalTriggerNtupleHGCTriggerSums::fill(const edm::Event& e, const edm::Even e.getByToken(trigger_sums_token_, trigger_sums_h); const l1t::HGCalTriggerSumsBxCollection& trigger_sums = *trigger_sums_h; - // retrieve geometry - es.get().get(geometry_); - triggerTools_.eventSetup(es); clear(); @@ -103,43 +92,21 @@ void HGCalTriggerNtupleHGCTriggerSums::fill(const edm::Event& e, const edm::Even if (ts_itr->pt() > 0) { ts_n_++; // hardware data - DetId panelId(ts_itr->detId()); - int panel_sector = -999; - int panel_number = -999; - if (panelId.det() == DetId::Forward) { - HGCalDetId panelIdHGCal(panelId); - if (panelId.subdetId() == ForwardSubdetector::HGCHEB) { - panel_number = panelIdHGCal.wafer(); - } else { - panel_sector = (panelIdHGCal.wafer() >> kSectorOffset_) & kSectorMask_; - panel_number = (panelIdHGCal.wafer() >> kPanelOffset_) & kPanelMask_; - } - } else if (panelId.det() == DetId::HGCalHSc) { - HGCScintillatorDetId panelIdSci(panelId); - panel_sector = panelIdSci.iphi(); - panel_number = panelIdSci.ietaAbs(); - } - ts_panel_number_.emplace_back(panel_number); - ts_panel_sector_.emplace_back(panel_sector); + DetId moduleId(ts_itr->detId()); ts_id_.emplace_back(ts_itr->detId()); - ts_side_.emplace_back(triggerTools_.zside(panelId)); - ts_layer_.emplace_back(triggerTools_.layerWithOffset(panelId)); - // V9 detids - if (panelId.det() == DetId::HGCalTrigger) { - HGCalTriggerDetId idv9(panelId); - ts_subdet_.emplace_back(idv9.subdet()); - ts_wafertype_.emplace_back(idv9.type()); - } else if (panelId.det() == DetId::HGCalHSc) { - HGCScintillatorDetId idv9(panelId); - ts_subdet_.emplace_back(idv9.subdet()); - ts_wafertype_.emplace_back(idv9.type()); - } - // V8 detids - else { - HGCalDetId idv8(panelId); - ts_subdet_.emplace_back(panelId.subdetId()); - ts_wafer_.emplace_back(idv8.wafer()); - ts_wafertype_.emplace_back(idv8.waferType()); + ts_side_.emplace_back(triggerTools_.zside(moduleId)); + ts_layer_.emplace_back(triggerTools_.layerWithOffset(moduleId)); + if (moduleId.det() == DetId::HGCalTrigger) { + HGCalTriggerDetId id(moduleId); + ts_subdet_.emplace_back(id.subdet()); + ts_wafertype_.emplace_back(id.type()); + } else if (moduleId.det() == DetId::HGCalHSc) { + HGCScintillatorDetId id(moduleId); + ts_subdet_.emplace_back(id.subdet()); + ts_wafertype_.emplace_back(id.type()); + } else { + ts_subdet_.emplace_back(-999); + ts_wafertype_.emplace_back(-999); } ts_data_.emplace_back(ts_itr->hwPt()); ts_mipPt_.emplace_back(ts_itr->mipPt()); @@ -163,8 +130,6 @@ void HGCalTriggerNtupleHGCTriggerSums::clear() { ts_layer_.clear(); ts_wafer_.clear(); ts_wafertype_.clear(); - ts_panel_number_.clear(); - ts_panel_sector_.clear(); ts_data_.clear(); ts_mipPt_.clear(); ts_pt_.clear(); diff --git a/L1Trigger/L1THGCalUtilities/python/customNtuples.py b/L1Trigger/L1THGCalUtilities/python/customNtuples.py index 92c3399a4d661..06c558584d8be 100644 --- a/L1Trigger/L1THGCalUtilities/python/customNtuples.py +++ b/L1Trigger/L1THGCalUtilities/python/customNtuples.py @@ -1,14 +1,5 @@ import FWCore.ParameterSet.Config as cms -def custom_ntuples_V9(process): - ntuples = process.hgcalTriggerNtuplizer.Ntuples - for ntuple in ntuples: - if ntuple.NtupleName=='HGCalTriggerNtupleHGCDigis' or \ - ntuple.NtupleName=='HGCalTriggerNtupleHGCTriggerCells': - ntuple.bhSimHits = cms.InputTag('g4SimHits:HGCHitsHEback') - return process - - def create_ntuple(process, inputs, ntuple_list=[ diff --git a/L1Trigger/L1THGCalUtilities/python/hgcalTriggerNtuples_cff.py b/L1Trigger/L1THGCalUtilities/python/hgcalTriggerNtuples_cff.py index 12c60e572be54..73f3996d7b25b 100644 --- a/L1Trigger/L1THGCalUtilities/python/hgcalTriggerNtuples_cff.py +++ b/L1Trigger/L1THGCalUtilities/python/hgcalTriggerNtuples_cff.py @@ -4,8 +4,4 @@ hgcalTriggerNtuples = cms.Sequence(hgcalTriggerNtuplizer) -from Configuration.Eras.Modifier_phase2_hgcalV10_cff import phase2_hgcalV10 -from L1Trigger.L1THGCalUtilities.customNtuples import custom_ntuples_V9 -modifyHgcalTriggerNtuplesWithV9Geometry_ = phase2_hgcalV10.makeProcessModifier(custom_ntuples_V9) - diff --git a/L1Trigger/L1THGCalUtilities/python/hgcalTriggerNtuples_cfi.py b/L1Trigger/L1THGCalUtilities/python/hgcalTriggerNtuples_cfi.py index 29ba251598ff1..71a5bf4352115 100644 --- a/L1Trigger/L1THGCalUtilities/python/hgcalTriggerNtuples_cfi.py +++ b/L1Trigger/L1THGCalUtilities/python/hgcalTriggerNtuples_cfi.py @@ -49,7 +49,7 @@ HGCDigisBH = cms.InputTag('simHGCalUnsuppressedDigis:HEback'), eeSimHits = cms.InputTag('g4SimHits:HGCHitsEE'), fhSimHits = cms.InputTag('g4SimHits:HGCHitsHEfront'), - bhSimHits = cms.InputTag('g4SimHits:HcalHits'), + bhSimHits = cms.InputTag('g4SimHits:HGCHitsHEback'), isSimhitComp = cms.bool(False), digiBXselect = cms.vuint32(2) ) @@ -60,7 +60,7 @@ Multiclusters = cms.InputTag('hgcalBackEndLayer2Producer:HGCalBackendLayer2Processor3DClustering'), eeSimHits = cms.InputTag('g4SimHits:HGCHitsEE'), fhSimHits = cms.InputTag('g4SimHits:HGCHitsHEfront'), - bhSimHits = cms.InputTag('g4SimHits:HcalHits'), + bhSimHits = cms.InputTag('g4SimHits:HGCHitsHEback'), FillSimEnergy = cms.bool(False), FillTruthMap = cms.bool(False), fcPerMip = fcPerMip, @@ -96,11 +96,6 @@ FillInterpretationInfo = cms.bool(True) ) -ntuple_panels = cms.PSet( - NtupleName = cms.string('HGCalTriggerNtupleHGCPanels'), - TriggerCells = cms.InputTag('hgcalConcentratorProducer:HGCalConcentratorProcessorSelection') -) - ntuple_towers = cms.PSet( NtupleName = cms.string('HGCalTriggerNtupleHGCTowers'), Towers = cms.InputTag('hgcalTowerProducer:HGCalTowerProcessor') diff --git a/L1Trigger/L1TTrackMatch/plugins/L1FastTrackingJetProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1FastTrackingJetProducer.cc index f859b04eef4a9..8af9cf53cfb3e 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1FastTrackingJetProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1FastTrackingJetProducer.cc @@ -33,12 +33,13 @@ // geometry #include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "RecoJets/JetProducers/plugins/VirtualJetProducer.h" //mc #include "SimTracker/TrackTriggerAssociation/interface/TTTrackAssociationMap.h" #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h" +#include + #include #include "TMath.h" #include "TH1.h" diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc index 57e00de06469c..126736a5b9cca 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc @@ -32,7 +32,8 @@ // geometry #include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "RecoJets/JetProducers/plugins/VirtualJetProducer.h" + +#include #include #include "TMath.h" diff --git a/L1TriggerConfig/L1ScalesProducers/src/L1CaloHcalScaleConfigOnlineProd.cc b/L1TriggerConfig/L1ScalesProducers/src/L1CaloHcalScaleConfigOnlineProd.cc index 61775ce28b2e5..3d00d35733922 100644 --- a/L1TriggerConfig/L1ScalesProducers/src/L1CaloHcalScaleConfigOnlineProd.cc +++ b/L1TriggerConfig/L1ScalesProducers/src/L1CaloHcalScaleConfigOnlineProd.cc @@ -24,7 +24,7 @@ #include "CondFormats/DataRecord/interface/L1CaloHcalScaleRcd.h" #include "Geometry/HcalTowerAlgo/interface/HcalTrigTowerGeometry.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "CalibCalorimetry/CaloTPG/src/CaloTPGTranscoderULUT.h" +#include "CalibCalorimetry/CaloTPG/interface/CaloTPGTranscoderULUT.h" #include "CondTools/L1Trigger/interface/OMDSReader.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" diff --git a/Mixing/Base/src/PileUp.cc b/Mixing/Base/src/PileUp.cc index 6f768975046b5..d9dea4c40efa0 100644 --- a/Mixing/Base/src/PileUp.cc +++ b/Mixing/Base/src/PileUp.cc @@ -5,7 +5,7 @@ #include "FWCore/Framework/interface/EventPrincipal.h" #include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/Framework/interface/Run.h" -#include "FWCore/Framework/src/SignallingProductRegistry.h" +#include "FWCore/Framework/interface/SignallingProductRegistry.h" #include "FWCore/Framework/interface/ESRecordsToProxyIndices.h" #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h" #include "FWCore/ServiceRegistry/interface/ProcessContext.h" diff --git a/Mixing/Base/src/SecondaryEventProvider.cc b/Mixing/Base/src/SecondaryEventProvider.cc index 589e3d1fdb181..480d83c770467 100644 --- a/Mixing/Base/src/SecondaryEventProvider.cc +++ b/Mixing/Base/src/SecondaryEventProvider.cc @@ -2,8 +2,8 @@ #include "Mixing/Base/src/SecondaryEventProvider.h" #include "FWCore/Common/interface/ProcessBlockHelper.h" #include "FWCore/Framework/interface/ExceptionActions.h" -#include "FWCore/Framework/src/PreallocationConfiguration.h" -#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/PreallocationConfiguration.h" +#include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/StreamID.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" diff --git a/MuonAnalysis/MuonAssociators/plugins/BuildFile.xml b/MuonAnalysis/MuonAssociators/plugins/BuildFile.xml index afa7f595a4ced..e106085532aff 100644 --- a/MuonAnalysis/MuonAssociators/plugins/BuildFile.xml +++ b/MuonAnalysis/MuonAssociators/plugins/BuildFile.xml @@ -1,7 +1,6 @@ - diff --git a/MuonAnalysis/MuonAssociators/plugins/MuonMCClassifier.cc b/MuonAnalysis/MuonAssociators/plugins/MuonMCClassifier.cc index 2b086f298ae2d..105136a983d22 100644 --- a/MuonAnalysis/MuonAssociators/plugins/MuonMCClassifier.cc +++ b/MuonAnalysis/MuonAssociators/plugins/MuonMCClassifier.cc @@ -56,7 +56,6 @@ #include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h" #include "SimDataFormats/Associations/interface/MuonToTrackingParticleAssociator.h" -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" #include #include "CommonTools/Utils/interface/StringCutObjectSelector.h" diff --git a/PhysicsTools/HepMCCandAlgos/test/BuildFile.xml b/PhysicsTools/HepMCCandAlgos/test/BuildFile.xml index dd250949ce54d..bb1ec8d810b3f 100644 --- a/PhysicsTools/HepMCCandAlgos/test/BuildFile.xml +++ b/PhysicsTools/HepMCCandAlgos/test/BuildFile.xml @@ -1,6 +1,4 @@ - - diff --git a/PhysicsTools/PatAlgos/plugins/PATObjectUserDataEmbedder.cc b/PhysicsTools/PatAlgos/plugins/PATObjectUserDataEmbedder.cc index c63200ff64826..87ef4f6924f52 100644 --- a/PhysicsTools/PatAlgos/plugins/PATObjectUserDataEmbedder.cc +++ b/PhysicsTools/PatAlgos/plugins/PATObjectUserDataEmbedder.cc @@ -75,7 +75,7 @@ namespace pat { static void fillDescriptions(edm::ConfigurationDescriptions &descriptions) { edm::ParameterSetDescription desc; desc.add("src"); - for (const std::string &what : {"userFloats", "userInts", "userIntFromBools", "userCands"}) { + for (auto &&what : {"userFloats", "userInts", "userIntFromBools", "userCands"}) { edm::ParameterSetDescription descNested; descNested.addWildcard("*"); desc.add(what, descNested); diff --git a/PhysicsTools/PatAlgos/python/slimming/MicroEventContent_cff.py b/PhysicsTools/PatAlgos/python/slimming/MicroEventContent_cff.py index 2cd9533f9d761..5035ec39e78e4 100644 --- a/PhysicsTools/PatAlgos/python/slimming/MicroEventContent_cff.py +++ b/PhysicsTools/PatAlgos/python/slimming/MicroEventContent_cff.py @@ -186,7 +186,7 @@ cms.untracked.PSet(branch = cms.untracked.string("EcalRecHitsSorted_reducedEgamma_reducedESRecHits_*"),splitLevel=cms.untracked.int32(99)), ]) -_phase2_hgc_extraCommands = ["keep *_slimmedElectronsFromMultiCl_*_*", "keep *_slimmedPhotonsFromMultiCl_*_*"] +_phase2_hgc_extraCommands = ["keep *_slimmedElectronsHGC_*_*", "keep *_slimmedPhotonsHGC_*_*"] from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal phase2_hgcal.toModify(MicroEventContentMC, outputCommands = MicroEventContentMC.outputCommands + _phase2_hgc_extraCommands) diff --git a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py index 80614e2c9d1e2..647d5e0734ec0 100644 --- a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py +++ b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py @@ -534,8 +534,8 @@ def _add_deepMET(process): # EGamma objects from HGCal are not yet in GED # so add companion collections for Phase-II MiniAOD production from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal - process.load("RecoEgamma.EgammaTools.slimmedEgammaFromMultiCl_cff") - phase2_hgcal.toModify(task, func=lambda t: t.add(process.slimmedEgammaFromMultiClTask)) + process.load("RecoEgamma.EgammaTools.slimmedEgammaHGC_cff") + phase2_hgcal.toModify(task, func=lambda t: t.add(process.slimmedEgammaHGCTask)) # L1 pre-firing weights for 2016, 2017, and 2018 from Configuration.Eras.Modifier_run2_L1prefiring_cff import run2_L1prefiring diff --git a/PhysicsTools/PatAlgos/python/tools/helpers.py b/PhysicsTools/PatAlgos/python/tools/helpers.py index a1d4a7851a63d..0f9dbd0d181e6 100644 --- a/PhysicsTools/PatAlgos/python/tools/helpers.py +++ b/PhysicsTools/PatAlgos/python/tools/helpers.py @@ -433,3 +433,65 @@ def testListModules(self): self.assertEqual([p.a,p.b,p.c], listModules(p.s)) unittest.main() + +class CloneTaskVisitor(object): + """Visitor that travels within a cms.Task, and returns a cloned version of the Task. + All modules are cloned and a postfix is added""" + def __init__(self, process, label, postfix, removePostfix="", noClones = [], verbose = False): + self._process = process + self._postfix = postfix + self._removePostfix = removePostfix + self._noClones = noClones + self._verbose = verbose + self._moduleLabels = [] + self._clonedTask = cms.Task() + setattr(process, self._newLabel(label), self._clonedTask) + + def enter(self, visitee): + if isinstance(visitee, cms._Module): + label = visitee.label() + newModule = None + if label in self._noClones: #keep unchanged + newModule = getattr(self._process, label) + elif label in self._moduleLabels: # has the module already been cloned ? + newModule = getattr(self._process, self._newLabel(label)) + else: + self._moduleLabels.append(label) + newModule = visitee.clone() + setattr(self._process, self._newLabel(label), newModule) + self.__appendToTopTask(newModule) + + def leave(self, visitee): + pass + + def clonedTask(self):#FIXME: can the following be used for Task? + for label in self._moduleLabels: + massSearchReplaceAnyInputTag(self._clonedTask, label, self._newLabel(label), moduleLabelOnly=True, verbose=self._verbose) + self._moduleLabels = [] # prevent the InputTag replacement next time the 'clonedTask' function is called. + return self._clonedTask + + def _newLabel(self, label): + if self._removePostfix != "": + if label[-len(self._removePostfix):] == self._removePostfix: + label = label[0:-len(self._removePostfix)] + else: + raise Exception("Tried to remove postfix %s from label %s, but it wasn't there" % (self._removePostfix, label)) + return label + self._postfix + + def __appendToTopTask(self, visitee): + self._clonedTask.add(visitee) + +def cloneProcessingSnippetTask(process, task, postfix, removePostfix="", noClones = [], verbose = False): + """ + ------------------------------------------------------------------ + copy a task plus the modules therein (including modules in subtasks) + both are renamed by getting a postfix + input tags are automatically adjusted + ------------------------------------------------------------------ + """ + result = task + if not postfix == "": + visitor = CloneTaskVisitor(process, task.label(), postfix, removePostfix, noClones, verbose) + task.visit(visitor) + result = visitor.clonedTask() + return result diff --git a/PhysicsTools/PatUtils/plugins/PackedCandidatesTrackLiteModifier.cc b/PhysicsTools/PatUtils/plugins/PackedCandidatesTrackLiteModifier.cc new file mode 100644 index 0000000000000..46ee7d2f0ce23 --- /dev/null +++ b/PhysicsTools/PatUtils/plugins/PackedCandidatesTrackLiteModifier.cc @@ -0,0 +1,72 @@ +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "FWCore/Framework/interface/global/EDProducer.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" + +#include "DataFormats/PatCandidates/interface/PackedCandidate.h" + +#include + +class PackedCandidatesTrackLiteModifier : public edm::global::EDProducer<> { +public: + explicit PackedCandidatesTrackLiteModifier(const edm::ParameterSet &); + ~PackedCandidatesTrackLiteModifier() override = default; + + void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override; + static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); + +private: + const edm::EDGetTokenT inputCandidates_; + const edm::EDPutTokenT outputCandidates_; + const unsigned int covSchema_; + const unsigned int covVersion_; + const unsigned int nHits_; + const unsigned int nPixelHits_; +}; + +//____________________________________________________________________________|| +PackedCandidatesTrackLiteModifier::PackedCandidatesTrackLiteModifier(const edm::ParameterSet &iConfig) + : inputCandidates_( + consumes(iConfig.getParameter("inputCandidates"))), + outputCandidates_(produces("")), + covSchema_(iConfig.getParameter("covSchema")), + covVersion_(iConfig.getParameter("covVersion")), + nHits_(iConfig.getParameter("nHits")), + nPixelHits_(iConfig.getParameter("nPixelHits")) {} + +void PackedCandidatesTrackLiteModifier::produce(edm::StreamID, + edm::Event &iEvent, + const edm::EventSetup &iSetup) const { + auto const &packedCandidates = iEvent.get(inputCandidates_); + + pat::PackedCandidateCollection output; + output.reserve(packedCandidates.size()); + for (auto const &cand : packedCandidates) { + output.push_back(pat::PackedCandidate(cand)); + + if (!output.back().hasTrackDetails() && output.back().fromTrackCandidate()) + output.back().setTrackPropertiesLite(covSchema_, covVersion_, nHits_, nPixelHits_); + } + + iEvent.emplace(outputCandidates_, std::move(output)); +}; + +void PackedCandidatesTrackLiteModifier::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { + edm::ParameterSetDescription desc; + + desc.add("inputCandidates", edm::InputTag("packedPFCandidates")); + desc.add("covSchema", 1025); + desc.add("covVersion", 1); + desc.add("nHits", 8); + desc.add("nPixelHits", 3); + + descriptions.addWithDefaultLabel(desc); +} + +//____________________________________________________________________________|| +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(PackedCandidatesTrackLiteModifier); diff --git a/PhysicsTools/TagAndProbe/interface/TriggerCandProducer.h b/PhysicsTools/TagAndProbe/interface/TriggerCandProducer.h index 286892a3771b5..21f596c007c94 100644 --- a/PhysicsTools/TagAndProbe/interface/TriggerCandProducer.h +++ b/PhysicsTools/TagAndProbe/interface/TriggerCandProducer.h @@ -56,5 +56,5 @@ class TriggerCandProducer : public edm::EDProducer { bool skipEvent_; bool matchUnprescaledTriggerOnly_; }; -#include "PhysicsTools/TagAndProbe/src/TriggerCandProducer.icc" +#include "PhysicsTools/TagAndProbe/interface/TriggerCandProducer.icc" #endif diff --git a/PhysicsTools/TagAndProbe/src/TriggerCandProducer.icc b/PhysicsTools/TagAndProbe/interface/TriggerCandProducer.icc similarity index 100% rename from PhysicsTools/TagAndProbe/src/TriggerCandProducer.icc rename to PhysicsTools/TagAndProbe/interface/TriggerCandProducer.icc diff --git a/RecoEcal/Configuration/python/RecoEcal_EventContent_cff.py b/RecoEcal/Configuration/python/RecoEcal_EventContent_cff.py index d179c3b108dd6..96f1e297f99f6 100644 --- a/RecoEcal/Configuration/python/RecoEcal_EventContent_cff.py +++ b/RecoEcal/Configuration/python/RecoEcal_EventContent_cff.py @@ -26,9 +26,7 @@ 'keep recoCaloClusters_particleFlowSuperClusterOOTECAL_*_*') ) _phase2_hgcal_scCommandsAOD = ['keep recoSuperClusters_particleFlowSuperClusterHGCal__*', - 'keep recoCaloClusters_particleFlowSuperClusterHGCal__*', - 'keep recoSuperClusters_particleFlowSuperClusterHGCalFromMultiCl__*', - 'keep recoCaloClusters_particleFlowSuperClusterHGCalFromMultiCl__*'] + 'keep recoCaloClusters_particleFlowSuperClusterHGCal__*'] from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal phase2_hgcal.toModify(RecoEcalAOD, @@ -65,8 +63,7 @@ 'drop recoSuperClusters_multi5x5SuperClusters_multi5x5BarrelSuperClusters_*') ) RecoEcalRECO.outputCommands.extend(RecoEcalAOD.outputCommands) -_phase2_hgcal_scCommands = ['keep *_particleFlowSuperClusterHGCal_*_*', - 'keep *_particleFlowSuperClusterHGCalFromMultiCl_*_*'] +_phase2_hgcal_scCommands = ['keep *_particleFlowSuperClusterHGCal_*_*'] phase2_hgcal.toModify(RecoEcalRECO, outputCommands = RecoEcalRECO.outputCommands + _phase2_hgcal_scCommands) diff --git a/RecoEcal/EgammaClusterProducers/python/particleFlowSuperClusteringSequence_cff.py b/RecoEcal/EgammaClusterProducers/python/particleFlowSuperClusteringSequence_cff.py index 793fed92e2861..4185150bcd19a 100644 --- a/RecoEcal/EgammaClusterProducers/python/particleFlowSuperClusteringSequence_cff.py +++ b/RecoEcal/EgammaClusterProducers/python/particleFlowSuperClusteringSequence_cff.py @@ -16,7 +16,7 @@ phase2_hgcal.toModify( particleFlowSuperClusterHGCal, PFClusters = 'particleFlowClusterHGCal', - useRegression = False, #no HGCal regression yet + useRegression = True, use_preshower = False, PFBasicClusterCollectionEndcap = "", PFSuperClusterCollectionEndcap = "", @@ -25,13 +25,7 @@ dropUnseedable = True, ) -particleFlowSuperClusterHGCalFromMultiCl = particleFlowSuperClusterHGCal.clone() -phase2_hgcal.toModify( - particleFlowSuperClusterHGCalFromMultiCl, - PFClusters = 'particleFlowClusterHGCalFromMultiCl', - useRegression = True, -) -phase2_hgcal.toModify( particleFlowSuperClusterHGCalFromMultiCl.regressionConfig, +phase2_hgcal.toModify( particleFlowSuperClusterHGCal.regressionConfig, regressionKeyEE = "superclus_hgcal_mean_offline", uncertaintyKeyEE = "superclus_hgcal_sigma_offline", isPhaseII = True, @@ -40,7 +34,6 @@ ) _phase2_hgcal_particleFlowSuperClusteringTask = particleFlowSuperClusteringTask.copy() _phase2_hgcal_particleFlowSuperClusteringTask.add(particleFlowSuperClusterHGCal) -_phase2_hgcal_particleFlowSuperClusteringTask.add(particleFlowSuperClusterHGCalFromMultiCl) phase2_hgcal.toReplaceWith( particleFlowSuperClusteringTask, _phase2_hgcal_particleFlowSuperClusteringTask ) diff --git a/RecoEgamma/Configuration/python/RecoEgamma_EventContent_cff.py b/RecoEgamma/Configuration/python/RecoEgamma_EventContent_cff.py index f14d59c228b0f..3a26c67d232a9 100644 --- a/RecoEgamma/Configuration/python/RecoEgamma_EventContent_cff.py +++ b/RecoEgamma/Configuration/python/RecoEgamma_EventContent_cff.py @@ -52,10 +52,10 @@ # mods for HGCAL _phase2_hgcal_RecoEgamma_tokeep = [ 'keep *_ecalDrivenGsfElectronCores_*_*', 'keep *_ecalDrivenGsfElectrons_*_*', - 'keep *_ecalDrivenGsfElectronCoresFromMultiCl_*_*', - 'keep *_ecalDrivenGsfElectronsFromMultiCl_*_*', - 'keep *_photonCoreFromMultiCl_*_*', - 'keep *_photonsFromMultiCl_*_*'] + 'keep *_ecalDrivenGsfElectronCoresHGC_*_*', + 'keep *_ecalDrivenGsfElectronsHGC_*_*', + 'keep *_photonCoreHGC_*_*', + 'keep *_photonsHGC_*_*'] from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal phase2_hgcal.toModify( RecoEgammaAOD, diff --git a/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronCoreEcalDrivenProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronCoreEcalDrivenProducer.cc index 524aa21efdaf7..c14adff8c84db 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronCoreEcalDrivenProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronCoreEcalDrivenProducer.cc @@ -21,6 +21,7 @@ class GsfElectronCoreEcalDrivenProducer : public edm::global::EDProducer<> { private: const bool useGsfPfRecTracks_; + const bool hgcalOnly_; const edm::EDGetTokenT gsfPfRecTracksToken_; const edm::EDGetTokenT gsfTracksToken_; @@ -41,11 +42,13 @@ void GsfElectronCoreEcalDrivenProducer::fillDescriptions(edm::ConfigurationDescr desc.add("gsfTracks", {"electronGsfTracks"}); desc.add("ctfTracks", {"generalTracks"}); desc.add("useGsfPfRecTracks", true); + desc.add("hgcalOnly", false); descriptions.add("ecalDrivenGsfElectronCores", desc); } GsfElectronCoreEcalDrivenProducer::GsfElectronCoreEcalDrivenProducer(const edm::ParameterSet& config) : useGsfPfRecTracks_(config.getParameter("useGsfPfRecTracks")), + hgcalOnly_(config.getParameter("hgcalOnly")), gsfPfRecTracksToken_(mayConsume(config.getParameter("gsfPfRecTracks"))), gsfTracksToken_(consumes(config.getParameter("gsfTracks"))), ctfTracksToken_(consumes(config.getParameter("ctfTracks"))), @@ -74,7 +77,11 @@ void GsfElectronCoreEcalDrivenProducer::produce(edm::StreamID, edm::Event& event auto scRef = gsfTrackRef->extra()->seedRef().castTo()->caloCluster().castTo(); if (!scRef.isNull()) { - eleCore.setSuperCluster(scRef); + // if hgcalOnly flag is true but this seed is not from HGCAL, skip it. + if (hgcalOnly_ && !scRef->seed()->caloID().detector(reco::CaloID::DET_HGCAL_ENDCAP)) + electrons.pop_back(); + else + eleCore.setSuperCluster(scRef); } else { electrons.pop_back(); edm::LogWarning("GsfElectronCoreEcalDrivenProducer") << "Seed CaloCluster is not a SuperCluster, unexpected..."; diff --git a/RecoEgamma/EgammaElectronProducers/python/ecalDrivenElectronSeeds_cff.py b/RecoEgamma/EgammaElectronProducers/python/ecalDrivenElectronSeeds_cff.py index 7ee843514e9e1..144ccfbef43f7 100644 --- a/RecoEgamma/EgammaElectronProducers/python/ecalDrivenElectronSeeds_cff.py +++ b/RecoEgamma/EgammaElectronProducers/python/ecalDrivenElectronSeeds_cff.py @@ -25,6 +25,3 @@ LowPtThreshold =1.0, applyHOverECut = False) -# create ecal driven seeds for electron using HGCal Multiclusters -ecalDrivenElectronSeedsFromMultiCl = ecalDrivenElectronSeeds.clone( - endcapSuperClusters = 'particleFlowSuperClusterHGCalFromMultiCl') diff --git a/RecoEgamma/EgammaElectronProducers/python/ecalDrivenGsfElectronCoresFromMultiCl_cff.py b/RecoEgamma/EgammaElectronProducers/python/ecalDrivenGsfElectronCoresFromMultiCl_cff.py deleted file mode 100644 index dad01b6c2a78a..0000000000000 --- a/RecoEgamma/EgammaElectronProducers/python/ecalDrivenGsfElectronCoresFromMultiCl_cff.py +++ /dev/null @@ -1,6 +0,0 @@ -from RecoEgamma.EgammaElectronProducers.ecalDrivenGsfElectronCores_cfi import ecalDrivenGsfElectronCores - -ecalDrivenGsfElectronCoresFromMultiCl = ecalDrivenGsfElectronCores.clone( - gsfTracks = 'electronGsfTracksFromMultiCl', - useGsfPfRecTracks = False -) diff --git a/RecoEgamma/EgammaElectronProducers/python/ecalDrivenGsfElectronCoresHGC_cff.py b/RecoEgamma/EgammaElectronProducers/python/ecalDrivenGsfElectronCoresHGC_cff.py new file mode 100644 index 0000000000000..b7cbe0f035736 --- /dev/null +++ b/RecoEgamma/EgammaElectronProducers/python/ecalDrivenGsfElectronCoresHGC_cff.py @@ -0,0 +1,7 @@ +from RecoEgamma.EgammaElectronProducers.ecalDrivenGsfElectronCores_cfi import ecalDrivenGsfElectronCores + +ecalDrivenGsfElectronCoresHGC = ecalDrivenGsfElectronCores.clone( + gsfTracks = 'electronGsfTracks', + useGsfPfRecTracks = False, + hgcalOnly = True, +) diff --git a/RecoEgamma/EgammaElectronProducers/python/gsfElectronSequence_cff.py b/RecoEgamma/EgammaElectronProducers/python/gsfElectronSequence_cff.py index d58724b8ec6c5..493fa3cb38296 100644 --- a/RecoEgamma/EgammaElectronProducers/python/gsfElectronSequence_cff.py +++ b/RecoEgamma/EgammaElectronProducers/python/gsfElectronSequence_cff.py @@ -7,16 +7,16 @@ #============================================================================== from RecoEgamma.EgammaElectronProducers.ecalDrivenGsfElectronCores_cfi import ecalDrivenGsfElectronCores -from RecoEgamma.EgammaElectronProducers.ecalDrivenGsfElectronCoresFromMultiCl_cff import ecalDrivenGsfElectronCoresFromMultiCl +from RecoEgamma.EgammaElectronProducers.ecalDrivenGsfElectronCoresHGC_cff import ecalDrivenGsfElectronCoresHGC from RecoEgamma.EgammaElectronProducers.gsfElectrons_cfi import * gsfEcalDrivenElectronTask = cms.Task(ecalDrivenGsfElectronCores,ecalDrivenGsfElectrons) gsfEcalDrivenElectronSequence = cms.Sequence(gsfEcalDrivenElectronTask) -_gsfEcalDrivenElectronTaskFromMultiCl = gsfEcalDrivenElectronTask.copy() -_gsfEcalDrivenElectronTaskFromMultiCl.add(cms.Task(ecalDrivenGsfElectronCoresFromMultiCl,ecalDrivenGsfElectronsFromMultiCl)) +_gsfEcalDrivenElectronTaskHGC = gsfEcalDrivenElectronTask.copy() +_gsfEcalDrivenElectronTaskHGC.add(cms.Task(ecalDrivenGsfElectronCoresHGC,ecalDrivenGsfElectronsHGC)) from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal phase2_hgcal.toReplaceWith( - gsfEcalDrivenElectronTask, _gsfEcalDrivenElectronTaskFromMultiCl + gsfEcalDrivenElectronTask, _gsfEcalDrivenElectronTaskHGC ) diff --git a/RecoEgamma/EgammaElectronProducers/python/gsfElectrons_cfi.py b/RecoEgamma/EgammaElectronProducers/python/gsfElectrons_cfi.py index ca448c2721558..c6b2fb8301fbb 100644 --- a/RecoEgamma/EgammaElectronProducers/python/gsfElectrons_cfi.py +++ b/RecoEgamma/EgammaElectronProducers/python/gsfElectrons_cfi.py @@ -28,8 +28,8 @@ pp_on_AA.toModify(ecalDrivenGsfElectrons.preselection, minSCEtBarrel = 15.0) pp_on_AA.toModify(ecalDrivenGsfElectrons.preselection, minSCEtEndcaps = 15.0) -ecalDrivenGsfElectronsFromMultiCl = ecalDrivenGsfElectrons.clone( - gsfElectronCoresTag = "ecalDrivenGsfElectronCoresFromMultiCl", +ecalDrivenGsfElectronsHGC = ecalDrivenGsfElectrons.clone( + gsfElectronCoresTag = "ecalDrivenGsfElectronCoresHGC", useGsfPfRecTracks = False, useDefaultEnergyCorrection = False, ambClustersOverlapStrategy = 0, diff --git a/RecoEgamma/EgammaElectronProducers/python/lowPtGsfElectronSeeds_cfi.py b/RecoEgamma/EgammaElectronProducers/python/lowPtGsfElectronSeeds_cfi.py index 8b5335af99183..40df81d308f15 100644 --- a/RecoEgamma/EgammaElectronProducers/python/lowPtGsfElectronSeeds_cfi.py +++ b/RecoEgamma/EgammaElectronProducers/python/lowPtGsfElectronSeeds_cfi.py @@ -22,8 +22,8 @@ def thresholds( wp ) : 'ptbiased', ]), ModelWeights = cms.vstring([ - 'RecoEgamma/ElectronIdentification/data/LowPtElectrons/RunII_Autumn18_LowPtElectrons_unbiased.xml.gz', - 'RecoEgamma/ElectronIdentification/data/LowPtElectrons/RunII_Autumn18_LowPtElectrons_displaced_pt_eta_biased.xml.gz', + 'RecoEgamma/ElectronIdentification/data/LowPtElectrons/RunII_Autumn18_LowPtElectrons_unbiased.root', + 'RecoEgamma/ElectronIdentification/data/LowPtElectrons/RunII_Autumn18_LowPtElectrons_displaced_pt_eta_biased.root', ]), ModelThresholds = thresholds("T"), PassThrough = cms.bool(False), diff --git a/RecoEgamma/EgammaElectronProducers/python/uncleanedOnlyElectronSequence_cff.py b/RecoEgamma/EgammaElectronProducers/python/uncleanedOnlyElectronSequence_cff.py index a71676e76e8b1..0f7d3aec0e978 100644 --- a/RecoEgamma/EgammaElectronProducers/python/uncleanedOnlyElectronSequence_cff.py +++ b/RecoEgamma/EgammaElectronProducers/python/uncleanedOnlyElectronSequence_cff.py @@ -135,7 +135,7 @@ # from RecoEgamma.EgammaElectronProducers.ecalDrivenGsfElectronCores_cfi import ecalDrivenGsfElectronCores -from RecoEgamma.EgammaElectronProducers.ecalDrivenGsfElectronCoresFromMultiCl_cff import ecalDrivenGsfElectronCoresFromMultiCl +from RecoEgamma.EgammaElectronProducers.ecalDrivenGsfElectronCoresHGC_cff import ecalDrivenGsfElectronCoresHGC uncleanedOnlyGsfElectronCores = ecalDrivenGsfElectronCores.clone( gsfTracks = "uncleanedOnlyElectronGsfTracks", gsfPfRecTracks = "uncleanedOnlyPfTrackElec" diff --git a/RecoEgamma/EgammaPhotonProducers/python/photonCore_cfi.py b/RecoEgamma/EgammaPhotonProducers/python/photonCore_cfi.py index c5c6e2a4e3051..99cd2a190202b 100644 --- a/RecoEgamma/EgammaPhotonProducers/python/photonCore_cfi.py +++ b/RecoEgamma/EgammaPhotonProducers/python/photonCore_cfi.py @@ -13,12 +13,15 @@ pixelSeedProducer = cms.InputTag('electronMergedSeeds'), minSCEt = cms.double(10.0), risolveConversionAmbiguity = cms.bool(True), + endcapOnly = cms.bool(False), # MVA_weights_location = cms.string('RecoEgamma/EgammaTools/data/TMVAnalysis_Likelihood.weights.txt') ) -photonCoreFromMultiCl = photonCore.clone( - scIslandEndcapProducer = 'particleFlowSuperClusterHGCalFromMultiCl', - pixelSeedProducer = 'electronMergedSeedsFromMultiCl' +photonCoreHGC = photonCore.clone( + scHybridBarrelProducer = "", + scIslandEndcapProducer = 'particleFlowSuperClusterHGCal', + pixelSeedProducer = 'electronMergedSeeds', + endcapOnly = True, ) islandPhotonCore = photonCore.clone( diff --git a/RecoEgamma/EgammaPhotonProducers/python/photonSequence_cff.py b/RecoEgamma/EgammaPhotonProducers/python/photonSequence_cff.py index 054db4642bf36..c430ec1637114 100644 --- a/RecoEgamma/EgammaPhotonProducers/python/photonSequence_cff.py +++ b/RecoEgamma/EgammaPhotonProducers/python/photonSequence_cff.py @@ -10,15 +10,15 @@ photonTask = cms.Task(photonCore,photons) photonSequence = cms.Sequence(photonTask) -_photonTaskFromMultiCl = photonTask.copy() -_photonTaskFromMultiCl.add(photonCoreFromMultiCl,photonsFromMultiCl) +_photonTaskHGC = photonTask.copy() +_photonTaskHGC.add(photonCoreHGC,photonsHGC) _photonTaskWithIsland = photonTask.copy() _photonTaskWithIsland.add(islandPhotonCore,islandPhotons) from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal phase2_hgcal.toReplaceWith( - photonTask, _photonTaskFromMultiCl + photonTask, _photonTaskHGC ) from Configuration.Eras.Modifier_pA_2016_cff import pA_2016 diff --git a/RecoEgamma/EgammaPhotonProducers/python/photons_cfi.py b/RecoEgamma/EgammaPhotonProducers/python/photons_cfi.py index 8cafe88ed80e5..85b4699c819c9 100644 --- a/RecoEgamma/EgammaPhotonProducers/python/photons_cfi.py +++ b/RecoEgamma/EgammaPhotonProducers/python/photons_cfi.py @@ -88,8 +88,8 @@ checkHcalStatus = cms.bool(True) ) -photonsFromMultiCl = photons.clone( - photonProducer = 'photonCoreFromMultiCl' +photonsHGC = photons.clone( + photonProducer = 'photonCoreHGC' ) islandPhotons = cms.EDProducer("PhotonProducer", diff --git a/RecoEgamma/EgammaPhotonProducers/src/PhotonCoreProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/PhotonCoreProducer.cc index 3439226a443cd..e53d164c8dcdb 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/PhotonCoreProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/PhotonCoreProducer.cc @@ -55,6 +55,7 @@ class PhotonCoreProducer : public edm::stream::EDProducer<> { edm::ParameterSet conf_; bool validPixelSeeds_; bool risolveAmbiguity_; + bool endcapOnly_; }; #include "FWCore/Framework/interface/MakerMacros.h" @@ -74,6 +75,7 @@ PhotonCoreProducer::PhotonCoreProducer(const edm::ParameterSet& config) pixelSeedProducer_ = consumes(conf_.getParameter("pixelSeedProducer")); minSCEt_ = conf_.getParameter("minSCEt"); risolveAmbiguity_ = conf_.getParameter("risolveConversionAmbiguity"); + endcapOnly_ = conf_.getParameter("endcapOnly"); // Register the product produces(PhotonCoreCollection_); @@ -90,9 +92,13 @@ void PhotonCoreProducer::produce(edm::Event& theEvent, const edm::EventSetup& th // Get the Barrel Super Cluster collection bool validBarrelSCHandle = true; + if (endcapOnly_) { + validBarrelSCHandle = false; + } + Handle scBarrelHandle; theEvent.getByToken(scHybridBarrelProducer_, scBarrelHandle); - if (!scBarrelHandle.isValid()) { + if (!endcapOnly_ && !scBarrelHandle.isValid()) { edm::LogError("PhotonCoreProducer") << "Error! Can't get the scHybridBarrelProducer"; validBarrelSCHandle = false; } diff --git a/RecoEgamma/EgammaTools/plugins/HGCalElectronFilter.cc b/RecoEgamma/EgammaTools/plugins/HGCalElectronFilter.cc index 9951f4d14f361..e63b93ffa9552 100644 --- a/RecoEgamma/EgammaTools/plugins/HGCalElectronFilter.cc +++ b/RecoEgamma/EgammaTools/plugins/HGCalElectronFilter.cc @@ -113,12 +113,12 @@ void HGCalElectronFilter::endStream() {} // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ void HGCalElectronFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - // cleanedEcalDrivenGsfElectronsFromMultiCl + // cleanedEcalDrivenGsfElectronsHGC edm::ParameterSetDescription desc; - desc.add("inputGsfElectrons", edm::InputTag("ecalDrivenGsfElectronsFromMultiCl")); + desc.add("inputGsfElectrons", edm::InputTag("ecalDrivenGsfElectronsHGC")); desc.add("cleanBarrel", false); desc.add("outputCollection", ""); - descriptions.add("cleanedEcalDrivenGsfElectronsFromMultiCl", desc); + descriptions.add("cleanedEcalDrivenGsfElectronsHGC", desc); } //define this as a plug-in diff --git a/RecoEgamma/EgammaTools/plugins/HGCalElectronIDValueMapProducer.cc b/RecoEgamma/EgammaTools/plugins/HGCalElectronIDValueMapProducer.cc index 0d7f8fe9aa6a8..fa27b01ef9de6 100644 --- a/RecoEgamma/EgammaTools/plugins/HGCalElectronIDValueMapProducer.cc +++ b/RecoEgamma/EgammaTools/plugins/HGCalElectronIDValueMapProducer.cc @@ -220,7 +220,7 @@ void HGCalElectronIDValueMapProducer::endStream() {} void HGCalElectronIDValueMapProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { // Auto-generate hgcalElectronIDValueMap_cfi edm::ParameterSetDescription desc; - desc.add("electrons", edm::InputTag("ecalDrivenGsfElectronsFromMultiCl")); + desc.add("electrons", edm::InputTag("ecalDrivenGsfElectronsHGC")); desc.add("pcaRadius", 3.0); desc.add>("variables", valuesProduced_); desc.add>("dEdXWeights") diff --git a/RecoEgamma/EgammaTools/plugins/HGCalPhotonIDValueMapProducer.cc b/RecoEgamma/EgammaTools/plugins/HGCalPhotonIDValueMapProducer.cc index f82e76ef29ee6..5f1f05c527475 100644 --- a/RecoEgamma/EgammaTools/plugins/HGCalPhotonIDValueMapProducer.cc +++ b/RecoEgamma/EgammaTools/plugins/HGCalPhotonIDValueMapProducer.cc @@ -204,7 +204,7 @@ void HGCalPhotonIDValueMapProducer::endStream() {} void HGCalPhotonIDValueMapProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { // hgcalPhotonIDValueMap edm::ParameterSetDescription desc; - desc.add("photons", edm::InputTag("photonsFromMultiCl")); + desc.add("photons", edm::InputTag("photonsHGC")); desc.add("pcaRadius", 3.0); desc.add>("variables", valuesProduced_); desc.add>("dEdXWeights") diff --git a/RecoEgamma/EgammaTools/python/slimmedEgammaFromMultiCl_cff.py b/RecoEgamma/EgammaTools/python/slimmedEgammaHGC_cff.py similarity index 70% rename from RecoEgamma/EgammaTools/python/slimmedEgammaFromMultiCl_cff.py rename to RecoEgamma/EgammaTools/python/slimmedEgammaHGC_cff.py index 5e4250e6bcf22..22cb1c51deea2 100644 --- a/RecoEgamma/EgammaTools/python/slimmedEgammaFromMultiCl_cff.py +++ b/RecoEgamma/EgammaTools/python/slimmedEgammaHGC_cff.py @@ -1,16 +1,16 @@ import FWCore.ParameterSet.Config as cms -from RecoEgamma.EgammaTools.cleanedEcalDrivenGsfElectronsFromMultiCl_cfi import cleanedEcalDrivenGsfElectronsFromMultiCl +from RecoEgamma.EgammaTools.cleanedEcalDrivenGsfElectronsHGC_cfi import cleanedEcalDrivenGsfElectronsHGC from RecoEgamma.EgammaTools.hgcalElectronIDValueMap_cff import hgcalElectronIDValueMap from PhysicsTools.PatAlgos.PATElectronProducer_cfi import PATElectronProducer from PhysicsTools.PatAlgos.slimming.slimmedElectrons_cfi import slimmedElectrons from RecoLocalCalo.HGCalRecProducers.hgcalRecHitMapProducer_cfi import hgcalRecHitMapProducer hgcElectronID = hgcalElectronIDValueMap.clone( - electrons = "cleanedEcalDrivenGsfElectronsFromMultiCl", + electrons = "cleanedEcalDrivenGsfElectronsHGC", ) -patElectronsFromMultiCl = PATElectronProducer.clone( - electronSource = "cleanedEcalDrivenGsfElectronsFromMultiCl", +patElectronsHGC = PATElectronProducer.clone( + electronSource = "cleanedEcalDrivenGsfElectronsHGC", beamLineSrc = "offlineBeamSpot", pvSrc = "offlinePrimaryVertices", addElectronID = False, @@ -41,23 +41,23 @@ userFunctionLabels = cms.vstring() ), ) -selectedPatElectronsFromMultiCl = cms.EDFilter("PATElectronSelector", - src = cms.InputTag("patElectronsFromMultiCl"), +selectedPatElectronsHGC = cms.EDFilter("PATElectronSelector", + src = cms.InputTag("patElectronsHGC"), cut = cms.string("!isEB && pt >= 10."), ) -slimmedElectronsFromMultiCl = slimmedElectrons.clone( - src = "selectedPatElectronsFromMultiCl", +slimmedElectronsHGC = slimmedElectrons.clone( + src = "selectedPatElectronsHGC", linkToPackedPFCandidates = False, saveNonZSClusterShapes = "0", modifyElectrons = False, ) -slimmedElectronsFromMultiClTask = cms.Task( - cleanedEcalDrivenGsfElectronsFromMultiCl, +slimmedElectronsHGCTask = cms.Task( + cleanedEcalDrivenGsfElectronsHGC, hgcElectronID, - patElectronsFromMultiCl, - selectedPatElectronsFromMultiCl, - slimmedElectronsFromMultiCl + patElectronsHGC, + selectedPatElectronsHGC, + slimmedElectronsHGC ) @@ -67,9 +67,9 @@ hgcPhotonID = hgcalPhotonIDValueMap.clone() -patPhotonsFromMultiCl = PATPhotonProducer.clone( - photonSource = "photonsFromMultiCl", - electronSource = "ecalDrivenGsfElectronsFromMultiCl", +patPhotonsHGC = PATPhotonProducer.clone( + photonSource = "photonsHGC", + electronSource = "ecalDrivenGsfElectronsHGC", beamLineSrc = "offlineBeamSpot", addPhotonID = False, addGenMatch = False, @@ -92,26 +92,26 @@ userFunctionLabels = cms.vstring() ), ) -selectedPatPhotonsFromMultiCl = cms.EDFilter("PATPhotonSelector", - src = cms.InputTag("patPhotonsFromMultiCl"), +selectedPatPhotonsHGC = cms.EDFilter("PATPhotonSelector", + src = cms.InputTag("patPhotonsHGC"), cut = cms.string("!isEB && pt >= 15."), ) -slimmedPhotonsFromMultiCl = slimmedPhotons.clone( - src = "selectedPatPhotonsFromMultiCl", +slimmedPhotonsHGC = slimmedPhotons.clone( + src = "selectedPatPhotonsHGC", linkToPackedPFCandidates = False, saveNonZSClusterShapes = "0", modifyPhotons = False, ) -slimmedPhotonsFromMultiClTask = cms.Task( +slimmedPhotonsHGCTask = cms.Task( hgcPhotonID, - patPhotonsFromMultiCl, - selectedPatPhotonsFromMultiCl, - slimmedPhotonsFromMultiCl + patPhotonsHGC, + selectedPatPhotonsHGC, + slimmedPhotonsHGC ) -slimmedEgammaFromMultiClTask = cms.Task( +slimmedEgammaHGCTask = cms.Task( hgcalRecHitMapProducer, - slimmedElectronsFromMultiClTask, - slimmedPhotonsFromMultiClTask + slimmedElectronsHGCTask, + slimmedPhotonsHGCTask ) diff --git a/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py b/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py index 57078ce78c168..6015291e69ab9 100644 --- a/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py +++ b/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py @@ -28,6 +28,7 @@ TICL_FEVT = cms.PSet( outputCommands = cms.untracked.vstring( 'keep *_ticlSimTracksters_*_*', + 'keep *_ticlSimTrackstersFromCP_*_*', ) ) TICL_FEVT.outputCommands.extend(TICL_RECO.outputCommands) diff --git a/RecoHGCal/TICL/interface/commons.h b/RecoHGCal/TICL/interface/commons.h new file mode 100644 index 0000000000000..415d852fc0dfe --- /dev/null +++ b/RecoHGCal/TICL/interface/commons.h @@ -0,0 +1,73 @@ +#ifndef RecoHGCal_TICL_interface_commons_h +#define RecoHGCal_TICL_interface_commons_h +#include +#include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h" +#include "DataFormats/HGCalReco/interface/Trackster.h" + +namespace ticl { + + inline Trackster::ParticleType tracksterParticleTypeFromPdgId(int pdgId, int charge) { + if (pdgId == 111) { + return Trackster::ParticleType::neutral_pion; + } else { + pdgId = std::abs(pdgId); + if (pdgId == 22) { + return Trackster::ParticleType::photon; + } else if (pdgId == 11) { + return Trackster::ParticleType::electron; + } else if (pdgId == 13) { + return Trackster::ParticleType::muon; + } else { + bool isHadron = (pdgId > 100 and pdgId < 900) or (pdgId > 1000 and pdgId < 9000); + if (isHadron) { + if (charge != 0) { + return Trackster::ParticleType::charged_hadron; + } else { + return Trackster::ParticleType::neutral_hadron; + } + } else { + return Trackster::ParticleType::unknown; + } + } + } + } + + static void addTrackster( + const int& index, + const std::vector, std::pair>>& lcVec, + const std::vector& inputClusterMask, + const float& fractionCut_, + const float& energy, + const int& pdgId, + const int& charge, + const edm::ProductID& seed, + std::vector& output_mask, + std::vector& result) { + if (lcVec.empty()) + return; + + Trackster tmpTrackster; + tmpTrackster.zeroProbabilities(); + tmpTrackster.vertices().reserve(lcVec.size()); + tmpTrackster.vertex_multiplicity().reserve(lcVec.size()); + for (auto const& [lc, energyScorePair] : lcVec) { + if (inputClusterMask[lc.index()] > 0) { + double fraction = energyScorePair.first / lc->energy(); + if (fraction < fractionCut_) + continue; + tmpTrackster.vertices().push_back(lc.index()); + output_mask[lc.index()] -= fraction; + tmpTrackster.vertex_multiplicity().push_back(1. / fraction); + } + } + + tmpTrackster.setIdProbability(tracksterParticleTypeFromPdgId(pdgId, charge), 1.f); + tmpTrackster.setRegressedEnergy(energy); + tmpTrackster.setSeed(seed, index); + result.emplace_back(tmpTrackster); + } + +} // namespace ticl + +#endif diff --git a/RecoHGCal/TICL/plugins/TrackstersFromCaloParticlesProducer.cc b/RecoHGCal/TICL/plugins/TrackstersFromCaloParticlesProducer.cc new file mode 100644 index 0000000000000..7d8cfef261f1d --- /dev/null +++ b/RecoHGCal/TICL/plugins/TrackstersFromCaloParticlesProducer.cc @@ -0,0 +1,123 @@ +// Author: Leonardo Cristella - leonardo.cristella@cern.ch +// Date: 08/2021 + +// user include files + +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" + +#include "DataFormats/CaloRecHit/interface/CaloCluster.h" +#include "DataFormats/ParticleFlowReco/interface/PFCluster.h" + +#include "DataFormats/HGCalReco/interface/Trackster.h" + +#include "DataFormats/Common/interface/ValueMap.h" +#include "SimDataFormats/Associations/interface/LayerClusterToCaloParticleAssociator.h" + +#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" +#include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" + +#include "RecoHGCal/TICL/interface/commons.h" + +#include "TrackstersPCA.h" +#include +#include +#include + +using namespace ticl; + +class TrackstersFromCaloParticlesProducer : public edm::stream::EDProducer<> { +public: + explicit TrackstersFromCaloParticlesProducer(const edm::ParameterSet&); + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + void produce(edm::Event&, const edm::EventSetup&) override; + +private: + std::string detector_; + const bool doNose_ = false; + const edm::EDGetTokenT> clusters_token_; + const edm::EDGetTokenT>> clustersTime_token_; + const edm::EDGetTokenT> filtered_layerclusters_mask_token_; + + const edm::EDGetTokenT> caloparticles_token_; + + const edm::EDGetTokenT associatorMapCaloParticleToReco_token_; + const edm::ESGetToken geom_token_; + hgcal::RecHitTools rhtools_; + const double fractionCut_; +}; +DEFINE_FWK_MODULE(TrackstersFromCaloParticlesProducer); + +TrackstersFromCaloParticlesProducer::TrackstersFromCaloParticlesProducer(const edm::ParameterSet& ps) + : detector_(ps.getParameter("detector")), + doNose_(detector_ == "HFNose"), + clusters_token_(consumes(ps.getParameter("layer_clusters"))), + clustersTime_token_(consumes(ps.getParameter("time_layerclusters"))), + filtered_layerclusters_mask_token_(consumes(ps.getParameter("filtered_mask"))), + caloparticles_token_(consumes(ps.getParameter("caloparticles"))), + associatorMapCaloParticleToReco_token_(consumes(ps.getParameter("associator"))), + geom_token_(esConsumes()), + fractionCut_(ps.getParameter("fractionCut")) { + produces>(); + produces>(); +} + +void TrackstersFromCaloParticlesProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("detector", "HGCAL"); + desc.add("layer_clusters", edm::InputTag("hgcalLayerClusters")); + desc.add("time_layerclusters", edm::InputTag("hgcalLayerClusters", "timeLayerCluster")); + desc.add("filtered_mask", edm::InputTag("filteredLayerClustersSimTracksters", "ticlSimTracksters")); + desc.add("caloparticles", edm::InputTag("mix", "MergedCaloTruth")); + desc.add("associator", edm::InputTag("layerClusterCaloParticleAssociationProducer")); + desc.add("fractionCut", 0.); + + descriptions.addWithDefaultLabel(desc); +} + +void TrackstersFromCaloParticlesProducer::produce(edm::Event& evt, const edm::EventSetup& es) { + auto result = std::make_unique>(); + auto output_mask = std::make_unique>(); + const auto& layerClusters = evt.get(clusters_token_); + const auto& layerClustersTimes = evt.get(clustersTime_token_); + const auto& inputClusterMask = evt.get(filtered_layerclusters_mask_token_); + output_mask->resize(layerClusters.size(), 1.f); + + const auto& caloparticles = evt.get(caloparticles_token_); + + const auto& caloParticlesToRecoColl = evt.get(associatorMapCaloParticleToReco_token_); + + const auto& geom = es.getData(geom_token_); + rhtools_.setGeometry(geom); + result->reserve(caloparticles.size()); + + for (const auto& [key, values] : caloParticlesToRecoColl) { + auto const& cp = *(key); + auto cpIndex = &cp - &caloparticles[0]; + + addTrackster(cpIndex, + values, + inputClusterMask, + fractionCut_, + cp.g4Tracks()[0].getMomentumAtBoundary().energy(), + cp.pdgId(), + cp.charge(), + key.id(), + *output_mask, + *result); + } + + ticl::assignPCAtoTracksters( + *result, layerClusters, layerClustersTimes, rhtools_.getPositionLayer(rhtools_.lastLayerEE(doNose_)).z()); + result->shrink_to_fit(); + + evt.put(std::move(result)); + evt.put(std::move(output_mask)); +} diff --git a/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc b/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc index 454f14ebbcae2..711def949d955 100644 --- a/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc +++ b/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc @@ -25,44 +25,18 @@ #include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" +#include "RecoHGCal/TICL/interface/commons.h" + #include "TrackstersPCA.h" #include #include #include -using namespace ticl; -namespace { - Trackster::ParticleType tracksterParticleTypeFromPdgId(int pdgId, int charge) { - if (pdgId == 111) { - return Trackster::ParticleType::neutral_pion; - } else { - pdgId = std::abs(pdgId); - if (pdgId == 22) { - return Trackster::ParticleType::photon; - } else if (pdgId == 11) { - return Trackster::ParticleType::electron; - } else if (pdgId == 13) { - return Trackster::ParticleType::muon; - } else { - bool isHadron = (pdgId > 100 and pdgId < 900) or (pdgId > 1000 and pdgId < 9000); - if (isHadron) { - if (charge != 0) { - return Trackster::ParticleType::charged_hadron; - } else { - return Trackster::ParticleType::neutral_hadron; - } - } else { - return Trackster::ParticleType::unknown; - } - } - } - } -} // namespace +using namespace ticl; class TrackstersFromSimClustersProducer : public edm::stream::EDProducer<> { public: explicit TrackstersFromSimClustersProducer(const edm::ParameterSet&); - ~TrackstersFromSimClustersProducer() override {} static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); void produce(edm::Event&, const edm::EventSetup&) override; @@ -74,14 +48,12 @@ class TrackstersFromSimClustersProducer : public edm::stream::EDProducer<> { const edm::EDGetTokenT>> clustersTime_token_; const edm::EDGetTokenT> filtered_layerclusters_mask_token_; - edm::EDGetTokenT> simclusters_token_; - edm::EDGetTokenT> caloparticles_token_; + const edm::EDGetTokenT> simclusters_token_; + const edm::EDGetTokenT> caloparticles_token_; - edm::InputTag associatorLayerClusterSimCluster_; - edm::EDGetTokenT associatorMapSimClusterToReco_token_; - edm::InputTag associatorLayerClusterCaloParticle_; - edm::EDGetTokenT associatorMapCaloParticleToReco_token_; - edm::ESGetToken geom_token_; + const edm::EDGetTokenT associatorMapSimClusterToReco_token_; + const edm::EDGetTokenT associatorMapCaloParticleToReco_token_; + const edm::ESGetToken geom_token_; hgcal::RecHitTools rhtools_; const double fractionCut_; }; @@ -90,18 +62,15 @@ DEFINE_FWK_MODULE(TrackstersFromSimClustersProducer); TrackstersFromSimClustersProducer::TrackstersFromSimClustersProducer(const edm::ParameterSet& ps) : detector_(ps.getParameter("detector")), doNose_(detector_ == "HFNose"), - clusters_token_(consumes>(ps.getParameter("layer_clusters"))), - clustersTime_token_( - consumes>>(ps.getParameter("time_layerclusters"))), - filtered_layerclusters_mask_token_(consumes>(ps.getParameter("filtered_mask"))), - simclusters_token_(consumes>(ps.getParameter("simclusters"))), - caloparticles_token_(consumes>(ps.getParameter("caloparticles"))), - associatorLayerClusterSimCluster_(ps.getUntrackedParameter("layerClusterSimClusterAssociator")), + clusters_token_(consumes(ps.getParameter("layer_clusters"))), + clustersTime_token_(consumes(ps.getParameter("time_layerclusters"))), + filtered_layerclusters_mask_token_(consumes(ps.getParameter("filtered_mask"))), + simclusters_token_(consumes(ps.getParameter("simclusters"))), + caloparticles_token_(consumes(ps.getParameter("caloparticles"))), associatorMapSimClusterToReco_token_( - consumes(associatorLayerClusterSimCluster_)), - associatorLayerClusterCaloParticle_( - ps.getUntrackedParameter("layerClusterCaloParticleAssociator")), - associatorMapCaloParticleToReco_token_(consumes(associatorLayerClusterCaloParticle_)), + consumes(ps.getParameter("layerClusterSimClusterAssociator"))), + associatorMapCaloParticleToReco_token_( + consumes(ps.getParameter("layerClusterCaloParticleAssociator"))), geom_token_(esConsumes()), fractionCut_(ps.getParameter("fractionCut")) { produces>(); @@ -117,13 +86,13 @@ void TrackstersFromSimClustersProducer::fillDescriptions(edm::ConfigurationDescr desc.add("filtered_mask", edm::InputTag("filteredLayerClustersSimTracksters", "ticlSimTracksters")); desc.add("simclusters", edm::InputTag("mix", "MergedCaloTruth")); desc.add("caloparticles", edm::InputTag("mix", "MergedCaloTruth")); - desc.addUntracked("layerClusterSimClusterAssociator", - edm::InputTag("layerClusterSimClusterAssociationProducer")); - desc.addUntracked("layerClusterCaloParticleAssociator", - edm::InputTag("layerClusterCaloParticleAssociationProducer")); + desc.add("layerClusterSimClusterAssociator", + edm::InputTag("layerClusterSimClusterAssociationProducer")); + desc.add("layerClusterCaloParticleAssociator", + edm::InputTag("layerClusterCaloParticleAssociationProducer")); desc.add("fractionCut", 0.); - descriptions.add("trackstersFromSimClustersProducer", desc); + descriptions.addWithDefaultLabel(desc); } void TrackstersFromSimClustersProducer::produce(edm::Event& evt, const edm::EventSetup& es) { @@ -145,62 +114,40 @@ void TrackstersFromSimClustersProducer::produce(edm::Event& evt, const edm::Even auto num_simclusters = simclusters.size(); result->reserve(num_simclusters); - for (const auto& [key, values] : caloParticlesToRecoColl) { + for (const auto& [key, lcVec] : caloParticlesToRecoColl) { auto const& cp = *(key); auto cpIndex = &cp - &caloparticles[0]; if (cp.g4Tracks()[0].crossedBoundary()) { - if (values.empty()) - continue; - Trackster tmpTrackster; - tmpTrackster.zeroProbabilities(); - tmpTrackster.vertices().reserve(values.size()); - tmpTrackster.vertex_multiplicity().reserve(values.size()); - for (auto const& [lc, energyScorePair] : values) { - if (inputClusterMask[lc.index()] > 0) { - double fraction = energyScorePair.first / lc->energy(); - if (fraction < fractionCut_) - continue; - tmpTrackster.vertices().push_back(lc.index()); - (*output_mask)[lc.index()] -= fraction; - tmpTrackster.vertex_multiplicity().push_back(1. / fraction); - } - } - tmpTrackster.setIdProbability(tracksterParticleTypeFromPdgId(cp.pdgId(), cp.charge()), 1.f); - float energyAtBoundary = cp.g4Tracks()[0].getMomentumAtBoundary().energy(); - tmpTrackster.setRegressedEnergy(energyAtBoundary); - tmpTrackster.setSeed(key.id(), cpIndex); - result->emplace_back(tmpTrackster); + addTrackster(cpIndex, + lcVec, + inputClusterMask, + fractionCut_, + cp.g4Tracks()[0].getMomentumAtBoundary().energy(), + cp.pdgId(), + cp.charge(), + key.id(), + *output_mask, + *result); + } else { for (const auto& scRef : cp.simClusters()) { const auto& it = simClustersToRecoColl.find(scRef); if (it == simClustersToRecoColl.end()) continue; const auto& lcVec = it->val; - if (lcVec.empty()) - continue; auto const& sc = *(scRef); - auto simClusterIndex = &sc - &simclusters[0]; - Trackster tmpTrackster; - - tmpTrackster.zeroProbabilities(); - tmpTrackster.vertices().reserve(lcVec.size()); - tmpTrackster.vertex_multiplicity().reserve(lcVec.size()); - - for (auto const& [lc, energyScorePair] : lcVec) { - if (inputClusterMask[lc.index()] > 0) { - double fraction = energyScorePair.first / lc->energy(); - if (fraction < fractionCut_) - continue; - tmpTrackster.vertices().push_back(lc.index()); - (*output_mask)[lc.index()] -= fraction; - tmpTrackster.vertex_multiplicity().push_back(1. / fraction); - } - } - tmpTrackster.setIdProbability(tracksterParticleTypeFromPdgId(sc.pdgId(), sc.charge()), 1.f); - float energyAtBoundary = sc.g4Tracks()[0].getMomentumAtBoundary().energy(); - tmpTrackster.setRegressedEnergy(energyAtBoundary); - tmpTrackster.setSeed(scRef.id(), simClusterIndex); - result->emplace_back(tmpTrackster); + auto const scIndex = &sc - &simclusters[0]; + + addTrackster(scIndex, + lcVec, + inputClusterMask, + fractionCut_, + sc.g4Tracks()[0].getMomentumAtBoundary().energy(), + sc.pdgId(), + sc.charge(), + scRef.id(), + *output_mask, + *result); } } } diff --git a/RecoHGCal/TICL/plugins/TrackstersProducer.cc b/RecoHGCal/TICL/plugins/TrackstersProducer.cc index 70109ea1a3ded..955af3572dc95 100644 --- a/RecoHGCal/TICL/plugins/TrackstersProducer.cc +++ b/RecoHGCal/TICL/plugins/TrackstersProducer.cc @@ -55,7 +55,7 @@ class TrackstersProducer : public edm::stream::EDProducer layer_clusters_tiles_hfnose_token_; const edm::EDGetTokenT> seeding_regions_token_; const std::string itername_; - ticl::Trackster::IterationIndex iterIndex_; + ticl::Trackster::IterationIndex iterIndex_ = ticl::Trackster::IterationIndex(0); }; DEFINE_FWK_MODULE(TrackstersProducer); diff --git a/RecoHGCal/TICL/python/SimTracksters_cff.py b/RecoHGCal/TICL/python/SimTracksters_cff.py index 7951277a710e2..cfee090998a9b 100644 --- a/RecoHGCal/TICL/python/SimTracksters_cff.py +++ b/RecoHGCal/TICL/python/SimTracksters_cff.py @@ -1,6 +1,7 @@ import FWCore.ParameterSet.Config as cms from RecoHGCal.TICL.trackstersFromSimClustersProducer_cfi import trackstersFromSimClustersProducer as _trackstersFromSimClustersProducer +from RecoHGCal.TICL.trackstersFromCaloParticlesProducer_cfi import trackstersFromCaloParticlesProducer as _trackstersFromCaloParticlesProducer from RecoHGCal.TICL.filteredLayerClustersProducer_cfi import filteredLayerClustersProducer as _filteredLayerClustersProducer @@ -16,11 +17,16 @@ ticlSimTracksters = _trackstersFromSimClustersProducer.clone( ) +ticlSimTrackstersFromCP = _trackstersFromCaloParticlesProducer.clone( +) from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 premix_stage2.toModify(ticlSimTracksters, simclusters = "mixData:MergedCaloTruth", caloparticles = "mixData:MergedCaloTruth", ) +premix_stage2.toModify(ticlSimTrackstersFromCP, + caloparticles = "mixData:MergedCaloTruth", +) -ticlSimTrackstersTask = cms.Task(filteredLayerClustersSimTracksters, ticlSimTracksters) +ticlSimTrackstersTask = cms.Task(filteredLayerClustersSimTracksters, ticlSimTracksters, ticlSimTrackstersFromCP) diff --git a/RecoHI/HiEgammaAlgos/plugins/HiEgammaSCCorrectionMaker.cc b/RecoHI/HiEgammaAlgos/plugins/HiEgammaSCCorrectionMaker.cc index d8c6ea12ee64e..3692831f547ea 100644 --- a/RecoHI/HiEgammaAlgos/plugins/HiEgammaSCCorrectionMaker.cc +++ b/RecoHI/HiEgammaAlgos/plugins/HiEgammaSCCorrectionMaker.cc @@ -21,7 +21,8 @@ #include -HiEgammaSCCorrectionMaker::HiEgammaSCCorrectionMaker(const edm::ParameterSet& ps) { +HiEgammaSCCorrectionMaker::HiEgammaSCCorrectionMaker(const edm::ParameterSet& ps) + : geoToken_(esConsumes()), topologyToken_(esConsumes()) { // The verbosity level std::string debugString = ps.getParameter("VerbosityLevel"); if (debugString == "DEBUG") @@ -80,14 +81,10 @@ void HiEgammaSCCorrectionMaker::produce(edm::Event& evt, const edm::EventSetup& using namespace edm; // get the collection geometry: - edm::ESHandle geoHandle; - es.get().get(geoHandle); - const CaloGeometry& geometry = *geoHandle; + const CaloGeometry& geometry = es.getData(geoToken_); const CaloSubdetectorGeometry* geometry_p; - edm::ESHandle pTopology; - es.get().get(theCaloTopo_); - const CaloTopology& topology = *theCaloTopo_; + const CaloTopology& topology = es.getData(topologyToken_); std::string rHInputCollection = rHInputProducerTag_.instance(); if (rHInputCollection == "EcalRecHitsEB") { diff --git a/RecoHI/HiEgammaAlgos/plugins/HiEgammaSCCorrectionMaker.h b/RecoHI/HiEgammaAlgos/plugins/HiEgammaSCCorrectionMaker.h index d6d4490bf8952..773ee33bb274a 100644 --- a/RecoHI/HiEgammaAlgos/plugins/HiEgammaSCCorrectionMaker.h +++ b/RecoHI/HiEgammaAlgos/plugins/HiEgammaSCCorrectionMaker.h @@ -58,9 +58,10 @@ class HiEgammaSCCorrectionMaker : public edm::stream::EDProducer<> { edm::InputTag sCInputProducerTag_; edm::EDGetTokenT rHInputProducer_; edm::EDGetTokenT sCInputProducer_; + edm::ESGetToken geoToken_; + edm::ESGetToken topologyToken_; reco::CaloCluster::AlgoId sCAlgo_; std::string outputCollection_; - edm::ESHandle theCaloTopo_; }; #endif diff --git a/RecoHI/HiEgammaAlgos/plugins/HiSpikeCleaner.cc b/RecoHI/HiEgammaAlgos/plugins/HiSpikeCleaner.cc index 8424f4e0d8d77..861b0cdd752c1 100644 --- a/RecoHI/HiEgammaAlgos/plugins/HiSpikeCleaner.cc +++ b/RecoHI/HiEgammaAlgos/plugins/HiSpikeCleaner.cc @@ -23,7 +23,6 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -56,6 +55,7 @@ class HiSpikeCleaner : public edm::stream::EDProducer<> { edm::EDGetTokenT sCInputProducerToken_; edm::EDGetTokenT rHInputProducerBToken_; edm::EDGetTokenT rHInputProducerEToken_; + edm::ESGetToken ecalSevLvlAlgoToken_; const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_; std::string outputCollection_; @@ -64,7 +64,8 @@ class HiSpikeCleaner : public edm::stream::EDProducer<> { double etCut_; }; -HiSpikeCleaner::HiSpikeCleaner(const edm::ParameterSet& iConfig) : ecalClusterToolsESGetTokens_{consumesCollector()} { +HiSpikeCleaner::HiSpikeCleaner(const edm::ParameterSet& iConfig) + : ecalSevLvlAlgoToken_(esConsumes()), ecalClusterToolsESGetTokens_{consumesCollector()} { //register your products /* Examples produces(); @@ -102,34 +103,21 @@ void HiSpikeCleaner::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) // Get raw SuperClusters from the event Handle pRawSuperClusters; - try { - iEvent.getByToken(sCInputProducerToken_, pRawSuperClusters); - } catch (cms::Exception& ex) { - edm::LogError("EgammaSCCorrectionMakerError") << "Error! can't get the rawSuperClusters "; - } + iEvent.getByToken(sCInputProducerToken_, pRawSuperClusters); // Get the RecHits from the event Handle pRecHitsB; - try { - iEvent.getByToken(rHInputProducerBToken_, pRecHitsB); - } catch (cms::Exception& ex) { - edm::LogError("EgammaSCCorrectionMakerError") << "Error! can't get the RecHits "; - } + iEvent.getByToken(rHInputProducerBToken_, pRecHitsB); // Get the RecHits from the event Handle pRecHitsE; - try { - iEvent.getByToken(rHInputProducerEToken_, pRecHitsE); - } catch (cms::Exception& ex) { - edm::LogError("EgammaSCCorrectionMakerError") << "Error! can't get the RecHits "; - } + iEvent.getByToken(rHInputProducerEToken_, pRecHitsE); // get the channel status from the DB // edm::ESHandle chStatus; // iSetup.get().get(chStatus); - edm::ESHandle ecalSevLvlAlgoHndl; - iSetup.get().get(ecalSevLvlAlgoHndl); + auto const& ecalSevLvlAlgo = iSetup.getData(ecalSevLvlAlgoToken_); // Create a pointer to the RecHits and raw SuperClusters const reco::SuperClusterCollection* rawClusters = pRawSuperClusters.product(); @@ -158,7 +146,7 @@ void HiSpikeCleaner::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) EcalRecHitCollection::const_iterator it = rechits.find(id); if (it != rechits.end()) { - ecalSevLvlAlgoHndl->severityLevel(id, rechits); + ecalSevLvlAlgo.severityLevel(id, rechits); swissCrx = EcalTools::swissCross(id, rechits, 0., true); // std::cout << "swissCross = " << swissCrx < flatparmsDB_, HiEvtPlaneFlatten** flat) { + explicit LoadEPDB(const RPFlatParams& flatparmsDB_, HiEvtPlaneFlatten** flat) { int Hbins; int Obins; - int flatTableSize = flatparmsDB_->m_table.size(); + int flatTableSize = flatparmsDB_.m_table.size(); genFlatPsi_ = kTRUE; if (flatTableSize < flat[0]->getHBins() + 2 * flat[0]->getOBins()) { genFlatPsi_ = kFALSE; @@ -39,7 +32,7 @@ class LoadEPDB { Obins = flat[0]->getOBins(); for (int i = 0; i < flatTableSize; i++) { - const RPFlatParams::EP* thisBin = &(flatparmsDB_->m_table[i]); + const RPFlatParams::EP* thisBin = &(flatparmsDB_.m_table[i]); for (int j = 0; j < hi::NumEPNames; j++) { int indx = thisBin->RPNameIndx[j]; if (indx < 0 || indx >= hi::NumEPNames) { @@ -62,13 +55,13 @@ class LoadEPDB { } int cbins = 0; while (flatTableSize > Hbins + 2 * Obins + cbins) { - const RPFlatParams::EP* thisBin = &(flatparmsDB_->m_table[Hbins + 2 * Obins + cbins]); + const RPFlatParams::EP* thisBin = &(flatparmsDB_.m_table[Hbins + 2 * Obins + cbins]); double centbinning = thisBin->x[0]; int ncentbins = (int)thisBin->y[0] + 0.01; if (ncentbins == 0) break; for (int j = 0; j < ncentbins; j++) { - const RPFlatParams::EP* thisBin = &(flatparmsDB_->m_table[Hbins + 2 * Obins + cbins + j + 1]); + const RPFlatParams::EP* thisBin = &(flatparmsDB_.m_table[Hbins + 2 * Obins + cbins + j + 1]); if (fabs(centbinning - 1.) < 0.01) { for (int i = 0; i < hi::NumEPNames; i++) { flat[i]->setCentRes1(j, thisBin->x[i], thisBin->y[i]); diff --git a/RecoHI/HiEvtPlaneAlgos/src/EvtPlaneProducer.cc b/RecoHI/HiEvtPlaneAlgos/src/EvtPlaneProducer.cc index 2a7416577a59b..8b9518d4f7a26 100644 --- a/RecoHI/HiEvtPlaneAlgos/src/EvtPlaneProducer.cc +++ b/RecoHI/HiEvtPlaneAlgos/src/EvtPlaneProducer.cc @@ -30,7 +30,6 @@ Description: #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/ESWatcher.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -179,7 +178,6 @@ class EvtPlaneProducer : public edm::stream::EDProducer<> { EPCuts cuts_; std::string centralityVariable_; - std::string centralityLabel_; std::string centralityMC_; edm::InputTag centralityBinTag_; @@ -212,6 +210,9 @@ class EvtPlaneProducer : public edm::stream::EDProducer<> { edm::InputTag chi2MapLostTag_; edm::EDGetTokenT> chi2MapLostToken_; + edm::ESGetToken centralityToken_; + edm::ESGetToken flatparmsToken_; + bool loadDB_; double minet_; double maxet_; @@ -383,7 +384,10 @@ EvtPlaneProducer::EvtPlaneProducer(const edm::ParameterSet &iConfig) if (iConfig.exists("nonDefaultGlauberModel")) { centralityMC_ = iConfig.getParameter("nonDefaultGlauberModel"); } - centralityLabel_ = centralityVariable_ + centralityMC_; + centralityToken_ = esConsumes(edm::ESInputTag("", centralityVariable_ + centralityMC_)); + if (loadDB_) { + flatparmsToken_ = esConsumes(); + } centralityBinToken_ = consumes(centralityBinTag_); @@ -438,9 +442,8 @@ void EvtPlaneProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSetup // //Get Size of Centrality Table // - edm::ESHandle centDB_; - iSetup.get().get(centralityLabel_, centDB_); - nCentBins_ = centDB_->m_table.size(); + auto const ¢DB = iSetup.getData(centralityToken_); + nCentBins_ = centDB.m_table.size(); for (int i = 0; i < NumEPNames; i++) { if (caloCentRef_ > 0) { int minbin = (caloCentRef_ - caloCentRefWidth_ / 2.) * nCentBins_ / 100.; @@ -458,9 +461,7 @@ void EvtPlaneProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSetup //Get flattening parameter file. // if (loadDB_ && hirpWatcher_.check(iSetup)) { - edm::ESHandle flatparmsDB_; - iSetup.get().get(flatparmsDB_); - LoadEPDB db(flatparmsDB_, flat); + LoadEPDB db(iSetup.getData(flatparmsToken_), flat); if (!db.IsSuccess()) { loadDB_ = kFALSE; } diff --git a/RecoHI/HiEvtPlaneAlgos/src/HiEvtPlaneFlatProducer.cc b/RecoHI/HiEvtPlaneAlgos/src/HiEvtPlaneFlatProducer.cc index 756fe2526a8b8..a6cf2fb38ae00 100644 --- a/RecoHI/HiEvtPlaneAlgos/src/HiEvtPlaneFlatProducer.cc +++ b/RecoHI/HiEvtPlaneAlgos/src/HiEvtPlaneFlatProducer.cc @@ -9,7 +9,6 @@ #include "Math/Vector3D.h" #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/ESWatcher.h" #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" @@ -57,7 +56,6 @@ class HiEvtPlaneFlatProducer : public edm::stream::EDProducer<> { // ----------member data --------------------------- std::string centralityVariable_; - std::string centralityLabel_; std::string centralityMC_; edm::InputTag centralityBinTag_; @@ -78,6 +76,8 @@ class HiEvtPlaneFlatProducer : public edm::stream::EDProducer<> { edm::ESWatcher hiWatcher; edm::ESWatcher hirpWatcher; + edm::ESGetToken centralityESToken_; + edm::ESGetToken flatparmsToken_; const int FlatOrder_; int NumFlatBins_; @@ -115,7 +115,8 @@ HiEvtPlaneFlatProducer::HiEvtPlaneFlatProducer(const edm::ParameterSet& iConfig) if (iConfig.exists("nonDefaultGlauberModel")) { centralityMC_ = iConfig.getParameter("nonDefaultGlauberModel"); } - centralityLabel_ = centralityVariable_ + centralityMC_; + centralityESToken_ = esConsumes(edm::ESInputTag("", centralityVariable_ + centralityMC_)); + flatparmsToken_ = esConsumes(); centralityBinToken_ = consumes(centralityBinTag_); @@ -158,9 +159,8 @@ void HiEvtPlaneFlatProducer::produce(edm::Event& iEvent, const edm::EventSetup& // //Get Size of Centrality Table // - edm::ESHandle centDB_; - iSetup.get().get(centralityLabel_, centDB_); - nCentBins_ = centDB_->m_table.size(); + auto const& centDB = iSetup.getData(centralityESToken_); + nCentBins_ = centDB.m_table.size(); for (int i = 0; i < NumEPNames; i++) { if (caloCentRef_ > 0) { int minbin = (caloCentRef_ - caloCentRefWidth_ / 2.) * nCentBins_ / 100.; @@ -178,9 +178,7 @@ void HiEvtPlaneFlatProducer::produce(edm::Event& iEvent, const edm::EventSetup& //Get flattening parameter file. // if (hirpWatcher.check(iSetup)) { - edm::ESHandle flatparmsDB_; - iSetup.get().get(flatparmsDB_); - LoadEPDB db(flatparmsDB_, flat); + LoadEPDB db(iSetup.getData(flatparmsToken_), flat); } //rp record change // diff --git a/RecoHI/HiTracking/plugins/HIPixelClusterVtxProducer.cc b/RecoHI/HiTracking/plugins/HIPixelClusterVtxProducer.cc index a69eb63239e7b..f79286f804533 100644 --- a/RecoHI/HiTracking/plugins/HIPixelClusterVtxProducer.cc +++ b/RecoHI/HiTracking/plugins/HIPixelClusterVtxProducer.cc @@ -1,17 +1,14 @@ #include "HIPixelClusterVtxProducer.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/Event.h" #include "DataFormats/VertexReco/interface/Vertex.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" #include "Geometry/CommonTopologies/interface/PixelTopology.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/CommonDetUnit/interface/GeomDet.h" #include "DataFormats/GeometryVector/interface/LocalPoint.h" @@ -27,6 +24,7 @@ /*****************************************************************************/ HIPixelClusterVtxProducer::HIPixelClusterVtxProducer(const edm::ParameterSet &ps) : srcPixelsString_(ps.getParameter("pixelRecHits")), + trackerToken_(esConsumes()), minZ_(ps.getParameter("minZ")), maxZ_(ps.getParameter("maxZ")), zStep_(ps.getParameter("zStep")) @@ -53,9 +51,7 @@ void HIPixelClusterVtxProducer::produce(edm::Event &ev, const edm::EventSetup &e // get tracker geometry if (hRecHits.isValid()) { - edm::ESHandle trackerHandle; - es.get().get(trackerHandle); - const TrackerGeometry *tgeo = trackerHandle.product(); + const TrackerGeometry *tgeo = &es.getData(trackerToken_); const SiPixelRecHitCollection *hits = hRecHits.product(); // loop over pixel rechits diff --git a/RecoHI/HiTracking/plugins/HIPixelClusterVtxProducer.h b/RecoHI/HiTracking/plugins/HIPixelClusterVtxProducer.h index 4915788a63835..eb329316be041 100644 --- a/RecoHI/HiTracking/plugins/HIPixelClusterVtxProducer.h +++ b/RecoHI/HiTracking/plugins/HIPixelClusterVtxProducer.h @@ -5,6 +5,8 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" namespace edm { class Run; @@ -31,6 +33,7 @@ class HIPixelClusterVtxProducer : public edm::stream::EDProducer<> { std::string srcPixelsString_; //pixel rec hits edm::EDGetTokenT srcPixels_; + edm::ESGetToken trackerToken_; double minZ_; double maxZ_; diff --git a/RecoHI/HiTracking/plugins/HIProtoTrackFilterProducer.cc b/RecoHI/HiTracking/plugins/HIProtoTrackFilterProducer.cc index ea7751d0cf307..89df6fd9cf337 100644 --- a/RecoHI/HiTracking/plugins/HIProtoTrackFilterProducer.cc +++ b/RecoHI/HiTracking/plugins/HIProtoTrackFilterProducer.cc @@ -34,6 +34,7 @@ class HIProtoTrackFilterProducer : public edm::global::EDProducer<> { edm::EDGetTokenT theBeamSpotToken; edm::EDGetTokenT theSiPixelRecHitsToken; + edm::ESGetToken theTtopoToken; double theTIPMax; double theChi2Max, thePtMin; bool doVariablePtMin; @@ -42,6 +43,7 @@ class HIProtoTrackFilterProducer : public edm::global::EDProducer<> { HIProtoTrackFilterProducer::HIProtoTrackFilterProducer(const edm::ParameterSet& iConfig) : theBeamSpotToken(consumes(iConfig.getParameter("beamSpot"))), theSiPixelRecHitsToken(consumes(iConfig.getParameter("siPixelRecHits"))), + theTtopoToken(esConsumes()), theTIPMax(iConfig.getParameter("tipMax")), theChi2Max(iConfig.getParameter("chi2")), thePtMin(iConfig.getParameter("ptMin")), @@ -85,11 +87,10 @@ void HIProtoTrackFilterProducer::produce(edm::StreamID, edm::Event& iEvent, cons edm::Handle recHitColl; iEvent.getByToken(theSiPixelRecHitsToken, recHitColl); - edm::ESHandle httopo; - iSetup.get().get(httopo); + auto const& ttopo = iSetup.getData(theTtopoToken); std::vector theChosenHits; - edmNew::copyDetSetRange(*recHitColl, theChosenHits, httopo->pxbDetIdLayerComparator(1)); + edmNew::copyDetSetRange(*recHitColl, theChosenHits, ttopo.pxbDetIdLayerComparator(1)); float estMult = theChosenHits.size(); double variablePtMin = thePtMin; diff --git a/RecoJets/JetAlgorithms/interface/QGLikelihoodCalculator.h b/RecoJets/JetAlgorithms/interface/QGLikelihoodCalculator.h index 574136c8db39e..377df3bc59955 100644 --- a/RecoJets/JetAlgorithms/interface/QGLikelihoodCalculator.h +++ b/RecoJets/JetAlgorithms/interface/QGLikelihoodCalculator.h @@ -2,7 +2,6 @@ #define JetAlgorithms_QGLikelihoodCalculator_h #include "CondFormats/JetMETObjects/interface/QGLikelihoodObject.h" -#include "FWCore/Framework/interface/ESHandle.h" /** * The QGLikelihoodCalculater calculates the likelihood for a jet @@ -16,8 +15,8 @@ class QGLikelihoodCalculator { ~QGLikelihoodCalculator(){}; float computeQGLikelihood( - edm::ESHandle &QGLParamsColl, float pt, float eta, float rho, std::vector vars) const; - float systematicSmearing(edm::ESHandle &QGLParamsColl, + const QGLikelihoodObject &QGLParamsColl, float pt, float eta, float rho, std::vector vars) const; + float systematicSmearing(const QGLikelihoodSystematicsObject &QGLParamsColl, float pt, float eta, float rho, diff --git a/RecoJets/JetAlgorithms/src/QGLikelihoodCalculator.cc b/RecoJets/JetAlgorithms/src/QGLikelihoodCalculator.cc index c7cd249db8a14..d39c93d11f85d 100644 --- a/RecoJets/JetAlgorithms/src/QGLikelihoodCalculator.cc +++ b/RecoJets/JetAlgorithms/src/QGLikelihoodCalculator.cc @@ -1,19 +1,18 @@ #include "RecoJets/JetAlgorithms/interface/QGLikelihoodCalculator.h" #include "CondFormats/JetMETObjects/interface/QGLikelihoodObject.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/ESHandle.h" #include /// Compute likelihood for a jet using the QGLikelihoodObject information and a set of variables float QGLikelihoodCalculator::computeQGLikelihood( - edm::ESHandle &QGLParamsColl, float pt, float eta, float rho, std::vector vars) const { - if (!isValidRange(pt, rho, eta, QGLParamsColl->qgValidRange)) + const QGLikelihoodObject &QGLParamsColl, float pt, float eta, float rho, std::vector vars) const { + if (!isValidRange(pt, rho, eta, QGLParamsColl.qgValidRange)) return -1; float Q = 1., G = 1.; for (unsigned int varIndex = 0; varIndex < vars.size(); ++varIndex) { - auto quarkEntry = findEntry(QGLParamsColl->data, eta, pt, rho, 0, varIndex); - auto gluonEntry = findEntry(QGLParamsColl->data, eta, pt, rho, 1, varIndex); + auto quarkEntry = findEntry(QGLParamsColl.data, eta, pt, rho, 0, varIndex); + auto gluonEntry = findEntry(QGLParamsColl.data, eta, pt, rho, 1, varIndex); if (!quarkEntry || !gluonEntry) return -2; @@ -97,7 +96,7 @@ float QGLikelihoodCalculator::smearingFunction(float x0, float a, float b, float } // Get systematic smearing -float QGLikelihoodCalculator::systematicSmearing(edm::ESHandle &QGLSystematicsColl, +float QGLikelihoodCalculator::systematicSmearing(const QGLikelihoodSystematicsObject &QGLSystematicsColl, float pt, float eta, float rho, @@ -113,10 +112,10 @@ float QGLikelihoodCalculator::systematicSmearing(edm::ESHandledata.begin(); + auto myDataObject = QGLSystematicsColl.data.begin(); while (!(myParameters == myDataObject->systCategory)) { ++myDataObject; - if (myDataObject == QGLSystematicsColl->data.end()) + if (myDataObject == QGLSystematicsColl.data.end()) return -1; //Smearing not available in the whole qgValidRange: do not throw warnings or errors } return smearingFunction(qgValue, myDataObject->a, myDataObject->b, myDataObject->lmin, myDataObject->lmax); diff --git a/RecoJets/JetAssociationProducers/interface/TrackExtrapolator.h b/RecoJets/JetAssociationProducers/interface/TrackExtrapolator.h index 27cdfe0b83006..611c97bf63848 100644 --- a/RecoJets/JetAssociationProducers/interface/TrackExtrapolator.h +++ b/RecoJets/JetAssociationProducers/interface/TrackExtrapolator.h @@ -33,7 +33,6 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/JetReco/interface/TrackExtrapolation.h" @@ -47,7 +46,9 @@ #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h" #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h" #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" +#include "TrackingTools/Records/interface/DetIdAssociatorRecord.h" #include "TrackingTools/Records/interface/TrackingComponentsRecord.h" +#include "TrackingTools/TrackAssociator/interface/DetIdAssociator.h" #include "TrackingTools/TrackAssociator/interface/FiducialVolume.h" // @@ -64,8 +65,11 @@ class TrackExtrapolator : public edm::stream::EDProducer<> { // ----------member data --------------------------- - edm::EDGetTokenT tracksSrc_; /// Input tracks - reco::TrackBase::TrackQuality trackQuality_; /// track quality of the tracks we care about + const edm::EDGetTokenT tracksSrc_; /// Input tracks + const edm::ESGetToken fieldToken_; + const edm::ESGetToken propagatorToken_; + const edm::ESGetToken ecalDetIdAssociatorToken_; + const reco::TrackBase::TrackQuality trackQuality_; /// track quality of the tracks we care about // ----------internal functions --------------------------- diff --git a/RecoJets/JetAssociationProducers/src/JetTracksAssociatorAtCaloFace.cc b/RecoJets/JetAssociationProducers/src/JetTracksAssociatorAtCaloFace.cc index ccf7290d39710..6c75b89014283 100644 --- a/RecoJets/JetAssociationProducers/src/JetTracksAssociatorAtCaloFace.cc +++ b/RecoJets/JetAssociationProducers/src/JetTracksAssociatorAtCaloFace.cc @@ -16,7 +16,7 @@ #include "JetTracksAssociatorAtCaloFace.h" JetTracksAssociatorAtCaloFace::JetTracksAssociatorAtCaloFace(const edm::ParameterSet& fConfig) - : firstRun(true), dR_(fConfig.getParameter("coneSize")) { + : mGeometry(esConsumes()), dR_(fConfig.getParameter("coneSize")) { mJets = consumes >(fConfig.getParameter("jets")); mExtrapolations = consumes >(fConfig.getParameter("extrapolations")), @@ -26,14 +26,7 @@ JetTracksAssociatorAtCaloFace::JetTracksAssociatorAtCaloFace(const edm::Paramete void JetTracksAssociatorAtCaloFace::produce(edm::Event& fEvent, const edm::EventSetup& fSetup) { // Get geometry - if (firstRun) { - fSetup.get().get(pGeo); - firstRun = false; - } - - if (!pGeo.isValid()) { - throw cms::Exception("InvalidInput") << "Did not get geometry" << std::endl; - } + auto const& geo = fSetup.getData(mGeometry); // get stuff from Event edm::Handle > jets_h; @@ -61,7 +54,7 @@ void JetTracksAssociatorAtCaloFace::produce(edm::Event& fEvent, const edm::Event allJets.reserve(jets_h->size()); for (unsigned i = 0; i < jets_h->size(); ++i) allJets.push_back(jets_h->refAt(i)); - mAssociator.produce(&*jetTracks, allJets, *extrapolations_h, *pGeo, dR_); + mAssociator.produce(&*jetTracks, allJets, *extrapolations_h, geo, dR_); // store output fEvent.put(std::move(jetTracks)); diff --git a/RecoJets/JetAssociationProducers/src/JetTracksAssociatorAtCaloFace.h b/RecoJets/JetAssociationProducers/src/JetTracksAssociatorAtCaloFace.h index 177131e81fa40..9bb3e9f052d6b 100644 --- a/RecoJets/JetAssociationProducers/src/JetTracksAssociatorAtCaloFace.h +++ b/RecoJets/JetAssociationProducers/src/JetTracksAssociatorAtCaloFace.h @@ -26,13 +26,11 @@ class JetTracksAssociatorAtCaloFace : public edm::stream::EDProducer<> { void produce(edm::Event&, const edm::EventSetup&) override; private: - JetTracksAssociatorAtCaloFace() {} - edm::EDGetTokenT> mJets; edm::EDGetTokenT> mExtrapolations; + edm::ESGetToken mGeometry; + JetTracksAssociationXtrpCalo mAssociator; - edm::ESHandle pGeo; - bool firstRun; double dR_; }; diff --git a/RecoJets/JetAssociationProducers/src/TrackExtrapolator.cc b/RecoJets/JetAssociationProducers/src/TrackExtrapolator.cc index f314daa472be8..e9a48001db4f8 100644 --- a/RecoJets/JetAssociationProducers/src/TrackExtrapolator.cc +++ b/RecoJets/JetAssociationProducers/src/TrackExtrapolator.cc @@ -1,15 +1,16 @@ #include "RecoJets/JetAssociationProducers/interface/TrackExtrapolator.h" -#include "TrackingTools/TrackAssociator/interface/DetIdAssociator.h" -#include "TrackingTools/Records/interface/DetIdAssociatorRecord.h" #include // // constructors and destructor // -TrackExtrapolator::TrackExtrapolator(const edm::ParameterSet& iConfig) { - tracksSrc_ = consumes(iConfig.getParameter("trackSrc")); - trackQuality_ = reco::TrackBase::qualityByName(iConfig.getParameter("trackQuality")); +TrackExtrapolator::TrackExtrapolator(const edm::ParameterSet& iConfig) + : tracksSrc_(consumes(iConfig.getParameter("trackSrc"))), + fieldToken_(esConsumes()), + propagatorToken_(esConsumes(edm::ESInputTag("", "SteppingHelixPropagatorAlong"))), + ecalDetIdAssociatorToken_(esConsumes(edm::ESInputTag("", "EcalDetIdAssociator"))), + trackQuality_(reco::TrackBase::qualityByName(iConfig.getParameter("trackQuality"))) { if (trackQuality_ == reco::TrackBase::undefQuality) { // we have a problem throw cms::Exception("InvalidInput") << "Unknown trackQuality value '" << iConfig.getParameter("trackQuality") @@ -28,13 +29,9 @@ TrackExtrapolator::~TrackExtrapolator() {} // ------------ method called on each new Event ------------ void TrackExtrapolator::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { // get stuff from Event Setup - edm::ESHandle field_h; - iSetup.get().get(field_h); - edm::ESHandle propagator_h; - iSetup.get().get("SteppingHelixPropagatorAlong", propagator_h); - edm::ESHandle ecalDetIdAssociator_h; - iSetup.get().get("EcalDetIdAssociator", ecalDetIdAssociator_h); - FiducialVolume const& ecalvolume = ecalDetIdAssociator_h->volume(); + auto const& field = iSetup.getData(fieldToken_); + auto const& propagator = iSetup.getData(propagatorToken_); + FiducialVolume const& ecalvolume = iSetup.getData(ecalDetIdAssociatorToken_).volume(); // get stuff from Event edm::Handle tracks_h; @@ -63,7 +60,7 @@ void TrackExtrapolator::produce(edm::Event& iEvent, const edm::EventSetup& iSetu itrk = trkBegin; itrk != trkEnd; ++itrk) { - if (propagateTrackToVolume(**itrk, *field_h, *propagator_h, ecalvolume, vresultPos[0], vresultMom[0])) { + if (propagateTrackToVolume(**itrk, field, propagator, ecalvolume, vresultPos[0], vresultMom[0])) { extrapolations->push_back(reco::TrackExtrapolation(*itrk, vresultPos, vresultMom)); } } diff --git a/RecoJets/JetProducers/interface/JetMuonHitsIDHelper.h b/RecoJets/JetProducers/interface/JetMuonHitsIDHelper.h index 33635ffde8b26..421a039453fe5 100644 --- a/RecoJets/JetProducers/interface/JetMuonHitsIDHelper.h +++ b/RecoJets/JetProducers/interface/JetMuonHitsIDHelper.h @@ -11,6 +11,9 @@ #include "DataFormats/JetReco/interface/Jet.h" #include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h" +#include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h" +#include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h" + namespace reco { namespace helper { @@ -47,6 +50,7 @@ namespace reco { int numberOfHitsRPC_; edm::EDGetTokenT input_rpchits_token_; + edm::ESGetToken trackingGeometryToken_; }; } // namespace helper } // namespace reco diff --git a/RecoJets/JetProducers/interface/QGTagger.h b/RecoJets/JetProducers/interface/QGTagger.h index b7815fccc4db8..231e5a35f48da 100644 --- a/RecoJets/JetProducers/interface/QGTagger.h +++ b/RecoJets/JetProducers/interface/QGTagger.h @@ -12,27 +12,33 @@ #include "JetMETCorrections/JetCorrector/interface/JetCorrector.h" #include "RecoJets/JetAlgorithms/interface/QGLikelihoodCalculator.h" +#include "CondFormats/DataRecord/interface/QGLikelihoodRcd.h" +#include "CondFormats/DataRecord/interface/QGLikelihoodSystematicsRcd.h" class QGTagger : public edm::global::EDProducer<> { public: explicit QGTagger(const edm::ParameterSet&); - ~QGTagger() override { delete qgLikelihood; }; + ~QGTagger() override = default; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; std::tuple calcVariables(const reco::Jet*, edm::Handle&, bool) const; template - void putInEvent(const std::string&, const edm::Handle>&, std::vector*, edm::Event&) const; + void putInEvent(const std::string&, + const edm::Handle>&, + const std::vector&, + edm::Event&) const; bool isPackedCandidate(const reco::Jet* jet) const; edm::EDGetTokenT> jetsToken; edm::EDGetTokenT jetCorrectorToken; edm::EDGetTokenT vertexToken; edm::EDGetTokenT rhoToken; - std::string jetsLabel, systLabel; + edm::ESGetToken paramsToken; + edm::ESGetToken systToken; const bool useQC, useJetCorr, produceSyst; - QGLikelihoodCalculator* qgLikelihood; + QGLikelihoodCalculator qgLikelihood; }; #endif diff --git a/RecoJets/JetProducers/plugins/BoostedTauSeedsProducer.cc b/RecoJets/JetProducers/plugins/BoostedTauSeedsProducer.cc index 832c0ab5aac00..93e32da07585f 100644 --- a/RecoJets/JetProducers/plugins/BoostedTauSeedsProducer.cc +++ b/RecoJets/JetProducers/plugins/BoostedTauSeedsProducer.cc @@ -28,6 +28,8 @@ #include "DataFormats/JetReco/interface/PFJetCollection.h" #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" +#include "DataFormats/PatCandidates/interface/Jet.h" +#include "DataFormats/PatCandidates/interface/PackedCandidate.h" #include "DataFormats/Common/interface/AssociationMap.h" #include "DataFormats/Common/interface/Ref.h" #include "DataFormats/Common/interface/RefProd.h" @@ -40,41 +42,46 @@ #include #include -class BoostedTauSeedsProducer : public edm::stream::EDProducer<> { +template +class GenericBoostedTauSeedsProducer : public edm::stream::EDProducer<> { public: - explicit BoostedTauSeedsProducer(const edm::ParameterSet&); - ~BoostedTauSeedsProducer() override {} + explicit GenericBoostedTauSeedsProducer(const edm::ParameterSet&); + ~GenericBoostedTauSeedsProducer() override {} void produce(edm::Event&, const edm::EventSetup&) override; private: - typedef edm::AssociationMap, std::vector, unsigned int> > + typedef edm::AssociationMap, std::vector, unsigned int>> JetToPFCandidateAssociation; + typedef std::vector JetTypeCollection; + typedef std::vector CandTypeCollection; std::string moduleLabel_; typedef edm::View JetView; edm::EDGetTokenT srcSubjets_; - edm::EDGetTokenT srcPFCandidates_; + edm::EDGetTokenT srcPFCandidates_; int verbosity_; }; -BoostedTauSeedsProducer::BoostedTauSeedsProducer(const edm::ParameterSet& cfg) +template +GenericBoostedTauSeedsProducer::GenericBoostedTauSeedsProducer(const edm::ParameterSet& cfg) : moduleLabel_(cfg.getParameter("@module_label")) { srcSubjets_ = consumes(cfg.getParameter("subjetSrc")); - srcPFCandidates_ = consumes(cfg.getParameter("pfCandidateSrc")); + srcPFCandidates_ = consumes(cfg.getParameter("pfCandidateSrc")); verbosity_ = (cfg.exists("verbosity")) ? cfg.getParameter("verbosity") : 0; - produces(); + produces(); produces("pfCandAssocMapForIsolation"); //produces("pfCandAssocMapForIsoDepositVetos"); } namespace { - typedef std::vector > JetToConstitMap; + typedef std::vector> JetToConstitMap; - reco::PFJet convertToPFJet(const reco::Jet& jet, const reco::Jet::Constituents& jetConstituents) { + template + JetType convertToPFJet(const reco::Jet& jet, const reco::Jet::Constituents& jetConstituents) { // CV: code for filling pfJetSpecific objects taken from // RecoParticleFlow/PFRootEvent/src/JetMaker.cc double chargedHadronEnergy = 0.; @@ -86,37 +93,36 @@ namespace { int neutralMultiplicity = 0; int muonMultiplicity = 0; for (auto const& jetConstituent : jetConstituents) { - const reco::PFCandidate* pfCandidate = dynamic_cast(jetConstituent.get()); + const CandType* pfCandidate = dynamic_cast(jetConstituent.get()); if (pfCandidate) { - switch (pfCandidate->particleId()) { - case reco::PFCandidate::h: // charged hadron + switch (std::abs(pfCandidate->pdgId())) { + case 211: // charged hadron chargedHadronEnergy += pfCandidate->energy(); ++chargedMultiplicity; break; - case reco::PFCandidate::e: // electron + case 11: // electron chargedEmEnergy += pfCandidate->energy(); ++chargedMultiplicity; break; - case reco::PFCandidate::mu: // muon + case 13: // muon chargedMuEnergy += pfCandidate->energy(); ++chargedMultiplicity; ++muonMultiplicity; break; - case reco::PFCandidate::gamma: // photon - case reco::PFCandidate::egamma_HF: // electromagnetic in HF + case 22: // photon + case 2: // electromagnetic in HF neutralEmEnergy += pfCandidate->energy(); ++neutralMultiplicity; break; - case reco::PFCandidate::h0: // neutral hadron - case reco::PFCandidate::h_HF: // hadron in HF + case 130: // neutral hadron + case 1: // hadron in HF neutralHadronEnergy += pfCandidate->energy(); ++neutralMultiplicity; break; default: - edm::LogWarning("convertToPFJet") - << "PFCandidate: Pt = " << pfCandidate->pt() << ", eta = " << pfCandidate->eta() - << ", phi = " << pfCandidate->phi() << " has invalid particleID = " << pfCandidate->particleId() - << " !!" << std::endl; + edm::LogWarning("convertToPFJet") << "PFCandidate: Pt = " << pfCandidate->pt() + << ", eta = " << pfCandidate->eta() << ", phi = " << pfCandidate->phi() + << " has invalid pdgID = " << pfCandidate->pdgId() << " !!" << std::endl; break; } } else { @@ -138,7 +144,7 @@ namespace { reco::PFJet pfJet(jet.p4(), jet.vertex(), pfJetSpecific, jetConstituents); pfJet.setJetArea(jet.jetArea()); - return pfJet; + return JetType(pfJet); } void getJetConstituents(const reco::Jet& jet, reco::Jet::Constituents& jet_and_subjetConstituents) { @@ -153,20 +159,21 @@ namespace { } } - std::vector getPFCandidates_exclJetConstituents( + template + std::vector>> getPFCandidates_exclJetConstituents( const reco::Jet& jet, - const edm::Handle& pfCandidates, + const edm::Handle>& pfCandidates, const JetToConstitMap::value_type& constitmap, bool invert) { auto const& collection_cand = (*pfCandidates); - std::vector pfCandidates_exclJetConstituents; + std::vector>> pfCandidates_exclJetConstituents; size_t numPFCandidates = pfCandidates->size(); for (size_t pfCandidateIdx = 0; pfCandidateIdx < numPFCandidates; ++pfCandidateIdx) { if (!(deltaR2(collection_cand[pfCandidateIdx], jet) < 1.0)) continue; bool isJetConstituent = constitmap.count(pfCandidateIdx); if (!(isJetConstituent ^ invert)) { - reco::PFCandidateRef pfCandidate(pfCandidates, pfCandidateIdx); + edm::Ref> pfCandidate(pfCandidates, pfCandidateIdx); pfCandidates_exclJetConstituents.push_back(pfCandidate); } } @@ -184,7 +191,8 @@ namespace { } } // namespace -void BoostedTauSeedsProducer::produce(edm::Event& evt, const edm::EventSetup& es) { +template +void GenericBoostedTauSeedsProducer::produce(edm::Event& evt, const edm::EventSetup& es) { if (verbosity_ >= 1) { std::cout << ":" << std::endl; } @@ -196,14 +204,14 @@ void BoostedTauSeedsProducer::produce(edm::Event& evt, const edm::EventSetup& es } assert((subjets->size() % 2) == 0); // CV: ensure that subjets come in pairs - edm::Handle pfCandidates; + edm::Handle pfCandidates; evt.getByToken(srcPFCandidates_, pfCandidates); if (verbosity_ >= 1) { std::cout << "#pfCandidates = " << pfCandidates->size() << std::endl; } - auto selectedSubjets = std::make_unique(); - edm::RefProd selectedSubjetRefProd = evt.getRefBeforePut(); + auto selectedSubjets = std::make_unique(); + edm::RefProd selectedSubjetRefProd = evt.getRefBeforePut(); auto selectedSubjetPFCandidateAssociationForIsolation = std::make_unique(&evt.productGetter()); @@ -247,16 +255,16 @@ void BoostedTauSeedsProducer::produce(edm::Event& evt, const edm::EventSetup& es printJetConstituents("subjetConstituents2", subjetConstituents2); } - selectedSubjets->push_back(convertToPFJet(*subjet1, subjetConstituents1)); - edm::Ref subjetRef1(selectedSubjetRefProd, selectedSubjets->size() - 1); - selectedSubjets->push_back(convertToPFJet(*subjet2, subjetConstituents2)); - edm::Ref subjetRef2(selectedSubjetRefProd, selectedSubjets->size() - 1); + selectedSubjets->push_back(convertToPFJet(*subjet1, subjetConstituents1)); + edm::Ref subjetRef1(selectedSubjetRefProd, selectedSubjets->size() - 1); + selectedSubjets->push_back(convertToPFJet(*subjet2, subjetConstituents2)); + edm::Ref subjetRef2(selectedSubjetRefProd, selectedSubjets->size() - 1); // find all PFCandidates that are not constituents of the **other** subjet - std::vector pfCandidatesNotInSubjet1 = - getPFCandidates_exclJetConstituents(*subjet1, pfCandidates, constitmap[2 * idx + 1], false); - std::vector pfCandidatesNotInSubjet2 = - getPFCandidates_exclJetConstituents(*subjet2, pfCandidates, constitmap[2 * idx], false); + std::vector>> pfCandidatesNotInSubjet1 = + getPFCandidates_exclJetConstituents(*subjet1, pfCandidates, constitmap[2 * idx + 1], false); + std::vector>> pfCandidatesNotInSubjet2 = + getPFCandidates_exclJetConstituents(*subjet2, pfCandidates, constitmap[2 * idx], false); if (verbosity_ >= 1) { std::cout << "#pfCandidatesNotInSubjet1 = " << pfCandidatesNotInSubjet1.size() << std::endl; std::cout << "#pfCandidatesNotInSubjet2 = " << pfCandidatesNotInSubjet2.size() << std::endl; @@ -276,5 +284,9 @@ void BoostedTauSeedsProducer::produce(edm::Event& evt, const edm::EventSetup& es evt.put(std::move(selectedSubjetPFCandidateAssociationForIsolation), "pfCandAssocMapForIsolation"); } +typedef GenericBoostedTauSeedsProducer BoostedTauSeedsProducer; +typedef GenericBoostedTauSeedsProducer PATBoostedTauSeedsProducer; + #include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(BoostedTauSeedsProducer); +DEFINE_FWK_MODULE(PATBoostedTauSeedsProducer); diff --git a/RecoJets/JetProducers/plugins/PileupJetIdProducer.cc b/RecoJets/JetProducers/plugins/PileupJetIdProducer.cc index 3686624a3fb1d..2edfeb24729d7 100644 --- a/RecoJets/JetProducers/plugins/PileupJetIdProducer.cc +++ b/RecoJets/JetProducers/plugins/PileupJetIdProducer.cc @@ -61,6 +61,7 @@ PileupJetIdProducer::PileupJetIdProducer(const edm::ParameterSet& iConfig, GBRFo input_vm_pujetid_token_ = consumes>(iConfig.getParameter("jetids")); input_rho_token_ = consumes(iConfig.getParameter("rho")); + parameters_token_ = esConsumes(edm::ESInputTag("", globalCache->jec())); } // ------------------------------------------------------------------------------------------ @@ -245,10 +246,9 @@ void PileupJetIdProducer::initJetEnergyCorrector(const edm::EventSetup& iSetup, jecLevels.push_back("L2L3Residual"); //check the corrector parameters needed according to the correction levels - edm::ESHandle parameters; - iSetup.get().get(gc->jec(), parameters); + auto const& parameters = iSetup.getData(parameters_token_); for (std::vector::const_iterator ll = jecLevels.begin(); ll != jecLevels.end(); ++ll) { - const JetCorrectorParameters& ip = (*parameters)[*ll]; + const JetCorrectorParameters& ip = parameters[*ll]; jetCorPars_.push_back(ip); } if (isData && gc->residualsFromTxt()) { diff --git a/RecoJets/JetProducers/plugins/PileupJetIdProducer.h b/RecoJets/JetProducers/plugins/PileupJetIdProducer.h index f5536d03e39c4..479179f175114 100644 --- a/RecoJets/JetProducers/plugins/PileupJetIdProducer.h +++ b/RecoJets/JetProducers/plugins/PileupJetIdProducer.h @@ -103,6 +103,7 @@ class PileupJetIdProducer : public edm::stream::EDProducer input_vertex_token_; edm::EDGetTokenT> input_vm_pujetid_token_; edm::EDGetTokenT input_rho_token_; + edm::ESGetToken parameters_token_; }; #endif diff --git a/RecoJets/JetProducers/plugins/QGTagger.cc b/RecoJets/JetProducers/plugins/QGTagger.cc index 18c7baa44c246..a0d16bf769da5 100644 --- a/RecoJets/JetProducers/plugins/QGTagger.cc +++ b/RecoJets/JetProducers/plugins/QGTagger.cc @@ -2,7 +2,6 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -17,8 +16,6 @@ #include "RecoJets/JetProducers/interface/QGTagger.h" #include "RecoJets/JetAlgorithms/interface/QGLikelihoodCalculator.h" -#include "CondFormats/DataRecord/interface/QGLikelihoodRcd.h" -#include "CondFormats/DataRecord/interface/QGLikelihoodSystematicsRcd.h" /** * EDProducer class to produced the qgLikelihood values and related variables @@ -30,32 +27,31 @@ QGTagger::QGTagger(const edm::ParameterSet& iConfig) jetCorrectorToken(consumes(iConfig.getParameter("jec"))), vertexToken(consumes(iConfig.getParameter("srcVertexCollection"))), rhoToken(consumes(iConfig.getParameter("srcRho"))), - jetsLabel(iConfig.getParameter("jetsLabel")), - systLabel(iConfig.getParameter("systematicsLabel")), + paramsToken(esConsumes(edm::ESInputTag("", iConfig.getParameter("jetsLabel")))), useQC(iConfig.getParameter("useQualityCuts")), useJetCorr(!iConfig.getParameter("jec").label().empty()), - produceSyst(!systLabel.empty()) { + produceSyst(!iConfig.getParameter("systematicsLabel").empty()) { produces>("qgLikelihood"); produces>("axis2"); produces>("mult"); produces>("ptD"); if (produceSyst) { + systToken = esConsumes(edm::ESInputTag("", iConfig.getParameter("systematicsLabel"))); produces>("qgLikelihoodSmearedQuark"); produces>("qgLikelihoodSmearedGluon"); produces>("qgLikelihoodSmearedAll"); } - qgLikelihood = new QGLikelihoodCalculator(); } /// Produce qgLikelihood using {mult, ptD, -log(axis2)} void QGTagger::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { - std::vector* qgProduct = new std::vector; - std::vector* axis2Product = new std::vector; - std::vector* multProduct = new std::vector; - std::vector* ptDProduct = new std::vector; - std::vector* smearedQuarkProduct = new std::vector; - std::vector* smearedGluonProduct = new std::vector; - std::vector* smearedAllProduct = new std::vector; + std::vector qgProduct; + std::vector axis2Product; + std::vector multProduct; + std::vector ptDProduct; + std::vector smearedQuarkProduct; + std::vector smearedGluonProduct; + std::vector smearedAllProduct; edm::Handle> jets; iEvent.getByToken(jetsToken, jets); @@ -67,14 +63,11 @@ void QGTagger::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& edm::Handle rho; iEvent.getByToken(rhoToken, rho); - edm::ESHandle QGLParamsColl; - QGLikelihoodRcd const& rcdhandle = iSetup.get(); - rcdhandle.get(jetsLabel, QGLParamsColl); + const auto& QGLParamsColl = iSetup.getData(paramsToken); - edm::ESHandle QGLSystColl; + const QGLikelihoodSystematicsObject* QGLSystColl = nullptr; if (produceSyst) { - QGLikelihoodSystematicsRcd const& systrcdhandle = iSetup.get(); - systrcdhandle.get(systLabel, QGLSystColl); + QGLSystColl = &iSetup.getData(systToken); } bool weStillNeedToCheckJetCandidates = true; @@ -93,19 +86,19 @@ void QGTagger::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& float qgValue; if (mult > 2) qgValue = - qgLikelihood->computeQGLikelihood(QGLParamsColl, pt, jet->eta(), *rho, {(float)mult, ptD, -std::log(axis2)}); + qgLikelihood.computeQGLikelihood(QGLParamsColl, pt, jet->eta(), *rho, {(float)mult, ptD, -std::log(axis2)}); else qgValue = -1; - qgProduct->push_back(qgValue); + qgProduct.push_back(qgValue); if (produceSyst) { - smearedQuarkProduct->push_back(qgLikelihood->systematicSmearing(QGLSystColl, pt, jet->eta(), *rho, qgValue, 0)); - smearedGluonProduct->push_back(qgLikelihood->systematicSmearing(QGLSystColl, pt, jet->eta(), *rho, qgValue, 1)); - smearedAllProduct->push_back(qgLikelihood->systematicSmearing(QGLSystColl, pt, jet->eta(), *rho, qgValue, 2)); + smearedQuarkProduct.push_back(qgLikelihood.systematicSmearing(*QGLSystColl, pt, jet->eta(), *rho, qgValue, 0)); + smearedGluonProduct.push_back(qgLikelihood.systematicSmearing(*QGLSystColl, pt, jet->eta(), *rho, qgValue, 1)); + smearedAllProduct.push_back(qgLikelihood.systematicSmearing(*QGLSystColl, pt, jet->eta(), *rho, qgValue, 2)); } - axis2Product->push_back(axis2); - multProduct->push_back(mult); - ptDProduct->push_back(ptD); + axis2Product.push_back(axis2); + multProduct.push_back(mult); + ptDProduct.push_back(ptD); } putInEvent("qgLikelihood", jets, qgProduct, iEvent); @@ -123,14 +116,13 @@ void QGTagger::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& template void QGTagger::putInEvent(const std::string& name, const edm::Handle>& jets, - std::vector* product, + const std::vector& product, edm::Event& iEvent) const { auto out = std::make_unique>(); typename edm::ValueMap::Filler filler(*out); - filler.insert(jets, product->begin(), product->end()); + filler.insert(jets, product.begin(), product.end()); filler.fill(); iEvent.put(std::move(out), name); - delete product; } /// Function to tell us if we are using packedCandidates, only test for first candidate diff --git a/RecoJets/JetProducers/src/JetMuonHitsIDHelper.cc b/RecoJets/JetProducers/src/JetMuonHitsIDHelper.cc index a3d4656eeeff4..5829e04b75ae9 100644 --- a/RecoJets/JetProducers/src/JetMuonHitsIDHelper.cc +++ b/RecoJets/JetProducers/src/JetMuonHitsIDHelper.cc @@ -1,13 +1,8 @@ #include "RecoJets/JetProducers/interface/JetMuonHitsIDHelper.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/JetReco/interface/JetTracksAssociation.h" -// #include "TrackingTools/TrackAssociator/interface/MuonDetIdAssociator.h" -#include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h" -#include "TrackingTools/TrackAssociator/interface/DetIdAssociator.h" -#include "TrackingTools/Records/interface/DetIdAssociatorRecord.h" #include "DataFormats/DTRecHit/interface/DTRecHitCollection.h" #include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h" #include "DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h" @@ -29,7 +24,8 @@ using namespace std; -reco::helper::JetMuonHitsIDHelper::JetMuonHitsIDHelper(edm::ParameterSet const& pset, edm::ConsumesCollector&& iC) { +reco::helper::JetMuonHitsIDHelper::JetMuonHitsIDHelper(edm::ParameterSet const& pset, edm::ConsumesCollector&& iC) + : trackingGeometryToken_(iC.esConsumes()) { isRECO_ = true; // This will be "true" initially, then if the product isn't found, set to false once numberOfHits1RPC_ = 0; numberOfHits2RPC_ = 0; @@ -55,8 +51,7 @@ void reco::helper::JetMuonHitsIDHelper::calculate(const edm::Event& event, if (isRECO_) { // This will be "true" initially, then if the product isn't found, set to false once // Get tracking geometry - edm::ESHandle trackingGeometry; - iSetup.get().get(trackingGeometry); + auto const& trackingGeometry = iSetup.getData(trackingGeometryToken_); //####READ RPC RecHits Collection######## //#In config: RpcRecHits = cms.InputTag("rpcRecHits") @@ -78,7 +73,7 @@ void reco::helper::JetMuonHitsIDHelper::calculate(const edm::Event& event, RPCRecHit const& hit = *itRPC; DetId detid = hit.geographicalId(); LocalPoint lp = hit.localPosition(); - const GeomDet* gd = trackingGeometry->idToDet(detid); + const GeomDet* gd = trackingGeometry.idToDet(detid); GlobalPoint gp = gd->toGlobal(lp); double dR2 = reco::deltaR(jet.eta(), jet.phi(), static_cast(gp.eta()), static_cast(gp.phi())); if (dR2 < 0.5) { diff --git a/RecoLocalCalo/Configuration/python/hgcalLocalReco_cff.py b/RecoLocalCalo/Configuration/python/hgcalLocalReco_cff.py index bd9aa1ea177cd..eff98b6d72142 100644 --- a/RecoLocalCalo/Configuration/python/hgcalLocalReco_cff.py +++ b/RecoLocalCalo/Configuration/python/hgcalLocalReco_cff.py @@ -18,8 +18,7 @@ hgcalLayerClusters, hgcalMultiClusters, particleFlowRecHitHGC, - particleFlowClusterHGCal, - particleFlowClusterHGCalFromMultiCl ) + particleFlowClusterHGCal ) _hfnose_hgcalLocalRecoTask = hgcalLocalRecoTask.copy() _hfnose_hgcalLocalRecoTask.add(hgcalLayerClustersHFNose) diff --git a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitPhase2WeightsProducer.cc b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitPhase2WeightsProducer.cc new file mode 100644 index 0000000000000..414ad351c0236 --- /dev/null +++ b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitPhase2WeightsProducer.cc @@ -0,0 +1,123 @@ +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" + +#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/EcalRecHit/interface/EcalUncalibratedRecHit.h" + +#include "DataFormats/EcalDigi/interface/EcalConstants.h" + +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" + +class EcalUncalibRecHitPhase2WeightsProducer : public edm::stream::EDProducer<> { +public: + explicit EcalUncalibRecHitPhase2WeightsProducer(const edm::ParameterSet& ps); + void produce(edm::Event& evt, const edm::EventSetup& es) override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + const float tRise_; + const float tFall_; + const std::vector weights_; + + const edm::EDGetTokenT ebDigiCollectionToken_; + const edm::EDPutTokenT ebUncalibRecHitCollectionToken_; +}; + +void EcalUncalibRecHitPhase2WeightsProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("EBhitCollection", "EcalUncalibRecHitsEB"); + desc.add("tRise", 0.2); + desc.add("tFall", 2.); + desc.add>("weights", + {-0.121016, + -0.119899, + -0.120923, + -0.0848959, + 0.261041, + 0.509881, + 0.373591, + 0.134899, + -0.0233605, + -0.0913195, + -0.112452, + -0.118596, + -0.121737, + -0.121737, + -0.121737, + -0.121737}); + + desc.add("BarrelDigis", edm::InputTag("simEcalUnsuppressedDigis", "")); + + descriptions.addWithDefaultLabel(desc); +} + +EcalUncalibRecHitPhase2WeightsProducer::EcalUncalibRecHitPhase2WeightsProducer(const edm::ParameterSet& ps) + : tRise_(ps.getParameter("tRise")), + tFall_(ps.getParameter("tFall")), + weights_(ps.getParameter>("weights")), + ebDigiCollectionToken_(consumes(ps.getParameter("BarrelDigis"))), + ebUncalibRecHitCollectionToken_( + produces(ps.getParameter("EBhitCollection"))) {} + +void EcalUncalibRecHitPhase2WeightsProducer::produce(edm::Event& evt, const edm::EventSetup& es) { + // retrieve digis + const EBDigiCollectionPh2* pdigis = &evt.get(ebDigiCollectionToken_); + + // prepare output + auto ebUncalibRechits = std::make_unique(); + + for (auto itdg = pdigis->begin(); itdg != pdigis->end(); ++itdg) { + EBDataFrame digi(*itdg); + EcalDataFrame_Ph2 dataFrame(*itdg); + DetId detId(digi.id()); + + bool g1 = false; + + std::vector timetrace; + std::vector adctrace; + + int nSamples = digi.size(); + + timetrace.reserve(nSamples); + adctrace.reserve(nSamples); + + float amp = 0; + float gratio; + + for (int sample = 0; sample < nSamples; ++sample) { + EcalLiteDTUSample thisSample = dataFrame[sample]; + gratio = ecalPh2::gains[thisSample.gainId()]; + adctrace.push_back(thisSample.adc() * gratio); + + amp = amp + adctrace[sample] * weights_[sample]; + + if (thisSample.gainId() == 1) + g1 = true; + + timetrace.push_back(sample); + + } // loop on samples + + float amp_e = 1; + float t0_e = 0; + + EcalUncalibratedRecHit rhit(detId, amp, 0., 0., 0., 0); // rhit(detIt, amp, pedestal, t0, chi2, flags) + rhit.setAmplitudeError(amp_e); + rhit.setJitterError(t0_e); + if (g1) + rhit.setFlagBit(EcalUncalibratedRecHit::kHasSwitchToGain1); + + ebUncalibRechits->push_back(rhit); + + } // loop on digis + + evt.put(ebUncalibRecHitCollectionToken_, std::move(ebUncalibRechits)); +} + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(EcalUncalibRecHitPhase2WeightsProducer); diff --git a/RecoLocalCalo/EcalRecProducers/python/ecalUncalibRecHitPhase2_cff.py b/RecoLocalCalo/EcalRecProducers/python/ecalUncalibRecHitPhase2_cff.py new file mode 100644 index 0000000000000..63a3f7711dde3 --- /dev/null +++ b/RecoLocalCalo/EcalRecProducers/python/ecalUncalibRecHitPhase2_cff.py @@ -0,0 +1,4 @@ +import FWCore.ParameterSet.Config as cms + +from RecoLocalCalo.EcalRecProducers.ecalUncalibRecHitPhase2_cfi import * +ecalUncalibRecHitPhase2Task = cms.Task(ecalUncalibRecHitPhase2) diff --git a/RecoLocalCalo/EcalRecProducers/python/ecalUncalibRecHitPhase2_cfi.py b/RecoLocalCalo/EcalRecProducers/python/ecalUncalibRecHitPhase2_cfi.py new file mode 100644 index 0000000000000..a43a9b134b0d9 --- /dev/null +++ b/RecoLocalCalo/EcalRecProducers/python/ecalUncalibRecHitPhase2_cfi.py @@ -0,0 +1,2 @@ +import RecoLocalCalo.EcalRecProducers.ecalUncalibRecHitPhase2WeightsProducer_cfi as _mod +ecalUncalibRecHitPhase2 = _mod.ecalUncalibRecHitPhase2WeightsProducer.clone() \ No newline at end of file diff --git a/RecoLocalCalo/EcalRecProducers/test/testEcalUncalibRecHitPhase2WeightsProducer.py b/RecoLocalCalo/EcalRecProducers/test/testEcalUncalibRecHitPhase2WeightsProducer.py new file mode 100644 index 0000000000000..b2e5f2234d4da --- /dev/null +++ b/RecoLocalCalo/EcalRecProducers/test/testEcalUncalibRecHitPhase2WeightsProducer.py @@ -0,0 +1,189 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Phase2C10_cff import Phase2C10 +from Configuration.Eras.Modifier_phase2_ecal_devel_cff import phase2_ecal_devel + +from RecoLocalCalo.EcalRecProducers.ecalUncalibRecHitPhase2_cff import * +from RecoLuminosity.LumiProducer.bunchSpacingProducer_cfi import * + +process = cms.Process('RECO',Phase2C10,phase2_ecal_devel) + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Configuration.Geometry.GeometryExtended2026D60Reco_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.RawToDigi_cff') +process.load('Configuration.StandardSequences.L1Reco_cff') +process.load('Configuration.StandardSequences.Reconstruction_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +process.load('RecoLocalCalo.EcalRecProducers.ecalUncalibRecHitPhase2_cff') +process.load('RecoLuminosity.LumiProducer.bunchSpacingProducer_cfi') + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(10), + output = cms.optional.untracked.allowed(cms.int32,cms.PSet) +) + +# Input source +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring('file:/eos/cms/store/group/dpg_ecal/comm_ecal/upgrade/Phase2CMSSW/step2_digi_cmssw_12_X.root'), + secondaryFileNames = cms.untracked.vstring() +) + +process.options = cms.untracked.PSet( + FailPath = cms.untracked.vstring(), + IgnoreCompletely = cms.untracked.vstring(), + Rethrow = cms.untracked.vstring(), + SkipEvent = cms.untracked.vstring(), + allowUnscheduled = cms.obsolete.untracked.bool, + canDeleteEarly = cms.untracked.vstring(), + emptyRunLumiMode = cms.obsolete.untracked.string, + eventSetup = cms.untracked.PSet( + forceNumberOfConcurrentIOVs = cms.untracked.PSet( + allowAnyLabel_=cms.required.untracked.uint32 + ), + numberOfConcurrentIOVs = cms.untracked.uint32(1) + ), + fileMode = cms.untracked.string('FULLMERGE'), + forceEventSetupCacheClearOnNewRun = cms.untracked.bool(False), + makeTriggerResults = cms.obsolete.untracked.bool, + numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(1), + numberOfConcurrentRuns = cms.untracked.uint32(1), + numberOfStreams = cms.untracked.uint32(0), + numberOfThreads = cms.untracked.uint32(1), + printDependencies = cms.untracked.bool(False), + sizeOfStackForThreadsInKB = cms.optional.untracked.uint32, + throwIfIllegalParameter = cms.untracked.bool(True), + wantSummary = cms.untracked.bool(False) +) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + annotation = cms.untracked.string('step3 nevts:10'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') +) + +# Output definition +process.FEVTDEBUGHLToutput = cms.OutputModule("PoolOutputModule", + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('GEN-SIM-RECO'), + filterName = cms.untracked.string('') + ), + fileName = cms.untracked.string('file:step3.root'), + outputCommands = process.FEVTDEBUGHLTEventContent.outputCommands, + splitLevel = cms.untracked.int32(0) +) + +process.MINIAODSIMoutput = cms.OutputModule("PoolOutputModule", + compressionAlgorithm = cms.untracked.string('LZMA'), + compressionLevel = cms.untracked.int32(4), + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('MINIAODSIM'), + filterName = cms.untracked.string('') + ), + dropMetaData = cms.untracked.string('ALL'), + eventAutoFlushCompressedSize = cms.untracked.int32(-900), + fastCloning = cms.untracked.bool(False), + fileName = cms.untracked.string('file:step3_inMINIAODSIM.root'), + outputCommands = process.MINIAODSIMEventContent.outputCommands, + overrideBranchesSplitLevel = cms.untracked.VPSet( + cms.untracked.PSet( + branch = cms.untracked.string('patPackedCandidates_packedPFCandidates__*'), + splitLevel = cms.untracked.int32(99) + ), + cms.untracked.PSet( + branch = cms.untracked.string('recoGenParticles_prunedGenParticles__*'), + splitLevel = cms.untracked.int32(99) + ), + cms.untracked.PSet( + branch = cms.untracked.string('patTriggerObjectStandAlones_slimmedPatTrigger__*'), + splitLevel = cms.untracked.int32(99) + ), + cms.untracked.PSet( + branch = cms.untracked.string('patPackedGenParticles_packedGenParticles__*'), + splitLevel = cms.untracked.int32(99) + ), + cms.untracked.PSet( + branch = cms.untracked.string('patJets_slimmedJets__*'), + splitLevel = cms.untracked.int32(99) + ), + cms.untracked.PSet( + branch = cms.untracked.string('recoVertexs_offlineSlimmedPrimaryVertices__*'), + splitLevel = cms.untracked.int32(99) + ), + cms.untracked.PSet( + branch = cms.untracked.string('recoCaloClusters_reducedEgamma_reducedESClusters_*'), + splitLevel = cms.untracked.int32(99) + ), + cms.untracked.PSet( + branch = cms.untracked.string('EcalRecHitsSorted_reducedEgamma_reducedEBRecHits_*'), + splitLevel = cms.untracked.int32(99) + ), + cms.untracked.PSet( + branch = cms.untracked.string('EcalRecHitsSorted_reducedEgamma_reducedEERecHits_*'), + splitLevel = cms.untracked.int32(99) + ), + cms.untracked.PSet( + branch = cms.untracked.string('recoGenJets_slimmedGenJets__*'), + splitLevel = cms.untracked.int32(99) + ), + cms.untracked.PSet( + branch = cms.untracked.string('patJets_slimmedJetsPuppi__*'), + splitLevel = cms.untracked.int32(99) + ), + cms.untracked.PSet( + branch = cms.untracked.string('EcalRecHitsSorted_reducedEgamma_reducedESRecHits_*'), + splitLevel = cms.untracked.int32(99) + ) + ), + overrideInputFileSplitLevels = cms.untracked.bool(True), + splitLevel = cms.untracked.int32(0) +) + +process.DQMoutput = cms.OutputModule("DQMRootOutputModule", + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('DQMIO'), + filterName = cms.untracked.string('') + ), + fileName = cms.untracked.string('file:step3_inDQM.root'), + outputCommands = process.DQMEventContent.outputCommands, + splitLevel = cms.untracked.int32(0) +) + +# Additional output definition + +# Other statements +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T15', '') + +# Path and EndPath definitions +process.L1Reco_step = cms.Path(process.L1Reco) +process.reconstruction_step = cms.Path(cms.Sequence(cms.Task( + bunchSpacingProducer, + ecalUncalibRecHitPhase2Task +))) + +process.FEVTDEBUGHLToutput_step = cms.EndPath(process.FEVTDEBUGHLToutput) + +# Schedule definition +process.schedule = cms.Schedule(process.L1Reco_step,process.reconstruction_step,process.FEVTDEBUGHLToutput_step) +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) + + + +# Customisation from command line + +#Have logErrorHarvester wait for the same EDProducers to finish as those providing data for the OutputModule +from FWCore.Modules.logErrorHarvester_cff import customiseLogErrorHarvesterUsingOutputCommands +process = customiseLogErrorHarvesterUsingOutputCommands(process) + +# Add early deletion of temporary data products to reduce peak memory need +from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete +process = customiseEarlyDelete(process) +# End adding early deletion diff --git a/RecoLocalCalo/HGCalRecProducers/plugins/HeterogeneousHGCalHEFCellPositionsConditions.cc b/RecoLocalCalo/HGCalRecProducers/plugins/HeterogeneousHGCalHEFCellPositionsConditions.cc index d8074c58a7927..446722f8ee418 100644 --- a/RecoLocalCalo/HGCalRecProducers/plugins/HeterogeneousHGCalHEFCellPositionsConditions.cc +++ b/RecoLocalCalo/HGCalRecProducers/plugins/HeterogeneousHGCalHEFCellPositionsConditions.cc @@ -1,3 +1,4 @@ +#include "KernelManagerHGCalCellPositions.h" #include "CondFormats/HGCalObjects/interface/HeterogeneousHGCalHEFCellPositionsConditions.h" HeterogeneousHGCalHEFCellPositionsConditions::HeterogeneousHGCalHEFCellPositionsConditions( diff --git a/RecoLocalCalo/HcalRecAlgos/src/HybridMinimizer.h b/RecoLocalCalo/HcalRecAlgos/interface/HybridMinimizer.h similarity index 100% rename from RecoLocalCalo/HcalRecAlgos/src/HybridMinimizer.h rename to RecoLocalCalo/HcalRecAlgos/interface/HybridMinimizer.h diff --git a/RecoLocalCalo/HcalRecAlgos/interface/PulseShapeFitOOTPileupCorrection.h b/RecoLocalCalo/HcalRecAlgos/interface/PulseShapeFitOOTPileupCorrection.h index fa0c61f61ecba..834e5754bb7e0 100644 --- a/RecoLocalCalo/HcalRecAlgos/interface/PulseShapeFitOOTPileupCorrection.h +++ b/RecoLocalCalo/HcalRecAlgos/interface/PulseShapeFitOOTPileupCorrection.h @@ -16,7 +16,7 @@ #include "Minuit2/Minuit2Minimizer.h" #include "Math/Functor.h" -#include "RecoLocalCalo/HcalRecAlgos/src/HybridMinimizer.h" +#include "RecoLocalCalo/HcalRecAlgos/interface/HybridMinimizer.h" class HcalTimeSlew; diff --git a/RecoLocalCalo/HcalRecAlgos/src/HybridMinimizer.cc b/RecoLocalCalo/HcalRecAlgos/src/HybridMinimizer.cc index ce3bd9804a908..61d8e071801fc 100644 --- a/RecoLocalCalo/HcalRecAlgos/src/HybridMinimizer.cc +++ b/RecoLocalCalo/HcalRecAlgos/src/HybridMinimizer.cc @@ -13,7 +13,7 @@ // different minimizer... // Implementation file for class HybridMinimizer -#include "RecoLocalCalo/HcalRecAlgos/src/HybridMinimizer.h" +#include "RecoLocalCalo/HcalRecAlgos/interface/HybridMinimizer.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "Math/IFunction.h" diff --git a/RecoLocalMuon/DTRecHit/BuildFile.xml b/RecoLocalMuon/DTRecHit/BuildFile.xml index aa0feb7a5aad5..363338ca76701 100644 --- a/RecoLocalMuon/DTRecHit/BuildFile.xml +++ b/RecoLocalMuon/DTRecHit/BuildFile.xml @@ -5,6 +5,8 @@ + + diff --git a/RecoLocalMuon/DTRecHit/plugins/BuildFile.xml b/RecoLocalMuon/DTRecHit/plugins/BuildFile.xml index 22d2bea2193ec..b6cbbabbf51a3 100644 --- a/RecoLocalMuon/DTRecHit/plugins/BuildFile.xml +++ b/RecoLocalMuon/DTRecHit/plugins/BuildFile.xml @@ -1,3 +1,5 @@ + + diff --git a/RecoLocalMuon/DTRecHit/plugins/DTLinearDriftFromDBAlgo.cc b/RecoLocalMuon/DTRecHit/plugins/DTLinearDriftFromDBAlgo.cc index cd0af2ac025de..7342701423411 100644 --- a/RecoLocalMuon/DTRecHit/plugins/DTLinearDriftFromDBAlgo.cc +++ b/RecoLocalMuon/DTRecHit/plugins/DTLinearDriftFromDBAlgo.cc @@ -15,6 +15,7 @@ #include "CondFormats/DTObjects/interface/DTMtime.h" #include "CondFormats/DataRecord/interface/DTMtimeRcd.h" #include "CondFormats/DTObjects/interface/DTRecoConditions.h" +#include "CondFormats/DataRecord/interface/DTRecoConditionsVdriftRcd.h" #include "CondFormats/DataRecord/interface/DTRecoConditionsUncertRcd.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "MagneticField/Engine/interface/MagneticField.h" @@ -26,6 +27,7 @@ using namespace edm; DTLinearDriftFromDBAlgo::DTLinearDriftFromDBAlgo(const ParameterSet& config) : DTRecHitBaseAlgo(config), mTimeMap(nullptr), + vDriftMap(nullptr), field(nullptr), nominalB(-1), minTime(config.getParameter("minTime")), @@ -34,6 +36,8 @@ DTLinearDriftFromDBAlgo::DTLinearDriftFromDBAlgo(const ParameterSet& config) // Option to force going back to digi time at Step 2 stepTwoFromDigi(config.getParameter("stepTwoFromDigi")), useUncertDB(config.getParameter("useUncertDB")), + readLegacyTTrigDB(config.getParameter("readLegacyTTrigDB")), + readLegacyVDriftDB(config.getParameter("readLegacyVDriftDB")), // Set verbose output debug(config.getUntrackedParameter("debug")) {} @@ -41,12 +45,26 @@ DTLinearDriftFromDBAlgo::~DTLinearDriftFromDBAlgo() {} void DTLinearDriftFromDBAlgo::setES(const EventSetup& setup) { if (debug) - cout << "[DTLinearDriftFromDBAlgo] setES called" << endl; + edm::LogVerbatim("DTLocalReco") << "[DTLinearDriftFromDBAlgo] setES called" << endl; theSync->setES(setup); // Get the map of ttrig from the Setup - ESHandle mTimeHandle; - setup.get().get(mTimeHandle); - mTimeMap = &*mTimeHandle; + if (readLegacyVDriftDB) { + ESHandle mTimeHandle; + setup.get().get(mTimeHandle); + mTimeMap = &*mTimeHandle; + vDriftMap = nullptr; + } else { + ESHandle hVdrift; + setup.get().get(hVdrift); + vDriftMap = &*hVdrift; + mTimeMap = nullptr; + + // Consistency check: no parametrization is implemented for the time being + int version = vDriftMap->version(); + if (version != 1) { + throw cms::Exception("Configuration") << "only version 1 is presently supported for VDriftDB"; + } + } ESHandle magfield; setup.get().get(magfield); @@ -62,9 +80,15 @@ void DTLinearDriftFromDBAlgo::setES(const EventSetup& setup) { } if (debug) { - cout << "[DTLinearDriftFromDBAlgo] meanTimer version: " << mTimeMap->version() << endl; + if (readLegacyVDriftDB) { + edm::LogVerbatim("DTLocalReco") << "[DTLinearDriftFromDBAlgo] meanTimer version: " << mTimeMap->version() << endl; + } else { + edm::LogVerbatim("DTLocalReco") << "[DTLinearDriftFromDBAlgo] vDrift version: " << vDriftMap->version() << endl; + } + if (useUncertDB) - cout << " uncertDB version: " << uncertMap->version() << endl; + edm::LogVerbatim("DTLocalReco") << " uncertDB version: " << uncertMap->version() + << endl; } } @@ -129,7 +153,8 @@ bool DTLinearDriftFromDBAlgo::compute(const DTLayer* layer, // check for out-of-time if (driftTime < minTime || driftTime > maxTime) { if (debug) - cout << "[DTLinearDriftFromDBAlgo]*** Drift time out of window for in-time hits " << driftTime << endl; + edm::LogWarning("DTLocalReco") << "[DTLinearDriftFromDBAlgo]*** Drift time out of window for in-time hits " + << driftTime << endl; if (step == 1) { //FIXME: protection against failure at 2nd and 3rd steps, must be checked!!! // Hits are interpreted as coming from out-of-time pile-up and recHit @@ -145,11 +170,17 @@ bool DTLinearDriftFromDBAlgo::compute(const DTLayer* layer, // Read the vDrift and reso for this wire float vDrift = 0; float hitResolution = 0; - // vdrift is cm/ns , resolution is cm - mTimeMap->get(wireId.superlayerId(), - vDrift, - hitResolution, // Value from vdrift DB; replaced below if useUncertDB card is set - DTVelocityUnits::cm_per_ns); + + if (readLegacyVDriftDB) { + // vdrift is cm/ns , resolution is cm + mTimeMap->get(wireId.superlayerId(), + vDrift, + hitResolution, // Value from vdrift DB; replaced below if useUncertDB card is set + DTVelocityUnits::cm_per_ns); + } else { + // For v2, we will pass also: double args[1] = {(layer->toLocal(globPos)).y()}; + vDrift = vDriftMap->get(wireId); + } if (useUncertDB) { // Read the uncertainty from the DB for the given channel and step @@ -182,15 +213,16 @@ bool DTLinearDriftFromDBAlgo::compute(const DTLayer* layer, error = LocalError(hitResolution * hitResolution, 0., 0.); if (debug) { - cout << "[DTLinearDriftFromDBAlgo] Compute drift distance, for digi at wire: " << wireId << endl - << " Step: " << step << endl - << " Digi time: " << digiTime << endl - << " Drift time: " << driftTime << endl - << " Drift distance: " << drift << endl - << " Hit Resolution: " << hitResolution << endl - << " Left point: " << leftPoint << endl - << " Right point: " << rightPoint << endl - << " Error: " << error << endl; + edm::LogWarning("DTLocalReco") << "[DTLinearDriftFromDBAlgo] Compute drift distance, for digi at wire: " << wireId + << endl + << " Step: " << step << endl + << " Digi time: " << digiTime << endl + << " Drift time: " << driftTime << endl + << " Drift distance: " << drift << endl + << " Hit Resolution: " << hitResolution << endl + << " Left point: " << leftPoint << endl + << " Right point: " << rightPoint << endl + << " Error: " << error << endl; } return true; diff --git a/RecoLocalMuon/DTRecHit/plugins/DTLinearDriftFromDBAlgo.h b/RecoLocalMuon/DTRecHit/plugins/DTLinearDriftFromDBAlgo.h index e922e99e376d1..21d5cc89bdaa4 100644 --- a/RecoLocalMuon/DTRecHit/plugins/DTLinearDriftFromDBAlgo.h +++ b/RecoLocalMuon/DTRecHit/plugins/DTLinearDriftFromDBAlgo.h @@ -76,9 +76,12 @@ class DTLinearDriftFromDBAlgo : public DTRecHitBaseAlgo { DTRecHit1D& newHit1D, int step) const; - //Map of meantimes + // Map of meantimes (old DB format) const DTMtime* mTimeMap; + // Drift velocity (new DB format) + const DTRecoConditions* vDriftMap; + // MF field const MagneticField* field; int nominalB; @@ -103,6 +106,10 @@ class DTLinearDriftFromDBAlgo : public DTRecHitBaseAlgo { // If false, the value taken from vdrift DB is used instead. bool useUncertDB; + // Read legacy format for vdrift and ttrig DBs + bool readLegacyTTrigDB; + bool readLegacyVDriftDB; + // Switch on/off the verbosity const bool debug; }; diff --git a/RecoLocalMuon/DTRecHit/plugins/SealModule.cc b/RecoLocalMuon/DTRecHit/plugins/SealModule.cc index 44fb6ecd64e5e..6f49f7bd3f3d2 100644 --- a/RecoLocalMuon/DTRecHit/plugins/SealModule.cc +++ b/RecoLocalMuon/DTRecHit/plugins/SealModule.cc @@ -1,5 +1,4 @@ -#include "FWCore/PluginManager/interface/ModuleDef.h" - +#include "FWCore/PluginManager/interface/PluginFactory.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "RecoLocalMuon/DTRecHit/plugins/DTRecHitProducer.h" @@ -9,17 +8,9 @@ #include "RecoLocalMuon/DTRecHit/plugins/DTLinearDriftFromDBAlgo.h" #include "RecoLocalMuon/DTRecHit/plugins/DTParametrizedDriftAlgo.h" -#include "CalibMuon/DTDigiSync/interface/DTTTrigSyncFactory.h" -#include "CalibMuon/DTDigiSync/src/DTTTrigSyncTOFCorr.h" -#include "CalibMuon/DTDigiSync/src/DTTTrigSyncT0Only.h" -#include "CalibMuon/DTDigiSync/src/DTTTrigSyncFromDB.h" - DEFINE_FWK_MODULE(DTRecHitProducer); DEFINE_EDM_PLUGIN(DTRecHitAlgoFactory, DTNoDriftAlgo, "DTNoDriftAlgo"); DEFINE_EDM_PLUGIN(DTRecHitAlgoFactory, DTLinearDriftAlgo, "DTLinearDriftAlgo"); DEFINE_EDM_PLUGIN(DTRecHitAlgoFactory, DTLinearDriftFromDBAlgo, "DTLinearDriftFromDBAlgo"); DEFINE_EDM_PLUGIN(DTRecHitAlgoFactory, DTParametrizedDriftAlgo, "DTParametrizedDriftAlgo"); -DEFINE_EDM_PLUGIN(DTTTrigSyncFactory, DTTTrigSyncTOFCorr, "DTTTrigSyncTOFCorr"); -DEFINE_EDM_PLUGIN(DTTTrigSyncFactory, DTTTrigSyncT0Only, "DTTTrigSyncT0Only"); -DEFINE_EDM_PLUGIN(DTTTrigSyncFactory, DTTTrigSyncFromDB, "DTTTrigSyncFromDB"); diff --git a/RecoLocalMuon/DTRecHit/python/DTLinearDriftFromDBAlgo_CosmicData_cfi.py b/RecoLocalMuon/DTRecHit/python/DTLinearDriftFromDBAlgo_CosmicData_cfi.py index 6df82f56d106d..3ece295ff02f0 100644 --- a/RecoLocalMuon/DTRecHit/python/DTLinearDriftFromDBAlgo_CosmicData_cfi.py +++ b/RecoLocalMuon/DTRecHit/python/DTLinearDriftFromDBAlgo_CosmicData_cfi.py @@ -28,7 +28,9 @@ # The module to be used for ttrig synchronization and its set parameter tTrigMode = cms.string('DTTTrigSyncFromDB'), doVdriftCorr = cms.bool(False), - useUncertDB = cms.bool(False) + useUncertDB = cms.bool(False), + readLegacyTTrigDB = cms.bool(True), + readLegacyVDriftDB = cms.bool(True), ), recAlgo = cms.string('DTLinearDriftFromDBAlgo') ) diff --git a/RecoLocalMuon/DTRecHit/python/DTLinearDriftFromDBAlgo_cfi.py b/RecoLocalMuon/DTRecHit/python/DTLinearDriftFromDBAlgo_cfi.py index 984bdde7a26f1..31213477d3ed5 100644 --- a/RecoLocalMuon/DTRecHit/python/DTLinearDriftFromDBAlgo_cfi.py +++ b/RecoLocalMuon/DTRecHit/python/DTLinearDriftFromDBAlgo_cfi.py @@ -29,7 +29,9 @@ tTrigMode = cms.string('DTTTrigSyncFromDB'), # perform a correction to vdrift in MB1s of external wheels doVdriftCorr = cms.bool(True), - useUncertDB = cms.bool(True) + useUncertDB = cms.bool(True), + readLegacyTTrigDB = cms.bool(True), + readLegacyVDriftDB = cms.bool(True), ), recAlgo = cms.string('DTLinearDriftFromDBAlgo') ) diff --git a/RecoLocalMuon/RPCRecHit/BuildFile.xml b/RecoLocalMuon/RPCRecHit/plugins/BuildFile.xml similarity index 100% rename from RecoLocalMuon/RPCRecHit/BuildFile.xml rename to RecoLocalMuon/RPCRecHit/plugins/BuildFile.xml diff --git a/RecoLocalMuon/RPCRecHit/src/CSCObjectMap.cc b/RecoLocalMuon/RPCRecHit/plugins/CSCObjectMap.cc similarity index 95% rename from RecoLocalMuon/RPCRecHit/src/CSCObjectMap.cc rename to RecoLocalMuon/RPCRecHit/plugins/CSCObjectMap.cc index bcc85ac870221..20b56db1eb24e 100644 --- a/RecoLocalMuon/RPCRecHit/src/CSCObjectMap.cc +++ b/RecoLocalMuon/RPCRecHit/plugins/CSCObjectMap.cc @@ -5,8 +5,8 @@ #include "Geometry/RPCGeometry/interface/RPCGeomServ.h" #include "Geometry/RPCGeometry/interface/RPCChamber.h" #include "Geometry/RPCGeometry/interface/RPCRoll.h" -#include "RecoLocalMuon/RPCRecHit/src/CSCObjectMap.h" -#include "RecoLocalMuon/RPCRecHit/src/CSCStationIndex.h" +#include "CSCObjectMap.h" +#include "CSCStationIndex.h" CSCObjectMap::CSCObjectMap(RPCGeometry const& rpcGeo) { for (TrackingGeometry::DetContainer::const_iterator it = rpcGeo.dets().begin(); it < rpcGeo.dets().end(); it++) { diff --git a/RecoLocalMuon/RPCRecHit/src/CSCObjectMap.h b/RecoLocalMuon/RPCRecHit/plugins/CSCObjectMap.h similarity index 89% rename from RecoLocalMuon/RPCRecHit/src/CSCObjectMap.h rename to RecoLocalMuon/RPCRecHit/plugins/CSCObjectMap.h index fd882b3ca618e..380f7ad6ca799 100644 --- a/RecoLocalMuon/RPCRecHit/src/CSCObjectMap.h +++ b/RecoLocalMuon/RPCRecHit/plugins/CSCObjectMap.h @@ -2,7 +2,7 @@ #define RecoLocalMuon_RPCRecHit_CSCObjectMap_h #include "DataFormats/MuonDetId/interface/RPCDetId.h" -#include "RecoLocalMuon/RPCRecHit/src/CSCStationIndex.h" +#include "CSCStationIndex.h" #include "Geometry/RPCGeometry/interface/RPCGeometry.h" #include diff --git a/RecoLocalMuon/RPCRecHit/src/CSCObjectMapESProducer.cc b/RecoLocalMuon/RPCRecHit/plugins/CSCObjectMapESProducer.cc similarity index 95% rename from RecoLocalMuon/RPCRecHit/src/CSCObjectMapESProducer.cc rename to RecoLocalMuon/RPCRecHit/plugins/CSCObjectMapESProducer.cc index 43bb8f9e9271c..ca1499b1d8876 100644 --- a/RecoLocalMuon/RPCRecHit/src/CSCObjectMapESProducer.cc +++ b/RecoLocalMuon/RPCRecHit/plugins/CSCObjectMapESProducer.cc @@ -8,7 +8,7 @@ #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "RecoLocalMuon/RPCRecHit/src/CSCObjectMap.h" +#include "CSCObjectMap.h" class CSCObjectMapESProducer : public edm::ESProducer { public: diff --git a/RecoLocalMuon/RPCRecHit/src/CSCSegtoRPC.cc b/RecoLocalMuon/RPCRecHit/plugins/CSCSegtoRPC.cc similarity index 98% rename from RecoLocalMuon/RPCRecHit/src/CSCSegtoRPC.cc rename to RecoLocalMuon/RPCRecHit/plugins/CSCSegtoRPC.cc index 5cb6b0ea8215d..27e32c4d7408c 100644 --- a/RecoLocalMuon/RPCRecHit/src/CSCSegtoRPC.cc +++ b/RecoLocalMuon/RPCRecHit/plugins/CSCSegtoRPC.cc @@ -8,9 +8,9 @@ #include "Geometry/RPCGeometry/interface/RPCGeomServ.h" #include "DataFormats/RPCRecHit/interface/RPCRecHit.h" #include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h" -#include "RecoLocalMuon/RPCRecHit/interface/CSCSegtoRPC.h" -#include "RecoLocalMuon/RPCRecHit/src/CSCStationIndex.h" -#include "RecoLocalMuon/RPCRecHit/src/CSCObjectMap.h" +#include "CSCSegtoRPC.h" +#include "CSCStationIndex.h" +#include "CSCObjectMap.h" CSCSegtoRPC::CSCSegtoRPC(edm::ConsumesCollector iC) : rpcGeoToken_(iC.esConsumes()), cscGeoToken_(iC.esConsumes()), cscMapToken_(iC.esConsumes()) {} diff --git a/RecoLocalMuon/RPCRecHit/interface/CSCSegtoRPC.h b/RecoLocalMuon/RPCRecHit/plugins/CSCSegtoRPC.h similarity index 100% rename from RecoLocalMuon/RPCRecHit/interface/CSCSegtoRPC.h rename to RecoLocalMuon/RPCRecHit/plugins/CSCSegtoRPC.h diff --git a/RecoLocalMuon/RPCRecHit/src/CSCStationIndex.h b/RecoLocalMuon/RPCRecHit/plugins/CSCStationIndex.h similarity index 100% rename from RecoLocalMuon/RPCRecHit/src/CSCStationIndex.h rename to RecoLocalMuon/RPCRecHit/plugins/CSCStationIndex.h diff --git a/RecoLocalMuon/RPCRecHit/src/DTObjectMap.cc b/RecoLocalMuon/RPCRecHit/plugins/DTObjectMap.cc similarity index 94% rename from RecoLocalMuon/RPCRecHit/src/DTObjectMap.cc rename to RecoLocalMuon/RPCRecHit/plugins/DTObjectMap.cc index 31e49a11c6482..f77f6aa04c71c 100644 --- a/RecoLocalMuon/RPCRecHit/src/DTObjectMap.cc +++ b/RecoLocalMuon/RPCRecHit/plugins/DTObjectMap.cc @@ -6,8 +6,8 @@ #include "Geometry/RPCGeometry/interface/RPCGeomServ.h" #include "Geometry/RPCGeometry/interface/RPCChamber.h" #include "Geometry/RPCGeometry/interface/RPCRoll.h" -#include "RecoLocalMuon/RPCRecHit/src/DTObjectMap.h" -#include "RecoLocalMuon/RPCRecHit/src/DTStationIndex.h" +#include "DTObjectMap.h" +#include "DTStationIndex.h" DTObjectMap::DTObjectMap(RPCGeometry const& rpcGeo) { for (TrackingGeometry::DetContainer::const_iterator it = rpcGeo.dets().begin(); it < rpcGeo.dets().end(); it++) { diff --git a/RecoLocalMuon/RPCRecHit/src/DTObjectMap.h b/RecoLocalMuon/RPCRecHit/plugins/DTObjectMap.h similarity index 89% rename from RecoLocalMuon/RPCRecHit/src/DTObjectMap.h rename to RecoLocalMuon/RPCRecHit/plugins/DTObjectMap.h index 553ea6d5065c3..c1a814dbffcdd 100644 --- a/RecoLocalMuon/RPCRecHit/src/DTObjectMap.h +++ b/RecoLocalMuon/RPCRecHit/plugins/DTObjectMap.h @@ -2,7 +2,7 @@ #define RecoLocalMuon_RPCRecHit_DTObjectMap_h #include "DataFormats/MuonDetId/interface/RPCDetId.h" -#include "RecoLocalMuon/RPCRecHit/src/DTStationIndex.h" +#include "DTStationIndex.h" #include "Geometry/RPCGeometry/interface/RPCGeometry.h" #include diff --git a/RecoLocalMuon/RPCRecHit/src/DTObjectMapESProducer.cc b/RecoLocalMuon/RPCRecHit/plugins/DTObjectMapESProducer.cc similarity index 95% rename from RecoLocalMuon/RPCRecHit/src/DTObjectMapESProducer.cc rename to RecoLocalMuon/RPCRecHit/plugins/DTObjectMapESProducer.cc index 11d8d9d6fd44b..a353fb50af57a 100644 --- a/RecoLocalMuon/RPCRecHit/src/DTObjectMapESProducer.cc +++ b/RecoLocalMuon/RPCRecHit/plugins/DTObjectMapESProducer.cc @@ -8,7 +8,7 @@ #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "RecoLocalMuon/RPCRecHit/src/DTObjectMap.h" +#include "DTObjectMap.h" class DTObjectMapESProducer : public edm::ESProducer { public: diff --git a/RecoLocalMuon/RPCRecHit/src/DTSegtoRPC.cc b/RecoLocalMuon/RPCRecHit/plugins/DTSegtoRPC.cc similarity index 99% rename from RecoLocalMuon/RPCRecHit/src/DTSegtoRPC.cc rename to RecoLocalMuon/RPCRecHit/plugins/DTSegtoRPC.cc index 47b2cbb2cb6db..e4beb3b6bdc15 100644 --- a/RecoLocalMuon/RPCRecHit/src/DTSegtoRPC.cc +++ b/RecoLocalMuon/RPCRecHit/plugins/DTSegtoRPC.cc @@ -8,9 +8,9 @@ #include "Geometry/RPCGeometry/interface/RPCGeomServ.h" #include "DataFormats/RPCRecHit/interface/RPCRecHit.h" #include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h" -#include "RecoLocalMuon/RPCRecHit/interface/DTSegtoRPC.h" -#include "RecoLocalMuon/RPCRecHit/src/DTObjectMap.h" -#include "RecoLocalMuon/RPCRecHit/src/DTStationIndex.h" +#include "DTSegtoRPC.h" +#include "DTObjectMap.h" +#include "DTStationIndex.h" #include diff --git a/RecoLocalMuon/RPCRecHit/interface/DTSegtoRPC.h b/RecoLocalMuon/RPCRecHit/plugins/DTSegtoRPC.h similarity index 100% rename from RecoLocalMuon/RPCRecHit/interface/DTSegtoRPC.h rename to RecoLocalMuon/RPCRecHit/plugins/DTSegtoRPC.h diff --git a/RecoLocalMuon/RPCRecHit/src/DTStationIndex.h b/RecoLocalMuon/RPCRecHit/plugins/DTStationIndex.h similarity index 100% rename from RecoLocalMuon/RPCRecHit/src/DTStationIndex.h rename to RecoLocalMuon/RPCRecHit/plugins/DTStationIndex.h diff --git a/RecoLocalMuon/RPCRecHit/src/RPCCluster.cc b/RecoLocalMuon/RPCRecHit/plugins/RPCCluster.cc similarity index 100% rename from RecoLocalMuon/RPCRecHit/src/RPCCluster.cc rename to RecoLocalMuon/RPCRecHit/plugins/RPCCluster.cc diff --git a/RecoLocalMuon/RPCRecHit/src/RPCCluster.h b/RecoLocalMuon/RPCRecHit/plugins/RPCCluster.h similarity index 100% rename from RecoLocalMuon/RPCRecHit/src/RPCCluster.h rename to RecoLocalMuon/RPCRecHit/plugins/RPCCluster.h diff --git a/RecoLocalMuon/RPCRecHit/src/RPCClusterContainer.h b/RecoLocalMuon/RPCRecHit/plugins/RPCClusterContainer.h similarity index 100% rename from RecoLocalMuon/RPCRecHit/src/RPCClusterContainer.h rename to RecoLocalMuon/RPCRecHit/plugins/RPCClusterContainer.h diff --git a/RecoLocalMuon/RPCRecHit/src/RPCClusterizer.cc b/RecoLocalMuon/RPCRecHit/plugins/RPCClusterizer.cc similarity index 100% rename from RecoLocalMuon/RPCRecHit/src/RPCClusterizer.cc rename to RecoLocalMuon/RPCRecHit/plugins/RPCClusterizer.cc diff --git a/RecoLocalMuon/RPCRecHit/src/RPCClusterizer.h b/RecoLocalMuon/RPCRecHit/plugins/RPCClusterizer.h similarity index 100% rename from RecoLocalMuon/RPCRecHit/src/RPCClusterizer.h rename to RecoLocalMuon/RPCRecHit/plugins/RPCClusterizer.h diff --git a/RecoLocalMuon/RPCRecHit/src/RPCMaskReClusterizer.cc b/RecoLocalMuon/RPCRecHit/plugins/RPCMaskReClusterizer.cc similarity index 100% rename from RecoLocalMuon/RPCRecHit/src/RPCMaskReClusterizer.cc rename to RecoLocalMuon/RPCRecHit/plugins/RPCMaskReClusterizer.cc diff --git a/RecoLocalMuon/RPCRecHit/src/RPCMaskReClusterizer.h b/RecoLocalMuon/RPCRecHit/plugins/RPCMaskReClusterizer.h similarity index 100% rename from RecoLocalMuon/RPCRecHit/src/RPCMaskReClusterizer.h rename to RecoLocalMuon/RPCRecHit/plugins/RPCMaskReClusterizer.h diff --git a/RecoLocalMuon/RPCRecHit/src/RPCPointProducer.cc b/RecoLocalMuon/RPCRecHit/plugins/RPCPointProducer.cc similarity index 98% rename from RecoLocalMuon/RPCRecHit/src/RPCPointProducer.cc rename to RecoLocalMuon/RPCRecHit/plugins/RPCPointProducer.cc index 615bea872d38e..17dc044ba8f5c 100644 --- a/RecoLocalMuon/RPCRecHit/src/RPCPointProducer.cc +++ b/RecoLocalMuon/RPCRecHit/plugins/RPCPointProducer.cc @@ -16,7 +16,7 @@ // // -#include "RecoLocalMuon/RPCRecHit/interface/RPCPointProducer.h" +#include "RPCPointProducer.h" // system include files diff --git a/RecoLocalMuon/RPCRecHit/interface/RPCPointProducer.h b/RecoLocalMuon/RPCRecHit/plugins/RPCPointProducer.h similarity index 87% rename from RecoLocalMuon/RPCRecHit/interface/RPCPointProducer.h rename to RecoLocalMuon/RPCRecHit/plugins/RPCPointProducer.h index c09d97d63ad80..e48344d34ee93 100644 --- a/RecoLocalMuon/RPCRecHit/interface/RPCPointProducer.h +++ b/RecoLocalMuon/RPCRecHit/plugins/RPCPointProducer.h @@ -11,9 +11,9 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/RPCRecHit/interface/RPCRecHit.h" #include "DataFormats/MuonDetId/interface/RPCDetId.h" -#include "RecoLocalMuon/RPCRecHit/interface/DTSegtoRPC.h" -#include "RecoLocalMuon/RPCRecHit/interface/CSCSegtoRPC.h" -#include "RecoLocalMuon/RPCRecHit/interface/TracktoRPC.h" +#include "DTSegtoRPC.h" +#include "CSCSegtoRPC.h" +#include "TracktoRPC.h" // // class decleration diff --git a/RecoLocalMuon/RPCRecHit/src/RPCRecHitAlgoFactory.cc b/RecoLocalMuon/RPCRecHit/plugins/RPCRecHitAlgoFactory.cc similarity index 77% rename from RecoLocalMuon/RPCRecHit/src/RPCRecHitAlgoFactory.cc rename to RecoLocalMuon/RPCRecHit/plugins/RPCRecHitAlgoFactory.cc index 267a550965499..6b32722e7f4b4 100644 --- a/RecoLocalMuon/RPCRecHit/src/RPCRecHitAlgoFactory.cc +++ b/RecoLocalMuon/RPCRecHit/plugins/RPCRecHitAlgoFactory.cc @@ -4,7 +4,7 @@ * \author M. Maggi -- INFN Bari */ -#include "RecoLocalMuon/RPCRecHit/interface/RPCRecHitAlgoFactory.h" +#include "RPCRecHitAlgoFactory.h" #include "FWCore/PluginManager/interface/PluginFactory.h" diff --git a/RecoLocalMuon/RPCRecHit/interface/RPCRecHitAlgoFactory.h b/RecoLocalMuon/RPCRecHit/plugins/RPCRecHitAlgoFactory.h similarity index 88% rename from RecoLocalMuon/RPCRecHit/interface/RPCRecHitAlgoFactory.h rename to RecoLocalMuon/RPCRecHit/plugins/RPCRecHitAlgoFactory.h index 446ceeead6c6a..5124d5012a837 100644 --- a/RecoLocalMuon/RPCRecHit/interface/RPCRecHitAlgoFactory.h +++ b/RecoLocalMuon/RPCRecHit/plugins/RPCRecHitAlgoFactory.h @@ -8,7 +8,7 @@ * \author G. Cerminara - INFN Torino */ #include "FWCore/PluginManager/interface/PluginFactory.h" -#include "RecoLocalMuon/RPCRecHit/interface/RPCRecHitBaseAlgo.h" +#include "RPCRecHitBaseAlgo.h" typedef edmplugin::PluginFactory RPCRecHitAlgoFactory; #endif diff --git a/RecoLocalMuon/RPCRecHit/src/RPCRecHitBaseAlgo.cc b/RecoLocalMuon/RPCRecHit/plugins/RPCRecHitBaseAlgo.cc similarity index 83% rename from RecoLocalMuon/RPCRecHit/src/RPCRecHitBaseAlgo.cc rename to RecoLocalMuon/RPCRecHit/plugins/RPCRecHitBaseAlgo.cc index 076824b64bb0d..85f92f082c1bd 100644 --- a/RecoLocalMuon/RPCRecHit/src/RPCRecHitBaseAlgo.cc +++ b/RecoLocalMuon/RPCRecHit/plugins/RPCRecHitBaseAlgo.cc @@ -4,11 +4,11 @@ * \author M. Maggi -- INFN Bari */ -#include "RecoLocalMuon/RPCRecHit/interface/RPCRecHitBaseAlgo.h" -#include "RecoLocalMuon/RPCRecHit/src/RPCClusterContainer.h" -#include "RecoLocalMuon/RPCRecHit/src/RPCCluster.h" -#include "RecoLocalMuon/RPCRecHit/src/RPCClusterizer.h" -#include "RecoLocalMuon/RPCRecHit/src/RPCMaskReClusterizer.h" +#include "RPCRecHitBaseAlgo.h" +#include "RPCClusterContainer.h" +#include "RPCCluster.h" +#include "RPCClusterizer.h" +#include "RPCMaskReClusterizer.h" RPCRecHitBaseAlgo::RPCRecHitBaseAlgo(const edm::ParameterSet& config) { // theSync = RPCTTrigSyncFactory::get()->create(config.getParameter("tTrigMode"), diff --git a/RecoLocalMuon/RPCRecHit/interface/RPCRecHitBaseAlgo.h b/RecoLocalMuon/RPCRecHit/plugins/RPCRecHitBaseAlgo.h similarity index 97% rename from RecoLocalMuon/RPCRecHit/interface/RPCRecHitBaseAlgo.h rename to RecoLocalMuon/RPCRecHit/plugins/RPCRecHitBaseAlgo.h index df923973fec59..cdeddf422cd73 100644 --- a/RecoLocalMuon/RPCRecHit/interface/RPCRecHitBaseAlgo.h +++ b/RecoLocalMuon/RPCRecHit/plugins/RPCRecHitBaseAlgo.h @@ -15,8 +15,8 @@ #include "DataFormats/RPCRecHit/interface/RPCRecHit.h" #include "DataFormats/Common/interface/OwnVector.h" -#include "RecoLocalMuon/RPCRecHit/src/RPCRollMask.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "RPCRollMask.h" class RPCCluster; class RPCRoll; diff --git a/RecoLocalMuon/RPCRecHit/src/RPCRecHitProducer.cc b/RecoLocalMuon/RPCRecHit/plugins/RPCRecHitProducer.cc similarity index 83% rename from RecoLocalMuon/RPCRecHit/src/RPCRecHitProducer.cc rename to RecoLocalMuon/RPCRecHit/plugins/RPCRecHitProducer.cc index 8a823f55ed77e..75db587198313 100644 --- a/RecoLocalMuon/RPCRecHit/src/RPCRecHitProducer.cc +++ b/RecoLocalMuon/RPCRecHit/plugins/RPCRecHitProducer.cc @@ -5,19 +5,13 @@ #include "RPCRecHitProducer.h" -#include "FWCore/Framework/interface/ESHandle.h" - #include "Geometry/RPCGeometry/interface/RPCRoll.h" -#include "Geometry/RPCGeometry/interface/RPCGeometry.h" -#include "Geometry/Records/interface/MuonGeometryRecord.h" #include "DataFormats/MuonDetId/interface/RPCDetId.h" #include "DataFormats/RPCRecHit/interface/RPCRecHit.h" -#include "RecoLocalMuon/RPCRecHit/interface/RPCRecHitAlgoFactory.h" +#include "RPCRecHitAlgoFactory.h" #include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h" -#include "CondFormats/DataRecord/interface/RPCMaskedStripsRcd.h" -#include "CondFormats/DataRecord/interface/RPCDeadStripsRcd.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include @@ -28,6 +22,7 @@ using namespace std; RPCRecHitProducer::RPCRecHitProducer(const ParameterSet& config) : theRPCDigiLabel(consumes(config.getParameter("rpcDigiLabel"))), + theRPCGeomToken(esConsumes()), // Get the concrete reconstruction algo from the factory theAlgo{RPCRecHitAlgoFactory::get()->create(config.getParameter("recAlgo"), config.getParameter("recAlgoConfig"))}, @@ -56,6 +51,8 @@ RPCRecHitProducer::RPCRecHitProducer(const ParameterSet& config) MaskVec.push_back(Item); } inputFile.close(); + } else { + theReadoutMaskedStripsToken = esConsumes(); } const string deadSource = config.getParameter("deadSource"); @@ -74,17 +71,15 @@ RPCRecHitProducer::RPCRecHitProducer(const ParameterSet& config) DeadVec.push_back(Item); } inputFile.close(); + } else { + theReadoutDeadStripsToken = esConsumes(); } } void RPCRecHitProducer::beginRun(const edm::Run& r, const edm::EventSetup& setup) { // Getting the masked-strip information if (maskSource_ == MaskSource::EventSetup) { - edm::ESHandle readoutMaskedStrips; - setup.get().get(readoutMaskedStrips); - const RPCMaskedStrips* tmp_obj = readoutMaskedStrips.product(); - theRPCMaskedStripsObj->MaskVec = tmp_obj->MaskVec; - delete tmp_obj; + theRPCMaskedStripsObj->MaskVec = setup.getData(theReadoutMaskedStripsToken).MaskVec; } else if (maskSource_ == MaskSource::File) { std::vector::iterator posVec; for (posVec = MaskVec.begin(); posVec != MaskVec.end(); ++posVec) { @@ -97,11 +92,7 @@ void RPCRecHitProducer::beginRun(const edm::Run& r, const edm::EventSetup& setup // Getting the dead-strip information if (deadSource_ == MaskSource::EventSetup) { - edm::ESHandle readoutDeadStrips; - setup.get().get(readoutDeadStrips); - const RPCDeadStrips* tmp_obj = readoutDeadStrips.product(); - theRPCDeadStripsObj->DeadVec = tmp_obj->DeadVec; - delete tmp_obj; + theRPCDeadStripsObj->DeadVec = setup.getData(theReadoutDeadStripsToken).DeadVec; } else if (deadSource_ == MaskSource::File) { std::vector::iterator posVec; for (posVec = DeadVec.begin(); posVec != DeadVec.end(); ++posVec) { @@ -115,8 +106,7 @@ void RPCRecHitProducer::beginRun(const edm::Run& r, const edm::EventSetup& setup void RPCRecHitProducer::produce(Event& event, const EventSetup& setup) { // Get the RPC Geometry - ESHandle rpcGeom; - setup.get().get(rpcGeom); + auto const& rpcGeom = setup.getData(theRPCGeomToken); // Get the digis from the event Handle digis; @@ -135,7 +125,7 @@ void RPCRecHitProducer::produce(Event& event, const EventSetup& setup) { const RPCDetId& rpcId = (*rpcdgIt).first; // Get the GeomDet from the setup - const RPCRoll* roll = rpcGeom->roll(rpcId); + const RPCRoll* roll = rpcGeom.roll(rpcId); if (roll == nullptr) { edm::LogError("BadDigiInput") << "Failed to find RPCRoll for ID " << rpcId; continue; diff --git a/RecoLocalMuon/RPCRecHit/src/RPCRecHitProducer.h b/RecoLocalMuon/RPCRecHit/plugins/RPCRecHitProducer.h similarity index 76% rename from RecoLocalMuon/RPCRecHit/src/RPCRecHitProducer.h rename to RecoLocalMuon/RPCRecHit/plugins/RPCRecHitProducer.h index 57752cff8b115..aa665ea3e2150 100644 --- a/RecoLocalMuon/RPCRecHit/src/RPCRecHitProducer.h +++ b/RecoLocalMuon/RPCRecHit/plugins/RPCRecHitProducer.h @@ -14,7 +14,11 @@ #include "DataFormats/RPCDigi/interface/RPCDigiCollection.h" #include "CondFormats/RPCObjects/interface/RPCMaskedStrips.h" #include "CondFormats/RPCObjects/interface/RPCDeadStrips.h" -#include "RecoLocalMuon/RPCRecHit/interface/RPCRecHitBaseAlgo.h" +#include "CondFormats/DataRecord/interface/RPCMaskedStripsRcd.h" +#include "CondFormats/DataRecord/interface/RPCDeadStripsRcd.h" +#include "Geometry/RPCGeometry/interface/RPCGeometry.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "RPCRecHitBaseAlgo.h" class RPCRecHitProducer : public edm::stream::EDProducer<> { public: @@ -34,6 +38,9 @@ class RPCRecHitProducer : public edm::stream::EDProducer<> { // The label to be used to retrieve RPC digis from the event const edm::EDGetTokenT theRPCDigiLabel; // edm::InputTag theRPCDigiLabel; + edm::ESGetToken theReadoutMaskedStripsToken; + edm::ESGetToken theReadoutDeadStripsToken; + const edm::ESGetToken theRPCGeomToken; // The reconstruction algorithm std::unique_ptr theAlgo; diff --git a/RecoLocalMuon/RPCRecHit/src/RPCRecHitStandardAlgo.cc b/RecoLocalMuon/RPCRecHit/plugins/RPCRecHitStandardAlgo.cc similarity index 97% rename from RecoLocalMuon/RPCRecHit/src/RPCRecHitStandardAlgo.cc rename to RecoLocalMuon/RPCRecHit/plugins/RPCRecHitStandardAlgo.cc index 36d127181224a..d8fb9868d5a41 100644 --- a/RecoLocalMuon/RPCRecHit/src/RPCRecHitStandardAlgo.cc +++ b/RecoLocalMuon/RPCRecHit/plugins/RPCRecHitStandardAlgo.cc @@ -5,7 +5,7 @@ */ #include "RPCCluster.h" -#include "RecoLocalMuon/RPCRecHit/src/RPCRecHitStandardAlgo.h" +#include "RPCRecHitStandardAlgo.h" #include "DataFormats/MuonDetId/interface/RPCDetId.h" #include "Geometry/RPCGeometry/interface/RPCRoll.h" #include "Geometry/CommonTopologies/interface/StripTopology.h" diff --git a/RecoLocalMuon/RPCRecHit/src/RPCRecHitStandardAlgo.h b/RecoLocalMuon/RPCRecHit/plugins/RPCRecHitStandardAlgo.h similarity index 94% rename from RecoLocalMuon/RPCRecHit/src/RPCRecHitStandardAlgo.h rename to RecoLocalMuon/RPCRecHit/plugins/RPCRecHitStandardAlgo.h index 9b1226bc66b81..e0cf1484e7b73 100644 --- a/RecoLocalMuon/RPCRecHit/src/RPCRecHitStandardAlgo.h +++ b/RecoLocalMuon/RPCRecHit/plugins/RPCRecHitStandardAlgo.h @@ -7,7 +7,7 @@ * \author M. Maggi -- INFN Bari */ -#include "RecoLocalMuon/RPCRecHit/interface/RPCRecHitBaseAlgo.h" +#include "RPCRecHitBaseAlgo.h" class RPCRecHitStandardAlgo : public RPCRecHitBaseAlgo { public: diff --git a/RecoLocalMuon/RPCRecHit/src/RPCRollMask.h b/RecoLocalMuon/RPCRecHit/plugins/RPCRollMask.h similarity index 100% rename from RecoLocalMuon/RPCRecHit/src/RPCRollMask.h rename to RecoLocalMuon/RPCRecHit/plugins/RPCRollMask.h diff --git a/RecoLocalMuon/RPCRecHit/src/SealModule.cc b/RecoLocalMuon/RPCRecHit/plugins/SealModule.cc similarity index 51% rename from RecoLocalMuon/RPCRecHit/src/SealModule.cc rename to RecoLocalMuon/RPCRecHit/plugins/SealModule.cc index 38931a628b5d8..48adb90a7421a 100644 --- a/RecoLocalMuon/RPCRecHit/src/SealModule.cc +++ b/RecoLocalMuon/RPCRecHit/plugins/SealModule.cc @@ -2,11 +2,11 @@ #include "FWCore/Framework/interface/MakerMacros.h" -#include "RecoLocalMuon/RPCRecHit/src/RPCRecHitProducer.h" -#include "RecoLocalMuon/RPCRecHit/interface/RPCPointProducer.h" +#include "RPCRecHitProducer.h" +#include "RPCPointProducer.h" -#include "RecoLocalMuon/RPCRecHit/interface/RPCRecHitAlgoFactory.h" -#include "RecoLocalMuon/RPCRecHit/src/RPCRecHitStandardAlgo.h" +#include "RPCRecHitAlgoFactory.h" +#include "RPCRecHitStandardAlgo.h" DEFINE_FWK_MODULE(RPCRecHitProducer); DEFINE_FWK_MODULE(RPCPointProducer); diff --git a/RecoLocalMuon/RPCRecHit/src/TracktoRPC.cc b/RecoLocalMuon/RPCRecHit/plugins/TracktoRPC.cc similarity index 98% rename from RecoLocalMuon/RPCRecHit/src/TracktoRPC.cc rename to RecoLocalMuon/RPCRecHit/plugins/TracktoRPC.cc index 489f82c6fbe4a..068334e06dc80 100644 --- a/RecoLocalMuon/RPCRecHit/src/TracktoRPC.cc +++ b/RecoLocalMuon/RPCRecHit/plugins/TracktoRPC.cc @@ -9,11 +9,11 @@ #include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h" #include "DataFormats/DetId/interface/DetId.h" #include "FWCore/Framework/interface/ConsumesCollector.h" -#include "RecoLocalMuon/RPCRecHit/interface/TracktoRPC.h" -#include "RecoLocalMuon/RPCRecHit/src/DTStationIndex.h" -#include "RecoLocalMuon/RPCRecHit/src/DTObjectMap.h" -#include "RecoLocalMuon/RPCRecHit/src/CSCStationIndex.h" -#include "RecoLocalMuon/RPCRecHit/src/CSCObjectMap.h" +#include "TracktoRPC.h" +#include "DTStationIndex.h" +#include "DTObjectMap.h" +#include "CSCStationIndex.h" +#include "CSCObjectMap.h" #include #include diff --git a/RecoLocalMuon/RPCRecHit/interface/TracktoRPC.h b/RecoLocalMuon/RPCRecHit/plugins/TracktoRPC.h similarity index 100% rename from RecoLocalMuon/RPCRecHit/interface/TracktoRPC.h rename to RecoLocalMuon/RPCRecHit/plugins/TracktoRPC.h diff --git a/RecoLocalTracker/Configuration/python/RecoLocalTracker_cff.py b/RecoLocalTracker/Configuration/python/RecoLocalTracker_cff.py index 809c440effb53..476c76c2f3a3f 100644 --- a/RecoLocalTracker/Configuration/python/RecoLocalTracker_cff.py +++ b/RecoLocalTracker/Configuration/python/RecoLocalTracker_cff.py @@ -8,6 +8,7 @@ from RecoLocalTracker.SiStripZeroSuppression.SiStripZeroSuppression_cfi import * from RecoLocalTracker.SiStripClusterizer.SiStripClusterizer_cfi import * from RecoLocalTracker.SiPixelClusterizer.siPixelClustersPreSplitting_cff import * +from RecoLocalTracker.SiPixelDigiReProducers.siPixelDigisMorphed_cfi import * from RecoLocalTracker.SiPixelRecHits.SiPixelRecHits_cfi import * from RecoLocalTracker.SubCollectionProducers.clustersummaryproducer_cfi import * @@ -15,6 +16,9 @@ siPixelClustersPreSplittingTask, siPixelRecHitsPreSplittingTask) +from Configuration.ProcessModifiers.siPixelDigiMorphing_cff import * +siPixelDigiMorphing.toModify(pixeltrackerlocalrecoTask, func=lambda t: t.add(siPixelDigisMorphed)) + striptrackerlocalrecoTask = cms.Task( siStripZeroSuppression, siStripClusters, diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.cc b/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.cc index 403870a156213..26b9a64ea3a52 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.cc +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.cc @@ -62,6 +62,7 @@ PixelThresholdClusterizer::PixelThresholdClusterizer(edm::ParameterSet const& co doMissCalibrate(conf.getParameter("MissCalibrate")), doSplitClusters(conf.getParameter("SplitClusters")) { theBuffer.setSize(theNumOfRows, theNumOfCols); + theFakePixels.clear(); } ///////////////////////////////////////////////////////////////////////////// PixelThresholdClusterizer::~PixelThresholdClusterizer() {} @@ -110,6 +111,8 @@ bool PixelThresholdClusterizer::setup(const PixelGeomDetUnit* pixDet) { theBuffer.setSize(nrows, ncols); // Modify } + theFakePixels.resize(nrows * ncols, false); + return true; } //---------------------------------------------------------------------------- @@ -179,6 +182,8 @@ void PixelThresholdClusterizer::clusterizeDetUnitT(const T& input, // Need to clean unused pixels from the buffer array. clear_buffer(begin, end); + + theFakePixels.clear(); } //---------------------------------------------------------------------------- @@ -218,7 +223,7 @@ void PixelThresholdClusterizer::copy_to_buffer(DigiIterator begin, DigiIterator } #endif int electron[end - begin]; // pixel charge in electrons - memset(electron, 0, sizeof(electron)); + memset(electron, 0, (end - begin) * sizeof(int)); if (doPhase2Calibration) { int i = 0; @@ -257,7 +262,9 @@ void PixelThresholdClusterizer::copy_to_buffer(DigiIterator begin, DigiIterator for (DigiIterator di = begin; di != end; ++di) { int row = di->row(); int col = di->column(); - int adc = electron[i++]; // this is in electrons + // VV: do not calibrate a fake pixel, it already has a unit of 10e-: + int adc = (di->flag() != 0) ? di->adc() * 10 : electron[i]; // this is in electrons + i++; #ifdef PIXELREGRESSION int adcOld = calibrate(di->adc(), col, row); @@ -277,6 +284,9 @@ void PixelThresholdClusterizer::copy_to_buffer(DigiIterator begin, DigiIterator if (adc >= thePixelThreshold) { theBuffer.set_adc(row, col, adc); + // VV: add pixel to the fake list. Only when running on digi collection + if (di->flag() != 0) + theFakePixels[row * theNumOfCols + col] = true; if (adc >= theSeedThreshold) theSeeds.push_back(SiPixelCluster::PixelPos(row, col)); } @@ -414,8 +424,9 @@ SiPixelCluster PixelThresholdClusterizer::make_cluster(const SiPixelCluster::Pix theBuffer.set_adc(pix, 1); // } - AccretionCluster acluster; + AccretionCluster acluster, cldata; acluster.add(pix, seed_adc); + cldata.add(pix, seed_adc); //Here we search all pixels adjacent to all pixels in the cluster. bool dead_flag = false; @@ -433,6 +444,10 @@ SiPixelCluster PixelThresholdClusterizer::make_cluster(const SiPixelCluster::Pix SiPixelCluster::PixelPos newpix(r, c); if (!acluster.add(newpix, theBuffer(r, c))) goto endClus; + // VV: no fake pixels in cluster, leads to non-contiguous clusters + if (!theFakePixels[r * theNumOfCols + c]) { + cldata.add(newpix, theBuffer(r, c)); + } theBuffer.set_adc(newpix, 1); } @@ -464,7 +479,7 @@ SiPixelCluster PixelThresholdClusterizer::make_cluster(const SiPixelCluster::Pix } // while accretion endClus: - SiPixelCluster cluster(acluster.isize, acluster.adc, acluster.x, acluster.y, acluster.xmin, acluster.ymin); + SiPixelCluster cluster(cldata.isize, cldata.adc, cldata.x, cldata.y, cldata.xmin, cldata.ymin); //Here we split the cluster, if the flag to do so is set and we have found a dead or noisy pixel. if (dead_flag && doSplitClusters) { diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.h b/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.h index 69ef40f934856..4e0f67e2f74f6 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.h +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.h @@ -90,6 +90,8 @@ class dso_hidden PixelThresholdClusterizer final : public PixelClusterizerBase { std::vector theSeeds; // cached seed pixels std::vector theClusters; // resulting clusters + std::vector theFakePixels; // fake pixels introduced to guide clustering + //! Clustering-related quantities: float thePixelThresholdInNoiseUnits; // Pixel threshold in units of noise float theSeedThresholdInNoiseUnits; // Pixel cluster seed in units of noise diff --git a/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizerPreSplitting_cfi.py b/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizerPreSplitting_cfi.py index f3675134fb84d..e14f8c6b249b0 100644 --- a/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizerPreSplitting_cfi.py +++ b/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizerPreSplitting_cfi.py @@ -23,3 +23,11 @@ ) ) ) + +from Configuration.ProcessModifiers.siPixelDigiMorphing_cff import siPixelDigiMorphing +siPixelDigiMorphing.toModify( + siPixelClustersPreSplitting, + cpu = dict( + src = 'siPixelDigisMorphed' + ) +) diff --git a/RecoLocalTracker/SiPixelDigiReProducers/doc/SiPixelDigiReProducers.doc b/RecoLocalTracker/SiPixelDigiReProducers/doc/SiPixelDigiReProducers.doc new file mode 100644 index 0000000000000..21ae79315f2c3 --- /dev/null +++ b/RecoLocalTracker/SiPixelDigiReProducers/doc/SiPixelDigiReProducers.doc @@ -0,0 +1,6 @@ + +/*! + +\page RecoLocalTracker_SiPixelDigiReProducers Package RecoLocalTracker/SiPixelDigiReProducers +*/ + diff --git a/RecoLocalTracker/SiPixelDigiReProducers/plugins/BuildFile.xml b/RecoLocalTracker/SiPixelDigiReProducers/plugins/BuildFile.xml new file mode 100644 index 0000000000000..14f9cb309eb7b --- /dev/null +++ b/RecoLocalTracker/SiPixelDigiReProducers/plugins/BuildFile.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/RecoLocalTracker/SiPixelDigiReProducers/plugins/SiPixelDigiMorphing.cc b/RecoLocalTracker/SiPixelDigiReProducers/plugins/SiPixelDigiMorphing.cc new file mode 100644 index 0000000000000..64a4fef281b6c --- /dev/null +++ b/RecoLocalTracker/SiPixelDigiReProducers/plugins/SiPixelDigiMorphing.cc @@ -0,0 +1,207 @@ +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/Common/interface/DetSetVectorNew.h" +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/SiPixelDigi/interface/PixelDigi.h" + +#include +#include + +class SiPixelDigiMorphing : public edm::stream::EDProducer<> { +public: + explicit SiPixelDigiMorphing(const edm::ParameterSet& conf); + ~SiPixelDigiMorphing() override = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + void produce(edm::Event& e, const edm::EventSetup& c) override; + +private: + edm::EDGetTokenT> tPixelDigi_; + edm::EDPutTokenT> tPutPixelDigi_; + + const int32_t nrows_; + const int32_t ncols_; + const int32_t nrocs_; // in Phase 1, this is ROCs, but could be any subset of a pixel row + const int32_t iters_; + const uint32_t fakeAdc_; + + int32_t ncols_r_; // number of columns per ROC + int32_t ksize_; // kernel size + + std::vector kernel1_; + std::vector kernel2_; + uint64_t mask_; + + enum MorphOption { kDilate, kErode }; + + void morph(uint64_t* const imap, uint64_t* omap, uint64_t* const kernel, MorphOption op) const; +}; + +SiPixelDigiMorphing::SiPixelDigiMorphing(edm::ParameterSet const& conf) + : tPixelDigi_(consumes(conf.getParameter("src"))), + tPutPixelDigi_(produces>()), + nrows_(conf.getParameter("nrows")), + ncols_(conf.getParameter("ncols")), + nrocs_(conf.getParameter("nrocs")), + iters_(conf.getParameter("iters")), + fakeAdc_(conf.getParameter("fakeAdc")) { + if (ncols_ % nrocs_ == 0) { + ncols_r_ = ncols_ / nrocs_; + } else { + throw cms::Exception("Configuration") << "[SiPixelDigiMorphing]:" + << " number of columns not divisible with" + << " number of ROCs\n"; + } + + if (ncols_r_ + 2 * iters_ <= int(sizeof(uint64_t) * 8)) { + ksize_ = 2 * iters_ + 1; + } else { + throw cms::Exception("Configuration") << "[SiPixelDigiMorphing]:" + << " too many columns per ROC" + << " or too many iterations set\n" + << " Ncol/Nrocs+2*iters should not be" + << " more than " << sizeof(uint64_t) * 8 << "\n"; + } + + std::vector k1(conf.getParameter>("kernel1")); + std::vector k2(conf.getParameter>("kernel2")); + + kernel1_.resize(ksize_, 0); + kernel2_.resize(ksize_, 0); + mask_ = 0; + int w = (ncols_r_ + 2 * iters_) / ksize_ + ((ncols_r_ + 2 * iters_) % ksize_ != 0); + for (int j = 0; j < w; j++) { + for (int ii = 0; ii < ksize_; ii++) { + kernel1_[ii] <<= ksize_; + kernel1_[ii] |= k1[ii]; + kernel2_[ii] <<= ksize_; + kernel2_[ii] |= k2[ii]; + } + mask_ <<= ksize_; + mask_ |= 1; + } + mask_ <<= iters_; +} + +void SiPixelDigiMorphing::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("src", edm::InputTag("siPixelDigis")); + desc.add("nrows", 160); + desc.add("ncols", 416); + desc.add("nrocs", 8); + desc.add("iters", 1); + desc.add>("kernel1", {7, 7, 7}); + desc.add>("kernel2", {2, 7, 2}); + desc.add("fakeAdc", 100); + + descriptions.addWithDefaultLabel(desc); +} + +void SiPixelDigiMorphing::produce(edm::Event& e, const edm::EventSetup& es) { + auto const& inputDigi = e.get(tPixelDigi_); + + auto outputDigis = std::make_unique>(); + + const int rocSize = nrows_ + 2 * iters_; + const int arrSize = nrocs_ * rocSize; + + uint64_t imap[arrSize]; + uint64_t map1[arrSize]; + uint64_t map2[arrSize]; + + for (auto const& ds : inputDigi) { + auto rawId = ds.detId(); + edm::DetSet* detDigis = nullptr; + detDigis = &(outputDigis->find_or_insert(rawId)); + + memset(imap, 0, arrSize * sizeof(uint64_t)); + for (auto const& di : ds) { + int r = int(di.column()) / ncols_r_; + int c = int(di.column()) % ncols_r_; + imap[r * rocSize + di.row() + iters_] |= uint64_t(1) << (c + iters_); + if (r > 0 && c < iters_) { + imap[(r - 1) * rocSize + di.row() + iters_] |= uint64_t(1) << (c + ncols_r_ + iters_); + } else if (++r < nrocs_ && c >= ncols_r_ - iters_) { + imap[r * rocSize + di.row() + iters_] |= uint64_t(1) << (c - ncols_r_ + iters_); + } + (*detDigis).data.emplace_back(di.row(), di.column(), di.adc(), 0); + } + + std::memcpy(map1, imap, arrSize * sizeof(uint64_t)); + memset(map2, 0, arrSize * sizeof(uint64_t)); + + morph(map1, map2, kernel1_.data(), kDilate); + morph(map2, map1, kernel2_.data(), kErode); + + uint64_t* i = imap + iters_; + uint64_t* o = map1 + iters_; + for (int roc = 0; roc < nrocs_; roc++, i += 2 * iters_, o += 2 * iters_) { + for (int row = 0; row < nrows_; row++, i++, o++) { + if (*o == 0) + continue; + *o >>= iters_; + *i >>= iters_; + for (int col = 0; col < ncols_r_; col++, (*i) >>= 1, (*o) >>= 1) { + if (*o == 0) + break; + if (((*i) & uint64_t(1)) == 1) + continue; + if (((*o) & uint64_t(1)) == 1) { + (*detDigis).data.emplace_back(row, roc * ncols_r_ + col, fakeAdc_, 1); + } + } + } + } + } + e.put(tPutPixelDigi_, std::move(outputDigis)); +} + +void SiPixelDigiMorphing::morph(uint64_t* const imap, uint64_t* omap, uint64_t* const kernel, MorphOption op) const { + uint64_t* i[ksize_]; // i(nput) + uint64_t* o = omap + iters_; // o(output) + unsigned char valid = 0; + unsigned char const validMask = (1 << ksize_) - 1; + uint64_t m[ksize_]; // m(ask) + + for (int ii = 0; ii < ksize_; ii++) { + i[ii] = imap + ii; + valid = (valid << 1) | (*i[ii] != 0); + m[ii] = mask_ << ii; + } + + for (int roc = 0; roc < nrocs_; roc++, o += 2 * iters_) { + for (int row = 0; row < nrows_; row++, o++) { + if ((valid & validMask) != 0) { + for (int jj = 0; jj < ksize_; jj++) { + for (int ii = 0; ii < ksize_; ii++) { + uint64_t v = (*i[ii]) & (kernel[ii] << jj); // v(ector) + if (op == kErode) + v ^= (kernel[ii] << jj); + uint64_t vv = v; // vv(vector bit - shifted and contracted) + for (int b = 1; b < ksize_; b++) + vv |= (v >> b); + *o |= ((vv << iters_) & m[jj]); + } + if (op == kErode) + *o ^= m[jj]; + } + } + for (int ii = 0; ii < ksize_; ii++) + i[ii]++; + valid = (valid << 1) | (*i[ksize_ - 1] != 0); + } + for (int ii = 0; ii < ksize_; ii++) { + i[ii] += 2 * iters_; + valid = (valid << 1) | (*i[ii] != 0); + } + } +} + +DEFINE_FWK_MODULE(SiPixelDigiMorphing); diff --git a/RecoLocalTracker/SiPixelDigiReProducers/python/siPixelDigisMorphed_cfi.py b/RecoLocalTracker/SiPixelDigiReProducers/python/siPixelDigisMorphed_cfi.py new file mode 100644 index 0000000000000..dd6e3782ba9c0 --- /dev/null +++ b/RecoLocalTracker/SiPixelDigiReProducers/python/siPixelDigisMorphed_cfi.py @@ -0,0 +1,5 @@ +import FWCore.ParameterSet.Config as cms + +from RecoLocalTracker.SiPixelDigiReProducers.siPixelDigiMorphing_cfi import siPixelDigiMorphing as _siPixelDigiMorphing + +siPixelDigisMorphed = _siPixelDigiMorphing.clone() diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/PixelRecHitGPUKernel.cu b/RecoLocalTracker/SiPixelRecHits/plugins/PixelRecHitGPUKernel.cu index d2a377ef68c70..9d189242e0c6d 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/PixelRecHitGPUKernel.cu +++ b/RecoLocalTracker/SiPixelRecHits/plugins/PixelRecHitGPUKernel.cu @@ -9,7 +9,6 @@ #include "CUDADataFormats/SiPixelCluster/interface/gpuClusteringConstants.h" #include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h" #include "HeterogeneousCore/CUDAUtilities/interface/device_unique_ptr.h" -#include "RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.h" #include "PixelRecHitGPUKernel.h" #include "gpuPixelRecHits.h" diff --git a/RecoMET/METAlgorithms/interface/CSCHaloAlgo.h b/RecoMET/METAlgorithms/interface/CSCHaloAlgo.h index 2c529837499c5..ca24f28c9bd11 100644 --- a/RecoMET/METAlgorithms/interface/CSCHaloAlgo.h +++ b/RecoMET/METAlgorithms/interface/CSCHaloAlgo.h @@ -89,7 +89,7 @@ namespace edm { class CSCHaloAlgo { public: - CSCHaloAlgo(); + CSCHaloAlgo(edm::ConsumesCollector iC); ~CSCHaloAlgo() {} reco::CSCHaloData Calculate(const CSCGeometry& TheCSCGeometry, edm::Handle& TheCosmicMuons, @@ -170,6 +170,7 @@ class CSCHaloAlgo { float et_thresh_rh_ee, dphi_thresh_segvsrh_ee, dr_lowthresh_segvsrh_ee, dr_highthresh_segvsrh_ee, dt_lowthresh_segvsrh_ee, dt_highthresh_segvsrh_ee; + edm::ESGetToken geoToken_; const CaloGeometry* geo_; const HcalGeometry* hgeo_; math::XYZPoint getPosition(const DetId& id, reco::Vertex::Point vtx); diff --git a/RecoMET/METAlgorithms/src/CSCHaloAlgo.cc b/RecoMET/METAlgorithms/src/CSCHaloAlgo.cc index 8c483c8041aec..0f3e648570c2f 100644 --- a/RecoMET/METAlgorithms/src/CSCHaloAlgo.cc +++ b/RecoMET/METAlgorithms/src/CSCHaloAlgo.cc @@ -14,7 +14,7 @@ using namespace edm; namespace { constexpr float c_cm_per_ns = 29.9792458; }; -CSCHaloAlgo::CSCHaloAlgo() : geo_(nullptr), hgeo_(nullptr) { +CSCHaloAlgo::CSCHaloAlgo(edm::ConsumesCollector iC) : geoToken_(iC.esConsumes()), geo_(nullptr), hgeo_(nullptr) { deta_threshold = 0.; min_inner_radius = 0.; max_inner_radius = 9999.; @@ -84,9 +84,7 @@ reco::CSCHaloData CSCHaloAlgo::Calculate(const CSCGeometry& TheCSCGeometry, bool ECALEmatched = false; bool HCALmatched = false; - edm::ESHandle pGeo; - TheSetup.get().get(pGeo); - geo_ = pGeo.product(); + geo_ = &TheSetup.getData(geoToken_); hgeo_ = dynamic_cast(geo_->getSubdetectorGeometry(DetId::Hcal, 1)); //} diff --git a/RecoMET/METFilters/interface/EcalBoundaryInfoCalculator.h b/RecoMET/METFilters/interface/EcalBoundaryInfoCalculator.h index e1fc9c3729560..9fcf3a8469c31 100644 --- a/RecoMET/METFilters/interface/EcalBoundaryInfoCalculator.h +++ b/RecoMET/METFilters/interface/EcalBoundaryInfoCalculator.h @@ -16,7 +16,6 @@ #include "DataFormats/EcalDetId/interface/EEDetId.h" #include "DataFormats/EcalDetId/interface/ESDetId.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/METReco/interface/BoundaryInformation.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/Exception.h" @@ -29,20 +28,20 @@ class EcalBoundaryInfoCalculator { EcalBoundaryInfoCalculator(); ~EcalBoundaryInfoCalculator(); - BoundaryInformation boundaryRecHits(const edm::Handle&, + BoundaryInformation boundaryRecHits(const EcalRecHitCollection&, const EcalRecHit*, - const edm::ESHandle theCaloTopology, - const edm::ESHandle ecalStatus, - const edm::ESHandle geometry) const; + const CaloTopology& theCaloTopology, + const EcalChannelStatus& ecalStatus, + const CaloGeometry& geometry) const; - BoundaryInformation gapRecHits(const edm::Handle&, + BoundaryInformation gapRecHits(const EcalRecHitCollection&, const EcalRecHit*, - const edm::ESHandle theCaloTopology, - const edm::ESHandle ecalStatus, - const edm::ESHandle geometry) const; + const CaloTopology& theCaloTopology, + const EcalChannelStatus& ecalStatus, + const CaloGeometry& geometry) const; bool checkRecHitHasDeadNeighbour(const EcalRecHit& hit, - const edm::ESHandle ecalStatus, + const EcalChannelStatus& ecalStatus, std::vector& stati) const { stati.clear(); EcalDetId hitdetid = EcalDetId(hit.id()); @@ -72,8 +71,8 @@ class EcalBoundaryInfoCalculator { if (EBDetId::validDetId(neighbourIeta, neighbourIphi)) { const EBDetId detid = EBDetId(neighbourIeta, neighbourIphi, EBDetId::ETAPHIMODE); - EcalChannelStatus::const_iterator chit = ecalStatus->find(detid); - int status = (chit != ecalStatus->end()) ? chit->getStatusCode() & 0x1F : -1; + EcalChannelStatus::const_iterator chit = ecalStatus.find(detid); + int status = (chit != ecalStatus.end()) ? chit->getStatusCode() & 0x1F : -1; if (status > 0) { bool present = false; @@ -106,8 +105,8 @@ class EcalBoundaryInfoCalculator { if (EEDetId::validDetId(neighbourIx, neighbourIy, hitIz)) { const EEDetId detid = EEDetId(neighbourIx, neighbourIy, hitIz, EEDetId::XYMODE); - EcalChannelStatus::const_iterator chit = ecalStatus->find(detid); - int status = (chit != ecalStatus->end()) ? chit->getStatusCode() & 0x1F : -1; + EcalChannelStatus::const_iterator chit = ecalStatus.find(detid); + int status = (chit != ecalStatus.end()) ? chit->getStatusCode() & 0x1F : -1; if (status > 0) { bool present = false; @@ -133,7 +132,7 @@ class EcalBoundaryInfoCalculator { return false; } - bool checkRecHitHasInvalidNeighbour(const EcalRecHit& hit, const edm::ESHandle ecalStatus) const { + bool checkRecHitHasInvalidNeighbour(const EcalRecHit& hit, const EcalChannelStatus& ecalStatus) const { //// return true, if *direct* neighbour is invalid EcalDetId hitdetid = EcalDetId(hit.id()); @@ -266,15 +265,15 @@ class EcalBoundaryInfoCalculator { } std::unique_ptr> initializeEcalNavigator(DetId startE, - const edm::ESHandle theCaloTopology, + const CaloTopology& theCaloTopology, EcalSubdetector ecalSubDet) const { - std::unique_ptr> theEcalNav(nullptr); + std::unique_ptr> theEcalNav; if (ecalSubDet == EcalBarrel) { - theEcalNav.reset(new CaloNavigator( - (EBDetId)startE, (theCaloTopology->getSubdetectorTopology(DetId::Ecal, ecalSubDet)))); + theEcalNav = std::make_unique>( + (EBDetId)startE, (theCaloTopology.getSubdetectorTopology(DetId::Ecal, ecalSubDet))); } else if (ecalSubDet == EcalEndcap) { - theEcalNav.reset(new CaloNavigator( - (EEDetId)startE, (theCaloTopology->getSubdetectorTopology(DetId::Ecal, ecalSubDet)))); + theEcalNav = std::make_unique>( + (EEDetId)startE, (theCaloTopology.getSubdetectorTopology(DetId::Ecal, ecalSubDet))); } else { edm::LogWarning("EcalBoundaryInfoCalculator") << "initializeEcalNavigator not implemented for subDet: " << ecalSubDet; @@ -315,12 +314,11 @@ template EcalBoundaryInfoCalculator::~EcalBoundaryInfoCalculator() {} template -BoundaryInformation EcalBoundaryInfoCalculator::boundaryRecHits( - const edm::Handle& RecHits, - const EcalRecHit* hit, - const edm::ESHandle theCaloTopology, - edm::ESHandle ecalStatus, - edm::ESHandle geometry) const { +BoundaryInformation EcalBoundaryInfoCalculator::boundaryRecHits(const EcalRecHitCollection& RecHits, + const EcalRecHit* hit, + const CaloTopology& theCaloTopology, + const EcalChannelStatus& ecalStatus, + const CaloGeometry& geometry) const { //initialize boundary information std::vector boundaryRecHits; std::vector boundaryDetIds; @@ -336,7 +334,7 @@ BoundaryInformation EcalBoundaryInfoCalculator::boundaryRecHits( boundaryEnergy += hit->energy(); EcalDetId hitdetid = (EcalDetId)hit->id(); boundaryDetIds.push_back(hitdetid); - const CaloSubdetectorGeometry* subGeom = geometry->getSubdetectorGeometry(hitdetid); + const CaloSubdetectorGeometry* subGeom = geometry.getSubdetectorGeometry(hitdetid); auto cellGeom = subGeom->getGeometry(hitdetid); double eta = cellGeom->getPosition().eta(); boundaryET += hit->energy() / cosh(eta); @@ -370,8 +368,8 @@ BoundaryInformation EcalBoundaryInfoCalculator::boundaryRecHits( next = makeStepInDirection(currDirection, theEcalNav.get()); theEcalNav->setHome(current); theEcalNav->home(); - EcalChannelStatus::const_iterator chit = ecalStatus->find(next); - int status = (chit != ecalStatus->end()) ? chit->getStatusCode() & 0x1F : -1; + EcalChannelStatus::const_iterator chit = ecalStatus.find(next); + int status = (chit != ecalStatus.end()) ? chit->getStatusCode() & 0x1F : -1; if (status > 0) { stati.push_back(status); startAlgo = true; @@ -400,8 +398,8 @@ BoundaryInformation EcalBoundaryInfoCalculator::boundaryRecHits( next = makeStepInDirection(currDirection, theEcalNav.get()); theEcalNav->setHome(current); theEcalNav->home(); - EcalChannelStatus::const_iterator chit = ecalStatus->find(next); - status = (chit != ecalStatus->end()) ? chit->getStatusCode() & 0x1F : -1; + EcalChannelStatus::const_iterator chit = ecalStatus.find(next); + status = (chit != ecalStatus.end()) ? chit->getStatusCode() & 0x1F : -1; if (status > 0) { // New dead cell found: update status std::vector of dead channels bool present = false; @@ -449,8 +447,8 @@ BoundaryInformation EcalBoundaryInfoCalculator::boundaryRecHits( // save recHits and add energy if on the boundary (and not inside at border) if ((!atBorder || status == 0) && !nextIsStart) { boundaryDetIds.push_back(next); - if (RecHits->find(next) != RecHits->end() && status == 0) { - EcalRecHit nexthit = *RecHits->find(next); + if (RecHits.find(next) != RecHits.end() && status == 0) { + EcalRecHit nexthit = *RecHits.find(next); ++beCellCounter; boundaryRecHits.push_back(nexthit); boundaryEnergy += nexthit.energy(); @@ -510,11 +508,11 @@ BoundaryInformation EcalBoundaryInfoCalculator::boundaryRecHits( } template -BoundaryInformation EcalBoundaryInfoCalculator::gapRecHits(const edm::Handle& RecHits, +BoundaryInformation EcalBoundaryInfoCalculator::gapRecHits(const EcalRecHitCollection& RecHits, const EcalRecHit* hit, - const edm::ESHandle theCaloTopology, - edm::ESHandle ecalStatus, - edm::ESHandle geometry) const { + const CaloTopology& theCaloTopology, + const EcalChannelStatus& ecalStatus, + const CaloGeometry& geometry) const { //initialize boundary information std::vector gapRecHits; std::vector gapDetIds; @@ -529,7 +527,7 @@ BoundaryInformation EcalBoundaryInfoCalculator::gapRecHits(const edm: gapEnergy += hit->energy(); EcalDetId hitdetid = (EcalDetId)hit->id(); gapDetIds.push_back(hitdetid); - const CaloSubdetectorGeometry* subGeom = geometry->getSubdetectorGeometry(hitdetid); + const CaloSubdetectorGeometry* subGeom = geometry.getSubdetectorGeometry(hitdetid); auto cellGeom = subGeom->getGeometry(hitdetid); double eta = cellGeom->getPosition().eta(); gapET += hit->energy() / cosh(eta); @@ -591,8 +589,8 @@ BoundaryInformation EcalBoundaryInfoCalculator::gapRecHits(const edm: next = makeStepInDirection(currDirection, theEcalNav.get()); theEcalNav->setHome(current); theEcalNav->home(); - EcalChannelStatus::const_iterator chit = ecalStatus->find(next); - status = (chit != ecalStatus->end()) ? chit->getStatusCode() & 0x1F : -1; + EcalChannelStatus::const_iterator chit = ecalStatus.find(next); + status = (chit != ecalStatus.end()) ? chit->getStatusCode() & 0x1F : -1; if (status > 0) { // Find dead cell along border -> end of cluster endIsFound = true; @@ -601,7 +599,7 @@ BoundaryInformation EcalBoundaryInfoCalculator::gapRecHits(const edm: // In case the Ecal border -> go along gap currDirection = turnLeft(currDirection, reverseOrientation); } else if (status == 0) { - if (RecHits->find(next) != RecHits->end()) { + if (RecHits.find(next) != RecHits.end()) { nextStepFound = true; } else { endIsFound = true; @@ -636,8 +634,8 @@ BoundaryInformation EcalBoundaryInfoCalculator::gapRecHits(const edm: // save recHits and add energy if (!endIsFound) { gapDetIds.push_back(next); - if (RecHits->find(next) != RecHits->end()) { - EcalRecHit nexthit = *RecHits->find(next); + if (RecHits.find(next) != RecHits.end()) { + EcalRecHit nexthit = *RecHits.find(next); ++gapCellCounter; gapRecHits.push_back(nexthit); gapEnergy += nexthit.energy(); @@ -670,8 +668,8 @@ BoundaryInformation EcalBoundaryInfoCalculator::gapRecHits(const edm: next = makeStepInDirection(currDirection, theEcalNav.get()); theEcalNav->setHome(current); theEcalNav->home(); - EcalChannelStatus::const_iterator chit = ecalStatus->find(next); - status = (chit != ecalStatus->end()) ? chit->getStatusCode() & 0x1F : -1; + EcalChannelStatus::const_iterator chit = ecalStatus.find(next); + status = (chit != ecalStatus.end()) ? chit->getStatusCode() & 0x1F : -1; if (status > 0) { // Find dead cell along border -> end of cluster endIsFound = true; @@ -680,7 +678,7 @@ BoundaryInformation EcalBoundaryInfoCalculator::gapRecHits(const edm: // In case the Ecal border -> go along gap currDirection = turnRight(currDirection, reverseOrientation); } else if (status == 0) { - if (RecHits->find(next) != RecHits->end()) { + if (RecHits.find(next) != RecHits.end()) { nextStepFound = true; } else { endIsFound = true; @@ -708,8 +706,8 @@ BoundaryInformation EcalBoundaryInfoCalculator::gapRecHits(const edm: // save recHits and add energy if (!endIsFound) { gapDetIds.push_back(next); - if (RecHits->find(next) != RecHits->end()) { - EcalRecHit nexthit = *RecHits->find(next); + if (RecHits.find(next) != RecHits.end()) { + EcalRecHit nexthit = *RecHits.find(next); ++gapCellCounter; gapRecHits.push_back(nexthit); gapEnergy += nexthit.energy(); diff --git a/RecoMET/METFilters/plugins/EEBadScFilter.cc b/RecoMET/METFilters/plugins/EEBadScFilter.cc index bee6f89af9d3f..8bb67edebb77b 100644 --- a/RecoMET/METFilters/plugins/EEBadScFilter.cc +++ b/RecoMET/METFilters/plugins/EEBadScFilter.cc @@ -16,7 +16,6 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/global/EDFilter.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -44,17 +43,19 @@ class EEBadScFilter : public edm::global::EDFilter<> { // function to calculate 5x5 energy and check rechit flags - virtual void scan5x5(const DetId &det, - const edm::Handle &hits, - const edm::ESHandle &caloTopo, - const edm::ESHandle &geometry, - int &nHits, - float &totEt) const; + void scan5x5(const DetId &det, + const EcalRecHitCollection &hits, + const CaloTopology &caloTopo, + const CaloGeometry &geometry, + int &nHits, + float &totEt) const; // input parameters // ee rechit collection (from AOD) const edm::EDGetTokenT eeRHSrcToken_; + const edm::ESGetToken geometryToken_; + const edm::ESGetToken caloTopoToken_; //config parameters (defining the cuts on the bad SCs) const double Emin_; // rechit energy threshold (check for !kGood rechit flags) @@ -70,6 +71,8 @@ class EEBadScFilter : public edm::global::EDFilter<> { // read the parameters from the config file EEBadScFilter::EEBadScFilter(const edm::ParameterSet &iConfig) : eeRHSrcToken_(consumes(iConfig.getParameter("EERecHitSource"))), + geometryToken_(esConsumes()), + caloTopoToken_(esConsumes()), Emin_(iConfig.getParameter("EminHit")), EtminSC_(iConfig.getParameter("EtminSC")), side_(iConfig.getParameter("SCsize")), @@ -81,9 +84,9 @@ EEBadScFilter::EEBadScFilter(const edm::ParameterSet &iConfig) } void EEBadScFilter::scan5x5(const DetId &det, - const edm::Handle &hits, - const edm::ESHandle &caloTopo, - const edm::ESHandle &geometry, + const EcalRecHitCollection &hits, + const CaloTopology &caloTopo, + const CaloGeometry &geometry, int &nHits, float &totEt) const { // function to compute: total transverse energy in a given supercrystal (totEt) @@ -95,8 +98,7 @@ void EEBadScFilter::scan5x5(const DetId &det, // navigator to define a 5x5 region around the input DetId - CaloNavigator cursor = CaloNavigator(det, caloTopo->getSubdetectorTopology(det)); - const CaloGeometry *geo = geometry.product(); + CaloNavigator cursor = CaloNavigator(det, caloTopo.getSubdetectorTopology(det)); // loop over a 5x5 array centered on the input DetId @@ -104,11 +106,11 @@ void EEBadScFilter::scan5x5(const DetId &det, for (int i = -side_ / 2; i <= side_ / 2; ++i) { cursor.home(); cursor.offsetBy(i, j); - if (hits->find(*cursor) != hits->end()) // if hit exists in the rechit collection + if (hits.find(*cursor) != hits.end()) // if hit exists in the rechit collection { - EcalRecHit tmpHit = *hits->find(*cursor); // get rechit with detID at cursor + EcalRecHit tmpHit = *hits.find(*cursor); // get rechit with detID at cursor - const GlobalPoint p(geo->getPosition(*cursor)); // calculate Et of the rechit + const GlobalPoint p(geometry.getPosition(*cursor)); // calculate Et of the rechit TVector3 hitPos(p.x(), p.y(), p.z()); hitPos *= 1.0 / hitPos.Mag(); hitPos *= tmpHit.energy(); @@ -129,16 +131,13 @@ bool EEBadScFilter::filter(edm::StreamID, edm::Event &iEvent, const edm::EventSe // load required collections // EE rechit collection - edm::Handle eeRHs; - iEvent.getByToken(eeRHSrcToken_, eeRHs); + auto const &eeRHs = iEvent.get(eeRHSrcToken_); // Calo Geometry - needed for computing E_t - edm::ESHandle pG; - iSetup.get().get(pG); + auto const &geometry = iSetup.getData(geometryToken_); // Calo Toplology - needed for navigating the 5x5 xtal array around the centre of a SC - edm::ESHandle pTopology; - iSetup.get().get(pTopology); + auto const &caloTopo = iSetup.getData(caloTopoToken_); // by default the event is OK bool pass = true; @@ -169,7 +168,7 @@ bool EEBadScFilter::filter(edm::StreamID, edm::Event &iEvent, const edm::EventSe // loop over the 5x5 SC centered on this DetId and fill discriminating variables - scan5x5(det, eeRHs, pTopology, pG, nhits, totEt); + scan5x5(det, eeRHs, caloTopo, geometry, nhits, totEt); // print some debug info diff --git a/RecoMET/METFilters/plugins/EcalBadCalibFilter.cc b/RecoMET/METFilters/plugins/EcalBadCalibFilter.cc index 9ebccffc315c8..1ac8801e3c0dc 100644 --- a/RecoMET/METFilters/plugins/EcalBadCalibFilter.cc +++ b/RecoMET/METFilters/plugins/EcalBadCalibFilter.cc @@ -19,7 +19,6 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/global/EDFilter.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -49,6 +48,7 @@ class EcalBadCalibFilter : public edm::global::EDFilter<> { // input parameters // ecal rechit collection (from AOD) const edm::EDGetTokenT ecalRHSrcToken_; + const edm::ESGetToken geoToken_; //config parameters (defining the cuts on the bad SCs) const double ecalMin_; // ecal rechit et threshold @@ -62,6 +62,7 @@ class EcalBadCalibFilter : public edm::global::EDFilter<> { // read the parameters from the config file EcalBadCalibFilter::EcalBadCalibFilter(const edm::ParameterSet& iConfig) : ecalRHSrcToken_(consumes(iConfig.getParameter("EcalRecHitSource"))), + geoToken_(esConsumes()), ecalMin_(iConfig.getParameter("ecalMinEt")), baddetEcal_(iConfig.getParameter >("baddetEcal")), taggingMode_(iConfig.getParameter("taggingMode")), @@ -77,9 +78,7 @@ bool EcalBadCalibFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::Ev iEvent.getByToken(ecalRHSrcToken_, ecalRHs); // Calo Geometry - needed for computing E_t - edm::ESHandle pG; - iSetup.get().get(pG); - const CaloGeometry* geo = pG.product(); + const CaloGeometry& geo = iSetup.getData(geoToken_); // by default the event is OK bool pass = true; @@ -109,7 +108,7 @@ bool EcalBadCalibFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::Ev ene = ecalhit->energy(); // compute transverse energy - const GlobalPoint& posecal = geo->getPosition(ecaldet); + const GlobalPoint& posecal = geo.getPosition(ecaldet); float pf = posecal.perp() / posecal.mag(); et = ene * pf; diff --git a/RecoMET/METFilters/plugins/EcalDeadCellBoundaryEnergyFilter.cc b/RecoMET/METFilters/plugins/EcalDeadCellBoundaryEnergyFilter.cc index 181483c47f9be..895113620c586 100644 --- a/RecoMET/METFilters/plugins/EcalDeadCellBoundaryEnergyFilter.cc +++ b/RecoMET/METFilters/plugins/EcalDeadCellBoundaryEnergyFilter.cc @@ -71,6 +71,9 @@ class EcalDeadCellBoundaryEnergyFilter : public edm::global::EDFilter<> { edm::EDGetTokenT EBRecHitsToken_; edm::EDGetTokenT EERecHitsToken_; + edm::ESGetToken caloTopologyToken_; + edm::ESGetToken ecalStatusToken_; + edm::ESGetToken geometryToken_; const std::string FilterAlgo_; const bool taggingMode_; @@ -105,9 +108,10 @@ EcalDeadCellBoundaryEnergyFilter::EcalDeadCellBoundaryEnergyFilter(const edm::Pa //now do what ever initialization is needed , EBRecHitsToken_(consumes(iConfig.getParameter("recHitsEB"))), - EERecHitsToken_(consumes(iConfig.getParameter("recHitsEE"))) - - , + EERecHitsToken_(consumes(iConfig.getParameter("recHitsEE"))), + caloTopologyToken_(esConsumes()), + ecalStatusToken_(esConsumes()), + geometryToken_(esConsumes()), FilterAlgo_(iConfig.getUntrackedParameter("FilterAlgo", "TuningMode")), taggingMode_(iConfig.getParameter("taggingMode")), skimGap_(iConfig.getUntrackedParameter("skimGap", false)), @@ -163,19 +167,12 @@ bool EcalDeadCellBoundaryEnergyFilter::filter(edm::StreamID, edm::Event& iEvent, v_boundaryInfoDeadCells_EE.reserve(50); // Get the Ecal RecHits - Handle EBRecHits; - iEvent.getByToken(EBRecHitsToken_, EBRecHits); - Handle EERecHits; - iEvent.getByToken(EERecHitsToken_, EERecHits); - - edm::ESHandle theCaloTopology; - iSetup.get().get(theCaloTopology); - - edm::ESHandle ecalStatus; - iSetup.get().get(ecalStatus); + auto const& EBRecHits = iEvent.get(EBRecHitsToken_); + auto const& EERecHits = iEvent.get(EERecHitsToken_); - edm::ESHandle geometry; - iSetup.get().get(geometry); + auto const& theCaloTopology = iSetup.getData(caloTopologyToken_); + auto const& ecalStatus = iSetup.getData(ecalStatusToken_); + auto const& geometry = iSetup.getData(geometryToken_); // int DeadChannelsCounterEB = 0; // int DeadChannelsCounterEE = 0; @@ -193,12 +190,12 @@ bool EcalDeadCellBoundaryEnergyFilter::filter(edm::StreamID, edm::Event& iEvent, if (debug_) edm::LogInfo("EcalDeadCellBoundaryEnergyFilter") << "process EB"; - for (EcalRecHitCollection::const_iterator hit = EBRecHits->begin(); hit != EBRecHits->end(); ++hit) { + for (EcalRecHitCollection::const_iterator hit = EBRecHits.begin(); hit != EBRecHits.end(); ++hit) { bool detIdAlreadyChecked = false; DetId currDetId = (DetId)hit->id(); //add limitation to channel stati - EcalChannelStatus::const_iterator chit = ecalStatus->find(currDetId); - int status = (chit != ecalStatus->end()) ? chit->getStatusCode() & 0x1F : -1; + EcalChannelStatus::const_iterator chit = ecalStatus.find(currDetId); + int status = (chit != ecalStatus.end()) ? chit->getStatusCode() & 0x1F : -1; if (status != 0) continue; bool passChannelLimitation = false; @@ -226,11 +223,8 @@ bool EcalDeadCellBoundaryEnergyFilter::filter(edm::StreamID, edm::Event& iEvent, // RecHit is at EB boundary and should be processed if (!detIdAlreadyChecked && deadNeighbourStati.empty() && ebBoundaryCalc.checkRecHitHasInvalidNeighbour(*hit, ecalStatus)) { - BoundaryInformation gapinfo = ebBoundaryCalc.gapRecHits((const edm::Handle&)EBRecHits, - (const EcalRecHit*)&(*hit), - theCaloTopology, - ecalStatus, - geometry); + BoundaryInformation gapinfo = + ebBoundaryCalc.gapRecHits(EBRecHits, &(*hit), theCaloTopology, ecalStatus, geometry); // get rechits along gap cluster for (std::vector::iterator it = gapinfo.detIds.begin(); it != gapinfo.detIds.end(); it++) { @@ -251,11 +245,7 @@ bool EcalDeadCellBoundaryEnergyFilter::filter(edm::StreamID, edm::Event& iEvent, if (!detIdAlreadyChecked && (passChannelLimitation || (limitDeadCellToChannelStatusEB_.empty() && !deadNeighbourStati.empty()))) { BoundaryInformation boundinfo = - ebBoundaryCalc.boundaryRecHits((const edm::Handle&)EBRecHits, - (const EcalRecHit*)&(*hit), - theCaloTopology, - ecalStatus, - geometry); + ebBoundaryCalc.boundaryRecHits(EBRecHits, &(*hit), theCaloTopology, ecalStatus, geometry); // get boundary of !kDead rechits arround the dead cluster for (std::vector::iterator it = boundinfo.detIds.begin(); it != boundinfo.detIds.end(); it++) { @@ -282,12 +272,12 @@ bool EcalDeadCellBoundaryEnergyFilter::filter(edm::StreamID, edm::Event& iEvent, if (debug_) edm::LogInfo("EcalDeadCellBoundaryEnergyFilter") << "process EE"; - for (EcalRecHitCollection::const_iterator hit = EERecHits->begin(); hit != EERecHits->end(); ++hit) { + for (EcalRecHitCollection::const_iterator hit = EERecHits.begin(); hit != EERecHits.end(); ++hit) { bool detIdAlreadyChecked = false; DetId currDetId = (DetId)hit->id(); //add limitation to channel stati - EcalChannelStatus::const_iterator chit = ecalStatus->find(currDetId); - int status = (chit != ecalStatus->end()) ? chit->getStatusCode() & 0x1F : -1; + EcalChannelStatus::const_iterator chit = ecalStatus.find(currDetId); + int status = (chit != ecalStatus.end()) ? chit->getStatusCode() & 0x1F : -1; if (status != 0) continue; bool passChannelLimitation = false; @@ -313,17 +303,14 @@ bool EcalDeadCellBoundaryEnergyFilter::filter(edm::StreamID, edm::Event& iEvent, } // RecHit is at EE boundary and should be processed - const CaloSubdetectorGeometry* subGeom = geometry->getSubdetectorGeometry(currDetId); + const CaloSubdetectorGeometry* subGeom = geometry.getSubdetectorGeometry(currDetId); auto cellGeom = subGeom->getGeometry(currDetId); double eta = cellGeom->getPosition().eta(); if (!detIdAlreadyChecked && deadNeighbourStati.empty() && eeBoundaryCalc.checkRecHitHasInvalidNeighbour(*hit, ecalStatus) && std::abs(eta) < 1.6) { - BoundaryInformation gapinfo = eeBoundaryCalc.gapRecHits((const edm::Handle&)EERecHits, - (const EcalRecHit*)&(*hit), - theCaloTopology, - ecalStatus, - geometry); + BoundaryInformation gapinfo = + eeBoundaryCalc.gapRecHits(EERecHits, &(*hit), theCaloTopology, ecalStatus, geometry); // get rechits along gap cluster for (std::vector::iterator it = gapinfo.detIds.begin(); it != gapinfo.detIds.end(); it++) { @@ -344,11 +331,7 @@ bool EcalDeadCellBoundaryEnergyFilter::filter(edm::StreamID, edm::Event& iEvent, if (!detIdAlreadyChecked && (passChannelLimitation || (limitDeadCellToChannelStatusEE_.empty() && !deadNeighbourStati.empty()))) { BoundaryInformation boundinfo = - eeBoundaryCalc.boundaryRecHits((const edm::Handle&)EERecHits, - (const EcalRecHit*)&(*hit), - theCaloTopology, - ecalStatus, - geometry); + eeBoundaryCalc.boundaryRecHits(EERecHits, &(*hit), theCaloTopology, ecalStatus, geometry); // get boundary of !kDead rechits arround the dead cluster for (std::vector::iterator it = boundinfo.detIds.begin(); it != boundinfo.detIds.end(); it++) { diff --git a/RecoMET/METFilters/plugins/EcalLaserCorrFilter.cc b/RecoMET/METFilters/plugins/EcalLaserCorrFilter.cc index 0082305af37af..fbfd4b75db418 100644 --- a/RecoMET/METFilters/plugins/EcalLaserCorrFilter.cc +++ b/RecoMET/METFilters/plugins/EcalLaserCorrFilter.cc @@ -3,7 +3,6 @@ #include "FWCore/Framework/interface/global/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" @@ -37,6 +36,7 @@ class EcalLaserCorrFilter : public edm::global::EDFilter<> { const edm::EDGetTokenT ebRHSrcToken_; const edm::EDGetTokenT eeRHSrcToken_; + const edm::ESGetToken laserToken_; // thresholds to laser corr to set kPoorCalib const double EBLaserMIN_, EELaserMIN_, EBLaserMAX_, EELaserMAX_, EBEnegyMIN_, EEEnegyMIN_; @@ -46,6 +46,7 @@ class EcalLaserCorrFilter : public edm::global::EDFilter<> { EcalLaserCorrFilter::EcalLaserCorrFilter(const edm::ParameterSet& iConfig) : ebRHSrcToken_(consumes(iConfig.getParameter("EBRecHitSource"))), eeRHSrcToken_(consumes(iConfig.getParameter("EERecHitSource"))), + laserToken_(esConsumes()), EBLaserMIN_(iConfig.getParameter("EBLaserMIN")), EELaserMIN_(iConfig.getParameter("EELaserMIN")), EBLaserMAX_(iConfig.getParameter("EBLaserMAX")), @@ -69,8 +70,7 @@ bool EcalLaserCorrFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::E iEvent.getByToken(eeRHSrcToken_, eeRHs); // Laser corrections - edm::ESHandle laser; - iSetup.get().get(laser); + auto const& laser = iSetup.getData(laserToken_); bool goodCalib = true; @@ -85,7 +85,7 @@ bool EcalLaserCorrFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::E int jz = EEDetId((*eerh).id()).zside(); // get laser coefficient - float lasercalib = laser->getLaserCorrection(EEDetId(eeDet), iEvent.time()); + float lasercalib = laser.getLaserCorrection(EEDetId(eeDet), iEvent.time()); if (energy > EEEnegyMIN_ && (lasercalib < EELaserMIN_ || lasercalib > EELaserMAX_)) { goodCalib = false; @@ -111,7 +111,7 @@ bool EcalLaserCorrFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::E int zrec = EBDetId((*ebrh).id()).zside(); // get laser coefficient - float lasercalib = laser->getLaserCorrection(EBDetId(ebDet), iEvent.time()); + float lasercalib = laser.getLaserCorrection(EBDetId(ebDet), iEvent.time()); if (energy > EBEnegyMIN_ && (lasercalib < EBLaserMIN_ || lasercalib > EBLaserMAX_)) { goodCalib = false; diff --git a/RecoMET/METPUSubtraction/interface/PFMETAlgorithmMVA.h b/RecoMET/METPUSubtraction/interface/PFMETAlgorithmMVA.h index 211cac8035348..4a121e780e214 100644 --- a/RecoMET/METPUSubtraction/interface/PFMETAlgorithmMVA.h +++ b/RecoMET/METPUSubtraction/interface/PFMETAlgorithmMVA.h @@ -11,9 +11,11 @@ */ #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "CondFormats/GBRForest/interface/GBRForest.h" +#include "CondFormats/DataRecord/interface/GBRWrapperRcd.h" #include "DataFormats/Candidate/interface/Candidate.h" #include "DataFormats/METReco/interface/MET.h" @@ -29,7 +31,7 @@ class PFMETAlgorithmMVA { public: - PFMETAlgorithmMVA(const edm::ParameterSet& cfg); + PFMETAlgorithmMVA(const edm::ParameterSet& cfg, edm::ConsumesCollector iC); ~PFMETAlgorithmMVA(); void initialize(const edm::EventSetup&); @@ -56,7 +58,6 @@ class PFMETAlgorithmMVA { private: const std::string updateVariableNames(std::string input); const GBRForest* loadMVAfromFile(const edm::FileInPath& inputFileName, const std::string& mvaName); - const GBRForest* loadMVAfromDB(const edm::EventSetup& es, const std::string& mvaName); const float evaluateU(); const float evaluateDPhi(); @@ -70,6 +71,11 @@ class PFMETAlgorithmMVA { std::string mvaNameCovU1_; std::string mvaNameCovU2_; + edm::ESGetToken mvaTokenU_; + edm::ESGetToken mvaTokenDPhi_; + edm::ESGetToken mvaTokenCovU1_; + edm::ESGetToken mvaTokenCovU2_; + int mvaType_; bool hasPhotons_; diff --git a/RecoMET/METPUSubtraction/plugins/PFMETProducerMVA.cc b/RecoMET/METPUSubtraction/plugins/PFMETProducerMVA.cc index 3a9c3880cff9d..6c6cd067499fe 100644 --- a/RecoMET/METPUSubtraction/plugins/PFMETProducerMVA.cc +++ b/RecoMET/METPUSubtraction/plugins/PFMETProducerMVA.cc @@ -7,7 +7,8 @@ const double dR2Min = 0.01 * 0.01; const double dR2Max = 0.5 * 0.5; const double dPtMatch = 0.1; -PFMETProducerMVA::PFMETProducerMVA(const edm::ParameterSet& cfg) : mvaMEtAlgo_(cfg), mvaMEtAlgo_isInitialized_(false) { +PFMETProducerMVA::PFMETProducerMVA(const edm::ParameterSet& cfg) + : mvaMEtAlgo_(cfg, consumesCollector()), mvaMEtAlgo_isInitialized_(false) { srcCorrJets_ = consumes(cfg.getParameter("srcCorrJets")); srcUncorrJets_ = consumes(cfg.getParameter("srcUncorrJets")); srcJetIds_ = consumes >(cfg.getParameter("srcMVAPileupJetId")); diff --git a/RecoMET/METPUSubtraction/python/mvaPFMET_leptons_cfi.py b/RecoMET/METPUSubtraction/python/mvaPFMET_leptons_cfi.py index d5450cee81cb6..917ac44580a72 100644 --- a/RecoMET/METPUSubtraction/python/mvaPFMET_leptons_cfi.py +++ b/RecoMET/METPUSubtraction/python/mvaPFMET_leptons_cfi.py @@ -4,100 +4,98 @@ isomuons = cms.EDFilter( "MuonSelector", src = cms.InputTag('muons'), - cut = cms.string( "(isTrackerMuon) && std::abs(eta) < 2.5 && pt > 9.5"+#17. "+ - "&& isPFMuon"+ - "&& globalTrack.isNonnull"+ - "&& innerTrack.hitPattern.numberOfValidPixelHits > 0"+ - "&& innerTrack.normalizedChi2 < 10"+ - "&& numberOfMatches > 0"+ - "&& innerTrack.hitPattern.numberOfValidTrackerHits>5"+ - "&& globalTrack.hitPattern.numberOfValidHits>0"+ - "&& (pfIsolationR03.sumChargedHadronPt+pfIsolationR03.sumNeutralHadronEt+pfIsolationR03.sumPhotonEt)/pt < 0.3"+ - "&& std::abs(innerTrack().dxy)<2.0" - ), + cut = cms.string("(isTrackerMuon) && std::abs(eta) < 2.5 && pt > 9.5"+#17. "+ + "&& isPFMuon"+ + "&& globalTrack.isNonnull"+ + "&& innerTrack.hitPattern.numberOfValidPixelHits > 0"+ + "&& innerTrack.normalizedChi2 < 10"+ + "&& numberOfMatches > 0"+ + "&& innerTrack.hitPattern.numberOfValidTrackerHits>5"+ + "&& globalTrack.hitPattern.numberOfValidHits>0"+ + "&& (pfIsolationR03.sumChargedHadronPt+pfIsolationR03.sumNeutralHadronEt+pfIsolationR03.sumPhotonEt)/pt < 0.3"+ + "&& std::abs(innerTrack().dxy)<2.0" + ), filter = cms.bool(False) - ) +) isoelectrons = cms.EDFilter( "GsfElectronSelector", - src = cms.InputTag('gsfElectrons'), - cut = cms.string( - "std::abs(eta) < 2.5 && pt > 9.5" + - "&& gsfTrack.trackerExpectedHitsInner.numberOfHits == 0" + -# "&& (pfIsolationVariables.chargedHadronIso+pfIsolationVariables.neutralHadronIso)/et < 0.3" + - "&& (isolationVariables03.tkSumPt)/et < 0.2" + - "&& ((std::abs(eta) < 1.4442 " + - "&& std::abs(deltaEtaSuperClusterTrackAtVtx) < 0.007"+ - "&& std::abs(deltaPhiSuperClusterTrackAtVtx) < 0.8" + - "&& sigmaIetaIeta < 0.01" + - "&& hcalOverEcal < 0.15" + - "&& std::abs(1./superCluster.energy - 1./p) < 0.05)"+ - "|| (std::abs(eta) > 1.566 "+ - "&& std::abs(deltaEtaSuperClusterTrackAtVtx) < 0.009"+ - "&& std::abs(deltaPhiSuperClusterTrackAtVtx) < 0.10" + - "&& sigmaIetaIeta < 0.03" + - "&& hcalOverEcal < 0.10" + - "&& std::abs(1./superCluster.energy - 1./p) < 0.05))" - ), - filter = cms.bool(False) - ) + src = cms.InputTag('gsfElectrons'), + cut = cms.string("std::abs(eta) < 2.5 && pt > 9.5" + + "&& gsfTrack.trackerExpectedHitsInner.numberOfHits == 0" + +# "&& (pfIsolationVariables.chargedHadronIso+pfIsolationVariables.neutralHadronIso)/et < 0.3" + + "&& (isolationVariables03.tkSumPt)/et < 0.2" + + "&& ((std::abs(eta) < 1.4442 " + + "&& std::abs(deltaEtaSuperClusterTrackAtVtx) < 0.007"+ + "&& std::abs(deltaPhiSuperClusterTrackAtVtx) < 0.8" + + "&& sigmaIetaIeta < 0.01" + + "&& hcalOverEcal < 0.15" + + "&& std::abs(1./superCluster.energy - 1./p) < 0.05)"+ + "|| (std::abs(eta) > 1.566 "+ + "&& std::abs(deltaEtaSuperClusterTrackAtVtx) < 0.009"+ + "&& std::abs(deltaPhiSuperClusterTrackAtVtx) < 0.10" + + "&& sigmaIetaIeta < 0.03" + + "&& hcalOverEcal < 0.10" + + "&& std::abs(1./superCluster.energy - 1./p) < 0.05))" + ), + filter = cms.bool(False) +) from RecoJets.Configuration.RecoPFJets_cff import kt6PFJets as dummy kt6PFJetsForRhoComputationVoronoiMet = dummy.clone( - doRhoFastjet = True, - voronoiRfact = 0.9 - ) + doRhoFastjet = True, + voronoiRfact = 0.9 +) from RecoTauTag.RecoTau.PFRecoTauDiscriminationByHPSSelection_cfi import hpsSelectionDiscriminator hpsPFTauDiscriminationByDecayModeFinding = hpsSelectionDiscriminator.clone( - PFTauProducer = 'hpsPFTauProducer' - ) + PFTauProducer = 'hpsPFTauProducer' +) from RecoTauTag.RecoTau.TauDiscriminatorTools import requireLeadTrack # Define decay mode prediscriminant requireDecayMode = cms.PSet( - BooleanOperator = cms.string("and"), - decayMode = cms.PSet( - Producer = cms.InputTag('hpsPFTauDiscriminationByDecayModeFinding'), - cut = cms.double(0.5) - ) - ) + BooleanOperator = cms.string("and"), + decayMode = cms.PSet( + Producer = cms.InputTag('hpsPFTauDiscriminationByDecayModeFinding'), + cut = cms.double(0.5) + ) +) from RecoTauTag.Configuration.HPSPFTaus_cff import hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr3Hits +import RecoTauTag.RecoTau.pfRecoTauDiscriminationAgainstMuon2_cfi as _mod -hpsPFTauDiscriminationAgainstMuon2 = cms.EDProducer("PFRecoTauDiscriminationAgainstMuon2", - PFTauProducer = cms.InputTag('hpsPFTauProducer'), - Prediscriminants = requireDecayMode.clone(), - discriminatorOption = cms.string('loose'), # available options are: 'loose', 'medium', 'tight' - HoPMin = cms.double(0.2) - ) - +hpsPFTauDiscriminationAgainstMuon2 = _mod.pfRecoTauDiscriminationAgainstMuon2.clone( + PFTauProducer = 'hpsPFTauProducer', + Prediscriminants = requireDecayMode.clone(), + discriminatorOption = 'loose', # available options are: 'loose', 'medium', 'tight' +) hpsPFTauDiscriminationByMVAIsolation = cms.EDProducer( "PFRecoTauDiscriminationByMVAIsolation", - PFTauProducer = cms.InputTag('hpsPFTauProducer'), - rhoProducer = cms.InputTag('kt6PFJetsForRhoComputationVoronoiMet','rho'), - Prediscriminants = requireDecayMode.clone(), - gbrfFilePath = cms.FileInPath('RecoTauTag/RecoTau/data/gbrfTauIso_v2.root'), - returnMVA = cms.bool(False), - mvaMin = cms.double(0.8), - ) + PFTauProducer = cms.InputTag('hpsPFTauProducer'), + rhoProducer = cms.InputTag('kt6PFJetsForRhoComputationVoronoiMet','rho'), + Prediscriminants = requireDecayMode.clone(), + gbrfFilePath = cms.FileInPath('RecoTauTag/RecoTau/data/gbrfTauIso_v2.root'), + returnMVA = cms.bool(False), + mvaMin = cms.double(0.8), +) isotaus = cms.EDFilter( "PFTauSelector", src = cms.InputTag('hpsPFTauProducer'), BooleanOperator = cms.string("and"), discriminators = cms.VPSet( - cms.PSet( discriminator=cms.InputTag("hpsPFTauDiscriminationByDecayModeFinding"), selectionCut=cms.double(0.5)), - #cms.PSet( discriminator=cms.InputTag("hpsPFTauDiscriminationByMVAIsolation"), selectionCut=cms.double(0.5)), - cms.PSet( discriminator=cms.InputTag("hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr3Hits"), selectionCut=cms.double(0.5)), - cms.PSet( discriminator=cms.InputTag("hpsPFTauDiscriminationByLooseElectronRejection"), selectionCut=cms.double(0.5)), - cms.PSet( discriminator=cms.InputTag("hpsPFTauDiscriminationAgainstMuon2"), selectionCut=cms.double(0.5)) + cms.PSet( discriminator=cms.InputTag("hpsPFTauDiscriminationByDecayModeFinding"), selectionCut=cms.double(0.5)), + #cms.PSet( discriminator=cms.InputTag("hpsPFTauDiscriminationByMVAIsolation"), selectionCut=cms.double(0.5)), + cms.PSet( discriminator=cms.InputTag("hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr3Hits"), selectionCut=cms.double(0.5)), + cms.PSet( discriminator=cms.InputTag("hpsPFTauDiscriminationByLooseElectronRejection"), selectionCut=cms.double(0.5)), + cms.PSet( discriminator=cms.InputTag("hpsPFTauDiscriminationAgainstMuon2"), selectionCut=cms.double(0.5)) ), cut = cms.string("std::abs(eta) < 2.3 && pt > 19.0 "), filter = cms.bool(False) - ) +) isomuonTask = cms.Task(isomuons) isomuonseq = cms.Sequence(isomuonsTask) diff --git a/RecoMET/METPUSubtraction/src/PFMETAlgorithmMVA.cc b/RecoMET/METPUSubtraction/src/PFMETAlgorithmMVA.cc index 976b982927bf2..0902c7c8c1aac 100644 --- a/RecoMET/METPUSubtraction/src/PFMETAlgorithmMVA.cc +++ b/RecoMET/METPUSubtraction/src/PFMETAlgorithmMVA.cc @@ -3,10 +3,6 @@ #include "FWCore/ParameterSet/interface/FileInPath.h" #include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "CondFormats/DataRecord/interface/GBRWrapperRcd.h" - #include "DataFormats/METReco/interface/CommonMETData.h" #include @@ -112,13 +108,7 @@ const GBRForest* PFMETAlgorithmMVA::loadMVAfromFile(const edm::FileInPath& input return mva; } -const GBRForest* PFMETAlgorithmMVA::loadMVAfromDB(const edm::EventSetup& es, const std::string& mvaName) { - edm::ESHandle mva; - es.get().get(mvaName, mva); - return mva.product(); -} - -PFMETAlgorithmMVA::PFMETAlgorithmMVA(const edm::ParameterSet& cfg) +PFMETAlgorithmMVA::PFMETAlgorithmMVA(const edm::ParameterSet& cfg, edm::ConsumesCollector iC) : utils_(cfg), mvaReaderU_(nullptr), mvaReaderDPhi_(nullptr), @@ -127,7 +117,19 @@ PFMETAlgorithmMVA::PFMETAlgorithmMVA(const edm::ParameterSet& cfg) cfg_(cfg) { mvaType_ = kBaseline; + edm::ParameterSet cfgInputRecords = cfg_.getParameter("inputRecords"); + mvaNameU_ = cfgInputRecords.getParameter("U"); + mvaNameDPhi_ = cfgInputRecords.getParameter("DPhi"); + mvaNameCovU1_ = cfgInputRecords.getParameter("CovU1"); + mvaNameCovU2_ = cfgInputRecords.getParameter("CovU2"); + loadMVAfromDB_ = cfg.getParameter("loadMVAfromDB"); + if (loadMVAfromDB_) { + mvaTokenU_ = iC.esConsumes(edm::ESInputTag("", mvaNameU_)); + mvaTokenDPhi_ = iC.esConsumes(edm::ESInputTag("", mvaNameDPhi_)); + mvaTokenCovU1_ = iC.esConsumes(edm::ESInputTag("", mvaNameCovU1_)); + mvaTokenCovU2_ = iC.esConsumes(edm::ESInputTag("", mvaNameCovU2_)); + } } PFMETAlgorithmMVA::~PFMETAlgorithmMVA() { @@ -141,17 +143,11 @@ PFMETAlgorithmMVA::~PFMETAlgorithmMVA() { //------------------------------------------------------------------------------- void PFMETAlgorithmMVA::initialize(const edm::EventSetup& es) { - edm::ParameterSet cfgInputRecords = cfg_.getParameter("inputRecords"); - mvaNameU_ = cfgInputRecords.getParameter("U"); - mvaNameDPhi_ = cfgInputRecords.getParameter("DPhi"); - mvaNameCovU1_ = cfgInputRecords.getParameter("CovU1"); - mvaNameCovU2_ = cfgInputRecords.getParameter("CovU2"); - if (loadMVAfromDB_) { - mvaReaderU_ = loadMVAfromDB(es, mvaNameU_); - mvaReaderDPhi_ = loadMVAfromDB(es, mvaNameDPhi_); - mvaReaderCovU1_ = loadMVAfromDB(es, mvaNameCovU1_); - mvaReaderCovU2_ = loadMVAfromDB(es, mvaNameCovU2_); + mvaReaderU_ = &es.getData(mvaTokenU_); + mvaReaderDPhi_ = &es.getData(mvaTokenDPhi_); + mvaReaderCovU1_ = &es.getData(mvaTokenCovU1_); + mvaReaderCovU2_ = &es.getData(mvaTokenCovU2_); } else { edm::ParameterSet cfgInputFileNames = cfg_.getParameter("inputFileNames"); diff --git a/RecoMET/METProducers/interface/PFMETProducer.h b/RecoMET/METProducers/interface/PFMETProducer.h index 56560a2bb1c8d..f6a45c3a568d3 100644 --- a/RecoMET/METProducers/interface/PFMETProducer.h +++ b/RecoMET/METProducers/interface/PFMETProducer.h @@ -41,10 +41,10 @@ #include "RecoMET/METAlgorithms/interface/SignPFSpecificAlgo.h" #include "RecoMET/METAlgorithms/interface/METSignificance.h" +#include "CondFormats/DataRecord/interface/JetResolutionRcd.h" +#include "CondFormats/DataRecord/interface/JetResolutionScaleFactorRcd.h" #include "JetMETCorrections/Modules/interface/JetResolution.h" -#include "TVector.h" - #include //____________________________________________________________________________|| @@ -76,9 +76,10 @@ namespace cms { edm::EDGetTokenT> jetToken_; std::vector>> lepTokens_; - std::string jetSFType_; - std::string jetResPtType_; - std::string jetResPhiType_; + + edm::ESGetToken jetSFToken_; + edm::ESGetToken jetResPtToken_; + edm::ESGetToken jetResPhiToken_; edm::EDGetTokenT rhoToken_; bool applyWeight_; edm::EDGetTokenT> weightsToken_; diff --git a/RecoMET/METProducers/src/CSCHaloDataProducer.cc b/RecoMET/METProducers/src/CSCHaloDataProducer.cc index 504b3eee9bb6e..d89ab6efcf155 100644 --- a/RecoMET/METProducers/src/CSCHaloDataProducer.cc +++ b/RecoMET/METProducers/src/CSCHaloDataProducer.cc @@ -13,7 +13,7 @@ using namespace edm; using namespace std; using namespace reco; -CSCHaloDataProducer::CSCHaloDataProducer(const edm::ParameterSet& iConfig) { +CSCHaloDataProducer::CSCHaloDataProducer(const edm::ParameterSet& iConfig) : CSCAlgo(consumesCollector()) { //Digi Level IT_L1MuGMTReadout = iConfig.getParameter("L1MuGMTReadoutLabel"); diff --git a/RecoMET/METProducers/src/PFMETProducer.cc b/RecoMET/METProducers/src/PFMETProducer.cc index 9427e9753fee7..96f2e8d464dff 100644 --- a/RecoMET/METProducers/src/PFMETProducer.cc +++ b/RecoMET/METProducers/src/PFMETProducer.cc @@ -39,9 +39,9 @@ namespace cms { lepTokens_.push_back(mayConsume>(*it)); } - jetSFType_ = iConfig.getParameter("srcJetSF"); - jetResPtType_ = iConfig.getParameter("srcJetResPt"); - jetResPhiType_ = iConfig.getParameter("srcJetResPhi"); + jetSFToken_ = esConsumes(edm::ESInputTag("", iConfig.getParameter("srcJetSF"))); + jetResPtToken_ = esConsumes(edm::ESInputTag("", iConfig.getParameter("srcJetResPt"))); + jetResPhiToken_ = esConsumes(edm::ESInputTag("", iConfig.getParameter("srcJetResPhi"))); rhoToken_ = consumes(iConfig.getParameter("srcRho")); } @@ -106,9 +106,9 @@ namespace cms { edm::Handle> inputJets; event.getByToken(jetToken_, inputJets); - JME::JetResolution resPtObj = JME::JetResolution::get(setup, jetResPtType_); - JME::JetResolution resPhiObj = JME::JetResolution::get(setup, jetResPhiType_); - JME::JetResolutionScaleFactor resSFObj = JME::JetResolutionScaleFactor::get(setup, jetSFType_); + JME::JetResolution resPtObj(setup.getData(jetResPtToken_)); + JME::JetResolution resPhiObj(setup.getData(jetResPhiToken_)); + JME::JetResolutionScaleFactor resSFObj(setup.getData(jetSFToken_)); edm::Handle rho; event.getByToken(rhoToken_, rho); diff --git a/RecoMuon/GlobalMuonProducer/test/GLBMuonAnalyzer.cc b/RecoMuon/GlobalMuonProducer/test/GLBMuonAnalyzer.cc index 7963d983ecaf4..d95ddc13b4d0f 100644 --- a/RecoMuon/GlobalMuonProducer/test/GLBMuonAnalyzer.cc +++ b/RecoMuon/GlobalMuonProducer/test/GLBMuonAnalyzer.cc @@ -5,9 +5,11 @@ * \author A. Everett - Purdue University */ -#include "RecoMuon/GlobalMuonProducer/test/GLBMuonAnalyzer.h" +// Base Class Headers +#include "FWCore/Framework/interface/EDAnalyzer.h" // Collaborating Class Header +#include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/ESHandle.h" @@ -32,11 +34,50 @@ #include "TH1F.h" #include "TH2F.h" +class GLBMuonAnalyzer : public edm::EDAnalyzer { +public: + /// Constructor + GLBMuonAnalyzer(const edm::ParameterSet &pset); + + /// Destructor + virtual ~GLBMuonAnalyzer(); + + // Operations + + void analyze(const edm::Event &event, const edm::EventSetup &eventSetup); + + virtual void beginJob(); + virtual void endJob(); + +protected: +private: + edm::InputTag theGLBMuonLabel; + + std::string theRootFileName; + TFile *theFile; + + // Histograms + TH1F *hPtRec; + TH1F *hPtSim; + TH1F *hPres; + TH1F *h1_Pres; + TH1F *hPTDiff; + TH1F *hPTDiff2; + TH2F *hPTDiffvsEta; + TH2F *hPTDiffvsPhi; + + // Counters + int numberOfSimTracks; + int numberOfRecTracks; + + std::string theDataType; +}; + using namespace std; using namespace edm; /// Constructor -GLBMuonAnalyzer::GLBMuonAnalyzer(const ParameterSet& pset) { +GLBMuonAnalyzer::GLBMuonAnalyzer(const ParameterSet &pset) { theGLBMuonLabel = pset.getUntrackedParameter("GlobalTrackCollectionLabel"); theRootFileName = pset.getUntrackedParameter("rootFileName"); @@ -91,7 +132,7 @@ void GLBMuonAnalyzer::endJob() { theFile->Close(); } -void GLBMuonAnalyzer::analyze(const Event& event, const EventSetup& eventSetup) { +void GLBMuonAnalyzer::analyze(const Event &event, const EventSetup &eventSetup) { //LogTrace("Analyzer") << "Run: " << event.id().run() << " Event: " << event.id().event() << endl; MuonPatternRecoDumper debug; @@ -186,3 +227,5 @@ void GLBMuonAnalyzer::analyze(const Event& event, const EventSetup& eventSetup) } LogTrace("Analyzer") << "---" << endl; } + +DEFINE_FWK_MODULE(GLBMuonAnalyzer); diff --git a/RecoMuon/GlobalMuonProducer/test/GLBMuonAnalyzer.h b/RecoMuon/GlobalMuonProducer/test/GLBMuonAnalyzer.h deleted file mode 100644 index c7ad966bbd8b3..0000000000000 --- a/RecoMuon/GlobalMuonProducer/test/GLBMuonAnalyzer.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef RecoMuon_GlobalMuonProducer_GLBMuonAnalyzer_H -#define RecoMuon_GlobalMuonProducer_GLBMuonAnalyzer_H - -/** \class GLBMuonAnalyzer - * Analyzer of the Global muon tracks - * - * \author R. Bellan - INFN Torino - * \author A. Everett - Purdue University - */ - -// Base Class Headers -#include "FWCore/Framework/interface/EDAnalyzer.h" - -//#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Utilities/interface/InputTag.h" - -class TFile; -class TH1F; -class TH2F; - -class GLBMuonAnalyzer : public edm::EDAnalyzer { -public: - /// Constructor - GLBMuonAnalyzer(const edm::ParameterSet &pset); - - /// Destructor - virtual ~GLBMuonAnalyzer(); - - // Operations - - void analyze(const edm::Event &event, const edm::EventSetup &eventSetup); - - virtual void beginJob(); - virtual void endJob(); - -protected: -private: - edm::InputTag theGLBMuonLabel; - - std::string theRootFileName; - TFile *theFile; - - // Histograms - TH1F *hPtRec; - TH1F *hPtSim; - TH1F *hPres; - TH1F *h1_Pres; - TH1F *hPTDiff; - TH1F *hPTDiff2; - TH2F *hPTDiffvsEta; - TH2F *hPTDiffvsPhi; - - // Counters - int numberOfSimTracks; - int numberOfRecTracks; - - std::string theDataType; -}; -#endif diff --git a/RecoMuon/GlobalMuonProducer/test/SealModule.cc b/RecoMuon/GlobalMuonProducer/test/SealModule.cc deleted file mode 100644 index 282c1b0442d09..0000000000000 --- a/RecoMuon/GlobalMuonProducer/test/SealModule.cc +++ /dev/null @@ -1,13 +0,0 @@ -#include "FWCore/PluginManager/interface/ModuleDef.h" - -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/Services/src/SiteLocalConfigService.h" -#include "FWCore/ServiceRegistry/interface/ServiceMaker.h" -#include "RecoMuon/GlobalMuonProducer/test/GLBMuonAnalyzer.h" - -using namespace edm::serviceregistry; - - - -DEFINE_FWK_MODULE(GLBMuonAnalyzer); diff --git a/RecoMuon/GlobalTrackingTools/src/DynamicTruncation.cc b/RecoMuon/GlobalTrackingTools/src/DynamicTruncation.cc index 22ddcda9f2bf0..8b2e15211990d 100644 --- a/RecoMuon/GlobalTrackingTools/src/DynamicTruncation.cc +++ b/RecoMuon/GlobalTrackingTools/src/DynamicTruncation.cc @@ -26,7 +26,6 @@ #include "RecoMuon/TrackingTools/interface/MuonPatternRecoDumper.h" #include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimator.h" #include "TrackPropagation/SteppingHelixPropagator/interface/SteppingHelixPropagator.h" -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" #define MAX_THR 1e7 diff --git a/RecoMuon/MuonIdentification/test/MuonTimingValidator.cc b/RecoMuon/MuonIdentification/test/MuonTimingValidator.cc index c42d2f493b351..90656dee77336 100644 --- a/RecoMuon/MuonIdentification/test/MuonTimingValidator.cc +++ b/RecoMuon/MuonIdentification/test/MuonTimingValidator.cc @@ -46,10 +46,6 @@ #include "Geometry/DTGeometry/interface/DTLayer.h" #include "Geometry/DTGeometry/interface/DTSuperLayer.h" #include "DataFormats/DTRecHit/interface/DTSLRecSegment2D.h" -#include "RecoLocalMuon/DTSegment/src/DTSegmentUpdator.h" -#include "RecoLocalMuon/DTSegment/src/DTSegmentCleaner.h" -#include "RecoLocalMuon/DTSegment/src/DTHitPairForFit.h" -#include "RecoLocalMuon/DTSegment/src/DTSegmentCand.h" #include #include diff --git a/RecoPPS/Local/interface/TotemTimingConversions.h b/RecoPPS/Local/interface/TotemTimingConversions.h index 28ddc761bbe1f..90ed0aecd75d7 100644 --- a/RecoPPS/Local/interface/TotemTimingConversions.h +++ b/RecoPPS/Local/interface/TotemTimingConversions.h @@ -5,6 +5,7 @@ * Laurent Forthomme (laurent.forthomme@cern.ch) * Nicola Minafra (nicola.minafra@cern.ch) * Filip Dej + * Christopher Misan (krzysztof.misan@cern.ch) * ****************************************************************************/ @@ -21,7 +22,7 @@ class TotemTimingConversions { public: - TotemTimingConversions(bool mergeTimePeaks, const PPSTimingCalibration& calibration); + TotemTimingConversions(double sampicSamplingPeriodNs, bool mergeTimePeaks, const PPSTimingCalibration& calibration); float timeOfFirstSample(const TotemTimingDigi& digi) const; float triggerTime(const TotemTimingDigi& digi) const; @@ -30,14 +31,13 @@ class TotemTimingConversions { std::vector voltSamples(const TotemTimingDigi& digi) const; private: - static constexpr float SAMPIC_SAMPLING_PERIOD_NS = 1. / 7.695; static constexpr float SAMPIC_ADC_V = 1. / 256; static constexpr int SAMPIC_MAX_NUMBER_OF_SAMPLES = 64; - static constexpr int SAMPIC_DEFAULT_OFFSET = 30; static constexpr int ACCEPTED_TIME_RADIUS = 4; static constexpr unsigned long CELL0_MASK = 0xfffffff000; PPSTimingCalibration calibration_; + double sampicSamplingPeriodNs_; bool mergeTimePeaks_; reco::FormulaEvaluator calibrationFunction_; }; diff --git a/RecoPPS/Local/interface/TotemTimingRecHitProducerAlgorithm.h b/RecoPPS/Local/interface/TotemTimingRecHitProducerAlgorithm.h index f4bc0de97843f..f75a96f85ca25 100644 --- a/RecoPPS/Local/interface/TotemTimingRecHitProducerAlgorithm.h +++ b/RecoPPS/Local/interface/TotemTimingRecHitProducerAlgorithm.h @@ -4,6 +4,7 @@ * Authors: * Laurent Forthomme (laurent.forthomme@cern.ch) * Nicola Minafra + * Christopher Misan (krzysztof.misan@cern.ch) * ****************************************************************************/ @@ -58,6 +59,8 @@ class TotemTimingRecHitProducerAlgorithm { int smoothingPoints_; double lowPassFrequency_; double hysteresis_; + double sampicOffset_; + double sampicSamplingPeriodNs_; TotemTimingRecHit::TimingAlgorithm mode_; }; diff --git a/RecoPPS/Local/plugins/TotemTimingLocalTrackFitter.cc b/RecoPPS/Local/plugins/TotemTimingLocalTrackFitter.cc index f6c8740eb18d2..3d8f2badfce18 100644 --- a/RecoPPS/Local/plugins/TotemTimingLocalTrackFitter.cc +++ b/RecoPPS/Local/plugins/TotemTimingLocalTrackFitter.cc @@ -5,6 +5,7 @@ * Laurent Forthomme (laurent.forthomme@cern.ch) * Nicola Minafra (nicola.minafra@cern.ch) * Mateusz Szpyrka (mateusz.szpyrka@cern.ch) + * Christopher Misan (krzysztof.misan@cern.ch) * ****************************************************************************/ @@ -21,12 +22,13 @@ #include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/CTPPSDetId/interface/CTPPSDiamondDetId.h" #include "DataFormats/CTPPSDetId/interface/TotemTimingDetId.h" #include "DataFormats/CTPPSReco/interface/TotemTimingRecHit.h" #include "DataFormats/CTPPSReco/interface/TotemTimingLocalTrack.h" #include "RecoPPS/Local/interface/TotemTimingTrackRecognition.h" - +template class TotemTimingLocalTrackFitter : public edm::stream::EDProducer<> { public: explicit TotemTimingLocalTrackFitter(const edm::ParameterSet&); @@ -34,40 +36,32 @@ class TotemTimingLocalTrackFitter : public edm::stream::EDProducer<> { static void fillDescriptions(edm::ConfigurationDescriptions&); private: + static edm::ParameterSetDescription fillDescriptionsShared(edm::ConfigurationDescriptions&); void produce(edm::Event&, const edm::EventSetup&) override; const edm::EDGetTokenT > recHitsToken_; const int maxPlaneActiveChannels_; - std::map trk_algo_map_; + const edm::ParameterSet trk_algo_params_; + std::map trk_algo_map_; }; - -TotemTimingLocalTrackFitter::TotemTimingLocalTrackFitter(const edm::ParameterSet& iConfig) +template +TotemTimingLocalTrackFitter::TotemTimingLocalTrackFitter(const edm::ParameterSet& iConfig) : recHitsToken_(consumes >(iConfig.getParameter("recHitsTag"))), - maxPlaneActiveChannels_(iConfig.getParameter("maxPlaneActiveChannels")) { + maxPlaneActiveChannels_(iConfig.getParameter("maxPlaneActiveChannels")), + trk_algo_params_(iConfig.getParameter("trackingAlgorithmParams")) { produces >(); - - for (unsigned short armNo = 0; armNo < 2; armNo++) - for (unsigned short rpNo = 0; rpNo < 2; rpNo++) { - TotemTimingDetId id(armNo, 1, rpNo, 0, 0); - TotemTimingTrackRecognition trk_algo(iConfig.getParameter("trackingAlgorithmParams")); - trk_algo_map_.insert(std::make_pair(id, trk_algo)); - } } - -void TotemTimingLocalTrackFitter::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { +template +void TotemTimingLocalTrackFitter::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { auto pOut = std::make_unique >(); edm::Handle > recHits; iEvent.getByToken(recHitsToken_, recHits); - for (const auto& trk_algo_entry : trk_algo_map_) - pOut->find_or_insert(trk_algo_entry.first); - - std::map planeActivityMap; + std::map planeActivityMap; auto motherId = [](const edm::det_id_type& detid) { - TotemTimingDetId out(detid); - out.setStation(1); + T out(detid); out.setChannel(0); return out; }; @@ -77,6 +71,12 @@ void TotemTimingLocalTrackFitter::produce(edm::Event& iEvent, const edm::EventSe // feed hits to the track producers for (const auto& vec : *recHits) { + const CTPPSDetId raw_detid(vec.detId()); + T detid(raw_detid.arm(), raw_detid.station(), raw_detid.rp()); + // if algorithm is not found, build it + if (trk_algo_map_.count(detid) == 0) + trk_algo_map_.insert(std::make_pair(detid, trk_algo_params_)); + auto detId = motherId(vec.detId()); if (planeActivityMap[detId] > maxPlaneActiveChannels_) continue; @@ -91,8 +91,10 @@ void TotemTimingLocalTrackFitter::produce(edm::Event& iEvent, const edm::EventSe } // retrieves tracks for all hit sets - for (auto& trk_algo_entry : trk_algo_map_) + for (auto& trk_algo_entry : trk_algo_map_) { + pOut->find_or_insert(trk_algo_entry.first); trk_algo_entry.second.produceTracks(pOut->operator[](trk_algo_entry.first)); + } iEvent.put(std::move(pOut)); @@ -100,8 +102,9 @@ void TotemTimingLocalTrackFitter::produce(edm::Event& iEvent, const edm::EventSe for (auto& trk_algo_entry : trk_algo_map_) trk_algo_entry.second.clear(); } - -void TotemTimingLocalTrackFitter::fillDescriptions(edm::ConfigurationDescriptions& descr) { +template +edm::ParameterSetDescription TotemTimingLocalTrackFitter::fillDescriptionsShared( + edm::ConfigurationDescriptions& descr) { edm::ParameterSetDescription desc; desc.add("recHitsTag", edm::InputTag("totemTimingRecHits")) ->setComment("input rechits collection to retrieve"); @@ -140,8 +143,20 @@ void TotemTimingLocalTrackFitter::fillDescriptions(edm::ConfigurationDescription trackingAlgoParams.add("yWidth", 0.0)->setComment("vertical track width"); desc.add("trackingAlgorithmParams", trackingAlgoParams) ->setComment("list of parameters associated to the track recognition algorithm"); - + return desc; +} +template <> +void TotemTimingLocalTrackFitter::fillDescriptions(edm::ConfigurationDescriptions& descr) { + auto desc = fillDescriptionsShared(descr); descr.add("totemTimingLocalTracks", desc); } -DEFINE_FWK_MODULE(TotemTimingLocalTrackFitter); +template <> +void TotemTimingLocalTrackFitter::fillDescriptions(edm::ConfigurationDescriptions& descr) { + auto desc = fillDescriptionsShared(descr); + descr.add("diamondSampicLocalTracks", desc); +} +template class TotemTimingLocalTrackFitter; +template class TotemTimingLocalTrackFitter; +DEFINE_FWK_MODULE(TotemTimingLocalTrackFitter); +DEFINE_FWK_MODULE(TotemTimingLocalTrackFitter); diff --git a/RecoPPS/Local/plugins/TotemTimingRecHitProducer.cc b/RecoPPS/Local/plugins/TotemTimingRecHitProducer.cc index ba14bdea48a71..b13743f20453e 100644 --- a/RecoPPS/Local/plugins/TotemTimingRecHitProducer.cc +++ b/RecoPPS/Local/plugins/TotemTimingRecHitProducer.cc @@ -4,6 +4,7 @@ * Authors: * Laurent Forthomme (laurent.forthomme@cern.ch) * Nicola Minafra (nicola.minafra@cern.ch) + * Christopher Misan (krzysztof.misan@cern.ch) * ****************************************************************************/ @@ -96,8 +97,10 @@ void TotemTimingRecHitProducer::fillDescriptions(edm::ConfigurationDescriptions& desc.add("timingCalibrationTag", "GlobalTag:TotemTimingCalibration") ->setComment("input tag for timing calibrations retrieval"); desc.add("baselinePoints", 8)->setComment("number of points to be used for the baseline"); - desc.add("saturationLimit", 0.85) - ->setComment("all signals with max > saturationLimit will be considered as saturated"); + desc.add("saturationLimit", 0.1) + ->setComment( + "all signals with max > saturationLimit will be considered as saturated for UFSD, similarly with " + "min("cfdFraction", 0.3)->setComment("fraction of the CFD"); desc.add("smoothingPoints", 20) ->setComment("number of points to be used for the smoothing using sinc (lowpass)"); @@ -105,7 +108,8 @@ void TotemTimingRecHitProducer::fillDescriptions(edm::ConfigurationDescriptions& ->setComment("Frequency (in GHz) for CFD smoothing, 0 for disabling the filter"); desc.add("hysteresis", 5.e-3)->setComment("hysteresis of the discriminator"); desc.add("mergeTimePeaks", true)->setComment("if time peaks schould be merged"); - + desc.add("sampicOffset", 1.0)->setComment("offset of the flipped sampic signal"); + desc.add("sampicSamplingPeriodNs", 1. / 7.695)->setComment("sapic sampling period in ns"); descr.add("totemTimingRecHits", desc); } diff --git a/RecoPPS/Local/python/totemTimingLocalReconstruction_cff.py b/RecoPPS/Local/python/totemTimingLocalReconstruction_cff.py index de6708fb29376..8a6a249dbf354 100644 --- a/RecoPPS/Local/python/totemTimingLocalReconstruction_cff.py +++ b/RecoPPS/Local/python/totemTimingLocalReconstruction_cff.py @@ -3,11 +3,18 @@ # reco hit production from RecoPPS.Local.totemTimingRecHits_cfi import totemTimingRecHits -# local track fitting +#Diamond Sampic reconstruction flow +from RecoPPS.Local.diamondSampicLocalTracks_cfi import diamondSampicLocalTracks +diamondSampicLocalTracks.recHitsTag=cms.InputTag("totemTimingRecHits") +diamondSampicLocalReconstructionTask = cms.Task( + totemTimingRecHits, + diamondSampicLocalTracks) +diamondSampicLocalReconstruction = cms.Sequence(diamondSampicLocalReconstructionTask) + +#Original UFSD reconstruction flow from RecoPPS.Local.totemTimingLocalTracks_cfi import totemTimingLocalTracks - +totemTimingLocalTracks.recHitsTag=cms.InputTag("totemTimingRecHits") totemTimingLocalReconstructionTask = cms.Task( - totemTimingRecHits , - totemTimingLocalTracks -) + totemTimingRecHits, + totemTimingLocalTracks) totemTimingLocalReconstruction = cms.Sequence(totemTimingLocalReconstructionTask) diff --git a/RecoPPS/Local/src/TotemTimingConversions.cc b/RecoPPS/Local/src/TotemTimingConversions.cc index e3a5258e91a30..b206ef9018f80 100644 --- a/RecoPPS/Local/src/TotemTimingConversions.cc +++ b/RecoPPS/Local/src/TotemTimingConversions.cc @@ -5,6 +5,7 @@ * Laurent Forthomme (laurent.forthomme@cern.ch) * Nicola Minafra (nicola.minafra@cern.ch) * Filip Dej + * Christopher Misan (krzysztof.misan@cern.ch) * ****************************************************************************/ @@ -13,15 +14,18 @@ //---------------------------------------------------------------------------------------------------- -TotemTimingConversions::TotemTimingConversions(bool mergeTimePeaks, const PPSTimingCalibration& calibration) - : calibration_(calibration), mergeTimePeaks_(mergeTimePeaks), calibrationFunction_(calibration_.formula()) {} +TotemTimingConversions::TotemTimingConversions(double sampicSamplingPeriodNs, + bool mergeTimePeaks, + const PPSTimingCalibration& calibration) + : calibration_(calibration), + sampicSamplingPeriodNs_(sampicSamplingPeriodNs), + mergeTimePeaks_(mergeTimePeaks), + calibrationFunction_(calibration_.formula()) {} //---------------------------------------------------------------------------------------------------- float TotemTimingConversions::timeOfFirstSample(const TotemTimingDigi& digi) const { unsigned int offsetOfSamples = digi.eventInfo().offsetOfSamples(); - if (offsetOfSamples == 0) - offsetOfSamples = SAMPIC_DEFAULT_OFFSET; // FW 0 is not sending this, FW > 0 yes unsigned int timestamp = (digi.cellInfo() <= SAMPIC_MAX_NUMBER_OF_SAMPLES / 2) ? digi.timestampA() : digi.timestampB(); @@ -30,13 +34,13 @@ float TotemTimingConversions::timeOfFirstSample(const TotemTimingDigi& digi) con digi.eventInfo().l1ALatency(); // time of first cell - float cell0TimeInstant = SAMPIC_MAX_NUMBER_OF_SAMPLES * SAMPIC_SAMPLING_PERIOD_NS * cell0TimeClock; + float cell0TimeInstant = SAMPIC_MAX_NUMBER_OF_SAMPLES * sampicSamplingPeriodNs_ * cell0TimeClock; // time of triggered cell float firstCellTimeInstant = (digi.cellInfo() < offsetOfSamples) - ? cell0TimeInstant + digi.cellInfo() * SAMPIC_SAMPLING_PERIOD_NS - : cell0TimeInstant - (SAMPIC_MAX_NUMBER_OF_SAMPLES - digi.cellInfo()) * SAMPIC_SAMPLING_PERIOD_NS; + ? cell0TimeInstant + digi.cellInfo() * sampicSamplingPeriodNs_ + : cell0TimeInstant - (SAMPIC_MAX_NUMBER_OF_SAMPLES - digi.cellInfo()) * sampicSamplingPeriodNs_; int db = digi.hardwareBoardId(); int sampic = digi.hardwareSampicId(); @@ -46,10 +50,11 @@ float TotemTimingConversions::timeOfFirstSample(const TotemTimingDigi& digi) con if (mergeTimePeaks_) { if (t < -ACCEPTED_TIME_RADIUS) - t += SAMPIC_MAX_NUMBER_OF_SAMPLES * SAMPIC_SAMPLING_PERIOD_NS; + t += SAMPIC_MAX_NUMBER_OF_SAMPLES * sampicSamplingPeriodNs_; if (t > ACCEPTED_TIME_RADIUS) - t -= SAMPIC_MAX_NUMBER_OF_SAMPLES * SAMPIC_SAMPLING_PERIOD_NS; + t -= SAMPIC_MAX_NUMBER_OF_SAMPLES * sampicSamplingPeriodNs_; } + return t; } @@ -57,10 +62,7 @@ float TotemTimingConversions::timeOfFirstSample(const TotemTimingDigi& digi) con float TotemTimingConversions::triggerTime(const TotemTimingDigi& digi) const { unsigned int offsetOfSamples = digi.eventInfo().offsetOfSamples(); - if (offsetOfSamples == 0) - offsetOfSamples = 30; // FW 0 is not sending this, FW > 0 yes - - return timeOfFirstSample(digi) + (SAMPIC_MAX_NUMBER_OF_SAMPLES - offsetOfSamples) * SAMPIC_SAMPLING_PERIOD_NS; + return timeOfFirstSample(digi) + (SAMPIC_MAX_NUMBER_OF_SAMPLES - offsetOfSamples) * sampicSamplingPeriodNs_; } //---------------------------------------------------------------------------------------------------- @@ -77,7 +79,7 @@ float TotemTimingConversions::timePrecision(const TotemTimingDigi& digi) const { std::vector TotemTimingConversions::timeSamples(const TotemTimingDigi& digi) const { std::vector time(digi.numberOfSamples()); for (unsigned int i = 0; i < time.size(); ++i) - time.at(i) = timeOfFirstSample(digi) + i * SAMPIC_SAMPLING_PERIOD_NS; + time.at(i) = timeOfFirstSample(digi) + i * sampicSamplingPeriodNs_; return time; } diff --git a/RecoPPS/Local/src/TotemTimingRecHitProducerAlgorithm.cc b/RecoPPS/Local/src/TotemTimingRecHitProducerAlgorithm.cc index 87a5f3f23316a..2358079e9652b 100644 --- a/RecoPPS/Local/src/TotemTimingRecHitProducerAlgorithm.cc +++ b/RecoPPS/Local/src/TotemTimingRecHitProducerAlgorithm.cc @@ -4,6 +4,7 @@ * Authors: * Laurent Forthomme (laurent.forthomme@cern.ch) * Nicola Minafra + * Christopher Misan (krzysztof.misan@cern.ch) * ****************************************************************************/ @@ -24,12 +25,14 @@ TotemTimingRecHitProducerAlgorithm::TotemTimingRecHitProducerAlgorithm(const edm cfdFraction_(iConfig.getParameter("cfdFraction")), smoothingPoints_(iConfig.getParameter("smoothingPoints")), lowPassFrequency_(iConfig.getParameter("lowPassFrequency")), - hysteresis_(iConfig.getParameter("hysteresis")) {} + hysteresis_(iConfig.getParameter("hysteresis")), + sampicOffset_(iConfig.getParameter("sampicOffset")), + sampicSamplingPeriodNs_(iConfig.getParameter("sampicSamplingPeriodNs")) {} //---------------------------------------------------------------------------------------------------- void TotemTimingRecHitProducerAlgorithm::setCalibration(const PPSTimingCalibration& calib) { - sampicConversions_ = std::make_unique(mergeTimePeaks_, calib); + sampicConversions_ = std::make_unique(sampicSamplingPeriodNs_, mergeTimePeaks_, calib); } //---------------------------------------------------------------------------------------------------- @@ -38,7 +41,7 @@ void TotemTimingRecHitProducerAlgorithm::build(const CTPPSGeometry& geom, const edm::DetSetVector& input, edm::DetSetVector& output) { for (const auto& vec : input) { - const TotemTimingDetId detid(vec.detId()); + const CTPPSDetId detid(vec.detId()); float x_pos = 0.f, y_pos = 0.f, z_pos = 0.f; float x_width = 0.f, y_width = 0.f, z_width = 0.f; @@ -69,22 +72,31 @@ void TotemTimingRecHitProducerAlgorithm::build(const CTPPSGeometry& geom, const std::vector time(sampicConversions_->timeSamples(digi)); std::vector data(sampicConversions_->voltSamples(digi)); - auto max_it = std::max_element(data.begin(), data.end()); + auto [min_it, max_it] = std::minmax_element(data.begin(), data.end()); + if (det->name() == "CTPPS_Diamond_Segment") { + //flip the signal + for (unsigned int i = 0; i < data.size(); ++i) + data[i] = -data[i] + sampicOffset_; + } RegressionResults baselineRegression = simplifiedLinearRegression(time, data, 0, baselinePoints_); // remove baseline std::vector dataCorrected(data.size()); for (unsigned int i = 0; i < data.size(); ++i) dataCorrected[i] = data[i] - (baselineRegression.q + baselineRegression.m * time[i]); + auto max_corrected_it = std::max_element(dataCorrected.begin(), dataCorrected.end()); float t = TotemTimingRecHit::NO_T_AVAILABLE; - if (*max_it < saturationLimit_) - t = constantFractionDiscriminator(time, dataCorrected); + //if det==diamond then if (*min_it) > saturationLimit_), calculate the t, otherwise t=-100 + //if det==ufsd then if (*max_it) < saturationLimit_), calculate the t, otherwise t=-100 + //the difference between ufsd and sampic conditions comes from the signal flip + if ((det->name() == "CTPPS_Diamond_Segment" && (*min_it) > saturationLimit_) || + (det->name() == "CTPPS_UFSD_Segment" && (*max_it) < saturationLimit_)) + t = constantFractionDiscriminator(time, dataCorrected); mode_ = TotemTimingRecHit::CFD; - rec_hits.emplace_back(x_pos, x_width, y_pos, diff --git a/RecoPPS/Local/test/DiamondSampicDigiProducer.cc b/RecoPPS/Local/test/DiamondSampicDigiProducer.cc new file mode 100644 index 0000000000000..46702b79188f2 --- /dev/null +++ b/RecoPPS/Local/test/DiamondSampicDigiProducer.cc @@ -0,0 +1,186 @@ +// -*- C++ -*- +// +// Package: SampicDigi/DiamondSampicDigiProducer +// Class: DiamondSampicDigiProducer +// +/**\class DiamondSampicDigiProducer DiamondSampicDigiProducer.cc SampicDigi/DiamondSampicDigiProducer/plugins/DiamondSampicDigiProducer.cc + + Description: This plugin takes testbeam data as input and converts them to TotemTimingDigi which could be then passed to reco + + Implementation: + [Notes on implementation] +*/ +// +// Original Author: Christopher Misan (krzysztof.misan@cern.ch) +// Created: Sun, 07 Mar 2021 14:42:52 GMT +// +// + +// system include files +#include +#include + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/StreamID.h" + +#include "DataFormats/CTPPSDigi/interface/TotemTimingDigi.h" +#include "DataFormats/CTPPSDetId/interface/TotemTimingDetId.h" +#include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/CTPPSDetId/interface/CTPPSDiamondDetId.h" + +#include "TFile.h" +#include "TTree.h" +#include "TChain.h" + +// +// class declaration +// + +class DiamondSampicDigiProducer : public edm::stream::EDProducer<> { +public: + explicit DiamondSampicDigiProducer(const edm::ParameterSet&); + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void produce(edm::Event&, const edm::EventSetup&) override; + + // ----------member data --------------------------- + std::vector sampicFilesVec_; + std::unordered_map> detid_vs_chid_; + std::unique_ptr inputTree_; + + //constants + const int kMaxSampicChannels = 32; + const int kSampicSamples = 64; + const int kLhcClkPeriod = 25; + const int kMaxBunchNumber = 3564; + const double kLhcOrbitPeriodNs = 88924.45; + const double kSampicOffset = 1.2; +}; + +// +// constructors and destructor +// + +using namespace edm; +using namespace std; + +DiamondSampicDigiProducer::DiamondSampicDigiProducer(const edm::ParameterSet& iConfig) + : sampicFilesVec_(iConfig.getParameter>("sampicFilesVec")) { + for (const auto& id_map : iConfig.getParameter>("idsMapping")) + detid_vs_chid_[id_map.getParameter("treeChId")] = id_map.getParameter>("detId"); + + inputTree_ = std::make_unique("desy"); + for (const auto& fname : sampicFilesVec_) + inputTree_->Add(fname.c_str()); + + produces>("TotemTiming"); +} + +// +// member functions +// + +void DiamondSampicDigiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + int eventNum = iEvent.id().event(); + auto digi = std::make_unique>(); + + uint num_samples; + double trigger_time; + int sample_channel[kMaxSampicChannels]; + int sample_cellInfoForOrderedData[kMaxSampicChannels]; + unsigned int sample_timestampA[kMaxSampicChannels]; + unsigned int sample_timestampB[kMaxSampicChannels]; + unsigned long long sample_timestampFPGA[kMaxSampicChannels]; + double sample_amp[kMaxSampicChannels][kSampicSamples]; + double sample_triggerPosition[kMaxSampicChannels][kSampicSamples]; + + inputTree_->SetBranchAddress("num_samples", &num_samples); + inputTree_->SetBranchAddress("trigger_time", &trigger_time); + inputTree_->SetBranchAddress("sample_channel", sample_channel); + inputTree_->SetBranchAddress("sample_timestampFPGA", sample_timestampFPGA); + inputTree_->SetBranchAddress("sample_timestampA", sample_timestampA); + inputTree_->SetBranchAddress("sample_timestampB", sample_timestampB); + inputTree_->SetBranchAddress("sample_cellInfoForOrderedData", sample_cellInfoForOrderedData); + inputTree_->SetBranchAddress("sample_ampl", sample_amp); + inputTree_->SetBranchAddress("sample_triggerPosition", sample_triggerPosition); + inputTree_->GetEntry(eventNum); + + int bunchNumber = ((int)trigger_time / kLhcClkPeriod) % kMaxBunchNumber; + int orbitNumber = (int)(trigger_time / kLhcOrbitPeriodNs); + + if (num_samples == 0) { + iEvent.put(std::move(digi), "TotemTiming"); + return; + } + + for (uint i = 0; i < num_samples; i++) { + unsigned short ch_id = sample_channel[i]; + + //for testbeam data channels<8 don't contain measurements + if (ch_id < 8) + continue; + + std::vector samples; + unsigned int offsetOfSamples = 0; + bool search_for_white_cell = true; + + for (int y = 0; y < kSampicSamples; y++) { + samples.push_back((int)(sample_amp[i][y] / kSampicOffset * 256)); + if (search_for_white_cell && sample_triggerPosition[i][y] == 1) { + offsetOfSamples = y; + search_for_white_cell = false; + } + } + + TotemTimingEventInfo eventInfoTmp(0, + trigger_time * 1E9 / 10, //l1ATimestamp + bunchNumber, + orbitNumber, + eventNum, + 1, + 1220 / 10, //l1ALatency + 64, + offsetOfSamples, + 1); + + TotemTimingDigi digiTmp(2 * 32 + ch_id, + sample_timestampFPGA[i], + sample_timestampA[i], + sample_timestampB[i], + sample_cellInfoForOrderedData[i], + samples, + eventInfoTmp); + + auto vec = detid_vs_chid_.at(ch_id); + for (const auto& id : vec) { + CTPPSDiamondDetId detId(id); + edm::DetSet& digis_for_detid = digi->find_or_insert(detId); + digis_for_detid.push_back(digiTmp); + } + } + iEvent.put(std::move(digi), "TotemTiming"); +} + +void DiamondSampicDigiProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add>("sampicFilesVec")->setComment("path to sampic root data"); + + edm::ParameterSetDescription idmap_valid; + idmap_valid.add("treeChId", 0)->setComment("HW id as retrieved from tree"); + idmap_valid.add>("detId")->setComment("mapped CTPPSDiamondDetId's for this channel"); + + desc.addVPSet("idsMapping", idmap_valid); + + descriptions.add("DiamondSampicDigiProducer", desc); +} + +DEFINE_FWK_MODULE(DiamondSampicDigiProducer); diff --git a/RecoPPS/Local/test/totemTiming_digiConverter_reco_cfg.py b/RecoPPS/Local/test/totemTiming_digiConverter_reco_cfg.py new file mode 100644 index 0000000000000..0ba58aab2e89c --- /dev/null +++ b/RecoPPS/Local/test/totemTiming_digiConverter_reco_cfg.py @@ -0,0 +1,91 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("DiamondSampic") + +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10000) ) + +process.source = cms.Source("EmptySource") + +process.load('RecoPPS.Local.totemTimingLocalReconstruction_cff') + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_data', '') + +################ +#digi converter +################ +process.totemTimingRawToDigi = cms.EDProducer('DiamondSampicDigiProducer', + #input path of the testbeam data + sampicFilesVec=cms.vstring("/eos/cms/store/group/dpg_ctpps/comm_ctpps/201905_DesyTestbeam/MergedDev/Ntuple_runsampic_159_runtelescope_636.root"), + ################ + #channel mapping + ################ + idsMapping = cms.VPSet( + cms.PSet(detId = cms.vuint32(2054160384,2054553600,2056257536,2056650752), treeChId = cms.uint32(8)), + cms.PSet(detId = cms.vuint32(2054164480,2054557696,2056261632,2056654848), treeChId = cms.uint32(9)), + cms.PSet(detId = cms.vuint32(2054168576,2054561792,2056265728,2056658944), treeChId = cms.uint32(10)), + cms.PSet(detId = cms.vuint32(2054172672,2054565888,2056269824,2056663040), treeChId = cms.uint32(11)), + cms.PSet(detId = cms.vuint32(2054176768,2054569984,2056273920,2056667136), treeChId = cms.uint32(12)), + cms.PSet(detId = cms.vuint32(2054180864,2054574080,2056278016,2056671232), treeChId = cms.uint32(13)), + cms.PSet(detId = cms.vuint32(2054184960,2054578176,2056282112,2056675328), treeChId = cms.uint32(14)), + cms.PSet(detId = cms.vuint32(2054189056,2054582272,2056286208,2056679424), treeChId = cms.uint32(15)), + cms.PSet(detId = cms.vuint32(2054193152,2054586368,2056290304,2056683520), treeChId = cms.uint32(16)), + cms.PSet(detId = cms.vuint32(2054197248,2054590464,2056294400,2056687616), treeChId = cms.uint32(17)), + cms.PSet(detId = cms.vuint32(2054201344,2054594560,2056298496,2056691712), treeChId = cms.uint32(18)), + cms.PSet(detId = cms.vuint32(2054205440,2054598656,2056302592,2056695808), treeChId = cms.uint32(19)), + + cms.PSet(detId = cms.vuint32(2054291456,2054422528,2056388608,2056519680), treeChId = cms.uint32(20)), + cms.PSet(detId = cms.vuint32(2054295552,2054426624,2056392704,2056523776), treeChId = cms.uint32(21)), + cms.PSet(detId = cms.vuint32(2054299648,2054430720,2056396800,2056527872), treeChId = cms.uint32(22)), + cms.PSet(detId = cms.vuint32(2054303744,2054434816,2056400896,2056531968), treeChId = cms.uint32(23)), + cms.PSet(detId = cms.vuint32(2054307840,2054438912,2056404992,2056536064), treeChId = cms.uint32(24)), + cms.PSet(detId = cms.vuint32(2054311936,2054443008,2056409088,2056540160), treeChId = cms.uint32(25)), + cms.PSet(detId = cms.vuint32(2054316032,2054447104,2056413184,2056544256), treeChId = cms.uint32(26)), + cms.PSet(detId = cms.vuint32(2054320128,2054451200,2056417280,2056548352), treeChId = cms.uint32(27)), + cms.PSet(detId = cms.vuint32(2054324224,2054455296,2056421376,2056552448), treeChId = cms.uint32(28)), + cms.PSet(detId = cms.vuint32(2054328320,2054459392,2056425472,2056556544), treeChId = cms.uint32(29)), + cms.PSet(detId = cms.vuint32(2054332416,2054463488,2056429568,2056560640), treeChId = cms.uint32(30)), + cms.PSet(detId = cms.vuint32(2054336512,2054467584,2056433664,2056564736), treeChId = cms.uint32(31)) + + ) +) + +################ +#geometry +################ +process.load('Geometry.VeryForwardGeometry.geometryRPFromDD_2021_cfi') + +################ +#calib +################ + +#load calibrations from json +#process.totemTimingRecHits.timingCalibrationTag= cms.string('ppsTimingCalibrationESSource:TotemTimingCalibration') +#process.ppsTimingCalibrationESSource = cms.ESSource('PPSTimingCalibrationESSource', +# calibrationFile = cms.FileInPath('RecoPPS/Local/data/timing_offsets_ufsd_2018.dec18.cal.json'),#calibration file does not yet exist in db +# subDetector = cms.uint32(1), +# appendToDataLabel = cms.string('TotemTimingCalibration') +#) + + + +process.totemTimingRecHits.mergeTimePeaks= cms.bool(False) + +process.out = cms.OutputModule("PoolOutputModule", + fileName = cms.untracked.string('file:diamondSampicReco.root') + +) + +process.p = cms.Path(process.totemTimingRawToDigi* + process.diamondSampicLocalReconstruction +) + +process.outpath = cms.EndPath(process.out) + + diff --git a/RecoPPS/Local/test/totemTiming_reco_cfg.py b/RecoPPS/Local/test/totemTiming_reco_cfg.py index 07f283dec4e09..7b95af9931500 100644 --- a/RecoPPS/Local/test/totemTiming_reco_cfg.py +++ b/RecoPPS/Local/test/totemTiming_reco_cfg.py @@ -53,7 +53,7 @@ process.load("EventFilter.CTPPSRawToDigi.ctppsRawToDigi_cff") # rechits production -process.load('Geometry.VeryForwardGeometry.geometryRPFromDD_2018_cfi') +process.load('Geometry.VeryForwardGeometry.geometryRPFromDD_2021_cfi') process.load('RecoPPS.Local.totemTimingLocalReconstruction_cff') process.output = cms.OutputModule("PoolOutputModule", @@ -65,9 +65,17 @@ ) # execution configuration +#Diamond Sampic flow process.p = cms.Path( process.ctppsRawToDigi* - process.totemTimingLocalReconstruction + process.diamondSampicLocalReconstruction ) +#Legacy UFSD flow +#process.totemTimingRecHits.saturationLimit=cms.double(0.85) +#process.p = cms.Path( +# process.ctppsRawToDigi* +# process.totemTimingLocalReconstruction +#) + process.outpath = cms.EndPath(process.output) diff --git a/RecoParticleFlow/Configuration/python/RecoParticleFlow_EventContent_cff.py b/RecoParticleFlow/Configuration/python/RecoParticleFlow_EventContent_cff.py index 9ac3e44c40f9e..2bd2008a44be8 100644 --- a/RecoParticleFlow/Configuration/python/RecoParticleFlow_EventContent_cff.py +++ b/RecoParticleFlow/Configuration/python/RecoParticleFlow_EventContent_cff.py @@ -67,7 +67,7 @@ RecoParticleFlowRECO.outputCommands.extend(RecoParticleFlowAOD.outputCommands) phase2_hgcal.toModify( RecoParticleFlowRECO, - outputCommands = RecoParticleFlowRECO.outputCommands + ['keep *_particleFlowSuperClusterHGCalFromMultiCl_*_*', + outputCommands = RecoParticleFlowRECO.outputCommands + ['keep *_particleFlowSuperClusterHGCal_*_*', 'keep recoPFBlocks_simPFProducer_*_*']) # Full Event content diff --git a/RecoParticleFlow/Configuration/python/RecoParticleFlow_cff.py b/RecoParticleFlow/Configuration/python/RecoParticleFlow_cff.py index 567c09b16ed19..d4c6fe1b94f84 100644 --- a/RecoParticleFlow/Configuration/python/RecoParticleFlow_cff.py +++ b/RecoParticleFlow/Configuration/python/RecoParticleFlow_cff.py @@ -63,6 +63,7 @@ # # for simPF +from RecoParticleFlow.PFClusterProducer.particleFlowClusterHGC_cfi import * from RecoParticleFlow.PFTracking.hgcalTrackCollection_cfi import * from RecoParticleFlow.PFProducer.simPFProducer_cff import * from SimTracker.TrackerHitAssociation.tpClusterProducer_cfi import * @@ -72,6 +73,7 @@ hgcalTrackCollection , tpClusterProducer , quickTrackAssociatorByHits , + particleFlowClusterHGCalFromSimCl , simPFProducer ) _phase2_hgcal_simPFSequence = cms.Sequence(_phase2_hgcal_simPFTask) diff --git a/RecoParticleFlow/PFClusterProducer/python/particleFlowClusterHGC_cfi.py b/RecoParticleFlow/PFClusterProducer/python/particleFlowClusterHGC_cfi.py index c36d95eaaf0d6..ece63d19494e3 100644 --- a/RecoParticleFlow/PFClusterProducer/python/particleFlowClusterHGC_cfi.py +++ b/RecoParticleFlow/PFClusterProducer/python/particleFlowClusterHGC_cfi.py @@ -61,12 +61,12 @@ recHitCleaners = cms.VPSet(), seedCleaners = cms.VPSet(), seedFinder = _passThruSeeds_HGCal, - initialClusteringStep = _simClusterMapper_HGCal, + initialClusteringStep = _hgcalTracksterMapper_HGCal, pfClusterBuilder = cms.PSet(), positionReCalc = _positionCalcPCA_HGCal, energyCorrector = cms.PSet() ) -particleFlowClusterHGCalFromMultiCl = particleFlowClusterHGCal.clone( - initialClusteringStep = _hgcalTracksterMapper_HGCal +particleFlowClusterHGCalFromSimCl = particleFlowClusterHGCal.clone( + initialClusteringStep = _simClusterMapper_HGCal ) diff --git a/RecoParticleFlow/PFSimProducer/plugins/PFSimParticleProducer.cc b/RecoParticleFlow/PFSimProducer/plugins/PFSimParticleProducer.cc index 2eb632b65e7d2..9f94a78e079a4 100644 --- a/RecoParticleFlow/PFSimProducer/plugins/PFSimParticleProducer.cc +++ b/RecoParticleFlow/PFSimProducer/plugins/PFSimParticleProducer.cc @@ -24,7 +24,6 @@ #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/TrackReco/interface/TrackFwd.h" #include "DataFormats/TrackerRecHit2D/interface/FastTrackerRecHit.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/stream/EDProducer.h" @@ -94,6 +93,8 @@ class PFSimParticleProducer : public edm::stream::EDProducer<> { edm::InputTag inputTagEcalRecHitsEE_; edm::EDGetTokenT tokenEcalRecHitsEE_; + edm::ESGetToken pdtToken_; + // parameters for retrieving true particles information -- edm::ParameterSet particleFilter_; @@ -160,6 +161,8 @@ PFSimParticleProducer::PFSimParticleProducer(const edm::ParameterSet& iConfig) { inputTagEcalRecHitsEE_ = iConfig.getParameter("ecalRecHitsEE"); tokenEcalRecHitsEE_ = consumes(inputTagEcalRecHitsEE_); + pdtToken_ = esConsumes(); + verbose_ = iConfig.getUntrackedParameter("verbose", false); // register products @@ -172,10 +175,7 @@ PFSimParticleProducer::PFSimParticleProducer(const edm::ParameterSet& iConfig) { void PFSimParticleProducer::produce(Event& iEvent, const EventSetup& iSetup) { // init Particle data table (from Pythia) - edm::ESHandle pdt; - // edm::ESHandle < DefaultConfig::ParticleDataTable > pdt; - iSetup.getData(pdt); - mySimEvent->initializePdt(&(*pdt)); + mySimEvent->initializePdt(&iSetup.getData(pdtToken_)); LogDebug("PFSimParticleProducer") << "START event: " << iEvent.id().event() << " in run " << iEvent.id().run() << endl; diff --git a/RecoParticleFlow/PFSimProducer/plugins/SimPFProducer.cc b/RecoParticleFlow/PFSimProducer/plugins/SimPFProducer.cc index bc73c145939de..6bedbb04367c6 100644 --- a/RecoParticleFlow/PFSimProducer/plugins/SimPFProducer.cc +++ b/RecoParticleFlow/PFSimProducer/plugins/SimPFProducer.cc @@ -78,7 +78,7 @@ DEFINE_FWK_MODULE(SimPFProducer); void SimPFProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { // simPFProducer edm::ParameterSetDescription desc; - desc.add("simClustersSrc", {"particleFlowClusterHGCal"}); + desc.add("simClustersSrc", {"particleFlowClusterHGCalFromSimCl"}); desc.add("trackSrc", {"generalTracks"}); desc.add>("associators", { diff --git a/RecoParticleFlow/PFTracking/python/mergedElectronSeeds_cfi.py b/RecoParticleFlow/PFTracking/python/mergedElectronSeeds_cfi.py index 7e71b38266f88..e5dc112043e21 100644 --- a/RecoParticleFlow/PFTracking/python/mergedElectronSeeds_cfi.py +++ b/RecoParticleFlow/PFTracking/python/mergedElectronSeeds_cfi.py @@ -9,6 +9,3 @@ from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA pp_on_AA.toModify(electronMergedSeeds, TkBasedSeeds = '') -electronMergedSeedsFromMultiCl = electronMergedSeeds.clone( - EcalBasedSeeds = 'ecalDrivenElectronSeedsFromMultiCl' -) diff --git a/RecoPixelVertexing/PixelLowPtUtilities/python/AllPixelTracks_cfi.py b/RecoPixelVertexing/PixelLowPtUtilities/python/AllPixelTracks_cfi.py index 37867549f0cc6..7d5e3a2f76948 100644 --- a/RecoPixelVertexing/PixelLowPtUtilities/python/AllPixelTracks_cfi.py +++ b/RecoPixelVertexing/PixelLowPtUtilities/python/AllPixelTracks_cfi.py @@ -3,13 +3,12 @@ from RecoPixelVertexing.PixelLowPtUtilities.clusterShapeTrackFilter_cfi import clusterShapeTrackFilter from RecoPixelVertexing.PixelLowPtUtilities.trackFitter_cfi import trackFitter from RecoPixelVertexing.PixelLowPtUtilities.trackCleaner_cfi import trackCleaner +import RecoPixelVertexing.PixelTrackFitting.pixelTracks_cfi as _mod ########################## # The base for all steps -allPixelTracks = cms.EDProducer("PixelTrackProducer", - - passLabel = cms.string(''), - +allPixelTracks = _mod.pixelTracks.clone( + passLabel = '', # Region RegionFactoryPSet = cms.PSet( ComponentName = cms.string('GlobalTrackingRegionWithVerticesProducer'), @@ -27,7 +26,6 @@ nSigmaZ = cms.double(3.0) ) ), - # Ordered hits OrderedHitsFactoryPSet = cms.PSet( ComponentName = cms.string('StandardHitTripletGenerator'), @@ -45,7 +43,7 @@ ), # Filter - Filter = cms.InputTag("clusterShapeTrackFilter"), + Filter = "clusterShapeTrackFilter", # Cleaner CleanerPSet = cms.string("trackCleaner"), diff --git a/RecoPixelVertexing/PixelLowPtUtilities/src/StripSubClusterShapeTrajectoryFilter.cc b/RecoPixelVertexing/PixelLowPtUtilities/src/StripSubClusterShapeTrajectoryFilter.cc index a6bce194ce907..6c7a71f66c831 100644 --- a/RecoPixelVertexing/PixelLowPtUtilities/src/StripSubClusterShapeTrajectoryFilter.cc +++ b/RecoPixelVertexing/PixelLowPtUtilities/src/StripSubClusterShapeTrajectoryFilter.cc @@ -22,7 +22,6 @@ #include "MagneticField/Engine/interface/MagneticField.h" #include "RecoPixelVertexing/PixelLowPtUtilities/interface/ClusterShapeHitFilter.h" #include "RecoTracker/Record/interface/CkfComponentsRecord.h" -#include "RecoTracker/MeasurementDet/src/TkMeasurementDetSet.h" #include "RecoTracker/MeasurementDet/interface/MeasurementTrackerEvent.h" #include "TrackingTools/PatternTools/interface/TempTrajectory.h" #include "TrackingTools/PatternTools/interface/Trajectory.h" diff --git a/RecoPixelVertexing/PixelTriplets/src/CACut.h b/RecoPixelVertexing/PixelTriplets/interface/CACut.h similarity index 95% rename from RecoPixelVertexing/PixelTriplets/src/CACut.h rename to RecoPixelVertexing/PixelTriplets/interface/CACut.h index 17e31a165e4a4..cc625b9050854 100644 --- a/RecoPixelVertexing/PixelTriplets/src/CACut.h +++ b/RecoPixelVertexing/PixelTriplets/interface/CACut.h @@ -1,3 +1,5 @@ +#ifndef RecoPixelVertexing_PixelTriplets_interface_CACut_h +#define RecoPixelVertexing_PixelTriplets_interface_CACut_h // -*- C++ -*- // // // // Package: RecoPixelVertexing/PixelTriplets @@ -7,11 +9,9 @@ // // Created: Wed, 14 Feb 2019 10:30:00 GMT // // -#ifndef RecoPixelVertexing_PixelTriplets_src_CACut_h -#define RecoPixelVertexing_PixelTriplets_src_CACut_h - #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" -#include "CAGraph.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "RecoPixelVertexing/PixelTriplets/interface/CAGraph.h" class CACut { public: diff --git a/RecoPixelVertexing/PixelTriplets/src/CAGraph.h b/RecoPixelVertexing/PixelTriplets/interface/CAGraph.h similarity index 88% rename from RecoPixelVertexing/PixelTriplets/src/CAGraph.h rename to RecoPixelVertexing/PixelTriplets/interface/CAGraph.h index c47079ffeb769..43e0f2f7ae626 100644 --- a/RecoPixelVertexing/PixelTriplets/src/CAGraph.h +++ b/RecoPixelVertexing/PixelTriplets/interface/CAGraph.h @@ -1,5 +1,5 @@ -#ifndef RecoPixelVertexing_PixelTriplets_src_CAGraph_h -#define RecoPixelVertexing_PixelTriplets_src_CAGraph_h +#ifndef RecoPixelVertexing_PixelTriplets_interface_CAGraph_h +#define RecoPixelVertexing_PixelTriplets_interface_CAGraph_h #include #include @@ -61,4 +61,4 @@ struct CAGraph { std::vector theRootLayers; }; -#endif // RecoPixelVertexing_PixelTriplets_src_CAGraph_h +#endif // RecoPixelVertexing_PixelTriplets_interface_CAGraph_h diff --git a/RecoPixelVertexing/PixelTriplets/interface/CAHitQuadrupletGenerator.h b/RecoPixelVertexing/PixelTriplets/interface/CAHitQuadrupletGenerator.h index deb2beb6099ee..7e93f30a186fb 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/CAHitQuadrupletGenerator.h +++ b/RecoPixelVertexing/PixelTriplets/interface/CAHitQuadrupletGenerator.h @@ -16,7 +16,7 @@ #include "RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h" #include "RecoPixelVertexing/PixelTriplets/interface/OrderedHitSeeds.h" -#include "RecoPixelVertexing/PixelTriplets/src/CACut.h" +#include "RecoPixelVertexing/PixelTriplets/interface/CACut.h" class TrackingRegion; class SeedingLayerSetsHits; diff --git a/RecoPixelVertexing/PixelTriplets/interface/CAHitTripletGenerator.h b/RecoPixelVertexing/PixelTriplets/interface/CAHitTripletGenerator.h index 081358b49fe52..7ac7a77927209 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/CAHitTripletGenerator.h +++ b/RecoPixelVertexing/PixelTriplets/interface/CAHitTripletGenerator.h @@ -17,7 +17,7 @@ #include "RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h" #include "RecoPixelVertexing/PixelTriplets/interface/OrderedHitSeeds.h" -#include "RecoPixelVertexing/PixelTriplets/src/CACut.h" +#include "RecoPixelVertexing/PixelTriplets/interface/CACut.h" class TrackingRegion; class SeedingLayerSetsHits; diff --git a/RecoPixelVertexing/PixelTriplets/plugins/ThirdHitRZPrediction.h b/RecoPixelVertexing/PixelTriplets/interface/ThirdHitRZPrediction.h similarity index 100% rename from RecoPixelVertexing/PixelTriplets/plugins/ThirdHitRZPrediction.h rename to RecoPixelVertexing/PixelTriplets/interface/ThirdHitRZPrediction.h diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAConstants.h b/RecoPixelVertexing/PixelTriplets/plugins/CAConstants.h index 8ea536465814c..0197ce44ffcad 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAConstants.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAConstants.h @@ -32,9 +32,10 @@ namespace caConstants { constexpr uint32_t maxCellsPerHit = 128 / 2; #else // GPU_SMALL_EVENTS // tested on MC events with 55-75 pileup events - constexpr uint32_t maxNumberOfTuples = 24 * 1024; + // and extended for Heavy Ions operations (24k -> 32k tuples, 128 -> 212 cells) + constexpr uint32_t maxNumberOfTuples = 32 * 1024; constexpr uint32_t maxNumberOfDoublets = 512 * 1024; - constexpr uint32_t maxCellsPerHit = 128; + constexpr uint32_t maxCellsPerHit = 212; #endif // GPU_SMALL_EVENTS #endif // ONLY_PHICUT constexpr uint32_t maxNumOfActiveDoublets = maxNumberOfDoublets / 8; diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc index 9a934bdb2fd4d..36b4bce0850ae 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc @@ -3,7 +3,7 @@ #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "ThirdHitPredictionFromInvParabola.h" -#include "ThirdHitRZPrediction.h" +#include "RecoPixelVertexing/PixelTriplets/interface/ThirdHitRZPrediction.h" #include "RecoTracker/TkMSParametrization/interface/PixelRecoUtilities.h" #include "FWCore/Framework/interface/ESHandle.h" diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.cc index 2662b65e406c1..608dc5a7e3c7a 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.cc @@ -3,7 +3,7 @@ #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "RecoPixelVertexing/PixelTriplets/interface/ThirdHitPredictionFromCircle.h" -#include "ThirdHitRZPrediction.h" +#include "RecoPixelVertexing/PixelTriplets/interface/ThirdHitRZPrediction.h" #include "RecoTracker/TkMSParametrization/interface/PixelRecoUtilities.h" #include "FWCore/Framework/interface/ESHandle.h" diff --git a/RecoPixelVertexing/PixelTriplets/src/CACell.h b/RecoPixelVertexing/PixelTriplets/src/CACell.h index ffe13ce2ebe5b..223026812271c 100644 --- a/RecoPixelVertexing/PixelTriplets/src/CACell.h +++ b/RecoPixelVertexing/PixelTriplets/src/CACell.h @@ -8,7 +8,7 @@ #include "RecoTracker/TkHitPairs/interface/RecHitsSortedInPhi.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" #include "TrackingTools/TransientTrackingRecHit/interface/SeedingLayerSetsHits.h" -#include "CACut.h" +#include "RecoPixelVertexing/PixelTriplets/interface/CACut.h" class CACellStatus { public: diff --git a/RecoPixelVertexing/PixelTriplets/src/CAHitQuadrupletGenerator.cc b/RecoPixelVertexing/PixelTriplets/src/CAHitQuadrupletGenerator.cc index 285253b14b81b..8676b48c4a253 100644 --- a/RecoPixelVertexing/PixelTriplets/src/CAHitQuadrupletGenerator.cc +++ b/RecoPixelVertexing/PixelTriplets/src/CAHitQuadrupletGenerator.cc @@ -10,7 +10,7 @@ #include "RecoPixelVertexing/PixelTriplets/interface/ThirdHitPredictionFromCircle.h" #include "TrackingTools/DetLayers/interface/BarrelDetLayer.h" -#include "CAGraph.h" +#include "RecoPixelVertexing/PixelTriplets/interface/CAGraph.h" #include "CellularAutomaton.h" namespace { diff --git a/RecoPixelVertexing/PixelTriplets/src/CAHitTripletGenerator.cc b/RecoPixelVertexing/PixelTriplets/src/CAHitTripletGenerator.cc index 03a5c75195a08..be604fd60d631 100644 --- a/RecoPixelVertexing/PixelTriplets/src/CAHitTripletGenerator.cc +++ b/RecoPixelVertexing/PixelTriplets/src/CAHitTripletGenerator.cc @@ -11,7 +11,7 @@ #include "RecoPixelVertexing/PixelTriplets/interface/ThirdHitPredictionFromCircle.h" #include "TrackingTools/DetLayers/interface/BarrelDetLayer.h" -#include "CAGraph.h" +#include "RecoPixelVertexing/PixelTriplets/interface/CAGraph.h" #include "CellularAutomaton.h" namespace { diff --git a/RecoPixelVertexing/PixelTriplets/src/CellularAutomaton.h b/RecoPixelVertexing/PixelTriplets/src/CellularAutomaton.h index 454ba8c867799..ce9731635b54d 100644 --- a/RecoPixelVertexing/PixelTriplets/src/CellularAutomaton.h +++ b/RecoPixelVertexing/PixelTriplets/src/CellularAutomaton.h @@ -7,7 +7,7 @@ #include "TrackingTools/TransientTrackingRecHit/interface/SeedingLayerSetsHits.h" #include "CACell.h" -#include "CAGraph.h" +#include "RecoPixelVertexing/PixelTriplets/interface/CAGraph.h" class CellularAutomaton { public: diff --git a/RecoTauTag/Configuration/python/tools/adaptToRunAtMiniAOD.py b/RecoTauTag/Configuration/python/tools/adaptToRunAtMiniAOD.py index e19ab6c984573..7487b9c5675ab 100644 --- a/RecoTauTag/Configuration/python/tools/adaptToRunAtMiniAOD.py +++ b/RecoTauTag/Configuration/python/tools/adaptToRunAtMiniAOD.py @@ -7,241 +7,300 @@ # Created: 9 Nov. 2017 ###### +import PhysicsTools.PatAlgos.tools.helpers as configtools ##### -def addTauReReco(process): - #PAT - process.load('PhysicsTools.PatAlgos.producersLayer1.tauProducer_cff') - process.load('PhysicsTools.PatAlgos.selectionLayer1.tauSelector_cfi') - process.selectedPatTaus.cut="pt > 18. && tauID(\'decayModeFindingNewDMs\')> 0.5" #Cut as in MiniAOD - #Tau RECO - process.load("RecoTauTag.Configuration.RecoPFTauTag_cff") - #Task/Sequence for tau rereco - process.miniAODTausTask = cms.Task( - process.PFTauTask, - process.makePatTausTask, - process.selectedPatTaus - ) - process.miniAODTausSequence = cms.Sequence(process.miniAODTausTask) - #Path with tau rereco (Needed?) - process.TauReco = cms.Path(process.miniAODTausSequence) +class adaptToRunAtMiniAOD(object): + def __init__(self, process, runBoosted=False, postfix=""): + self.process = process + self.runBoosted = runBoosted + self.postfix = postfix + if runBoosted: + self.postfix = 'Boosted'+postfix + #print("Adapting boosted tau reconstruction to run at miniAOD; postfix = \"%s\"" % self.postfix) + #else: + # print("Adapting tau reconstruction to run at miniAOD; postfix = \"%s\"" % self.postfix) -##### -def convertModuleToMiniAODInput(process, name): - module = getattr(process, name) - if hasattr(module, 'particleFlowSrc'): - module.particleFlowSrc = cms.InputTag("packedPFCandidates", "", "") - if hasattr(module, 'vertexSrc'): - module.vertexSrc = cms.InputTag('offlineSlimmedPrimaryVertices') - if hasattr(module, 'qualityCuts') and hasattr(module.qualityCuts, 'primaryVertexSrc'): - module.qualityCuts.primaryVertexSrc = cms.InputTag('offlineSlimmedPrimaryVertices') + ##### + def addTauReReco(self): + #PAT + self.process.load('PhysicsTools.PatAlgos.producersLayer1.tauProducer_cff') + self.process.load('PhysicsTools.PatAlgos.selectionLayer1.tauSelector_cfi') + self.process.selectedPatTaus.cut="pt > 18. && tauID(\'decayModeFindingNewDMs\')> 0.5" #Cut as in MiniAOD + #Tau RECO + self.process.load("RecoTauTag.Configuration.RecoPFTauTag_cff") + #Task/Sequence for tau rereco + self.process.miniAODTausTask = cms.Task( + self.process.PFTauTask, + self.process.makePatTausTask, + self.process.selectedPatTaus + ) + self.miniAODTausTask = configtools.cloneProcessingSnippetTask( + self.process,self.process.miniAODTausTask,postfix=self.postfix) + setattr(self.process,'miniAODTausSequence'+self.postfix,cms.Sequence(self.miniAODTausTask)) + if not self.postfix=="": + del self.process.miniAODTausTask -##### -def adaptTauToMiniAODReReco(process, reclusterJets=True): + ##### + def convertModuleToMiniAODInput(self,name): + module = getattr(self.process, name) + if hasattr(module, 'particleFlowSrc'): + module.particleFlowSrc = cms.InputTag("packedPFCandidates", "", "") + if hasattr(module, 'vertexSrc'): + module.vertexSrc = cms.InputTag('offlineSlimmedPrimaryVertices') + if hasattr(module, 'qualityCuts') and hasattr(module.qualityCuts, 'primaryVertexSrc'): + module.qualityCuts.primaryVertexSrc = cms.InputTag('offlineSlimmedPrimaryVertices') + + ##### + def adaptTauToMiniAODReReco(self,reclusterJets=True): # TRYING TO MAKE THINGS MINIAOD COMPATIBLE, FROM THE START, TO THE END, 1 BY 1 - #print '[adaptTauToMiniAODReReco]: Start' - - jetCollection = 'slimmedJets' - # Add new jet collections if reclustering is demanded - if reclusterJets: - jetCollection = 'patJetsPAT' - from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets - process.ak4PFJetsPAT = ak4PFJets.clone( - src=cms.InputTag("packedPFCandidates") - ) - # trivial PATJets - from PhysicsTools.PatAlgos.producersLayer1.jetProducer_cfi import _patJets - process.patJetsPAT = _patJets.clone( - jetSource = cms.InputTag("ak4PFJetsPAT"), - addJetCorrFactors = cms.bool(False), - jetCorrFactorsSource = cms.VInputTag(), - addBTagInfo = cms.bool(False), - addDiscriminators = cms.bool(False), - discriminatorSources = cms.VInputTag(), - addAssociatedTracks = cms.bool(False), - addJetCharge = cms.bool(False), - addGenPartonMatch = cms.bool(False), - embedGenPartonMatch = cms.bool(False), - addGenJetMatch = cms.bool(False), - getJetMCFlavour = cms.bool(False), - addJetFlavourInfo = cms.bool(False), - ) - process.miniAODTausTask.add(process.ak4PFJetsPAT) - process.miniAODTausTask.add(process.patJetsPAT) + #print '[adaptTauToMiniAODReReco]: Start' + jetCollection = 'slimmedJets' + # Add new jet collections if reclustering is demanded + if self.runBoosted: + jetCollection = 'boostedTauSeedsPAT'+self.postfix + from RecoTauTag.Configuration.boostedHPSPFTaus_cff import ca8PFJetsCHSprunedForBoostedTaus + setattr(self.process,'ca8PFJetsCHSprunedForBoostedTausPAT'+self.postfix,ca8PFJetsCHSprunedForBoostedTaus.clone( + src = 'packedPFCandidates', + jetCollInstanceName = 'subJetsForSeedingBoostedTausPAT' + )) + setattr(self.process,'boostedTauSeedsPAT'+self.postfix, + cms.EDProducer("PATBoostedTauSeedsProducer", + subjetSrc = cms.InputTag('ca8PFJetsCHSprunedForBoostedTausPAT'+self.postfix,'subJetsForSeedingBoostedTausPAT'), + pfCandidateSrc = cms.InputTag('packedPFCandidates'), + verbosity = cms.int32(0) + )) + self.miniAODTausTask.add(getattr(self.process,'ca8PFJetsCHSprunedForBoostedTausPAT'+self.postfix)) + self.miniAODTausTask.add(getattr(self.process,'boostedTauSeedsPAT'+self.postfix)) + elif reclusterJets: + jetCollection = 'patJetsPAT'+self.postfix + from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets + setattr(self.process,'ak4PFJetsPAT'+self.postfix,ak4PFJets.clone( + src = "packedPFCandidates" + )) + # trivial PATJets + from PhysicsTools.PatAlgos.producersLayer1.jetProducer_cfi import _patJets + setattr(self.process,'patJetsPAT'+self.postfix,_patJets.clone( + jetSource = "ak4PFJetsPAT"+self.postfix, + addJetCorrFactors = False, + jetCorrFactorsSource = [], + addBTagInfo = False, + addDiscriminators = False, + discriminatorSources = [], + addAssociatedTracks = False, + addJetCharge = False, + addGenPartonMatch = False, + embedGenPartonMatch = False, + addGenJetMatch = False, + getJetMCFlavour = False, + addJetFlavourInfo = False, + )) + self.miniAODTausTask.add(getattr(self.process,'ak4PFJetsPAT'+self.postfix)) + self.miniAODTausTask.add(getattr(self.process,'patJetsPAT'+self.postfix)) - # so this adds all tracks to jet in some deltaR region. we don't have tracks so don't need it :D - # process.ak4PFJetTracksAssociatorAtVertex.jets = cms.InputTag(jetCollection) + # so this adds all tracks to jet in some deltaR region. we don't have tracks so don't need it :D + # self.process.ak4PFJetTracksAssociatorAtVertex.jets = cms.InputTag(jetCollection) - # Remove ak4PFJetTracksAssociatorAtVertex from recoTauCommonSequence - # Remove pfRecoTauTagInfoProducer from recoTauCommonSequence since it uses the jet-track association - # HOWEVER, may use https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookMiniAOD2017#Isolated_Tracks - # probably needs recovery of the two modules above - - process.recoTauAK4Jets08RegionPAT = cms.EDProducer("RecoTauPatJetRegionProducer", - deltaR = process.recoTauAK4PFJets08Region.deltaR, - maxJetAbsEta = process.recoTauAK4PFJets08Region.maxJetAbsEta, - minJetPt = process.recoTauAK4PFJets08Region.minJetPt, - pfCandAssocMapSrc = cms.InputTag(""), - pfCandSrc = cms.InputTag("packedPFCandidates"), - src = cms.InputTag(jetCollection) - ) - - process.recoTauPileUpVertices.src = cms.InputTag("offlineSlimmedPrimaryVertices") - # Redefine recoTauCommonTask - # with redefined region and PU vertices, and w/o track-to-vertex associator and tauTagInfo (the two latter are probably obsolete and not needed at all) - process.recoTauCommonTask = cms.Task( - process.recoTauAK4Jets08RegionPAT, - process.recoTauPileUpVertices - ) - - for moduleName in process.TauReco.moduleNames(): - convertModuleToMiniAODInput(process, moduleName) - - - # Adapt TauPiZeros producer - process.ak4PFJetsLegacyHPSPiZeros.builders[0].qualityCuts.primaryVertexSrc = cms.InputTag("offlineSlimmedPrimaryVertices") - process.ak4PFJetsLegacyHPSPiZeros.jetSrc = cms.InputTag(jetCollection) - - # Adapt TauChargedHadrons producer - for builder in process.ak4PFJetsRecoTauChargedHadrons.builders: - builder.qualityCuts.primaryVertexSrc = cms.InputTag("offlineSlimmedPrimaryVertices") - if builder.name.value() == 'tracks': #replace plugin based on generalTracks by one based on lostTracks - builder.name = 'lostTracks' - builder.plugin = 'PFRecoTauChargedHadronFromLostTrackPlugin' - builder.srcTracks = cms.InputTag("lostTracks") - process.ak4PFJetsRecoTauChargedHadrons.jetSrc = cms.InputTag(jetCollection) - - # Adapt combinatoricRecoTau producer - process.combinatoricRecoTaus.jetRegionSrc = 'recoTauAK4Jets08RegionPAT' - process.combinatoricRecoTaus.jetSrc = jetCollection - # Adapt builders - for builder in process.combinatoricRecoTaus.builders: - for name,value in builder.parameters_().items(): - if name == 'qualityCuts': - builder.qualityCuts.primaryVertexSrc = 'offlineSlimmedPrimaryVertices' - elif name == 'pfCandSrc': - builder.pfCandSrc = 'packedPFCandidates' - # Adapt supported modifiers and remove unsupported ones - modifiersToRemove_ = cms.VPSet() - for mod in process.combinatoricRecoTaus.modifiers: - if mod.name.value() == 'elec_rej': - modifiersToRemove_.append(mod) - continue - elif mod.name.value() == 'TTIworkaround': - modifiersToRemove_.append(mod) - continue - for name,value in mod.parameters_().items(): - if name == 'qualityCuts': - mod.qualityCuts.primaryVertexSrc = 'offlineSlimmedPrimaryVertices' - for mod in modifiersToRemove_: - process.combinatoricRecoTaus.modifiers.remove(mod) - #print "\t\t Removing '%s' modifier from 'combinatoricRecoTaus'" %mod.name.value() - - # Redefine tau PV producer - process.hpsPFTauPrimaryVertexProducer.__dict__['_TypedParameterizable__type'] = 'PFTauMiniAODPrimaryVertexProducer' - process.hpsPFTauPrimaryVertexProducer.PVTag = 'offlineSlimmedPrimaryVertices' - process.hpsPFTauPrimaryVertexProducer.packedCandidatesTag = cms.InputTag("packedPFCandidates") - process.hpsPFTauPrimaryVertexProducer.lostCandidatesTag = cms.InputTag("lostTracks") - - # Redefine tau SV producer - process.hpsPFTauSecondaryVertexProducer = cms.EDProducer("PFTauSecondaryVertexProducer", - PFTauTag = cms.InputTag("hpsPFTauProducer") - ) + # Remove ak4PFJetTracksAssociatorAtVertex from recoTauCommonSequence + # Remove pfRecoTauTagInfoProducer from recoTauCommonSequence since it uses the jet-track association + # HOWEVER, may use https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookMiniAOD2017#Isolated_Tracks + # probably needs recovery of the two modules above + self.miniAODTausTask.remove(getattr(self.process,'ak4PFJetTracksAssociatorAtVertex'+self.postfix)) + self.miniAODTausTask.remove(getattr(self.process,'pfRecoTauTagInfoProducer'+self.postfix)) + + self.miniAODTausTask.remove(getattr(self.process,'recoTauAK4PFJets08Region'+self.postfix)) + setattr(self.process,'recoTauAK4Jets08RegionPAT'+self.postfix, + cms.EDProducer("RecoTauPatJetRegionProducer", + deltaR = self.process.recoTauAK4PFJets08Region.deltaR, + maxJetAbsEta = self.process.recoTauAK4PFJets08Region.maxJetAbsEta, + minJetPt = self.process.recoTauAK4PFJets08Region.minJetPt, + pfCandAssocMapSrc = cms.InputTag(""), + pfCandSrc = cms.InputTag("packedPFCandidates"), + src = cms.InputTag(jetCollection) + )) + _jetRegionProducer = getattr(self.process,'recoTauAK4Jets08RegionPAT'+self.postfix) + self.miniAODTausTask.add(_jetRegionProducer) + if self.runBoosted: + _jetRegionProducer.pfCandAssocMapSrc = cms.InputTag(jetCollection, 'pfCandAssocMapForIsolation') + + getattr(self.process,'recoTauPileUpVertices'+self.postfix).src = "offlineSlimmedPrimaryVertices" + + for moduleName in self.miniAODTausTask.moduleNames(): + self.convertModuleToMiniAODInput(moduleName) + + + # Adapt TauPiZeros producer + _piZeroProducer = getattr(self.process,'ak4PFJetsLegacyHPSPiZeros'+self.postfix) + for builder in _piZeroProducer.builders: + builder.qualityCuts.primaryVertexSrc = "offlineSlimmedPrimaryVertices" + _piZeroProducer.jetSrc = jetCollection + + # Adapt TauChargedHadrons producer + _chargedHadronProducer = getattr(self.process,'ak4PFJetsRecoTauChargedHadrons'+self.postfix) + for builder in _chargedHadronProducer.builders: + builder.qualityCuts.primaryVertexSrc = "offlineSlimmedPrimaryVertices" + if builder.name.value() == 'tracks': #replace plugin based on generalTracks by one based on lostTracks + builder.name = 'lostTracks' + builder.plugin = 'PFRecoTauChargedHadronFromLostTrackPlugin' + builder.srcTracks = "lostTracks" + if self.runBoosted: + builder.dRcone = 0.3 + builder.dRconeLimitedToJetArea = True + _chargedHadronProducer.jetSrc = jetCollection + + # Adapt combinatoricRecoTau producer + _combinatoricRecoTauProducer = getattr(self.process,'combinatoricRecoTaus'+self.postfix) + _combinatoricRecoTauProducer.jetRegionSrc = 'recoTauAK4Jets08RegionPAT'+self.postfix + _combinatoricRecoTauProducer.jetSrc = jetCollection + # Adapt builders + for builder in _combinatoricRecoTauProducer.builders: + for name,value in builder.parameters_().items(): + if name == 'qualityCuts': + builder.qualityCuts.primaryVertexSrc = 'offlineSlimmedPrimaryVertices' + elif name == 'pfCandSrc': + builder.pfCandSrc = 'packedPFCandidates' + # Adapt supported modifiers and remove unsupported ones + _modifiersToRemove = cms.VPSet() + for mod in _combinatoricRecoTauProducer.modifiers: + if mod.name.value() == 'elec_rej': + _modifiersToRemove.append(mod) + continue + elif mod.name.value() == 'TTIworkaround': + _modifiersToRemove.append(mod) + continue + for name,value in mod.parameters_().items(): + if name == 'qualityCuts': + mod.qualityCuts.primaryVertexSrc = 'offlineSlimmedPrimaryVertices' + for mod in _modifiersToRemove: + _combinatoricRecoTauProducer.modifiers.remove(mod) + #print "\t\t Removing '%s' modifier from 'combinatoricRecoTaus'" %mod.name.value() + + # Redefine tau PV producer + _tauPVProducer = getattr(self.process,'hpsPFTauPrimaryVertexProducer'+self.postfix) + _tauPVProducer.__dict__['_TypedParameterizable__type'] = 'PFTauMiniAODPrimaryVertexProducer' + _tauPVProducer.PVTag = 'offlineSlimmedPrimaryVertices' + _tauPVProducer.packedCandidatesTag = cms.InputTag("packedPFCandidates") + _tauPVProducer.lostCandidatesTag = cms.InputTag("lostTracks") + + # Redefine tau SV producer + setattr(self.process,'hpsPFTauSecondaryVertexProducer'+self.postfix, + cms.EDProducer("PFTauSecondaryVertexProducer", + PFTauTag = cms.InputTag("hpsPFTauProducer"+self.postfix) + )) - # Remove RecoTau producers which are not supported (yet?), i.e. against-e/mu discriminats - for moduleName in process.TauReco.moduleNames(): - if 'ElectronRejection' in moduleName or 'MuonRejection' in moduleName: - if 'ByDeadECALElectronRejection' in moduleName: continue - process.miniAODTausTask.remove(getattr(process, moduleName)) - - # Instead add against-mu discriminants which are MiniAOD compatible - from RecoTauTag.RecoTau.hpsPFTauDiscriminationByMuonRejectionSimple_cff import hpsPFTauDiscriminationByMuonRejectionSimple + # Remove RecoTau producers which are not supported (yet?), i.e. against-e/mu discriminats + for moduleName in self.miniAODTausTask.moduleNames(): + if 'ElectronRejection' in moduleName or 'MuonRejection' in moduleName: + if 'ByDeadECALElectronRejection' in moduleName: continue + self.miniAODTausTask.remove(getattr(self.process, moduleName)) + + # Instead add against-mu discriminants which are MiniAOD compatible + from RecoTauTag.RecoTau.hpsPFTauDiscriminationByMuonRejectionSimple_cff import hpsPFTauDiscriminationByMuonRejectionSimple - process.hpsPFTauDiscriminationByMuonRejectionSimple = hpsPFTauDiscriminationByMuonRejectionSimple - process.miniAODTausTask.add(process.hpsPFTauDiscriminationByMuonRejectionSimple) + setattr(self.process,'hpsPFTauDiscriminationByMuonRejectionSimple'+self.postfix, + hpsPFTauDiscriminationByMuonRejectionSimple.clone( + PFTauProducer = "hpsPFTauProducer"+self.postfix)) + _tauIDAntiMuSimple = getattr(self.process,'hpsPFTauDiscriminationByMuonRejectionSimple'+self.postfix) + if self.runBoosted: + _tauIDAntiMuSimple.dRmuonMatch = 0.1 + self.miniAODTausTask.add(_tauIDAntiMuSimple) - ##### - # PAT part in the following - - process.tauGenJets.GenParticles = cms.InputTag("prunedGenParticles") - process.tauMatch.matched = cms.InputTag("prunedGenParticles") - - # Remove unsupported tauIDs - for name, src in process.patTaus.tauIDSources.parameters_().items(): - if name.find('againstElectron') > -1 or name.find('againstMuon') > -1: - if name.find('againstElectronDeadECAL') > -1: continue - delattr(process.patTaus.tauIDSources,name) - # Add MiniAOD specific ones - setattr(process.patTaus.tauIDSources,'againstMuonLooseSimple', - cms.PSet(inputTag = cms.InputTag('hpsPFTauDiscriminationByMuonRejectionSimple'), - provenanceConfigLabel = cms.string('IDWPdefinitions'), - idLabel = cms.string('ByLooseMuonRejectionSimple') + ##### + # PAT part in the following + + getattr(self.process,'tauGenJets'+self.postfix).GenParticles = "prunedGenParticles" + getattr(self.process,'tauMatch'+self.postfix).matched = "prunedGenParticles" + + # Remove unsupported tauIDs + _patTauProducer = getattr(self.process,'patTaus'+self.postfix) + for name,src in _patTauProducer.tauIDSources.parameters_().items(): + if name.find('againstElectron') > -1 or name.find('againstMuon') > -1: + if name.find('againstElectronDeadECAL') > -1: continue + delattr(_patTauProducer.tauIDSources,name) + # Add MiniAOD specific ones + setattr(_patTauProducer.tauIDSources,'againstMuonLooseSimple', + cms.PSet(inputTag = cms.InputTag('hpsPFTauDiscriminationByMuonRejectionSimple'+self.postfix), + provenanceConfigLabel = cms.string('IDWPdefinitions'), + idLabel = cms.string('ByLooseMuonRejectionSimple') )) - setattr(process.patTaus.tauIDSources,'againstMuonTightSimple', - cms.PSet(inputTag = cms.InputTag('hpsPFTauDiscriminationByMuonRejectionSimple'), - provenanceConfigLabel = cms.string('IDWPdefinitions'), - idLabel = cms.string('ByTightMuonRejectionSimple') + setattr(_patTauProducer.tauIDSources,'againstMuonTightSimple', + cms.PSet(inputTag = cms.InputTag('hpsPFTauDiscriminationByMuonRejectionSimple'+self.postfix), + provenanceConfigLabel = cms.string('IDWPdefinitions'), + idLabel = cms.string('ByTightMuonRejectionSimple') )) - # Run TauIDs (anti-e && deepTau) on top of selectedPatTaus - _updatedTauName = 'selectedPatTausNewIDs' - _noUpdatedTauName = 'selectedPatTausNoNewIDs' - import RecoTauTag.RecoTau.tools.runTauIdMVA as tauIdConfig - tauIdEmbedder = tauIdConfig.TauIDEmbedder( - process, debug = False, - updatedTauName = _updatedTauName, - toKeep = ['againstEle2018','deepTau2017v2p1'] - ) - tauIdEmbedder.runTauID() - setattr(process, _noUpdatedTauName, process.selectedPatTaus.clone()) - process.miniAODTausTask.add(getattr(process,_noUpdatedTauName)) - delattr(process, 'selectedPatTaus') - process.deepTau2017v2p1.taus = _noUpdatedTauName - process.patTauDiscriminationByElectronRejectionMVA62018Raw.PATTauProducer = _noUpdatedTauName - process.patTauDiscriminationByElectronRejectionMVA62018.PATTauProducer = _noUpdatedTauName - process.selectedPatTaus = getattr(process, _updatedTauName).clone( - src = _noUpdatedTauName - ) - process.newTauIDsTask = cms.Task( - process.rerunMvaIsolationTask, - process.selectedPatTaus - ) - process.miniAODTausTask.add(process.newTauIDsTask) - - #print '[adaptTauToMiniAODReReco]: Done!' + # Run TauIDs (anti-e && deepTau) on top of selectedPatTaus + _updatedTauName = 'selectedPatTausNewIDs'+self.postfix + _noUpdatedTauName = 'selectedPatTausNoNewIDs'+self.postfix + toKeep = ['againstEle2018'] + if not self.runBoosted: + toKeep.append('deepTau2017v2p1') + import RecoTauTag.RecoTau.tools.runTauIdMVA as tauIdConfig + tauIdEmbedder = tauIdConfig.TauIDEmbedder( + self.process, debug = False, + originalTauName = _noUpdatedTauName, + updatedTauName = _updatedTauName, + postfix = "MiniAODTaus"+self.postfix, + toKeep = toKeep + ) + tauIdEmbedder.runTauID() + setattr(self.process, _noUpdatedTauName, getattr(self.process,'selectedPatTaus'+self.postfix).clone()) + self.miniAODTausTask.add(getattr(self.process,_noUpdatedTauName)) + delattr(self.process, 'selectedPatTaus'+self.postfix) + setattr(self.process,'selectedPatTaus'+self.postfix,getattr(self.process, _updatedTauName).clone()) + delattr(self.process, _updatedTauName) + setattr(self.process,'newTauIDsTask'+self.postfix,cms.Task( + getattr(self.process,'rerunMvaIsolationTaskMiniAODTaus'+self.postfix), + getattr(self.process,'selectedPatTaus'+self.postfix) + )) + self.miniAODTausTask.add(getattr(self.process,'newTauIDsTask'+self.postfix)) + + #print '[adaptTauToMiniAODReReco]: Done!' -##### -def setOutputModule(mode=0): + ##### + def setOutputModule(self,mode=0): #mode = 0: store original MiniAOD and new selectedPatTaus #mode = 1: store original MiniAOD, new selectedPatTaus, and all PFTau products as in AOD (except of unsuported ones), plus a few additional collections (charged hadrons, pi zeros, combinatoric reco taus) - import Configuration.EventContent.EventContent_cff as evtContent - output = cms.OutputModule( - 'PoolOutputModule', - fileName=cms.untracked.string('miniAOD_TauReco.root'), - fastCloning=cms.untracked.bool(False), - dataset=cms.untracked.PSet( - dataTier=cms.untracked.string('MINIAODSIM'), - filterName=cms.untracked.string('') - ), - outputCommands = evtContent.MINIAODSIMEventContent.outputCommands, - SelectEvents=cms.untracked.PSet( - SelectEvents=cms.vstring('*',) + import Configuration.EventContent.EventContent_cff as evtContent + output = cms.OutputModule( + 'PoolOutputModule', + fileName=cms.untracked.string('miniAOD_TauReco.root'), + fastCloning=cms.untracked.bool(False), + dataset=cms.untracked.PSet( + dataTier=cms.untracked.string('MINIAODSIM'), + filterName=cms.untracked.string('') + ), + outputCommands = evtContent.MINIAODSIMEventContent.outputCommands, + SelectEvents=cms.untracked.PSet( + SelectEvents=cms.vstring('*',) ) - ) - output.outputCommands.append('keep *_selectedPatTaus_*_*') - if mode==1: - for prod in evtContent.RecoTauTagAOD.outputCommands: - if prod.find('ElectronRejection') > -1 and prod.find('DeadECAL') == -1: - continue - if prod.find('MuonRejection') > -1: - continue - output.outputCommands.append(prod) - output.outputCommands.append('keep *_hpsPFTauDiscriminationByMuonRejectionSimple_*_*') - output.outputCommands.append('keep *_combinatoricReco*_*_*') - output.outputCommands.append('keep *_ak4PFJetsRecoTauChargedHadrons_*_*') - output.outputCommands.append('keep *_ak4PFJetsLegacyHPSPiZeros_*_*') - output.outputCommands.append('keep *_patJetsPAT_*_*') - - return output + ) + output.outputCommands.append('keep *_selectedPatTaus'+self.postfix+'_*_*') + if mode==1: + import re + for prod in evtContent.RecoTauTagAOD.outputCommands: + if prod.find('ElectronRejection') > -1 and prod.find('DeadECAL') == -1: + continue + if prod.find('MuonRejection') > -1: + continue + if prod.find("_*_*")>-1: # products w/o instance + output.outputCommands.append(prod.replace("_*_*",self.postfix+"_*_*")) + else: # check if there are prods with instance + m = re.search(r'_[A-Za-z0-9]+_\*', prod) + if m!=None: + inst = m.group(0) + output.outputCommands.append(prod.replace(inst,self.postfix+inst)) + else: + print("Warning: \"%s\" do not match known name patterns; trying to keep w/o postfix" % prod) + output.outputCommands.append(prod) + + output.outputCommands.append('keep *_hpsPFTauDiscriminationByMuonRejectionSimple'+self.postfix+'_*_*') + output.outputCommands.append('keep *_combinatoricReco*_*_*') + output.outputCommands.append('keep *_ak4PFJetsRecoTauChargedHadrons'+self.postfix+'_*_*') + output.outputCommands.append('keep *_ak4PFJetsLegacyHPSPiZeros'+self.postfix+'_*_*') + output.outputCommands.append('keep *_patJetsPAT'+self.postfix+'_*_*') + output.outputCommands.append('keep *_boostedTauSeedsPAT'+self.postfix+'_*_*') + + return output ##### diff --git a/RecoTauTag/RecoTau/interface/PFTauPrimaryVertexProducerBase.h b/RecoTauTag/RecoTau/interface/PFTauPrimaryVertexProducerBase.h index 49d01e20fe29f..90f797f561d09 100644 --- a/RecoTauTag/RecoTau/interface/PFTauPrimaryVertexProducerBase.h +++ b/RecoTauTag/RecoTau/interface/PFTauPrimaryVertexProducerBase.h @@ -30,6 +30,9 @@ #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" +#include "TrackingTools/Records/interface/TransientTrackRecord.h" + #include "DataFormats/TauReco/interface/PFTauDiscriminator.h" #include "CommonTools/Utils/interface/StringCutObjectSelector.h" #include "RecoTauTag/RecoTau/interface/RecoTauVertexAssociator.h" @@ -72,6 +75,7 @@ class PFTauPrimaryVertexProducerBase : public edm::stream::EDProducer<> { edm::EDGetTokenT > muonToken_; edm::EDGetTokenT pvToken_; edm::EDGetTokenT beamSpotToken_; + edm::ESGetToken transTrackBuilderToken_; int algorithm_; edm::ParameterSet qualityCutsPSet_; bool useBeamSpot_; diff --git a/RecoTauTag/RecoTau/python/PATTauDiscriminationAgainstElectronMVA6Phase2_cff.py b/RecoTauTag/RecoTau/python/PATTauDiscriminationAgainstElectronMVA6Phase2_cff.py index 7565461c686c4..162c3f3fb16f7 100644 --- a/RecoTauTag/RecoTau/python/PATTauDiscriminationAgainstElectronMVA6Phase2_cff.py +++ b/RecoTauTag/RecoTau/python/PATTauDiscriminationAgainstElectronMVA6Phase2_cff.py @@ -2,7 +2,7 @@ # Electron collection merger mergedSlimmedElectronsForTauId = cms.EDProducer('PATElectronCollectionMerger', - src = cms.VInputTag('slimmedElectrons', 'slimmedElectronsFromMultiCl') + src = cms.VInputTag('slimmedElectrons', 'slimmedElectronsHGC') ) # anti-e phase-2 tauID (Raw) from RecoTauTag.RecoTau.tauDiscriminationAgainstElectronMVA6Phase2_mvaDefs_cff import mvaNames_phase2, mapping_phase2, workingPoints_phase2 diff --git a/RecoTauTag/RecoTau/python/PATTauDiscriminationByMVAIsolationRun2_cff.py b/RecoTauTag/RecoTau/python/PATTauDiscriminationByMVAIsolationRun2_cff.py index 0574f9d1656e7..eec9593e021f4 100644 --- a/RecoTauTag/RecoTau/python/PATTauDiscriminationByMVAIsolationRun2_cff.py +++ b/RecoTauTag/RecoTau/python/PATTauDiscriminationByMVAIsolationRun2_cff.py @@ -3,28 +3,25 @@ from RecoTauTag.RecoTau.TauDiscriminatorTools import noPrediscriminants from RecoTauTag.RecoTau.PATTauDiscriminantCutMultiplexer_cfi import * +import RecoTauTag.RecoTau.patTauDiscriminationByMVAIsolationRun2_cfi as _mod # make sure to load the database containing the mva inputs before using the producers below # e.g. process.load('RecoTauTag.Configuration.loadRecoTauTagMVAsFromPrepDB_cfi') as in # RecoTauTag.Configuration.HPSPFTaus_cff -patDiscriminationByIsolationMVArun2v1raw = cms.EDProducer("PATTauDiscriminationByMVAIsolationRun2", - +patDiscriminationByIsolationMVArun2v1raw = _mod.patTauDiscriminationByMVAIsolationRun2.clone( # tau collection to discriminate - PATTauProducer = cms.InputTag('replaceMeByTauCollectionToBeUsed'), # in MiniAOD: slimmedTaus + PATTauProducer = 'replaceMeByTauCollectionToBeUsed', # in MiniAOD: slimmedTaus Prediscriminants = noPrediscriminants, - loadMVAfromDB = cms.bool(True), - inputFileName = cms.FileInPath("RecoTauTag/RecoTau/data/emptyMVAinputFile"), # the filename for MVA if it is not loaded from DB - mvaName = cms.string("replaceMeByNameOfMVATraining"), # e.g. RecoTauTag_tauIdMVADBoldDMwLTv1 - mvaOpt = cms.string("replaceMeByMVAOption"), # e.g. DBoldDMwLT - + loadMVAfromDB = True, + inputFileName = "RecoTauTag/RecoTau/data/emptyMVAinputFile", # the filename for MVA if it is not loaded from DB + mvaName = "replaceMeByNameOfMVATraining", # e.g. RecoTauTag_tauIdMVADBoldDMwLTv1 + mvaOpt = "replaceMeByMVAOption", # e.g. DBoldDMwLT # change these only if input isolation sums changed for the MVA training you want to use - srcChargedIsoPtSum = cms.string('chargedIsoPtSum'), - srcNeutralIsoPtSum = cms.string('neutralIsoPtSum'), - srcPUcorrPtSum = cms.string('puCorrPtSum'), - srcPhotonPtSumOutsideSignalCone = cms.string('photonPtSumOutsideSignalCone'), - srcFootprintCorrection = cms.string('footprintCorrection'), - - verbosity = cms.int32(0) + srcChargedIsoPtSum = 'chargedIsoPtSum', + srcNeutralIsoPtSum = 'neutralIsoPtSum', + srcPUcorrPtSum = 'puCorrPtSum', + srcPhotonPtSumOutsideSignalCone = 'photonPtSumOutsideSignalCone', + srcFootprintCorrection = 'footprintCorrection', ) patDiscriminationByIsolationMVArun2v1 = patTauDiscriminantCutMultiplexer.clone( diff --git a/RecoTauTag/RecoTau/python/PFRecoTauDiscriminationAgainstElectronMVA6Phase2_cff.py b/RecoTauTag/RecoTau/python/PFRecoTauDiscriminationAgainstElectronMVA6Phase2_cff.py index 2f3db755b3eb7..ae071ad801c6e 100644 --- a/RecoTauTag/RecoTau/python/PFRecoTauDiscriminationAgainstElectronMVA6Phase2_cff.py +++ b/RecoTauTag/RecoTau/python/PFRecoTauDiscriminationAgainstElectronMVA6Phase2_cff.py @@ -1,18 +1,18 @@ import FWCore.ParameterSet.Config as cms # HGCal electron stuff -from RecoEgamma.EgammaTools.cleanedEcalDrivenGsfElectronsFromMultiCl_cfi import cleanedEcalDrivenGsfElectronsFromMultiCl +from RecoEgamma.EgammaTools.cleanedEcalDrivenGsfElectronsHGC_cfi import cleanedEcalDrivenGsfElectronsHGC from RecoEgamma.EgammaTools.hgcalElectronIDValueMap_cff import hgcalElectronIDValueMap # HGCal electrons cleaned against duplicates and electrons in barrel (pt>10GeV) # TauValElectronSelector defined Validation/RecoTau/plugins/Selectors.cc; # is there a more intuitive place where such a selector is defined? -cleanedEcalDrivenGsfElectronsFromMultiClNoEB = cms.EDFilter('TauValElectronSelector', +cleanedEcalDrivenGsfElectronsHGCnoEB = cms.EDFilter('TauValElectronSelector', cut = cms.string('!isEB && pt >= 10.'), - src = cms.InputTag('cleanedEcalDrivenGsfElectronsFromMultiCl') + src = cms.InputTag('cleanedEcalDrivenGsfElectronsHGC') ) # Electron collection merger mergedGsfElectronsForTauId = cms.EDProducer('GsfElectronCollectionMerger', - src = cms.VInputTag('gedGsfElectrons', 'cleanedEcalDrivenGsfElectronsFromMultiClNoEB') + src = cms.VInputTag('gedGsfElectrons', 'cleanedEcalDrivenGsfElectronsHGCnoEB') ) # HGCal EleID with merged electron collection hgcElectronIdForTauId = hgcalElectronIDValueMap.clone( @@ -40,8 +40,8 @@ ) electronsForTauDiscriminationAgainstElectronMVA6Phase2Task = cms.Task( - cleanedEcalDrivenGsfElectronsFromMultiCl, - cleanedEcalDrivenGsfElectronsFromMultiClNoEB, + cleanedEcalDrivenGsfElectronsHGC, + cleanedEcalDrivenGsfElectronsHGCnoEB, mergedGsfElectronsForTauId, hgcElectronIdForTauId ) diff --git a/RecoTauTag/RecoTau/python/PFRecoTauDiscriminationByMVAIsolation2_cff.py b/RecoTauTag/RecoTau/python/PFRecoTauDiscriminationByMVAIsolation2_cff.py index 6c44709cd0532..8a3ccf9f6148d 100644 --- a/RecoTauTag/RecoTau/python/PFRecoTauDiscriminationByMVAIsolation2_cff.py +++ b/RecoTauTag/RecoTau/python/PFRecoTauDiscriminationByMVAIsolation2_cff.py @@ -2,30 +2,28 @@ from RecoTauTag.RecoTau.recoTauDiscriminantCutMultiplexerDefault_cfi import recoTauDiscriminantCutMultiplexerDefault from RecoTauTag.Configuration.HPSPFTaus_cff import hpsPFTauBasicDiscriminators +import RecoTauTag.RecoTau.pfRecoTauDiscriminationByIsolationMVA2_cfi as _mod -discriminationByIsolationMVA2raw = cms.EDProducer("PFRecoTauDiscriminationByIsolationMVA2", - +discriminationByIsolationMVA2raw = _mod.pfRecoTauDiscriminationByIsolationMVA2.clone( # tau collection to discriminate - PFTauProducer = cms.InputTag('pfTauProducer'), + PFTauProducer = 'pfTauProducer', # Require leading pion ensures that: # 1) these is at least one track above threshold (0.5 GeV) in the signal cone # 2) a track OR a pi-zero in the signal cone has pT > 5 GeV Prediscriminants = requireLeadTrack, - loadMVAfromDB = cms.bool(True), - inputFileName = cms.FileInPath("RecoTauTag/RecoTau/data/emptyMVAinputFile"), # the filename for MVA if it is not loaded from DB - mvaName = cms.string("tauIdMVAnewDMwLT"), - mvaOpt = cms.string("newDMwLT"), + loadMVAfromDB = True, + inputFileName = "RecoTauTag/RecoTau/data/emptyMVAinputFile", # the filename for MVA if it is not loaded from DB + mvaName = "tauIdMVAnewDMwLT", + mvaOpt = "newDMwLT", # NOTE: tau lifetime reconstruction sequence needs to be run before - srcTauTransverseImpactParameters = cms.InputTag(''), + srcTauTransverseImpactParameters = '', - srcBasicTauDiscriminators = cms.InputTag('hpsPFTauBasicDiscriminators'), - srcChargedIsoPtSumIndex = cms.int32(0), - srcNeutralIsoPtSumIndex = cms.int32(1), - srcPUcorrPtSumIndex = cms.int32(5), - - verbosity = cms.int32(0) + srcBasicTauDiscriminators = 'hpsPFTauBasicDiscriminators', + srcChargedIsoPtSumIndex = 0, + srcNeutralIsoPtSumIndex = 1, + srcPUcorrPtSumIndex = 5, ) discriminationByIsolationMVA2 = recoTauDiscriminantCutMultiplexerDefault.clone( diff --git a/RecoTauTag/RecoTau/python/PFRecoTauTagInfoProducer_cfi.py b/RecoTauTag/RecoTau/python/PFRecoTauTagInfoProducer_cfi.py index a143929dc676f..de687942ea62f 100644 --- a/RecoTauTag/RecoTau/python/PFRecoTauTagInfoProducer_cfi.py +++ b/RecoTauTag/RecoTau/python/PFRecoTauTagInfoProducer_cfi.py @@ -1,46 +1,41 @@ import FWCore.ParameterSet.Config as cms -import copy from RecoTauTag.RecoTau.PFRecoTauQualityCuts_cfi import PFTauQualityCuts +import RecoTauTag.RecoTau.pfRecoTauTagInfoProducer_cfi as _mod -pfRecoTauTagInfoProducer = cms.EDProducer("PFRecoTauTagInfoProducer", - +pfRecoTauTagInfoProducer = _mod.pfRecoTauTagInfoProducer.clone( # These values set the minimum pt quality requirements - # for the various constituent types - ChargedHadrCand_tkminPt = cms.double(0.5), # charged PF objects - tkminPt = cms.double(0.5), # track (non-PF) objects - NeutrHadrCand_HcalclusMinEt = cms.double(1.0), # PF neutral hadrons (HCAL) - GammaCand_EcalclusMinEt = cms.double(1.0), # PF gamma candidates (ECAL) + # for the various constituent types + ChargedHadrCand_tkminPt = 0.5, # charged PF objects + tkminPt = 0.5, # track (non-PF) objects + NeutrHadrCand_HcalclusMinEt = 1.0, # PF neutral hadrons (HCAL) + GammaCand_EcalclusMinEt = 1.0, # PF gamma candidates (ECAL) # The size of the delta R cone used to collect objects from the jet - ChargedHadrCand_AssociationCone = cms.double(0.8), - - PVProducer = PFTauQualityCuts.primaryVertexSrc, - UsePVconstraint = cms.bool(True), - PFCandidateProducer = cms.InputTag('particleFlow'), - PFJetTracksAssociatorProducer = cms.InputTag('ak4PFJetTracksAssociatorAtVertex'), + ChargedHadrCand_AssociationCone = 0.8, + PVProducer = PFTauQualityCuts.primaryVertexSrc, # Quality cuts for tracks (non-PF, from JetTracksAssociator) - tkminTrackerHitsn = cms.int32(3), - tkmaxChi2 = cms.double(100.0), - tkPVmaxDZ = cms.double(0.2), ##considered if UsePVconstraint is true - tkminPixelHitsn = cms.int32(0), - tkmaxipt = cms.double(0.03), + tkminTrackerHitsn = 3, + tkmaxChi2 = 100.0, + tkPVmaxDZ = 0.2, ##considered if UsePVconstraint is true + tkminPixelHitsn = 0, + tkmaxipt = 0.03, # Quality cuts for PFCharged Hadron candidates (taken from their underlying recTrack) - ChargedHadrCand_tkminTrackerHitsn = cms.int32(3), - ChargedHadrCand_tkmaxChi2 = cms.double(100.0), - ChargedHadrCand_tkmaxipt = cms.double(0.03), - ChargedHadrCand_tkminPixelHitsn = cms.int32(0), - ChargedHadrCand_tkPVmaxDZ = cms.double(0.2), ##considered if UsePVconstraint is true + ChargedHadrCand_tkminTrackerHitsn = 3, + ChargedHadrCand_tkmaxChi2 = 100.0, + ChargedHadrCand_tkmaxipt = 0.03, + ChargedHadrCand_tkminPixelHitsn = 0, + ChargedHadrCand_tkPVmaxDZ = 0.2, ##considered if UsePVconstraint is true # Smear vertex - smearedPVsigmaY = cms.double(0.0015), - smearedPVsigmaX = cms.double(0.0015), - smearedPVsigmaZ = cms.double(0.005), + smearedPVsigmaY = 0.0015, + smearedPVsigmaX = 0.0015, + smearedPVsigmaZ = 0.005, ) # PF TauTag info seeded from the Inside-Out jet producer -pfRecoTauTagInfoProducerInsideOut = copy.deepcopy(pfRecoTauTagInfoProducer) -pfRecoTauTagInfoProducerInsideOut.PFJetTracksAssociatorProducer = cms.InputTag('insideOutJetTracksAssociatorAtVertex') -pfRecoTauTagInfoProducerInsideOut.ChargedHadrCand_AssociationCone = cms.double(1.0) - +pfRecoTauTagInfoProducerInsideOut = pfRecoTauTagInfoProducer.clone( + PFJetTracksAssociatorProducer = 'insideOutJetTracksAssociatorAtVertex', + ChargedHadrCand_AssociationCone = 1.0 +) diff --git a/RecoTauTag/RecoTau/python/PFTauPrimaryVertexProducer_cfi.py b/RecoTauTag/RecoTau/python/PFTauPrimaryVertexProducer_cfi.py index 7ce2bf83b2579..31641f51c362f 100644 --- a/RecoTauTag/RecoTau/python/PFTauPrimaryVertexProducer_cfi.py +++ b/RecoTauTag/RecoTau/python/PFTauPrimaryVertexProducer_cfi.py @@ -1,20 +1,14 @@ import FWCore.ParameterSet.Config as cms from RecoTauTag.RecoTau.PFRecoTauQualityCuts_cfi import PFTauQualityCuts -PFTauPrimaryVertexProducer = cms.EDProducer("PFTauPrimaryVertexProducer", - PFTauTag = cms.InputTag("hpsPFTauProducer"), - ElectronTag = cms.InputTag("MyElectrons"), - MuonTag = cms.InputTag("MyMuons"), - PVTag = cms.InputTag("offlinePrimaryVertices"), - beamSpot = cms.InputTag("offlineBeamSpot"), - #Algorithm: 0 - use tau-jet vertex, 1 - use vertex[0] - Algorithm = cms.int32(0), - qualityCuts = PFTauQualityCuts, - useBeamSpot = cms.bool(True), - RemoveMuonTracks = cms.bool(False), - RemoveElectronTracks = cms.bool(False), - useSelectedTaus = cms.bool(False), - discriminators = cms.VPSet(cms.PSet(discriminator = cms.InputTag('hpsPFTauDiscriminationByDecayModeFinding'), - selectionCut = cms.double(0.5))), - cut = cms.string("pt > 18.0 & abs(eta)<2.3") - ) +import RecoTauTag.RecoTau.pfTauPrimaryVertexProducer_cfi as _mod +PFTauPrimaryVertexProducer = _mod.pfTauPrimaryVertexProducer.clone( + #Algorithm: 0 - use tau-jet vertex, 1 - use vertex[0] + qualityCuts = PFTauQualityCuts, + discriminators = cms.VPSet( + cms.PSet( + discriminator = cms.InputTag('hpsPFTauDiscriminationByDecayModeFinding'), + selectionCut = cms.double(0.5) + ) + ), +) diff --git a/RecoTauTag/RecoTau/src/PFTauPrimaryVertexProducerBase.cc b/RecoTauTag/RecoTau/src/PFTauPrimaryVertexProducerBase.cc index 692ee0c6fd661..4f51e3c5a0662 100644 --- a/RecoTauTag/RecoTau/src/PFTauPrimaryVertexProducerBase.cc +++ b/RecoTauTag/RecoTau/src/PFTauPrimaryVertexProducerBase.cc @@ -1,11 +1,8 @@ #include "RecoTauTag/RecoTau/interface/PFTauPrimaryVertexProducerBase.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/Exception.h" -#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" -#include "TrackingTools/Records/interface/TransientTrackRecord.h" #include "RecoVertex/VertexPrimitives/interface/TransientVertex.h" #include "RecoVertex/AdaptiveVertexFit/interface/AdaptiveVertexFitter.h" @@ -23,6 +20,7 @@ PFTauPrimaryVertexProducerBase::PFTauPrimaryVertexProducerBase(const edm::Parame muonToken_(consumes>(iConfig.getParameter("MuonTag"))), pvToken_(consumes(iConfig.getParameter("PVTag"))), beamSpotToken_(consumes(iConfig.getParameter("beamSpot"))), + transTrackBuilderToken_(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))), algorithm_(iConfig.getParameter("Algorithm")), qualityCutsPSet_(iConfig.getParameter("qualityCuts")), useBeamSpot_(iConfig.getParameter("useBeamSpot")), @@ -79,8 +77,7 @@ void PFTauPrimaryVertexProducerBase::produce(edm::Event& iEvent, const edm::Even beginEvent(iEvent, iSetup); // Obtain Collections - edm::ESHandle transTrackBuilder; - iSetup.get().get("TransientTrackBuilder", transTrackBuilder); + auto const& transTrackBuilder = iSetup.getData(transTrackBuilderToken_); edm::Handle> pfTaus; iEvent.getByToken(pftauToken_, pfTaus); @@ -193,7 +190,7 @@ void PFTauPrimaryVertexProducerBase::produce(edm::Event& iEvent, const edm::Even std::vector transTracks; transTracks.reserve(nonTauTracks.size()); for (const auto track : nonTauTracks) { - transTracks.push_back(transTrackBuilder->build(*track)); + transTracks.push_back(transTrackBuilder.build(*track)); } bool fitOK(true); if (transTracks.size() >= 2) { diff --git a/RecoTauTag/RecoTau/test/rerunTauRecoOnMiniAOD.py b/RecoTauTag/RecoTau/test/rerunTauRecoOnMiniAOD.py index eb75eb61aa3a9..70458aeea2662 100644 --- a/RecoTauTag/RecoTau/test/rerunTauRecoOnMiniAOD.py +++ b/RecoTauTag/RecoTau/test/rerunTauRecoOnMiniAOD.py @@ -13,9 +13,16 @@ maxEvents = 100 # maxEvents = -1 +# Set 'runBoosted' true to run boosted tau reconstuction +runBoosted = False + +# Add postfix to production sequences and modules; +# In case of boosted tau recostuction actual postfix is 'Boosted'+postfix +postfix = '' # If 'reclusterJets' set true a new collection of uncorrected ak4PFJets is # built to seed taus (as at RECO), otherwise standard slimmedJets are used +# Irrelavant in case of boosted tau reco reclusterJets = True # reclusterJets = False @@ -33,8 +40,11 @@ print('Running Tau reco&id with MiniAOD inputs:') print('\t Run type:', runType) print('\t Recluster jets:', reclusterJets) +print('\t Boosted tau reco:', runBoosted) print('\t Use Phase2 settings:', phase2) print('\t Output mode:', outMode) +if not postfix=="": + print('\t Postfix:', postfix) ##### from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 @@ -80,10 +90,11 @@ exit(1) ##### -import RecoTauTag.Configuration.tools.adaptToRunAtMiniAOD as tauAtMiniTools +from RecoTauTag.Configuration.tools.adaptToRunAtMiniAOD import adaptToRunAtMiniAOD ##### -tauAtMiniTools.addTauReReco(process) +tauAtMiniTools = adaptToRunAtMiniAOD(process,runBoosted,postfix=postfix) +tauAtMiniTools.addTauReReco() ##### process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') @@ -115,11 +126,14 @@ process.out = cms.EndPath(process.output) ##### -tauAtMiniTools.adaptTauToMiniAODReReco(process, reclusterJets) +tauAtMiniTools.adaptTauToMiniAODReReco(reclusterJets) +process.p = cms.Path( + getattr(process,("miniAODTausSequence"+postfix if not runBoosted else "miniAODTausSequenceBoosted"+postfix)) +) if runType == 'data': from PhysicsTools.PatAlgos.tools.coreTools import runOnData - runOnData(process, names = ['Taus'], outputModules = []) + runOnData(process, names = ['Taus'], outputModules = [], postfix = (postfix if not runBoosted else 'Boosted'+postfix)) ##### process.load('FWCore.MessageService.MessageLogger_cfi') diff --git a/RecoTracker/ConversionSeedGenerators/plugins/HitPairGeneratorFromLayerPairForPhotonConversion.cc b/RecoTracker/ConversionSeedGenerators/plugins/HitPairGeneratorFromLayerPairForPhotonConversion.cc index 9f73566d25275..963e4d69e7b23 100644 --- a/RecoTracker/ConversionSeedGenerators/plugins/HitPairGeneratorFromLayerPairForPhotonConversion.cc +++ b/RecoTracker/ConversionSeedGenerators/plugins/HitPairGeneratorFromLayerPairForPhotonConversion.cc @@ -9,7 +9,6 @@ #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegionBase.h" #include "RecoTracker/TkHitPairs/interface/OrderedHitPairs.h" -#include "RecoTracker/TkHitPairs/src/InnerDeltaPhi.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" diff --git a/RecoTracker/ConversionSeedGenerators/plugins/HitQuadrupletGeneratorFromLayerPairForPhotonConversion.cc b/RecoTracker/ConversionSeedGenerators/plugins/HitQuadrupletGeneratorFromLayerPairForPhotonConversion.cc index ccd4ed85dca68..d81105435826b 100644 --- a/RecoTracker/ConversionSeedGenerators/plugins/HitQuadrupletGeneratorFromLayerPairForPhotonConversion.cc +++ b/RecoTracker/ConversionSeedGenerators/plugins/HitQuadrupletGeneratorFromLayerPairForPhotonConversion.cc @@ -9,7 +9,6 @@ #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegionBase.h" #include "RecoTracker/TkHitPairs/interface/OrderedHitPairs.h" -#include "RecoTracker/TkHitPairs/src/InnerDeltaPhi.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" diff --git a/RecoTracker/ConversionSeedGenerators/plugins/PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h b/RecoTracker/ConversionSeedGenerators/plugins/PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h index 9c43742b2c637..829740d1b77e1 100644 --- a/RecoTracker/ConversionSeedGenerators/plugins/PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h +++ b/RecoTracker/ConversionSeedGenerators/plugins/PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h @@ -21,7 +21,7 @@ #include "CombinedHitQuadrupletGeneratorForPhotonConversion.h" #include "RecoTracker/SpecialSeedGenerators/interface/ClusterChecker.h" -#include "RecoTracker/TkTrackingRegions/plugins/GlobalTrackingRegionProducerFromBeamSpot.h" +#include "RecoTracker/TkTrackingRegions/interface/GlobalTrackingRegionProducerFromBeamSpot.h" #include diff --git a/RecoTracker/ConversionSeedGenerators/plugins/PhotonConversionTrajectorySeedProducerFromSingleLegAlgo.h b/RecoTracker/ConversionSeedGenerators/plugins/PhotonConversionTrajectorySeedProducerFromSingleLegAlgo.h index c7dc50f2d5594..9a3c136bbae8a 100644 --- a/RecoTracker/ConversionSeedGenerators/plugins/PhotonConversionTrajectorySeedProducerFromSingleLegAlgo.h +++ b/RecoTracker/ConversionSeedGenerators/plugins/PhotonConversionTrajectorySeedProducerFromSingleLegAlgo.h @@ -23,7 +23,7 @@ #include "CombinedHitPairGeneratorForPhotonConversion.h" #include "RecoTracker/TkSeedGenerator/interface/ClusterChecker.h" -#include "RecoTracker/TkTrackingRegions/plugins/GlobalTrackingRegionProducerFromBeamSpot.h" +#include "RecoTracker/TkTrackingRegions/interface/GlobalTrackingRegionProducerFromBeamSpot.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include diff --git a/RecoTracker/FinalTrackSelectors/plugins/getBestVertex.h b/RecoTracker/FinalTrackSelectors/interface/getBestVertex.h similarity index 100% rename from RecoTracker/FinalTrackSelectors/plugins/getBestVertex.h rename to RecoTracker/FinalTrackSelectors/interface/getBestVertex.h diff --git a/RecoTracker/FinalTrackSelectors/plugins/DefaultTrackMVAClassifier.cc b/RecoTracker/FinalTrackSelectors/plugins/DefaultTrackMVAClassifier.cc index 34fe0392cccff..2b92bfe3c5a92 100644 --- a/RecoTracker/FinalTrackSelectors/plugins/DefaultTrackMVAClassifier.cc +++ b/RecoTracker/FinalTrackSelectors/plugins/DefaultTrackMVAClassifier.cc @@ -6,9 +6,9 @@ #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/VertexReco/interface/Vertex.h" -#include +#include "RecoTracker/FinalTrackSelectors/interface/getBestVertex.h" -#include "getBestVertex.h" +#include #include "TFile.h" diff --git a/RecoTracker/FinalTrackSelectors/plugins/TrackCutClassifier.cc b/RecoTracker/FinalTrackSelectors/plugins/TrackCutClassifier.cc index 0fdd3b0f2301b..1534189063740 100644 --- a/RecoTracker/FinalTrackSelectors/plugins/TrackCutClassifier.cc +++ b/RecoTracker/FinalTrackSelectors/plugins/TrackCutClassifier.cc @@ -4,9 +4,10 @@ #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h" +#include "RecoTracker/FinalTrackSelectors/interface/getBestVertex.h" + #include -#include "getBestVertex.h" #include "powN.h" namespace { diff --git a/RecoTracker/FinalTrackSelectors/plugins/TrackLwtnnClassifier.cc b/RecoTracker/FinalTrackSelectors/plugins/TrackLwtnnClassifier.cc index 5703a0e538992..0f42e22d4d775 100644 --- a/RecoTracker/FinalTrackSelectors/plugins/TrackLwtnnClassifier.cc +++ b/RecoTracker/FinalTrackSelectors/plugins/TrackLwtnnClassifier.cc @@ -6,7 +6,7 @@ #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/VertexReco/interface/Vertex.h" -#include "getBestVertex.h" +#include "RecoTracker/FinalTrackSelectors/interface/getBestVertex.h" //from lwtnn #include "TrackingTools/Records/interface/TrackingComponentsRecord.h" diff --git a/RecoTracker/FinalTrackSelectors/plugins/TrackTfClassifier.cc b/RecoTracker/FinalTrackSelectors/plugins/TrackTfClassifier.cc index 9052194f5b606..156410b04c892 100644 --- a/RecoTracker/FinalTrackSelectors/plugins/TrackTfClassifier.cc +++ b/RecoTracker/FinalTrackSelectors/plugins/TrackTfClassifier.cc @@ -5,7 +5,7 @@ #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/VertexReco/interface/Vertex.h" #include "FWCore/Framework/interface/ConsumesCollector.h" -#include "getBestVertex.h" +#include "RecoTracker/FinalTrackSelectors/interface/getBestVertex.h" #include "TrackingTools/Records/interface/TfGraphRecord.h" #include "PhysicsTools/TensorFlow/interface/TensorFlow.h" diff --git a/RecoTracker/MeasurementDet/plugins/MeasurementTrackerEventProducer.cc b/RecoTracker/MeasurementDet/plugins/MeasurementTrackerEventProducer.cc index 29b49c425832d..beb24602db116 100644 --- a/RecoTracker/MeasurementDet/plugins/MeasurementTrackerEventProducer.cc +++ b/RecoTracker/MeasurementDet/plugins/MeasurementTrackerEventProducer.cc @@ -1,13 +1,10 @@ #include "MeasurementTrackerEventProducer.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" -#include "RecoTracker/MeasurementDet/interface/MeasurementTracker.h" #include "RecoTracker/MeasurementDet/interface/MeasurementTrackerEvent.h" -#include "RecoTracker/Record/interface/CkfComponentsRecord.h" #include "CondFormats/SiPixelObjects/interface/CablingPathToDetUnit.h" #include "CondFormats/SiPixelObjects/interface/PixelROC.h" #include "CondFormats/SiPixelObjects/interface/LocalPixel.h" @@ -15,7 +12,8 @@ #include MeasurementTrackerEventProducer::MeasurementTrackerEventProducer(const edm::ParameterSet& iConfig) - : measurementTrackerLabel_(iConfig.getParameter("measurementTracker")), + : measurementTrackerToken_( + esConsumes(edm::ESInputTag("", iConfig.getParameter("measurementTracker")))), switchOffPixelsIfEmpty_(iConfig.getParameter("switchOffPixelsIfEmpty")) { std::vector inactivePixelDetectorTags( iConfig.getParameter>("inactivePixelDetectorLabels")); @@ -27,7 +25,7 @@ MeasurementTrackerEventProducer::MeasurementTrackerEventProducer(const edm::Para if (!badPixelFEDChannelCollectionTags.empty()) { for (auto& t : badPixelFEDChannelCollectionTags) theBadPixelFEDChannelsLabels.push_back(consumes(t)); - pixelCablingMapLabel_ = iConfig.getParameter("pixelCablingMapLabel"); + pixelCablingMapToken_ = esConsumes(edm::ESInputTag("", iConfig.getParameter("pixelCablingMapLabel"))); } std::vector inactiveStripDetectorTags( @@ -100,13 +98,12 @@ void MeasurementTrackerEventProducer::fillDescriptions(edm::ConfigurationDescrip } void MeasurementTrackerEventProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { - edm::ESHandle measurementTracker; - iSetup.get().get(measurementTrackerLabel_, measurementTracker); + auto const& measurementTracker = iSetup.getData(measurementTrackerToken_); // create new data structures from templates - auto stripData = std::make_unique(measurementTracker->stripDetConditions()); - auto pixelData = std::make_unique(measurementTracker->pixelDetConditions()); - auto phase2OTData = std::make_unique(measurementTracker->phase2DetConditions()); + auto stripData = std::make_unique(measurementTracker.stripDetConditions()); + auto pixelData = std::make_unique(measurementTracker.pixelDetConditions()); + auto phase2OTData = std::make_unique(measurementTracker.phase2DetConditions()); std::vector stripClustersToSkip; std::vector pixelClustersToSkip; @@ -116,7 +113,7 @@ void MeasurementTrackerEventProducer::produce(edm::Event& iEvent, const edm::Eve updatePixels(iEvent, *pixelData, pixelClustersToSkip, - dynamic_cast(*(measurementTracker->geomTracker())), + dynamic_cast(*(measurementTracker.geomTracker())), iSetup); updatePhase2OT(iEvent, *phase2OTData); updateStacks(iEvent, *phase2OTData); @@ -127,7 +124,7 @@ void MeasurementTrackerEventProducer::produce(edm::Event& iEvent, const edm::Eve const VectorHitCollection* phase2OTVectorHits = useVectorHits_ ? &iEvent.get(thePh2OTVectorHitsLabel) : nullptr; const VectorHitCollection* phase2OTVectorHitsRej = useVectorHits_ ? &iEvent.get(thePh2OTVectorHitsRejLabel) : nullptr; - iEvent.put(std::make_unique(*measurementTracker, + iEvent.put(std::make_unique(measurementTracker, stripData.release(), pixelData.release(), phase2OTData.release(), @@ -177,8 +174,7 @@ void MeasurementTrackerEventProducer::updatePixels(const edm::Event& event, } if (!theBadPixelFEDChannelsLabels.empty()) { - edm::ESHandle cablingMap; - iSetup.get().get(pixelCablingMapLabel_, cablingMap); + auto const& cablingMap = iSetup.getData(pixelCablingMapToken_); edm::Handle pixelFEDChannelCollectionHandle; for (const edm::EDGetTokenT& tk : theBadPixelFEDChannelsLabels) { @@ -194,7 +190,7 @@ void MeasurementTrackerEventProducer::updatePixels(const edm::Event& event, // however the cabling map uses a numbering [1,numberOfROCs], see sipixelobjects::PixelFEDLink::roc(unsigned int id), not necessarily sorted in the same direction. // PixelFEDChannelCollection MUST be filled such that ch.roc_first (ch.roc_last) correspond to the lowest (highest) 'idInDetUnit' in the channel for (path.roc = 1; path.roc <= (ch.roc_last - ch.roc_first) + 1; path.roc++) { - const sipixelobjects::PixelROC* roc = cablingMap->findItem(path); + const sipixelobjects::PixelROC* roc = cablingMap.findItem(path); if (roc == nullptr) continue; assert(roc->rawId() == disabledChannels.detId()); diff --git a/RecoTracker/MeasurementDet/plugins/MeasurementTrackerEventProducer.h b/RecoTracker/MeasurementDet/plugins/MeasurementTrackerEventProducer.h index 53ee67905c456..b96ba0fbb2fca 100644 --- a/RecoTracker/MeasurementDet/plugins/MeasurementTrackerEventProducer.h +++ b/RecoTracker/MeasurementDet/plugins/MeasurementTrackerEventProducer.h @@ -13,6 +13,8 @@ #include "DataFormats/SiPixelDetId/interface/PixelFEDChannel.h" #include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" #include "DataFormats/TrackerRecHit2D/interface/VectorHit.h" +#include "RecoTracker/MeasurementDet/interface/MeasurementTracker.h" +#include "RecoTracker/Record/interface/CkfComponentsRecord.h" class dso_hidden MeasurementTrackerEventProducer final : public edm::stream::EDProducer<> { public: @@ -37,7 +39,7 @@ class dso_hidden MeasurementTrackerEventProducer final : public edm::stream::EDP void getInactiveStrips(const edm::Event& event, std::vector& rawInactiveDetIds) const; - std::string measurementTrackerLabel_; + edm::ESGetToken measurementTrackerToken_; edm::EDGetTokenT> thePixelClusterLabel; edm::EDGetTokenT> theStripClusterLabel; edm::EDGetTokenT> thePh2OTClusterLabel; @@ -48,7 +50,7 @@ class dso_hidden MeasurementTrackerEventProducer final : public edm::stream::EDP std::vector> theInactivePixelDetectorLabels; std::vector> theBadPixelFEDChannelsLabels; - std::string pixelCablingMapLabel_; + edm::ESGetToken pixelCablingMapToken_; std::vector> theInactiveStripDetectorLabels; bool selfUpdateSkipClusters_; diff --git a/RecoTracker/MkFit/python/customizeHLTIter0ToMkFit.py b/RecoTracker/MkFit/python/customizeHLTIter0ToMkFit.py index 01b59acd67816..520a7722db3a3 100644 --- a/RecoTracker/MkFit/python/customizeHLTIter0ToMkFit.py +++ b/RecoTracker/MkFit/python/customizeHLTIter0ToMkFit.py @@ -68,12 +68,16 @@ def customizeHLTIter0ToMkFit(process): ) process.HLTDoLocalStripSequence += process.hltSiStripRecHits - process.HLTIterativeTrackingIteration0.replace(process.hltIter0PFlowCkfTrackCandidates, - process.hltIter0PFlowCkfTrackCandidatesMkFitSiPixelHits + - process.hltIter0PFlowCkfTrackCandidatesMkFitSiStripHits + - process.hltIter0PFlowCkfTrackCandidatesMkFitEventOfHits + - process.hltIter0PFlowCkfTrackCandidatesMkFitSeeds + - process.hltIter0PFlowCkfTrackCandidatesMkFit + - process.hltIter0PFlowCkfTrackCandidates) + + replaceWith = (process.hltIter0PFlowCkfTrackCandidatesMkFitSiPixelHits + + process.hltIter0PFlowCkfTrackCandidatesMkFitSiStripHits + + process.hltIter0PFlowCkfTrackCandidatesMkFitEventOfHits + + process.hltIter0PFlowCkfTrackCandidatesMkFitSeeds + + process.hltIter0PFlowCkfTrackCandidatesMkFit + + process.hltIter0PFlowCkfTrackCandidates) + + process.HLTIterativeTrackingIteration0.replace(process.hltIter0PFlowCkfTrackCandidates, replaceWith) + process.HLT_IsoTrackHB_v4.replace(process.hltIter0PFlowCkfTrackCandidates, replaceWith) + process.HLT_IsoTrackHE_v4.replace(process.hltIter0PFlowCkfTrackCandidates, replaceWith) return process diff --git a/RecoTracker/SingleTrackPattern/interface/CRackTrajectoryBuilder.h b/RecoTracker/SingleTrackPattern/interface/CRackTrajectoryBuilder.h index 9f565d5c1684c..40df6ce4fc248 100644 --- a/RecoTracker/SingleTrackPattern/interface/CRackTrajectoryBuilder.h +++ b/RecoTracker/SingleTrackPattern/interface/CRackTrajectoryBuilder.h @@ -10,6 +10,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h" #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h" @@ -27,6 +28,7 @@ #include "RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h" #include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h" #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h" +#include "TrackingTools/Records/interface/TransientRecHitRecord.h" #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/TrackReco/interface/TrackExtra.h" #include "TrackingTools/TrackFitters/interface/KFTrajectoryFitter.h" @@ -35,8 +37,6 @@ #include "RecoTracker/MeasurementDet/interface/MeasurementTracker.h" #include "TrackingTools/MaterialEffects/interface/PropagatorWithMaterial.h" -#include "FWCore/Framework/interface/ESHandle.h" - //to sort hits by the det position class CompareDetY_plus { public: @@ -172,7 +172,7 @@ class CRackTrajectoryBuilder { }; public: - CRackTrajectoryBuilder(const edm::ParameterSet& conf); + CRackTrajectoryBuilder(const edm::ParameterSet& conf, edm::ConsumesCollector iC); ~CRackTrajectoryBuilder(); /// Runs the algorithm @@ -215,8 +215,11 @@ class CRackTrajectoryBuilder { std::pair innerState(const Trajectory& traj) const; private: - edm::ESHandle magfield; - edm::ESHandle tracker; + const edm::ESGetToken magfieldToken_; + const edm::ESGetToken trackerToken_; + const edm::ESGetToken builderToken_; + const MagneticField* magfield; + const TrackerGeometry* tracker; PropagatorWithMaterial* thePropagator; PropagatorWithMaterial* thePropagatorOp; @@ -242,7 +245,6 @@ class CRackTrajectoryBuilder { TransientTrackingRecHit::RecHitContainer hits; bool seed_plus; std::string geometry; - std::string theBuilderName; // TransientInitialStateEstimator* theInitialState; }; diff --git a/RecoTracker/SingleTrackPattern/interface/CosmicTrajectoryBuilder.h b/RecoTracker/SingleTrackPattern/interface/CosmicTrajectoryBuilder.h index ca137e72ae73b..16239efae2e79 100644 --- a/RecoTracker/SingleTrackPattern/interface/CosmicTrajectoryBuilder.h +++ b/RecoTracker/SingleTrackPattern/interface/CosmicTrajectoryBuilder.h @@ -10,6 +10,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h" #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h" @@ -28,6 +29,7 @@ #include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h" #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h" #include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h" +#include "TrackingTools/Records/interface/TransientRecHitRecord.h" #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/TrackReco/interface/TrackExtra.h" #include "TrackingTools/TrackFitters/interface/KFTrajectoryFitter.h" @@ -36,8 +38,6 @@ #include "RecoTracker/MeasurementDet/interface/MeasurementTracker.h" #include "TrackingTools/MaterialEffects/interface/PropagatorWithMaterial.h" -#include "FWCore/Framework/interface/ESHandle.h" - #ifndef TrajectoryBuilder_CompareHitY #define TrajectoryBuilder_CompareHitY @@ -76,7 +76,7 @@ class CosmicTrajectoryBuilder { typedef TrajectoryMeasurement TM; public: - CosmicTrajectoryBuilder(const edm::ParameterSet &conf); + CosmicTrajectoryBuilder(const edm::ParameterSet &conf, edm::ConsumesCollector iC); ~CosmicTrajectoryBuilder(); /// Runs the algorithm @@ -112,8 +112,11 @@ class CosmicTrajectoryBuilder { bool qualityFilter(const Trajectory &traj); private: - edm::ESHandle magfield; - edm::ESHandle tracker; + const edm::ESGetToken magfieldToken_; + const edm::ESGetToken trackerToken_; + const edm::ESGetToken builderToken_; + const MagneticField *magfield; + const TrackerGeometry *tracker; PropagatorWithMaterial *thePropagator; PropagatorWithMaterial *thePropagatorOp; @@ -131,7 +134,6 @@ class CosmicTrajectoryBuilder { TransientTrackingRecHit::RecHitContainer hits; bool seed_plus; std::string geometry; - std::string theBuilderName; }; #endif diff --git a/RecoTracker/SingleTrackPattern/src/CRackTrajectoryBuilder.cc b/RecoTracker/SingleTrackPattern/src/CRackTrajectoryBuilder.cc index 94369214c9403..4b12219fbcf01 100644 --- a/RecoTracker/SingleTrackPattern/src/CRackTrajectoryBuilder.cc +++ b/RecoTracker/SingleTrackPattern/src/CRackTrajectoryBuilder.cc @@ -20,14 +20,16 @@ #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "TrackingTools/Records/interface/TrackingComponentsRecord.h" -#include "TrackingTools/Records/interface/TransientRecHitRecord.h" #include "TrackingTools/TrackFitters/interface/TrajectoryStateWithArbitraryError.h" //#include "RecoTracker/CkfPattern/interface/TransientInitialStateEstimator.h" using namespace std; -CRackTrajectoryBuilder::CRackTrajectoryBuilder(const edm::ParameterSet& conf) { +CRackTrajectoryBuilder::CRackTrajectoryBuilder(const edm::ParameterSet& conf, edm::ConsumesCollector iC) + : magfieldToken_(iC.esConsumes()), + trackerToken_(iC.esConsumes()), + builderToken_(iC.esConsumes(edm::ESInputTag("", conf.getParameter("TTRHBuilder")))) { //minimum number of hits per tracks theMinHits = conf.getParameter("MinHits"); @@ -40,7 +42,6 @@ CRackTrajectoryBuilder::CRackTrajectoryBuilder(const edm::ParameterSet& conf) { useMatchedHits = conf.getUntrackedParameter("useMatchedHits", true); geometry = conf.getUntrackedParameter("GeometricStructure", "STANDARD"); - theBuilderName = conf.getParameter("TTRHBuilder"); } CRackTrajectoryBuilder::~CRackTrajectoryBuilder() { @@ -52,8 +53,8 @@ void CRackTrajectoryBuilder::init(const edm::EventSetup& es, bool seedplus) { // theInitialState = new TransientInitialStateEstimator( es,tise_params); //services - es.get().get(magfield); - es.get().get(tracker); + magfield = &es.getData(magfieldToken_); + tracker = &es.getData(trackerToken_); if (seedplus) { seed_plus = true; @@ -69,10 +70,7 @@ void CRackTrajectoryBuilder::init(const edm::EventSetup& es, bool seedplus) { // theUpdator= new KFStripUpdator(); theEstimator = new Chi2MeasurementEstimator(chi2cut); - edm::ESHandle theBuilder; - es.get().get(theBuilderName, theBuilder); - - RHBuilder = theBuilder.product(); + RHBuilder = &es.getData(builderToken_); theFitter = new KFTrajectoryFitter(*thePropagator, *theUpdator, *theEstimator); diff --git a/RecoTracker/SingleTrackPattern/src/CosmicTrackFinder.cc b/RecoTracker/SingleTrackPattern/src/CosmicTrackFinder.cc index 97e422b950867..85e0004f1594d 100644 --- a/RecoTracker/SingleTrackPattern/src/CosmicTrackFinder.cc +++ b/RecoTracker/SingleTrackPattern/src/CosmicTrackFinder.cc @@ -26,7 +26,7 @@ namespace cms { CosmicTrackFinder::CosmicTrackFinder(edm::ParameterSet const& conf) - : cosmicTrajectoryBuilder_(conf), crackTrajectoryBuilder_(conf) { + : cosmicTrajectoryBuilder_(conf, consumesCollector()), crackTrajectoryBuilder_(conf, consumesCollector()) { geometry = conf.getUntrackedParameter("GeometricStructure", "STANDARD"); useHitsSplitting_ = conf.getParameter("useHitsSplitting"); matchedrecHitsToken_ = @@ -76,8 +76,6 @@ namespace cms { // Step B: create empty output collection auto output = std::make_unique(); - edm::ESHandle tracker; - es.get().get(tracker); edm::LogVerbatim("CosmicTrackFinder") << "========== Cosmic Track Finder Info =========="; edm::LogVerbatim("CosmicTrackFinder") << " Numbers of Seeds " << (*seed).size(); if (!(*seed).empty()) { diff --git a/RecoTracker/SingleTrackPattern/src/CosmicTrajectoryBuilder.cc b/RecoTracker/SingleTrackPattern/src/CosmicTrajectoryBuilder.cc index 17d23a9da0778..f773c170ac9d7 100644 --- a/RecoTracker/SingleTrackPattern/src/CosmicTrajectoryBuilder.cc +++ b/RecoTracker/SingleTrackPattern/src/CosmicTrajectoryBuilder.cc @@ -15,10 +15,12 @@ #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "TrackingTools/Records/interface/TrackingComponentsRecord.h" -#include "TrackingTools/Records/interface/TransientRecHitRecord.h" #include "TrackingTools/TrackFitters/interface/TrajectoryStateWithArbitraryError.h" using namespace std; -CosmicTrajectoryBuilder::CosmicTrajectoryBuilder(const edm::ParameterSet &conf) { +CosmicTrajectoryBuilder::CosmicTrajectoryBuilder(const edm::ParameterSet &conf, edm::ConsumesCollector iC) + : magfieldToken_(iC.esConsumes()), + trackerToken_(iC.esConsumes()), + builderToken_(iC.esConsumes(edm::ESInputTag("", conf.getParameter("TTRHBuilder")))) { //minimum number of hits per tracks theMinHits = conf.getParameter("MinHits"); @@ -27,7 +29,6 @@ CosmicTrajectoryBuilder::CosmicTrajectoryBuilder(const edm::ParameterSet &conf) edm::LogInfo("CosmicTrackFinder") << "Minimum number of hits " << theMinHits << " Cut on Chi2= " << chi2cut; geometry = conf.getUntrackedParameter("GeometricStructure", "STANDARD"); - theBuilderName = conf.getParameter("TTRHBuilder"); } CosmicTrajectoryBuilder::~CosmicTrajectoryBuilder() {} @@ -36,8 +37,8 @@ void CosmicTrajectoryBuilder::init(const edm::EventSetup &es, bool seedplus) { // FIXME: this is a memory leak generator //services - es.get().get(magfield); - es.get().get(tracker); + magfield = &es.getData(magfieldToken_); + tracker = &es.getData(trackerToken_); if (seedplus) { seed_plus = true; @@ -52,10 +53,7 @@ void CosmicTrajectoryBuilder::init(const edm::EventSetup &es, bool seedplus) { theUpdator = new KFUpdator(); theEstimator = new Chi2MeasurementEstimator(chi2cut); - edm::ESHandle theBuilder; - es.get().get(theBuilderName, theBuilder); - - RHBuilder = theBuilder.product(); + RHBuilder = &es.getData(builderToken_); hitCloner = static_cast(RHBuilder)->cloner(); theFitter = new KFTrajectoryFitter(*thePropagator, *theUpdator, *theEstimator); diff --git a/RecoTracker/SpecialSeedGenerators/interface/SimpleCosmicBONSeeder.h b/RecoTracker/SpecialSeedGenerators/interface/SimpleCosmicBONSeeder.h index 7bcef77048ef0..99f8ba76f78d4 100644 --- a/RecoTracker/SpecialSeedGenerators/interface/SimpleCosmicBONSeeder.h +++ b/RecoTracker/SpecialSeedGenerators/interface/SimpleCosmicBONSeeder.h @@ -63,9 +63,11 @@ class SimpleCosmicBONSeeder : public edm::stream::EDProducer<> { private: edm::ParameterSet conf_; - std::string builderName; - edm::EDGetTokenT seedingLayerToken_; + const edm::EDGetTokenT seedingLayerToken_; + const edm::ESGetToken magfieldToken_; + const edm::ESGetToken trackerToken_; + const edm::ESGetToken ttrhBuilderToken_; GlobalTrackingRegion region_; double pMin_; bool writeTriplets_; @@ -75,9 +77,8 @@ class SimpleCosmicBONSeeder : public edm::stream::EDProducer<> { uint32_t tripletsVerbosity_, seedVerbosity_, helixVerbosity_; - edm::ESHandle magfield; - edm::ESHandle tracker; - edm::ESHandle TTTRHBuilder; + const MagneticField *magfield; + const TrackerGeometry *tracker; TkClonerImpl cloner; // FIXME KFUpdator *theUpdator; PropagatorWithMaterial *thePropagatorAl; diff --git a/RecoTracker/SpecialSeedGenerators/src/OutsideInMuonSeeder.cc b/RecoTracker/SpecialSeedGenerators/src/OutsideInMuonSeeder.cc index 85b16b1900b72..78feb050949c6 100644 --- a/RecoTracker/SpecialSeedGenerators/src/OutsideInMuonSeeder.cc +++ b/RecoTracker/SpecialSeedGenerators/src/OutsideInMuonSeeder.cc @@ -8,7 +8,6 @@ #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" @@ -62,22 +61,23 @@ class OutsideInMuonSeeder final : public edm::stream::EDProducer<> { /// How much to rescale errors from STA const double errorRescaling_; - const std::string trackerPropagatorName_; - const std::string muonPropagatorName_; - edm::EDGetTokenT measurementTrackerTag_; - const std::string measurementTrackerName_; - const std::string estimatorName_; - const std::string updatorName_; + const edm::ESGetToken trackerPropagatorToken_; + const edm::ESGetToken muonPropagatorToken_; + const edm::EDGetTokenT measurementTrackerTag_; + const edm::ESGetToken estimatorToken_; + const edm::ESGetToken updatorToken_; + const edm::ESGetToken magfieldToken_; + const edm::ESGetToken geometryToken_; + const edm::ESGetToken tkGeometryToken_; float const minEtaForTEC_; float const maxEtaForTOB_; - edm::ESHandle magfield_; - edm::ESHandle muonPropagator_; - edm::ESHandle trackerPropagator_; - edm::ESHandle geometry_; - edm::ESHandle estimator_; - edm::ESHandle updator_; + const MagneticField *magfield_; + const Propagator *muonPropagator_; + const GlobalTrackingGeometry *geometry_; + const Chi2MeasurementEstimatorBase *estimator_; + const TrajectoryStateUpdator *updator_; /// Dump deug information const bool debug_; @@ -98,11 +98,14 @@ OutsideInMuonSeeder::OutsideInMuonSeeder(const edm::ParameterSet &iConfig) hitsToTry_(iConfig.getParameter("hitsToTry")), fromVertex_(iConfig.getParameter("fromVertex")), errorRescaling_(iConfig.getParameter("errorRescaleFactor")), - trackerPropagatorName_(iConfig.getParameter("trackerPropagator")), - muonPropagatorName_(iConfig.getParameter("muonPropagator")), + trackerPropagatorToken_(esConsumes(edm::ESInputTag("", iConfig.getParameter("trackerPropagator")))), + muonPropagatorToken_(esConsumes(edm::ESInputTag("", iConfig.getParameter("muonPropagator")))), measurementTrackerTag_(consumes(edm::InputTag("MeasurementTrackerEvent"))), - estimatorName_(iConfig.getParameter("hitCollector")), - updatorName_("KFUpdator"), + estimatorToken_(esConsumes(edm::ESInputTag("", iConfig.getParameter("hitCollector")))), + updatorToken_(esConsumes(edm::ESInputTag("", "KFUpdator"))), + magfieldToken_(esConsumes()), + geometryToken_(esConsumes()), + tkGeometryToken_(esConsumes()), minEtaForTEC_(iConfig.getParameter("minEtaForTEC")), maxEtaForTOB_(iConfig.getParameter("maxEtaForTOB")), debug_(iConfig.getUntrackedParameter("debug", false)) { @@ -113,18 +116,17 @@ void OutsideInMuonSeeder::produce(edm::Event &iEvent, const edm::EventSetup &iSe using namespace edm; using namespace std; - iSetup.get().get(magfield_); - iSetup.get().get(trackerPropagatorName_, trackerPropagator_); - iSetup.get().get(muonPropagatorName_, muonPropagator_); - iSetup.get().get(geometry_); - iSetup.get().get(estimatorName_, estimator_); - iSetup.get().get(updatorName_, updator_); + magfield_ = &iSetup.getData(magfieldToken_); + auto const &trackerPropagator = iSetup.getData(trackerPropagatorToken_); + muonPropagator_ = &iSetup.getData(muonPropagatorToken_); + geometry_ = &iSetup.getData(geometryToken_); + estimator_ = &iSetup.getData(estimatorToken_); + updator_ = &iSetup.getData(updatorToken_); Handle measurementTracker; iEvent.getByToken(measurementTrackerTag_, measurementTracker); - ESHandle tmpTkGeometry; - iSetup.get().get(tmpTkGeometry); + const auto &tmpTkGeometry = iSetup.getData(tkGeometryToken_); Handle> src; iEvent.getByToken(src_, src); @@ -142,7 +144,7 @@ void OutsideInMuonSeeder::produce(edm::Event &iEvent, const edm::EventSetup &iSe // very same direction every single time. std::unique_ptr pmuon_cloned = SetPropagationDirection(*muonPropagator_, fromVertex_ ? alongMomentum : oppositeToMomentum); - std::unique_ptr ptracker_cloned = SetPropagationDirection(*trackerPropagator_, alongMomentum); + std::unique_ptr ptracker_cloned = SetPropagationDirection(trackerPropagator, alongMomentum); int sizeBefore = out->size(); if (debug_) @@ -151,8 +153,8 @@ void OutsideInMuonSeeder::produce(edm::Event &iEvent, const edm::EventSetup &iSe const reco::Track &tk = *mu.outerTrack(); TrajectoryStateOnSurface state = - fromVertex_ ? TrajectoryStateOnSurface(trajectoryStateTransform::initialFreeState(tk, magfield_.product())) - : trajectoryStateTransform::innerStateOnSurface(tk, *geometry_, magfield_.product()); + fromVertex_ ? TrajectoryStateOnSurface(trajectoryStateTransform::initialFreeState(tk, magfield_)) + : trajectoryStateTransform::innerStateOnSurface(tk, *geometry_, magfield_); if (std::abs(tk.eta()) < maxEtaForTOB_) { std::vector const &tob = measurementTracker->geometricSearchTracker()->tobLayers(); @@ -171,10 +173,10 @@ void OutsideInMuonSeeder::produce(edm::Event &iEvent, const edm::EventSetup &iSe } } if (tk.eta() > minEtaForTEC_) { - const auto &forwLayers = tmpTkGeometry->isThere(GeomDetEnumerators::P2OTEC) + const auto &forwLayers = tmpTkGeometry.isThere(GeomDetEnumerators::P2OTEC) ? measurementTracker->geometricSearchTracker()->posTidLayers() : measurementTracker->geometricSearchTracker()->posTecLayers(); - if (tmpTkGeometry->isThere(GeomDetEnumerators::P2OTEC)) { + if (tmpTkGeometry.isThere(GeomDetEnumerators::P2OTEC)) { LogDebug("OutsideInMuonSeeder") << "\n We are using the Phase2 Outer Tracker (defined as a TID+). "; } LogTrace("OutsideInMuonSeeder") << "\n ==== TEC+ tot layers " << forwLayers.size() << " ====" << std::endl; @@ -195,10 +197,10 @@ void OutsideInMuonSeeder::produce(edm::Event &iEvent, const edm::EventSetup &iSe } } if (tk.eta() < -minEtaForTEC_) { - const auto &forwLayers = tmpTkGeometry->isThere(GeomDetEnumerators::P2OTEC) + const auto &forwLayers = tmpTkGeometry.isThere(GeomDetEnumerators::P2OTEC) ? measurementTracker->geometricSearchTracker()->negTidLayers() : measurementTracker->geometricSearchTracker()->negTecLayers(); - if (tmpTkGeometry->isThere(GeomDetEnumerators::P2OTEC)) { + if (tmpTkGeometry.isThere(GeomDetEnumerators::P2OTEC)) { LogDebug("OutsideInMuonSeeder") << "\n We are using the Phase2 Outer Tracker (defined as a TID-). "; } LogTrace("OutsideInMuonSeeder") << "\n ==== TEC- tot layers " << forwLayers.size() << " ====" << std::endl; @@ -295,7 +297,7 @@ int OutsideInMuonSeeder::doLayer(const GeometricSearchDet &layer, } void OutsideInMuonSeeder::doDebug(const reco::Track &tk) const { - TrajectoryStateOnSurface tsos = trajectoryStateTransform::innerStateOnSurface(tk, *geometry_, &*magfield_); + TrajectoryStateOnSurface tsos = trajectoryStateTransform::innerStateOnSurface(tk, *geometry_, magfield_); std::unique_ptr pmuon_cloned = SetPropagationDirection(*muonPropagator_, alongMomentum); for (unsigned int i = 0; i < tk.recHitsSize(); ++i) { const TrackingRecHit *hit = &*tk.recHit(i); diff --git a/RecoTracker/SpecialSeedGenerators/src/SimpleCosmicBONSeeder.cc b/RecoTracker/SpecialSeedGenerators/src/SimpleCosmicBONSeeder.cc index 23a266786e030..96096fa1f7612 100644 --- a/RecoTracker/SpecialSeedGenerators/src/SimpleCosmicBONSeeder.cc +++ b/RecoTracker/SpecialSeedGenerators/src/SimpleCosmicBONSeeder.cc @@ -25,6 +25,9 @@ using namespace std; SimpleCosmicBONSeeder::SimpleCosmicBONSeeder(edm::ParameterSet const &conf) : conf_(conf), seedingLayerToken_(consumes(conf.getParameter("TripletsSrc"))), + magfieldToken_(esConsumes()), + trackerToken_(esConsumes()), + ttrhBuilderToken_(esConsumes(edm::ESInputTag("", conf_.getParameter("TTRHBuilder")))), writeTriplets_(conf.getParameter("writeTriplets")), seedOnMiddle_(conf.existsAs("seedOnMiddle") ? conf.getParameter("seedOnMiddle") : false), rescaleError_(conf.existsAs("rescaleError") ? conf.getParameter("rescaleError") : 1.0), @@ -42,8 +45,6 @@ SimpleCosmicBONSeeder::SimpleCosmicBONSeeder(edm::ParameterSet const &conf) region_ = GlobalTrackingRegion(ptmin, originradius, halflength, originz); pMin_ = regionConf.getParameter("pMin"); - builderName = conf_.getParameter("TTRHBuilder"); - //***top-bottom positiveYOnly = conf_.getParameter("PositiveYOnly"); negativeYOnly = conf_.getParameter("NegativeYOnly"); @@ -90,7 +91,7 @@ void SimpleCosmicBONSeeder::produce(edm::Event &ev, const edm::EventSetup &es) { auto output = std::make_unique(); auto outtriplets = std::make_unique>(); - es.get().get(magfield); + magfield = &es.getData(magfieldToken_); if (magfield->inTesla(GlobalPoint(0, 0, 0)).mag() > 0.01) { size_t clustsOrZero = check_.tooManyClusters(ev); if (clustsOrZero) { @@ -125,12 +126,11 @@ void SimpleCosmicBONSeeder::produce(edm::Event &ev, const edm::EventSetup &es) { } void SimpleCosmicBONSeeder::init(const edm::EventSetup &iSetup) { - iSetup.get().get(tracker); - iSetup.get().get(builderName, TTTRHBuilder); - cloner = ((TkTransientTrackingRecHitBuilder const *)(TTTRHBuilder.product()))->cloner(); + tracker = &iSetup.getData(trackerToken_); + cloner = dynamic_cast(iSetup.getData(ttrhBuilderToken_)).cloner(); // FIXME: these should come from ES too!! - thePropagatorAl = new PropagatorWithMaterial(alongMomentum, 0.1057, &(*magfield)); - thePropagatorOp = new PropagatorWithMaterial(oppositeToMomentum, 0.1057, &(*magfield)); + thePropagatorAl = new PropagatorWithMaterial(alongMomentum, 0.1057, magfield); + thePropagatorOp = new PropagatorWithMaterial(oppositeToMomentum, 0.1057, magfield); theUpdator = new KFUpdator(); } diff --git a/RecoTracker/TkSeedGenerator/plugins/DeepCoreSeedGenerator.cc b/RecoTracker/TkSeedGenerator/plugins/DeepCoreSeedGenerator.cc index 064220ae40fde..1f661345a8ba8 100644 --- a/RecoTracker/TkSeedGenerator/plugins/DeepCoreSeedGenerator.cc +++ b/RecoTracker/TkSeedGenerator/plugins/DeepCoreSeedGenerator.cc @@ -99,27 +99,24 @@ class DeepCoreSeedGenerator : public edm::stream::EDProducer magfield_; - edm::ESHandle geometry_; - edm::ESHandle propagator_; + const GlobalTrackingGeometry* geometry_ = nullptr; edm::EDGetTokenT> vertices_; edm::EDGetTokenT> pixelClusters_; edm::Handle> inputPixelClusters_; edm::EDGetTokenT> cores_; + const edm::ESGetToken geometryToken_; + const edm::ESGetToken pixelCPEToken_; const edm::ESGetToken topoToken_; double ptMin_; double deltaR_; double chargeFracMin_; double centralMIPCharge_; - std::string pixelCPE_; std::string weightfilename_; std::vector inputTensorName_; std::vector outputTensorName_; @@ -166,12 +163,13 @@ DeepCoreSeedGenerator::DeepCoreSeedGenerator(const edm::ParameterSet& iConfig, c pixelClusters_( consumes>(iConfig.getParameter("pixelClusters"))), cores_(consumes>(iConfig.getParameter("cores"))), + geometryToken_(esConsumes()), + pixelCPEToken_(esConsumes(edm::ESInputTag("", iConfig.getParameter("pixelCPE")))), topoToken_(esConsumes()), ptMin_(iConfig.getParameter("ptMin")), deltaR_(iConfig.getParameter("deltaR")), chargeFracMin_(iConfig.getParameter("chargeFractionMin")), centralMIPCharge_(iConfig.getParameter("centralMIPCharge")), - pixelCPE_(iConfig.getParameter("pixelCPE")), weightfilename_(iConfig.getParameter("weightFile").fullPath()), inputTensorName_(iConfig.getParameter>("inputTensorName")), outputTensorName_(iConfig.getParameter>("outputTensorName")), @@ -199,18 +197,13 @@ void DeepCoreSeedGenerator::produce(edm::Event& iEvent, const edm::EventSetup& i using namespace edm; using namespace reco; - iSetup.get().get(magfield_); - iSetup.get().get(geometry_); - iSetup.get().get("AnalyticalPropagator", propagator_); + geometry_ = &iSetup.getData(geometryToken_); const auto& inputPixelClusters_ = iEvent.get(pixelClusters_); const auto& vertices = iEvent.get(vertices_); const auto& cores = iEvent.get(cores_); - edm::ESHandle pixelCPEhandle; - const PixelClusterParameterEstimator* pixelCPE; - iSetup.get().get(pixelCPE_, pixelCPEhandle); - pixelCPE = pixelCPEhandle.product(); + const PixelClusterParameterEstimator* pixelCPE = &iSetup.getData(pixelCPEToken_); const TrackerTopology* const tTopo = &iSetup.getData(topoToken_); auto output = std::make_unique>(); @@ -549,12 +542,6 @@ std::unique_ptr DeepCoreSeedGenerator::initializeGlobalCache(cons void DeepCoreSeedGenerator::globalEndJob(DeepCoreCache* cache) { delete cache->graph_def; } -// ------------ method called once each job just before starting event loop ------------ -void DeepCoreSeedGenerator::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void DeepCoreSeedGenerator::endJob() {} - // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ void DeepCoreSeedGenerator::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; diff --git a/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.cc b/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.cc index 75bf3c03789af..94198728f1eb7 100644 --- a/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.cc +++ b/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.cc @@ -2,13 +2,13 @@ #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "RecoPixelVertexing/PixelTriplets/interface/ThirdHitPredictionFromCircle.h" -#include "RecoPixelVertexing/PixelTriplets/plugins/ThirdHitRZPrediction.h" +#include "RecoPixelVertexing/PixelTriplets/interface/ThirdHitRZPrediction.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Utilities/interface/ESInputTag.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "RecoPixelVertexing/PixelTriplets/plugins/ThirdHitCorrection.h" +#include "RecoTracker/TkMSParametrization/interface/PixelRecoUtilities.h" #include "RecoTracker/TkHitPairs/interface/RecHitsSortedInPhi.h" #include "CommonTools/RecoAlgos/interface/KDTreeLinkerAlgo.h" diff --git a/RecoTracker/TkSeedingLayers/interface/SeedingLayerSetsBuilder.h b/RecoTracker/TkSeedingLayers/interface/SeedingLayerSetsBuilder.h index 733d892a14aee..c559467c8d0d1 100644 --- a/RecoTracker/TkSeedingLayers/interface/SeedingLayerSetsBuilder.h +++ b/RecoTracker/TkSeedingLayers/interface/SeedingLayerSetsBuilder.h @@ -27,12 +27,15 @@ class TrackerRecoGeometryRecord; class TransientRecHitRecord; class TransientTrackingRecHitBuilder; class DetLayer; +class TrackerTopology; +class TrackerTopologyRcd; +class GeometricSearchTracker; +class TrackerRecoGeometryRecord; class SeedingLayerSetsBuilder { public: using SeedingLayerId = std::tuple; - SeedingLayerSetsBuilder() = default; SeedingLayerSetsBuilder(const edm::ParameterSet& cfg, edm::ConsumesCollector& iC, const edm::InputTag& fastsimHitTag); //FastSim specific constructor @@ -68,6 +71,8 @@ class SeedingLayerSetsBuilder { edm::ESWatcher geometryWatcher_; edm::ESWatcher trhWatcher_; edm::EDGetTokenT fastSimrecHitsToken_; + const edm::ESGetToken trackerToken_; + edm::ESGetToken trackerTopologyToken_; struct LayerSpec { LayerSpec(unsigned short index, const std::string& layerName, @@ -82,6 +87,7 @@ class SeedingLayerSetsBuilder { std::string pixelHitProducer; bool usePixelHitProducer; const std::string hitBuilder; + const edm::ESGetToken hitBuilderToken; GeomDetEnumerators::SubDetector subdet; TrackerDetSide side; diff --git a/RecoTracker/TkSeedingLayers/src/HitExtractorPIX.cc b/RecoTracker/TkSeedingLayers/src/HitExtractorPIX.cc index c4bce9c44eeec..e83ba1d275d49 100644 --- a/RecoTracker/TkSeedingLayers/src/HitExtractorPIX.cc +++ b/RecoTracker/TkSeedingLayers/src/HitExtractorPIX.cc @@ -1,13 +1,10 @@ #include "HitExtractorPIX.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "TrackingTools/DetLayers/interface/DetLayer.h" #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include using namespace ctfseeding; @@ -17,7 +14,10 @@ HitExtractorPIX::HitExtractorPIX(TrackerDetSide side, int idLayer, const std::string& hitProducer, edm::ConsumesCollector& iC) - : theHitProducer(iC.consumes(hitProducer)), theSide(side), theIdLayer(idLayer) {} + : theHitProducer(iC.consumes(hitProducer)), + theTtopo(iC.esConsumes()), + theSide(side), + theIdLayer(idLayer) {} void HitExtractorPIX::useSkipClusters_(const edm::InputTag& m, edm::ConsumesCollector& iC) { theSkipClusters = iC.consumes(m); @@ -28,9 +28,7 @@ HitExtractor::Hits HitExtractorPIX::hits(const TkTransientTrackingRecHitBuilder& const edm::EventSetup& es) const { HitExtractor::Hits result; - edm::ESHandle httopo; - es.get().get(httopo); - const TrackerTopology& ttopo = *httopo; + const TrackerTopology& ttopo = es.getData(theTtopo); edm::Handle pixelHits; ev.getByToken(theHitProducer, pixelHits); diff --git a/RecoTracker/TkSeedingLayers/src/HitExtractorPIX.h b/RecoTracker/TkSeedingLayers/src/HitExtractorPIX.h index d5ba0fc2535cd..b4bf661931bc4 100644 --- a/RecoTracker/TkSeedingLayers/src/HitExtractorPIX.h +++ b/RecoTracker/TkSeedingLayers/src/HitExtractorPIX.h @@ -9,6 +9,8 @@ #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h" #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" namespace ctfseeding { class HitExtractorPIX final : public HitExtractor { @@ -26,6 +28,7 @@ namespace ctfseeding { edm::EDGetTokenT theSkipClusters; edm::EDGetTokenT theHitProducer; + edm::ESGetToken theTtopo; TrackerDetSide theSide; int theIdLayer; }; diff --git a/RecoTracker/TkSeedingLayers/src/HitExtractorSTRP.cc b/RecoTracker/TkSeedingLayers/src/HitExtractorSTRP.cc index 471c131a5f4c0..0772c922f0d9f 100644 --- a/RecoTracker/TkSeedingLayers/src/HitExtractorSTRP.cc +++ b/RecoTracker/TkSeedingLayers/src/HitExtractorSTRP.cc @@ -1,21 +1,15 @@ #include "HitExtractorSTRP.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "TrackingTools/DetLayers/interface/DetLayer.h" #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/Common/interface/ContainerMask.h" #include "TrackingTools/TransientTrackingRecHit/interface/TrackingRecHitProjector.h" #include "RecoTracker/TransientTrackingRecHit/interface/ProjectedRecHit2D.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/SiStripCluster/interface/SiStripClusterTools.h" #include @@ -29,13 +23,15 @@ using namespace edm; HitExtractorSTRP::HitExtractorSTRP(GeomDetEnumerators::SubDetector subdet, TrackerDetSide side, int idLayer, - float iminGoodCharge) + float iminGoodCharge, + edm::ConsumesCollector& iC) : theLayerSubDet(subdet), theSide(side), theIdLayer(idLayer), minAbsZ(0), theMinRing(1), theMaxRing(0), + theTtopo(iC.esConsumes()), hasMatchedHits(false), hasRPhiHits(false), hasStereoHits(false), @@ -190,9 +186,7 @@ HitExtractor::Hits HitExtractorSTRP::hits(const TkTransientTrackingRecHitBuilder unsigned int cleanFrom = 0; //Retrieve tracker topology from geometry - edm::ESHandle tTopoHandle; - es.get().get(tTopoHandle); - const TrackerTopology* const tTopo = tTopoHandle.product(); + const TrackerTopology* const tTopo = &es.getData(theTtopo); // // TIB diff --git a/RecoTracker/TkSeedingLayers/src/HitExtractorSTRP.h b/RecoTracker/TkSeedingLayers/src/HitExtractorSTRP.h index e92b2e3646fac..7a1f5b8a6f15a 100644 --- a/RecoTracker/TkSeedingLayers/src/HitExtractorSTRP.h +++ b/RecoTracker/TkSeedingLayers/src/HitExtractorSTRP.h @@ -9,6 +9,8 @@ #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2DCollection.h" #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2DCollection.h" #include "DataFormats/TrackerRecHit2D/interface/VectorHit.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include #include @@ -25,7 +27,11 @@ namespace ctfseeding { public: typedef SiStripRecHit2D::ClusterRef SiStripClusterRef; - HitExtractorSTRP(GeomDetEnumerators::SubDetector subdet, TrackerDetSide side, int idLayer, float iminGoodCharge); + HitExtractorSTRP(GeomDetEnumerators::SubDetector subdet, + TrackerDetSide side, + int idLayer, + float iminGoodCharge, + edm::ConsumesCollector& iC); ~HitExtractorSTRP() override {} HitExtractor::Hits hits(const TkTransientTrackingRecHitBuilder& ttrhBuilder, @@ -93,6 +99,7 @@ namespace ctfseeding { edm::EDGetTokenT theRPhiHits; edm::EDGetTokenT theStereoHits; edm::EDGetTokenT theVectorHits; + edm::ESGetToken theTtopo; bool hasMatchedHits; bool hasRPhiHits; bool hasStereoHits; diff --git a/RecoTracker/TkSeedingLayers/src/SeedingLayerSetsBuilder.cc b/RecoTracker/TkSeedingLayers/src/SeedingLayerSetsBuilder.cc index 4bd23772b1761..d9c3eaf1c9c3f 100644 --- a/RecoTracker/TkSeedingLayers/src/SeedingLayerSetsBuilder.cc +++ b/RecoTracker/TkSeedingLayers/src/SeedingLayerSetsBuilder.cc @@ -1,7 +1,6 @@ #include "RecoTracker/TkSeedingLayers/interface/SeedingLayerSetsBuilder.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" @@ -102,7 +101,9 @@ SeedingLayerSetsBuilder::LayerSpec::LayerSpec(unsigned short index, const std::string& layerName, const edm::ParameterSet& cfgLayer, edm::ConsumesCollector& iC) - : nameIndex(index), hitBuilder(cfgLayer.getParameter("TTRHBuilder")) { + : nameIndex(index), + hitBuilder(cfgLayer.getParameter("TTRHBuilder")), + hitBuilderToken(iC.esConsumes(edm::ESInputTag("", hitBuilder))) { usePixelHitProducer = false; if (cfgLayer.exists("HitProducer")) { pixelHitProducer = cfgLayer.getParameter("HitProducer"); @@ -123,7 +124,7 @@ SeedingLayerSetsBuilder::LayerSpec::LayerSpec(unsigned short index, if (subdet == GeomDetEnumerators::PixelBarrel || subdet == GeomDetEnumerators::PixelEndcap) { extractor = std::make_unique(side, idLayer, pixelHitProducer, iC); } else if (subdet != GeomDetEnumerators::invalidDet) { // strip - auto extr = std::make_unique(subdet, side, idLayer, clusterChargeCut(cfgLayer)); + auto extr = std::make_unique(subdet, side, idLayer, clusterChargeCut(cfgLayer), iC); if (cfgLayer.exists("matchedRecHits")) { extr->useMatchedHits(cfgLayer.getParameter("matchedRecHits"), iC); } @@ -183,10 +184,12 @@ SeedingLayerSetsBuilder::SeedingLayerSetsBuilder(const edm::ParameterSet& cfg, const edm::InputTag& fastsimHitTag) : SeedingLayerSetsBuilder(cfg, iC) { fastSimrecHitsToken_ = iC.consumes(fastsimHitTag); + trackerTopologyToken_ = iC.esConsumes(); } SeedingLayerSetsBuilder::SeedingLayerSetsBuilder(const edm::ParameterSet& cfg, edm::ConsumesCollector&& iC) : SeedingLayerSetsBuilder(cfg, iC) {} -SeedingLayerSetsBuilder::SeedingLayerSetsBuilder(const edm::ParameterSet& cfg, edm::ConsumesCollector& iC) { +SeedingLayerSetsBuilder::SeedingLayerSetsBuilder(const edm::ParameterSet& cfg, edm::ConsumesCollector& iC) + : trackerToken_(iC.esConsumes()) { std::vector namesPset = cfg.getParameter >("layerList"); std::vector > layerNamesInSets = this->layerNamesInSets(namesPset); // debug printout of layers @@ -296,9 +299,7 @@ void SeedingLayerSetsBuilder::updateEventSetup(const edm::EventSetup& es) { if (!(geometryWatcher_.check(es) | trhWatcher_.check(es))) return; - edm::ESHandle htracker; - es.get().get(htracker); - const GeometricSearchTracker& tracker = *htracker; + const GeometricSearchTracker& tracker = es.getData(trackerToken_); const std::vector& bpx = tracker.barrelLayers(); const std::vector& tib = tracker.tibLayers(); @@ -344,11 +345,8 @@ void SeedingLayerSetsBuilder::updateEventSetup(const edm::EventSetup& es) { throw cms::Exception("Configuration") << "Did not find DetLayer for layer " << theLayerNames[layer.nameIndex]; } - edm::ESHandle builder; - es.get().get(layer.hitBuilder, builder); - theLayerDets[layer.nameIndex] = detLayer; - theTTRHBuilders[layer.nameIndex] = builder.product(); + theTTRHBuilders[layer.nameIndex] = &es.getData(layer.hitBuilderToken); } } @@ -382,9 +380,7 @@ std::unique_ptr SeedingLayerSetsBuilder::makeSeedingLayerS edm::Handle fastSimrechits_; ev.getByToken(fastSimrecHitsToken_, fastSimrechits_); //using FastSim RecHits - edm::ESHandle trackerTopology; - es.get().get(trackerTopology); - const TrackerTopology* const tTopo = trackerTopology.product(); + const TrackerTopology* const tTopo = &es.getData(trackerTopologyToken_); SeedingLayerSetsHits::OwnedHits layerhits_; auto ret = std::make_unique( diff --git a/RecoTracker/TkTrackingRegions/plugins/GlobalTrackingRegionProducerFromBeamSpot.h b/RecoTracker/TkTrackingRegions/interface/GlobalTrackingRegionProducerFromBeamSpot.h similarity index 100% rename from RecoTracker/TkTrackingRegions/plugins/GlobalTrackingRegionProducerFromBeamSpot.h rename to RecoTracker/TkTrackingRegions/interface/GlobalTrackingRegionProducerFromBeamSpot.h diff --git a/RecoTracker/TkTrackingRegions/plugins/PixelInactiveAreaFinder.cc b/RecoTracker/TkTrackingRegions/plugins/PixelInactiveAreaFinder.cc index dd17b7e61c0a8..13365df6e9fed 100644 --- a/RecoTracker/TkTrackingRegions/plugins/PixelInactiveAreaFinder.cc +++ b/RecoTracker/TkTrackingRegions/plugins/PixelInactiveAreaFinder.cc @@ -2,13 +2,10 @@ #include "FWCore/Utilities/interface/VecArray.h" #include "FWCore/Utilities/interface/transform.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "CondFormats/DataRecord/interface/SiPixelQualityRcd.h" #include "CondFormats/SiPixelObjects/interface/SiPixelQuality.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "DataFormats/Math/interface/deltaPhi.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "TrackingTools/TransientTrackingRecHit/interface/SeedingLayerSetsLooper.h" @@ -472,7 +469,10 @@ PixelInactiveAreaFinder::PixelInactiveAreaFinder( [&](const auto& tag) { return iC.consumes(tag); })), badPixelFEDChannelsTokens_( edm::vector_transform(iConfig.getParameter>("badPixelFEDChannelCollectionLabels"), - [&](const auto& tag) { return iC.consumes(tag); })) { + [&](const auto& tag) { return iC.consumes(tag); })), + trackerGeometryToken_(iC.esConsumes()), + trackerTopologyToken_(iC.esConsumes()), + pixelQualityToken_(iC.esConsumes()) { #ifdef EDM_ML_DEBUG for (const auto& layer : seedingLayers) { LogTrace("PixelInactiveAreaFinder") << "Input layer subdet " << std::get<0>(layer) << " side " @@ -554,15 +554,8 @@ void PixelInactiveAreaFinder::fillDescriptions(edm::ParameterSetDescription& des PixelInactiveAreaFinder::InactiveAreas PixelInactiveAreaFinder::inactiveAreas(const edm::Event& iEvent, const edm::EventSetup& iSetup) { // Set data to handles - { - edm::ESHandle trackerGeometry; - iSetup.get().get(trackerGeometry); - trackerGeometry_ = trackerGeometry.product(); - - edm::ESHandle trackerTopology; - iSetup.get().get(trackerTopology); - trackerTopology_ = trackerTopology.product(); - } + trackerGeometry_ = &iSetup.getData(trackerGeometryToken_); + trackerTopology_ = &iSetup.getData(trackerTopologyToken_); // assign data to instance variables updatePixelDets(iSetup); @@ -700,10 +693,9 @@ void PixelInactiveAreaFinder::getBadPixelDets(const edm::Event& iEvent, const ed }; // SiPixelQuality - edm::ESHandle pixelQuality; - iSetup.get().get(pixelQuality); + auto const& pixelQuality = iSetup.getData(pixelQualityToken_); - for (auto const& disabledModule : pixelQuality->getBadComponentList()) { + for (auto const& disabledModule : pixelQuality.getBadComponentList()) { addDetId(disabledModule.DetID); } diff --git a/RecoTracker/TkTrackingRegions/plugins/PixelInactiveAreaFinder.h b/RecoTracker/TkTrackingRegions/plugins/PixelInactiveAreaFinder.h index 96d2c6e43764a..6763bae22ac9c 100644 --- a/RecoTracker/TkTrackingRegions/plugins/PixelInactiveAreaFinder.h +++ b/RecoTracker/TkTrackingRegions/plugins/PixelInactiveAreaFinder.h @@ -8,6 +8,8 @@ #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Utilities/interface/VecArray.h" +#include "CondFormats/DataRecord/interface/SiPixelQualityRcd.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "AreaSeededTrackingRegionsBuilder.h" @@ -87,6 +89,9 @@ class PixelInactiveAreaFinder { std::vector > inactivePixelDetectorTokens_; std::vector > badPixelFEDChannelsTokens_; + edm::ESGetToken trackerGeometryToken_; + edm::ESGetToken trackerTopologyToken_; + edm::ESGetToken pixelQualityToken_; // Output type aliases using DetGroupSpanContainerPair = std::pair; diff --git a/RecoTracker/TkTrackingRegions/plugins/SealModule.cc b/RecoTracker/TkTrackingRegions/plugins/SealModule.cc index f925fe4af42a2..94d86918d3072 100644 --- a/RecoTracker/TkTrackingRegions/plugins/SealModule.cc +++ b/RecoTracker/TkTrackingRegions/plugins/SealModule.cc @@ -3,13 +3,13 @@ #include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducerFactory.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducer.h" +#include "RecoTracker/TkTrackingRegions/interface/GlobalTrackingRegionProducerFromBeamSpot.h" #include "RecoTracker/TkTrackingRegions/plugins/PointSeededTrackingRegionsProducer.h" #include "RecoTracker/TkTrackingRegions/plugins/CandidateSeededTrackingRegionsProducer.h" #include "RecoTracker/TkTrackingRegions/plugins/CandidatePointSeededTrackingRegionsProducer.h" #include "RecoTracker/MeasurementDet/interface/MeasurementTrackerEvent.h" #include "GlobalTrackingRegionWithVerticesProducer.h" #include "GlobalTrackingRegionProducer.h" -#include "GlobalTrackingRegionProducerFromBeamSpot.h" #include "AreaSeededTrackingRegionsProducer.h" DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, GlobalTrackingRegionProducer, "GlobalRegionProducer"); @@ -50,4 +50,4 @@ using CandidatePointSeededTrackingRegionsEDProducer = DEFINE_FWK_MODULE(CandidatePointSeededTrackingRegionsEDProducer); using AreaSeededTrackingRegionsEDProducer = TrackingRegionEDProducerT; -DEFINE_FWK_MODULE(AreaSeededTrackingRegionsEDProducer); \ No newline at end of file +DEFINE_FWK_MODULE(AreaSeededTrackingRegionsEDProducer); diff --git a/RecoVertex/ConfigurableVertexReco/test/BuildFile.CVRAnalysis b/RecoVertex/ConfigurableVertexReco/test/BuildFile.CVRAnalysis index 2733e30a3c33e..8a854e8cc095e 100644 --- a/RecoVertex/ConfigurableVertexReco/test/BuildFile.CVRAnalysis +++ b/RecoVertex/ConfigurableVertexReco/test/BuildFile.CVRAnalysis @@ -1,5 +1,4 @@ - diff --git a/RecoVertex/KalmanVertexFit/plugins/BuildFile.xml b/RecoVertex/KalmanVertexFit/plugins/BuildFile.xml index 190b1e5e60c2e..8c0202df544b6 100644 --- a/RecoVertex/KalmanVertexFit/plugins/BuildFile.xml +++ b/RecoVertex/KalmanVertexFit/plugins/BuildFile.xml @@ -1,8 +1,8 @@ - + diff --git a/RecoVertex/KalmanVertexFit/plugins/KVFTrackUpdate.cc b/RecoVertex/KalmanVertexFit/plugins/KVFTrackUpdate.cc index 4c0426ad7b072..ed4f6007e1ff2 100644 --- a/RecoVertex/KalmanVertexFit/plugins/KVFTrackUpdate.cc +++ b/RecoVertex/KalmanVertexFit/plugins/KVFTrackUpdate.cc @@ -9,7 +9,6 @@ #include "TrackingTools/TransientTrack/interface/TransientTrack.h" #include "RecoVertex/VertexPrimitives/interface/TransientVertex.h" #include "RecoVertex/KalmanVertexFit/interface/KalmanVertexFitter.h" -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" #include "RecoVertex/KalmanVertexFit/interface/SingleTrackVertexConstraint.h" #include "FWCore/Utilities/interface/InputTag.h" diff --git a/RecoVertex/PrimaryVertexProducer/python/OfflinePixel3DPrimaryVertices_cfi.py b/RecoVertex/PrimaryVertexProducer/python/OfflinePixel3DPrimaryVertices_cfi.py index c965ae93047dc..745f3f2f9bd0e 100644 --- a/RecoVertex/PrimaryVertexProducer/python/OfflinePixel3DPrimaryVertices_cfi.py +++ b/RecoVertex/PrimaryVertexProducer/python/OfflinePixel3DPrimaryVertices_cfi.py @@ -1,34 +1,23 @@ import FWCore.ParameterSet.Config as cms +import RecoVertex.PrimaryVertexProducer.primaryVertexProducer_cfi as _mod -pixelVertices = cms.EDProducer("PrimaryVertexProducer", +pixelVertices = _mod.primaryVertexProducer.clone( + TrackLabel = "pixelTracks", - verbose = cms.untracked.bool(False), - TrackLabel = cms.InputTag("pixelTracks"), - beamSpotLabel = cms.InputTag("offlineBeamSpot"), - - TkFilterParameters = cms.PSet( - algorithm=cms.string('filter'), - maxNormalizedChi2 = cms.double(100.0), - minPixelLayersWithHits=cms.int32(3), - minSiliconLayersWithHits = cms.int32(3), - maxD0Significance = cms.double(100.0), - minPt = cms.double(0.0), - maxEta = cms.double(100.), - trackQuality = cms.string("any") + TkFilterParameters = dict( + maxNormalizedChi2 = 100.0, + minPixelLayersWithHits=3, + minSiliconLayersWithHits = 3, + maxD0Significance = 100.0, + maxEta = 100., ), - TkClusParameters = cms.PSet( - algorithm = cms.string('DA_vect'), - TkDAClusParameters = cms.PSet( - dzCutOff = cms.double(4.0), - d0CutOff = cms.double(3.0), - Tmin = cms.double(2.4), - Tpurge = cms.double(2.0), - Tstop = cms.double(0.5), - coolingFactor = cms.double(0.6), - vertexSize = cms.double(0.01), - zmerge = cms.double(0.01), - uniquetrkweight = cms.double(0.9) + TkClusParameters = dict( + TkDAClusParameters = dict( + dzCutOff = 4.0, + Tmin = 2.4, + vertexSize = 0.01, + uniquetrkweight = 0.9 ) ), @@ -42,9 +31,4 @@ ) ] ) - - - ) - - diff --git a/RecoVertex/PrimaryVertexProducer/python/OfflinePrimaryVerticesFromCosmicTracks_cfi.py b/RecoVertex/PrimaryVertexProducer/python/OfflinePrimaryVerticesFromCosmicTracks_cfi.py index ca285f32c1ad0..85826d38cb01d 100644 --- a/RecoVertex/PrimaryVertexProducer/python/OfflinePrimaryVerticesFromCosmicTracks_cfi.py +++ b/RecoVertex/PrimaryVertexProducer/python/OfflinePrimaryVerticesFromCosmicTracks_cfi.py @@ -1,28 +1,24 @@ import FWCore.ParameterSet.Config as cms +import RecoVertex.PrimaryVertexProducer.primaryVertexProducer_cfi as _mod -offlinePrimaryVerticesFromCosmicTracks = cms.EDProducer("PrimaryVertexProducer", - - verbose = cms.untracked.bool(False), - TrackLabel = cms.InputTag("ctfWithMaterialTracksP5"), - beamSpotLabel = cms.InputTag("offlineBeamSpot"), +offlinePrimaryVerticesFromCosmicTracks = _mod.primaryVertexProducer.clone( + TrackLabel = "ctfWithMaterialTracksP5", + beamSpotLabel = "offlineBeamSpot", - TkFilterParameters = cms.PSet( - algorithm=cms.string('filter'), - maxNormalizedChi2 = cms.double(5.0), - minSiliconLayersWithHits = cms.int32(7), ## hits > 7 - maxD0Significance = cms.double(5.0), ## keep most primary tracks - maxD0Error = cms.double(10.0), - maxDzError = cms.double(10.0), - minPt = cms.double(0.0), ## better for softish events - maxEta = cms.double(5.0), - minPixelLayersWithHits = cms.int32(2), ## hits > 2 - trackQuality = cms.string("any") + TkFilterParameters = dict( + maxNormalizedChi2 = 5.0, + minSiliconLayersWithHits = 7, ## hits > 7 + maxD0Significance = 5.0, ## keep most primary tracks + maxD0Error = 10.0, + maxDzError = 10.0, + maxEta = 5.0, + minPixelLayersWithHits = 2, ## hits > 2 ), - TkClusParameters = cms.PSet( - algorithm = cms.string("gap"), - TkGapClusParameters = cms.PSet( - zSeparation = cms.double(0.1) ## 1 mm max separation betw. clusters + TkClusParameters = dict( + algorithm = "gap", + TkGapClusParameters = dict( + zSeparation = 0.1 ## 1 mm max separation betw. clusters ) ), @@ -36,9 +32,4 @@ ) ] ) - - - ) - - diff --git a/SimCalorimetry/CastorSim/src/CastorAmplifier.h b/SimCalorimetry/CastorSim/interface/CastorAmplifier.h similarity index 91% rename from SimCalorimetry/CastorSim/src/CastorAmplifier.h rename to SimCalorimetry/CastorSim/interface/CastorAmplifier.h index 178cfc5e033ae..10bb4cac3c0f3 100644 --- a/SimCalorimetry/CastorSim/src/CastorAmplifier.h +++ b/SimCalorimetry/CastorSim/interface/CastorAmplifier.h @@ -2,7 +2,7 @@ #define CastorSim_CastorAmplifier_h #include "CalibFormats/CaloObjects/interface/CaloSamples.h" -#include "SimCalorimetry/CastorSim/src/CastorSimParameterMap.h" +#include "SimCalorimetry/CastorSim/interface/CastorSimParameterMap.h" class CastorDbService; diff --git a/SimCalorimetry/CastorSim/src/CastorCoderFactory.h b/SimCalorimetry/CastorSim/interface/CastorCoderFactory.h similarity index 100% rename from SimCalorimetry/CastorSim/src/CastorCoderFactory.h rename to SimCalorimetry/CastorSim/interface/CastorCoderFactory.h diff --git a/SimCalorimetry/CastorSim/src/CastorDigitizerTraits.h b/SimCalorimetry/CastorSim/interface/CastorDigitizerTraits.h similarity index 82% rename from SimCalorimetry/CastorSim/src/CastorDigitizerTraits.h rename to SimCalorimetry/CastorSim/interface/CastorDigitizerTraits.h index ed2ff0e52626b..76b7ea42e40d1 100644 --- a/SimCalorimetry/CastorSim/src/CastorDigitizerTraits.h +++ b/SimCalorimetry/CastorSim/interface/CastorDigitizerTraits.h @@ -2,7 +2,7 @@ #define CastorSim_CastorDigitizerTraits_h #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" -#include "SimCalorimetry/CastorSim/src/CastorElectronicsSim.h" +#include "SimCalorimetry/CastorSim/interface/CastorElectronicsSim.h" class CastorDigitizerTraits { public: diff --git a/SimCalorimetry/CastorSim/src/CastorElectronicsSim.h b/SimCalorimetry/CastorSim/interface/CastorElectronicsSim.h similarity index 100% rename from SimCalorimetry/CastorSim/src/CastorElectronicsSim.h rename to SimCalorimetry/CastorSim/interface/CastorElectronicsSim.h diff --git a/SimCalorimetry/CastorSim/src/CastorHitCorrection.h b/SimCalorimetry/CastorSim/interface/CastorHitCorrection.h similarity index 100% rename from SimCalorimetry/CastorSim/src/CastorHitCorrection.h rename to SimCalorimetry/CastorSim/interface/CastorHitCorrection.h diff --git a/SimCalorimetry/CastorSim/src/CastorHitFilter.h b/SimCalorimetry/CastorSim/interface/CastorHitFilter.h similarity index 100% rename from SimCalorimetry/CastorSim/src/CastorHitFilter.h rename to SimCalorimetry/CastorSim/interface/CastorHitFilter.h diff --git a/SimCalorimetry/CastorSim/src/CastorShape.h b/SimCalorimetry/CastorSim/interface/CastorShape.h similarity index 100% rename from SimCalorimetry/CastorSim/src/CastorShape.h rename to SimCalorimetry/CastorSim/interface/CastorShape.h diff --git a/SimCalorimetry/CastorSim/src/CastorSimParameterMap.h b/SimCalorimetry/CastorSim/interface/CastorSimParameterMap.h similarity index 92% rename from SimCalorimetry/CastorSim/src/CastorSimParameterMap.h rename to SimCalorimetry/CastorSim/interface/CastorSimParameterMap.h index d4fc1563b52f5..85d0cf662f281 100644 --- a/SimCalorimetry/CastorSim/src/CastorSimParameterMap.h +++ b/SimCalorimetry/CastorSim/interface/CastorSimParameterMap.h @@ -4,7 +4,7 @@ #include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "SimCalorimetry/CaloSimAlgos/interface/CaloVSimParameterMap.h" -#include "SimCalorimetry/CastorSim/src/CastorSimParameters.h" +#include "SimCalorimetry/CastorSim/interface/CastorSimParameters.h" class CastorSimParameterMap : public CaloVSimParameterMap { public: diff --git a/SimCalorimetry/CastorSim/src/CastorSimParameters.h b/SimCalorimetry/CastorSim/interface/CastorSimParameters.h similarity index 100% rename from SimCalorimetry/CastorSim/src/CastorSimParameters.h rename to SimCalorimetry/CastorSim/interface/CastorSimParameters.h diff --git a/SimCalorimetry/CastorSim/plugins/CastorDigiAnalyzer.cc b/SimCalorimetry/CastorSim/plugins/CastorDigiAnalyzer.cc index ed70c08e184f2..43caf526cfc9f 100644 --- a/SimCalorimetry/CastorSim/plugins/CastorDigiAnalyzer.cc +++ b/SimCalorimetry/CastorSim/plugins/CastorDigiAnalyzer.cc @@ -1,7 +1,86 @@ +/** Castor digis + Author: Panos Katsas +*/ + +#include "CalibFormats/CaloObjects/interface/CaloSamples.h" #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "SimCalorimetry/CastorSim/plugins/CastorDigiAnalyzer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "SimCalorimetry/CaloSimAlgos/interface/CaloHitAnalyzer.h" +#include "SimCalorimetry/CaloSimAlgos/interface/CaloValidationStatistics.h" +#include "SimCalorimetry/CastorSim/interface/CastorHitFilter.h" +#include "SimCalorimetry/CastorSim/interface/CastorSimParameterMap.h" + #include +#include + +class CastorDigiStatistics { +public: + CastorDigiStatistics(std::string name, + int maxBin, + float amplitudeThreshold, + float expectedPedestal, + float binPrevToBinMax, + float binNextToBinMax, + CaloHitAnalyzer &litudeAnalyzer) + : maxBin_(maxBin), + amplitudeThreshold_(amplitudeThreshold), + pedestal_(name + " pedestal", expectedPedestal, 0.), + binPrevToBinMax_(name + " binPrevToBinMax", binPrevToBinMax, 0.), + binNextToBinMax_(name + " binNextToBinMax", binNextToBinMax, 0.), + amplitudeAnalyzer_(amplitudeAnalyzer) {} + + template + void analyze(const Digi &digi); + +private: + int maxBin_; + float amplitudeThreshold_; + CaloValidationStatistics pedestal_; + CaloValidationStatistics binPrevToBinMax_; + CaloValidationStatistics binNextToBinMax_; + CaloHitAnalyzer &litudeAnalyzer_; +}; + +template +void CastorDigiStatistics::analyze(const Digi &digi) { + pedestal_.addEntry(digi[0].adc()); + pedestal_.addEntry(digi[1].adc()); + + double pedestal_fC = 0.5 * (digi[0].nominal_fC() + digi[1].nominal_fC()); + + double maxAmplitude = digi[maxBin_].nominal_fC() - pedestal_fC; + + if (maxAmplitude > amplitudeThreshold_) { + double binPrevToBinMax = (digi[maxBin_ - 1].nominal_fC() - pedestal_fC) / maxAmplitude; + binPrevToBinMax_.addEntry(binPrevToBinMax); + + double binNextToBinMax = (digi[maxBin_ + 1].nominal_fC() - pedestal_fC) / maxAmplitude; + binNextToBinMax_.addEntry(binNextToBinMax); + + double amplitude = digi[maxBin_].nominal_fC() + digi[maxBin_ + 1].nominal_fC() - 2 * pedestal_fC; + + amplitudeAnalyzer_.analyze(digi.id().rawId(), amplitude); + } +} + +class CastorDigiAnalyzer : public edm::one::EDAnalyzer<> { +public: + explicit CastorDigiAnalyzer(edm::ParameterSet const &conf); + void analyze(edm::Event const &e, edm::EventSetup const &c) override; + +private: + std::string hitReadoutName_; + CastorSimParameterMap simParameterMap_; + CastorHitFilter castorFilter_; + CaloHitAnalyzer castorHitAnalyzer_; + CastorDigiStatistics castorDigiStatistics_; + edm::InputTag castorDigiCollectionTag_; +}; CastorDigiAnalyzer::CastorDigiAnalyzer(edm::ParameterSet const &conf) : hitReadoutName_("CastorHits"), @@ -37,3 +116,7 @@ void CastorDigiAnalyzer::analyze(edm::Event const &e, edm::EventSetup const &c) castorHitAnalyzer_.fillHits(*hits); CastorDigiAnalyzerImpl::analyze(e, castorDigiStatistics_, castorDigiCollectionTag_); } + +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(CastorDigiAnalyzer); diff --git a/SimCalorimetry/CastorSim/plugins/CastorDigiAnalyzer.h b/SimCalorimetry/CastorSim/plugins/CastorDigiAnalyzer.h deleted file mode 100644 index e717f4f737a22..0000000000000 --- a/SimCalorimetry/CastorSim/plugins/CastorDigiAnalyzer.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef CastorSim_CastorDigiAnalyzer_h -#define CastorSim_CastorDigiAnalyzer_h - -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "SimCalorimetry/CaloSimAlgos/interface/CaloHitAnalyzer.h" -#include "SimCalorimetry/CastorSim/plugins/CastorDigiStatistics.h" -#include "SimCalorimetry/CastorSim/src/CastorHitFilter.h" -#include "SimCalorimetry/CastorSim/src/CastorSimParameterMap.h" -#include - -/** Castor digis - Author: Panos Katsas -*/ - -class CastorDigiAnalyzer : public edm::one::EDAnalyzer<> { -public: - explicit CastorDigiAnalyzer(edm::ParameterSet const &conf); - void analyze(edm::Event const &e, edm::EventSetup const &c) override; - -private: - std::string hitReadoutName_; - CastorSimParameterMap simParameterMap_; - CastorHitFilter castorFilter_; - CaloHitAnalyzer castorHitAnalyzer_; - CastorDigiStatistics castorDigiStatistics_; - edm::InputTag castorDigiCollectionTag_; -}; - -#endif diff --git a/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.cc b/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.cc index 7979f2e5475a4..c2957bed41ee4 100644 --- a/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.cc +++ b/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.cc @@ -5,18 +5,92 @@ #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESWatcher.h" +#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" +#include "FWCore/Framework/interface/ProducesCollector.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Utilities/interface/RandomNumberGenerator.h" #include "FWCore/Utilities/interface/StreamID.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "SimCalorimetry/CaloSimAlgos/interface/CaloShapeIntegrator.h" #include "SimCalorimetry/CaloSimAlgos/interface/CaloTDigitizer.h" -#include "SimCalorimetry/CastorSim/plugins/CastorDigiProducer.h" +#include "SimCalorimetry/CaloSimAlgos/interface/CaloHitResponse.h" +#include "SimCalorimetry/CaloSimAlgos/interface/CaloTDigitizer.h" +#include "SimCalorimetry/CastorSim/interface/CastorAmplifier.h" +#include "SimCalorimetry/CastorSim/interface/CastorCoderFactory.h" +#include "SimCalorimetry/CastorSim/interface/CastorDigitizerTraits.h" +#include "SimCalorimetry/CastorSim/interface/CastorElectronicsSim.h" +#include "SimCalorimetry/CastorSim/interface/CastorHitCorrection.h" +#include "SimCalorimetry/CastorSim/interface/CastorHitFilter.h" +#include "SimCalorimetry/CastorSim/interface/CastorShape.h" +#include "SimCalorimetry/CastorSim/interface/CastorSimParameterMap.h" #include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h" +#include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" +#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h" #include "SimDataFormats/CrossingFrame/interface/MixCollection.h" #include "SimGeneral/MixingModule/interface/PileUpEventPrincipal.h" +#include + +namespace CLHEP { + class HepRandomEngine; +} + +class CastorDigiProducer : public DigiAccumulatorMixMod { +public: + explicit CastorDigiProducer(const edm::ParameterSet &ps, edm::ProducesCollector, edm::ConsumesCollector &iC); + ~CastorDigiProducer() override; + + void initializeEvent(edm::Event const &e, edm::EventSetup const &c) override; + void accumulate(edm::Event const &e, edm::EventSetup const &c) override; + void accumulate(PileUpEventPrincipal const &e, edm::EventSetup const &c, edm::StreamID const &) override; + void finalizeEvent(edm::Event &e, edm::EventSetup const &c) override; + +private: + void accumulateCaloHits(std::vector const &, int bunchCrossing); + + /// fills the vectors for each subdetector + void sortHits(const edm::PCaloHitContainer &hits); + /// some hits in each subdetector, just for testing purposes + void fillFakeHits(); + /// make sure the digitizer has the correct list of all cells that + /// exist in the geometry + void checkGeometry(const edm::EventSetup &eventSetup); + + edm::InputTag theHitsProducerTag; + const edm::ESGetToken theConditionsToken; + const edm::ESGetToken theGeometryToken; + edm::ESWatcher theGeometryWatcher; + + /** Reconstruction algorithm*/ + typedef CaloTDigitizer CastorDigitizer; + + CastorSimParameterMap *theParameterMap; + CaloVShape *theCastorShape; + CaloVShape *theCastorIntegratedShape; + + CaloHitResponse *theCastorResponse; + + CastorAmplifier *theAmplifier; + CastorCoderFactory *theCoderFactory; + CastorElectronicsSim *theElectronicsSim; + + CastorHitFilter theCastorHitFilter; + + CastorHitCorrection *theHitCorrection; + + CastorDigitizer *theCastorDigitizer; + + std::vector theCastorHits; + + CLHEP::HepRandomEngine *randomEngine_ = nullptr; +}; + CastorDigiProducer::CastorDigiProducer(const edm::ParameterSet &ps, edm::ProducesCollector producesCollector, edm::ConsumesCollector &iC) @@ -166,3 +240,8 @@ void CastorDigiProducer::checkGeometry(const edm::EventSetup &eventSetup) { theCastorDigitizer->setDetIds(castorCells); } } + +#include "FWCore/Framework/interface/MakerMacros.h" +#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixModFactory.h" + +DEFINE_DIGI_ACCUMULATOR(CastorDigiProducer); diff --git a/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.h b/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.h deleted file mode 100644 index 6b7e61412b315..0000000000000 --- a/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.h +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef CastorDigiProducer_h -#define CastorDigiProducer_h - -#include "CalibFormats/CastorObjects/interface/CastorDbRecord.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESWatcher.h" -#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" -#include "FWCore/Framework/interface/ProducesCollector.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "SimCalorimetry/CaloSimAlgos/interface/CaloHitResponse.h" -#include "SimCalorimetry/CaloSimAlgos/interface/CaloTDigitizer.h" -#include "SimCalorimetry/CastorSim/src/CastorAmplifier.h" -#include "SimCalorimetry/CastorSim/src/CastorCoderFactory.h" -#include "SimCalorimetry/CastorSim/src/CastorDigitizerTraits.h" -#include "SimCalorimetry/CastorSim/src/CastorElectronicsSim.h" -#include "SimCalorimetry/CastorSim/src/CastorHitCorrection.h" -#include "SimCalorimetry/CastorSim/src/CastorHitFilter.h" -#include "SimCalorimetry/CastorSim/src/CastorShape.h" -#include "SimCalorimetry/CastorSim/src/CastorSimParameterMap.h" -#include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" -#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h" - -#include - -namespace CLHEP { - class HepRandomEngine; -} - -class PCaloHit; -class PileUpEventPrincipal; - -class CastorDigiProducer : public DigiAccumulatorMixMod { -public: - explicit CastorDigiProducer(const edm::ParameterSet &ps, edm::ProducesCollector, edm::ConsumesCollector &iC); - ~CastorDigiProducer() override; - - void initializeEvent(edm::Event const &e, edm::EventSetup const &c) override; - void accumulate(edm::Event const &e, edm::EventSetup const &c) override; - void accumulate(PileUpEventPrincipal const &e, edm::EventSetup const &c, edm::StreamID const &) override; - void finalizeEvent(edm::Event &e, edm::EventSetup const &c) override; - -private: - void accumulateCaloHits(std::vector const &, int bunchCrossing); - - /// fills the vectors for each subdetector - void sortHits(const edm::PCaloHitContainer &hits); - /// some hits in each subdetector, just for testing purposes - void fillFakeHits(); - /// make sure the digitizer has the correct list of all cells that - /// exist in the geometry - void checkGeometry(const edm::EventSetup &eventSetup); - - edm::InputTag theHitsProducerTag; - const edm::ESGetToken theConditionsToken; - const edm::ESGetToken theGeometryToken; - edm::ESWatcher theGeometryWatcher; - - /** Reconstruction algorithm*/ - typedef CaloTDigitizer CastorDigitizer; - - CastorSimParameterMap *theParameterMap; - CaloVShape *theCastorShape; - CaloVShape *theCastorIntegratedShape; - - CaloHitResponse *theCastorResponse; - - CastorAmplifier *theAmplifier; - CastorCoderFactory *theCoderFactory; - CastorElectronicsSim *theElectronicsSim; - - CastorHitFilter theCastorHitFilter; - - CastorHitCorrection *theHitCorrection; - - CastorDigitizer *theCastorDigitizer; - - std::vector theCastorHits; - - CLHEP::HepRandomEngine *randomEngine_ = nullptr; -}; - -#endif diff --git a/SimCalorimetry/CastorSim/plugins/CastorDigiStatistics.h b/SimCalorimetry/CastorSim/plugins/CastorDigiStatistics.h deleted file mode 100644 index 9d82fdd537693..0000000000000 --- a/SimCalorimetry/CastorSim/plugins/CastorDigiStatistics.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef CastorSim_CastorDigiStatistics_h -#define CastorSim_CastorDigiStatistics_h - -#include "CalibFormats/CaloObjects/interface/CaloSamples.h" -#include "SimCalorimetry/CaloSimAlgos/interface/CaloHitAnalyzer.h" -#include "SimCalorimetry/CaloSimAlgos/interface/CaloValidationStatistics.h" -#include - -class CastorDigiStatistics { -public: - CastorDigiStatistics(std::string name, - int maxBin, - float amplitudeThreshold, - float expectedPedestal, - float binPrevToBinMax, - float binNextToBinMax, - CaloHitAnalyzer &litudeAnalyzer) - : maxBin_(maxBin), - amplitudeThreshold_(amplitudeThreshold), - pedestal_(name + " pedestal", expectedPedestal, 0.), - binPrevToBinMax_(name + " binPrevToBinMax", binPrevToBinMax, 0.), - binNextToBinMax_(name + " binNextToBinMax", binNextToBinMax, 0.), - amplitudeAnalyzer_(amplitudeAnalyzer) {} - - template - void analyze(const Digi &digi); - -private: - int maxBin_; - float amplitudeThreshold_; - CaloValidationStatistics pedestal_; - CaloValidationStatistics binPrevToBinMax_; - CaloValidationStatistics binNextToBinMax_; - CaloHitAnalyzer &litudeAnalyzer_; -}; - -template -void CastorDigiStatistics::analyze(const Digi &digi) { - pedestal_.addEntry(digi[0].adc()); - pedestal_.addEntry(digi[1].adc()); - - double pedestal_fC = 0.5 * (digi[0].nominal_fC() + digi[1].nominal_fC()); - - double maxAmplitude = digi[maxBin_].nominal_fC() - pedestal_fC; - - if (maxAmplitude > amplitudeThreshold_) { - double binPrevToBinMax = (digi[maxBin_ - 1].nominal_fC() - pedestal_fC) / maxAmplitude; - binPrevToBinMax_.addEntry(binPrevToBinMax); - - double binNextToBinMax = (digi[maxBin_ + 1].nominal_fC() - pedestal_fC) / maxAmplitude; - binNextToBinMax_.addEntry(binNextToBinMax); - - double amplitude = digi[maxBin_].nominal_fC() + digi[maxBin_ + 1].nominal_fC() - 2 * pedestal_fC; - - amplitudeAnalyzer_.analyze(digi.id().rawId(), amplitude); - } -} - -#endif diff --git a/SimCalorimetry/CastorSim/plugins/CastorHitAnalyzer.cc b/SimCalorimetry/CastorSim/plugins/CastorHitAnalyzer.cc index 1d5b3b02b424f..5bf94f166a6ed 100644 --- a/SimCalorimetry/CastorSim/plugins/CastorHitAnalyzer.cc +++ b/SimCalorimetry/CastorSim/plugins/CastorHitAnalyzer.cc @@ -1,7 +1,34 @@ +/** Compares RecHits to SimHit + + \Author P. Katsas, Univ. of Athens +*/ + #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "SimCalorimetry/CastorSim/plugins/CastorHitAnalyzer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "SimCalorimetry/CaloSimAlgos/interface/CaloHitAnalyzer.h" +#include "SimCalorimetry/CastorSim/interface/CastorHitFilter.h" +#include "SimCalorimetry/CastorSim/interface/CastorSimParameterMap.h" + #include +#include + +class CastorHitAnalyzer : public edm::one::EDAnalyzer<> { +public: + explicit CastorHitAnalyzer(edm::ParameterSet const &conf); + void analyze(edm::Event const &e, edm::EventSetup const &c) override; + +private: + std::string hitReadoutName_; + CastorSimParameterMap simParameterMap_; + CastorHitFilter castorFilter_; + CaloHitAnalyzer castorAnalyzer_; + edm::InputTag castorRecHitCollectionTag_; +}; CastorHitAnalyzer::CastorHitAnalyzer(edm::ParameterSet const &conf) : hitReadoutName_("CastorHits"), @@ -34,3 +61,7 @@ void CastorHitAnalyzer::analyze(edm::Event const &e, edm::EventSetup const &c) { castorAnalyzer_.fillHits(*hits); CastorHitAnalyzerImpl::analyze(e, castorAnalyzer_, castorRecHitCollectionTag_); } + +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(CastorHitAnalyzer); diff --git a/SimCalorimetry/CastorSim/plugins/CastorHitAnalyzer.h b/SimCalorimetry/CastorSim/plugins/CastorHitAnalyzer.h deleted file mode 100644 index 86fd8db0ae0b3..0000000000000 --- a/SimCalorimetry/CastorSim/plugins/CastorHitAnalyzer.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef CastorSim_CastorHitAnalyzer_h -#define CastorSim_CastorHitAnalyzer_h - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "SimCalorimetry/CaloSimAlgos/interface/CaloHitAnalyzer.h" -#include "SimCalorimetry/CastorSim/src/CastorHitFilter.h" -#include "SimCalorimetry/CastorSim/src/CastorSimParameterMap.h" -#include - -/** Compares RecHits to SimHit - - \Author P. Katsas, Univ. of Athens -*/ - -class CastorHitAnalyzer : public edm::one::EDAnalyzer<> { -public: - explicit CastorHitAnalyzer(edm::ParameterSet const &conf); - void analyze(edm::Event const &e, edm::EventSetup const &c) override; - -private: - std::string hitReadoutName_; - CastorSimParameterMap simParameterMap_; - CastorHitFilter castorFilter_; - CaloHitAnalyzer castorAnalyzer_; - edm::InputTag castorRecHitCollectionTag_; -}; - -#endif diff --git a/SimCalorimetry/CastorSim/plugins/SealModule.cc b/SimCalorimetry/CastorSim/plugins/SealModule.cc deleted file mode 100644 index ac62feb638824..0000000000000 --- a/SimCalorimetry/CastorSim/plugins/SealModule.cc +++ /dev/null @@ -1,9 +0,0 @@ -#include "FWCore/Framework/interface/MakerMacros.h" -#include "SimCalorimetry/CastorSim/plugins/CastorDigiAnalyzer.h" -#include "SimCalorimetry/CastorSim/plugins/CastorDigiProducer.h" -#include "SimCalorimetry/CastorSim/plugins/CastorHitAnalyzer.h" -#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixModFactory.h" - -DEFINE_DIGI_ACCUMULATOR(CastorDigiProducer); -DEFINE_FWK_MODULE(CastorHitAnalyzer); -DEFINE_FWK_MODULE(CastorDigiAnalyzer); diff --git a/SimCalorimetry/CastorSim/src/CastorAmplifier.cc b/SimCalorimetry/CastorSim/src/CastorAmplifier.cc index 75aac28d5829a..2aab5ecca9fc2 100644 --- a/SimCalorimetry/CastorSim/src/CastorAmplifier.cc +++ b/SimCalorimetry/CastorSim/src/CastorAmplifier.cc @@ -6,8 +6,8 @@ #include "CondFormats/CastorObjects/interface/CastorPedestalWidth.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "SimCalorimetry/CastorSim/src/CastorAmplifier.h" -#include "SimCalorimetry/CastorSim/src/CastorSimParameters.h" +#include "SimCalorimetry/CastorSim/interface/CastorAmplifier.h" +#include "SimCalorimetry/CastorSim/interface/CastorSimParameters.h" #include "CLHEP/Random/RandGaussQ.h" diff --git a/SimCalorimetry/CastorSim/src/CastorCoderFactory.cc b/SimCalorimetry/CastorSim/src/CastorCoderFactory.cc index ee01e3ab63a02..c4fc4bff6fd5f 100644 --- a/SimCalorimetry/CastorSim/src/CastorCoderFactory.cc +++ b/SimCalorimetry/CastorSim/src/CastorCoderFactory.cc @@ -1,6 +1,6 @@ #include "CalibFormats/CastorObjects/interface/CastorCoderDb.h" #include "CalibFormats/CastorObjects/interface/CastorNominalCoder.h" -#include "SimCalorimetry/CastorSim/src/CastorCoderFactory.h" +#include "SimCalorimetry/CastorSim/interface/CastorCoderFactory.h" #include CastorCoderFactory::CastorCoderFactory(CoderType coderType) : theCoderType(coderType), theDbService(nullptr) {} diff --git a/SimCalorimetry/CastorSim/src/CastorElectronicsSim.cc b/SimCalorimetry/CastorSim/src/CastorElectronicsSim.cc index fdacab15fc53e..45384a3beff7b 100644 --- a/SimCalorimetry/CastorSim/src/CastorElectronicsSim.cc +++ b/SimCalorimetry/CastorSim/src/CastorElectronicsSim.cc @@ -1,7 +1,7 @@ #include "DataFormats/HcalDigi/interface/CastorDataFrame.h" -#include "SimCalorimetry/CastorSim/src/CastorAmplifier.h" -#include "SimCalorimetry/CastorSim/src/CastorCoderFactory.h" -#include "SimCalorimetry/CastorSim/src/CastorElectronicsSim.h" +#include "SimCalorimetry/CastorSim/interface/CastorAmplifier.h" +#include "SimCalorimetry/CastorSim/interface/CastorCoderFactory.h" +#include "SimCalorimetry/CastorSim/interface/CastorElectronicsSim.h" #include "CLHEP/Random/RandFlat.h" diff --git a/SimCalorimetry/CastorSim/src/CastorHitCorrection.cc b/SimCalorimetry/CastorSim/src/CastorHitCorrection.cc index 5b39c8b516c7a..ea36db1f3ab04 100644 --- a/SimCalorimetry/CastorSim/src/CastorHitCorrection.cc +++ b/SimCalorimetry/CastorSim/src/CastorHitCorrection.cc @@ -5,7 +5,7 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/Exception.h" #include "SimCalorimetry/CaloSimAlgos/interface/CaloSimParameters.h" -#include "SimCalorimetry/CastorSim/src/CastorHitCorrection.h" +#include "SimCalorimetry/CastorSim/interface/CastorHitCorrection.h" CastorHitCorrection::CastorHitCorrection(const CaloVSimParameterMap *parameterMap) : theParameterMap(parameterMap) {} diff --git a/SimCalorimetry/CastorSim/src/CastorShape.cc b/SimCalorimetry/CastorSim/src/CastorShape.cc index 4717b388a71a7..dd1979d3a21cd 100644 --- a/SimCalorimetry/CastorSim/src/CastorShape.cc +++ b/SimCalorimetry/CastorSim/src/CastorShape.cc @@ -1,4 +1,4 @@ -#include "SimCalorimetry/CastorSim/src/CastorShape.h" +#include "SimCalorimetry/CastorSim/interface/CastorShape.h" #include CastorShape::CastorShape() : nbin_(256), nt_(nbin_, 0.) { computeShapeCastor(); } diff --git a/SimCalorimetry/CastorSim/src/CastorSimParameterMap.cc b/SimCalorimetry/CastorSim/src/CastorSimParameterMap.cc index 8cc070761a544..b0049defc8a86 100644 --- a/SimCalorimetry/CastorSim/src/CastorSimParameterMap.cc +++ b/SimCalorimetry/CastorSim/src/CastorSimParameterMap.cc @@ -2,7 +2,7 @@ #include "DataFormats/HcalDetId/interface/HcalCastorDetId.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" -#include "SimCalorimetry/CastorSim/src/CastorSimParameterMap.h" +#include "SimCalorimetry/CastorSim/interface/CastorSimParameterMap.h" #include // some arbitrary numbers for now diff --git a/SimCalorimetry/CastorSim/src/CastorSimParameters.cc b/SimCalorimetry/CastorSim/src/CastorSimParameters.cc index b03a8d6ef8f2c..39d2436abdc54 100644 --- a/SimCalorimetry/CastorSim/src/CastorSimParameters.cc +++ b/SimCalorimetry/CastorSim/src/CastorSimParameters.cc @@ -5,7 +5,7 @@ #include "DataFormats/HcalDetId/interface/HcalGenericDetId.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "SimCalorimetry/CastorSim/src/CastorSimParameters.h" +#include "SimCalorimetry/CastorSim/interface/CastorSimParameters.h" #include CastorSimParameters::CastorSimParameters(double simHitToPhotoelectrons, diff --git a/SimCalorimetry/CastorSim/test/CastorDigitizerTest.cpp b/SimCalorimetry/CastorSim/test/CastorDigitizerTest.cpp index ec9e5a28341d9..5ee928e1cc059 100644 --- a/SimCalorimetry/CastorSim/test/CastorDigitizerTest.cpp +++ b/SimCalorimetry/CastorSim/test/CastorDigitizerTest.cpp @@ -5,9 +5,9 @@ #include "SimCalorimetry/CaloSimAlgos/interface/CaloHitResponse.h" #include "SimCalorimetry/CaloSimAlgos/interface/CaloShapeIntegrator.h" #include "SimCalorimetry/CaloSimAlgos/interface/CaloTDigitizer.h" -#include "SimCalorimetry/CastorSim/src/CastorElectronicsSim.h" -#include "SimCalorimetry/CastorSim/src/CastorShape.h" -#include "SimCalorimetry/CastorSim/src/CastorSimParameterMap.h" +#include "SimCalorimetry/CastorSim/interface/CastorElectronicsSim.h" +#include "SimCalorimetry/CastorSim/interface/CastorShape.h" +#include "SimCalorimetry/CastorSim/interface/CastorSimParameterMap.h" #include "SimDataFormats/CaloHit/interface/PCaloHit.h" //#include "CalibFormats/HcalObjects/interface/HcalDbService.h" #include "CLHEP/Random/JamesRandom.h" @@ -18,11 +18,11 @@ #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "Geometry/ForwardGeometry/interface/CastorHardcodeGeometryLoader.h" #include "Geometry/HcalTowerAlgo/interface/HcalHardcodeGeometryLoader.h" -#include "SimCalorimetry/CastorSim/src/CastorAmplifier.h" -#include "SimCalorimetry/CastorSim/src/CastorCoderFactory.h" -#include "SimCalorimetry/CastorSim/src/CastorDigitizerTraits.h" -#include "SimCalorimetry/CastorSim/src/CastorHitCorrection.h" -#include "SimCalorimetry/CastorSim/src/CastorHitFilter.h" +#include "SimCalorimetry/CastorSim/interface/CastorAmplifier.h" +#include "SimCalorimetry/CastorSim/interface/CastorCoderFactory.h" +#include "SimCalorimetry/CastorSim/interface/CastorDigitizerTraits.h" +#include "SimCalorimetry/CastorSim/interface/CastorHitCorrection.h" +#include "SimCalorimetry/CastorSim/interface/CastorHitFilter.h" #include #include #include diff --git a/SimCalorimetry/EcalSimProducers/plugins/EcalCATIAGainRatiosESProducer.cc b/SimCalorimetry/EcalSimProducers/plugins/EcalCATIAGainRatiosESProducer.cc index e66d3b2b5fe9d..c3b794c647c4c 100644 --- a/SimCalorimetry/EcalSimProducers/plugins/EcalCATIAGainRatiosESProducer.cc +++ b/SimCalorimetry/EcalSimProducers/plugins/EcalCATIAGainRatiosESProducer.cc @@ -8,7 +8,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "CondFormats/DataRecord/interface/EcalCATIAGainRatiosRcd.h" #include "CondFormats/EcalObjects/interface/EcalCATIAGainRatios.h" -#include "CondFormats/EcalObjects/src/classes.h" +#include "DataFormats/EcalDigi/interface/EcalConstants.h" // // class declaration // diff --git a/SimCalorimetry/EcalSimProducers/plugins/EcalLiteDTUPedestalsESProducer.cc b/SimCalorimetry/EcalSimProducers/plugins/EcalLiteDTUPedestalsESProducer.cc index b9b18061497bf..dea13eae1282f 100644 --- a/SimCalorimetry/EcalSimProducers/plugins/EcalLiteDTUPedestalsESProducer.cc +++ b/SimCalorimetry/EcalSimProducers/plugins/EcalLiteDTUPedestalsESProducer.cc @@ -7,7 +7,6 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "CondFormats/DataRecord/interface/EcalLiteDTUPedestalsRcd.h" #include "CondFormats/EcalObjects/interface/EcalLiteDTUPedestals.h" -#include "CondFormats/EcalObjects/src/classes.h" #include "DataFormats/EcalDigi/interface/EcalConstants.h" // diff --git a/SimCalorimetry/HcalSimProducers/plugins/HcalDigiAnalyzer.cc b/SimCalorimetry/HcalSimProducers/plugins/HcalDigiAnalyzer.cc new file mode 100644 index 0000000000000..271950d8eb0f7 --- /dev/null +++ b/SimCalorimetry/HcalSimProducers/plugins/HcalDigiAnalyzer.cc @@ -0,0 +1,151 @@ +/** Studies Hcal digis + + \Author Rick Wilkinson, Caltech +*/ + +#include "CalibFormats/CaloObjects/interface/CaloSamples.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "SimCalorimetry/CaloSimAlgos/interface/CaloHitAnalyzer.h" +#include "SimCalorimetry/CaloSimAlgos/interface/CaloValidationStatistics.h" +#include "SimCalorimetry/HcalSimAlgos/interface/HcalHitFilter.h" +#include "SimCalorimetry/HcalSimAlgos/interface/HcalSimParameterMap.h" +#include "SimCalorimetry/HcalSimAlgos/interface/ZDCHitFilter.h" + +#include +#include + +class HcalDigiStatistics { +public: + HcalDigiStatistics(std::string name, + int maxBin, + float amplitudeThreshold, + float expectedPedestal, + float binPrevToBinMax, + float binNextToBinMax, + CaloHitAnalyzer &litudeAnalyzer) + : maxBin_(maxBin), + amplitudeThreshold_(amplitudeThreshold), + pedestal_(name + " pedestal", expectedPedestal, 0.), + binPrevToBinMax_(name + " binPrevToBinMax", binPrevToBinMax, 0.), + binNextToBinMax_(name + " binNextToBinMax", binNextToBinMax, 0.), + amplitudeAnalyzer_(amplitudeAnalyzer) {} + + template + void analyze(const Digi &digi); + +private: + int maxBin_; + float amplitudeThreshold_; + CaloValidationStatistics pedestal_; + CaloValidationStatistics binPrevToBinMax_; + CaloValidationStatistics binNextToBinMax_; + CaloHitAnalyzer &litudeAnalyzer_; +}; + +template +void HcalDigiStatistics::analyze(const Digi &digi) { + pedestal_.addEntry(digi[0].adc()); + pedestal_.addEntry(digi[1].adc()); + + double pedestal_fC = 0.5 * (digi[0].nominal_fC() + digi[1].nominal_fC()); + + double maxAmplitude = digi[maxBin_].nominal_fC() - pedestal_fC; + + if (maxAmplitude > amplitudeThreshold_) { + double binPrevToBinMax = (digi[maxBin_ - 1].nominal_fC() - pedestal_fC) / maxAmplitude; + binPrevToBinMax_.addEntry(binPrevToBinMax); + + double binNextToBinMax = (digi[maxBin_ + 1].nominal_fC() - pedestal_fC) / maxAmplitude; + binNextToBinMax_.addEntry(binNextToBinMax); + + double amplitude = digi[maxBin_].nominal_fC() + digi[maxBin_ + 1].nominal_fC() - 2 * pedestal_fC; + + amplitudeAnalyzer_.analyze(digi.id().rawId(), amplitude); + } +} + +class HcalDigiAnalyzer : public edm::one::EDAnalyzer<> { +public: + explicit HcalDigiAnalyzer(edm::ParameterSet const &conf); + void analyze(edm::Event const &e, edm::EventSetup const &c) override; + +private: + std::string hitReadoutName_; + HcalSimParameterMap simParameterMap_; + HBHEHitFilter hbheFilter_; + HOHitFilter hoFilter_; + HFHitFilter hfFilter_; + ZDCHitFilter zdcFilter_; + CaloHitAnalyzer hbheHitAnalyzer_; + CaloHitAnalyzer hoHitAnalyzer_; + CaloHitAnalyzer hfHitAnalyzer_; + CaloHitAnalyzer zdcHitAnalyzer_; + HcalDigiStatistics hbheDigiStatistics_; + HcalDigiStatistics hoDigiStatistics_; + HcalDigiStatistics hfDigiStatistics_; + HcalDigiStatistics zdcDigiStatistics_; + + edm::InputTag hbheDigiCollectionTag_; + edm::InputTag hoDigiCollectionTag_; + edm::InputTag hfDigiCollectionTag_; +}; + +HcalDigiAnalyzer::HcalDigiAnalyzer(edm::ParameterSet const &conf) + : hitReadoutName_("HcalHits"), + simParameterMap_(), + hbheFilter_(), + hoFilter_(), + hfFilter_(), + hbheHitAnalyzer_("HBHEDigi", 1., &simParameterMap_, &hbheFilter_), + hoHitAnalyzer_("HODigi", 1., &simParameterMap_, &hoFilter_), + hfHitAnalyzer_("HFDigi", 1., &simParameterMap_, &hfFilter_), + zdcHitAnalyzer_("ZDCDigi", 1., &simParameterMap_, &zdcFilter_), + hbheDigiStatistics_("HBHEDigi", 4, 10., 6., 0.1, 0.5, hbheHitAnalyzer_), + hoDigiStatistics_("HODigi", 4, 10., 6., 0.1, 0.5, hoHitAnalyzer_), + hfDigiStatistics_("HFDigi", 3, 10., 6., 0.1, 0.5, hfHitAnalyzer_), + zdcDigiStatistics_("ZDCDigi", 3, 10., 6., 0.1, 0.5, zdcHitAnalyzer_), + hbheDigiCollectionTag_(conf.getParameter("hbheDigiCollectionTag")), + hoDigiCollectionTag_(conf.getParameter("hoDigiCollectionTag")), + hfDigiCollectionTag_(conf.getParameter("hfDigiCollectionTag")) {} + +namespace HcalDigiAnalyzerImpl { + template + void analyze(edm::Event const &e, HcalDigiStatistics &statistics, edm::InputTag &tag) { + edm::Handle digis; + e.getByLabel(tag, digis); + for (unsigned i = 0; i < digis->size(); ++i) { + std::cout << (*digis)[i] << std::endl; + statistics.analyze((*digis)[i]); + } + } +} // namespace HcalDigiAnalyzerImpl + +void HcalDigiAnalyzer::analyze(edm::Event const &e, edm::EventSetup const &c) { + // Step A: Get Inputs + edm::Handle> cf, zdccf; + e.getByLabel("mix", "HcalHits", cf); + // e.getByLabel("mix", "ZDCHits", zdccf); + + // test access to SimHits for HcalHits and ZDC hits + std::unique_ptr> hits(new MixCollection(cf.product())); + // std::unique_ptr > zdcHits(new + // MixCollection(zdccf.product())); + hbheHitAnalyzer_.fillHits(*hits); + hoHitAnalyzer_.fillHits(*hits); + hfHitAnalyzer_.fillHits(*hits); + // zdcHitAnalyzer_.fillHits(*zdcHits); + HcalDigiAnalyzerImpl::analyze(e, hbheDigiStatistics_, hbheDigiCollectionTag_); + HcalDigiAnalyzerImpl::analyze(e, hoDigiStatistics_, hoDigiCollectionTag_); + HcalDigiAnalyzerImpl::analyze(e, hfDigiStatistics_, hfDigiCollectionTag_); + // HcalDigiAnalyzerImpl::analyze(e, zdcDigiStatistics_); +} + +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(HcalDigiAnalyzer); diff --git a/SimCalorimetry/HcalSimProducers/src/HcalHitAnalyzer.cc b/SimCalorimetry/HcalSimProducers/plugins/HcalHitAnalyzer.cc similarity index 62% rename from SimCalorimetry/HcalSimProducers/src/HcalHitAnalyzer.cc rename to SimCalorimetry/HcalSimProducers/plugins/HcalHitAnalyzer.cc index 94ba175495659..f632dc8ff3f9a 100644 --- a/SimCalorimetry/HcalSimProducers/src/HcalHitAnalyzer.cc +++ b/SimCalorimetry/HcalSimProducers/plugins/HcalHitAnalyzer.cc @@ -1,7 +1,43 @@ +/** Compares HCAL RecHits to SimHit + + \Author Rick Wilkinson, Caltech +*/ + #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "SimCalorimetry/HcalSimProducers/src/HcalHitAnalyzer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "SimCalorimetry/CaloSimAlgos/interface/CaloHitAnalyzer.h" +#include "SimCalorimetry/HcalSimAlgos/interface/HcalHitFilter.h" +#include "SimCalorimetry/HcalSimAlgos/interface/HcalSimParameterMap.h" +#include "SimCalorimetry/HcalSimAlgos/interface/ZDCHitFilter.h" + #include +#include + +class HcalHitAnalyzer : public edm::one::EDAnalyzer<> { +public: + explicit HcalHitAnalyzer(edm::ParameterSet const &conf); + void analyze(edm::Event const &e, edm::EventSetup const &c) override; + +private: + HcalSimParameterMap simParameterMap_; + HBHEHitFilter hbheFilter_; + HOHitFilter hoFilter_; + HFHitFilter hfFilter_; + ZDCHitFilter zdcFilter_; + CaloHitAnalyzer hbheAnalyzer_; + CaloHitAnalyzer hoAnalyzer_; + CaloHitAnalyzer hfAnalyzer_; + CaloHitAnalyzer zdcAnalyzer_; + + edm::InputTag hbheRecHitCollectionTag_; + edm::InputTag hoRecHitCollectionTag_; + edm::InputTag hfRecHitCollectionTag_; +}; HcalHitAnalyzer::HcalHitAnalyzer(edm::ParameterSet const &conf) : simParameterMap_(conf), @@ -47,3 +83,7 @@ void HcalHitAnalyzer::analyze(edm::Event const &e, edm::EventSetup const &c) { HcalHitAnalyzerImpl::analyze(e, hfAnalyzer_, hfRecHitCollectionTag_); // HcalHitAnalyzerImpl::analyze(e, zdcAnalyzer_); } + +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(HcalHitAnalyzer); diff --git a/SimCalorimetry/HcalSimProducers/plugins/SealModule.cc b/SimCalorimetry/HcalSimProducers/plugins/SealModule.cc index 011759fa42e9c..3f378269a275f 100644 --- a/SimCalorimetry/HcalSimProducers/plugins/SealModule.cc +++ b/SimCalorimetry/HcalSimProducers/plugins/SealModule.cc @@ -1,9 +1,5 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "SimCalorimetry/HcalSimProducers/interface/HcalDigiProducer.h" -#include "SimCalorimetry/HcalSimProducers/src/HcalDigiAnalyzer.h" -#include "SimCalorimetry/HcalSimProducers/src/HcalHitAnalyzer.h" #include "SimGeneral/MixingModule/interface/DigiAccumulatorMixModFactory.h" -DEFINE_FWK_MODULE(HcalHitAnalyzer); -DEFINE_FWK_MODULE(HcalDigiAnalyzer); DEFINE_DIGI_ACCUMULATOR(HcalDigiProducer); diff --git a/SimCalorimetry/HcalSimProducers/src/HcalDigiAnalyzer.cc b/SimCalorimetry/HcalSimProducers/src/HcalDigiAnalyzer.cc deleted file mode 100644 index 97ba9eff7c788..0000000000000 --- a/SimCalorimetry/HcalSimProducers/src/HcalDigiAnalyzer.cc +++ /dev/null @@ -1,54 +0,0 @@ -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "SimCalorimetry/HcalSimProducers/src/HcalDigiAnalyzer.h" -#include - -HcalDigiAnalyzer::HcalDigiAnalyzer(edm::ParameterSet const &conf) - : hitReadoutName_("HcalHits"), - simParameterMap_(), - hbheFilter_(), - hoFilter_(), - hfFilter_(), - hbheHitAnalyzer_("HBHEDigi", 1., &simParameterMap_, &hbheFilter_), - hoHitAnalyzer_("HODigi", 1., &simParameterMap_, &hoFilter_), - hfHitAnalyzer_("HFDigi", 1., &simParameterMap_, &hfFilter_), - zdcHitAnalyzer_("ZDCDigi", 1., &simParameterMap_, &zdcFilter_), - hbheDigiStatistics_("HBHEDigi", 4, 10., 6., 0.1, 0.5, hbheHitAnalyzer_), - hoDigiStatistics_("HODigi", 4, 10., 6., 0.1, 0.5, hoHitAnalyzer_), - hfDigiStatistics_("HFDigi", 3, 10., 6., 0.1, 0.5, hfHitAnalyzer_), - zdcDigiStatistics_("ZDCDigi", 3, 10., 6., 0.1, 0.5, zdcHitAnalyzer_), - hbheDigiCollectionTag_(conf.getParameter("hbheDigiCollectionTag")), - hoDigiCollectionTag_(conf.getParameter("hoDigiCollectionTag")), - hfDigiCollectionTag_(conf.getParameter("hfDigiCollectionTag")) {} - -namespace HcalDigiAnalyzerImpl { - template - void analyze(edm::Event const &e, HcalDigiStatistics &statistics, edm::InputTag &tag) { - edm::Handle digis; - e.getByLabel(tag, digis); - for (unsigned i = 0; i < digis->size(); ++i) { - std::cout << (*digis)[i] << std::endl; - statistics.analyze((*digis)[i]); - } - } -} // namespace HcalDigiAnalyzerImpl - -void HcalDigiAnalyzer::analyze(edm::Event const &e, edm::EventSetup const &c) { - // Step A: Get Inputs - edm::Handle> cf, zdccf; - e.getByLabel("mix", "HcalHits", cf); - // e.getByLabel("mix", "ZDCHits", zdccf); - - // test access to SimHits for HcalHits and ZDC hits - std::unique_ptr> hits(new MixCollection(cf.product())); - // std::unique_ptr > zdcHits(new - // MixCollection(zdccf.product())); - hbheHitAnalyzer_.fillHits(*hits); - hoHitAnalyzer_.fillHits(*hits); - hfHitAnalyzer_.fillHits(*hits); - // zdcHitAnalyzer_.fillHits(*zdcHits); - HcalDigiAnalyzerImpl::analyze(e, hbheDigiStatistics_, hbheDigiCollectionTag_); - HcalDigiAnalyzerImpl::analyze(e, hoDigiStatistics_, hoDigiCollectionTag_); - HcalDigiAnalyzerImpl::analyze(e, hfDigiStatistics_, hfDigiCollectionTag_); - // HcalDigiAnalyzerImpl::analyze(e, zdcDigiStatistics_); -} diff --git a/SimCalorimetry/HcalSimProducers/src/HcalDigiAnalyzer.h b/SimCalorimetry/HcalSimProducers/src/HcalDigiAnalyzer.h deleted file mode 100644 index 21362e42457a3..0000000000000 --- a/SimCalorimetry/HcalSimProducers/src/HcalDigiAnalyzer.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef HcalSimProducers_HcalDigiAnalyzer_h -#define HcalSimProducers_HcalDigiAnalyzer_h - -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "SimCalorimetry/CaloSimAlgos/interface/CaloHitAnalyzer.h" -#include "SimCalorimetry/HcalSimAlgos/interface/HcalHitFilter.h" -#include "SimCalorimetry/HcalSimAlgos/interface/HcalSimParameterMap.h" -#include "SimCalorimetry/HcalSimAlgos/interface/ZDCHitFilter.h" -#include "SimCalorimetry/HcalSimProducers/src/HcalDigiStatistics.h" -#include - -/** Studies Hcal digis - - \Author Rick Wilkinson, Caltech -*/ - -class HcalDigiAnalyzer : public edm::one::EDAnalyzer<> { -public: - explicit HcalDigiAnalyzer(edm::ParameterSet const &conf); - void analyze(edm::Event const &e, edm::EventSetup const &c) override; - -private: - std::string hitReadoutName_; - HcalSimParameterMap simParameterMap_; - HBHEHitFilter hbheFilter_; - HOHitFilter hoFilter_; - HFHitFilter hfFilter_; - ZDCHitFilter zdcFilter_; - CaloHitAnalyzer hbheHitAnalyzer_; - CaloHitAnalyzer hoHitAnalyzer_; - CaloHitAnalyzer hfHitAnalyzer_; - CaloHitAnalyzer zdcHitAnalyzer_; - HcalDigiStatistics hbheDigiStatistics_; - HcalDigiStatistics hoDigiStatistics_; - HcalDigiStatistics hfDigiStatistics_; - HcalDigiStatistics zdcDigiStatistics_; - - edm::InputTag hbheDigiCollectionTag_; - edm::InputTag hoDigiCollectionTag_; - edm::InputTag hfDigiCollectionTag_; -}; - -#endif diff --git a/SimCalorimetry/HcalSimProducers/src/HcalDigiStatistics.h b/SimCalorimetry/HcalSimProducers/src/HcalDigiStatistics.h deleted file mode 100644 index f652db769c8fe..0000000000000 --- a/SimCalorimetry/HcalSimProducers/src/HcalDigiStatistics.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef HcalSimProducers_HcalDigiStatistics_h -#define HcalSimProducers_HcalDigiStatistics_h - -#include "CalibFormats/CaloObjects/interface/CaloSamples.h" -#include "SimCalorimetry/CaloSimAlgos/interface/CaloHitAnalyzer.h" -#include "SimCalorimetry/CaloSimAlgos/interface/CaloValidationStatistics.h" -#include - -class HcalDigiStatistics { -public: - HcalDigiStatistics(std::string name, - int maxBin, - float amplitudeThreshold, - float expectedPedestal, - float binPrevToBinMax, - float binNextToBinMax, - CaloHitAnalyzer &litudeAnalyzer) - : maxBin_(maxBin), - amplitudeThreshold_(amplitudeThreshold), - pedestal_(name + " pedestal", expectedPedestal, 0.), - binPrevToBinMax_(name + " binPrevToBinMax", binPrevToBinMax, 0.), - binNextToBinMax_(name + " binNextToBinMax", binNextToBinMax, 0.), - amplitudeAnalyzer_(amplitudeAnalyzer) {} - - template - void analyze(const Digi &digi); - -private: - int maxBin_; - float amplitudeThreshold_; - CaloValidationStatistics pedestal_; - CaloValidationStatistics binPrevToBinMax_; - CaloValidationStatistics binNextToBinMax_; - CaloHitAnalyzer &litudeAnalyzer_; -}; - -template -void HcalDigiStatistics::analyze(const Digi &digi) { - pedestal_.addEntry(digi[0].adc()); - pedestal_.addEntry(digi[1].adc()); - - double pedestal_fC = 0.5 * (digi[0].nominal_fC() + digi[1].nominal_fC()); - - double maxAmplitude = digi[maxBin_].nominal_fC() - pedestal_fC; - - if (maxAmplitude > amplitudeThreshold_) { - double binPrevToBinMax = (digi[maxBin_ - 1].nominal_fC() - pedestal_fC) / maxAmplitude; - binPrevToBinMax_.addEntry(binPrevToBinMax); - - double binNextToBinMax = (digi[maxBin_ + 1].nominal_fC() - pedestal_fC) / maxAmplitude; - binNextToBinMax_.addEntry(binNextToBinMax); - - double amplitude = digi[maxBin_].nominal_fC() + digi[maxBin_ + 1].nominal_fC() - 2 * pedestal_fC; - - amplitudeAnalyzer_.analyze(digi.id().rawId(), amplitude); - } -} - -#endif diff --git a/SimCalorimetry/HcalSimProducers/src/HcalHitAnalyzer.h b/SimCalorimetry/HcalSimProducers/src/HcalHitAnalyzer.h deleted file mode 100644 index 5c37f61732b5b..0000000000000 --- a/SimCalorimetry/HcalSimProducers/src/HcalHitAnalyzer.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef HcalSimProducers_HcalHitAnalyzer_h -#define HcalSimProducers_HcalHitAnalyzer_h - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "SimCalorimetry/CaloSimAlgos/interface/CaloHitAnalyzer.h" -#include "SimCalorimetry/HcalSimAlgos/interface/HcalHitFilter.h" -#include "SimCalorimetry/HcalSimAlgos/interface/HcalSimParameterMap.h" -#include "SimCalorimetry/HcalSimAlgos/interface/ZDCHitFilter.h" -#include - -/** Compares HCAL RecHits to SimHit - - \Author Rick Wilkinson, Caltech -*/ - -class HcalHitAnalyzer : public edm::one::EDAnalyzer<> { -public: - explicit HcalHitAnalyzer(edm::ParameterSet const &conf); - void analyze(edm::Event const &e, edm::EventSetup const &c) override; - -private: - HcalSimParameterMap simParameterMap_; - HBHEHitFilter hbheFilter_; - HOHitFilter hoFilter_; - HFHitFilter hfFilter_; - ZDCHitFilter zdcFilter_; - CaloHitAnalyzer hbheAnalyzer_; - CaloHitAnalyzer hoAnalyzer_; - CaloHitAnalyzer hfAnalyzer_; - CaloHitAnalyzer zdcAnalyzer_; - - edm::InputTag hbheRecHitCollectionTag_; - edm::InputTag hoRecHitCollectionTag_; - edm::InputTag hfRecHitCollectionTag_; -}; - -#endif diff --git a/SimG4CMS/Calo/BuildFile.xml b/SimG4CMS/Calo/BuildFile.xml index b6bda3c62bb7a..7b5daa8b441ab 100644 --- a/SimG4CMS/Calo/BuildFile.xml +++ b/SimG4CMS/Calo/BuildFile.xml @@ -8,13 +8,13 @@ - + diff --git a/SimG4CMS/Calo/interface/CaloG4Hit.h b/SimG4CMS/Calo/interface/CaloG4Hit.h index f96f2e7d4986e..2f1727ee451b0 100644 --- a/SimG4CMS/Calo/interface/CaloG4Hit.h +++ b/SimG4CMS/Calo/interface/CaloG4Hit.h @@ -67,6 +67,7 @@ class CaloG4Hit : public G4VHit { double getTimeSlice() const { return hitID.timeSlice(); } int getTimeSliceID() const { return hitID.timeSliceID(); } uint16_t getDepth() const { return hitID.depth(); } + bool isFinecaloTrackID() const { return hitID.isFinecaloTrackID(); } CaloHitID getID() const { return hitID; } void setID(uint32_t i, double d, int j, uint16_t k = 0) { hitID.setID(i, d, j, k); } @@ -98,8 +99,6 @@ class CaloG4HitLess { return (a->getUnitID() < b->getUnitID()); } else if (a->getDepth() != b->getDepth()) { return (a->getDepth() < b->getDepth()); - } else if (a->getID().fineTrackID() != b->getID().fineTrackID()) { - return (a->getID().fineTrackID() < b->getID().fineTrackID()); } else { return (a->getTimeSliceID() < b->getTimeSliceID()); } @@ -110,7 +109,7 @@ class CaloG4HitEqual { public: bool operator()(const CaloG4Hit* a, const CaloG4Hit* b) { return (a->getTrackID() == b->getTrackID() && a->getUnitID() == b->getUnitID() && a->getDepth() == b->getDepth() && - a->getTimeSliceID() == b->getTimeSliceID() && a->getID().fineTrackID() == b->getID().fineTrackID()); + a->getTimeSliceID() == b->getTimeSliceID()); } }; diff --git a/SimG4CMS/Calo/interface/CaloHitID.h b/SimG4CMS/Calo/interface/CaloHitID.h index d44a4b61f79f5..12d6a68010515 100644 --- a/SimG4CMS/Calo/interface/CaloHitID.h +++ b/SimG4CMS/Calo/interface/CaloHitID.h @@ -26,9 +26,8 @@ class CaloHitID { void reset(); void setTrackID(int trackID) { theTrackID = trackID; } - bool hasFineTrackID() const { return theFineTrackID != -1; } - void setFineTrackID(int fineTrackID) { theFineTrackID = fineTrackID; } - int fineTrackID() const { return hasFineTrackID() ? theFineTrackID : theTrackID; } + void markAsFinecaloTrackID(bool flag = true) { isFinecaloTrackID_ = flag; } + bool isFinecaloTrackID() const { return isFinecaloTrackID_; } bool operator==(const CaloHitID&) const; bool operator<(const CaloHitID&) const; @@ -42,7 +41,7 @@ class CaloHitID { uint16_t theDepth; float timeSliceUnit; bool ignoreTrackID; - int theFineTrackID; + bool isFinecaloTrackID_; }; std::ostream& operator<<(std::ostream&, const CaloHitID&); diff --git a/SimG4CMS/Calo/interface/CaloSD.h b/SimG4CMS/Calo/interface/CaloSD.h index 5b061f291bfa7..65c97ba1bffa3 100644 --- a/SimG4CMS/Calo/interface/CaloSD.h +++ b/SimG4CMS/Calo/interface/CaloSD.h @@ -28,6 +28,7 @@ #include #include +#include #include class G4Step; @@ -85,7 +86,9 @@ class CaloSD : public SensitiveCaloDetector, double getAttenuation(const G4Step* aStep, double birk1, double birk2, double birk3) const; static std::string printableDecayChain(const std::vector& decayChain); - void hitBookkeepingFineCalo(const G4Step* step, const G4Track* currentTrack, CaloG4Hit* hit); + std::string shortreprID(const CaloHitID& ID); + std::string shortreprID(const CaloG4Hit* hit); + unsigned int findBoundaryCrossingParent(const G4Track* track, bool markParentAsSaveable = true); void update(const BeginOfRun*) override; void update(const BeginOfEvent*) override; @@ -183,8 +186,10 @@ class CaloSD : public SensitiveCaloDetector, std::map hitMap; std::map tkMap; + std::unordered_map boundaryCrossingParentMap_; std::vector> reusehit; std::vector fineDetectors_; + bool doFineCaloThisStep_; }; #endif // SimG4CMS_CaloSD_h diff --git a/SimG4CMS/Calo/interface/CaloSteppingAction.h b/SimG4CMS/Calo/interface/CaloSteppingAction.h deleted file mode 100644 index 94e2c8aeed0b0..0000000000000 --- a/SimG4CMS/Calo/interface/CaloSteppingAction.h +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef SimG4CMS_CaloSteppingAction_H -#define SimG4CMS_CaloSteppingAction_H -//#define HcalNumberingTest - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/Event.h" -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/Math/interface/Point3D.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/PluginManager/interface/ModuleDef.h" - -#include "SimG4Core/Notification/interface/Observer.h" -#include "SimG4Core/Notification/interface/BeginOfJob.h" -#include "SimG4Core/Notification/interface/BeginOfRun.h" -#include "SimG4Core/Notification/interface/BeginOfEvent.h" -#include "SimG4Core/Notification/interface/EndOfEvent.h" -#include "SimG4Core/Watcher/interface/SimProducer.h" -#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" - -#include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" -#include "SimDataFormats/CaloHit/interface/PassiveHit.h" -#include "SimDataFormats/SimHitMaker/interface/CaloSlaveSD.h" - -#include "SimG4CMS/Calo/interface/CaloGVHit.h" -#include "SimG4CMS/Calo/interface/HcalNumberingScheme.h" -#include "SimG4CMS/Calo/interface/HcalNumberingFromPS.h" - -#include "Geometry/EcalCommonData/interface/EcalBarrelNumberingScheme.h" -#include "Geometry/EcalCommonData/interface/EcalBaseNumber.h" -#include "Geometry/EcalCommonData/interface/EcalEndcapNumberingScheme.h" -#ifdef HcalNumberingTest -#include "Geometry/HcalCommonData/interface/HcalNumberingFromDDD.h" -#include "Geometry/HcalCommonData/interface/HcalDDDSimConstants.h" -#endif - -#include "G4LogicalVolume.hh" -#include "G4Region.hh" -#include "G4Step.hh" -#include "G4UserSteppingAction.hh" -#include "G4VPhysicalVolume.hh" -#include "G4VTouchable.hh" -#include "G4Track.hh" - -#include -#include -#include -#include -#include -#include - -class CaloSteppingAction : public SimProducer, - public Observer, - public Observer, - public Observer, - public Observer, - public Observer { -public: - CaloSteppingAction(const edm::ParameterSet &p); - ~CaloSteppingAction() override; - - void produce(edm::Event &, const edm::EventSetup &) override; - -private: - void fillHits(edm::PCaloHitContainer &cc, int type); - void fillPassiveHits(edm::PassiveHitContainer &cc); - // observer classes - void update(const BeginOfJob *job) override; - void update(const BeginOfRun *run) override; - void update(const BeginOfEvent *evt) override; - void update(const G4Step *step) override; - void update(const EndOfEvent *evt) override; - - void NaNTrap(const G4Step *) const; - uint32_t getDetIDHC(int det, int lay, int depth, const math::XYZVectorD &pos) const; - void fillHit(uint32_t id, double dE, double time, int primID, uint16_t depth, double em, int flag); - uint16_t getDepth(bool flag, double crystalDepth, double radl) const; - double curve_LY(double crystalLength, double crystalDepth) const; - double getBirkL3(double dE, double step, double chg, double dens) const; - double getBirkHC(double dE, double step, double chg, double dens) const; - void saveHits(int flag); - - static const int nSD_ = 3; - std::unique_ptr ebNumberingScheme_; - std::unique_ptr eeNumberingScheme_; - std::unique_ptr hcNumberingPS_; -#ifdef HcalNumberingTest - std::unique_ptr hcNumbering_; -#endif - std::unique_ptr hcNumberingScheme_; - std::unique_ptr slave_[nSD_]; - - std::vector nameEBSD_, nameEESD_, nameHCSD_; - std::vector nameHitC_; - std::vector volEBSD_, volEESD_, volHCSD_; - std::map xtalMap_; - std::map mapLV_; - int allSteps_, count_, eventID_; - double slopeLY_, birkC1EC_, birkSlopeEC_; - double birkCutEC_, birkC1HC_, birkC2HC_; - double birkC3HC_, timeSliceUnit_; - std::map, CaloGVHit> hitMap_[nSD_]; - typedef std::tuple - PassiveData; - std::vector store_; -}; - -#endif diff --git a/SimG4CMS/Calo/interface/HcalTestAnalysis.h b/SimG4CMS/Calo/interface/HcalTestAnalysis.h deleted file mode 100644 index c3c2329eee215..0000000000000 --- a/SimG4CMS/Calo/interface/HcalTestAnalysis.h +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef SimG4CMS_HcalTestAnalysis_H -#define SimG4CMS_HcalTestAnalysis_H -/////////////////////////////////////////////////////////////////////////////// -// File: HcalTestAnalysis.h -// Analysis of simhits inside the OSCAR framework -/////////////////////////////////////////////////////////////////////////////// - -#include "SimG4Core/Notification/interface/Observer.h" -#include "SimG4Core/Watcher/interface/SimWatcher.h" - -#include "SimDataFormats/CaloHit/interface/CaloHit.h" -#include "SimDataFormats/CaloTest/interface/HcalTestHistoClass.h" -#include "SimG4CMS/Calo/interface/HcalQie.h" -#include "SimG4CMS/Calo/interface/HcalTestHistoManager.h" -#include "SimG4CMS/Calo/interface/HcalTestNumberingScheme.h" -#include "Geometry/HcalCommonData/interface/HcalNumberingFromDDD.h" -#include "Geometry/HcalCommonData/interface/HcalDDDSimConstants.h" - -#include -#include -#include -#include - -class G4Step; -class BeginOfJob; -class BeginOfRun; -class BeginOfEvent; -class EndOfEvent; - -namespace CLHEP { - class HepRandomEngine; -} - -class HcalTestAnalysis : public SimWatcher, - public Observer, - public Observer, - public Observer, - public Observer, - public Observer { -public: - HcalTestAnalysis(const edm::ParameterSet &p); - ~HcalTestAnalysis() override; - -private: - // observer classes - void update(const BeginOfJob *run) override; - void update(const BeginOfRun *run) override; - void update(const BeginOfEvent *evt) override; - void update(const EndOfEvent *evt) override; - void update(const G4Step *step) override; - - // analysis-related stuff - std::vector layerGrouping(int); - std::vector towersToAdd(int centre, int nadd); - void fill(const EndOfEvent *ev); - void qieAnalysis(CLHEP::HepRandomEngine *); - void layerAnalysis(); - double timeOfFlight(int det, int layer, double eta); - -private: - //Keep parameters to instantiate HcalTestHistoClass later - std::string fileName_; - - // Qie Analysis - std::unique_ptr myqie_; - int addTower_; - - // Private Tuples - std::unique_ptr tuplesManager_; - HcalTestHistoClass *tuples_; - - // Numbering scheme - std::unique_ptr numberingFromDDD_; - const HcalDDDSimConstants *hcons_; - HcalTestNumberingScheme *org_; - - // Hits for qie analysis - std::vector caloHitCache_; - std::vector group_, tower_; - int nGroup_, nTower_; - - // to read from ParameterSet - std::vector names_; - double eta0_, phi0_; - int centralTower_; - - // some private members for ananlysis - unsigned int count_; - double edepEB_, edepEE_, edepHB_, edepHE_; - double edepHO_, edepl_[20]; - double mudist_[20]; // Distance of muon from central part -}; - -#endif diff --git a/SimG4CMS/Calo/plugins/BuildFile.xml b/SimG4CMS/Calo/plugins/BuildFile.xml index f75182a06fe4b..041a8a5ec0472 100644 --- a/SimG4CMS/Calo/plugins/BuildFile.xml +++ b/SimG4CMS/Calo/plugins/BuildFile.xml @@ -1,4 +1,5 @@ + @@ -10,6 +11,7 @@ + diff --git a/SimG4CMS/Calo/src/CaloSteppingAction.cc b/SimG4CMS/Calo/plugins/CaloSteppingAction.cc similarity index 83% rename from SimG4CMS/Calo/src/CaloSteppingAction.cc rename to SimG4CMS/Calo/plugins/CaloSteppingAction.cc index 34c753b64f7df..02af73acc6c5b 100644 --- a/SimG4CMS/Calo/src/CaloSteppingAction.cc +++ b/SimG4CMS/Calo/plugins/CaloSteppingAction.cc @@ -1,34 +1,126 @@ +//#define EDM_ML_DEBUG +//#define HcalNumberingTest + // to make hits in EB/EE/HC -#include "SimG4CMS/Calo/interface/CaloSteppingAction.h" -#include "SimG4Core/Notification/interface/G4TrackToParticleID.h" +#include "DataFormats/Common/interface/Handle.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "SimDataFormats/CaloHit/interface/PCaloHit.h" -#ifdef HcalNumberingTest -#include "Geometry/HcalCommonData/interface/HcalDDDSimConstants.h" -#include "Geometry/Records/interface/HcalSimNumberingRecord.h" -#endif +#include "DataFormats/Math/interface/Point3D.h" +#include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/isFinite.h" #include "FWCore/Utilities/interface/Exception.h" +#include "Geometry/EcalCommonData/interface/EcalBarrelNumberingScheme.h" +#include "Geometry/EcalCommonData/interface/EcalBaseNumber.h" +#include "Geometry/EcalCommonData/interface/EcalEndcapNumberingScheme.h" +#ifdef HcalNumberingTest +#include "Geometry/HcalCommonData/interface/HcalNumberingFromDDD.h" +#include "Geometry/HcalCommonData/interface/HcalDDDSimConstants.h" +#include "Geometry/Records/interface/HcalSimNumberingRecord.h" +#endif + +#include "SimDataFormats/CaloHit/interface/PCaloHit.h" +#include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" +#include "SimDataFormats/CaloHit/interface/PassiveHit.h" +#include "SimDataFormats/SimHitMaker/interface/CaloSlaveSD.h" + +#include "SimG4CMS/Calo/interface/CaloGVHit.h" +#include "SimG4CMS/Calo/interface/HcalNumberingScheme.h" +#include "SimG4CMS/Calo/interface/HcalNumberingFromPS.h" + +#include "SimG4Core/Notification/interface/G4TrackToParticleID.h" +#include "SimG4Core/Notification/interface/Observer.h" +#include "SimG4Core/Notification/interface/BeginOfJob.h" +#include "SimG4Core/Notification/interface/BeginOfRun.h" +#include "SimG4Core/Notification/interface/BeginOfEvent.h" +#include "SimG4Core/Notification/interface/EndOfEvent.h" +#include "SimG4Core/Watcher/interface/SimProducer.h" +#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" + +#include "G4LogicalVolume.hh" #include "G4LogicalVolumeStore.hh" #include "G4NavigationHistory.hh" #include "G4ParticleTable.hh" #include "G4PhysicalVolumeStore.hh" +#include "G4Region.hh" #include "G4RegionStore.hh" +#include "G4Step.hh" +#include "G4SystemOfUnits.hh" +#include "G4Track.hh" #include "G4Trap.hh" #include "G4UnitsTable.hh" -#include "G4SystemOfUnits.hh" +#include "G4UserSteppingAction.hh" +#include "G4VPhysicalVolume.hh" +#include "G4VTouchable.hh" +#include #include #include #include +#include +#include +#include -//#define EDM_ML_DEBUG +class CaloSteppingAction : public SimProducer, + public Observer, + public Observer, + public Observer, + public Observer, + public Observer { +public: + CaloSteppingAction(const edm::ParameterSet& p); + ~CaloSteppingAction() override; + + void produce(edm::Event&, const edm::EventSetup&) override; + +private: + void fillHits(edm::PCaloHitContainer& cc, int type); + void fillPassiveHits(edm::PassiveHitContainer& cc); + // observer classes + void update(const BeginOfJob* job) override; + void update(const BeginOfRun* run) override; + void update(const BeginOfEvent* evt) override; + void update(const G4Step* step) override; + void update(const EndOfEvent* evt) override; + + void NaNTrap(const G4Step*) const; + uint32_t getDetIDHC(int det, int lay, int depth, const math::XYZVectorD& pos) const; + void fillHit(uint32_t id, double dE, double time, int primID, uint16_t depth, double em, int flag); + uint16_t getDepth(bool flag, double crystalDepth, double radl) const; + double curve_LY(double crystalLength, double crystalDepth) const; + double getBirkL3(double dE, double step, double chg, double dens) const; + double getBirkHC(double dE, double step, double chg, double dens) const; + void saveHits(int flag); + + static const int nSD_ = 3; + std::unique_ptr ebNumberingScheme_; + std::unique_ptr eeNumberingScheme_; + std::unique_ptr hcNumberingPS_; +#ifdef HcalNumberingTest + std::unique_ptr hcNumbering_; +#endif + std::unique_ptr hcNumberingScheme_; + std::unique_ptr slave_[nSD_]; + + std::vector nameEBSD_, nameEESD_, nameHCSD_; + std::vector nameHitC_; + std::vector volEBSD_, volEESD_, volHCSD_; + std::map xtalMap_; + std::map mapLV_; + int allSteps_, count_, eventID_; + double slopeLY_, birkC1EC_, birkSlopeEC_; + double birkCutEC_, birkC1HC_, birkC2HC_; + double birkC3HC_, timeSliceUnit_; + std::map, CaloGVHit> hitMap_[nSD_]; + typedef std::tuple + PassiveData; + std::vector store_; +}; CaloSteppingAction::CaloSteppingAction(const edm::ParameterSet& p) : count_(0) { edm::ParameterSet iC = p.getParameter("CaloSteppingAction"); @@ -452,3 +544,8 @@ void CaloSteppingAction::saveHits(int type) { hit.second.getDepth()); } } + +#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" + +DEFINE_SIMWATCHER(CaloSteppingAction); diff --git a/SimG4CMS/Calo/plugins/HFPMTHitAnalyzer.cc b/SimG4CMS/Calo/plugins/HFPMTHitAnalyzer.cc index 6651959849d85..0a73d425c7bc5 100644 --- a/SimG4CMS/Calo/plugins/HFPMTHitAnalyzer.cc +++ b/SimG4CMS/Calo/plugins/HFPMTHitAnalyzer.cc @@ -203,7 +203,7 @@ void HFPMTHitAnalyzer::beginJob() { void HFPMTHitAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { ++event_no; if (event_no % 500 == 0) - std::cout << "Event # " << event_no << " processed.\n"; + edm::LogVerbatim("HcalSim") << "Event # " << event_no << " processed."; std::vector caloHits; edm::Handle hitsHcal; diff --git a/SimG4CMS/Calo/plugins/HOSimHitStudy.cc b/SimG4CMS/Calo/plugins/HOSimHitStudy.cc index 10c6b7f378de5..7a3af2fdd1cb2 100644 --- a/SimG4CMS/Calo/plugins/HOSimHitStudy.cc +++ b/SimG4CMS/Calo/plugins/HOSimHitStudy.cc @@ -22,8 +22,8 @@ #include "SimG4CMS/Calo/interface/CaloHitID.h" #include "SimG4CMS/Calo/interface/HcalTestNumberingScheme.h" -#include "CLHEP/Units/GlobalPhysicalConstants.h" -#include "CLHEP/Units/GlobalSystemOfUnits.h" +#include +#include #include #include diff --git a/SimG4CMS/Calo/src/HcalTestAnalysis.cc b/SimG4CMS/Calo/plugins/HcalTestAnalysis.cc similarity index 89% rename from SimG4CMS/Calo/src/HcalTestAnalysis.cc rename to SimG4CMS/Calo/plugins/HcalTestAnalysis.cc index 7089c070daacf..6437d5b46555a 100644 --- a/SimG4CMS/Calo/src/HcalTestAnalysis.cc +++ b/SimG4CMS/Calo/plugins/HcalTestAnalysis.cc @@ -2,32 +2,104 @@ #include "SimG4Core/Notification/interface/BeginOfRun.h" #include "SimG4Core/Notification/interface/BeginOfEvent.h" #include "SimG4Core/Notification/interface/EndOfEvent.h" +#include "SimG4Core/Notification/interface/Observer.h" +#include "SimG4Core/Watcher/interface/SimWatcher.h" // to retreive hits #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" -#include "SimG4CMS/Calo/interface/HcalTestAnalysis.h" -#include "SimG4CMS/Calo/interface/HCalSD.h" -#include "SimG4CMS/Calo/interface/CaloG4Hit.h" -#include "SimG4CMS/Calo/interface/CaloG4HitCollection.h" #include "DataFormats/Math/interface/Point3D.h" +#include "SimDataFormats/CaloHit/interface/CaloHit.h" +#include "SimDataFormats/CaloTest/interface/HcalTestHistoClass.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESHandle.h" + +#include "Geometry/HcalCommonData/interface/HcalNumberingFromDDD.h" +#include "Geometry/HcalCommonData/interface/HcalDDDSimConstants.h" #include "Geometry/Records/interface/HcalSimNumberingRecord.h" +#include "SimG4CMS/Calo/interface/CaloG4Hit.h" +#include "SimG4CMS/Calo/interface/CaloG4HitCollection.h" +#include "SimG4CMS/Calo/interface/HCalSD.h" +#include "SimG4CMS/Calo/interface/HcalQie.h" +#include "SimG4CMS/Calo/interface/HcalTestHistoManager.h" +#include "SimG4CMS/Calo/interface/HcalTestNumberingScheme.h" + #include "G4SDManager.hh" #include "G4Step.hh" #include "G4Track.hh" #include "G4VProcess.hh" #include "G4HCofThisEvent.hh" -#include "CLHEP/Units/GlobalSystemOfUnits.h" -#include "CLHEP/Units/GlobalPhysicalConstants.h" -#include "Randomize.hh" + +#include +#include +#include #include #include #include -#include +#include +#include + +class HcalTestAnalysis : public SimWatcher, + public Observer, + public Observer, + public Observer, + public Observer, + public Observer { +public: + HcalTestAnalysis(const edm::ParameterSet& p); + ~HcalTestAnalysis() override; + +private: + // observer classes + void update(const BeginOfJob* run) override; + void update(const BeginOfRun* run) override; + void update(const BeginOfEvent* evt) override; + void update(const EndOfEvent* evt) override; + void update(const G4Step* step) override; + + // analysis-related stuff + std::vector layerGrouping(int); + std::vector towersToAdd(int centre, int nadd); + void fill(const EndOfEvent* ev); + void qieAnalysis(CLHEP::HepRandomEngine*); + void layerAnalysis(); + double timeOfFlight(int det, int layer, double eta); + +private: + //Keep parameters to instantiate HcalTestHistoClass later + std::string fileName_; + + // Qie Analysis + std::unique_ptr myqie_; + int addTower_; + + // Private Tuples + std::unique_ptr tuplesManager_; + HcalTestHistoClass* tuples_; + + // Numbering scheme + std::unique_ptr numberingFromDDD_; + const HcalDDDSimConstants* hcons_; + HcalTestNumberingScheme* org_; + + // Hits for qie analysis + std::vector caloHitCache_; + std::vector group_, tower_; + int nGroup_, nTower_; + + // to read from ParameterSet + std::vector names_; + double eta0_, phi0_; + int centralTower_; + + // some private members for ananlysis + unsigned int count_; + double edepEB_, edepEE_, edepHB_, edepHE_; + double edepHO_, edepl_[20]; + double mudist_[20]; // Distance of muon from central part +}; HcalTestAnalysis::HcalTestAnalysis(const edm::ParameterSet& p) : addTower_(3), tuples_(nullptr), hcons_(nullptr), org_(nullptr) { @@ -633,3 +705,8 @@ double HcalTestAnalysis::timeOfFlight(int det, int layer, double eta) { << " eta/theta " << eta << " " << theta / deg << " dist " << dist; return tmp; } + +#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" + +DEFINE_SIMWATCHER(HcalTestAnalysis); diff --git a/SimG4CMS/Calo/plugins/module.cc b/SimG4CMS/Calo/plugins/module.cc deleted file mode 100644 index 5ab2480dde404..0000000000000 --- a/SimG4CMS/Calo/plugins/module.cc +++ /dev/null @@ -1,7 +0,0 @@ -#include "SimG4CMS/Calo/interface/HcalTestAnalysis.h" -#include "SimG4CMS/Calo/interface/CaloSteppingAction.h" -#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" -#include "FWCore/PluginManager/interface/ModuleDef.h" - -DEFINE_SIMWATCHER(HcalTestAnalysis); -DEFINE_SIMWATCHER(CaloSteppingAction); diff --git a/SimG4CMS/Calo/src/CaloHitID.cc b/SimG4CMS/Calo/src/CaloHitID.cc index 2854a27f68909..e260a67498282 100644 --- a/SimG4CMS/Calo/src/CaloHitID.cc +++ b/SimG4CMS/Calo/src/CaloHitID.cc @@ -7,7 +7,7 @@ #include CaloHitID::CaloHitID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth, float tSlice, bool ignoreTkID) - : timeSliceUnit(tSlice), ignoreTrackID(ignoreTkID), theFineTrackID(-1) { + : timeSliceUnit(tSlice), ignoreTrackID(ignoreTkID), isFinecaloTrackID_(false) { setID(unitID, timeSlice, trackID, depth); } @@ -21,7 +21,7 @@ CaloHitID::CaloHitID(const CaloHitID& id) { theDepth = id.theDepth; timeSliceUnit = id.timeSliceUnit; ignoreTrackID = id.ignoreTrackID; - theFineTrackID = id.theFineTrackID; + isFinecaloTrackID_ = id.isFinecaloTrackID_; } const CaloHitID& CaloHitID::operator=(const CaloHitID& id) { @@ -32,7 +32,7 @@ const CaloHitID& CaloHitID::operator=(const CaloHitID& id) { theDepth = id.theDepth; timeSliceUnit = id.timeSliceUnit; ignoreTrackID = id.ignoreTrackID; - theFineTrackID = id.theFineTrackID; + isFinecaloTrackID_ = id.isFinecaloTrackID_; return *this; } @@ -52,12 +52,12 @@ void CaloHitID::reset() { theTrackID = -2; theTimeSliceID = (int)(theTimeSlice / timeSliceUnit); theDepth = 0; - theFineTrackID = -1; + isFinecaloTrackID_ = false; } bool CaloHitID::operator==(const CaloHitID& id) const { return ((theUnitID == id.unitID()) && (theTrackID == id.trackID() || ignoreTrackID) && - (theTimeSliceID == id.timeSliceID()) && (theDepth == id.depth()) && (fineTrackID() == id.fineTrackID())) + (theTimeSliceID == id.timeSliceID()) && (theDepth == id.depth())) ? true : false; } @@ -65,8 +65,6 @@ bool CaloHitID::operator==(const CaloHitID& id) const { bool CaloHitID::operator<(const CaloHitID& id) const { if (theTrackID != id.trackID()) { return (theTrackID > id.trackID()); - } else if (fineTrackID() != id.fineTrackID()) { - return (fineTrackID() > id.fineTrackID()); } else if (theUnitID != id.unitID()) { return (theUnitID > id.unitID()); } else if (theDepth != id.depth()) { @@ -79,8 +77,6 @@ bool CaloHitID::operator<(const CaloHitID& id) const { bool CaloHitID::operator>(const CaloHitID& id) const { if (theTrackID != id.trackID()) { return (theTrackID < id.trackID()); - } else if (fineTrackID() != id.fineTrackID()) { - return (fineTrackID() < id.fineTrackID()); } else if (theUnitID != id.unitID()) { return (theUnitID < id.unitID()); } else if (theDepth != id.depth()) { @@ -93,7 +89,5 @@ bool CaloHitID::operator>(const CaloHitID& id) const { std::ostream& operator<<(std::ostream& os, const CaloHitID& id) { os << "UnitID 0x" << std::hex << id.unitID() << std::dec << " Depth " << std::setw(6) << id.depth() << " Time " << std::setw(6) << id.timeSlice() << " TrackID " << std::setw(8) << id.trackID(); - if (id.hasFineTrackID()) - os << " fineTrackID " << id.fineTrackID(); return os; } diff --git a/SimG4CMS/Calo/src/CaloSD.cc b/SimG4CMS/Calo/src/CaloSD.cc index 8ef73b61a5e2c..385f89c5b48ad 100644 --- a/SimG4CMS/Calo/src/CaloSD.cc +++ b/SimG4CMS/Calo/src/CaloSD.cc @@ -29,7 +29,7 @@ #include #include -//#define EDM_ML_DEBUG +// #define EDM_ML_DEBUG CaloSD::CaloSD(const std::string& name, const SensitiveDetectorCatalog& clg, @@ -114,6 +114,8 @@ CaloSD::CaloSD(const std::string& name, << eminHitD / CLHEP::MeV << " MeV (for nonzero depths);\n Time Slice Unit " << timeSlice << "\nIgnore TrackID Flag " << ignoreTrackID << " doFineCalo flag " << doFineCalo_ << "\nBeam Position " << beamZ / CLHEP::cm << " cm"; + if (doFineCalo_) + edm::LogVerbatim("DoFineCalo") << "Using finecalo v2"; // Treat fine calorimeters edm::LogVerbatim("CaloSim") << "CaloSD: Have a possibility of " << fineNames.size() << " fine calorimeters of which " @@ -166,6 +168,10 @@ G4bool CaloSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) { << " Eprestep= " << aStep->GetPreStepPoint()->GetKineticEnergy() << " step= " << aStep->GetStepLength() << " Edep= " << aStep->GetTotalEnergyDeposit(); #endif + + // Class variable to determine whether finecalo rules should apply for this step + doFineCaloThisStep_ = (doFineCalo_ && isItFineCalo(aStep->GetPreStepPoint()->GetTouchable())); + // apply shower library or parameterisation if (isParameterized) { if (getFromLibrary(aStep)) { @@ -211,6 +217,10 @@ G4bool CaloSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) { double energy = getEnergyDeposit(aStep); if (energy > 0.0) { + if (doFineCaloThisStep_) { + currentID.setID(unitID, time, findBoundaryCrossingParent(theTrack), depth); + currentID.markAsFinecaloTrackID(); + } if (G4TrackToParticleID::isGammaElectronPositron(theTrack)) { edepositEM = energy; } else { @@ -230,7 +240,7 @@ G4bool CaloSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) { currentHit = createNewHit(aStep, aStep->GetTrack()); } else { #ifdef EDM_ML_DEBUG - edm::LogVerbatim("DoFineCalo") << "Not creating new hit, only updating currentHit " << currentHit->getUnitID(); + edm::LogVerbatim("DoFineCalo") << "Not creating new hit, only updating " << shortreprID(currentHit); #endif } return true; @@ -442,11 +452,11 @@ bool CaloSD::checkHit() { int CaloSD::getNumberOfHits() { return theHC->entries(); } +/* +Takes a vector of ints (representing trackIDs), and returns a formatted string +for debugging purposes +*/ std::string CaloSD::printableDecayChain(const std::vector& decayChain) { - /* - Takes a vector of ints (representing trackIDs), and returns a formatted string - for debugging purposes - */ std::stringstream ss; for (long unsigned int i = 0; i < decayChain.size(); i++) { if (i > 0) @@ -456,111 +466,91 @@ std::string CaloSD::printableDecayChain(const std::vector& decayCh return ss.str(); } -void CaloSD::hitBookkeepingFineCalo(const G4Step* step, const G4Track* currentTrack, CaloG4Hit* hit) { - /* - Performs bookkeeping: Determines what trackIDs are to be recorded for the hit (typically some - some parent trackID), and also sets the right flags on either the TrackInformation object or - the TrackWithHistory object to make sure the right track is saved to the SimTrack collection. - - `currentTrack` is the track that is currently being processed by Geant - */ - TrackInformation* trkInfo = cmsTrackInformation(currentTrack); - // Copy the class's currentID so we can freely modify it without influencing - // hits created later in possibly non-fine detectors by the same track - CaloHitID hitID = currentID; - // First check if the current currentTrack passes criteria - if (trkInfo->crossedBoundary()) { +/* Very short representation of a CaloHitID */ +std::string CaloSD::shortreprID(const CaloHitID& ID) { + std::stringstream ss; + ss << GetName() << "/" << ID.unitID() << "/trk" << ID.trackID() << "/d" << ID.depth() << "/time" << ID.timeSliceID(); + if (ID.isFinecaloTrackID()) + ss << "/FC"; + return ss.str(); +} + +/* As above, but with a hit as input */ +std::string CaloSD::shortreprID(const CaloG4Hit* hit) { return shortreprID(hit->getID()); } + +/* +Finds the boundary-crossing parent of a track, and stores it in the CaloSD's map +*/ +unsigned int CaloSD::findBoundaryCrossingParent(const G4Track* track, bool markAsSaveable) { + TrackInformation* trkInfo = cmsTrackInformation(track); + unsigned int id = track->GetTrackID(); + // First see if this track is already in the map + auto it = boundaryCrossingParentMap_.find(id); + if (it != boundaryCrossingParentMap_.end()) { #ifdef EDM_ML_DEBUG - edm::LogVerbatim("DoFineCalo") << "currentTrack " << currentTrack->GetTrackID() - << " itself has crossedBoundary=" << trkInfo->crossedBoundary() - << " ; recording it for hit " << hit->getUnitID(); + edm::LogVerbatim("DoFineCalo") << "Track " << id << " parent already cached: " << it->second; #endif - hitID.setFineTrackID(currentTrack->GetTrackID()); - hit->setID(hitID); // Actually overwrite the ID for the hit - trkInfo->storeTrack(true); - return; + return it->second; } - // currentTrack itself does not pass thresholds / does not cross boundary; go through its history to find a track that does - TrackWithHistory* recordTrackWithHistory; - // Keep track of decay chain of this track for debugging purposes - std::vector decayChain; - decayChain.push_back(currentTrack->GetTrackID()); - // Find the first parent of this track that passes the required criteria - // Start from first parent - unsigned int recordTrackID = currentTrack->GetParentID(); + // Then see if the track itself crosses the boundary + else if (trkInfo->crossedBoundary()) { #ifdef EDM_ML_DEBUG - edm::LogVerbatim("DoFineCalo") << "Trying to find the first parent of hit " << hit->getUnitID() - << " that passes saving criterion (crosses boundary or specific criterion)" - << "; starting with first parent track " << recordTrackID; + edm::LogVerbatim("DoFineCalo") << "Track " << id << " crosses boundary itself"; #endif - // Check whether this first parent actually exists - if (recordTrackID <= 0) { - // Track ID 0 is not a track; - // This means the current currentTrack has no parent, but apparently it also didn't fit saving criteria - throw cms::Exception("Unknown", "CaloSD") << "ERROR: Track " << currentTrack->GetTrackID() - << " has no parent, does not fit saving criteria, but left hit " - << hit->getUnitID() << "; recording it but it's weird!"; + boundaryCrossingParentMap_[id] = id; + trkInfo->storeTrack(true); + return id; } - // Start progressing through the track's history + // Else, traverse the history of the track + std::vector decayChain{id}; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("DoFineCalo") << "Track " << id << ": Traversing history to find boundary-crossing parent"; +#endif + unsigned int parentID = track->GetParentID(); while (true) { - // Record the decay chain for debugging purposes - decayChain.push_back(recordTrackID); - recordTrackWithHistory = m_trackManager->getTrackByID(recordTrackID); - if (recordTrackID < (unsigned int)hitID.trackID()) { - // A parent of the currentTrack has a lower trackID than the current - // hitID.trackID(). This means the current hitID.trackID() does not point - // to the earliest ancestor of the currentTrack. - // The current hitID.trackID() might not be a saved track yet, but the - // ancestor is *always* a saved track. - // Fix this by overwriting the hitID's track ID. + if (parentID == 0) + throw cms::Exception("Unknown", "CaloSD") + << "Hit end of parentage for track " << id << " without finding a boundary-crossing parent"; + // First check if this ancestor is already in the map + auto it = boundaryCrossingParentMap_.find(parentID); + if (it != boundaryCrossingParentMap_.end()) { #ifdef EDM_ML_DEBUG - edm::LogVerbatim("DoFineCalo") << "History-tracking progressed to track " << recordTrackID - << ", which is an earlier ancestor than current primary " << hitID.trackID() - << "; overwriting it."; + edm::LogVerbatim("DoFineCalo") << " Track " << parentID + << " boundary-crossing parent already cached: " << it->second; #endif - hitID.setTrackID(recordTrackID); - } - // Check if this parent fits the boundary-crossing criteria - if (recordTrackWithHistory->crossedBoundary() && recordTrackWithHistory->getIDAtBoundary() == (int)recordTrackID) { + // Store this parent also for the rest of the traversed decay chain + for (auto ancestorID : decayChain) + boundaryCrossingParentMap_[ancestorID] = it->second; #ifdef EDM_ML_DEBUG - edm::LogVerbatim("DoFineCalo") << "Recording track " << recordTrackID << " as source of hit " << hit->getUnitID() - << "; crossed boundary at pos=(" - << recordTrackWithHistory->getPositionAtBoundary().x() << "," - << recordTrackWithHistory->getPositionAtBoundary().y() << "," - << recordTrackWithHistory->getPositionAtBoundary().z() << ")" - << " mom=(" << recordTrackWithHistory->getMomentumAtBoundary().x() << "," - << recordTrackWithHistory->getMomentumAtBoundary().y() << "," - << recordTrackWithHistory->getMomentumAtBoundary().z() << "," - << recordTrackWithHistory->getMomentumAtBoundary().e() << ")" - << " id@boundary=" << recordTrackWithHistory->getIDAtBoundary() - << "; decayChain: " << printableDecayChain(decayChain); + // In debug mode, still build the rest of the decay chain for debugging + decayChain.push_back(parentID); + while (parentID != it->second) { + parentID = m_trackManager->getTrackByID(parentID, true)->parentID(); + decayChain.push_back(parentID); + } + edm::LogVerbatim("DoFineCalo") << " Full decay chain: " << printableDecayChain(decayChain); #endif - break; + return it->second; } - // This parent track did not fit criteria - go to the next parent + // If not, get this parent from the track manager (expensive) + TrackWithHistory* parentTrack = m_trackManager->getTrackByID(parentID, true); + if (parentTrack->crossedBoundary()) { + if (markAsSaveable) + parentTrack->save(); + decayChain.push_back(parentID); + // Record this boundary crossing parent for all traversed ancestors + for (auto ancestorID : decayChain) + boundaryCrossingParentMap_[ancestorID] = parentID; #ifdef EDM_ML_DEBUG - edm::LogVerbatim("DoFineCalo") << "Track " << recordTrackID << " did not cross the boundary or fit other criteria"; + edm::LogVerbatim("DoFineCalo") << " Found boundary-crossing ancestor " << parentID << " for track " << id + << "; decay chain: " << printableDecayChain(decayChain); #endif - recordTrackID = recordTrackWithHistory->parentID(); - if (recordTrackID <= 0) { - // Track ID 0 is not a track; - // This means that no parent of the currentTrack fitted the criteria - throw cms::Exception("Unknown", "CaloSD") - << "Hit " << hit->getUnitID() << " does not have any parent track that passes the criteria!" - << " decayChain so far: " << printableDecayChain(decayChain); + return parentID; } + // Next iteration + decayChain.push_back(parentID); + parentID = parentTrack->parentID(); } - // Parentage traversal done - do the bookeeping for the found ancestor track - recordTrackWithHistory->save(); - hitID.setFineTrackID(recordTrackID); - hit->setID(hitID); // Actually overwrite the ID for the hit -#ifdef EDM_ML_DEBUG - edm::LogVerbatim("DoFineCalo") << "Stored the following bookeeping for hit " << hit->getUnitID() - << " hitID.trackID()=" << hitID.trackID() - << " hitID.fineTrackID()=" << hitID.fineTrackID() - << " recordTrackWithHistory->trackID()=" << recordTrackWithHistory->trackID() - << " recordTrackWithHistory->saved()=" << recordTrackWithHistory->saved(); -#endif } CaloG4Hit* CaloSD::createNewHit(const G4Step* aStep, const G4Track* theTrack) { @@ -596,30 +586,15 @@ CaloG4Hit* CaloSD::createNewHit(const G4Step* aStep, const G4Track* theTrack) { storeHit(aHit); TrackInformation* trkInfo = cmsTrackInformation(theTrack); - bool currentlyInsideFineVolume = !doFineCalo_ ? false : isItFineCalo(aStep->GetPostStepPoint()->GetTouchable()); - #ifdef EDM_ML_DEBUG - edm::LogVerbatim("DoFineCalo") << "Creating new hit " << aHit->getUnitID() << " using " - << (currentlyInsideFineVolume ? "FINECALO" : "normal CaloSD") - << "; currentID.trackID=" << currentID.trackID() - << " currentID.fineTrackID=" << currentID.fineTrackID() - << " isItFineCalo(aStep->GetPostStepPoint()->GetTouchable())=" - << isItFineCalo(aStep->GetPostStepPoint()->GetTouchable()) - << " isItFineCalo(aStep->GetPreStepPoint()->GetTouchable())=" - << isItFineCalo(aStep->GetPreStepPoint()->GetTouchable()) - << " theTrack=" << theTrack->GetTrackID() << " (" - << " parentTrackId=" << theTrack->GetParentID() - << " getIDonCaloSurface=" << trkInfo->getIDonCaloSurface() << ")" - << " primIDSaved=" << primIDSaved; + if (doFineCaloThisStep_) + edm::LogVerbatim("DoFineCalo") << "New hit " << shortreprID(aHit) << " using finecalo;" + << " isItFineCalo(post)=" << isItFineCalo(aStep->GetPostStepPoint()->GetTouchable()) + << " isItFineCalo(pre)=" << isItFineCalo(aStep->GetPreStepPoint()->GetTouchable()); #endif - // If fine calo is activated for the current volume, perform track/hit - // saving logic for fineCalo - if (currentlyInsideFineVolume) { - hitBookkeepingFineCalo(aStep, theTrack, aHit); - } // 'Traditional', non-fine history bookkeeping - else { + if (!doFineCaloThisStep_) { double etrack = 0; if (currentID.trackID() == primIDSaved) { // The track is saved; nothing to be done } else if (currentID.trackID() == theTrack->GetTrackID()) { @@ -793,6 +768,7 @@ void CaloSD::update(const ::EndOfEvent*) { std::vector>().swap(reusehit); if (useMap) hitMap.erase(hitMap.begin(), hitMap.end()); + boundaryCrossingParentMap_.clear(); } void CaloSD::clearHits() { @@ -900,26 +876,22 @@ bool CaloSD::saveHit(CaloG4Hit* aHit) { if (corrTOFBeam) time += correctT; - // Do track bookkeeping a little differently for fine tracking - if (doFineCalo_ && aHit->getID().hasFineTrackID()) { - tkID = aHit->getID().fineTrackID(); + // More strict bookkeeping for finecalo + if (doFineCalo_ && aHit->isFinecaloTrackID()) { #ifdef EDM_ML_DEBUG - edm::LogVerbatim("DoFineCalo") << "Saving hit " << aHit->getUnitID() << " with trackID=" << tkID; + edm::LogVerbatim("DoFineCalo") << "Saving hit " << shortreprID(aHit); #endif - // Check if the track is actually in the trackManager - if (m_trackManager) { - if (!m_trackManager->trackExists(tkID)) { - ok = false; - throw cms::Exception("Unknown", "CaloSD") - << "aHit " << aHit->getUnitID() << " has fine trackID " << tkID << ", which is NOT IN THE TRACK MANAGER"; - } - } else { - ok = false; - throw cms::Exception("Unknown", "CaloSD") << "m_trackManager not set, saveHit ok=false!"; - } - // Take the aHit-information and move it to the actual PCaloHitContainer - slave.get()->processHits( - aHit->getUnitID(), aHit->getEM() / CLHEP::GeV, aHit->getHadr() / CLHEP::GeV, time, tkID, aHit->getDepth()); + if (!m_trackManager) + throw cms::Exception("Unknown", "CaloSD") << "m_trackManager not set, needed for finecalo!"; + if (!m_trackManager->trackExists(aHit->getTrackID())) + throw cms::Exception("Unknown", "CaloSD") + << "Error on hit " << shortreprID(aHit) << ": Parent track not in track manager"; + slave.get()->processHits(aHit->getUnitID(), + aHit->getEM() / CLHEP::GeV, + aHit->getHadr() / CLHEP::GeV, + time, + aHit->getTrackID(), + aHit->getDepth()); } // Regular, not-fine way: else { @@ -937,8 +909,7 @@ bool CaloSD::saveHit(CaloG4Hit* aHit) { ok = false; } #ifdef EDM_ML_DEBUG - edm::LogVerbatim("DoFineCalo") << "Saving hit " << aHit->getUnitID() << " with trackID=" << tkID - << " (no fineTrackID)"; + edm::LogVerbatim("DoFineCalo") << "Saving hit " << shortreprID(aHit) << " with trackID=" << tkID; #endif slave.get()->processHits( aHit->getUnitID(), aHit->getEM() / CLHEP::GeV, aHit->getHadr() / CLHEP::GeV, time, tkID, aHit->getDepth()); diff --git a/SimG4CMS/Calo/src/CaloTrkProcessing.cc b/SimG4CMS/Calo/src/CaloTrkProcessing.cc index 601032898e503..8c2f2350e3b5f 100644 --- a/SimG4CMS/Calo/src/CaloTrkProcessing.cc +++ b/SimG4CMS/Calo/src/CaloTrkProcessing.cc @@ -16,7 +16,7 @@ #include "DD4hep/Filter.h" #include -//#define EDM_ML_DEBUG +// #define EDM_ML_DEBUG CaloTrkProcessing::CaloTrkProcessing(const std::string& name, const CaloSimulationParameters& csps, @@ -293,7 +293,8 @@ void CaloTrkProcessing::update(const G4Step* aStep) { trkInfo->setIDonCaloSurface( id, ical, inside, theTrack->GetDefinition()->GetPDGEncoding(), theTrack->GetMomentum().mag()); trkInfo->setCaloIDChecked(true); - trkInfo->setCrossedBoundary(theTrack); + if (!doFineCalo_) + trkInfo->setCrossedBoundary(theTrack); lastTrackID_ = id; if (theTrack->GetKineticEnergy() / CLHEP::MeV > eMin_) trkInfo->putInHistory(); diff --git a/SimG4CMS/EcalTestBeam/interface/EcalTBH4Trigger.h b/SimG4CMS/EcalTestBeam/interface/EcalTBH4Trigger.h deleted file mode 100644 index e923a8b87370d..0000000000000 --- a/SimG4CMS/EcalTestBeam/interface/EcalTBH4Trigger.h +++ /dev/null @@ -1,179 +0,0 @@ -#ifndef HelpfulWatchers_EcalTBH4Trigger_h -#define HelpfulWatchers_EcalTBH4Trigger_h -// -*- C++ -*- -// -// Package: HelpfulWatchers -// Class : EcalTBH4Trigger -// -/**\class EcalTBH4Trigger EcalTBH4Trigger.h - SimG4Core/HelpfulWatchers/interface/EcalTBH4Trigger.h - - Description: Simulates ECALTBH4 trigger an throw exception in case of non - triggering event - - Usage: - - -*/ -// - -// system include files -#include - -// user include files -#include "SimG4Core/Notification/interface/Observer.h" -#include "SimG4Core/Notification/interface/SimG4Exception.h" -#include "SimG4Core/Watcher/interface/SimWatcher.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "G4Step.hh" -#include "G4VProcess.hh" -#include "G4VTouchable.hh" - -#include "CLHEP/Units/SystemOfUnits.h" - -// forward declarations -class DDDWorld; -class BeginOfJob; -class BeginOfRun; -class BeginOfEvent; -class BeginOfTrack; - -class EndOfRun; -class EndOfEvent; -class EndOfTrack; - -#define OBSERVES(type) \ -public \ - Observer -#define UPDATEH4(type) \ - void update(const type *) {} -class EcalTBH4Trigger : public SimWatcher, - // OBSERVES(DDDWorld), - // OBSERVES(BeginOfJob), - // OBSERVES(BeginOfRun), - OBSERVES(BeginOfEvent), - // OBSERVES(BeginOfTrack), - OBSERVES(G4Step), - // OBSERVES(EndOfRun), - OBSERVES(EndOfEvent) -//, -// OBSERVES(EndOfTrack) -{ -public: - EcalTBH4Trigger(const edm::ParameterSet &pSet) - : m_verbose(pSet.getUntrackedParameter("verbose", false)), - nTriggeredEvents_(0), - trigEvents_(pSet.getUntrackedParameter("trigEvents", -1)) {} - // virtual ~EcalTBH4Trigger(); - - // ---------- const member functions --------------------- - - // ---------- static member functions -------------------- - - // ---------- member functions --------------------------- - // UPDATEH4(DDDWorld) - // UPDATEH4(BeginOfJob) - // UPDATEH4(BeginOfRun) - // UPDATEH4(BeginOfEvent) - void update(const BeginOfEvent *anEvent) override { - // std::cout <<"++ signal BeginOfEvent " ; - // m_enteringTBH4BeamLine=false; - // m_exitingTBH4BeamLine=false; - // m_passedTrigger=false; - m_passedTrg1 = false; - m_passedTrg3 = false; - m_passedTrg4 = false; - m_passedTrg5 = false; - m_passedTrg6 = false; - } - - // UPDATEH4(BeginOfTrack) - void update(const G4Step *iStep) override { - if (trigEvents_ >= 0 && nTriggeredEvents_ >= trigEvents_) - throw SimG4Exception("Number of needed trigger events reached in ECALTBH4"); - - const G4StepPoint *pre = iStep->GetPreStepPoint(); - const G4StepPoint *post = iStep->GetPostStepPoint(); - if (m_verbose) { - std::cout << "++ signal G4Step"; - const G4VTouchable *touch = iStep->GetPreStepPoint()->GetTouchable(); - // Get name and copy numbers - if (touch->GetHistoryDepth() > 0) { - for (int ii = 0; ii <= touch->GetHistoryDepth(); ii++) { - std::cout << "EcalTBH4::Level " << ii << ": " << touch->GetVolume(ii)->GetName() << "[" - << touch->GetReplicaNumber(ii) << "]"; - } - } - std::cout << std::endl; - const G4Track *theTrack = iStep->GetTrack(); - const G4ThreeVector &pos = post->GetPosition(); - std::cout << "( " << pos.x() << "," << pos.y() << "," << pos.z() << ") "; - std::cout << " released energy (MeV) " << iStep->GetTotalEnergyDeposit() / CLHEP::MeV; - if (theTrack) { - const G4ThreeVector mom = theTrack->GetMomentum(); - std::cout << " track length (cm) " << theTrack->GetTrackLength() / CLHEP::cm << " particle type " - << theTrack->GetDefinition()->GetParticleName() << " momentum " - << "( " << mom.x() << "," << mom.y() << "," << mom.z() << ") "; - if (theTrack->GetCreatorProcess()) { - std::cout << " created by " << theTrack->GetCreatorProcess()->GetProcessName(); - } - } - if (post->GetPhysicalVolume()) { - std::cout << " " << pre->GetPhysicalVolume()->GetName() << "->" << post->GetPhysicalVolume()->GetName(); - } - std::cout << std::endl; - } - - if (post && post->GetPhysicalVolume()) { - if (!m_passedTrg1 && post->GetPhysicalVolume()->GetName() == "TRG1") - m_passedTrg1 = true; - if (!m_passedTrg3 && post->GetPhysicalVolume()->GetName() == "TRG3") - m_passedTrg3 = true; - if (!m_passedTrg4 && post->GetPhysicalVolume()->GetName() == "TRG4") - m_passedTrg4 = true; - if (!m_passedTrg5 && post->GetPhysicalVolume()->GetName() == "TRG5") - m_passedTrg5 = true; - if (!m_passedTrg6 && post->GetPhysicalVolume()->GetName() == "TRG6") - m_passedTrg6 = true; - if (post->GetPhysicalVolume()->GetName() == "CMSSE") // Exiting TBH4BeamLine - if (!(m_passedTrg1 && m_passedTrg6)) // Trigger defined as Trg4 && Trg6 - throw SimG4Exception("Event is not triggered by ECALTBH4"); - } - - /* if (!m_enteringTBH4BeamLine && ( post->GetPhysicalVolume()->GetName() - * == */ - } - // UPDATEH4(G4Step) - // UPDATEH4(EndOfRun) - // UPDATEH4(EndOfEvent) - void update(const EndOfEvent *anEvent) override { - // std::cout <<"++ signal BeginOfEvent " ; - // m_enteringTBH4BeamLine=false; - // m_exitingTBH4BeamLine=false; - // m_passedTrigger=false; - nTriggeredEvents_++; - } - // UPDATEH4(EndOfTrack) - -private: - // EcalTBH4Trigger(const EcalTBH4Trigger&); // stop default - - // const EcalTBH4Trigger& operator=(const EcalTBH4Trigger&); // stop default - - // ---------- member data -------------------------------- - bool m_verbose; - // bool m_enteringTBH4BeamLine; - // bool m_exitingTBH4BeamLine; - bool m_passedTrg1; - bool m_passedTrg3; - bool m_passedTrg4; - bool m_passedTrg5; - bool m_passedTrg6; - int nTriggeredEvents_; - int trigEvents_; - // bool m_passedTrigger; -}; - -#endif diff --git a/SimG4CMS/EcalTestBeam/interface/EcalTBMCInfoProducer.h b/SimG4CMS/EcalTestBeam/interface/EcalTBMCInfoProducer.h deleted file mode 100644 index d1d704ea99fd2..0000000000000 --- a/SimG4CMS/EcalTestBeam/interface/EcalTBMCInfoProducer.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef EcalTBMCInfoProducer_H -#define EcalTBMCInfoProducer_H -/* - * \file EcalTBMCInfoProducer.h - * - * - */ -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "Geometry/EcalTestBeam/interface/EcalTBCrystalMap.h" -#include "SimDataFormats/EcalTestBeam/interface/PEcalTBInfo.h" -#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" - -#include "Math/GenVector/Rotation3D.h" - -class EcalTBMCInfoProducer : public edm::stream::EDProducer<> { -public: - /// Constructor - explicit EcalTBMCInfoProducer(const edm::ParameterSet &ps); - - /// Destructor - ~EcalTBMCInfoProducer() override; - - /// Produce digis out of raw data - void produce(edm::Event &event, const edm::EventSetup &eventSetup) override; - -private: - double beamEta; - double beamPhi; - double beamTheta; - - int crysNumber; - - double beamXoff; - double beamYoff; - - double partXhodo; - double partYhodo; - - EcalTBCrystalMap *theTestMap; - - ROOT::Math::Rotation3D *fromCMStoTB; - - edm::EDGetTokenT GenVtxToken; -}; - -#endif diff --git a/SimG4CMS/EcalTestBeam/interface/FakeTBEventHeaderProducer.h b/SimG4CMS/EcalTestBeam/interface/FakeTBEventHeaderProducer.h deleted file mode 100644 index f17e2ca11d32a..0000000000000 --- a/SimG4CMS/EcalTestBeam/interface/FakeTBEventHeaderProducer.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef FakeTBEventHeaderProducer_H -#define FakeTBEventHeaderProducer_H -/* - * \file FakeTBEventHeaderProducer.h - * - * - * Mimic the event header information - * for the test beam simulation - * - */ - -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "Geometry/EcalTestBeam/interface/EcalTBHodoscopeGeometry.h" -#include "SimDataFormats/EcalTestBeam/interface/PEcalTBInfo.h" -#include "TBDataFormats/EcalTBObjects/interface/EcalTBEventHeader.h" - -class FakeTBEventHeaderProducer : public edm::stream::EDProducer<> { -public: - /// Constructor - explicit FakeTBEventHeaderProducer(const edm::ParameterSet &ps); - - /// Destructor - ~FakeTBEventHeaderProducer() override; - - /// Produce digis out of raw data - void produce(edm::Event &event, const edm::EventSetup &eventSetup) override; - -private: - edm::EDGetTokenT ecalTBInfo_; -}; - -#endif diff --git a/SimG4CMS/EcalTestBeam/interface/FakeTBHodoscopeRawInfoProducer.h b/SimG4CMS/EcalTestBeam/interface/FakeTBHodoscopeRawInfoProducer.h deleted file mode 100644 index f486ae98dfc5e..0000000000000 --- a/SimG4CMS/EcalTestBeam/interface/FakeTBHodoscopeRawInfoProducer.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef FakeTBHodoscopeRawInfoProducer_H -#define FakeTBHodoscopeRawInfoProducer_H -/* - * \file FakeTBHodoscopeRawInfoProducer.h - * - * - * Mimic the hodoscope raw information using - * the generated vertex of the test beam simulation - * - */ - -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "Geometry/EcalTestBeam/interface/EcalTBHodoscopeGeometry.h" -#include "SimDataFormats/EcalTestBeam/interface/PEcalTBInfo.h" -#include "TBDataFormats/EcalTBObjects/interface/EcalTBHodoscopePlaneRawHits.h" -#include "TBDataFormats/EcalTBObjects/interface/EcalTBHodoscopeRawInfo.h" - -class FakeTBHodoscopeRawInfoProducer : public edm::stream::EDProducer<> { -public: - /// Constructor - explicit FakeTBHodoscopeRawInfoProducer(const edm::ParameterSet &ps); - - /// Destructor - ~FakeTBHodoscopeRawInfoProducer() override; - - /// Produce digis out of raw data - void produce(edm::Event &event, const edm::EventSetup &eventSetup) override; - -private: - EcalTBHodoscopeGeometry *theTBHodoGeom_; - - edm::EDGetTokenT ecalTBInfo_; -}; - -#endif diff --git a/SimG4CMS/EcalTestBeam/interface/TBHodoActiveVolumeRawInfoProducer.h b/SimG4CMS/EcalTestBeam/interface/TBHodoActiveVolumeRawInfoProducer.h deleted file mode 100644 index ee00df4358599..0000000000000 --- a/SimG4CMS/EcalTestBeam/interface/TBHodoActiveVolumeRawInfoProducer.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef TBHodoActiveVolumeRawInfoProducer_H -#define TBHodoActiveVolumeRawInfoProducer_H -/* - * \file TBHodoActiveVolumeRawInfoProducer.h - * - * - */ - -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "Geometry/EcalTestBeam/interface/EcalTBHodoscopeGeometry.h" -#include "SimDataFormats/CaloHit/interface/PCaloHit.h" -#include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" -#include "SimDataFormats/EcalTestBeam/interface/HodoscopeDetId.h" -#include "SimDataFormats/EcalTestBeam/interface/PEcalTBInfo.h" -#include "TBDataFormats/EcalTBObjects/interface/EcalTBHodoscopePlaneRawHits.h" -#include "TBDataFormats/EcalTBObjects/interface/EcalTBHodoscopeRawInfo.h" - -class TBHodoActiveVolumeRawInfoProducer : public edm::stream::EDProducer<> { -public: - /// Constructor - explicit TBHodoActiveVolumeRawInfoProducer(const edm::ParameterSet &ps); - - /// Destructor - ~TBHodoActiveVolumeRawInfoProducer() override; - - /// Produce digis out of raw data - void produce(edm::Event &event, const edm::EventSetup &eventSetup) override; - -private: - double myThreshold; - - edm::EDGetTokenT m_EcalToken; - EcalTBHodoscopeGeometry *theTBHodoGeom_; -}; - -#endif diff --git a/SimG4CMS/EcalTestBeam/plugins/EcalTBH4Trigger.cc b/SimG4CMS/EcalTestBeam/plugins/EcalTBH4Trigger.cc new file mode 100644 index 0000000000000..bb735ba4df6b7 --- /dev/null +++ b/SimG4CMS/EcalTestBeam/plugins/EcalTBH4Trigger.cc @@ -0,0 +1,144 @@ +// -*- C++ -*- +// +// Package: HelpfulWatchers +// Class : EcalTBH4Trigger +// +/**\class EcalTBH4Trigger EcalTBH4Trigger.h + SimG4Core/HelpfulWatchers/interface/EcalTBH4Trigger.h + + Description: Simulates ECALTBH4 trigger an throw exception in case of non + triggering event + + Usage: + + +*/ +// + +// system include files +#include + +// user include files +#include "SimG4Core/Notification/interface/BeginOfEvent.h" +#include "SimG4Core/Notification/interface/EndOfEvent.h" +#include "SimG4Core/Notification/interface/Observer.h" +#include "SimG4Core/Notification/interface/SimG4Exception.h" +#include "SimG4Core/Watcher/interface/SimWatcher.h" +#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" + +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "G4Step.hh" +#include "G4VProcess.hh" +#include "G4VTouchable.hh" + +#include + +class EcalTBH4Trigger : public SimWatcher, + public Observer, + public Observer, + public Observer { +public: + EcalTBH4Trigger(const edm::ParameterSet &pSet) + : m_verbose(pSet.getUntrackedParameter("verbose", false)), + nTriggeredEvents_(0), + trigEvents_(pSet.getUntrackedParameter("trigEvents", -1)) {} + // virtual ~EcalTBH4Trigger(); + + // ---------- const member functions --------------------- + + // ---------- static member functions -------------------- + + // ---------- member functions --------------------------- + void update(const BeginOfEvent *anEvent) override; + void update(const G4Step *iStep) override; + void update(const EndOfEvent *anEvent) override; + +private: + // ---------- member data -------------------------------- + bool m_verbose; + bool m_passedTrg1; + bool m_passedTrg3; + bool m_passedTrg4; + bool m_passedTrg5; + bool m_passedTrg6; + int nTriggeredEvents_; + int trigEvents_; +}; + +void EcalTBH4Trigger::update(const BeginOfEvent *anEvent) { + m_passedTrg1 = false; + m_passedTrg3 = false; + m_passedTrg4 = false; + m_passedTrg5 = false; + m_passedTrg6 = false; +} + +void EcalTBH4Trigger::update(const G4Step *iStep) { + if (trigEvents_ >= 0 && nTriggeredEvents_ >= trigEvents_) + throw SimG4Exception("Number of needed trigger events reached in ECALTBH4"); + + const G4StepPoint *pre = iStep->GetPreStepPoint(); + const G4StepPoint *post = iStep->GetPostStepPoint(); + if (m_verbose) { + std::ostringstream st1; + st1 << "++ signal G4Step"; + const G4VTouchable *touch = iStep->GetPreStepPoint()->GetTouchable(); + // Get name and copy numbers + if (touch->GetHistoryDepth() > 0) { + for (int ii = 0; ii <= touch->GetHistoryDepth(); ii++) { + st1 << "EcalTBH4::Level " << ii << ": " << touch->GetVolume(ii)->GetName() << "[" << touch->GetReplicaNumber(ii) + << "]"; + } + } + edm::LogVerbatim("EcalTBInfo") << st1.str(); + + std::ostringstream st2; + const G4Track *theTrack = iStep->GetTrack(); + const G4ThreeVector &pos = post->GetPosition(); + st2 << "( " << pos.x() << "," << pos.y() << "," << pos.z() << ") "; + st2 << " released energy (MeV) " << iStep->GetTotalEnergyDeposit() / CLHEP::MeV; + if (theTrack) { + const G4ThreeVector mom = theTrack->GetMomentum(); + st2 << " track length (cm) " << theTrack->GetTrackLength() / CLHEP::cm << " particle type " + << theTrack->GetDefinition()->GetParticleName() << " momentum " + << "( " << mom.x() << "," << mom.y() << "," << mom.z() << ") "; + if (theTrack->GetCreatorProcess()) { + st2 << " created by " << theTrack->GetCreatorProcess()->GetProcessName(); + } + } + if (post->GetPhysicalVolume()) { + st2 << " " << pre->GetPhysicalVolume()->GetName() << "->" << post->GetPhysicalVolume()->GetName(); + } + edm::LogVerbatim("EcalTBInfo") << st2.str(); + } + + if (post && post->GetPhysicalVolume()) { + if (!m_passedTrg1 && post->GetPhysicalVolume()->GetName() == "TRG1") + m_passedTrg1 = true; + if (!m_passedTrg3 && post->GetPhysicalVolume()->GetName() == "TRG3") + m_passedTrg3 = true; + if (!m_passedTrg4 && post->GetPhysicalVolume()->GetName() == "TRG4") + m_passedTrg4 = true; + if (!m_passedTrg5 && post->GetPhysicalVolume()->GetName() == "TRG5") + m_passedTrg5 = true; + if (!m_passedTrg6 && post->GetPhysicalVolume()->GetName() == "TRG6") + m_passedTrg6 = true; + if (post->GetPhysicalVolume()->GetName() == "CMSSE") // Exiting TBH4BeamLine + if (!(m_passedTrg1 && m_passedTrg6)) // Trigger defined as Trg4 && Trg6 + throw SimG4Exception("Event is not triggered by ECALTBH4"); + } + + /* if (!m_enteringTBH4BeamLine && ( post->GetPhysicalVolume()->GetName() + * == */ +} + +void EcalTBH4Trigger::update(const EndOfEvent *anEvent) { + edm::LogVerbatim("EcalTBInfo") << "++ signal BeginOfEvent "; + nTriggeredEvents_++; +} + +DEFINE_SIMWATCHER(EcalTBH4Trigger); diff --git a/SimG4CMS/EcalTestBeam/plugins/EcalTBMCInfoProducer.cc b/SimG4CMS/EcalTestBeam/plugins/EcalTBMCInfoProducer.cc index d7e007ec0e8fc..166ee3cea6344 100644 --- a/SimG4CMS/EcalTestBeam/plugins/EcalTBMCInfoProducer.cc +++ b/SimG4CMS/EcalTestBeam/plugins/EcalTBMCInfoProducer.cc @@ -4,20 +4,61 @@ * */ -#include "CLHEP/Random/RandFlat.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Math/interface/Point3D.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Utilities/interface/RandomNumberGenerator.h" -#include "SimG4CMS/EcalTestBeam/interface/EcalTBMCInfoProducer.h" -#include "DataFormats/Math/interface/Point3D.h" +#include "Geometry/EcalTestBeam/interface/EcalTBCrystalMap.h" +#include "SimDataFormats/EcalTestBeam/interface/PEcalTBInfo.h" +#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" + +#include "Math/GenVector/Rotation3D.h" +#include #include #include #include -using namespace std; -using namespace cms; +class EcalTBMCInfoProducer : public edm::stream::EDProducer<> { +public: + /// Constructor + explicit EcalTBMCInfoProducer(const edm::ParameterSet &ps); + + /// Destructor + ~EcalTBMCInfoProducer() override; + + /// Produce digis out of raw data + void produce(edm::Event &event, const edm::EventSetup &eventSetup) override; + +private: + double beamEta; + double beamPhi; + double beamTheta; + + int crysNumber; + + double beamXoff; + double beamYoff; + + double partXhodo; + double partYhodo; + + EcalTBCrystalMap *theTestMap; + + ROOT::Math::Rotation3D *fromCMStoTB; + + edm::EDGetTokenT GenVtxToken; +}; EcalTBMCInfoProducer::EcalTBMCInfoProducer(const edm::ParameterSet &ps) { produces(); @@ -34,7 +75,7 @@ EcalTBMCInfoProducer::EcalTBMCInfoProducer(const edm::ParameterSet &ps) { beamXoff = ps.getParameter("BeamMeanX"); beamYoff = ps.getParameter("BeamMeanX"); - string fullMapName = CrystalMapFile.fullPath(); + std::string fullMapName = CrystalMapFile.fullPath(); theTestMap = new EcalTBCrystalMap(fullMapName); crysNumber = 0; @@ -63,13 +104,13 @@ EcalTBMCInfoProducer::EcalTBMCInfoProducer(const edm::ParameterSet &ps) { } } - edm::LogInfo("EcalTBInfo") << "Initialize TB MC ECAL info producer with parameters: \n" - << "Crystal map file: " << CrystalMapFile << "\n" - << "Beam average eta = " << beamEta << "\n" - << "Beam average phi = " << beamPhi << "\n" - << "Corresponding to crystal number = " << crysNumber << "\n" - << "Beam X offset = " << beamXoff << "\n" - << "Beam Y offset = " << beamYoff; + edm::LogVerbatim("EcalTBInfo") << "Initialize TB MC ECAL info producer with parameters: \n" + << "Crystal map file: " << CrystalMapFile << "\n" + << "Beam average eta = " << beamEta << "\n" + << "Beam average phi = " << beamPhi << "\n" + << "Corresponding to crystal number = " << crysNumber << "\n" + << "Beam X offset = " << beamXoff << "\n" + << "Beam Y offset = " << beamYoff; // rotation matrix to move from the CMS reference frame to the test beam one @@ -103,7 +144,7 @@ void EcalTBMCInfoProducer::produce(edm::Event &event, const edm::EventSetup &eve edm::Service rng; CLHEP::HepRandomEngine *engine = &rng->getEngine(event.streamID()); - unique_ptr product(new PEcalTBInfo()); + std::unique_ptr product(new PEcalTBInfo()); // Fill the run information @@ -148,3 +189,5 @@ void EcalTBMCInfoProducer::produce(edm::Event &event, const edm::EventSetup &eve event.put(std::move(product)); } + +DEFINE_FWK_MODULE(EcalTBMCInfoProducer); diff --git a/SimG4CMS/EcalTestBeam/plugins/FakeTBEventHeaderProducer.cc b/SimG4CMS/EcalTestBeam/plugins/FakeTBEventHeaderProducer.cc index e7b2738440573..3beefed8af896 100644 --- a/SimG4CMS/EcalTestBeam/plugins/FakeTBEventHeaderProducer.cc +++ b/SimG4CMS/EcalTestBeam/plugins/FakeTBEventHeaderProducer.cc @@ -1,14 +1,40 @@ /* * \file FakeTBEventHeaderProducer.cc * + * Mimic the event header information + * for the test beam simulation * */ #include "DataFormats/EcalDetId/interface/EBDetId.h" -#include "SimG4CMS/EcalTestBeam/interface/FakeTBEventHeaderProducer.h" +#include "DataFormats/Common/interface/Handle.h" -using namespace cms; -using namespace std; +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "Geometry/EcalTestBeam/interface/EcalTBHodoscopeGeometry.h" +#include "SimDataFormats/EcalTestBeam/interface/PEcalTBInfo.h" +#include "TBDataFormats/EcalTBObjects/interface/EcalTBEventHeader.h" + +class FakeTBEventHeaderProducer : public edm::stream::EDProducer<> { +public: + /// Constructor + explicit FakeTBEventHeaderProducer(const edm::ParameterSet &ps); + + /// Destructor + ~FakeTBEventHeaderProducer() override; + + /// Produce digis out of raw data + void produce(edm::Event &event, const edm::EventSetup &eventSetup) override; + +private: + edm::EDGetTokenT ecalTBInfo_; +}; FakeTBEventHeaderProducer::FakeTBEventHeaderProducer(const edm::ParameterSet &ps) { ecalTBInfo_ = consumes(edm::InputTag("EcalTBInfoLabel", "SimEcalTBG4Object")); @@ -18,7 +44,7 @@ FakeTBEventHeaderProducer::FakeTBEventHeaderProducer(const edm::ParameterSet &ps FakeTBEventHeaderProducer::~FakeTBEventHeaderProducer() {} void FakeTBEventHeaderProducer::produce(edm::Event &event, const edm::EventSetup &eventSetup) { - unique_ptr product(new EcalTBEventHeader()); + std::unique_ptr product(new EcalTBEventHeader()); // get the vertex information from the event @@ -43,8 +69,11 @@ void FakeTBEventHeaderProducer::produce(edm::Event &event, const edm::EventSetup product->setTriggerMask(0x1); product->setCrystalInBeam(EBDetId(1, theEcalTBInfo->nCrystal(), EBDetId::SMCRYSTALMODE)); - // LogDebug("FakeTBHeader") << (*product); - // LogDebug("FakeTBHeader") << (*product).eventType(); - // LogDebug("FakeTBHeader") << (*product).crystalInBeam(); + LogDebug("FakeTBHeader") << (*product); + LogDebug("FakeTBHeader") << (*product).eventType(); + LogDebug("FakeTBHeader") << (*product).crystalInBeam(); + event.put(std::move(product)); } + +DEFINE_FWK_MODULE(FakeTBEventHeaderProducer); diff --git a/SimG4CMS/EcalTestBeam/plugins/FakeTBHodoscopeRawInfoProducer.cc b/SimG4CMS/EcalTestBeam/plugins/FakeTBHodoscopeRawInfoProducer.cc index 45a1169c65695..c3937c8ee0e14 100644 --- a/SimG4CMS/EcalTestBeam/plugins/FakeTBHodoscopeRawInfoProducer.cc +++ b/SimG4CMS/EcalTestBeam/plugins/FakeTBHodoscopeRawInfoProducer.cc @@ -1,13 +1,42 @@ /* * \file FakeTBHodoscopeRawInfoProducer.cc * + * Mimic the hodoscope raw information using + * the generated vertex of the test beam simulation * */ -#include "SimG4CMS/EcalTestBeam/interface/FakeTBHodoscopeRawInfoProducer.h" +#include "DataFormats/Common/interface/Handle.h" -using namespace cms; -using namespace std; +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "Geometry/EcalTestBeam/interface/EcalTBHodoscopeGeometry.h" +#include "SimDataFormats/EcalTestBeam/interface/PEcalTBInfo.h" +#include "TBDataFormats/EcalTBObjects/interface/EcalTBHodoscopePlaneRawHits.h" +#include "TBDataFormats/EcalTBObjects/interface/EcalTBHodoscopeRawInfo.h" + +class FakeTBHodoscopeRawInfoProducer : public edm::stream::EDProducer<> { +public: + /// Constructor + explicit FakeTBHodoscopeRawInfoProducer(const edm::ParameterSet &ps); + + /// Destructor + ~FakeTBHodoscopeRawInfoProducer() override; + + /// Produce digis out of raw data + void produce(edm::Event &event, const edm::EventSetup &eventSetup) override; + +private: + EcalTBHodoscopeGeometry *theTBHodoGeom_; + + edm::EDGetTokenT ecalTBInfo_; +}; FakeTBHodoscopeRawInfoProducer::FakeTBHodoscopeRawInfoProducer(const edm::ParameterSet &ps) { ecalTBInfo_ = consumes(edm::InputTag("EcalTBInfoLabel", "SimEcalTBG4Object")); @@ -19,7 +48,7 @@ FakeTBHodoscopeRawInfoProducer::FakeTBHodoscopeRawInfoProducer(const edm::Parame FakeTBHodoscopeRawInfoProducer::~FakeTBHodoscopeRawInfoProducer() { delete theTBHodoGeom_; } void FakeTBHodoscopeRawInfoProducer::produce(edm::Event &event, const edm::EventSetup &eventSetup) { - unique_ptr product(new EcalTBHodoscopeRawInfo()); + std::unique_ptr product(new EcalTBHodoscopeRawInfo()); // get the vertex information from the event @@ -36,7 +65,7 @@ void FakeTBHodoscopeRawInfoProducer::produce(edm::Event &event, const edm::Event // to the event vertex coordinates in the TB reference frame // plane 0/2 = x plane 1/3 = y - int nPlanes = (int)theTBHodoGeom_->getNPlanes(); + int nPlanes = static_cast(theTBHodoGeom_->getNPlanes()); product->setPlanes(nPlanes); for (int iPlane = 0; iPlane < nPlanes; ++iPlane) { @@ -44,7 +73,7 @@ void FakeTBHodoscopeRawInfoProducer::produce(edm::Event &event, const edm::Event if (iPlane == 1 || iPlane == 3) theCoord = (float)partYhodo; - vector firedChannels = theTBHodoGeom_->getFiredFibresInPlane(theCoord, iPlane); + std::vector firedChannels = theTBHodoGeom_->getFiredFibresInPlane(theCoord, iPlane); unsigned int nChannels = firedChannels.size(); EcalTBHodoscopePlaneRawHits planeHit(nChannels); @@ -52,10 +81,12 @@ void FakeTBHodoscopeRawInfoProducer::produce(edm::Event &event, const edm::Event planeHit.addHit(firedChannels[i]); } - product->setPlane((unsigned int)iPlane, planeHit); + product->setPlane(static_cast(iPlane), planeHit); } LogDebug("EcalTBHodo") << (*product); event.put(std::move(product)); } + +DEFINE_FWK_MODULE(FakeTBHodoscopeRawInfoProducer); diff --git a/SimG4CMS/EcalTestBeam/plugins/SealModule.cc b/SimG4CMS/EcalTestBeam/plugins/SealModule.cc deleted file mode 100644 index 12a5c370f26b6..0000000000000 --- a/SimG4CMS/EcalTestBeam/plugins/SealModule.cc +++ /dev/null @@ -1,18 +0,0 @@ -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "SimG4CMS/EcalTestBeam/interface/EcalTBH4Trigger.h" -#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" - -#include "SimG4CMS/EcalTestBeam/interface/EcalTBMCInfoProducer.h" -DEFINE_FWK_MODULE(EcalTBMCInfoProducer); - -#include "SimG4CMS/EcalTestBeam/interface/FakeTBHodoscopeRawInfoProducer.h" -DEFINE_FWK_MODULE(FakeTBHodoscopeRawInfoProducer); - -#include "SimG4CMS/EcalTestBeam/interface/TBHodoActiveVolumeRawInfoProducer.h" -DEFINE_FWK_MODULE(TBHodoActiveVolumeRawInfoProducer); - -#include "SimG4CMS/EcalTestBeam/interface/FakeTBEventHeaderProducer.h" -DEFINE_FWK_MODULE(FakeTBEventHeaderProducer); - -DEFINE_SIMWATCHER(EcalTBH4Trigger); diff --git a/SimG4CMS/EcalTestBeam/plugins/TBHodoActiveVolumeRawInfoProducer.cc b/SimG4CMS/EcalTestBeam/plugins/TBHodoActiveVolumeRawInfoProducer.cc index b6b768a4a6768..3c64637f5f3f6 100644 --- a/SimG4CMS/EcalTestBeam/plugins/TBHodoActiveVolumeRawInfoProducer.cc +++ b/SimG4CMS/EcalTestBeam/plugins/TBHodoActiveVolumeRawInfoProducer.cc @@ -4,10 +4,43 @@ * */ -#include "SimG4CMS/EcalTestBeam/interface/TBHodoActiveVolumeRawInfoProducer.h" +#include "DataFormats/Common/interface/Handle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "Geometry/EcalTestBeam/interface/EcalTBHodoscopeGeometry.h" +#include "SimDataFormats/CaloHit/interface/PCaloHit.h" +#include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" +#include "SimDataFormats/EcalTestBeam/interface/HodoscopeDetId.h" +#include "SimDataFormats/EcalTestBeam/interface/PEcalTBInfo.h" +#include "TBDataFormats/EcalTBObjects/interface/EcalTBHodoscopePlaneRawHits.h" +#include "TBDataFormats/EcalTBObjects/interface/EcalTBHodoscopeRawInfo.h" #include +class TBHodoActiveVolumeRawInfoProducer : public edm::stream::EDProducer<> { +public: + /// Constructor + explicit TBHodoActiveVolumeRawInfoProducer(const edm::ParameterSet &ps); + + /// Destructor + ~TBHodoActiveVolumeRawInfoProducer() override; + + /// Produce digis out of raw data + void produce(edm::Event &event, const edm::EventSetup &eventSetup) override; + +private: + double myThreshold; + + edm::EDGetTokenT m_EcalToken; + EcalTBHodoscopeGeometry *theTBHodoGeom_; +}; + using namespace cms; using namespace std; @@ -83,3 +116,5 @@ void TBHodoActiveVolumeRawInfoProducer::produce(edm::Event &event, const edm::Ev event.put(std::move(product)); } + +DEFINE_FWK_MODULE(TBHodoActiveVolumeRawInfoProducer); diff --git a/SimG4CMS/FP420/interface/FP420Test.h b/SimG4CMS/FP420/interface/FP420Test.h deleted file mode 100644 index db49e64540091..0000000000000 --- a/SimG4CMS/FP420/interface/FP420Test.h +++ /dev/null @@ -1,225 +0,0 @@ -#ifndef FP420Test_H -#define FP420Test_H - -// system include files -#include -#include -#include -#include -// -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -// -// -#include "SimG4Core/Notification/interface/Observer.h" -#include "SimG4Core/Notification/interface/BeginOfJob.h" -#include "SimG4Core/Notification/interface/BeginOfRun.h" -#include "SimG4Core/Notification/interface/EndOfRun.h" -#include "SimG4Core/Notification/interface/BeginOfEvent.h" -#include "SimG4Core/Notification/interface/EndOfEvent.h" -#include "SimG4Core/Notification/interface/BeginOfTrack.h" -#include "SimG4Core/Notification/interface/EndOfTrack.h" -#include "SimG4Core/Watcher/interface/SimWatcher.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "SimG4CMS/FP420/interface/FP420G4Hit.h" - -#include "G4VTouchable.hh" -#include -#include -#include - -// ---------------------------------------------------------------- -// Includes needed for Root ntupling -// -#include "TROOT.h" -#include "TFile.h" -#include "TH1.h" -#include "TH2.h" -#include "TProfile.h" -#include "TNtuple.h" -#include "TRandom.h" -#include "TLorentzVector.h" -#include "TUnixSystem.h" -#include "TSystem.h" -#include "TMath.h" -#include "TF1.h" - -#include -#include -#include - -class Fp420AnalysisHistManager : public TNamed { -public: - Fp420AnalysisHistManager(const TString& managername); - ~Fp420AnalysisHistManager() override; - - TH1F* GetHisto(Int_t Number); - TH1F* GetHisto(const TObjString& histname); - - TH2F* GetHisto2(Int_t Number); - TH2F* GetHisto2(const TObjString& histname); - - void WriteToFile(const TString& fOutputFile, const TString& fRecreateFile); - -private: - void BookHistos(); - void StoreWeights(); - void HistInit(const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup); - void HistInit( - const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup, Int_t nbinsy, Axis_t ylow, Axis_t yup); - - const char* fTypeTitle; - TObjArray* fHistArray; - TObjArray* fHistNamesArray; -}; - -class FP420NumberingScheme; - -class BeginOfJob; -class BeginOfRun; -class EndOfRun; -class BeginOfEvent; -class EndOfEvent; -class BeginOfTrack; -class EndOfTrack; -class G4Step; - -/* -class ObserveBeginOfRun : private Observer -{ -public: - ObserveBeginOfRun(); -private: - void update(const BeginOfRun * run); -}; - -class ObserveEndOfRun : private Observer -{ -public: - ObserveEndOfRun(); -private: - void update(const EndOfRun * run); -}; - -class ObserveBeginOfEvent : private Observer -{ -public: - ObserveBeginOfEvent(); -private: - void update(const BeginOfEvent * evt); -}; - -class ObserveEndOfEvent : private Observer -{ -public: - ObserveEndOfEvent(); -private: - void update(const EndOfEvent * evt); - // std::vector theStripHits; -}; - -class ObserveBeginOfTrack : private Observer -{ -public: - ObserveBeginOfTrack(); -private: - void update(const BeginOfTrack * trk); -}; - -class ObserveEndOfTrack : private Observer -{ -public: - ObserveEndOfTrack(); -private: - void update(const EndOfTrack * trk); -}; - -class ObserveStep : private Observer -{ -public: - ObserveStep(); -private: - void update(const G4Step * step); -}; -*/ -//class FP420Test: public SimProducer, -class FP420Test : public SimWatcher, - public Observer, - public Observer, - public Observer, - public Observer, - public Observer, - public Observer, - public Observer, - public Observer { -public: - FP420Test(const edm::ParameterSet& p); - ~FP420Test() override; - //MyActions(); - //MyActions(); -private: - // observer classes - void update(const BeginOfJob* run) override; - void update(const BeginOfRun* run) override; - void update(const EndOfRun* run) override; - void update(const BeginOfEvent* evt) override; - void update(const BeginOfTrack* trk) override; - void update(const G4Step* step) override; - void update(const EndOfTrack* trk) override; - void update(const EndOfEvent* evt) override; - -private: - //UHB_Analysis* UserNtuples; - - int iev; - int itrk; - G4double entot0, tracklength0; - -private: - // Utilities to get detector levels during a step - - int detLevels(const G4VTouchable*) const; - G4String detName(const G4VTouchable*, int, int) const; - void detectorLevel(const G4VTouchable*, int&, int*, G4String*) const; - - double rinCalo, zinCalo; - int lastTrackID; - int verbosity; - - // SumEnerDeposit - all deposited energy on all steps ; SumStepl - length in steel !!! - G4double SumEnerDeposit, SumStepl, SumStepc; - // numofpart - # particles produced along primary track - int numofpart; - // last point of the primary track - G4ThreeVector lastpo; - - // z: - double z1, z2, z3, z4, zD2, zD3; - int sn0, dn0, pn0, rn0; - int rn00; - double ZSiDet, z420; - double ZGapLDet, ZBoundDet, ZSiStep, ZSiPlane, zinibeg; - double zBlade, gapBlade; - -private: - Float_t fp420eventarray[1]; - TNtuple* fp420eventntuple; - TFile fp420OutputFile; - int whichevent; - - Fp420AnalysisHistManager* TheHistManager; //Histogram Manager of the analysis - std::string fDataLabel; // Data type label - std::string fOutputFile; // The output file name - std::string fRecreateFile; // Recreate the file flag, default="RECREATE" - - // // // // // // TObjString fHistType; - // TString fDataLabel; // Data type label - // TString fOutputFile; // The output file name - // TString fRecreateFile; // Recreate the file flag, default="RECREATE" -}; - -#endif diff --git a/SimG4CMS/FP420/plugins/FP420Test.cc b/SimG4CMS/FP420/plugins/FP420Test.cc index 95ddeb1e68959..a42926b964596 100644 --- a/SimG4CMS/FP420/plugins/FP420Test.cc +++ b/SimG4CMS/FP420/plugins/FP420Test.cc @@ -3,49 +3,159 @@ // system include files #include -#include -#include -#include +#include +#include // -#include "SimG4Core/Notification/interface/BeginOfEvent.h" -#include "SimG4Core/Notification/interface/EndOfEvent.h" -#include "SimG4Core/Notification/interface/TrackWithHistory.h" -#include "SimG4Core/Notification/interface/TrackInformation.h" - +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" +// +#include "SimG4Core/Notification/interface/TrackWithHistory.h" +#include "SimG4Core/Notification/interface/TrackInformation.h" +#include "SimG4Core/Notification/interface/Observer.h" +#include "SimG4Core/Notification/interface/BeginOfJob.h" +#include "SimG4Core/Notification/interface/BeginOfRun.h" +#include "SimG4Core/Notification/interface/EndOfRun.h" +#include "SimG4Core/Notification/interface/BeginOfEvent.h" +#include "SimG4Core/Notification/interface/EndOfEvent.h" +#include "SimG4Core/Notification/interface/BeginOfTrack.h" +#include "SimG4Core/Notification/interface/EndOfTrack.h" +#include "SimG4Core/Watcher/interface/SimWatcher.h" +#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" // to retreive hits #include "SimG4CMS/FP420/interface/FP420NumberingScheme.h" #include "SimG4CMS/FP420/interface/FP420G4HitCollection.h" -#include "SimG4CMS/FP420/interface/FP420Test.h" - // G4 stuff +#include "G4HCofThisEvent.hh" +#include "G4ProcessManager.hh" #include "G4SDManager.hh" #include "G4Step.hh" #include "G4Track.hh" -#include "G4VProcess.hh" -#include "G4HCofThisEvent.hh" -#include "G4UserEventAction.hh" #include "G4TransportationManager.hh" -#include "G4ProcessManager.hh" +#include "G4UserEventAction.hh" +#include "G4VProcess.hh" +#include "G4VTouchable.hh" -#include "CLHEP/Units/GlobalSystemOfUnits.h" -#include "CLHEP/Units/GlobalPhysicalConstants.h" +#include +#include +#include //================================================================ // Root stuff +#include "TROOT.h" +#include "TFile.h" +#include "TH1.h" +#include "TH2.h" +#include "TProfile.h" +#include "TNtuple.h" +#include "TRandom.h" +#include "TLorentzVector.h" +#include "TUnixSystem.h" +#include "TSystem.h" +#include "TMath.h" +#include "TF1.h" +#include "TObjArray.h" +#include "TObjString.h" +#include "TNamed.h" + +class Fp420AnalysisHistManager : public TNamed { +public: + Fp420AnalysisHistManager(const TString& managername); + ~Fp420AnalysisHistManager() override; + + TH1F* getHisto(Int_t Number); + TH1F* getHisto(const TObjString& histname); + + TH2F* getHisto2(Int_t Number); + TH2F* getHisto2(const TObjString& histname); + + void writeToFile(const TString& fOutputFile, const TString& fRecreateFile); + +private: + void bookHistos(); + void storeWeights(); + void histInit(const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup); + void histInit( + const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup, Int_t nbinsy, Axis_t ylow, Axis_t yup); + + const char* fTypeTitle; + TObjArray* fHistArray; + TObjArray* fHistNamesArray; +}; + +class FP420Test : public SimWatcher, + public Observer, + public Observer, + public Observer, + public Observer, + public Observer, + public Observer, + public Observer, + public Observer { +public: + FP420Test(const edm::ParameterSet& p); + ~FP420Test() override; + +private: + // observer classes + void update(const BeginOfJob* run) override; + void update(const BeginOfRun* run) override; + void update(const EndOfRun* run) override; + void update(const BeginOfEvent* evt) override; + void update(const BeginOfTrack* trk) override; + void update(const G4Step* step) override; + void update(const EndOfTrack* trk) override; + void update(const EndOfEvent* evt) override; + +private: + // Utilities to get detector levels during a step + + int detLevels(const G4VTouchable*) const; + G4String detName(const G4VTouchable*, int, int) const; + void detectorLevel(const G4VTouchable*, int&, int*, G4String*) const; + + //UHB_Analysis* UserNtuples; + + int iev; + int itrk; + G4double entot0, tracklength0; + + double rinCalo, zinCalo; + int lastTrackID; + int verbosity; + + // sumEnerDeposit - all deposited energy on all steps ; sumStepl - length in steel !!! + G4double sumEnerDeposit, sumStepl, sumStepc; + // numofpart - # particles produced along primary track + int numofpart; + // last point of the primary track + G4ThreeVector lastpo; + + // z: + double z1, z2, z3, z4, zD2, zD3; + int sn0, dn0, pn0, rn0; + int rn00; + double zSiDet, z420; + double zGapLDet, zBoundDet, zSiStep, zSiPlane, zinibeg; + double zBlade, gapBlade; + + Float_t fp420eventarray[1]; + TNtuple* fp420eventntuple; + TFile fp420OutputFile; + int whichevent; + + Fp420AnalysisHistManager* theHistManager; //Histogram Manager of the analysis + std::string fDataLabel; // Data type label + std::string fOutputFile; // The output file name + std::string fRecreateFile; // Recreate the file flag, default="RECREATE" +}; -// Include the standard header to effectively include -// the standard header within the std namespace. -#include - -using namespace edm; -using namespace std; //================================================================ - -//UserVerbosity FP420Test::std::cout("FP420Test","info","FP420Test"); - enum ntfp420_elements { ntfp420_evt }; //================================================================ FP420Test::FP420Test(const edm::ParameterSet& p) { @@ -59,8 +169,8 @@ FP420Test::FP420Test(const edm::ParameterSet& p) { fRecreateFile = m_Anal.getParameter("FRecreateFile"); if (verbosity > 0) { - std::cout << "============================================================================" << std::endl; - std::cout << "FP420Testconstructor :: Initialized as observer" << std::endl; + edm::LogVerbatim("FP420Test") << "============================================================================"; + edm::LogVerbatim("FP420Test") << "FP420Testconstructor :: Initialized as observer"; } // Initialization: @@ -75,27 +185,27 @@ FP420Test::FP420Test(const edm::ParameterSet& p) { zBlade = 5.00; gapBlade = 1.6; double gapSupplane = 1.6; - ZSiPlane = 2 * zBlade + gapBlade + gapSupplane; + zSiPlane = 2 * zBlade + gapBlade + gapSupplane; - double ZKapton = 0.1; - ZSiStep = ZSiPlane + ZKapton; + double zKapton = 0.1; + zSiStep = zSiPlane + zKapton; - double ZBoundDet = 0.020; - double ZSiElectr = 0.250; - double ZCeramDet = 0.500; + double zBoundDet = 0.020; + double zSiElectr = 0.250; + double zCeramDet = 0.500; // - ZSiDet = 0.250; - ZGapLDet = zBlade / 2 - (ZSiDet + ZSiElectr + ZBoundDet + ZCeramDet / 2); + zSiDet = 0.250; + zGapLDet = zBlade / 2 - (zSiDet + zSiElectr + zBoundDet + zCeramDet / 2); // - // ZSiStation = 5*(2*(5.+1.6)+0.1)+2*6.+1.0 = 79.5 - double ZSiStation = (pn0 - 1) * (2 * (zBlade + gapBlade) + ZKapton) + 2 * 6. + 0.0; // = 78.5 + // zSiStation = 5*(2*(5.+1.6)+0.1)+2*6.+1.0 = 79.5 + double zSiStation = (pn0 - 1) * (2 * (zBlade + gapBlade) + zKapton) + 2 * 6. + 0.0; // = 78.5 // 11.=e1, 12.=e2 in zzzrectangle.xml double eee1 = 11.; double eee2 = 12.; zinibeg = (eee1 - eee2) / 2.; - z1 = zinibeg + (ZSiStation + 10.) / 2 + z420; // z1 - right after 1st Station + z1 = zinibeg + (zSiStation + 10.) / 2 + z420; // z1 - right after 1st Station z2 = z1 + zD2; //z2 - right after middle Station z3 = z1 + zD3; //z3 - right after last Station z4 = z1 + 2 * zD3; @@ -109,10 +219,10 @@ FP420Test::FP420Test(const edm::ParameterSet& p) { // fOutputFile = "TheAnlysis.root"; // fRecreateFile = "RECREATE"; - TheHistManager = new Fp420AnalysisHistManager(fDataLabel); + theHistManager = new Fp420AnalysisHistManager(fDataLabel); if (verbosity > 0) { - std::cout << "FP420Test constructor :: Initialized Fp420AnalysisHistManager" << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test constructor :: Initialized Fp420AnalysisHistManager"; } } @@ -120,20 +230,20 @@ FP420Test::~FP420Test() { // delete UserNtuples; TFile fp420OutputFile("newntfp420.root", "RECREATE"); - std::cout << "FP420 output root file has been created"; + edm::LogVerbatim("FP420Test") << "FP420 output root file has been created"; fp420eventntuple->Write(); - std::cout << ", written"; + edm::LogVerbatim("FP420Test") << "FP420 output root file has been written"; fp420OutputFile.Close(); - std::cout << ", closed"; + edm::LogVerbatim("FP420Test") << "FP420 output root file has been closed"; delete fp420eventntuple; - std::cout << ", and deleted" << std::endl; + edm::LogVerbatim("FP420Test") << "FP420 output root file pointer has been deleted"; //------->while end // Write histograms to file - TheHistManager->WriteToFile(fOutputFile, fRecreateFile); + theHistManager->writeToFile(fOutputFile, fRecreateFile); if (verbosity > 0) { - std::cout << std::endl << "FP420Test Destructor --------> End of FP420Test : " << std::endl; + edm::LogVerbatim("FP420Test") << std::endl << "FP420Test Destructor --------> End of FP420Test : "; } } @@ -149,12 +259,12 @@ Fp420AnalysisHistManager::Fp420AnalysisHistManager(const TString& managername) { fHistNamesArray = new TObjArray(); // Array to store histos's names TH1::AddDirectory(kFALSE); - BookHistos(); + bookHistos(); fHistArray->Compress(); // Removes empty space fHistNamesArray->Compress(); - // StoreWeights(); // Store the weights + // storeWeights(); // Store the weights } //----------------------------------------------------------------------------- @@ -173,36 +283,36 @@ Fp420AnalysisHistManager::~Fp420AnalysisHistManager() { } //----------------------------------------------------------------------------- -void Fp420AnalysisHistManager::BookHistos() { +void Fp420AnalysisHistManager::bookHistos() { // at Start: (mm) - HistInit("PrimaryEta", "Primary Eta", 100, 9., 12.); - HistInit("PrimaryPhigrad", "Primary Phigrad", 100, 0., 360.); - HistInit("PrimaryTh", "Primary Th", 100, 0., 180.); - HistInit("PrimaryLastpoZ", "Primary Lastpo Z", 100, -200., 430000.); - HistInit("PrimaryLastpoX", "Primary Lastpo X Z10", 100, -30., 30.); - HistInit("YLastpoNumofpart", "Primary Lastpo Y n>10", 100, -30., 30.); - HistInit("VtxX", "Vtx X", 100, -50., 50.); - HistInit("VtxY", "Vtx Y", 100, -50., 50.); - HistInit("VtxZ", "Vtx Z", 100, -200., 430000.); + histInit("PrimaryEta", "Primary Eta", 100, 9., 12.); + histInit("PrimaryPhigrad", "Primary Phigrad", 100, 0., 360.); + histInit("PrimaryTh", "Primary Th", 100, 0., 180.); + histInit("PrimaryLastpoZ", "Primary Lastpo Z", 100, -200., 430000.); + histInit("PrimaryLastpoX", "Primary Lastpo X Z10", 100, -30., 30.); + histInit("YLastpoNumofpart", "Primary Lastpo Y n>10", 100, -30., 30.); + histInit("VtxX", "Vtx X", 100, -50., 50.); + histInit("VtxY", "Vtx Y", 100, -50., 50.); + histInit("VtxZ", "Vtx Z", 100, -200., 430000.); // Book the histograms and add them to the array - HistInit("SumEDep", "This is sum Energy deposited", 100, -1, 199.); - HistInit("TrackL", "This is TrackL", 100, 0., 12000.); - HistInit("zHits", "z Hits all events", 100, 400000., 430000.); - HistInit("zHitsnoMI", "z Hits no MI", 100, 400000., 430000.); - HistInit("zHitsTrLoLe", "z Hits TrLength bigger 8300", 100, 400000., 430000.); - HistInit("NumberOfHits", "NumberOfHits", 100, 0., 300.); + histInit("SumEDep", "This is sum Energy deposited", 100, -1, 199.); + histInit("TrackL", "This is TrackL", 100, 0., 12000.); + histInit("zHits", "z Hits all events", 100, 400000., 430000.); + histInit("zHitsnoMI", "z Hits no MI", 100, 400000., 430000.); + histInit("zHitsTrLoLe", "z Hits TrLength bigger 8300", 100, 400000., 430000.); + histInit("NumberOfHits", "NumberOfHits", 100, 0., 300.); } //----------------------------------------------------------------------------- -void Fp420AnalysisHistManager::WriteToFile(const TString& fOutputFile, const TString& fRecreateFile) { +void Fp420AnalysisHistManager::writeToFile(const TString& fOutputFile, const TString& fRecreateFile) { //Write to file = fOutputFile - std::cout << "================================================================" << std::endl; - std::cout << " Write this Analysis to File " << fOutputFile << std::endl; - std::cout << "================================================================" << std::endl; + edm::LogVerbatim("FP420Test") << "================================================================"; + edm::LogVerbatim("FP420Test") << " Write this Analysis to File " << fOutputFile; + edm::LogVerbatim("FP420Test") << "================================================================"; TFile* file = new TFile(fOutputFile, fRecreateFile); @@ -211,7 +321,7 @@ void Fp420AnalysisHistManager::WriteToFile(const TString& fOutputFile, const TSt } //----------------------------------------------------------------------------- -void Fp420AnalysisHistManager::HistInit(const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup) { +void Fp420AnalysisHistManager::histInit(const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup) { // Add histograms and histograms names to the array char* newtitle = new char[strlen(title) + strlen(fTypeTitle) + 5]; @@ -224,7 +334,7 @@ void Fp420AnalysisHistManager::HistInit(const char* name, const char* title, Int } //----------------------------------------------------------------------------- -void Fp420AnalysisHistManager::HistInit( +void Fp420AnalysisHistManager::histInit( const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup, Int_t nbinsy, Axis_t ylow, Axis_t yup) { // Add histograms and histograms names to the array @@ -238,55 +348,55 @@ void Fp420AnalysisHistManager::HistInit( } //----------------------------------------------------------------------------- -TH1F* Fp420AnalysisHistManager::GetHisto(Int_t Number) { +TH1F* Fp420AnalysisHistManager::getHisto(Int_t Number) { // Get a histogram from the array with index = Number if (Number <= fHistArray->GetLast() && fHistArray->At(Number) != (TObject*)nullptr) { return (TH1F*)(fHistArray->At(Number)); } else { - std::cout << "!!!!!!!!!!!!!!!!!!GetHisto!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl; - std::cout << " WARNING ERROR - HIST ID INCORRECT (TOO HIGH) - " << Number << std::endl; - std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl; + edm::LogVerbatim("FP420Test") << "!!!!!!!!!!!!!!!!!!getHisto!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; + edm::LogVerbatim("FP420Test") << " WARNING ERROR - HIST ID INCORRECT (TOO HIGH) - " << Number; + edm::LogVerbatim("FP420Test") << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; return (TH1F*)(fHistArray->At(0)); } } //----------------------------------------------------------------------------- -TH2F* Fp420AnalysisHistManager::GetHisto2(Int_t Number) { +TH2F* Fp420AnalysisHistManager::getHisto2(Int_t Number) { // Get a histogram from the array with index = Number if (Number <= fHistArray->GetLast() && fHistArray->At(Number) != (TObject*)nullptr) { return (TH2F*)(fHistArray->At(Number)); } else { - std::cout << "!!!!!!!!!!!!!!!!GetHisto2!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl; - std::cout << " WARNING ERROR - HIST ID INCORRECT (TOO HIGH) - " << Number << std::endl; - std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl; + edm::LogVerbatim("FP420Test") << "!!!!!!!!!!!!!!!!getHisto2!!!!!!!!!!!!!!!!!!!!!!!!!!!"; + edm::LogVerbatim("FP420Test") << " WARNING ERROR - HIST ID INCORRECT (TOO HIGH) - " << Number; + edm::LogVerbatim("FP420Test") << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; return (TH2F*)(fHistArray->At(0)); } } //----------------------------------------------------------------------------- -TH1F* Fp420AnalysisHistManager::GetHisto(const TObjString& histname) { +TH1F* Fp420AnalysisHistManager::getHisto(const TObjString& histname) { // Get a histogram from the array with name = histname Int_t index = fHistNamesArray->IndexOf(&histname); - return GetHisto(index); + return getHisto(index); } //----------------------------------------------------------------------------- -TH2F* Fp420AnalysisHistManager::GetHisto2(const TObjString& histname) { +TH2F* Fp420AnalysisHistManager::getHisto2(const TObjString& histname) { // Get a histogram from the array with name = histname Int_t index = fHistNamesArray->IndexOf(&histname); - return GetHisto2(index); + return getHisto2(index); } //----------------------------------------------------------------------------- -void Fp420AnalysisHistManager::StoreWeights() { +void Fp420AnalysisHistManager::storeWeights() { // Add structure to each histogram to store the weights for (int i = 0; i < fHistArray->GetEntries(); i++) { @@ -303,7 +413,7 @@ void Fp420AnalysisHistManager::StoreWeights() { //==================================================================== per JOB void FP420Test::update(const BeginOfJob* job) { //job - std::cout << "FP420Test:beggining of job" << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test:beggining of job"; ; } @@ -311,7 +421,7 @@ void FP420Test::update(const BeginOfJob* job) { void FP420Test::update(const BeginOfRun* run) { //run - std::cout << std::endl << "FP420Test:: Begining of Run" << std::endl; + edm::LogVerbatim("FP420Test") << std::endl << "FP420Test:: Begining of Run"; } void FP420Test::update(const EndOfRun* run) { ; } @@ -320,7 +430,7 @@ void FP420Test::update(const EndOfRun* run) { ; } void FP420Test::update(const BeginOfEvent* evt) { iev = (*evt)()->GetEventID(); if (verbosity > 0) { - std::cout << "FP420Test:update Event number = " << iev << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test:update Event number = " << iev; } whichevent++; } @@ -329,13 +439,13 @@ void FP420Test::update(const BeginOfEvent* evt) { void FP420Test::update(const BeginOfTrack* trk) { itrk = (*trk)()->GetTrackID(); if (verbosity > 1) { - std::cout << "FP420Test:update BeginOfTrack number = " << itrk << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test:update BeginOfTrack number = " << itrk; } if (itrk == 1) { - SumEnerDeposit = 0.; + sumEnerDeposit = 0.; numofpart = 0; - SumStepl = 0.; - SumStepc = 0.; + sumStepl = 0.; + sumStepc = 0.; tracklength0 = 0.; } } @@ -344,13 +454,13 @@ void FP420Test::update(const BeginOfTrack* trk) { void FP420Test::update(const EndOfTrack* trk) { itrk = (*trk)()->GetTrackID(); if (verbosity > 1) { - std::cout << "FP420Test:update EndOfTrack number = " << itrk << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test:update EndOfTrack number = " << itrk; } if (itrk == 1) { G4double tracklength = (*trk)()->GetTrackLength(); // Accumulated track length - TheHistManager->GetHisto("SumEDep")->Fill(SumEnerDeposit); - TheHistManager->GetHisto("TrackL")->Fill(tracklength); + theHistManager->getHisto("SumEDep")->Fill(sumEnerDeposit); + theHistManager->getHisto("TrackL")->Fill(tracklength); // direction !!! G4ThreeVector vert_mom = (*trk)()->GetVertexMomentumDirection(); @@ -364,30 +474,30 @@ void FP420Test::update(const EndOfTrack* trk) { // float XV = vert_pos.x(); // mm // float YV = vert_pos.y(); // mm //UserNtuples->fillg543(phigrad,1.); - //UserNtuples->fillp203(phigrad,SumStepl,1.); + //UserNtuples->fillp203(phigrad,sumStepl,1.); //UserNtuples->fillg544(XV,1.); - //UserNtuples->fillp201(XV,SumStepl,1.); + //UserNtuples->fillp201(XV,sumStepl,1.); //UserNtuples->fillg545(YV,1.); - //UserNtuples->fillp202(YV,SumStepl,1.); + //UserNtuples->fillp202(YV,sumStepl,1.); //UserNtuples->fillg524(eta,1.); - //UserNtuples->fillg534(SumStepl,1.); - //UserNtuples->fillg535(eta,SumStepl); - //UserNtuples->fillp207(eta,SumStepl,1.); - //UserNtuples->filld217(eta,SumStepl,1.); - //UserNtuples->filld220(phigrad,SumStepl,1.); - //UserNtuples->filld221(XV,SumStepl,1.); - //UserNtuples->filld222(YV,SumStepl,1.); - //UserNtuples->fillg537(SumStepc,1.); - //UserNtuples->fillg84(SumStepl,1.); + //UserNtuples->fillg534(sumStepl,1.); + //UserNtuples->fillg535(eta,sumStepl); + //UserNtuples->fillp207(eta,sumStepl,1.); + //UserNtuples->filld217(eta,sumStepl,1.); + //UserNtuples->filld220(phigrad,sumStepl,1.); + //UserNtuples->filld221(XV,sumStepl,1.); + //UserNtuples->filld222(YV,sumStepl,1.); + //UserNtuples->fillg537(sumStepc,1.); + //UserNtuples->fillg84(sumStepl,1.); // MI = (multiple interactions): if (tracklength < z4) { // //UserNtuples->fillp208(eta,tracklength,1.); //UserNtuples->filld218(eta,tracklength,1.); - //UserNtuples->fillg538(SumStepc,1.); - //UserNtuples->fillg85(SumStepl,1.); + //UserNtuples->fillg538(sumStepc,1.); + //UserNtuples->fillg85(sumStepl,1.); } // last step information @@ -446,13 +556,13 @@ void FP420Test::update(const G4Step* aStep) { if (verbosity > 2) { G4int stepnumber = aStep->GetTrack()->GetCurrentStepNumber(); - std::cout << "FP420Test:update Step number = " << stepnumber << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test:update Step number = " << stepnumber; } // track on aStep: ! G4Track* theTrack = aStep->GetTrack(); TrackInformation* trkInfo = dynamic_cast(theTrack->GetUserInformation()); if (trkInfo == nullptr) { - std::cout << "FP420Test on aStep: No trk info !!!! abort " << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test on aStep: No trk info !!!! abort "; } G4int id = theTrack->GetTrackID(); G4String particleType = theTrack->GetDefinition()->GetParticleName(); // !!! @@ -475,7 +585,7 @@ void FP420Test::update(const G4Step* aStep) { //G4double trackvel = theTrack->GetVelocity(); - //std::cout << " trackstatus= " << trackstatus << " entot= " << entot << std::endl; + //edm::LogVerbatim("FP420Test") << " trackstatus= " << trackstatus << " entot= " << entot ; // step points: ! G4double stepl = aStep->GetStepLength(); @@ -506,54 +616,6 @@ void FP420Test::update(const G4Step* aStep) { detectorLevel(pre_touch, pre_levels, copyno1, name1); } - // G4LogicalVolume* lv = currentPV->GetLogicalVolume(); - // G4Material* mat = lv->GetMaterial(); - // std::string prenameVolume; - // prenameVolume.assign(prename,0,20); - - // G4double prebeta = preStepPoint->GetBeta(); - // G4double precharge = preStepPoint->GetCharge(); - // G4double prerad = mat->GetRadlen(); - - // std::cout << " EneryDeposited = " << EnerDeposit << std::endl; - // std::cout << " prevolume = " << prename << std::endl; - //// std::cout << " posvolume = " << aStep->GetPostStepPoint()->GetPhysicalVolume()->GetName() << std::endl; - // std::cout << " preposition = " << preposition << std::endl; - /* - // postStep - G4StepPoint* postStepPoint = aStep->GetPostStepPoint(); - G4ThreeVector posposition = postStepPoint->GetPosition(); - G4ThreeVector poslocalpoint = theTrack->GetTouchable()->GetHistory()-> - GetTopTransform().TransformPoint(posposition); - G4VPhysicalVolume* poscurrentPV = postStepPoint->GetPhysicalVolume(); - G4String posname = poscurrentPV->GetName(); -// G4LogicalVolume* poslv = poscurrentPV->GetLogicalVolume(); -// G4Material* posmat = poslv->GetMaterial(); -// std::string posnameVolume; -// posnameVolume.assign(posname,0,20); - -#ifdef ddebug - std::cout << "============posStep: information:============" << std::endl; - std::cout << " posposition = " << posposition - << " poslocalpoint = " << poslocalpoint - << " posvolume = " << posname - // << " posnameVolume = " << posnameVolume - << std::endl; - - std::cout << " ==========================================" << std::endl; -#endif - - -*/ - - // // - // // - - // 24.01.2006: - // tr : id parentID trackstatus tracklength curstepnumber entot vert_pos - // st : stepl EnerDeposit - // prestep: preposition prevolume = SBSTm SIDETL SIDETR name= SISTATION copy= 1,2,3 name= SIPLANE copy= 1..5..10 - // gen_track: // id=1 parentID=1 trackstatus=0,2 tracklength(accumulated) curstepnumber entot vert_pos if (id == 1) { @@ -567,13 +629,13 @@ void FP420Test::update(const G4Step* aStep) { // for Copper: if (prename == "SBST") { - SumStepc += stepl; + sumStepc += stepl; // ========= } // for ststeel: // if(prename == "SBSTs") { if (prename == "SBSTs") { - SumStepl += stepl; + sumStepl += stepl; // ========= } // ========= @@ -691,7 +753,7 @@ void FP420Test::update(const G4Step* aStep) { // deposition of energy on steps along primary track //UserNtuples->fillg500(EnerDeposit,1.); // collect sum deposited energy on all steps along primary track - SumEnerDeposit += EnerDeposit; + sumEnerDeposit += EnerDeposit; // position of step for primary track: //UserNtuples->fillg501(preposition.x(),1.); //UserNtuples->fillg502(preposition.y(),1.); @@ -792,7 +854,7 @@ void FP420Test::update(const EndOfEvent* evt) { if (verbosity > 1) { iev = (*evt)()->GetEventID(); - std::cout << "FP420Test:update EndOfEvent = " << iev << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test:update EndOfEvent = " << iev; } // Fill-in ntuple fp420eventarray[ntfp420_evt] = (float)whichevent; @@ -804,17 +866,17 @@ void FP420Test::update(const EndOfEvent* evt) { // prim.vertex: G4int nvertex = (*evt)()->GetNumberOfPrimaryVertex(); if (nvertex != 1) - std::cout << "FP420Test: My warning: NumberOfPrimaryVertex != 1 --> = " << nvertex << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test: My warning: NumberOfPrimaryVertex != 1 --> = " << nvertex; for (int i = 0; i < nvertex; i++) { G4PrimaryVertex* avertex = (*evt)()->GetPrimaryVertex(i); if (avertex == nullptr) - std::cout << "FP420Test End Of Event ERR: pointer to vertex = 0" << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test End Of Event ERR: pointer to vertex = 0"; G4int npart = avertex->GetNumberOfParticle(); if (npart != 1) - std::cout << "FP420Test: My warning: NumberOfPrimaryPart != 1 --> = " << npart << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test: My warning: NumberOfPrimaryPart != 1 --> = " << npart; if (npart == 0) - std::cout << "FP420Test End Of Event ERR: no NumberOfParticle" << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test End Of Event ERR: no NumberOfParticle"; // find just primary track: track pointer: thePrim if (thePrim == nullptr) @@ -829,9 +891,9 @@ void FP420Test::update(const EndOfEvent* evt) { //UserNtuples->fillh01(vx); //UserNtuples->fillh02(vy); //UserNtuples->fillh03(vz); - TheHistManager->GetHisto("VtxX")->Fill(vx); - TheHistManager->GetHisto("VtxY")->Fill(vy); - TheHistManager->GetHisto("VtxZ")->Fill(vz); + theHistManager->getHisto("VtxX")->Fill(vx); + theHistManager->getHisto("VtxY")->Fill(vy); + theHistManager->getHisto("VtxZ")->Fill(vz); } } // prim.vertex loop end @@ -880,18 +942,18 @@ void FP420Test::update(const EndOfEvent* evt) { //UserNtuples->fillg14(lastpo.y(),1.); //UserNtuples->fillg15(lastpo.z(),1.); - TheHistManager->GetHisto("PrimaryEta")->Fill(eta); - TheHistManager->GetHisto("PrimaryPhigrad")->Fill(phigrad); - TheHistManager->GetHisto("PrimaryTh")->Fill(th * 180. / pi); + theHistManager->getHisto("PrimaryEta")->Fill(eta); + theHistManager->getHisto("PrimaryPhigrad")->Fill(phigrad); + theHistManager->getHisto("PrimaryTh")->Fill(th * 180. / pi); - TheHistManager->GetHisto("PrimaryLastpoZ")->Fill(lastpo.z()); + theHistManager->getHisto("PrimaryLastpoZ")->Fill(lastpo.z()); if (lastpo.z() < z4) { - TheHistManager->GetHisto("PrimaryLastpoX")->Fill(lastpo.x()); - TheHistManager->GetHisto("PrimaryLastpoY")->Fill(lastpo.y()); + theHistManager->getHisto("PrimaryLastpoX")->Fill(lastpo.x()); + theHistManager->getHisto("PrimaryLastpoY")->Fill(lastpo.y()); } if (numofpart > 4) { - TheHistManager->GetHisto("XLastpoNumofpart")->Fill(lastpo.x()); - TheHistManager->GetHisto("YLastpoNumofpart")->Fill(lastpo.y()); + theHistManager->getHisto("XLastpoNumofpart")->Fill(lastpo.x()); + theHistManager->getHisto("YLastpoNumofpart")->Fill(lastpo.y()); } // ========================================================================== @@ -899,32 +961,32 @@ void FP420Test::update(const EndOfEvent* evt) { // hit map for FP420 // ================================== - map > themap; - map > themap1; + std::map > themap; + std::map > themap1; - map > themapxy; - map > themapz; + std::map > themapxy; + std::map > themapz; // access to the G4 hit collections: -----> this work OK: // edm::LogInfo("FP420Test") << "1"; G4HCofThisEvent* allHC = (*evt)()->GetHCofThisEvent(); // edm::LogInfo("FP420Test") << "2"; if (verbosity > 0) { - std::cout << "FP420Test: accessed all HC" << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test: accessed all HC"; ; } int CAFIid = G4SDManager::GetSDMpointer()->GetCollectionID("FP420SI"); // edm::LogInfo("FP420Test") << "3"; - // std::cout << " CAFIid = " << CAFIid << std::endl;; + // edm::LogVerbatim("FP420Test") << " CAFIid = " << CAFIid;; FP420G4HitCollection* theCAFI = (FP420G4HitCollection*)allHC->GetHC(CAFIid); // CaloG4HitCollection* theCAFI = (CaloG4HitCollection*) allHC->GetHC(CAFIid); if (verbosity > 0) { - //std::cout << "FP420Test: theCAFI = " << theCAFI << std::endl; - std::cout << "FP420Test: theCAFI->entries = " << theCAFI->entries() << std::endl; + //edm::LogVerbatim("FP420Test") << "FP420Test: theCAFI = " << theCAFI; + edm::LogVerbatim("FP420Test") << "FP420Test: theCAFI->entries = " << theCAFI->entries(); } // edm::LogInfo("FP420Test") << "theCAFI->entries="<< theCAFI->entries(); - TheHistManager->GetHisto("NumberOfHits")->Fill(theCAFI->entries()); + theHistManager->getHisto("NumberOfHits")->Fill(theCAFI->entries()); // access to the G4 hit collections ----> variant 2: give 0 hits // FP420G4HitCollection * theCAFI; @@ -958,9 +1020,9 @@ void FP420Test::update(const EndOfEvent* evt) { FP420G4Hit* aHit = (*theCAFI)[j]; G4ThreeVector hitPoint = aHit->getEntry(); double zz = hitPoint.z(); - TheHistManager->GetHisto("zHits")->Fill(zz); + theHistManager->getHisto("zHits")->Fill(zz); if (tracklength0 > 8300.) - TheHistManager->GetHisto("zHitsTrLoLe")->Fill(zz); + theHistManager->getHisto("zHitsTrLoLe")->Fill(zz); } // varia = 0; // if( varia == 0) { @@ -1015,10 +1077,10 @@ void FP420Test::update(const EndOfEvent* evt) { // double yy = hitPoint.y(); double zz = hitPoint.z(); - TheHistManager->GetHisto("zHitsnoMI")->Fill(zz); + theHistManager->getHisto("zHitsnoMI")->Fill(zz); if (verbosity > 2) { - std::cout << "FP420Test:zHits = " << zz << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test:zHits = " << zz; } // double rr = hitPoint.perp(); /* @@ -1037,7 +1099,7 @@ void FP420Test::update(const EndOfEvent* evt) { FP420NumberingScheme::unpackFP420Index(unitID, det, zside, sector, zmodule); int justlayer = FP420NumberingScheme::unpackLayerIndex(rn00, zside); // 1,2 if (justlayer < 1 || justlayer > 2) { - std::cout << "FP420Test:WRONG justlayer= " << justlayer << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test:WRONG justlayer= " << justlayer; } // zside=1,2 ; zmodule=1,10 ; sector=1,3 //UserNtuples->fillg44(float(sector),1.); @@ -1055,15 +1117,16 @@ void FP420Test::update(const EndOfEvent* evt) { G4ThreeVector middle = (hitExitLocalPoint - hitEntryLocalPoint) / 2.; themapz[unitID] = hitPoint.z() + fabs(middle.z()); if (verbosity > 2) { - std::cout << "1111111111111111111111111111111111111111111111111111111111111111111111111 " << std::endl; - std::cout << "FP420Test: det, zside, sector, zmodule = " << det << zside << sector << zmodule << std::endl; - std::cout << "FP420Test: justlayer = " << justlayer << std::endl; - std::cout << "FP420Test: hitExitLocalPoint = " << hitExitLocalPoint << std::endl; - std::cout << "FP420Test: hitEntryLocalPoint = " << hitEntryLocalPoint << std::endl; - std::cout << "FP420Test: middle= " << middle << std::endl; - std::cout << "FP420Test: hitPoint.z()-419000.= " << hitPoint.z() - 419000. << std::endl; - - std::cout << "FP420Test:zHits-419000. = " << themapz[unitID] - 419000. << std::endl; + edm::LogVerbatim("FP420Test") << "1111111111111111111111111111111111111111111111111111111111111111111111111 "; + edm::LogVerbatim("FP420Test") << "FP420Test: det, zside, sector, zmodule = " << det << zside << sector + << zmodule; + edm::LogVerbatim("FP420Test") << "FP420Test: justlayer = " << justlayer; + edm::LogVerbatim("FP420Test") << "FP420Test: hitExitLocalPoint = " << hitExitLocalPoint; + edm::LogVerbatim("FP420Test") << "FP420Test: hitEntryLocalPoint = " << hitEntryLocalPoint; + edm::LogVerbatim("FP420Test") << "FP420Test: middle= " << middle; + edm::LogVerbatim("FP420Test") << "FP420Test: hitPoint.z()-419000.= " << hitPoint.z() - 419000.; + + edm::LogVerbatim("FP420Test") << "FP420Test:zHits-419000. = " << themapz[unitID] - 419000.; } //======================================= // Y @@ -1142,7 +1205,7 @@ void FP420Test::update(const EndOfEvent* evt) { //UserNtuples->fillg56(dx,1.); //UserNtuples->fillg57(dy,1.); //UserNtuples->fillg20(numofpart,1.); - //UserNtuples->fillg21(SumEnerDeposit,1.); + //UserNtuples->fillg21(sumEnerDeposit,1.); if (zside == 1) { //UserNtuples->fillg26(losenergy,1.); } @@ -1162,7 +1225,7 @@ void FP420Test::update(const EndOfEvent* evt) { //UserNtuples->fillg52(dx,1.); //UserNtuples->fillg53(dy,1.); //UserNtuples->fillg22(numofpart,1.); - //UserNtuples->fillg23(SumEnerDeposit,1.); + //UserNtuples->fillg23(sumEnerDeposit,1.); //UserNtuples->fillg80(incidentEnergyHit,1.); //UserNtuples->fillg81(float(trackIDhit),1.); if (zside == 1) { @@ -1184,7 +1247,7 @@ void FP420Test::update(const EndOfEvent* evt) { //UserNtuples->fillg69(dy,1.); //UserNtuples->filld210(xx,yy,1.); //UserNtuples->fillg22(numofpart,1.); - //UserNtuples->fillg23(SumEnerDeposit,1.); + //UserNtuples->fillg23(sumEnerDeposit,1.); if (zside == 1) { //UserNtuples->fillg28(losenergy,1.); } @@ -1210,7 +1273,7 @@ void FP420Test::update(const EndOfEvent* evt) { // int rn00=3;//test only with 2 sensors in superlayer, not 4 // int rn00=rn0;//always if (verbosity > 2) { - std::cout << "22222222222222222222222222222222222222222222222222222222222222222222222222 " << std::endl; + edm::LogVerbatim("FP420Test") << "22222222222222222222222222222222222222222222222222222222222222222222222222 "; } int det = 1; int allplacesforsensors = 7; @@ -1219,21 +1282,21 @@ void FP420Test::update(const EndOfEvent* evt) { for (int zsideinorder = 1; zsideinorder < allplacesforsensors; zsideinorder++) { int zside = FP420NumberingScheme::realzside(rn00, zsideinorder); //1,3,5,2,4,6 if (verbosity > 2) { - std::cout << "FP420Test: sector= " << sector << " zmodule= " << zmodule - << " zsideinorder= " << zsideinorder << " zside= " << zside << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test: sector= " << sector << " zmodule= " << zmodule + << " zsideinorder= " << zsideinorder << " zside= " << zside; } if (zside != 0) { int justlayer = FP420NumberingScheme::unpackLayerIndex(rn00, zside); // 1,2 if (justlayer < 1 || justlayer > 2) { - std::cout << "FP420Test:WRONG justlayer= " << justlayer << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test:WRONG justlayer= " << justlayer; } int copyinlayer = FP420NumberingScheme::unpackCopyIndex(rn00, zside); // 1,2,3 if (copyinlayer < 1 || copyinlayer > 3) { - std::cout << "FP420Test:WRONG copyinlayer= " << copyinlayer << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test:WRONG copyinlayer= " << copyinlayer; } int orientation = FP420NumberingScheme::unpackOrientation(rn00, zside); // Front: = 1; Back: = 2 if (orientation < 1 || orientation > 2) { - std::cout << "FP420Test:WRONG orientation= " << orientation << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test:WRONG orientation= " << orientation; } // iu is a continues numbering of planes(!) over two arm FP420 set up @@ -1244,8 +1307,9 @@ void FP420Test::update(const EndOfEvent* evt) { FP420NumberingScheme::packMYIndex(rn00, pn0, sn0, detfixed, justlayer, sector, zmodule) - 1; // ii = 0-19 --> 20 items if (verbosity > 2) { - std::cout << "FP420Test: justlayer = " << justlayer << " copyinlayer = " << copyinlayer - << " orientation = " << orientation << " ii= " << ii << std::endl; + edm::LogVerbatim("FP420Test") + << "FP420Test: justlayer = " << justlayer << " copyinlayer = " << copyinlayer + << " orientation = " << orientation << " ii= " << ii; } double zdiststat = 0.; if (sn0 < 4) { @@ -1258,23 +1322,23 @@ void FP420Test::update(const EndOfEvent* evt) { zdiststat = zD3; } double kplane = -(pn0 - 1) / 2 - 0.5 + (zmodule - 1); //-3.5 +0...5 = -3.5,-2.5,-1.5,+2.5,+1.5 - double zcurrent = zinibeg + z420 + (ZSiStep - ZSiPlane) / 2 + kplane * ZSiStep + zdiststat; - //double zcurrent = zinibeg +(ZSiStep-ZSiPlane)/2 + kplane*ZSiStep + (sector-1)*zUnit; + double zcurrent = zinibeg + z420 + (zSiStep - zSiPlane) / 2 + kplane * zSiStep + zdiststat; + //double zcurrent = zinibeg +(zSiStep-zSiPlane)/2 + kplane*zSiStep + (sector-1)*zUnit; if (verbosity > 2) { - std::cout << "FP420Test: Leftzcurrent-419000. = " << zcurrent - 419000. << std::endl; - std::cout << "FP420Test: ZGapLDet = " << ZGapLDet << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test: Leftzcurrent-419000. = " << zcurrent - 419000.; + edm::LogVerbatim("FP420Test") << "FP420Test: zGapLDet = " << zGapLDet; } if (justlayer == 1) { if (orientation == 1) - zcurrent += (ZGapLDet + ZSiDet / 2); + zcurrent += (zGapLDet + zSiDet / 2); if (orientation == 2) - zcurrent += zBlade - (ZGapLDet + ZSiDet / 2); + zcurrent += zBlade - (zGapLDet + zSiDet / 2); } if (justlayer == 2) { if (orientation == 1) - zcurrent += (ZGapLDet + ZSiDet / 2) + zBlade + gapBlade; + zcurrent += (zGapLDet + zSiDet / 2) + zBlade + gapBlade; if (orientation == 2) - zcurrent += 2 * zBlade + gapBlade - (ZGapLDet + ZSiDet / 2); + zcurrent += 2 * zBlade + gapBlade - (zGapLDet + zSiDet / 2); } // . // @@ -1282,7 +1346,7 @@ void FP420Test::update(const EndOfEvent* evt) { zcurrent = -zcurrent; // if (verbosity > 2) { - std::cout << "FP420Test: zcurrent-419000. = " << zcurrent - 419000. << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test: zcurrent-419000. = " << zcurrent - 419000.; } //================================== end of for loops in continuius number iu: } //if(zside!=0 @@ -1291,16 +1355,17 @@ void FP420Test::update(const EndOfEvent* evt) { } // for sector if (verbosity > 2) { - std::cout << "----------------------------------------------------------------------------- " << std::endl; + edm::LogVerbatim("FP420Test") + << "----------------------------------------------------------------------------- "; } //======================================================================================================CHECK if (totallosenergy == 0.0) { - std::cout << "FP420Test: number of hits = " << theCAFI->entries() << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test: number of hits = " << theCAFI->entries(); for (int j = 0; j < nhits; j++) { FP420G4Hit* aHit = (*theCAFI)[j]; double losenergy = aHit->getEnergyLoss(); - std::cout << " j hits = " << j << "losenergy = " << losenergy << std::endl; + edm::LogVerbatim("FP420Test") << " j hits = " << j << "losenergy = " << losenergy; } } //======================================================================================================CHECK @@ -1377,8 +1442,8 @@ void FP420Test::update(const EndOfEvent* evt) { //=========================== thePrim != 0 end === // ========================================================================== if (verbosity > 0) { - std::cout << "FP420Test: END OF Event " << (*evt)()->GetEventID() << std::endl; + edm::LogVerbatim("FP420Test") << "FP420Test: END OF Event " << (*evt)()->GetEventID(); } } -// ========================================================================== +DEFINE_SIMWATCHER(FP420Test); //= diff --git a/SimG4CMS/FP420/plugins/module.cc b/SimG4CMS/FP420/plugins/module.cc deleted file mode 100644 index fcc8aee1713b1..0000000000000 --- a/SimG4CMS/FP420/plugins/module.cc +++ /dev/null @@ -1,5 +0,0 @@ -#include "SimG4CMS/FP420/interface/FP420Test.h" -#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" -#include "FWCore/PluginManager/interface/ModuleDef.h" - -DEFINE_SIMWATCHER(FP420Test); //= diff --git a/SimG4CMS/Forward/interface/BscTest.h b/SimG4CMS/Forward/interface/BscTest.h deleted file mode 100644 index f03e010c77fa5..0000000000000 --- a/SimG4CMS/Forward/interface/BscTest.h +++ /dev/null @@ -1,226 +0,0 @@ -#ifndef BscTest_H -#define BscTest_H - -// system include files -#include -#include -#include -#include -// -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -// -// -#include "SimG4Core/Notification/interface/Observer.h" -#include "SimG4Core/Notification/interface/BeginOfJob.h" -#include "SimG4Core/Notification/interface/BeginOfRun.h" -#include "SimG4Core/Notification/interface/EndOfRun.h" -#include "SimG4Core/Notification/interface/BeginOfEvent.h" -#include "SimG4Core/Notification/interface/EndOfEvent.h" -#include "SimG4Core/Notification/interface/BeginOfTrack.h" -#include "SimG4Core/Notification/interface/EndOfTrack.h" -#include "SimG4Core/Watcher/interface/SimWatcher.h" -//#include "SimG4Core/Watcher/interface/SimProducer.h" -//#include "SimG4Core/Watcher/interface/SimWatcherMaker.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "SimG4CMS/Forward/interface/BscG4Hit.h" - -#include "G4VTouchable.hh" -#include -#include -#include -#include -#include -// #include - -// ---------------------------------------------------------------- -// Includes needed for Root ntupling -// -#include "TROOT.h" -#include "TFile.h" -#include "TH1.h" -#include "TH2.h" -#include "TProfile.h" -#include "TNtuple.h" -#include "TRandom.h" -#include "TLorentzVector.h" -#include "TUnixSystem.h" -#include "TSystem.h" -#include "TMath.h" -#include "TF1.h" - -#include -#include -#include - -class BscAnalysisHistManager : public TNamed { -public: - BscAnalysisHistManager(const TString& managername); - ~BscAnalysisHistManager() override; - - TH1F* GetHisto(Int_t Number); - TH1F* GetHisto(const TObjString& histname); - - TH2F* GetHisto2(Int_t Number); - TH2F* GetHisto2(const TObjString& histname); - - void WriteToFile(const TString& fOutputFile, const TString& fRecreateFile); - -private: - void BookHistos(); - void StoreWeights(); - void HistInit(const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup); - void HistInit( - const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup, Int_t nbinsy, Axis_t ylow, Axis_t yup); - - const char* fTypeTitle; - TObjArray* fHistArray; - TObjArray* fHistNamesArray; -}; - -class BscNumberingScheme; - -class BeginOfJob; -class BeginOfRun; -class EndOfRun; -class BeginOfEvent; -class EndOfEvent; -class BeginOfTrack; -class EndOfTrack; -class G4Step; - -/* -class ObserveBeginOfRun : private Observer -{ -public: - ObserveBeginOfRun(); -private: - void update(const BeginOfRun * run); -}; - -class ObserveEndOfRun : private Observer -{ -public: - ObserveEndOfRun(); -private: - void update(const EndOfRun * run); -}; - -class ObserveBeginOfEvent : private Observer -{ -public: - ObserveBeginOfEvent(); -private: - void update(const BeginOfEvent * evt); -}; - -class ObserveEndOfEvent : private Observer -{ -public: - ObserveEndOfEvent(); -private: - void update(const EndOfEvent * evt); - // std::vector theStripHits; -}; - -class ObserveBeginOfTrack : private Observer -{ -public: - ObserveBeginOfTrack(); -private: - void update(const BeginOfTrack * trk); -}; - -class ObserveEndOfTrack : private Observer -{ -public: - ObserveEndOfTrack(); -private: - void update(const EndOfTrack * trk); -}; - -class ObserveStep : private Observer -{ -public: - ObserveStep(); -private: - void update(const G4Step * step); -}; -*/ -//class BscTest: public SimProducer, -class BscTest : public SimWatcher, - public Observer, - public Observer, - public Observer, - public Observer, - public Observer, - public Observer, - public Observer, - public Observer { -public: - BscTest(const edm::ParameterSet& p); - ~BscTest() override; - //MyActions(); - //MyActions(); -private: - // observer classes - void update(const BeginOfJob* run) override; - void update(const BeginOfRun* run) override; - void update(const EndOfRun* run) override; - void update(const BeginOfEvent* evt) override; - void update(const BeginOfTrack* trk) override; - void update(const G4Step* step) override; - void update(const EndOfTrack* trk) override; - void update(const EndOfEvent* evt) override; - -private: - //UHB_Analysis* UserNtuples; - BscNumberingScheme* theBscNumberingScheme; - - int iev; - int itrk; - G4double entot0, tracklength0; - -private: - // Utilities to get detector levels during a step - - int detLevels(const G4VTouchable*) const; - G4String detName(const G4VTouchable*, int, int) const; - void detectorLevel(const G4VTouchable*, int&, int*, G4String*) const; - - double rinCalo, zinCalo; - int lastTrackID; - int verbosity; - - // SumEnerDeposit - all deposited energy on all steps ; SumStepl - length in steel !!! - G4double SumEnerDeposit, SumStepl, SumStepc; - // numofpart - # particles produced along primary track - int numofpart; - // last point of the primary track - G4ThreeVector lastpo; - - // z: - double z1, z2, z3, z4; - -private: - Float_t bsceventarray[1]; - TNtuple* bsceventntuple; - TFile bscOutputFile; - int whichevent; - - BscAnalysisHistManager* TheHistManager; //Histogram Manager of the analysis - std::string fDataLabel; // Data type label - std::string fOutputFile; // The output file name - std::string fRecreateFile; // Recreate the file flag, default="RECREATE" - - // // // // // // TObjString fHistType; - // TString fDataLabel; // Data type label - // TString fOutputFile; // The output file name - // TString fRecreateFile; // Recreate the file flag, default="RECREATE" -}; - -#endif diff --git a/SimG4CMS/Forward/interface/CastorTestAnalysis.h b/SimG4CMS/Forward/interface/CastorTestAnalysis.h deleted file mode 100644 index 832caa189d16f..0000000000000 --- a/SimG4CMS/Forward/interface/CastorTestAnalysis.h +++ /dev/null @@ -1,111 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// File: CastorTestAnalysis.h -// Date: 02.07 Panos Katsas -// Description: simulation analysis steering code -// -/////////////////////////////////////////////////////////////////////////////// -#undef debug -#ifndef CastorTestAnalysis_h -#define CastorTestAnalysis_h - -#include "SimG4Core/Notification/interface/BeginOfJob.h" -#include "SimG4Core/Notification/interface/BeginOfRun.h" -#include "SimG4Core/Notification/interface/EndOfRun.h" -#include "SimG4Core/Notification/interface/BeginOfEvent.h" -#include "SimG4Core/Notification/interface/EndOfEvent.h" - -#include "G4SDManager.hh" -#include "G4Step.hh" -#include "G4Track.hh" -#include "G4Event.hh" -#include "G4PrimaryVertex.hh" -#include "G4VProcess.hh" -#include "G4HCofThisEvent.hh" -#include "G4UserEventAction.hh" -#include "CLHEP/Units/GlobalSystemOfUnits.h" -#include "CLHEP/Units/GlobalPhysicalConstants.h" - -#include "SimG4Core/Notification/interface/Observer.h" -#include "SimG4Core/Watcher/interface/SimWatcher.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "SimG4CMS/Calo/interface/CaloG4Hit.h" -#include "SimG4CMS/Calo/interface/CaloG4HitCollection.h" - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "TROOT.h" -#include "TFile.h" -#include "TH1.h" -#include "TH2.h" -#include "TProfile.h" -#include "TNtuple.h" -#include "TRandom.h" -#include "TLorentzVector.h" -#include "TUnixSystem.h" -#include "TSystem.h" -#include "TMath.h" -#include "TF1.h" - -class G4Step; -class BeginOfJob; -class BeginOfRun; -class EndOfRun; -class BeginOfEvent; -class EndOfEvent; -class CastorNumberingScheme; - -class CastorTestAnalysis : public SimWatcher, - public Observer, - public Observer, - public Observer, - public Observer, - public Observer, - public Observer { -public: - CastorTestAnalysis(const edm::ParameterSet &p); - ~CastorTestAnalysis() override; - -private: - // observer classes - void update(const BeginOfJob *run) override; - void update(const BeginOfRun *run) override; - void update(const EndOfRun *run) override; - void update(const BeginOfEvent *evt) override; - void update(const EndOfEvent *evt) override; - void update(const G4Step *step) override; - -private: - void getCastorBranchData(const CaloG4HitCollection *hc); - void Finish(); - - int verbosity; - int doNTcastorstep; - int doNTcastorevent; - std::string stepNtFileName; - std::string eventNtFileName; - - TFile *castorOutputEventFile; - TFile *castorOutputStepFile; - - TNtuple *castorstepntuple; - TNtuple *castoreventntuple; - - CastorNumberingScheme *theCastorNumScheme; - - int eventIndex; - int stepIndex; - int eventGlobalHit; - - Float_t castorsteparray[14]; - Float_t castoreventarray[11]; -}; - -#endif // CastorTestAnalysis_h diff --git a/SimG4CMS/Forward/interface/DoCastorAnalysis.h b/SimG4CMS/Forward/interface/DoCastorAnalysis.h deleted file mode 100644 index 26aa4c237d0e0..0000000000000 --- a/SimG4CMS/Forward/interface/DoCastorAnalysis.h +++ /dev/null @@ -1,105 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// File: DoCastorAnalysis.h -// Date: 02.07 Panos Katsas -// Description: simulation analysis steering code -// -/////////////////////////////////////////////////////////////////////////////// -#undef debug -#ifndef DoCastorAnalysis_h -#define DoCastorAnalysis_h - -#include "SimG4Core/Notification/interface/BeginOfJob.h" -#include "SimG4Core/Notification/interface/BeginOfRun.h" -#include "SimG4Core/Notification/interface/EndOfRun.h" -#include "SimG4Core/Notification/interface/BeginOfEvent.h" -#include "SimG4Core/Notification/interface/EndOfEvent.h" - -#include "G4SDManager.hh" -#include "G4Step.hh" -#include "G4Track.hh" -#include "G4Event.hh" -#include "G4PrimaryVertex.hh" -#include "G4VProcess.hh" -#include "G4HCofThisEvent.hh" -#include "G4UserEventAction.hh" -#include "CLHEP/Units/GlobalSystemOfUnits.h" -#include "CLHEP/Units/GlobalPhysicalConstants.h" - -#include "SimG4Core/Notification/interface/Observer.h" -#include "SimG4Core/Watcher/interface/SimWatcher.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "TROOT.h" -#include "TFile.h" -#include "TH1.h" -#include "TH2.h" -#include "TProfile.h" -#include "TNtuple.h" -#include "TRandom.h" -#include "TLorentzVector.h" -#include "TUnixSystem.h" -#include "TSystem.h" -#include "TMath.h" -#include "TF1.h" - -class G4Step; -class BeginOfJob; -class BeginOfRun; -class EndOfRun; -class BeginOfEvent; -class EndOfEvent; - -class DoCastorAnalysis : public SimWatcher, - public Observer, - public Observer, - public Observer, - public Observer, - public Observer, - public Observer { -public: - DoCastorAnalysis(const edm::ParameterSet &p); - ~DoCastorAnalysis() override; - -private: - // observer classes - void update(const BeginOfJob *run) override; - void update(const BeginOfRun *run) override; - void update(const EndOfRun *run) override; - void update(const BeginOfEvent *evt) override; - void update(const EndOfEvent *evt) override; - void update(const G4Step *step) override; - -private: - int verbosity; - - std::string TreeFileName; - - TFile *CastorOutputEventFile; - TTree *CastorTree; - - int eventIndex; - - std::vector simhit_x, simhit_y, simhit_z; - std::vector simhit_eta, simhit_phi, simhit_energy; - std::vector simhit_sector, simhit_module; - //std::vector simhit_time; - - std::vector *psimhit_x, *psimhit_y, *psimhit_z; - std::vector *psimhit_eta, *psimhit_phi, *psimhit_energy; - std::vector *psimhit_sector, *psimhit_module; - //std::vector *psimhit_time; - - double simhit_etot; -}; - -#endif // DoCastorAnalysis_h diff --git a/SimG4CMS/Forward/interface/SimG4FluxProducer.h b/SimG4CMS/Forward/interface/SimG4FluxProducer.h deleted file mode 100644 index 4ba5f9d60363a..0000000000000 --- a/SimG4CMS/Forward/interface/SimG4FluxProducer.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef SimG4CMSForwardSimG4FluxProducer_h -#define SimG4CMSForwardSimG4FluxProducer_h - -#include "SimG4Core/Notification/interface/BeginOfRun.h" -#include "SimG4Core/Notification/interface/BeginOfEvent.h" -#include "SimG4Core/Notification/interface/EndOfEvent.h" -#include "SimG4Core/Watcher/interface/SimProducer.h" -#include "SimG4Core/Notification/interface/Observer.h" - -// to retreive hits -#include "SimDataFormats/CaloTest/interface/ParticleFlux.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "G4Step.hh" -#include "G4LogicalVolumeStore.hh" -#include "G4PhysicalVolumeStore.hh" - -#include -#include -#include - -class SimG4FluxProducer : public SimProducer, - public Observer, - public Observer, - public Observer { -public: - SimG4FluxProducer(const edm::ParameterSet &p); - SimG4FluxProducer(const SimG4FluxProducer &) = delete; // stop default - const SimG4FluxProducer &operator=(const SimG4FluxProducer &) = delete; - ~SimG4FluxProducer() override; - - void produce(edm::Event &, const edm::EventSetup &) override; - -private: - // observer classes - void update(const BeginOfRun *run) override; - void update(const BeginOfEvent *evt) override; - void update(const G4Step *step) override; - - void endOfEvent(ParticleFlux &pflx, unsigned int k); - G4VPhysicalVolume *getTopPV(); - std::map>::iterator findLV(G4LogicalVolume *plv); - -private: - std::vector LVNames_; - std::vector LVTypes_; - G4VPhysicalVolume *topPV_; - std::map> mapLV_; - - // some private members for ananlysis - unsigned int count_; - bool init_; - std::map, ParticleFlux> store_; -}; - -#endif diff --git a/SimG4CMS/Forward/interface/TotemTestGem.h b/SimG4CMS/Forward/interface/TotemTestGem.h deleted file mode 100644 index 9c1724d096e76..0000000000000 --- a/SimG4CMS/Forward/interface/TotemTestGem.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef Forward_TotemTestGem_h -#define Forward_TotemTestGem_h 1 -// -*- C++ -*- -// -// Package: Forward -// Class : TotemTestGem -// -/**\class TotemTestGem TotemTestGem.h SimG4CMS/Forward/interface/TotemTestGem.h - - Description: Manages Root file creation for Totem Tests - - Usage: - Used in testing Totem simulation - -*/ -// -// Original Author: -// Created: Tue May 16 10:14:34 CEST 2006 -// - -// system include files -#include -#include -#include -#include - -// user include files -#include "SimG4Core/Notification/interface/Observer.h" -#include "SimG4Core/Notification/interface/BeginOfJob.h" -#include "SimG4Core/Notification/interface/BeginOfEvent.h" -#include "SimG4Core/Notification/interface/EndOfEvent.h" -#include "SimG4Core/Watcher/interface/SimProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "SimDataFormats/Forward/interface/TotemTestHistoClass.h" -#include "SimG4CMS/Forward/interface/TotemG4Hit.h" - -class G4Step; - -class TotemTestGem : public SimProducer, public Observer, public Observer { -public: - TotemTestGem(const edm::ParameterSet &p); - ~TotemTestGem() override; - - void produce(edm::Event &, const edm::EventSetup &) override; - -protected: - // observer classes - void update(const BeginOfEvent *evt) override; - void update(const EndOfEvent *evt) override; - -private: - void clear(); - void fillEvent(TotemTestHistoClass &); - -private: - //Keep parameters and internal memory - std::vector names; - int evtnum; - std::vector hits; -}; - -#endif diff --git a/SimG4CMS/Forward/interface/ZdcTestAnalysis.h b/SimG4CMS/Forward/interface/ZdcTestAnalysis.h deleted file mode 100644 index e8d90ccd94292..0000000000000 --- a/SimG4CMS/Forward/interface/ZdcTestAnalysis.h +++ /dev/null @@ -1,107 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// File: ZdcTestAnalysis.h -// Date: 03.06 Edmundo Garcia -// Description: simulation analysis steering code -// -/////////////////////////////////////////////////////////////////////////////// -#undef debug -#ifndef ZdcTestAnalysis_h -#define ZdcTestAnalysis_h - -#include "SimG4Core/Notification/interface/BeginOfJob.h" -#include "SimG4Core/Notification/interface/BeginOfRun.h" -#include "SimG4Core/Notification/interface/EndOfRun.h" -#include "SimG4Core/Notification/interface/BeginOfEvent.h" -#include "SimG4Core/Notification/interface/EndOfEvent.h" - -#include "G4SDManager.hh" -#include "G4Step.hh" -#include "G4Track.hh" -#include "G4Event.hh" -#include "G4PrimaryVertex.hh" -#include "G4VProcess.hh" -#include "G4HCofThisEvent.hh" -#include "G4UserEventAction.hh" -#include "CLHEP/Units/GlobalSystemOfUnits.h" -#include "CLHEP/Units/GlobalPhysicalConstants.h" - -#include "SimG4Core/Notification/interface/Observer.h" -#include "SimG4Core/Watcher/interface/SimWatcher.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "TROOT.h" -#include "TFile.h" -#include "TH1.h" -#include "TH2.h" -#include "TProfile.h" -#include "TNtuple.h" -#include "TRandom.h" -#include "TLorentzVector.h" -#include "TUnixSystem.h" -#include "TSystem.h" -#include "TMath.h" -#include "TF1.h" - -class G4Step; -class BeginOfJob; -class BeginOfRun; -class EndOfRun; -class BeginOfEvent; -class EndOfEvent; -class ZdcNumberingScheme; - -class ZdcTestAnalysis : public SimWatcher, - public Observer, - public Observer, - public Observer, - public Observer, - public Observer, - public Observer { -public: - ZdcTestAnalysis(const edm::ParameterSet &p); - ~ZdcTestAnalysis() override; - -private: - // observer classes - void update(const BeginOfJob *run) override; - void update(const BeginOfRun *run) override; - void update(const EndOfRun *run) override; - void update(const BeginOfEvent *evt) override; - void update(const EndOfEvent *evt) override; - void update(const G4Step *step) override; - -private: - void finish(); - - int verbosity; - int doNTzdcstep; - int doNTzdcevent; - std::string stepNtFileName; - std::string eventNtFileName; - - TFile *zdcOutputEventFile; - TFile *zdcOutputStepFile; - - TNtuple *zdcstepntuple; - TNtuple *zdceventntuple; - - int eventIndex; - int stepIndex; - - Float_t zdcsteparray[18]; - Float_t zdceventarray[16]; - - ZdcNumberingScheme *theZdcNumScheme; -}; - -#endif // ZdcTestAnalysis_h diff --git a/SimG4CMS/Forward/src/BscTest.cc b/SimG4CMS/Forward/plugins/BscTest.cc similarity index 80% rename from SimG4CMS/Forward/src/BscTest.cc rename to SimG4CMS/Forward/plugins/BscTest.cc index b2cd6a6020658..7ccd6513b02de 100644 --- a/SimG4CMS/Forward/src/BscTest.cc +++ b/SimG4CMS/Forward/plugins/BscTest.cc @@ -2,23 +2,37 @@ // // system include files +#include #include #include -#include +#include +#include #include -// -#include "SimG4Core/Notification/interface/BeginOfEvent.h" -#include "SimG4Core/Notification/interface/EndOfEvent.h" -#include "SimG4Core/Notification/interface/TrackWithHistory.h" -#include "SimG4Core/Notification/interface/TrackInformation.h" +// #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "SimG4Core/Notification/interface/TrackWithHistory.h" +#include "SimG4Core/Notification/interface/TrackInformation.h" +#include "SimG4Core/Notification/interface/Observer.h" +#include "SimG4Core/Notification/interface/BeginOfJob.h" +#include "SimG4Core/Notification/interface/BeginOfRun.h" +#include "SimG4Core/Notification/interface/EndOfRun.h" +#include "SimG4Core/Notification/interface/BeginOfEvent.h" +#include "SimG4Core/Notification/interface/EndOfEvent.h" +#include "SimG4Core/Notification/interface/BeginOfTrack.h" +#include "SimG4Core/Notification/interface/EndOfTrack.h" +#include "SimG4Core/Watcher/interface/SimWatcher.h" + // to retreive hits +#include "SimG4CMS/Forward/interface/BscG4Hit.h" #include "SimG4CMS/Forward/interface/BscNumberingScheme.h" #include "SimG4CMS/Forward/interface/BscG4HitCollection.h" -#include "SimG4CMS/Forward/interface/BscTest.h" // G4 stuff #include "G4SDManager.hh" @@ -29,22 +43,123 @@ #include "G4UserEventAction.hh" #include "G4TransportationManager.hh" #include "G4ProcessManager.hh" +#include "G4VTouchable.hh" -#include "CLHEP/Units/GlobalSystemOfUnits.h" -#include "CLHEP/Units/GlobalPhysicalConstants.h" - -//================================================================ -// Root stuff - -// Include the standard header to effectively include -// the standard header within the std namespace. -#include +#include +#include +#include +#include +#include -//================================================================ +// ---------------------------------------------------------------- +// Includes needed for Root ntupling +// +#include "TROOT.h" +#include "TFile.h" +#include "TH1.h" +#include "TH2.h" +#include "TProfile.h" +#include "TNtuple.h" +#include "TRandom.h" +#include "TLorentzVector.h" +#include "TUnixSystem.h" +#include "TSystem.h" +#include "TMath.h" +#include "TF1.h" +#include "TObjArray.h" +#include "TObjString.h" +#include "TNamed.h" //#define EDM_ML_DEBUG -//UserVerbosity BscTest::std::cout("BscTest","info","BscTest"); +class BscAnalysisHistManager : public TNamed { +public: + BscAnalysisHistManager(const TString& managername); + ~BscAnalysisHistManager() override; + + TH1F* getHisto(Int_t Number); + TH1F* getHisto(const TObjString& histname); + + TH2F* getHisto2(Int_t Number); + TH2F* getHisto2(const TObjString& histname); + + void writeToFile(const TString& fOutputFile, const TString& fRecreateFile); + +private: + void bookHistos(); + void storeWeights(); + void histInit(const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup); + void histInit( + const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup, Int_t nbinsy, Axis_t ylow, Axis_t yup); + + const char* fTypeTitle; + TObjArray* fHistArray; + TObjArray* fHistNamesArray; +}; + +class BscTest : public SimWatcher, + public Observer, + public Observer, + public Observer, + public Observer, + public Observer, + public Observer, + public Observer, + public Observer { +public: + BscTest(const edm::ParameterSet& p); + ~BscTest() override; + +private: + // observer classes + void update(const BeginOfJob* run) override; + void update(const BeginOfRun* run) override; + void update(const EndOfRun* run) override; + void update(const BeginOfEvent* evt) override; + void update(const BeginOfTrack* trk) override; + void update(const G4Step* step) override; + void update(const EndOfTrack* trk) override; + void update(const EndOfEvent* evt) override; + + //UHB_Analysis* UserNtuples; + BscNumberingScheme* theBscNumberingScheme; + + int iev; + int itrk; + G4double entot0, tracklength0; + + // Utilities to get detector levels during a step + + int detLevels(const G4VTouchable*) const; + G4String detName(const G4VTouchable*, int, int) const; + void detectorLevel(const G4VTouchable*, int&, int*, G4String*) const; + + double rinCalo, zinCalo; + int lastTrackID; + int verbosity; + + // sumEnerDeposit - all deposited energy on all steps ; sumStepl - length in steel !!! + G4double sumEnerDeposit, sumStepl, sumStepc; + // numofpart - # particles produced along primary track + int numofpart; + // last point of the primary track + G4ThreeVector lastpo; + + // z: + double z1, z2, z3, z4; + +private: + Float_t bsceventarray[1]; + TNtuple* bsceventntuple; + TFile bscOutputFile; + int whichevent; + + BscAnalysisHistManager* TheHistManager; //Histogram Manager of the analysis + std::string fDataLabel; // Data type label + std::string fOutputFile; // The output file name + std::string fRecreateFile; // Recreate the file flag, default="RECREATE" +}; + enum ntbsc_elements { ntbsc_evt }; //================================================================ @@ -90,7 +205,7 @@ BscTest::~BscTest() { //------->while end // Write histograms to file - TheHistManager->WriteToFile(fOutputFile, fRecreateFile); + TheHistManager->writeToFile(fOutputFile, fRecreateFile); if (verbosity > 0) { edm::LogVerbatim("BscTest") << std::endl << "BscTest Destructor --------> End of BscTest : "; } @@ -109,7 +224,7 @@ BscAnalysisHistManager::BscAnalysisHistManager(const TString& managername) { fHistArray = new TObjArray(); // Array to store histos fHistNamesArray = new TObjArray(); // Array to store histos's names - BookHistos(); + bookHistos(); fHistArray->Compress(); // Removes empty space fHistNamesArray->Compress(); @@ -131,18 +246,18 @@ BscAnalysisHistManager::~BscAnalysisHistManager() { } //----------------------------------------------------------------------------- -void BscAnalysisHistManager::BookHistos() { +void BscAnalysisHistManager::bookHistos() { // at Start: (mm) - HistInit("TrackPhi", "Primary Phi", 100, 0., 360.); - HistInit("TrackTheta", "Primary Theta", 100, 0., 180.); - HistInit("TrackP", "Track XY position Z+ ", 80, -80., 80., 80, -80., 80.); - HistInit("TrackM", "Track XY position Z-", 80, -80., 80., 80, -80., 80.); - HistInit("DetIDs", "Track DetId - vs +", 16, -0.5, 15.5, 16, 15.5, 31.5); + histInit("TrackPhi", "Primary Phi", 100, 0., 360.); + histInit("TrackTheta", "Primary Theta", 100, 0., 180.); + histInit("TrackP", "Track XY position Z+ ", 80, -80., 80., 80, -80., 80.); + histInit("TrackM", "Track XY position Z-", 80, -80., 80., 80, -80., 80.); + histInit("DetIDs", "Track DetId - vs +", 16, -0.5, 15.5, 16, 15.5, 31.5); } //----------------------------------------------------------------------------- -void BscAnalysisHistManager::WriteToFile(const TString& fOutputFile, const TString& fRecreateFile) { +void BscAnalysisHistManager::writeToFile(const TString& fOutputFile, const TString& fRecreateFile) { //Write to file = fOutputFile edm::LogVerbatim("BscTest") << "================================================================"; @@ -156,7 +271,7 @@ void BscAnalysisHistManager::WriteToFile(const TString& fOutputFile, const TStri } //----------------------------------------------------------------------------- -void BscAnalysisHistManager::HistInit(const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup) { +void BscAnalysisHistManager::histInit(const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup) { // Add histograms and histograms names to the array char* newtitle = new char[strlen(title) + strlen(fTypeTitle) + 5]; @@ -169,7 +284,7 @@ void BscAnalysisHistManager::HistInit(const char* name, const char* title, Int_t } //----------------------------------------------------------------------------- -void BscAnalysisHistManager::HistInit( +void BscAnalysisHistManager::histInit( const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup, Int_t nbinsy, Axis_t ylow, Axis_t yup) { // Add histograms and histograms names to the array @@ -183,14 +298,14 @@ void BscAnalysisHistManager::HistInit( } //----------------------------------------------------------------------------- -TH1F* BscAnalysisHistManager::GetHisto(Int_t Number) { +TH1F* BscAnalysisHistManager::getHisto(Int_t Number) { // Get a histogram from the array with index = Number if (Number <= fHistArray->GetLast() && fHistArray->At(Number) != (TObject*)nullptr) { return (TH1F*)(fHistArray->At(Number)); } else { - edm::LogVerbatim("BscTest") << "!!!!!!!!!!!!!!!!!!GetHisto!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; + edm::LogVerbatim("BscTest") << "!!!!!!!!!!!!!!!!!!getHisto!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; edm::LogVerbatim("BscTest") << " WARNING ERROR - HIST ID INCORRECT (TOO HIGH) - " << Number; edm::LogVerbatim("BscTest") << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; @@ -199,14 +314,14 @@ TH1F* BscAnalysisHistManager::GetHisto(Int_t Number) { } //----------------------------------------------------------------------------- -TH2F* BscAnalysisHistManager::GetHisto2(Int_t Number) { +TH2F* BscAnalysisHistManager::getHisto2(Int_t Number) { // Get a histogram from the array with index = Number if (Number <= fHistArray->GetLast() && fHistArray->At(Number) != (TObject*)nullptr) { return (TH2F*)(fHistArray->At(Number)); } else { - edm::LogVerbatim("BscTest") << "!!!!!!!!!!!!!!!!GetHisto2!!!!!!!!!!!!!!!!!!!!!!!!!!!"; + edm::LogVerbatim("BscTest") << "!!!!!!!!!!!!!!!!getHisto2!!!!!!!!!!!!!!!!!!!!!!!!!!!"; edm::LogVerbatim("BscTest") << " WARNING ERROR - HIST ID INCORRECT (TOO HIGH) - " << Number; edm::LogVerbatim("BscTest") << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; @@ -215,23 +330,23 @@ TH2F* BscAnalysisHistManager::GetHisto2(Int_t Number) { } //----------------------------------------------------------------------------- -TH1F* BscAnalysisHistManager::GetHisto(const TObjString& histname) { +TH1F* BscAnalysisHistManager::getHisto(const TObjString& histname) { // Get a histogram from the array with name = histname Int_t index = fHistNamesArray->IndexOf(&histname); - return GetHisto(index); + return getHisto(index); } //----------------------------------------------------------------------------- -TH2F* BscAnalysisHistManager::GetHisto2(const TObjString& histname) { +TH2F* BscAnalysisHistManager::getHisto2(const TObjString& histname) { // Get a histogram from the array with name = histname Int_t index = fHistNamesArray->IndexOf(&histname); - return GetHisto2(index); + return getHisto2(index); } //----------------------------------------------------------------------------- -void BscAnalysisHistManager::StoreWeights() { +void BscAnalysisHistManager::storeWeights() { // Add structure to each histogram to store the weights for (int i = 0; i < fHistArray->GetEntries(); i++) { @@ -271,10 +386,10 @@ void BscTest::update(const BeginOfTrack* trk) { edm::LogVerbatim("BscTest") << "BscTest:update BeginOfTrack number = " << itrk; } if (itrk == 1) { - SumEnerDeposit = 0.; + sumEnerDeposit = 0.; numofpart = 0; - SumStepl = 0.; - SumStepc = 0.; + sumStepl = 0.; + sumStepc = 0.; tracklength0 = 0.; } } @@ -288,8 +403,8 @@ void BscTest::update(const EndOfTrack* trk) { if (itrk == 1) { G4double tracklength = (*trk)()->GetTrackLength(); // Accumulated track length - TheHistManager->GetHisto("SumEDep")->Fill(SumEnerDeposit); - TheHistManager->GetHisto("TrackL")->Fill(tracklength); + TheHistManager->getHisto("SumEDep")->Fill(sumEnerDeposit); + TheHistManager->getHisto("TrackL")->Fill(tracklength); // direction !!! G4ThreeVector vert_mom = (*trk)()->GetVertexMomentumDirection(); @@ -357,13 +472,13 @@ void BscTest::update(const G4Step* aStep) { // for Copper: if (prename == "SBST") { - SumStepc += stepl; + sumStepc += stepl; // ========= } // for ststeel: // if(prename == "SBSTs") { if (prename == "SBSTs") { - SumStepl += stepl; + sumStepl += stepl; // ========= } // ========= @@ -457,7 +572,7 @@ void BscTest::update(const G4Step* aStep) { } // end of trackstatus != 2 - SumEnerDeposit += EnerDeposit; + sumEnerDeposit += EnerDeposit; if (trackstatus == 2) { // primary track length // //UserNtuples->fillg508(tracklength,1.); @@ -556,9 +671,9 @@ void BscTest::update(const EndOfEvent* evt) { //UserNtuples->fillh01(vx); //UserNtuples->fillh02(vy); //UserNtuples->fillh03(vz); - TheHistManager->GetHisto("VtxX")->Fill(vx); - TheHistManager->GetHisto("VtxY")->Fill(vy); - TheHistManager->GetHisto("VtxZ")->Fill(vz); + TheHistManager->getHisto("VtxX")->Fill(vx); + TheHistManager->getHisto("VtxY")->Fill(vy); + TheHistManager->getHisto("VtxZ")->Fill(vz); } } // prim.vertex loop end @@ -583,18 +698,18 @@ void BscTest::update(const EndOfEvent* evt) { double th = mom.theta(); double eta = -log(tan(th / 2)); - TheHistManager->GetHisto("PrimaryEta")->Fill(eta); - TheHistManager->GetHisto("PrimaryPhigrad")->Fill(phigrad); - TheHistManager->GetHisto("PrimaryTh")->Fill(th * 180. / pi); + TheHistManager->getHisto("PrimaryEta")->Fill(eta); + TheHistManager->getHisto("PrimaryPhigrad")->Fill(phigrad); + TheHistManager->getHisto("PrimaryTh")->Fill(th * 180. / pi); - TheHistManager->GetHisto("PrimaryLastpoZ")->Fill(lastpo.z()); + TheHistManager->getHisto("PrimaryLastpoZ")->Fill(lastpo.z()); if (lastpo.z() < z4) { - TheHistManager->GetHisto("PrimaryLastpoX")->Fill(lastpo.x()); - TheHistManager->GetHisto("PrimaryLastpoY")->Fill(lastpo.y()); + TheHistManager->getHisto("PrimaryLastpoX")->Fill(lastpo.x()); + TheHistManager->getHisto("PrimaryLastpoY")->Fill(lastpo.y()); } if (numofpart > 4) { - TheHistManager->GetHisto("XLastpoNumofpart")->Fill(lastpo.x()); - TheHistManager->GetHisto("YLastpoNumofpart")->Fill(lastpo.y()); + TheHistManager->getHisto("XLastpoNumofpart")->Fill(lastpo.x()); + TheHistManager->getHisto("YLastpoNumofpart")->Fill(lastpo.y()); } // ========================================================================== @@ -637,9 +752,9 @@ void BscTest::update(const EndOfEvent* evt) { BscG4Hit* aHit = (*theCAFI)[j]; const CLHEP::Hep3Vector& hitPoint = aHit->getEntry(); double zz = hitPoint.z(); - TheHistManager->GetHisto("zHits")->Fill(zz); + TheHistManager->getHisto("zHits")->Fill(zz); if (tracklength0 > 8300.) - TheHistManager->GetHisto("zHitsTrLoLe")->Fill(zz); + TheHistManager->getHisto("zHitsTrLoLe")->Fill(zz); } if (varia == 2) { @@ -657,7 +772,7 @@ void BscTest::update(const EndOfEvent* evt) { double zz = hitPoint.z(); - TheHistManager->GetHisto("zHitsnoMI")->Fill(zz); + TheHistManager->getHisto("zHitsnoMI")->Fill(zz); if (verbosity > 2) { edm::LogVerbatim("BscTest") << "BscTest:zHits = " << zz; @@ -739,7 +854,7 @@ void BscTest::update(const EndOfEvent* evt) { //UserNtuples->fillg56(dx,1.); //UserNtuples->fillg57(dy,1.); //UserNtuples->fillg20(numofpart,1.); - //UserNtuples->fillg21(SumEnerDeposit,1.); + //UserNtuples->fillg21(sumEnerDeposit,1.); if (zside == 1) { //UserNtuples->fillg26(losenergy,1.); } @@ -759,7 +874,7 @@ void BscTest::update(const EndOfEvent* evt) { //UserNtuples->fillg52(dx,1.); //UserNtuples->fillg53(dy,1.); //UserNtuples->fillg22(numofpart,1.); - //UserNtuples->fillg23(SumEnerDeposit,1.); + //UserNtuples->fillg23(sumEnerDeposit,1.); //UserNtuples->fillg80(incidentEnergyHit,1.); //UserNtuples->fillg81(float(trackIDhit),1.); if (zside == 1) { @@ -845,3 +960,8 @@ void BscTest::update(const EndOfEvent* evt) { edm::LogVerbatim("BscTest") << "BscTest: END OF Event " << (*evt)()->GetEventID(); } } + +#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" + +DEFINE_SIMWATCHER(BscTest); diff --git a/SimG4CMS/Forward/src/CastorTestAnalysis.cc b/SimG4CMS/Forward/plugins/CastorTestAnalysis.cc similarity index 78% rename from SimG4CMS/Forward/src/CastorTestAnalysis.cc rename to SimG4CMS/Forward/plugins/CastorTestAnalysis.cc index e7658357ea68d..afd3f04834f6a 100644 --- a/SimG4CMS/Forward/src/CastorTestAnalysis.cc +++ b/SimG4CMS/Forward/plugins/CastorTestAnalysis.cc @@ -10,19 +10,104 @@ // Created: 02/2007 // -#include "SimG4CMS/Forward/interface/CastorTestAnalysis.h" +#include "SimG4Core/Notification/interface/Observer.h" +#include "SimG4Core/Notification/interface/BeginOfJob.h" +#include "SimG4Core/Notification/interface/BeginOfRun.h" +#include "SimG4Core/Notification/interface/EndOfRun.h" +#include "SimG4Core/Notification/interface/BeginOfEvent.h" +#include "SimG4Core/Notification/interface/EndOfEvent.h" +#include "SimG4Core/Watcher/interface/SimWatcher.h" + +#include "SimG4CMS/Calo/interface/CaloG4Hit.h" +#include "SimG4CMS/Calo/interface/CaloG4HitCollection.h" #include "SimG4CMS/Forward/interface/CastorNumberingScheme.h" #include "DataFormats/Math/interface/Point3D.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" - +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "G4SDManager.hh" +#include "G4Step.hh" +#include "G4Track.hh" +#include "G4Event.hh" +#include "G4PrimaryVertex.hh" +#include "G4VProcess.hh" +#include "G4HCofThisEvent.hh" +#include "G4UserEventAction.hh" + +#include +#include +#include + +#include "TROOT.h" #include "TFile.h" +#include "TH1.h" +#include "TH2.h" +#include "TProfile.h" +#include "TNtuple.h" +#include "TRandom.h" +#include "TLorentzVector.h" +#include "TUnixSystem.h" +#include "TSystem.h" +#include "TMath.h" +#include "TF1.h" + +#include #include #include #include +#include +#include +#include //#define EDM_ML_DEBUG +class CastorTestAnalysis : public SimWatcher, + public Observer, + public Observer, + public Observer, + public Observer, + public Observer, + public Observer { +public: + CastorTestAnalysis(const edm::ParameterSet &p); + ~CastorTestAnalysis() override; + +private: + // observer classes + void update(const BeginOfJob *run) override; + void update(const BeginOfRun *run) override; + void update(const EndOfRun *run) override; + void update(const BeginOfEvent *evt) override; + void update(const EndOfEvent *evt) override; + void update(const G4Step *step) override; + +private: + void getCastorBranchData(const CaloG4HitCollection *hc); + void Finish(); + + int verbosity; + int doNTcastorstep; + int doNTcastorevent; + std::string stepNtFileName; + std::string eventNtFileName; + + TFile *castorOutputEventFile; + TFile *castorOutputStepFile; + + TNtuple *castorstepntuple; + TNtuple *castoreventntuple; + + CastorNumberingScheme *theCastorNumScheme; + + int eventIndex; + int stepIndex; + int eventGlobalHit; + + Float_t castorsteparray[14]; + Float_t castoreventarray[11]; +}; + enum ntcastors_elements { ntcastors_evt, ntcastors_trackid, @@ -54,7 +139,7 @@ enum ntcastore_elements { ntcastore_z }; -CastorTestAnalysis::CastorTestAnalysis(const edm::ParameterSet& p) { +CastorTestAnalysis::CastorTestAnalysis(const edm::ParameterSet &p) { edm::ParameterSet m_Anal = p.getParameter("CastorTestAnalysis"); verbosity = m_Anal.getParameter("Verbosity"); doNTcastorstep = m_Anal.getParameter("StepNtupleFlag"); @@ -98,10 +183,10 @@ CastorTestAnalysis::~CastorTestAnalysis() { } //=================================================================== per EVENT -void CastorTestAnalysis::update(const BeginOfJob* job) { edm::LogVerbatim("ForwardSim") << " Starting new job "; } +void CastorTestAnalysis::update(const BeginOfJob *job) { edm::LogVerbatim("ForwardSim") << " Starting new job "; } //==================================================================== per RUN -void CastorTestAnalysis::update(const BeginOfRun* run) { +void CastorTestAnalysis::update(const BeginOfRun *run) { edm::LogVerbatim("ForwardSim") << std::endl << "CastorTestAnalysis: Starting Run"; if (doNTcastorstep) { edm::LogVerbatim("ForwardSim") << "CastorTestAnalysis: output step root file created"; @@ -118,17 +203,17 @@ void CastorTestAnalysis::update(const BeginOfRun* run) { eventIndex = 0; } -void CastorTestAnalysis::update(const BeginOfEvent* evt) { +void CastorTestAnalysis::update(const BeginOfEvent *evt) { edm::LogVerbatim("ForwardSim") << "CastorTestAnalysis: Processing Event Number: " << eventIndex; eventIndex++; stepIndex = 0; } -void CastorTestAnalysis::update(const G4Step* aStep) { +void CastorTestAnalysis::update(const G4Step *aStep) { stepIndex++; if (doNTcastorstep) { - G4StepPoint* preStepPoint = aStep->GetPreStepPoint(); + G4StepPoint *preStepPoint = aStep->GetPreStepPoint(); // G4StepPoint * postStepPoint= aStep->GetPostStepPoint(); G4double stepL = aStep->GetStepLength(); G4double stepE = aStep->GetTotalEnergyDeposit(); @@ -136,20 +221,20 @@ void CastorTestAnalysis::update(const G4Step* aStep) { if (verbosity >= 2) edm::LogVerbatim("ForwardSim") << "Step " << stepL << ", " << stepE; - G4Track* theTrack = aStep->GetTrack(); + G4Track *theTrack = aStep->GetTrack(); G4int theTrackID = theTrack->GetTrackID(); G4double theCharge = theTrack->GetDynamicParticle()->GetCharge(); // G4String particleType = theTrack->GetDefinition()->GetParticleName(); G4int pdgcode = theTrack->GetDefinition()->GetPDGEncoding(); - const G4ThreeVector& vert_mom = theTrack->GetVertexMomentumDirection(); + const G4ThreeVector &vert_mom = theTrack->GetVertexMomentumDirection(); G4double vpx = vert_mom.x(); G4double vpy = vert_mom.y(); G4double vpz = vert_mom.z(); double eta = 0.5 * log((1. + vpz) / (1. - vpz)); double phi = atan2(vpy, vpx); - const G4ThreeVector& hitPoint = preStepPoint->GetPosition(); + const G4ThreeVector &hitPoint = preStepPoint->GetPosition(); // Fill-in ntuple // castorsteparray[ntcastors_evt] = (*evt)()->GetEventID(); @@ -206,18 +291,18 @@ void CastorTestAnalysis::update(const G4Step* aStep) { } //================= End of EVENT =============== -void CastorTestAnalysis::update(const EndOfEvent* evt) { +void CastorTestAnalysis::update(const EndOfEvent *evt) { // Look for the Hit Collection edm::LogVerbatim("ForwardSim") << std::endl << "CastorTest::update(EndOfEvent * evt) - event #" << (*evt)()->GetEventID(); // access to the G4 hit collections - G4HCofThisEvent* allHC = (*evt)()->GetHCofThisEvent(); + G4HCofThisEvent *allHC = (*evt)()->GetHCofThisEvent(); edm::LogVerbatim("ForwardSim") << "update(*evt) --> accessed all HC"; int CAFIid = G4SDManager::GetSDMpointer()->GetCollectionID("CastorFI"); - CaloG4HitCollection* theCAFI = (CaloG4HitCollection*)allHC->GetHC(CAFIid); + CaloG4HitCollection *theCAFI = (CaloG4HitCollection *)allHC->GetHC(CAFIid); theCastorNumScheme = new CastorNumberingScheme(); // CastorNumberingScheme *theCastorNumScheme = new CastorNumberingScheme(); @@ -247,14 +332,14 @@ void CastorTestAnalysis::update(const EndOfEvent* evt) { #ifdef EDM_ML_DEBUG int particleType = 0; #endif - G4PrimaryParticle* thePrim = nullptr; + G4PrimaryParticle *thePrim = nullptr; G4int nvertex = (*evt)()->GetNumberOfPrimaryVertex(); edm::LogVerbatim("ForwardSim") << "Event has " << nvertex << " vertex"; if (nvertex == 0) edm::LogVerbatim("ForwardSim") << "CASTORTest End Of Event ERROR: no vertex"; for (int i = 0; i < nvertex; i++) { - G4PrimaryVertex* avertex = (*evt)()->GetPrimaryVertex(i); + G4PrimaryVertex *avertex = (*evt)()->GetPrimaryVertex(i); if (avertex == nullptr) edm::LogVerbatim("ForwardSim") << "CASTORTest End Of Event ERR: pointer to vertex = 0"; edm::LogVerbatim("ForwardSim") << "Vertex number :" << i; @@ -311,10 +396,10 @@ void CastorTestAnalysis::update(const EndOfEvent* evt) { edm::LogVerbatim("ForwardSim") << std::endl << "===>>> Done writing user histograms "; } -void CastorTestAnalysis::update(const EndOfRun* run) { ; } +void CastorTestAnalysis::update(const EndOfRun *run) { ; } //=================================================================== -void CastorTestAnalysis::getCastorBranchData(const CaloG4HitCollection* hc) { +void CastorTestAnalysis::getCastorBranchData(const CaloG4HitCollection *hc) { int nentries = hc->entries(); if (nentries > 0) { @@ -326,12 +411,12 @@ void CastorTestAnalysis::getCastorBranchData(const CaloG4HitCollection* hc) { double en_in_sd = 0.; for (int ihit = 0; ihit < nentries; ihit++) { - CaloG4Hit* aHit = (*hc)[ihit]; + CaloG4Hit *aHit = (*hc)[ihit]; totalEnergy += aHit->getEnergyDeposit(); } for (int ihit = 0; ihit < nentries; ihit++) { - CaloG4Hit* aHit = (*hc)[ihit]; + CaloG4Hit *aHit = (*hc)[ihit]; volumeID = aHit->getUnitID(); hitEnergy = aHit->getEnergyDeposit(); en_in_sd += aHit->getEnergyDeposit(); @@ -386,3 +471,8 @@ void CastorTestAnalysis::Finish() { edm::LogVerbatim("ForwardSim") << "CastorTestAnalysis: Event file closed"; } } + +#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" + +DEFINE_SIMWATCHER(CastorTestAnalysis); diff --git a/SimG4CMS/Forward/src/DoCastorAnalysis.cc b/SimG4CMS/Forward/plugins/DoCastorAnalysis.cc similarity index 66% rename from SimG4CMS/Forward/src/DoCastorAnalysis.cc rename to SimG4CMS/Forward/plugins/DoCastorAnalysis.cc index 77f642142a987..9fe0a203e54b3 100644 --- a/SimG4CMS/Forward/src/DoCastorAnalysis.cc +++ b/SimG4CMS/Forward/plugins/DoCastorAnalysis.cc @@ -9,24 +9,103 @@ // Original Author: P. Katsas // Created: 02/2007 // + +#include "DataFormats/Math/interface/Point3D.h" + #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + #include "SimG4CMS/Calo/interface/CaloG4Hit.h" #include "SimG4CMS/Calo/interface/CaloG4HitCollection.h" -#include "DataFormats/Math/interface/Point3D.h" - -#include "SimG4CMS/Forward/interface/DoCastorAnalysis.h" #include "SimG4CMS/Forward/interface/CastorNumberingScheme.h" +#include "SimG4Core/Notification/interface/BeginOfJob.h" +#include "SimG4Core/Notification/interface/BeginOfRun.h" +#include "SimG4Core/Notification/interface/EndOfRun.h" +#include "SimG4Core/Notification/interface/BeginOfEvent.h" +#include "SimG4Core/Notification/interface/EndOfEvent.h" +#include "SimG4Core/Notification/interface/Observer.h" +#include "SimG4Core/Watcher/interface/SimWatcher.h" + +#include "G4SDManager.hh" +#include "G4Step.hh" +#include "G4Track.hh" +#include "G4Event.hh" +#include "G4PrimaryVertex.hh" +#include "G4VProcess.hh" +#include "G4HCofThisEvent.hh" +#include "G4UserEventAction.hh" + +#include +#include +#include + +#include "TROOT.h" #include "TFile.h" +#include "TH1.h" +#include "TH2.h" +#include "TProfile.h" +#include "TNtuple.h" +#include "TRandom.h" +#include "TLorentzVector.h" +#include "TUnixSystem.h" +#include "TSystem.h" +#include "TMath.h" +#include "TF1.h" + +#include #include #include #include +#include #include +#include #include //#define EDM_ML_DEBUG -DoCastorAnalysis::DoCastorAnalysis(const edm::ParameterSet& p) { +class DoCastorAnalysis : public SimWatcher, + public Observer, + public Observer, + public Observer, + public Observer, + public Observer, + public Observer { +public: + DoCastorAnalysis(const edm::ParameterSet &p); + ~DoCastorAnalysis() override; + +private: + // observer classes + void update(const BeginOfJob *run) override; + void update(const BeginOfRun *run) override; + void update(const EndOfRun *run) override; + void update(const BeginOfEvent *evt) override; + void update(const EndOfEvent *evt) override; + void update(const G4Step *step) override; + +private: + int verbosity; + + std::string TreeFileName; + + TFile *CastorOutputEventFile; + TTree *CastorTree; + + int eventIndex; + + std::vector simhit_x, simhit_y, simhit_z; + std::vector simhit_eta, simhit_phi, simhit_energy; + std::vector simhit_sector, simhit_module; + + std::vector *psimhit_x, *psimhit_y, *psimhit_z; + std::vector *psimhit_eta, *psimhit_phi, *psimhit_energy; + std::vector *psimhit_sector, *psimhit_module; + + double simhit_etot; +}; + +DoCastorAnalysis::DoCastorAnalysis(const edm::ParameterSet &p) { edm::ParameterSet m_Anal = p.getParameter("DoCastorAnalysis"); verbosity = m_Anal.getParameter("Verbosity"); @@ -60,7 +139,6 @@ DoCastorAnalysis::DoCastorAnalysis(const edm::ParameterSet& p) { CastorTree->Branch("simhit_phi", "std::vector", &psimhit_phi); CastorTree->Branch("simhit_energy", "std::vector", &psimhit_energy); - // CastorTree->Branch("simhit_time","std::vector",&psimhit_time); CastorTree->Branch("simhit_sector", "std::vector", &psimhit_sector); CastorTree->Branch("simhit_module", "std::vector", &psimhit_module); @@ -93,11 +171,11 @@ DoCastorAnalysis::~DoCastorAnalysis() { //=================================================================== per EVENT -void DoCastorAnalysis::update(const BeginOfJob* job) { edm::LogVerbatim("ForwardSim") << " Starting new job "; } +void DoCastorAnalysis::update(const BeginOfJob *job) { edm::LogVerbatim("ForwardSim") << " Starting new job "; } //==================================================================== per RUN -void DoCastorAnalysis::update(const BeginOfRun* run) { +void DoCastorAnalysis::update(const BeginOfRun *run) { edm::LogVerbatim("ForwardSim") << std::endl << "DoCastorAnalysis: Starting Run"; // edm::LogVerbatim("ForwardSim") << "DoCastorAnalysis: output event root file created"; @@ -107,23 +185,23 @@ void DoCastorAnalysis::update(const BeginOfRun* run) { eventIndex = 1; } -void DoCastorAnalysis::update(const BeginOfEvent* evt) { +void DoCastorAnalysis::update(const BeginOfEvent *evt) { edm::LogVerbatim("ForwardSim") << "DoCastorAnalysis: Processing Event Number: " << eventIndex; eventIndex++; } //================= End of EVENT =============== -void DoCastorAnalysis::update(const EndOfEvent* evt) { +void DoCastorAnalysis::update(const EndOfEvent *evt) { // Look for the Hit Collection // access to the G4 hit collections - G4HCofThisEvent* allHC = (*evt)()->GetHCofThisEvent(); + G4HCofThisEvent *allHC = (*evt)()->GetHCofThisEvent(); int CAFIid = G4SDManager::GetSDMpointer()->GetCollectionID("CastorFI"); - CaloG4HitCollection* theCAFI = (CaloG4HitCollection*)allHC->GetHC(CAFIid); + CaloG4HitCollection *theCAFI = (CaloG4HitCollection *)allHC->GetHC(CAFIid); - CastorNumberingScheme* theCastorNumScheme = new CastorNumberingScheme(); + CastorNumberingScheme *theCastorNumScheme = new CastorNumberingScheme(); unsigned int volumeID = 0; // std::map > themap; @@ -158,10 +236,6 @@ void DoCastorAnalysis::update(const EndOfEvent* evt) { psimhit_energy->clear(); psimhit_energy->reserve(nentries); - //psimhit_time=&simhit_time; - //psimhit_time->clear(); - //psimhit_time->reserve(nentries); - psimhit_sector = &simhit_sector; psimhit_sector->clear(); psimhit_sector->reserve(nentries); @@ -174,7 +248,7 @@ void DoCastorAnalysis::update(const EndOfEvent* evt) { if (nentries > 0) { for (int ihit = 0; ihit < nentries; ihit++) { - CaloG4Hit* aHit = (*theCAFI)[ihit]; + CaloG4Hit *aHit = (*theCAFI)[ihit]; volumeID = aHit->getUnitID(); //themap[volumeID] += aHit->getEnergyDeposit(); @@ -198,7 +272,6 @@ void DoCastorAnalysis::update(const EndOfEvent* evt) { psimhit_phi->push_back(phi); psimhit_energy->push_back(energy); - // psimhit_time->push_back(time); psimhit_sector->push_back(sector); psimhit_module->push_back(zmodule); @@ -221,6 +294,11 @@ void DoCastorAnalysis::update(const EndOfEvent* evt) { delete theCastorNumScheme; } -void DoCastorAnalysis::update(const EndOfRun* run) { ; } +void DoCastorAnalysis::update(const EndOfRun *run) { ; } + +void DoCastorAnalysis::update(const G4Step *aStep) { ; } + +#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" -void DoCastorAnalysis::update(const G4Step* aStep) { ; } +DEFINE_SIMWATCHER(DoCastorAnalysis); diff --git a/SimG4CMS/Forward/src/SimG4FluxProducer.cc b/SimG4CMS/Forward/plugins/SimG4FluxProducer.cc similarity index 64% rename from SimG4CMS/Forward/src/SimG4FluxProducer.cc rename to SimG4CMS/Forward/plugins/SimG4FluxProducer.cc index 38851ece7761a..98a1cf7cf7f11 100644 --- a/SimG4CMS/Forward/src/SimG4FluxProducer.cc +++ b/SimG4CMS/Forward/plugins/SimG4FluxProducer.cc @@ -1,21 +1,71 @@ -#include "SimG4CMS/Forward/interface/SimG4FluxProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "SimDataFormats/CaloTest/interface/ParticleFlux.h" + +#include "SimG4Core/Notification/interface/BeginOfRun.h" +#include "SimG4Core/Notification/interface/BeginOfEvent.h" +#include "SimG4Core/Notification/interface/EndOfEvent.h" +#include "SimG4Core/Watcher/interface/SimProducer.h" +#include "SimG4Core/Notification/interface/Observer.h" + +#include "G4Step.hh" +#include "G4LogicalVolumeStore.hh" +#include "G4PhysicalVolumeStore.hh" #include "G4Track.hh" #include "G4TouchableHistory.hh" #include "G4TransportationManager.hh" -#include "CLHEP/Units/GlobalSystemOfUnits.h" -#include "CLHEP/Units/GlobalPhysicalConstants.h" + +#include +#include #include #include #include +#include #include +#include #include +#include //#define EDM_ML_DEBUG -SimG4FluxProducer::SimG4FluxProducer(const edm::ParameterSet& p) : count_(0), init_(false) { +class SimG4FluxProducer : public SimProducer, + public Observer, + public Observer, + public Observer { +public: + SimG4FluxProducer(const edm::ParameterSet &p); + SimG4FluxProducer(const SimG4FluxProducer &) = delete; // stop default + const SimG4FluxProducer &operator=(const SimG4FluxProducer &) = delete; + ~SimG4FluxProducer() override; + + void produce(edm::Event &, const edm::EventSetup &) override; + +private: + // observer classes + void update(const BeginOfRun *run) override; + void update(const BeginOfEvent *evt) override; + void update(const G4Step *step) override; + + void endOfEvent(ParticleFlux &pflx, unsigned int k); + G4VPhysicalVolume *getTopPV(); + std::map>::iterator findLV(G4LogicalVolume *plv); + + std::vector LVNames_; + std::vector LVTypes_; + G4VPhysicalVolume *topPV_; + std::map> mapLV_; + + // some private members for ananlysis + unsigned int count_; + bool init_; + std::map, ParticleFlux> store_; +}; + +SimG4FluxProducer::SimG4FluxProducer(const edm::ParameterSet &p) : count_(0), init_(false) { edm::ParameterSet m_FP = p.getParameter("SimG4FluxProducer"); LVNames_ = m_FP.getUntrackedParameter>("LVNames"); LVTypes_ = m_FP.getUntrackedParameter>("LVTypes"); @@ -31,7 +81,7 @@ SimG4FluxProducer::SimG4FluxProducer(const edm::ParameterSet& p) : count_(0), in SimG4FluxProducer::~SimG4FluxProducer() {} -void SimG4FluxProducer::produce(edm::Event& e, const edm::EventSetup&) { +void SimG4FluxProducer::produce(edm::Event &e, const edm::EventSetup &) { #ifdef EDM_ML_DEBUG edm::LogVerbatim("SimG4FluxProducer") << "SimG4FluxProducer: enters produce with " << LVNames_.size() << " LV's"; #endif @@ -43,7 +93,7 @@ void SimG4FluxProducer::produce(edm::Event& e, const edm::EventSetup&) { } } -void SimG4FluxProducer::update(const BeginOfRun* run) { +void SimG4FluxProducer::update(const BeginOfRun *run) { #ifdef EDM_ML_DEBUG edm::LogVerbatim("SimG4FluxProducer") << "SimG4FluxProducer: enters BeginOfRun"; #endif @@ -52,7 +102,7 @@ void SimG4FluxProducer::update(const BeginOfRun* run) { edm::LogWarning("SimG4FluxProducer") << "Cannot find top level volume\n"; } else { init_ = true; - const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance(); + const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance(); for (auto lvcite : *lvs) { findLV(lvcite); } @@ -60,7 +110,7 @@ void SimG4FluxProducer::update(const BeginOfRun* run) { #ifdef EDM_ML_DEBUG edm::LogVerbatim("SimG4FluxProducer") << "SimG4FluxProducer::Finds " << mapLV_.size() << " logical volumes"; unsigned int k(0); - for (const auto& lvs : mapLV_) { + for (const auto &lvs : mapLV_) { edm::LogVerbatim("SimG4FluxProducer") << "Entry[" << k << "] " << lvs.first << ": (" << (lvs.second).first << ", " << (lvs.second).second << ")"; ++k; @@ -69,30 +119,30 @@ void SimG4FluxProducer::update(const BeginOfRun* run) { } } -void SimG4FluxProducer::update(const BeginOfEvent* evt) { +void SimG4FluxProducer::update(const BeginOfEvent *evt) { int iev = (*evt)()->GetEventID(); edm::LogVerbatim("SimG4FluxProducer") << "SimG4FluxProducer: =====> Begin event = " << iev; ++count_; store_.clear(); } -void SimG4FluxProducer::update(const G4Step* aStep) { +void SimG4FluxProducer::update(const G4Step *aStep) { if (aStep != nullptr) { - G4TouchableHistory* touchable = (G4TouchableHistory*)aStep->GetPreStepPoint()->GetTouchable(); - G4LogicalVolume* plv = (G4LogicalVolume*)touchable->GetVolume()->GetLogicalVolume(); + G4TouchableHistory *touchable = (G4TouchableHistory *)aStep->GetPreStepPoint()->GetTouchable(); + G4LogicalVolume *plv = (G4LogicalVolume *)touchable->GetVolume()->GetLogicalVolume(); auto it = (init_) ? mapLV_.find(plv) : findLV(plv); // edm::LogVerbatim("SimG4FluxProducer") << plv->GetName() << " Flag " << (it != mapLV_.end()) << " step " << aStep->IsFirstStepInVolume() << ":" << aStep->IsLastStepInVolume(); if (it != mapLV_.end()) { int type = LVTypes_[(it->second).first]; if ((type == 0 && aStep->IsFirstStepInVolume()) || (type == 1 && aStep->IsLastStepInVolume())) { unsigned int copy = (unsigned int)(touchable->GetReplicaNumber(0)); - std::pair key(plv, copy); + std::pair key(plv, copy); auto itr = store_.find(key); if (itr == store_.end()) { store_[key] = ParticleFlux((it->second).second, copy); itr = store_.find(key); } - G4Track* track = aStep->GetTrack(); + G4Track *track = aStep->GetTrack(); int pdgid = track->GetDefinition()->GetPDGEncoding(); int vxtyp = (track->GetCreatorProcess() == nullptr) ? 0 : 1; double time = (aStep->GetPostStepPoint()->GetGlobalTime()); @@ -118,10 +168,10 @@ void SimG4FluxProducer::update(const G4Step* aStep) { } //if (aStep != NULL) } -void SimG4FluxProducer::endOfEvent(ParticleFlux& flux, unsigned int k) { +void SimG4FluxProducer::endOfEvent(ParticleFlux &flux, unsigned int k) { bool done(false); - for (const auto& element : store_) { - G4LogicalVolume* lv = (element.first).first; + for (const auto &element : store_) { + G4LogicalVolume *lv = (element.first).first; auto it = mapLV_.find(lv); if (it != mapLV_.end()) { if ((it->second).first == k) { @@ -146,12 +196,12 @@ void SimG4FluxProducer::endOfEvent(ParticleFlux& flux, unsigned int k) { } } -G4VPhysicalVolume* SimG4FluxProducer::getTopPV() { +G4VPhysicalVolume *SimG4FluxProducer::getTopPV() { return G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume(); } -std::map>::iterator SimG4FluxProducer::findLV( - G4LogicalVolume* plv) { +std::map>::iterator SimG4FluxProducer::findLV( + G4LogicalVolume *plv) { auto itr = mapLV_.find(plv); if (itr == mapLV_.end()) { std::string name = plv->GetName(); @@ -165,3 +215,7 @@ std::map>::iterator SimG4 } return itr; } +#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" + +DEFINE_SIMWATCHER(SimG4FluxProducer); diff --git a/SimG4CMS/Forward/src/TotemTestGem.cc b/SimG4CMS/Forward/plugins/TotemTestGem.cc similarity index 73% rename from SimG4CMS/Forward/src/TotemTestGem.cc rename to SimG4CMS/Forward/plugins/TotemTestGem.cc index 85d192cbfed9b..7ff4d053e49e3 100644 --- a/SimG4CMS/Forward/src/TotemTestGem.cc +++ b/SimG4CMS/Forward/plugins/TotemTestGem.cc @@ -11,25 +11,59 @@ // // system include files -#include -#include #include +#include +#include +#include +#include +#include // user include files -#include "SimG4Core/Notification/interface/BeginOfEvent.h" -#include "SimG4Core/Notification/interface/EndOfEvent.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "SimG4CMS/Forward/interface/TotemTestGem.h" +#include "SimDataFormats/Forward/interface/TotemTestHistoClass.h" + #include "SimG4CMS/Forward/interface/TotemG4HitCollection.h" +#include "SimG4CMS/Forward/interface/TotemG4Hit.h" + +#include "SimG4Core/Notification/interface/Observer.h" +#include "SimG4Core/Notification/interface/BeginOfJob.h" +#include "SimG4Core/Notification/interface/BeginOfEvent.h" +#include "SimG4Core/Notification/interface/EndOfEvent.h" +#include "SimG4Core/Watcher/interface/SimProducer.h" #include "G4SDManager.hh" +#include "G4Step.hh" #include "G4HCofThisEvent.hh" -#include "CLHEP/Units/GlobalSystemOfUnits.h" -#include "CLHEP/Units/GlobalPhysicalConstants.h" + +#include +#include + +class TotemTestGem : public SimProducer, public Observer, public Observer { +public: + TotemTestGem(const edm::ParameterSet& p); + ~TotemTestGem() override; + + void produce(edm::Event&, const edm::EventSetup&) override; + +protected: + // observer classes + void update(const BeginOfEvent* evt) override; + void update(const EndOfEvent* evt) override; + +private: + void clear(); + void fillEvent(TotemTestHistoClass&); + + //Keep parameters and internal memory + std::vector names; + int evtnum; + std::vector hits; +}; // // constructors and destructor @@ -115,3 +149,8 @@ void TotemTestGem::clear() { evtnum = 0; hits.clear(); } + +#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" + +DEFINE_SIMWATCHER(TotemTestGem); diff --git a/SimG4CMS/Forward/src/ZdcTestAnalysis.cc b/SimG4CMS/Forward/plugins/ZdcTestAnalysis.cc similarity index 64% rename from SimG4CMS/Forward/src/ZdcTestAnalysis.cc rename to SimG4CMS/Forward/plugins/ZdcTestAnalysis.cc index 240d34d808656..c2754962c1e60 100644 --- a/SimG4CMS/Forward/src/ZdcTestAnalysis.cc +++ b/SimG4CMS/Forward/plugins/ZdcTestAnalysis.cc @@ -1,15 +1,101 @@ +/////////////////////////////////////////////////////////////////////////////// +// File: ZdcTestAnalysis.cc +// Date: 03.06 Edmundo Garcia +// Description: simulation analysis steering code +// +/////////////////////////////////////////////////////////////////////////////// +#include "DataFormats/Math/interface/Point3D.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "SimG4CMS/Calo/interface/CaloG4Hit.h" #include "SimG4CMS/Calo/interface/CaloG4HitCollection.h" -#include "DataFormats/Math/interface/Point3D.h" - -#include "SimG4CMS/Forward/interface/ZdcTestAnalysis.h" #include "SimG4CMS/Forward/interface/ZdcNumberingScheme.h" +#include "SimG4Core/Notification/interface/BeginOfJob.h" +#include "SimG4Core/Notification/interface/BeginOfRun.h" +#include "SimG4Core/Notification/interface/EndOfRun.h" +#include "SimG4Core/Notification/interface/BeginOfEvent.h" +#include "SimG4Core/Notification/interface/EndOfEvent.h" +#include "SimG4Core/Notification/interface/Observer.h" +#include "SimG4Core/Watcher/interface/SimWatcher.h" + +#include "G4SDManager.hh" +#include "G4Step.hh" +#include "G4Track.hh" +#include "G4Event.hh" +#include "G4PrimaryVertex.hh" +#include "G4VProcess.hh" +#include "G4HCofThisEvent.hh" +#include "G4UserEventAction.hh" + +#include +#include +#include + +#include "TROOT.h" +#include "TH1.h" +#include "TH2.h" +#include "TProfile.h" +#include "TNtuple.h" +#include "TRandom.h" +#include "TLorentzVector.h" +#include "TUnixSystem.h" +#include "TSystem.h" +#include "TMath.h" +#include "TF1.h" #include "TFile.h" + +#include #include #include #include +#include +#include +#include + +class ZdcTestAnalysis : public SimWatcher, + public Observer, + public Observer, + public Observer, + public Observer, + public Observer, + public Observer { +public: + ZdcTestAnalysis(const edm::ParameterSet& p); + ~ZdcTestAnalysis() override; + +private: + // observer classes + void update(const BeginOfJob* run) override; + void update(const BeginOfRun* run) override; + void update(const EndOfRun* run) override; + void update(const BeginOfEvent* evt) override; + void update(const EndOfEvent* evt) override; + void update(const G4Step* step) override; + + void finish(); + + int verbosity; + int doNTzdcstep; + int doNTzdcevent; + std::string stepNtFileName; + std::string eventNtFileName; + + TFile* zdcOutputEventFile; + TFile* zdcOutputStepFile; + + TNtuple* zdcstepntuple; + TNtuple* zdceventntuple; + + int eventIndex; + int stepIndex; + + Float_t zdcsteparray[18]; + Float_t zdceventarray[16]; + + ZdcNumberingScheme* theZdcNumScheme; +}; enum ntzdcs_elements { ntzdcs_evt, @@ -61,19 +147,18 @@ ZdcTestAnalysis::ZdcTestAnalysis(const edm::ParameterSet& p) { eventNtFileName = m_Anal.getParameter("EventNtupleFileName"); if (verbosity > 0) - std::cout << std::endl; - std::cout << "============================================================================" << std::endl; - std::cout << "ZdcTestAnalysis:: Initialized as observer" << std::endl; + edm::LogVerbatim("ZdcAnalysis") << "\n============================================================================"; + edm::LogVerbatim("ZdcAnalysis") << "ZdcTestAnalysis:: Initialized as observer"; if (doNTzdcstep > 0) { - std::cout << " Step Ntuple will be created" << std::endl; - std::cout << " Step Ntuple file: " << stepNtFileName << std::endl; + edm::LogVerbatim("ZdcAnalysis") << " Step Ntuple will be created"; + edm::LogVerbatim("ZdcAnalysis") << " Step Ntuple file: " << stepNtFileName; } if (doNTzdcevent > 0) { - std::cout << " Event Ntuple will be created" << std::endl; - std::cout << " Step Ntuple file: " << stepNtFileName << std::endl; + edm::LogVerbatim("ZdcAnalysis") << " Event Ntuple will be created"; + edm::LogVerbatim("ZdcAnalysis") << " Step Ntuple file: " << stepNtFileName; } - std::cout << "============================================================================" << std::endl; - std::cout << std::endl; + edm::LogVerbatim("ZdcAnalysis") << "============================================================================" + << std::endl; if (doNTzdcstep > 0) zdcstepntuple = @@ -99,23 +184,22 @@ ZdcTestAnalysis::~ZdcTestAnalysis() { void ZdcTestAnalysis::update(const BeginOfJob* job) { //job - std::cout << "beggining of job" << std::endl; - ; + edm::LogVerbatim("ZdcAnalysis") << "beggining of job"; } //==================================================================== per RUN void ZdcTestAnalysis::update(const BeginOfRun* run) { //run - std::cout << std::endl << "ZdcTestAnalysis: Begining of Run" << std::endl; + edm::LogVerbatim("ZdcAnalysis") << "\nZdcTestAnalysis: Begining of Run"; if (doNTzdcstep) { - std::cout << "ZDCTestAnalysis: output step file created" << std::endl; + edm::LogVerbatim("ZdcAnalysis") << "ZDCTestAnalysis: output step file created"; TString stepfilename = stepNtFileName; zdcOutputStepFile = new TFile(stepfilename, "RECREATE"); } if (doNTzdcevent) { - std::cout << "ZDCTestAnalysis: output event file created" << std::endl; + edm::LogVerbatim("ZdcAnalysis") << "ZDCTestAnalysis: output event file created"; TString stepfilename = eventNtFileName; zdcOutputEventFile = new TFile(stepfilename, "RECREATE"); } @@ -125,7 +209,7 @@ void ZdcTestAnalysis::update(const BeginOfRun* run) { void ZdcTestAnalysis::update(const BeginOfEvent* evt) { //event - std::cout << "ZdcTest: Processing Event Number: " << eventIndex << std::endl; + edm::LogVerbatim("ZdcAnalysis") << "ZdcTest: Processing Event Number: " << eventIndex; eventIndex++; stepIndex = 0; } @@ -141,7 +225,7 @@ void ZdcTestAnalysis::update(const G4Step* aStep) { G4double stepE = aStep->GetTotalEnergyDeposit(); if (verbosity >= 2) - std::cout << "Step " << stepL << "," << stepE << std::endl; + edm::LogVerbatim("ZdcAnalysis") << "Step " << stepL << "," << stepE; G4Track* theTrack = aStep->GetTrack(); G4int theTrackID = theTrack->GetTrackID(); @@ -184,8 +268,8 @@ void ZdcTestAnalysis::update(const G4Step* aStep) { theMaterials[jj] = theLogicalVolumes[jj]->GetMaterial(); theMaterialNames[jj] = theMaterials[jj]->GetName(); if (verbosity >= 2) - std::cout << " GHD " << jj << ": " << theReplicaNumbers[jj] << "," << thePVnames[jj] << "," << theLVnames[jj] - << "," << theMaterialNames[jj] << std::endl; + edm::LogVerbatim("ZdcAnalysis") << " GHD " << jj << ": " << theReplicaNumbers[jj] << "," << thePVnames[jj] + << "," << theLVnames[jj] << "," << theMaterialNames[jj]; } idLayer = theReplicaNumbers[1]; @@ -210,8 +294,8 @@ void ZdcTestAnalysis::update(const G4Step* aStep) { else { thePVtype = 0; if (verbosity >= 2) - std::cout << " pvtype=0 hd=" << historyDepth << " " << theReplicaNumbers[0] << "," << thePVnames[0] << "," - << theLVnames[0] << "," << theMaterialNames[0] << std::endl; + edm::LogVerbatim("ZdcAnalysis") << " pvtype=0 hd=" << historyDepth << " " << theReplicaNumbers[0] << "," + << thePVnames[0] << "," << theLVnames[0] << "," << theMaterialNames[0]; } } else if (historyDepth == 0) { int theReplicaNumber = touch->GetReplicaNumber(0); @@ -222,10 +306,10 @@ void ZdcTestAnalysis::update(const G4Step* aStep) { G4Material* theMaterial = theLogicalVolume->GetMaterial(); const G4String& theMaterialName = theMaterial->GetName(); if (verbosity >= 2) - std::cout << " hd=0 " << theReplicaNumber << "," << thePVname << "," << theLVname << "," << theMaterialName - << std::endl; + edm::LogVerbatim("ZdcAnalysis") << " hd=0 " << theReplicaNumber << "," << thePVname << "," << theLVname << "," + << theMaterialName; } else { - std::cout << " hd<0: hd=" << historyDepth << std::endl; + edm::LogVerbatim("ZdcAnalysis") << " hd<0: hd=" << historyDepth; } double NCherPhot = -1; @@ -255,19 +339,18 @@ void ZdcTestAnalysis::update(const EndOfEvent* evt) { //end of event // Look for the Hit Collection - std::cout << std::endl - << "ZdcTest::upDate(const EndOfEvent * evt) - event #" << (*evt)()->GetEventID() << std::endl - << " # of aSteps followed in event = " << stepIndex << std::endl; + edm::LogVerbatim("ZdcAnalysis") << "\nZdcTest::upDate(const EndOfEvent * evt) - event #" << (*evt)()->GetEventID() + << "\n # of aSteps followed in event = " << stepIndex; // access to the G4 hit collections G4HCofThisEvent* allHC = (*evt)()->GetHCofThisEvent(); - std::cout << " accessed all HC"; + edm::LogVerbatim("ZdcAnalysis") << " accessed all HC"; int theZDCHCid = G4SDManager::GetSDMpointer()->GetCollectionID("ZDCHITS"); - std::cout << " - theZDCHCid = " << theZDCHCid; + edm::LogVerbatim("ZdcAnalysis") << " - theZDCHCid = " << theZDCHCid; CaloG4HitCollection* theZDCHC = (CaloG4HitCollection*)allHC->GetHC(theZDCHCid); - std::cout << " - theZDCHC = " << theZDCHC << std::endl; + edm::LogVerbatim("ZdcAnalysis") << " - theZDCHC = " << theZDCHC; if (!theZdcNumScheme) { theZdcNumScheme = new ZdcNumberingScheme(1); @@ -281,7 +364,7 @@ void ZdcTestAnalysis::update(const EndOfEvent* evt) { std::map > primaries; float totalEnergy = 0; int nentries = theZDCHC->entries(); - std::cout << " theZDCHC has " << nentries << " entries" << std::endl; + edm::LogVerbatim("ZdcAnalysis") << " theZDCHC has " << nentries << " entries"; if (doNTzdcevent) { if (nentries > 0) { @@ -299,8 +382,9 @@ void ZdcTestAnalysis::update(const EndOfEvent* evt) { math::XYZPoint hitPoint = aHit->getPosition(); double hitEnergy = aHit->getEnergyDeposit(); if (verbosity >= 1) - std::cout << " entry #" << ihit << ": fiberID=0x" << std::hex << fiberID << std::dec << "; enEm=" << enEm - << "; enHad=" << enHad << "; hitEnergy=" << hitEnergy << "z=" << hitPoint.z() << std::endl; + edm::LogVerbatim("ZdcAnalysis") + << " entry #" << ihit << ": fiberID=0x" << std::hex << fiberID << std::dec << "; enEm=" << enEm + << "; enHad=" << enHad << "; hitEnergy=" << hitEnergy << "z=" << hitPoint.z(); energyInFibers[fiberID] += enEm + enHad; primaries[aHit->getTrackID()] += enEm + enHad; float time = aHit->getTimeSliceID(); @@ -347,19 +431,19 @@ void ZdcTestAnalysis::update(const EndOfEvent* evt) { int trackID = 0; G4PrimaryParticle* thePrim = nullptr; G4int nvertex = (*evt)()->GetNumberOfPrimaryVertex(); - std::cout << "Event has " << nvertex << " vertex" << std::endl; + edm::LogVerbatim("ZdcAnalysis") << "Event has " << nvertex << " vertex"; if (nvertex == 0) - std::cout << "ZdcTest End Of Event ERROR: no vertex" << std::endl; + edm::LogVerbatim("ZdcAnalysis") << "ZdcTest End Of Event ERROR: no vertex"; for (int i = 0; i < nvertex; i++) { G4PrimaryVertex* avertex = (*evt)()->GetPrimaryVertex(i); if (avertex == nullptr) { - std::cout << "ZdcTest End Of Event ERR: pointer to vertex = 0" << std::endl; + edm::LogVerbatim("ZdcAnalysis") << "ZdcTest End Of Event ERR: pointer to vertex = 0"; } else { - std::cout << "Vertex number :" << i << std::endl; + edm::LogVerbatim("ZdcAnalysis") << "Vertex number :" << i; int npart = avertex->GetNumberOfParticle(); if (npart == 0) - std::cout << "ZdcTest End Of Event ERR: no primary!" << std::endl; + edm::LogVerbatim("ZdcAnalysis") << "ZdcTest End Of Event ERR: no primary!"; if (thePrim == nullptr) thePrim = avertex->GetPrimary(trackID); } @@ -374,10 +458,10 @@ void ZdcTestAnalysis::update(const EndOfEvent* evt) { pz = thePrim->GetPz(); pInit = sqrt(pow(px, 2.) + pow(py, 2.) + pow(pz, 2.)); if (pInit == 0) { - std::cout << "ZdcTest End Of Event ERR: primary has p=0 " << std::endl; + edm::LogVerbatim("ZdcAnalysis") << "ZdcTest End Of Event ERR: primary has p=0 "; } } else { - std::cout << "ZdcTest End Of Event ERR: could not find primary " << std::endl; + edm::LogVerbatim("ZdcAnalysis") << "ZdcTest End Of Event ERR: could not find primary "; } } // nentries > 0 @@ -386,31 +470,36 @@ void ZdcTestAnalysis::update(const EndOfEvent* evt) { int iEvt = (*evt)()->GetEventID(); if (iEvt < 10) - std::cout << " ZdcTest Event " << iEvt << std::endl; + edm::LogVerbatim("ZdcAnalysis") << " ZdcTest Event " << iEvt; else if ((iEvt < 100) && (iEvt % 10 == 0)) - std::cout << " ZdcTest Event " << iEvt << std::endl; + edm::LogVerbatim("ZdcAnalysis") << " ZdcTest Event " << iEvt; else if ((iEvt < 1000) && (iEvt % 100 == 0)) - std::cout << " ZdcTest Event " << iEvt << std::endl; + edm::LogVerbatim("ZdcAnalysis") << " ZdcTest Event " << iEvt; else if ((iEvt < 10000) && (iEvt % 1000 == 0)) - std::cout << " ZdcTest Event " << iEvt << std::endl; + edm::LogVerbatim("ZdcAnalysis") << " ZdcTest Event " << iEvt; } -void ZdcTestAnalysis::update(const EndOfRun* run) { ; } +void ZdcTestAnalysis::update(const EndOfRun* run) {} void ZdcTestAnalysis::finish() { if (doNTzdcstep) { zdcOutputStepFile->cd(); zdcstepntuple->Write(); - std::cout << "ZdcTestAnalysis: Ntuple step written for event: " << eventIndex << std::endl; + edm::LogVerbatim("ZdcAnalysis") << "ZdcTestAnalysis: Ntuple step written for event: " << eventIndex; zdcOutputStepFile->Close(); - std::cout << "ZdcTestAnalysis: Step file closed" << std::endl; + edm::LogVerbatim("ZdcAnalysis") << "ZdcTestAnalysis: Step file closed"; } if (doNTzdcevent) { zdcOutputEventFile->cd(); zdceventntuple->Write("", TObject::kOverwrite); - std::cout << "ZdcTestAnalysis: Ntuple event written for event: " << eventIndex << std::endl; + edm::LogVerbatim("ZdcAnalysis") << "ZdcTestAnalysis: Ntuple event written for event: " << eventIndex; zdcOutputEventFile->Close(); - std::cout << "ZdcTestAnalysis: Event file closed" << std::endl; + edm::LogVerbatim("ZdcAnalysis") << "ZdcTestAnalysis: Event file closed"; } } + +#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" + +DEFINE_SIMWATCHER(ZdcTestAnalysis); diff --git a/SimG4CMS/Forward/plugins/module.cc b/SimG4CMS/Forward/plugins/module.cc deleted file mode 100644 index 2db30d885dd99..0000000000000 --- a/SimG4CMS/Forward/plugins/module.cc +++ /dev/null @@ -1,16 +0,0 @@ -#include "SimG4CMS/Forward/interface/TotemTestGem.h" -#include "SimG4CMS/Forward/interface/CastorTestAnalysis.h" -#include "SimG4CMS/Forward/interface/ZdcTestAnalysis.h" -#include "SimG4CMS/Forward/interface/DoCastorAnalysis.h" -#include "SimG4CMS/Forward/interface/BscTest.h" -#include "SimG4CMS/Forward/interface/SimG4FluxProducer.h" - -#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" -#include "FWCore/PluginManager/interface/ModuleDef.h" - -DEFINE_SIMWATCHER(CastorTestAnalysis); -DEFINE_SIMWATCHER(ZdcTestAnalysis); -DEFINE_SIMWATCHER(DoCastorAnalysis); -DEFINE_SIMWATCHER(TotemTestGem); -DEFINE_SIMWATCHER(BscTest); -DEFINE_SIMWATCHER(SimG4FluxProducer); diff --git a/SimG4CMS/Forward/src/BSCG4Hit.cc b/SimG4CMS/Forward/src/BSCG4Hit.cc index 2f02471551718..c8b0f74e162c4 100644 --- a/SimG4CMS/Forward/src/BSCG4Hit.cc +++ b/SimG4CMS/Forward/src/BSCG4Hit.cc @@ -3,6 +3,7 @@ // Date: 02.2006 // Description: Transient Hit class for the Bsc /////////////////////////////////////////////////////////////////////////////// +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "SimG4CMS/Forward/interface/BscG4Hit.h" #include @@ -107,7 +108,7 @@ void BscG4Hit::addEnergyDeposit(const BscG4Hit& aHit) { theEnergyLoss = elem + hadr; } -void BscG4Hit::Print() { std::cout << (*this); } +void BscG4Hit::Print() { edm::LogVerbatim("ForwardSim") << (*this); } void BscG4Hit::addEnergyDeposit(float em, float hd) { elem += em; diff --git a/SimG4CMS/Forward/src/TotemG4Hit.cc b/SimG4CMS/Forward/src/TotemG4Hit.cc index 96abd061d1756..723741e67f5bf 100644 --- a/SimG4CMS/Forward/src/TotemG4Hit.cc +++ b/SimG4CMS/Forward/src/TotemG4Hit.cc @@ -13,6 +13,7 @@ // system include files // user include files +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "SimG4CMS/Forward/interface/TotemG4Hit.h" // @@ -109,7 +110,7 @@ void TotemG4Hit::addEnergyDeposit(const TotemG4Hit& aHit) { hadr += aHit.getHadr(); } -void TotemG4Hit::Print() { std::cout << (*this); } +void TotemG4Hit::Print() { edm::LogVerbatim("ForwardSim") << (*this); } math::XYZPoint TotemG4Hit::getEntry() const { return entry; } diff --git a/SimG4CMS/Forward/src/ZdcNumberingScheme.cc b/SimG4CMS/Forward/src/ZdcNumberingScheme.cc index 66b3b36bfa915..fb3d8be72f04f 100644 --- a/SimG4CMS/Forward/src/ZdcNumberingScheme.cc +++ b/SimG4CMS/Forward/src/ZdcNumberingScheme.cc @@ -6,19 +6,21 @@ /////////////////////////////////////////////////////////////////////////////// #include "SimG4CMS/Forward/interface/ZdcNumberingScheme.h" #include "DataFormats/HcalDetId/interface/HcalZDCDetId.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "CLHEP/Units/GlobalSystemOfUnits.h" #include -#undef debug + +//#define EDM_ML_DEBUG ZdcNumberingScheme::ZdcNumberingScheme(int iv) { verbosity = iv; if (verbosity > 0) - std::cout << "Creating ZDCNumberingScheme" << std::endl; + edm::LogVerbatim("ForwardSim") << "Creating ZDCNumberingScheme"; } ZdcNumberingScheme::~ZdcNumberingScheme() { if (verbosity > 0) - std::cout << " Deleting ZdcNumberingScheme" << std::endl; + edm::LogVerbatim("ForwardSim") << " Deleting ZdcNumberingScheme"; } void ZdcNumberingScheme::setVerbosity(const int iv) { verbosity = iv; } @@ -47,7 +49,7 @@ unsigned int ZdcNumberingScheme::getUnitID(const G4Step* aStep) const { zside = -1; } else if (name[ich] == "ZDC_EMLayer") { section = HcalZDCDetId::EM; -#ifdef debug +#ifdef EDM_ML_DEBUG layer = copyno[ich]; #endif } else if (name[ich] == "ZDC_EMFiber") { @@ -78,7 +80,7 @@ unsigned int ZdcNumberingScheme::getUnitID(const G4Step* aStep) const { else channel = 4; } -#ifdef debug +#ifdef EDM_ML_DEBUG else if (name[ich] == "ZDC_LumGas") { fiber = 1; } else if (name[ich] == "ZDC_HadFiber") { @@ -87,7 +89,7 @@ unsigned int ZdcNumberingScheme::getUnitID(const G4Step* aStep) const { #endif } -#ifdef debug +#ifdef EDM_ML_DEBUG unsigned intindex = 0; intindex = packZdcIndex(section, layer, fiber, channel, zside); #endif @@ -99,16 +101,16 @@ unsigned int ZdcNumberingScheme::getUnitID(const G4Step* aStep) const { HcalZDCDetId zdcId(section, true_for_positive_eta, channel); index = zdcId.rawId(); -#ifdef debug - std::cout << "DetectorId: "; - std::cout << zdcId << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("ForwardSim") << "DetectorId: " << zdcId; - std::cout << "ZdcNumberingScheme:" - << " getUnitID - # of levels = " << level << std::endl; + edm::LogVerbatim("ForwardSim") << "ZdcNumberingScheme:" + << " getUnitID - # of levels = " << level; for (int ich = 0; ich < level; ich++) - std::cout << " " << ich << ": copyno " << copyno[ich] << " name=" << name[ich] << " section " << section - << " zside " << zside << " layer " << layer << " fiber " << fiber << " channel " << channel - << "packedIndex =" << intindex << " detId raw: " << index << std::endl; + edm::LogVerbatim("ForwardSim") << " " << ich << ": copyno " << copyno[ich] << " name=" << name[ich] + << " section " << section << " zside " << zside << " layer " << layer << " fiber " + << fiber << " channel " << channel << "packedIndex =" << intindex + << " detId raw: " << std::hex << index << std::dec; #endif @@ -126,9 +128,9 @@ unsigned ZdcNumberingScheme::packZdcIndex(int section, int layer, int fiber, int idx += (layer & 127) << 2; //bits 2-8 idx += (section & 3); //bits 0-1 -#ifdef debug - std::cout << "ZDC packing: section " << section << " layer " << layer << " fiber " << fiber << " channel " << channel - << " zside " << z << "idx: " << idx << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("ForwardSim") << "ZDC packing: section " << section << " layer " << layer << " fiber " << fiber + << " channel " << channel << " zside " << z << "idx: " << std::hex << idx << std::dec; int newsubdet, newlayer, newfiber, newchannel, newz; unpackZdcIndex(idx, newsubdet, newlayer, newfiber, newchannel, newz); #endif @@ -144,9 +146,9 @@ void ZdcNumberingScheme::unpackZdcIndex( layer = (idx >> 2) & 127; section = idx & 3; -#ifdef debug - std::cout << "ZDC unpacking: idx:" << idx << " -> section " << section << " layer " << layer << " fiber " << fiber - << " channel " << channel << " zside " << z << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("ForwardSim") << "ZDC unpacking: idx:" << idx << " -> section " << section << " layer " << layer + << " fiber " << fiber << " channel " << channel << " zside " << z; #endif } diff --git a/SimG4CMS/Forward/src/ZdcSD.cc b/SimG4CMS/Forward/src/ZdcSD.cc index e8d3052fa1b1b..314a00257762c 100644 --- a/SimG4CMS/Forward/src/ZdcSD.cc +++ b/SimG4CMS/Forward/src/ZdcSD.cc @@ -243,15 +243,18 @@ double ZdcSD::getEnergyDeposit(const G4Step* aStep) { float tan_arcos = 2. * a * d; if (tan_arcos != 0.) arg_arcos = (r * r - a * a - d * d) / tan_arcos; - // std::cout.testOut << " d_qz: " << r << "," << a << "," << d << " " << tan_arcos << " " << arg_arcos; arg_arcos = std::abs(arg_arcos); - // std::cout.testOut << "," << arg_arcos; float th_arcos = acos(std::min(std::max(arg_arcos, -1.f), 1.f)); - // std::cout.testOut << " " << th_arcos; d_qz = th_arcos / twopi; - // std::cout.testOut << " " << d_qz; d_qz = std::abs(d_qz); - // std::cout.testOut << "," << d_qz; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("ForwardSim") << " d_qz: " << r << "," << a << "," << d << " " << tan_arcos << " " + << arg_arcos; + edm::LogVerbatim("ForwardSim") << "," << arg_arcos; + edm::LogVerbatim("ForwardSim") << " " << d_qz; + edm::LogVerbatim("ForwardSim") << " " << th_arcos; + edm::LogVerbatim("ForwardSim") << "," << d_qz; +#endif } } } diff --git a/SimG4CMS/Forward/src/ZdcShowerLibrary.cc b/SimG4CMS/Forward/src/ZdcShowerLibrary.cc index adef2788561b6..9434d8a659977 100644 --- a/SimG4CMS/Forward/src/ZdcShowerLibrary.cc +++ b/SimG4CMS/Forward/src/ZdcShowerLibrary.cc @@ -6,9 +6,10 @@ #include "SimG4CMS/Forward/interface/ZdcShowerLibrary.h" #include "SimG4Core/Notification/interface/G4TrackToParticleID.h" -#include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Utilities/interface/RandomNumberGenerator.h" +#include "FWCore/Utilities/interface/Exception.h" #include "G4VPhysicalVolume.hh" #include "G4Step.hh" @@ -116,11 +117,12 @@ std::vector& ZdcShowerLibrary::getHits(const G4Step* aSte hits.push_back(oneHit); - LogDebug("ZdcShower") << "\nZdcShowerLibrary:Generated Hit " << nHit << " orig hit pos " << hitPointOrig - << " orig hit pos local coord" << hitPoint << " new position " << (hits[nHit].position) - << " Channel " << (hits[nHit].depth) << " side " << side << " Time " << (hits[nHit].time) - << " DetectorID " << (hits[nHit].detID) << " Had Energy " << (hits[nHit].DeHad) - << " EM Energy " << (hits[nHit].DeEM) << "\n"; + edm::LogVerbatim("ZdcShower") << "\nZdcShowerLibrary:Generated Hit " << nHit << " orig hit pos " << hitPointOrig + << " orig hit pos local coord" << hitPoint << " new position " + << (hits[nHit].position) << " Channel " << (hits[nHit].depth) << " side " << side + << " Time " << (hits[nHit].time) << " DetectorID " << (hits[nHit].detID) + << " Had Energy " << (hits[nHit].DeHad) << " EM Energy " << (hits[nHit].DeEM) + << "\n"; nHit++; } return hits; @@ -137,12 +139,12 @@ int ZdcShowerLibrary::getEnergyFromLibrary(const G4ThreeVector& hitPoint, energy = energy / GeV; - LogDebug("ZdcShower") << "\n ZdcShowerLibrary::getEnergyFromLibrary input/output variables:" - << " phi: " << 59.2956 * momDir.phi() << " theta: " << 59.2956 * momDir.theta() - << " xin : " << hitPoint.x() << " yin : " << hitPoint.y() << " zin : " << hitPoint.z() - << " track en: " << energy << "(GeV)" - << " section: " << section << " side: " << side << " channel: " << channel - << " partID: " << parCode; + edm::LogVerbatim("ZdcShower") << "\n ZdcShowerLibrary::getEnergyFromLibrary input/output variables:" + << " phi: " << 59.2956 * momDir.phi() << " theta: " << 59.2956 * momDir.theta() + << " xin : " << hitPoint.x() << " yin : " << hitPoint.y() << " zin : " << hitPoint.z() + << " track en: " << energy << "(GeV)" + << " section: " << section << " side: " << side << " channel: " << channel + << " partID: " << parCode; double eav = 0.; double esig = 0.; @@ -203,13 +205,13 @@ int ZdcShowerLibrary::getEnergyFromLibrary(const G4ThreeVector& hitPoint, } if (eav < 0. || esig < 0.) { - LogDebug("ZdcShower") << " Negative everage energy or esigma from parametrization \n" - << " xin: " << xin << "(cm)" - << " yin: " << yin << "(cm)" - << " track en: " << energy << "(GeV)" - << " eaverage: " << eav << " (GeV)" - << " esigma: " << esig << " (GeV)" - << " edist: " << edis << " (GeV)"; + edm::LogVerbatim("ZdcShower") << " Negative everage energy or esigma from parametrization \n" + << " xin: " << xin << "(cm)" + << " yin: " << yin << "(cm)" + << " track en: " << energy << "(GeV)" + << " eaverage: " << eav << " (GeV)" + << " esigma: " << esig << " (GeV)" + << " edist: " << edis << " (GeV)"; return 0; } @@ -220,13 +222,11 @@ int ZdcShowerLibrary::getEnergyFromLibrary(const G4ThreeVector& hitPoint, while (nphotons == -1 || nphotons > int(eav + 5. * esig)) nphotons = (int)(fact * photonFluctuation(eav, esig, edis)); - LogDebug("ZdcShower") - //std::cout - << " track en: " << energy << "(GeV)" - << " eaverage: " << eav / GeV << " (GeV)" - << " esigma: " << esig / GeV << " (GeV)" - << " edist: " << edis << " (GeV)" - << " dE hit: " << nphotons / GeV << " (GeV)"; + edm::LogVerbatim("ZdcShower") << " track en: " << energy << "(GeV)" + << " eaverage: " << eav / GeV << " (GeV)" + << " esigma: " << esig / GeV << " (GeV)" + << " edist: " << edis << " (GeV)" + << " dE hit: " << nphotons / GeV << " (GeV)"; return nphotons; } diff --git a/SimG4CMS/Forward/test/SimG4FluxAnalyzer.cc b/SimG4CMS/Forward/test/SimG4FluxAnalyzer.cc index e47c29ec25232..8937cd8d052a9 100644 --- a/SimG4CMS/Forward/test/SimG4FluxAnalyzer.cc +++ b/SimG4CMS/Forward/test/SimG4FluxAnalyzer.cc @@ -1,10 +1,10 @@ // system include files -#include #include #include -#include #include +#include #include +#include // user include files #include "CommonTools/UtilAlgos/interface/TFileService.h" @@ -17,6 +17,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/InputTag.h" #include "SimDataFormats/CaloTest/interface/ParticleFlux.h" @@ -60,17 +61,17 @@ SimG4FluxAnalyzer::SimG4FluxAnalyzer(const edm::ParameterSet& iConfig) { //now do whatever initialization is needed lvNames_ = iConfig.getParameter>("LVNames"); #ifdef EDM_ML_DEBUG - std::cout << "SimG4FluxAnalyzer:: for " << lvNames_.size() << " names:"; + std::ostringstream st1; for (const auto& name : lvNames_) - std::cout << " " << name; - std::cout << std::endl; + st1 << " " << name; + edm::LogVerbatim("SimG4FluxProducer") << "SimG4FluxAnalyzer:: for " << lvNames_.size() << " names:" << st1.str(); #endif for (const auto& name : lvNames_) { std::string tagn = name + "ParticleFlux"; tok_PF_.push_back(consumes(edm::InputTag("g4SimHits", tagn))); #ifdef EDM_ML_DEBUG - std::cout << "Flux source " << edm::InputTag("g4SimHits", tagn) << std::endl; + edm::LogVerbatim("SimG4FluxProducer") << "Flux source " << edm::InputTag("g4SimHits", tagn); #endif } } @@ -132,8 +133,8 @@ void SimG4FluxAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& int id = pflux->getId(); std::vector flux = pflux->getFlux(); #ifdef EDM_ML_DEBUG - std::cout << "SimG4FluxAnalyzer:: ParticleFlux for " << lvNames_[k] << " has " << pflux->getComponents() - << " entries" << std::endl; + edm::LogVerbatim("SimG4FluxProducer") + << "SimG4FluxAnalyzer:: ParticleFlux for " << lvNames_[k] << " has " << pflux->getComponents() << " entries"; ++k; unsigned k1(0); #endif @@ -153,16 +154,16 @@ void SimG4FluxAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& momY_.push_back(element.momentum.Y()); momZ_.push_back(element.momentum.Z()); #ifdef EDM_ML_DEBUG - std::cout << "Flux[" << k1 << "] PDGId " << element.pdgId << " VT " << element.vxType << " ToF " << element.tof - << " Vertex " << element.vertex << " Hit " << element.hitPoint << " p " << element.momentum - << std::endl; + edm::LogVerbatim("SimG4FluxProducer") + << "Flux[" << k1 << "] PDGId " << element.pdgId << " VT " << element.vxType << " ToF " << element.tof + << " Vertex " << element.vertex << " Hit " << element.hitPoint << " p " << element.momentum; ++k1; #endif } } } #ifdef EDM_ML_DEBUG - std::cout << "All flux compnents have " << detName_.size() << " entries" << std::endl; + edm::LogVerbatim("SimG4FluxProducer") << "All flux compnents have " << detName_.size() << " entries"; #endif if (!detName_.empty()) tree_->Fill(); diff --git a/SimG4CMS/HGCalTestBeam/BuildFile.xml b/SimG4CMS/HGCalTestBeam/BuildFile.xml index 21c10d355c932..e46b057df6df2 100644 --- a/SimG4CMS/HGCalTestBeam/BuildFile.xml +++ b/SimG4CMS/HGCalTestBeam/BuildFile.xml @@ -1,15 +1,8 @@ - - - - - - - diff --git a/SimG4CMS/HGCalTestBeam/CaloUtil.xml b/SimG4CMS/HGCalTestBeam/CaloUtil.xml deleted file mode 100644 index 2619c0b700090..0000000000000 --- a/SimG4CMS/HGCalTestBeam/CaloUtil.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SimG4CMS/HGCalTestBeam/data/dd4hep/HGCalTB181Oct1.xml b/SimG4CMS/HGCalTestBeam/data/dd4hep/HGCalTB181Oct1.xml new file mode 100644 index 0000000000000..b07ea40251d0d --- /dev/null +++ b/SimG4CMS/HGCalTestBeam/data/dd4hep/HGCalTB181Oct1.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SimG4CMS/HGCalTestBeam/plugins/BuildFile.xml b/SimG4CMS/HGCalTestBeam/plugins/BuildFile.xml index 34d2dbe586930..8724239309167 100644 --- a/SimG4CMS/HGCalTestBeam/plugins/BuildFile.xml +++ b/SimG4CMS/HGCalTestBeam/plugins/BuildFile.xml @@ -12,12 +12,12 @@ - + diff --git a/SimG4CMS/HGCalTestBeam/plugins/HGCPassive.cc b/SimG4CMS/HGCalTestBeam/plugins/HGCPassive.cc index 151bc145d3eab..6c30d5cb7b127 100644 --- a/SimG4CMS/HGCalTestBeam/plugins/HGCPassive.cc +++ b/SimG4CMS/HGCalTestBeam/plugins/HGCPassive.cc @@ -4,31 +4,88 @@ // Description: Main analysis class for HGCal Validation of G4 Hits /////////////////////////////////////////////////////////////////////////////// -#include "HGCPassive.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "CLHEP/Units/GlobalPhysicalConstants.h" -#include "CLHEP/Units/GlobalSystemOfUnits.h" +// to retreive hits +#include "SimDataFormats/CaloHit/interface/PassiveHit.h" + +#include "SimG4Core/Notification/interface/BeginOfEvent.h" +#include "SimG4Core/Notification/interface/BeginOfRun.h" +#include "SimG4Core/Notification/interface/Observer.h" +#include "SimG4Core/Watcher/interface/SimProducer.h" + +#include "G4LogicalVolumeStore.hh" +#include "G4PhysicalVolumeStore.hh" +#include "G4Step.hh" #include "G4TransportationManager.hh" +#include "G4TouchableHistory.hh" +#include "G4Track.hh" +#include "DD4hep/Filter.h" +#include #include -#include -#include -#include -#include +#include +#include +#include //#define EDM_ML_DEBUG -HGCPassive::HGCPassive(const edm::ParameterSet& p) : topPV_(nullptr), topLV_(nullptr), count_(0), init_(false) { +class HGCPassive : public SimProducer, + public Observer, + public Observer, + public Observer { +public: + HGCPassive(const edm::ParameterSet &p); + HGCPassive(const HGCPassive &) = delete; // stop default + const HGCPassive &operator=(const HGCPassive &) = delete; + ~HGCPassive() override; + + void produce(edm::Event &, const edm::EventSetup &) override; + +private: + // observer classes + void update(const BeginOfRun *run) override; + void update(const BeginOfEvent *evt) override; + void update(const G4Step *step) override; + + // void endOfEvent(edm::PassiveHitContainer &HGCEEAbsE); + void endOfEvent(edm::PassiveHitContainer &hgcPH, unsigned int k); + + typedef std::map>::iterator volumeIterator; + G4VPhysicalVolume *getTopPV(); + volumeIterator findLV(G4LogicalVolume *plv); + void storeInfo( + const volumeIterator itr, G4LogicalVolume *plv, unsigned int copy, double time, double energy, bool flag); + +private: + std::vector LVNames_; + G4VPhysicalVolume *topPV_; + G4LogicalVolume *topLV_; + std::map> mapLV_; + std::string motherName_; + int addlevel_; + + // some private members for ananlysis + unsigned int count_; + bool init_; + std::map, std::array> store_; +}; + +HGCPassive::HGCPassive(const edm::ParameterSet &p) : topPV_(nullptr), topLV_(nullptr), count_(0), init_(false) { edm::ParameterSet m_Passive = p.getParameter("HGCPassive"); - LVNames_ = m_Passive.getParameter >("LVNames"); + LVNames_ = m_Passive.getParameter>("LVNames"); motherName_ = m_Passive.getParameter("MotherName"); + bool dd4hep = m_Passive.getParameter("IfDD4Hep"); + addlevel_ = dd4hep ? 1 : 0; #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HGCSim") << "Name of the mother volume " << motherName_; + edm::LogVerbatim("HGCSim") << "Name of the mother volume " << motherName_ << " AddLevel " << addlevel_; unsigned k(0); #endif - for (const auto& name : LVNames_) { + for (const auto &name : LVNames_) { produces(Form("%sPassiveHits", name.c_str())); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCSim") << "Collection name[" << k << "] " << name; @@ -39,7 +96,7 @@ HGCPassive::HGCPassive(const edm::ParameterSet& p) : topPV_(nullptr), topLV_(nul HGCPassive::~HGCPassive() {} -void HGCPassive::produce(edm::Event& e, const edm::EventSetup&) { +void HGCPassive::produce(edm::Event &e, const edm::EventSetup &) { for (unsigned int k = 0; k < LVNames_.size(); ++k) { std::unique_ptr hgcPH(new edm::PassiveHitContainer); endOfEvent(*hgcPH, k); @@ -47,13 +104,13 @@ void HGCPassive::produce(edm::Event& e, const edm::EventSetup&) { } } -void HGCPassive::update(const BeginOfRun* run) { +void HGCPassive::update(const BeginOfRun *run) { topPV_ = getTopPV(); if (topPV_ == nullptr) { edm::LogWarning("HGCSim") << "Cannot find top level volume\n"; } else { init_ = true; - const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance(); + const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance(); for (auto lvcite : *lvs) { findLV(lvcite); } @@ -61,7 +118,7 @@ void HGCPassive::update(const BeginOfRun* run) { #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCSim") << "HGCPassive::Finds " << mapLV_.size() << " logical volumes"; unsigned int k(0); - for (const auto& lvs : mapLV_) { + for (const auto &lvs : mapLV_) { edm::LogVerbatim("HGCSim") << "Entry[" << k << "] " << lvs.first << ": (" << (lvs.second).first << ", " << (lvs.second).second << ")"; ++k; @@ -71,7 +128,7 @@ void HGCPassive::update(const BeginOfRun* run) { } //=================================================================== per EVENT -void HGCPassive::update(const BeginOfEvent* evt) { +void HGCPassive::update(const BeginOfEvent *evt) { int iev = (*evt)()->GetEventID(); edm::LogVerbatim("HGCSim") << "HGCPassive: =====> Begin event = " << iev << std::endl; @@ -81,13 +138,14 @@ void HGCPassive::update(const BeginOfEvent* evt) { // //=================================================================== each // STEP -void HGCPassive::update(const G4Step* aStep) { +void HGCPassive::update(const G4Step *aStep) { if (aStep != nullptr) { - G4VSensitiveDetector* curSD = aStep->GetPreStepPoint()->GetSensitiveDetector(); - const G4VTouchable* touchable = aStep->GetPreStepPoint()->GetTouchable(); + G4VSensitiveDetector *curSD = aStep->GetPreStepPoint()->GetSensitiveDetector(); + const G4VTouchable *touchable = aStep->GetPreStepPoint()->GetTouchable(); + int level = (touchable->GetHistoryDepth()); if (curSD == nullptr) { - G4LogicalVolume* plv = touchable->GetVolume()->GetLogicalVolume(); + G4LogicalVolume *plv = touchable->GetVolume()->GetLogicalVolume(); auto it = (init_) ? mapLV_.find(plv) : findLV(plv); double time = aStep->GetTrack()->GetGlobalTime(); double energy = (aStep->GetTotalEnergyDeposit()) / CLHEP::GeV; @@ -96,8 +154,8 @@ void HGCPassive::update(const G4Step* aStep) { if (((aStep->GetPostStepPoint() == nullptr) || (aStep->GetTrack()->GetNextVolume() == nullptr)) && (aStep->IsLastStepInVolume())) { #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HGCSim") << plv->GetName() << " F|L Step " << aStep->IsFirstStepInVolume() << ":" - << aStep->IsLastStepInVolume() << " Position" + edm::LogVerbatim("HGCSim") << static_cast(dd4hep::dd::noNamespace(plv->GetName())) << " F|L Step " + << aStep->IsFirstStepInVolume() << ":" << aStep->IsLastStepInVolume() << " Position" << aStep->GetPreStepPoint()->GetPosition() << " Track " << aStep->GetTrack()->GetDefinition()->GetParticleName() << " at" << aStep->GetTrack()->GetPosition() << " Volume " << aStep->GetTrack()->GetVolume() @@ -109,7 +167,9 @@ void HGCPassive::update(const G4Step* aStep) { energy += (aStep->GetPreStepPoint()->GetKineticEnergy() / CLHEP::GeV); } else { time = (aStep->GetPostStepPoint()->GetGlobalTime()); - copy = (unsigned int)(touchable->GetReplicaNumber(0) + 1000 * touchable->GetReplicaNumber(1)); + copy = (level < 2) + ? 0 + : static_cast(touchable->GetReplicaNumber(0) + 1000 * touchable->GetReplicaNumber(1)); } if (it != mapLV_.end()) { storeInfo(it, plv, copy, time, energy, true); @@ -122,17 +182,17 @@ void HGCPassive::update(const G4Step* aStep) { } // if (curSD==NULL) // Now for the mother volumes - int level = (touchable->GetHistoryDepth()); if (level > 0) { double energy = (aStep->GetTotalEnergyDeposit()) / CLHEP::GeV; double time = (aStep->GetTrack()->GetGlobalTime()); for (int i = level; i > 0; --i) { - G4LogicalVolume* plv = touchable->GetVolume(i)->GetLogicalVolume(); + G4LogicalVolume *plv = touchable->GetVolume(i)->GetLogicalVolume(); auto it = (init_) ? mapLV_.find(plv) : findLV(plv); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HGCSim") << "Level: " << level << ":" << i << " " << plv->GetName() << " flag in the List " - << (it != mapLV_.end()); + edm::LogVerbatim("HGCSim") << "Level: " << level << ":" << i << " " + << static_cast(dd4hep::dd::noNamespace(plv->GetName())) + << " flag in the List " << (it != mapLV_.end()); #endif if (it != mapLV_.end()) { unsigned int copy = @@ -148,12 +208,12 @@ void HGCPassive::update(const G4Step* aStep) { //================================================================ End of EVENT -void HGCPassive::endOfEvent(edm::PassiveHitContainer& hgcPH, unsigned int k) { +void HGCPassive::endOfEvent(edm::PassiveHitContainer &hgcPH, unsigned int k) { #ifdef EDM_ML_DEBUG unsigned int kount(0); #endif - for (const auto& element : store_) { - G4LogicalVolume* lv = (element.first).first; + for (const auto &element : store_) { + G4LogicalVolume *lv = (element.first).first; auto it = mapLV_.find(lv); if (it != mapLV_.end()) { if ((it->second).first == k) { @@ -169,14 +229,14 @@ void HGCPassive::endOfEvent(edm::PassiveHitContainer& hgcPH, unsigned int k) { } } -G4VPhysicalVolume* HGCPassive::getTopPV() { +G4VPhysicalVolume *HGCPassive::getTopPV() { return G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume(); } -HGCPassive::volumeIterator HGCPassive::findLV(G4LogicalVolume* plv) { +HGCPassive::volumeIterator HGCPassive::findLV(G4LogicalVolume *plv) { auto itr = mapLV_.find(plv); if (itr == mapLV_.end()) { - std::string name = plv->GetName(); + std::string name = static_cast(dd4hep::dd::noNamespace(plv->GetName())); for (unsigned int k = 0; k < LVNames_.size(); ++k) { if (name.find(LVNames_[k]) != std::string::npos) { mapLV_[plv] = std::pair(k, name); @@ -186,19 +246,19 @@ HGCPassive::volumeIterator HGCPassive::findLV(G4LogicalVolume* plv) { } } if (topLV_ == nullptr) { - if (std::string(plv->GetName()) == motherName_) + if (static_cast(dd4hep::dd::noNamespace(plv->GetName())) == motherName_) topLV_ = plv; } return itr; } void HGCPassive::storeInfo(const HGCPassive::volumeIterator it, - G4LogicalVolume* plv, + G4LogicalVolume *plv, unsigned int copy, double time, double energy, bool flag) { - std::pair key(plv, copy); + std::pair key(plv, copy); auto itr = store_.find(key); double ee = (flag) ? energy : 0; if (itr == store_.end()) { @@ -215,4 +275,7 @@ void HGCPassive::storeInfo(const HGCPassive::volumeIterator it, #endif } +#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" + DEFINE_SIMWATCHER(HGCPassive); diff --git a/SimG4CMS/HGCalTestBeam/plugins/HGCPassive.h b/SimG4CMS/HGCalTestBeam/plugins/HGCPassive.h deleted file mode 100644 index c5ee87c5539e8..0000000000000 --- a/SimG4CMS/HGCalTestBeam/plugins/HGCPassive.h +++ /dev/null @@ -1,75 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// File: HGCPassive.cc -// copied from SimG4HGCalValidation -// Description: Main analysis class for HGCal Validation of G4 Hits -/////////////////////////////////////////////////////////////////////////////// - -#include "SimG4Core/Notification/interface/BeginOfEvent.h" -#include "SimG4Core/Notification/interface/BeginOfRun.h" -#include "SimG4Core/Notification/interface/EndOfEvent.h" -#include "SimG4Core/Notification/interface/Observer.h" -#include "SimG4Core/Watcher/interface/SimProducer.h" - -// to retreive hits -#include "SimDataFormats/CaloHit/interface/PassiveHit.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" - -#include "SimDataFormats/CaloHit/interface/PassiveHit.h" - -#include "G4LogicalVolumeStore.hh" -#include "G4PhysicalVolumeStore.hh" -#include "G4Step.hh" -#include "G4TouchableHistory.hh" -#include "G4Track.hh" - -#include -#include -#include -#include - -class HGCPassive : public SimProducer, - public Observer, - public Observer, - public Observer { -public: - HGCPassive(const edm::ParameterSet &p); - HGCPassive(const HGCPassive &) = delete; // stop default - const HGCPassive &operator=(const HGCPassive &) = delete; - ~HGCPassive() override; - - void produce(edm::Event &, const edm::EventSetup &) override; - -private: - // observer classes - void update(const BeginOfRun *run) override; - void update(const BeginOfEvent *evt) override; - void update(const G4Step *step) override; - - // void endOfEvent(edm::PassiveHitContainer &HGCEEAbsE); - void endOfEvent(edm::PassiveHitContainer &hgcPH, unsigned int k); - - typedef std::map>::iterator volumeIterator; - G4VPhysicalVolume *getTopPV(); - volumeIterator findLV(G4LogicalVolume *plv); - void storeInfo( - const volumeIterator itr, G4LogicalVolume *plv, unsigned int copy, double time, double energy, bool flag); - -private: - std::vector LVNames_; - G4VPhysicalVolume *topPV_; - G4LogicalVolume *topLV_; - std::map> mapLV_; - std::string motherName_; - - // some private members for ananlysis - unsigned int count_; - bool init_; - std::map, std::array> store_; -}; diff --git a/SimG4CMS/HGCalTestBeam/plugins/HGCalTimingAnalyzer.cc b/SimG4CMS/HGCalTestBeam/plugins/HGCalTimingAnalyzer.cc index 730c8a7991b9d..e5ad26df771a3 100644 --- a/SimG4CMS/HGCalTestBeam/plugins/HGCalTimingAnalyzer.cc +++ b/SimG4CMS/HGCalTestBeam/plugins/HGCalTimingAnalyzer.cc @@ -1,8 +1,7 @@ // system include files #include -#include +#include #include -#include #include #include @@ -17,6 +16,7 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" @@ -92,11 +92,12 @@ HGCalTimingAnalyzer::HGCalTimingAnalyzer(const edm::ParameterSet& iConfig) if (!groupHits_) timeUnit_ = 0.000001; #ifdef EDM_ML_DEBUG - std::cout << "HGCalTimingAnalyzer:: Group Hits " << groupHits_ << " in " << timeUnit_ << " IdBeam " << idBeams_.size() - << ":"; + std::ostringstream st1; + st1 << "HGCalTimingAnalyzer:: Group Hits " << groupHits_ << " in " << timeUnit_ << " IdBeam " << idBeams_.size() + << ":"; for (const auto& id : idBeams_) - std::cout << " " << id; - std::cout << std::endl; + st1 << " " << id; + edm::LogVerbatim("HGCSim") << st1.str(); #endif if (idBeams_.empty()) idBeams_.push_back(1001); @@ -104,19 +105,19 @@ HGCalTimingAnalyzer::HGCalTimingAnalyzer(const edm::ParameterSet& iConfig) edm::InputTag tmp0 = iConfig.getParameter("GeneratorSrc"); tok_hepMC_ = consumes(tmp0); #ifdef EDM_ML_DEBUG - std::cout << "HGCalTimingAnalyzer:: GeneratorSource = " << tmp0 << std::endl; + edm::LogVerbatim("HGCSim") << "HGCalTimingAnalyzer:: GeneratorSource = " << tmp0; #endif tok_simTk_ = consumes(edm::InputTag("g4SimHits")); tok_simVtx_ = consumes(edm::InputTag("g4SimHits")); std::string tmp1 = iConfig.getParameter("CaloHitSrcEE"); tok_hitsEE_ = consumes(edm::InputTag("g4SimHits", tmp1)); #ifdef EDM_ML_DEBUG - std::cout << "HGCalTimingAnalyzer:: Detector " << detectorEE_ << " with tags " << tmp1 << std::endl; + edm::LogVerbatim("HGCSim") << "HGCalTimingAnalyzer:: Detector " << detectorEE_ << " with tags " << tmp1; #endif tmp1 = iConfig.getParameter("CaloHitSrcBeam"); tok_hitsBeam_ = consumes(edm::InputTag("g4SimHits", tmp1)); #ifdef EDM_ML_DEBUG - std::cout << "HGCalTimingAnalyzer:: Detector " << detectorBeam_ << " with tags " << tmp1 << std::endl; + edm::LogVerbatim("HGCSim") << "HGCalTimingAnalyzer:: Detector " << detectorBeam_ << " with tags " << tmp1; #endif } @@ -158,8 +159,8 @@ void HGCalTimingAnalyzer::beginRun(const edm::Run&, const edm::EventSetup& iSetu hgcons_ = &iSetup.getData(tokDDD_); #ifdef EDM_ML_DEBUG - std::cout << "HGCalTimingAnalyzer::" << detectorEE_ << " defined with " << hgcons_->layers(false) << " layers" - << std::endl; + edm::LogVerbatim("HGCSim") << "HGCalTimingAnalyzer::" << detectorEE_ << " defined with " << hgcons_->layers(false) + << " layers"; #endif } @@ -175,8 +176,8 @@ void HGCalTimingAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetu unsigned int k(0); for (HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin(); p != myGenEvent->particles_end(); ++p, ++k) { - std::cout << "Particle[" << k << "] with p " << (*p)->momentum().rho() << " theta " << (*p)->momentum().theta() - << " phi " << (*p)->momentum().phi() << std::endl; + edm::LogVerbatim("HGCSim") << "Particle[" << k << "] with p " << (*p)->momentum().rho() << " theta " + << (*p)->momentum().theta() << " phi " << (*p)->momentum().phi(); } } #endif @@ -200,30 +201,30 @@ void HGCalTimingAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetu iEvent.getByToken(tok_hitsEE_, theCaloHitContainers); if (theCaloHitContainers.isValid()) { #ifdef EDM_ML_DEBUG - std::cout << "PcalohitContainer for " << detectorEE_ << " has " << theCaloHitContainers->size() << " hits" - << std::endl; + edm::LogVerbatim("HGCSim") << "PcalohitContainer for " << detectorEE_ << " has " << theCaloHitContainers->size() + << " hits"; #endif caloHits.clear(); caloHits.insert(caloHits.end(), theCaloHitContainers->begin(), theCaloHitContainers->end()); analyzeSimHits(0, caloHits); } else { #ifdef EDM_ML_DEBUG - std::cout << "PCaloHitContainer does not exist for " << detectorEE_ << " !!!" << std::endl; + edm::LogVerbatim("HGCSim") << "PCaloHitContainer does not exist for " << detectorEE_ << " !!!"; #endif } iEvent.getByToken(tok_hitsBeam_, theCaloHitContainers); if (theCaloHitContainers.isValid()) { #ifdef EDM_ML_DEBUG - std::cout << "PcalohitContainer for " << detectorBeam_ << " has " << theCaloHitContainers->size() << " hits" - << std::endl; + edm::LogVerbatim("HGCSim") << "PcalohitContainer for " << detectorBeam_ << " has " << theCaloHitContainers->size() + << " hits"; #endif caloHits.clear(); caloHits.insert(caloHits.end(), theCaloHitContainers->begin(), theCaloHitContainers->end()); analyzeSimHits(1, caloHits); } else { #ifdef EDM_ML_DEBUG - std::cout << "PCaloHitContainer does not exist for " << detectorBeam_ << " !!!" << std::endl; + edm::LogVerbatim("HGCSim") << "PCaloHitContainer does not exist for " << detectorBeam_ << " !!!"; #endif } if (doTree_) @@ -246,16 +247,16 @@ void HGCalTimingAnalyzer::analyzeSimHits(int type, std::vector const& id = HGCalDetId((ForwardSubdetector)(subdet), zside, recoLayerCell.second, subsector, sector, recoLayerCell.first) .rawId(); #ifdef EDM_ML_DEBUG - std::cout << "SimHit:Hit[" << i << "] Id " << subdet << ":" << zside << ":" << layer << ":" << sector << ":" - << subsector << ":" << recoLayerCell.first << ":" << recoLayerCell.second << " Energy " << energy - << " Time " << time << std::endl; + edm::LogVerbatim("HGCSim") << "SimHit:Hit[" << i << "] Id " << subdet << ":" << zside << ":" << layer << ":" + << sector << ":" << subsector << ":" << recoLayerCell.first << ":" + << recoLayerCell.second << " Energy " << energy << " Time " << time; #endif } else { #ifdef EDM_ML_DEBUG int subdet, layer, x, y; HcalTestBeamNumbering::unpackIndex(id, subdet, layer, x, y); - std::cout << "SimHit:Hit[" << i << "] Beam Subdet " << subdet << " Layer " << layer << " x|y " << x << ":" << y - << " Energy " << energy << " Time " << time << std::endl; + edm::LogVerbatim("HGCSim") << "SimHit:Hit[" << i << "] Beam Subdet " << subdet << " Layer " << layer << " x|y " + << x << ":" << y << " Energy " << energy << " Time " << time; #endif } uint64_t tid = (uint64_t)((time + 50.0) / timeUnit_); @@ -273,8 +274,8 @@ void HGCalTimingAnalyzer::analyzeSimHits(int type, std::vector const& } #ifdef EDM_ML_DEBUG - std::cout << "analyzeSimHits: Finds " << map_hits.size() << " hits " - << " from the Hit Vector of size " << hits.size() << " for type " << type << std::endl; + edm::LogVerbatim("HGCSim") << "analyzeSimHits: Finds " << map_hits.size() << " hits " + << " from the Hit Vector of size " << hits.size() << " for type " << type; #endif for (const auto& itr : map_hits) { uint32_t id = (itr.first).first; @@ -290,7 +291,7 @@ void HGCalTimingAnalyzer::analyzeSimHits(int type, std::vector const& simHitCellTmBeam_.push_back(time); } #ifdef EDM_ML_DEBUG - std::cout << "SimHit::ID: " << std::hex << id << std::dec << " T: " << time << " E: " << energy << std::endl; + edm::LogVerbatim("HGCSim") << "SimHit::ID: " << std::hex << id << std::dec << " T: " << time << " E: " << energy; #endif } } @@ -301,9 +302,9 @@ void HGCalTimingAnalyzer::analyzeSimTracks(edm::Handle c int vertIndex(-1); for (edm::SimTrackContainer::const_iterator simTrkItr = SimTk->begin(); simTrkItr != SimTk->end(); simTrkItr++) { #ifdef EDM_ML_DEBUG - std::cout << "Track " << simTrkItr->trackId() << " Vertex " << simTrkItr->vertIndex() << " Type " - << simTrkItr->type() << " Charge " << simTrkItr->charge() << " momentum " << simTrkItr->momentum() << " " - << simTrkItr->momentum().P() << std::endl; + edm::LogVerbatim("HGCSim") << "Track " << simTrkItr->trackId() << " Vertex " << simTrkItr->vertIndex() << " Type " + << simTrkItr->type() << " Charge " << simTrkItr->charge() << " momentum " + << simTrkItr->momentum() << " " << simTrkItr->momentum().P(); #endif if (vertIndex == -1) { vertIndex = simTrkItr->vertIndex(); @@ -315,7 +316,7 @@ void HGCalTimingAnalyzer::analyzeSimTracks(edm::Handle c for (int iv = 0; iv < vertIndex; iv++) simVtxItr++; #ifdef EDM_ML_DEBUG - std::cout << "Vertex " << vertIndex << " position " << simVtxItr->position() << std::endl; + edm::LogVerbatim("HGCSim") << "Vertex " << vertIndex << " position " << simVtxItr->position(); #endif xBeam_ = simVtxItr->position().X(); yBeam_ = simVtxItr->position().Y(); diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN170_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN170_cfg.py index d4bd99d3db2b9..ffebf5a7ea94d 100644 --- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN170_cfg.py +++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN170_cfg.py @@ -101,9 +101,10 @@ 'HcalTB06BeamDetector'] process.g4SimHits.Watchers = cms.VPSet(cms.PSet( HGCPassive = cms.PSet( - LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), - MotherName = cms.string('OCMS'), - ), + LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), + MotherName = cms.string('OCMS'), + IfDD4Hep = cms.bool(False), + ), type = cms.string('HGCPassive'), ) ) diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1DD4Hep_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1DD4Hep_cfg.py new file mode 100644 index 0000000000000..b6ce1cd26dbd1 --- /dev/null +++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1DD4Hep_cfg.py @@ -0,0 +1,151 @@ +import FWCore.ParameterSet.Config as cms +from Configuration.ProcessModifiers.dd4hep_cff import dd4hep + +process = cms.Process('SIM',dd4hep) + +# import of standard configurations +process.load("FWCore.MessageService.MessageLogger_cfi") +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load("Configuration.Geometry.GeometryDD4hep_cff") +process.load('Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi') +process.load('Geometry.HGCalCommonData.hgcalParametersInitialization_cfi') +process.load('Geometry.HcalTestBeamData.hcalTB06Parameters_cff') +process.load('Configuration.StandardSequences.MagneticField_0T_cff') +process.load('Configuration.StandardSequences.Generator_cff') +process.load('IOMC.EventVertexGenerators.VtxSmearedFlat_cfi') +process.load('GeneratorInterface.Core.genFilterSummary_cff') +process.load('Configuration.StandardSequences.SimIdeal_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +process.load('SimG4CMS.HGCalTestBeam.HGCalTBAnalyzer_cfi') +process.load('SimG4CMS.HGCalTestBeam.HGCalTBCheckGunPosition_cfi') + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(10) +) + +if 'MessageLogger' in process.__dict__: + process.MessageLogger.HGCalGeom=dict() + process.MessageLogger.HGCSim=dict() + process.MessageLogger.HcalSim=dict() + process.MessageLogger.HcalTB06BeamSD=dict() +# process.MessageLogger.SimG4CoreGeometry=dict() + +# Input source +process.source = cms.Source("EmptySource") + +process.options = cms.untracked.PSet( +) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + annotation = cms.untracked.string('SingleMuonE200_cfi nevts:10'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') +) + +# Output definition + +process.FEVTDEBUGoutput = cms.OutputModule("PoolOutputModule", + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('generation_step') + ), + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('GEN-SIM'), + filterName = cms.untracked.string('') + ), + fileName = cms.untracked.string('file:TBGenSim181Oct1DD4Hep.root'), + outputCommands = process.FEVTDEBUGEventContent.outputCommands, + splitLevel = cms.untracked.int32(0) +) + +# Additional output definition +process.TFileService = cms.Service("TFileService", + fileName = cms.string('TBGenSimDD4Hep.root') + ) + +# Other statements +process.genstepfilter.triggerConditions=cms.vstring("generation_step") +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc', '') + +process.generator = cms.EDProducer("FlatRandomEThetaGunProducer", + AddAntiParticle = cms.bool(False), + PGunParameters = cms.PSet( + MinE = cms.double(99.99), + MaxE = cms.double(100.01), + MinTheta = cms.double(0.0), + MaxTheta = cms.double(0.0), + MinPhi = cms.double(-3.14159265359), + MaxPhi = cms.double(3.14159265359), + PartID = cms.vint32(11) + ), + Verbosity = cms.untracked.int32(0), + firstRun = cms.untracked.uint32(1), + psethack = cms.string('single muon E 100') +) +process.VtxSmeared.MinZ = -800.0 +process.VtxSmeared.MaxZ = -800.0 +process.VtxSmeared.MinX = -7.5 +process.VtxSmeared.MaxX = 7.5 +process.VtxSmeared.MinY = -7.5 +process.VtxSmeared.MaxY = 7.5 +process.g4SimHits.HGCSD.RejectMouseBite = True +process.g4SimHits.HGCSD.RotatedWafer = True +process.g4SimHits.OnlySDs = ['AHcalSensitiveDetector', + 'HGCSensitiveDetector', + 'HGCalTB1601SensitiveDetector', + 'HcalTB06BeamDetector'] +process.DDDetectorESProducer.confGeomXMLFiles = cms.FileInPath("SimG4CMS/HGCalTestBeam/data/dd4hep/HGCalTB181Oct1.xml") + +process.g4SimHits.Watchers = cms.VPSet(cms.PSet( + HGCPassive = cms.PSet( + LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), + MotherName = cms.string('OCMS'), + IfDD4Hep = cms.bool(True), + ), + type = cms.string('HGCPassive'), + ) + ) +process.HGCalTBAnalyzer.doDigis = False +process.HGCalTBAnalyzer.doRecHits = False +process.HGCalTBAnalyzer.useFH = True +process.HGCalTBAnalyzer.useBH = True +process.HGCalTBAnalyzer.useBeam = True +process.HGCalTBAnalyzer.zFrontEE = 1110.0 +process.HGCalTBAnalyzer.zFrontFH = 1176.5 +process.HGCalTBAnalyzer.zFrontFH = 1307.5 +process.HGCalTBAnalyzer.maxDepth = 39 +process.HGCalTBAnalyzer.deltaZ = 26.2 +process.HGCalTBAnalyzer.zFirst = 22.8 +process.HGCalTBAnalyzer.doPassive = True +process.HGCalTBAnalyzer.doPassiveEE = True +process.HGCalTBAnalyzer.doPassiveHE = True +process.HGCalTBAnalyzer.doPassiveBH = True + +# Path and EndPath definitions +process.generation_step = cms.Path(process.pgen) +process.gunfilter_step = cms.Path(process.HGCalTBCheckGunPostion) +process.simulation_step = cms.Path(process.psim) +process.genfiltersummary_step = cms.EndPath(process.genFilterSummary) +process.analysis_step = cms.Path(process.HGCalTBAnalyzer) +process.endjob_step = cms.EndPath(process.endOfProcess) +process.FEVTDEBUGoutput_step = cms.EndPath(process.FEVTDEBUGoutput) + +# Schedule definition +process.schedule = cms.Schedule(process.generation_step, + process.genfiltersummary_step, + process.simulation_step, + process.gunfilter_step, + process.analysis_step, + process.endjob_step, + process.FEVTDEBUGoutput_step + ) +# filter all path with the production filter sequence +for path in process.paths: + getattr(process,path)._seq = process.generator * getattr(process,path)._seq + + diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1PC1mm_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1PC1mm_cfg.py index 010dee6e59dd6..f7a646183257c 100644 --- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1PC1mm_cfg.py +++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1PC1mm_cfg.py @@ -100,12 +100,13 @@ 'HGCalTB1601SensitiveDetector', 'HcalTB06BeamDetector'] process.g4SimHits.Watchers = cms.VPSet(cms.PSet( - HGCPassive = cms.PSet( - LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), - MotherName = cms.string('OCMS'), - ), - type = cms.string('HGCPassive'), - ) + HGCPassive = cms.PSet( + LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), + MotherName = cms.string('OCMS'), + IfDD4Hep = cms.bool(False), + ), + type = cms.string('HGCPassive'), +) ) process.HGCalTBAnalyzer.doDigis = False process.HGCalTBAnalyzer.doRecHits = False diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1_cfg.py index c732aa5c82699..dedf1c3e905b5 100644 --- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1_cfg.py +++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1_cfg.py @@ -100,9 +100,10 @@ 'HcalTB06BeamDetector'] process.g4SimHits.Watchers = cms.VPSet(cms.PSet( HGCPassive = cms.PSet( - LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), - MotherName = cms.string('OCMS'), - ), + LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), + MotherName = cms.string('OCMS'), + IfDD4Hep = cms.bool(False), + ), type = cms.string('HGCPassive'), ) ) diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1el100_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1el100_cfg.py index 936802a0d6d79..2ff18aae945a8 100644 --- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1el100_cfg.py +++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1el100_cfg.py @@ -102,9 +102,10 @@ 'HcalTB06BeamDetector'] process.g4SimHits.Watchers = cms.VPSet(cms.PSet( HGCPassive = cms.PSet( - LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), - MotherName = cms.string('OCMS'), - ), + LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), + MotherName = cms.string('OCMS'), + IfDD4Hep = cms.bool(False), + ), type = cms.string('HGCPassive'), ) ) diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct2_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct2_cfg.py index 4aec57c9ae2dd..78e5591094328 100644 --- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct2_cfg.py +++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct2_cfg.py @@ -100,9 +100,10 @@ 'HcalTB06BeamDetector'] process.g4SimHits.Watchers = cms.VPSet(cms.PSet( HGCPassive = cms.PSet( - LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), - MotherName = cms.string('OCMS'), - ), + LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), + MotherName = cms.string('OCMS'), + IfDD4Hep = cms.bool(False), + ), type = cms.string('HGCPassive'), ) ) diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct3_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct3_cfg.py index 380326c051e77..adfa709001079 100644 --- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct3_cfg.py +++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct3_cfg.py @@ -100,9 +100,10 @@ 'HcalTB06BeamDetector'] process.g4SimHits.Watchers = cms.VPSet(cms.PSet( HGCPassive = cms.PSet( - LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), - MotherName = cms.string('OCMS'), - ), + LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), + MotherName = cms.string('OCMS'), + IfDD4Hep = cms.bool(False), + ), type = cms.string('HGCPassive'), ) ) diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct4_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct4_cfg.py index 50fce5576d0a9..26a3a41c82086 100644 --- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct4_cfg.py +++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct4_cfg.py @@ -100,9 +100,10 @@ 'HcalTB06BeamDetector'] process.g4SimHits.Watchers = cms.VPSet(cms.PSet( HGCPassive = cms.PSet( - LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), - MotherName = cms.string('OCMS'), - ), + LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), + MotherName = cms.string('OCMS'), + IfDD4Hep = cms.bool(False), + ), type = cms.string('HGCPassive'), ) ) diff --git a/SimG4CMS/HcalTestBeam/BuildFile.xml b/SimG4CMS/HcalTestBeam/BuildFile.xml index 2ab4eeeb62169..d1629d382a63e 100644 --- a/SimG4CMS/HcalTestBeam/BuildFile.xml +++ b/SimG4CMS/HcalTestBeam/BuildFile.xml @@ -1,10 +1,8 @@ - - diff --git a/SimG4CMS/HcalTestBeam/plugins/BuildFile.xml b/SimG4CMS/HcalTestBeam/plugins/BuildFile.xml index f7945b9cafa03..90b56df11fe71 100644 --- a/SimG4CMS/HcalTestBeam/plugins/BuildFile.xml +++ b/SimG4CMS/HcalTestBeam/plugins/BuildFile.xml @@ -1,6 +1,5 @@ - @@ -9,7 +8,6 @@ - diff --git a/SimG4CMS/HcalTestBeam/plugins/HcalTB02Analysis.cc b/SimG4CMS/HcalTestBeam/plugins/HcalTB02Analysis.cc index f94261404a9e2..14b0af992b18e 100644 --- a/SimG4CMS/HcalTestBeam/plugins/HcalTB02Analysis.cc +++ b/SimG4CMS/HcalTestBeam/plugins/HcalTB02Analysis.cc @@ -47,10 +47,10 @@ #include "G4ThreeVector.hh" #include "G4VProcess.hh" -#include "CLHEP/Random/RandGaussQ.h" -#include "CLHEP/Units/GlobalSystemOfUnits.h" -#include "CLHEP/Units/GlobalPhysicalConstants.h" -#include "Randomize.hh" +#include +#include +#include +#include //#define EDM_ML_DEBUG @@ -385,13 +385,13 @@ void HcalTB02Analysis::update(const EndOfEvent* evt) { int iEvt = (*evt)()->GetEventID(); if (iEvt < 10) - std::cout << " Event " << iEvt << std::endl; + edm::LogVerbatim("HcalTBSim") << " Event " << iEvt; else if ((iEvt < 100) && (iEvt % 10 == 0)) - std::cout << " Event " << iEvt << std::endl; + edm::LogVerbatim("HcalTBSim") << " Event " << iEvt; else if ((iEvt < 1000) && (iEvt % 100 == 0)) - std::cout << " Event " << iEvt << std::endl; + edm::LogVerbatim("HcalTBSim") << " Event " << iEvt; else if ((iEvt < 10000) && (iEvt % 1000 == 0)) - std::cout << " Event " << iEvt << std::endl; + edm::LogVerbatim("HcalTBSim") << " Event " << iEvt; } void HcalTB02Analysis::fillEvent(HcalTB02HistoClass& product) { diff --git a/SimG4CMS/HcalTestBeam/plugins/HcalTB04Analysis.cc b/SimG4CMS/HcalTestBeam/plugins/HcalTB04Analysis.cc index aed8798442175..fc11fb5b06916 100644 --- a/SimG4CMS/HcalTestBeam/plugins/HcalTB04Analysis.cc +++ b/SimG4CMS/HcalTestBeam/plugins/HcalTB04Analysis.cc @@ -56,10 +56,12 @@ #include "G4ThreeVector.hh" #include "G4VProcess.hh" #include "G4HCofThisEvent.hh" -#include "CLHEP/Random/RandGaussQ.h" -#include "CLHEP/Units/GlobalSystemOfUnits.h" -#include "CLHEP/Units/GlobalPhysicalConstants.h" -#include "Randomize.hh" + +#include +#include +#include +#include + #include //#define EDM_ML_DEBUG diff --git a/SimG4CMS/HcalTestBeam/plugins/HcalTB06Analysis.cc b/SimG4CMS/HcalTestBeam/plugins/HcalTB06Analysis.cc index 5690a501ecbf5..f6ce39dcf7eed 100644 --- a/SimG4CMS/HcalTestBeam/plugins/HcalTB06Analysis.cc +++ b/SimG4CMS/HcalTestBeam/plugins/HcalTB06Analysis.cc @@ -31,6 +31,7 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/Run.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "CommonTools/UtilAlgos/interface/TFileService.h" @@ -38,17 +39,15 @@ #include "SimDataFormats/HcalTestBeam/interface/HcalTestBeamNumbering.h" #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" -#include "CLHEP/Units/GlobalSystemOfUnits.h" -#include "CLHEP/Units/GlobalPhysicalConstants.h" -#include "globals.hh" #include "Randomize.hh" +#include "globals.hh" + +#include +#include // system include files -#include -#include -#include -#include #include +#include //#define EDM_ML_DEBUG @@ -182,9 +181,9 @@ void HcalTB06Analysis::analyze(const edm::Event& evt, const edm::EventSetup&) { for (unsigned int i = 0; i < ne; ++i) { EBDetId ecalid((*EcalHits)[i].id()); #ifdef EDM_ML_DEBUG - std::cout << "EB " << i << " " << ecalid.ieta() << ":" << m_idxetaEcal << " " << ecalid.iphi() << ":" - << m_idxphiEcal << " " << (*EcalHits)[i].time() << ":" << m_timeLimit << " " - << (*EcalHits)[i].energy() << std::endl; + edm::LogVerbatim("HcalTBSim") << "EB " << i << " " << ecalid.ieta() << ":" << m_idxetaEcal << " " + << ecalid.iphi() << ":" << m_idxphiEcal << " " << (*EcalHits)[i].time() << ":" + << m_timeLimit << " " << (*EcalHits)[i].energy(); #endif // 7x7 crystal selection if (std::abs(m_idxetaEcal - ecalid.ieta()) <= 3 && std::abs(m_idxphiEcal - ecalid.iphi()) <= 3 && @@ -202,9 +201,9 @@ void HcalTB06Analysis::analyze(const edm::Event& evt, const edm::EventSetup&) { for (unsigned int i = 0; i < nh; ++i) { HcalDetId hcalid((*HcalHits)[i].id()); #ifdef EDM_ML_DEBUG - std::cout << "HC " << i << " " << hcalid.subdet() << " " << hcalid.ieta() << ":" << m_idxetaHcal << " " - << hcalid.iphi() << ":" << m_idxphiHcal << " " << (*HcalHits)[i].time() << ":" << m_timeLimit << " " - << (*HcalHits)[i].energy() << std::endl; + edm::LogVerbatim("HcalTBSim") << "HC " << i << " " << hcalid.subdet() << " " << hcalid.ieta() << ":" + << m_idxetaHcal << " " << hcalid.iphi() << ":" << m_idxphiHcal << " " + << (*HcalHits)[i].time() << ":" << m_timeLimit << " " << (*HcalHits)[i].energy(); #endif // 3x3 towers selection if (std::abs(m_idxetaHcal - hcalid.ieta()) <= 1 && std::abs(m_idxphiHcal - hcalid.iphi()) <= 1 && diff --git a/SimG4CMS/Muon/BuildFile.xml b/SimG4CMS/Muon/BuildFile.xml index e1a7c1c695064..8244c9f2db440 100644 --- a/SimG4CMS/Muon/BuildFile.xml +++ b/SimG4CMS/Muon/BuildFile.xml @@ -1,6 +1,5 @@ - diff --git a/SimG4CMS/Muon/plugins/BuildFile.xml b/SimG4CMS/Muon/plugins/BuildFile.xml index 6165a2981f7ab..bd52343f03e4c 100644 --- a/SimG4CMS/Muon/plugins/BuildFile.xml +++ b/SimG4CMS/Muon/plugins/BuildFile.xml @@ -1,8 +1,7 @@ - - + diff --git a/SimG4CMS/PPS/plugins/module.cc b/SimG4CMS/PPS/plugins/module.cc deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/SimG4CMS/ShowerLibraryProducer/interface/CastorShowerLibraryMaker.h b/SimG4CMS/ShowerLibraryProducer/interface/CastorShowerLibraryMaker.h deleted file mode 100644 index 39b064d4b9058..0000000000000 --- a/SimG4CMS/ShowerLibraryProducer/interface/CastorShowerLibraryMaker.h +++ /dev/null @@ -1,181 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// File: CastorShowerLibraryMaker.h -// Date: 02/2009 -// Author: Wagner Carvalho (adapted from Panos Katsas code) -// Description: simulation analysis steering code -// -/////////////////////////////////////////////////////////////////////////////// -#undef debug -#ifndef CastorShowerLibraryMaker_h -#define CastorShowerLibraryMaker_h - -#include "SimG4Core/Notification/interface/BeginOfJob.h" -#include "SimG4Core/Notification/interface/BeginOfRun.h" -#include "SimG4Core/Notification/interface/EndOfRun.h" -#include "SimG4Core/Notification/interface/BeginOfEvent.h" -#include "SimG4Core/Notification/interface/EndOfEvent.h" - -#include "SimG4CMS/Calo/interface/CaloG4HitCollection.h" - -#include "G4RunManager.hh" -#include "G4SDManager.hh" -#include "G4Step.hh" -#include "G4Track.hh" -#include "G4Event.hh" -#include "G4PrimaryVertex.hh" -#include "G4VProcess.hh" -#include "G4HCofThisEvent.hh" -#include "G4UserEventAction.hh" -#include "CLHEP/Units/SystemOfUnits.h" -#include "CLHEP/Units/PhysicalConstants.h" - -#include "SimG4Core/Notification/interface/Observer.h" -#include "SimG4Core/Watcher/interface/SimWatcher.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "CommonTools/UtilAlgos/interface/TFileService.h" - -// Classes for shower library Root file -#include "SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h" -#include "SimDataFormats/CaloHit/interface/CastorShowerEvent.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "TROOT.h" -#include "TFile.h" -#include "TH1.h" -#include "TH2.h" -#include "TProfile.h" -#include "TNtuple.h" -#include "TRandom.h" -#include "TLorentzVector.h" -#include "TUnixSystem.h" -#include "TSystem.h" -#include "TMath.h" -#include "TF1.h" - -class G4Step; -class BeginOfJob; -class BeginOfRun; -class EndOfRun; -class BeginOfEvent; -class EndOfEvent; - -/* -typedef std::vector > phi_t; //holds N phi bin collection (with M events each) -typedef std::vector eta_t; //holds N eta bin collection -typedef std::vector energy_t; //holds N energy bin -*/ -typedef std::vector > > > SLBin3D; // bin in energy, eta and phi - -class CastorShowerLibraryMaker : public SimWatcher, - public Observer, - public Observer, - public Observer, - public Observer, - public Observer, - public Observer { -public: - CastorShowerLibraryMaker(const edm::ParameterSet& p); - ~CastorShowerLibraryMaker() override; - -private: - typedef int ebin; - typedef int etabin; - typedef int phibin; - // private structures - struct ShowerLib { - CastorShowerLibraryInfo SLInfo; // the info - SLBin3D SLCollection; // the showers - std::vector SLEnergyBins; - std::vector SLEtaBins; - std::vector SLPhiBins; - unsigned int nEvtPerBinE; - unsigned int nEvtPerBinEta; - unsigned int nEvtPerBinPhi; - std::vector nEvtInBinE; - std::vector > nEvtInBinEta; - std::vector > > nEvtInBinPhi; - }; - - // observer classes - void update(const BeginOfJob* run) override; - void update(const BeginOfRun* run) override; - void update(const EndOfRun* run) override; - void update(const BeginOfEvent* evt) override; - void update(const EndOfEvent* evt) override; - void update(const G4Step* step) override; - -private: - void Finish(); - - // Job general parameters - int verbosity; - std::string eventNtFileName; - - unsigned int NPGParticle; // number of particles requested to Particle Gun - std::vector PGParticleIDs; //p. gun particle IDs - bool DoHadSL; // true if hadronic SL should be produced - bool DoEmSL; // true if electromag. SL should be produced - bool InsideCastor; // true if particle step inside CASTOR - bool DeActivatePhysicsProcess; //cfg parameter: True if phys. proc. should be off from IP to Castor - std::vector thePrims; // list of primaries for this event - - // Pointers for user defined class objects to be stored to Root file - CastorShowerLibraryInfo* emInfo; - CastorShowerLibraryInfo* hadInfo; - CastorShowerEvent* emShower; - CastorShowerEvent* hadShower; - ShowerLib emSLHolder; - ShowerLib hadSLHolder; - ShowerLib* SLShowerptr; // pointer to the current shower collection (above) - std::map > MapOfSecondaries; // map to hold all secondaries ID keyed by - // the PDG code of the primary - - std::map PrimaryMomentum; - std::map PrimaryPosition; - double MaxEta; // limits the eta region, the lower limit is given by the SL bins - double MaxPhi; // limits the phi region, the lower limit is given by the SL bins - // private methods - int FindEnergyBin(double e); - int FindEtaBin(double eta); - int FindPhiBin(double phi); - bool SLacceptEvent(int, int, int); - bool IsSLReady(); - void GetKinematics(G4PrimaryParticle*, double& px, double& py, double& pz, double& pInit, double& eta, double& phi); - void GetKinematics(int, double& px, double& py, double& pz, double& pInit, double& eta, double& phi); - - std::vector GetPrimary(const G4Event*); - bool FillShowerEvent(CaloG4HitCollection*, CastorShowerEvent*, int); - void InitSLHolder(ShowerLib&); - - void printSLstatus(int, int, int); - int& SLnEvtInBinE(int ebin); - int& SLnEvtInBinEta(int ebin, int etabin); - int& SLnEvtInBinPhi(int ebin, int etabin, int phibin); - bool SLisEBinFilled(int ebin); - bool SLisEtaBinFilled(int ebin, int etabin); - bool SLisPhiBinFilled(int ebin, int etabin, int phibin); - void KillSecondaries(const G4Step* step); - void GetMissingEnergy(CaloG4HitCollection*, double&, double&); - - // Root pointers - TFile* theFile; - TTree* theTree; - - int eventIndex; - int stepIndex; // ignore, please -}; - -#endif // CastorShowerLibraryMaker_h diff --git a/SimG4CMS/ShowerLibraryProducer/interface/HcalForwardAnalysis.h b/SimG4CMS/ShowerLibraryProducer/interface/HcalForwardAnalysis.h deleted file mode 100644 index 5923dddb7cf94..0000000000000 --- a/SimG4CMS/ShowerLibraryProducer/interface/HcalForwardAnalysis.h +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef ShowerLibraryProducer_HcalForwardAnalysis_h -#define ShowerLibraryProducer_HcalForwardAnalysis_h - -#include -#include -#include -#include - -// user include files -#include "SimG4Core/Watcher/interface/SimProducer.h" -#include "SimG4Core/Notification/interface/Observer.h" - -#include "SimG4CMS/ShowerLibraryProducer/interface/FiberG4Hit.h" -#include "SimG4CMS/ShowerLibraryProducer/interface/HFShowerG4Hit.h" - -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "CommonTools/UtilAlgos/interface/TFileService.h" - -#include "G4Step.hh" -#include "G4Track.hh" -#include "G4ThreeVector.hh" - -#include "TFile.h" -#include "TTree.h" - -#include -#include - -class BeginOfRun; -class BeginOfEvent; -class EndOfEvent; - -class HcalForwardAnalysis : public SimProducer, - public Observer, - public Observer, - public Observer, - public Observer { -public: - struct Photon { - Photon(int id, float X, float Y, float Z, float T, float Lambda) - : fiberId(id), x(X), y(Y), z(Z), t(T), lambda(Lambda) {} - int fiberId; - float x; - float y; - float z; - float t; - float lambda; - }; - - HcalForwardAnalysis(const edm::ParameterSet& p); - HcalForwardAnalysis(const HcalForwardAnalysis&) = delete; // stop default - const HcalForwardAnalysis& operator=(const HcalForwardAnalysis&) = delete; - ~HcalForwardAnalysis() override; - - void produce(edm::Event&, const edm::EventSetup&) override; - -private: - void init(); - - // observer methods - void update(const BeginOfRun* run) override; - void update(const BeginOfEvent* evt) override; - void update(const G4Step* step) override; - void update(const EndOfEvent* evt) override; - // void write(const EndOfRun * run); - - //User methods - void setPhotons(const EndOfEvent* evt); - //void fillEvent(PHcalForwardLibInfo&); - void fillEvent(); - void parseDetId(int id, int& tower, int& cell, int& fiber); - void clear(); - - edm::Service theFile; - TTree* theTree; - int theEventCounter; - int count; - int evNum; - float x[10000], y[10000], z[10000], t[10000], lambda[10000]; - float primX, primY, primZ, primT; - float primMomX, primMomY, primMomZ; - int nphot; - int fiberId[10000]; - std::vector thePhotons; - std::vector theNames; - bool fillt; -}; -#endif diff --git a/SimG4CMS/ShowerLibraryProducer/plugins/BuildFile.xml b/SimG4CMS/ShowerLibraryProducer/plugins/BuildFile.xml index 1f5e84556a2d3..b54e90835c576 100644 --- a/SimG4CMS/ShowerLibraryProducer/plugins/BuildFile.xml +++ b/SimG4CMS/ShowerLibraryProducer/plugins/BuildFile.xml @@ -1,8 +1,6 @@ - - @@ -10,4 +8,4 @@ - + diff --git a/SimG4CMS/ShowerLibraryProducer/src/CastorShowerLibraryMaker.cc b/SimG4CMS/ShowerLibraryProducer/plugins/CastorShowerLibraryMaker.cc similarity index 80% rename from SimG4CMS/ShowerLibraryProducer/src/CastorShowerLibraryMaker.cc rename to SimG4CMS/ShowerLibraryProducer/plugins/CastorShowerLibraryMaker.cc index 3c5229d594ab6..488dd9acc2d07 100644 --- a/SimG4CMS/ShowerLibraryProducer/src/CastorShowerLibraryMaker.cc +++ b/SimG4CMS/ShowerLibraryProducer/plugins/CastorShowerLibraryMaker.cc @@ -12,28 +12,174 @@ // Adapted by W. Carvalho , 02/2009 // ////////////////////////////////////////////////////////////// + +#include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "DataFormats/Math/interface/Point3D.h" + #include "FWCore/Utilities/interface/EDMException.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +// Classes for shower library Root file +#include "SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h" +#include "SimDataFormats/CaloHit/interface/CastorShowerEvent.h" + #include "SimG4Core/Notification/interface/SimG4Exception.h" +#include "SimG4Core/Notification/interface/BeginOfJob.h" +#include "SimG4Core/Notification/interface/BeginOfRun.h" +#include "SimG4Core/Notification/interface/EndOfRun.h" +#include "SimG4Core/Notification/interface/BeginOfEvent.h" +#include "SimG4Core/Notification/interface/EndOfEvent.h" +#include "SimG4Core/Notification/interface/Observer.h" +#include "SimG4Core/Watcher/interface/SimWatcher.h" + #include "SimG4CMS/Calo/interface/CaloG4Hit.h" #include "SimG4CMS/Calo/interface/CaloG4HitCollection.h" -#include "DataFormats/Math/interface/Point3D.h" -#include "SimG4CMS/ShowerLibraryProducer/interface/CastorShowerLibraryMaker.h" #include "SimG4CMS/Forward/interface/CastorNumberingScheme.h" -#include "SimDataFormats/CaloHit/interface/CastorShowerEvent.h" +#include "G4RunManager.hh" +#include "G4SDManager.hh" +#include "G4Step.hh" +#include "G4Track.hh" +#include "G4Event.hh" +#include "G4PrimaryVertex.hh" +#include "G4VProcess.hh" +#include "G4HCofThisEvent.hh" +#include "G4UserEventAction.hh" -#include "CLHEP/Units/GlobalSystemOfUnits.h" -#include "CLHEP/Units/GlobalPhysicalConstants.h" +#include +#include +#include +#include +#include +#include "TROOT.h" #include "TFile.h" +#include "TH1.h" +#include "TH2.h" +#include "TProfile.h" +#include "TNtuple.h" +#include "TRandom.h" +#include "TLorentzVector.h" +#include "TUnixSystem.h" +#include "TSystem.h" +#include "TMath.h" +#include "TF1.h" + +#include #include +#include +#include #include +#include +#include #include -#include -#include +#include +#include + +typedef std::vector > > > SLBin3D; // bin in energy, eta and phi + +class CastorShowerLibraryMaker : public SimWatcher, + public Observer, + public Observer, + public Observer, + public Observer, + public Observer, + public Observer { +public: + CastorShowerLibraryMaker(const edm::ParameterSet& p); + ~CastorShowerLibraryMaker() override; + +private: + typedef int ebin; + typedef int etabin; + typedef int phibin; + // private structures + struct ShowerLib { + CastorShowerLibraryInfo SLInfo; // the info + SLBin3D SLCollection; // the showers + std::vector SLEnergyBins; + std::vector SLEtaBins; + std::vector SLPhiBins; + unsigned int nEvtPerBinE; + unsigned int nEvtPerBinEta; + unsigned int nEvtPerBinPhi; + std::vector nEvtInBinE; + std::vector > nEvtInBinEta; + std::vector > > nEvtInBinPhi; + }; + + // observer classes + void update(const BeginOfJob* run) override; + void update(const BeginOfRun* run) override; + void update(const EndOfRun* run) override; + void update(const BeginOfEvent* evt) override; + void update(const EndOfEvent* evt) override; + void update(const G4Step* step) override; + +private: + void Finish(); + + // Job general parameters + int verbosity; + std::string eventNtFileName; + + unsigned int NPGParticle; // number of particles requested to Particle Gun + std::vector PGParticleIDs; //p. gun particle IDs + bool DoHadSL; // true if hadronic SL should be produced + bool DoEmSL; // true if electromag. SL should be produced + bool InsideCastor; // true if particle step inside CASTOR + bool DeActivatePhysicsProcess; //cfg parameter: True if phys. proc. should be off from IP to Castor + std::vector thePrims; // list of primaries for this event + + // Pointers for user defined class objects to be stored to Root file + CastorShowerLibraryInfo* emInfo; + CastorShowerLibraryInfo* hadInfo; + CastorShowerEvent* emShower; + CastorShowerEvent* hadShower; + ShowerLib emSLHolder; + ShowerLib hadSLHolder; + ShowerLib* SLShowerptr; // pointer to the current shower collection (above) + std::map > MapOfSecondaries; // map to hold all secondaries ID keyed by + // the PDG code of the primary + + std::map PrimaryMomentum; + std::map PrimaryPosition; + double MaxEta; // limits the eta region, the lower limit is given by the SL bins + double MaxPhi; // limits the phi region, the lower limit is given by the SL bins + // private methods + int FindEnergyBin(double e); + int FindEtaBin(double eta); + int FindPhiBin(double phi); + bool SLacceptEvent(int, int, int); + bool IsSLReady(); + void GetKinematics(G4PrimaryParticle*, double& px, double& py, double& pz, double& pInit, double& eta, double& phi); + void GetKinematics(int, double& px, double& py, double& pz, double& pInit, double& eta, double& phi); + + std::vector GetPrimary(const G4Event*); + bool FillShowerEvent(CaloG4HitCollection*, CastorShowerEvent*, int); + void InitSLHolder(ShowerLib&); + + void printSLstatus(int, int, int); + int& SLnEvtInBinE(int ebin); + int& SLnEvtInBinEta(int ebin, int etabin); + int& SLnEvtInBinPhi(int ebin, int etabin, int phibin); + bool SLisEBinFilled(int ebin); + bool SLisEtaBinFilled(int ebin, int etabin); + bool SLisPhiBinFilled(int ebin, int etabin, int phibin); + void KillSecondaries(const G4Step* step); + void GetMissingEnergy(CaloG4HitCollection*, double&, double&); + + // Root pointers + TFile* theFile; + TTree* theTree; + + int eventIndex; + int stepIndex; // ignore, please +}; CastorShowerLibraryMaker::CastorShowerLibraryMaker(const edm::ParameterSet& p) : NPGParticle(0), @@ -210,10 +356,10 @@ void CastorShowerLibraryMaker::update(const BeginOfRun* run) { // If no data are written, because e.g. the branch is disabled, // the number of bytes returned is 0. // if(flag==-1) { - // edm::LogInfo("CastorAnalyzer") << " WARNING: Error writing to Branch \"CastorShowerLibInfo\" \n" ; + // edm::LogVerbatim("CastorAnalyzer") << " WARNING: Error writing to Branch \"CastorShowerLibInfo\" \n" ; // } else // if(flag==0) { - // edm::LogInfo("CastorAnalyzer") << " WARNING: No data written to Branch \"CastorShowerLibInfo\" \n" ; + // edm::LogVerbatim("CastorAnalyzer") << " WARNING: No data written to Branch \"CastorShowerLibInfo\" \n" ; // } // Initialize "accounting" variables @@ -287,7 +433,7 @@ void CastorShowerLibraryMaker::update(const BeginOfEvent* evt) { } */ if (!accept) - edm::LogInfo("CastorShowerLibraryMaker") + edm::LogVerbatim("CastorShowerLibraryMaker") << "Event not accepted for ebin=" << ebin << ",etabin=" << etabin << ",phibin=" << phibin << std::endl; } else { accept = true; @@ -401,7 +547,7 @@ void CastorShowerLibraryMaker::update(const G4Step* aStep) { */ /* if(aStep->IsFirstStepInVolume()) { - edm::LogInfo("CastorShowerLibraryMaker") << "CastorShowerLibraryMaker::update(const G4Step * aStep):" + edm::LogVerbatim("CastorShowerLibraryMaker") << "CastorShowerLibraryMaker::update(const G4Step * aStep):" << "\n IsFirstStepInVolume , " << "time = " << aStep->GetTrack()->GetGlobalTime() ; } @@ -428,7 +574,7 @@ void CastorShowerLibraryMaker::update(const EndOfEvent* evt) { std::cout << "CastorShowerLibraryMaker: End of Event: " << eventIndex << std::endl; // Get the pointer to the primary particle if (thePrims.empty()) { - edm::LogInfo("CastorShowerLibraryMaker") << "No valid primary particle found. Skipping event" << std::endl; + edm::LogVerbatim("CastorShowerLibraryMaker") << "No valid primary particle found. Skipping event" << std::endl; return; } // access to the G4 hit collections @@ -436,10 +582,10 @@ void CastorShowerLibraryMaker::update(const EndOfEvent* evt) { int CAFIid = G4SDManager::GetSDMpointer()->GetCollectionID("CastorFI"); CaloG4HitCollection* theCAFI = (CaloG4HitCollection*)allHC->GetHC(CAFIid); if (verbosity) - edm::LogInfo("CastorShowerLibraryMaker") << " update(*evt) --> accessed all HC "; - edm::LogInfo("CastorShowerLibraryMaker") << "Found " << theCAFI->entries() << " hits in G4HitCollection"; + edm::LogVerbatim("CastorShowerLibraryMaker") << " update(*evt) --> accessed all HC "; + edm::LogVerbatim("CastorShowerLibraryMaker") << "Found " << theCAFI->entries() << " hits in G4HitCollection"; if (theCAFI->entries() == 0) { - edm::LogInfo("CastorShowerLibraryMaker") << "\n Empty G4HitCollection"; + edm::LogVerbatim("CastorShowerLibraryMaker") << "\n Empty G4HitCollection"; return; } @@ -449,7 +595,7 @@ void CastorShowerLibraryMaker::update(const EndOfEvent* evt) { for (unsigned int i = 0; i < thePrims.size(); i++) { G4PrimaryParticle* thePrim = thePrims.at(i); if (!thePrim) { - edm::LogInfo("CastorShowerLibraryMaker") << "nullptr Pointer to the primary" << std::endl; + edm::LogVerbatim("CastorShowerLibraryMaker") << "nullptr Pointer to the primary" << std::endl; continue; } // Check primary particle type @@ -464,7 +610,7 @@ void CastorShowerLibraryMaker::update(const EndOfEvent* evt) { SLShowerptr = &hadSLHolder; SLType = "Hadronic"; } - edm::LogInfo("CastorShowerLibraryMaker") << "\n Primary (thePrim) trackID is " << thePrim->GetTrackID() << "\n"; + edm::LogVerbatim("CastorShowerLibraryMaker") << "\n Primary (thePrim) trackID is " << thePrim->GetTrackID() << "\n"; // Obtain primary particle's initial momentum (pInit) double px = 0., py = 0., pz = 0., pInit = 0., eta = 0., phi = 0.; @@ -472,7 +618,7 @@ void CastorShowerLibraryMaker::update(const EndOfEvent* evt) { // Check if current event falls into any bin // first: energy if (pInit == 0) { - edm::LogInfo("CastorShowerLibraryMaker") << "Primary did not hit CASTOR" << std::endl; + edm::LogVerbatim("CastorShowerLibraryMaker") << "Primary did not hit CASTOR" << std::endl; continue; } int ebin = FindEnergyBin(pInit); @@ -481,7 +627,7 @@ void CastorShowerLibraryMaker::update(const EndOfEvent* evt) { std::cout << SLType << std::endl; printSLstatus(ebin, etabin, phibin); if (!SLacceptEvent(ebin, etabin, phibin)) { - edm::LogInfo("CastorShowerLibraryMaker") + edm::LogVerbatim("CastorShowerLibraryMaker") << "Event not accepted for ebin=" << ebin << ",etabin=" << etabin << ",phibin=" << phibin << "(" << pInit << "," << eta << "," << phi << ")" << std::endl; continue; @@ -490,7 +636,7 @@ void CastorShowerLibraryMaker::update(const EndOfEvent* evt) { // event passed. Fill the vector accordingly // // Look for the Hit Collection - edm::LogInfo("CastorShowerLibraryMaker") + edm::LogVerbatim("CastorShowerLibraryMaker") << "\n CastorShowerLibraryMaker::update(EndOfEvent * evt) - event #" << (*evt)()->GetEventID(); /* @@ -507,7 +653,7 @@ void CastorShowerLibraryMaker::update(const EndOfEvent* evt) { if (FillShowerEvent(theCAFI, shower, particleType)) { // Primary particle information /* - edm::LogInfo("CastorShowerLibraryMaker") << "New SL event: Primary = " << particleType + edm::LogVerbatim("CastorShowerLibraryMaker") << "New SL event: Primary = " << particleType << "; Energy = " << pInit << "; Eta = " << eta << "; Phi = " << phi << "; Nhits = " << shower->getNhit() << std::endl; */ @@ -651,7 +797,7 @@ int CastorShowerLibraryMaker::FindEnergyBin(double energy) { // returns -1 if ouside valid range // if (!SLShowerptr) { - edm::LogInfo("CastorShowerLibraryMaker") << "\n\nFindEnergyBin can be called only after BeginOfEvent\n\n"; + edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nFindEnergyBin can be called only after BeginOfEvent\n\n"; throw SimG4Exception("\n\nnullptr Pointer to the shower library.\n\n"); } const std::vector& SLenergies = SLShowerptr->SLEnergyBins; @@ -675,7 +821,7 @@ int CastorShowerLibraryMaker::FindEtaBin(double eta) { // returns -1 if ouside valid range // if (!SLShowerptr) { - edm::LogInfo("CastorShowerLibraryMaker") << "\n\nFindEtaBin can be called only after BeginOfEvent\n\n"; + edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nFindEtaBin can be called only after BeginOfEvent\n\n"; throw SimG4Exception("\n\nnullptr Pointer to the shower library.\n\n"); } const std::vector& SLetas = SLShowerptr->SLEtaBins; @@ -699,7 +845,7 @@ int CastorShowerLibraryMaker::FindPhiBin(double phi) { // needs protection in case phi is outside range -pi,pi // if (!SLShowerptr) { - edm::LogInfo("CastorShowerLibraryMaker") << "\n\nFindPhiBin can be called only after BeginOfEvent\n\n"; + edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nFindPhiBin can be called only after BeginOfEvent\n\n"; throw SimG4Exception("\n\nnullptr Pointer to the shower library.\n\n"); } const std::vector& SLphis = SLShowerptr->SLPhiBins; @@ -718,7 +864,7 @@ int CastorShowerLibraryMaker::FindPhiBin(double phi) { bool CastorShowerLibraryMaker::IsSLReady() { // at this point, the pointer to the shower library should be nullptr if (SLShowerptr) { - edm::LogInfo("CastorShowerLibraryMaker") << "\n\nIsSLReady must be called when a new event starts.\n\n"; + edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nIsSLReady must be called when a new event starts.\n\n"; throw SimG4Exception("\n\nNOT nullptr Pointer to the shower library.\n\n"); } // it is enough to check if all the energy bin is filled @@ -786,16 +932,17 @@ std::vector CastorShowerLibraryMaker::GetPrimary(const G4Eve std::vector thePrims; G4PrimaryParticle* thePrim = nullptr; G4int nvertex = evt->GetNumberOfPrimaryVertex(); - edm::LogInfo("CastorShowerLibraryMaker") << "Event has " << nvertex << " vertex"; + edm::LogVerbatim("CastorShowerLibraryMaker") << "Event has " << nvertex << " vertex"; if (nvertex != 1) { - edm::LogInfo("CastorShowerLibraryMaker") << "CastorShowerLibraryMaker::GetPrimary ERROR: no vertex"; + edm::LogVerbatim("CastorShowerLibraryMaker") << "CastorShowerLibraryMaker::GetPrimary ERROR: no vertex"; return thePrims; } for (int i = 0; i < nvertex; i++) { G4PrimaryVertex* avertex = evt->GetPrimaryVertex(i); if (avertex == nullptr) { - edm::LogInfo("CastorShowerLibraryMaker") << "CastorShowerLibraryMaker::GetPrimary ERROR: pointer to vertex = 0"; + edm::LogVerbatim("CastorShowerLibraryMaker") + << "CastorShowerLibraryMaker::GetPrimary ERROR: pointer to vertex = 0"; continue; } unsigned int npart = avertex->GetNumberOfParticle(); @@ -818,7 +965,7 @@ std::vector CastorShowerLibraryMaker::GetPrimary(const G4Eve } void CastorShowerLibraryMaker::printSLstatus(int ebin, int etabin, int phibin) { if (!SLShowerptr) { - edm::LogInfo("CastorShowerLibraryInfo") << "nullptr shower pointer. Printing both"; + edm::LogVerbatim("CastorShowerLibraryInfo") << "nullptr shower pointer. Printing both"; std::cout << "Electromagnetic" << std::endl; SLShowerptr = &emSLHolder; this->printSLstatus(ebin, etabin, phibin); @@ -864,7 +1011,7 @@ void CastorShowerLibraryMaker::printSLstatus(int ebin, int etabin, int phibin) { } bool CastorShowerLibraryMaker::SLacceptEvent(int ebin, int etabin, int phibin) { if (SLShowerptr == nullptr) { - edm::LogInfo("CastorShowerLibraryMaker::SLacceptEvent:") << "Error. nullptr pointer to CastorShowerEvent"; + edm::LogVerbatim("CastorShowerLibraryMaker::SLacceptEvent:") << "Error. nullptr pointer to CastorShowerEvent"; return false; } if (ebin < 0 || ebin >= int(SLShowerptr->SLEnergyBins.size())) @@ -898,7 +1045,7 @@ bool CastorShowerLibraryMaker::FillShowerEvent(CaloG4HitCollection* theCAFI, Cas } */ if (!shower) { - edm::LogInfo("CastorShowerLibraryMaker") << "Error. nullptr pointer to CastorShowerEvent"; + edm::LogVerbatim("CastorShowerLibraryMaker") << "Error. nullptr pointer to CastorShowerEvent"; return false; } @@ -913,7 +1060,7 @@ bool CastorShowerLibraryMaker::FillShowerEvent(CaloG4HitCollection* theCAFI, Cas int hit_particleID = aHit->getTrackID(); if (MapOfSecondaries[ipart].find(hit_particleID) == MapOfSecondaries[ipart].end()) { if (verbosity) - edm::LogInfo("CastorShowerLibraryMaker") << "Skipping hit from trackID " << hit_particleID; + edm::LogVerbatim("CastorShowerLibraryMaker") << "Skipping hit from trackID " << hit_particleID; continue; } volumeID = aHit->getUnitID(); @@ -925,15 +1072,15 @@ bool CastorShowerLibraryMaker::FillShowerEvent(CaloG4HitCollection* theCAFI, Cas entry = aHit->getEntry(); position = aHit->getPosition(); if (verbosity) - edm::LogInfo("CastorShowerLibraryMaker") << "\n side , sector , module = " << zside << " , " << sector << " , " - << zmodule << "\n nphotons = " << hitEnergy; + edm::LogVerbatim("CastorShowerLibraryMaker") << "\n side , sector , module = " << zside << " , " << sector + << " , " << zmodule << "\n nphotons = " << hitEnergy; if (verbosity) - edm::LogInfo("CastorShowerLibraryMaker") + edm::LogVerbatim("CastorShowerLibraryMaker") << "\n packIndex = " << theCastorNumScheme->packIndex(zside, sector, zmodule); if (verbosity && time > 100.) { - edm::LogInfo("CastorShowerLibraryMaker") + edm::LogVerbatim("CastorShowerLibraryMaker") << "\n nentries = " << nentries << "\n time[" << ihit << "] = " << time << "\n trackID[" << ihit << "] = " << aHit->getTrackID() << "\n volumeID[" << ihit << "] = " << volumeID << "\n nphotons[" << ihit << "] = " << hitEnergy << "\n side, sector, module = " << zside << ", " << sector << ", " << zmodule @@ -941,7 +1088,7 @@ bool CastorShowerLibraryMaker::FillShowerEvent(CaloG4HitCollection* theCAFI, Cas << "," << entry.y() << "," << entry.z(); } if (verbosity) - edm::LogInfo("CastorShowerLibraryMaker") << "\n Incident Energy = " << aHit->getIncidentEnergy() << " \n"; + edm::LogVerbatim("CastorShowerLibraryMaker") << "\n Incident Energy = " << aHit->getIncidentEnergy() << " \n"; // CaloG4Hit information shower->setDetID(volumeID); @@ -952,7 +1099,8 @@ bool CastorShowerLibraryMaker::FillShowerEvent(CaloG4HitCollection* theCAFI, Cas } // Write number of hits to CastorShowerEvent instance if (nHits == 0) { - edm::LogInfo("CastorShowerLibraryMaker") << "No hits found for this track (trackID=" << ipart << ")." << std::endl; + edm::LogVerbatim("CastorShowerLibraryMaker") + << "No hits found for this track (trackID=" << ipart << ")." << std::endl; if (theCastorNumScheme) delete theCastorNumScheme; return false; @@ -966,7 +1114,7 @@ bool CastorShowerLibraryMaker::FillShowerEvent(CaloG4HitCollection* theCAFI, Cas } int& CastorShowerLibraryMaker::SLnEvtInBinE(int ebin) { if (!SLShowerptr) { - edm::LogInfo("CastorShowerLibraryMaker") << "\n\nSLnEvtInBinE can be called only after BeginOfEvent\n\n"; + edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nSLnEvtInBinE can be called only after BeginOfEvent\n\n"; throw SimG4Exception("\n\nnullptr Pointer to the shower library."); } return SLShowerptr->nEvtInBinE.at(ebin); @@ -974,7 +1122,7 @@ int& CastorShowerLibraryMaker::SLnEvtInBinE(int ebin) { int& CastorShowerLibraryMaker::SLnEvtInBinEta(int ebin, int etabin) { if (!SLShowerptr) { - edm::LogInfo("CastorShowerLibraryMaker") << "\n\nSLnEvtInBinEta can be called only after BeginOfEvent\n\n"; + edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nSLnEvtInBinEta can be called only after BeginOfEvent\n\n"; throw SimG4Exception("\n\nnullptr Pointer to the shower library."); } return SLShowerptr->nEvtInBinEta.at(ebin).at(etabin); @@ -982,14 +1130,14 @@ int& CastorShowerLibraryMaker::SLnEvtInBinEta(int ebin, int etabin) { int& CastorShowerLibraryMaker::SLnEvtInBinPhi(int ebin, int etabin, int phibin) { if (!SLShowerptr) { - edm::LogInfo("CastorShowerLibraryMaker") << "\n\nSLnEvtInBinPhi can be called only after BeginOfEvent\n\n"; + edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nSLnEvtInBinPhi can be called only after BeginOfEvent\n\n"; throw SimG4Exception("\n\nnullptr Pointer to the shower library."); } return SLShowerptr->nEvtInBinPhi.at(ebin).at(etabin).at(phibin); } bool CastorShowerLibraryMaker::SLisEBinFilled(int ebin) { if (!SLShowerptr) { - edm::LogInfo("CastorShowerLibraryMaker") << "\n\nSLisEBinFilled can be called only after BeginOfEvent\n\n"; + edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nSLisEBinFilled can be called only after BeginOfEvent\n\n"; throw SimG4Exception("\n\nnullptr Pointer to the shower library."); } if (SLShowerptr->nEvtInBinE.at(ebin) < (int)SLShowerptr->nEvtPerBinE) @@ -998,7 +1146,7 @@ bool CastorShowerLibraryMaker::SLisEBinFilled(int ebin) { } bool CastorShowerLibraryMaker::SLisEtaBinFilled(int ebin, int etabin) { if (!SLShowerptr) { - edm::LogInfo("CastorShowerLibraryMaker") << "\n\nSLisEtaBinFilled can be called only after BeginOfEvent\n\n"; + edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nSLisEtaBinFilled can be called only after BeginOfEvent\n\n"; throw SimG4Exception("\n\nnullptr Pointer to the shower library."); } if (SLShowerptr->nEvtInBinEta.at(ebin).at(etabin) < (int)SLShowerptr->nEvtPerBinEta) @@ -1007,7 +1155,7 @@ bool CastorShowerLibraryMaker::SLisEtaBinFilled(int ebin, int etabin) { } bool CastorShowerLibraryMaker::SLisPhiBinFilled(int ebin, int etabin, int phibin) { if (!SLShowerptr) { - edm::LogInfo("CastorShowerLibraryMaker") << "\n\nSLisPhiBinFilled can be called only after BeginOfEvent\n\n"; + edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nSLisPhiBinFilled can be called only after BeginOfEvent\n\n"; throw SimG4Exception("\n\nnullptr Pointer to the shower library."); } if (SLShowerptr->nEvtInBinPhi.at(ebin).at(etabin).at(phibin) < (int)SLShowerptr->nEvtPerBinPhi) @@ -1044,3 +1192,8 @@ void CastorShowerLibraryMaker::GetMissingEnergy(CaloG4HitCollection* theCAFI, do } } } + +#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" + +DEFINE_SIMWATCHER(CastorShowerLibraryMaker); diff --git a/SimG4CMS/ShowerLibraryProducer/src/HcalForwardAnalysis.cc b/SimG4CMS/ShowerLibraryProducer/plugins/HcalForwardAnalysis.cc similarity index 78% rename from SimG4CMS/ShowerLibraryProducer/src/HcalForwardAnalysis.cc rename to SimG4CMS/ShowerLibraryProducer/plugins/HcalForwardAnalysis.cc index fbe711ab42025..6af2fdac229ea 100644 --- a/SimG4CMS/ShowerLibraryProducer/src/HcalForwardAnalysis.cc +++ b/SimG4CMS/ShowerLibraryProducer/plugins/HcalForwardAnalysis.cc @@ -2,26 +2,95 @@ #include #include #include +#include +#include // user include files -#include "SimG4CMS/ShowerLibraryProducer/interface/HcalForwardAnalysis.h" - -#include "SimG4Core/Notification/interface/BeginOfRun.h" -#include "SimG4Core/Notification/interface/BeginOfEvent.h" -#include "SimG4Core/Notification/interface/EndOfEvent.h" - #include "DataFormats/Math/interface/Point3D.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "SimG4Core/Notification/interface/BeginOfRun.h" +#include "SimG4Core/Notification/interface/BeginOfEvent.h" +#include "SimG4Core/Notification/interface/EndOfEvent.h" +#include "SimG4Core/Watcher/interface/SimProducer.h" +#include "SimG4Core/Notification/interface/Observer.h" + +#include "SimG4CMS/ShowerLibraryProducer/interface/FiberG4Hit.h" +#include "SimG4CMS/ShowerLibraryProducer/interface/HFShowerG4Hit.h" +#include "G4HCofThisEvent.hh" #include "G4SDManager.hh" +#include "G4Step.hh" +#include "G4Track.hh" +#include "G4ThreeVector.hh" #include "G4VProcess.hh" -#include "G4HCofThisEvent.hh" -#include "CLHEP/Units/GlobalSystemOfUnits.h" -#include "CLHEP/Units/GlobalPhysicalConstants.h" + +#include +#include + +#include "TFile.h" +#include "TTree.h" + +//#define EDM_ML_DEBUG + +class HcalForwardAnalysis : public SimProducer, + public Observer, + public Observer, + public Observer, + public Observer { +public: + struct Photon { + Photon(int id, float X, float Y, float Z, float T, float Lambda) + : fiberId(id), x(X), y(Y), z(Z), t(T), lambda(Lambda) {} + int fiberId; + float x; + float y; + float z; + float t; + float lambda; + }; + + HcalForwardAnalysis(const edm::ParameterSet& p); + HcalForwardAnalysis(const HcalForwardAnalysis&) = delete; // stop default + const HcalForwardAnalysis& operator=(const HcalForwardAnalysis&) = delete; + ~HcalForwardAnalysis() override; + + void produce(edm::Event&, const edm::EventSetup&) override; + +private: + void init(); + + // observer methods + void update(const BeginOfRun* run) override; + void update(const BeginOfEvent* evt) override; + void update(const G4Step* step) override; + void update(const EndOfEvent* evt) override; + // void write(const EndOfRun * run); + + //User methods + void setPhotons(const EndOfEvent* evt); + //void fillEvent(PHcalForwardLibInfo&); + void fillEvent(); + void parseDetId(int id, int& tower, int& cell, int& fiber); + void clear(); + + edm::Service theFile; + TTree* theTree; + int theEventCounter; + int count; + int evNum; + float x[10000], y[10000], z[10000], t[10000], lambda[10000]; + float primX, primY, primZ, primT; + float primMomX, primMomY, primMomZ; + int nphot; + int fiberId[10000]; + std::vector thePhotons; + std::vector theNames; + bool fillt; +}; HcalForwardAnalysis::HcalForwardAnalysis(const edm::ParameterSet& p) { edm::ParameterSet m_SLP = p.getParameter("HFShowerLibraryProducer"); @@ -85,7 +154,9 @@ void HcalForwardAnalysis::update(const BeginOfRun* run) { void HcalForwardAnalysis::update(const BeginOfEvent* evt) { evNum = (*evt)()->GetEventID(); clear(); +#ifdef EDM_ML_DEBUG edm::LogVerbatim("HcalForwardLib") << "HcalForwardAnalysis: =====> Begin of event = " << evNum; +#endif } void HcalForwardAnalysis::update(const G4Step* aStep) {} @@ -94,7 +165,9 @@ void HcalForwardAnalysis::update(const EndOfEvent* evt) { count++; //fill the buffer +#ifdef EDM_ML_DEBUG edm::LogVerbatim("HcalForwardLib") << "HcalForwardAnalysis::Fill event " << (*evt)()->GetEventID(); +#endif setPhotons(evt); int iEvt = (*evt)()->GetEventID(); @@ -114,6 +187,7 @@ void HcalForwardAnalysis::setPhotons(const EndOfEvent* evt) { FiberG4HitsCollection* theHC; // Look for the Hit Collection of HCal G4HCofThisEvent* allHC = (*evt)()->GetHCofThisEvent(); +#ifdef EDM_ML_DEBUG edm::LogVerbatim("HcalForwardLib") << "HcalForwardAnalysis:: Has " << allHC->GetNumberOfCollections() << " collections"; for (int k = 0; k < allHC->GetNumberOfCollections(); ++k) { @@ -122,22 +196,29 @@ void HcalForwardAnalysis::setPhotons(const EndOfEvent* evt) { edm::LogVerbatim("HcalForwardLib") << "Collecttion[" << k << "] " << allHC->GetHC(k) << " " << name << ":" << nameSD; } +#endif std::string sdName = theNames[0]; //name for fiber hits idHC = G4SDManager::GetSDMpointer()->GetCollectionID(sdName); theHC = (FiberG4HitsCollection*)allHC->GetHC(idHC); +#ifdef EDM_ML_DEBUG edm::LogVerbatim("HcalForwardLib") << "HcalForwardAnalysis::setPhotons() Hit Collection for " << sdName << " of ID " << idHC << " is obtained at " << theHC; +#endif std::vector ShortFiberPhotons; std::vector LongFiberPhotons; LongFiberPhotons.clear(); ShortFiberPhotons.clear(); if (idHC >= 0 && theHC != nullptr) { int thehc_entries = theHC->entries(); +#ifdef EDM_ML_DEBUG edm::LogVerbatim("HcalForwardLib") << "FiberhitSize " << thehc_entries; +#endif for (j = 0; j < thehc_entries; j++) { FiberG4Hit* aHit = (*theHC)[j]; std::vector thePhotonsFromHit = aHit->photon(); +#ifdef EDM_ML_DEBUG edm::LogVerbatim("HcalForwardLib") << "Fiberhit " << j << " has " << thePhotonsFromHit.size() << " photons."; +#endif int fTowerId = -1; int fCellId = -1; int fFiberId = -1; @@ -148,13 +229,17 @@ void HcalForwardAnalysis::setPhotons(const EndOfEvent* evt) { if (aHit->depth() == 2) ShortFiberPhotons.push_back(thePhotonsFromHit[iph]); } +#ifdef EDM_ML_DEBUG edm::LogVerbatim("HcalForwardLib") << "HcalForwardAnalysis::setPhotons() NbPhotons " << thePhotonsFromHit.size() << " towerId " << fTowerId << " cellId " << fCellId << " fiberId " << fFiberId << " depth " << aHit->depth(); +#endif } } else { fillt = false; +#ifdef EDM_ML_DEBUG edm::LogVerbatim("HcalForwardLib") << "HcalForwardAnalysis::setPhotons(): No Photons!"; +#endif return; } edm::LogVerbatim("HcalForwardLib") << "HcalForwardAnalysis::setPhotons() LongFibPhotons: " << LongFiberPhotons.size() @@ -181,9 +266,11 @@ void HcalForwardAnalysis::setPhotons(const EndOfEvent* evt) { int thec_hc_entries = theChamberHC->entries(); for (j = 0; j < thec_hc_entries; ++j) { HFShowerG4Hit* aHit = (*theChamberHC)[j]; +#ifdef EDM_ML_DEBUG edm::LogVerbatim("HcalForwardLib") << "HcalForwardAnalysis::setPhotons() Chamber Hit id " << aHit->hitId() << " track id " << aHit->trackId() << " prim. pos. " << aHit->globalPosition() << " prom mom. dir. " << aHit->primaryMomDir() << " time " << aHit->time(); +#endif primPosOnSurf.SetXYZ(aHit->globalPosition().x(), aHit->globalPosition().y(), aHit->globalPosition().z()); primMomDirOnSurf.SetXYZ(aHit->primaryMomDir().x(), aHit->primaryMomDir().y(), aHit->primaryMomDir().z()); primTimeOnSurf = aHit->time(); @@ -251,9 +338,9 @@ void HcalForwardAnalysis::setPhotons(const EndOfEvent* evt) { } void HcalForwardAnalysis::fillEvent() { - /* - edm::LogVerbatim("HcalForwardLib") << "HcalForwardAnalysis: =====> filledEvent"; - */ +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalForwardLib") << "HcalForwardAnalysis: =====> filledEvent"; +#endif nphot = int(thePhotons.size()); for (int i = 0; i < nphot; ++i) { x[i] = thePhotons[i].x; @@ -287,3 +374,8 @@ void HcalForwardAnalysis::clear() { thePhotons.clear(); } + +#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" + +DEFINE_SIMWATCHER(HcalForwardAnalysis); diff --git a/SimG4CMS/ShowerLibraryProducer/plugins/module.cc b/SimG4CMS/ShowerLibraryProducer/plugins/module.cc deleted file mode 100644 index 15c81e10041e8..0000000000000 --- a/SimG4CMS/ShowerLibraryProducer/plugins/module.cc +++ /dev/null @@ -1,7 +0,0 @@ -#include "SimG4CMS/ShowerLibraryProducer/interface/HcalForwardAnalysis.h" -#include "SimG4CMS/ShowerLibraryProducer/interface/CastorShowerLibraryMaker.h" -#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" -#include "FWCore/PluginManager/interface/ModuleDef.h" - -DEFINE_SIMWATCHER(HcalForwardAnalysis); -DEFINE_SIMWATCHER(CastorShowerLibraryMaker); diff --git a/SimG4CMS/Tracker/BuildFile.xml b/SimG4CMS/Tracker/BuildFile.xml index b8e5e5086a183..7bb9545281b61 100644 --- a/SimG4CMS/Tracker/BuildFile.xml +++ b/SimG4CMS/Tracker/BuildFile.xml @@ -1,7 +1,6 @@ - diff --git a/SimG4CMS/Tracker/plugins/BuildFile.xml b/SimG4CMS/Tracker/plugins/BuildFile.xml index a81e8c8cce413..7694fdb457f0f 100644 --- a/SimG4CMS/Tracker/plugins/BuildFile.xml +++ b/SimG4CMS/Tracker/plugins/BuildFile.xml @@ -1,3 +1,4 @@ + diff --git a/SimG4CMS/Tracker/plugins/module.cc b/SimG4CMS/Tracker/plugins/module.cc deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/SimG4CMS/Tracker/src/TrackerG4SimHitNumberingScheme.cc b/SimG4CMS/Tracker/src/TrackerG4SimHitNumberingScheme.cc index 8276f307fb42f..20aba434b730d 100644 --- a/SimG4CMS/Tracker/src/TrackerG4SimHitNumberingScheme.cc +++ b/SimG4CMS/Tracker/src/TrackerG4SimHitNumberingScheme.cc @@ -9,7 +9,7 @@ #include "G4TouchableHistory.hh" #include "G4VSensitiveDetector.hh" -//#define DEBUG +//#define EDM_ML_DEBUG TrackerG4SimHitNumberingScheme::TrackerG4SimHitNumberingScheme(const GeometricDet& det) : alreadySet_(false), geomDet_(&det) {} @@ -55,7 +55,7 @@ void TrackerG4SimHitNumberingScheme::buildAll() { void TrackerG4SimHitNumberingScheme::touchToNavStory(const G4VTouchable* v, TrackerG4SimHitNumberingScheme::Nav_Story& st) { -#ifdef DEBUG +#ifdef EDM_ML_DEBUG std::vector debugint; std::vector debugstring; #endif @@ -65,14 +65,14 @@ void TrackerG4SimHitNumberingScheme::touchToNavStory(const G4VTouchable* v, if (dd4hep::dd::noNamespace(v->GetVolume(k)->GetLogicalVolume()->GetName()) != "TOBInactive") { st.emplace_back( std::pair(v->GetVolume(k)->GetCopyNo(), v->GetVolume(k)->GetLogicalVolume()->GetName())); -#ifdef DEBUG +#ifdef EDM_ML_DEBUG debugint.emplace_back(v->GetVolume(k)->GetCopyNo()); debugstring.emplace_back(v->GetVolume(k)->GetLogicalVolume()->GetName()); #endif } } -#ifdef DEBUG - LogDebug("TrackerSimDebugNumbering") << " G4 TrackerG4SimHitNumberingScheme " << debugint; +#ifdef EDM_ML_DEBUG + LogDebug("TrackerSimDebugNumbering") << " G4 TrackerG4SimHitNumberingScheme " << debugint.size(); for (u_int32_t jj = 0; jj < debugstring.size(); jj++) LogDebug("TrackerSimDebugNumbering") << " " << debugstring[jj]; #endif @@ -85,7 +85,7 @@ unsigned int TrackerG4SimHitNumberingScheme::g4ToNumberingScheme(const G4VToucha TrackerG4SimHitNumberingScheme::Nav_Story st; touchToNavStory(v, st); -#ifdef DEBUG +#ifdef EDM_ML_DEBUG dumpG4VPV(v); LogDebug("TrackerSimDebugNumbering") << " Returning: " << directMap_[st]; #endif diff --git a/SimG4Core/Application/interface/RunManagerMTWorker.h b/SimG4Core/Application/interface/RunManagerMTWorker.h index f42895f449894..0442175117865 100644 --- a/SimG4Core/Application/interface/RunManagerMTWorker.h +++ b/SimG4Core/Application/interface/RunManagerMTWorker.h @@ -86,7 +86,8 @@ class RunManagerMTWorker { void DumpMagneticField(const G4Field*, const std::string&) const; - static void resetTLS(); + void resetTLS(); + int getThreadIndex() const { return m_thread_index; } Generator m_generator; edm::EDGetTokenT m_InToken; @@ -111,12 +112,14 @@ class RunManagerMTWorker { edm::ParameterSet m_p; struct TLSData; - static thread_local TLSData* m_tls; - static thread_local bool dumpMF; + TLSData* m_tls{nullptr}; + bool dumpMF{false}; G4SimEvent* m_simEvent; std::unique_ptr m_sVerbose; std::unordered_map> m_sdMakers; + + const int m_thread_index{-1}; }; #endif diff --git a/SimG4Core/Application/interface/ThreadHandoff.h b/SimG4Core/Application/interface/ThreadHandoff.h new file mode 100644 index 0000000000000..e54aa32f6e8ab --- /dev/null +++ b/SimG4Core/Application/interface/ThreadHandoff.h @@ -0,0 +1,98 @@ +#ifndef SimG4Core_Application_ThreadHandoff_h +#define SimG4Core_Application_ThreadHandoff_h +// -*- C++ -*- +// +// Package: SimG4Core/Application +// Class : ThreadHandoff +// +/**\class ThreadHandoff ThreadHandoff.h "SimG4Core/Application/interface/ThreadHandoff.h" + + Description: [one line class summary] + + Usage: + + +*/ +// +// Original Author: Christopher Jones +// Created: Mon, 16 Aug 2021 13:51:53 GMT +// + +// system include files +#include +#include //strerror_r +#include +#include +#include + +// user include files + +// forward declarations + +namespace omt { + class ThreadHandoff { + public: + explicit ThreadHandoff(int stackSize); + ~ThreadHandoff(); + + ThreadHandoff(const ThreadHandoff&) = delete; // stop default + const ThreadHandoff& operator=(const ThreadHandoff&) = delete; // stop default + + template + void runAndWait(F&& iF) { + Functor f{std::move(iF)}; + + std::unique_lock lck(m_mutex); + m_loopReady = false; + m_toRun = &f; + + m_threadHandoff.notify_one(); + + m_threadHandoff.wait(lck, [this]() { return m_loopReady; }); + auto e = f.exception(); + if (e) { + std::rethrow_exception(e); + } + } + + void stopThread() { + runAndWait([this]() { m_stopThread = true; }); + } + + private: + class FunctorBase { + public: + virtual ~FunctorBase() {} + virtual void execute() = 0; + }; + template + class Functor : public FunctorBase { + public: + explicit Functor(F&& iF) : m_f(std::move(iF)) {} + void execute() final { + try { + m_f(); + } catch (...) { + m_except = std::current_exception(); + } + } + std::exception_ptr exception() { return m_except; } + + private: + F m_f; + std::exception_ptr m_except; + }; + + static void* threadLoop(void* iArgs); + + // ---------- member data -------------------------------- + pthread_t m_thread; + std::mutex m_mutex; + std::condition_variable m_threadHandoff; + + FunctorBase* m_toRun{nullptr}; + bool m_loopReady{false}; + bool m_stopThread{false}; + }; +} // namespace omt +#endif diff --git a/SimG4Core/Application/plugins/OscarMTProducer.cc b/SimG4Core/Application/plugins/OscarMTProducer.cc index cfce6e9fed2d6..d33504f82f66e 100644 --- a/SimG4Core/Application/plugins/OscarMTProducer.cc +++ b/SimG4Core/Application/plugins/OscarMTProducer.cc @@ -1,4 +1,11 @@ -#include "OscarMTProducer.h" +#include +#include + +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Run.h" #include "FWCore/PluginManager/interface/PluginManager.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -7,15 +14,20 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" #include "FWCore/Utilities/interface/RandomNumberGenerator.h" #include "FWCore/Utilities/interface/Exception.h" -#include "SimG4Core/Notification/interface/SimG4Exception.h" +#include "SimG4Core/Application/interface/OscarMTMasterThread.h" #include "SimG4Core/Application/interface/RunManagerMT.h" #include "SimG4Core/Application/interface/RunManagerMTWorker.h" + +#include "SimG4Core/Notification/interface/SimG4Exception.h" #include "SimG4Core/Notification/interface/G4SimEvent.h" + #include "SimG4Core/SensitiveDetector/interface/SensitiveTkDetector.h" #include "SimG4Core/SensitiveDetector/interface/SensitiveCaloDetector.h" + #include "SimG4Core/Watcher/interface/SimProducer.h" #include "SimDataFormats/Track/interface/SimTrackContainer.h" @@ -23,10 +35,34 @@ #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" +#include "SimG4Core/Application/interface/ThreadHandoff.h" + #include "Randomize.hh" -#include -#include +// for some reason void doesn't compile +class OscarMTProducer : public edm::stream::EDProducer, edm::RunCache > { +public: + typedef std::vector > Producers; + + explicit OscarMTProducer(edm::ParameterSet const& p, const OscarMTMasterThread*); + ~OscarMTProducer() override; + + static std::unique_ptr initializeGlobalCache(const edm::ParameterSet& iConfig); + static std::shared_ptr globalBeginRun(const edm::Run& iRun, + const edm::EventSetup& iSetup, + const OscarMTMasterThread* masterThread); + static void globalEndRun(const edm::Run& iRun, const edm::EventSetup& iSetup, const RunContext* iContext); + static void globalEndJob(OscarMTMasterThread* masterThread); + + void beginRun(const edm::Run& r, const edm::EventSetup& c) override; + void endRun(const edm::Run& r, const edm::EventSetup& c) override; + void produce(edm::Event& e, const edm::EventSetup& c) override; + +private: + omt::ThreadHandoff m_handoff; + std::unique_ptr m_runManagerWorker; + const OscarMTMasterThread* m_masterThread = nullptr; +}; namespace edm { class StreamID; @@ -55,17 +91,25 @@ namespace { explicit StaticRandomEngineSetUnset(CLHEP::HepRandomEngine* engine); ~StaticRandomEngineSetUnset(); + CLHEP::HepRandomEngine* currentEngine() { return m_currentEngine; } + private: CLHEP::HepRandomEngine* m_currentEngine; CLHEP::HepRandomEngine* m_previousEngine; }; } // namespace -OscarMTProducer::OscarMTProducer(edm::ParameterSet const& p, const OscarMTMasterThread* ms) { +OscarMTProducer::OscarMTProducer(edm::ParameterSet const& p, const OscarMTMasterThread* ms) + : m_handoff{p.getUntrackedParameter("workerThreadStackSize", 10 * 1024 * 1024)} { // Random number generation not allowed here StaticRandomEngineSetUnset random(nullptr); - m_runManagerWorker = std::make_unique(p, consumesCollector()); + auto token = edm::ServiceRegistry::instance().presentToken(); + m_handoff.runAndWait([this, &p, token]() { + edm::ServiceRegistry::Operate guard{token}; + StaticRandomEngineSetUnset random(nullptr); + m_runManagerWorker = std::make_unique(p, consumesCollector()); + }); m_masterThread = ms; m_masterThread->callConsumes(consumesCollector()); @@ -133,7 +177,13 @@ OscarMTProducer::OscarMTProducer(edm::ParameterSet const& p, const OscarMTMaster edm::LogVerbatim("SimG4CoreApplication") << "OscarMTProducer is constructed"; } -OscarMTProducer::~OscarMTProducer() {} +OscarMTProducer::~OscarMTProducer() { + auto token = edm::ServiceRegistry::instance().presentToken(); + m_handoff.runAndWait([this, token]() { + edm::ServiceRegistry::Operate guard{token}; + m_runManagerWorker.reset(); + }); +} std::unique_ptr OscarMTProducer::initializeGlobalCache(const edm::ParameterSet& iConfig) { // Random number generation not allowed here @@ -166,8 +216,12 @@ void OscarMTProducer::globalEndJob(OscarMTMasterThread* masterThread) { void OscarMTProducer::beginRun(const edm::Run&, const edm::EventSetup& es) { edm::LogVerbatim("SimG4CoreApplication") << "OscarMTProducer::beginRun"; - m_runManagerWorker->beginRun(es); - m_runManagerWorker->initializeG4(m_masterThread->runManagerMasterPtr(), es); + auto token = edm::ServiceRegistry::instance().presentToken(); + m_handoff.runAndWait([this, &es, token]() { + edm::ServiceRegistry::Operate guard{token}; + m_runManagerWorker->beginRun(es); + m_runManagerWorker->initializeG4(m_masterThread->runManagerMasterPtr(), es); + }); edm::LogVerbatim("SimG4CoreApplication") << "OscarMTProducer::beginRun done"; } @@ -175,12 +229,18 @@ void OscarMTProducer::endRun(const edm::Run&, const edm::EventSetup&) { // Random number generation not allowed here StaticRandomEngineSetUnset random(nullptr); edm::LogVerbatim("SimG4CoreApplication") << "OscarMTProducer::endRun"; - m_runManagerWorker->endRun(); + auto token = edm::ServiceRegistry::instance().presentToken(); + m_handoff.runAndWait([this, token]() { + StaticRandomEngineSetUnset random(nullptr); + edm::ServiceRegistry::Operate guard{token}; + m_runManagerWorker->endRun(); + }); edm::LogVerbatim("SimG4CoreApplication") << "OscarMTProducer::endRun done"; } void OscarMTProducer::produce(edm::Event& e, const edm::EventSetup& es) { StaticRandomEngineSetUnset random(e.streamID()); + auto engine = random.currentEngine(); edm::LogVerbatim("SimG4CoreApplication") << "Produce event " << e.id() << " stream " << e.streamID(); //edm::LogVerbatim("SimG4CoreApplication") << " rand= " << G4UniformRand(); @@ -189,7 +249,12 @@ void OscarMTProducer::produce(edm::Event& e, const edm::EventSetup& es) { std::unique_ptr evt; try { - evt = m_runManagerWorker->produce(e, es, globalCache()->runManagerMaster()); + auto token = edm::ServiceRegistry::instance().presentToken(); + m_handoff.runAndWait([this, &e, &es, &evt, token, engine]() { + edm::ServiceRegistry::Operate guard{token}; + StaticRandomEngineSetUnset random(engine); + evt = m_runManagerWorker->produce(e, es, globalCache()->runManagerMaster()); + }); } catch (const SimG4Exception& simg4ex) { edm::LogWarning("SimG4CoreApplication") << "SimG4Exception caght! " << simg4ex.what(); diff --git a/SimG4Core/Application/plugins/OscarMTProducer.h b/SimG4Core/Application/plugins/OscarMTProducer.h deleted file mode 100644 index 5d9bc43ce25d7..0000000000000 --- a/SimG4Core/Application/plugins/OscarMTProducer.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef SimG4Core_OscarMTProducer_H -#define SimG4Core_OscarMTProducer_H - -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/Run.h" - -#include "SimG4Core/Application/interface/OscarMTMasterThread.h" - -#include - -class SimProducer; -class RunManagerMTWorker; - -class OscarMTProducer : public edm::stream::EDProducer, - edm::RunCache // for some reason void doesn't compile - > { -public: - typedef std::vector > Producers; - - explicit OscarMTProducer(edm::ParameterSet const& p, const OscarMTMasterThread*); - ~OscarMTProducer() override; - - static std::unique_ptr initializeGlobalCache(const edm::ParameterSet& iConfig); - static std::shared_ptr globalBeginRun(const edm::Run& iRun, - const edm::EventSetup& iSetup, - const OscarMTMasterThread* masterThread); - static void globalEndRun(const edm::Run& iRun, const edm::EventSetup& iSetup, const RunContext* iContext); - static void globalEndJob(OscarMTMasterThread* masterThread); - - void beginRun(const edm::Run& r, const edm::EventSetup& c) override; - void endRun(const edm::Run& r, const edm::EventSetup& c) override; - void produce(edm::Event& e, const edm::EventSetup& c) override; - -private: - std::unique_ptr m_runManagerWorker; - const OscarMTMasterThread* m_masterThread = nullptr; -}; - -#endif diff --git a/SimG4Core/Application/src/OscarMTMasterThread.cc b/SimG4Core/Application/src/OscarMTMasterThread.cc index 468e2196c0810..6c4772a4aafdd 100644 --- a/SimG4Core/Application/src/OscarMTMasterThread.cc +++ b/SimG4Core/Application/src/OscarMTMasterThread.cc @@ -66,8 +66,8 @@ OscarMTMasterThread::OscarMTMasterThread(const edm::ParameterSet& iConfig) } else if (m_masterThreadState == ThreadState::Destruct) { edm::LogVerbatim("OscarMTMasterThread") << "Master thread: Breaking out of state loop"; if (isG4Alive) - throw edm::Exception(edm::errors::LogicError) - << "Geant4 is still alive, master thread state must be set to EndRun before Destruct"; + throw edm::Exception(edm::errors::LogicError) << "OscarMTMasterThread: Geant4 is still alive, master thread " + "state must be set to EndRun before Destruct"; break; } else { throw edm::Exception(edm::errors::LogicError) @@ -83,7 +83,7 @@ OscarMTMasterThread::OscarMTMasterThread(const edm::ParameterSet& iConfig) m_runManagerMaster.reset(); G4PhysicalVolumeStore::Clean(); - edm::LogVerbatim("OscarMTMasterThread") << "Master thread: Reseted shared_ptr"; + edm::LogVerbatim("SimG4CoreApplication") << "OscarMTMasterThread: physics and geometry are cleaned"; lk2.unlock(); edm::LogVerbatim("SimG4CoreApplication") << "OscarMTMasterThread: Master thread is finished"; }); @@ -161,22 +161,13 @@ void OscarMTMasterThread::stopThread() { return; } edm::LogVerbatim("SimG4CoreApplication") << "OscarMTMasterThread::stopTread: stop main thread"; - - // Release our instance of the shared master run manager, so that - // the G4 master thread can do the cleanup. Then notify the master - // thread, and join it. std::unique_lock lk2(m_threadMutex); - m_runManagerMaster.reset(); - LogDebug("OscarMTMasterThread") << "Main thread: reseted shared_ptr"; - m_masterThreadState = ThreadState::Destruct; m_masterCanProceed = true; edm::LogVerbatim("SimG4CoreApplication") << "OscarMTMasterThread::stopTread: notify"; m_notifyMasterCv.notify_one(); lk2.unlock(); - - LogDebug("OscarMTMasterThread") << "Main thread: joining master thread"; m_masterThread.join(); - edm::LogVerbatim("SimG4CoreApplication") << "OscarMTMasterThread::stopTread: main thread finished"; + edm::LogVerbatim("SimG4CoreApplication") << "OscarMTMasterThread::stopTread: is done"; m_stopped = true; } diff --git a/SimG4Core/Application/src/RunManagerMTWorker.cc b/SimG4Core/Application/src/RunManagerMTWorker.cc index 6e240cae85086..0f557b23a6cee 100644 --- a/SimG4Core/Application/src/RunManagerMTWorker.cc +++ b/SimG4Core/Application/src/RunManagerMTWorker.cc @@ -64,7 +64,6 @@ #include "tbb/task_arena.h" static std::once_flag applyOnce; -thread_local bool RunManagerMTWorker::dumpMF = false; // from https://hypernews.cern.ch/HyperNews/CMS/get/edmFramework/3302/2.html namespace { @@ -72,10 +71,6 @@ namespace { int get_new_thread_index() { return thread_counter++; } - thread_local int s_thread_index = get_new_thread_index(); - - int getThreadIndex() { return s_thread_index; } - void createWatchers(const edm::ParameterSet& iP, SimActivityRegistry* iReg, std::vector>& oWatchers, @@ -102,10 +97,6 @@ namespace { } } } - - std::atomic active_tlsdata{0}; - std::atomic tls_shutdown_timeout{false}; - std::atomic n_tls_shutdown_task{0}; } // namespace struct RunManagerMTWorker::TLSData { @@ -127,9 +118,9 @@ struct RunManagerMTWorker::TLSData { bool threadInitialized = false; bool runTerminated = false; - TLSData() { ++active_tlsdata; } + TLSData() {} - ~TLSData() { --active_tlsdata; } + ~TLSData() {} }; //This can not be a smart pointer since we must delete some of the members @@ -137,7 +128,7 @@ struct RunManagerMTWorker::TLSData { // other 'singletons' after those singletons have been deleted. Instead we // atempt to delete all TLS at RunManagerMTWorker destructor. If that fails for // some reason, it is better to leak than cause a crash. -thread_local RunManagerMTWorker::TLSData* RunManagerMTWorker::m_tls{nullptr}; +//thread_local RunManagerMTWorker::TLSData* RunManagerMTWorker::m_tls{nullptr}; RunManagerMTWorker::RunManagerMTWorker(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iC) : m_generator(iConfig.getParameter("Generator")), @@ -158,7 +149,8 @@ RunManagerMTWorker::RunManagerMTWorker(const edm::ParameterSet& iConfig, edm::Co m_pCustomUIsession(iConfig.getUntrackedParameter("CustomUIsession")), m_p(iConfig), m_simEvent(nullptr), - m_sVerbose(nullptr) { + m_sVerbose(nullptr), + m_thread_index{get_new_thread_index()} { std::vector onlySDs = iConfig.getParameter>("OnlySDs"); m_sdMakers = sim::sensitiveDetectorMakers(m_p, iC, onlySDs); std::vector watchers = iConfig.getParameter>("Watchers"); @@ -180,47 +172,9 @@ RunManagerMTWorker::RunManagerMTWorker(const edm::ParameterSet& iConfig, edm::Co edm::LogVerbatim("SimG4CoreApplication") << "SD[" << k << "] " << itr->first; } -RunManagerMTWorker::~RunManagerMTWorker() { - ++n_tls_shutdown_task; - resetTLS(); - - { - //make sure all tasks are done before continuing - timespec s; - s.tv_sec = 0; - s.tv_nsec = 10000; - while (n_tls_shutdown_task != 0) { - nanosleep(&s, nullptr); - } - } -} - -void RunManagerMTWorker::resetTLS() { - m_tls = nullptr; +RunManagerMTWorker::~RunManagerMTWorker() { resetTLS(); } - if (active_tlsdata != 0 and not tls_shutdown_timeout) { - ++n_tls_shutdown_task; - //need to run tasks on each thread which has set the tls - { - tbb::task_arena arena(tbb::task_arena::attach{}); - arena.enqueue([]() { RunManagerMTWorker::resetTLS(); }); - } - timespec s; - s.tv_sec = 0; - s.tv_nsec = 10000; - //we do not want this thread to be used for a new task since it - // has already cleared its structures. In order to fill all TBB - // threads we wait for all TLSes to clear - int count = 0; - while (active_tlsdata.load() != 0 and ++count < 1000) { - nanosleep(&s, nullptr); - } - if (count >= 1000) { - tls_shutdown_timeout = true; - } - } - --n_tls_shutdown_task; -} +void RunManagerMTWorker::resetTLS() { m_tls = nullptr; } void RunManagerMTWorker::beginRun(edm::EventSetup const& es) { for (auto& maker : m_sdMakers) { @@ -323,7 +277,7 @@ void RunManagerMTWorker::initializeG4(RunManagerMT* runManagerMaster, const edm: std::string fieldFile = m_p.getUntrackedParameter("FileNameField", ""); if (!fieldFile.empty()) { - std::call_once(applyOnce, []() { dumpMF = true; }); + std::call_once(applyOnce, [this]() { dumpMF = true; }); if (dumpMF) { edm::LogVerbatim("SimG4CoreApplication") << "RunManagerMTWorker: Dump magnetic field to file " << fieldFile; DumpMagneticField(tM->GetFieldManager()->GetDetectorField(), fieldFile); @@ -494,13 +448,7 @@ std::unique_ptr RunManagerMTWorker::produce(const edm::Event& inpevt // We have to do the per-thread initialization, and per-thread // per-run initialization here by ourselves. - if (nullptr == m_tls || !m_tls->threadInitialized) { - edm::LogVerbatim("SimG4CoreApplication") - << "RunManagerMTWorker::produce(): stream " << inpevt.streamID() << " thread " << getThreadIndex() - << " Geant4 initialisation for this thread"; - initializeG4(&runManagerMaster, es); - m_tls->threadInitialized = true; - } + assert(m_tls != nullptr and m_tls->threadInitialized); // Initialize run if (inpevt.id().run() != m_tls->currentRunNumber) { edm::LogVerbatim("SimG4CoreApplication") diff --git a/SimG4Core/Application/src/ThreadHandoff.cc b/SimG4Core/Application/src/ThreadHandoff.cc new file mode 100644 index 0000000000000..fda990f21f02b --- /dev/null +++ b/SimG4Core/Application/src/ThreadHandoff.cc @@ -0,0 +1,116 @@ +// -*- C++ -*- +// +// Package: SimG4Core/Application +// Class : ThreadHandoff +// +// Implementation: +// [Notes on implementation] +// +// Original Author: Christopher Jones +// Created: Mon, 16 Aug 2021 14:37:29 GMT +// + +// system include files + +// user include files +#include "SimG4Core/Application/interface/ThreadHandoff.h" +#include "FWCore/Utilities/interface/Exception.h" + +// +// constants, enums and typedefs +// + +namespace { + std::string errorMessage(int erno) { + std::array buffer; + strerror_r(erno, &buffer[0], buffer.size()); + buffer.back() = '\0'; + return std::string(&buffer[0]); + } +} // namespace +// +// static data member definitions +// + +// +// constructors and destructor +// +using namespace omt; + +ThreadHandoff::ThreadHandoff(int stackSize) { + pthread_attr_t attr; + int erno; + if (0 != (erno = pthread_attr_init(&attr))) { + throw cms::Exception("ThreadInitFailed") + << "Failed to initialize thread attributes (" << erno << ") " << errorMessage(erno); + } + + if (0 != (erno = pthread_attr_setstacksize(&attr, stackSize))) { + throw cms::Exception("ThreadStackSizeFailed") + << "Failed to set stack size " << stackSize << " " << errorMessage(erno); + } + std::unique_lock lk(m_mutex); + + erno = pthread_create(&m_thread, &attr, threadLoop, this); + if (0 != erno) { + throw cms::Exception("ThreadCreateFailed") << " failed to create a pthread (" << erno << ") " << errorMessage(erno); + } + m_loopReady = false; + m_threadHandoff.wait(lk, [this]() { return m_loopReady; }); +} + +// ThreadHandoff::ThreadHandoff(const ThreadHandoff& rhs) +// { +// // do actual copying here; +// } + +ThreadHandoff::~ThreadHandoff() { + if (not m_stopThread) { + stopThread(); + } + void* ret; + pthread_join(m_thread, &ret); +} + +// +// assignment operators +// +// const ThreadHandoff& ThreadHandoff::operator=(const ThreadHandoff& rhs) +// { +// //An exception safe implementation is +// ThreadHandoff temp(rhs); +// swap(rhs); +// +// return *this; +// } + +// +// member functions +// + +// +// const member functions +// + +// +// static member functions +// +void* ThreadHandoff::threadLoop(void* iArgs) { + auto theThis = reinterpret_cast(iArgs); + { + std::unique_lock lck(theThis->m_mutex); + theThis->m_loopReady = true; + } + theThis->m_threadHandoff.notify_one(); + + std::unique_lock lck(theThis->m_mutex); + do { + theThis->m_toRun = nullptr; + theThis->m_threadHandoff.wait(lck, [theThis]() { return nullptr != theThis->m_toRun; }); + theThis->m_toRun->execute(); + theThis->m_loopReady = true; + theThis->m_threadHandoff.notify_one(); + } while (not theThis->m_stopThread); + theThis->m_loopReady = true; + return nullptr; +} diff --git a/SimG4Core/Application/test/BuildFile.xml b/SimG4Core/Application/test/BuildFile.xml index 933807d300b68..81aa60d01aed9 100644 --- a/SimG4Core/Application/test/BuildFile.xml +++ b/SimG4Core/Application/test/BuildFile.xml @@ -1,7 +1,5 @@ - - diff --git a/SimG4Core/Application/test/test_catch2_ThreadHandoff.cc b/SimG4Core/Application/test/test_catch2_ThreadHandoff.cc new file mode 100644 index 0000000000000..5f930d811cba0 --- /dev/null +++ b/SimG4Core/Application/test/test_catch2_ThreadHandoff.cc @@ -0,0 +1,20 @@ +#include "SimG4Core/Application/interface/ThreadHandoff.h" +#include "FWCore/Utilities/interface/Exception.h" +#define CATCH_CONFIG_MAIN +#include "catch.hpp" + +using namespace omt; +TEST_CASE("Test omt::ThreadHandoff", "[ThreadHandoff]") { + SECTION("Do nothing") { ThreadHandoff th; } + SECTION("Simple") { + ThreadHandoff th; + bool value = false; + th.runAndWait([&value]() { value = true; }); + REQUIRE(value == true); + } + + SECTION("Exception") { + ThreadHandoff th; + REQUIRE_THROWS_AS(th.runAndWait([]() { throw cms::Exception("Test"); }), cms::Exception); + } +} diff --git a/SimG4Core/Configuration/test/dd4hep_ZMM_Run3_Step1_cfg.py b/SimG4Core/Configuration/test/dd4hep_ZMM_Run3_Step1_cfg.py index 051c7cc6ddc19..fcda5293911dd 100644 --- a/SimG4Core/Configuration/test/dd4hep_ZMM_Run3_Step1_cfg.py +++ b/SimG4Core/Configuration/test/dd4hep_ZMM_Run3_Step1_cfg.py @@ -17,7 +17,7 @@ process.load('Configuration.StandardSequences.SimIdeal_cff') process.load('Configuration.StandardSequences.EndOfProcess_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') -process.load('Configuration.Geometry.GeometryDD4hepExtended2021_cff') # there w +process.load('Configuration.Geometry.GeometryDD4hepExtended2021Reco_cff') if hasattr(process,'MessageLogger'): diff --git a/SimG4Core/Configuration/test/dd4hep_ttbar_2026D77_Step1_cfg.py b/SimG4Core/Configuration/test/dd4hep_ttbar_2026D77_Step1_cfg.py index a8910e03b01a0..4fb983d79fa45 100644 --- a/SimG4Core/Configuration/test/dd4hep_ttbar_2026D77_Step1_cfg.py +++ b/SimG4Core/Configuration/test/dd4hep_ttbar_2026D77_Step1_cfg.py @@ -10,7 +10,7 @@ process.load('FWCore.MessageService.MessageLogger_cfi') process.load('Configuration.EventContent.EventContent_cff') process.load('SimGeneral.MixingModule.mixNoPU_cfi') -process.load('Configuration.Geometry.GeometryDD4hepExtended2026D77_cff') +process.load('Configuration.Geometry.GeometryDD4hepExtended2026D77Reco_cff') process.load('Configuration.StandardSequences.MagneticField_cff') process.load('Configuration.StandardSequences.Generator_cff') process.load('IOMC.EventVertexGenerators.VtxSmearedHLLHC14TeV_cfi') diff --git a/SimG4Core/Configuration/test/dd4hep_ttbar_Run3_Step1_cfg.py b/SimG4Core/Configuration/test/dd4hep_ttbar_Run3_Step1_cfg.py index 6310d564e2840..5b558b9fdba1a 100644 --- a/SimG4Core/Configuration/test/dd4hep_ttbar_Run3_Step1_cfg.py +++ b/SimG4Core/Configuration/test/dd4hep_ttbar_Run3_Step1_cfg.py @@ -10,7 +10,7 @@ process.load('FWCore.MessageService.MessageLogger_cfi') process.load('Configuration.EventContent.EventContent_cff') process.load('SimGeneral.MixingModule.mixNoPU_cfi') -process.load('Configuration.Geometry.GeometryDD4hepExtended2021_cff') +process.load('Configuration.Geometry.GeometryDD4hepExtended2021Reco_cff') process.load('Configuration.StandardSequences.MagneticField_cff') process.load('Configuration.StandardSequences.Generator_cff') process.load('IOMC.EventVertexGenerators.VtxSmearedHLLHC14TeV_cfi') diff --git a/SimG4Core/Configuration/test/ddd_ZMM_Run3_Step1_cfg.py b/SimG4Core/Configuration/test/ddd_ZMM_Run3_Step1_cfg.py index de508fba1eacd..1ae4f3acd08b8 100644 --- a/SimG4Core/Configuration/test/ddd_ZMM_Run3_Step1_cfg.py +++ b/SimG4Core/Configuration/test/ddd_ZMM_Run3_Step1_cfg.py @@ -17,7 +17,7 @@ process.load('Configuration.StandardSequences.SimIdeal_cff') process.load('Configuration.StandardSequences.EndOfProcess_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') -process.load('Configuration.Geometry.GeometryExtended2021_cff') # there w +process.load('Configuration.Geometry.GeometryExtended2021Reco_cff') if hasattr(process,'MessageLogger'): process.MessageLogger.EcalGeom=dict() diff --git a/SimG4Core/PrintGeomInfo/data/dd4hep/cmsExtendedGeometry2021.xml b/SimG4Core/PrintGeomInfo/data/dd4hep/cmsExtendedGeometry2021.xml new file mode 100644 index 0000000000000..1f8964f5f589f --- /dev/null +++ b/SimG4Core/PrintGeomInfo/data/dd4hep/cmsExtendedGeometry2021.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/SimG4Core/PrintGeomInfo/data/hcalRecNumbering.xml b/SimG4Core/PrintGeomInfo/data/hcalRecNumbering.xml new file mode 100644 index 0000000000000..da8eb8002a5d4 --- /dev/null +++ b/SimG4Core/PrintGeomInfo/data/hcalRecNumbering.xml @@ -0,0 +1,33 @@ + + + + + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + + + 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4 + + + 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 + + + 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 + + + 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5 + + + 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6 + + + 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7 + + + + diff --git a/SimG4Core/PrintGeomInfo/data/hcalSimNumbering.xml b/SimG4Core/PrintGeomInfo/data/hcalSimNumbering.xml new file mode 100644 index 0000000000000..4145c1e4fb8c1 --- /dev/null +++ b/SimG4Core/PrintGeomInfo/data/hcalSimNumbering.xml @@ -0,0 +1,91 @@ + + + + + + 0.0*deg, 0.0*deg, 0.0*deg, 10.0*deg, 10.0*deg + + + 0.000, 0.087, 0.174, 0.261, 0.348, 0.435, 0.522, 0.609, 0.696, + 0.783, 0.870, 0.957, 1.044, 1.131, 1.218, 1.305, 1.392, 1.479, + 1.566, 1.653, 1.740, 1.830, 1.930, 2.043, 2.172, 2.322, 2.500, + 2.650, 2.868, 3.000 + + + 12.50*cm, 16.90*cm, 20.10*cm, 24.00*cm, 28.60*cm, 34.00*cm, + 40.60*cm, 48.30*cm, 57.60*cm, 68.60*cm, 81.80*cm, 97.50*cm, + 116.20*cm, 130.00*cm + + + 5.0*deg, 5.0*deg, 5.0*deg, 5.0*deg, 5.0*deg, 5.0*deg, 5.0*deg, + 5.0*deg, 5.0*deg, 5.0*deg, 5.0*deg, 5.0*deg, 5.0*deg, 5.0*deg, + 5.0*deg, 5.0*deg, 5.0*deg, 5.0*deg, 5.0*deg, 5.0*deg, 10.0*deg, + 10.0*deg, 10.0*deg, 10.0*deg, 10.0*deg, 10.0*deg, 10.0*deg, + 10.0*deg, 10.0*deg + + + 10.0*deg, 10.0*deg, 10.0*deg, 10.0*deg, 10.0*deg, 10.0*deg, + 10.0*deg, 10.0*deg, 10.0*deg, 10.0*deg, 10.0*deg, 20.0*deg, + 20.0*deg + + + 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4 + + + 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 + + + 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 + + + 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5 + + + 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6 + + + 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7 + + + 1, 16, 29, 1 + + + 16, 29, 41, 15 + + + 4, 7, 4, 4 + + + 1.392, 3.000, 5.500, 1.305 + + + 22.0*cm, 165.0*cm, 30.0*cm, 0.0*cm, 1115.0*cm, 0.375*cm, + 1137.0*cm + + + 15, 29, 4, 10, 5, 2, 4, 18, 19, 11, 12, 13, 14, 3, 4, 3, 1, 0 + + + 0.5, 1.2 + + + 117.0, 117.0, 117.0, 217.0 + + + 0, 0, 0, 0 + + + 178.0, 178.0, 178.0, 178.0, 178.0, 178.0, 178.0 + + + 0, 0, 0, 0, 0, 0, 0 + + + 2.840, 2.090, 2.840, 2.090 + + + 0, 0, 0, 0 + + + + diff --git a/SimG4Core/PrintGeomInfo/python/cmsExtendedGeometry2021_cfi.py b/SimG4Core/PrintGeomInfo/python/cmsExtendedGeometry2021_cfi.py new file mode 100644 index 0000000000000..60e686a9dea8f --- /dev/null +++ b/SimG4Core/PrintGeomInfo/python/cmsExtendedGeometry2021_cfi.py @@ -0,0 +1,9 @@ +import FWCore.ParameterSet.Config as cms + +XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", + geomXMLFiles = cms.vstring( + 'SimG4Core/PrintGeomInfo/data/dddDBBigFile.xml', + 'SimG4Core/PrintGeomInfo/data/hcalSimNumbering.xml', + 'SimG4Core/PrintGeomInfo/data/hcalRecNumbering.xml'), + rootNodeName = cms.string('cms:OCMS') +) diff --git a/SimG4Core/PrintGeomInfo/test/SimFileCompare.cpp b/SimG4Core/PrintGeomInfo/test/SimFileCompare.cpp index 5949933d170e1..ac8a2af3b0dd8 100644 --- a/SimG4Core/PrintGeomInfo/test/SimFileCompare.cpp +++ b/SimG4Core/PrintGeomInfo/test/SimFileCompare.cpp @@ -3,11 +3,14 @@ // Compares output files from PrintGeomInfo created using DDD and DD4Hep // inputs. Usage: // -// SimFileCompare infile1 infile2 mode debug -// infile1 (const char*) File created using DDD -// infile2 (const char*) File created using DD4Hep +// SimFileCompare infile1 infile2 type files mode debug +// infile1 (const char*) First file name +// infile2 (const char*) Second file name // type (int) Type of file: material (0), solid (1), // LogicalVolume (2), PhysicalVolume (3) +// files (int) Double digits each inidicating the file source +// (0 for DDD, 1 for DD4HEP). So if first file is +// DDD and second is DD4HEP, it will be 10 // mode (int) Treat (0) or not treat (1) names from DDD // deug (int) Single digit number (0 minimum printout) // @@ -123,150 +126,160 @@ void myPrint2(std::map const& obj1, std::map con } } -void CompareFiles(const char* fileDDD, const char* fileDD4Hep, int type, int mode, int debug) { - std::map matDDD, matDD4Hep; - std::map solidDDD, solidDD4Hep; - std::map lvDDD, lvDD4Hep; - std::map pvDDD, pvDD4Hep; +void CompareFiles(const char* fileFile1, const char* fileFile2, int type, int files, int mode, int debug) { + std::map matFile1, matFile2; + std::map solidFile1, solidFile2; + std::map lvFile1, lvFile2; + std::map pvFile1, pvFile2; + bool typeFile1 = ((files % 10) == 0); + bool typeFile2 = (((files / 10) % 10) == 0); char buffer[100]; std::string name; - std::ifstream fInput1(fileDDD); - unsigned int sizeDDD(0), sizeDD4Hep(0); + std::ifstream fInput1(fileFile1); + unsigned int sizeFile1(0), sizeFile2(0); if (!fInput1.good()) { - std::cout << "Cannot open file " << fileDDD << std::endl; + std::cout << "Cannot open file " << fileFile1 << std::endl; } else { while (fInput1.getline(buffer, 100)) { std::vector items = splitString(std::string(buffer)); - name = ((mode == 1) ? removeExtraName(items[0], debug) : items[0]); + if (typeFile1) { + name = ((mode == 1) ? removeExtraName(items[0], debug) : items[0]); + } else { + name = reducedName(items[0], debug); + } double r1 = (items.size() > 1) ? atof(items[1].c_str()) : 0; double r2 = (items.size() > 2) ? atof(items[2].c_str()) : 0; double r3 = (items.size() > 3) ? atof(items[3].c_str()) : 0; if (type == 0) { - auto it = matDDD.find(name); - if (it == matDDD.end()) - matDDD[name] = materials(1, r1, r2); + auto it = matFile1.find(name); + if (it == matFile1.end()) + matFile1[name] = materials(1, r1, r2); else ++((it->second).occ); } else if (type == 1) { - auto it = solidDDD.find(name); - if (it == solidDDD.end()) - solidDDD[name] = solids(1, r1); + auto it = solidFile1.find(name); + if (it == solidFile1.end()) + solidFile1[name] = solids(1, r1); else ++((it->second).occ); } else if (type == 2) { - auto it = lvDDD.find(name); - if (it == lvDDD.end()) - lvDDD[name] = lvs(1, r1); + auto it = lvFile1.find(name); + if (it == lvFile1.end()) + lvFile1[name] = lvs(1, r1); else ++((it->second).occ); } else { - auto it = pvDDD.find(name); - if (it == pvDDD.end()) - pvDDD[name] = pvs(1, r1, r2, r3); + auto it = pvFile1.find(name); + if (it == pvFile1.end()) + pvFile1[name] = pvs(1, r1, r2, r3); else ++((it->second).occ); } } fInput1.close(); - sizeDDD = - ((type == 0) ? matDDD.size() : ((type == 1) ? solidDDD.size() : ((type == 2) ? lvDDD.size() : pvDDD.size()))); + sizeFile1 = ((type == 0) ? matFile1.size() + : ((type == 1) ? solidFile1.size() : ((type == 2) ? lvFile1.size() : pvFile1.size()))); } - std::ifstream fInput2(fileDD4Hep); + std::ifstream fInput2(fileFile2); if (!fInput2.good()) { - std::cout << "Cannot open file " << fileDD4Hep << std::endl; + std::cout << "Cannot open file " << fileFile2 << std::endl; } else { while (fInput2.getline(buffer, 100)) { std::vector items = splitString(std::string(buffer)); - name = reducedName(items[0], debug); + if (typeFile2) { + name = ((mode == 1) ? removeExtraName(items[0], debug) : items[0]); + } else { + name = reducedName(items[0], debug); + } double r1 = (items.size() > 1) ? atof(items[1].c_str()) : 0; double r2 = (items.size() > 2) ? atof(items[2].c_str()) : 0; double r3 = (items.size() > 3) ? atof(items[3].c_str()) : 0; if (type == 0) { - auto it = matDD4Hep.find(name); - if (it == matDD4Hep.end()) - matDD4Hep[name] = materials(1, r1, r2); + auto it = matFile2.find(name); + if (it == matFile2.end()) + matFile2[name] = materials(1, r1, r2); else ++((it->second).occ); } else if (type == 1) { - auto it = solidDD4Hep.find(name); - if (it == solidDD4Hep.end()) - solidDD4Hep[name] = solids(1, r1); + auto it = solidFile2.find(name); + if (it == solidFile2.end()) + solidFile2[name] = solids(1, r1); else ++((it->second).occ); } else if (type == 2) { - auto it = lvDD4Hep.find(name); - if (it == lvDD4Hep.end()) - lvDD4Hep[name] = lvs(1, r1); + auto it = lvFile2.find(name); + if (it == lvFile2.end()) + lvFile2[name] = lvs(1, r1); else ++((it->second).occ); } else { - auto it = pvDD4Hep.find(name); - if (it == pvDD4Hep.end()) - pvDD4Hep[name] = pvs(1, r1, r2, r3); + auto it = pvFile2.find(name); + if (it == pvFile2.end()) + pvFile2[name] = pvs(1, r1, r2, r3); else ++((it->second).occ); } } fInput2.close(); - sizeDD4Hep = ((type == 0) ? matDD4Hep.size() - : ((type == 1) ? solidDD4Hep.size() : ((type == 2) ? lvDD4Hep.size() : pvDD4Hep.size()))); + sizeFile2 = ((type == 0) ? matFile2.size() + : ((type == 1) ? solidFile2.size() : ((type == 2) ? lvFile2.size() : pvFile2.size()))); } - std::cout << "Reads " << sizeDDD << " names from " << fileDDD << " and " << sizeDD4Hep << " names from " << fileDD4Hep - << std::endl; + std::cout << "Reads " << sizeFile1 << " names from " << fileFile1 << " and " << sizeFile2 << " names from " + << fileFile2 << std::endl; - std::cout << "\nMore than one entry for a given name in " << fileDDD << std::endl; + std::cout << "\nMore than one entry for a given name in " << fileFile1 << std::endl; if (type == 0) { - myPrint1(matDDD); + myPrint1(matFile1); } else if (type == 1) { - myPrint1(solidDDD); + myPrint1(solidFile1); } else if (type == 2) { - myPrint1(lvDDD); + myPrint1(lvFile1); } else { - myPrint1(pvDDD); + myPrint1(pvFile1); } - std::cout << "\nMore than one entry for a given name in " << fileDD4Hep << std::endl; + std::cout << "\nMore than one entry for a given name in " << fileFile2 << std::endl; if (type == 0) { - myPrint1(matDD4Hep); + myPrint1(matFile2); } else if (type == 1) { - myPrint1(solidDD4Hep); + myPrint1(solidFile2); } else if (type == 2) { - myPrint1(lvDD4Hep); + myPrint1(lvFile2); } else { - myPrint1(pvDD4Hep); + myPrint1(pvFile2); } - std::cout << "\nEntry in " << fileDDD << " not in " << fileDD4Hep << std::endl; + std::cout << "\nEntry in " << fileFile1 << " not in " << fileFile2 << std::endl; if (type == 0) { - myPrint2(matDDD, matDD4Hep); + myPrint2(matFile1, matFile2); } else if (type == 1) { - myPrint2(solidDDD, solidDD4Hep); + myPrint2(solidFile1, solidFile2); } else if (type == 2) { - myPrint2(lvDDD, lvDD4Hep); + myPrint2(lvFile1, lvFile2); } else { - myPrint2(pvDDD, pvDD4Hep); + myPrint2(pvFile1, pvFile2); } - std::cout << "\nEntry in " << fileDD4Hep << " not in " << fileDDD << std::endl; + std::cout << "\nEntry in " << fileFile2 << " not in " << fileFile1 << std::endl; if (type == 0) { - myPrint2(matDD4Hep, matDDD); + myPrint2(matFile2, matFile1); } else if (type == 1) { - myPrint2(solidDD4Hep, solidDDD); + myPrint2(solidFile2, solidFile1); } else if (type == 2) { - myPrint2(lvDD4Hep, lvDDD); + myPrint2(lvFile2, lvFile1); } else { - myPrint2(pvDD4Hep, pvDDD); + myPrint2(pvFile2, pvFile1); } //Now type specific changes - std::cout << "\nEntries in " << fileDDD << " and " << fileDD4Hep << " do not match in the content\n"; + std::cout << "\nEntries in " << fileFile1 << " and " << fileFile2 << " do not match in the content\n"; const double denmin = 0.0001; int kount1(0), kount2(0); if (type == 0) { const double tol1 = 0.00001; - for (auto it1 : matDDD) { - auto it2 = matDD4Hep.find(it1.first); - if (it2 != matDD4Hep.end()) { + for (auto it1 : matFile1) { + auto it2 = matFile2.find(it1.first); + if (it2 != matFile2.end()) { ++kount1; double rdif = 0.5 * (it1.second.radl - it2->second.radl) / std::max(denmin, (it1.second.radl + it2->second.radl)); @@ -274,8 +287,8 @@ void CompareFiles(const char* fileDDD, const char* fileDD4Hep, int type, int mod 0.5 * (it1.second.intl - it2->second.intl) / std::max(denmin, (it1.second.intl + it2->second.intl)); if ((std::abs(rdif) > tol1) || (std::abs(idif) > tol1)) { ++kount2; - std::cout << it1.first << " Radiation Length " << it1.second.radl << ":" << it2->second.radl << ":" << rdif - << " Interaction Length " << it1.second.intl << ":" << it2->second.intl << ":" << idif << std::endl; + std::cout << it1.first << " X0 " << it1.second.radl << ":" << it2->second.radl << ":" << rdif << " #L " + << it1.second.intl << ":" << it2->second.intl << ":" << idif << std::endl; } } } @@ -283,9 +296,9 @@ void CompareFiles(const char* fileDDD, const char* fileDD4Hep, int type, int mod << " or more\n"; } else if (type == 1) { const double tol2 = 0.0001; - for (auto it1 : solidDDD) { - auto it2 = solidDD4Hep.find(it1.first); - if (it2 != solidDD4Hep.end()) { + for (auto it1 : solidFile1) { + auto it2 = solidFile2.find(it1.first); + if (it2 != solidFile2.end()) { ++kount1; double vdif = 0.5 * (it1.second.volume - it2->second.volume) / std::max(denmin, (it1.second.volume + it2->second.volume)); @@ -300,9 +313,9 @@ void CompareFiles(const char* fileDDD, const char* fileDD4Hep, int type, int mod << " or more\n"; } else if (type == 2) { const double tol3 = 0.0001; - for (auto it1 : lvDDD) { - auto it2 = lvDD4Hep.find(it1.first); - if (it2 != lvDD4Hep.end()) { + for (auto it1 : lvFile1) { + auto it2 = lvFile2.find(it1.first); + if (it2 != lvFile2.end()) { ++kount1; double vdif = 0.5 * (it1.second.mass - it2->second.mass) / std::max(denmin, (it1.second.mass + it2->second.mass)); @@ -316,9 +329,9 @@ void CompareFiles(const char* fileDDD, const char* fileDD4Hep, int type, int mod << " or more\n"; } else { const double tol4 = 0.0001; - for (auto it1 : pvDDD) { - auto it2 = pvDD4Hep.find(it1.first); - if (it2 != pvDD4Hep.end()) { + for (auto it1 : pvFile1) { + auto it2 = pvFile2.find(it1.first); + if (it2 != pvFile2.end()) { ++kount1; double xdif = (it1.second.xx - it2->second.xx); double ydif = (it1.second.yy - it2->second.yy); @@ -337,11 +350,12 @@ void CompareFiles(const char* fileDDD, const char* fileDD4Hep, int type, int mod } int main(int argc, char* argv[]) { - if (argc <= 4) { + if (argc <= 5) { std::cout << "Please give a minimum of 2 arguments \n" - << "input file name from the DDD run\n" - << "input file name from the DD4Hep run\n" + << "name of the first input file\n" + << "name of the second input file\n" << "type (Material:0, Solid:1, LV:2, PV:3\n" + << "files (10 if first file from DDD and second from DD4HEP)\n" << "mode (treat the name for DDD or not == needed for PV)\n" << "debug flag (0 for minimum printout)\n" << std::endl; @@ -353,8 +367,9 @@ int main(int argc, char* argv[]) { int type = ((argc > 3) ? atoi(argv[3]) : 0); if (type < 0 || type > 3) type = 0; - int mode = ((argc > 4) ? atoi(argv[4]) : 0); - int debug = ((argc > 5) ? atoi(argv[5]) : 0); - CompareFiles(infile1, infile2, type, mode, debug); + int files = ((argc > 4) ? atoi(argv[4]) : 10); + int mode = ((argc > 5) ? atoi(argv[5]) : 0); + int debug = ((argc > 6) ? atoi(argv[6]) : 0); + CompareFiles(infile1, infile2, type, files, mode, debug); return 0; } diff --git a/SimG4Core/PrintGeomInfo/test/python/g4DumpGeometry_cfg.py b/SimG4Core/PrintGeomInfo/test/python/g4DumpGeometry_cfg.py index 31af188f60ad0..691fdf90626ec 100644 --- a/SimG4Core/PrintGeomInfo/test/python/g4DumpGeometry_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/g4DumpGeometry_cfg.py @@ -2,11 +2,11 @@ process = cms.Process("G4PrintGeometry") -#process.load('Configuration.Geometry.GeometryExtended2015_cff') -process.load('Configuration.Geometry.GeometryExtended2017_cff') -#process.load('Configuration.Geometry.GeometryExtended2018_cff') -#process.load('Configuration.Geometry.GeometryExtended2023D17_cff') -#process.load('Configuration.Geometry.GeometryExtended2026D45_cff') +#process.load('Configuration.Geometry.GeometryExtended2015Reco_cff') +process.load('Configuration.Geometry.GeometryExtended2017Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2021Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2026D77Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2026D83Reco_cff') from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import * process = checkOverlap(process) @@ -19,7 +19,7 @@ # Geant4 geometry check process.g4SimHits.G4CheckOverlap.OutputBaseName = cms.string("2017") -#process.g4SimHits.G4CheckOverlap.OutputBaseName = cms.string("2026D45") +#process.g4SimHits.G4CheckOverlap.OutputBaseName = cms.string("2026D77") process.g4SimHits.G4CheckOverlap.OverlapFlag = cms.bool(False) process.g4SimHits.G4CheckOverlap.Tolerance = cms.double(0.0) process.g4SimHits.G4CheckOverlap.Resolution = cms.int32(10000) diff --git a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheck2026_cfg.py b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheck2026_cfg.py index 916e82c51b1a1..e543c1dce58e0 100644 --- a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheck2026_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheck2026_cfg.py @@ -3,8 +3,8 @@ from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 process = cms.Process('SIM',Phase2C11) -#process.load('Configuration.Geometry.GeometryExtended2026D76_cff') -process.load('Configuration.Geometry.GeometryExtended2026D83_cff') +#process.load('Configuration.Geometry.GeometryExtended2026D77Reco_cff') +process.load('Configuration.Geometry.GeometryExtended2026D83Reco_cff') process.load('FWCore.MessageService.MessageLogger_cfi') diff --git a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckCalo_cfg.py b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckCalo_cfg.py index 3496839bf6cc0..8c90905c28fa8 100644 --- a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckCalo_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckCalo_cfg.py @@ -2,11 +2,11 @@ process = cms.Process("G4PrintGeometry") -#process.load('Configuration.Geometry.GeometryExtended2015_cff') -#process.load('Configuration.Geometry.GeometryExtended2017_cff') -process.load('Configuration.Geometry.GeometryExtended2021_cff') -#process.load('Configuration.Geometry.GeometryExtended2026D17_cff') -#process.load('Configuration.Geometry.GeometryExtended2026D45_cff') +#process.load('Configuration.Geometry.GeometryExtended2015Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2017Reco_cff') +process.load('Configuration.Geometry.GeometryExtended2021Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2026D77Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2026D83Reco_cff') from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import * process = checkOverlap(process) diff --git a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckDD4Hep_cfg.py b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckDD4Hep_cfg.py index 49b42c988186a..be7f0d746eca6 100644 --- a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckDD4Hep_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckDD4Hep_cfg.py @@ -4,7 +4,7 @@ process = cms.Process("G4PrintGeometry",Run3_dd4hep) -process.load('Configuration.Geometry.GeometryDD4hepExtended2021_cff') +process.load('Configuration.Geometry.GeometryDD4hepExtended2021Reco_cff') from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import * process = checkOverlap(process) diff --git a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckEcal_cfg.py b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckEcal_cfg.py index e7007b465fd3c..620e958f26170 100644 --- a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckEcal_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckEcal_cfg.py @@ -2,11 +2,11 @@ process = cms.Process("G4PrintGeometry") -#process.load('Configuration.Geometry.GeometryExtended2015_cff') -#process.load('Configuration.Geometry.GeometryExtended2017_cff') -process.load('Configuration.Geometry.GeometryExtended2021_cff') -#process.load('Configuration.Geometry.GeometryExtended2026D17_cff') -#process.load('Configuration.Geometry.GeometryExtended2026D45_cff') +#process.load('Configuration.Geometry.GeometryExtended2015Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2017Reco_cff') +process.load('Configuration.Geometry.GeometryExtended2021Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2026D77Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2026D83Reco_cff') from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import * process = checkOverlap(process) @@ -15,7 +15,7 @@ process.g4SimHits.CheckGeometry = True # Geant4 geometry check -process.g4SimHits.G4CheckOverlap.OutputBaseName = cms.string("Ecal2018") +process.g4SimHits.G4CheckOverlap.OutputBaseName = cms.string("Ecal2021") process.g4SimHits.G4CheckOverlap.OverlapFlag = cms.bool(True) process.g4SimHits.G4CheckOverlap.Tolerance = cms.double(0.0) process.g4SimHits.G4CheckOverlap.Resolution = cms.int32(10000) diff --git a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckHGCal_cfg.py b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckHGCal_cfg.py index 55cf610dcfd6d..d9faff4a9b67f 100644 --- a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckHGCal_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckHGCal_cfg.py @@ -2,8 +2,8 @@ process = cms.Process("G4PrintGeometry") -#process.load('Configuration.Geometry.GeometryExtended2026D17_cff') -process.load('Configuration.Geometry.GeometryExtended2026D45_cff') +#process.load('Configuration.Geometry.GeometryExtended2026D77Reco_cff') +process.load('Configuration.Geometry.GeometryExtended2026D83Reco_cff') from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import * process = checkOverlap(process) @@ -12,7 +12,7 @@ process.g4SimHits.CheckGeometry = True # Geant4 geometry check -process.g4SimHits.G4CheckOverlap.OutputBaseName = cms.string("HGcal2026D45") +process.g4SimHits.G4CheckOverlap.OutputBaseName = cms.string("HGcal2026D83") process.g4SimHits.G4CheckOverlap.OverlapFlag = cms.bool(True) process.g4SimHits.G4CheckOverlap.Tolerance = cms.double(0.0) process.g4SimHits.G4CheckOverlap.Resolution = cms.int32(10000) diff --git a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckMuon_cfg.py b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckMuon_cfg.py index b0e77b630896e..596256fb76c98 100644 --- a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckMuon_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckMuon_cfg.py @@ -2,12 +2,13 @@ process = cms.Process("G4PrintGeometry") -#process.load('Configuration.Geometry.GeometryExtended2015_cff') -#process.load('Configuration.Geometry.GeometryExtended2017_cff') -#process.load('Configuration.Geometry.GeometryExtended2021_cff') -#process.load('Configuration.Geometry.GeometryExtended2026D17_cff') -#process.load('Configuration.Geometry.GeometryExtended2026D45_cff') +#process.load('Configuration.Geometry.GeometryExtended2015Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2017Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2021Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2026D77Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2026D83Reco_cff') process.load('SimG4Core.PrintGeomInfo.cmsMuon2017XML_cfi') +process.load('Geometry.MuonNumbering.muonGeometryConstants_cff') from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import * process = checkOverlap(process) diff --git a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckTracker_cfg.py b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckTracker_cfg.py index aa558a9054a82..9ec07530db51e 100644 --- a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckTracker_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckTracker_cfg.py @@ -2,12 +2,11 @@ process = cms.Process("G4PrintGeometry") - -#process.load('Configuration.Geometry.GeometryExtended2015_cff') -#process.load('Configuration.Geometry.GeometryExtended2017_cff') -process.load('Configuration.Geometry.GeometryExtended2021_cff') -#process.load('Configuration.Geometry.GeometryExtended2026D17_cff') -#process.load('Configuration.Geometry.GeometryExtended2026D45_cff') +#process.load('Configuration.Geometry.GeometryExtended2015Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2017Reco_cff') +process.load('Configuration.Geometry.GeometryExtended2021Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2026D17Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2026D45Reco_cff') from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import * process = checkOverlap(process) diff --git a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheck_cfg.py b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheck_cfg.py index 1ec314574070b..4aa2003e601bc 100644 --- a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheck_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheck_cfg.py @@ -2,12 +2,12 @@ #from Configuration.Eras.Era_Run2_cff import Run2 #process = cms.Process('SIM',Run2) -#process.load('Configuration.Geometry.GeometryExtended2015_cff') -#process.load('Configuration.Geometry.GeometryExtended2017_cff') +#process.load('Configuration.Geometry.GeometryExtended2015Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2017Reco_cff') from Configuration.Eras.Era_Run3_cff import Run3 process = cms.Process('SIM',Run3) -process.load('Configuration.Geometry.GeometryExtended2021_cff') +process.load('Configuration.Geometry.GeometryExtended2021Reco_cff') process.load('FWCore.MessageService.MessageLogger_cfi') diff --git a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheck_dd4hep_cfg.py b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheck_dd4hep_cfg.py index 01718f1c4b691..bb67118d334bd 100644 --- a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheck_dd4hep_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheck_dd4hep_cfg.py @@ -2,7 +2,7 @@ from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep process = cms.Process('G4PrintGeometry',Run3_dd4hep) -process.load('Configuration.Geometry.GeometryDD4hepExtended2021_cff') +process.load('Configuration.Geometry.GeometryDD4hepExtended2021Reco_cff') process.load('FWCore.MessageService.MessageLogger_cfi') diff --git a/SimG4Core/PrintGeomInfo/test/python/runDD4HepBigXML_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runDD4HepBigXML_cfg.py new file mode 100644 index 0000000000000..564193e4fd96b --- /dev/null +++ b/SimG4Core/PrintGeomInfo/test/python/runDD4HepBigXML_cfg.py @@ -0,0 +1,47 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep +process = cms.Process('G4PrintGeometry',Run3_dd4hep) +process.load("Configuration.Geometry.GeometryDD4hep_cff") +process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cff") +process.load("Geometry.EcalCommonData.ecalSimulationParameters_cff") +process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cff") +process.load("Geometry.HcalCommonData.hcalDDDRecConstants_cfi") +process.load("Geometry.MuonNumbering.muonGeometryConstants_cff") +process.load("Geometry.MuonNumbering.muonOffsetESProducer_cff") +process.load('FWCore.MessageService.MessageLogger_cfi') + +from SimG4Core.PrintGeomInfo.g4PrintGeomInfo_cfi import * + +process = printGeomInfo(process) + +if hasattr(process,'MessageLogger'): + process.MessageLogger.G4cerr=dict() + process.MessageLogger.G4cout=dict() + +process.DDDetectorESProducer.confGeomXMLFiles = cms.FileInPath("SimG4Core/PrintGeomInfo/data/dd4hep/cmsExtendedGeometry2021.xml") + +process.g4SimHits.Watchers = cms.VPSet(cms.PSet( + DumpSummary = cms.untracked.bool(True), + DumpLVTree = cms.untracked.bool(False), + DumpMaterial = cms.untracked.bool(False), + DumpLVList = cms.untracked.bool(False), + DumpLV = cms.untracked.bool(False), + DumpSolid = cms.untracked.bool(False), + DumpAttributes = cms.untracked.bool(False), + DumpPV = cms.untracked.bool(False), + DumpRotation = cms.untracked.bool(False), + DumpReplica = cms.untracked.bool(False), + DumpTouch = cms.untracked.bool(False), + DumpSense = cms.untracked.bool(False), + DD4Hep = cms.untracked.bool(True), + Name = cms.untracked.string(''), + Names = cms.untracked.vstring(''), + MaterialFileName = cms.untracked.string('matfileBigDD4Hep.txt'), + SolidFileName = cms.untracked.string('solidfileBigDD4Hep.txt'), + LVFileName = cms.untracked.string('lvfileBigDD4Hep.txt'), + PVFileName = cms.untracked.string('pvfileBigDD4Hep.txt'), + TouchFileName = cms.untracked.string('touchfileBigDD4Hep.txt'), + FileDetail = cms.untracked.bool(True), + type = cms.string('PrintGeomInfoAction') +)) diff --git a/SimG4Core/PrintGeomInfo/test/python/runDD4HepDB_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runDD4HepDB_cfg.py new file mode 100644 index 0000000000000..9afd8c037350f --- /dev/null +++ b/SimG4Core/PrintGeomInfo/test/python/runDD4HepDB_cfg.py @@ -0,0 +1,42 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep +process = cms.Process('G4PrintGeometry',Run3_dd4hep) +process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.GeometrySimDB_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, '120X_mcRun3_2021_realistic_dd4hep_v1', '') + +from SimG4Core.PrintGeomInfo.g4PrintGeomInfo_cfi import * + +process = printGeomInfo(process) + +if hasattr(process,'MessageLogger'): + process.MessageLogger.G4cerr=dict() + process.MessageLogger.G4cout=dict() + +process.g4SimHits.Watchers = cms.VPSet(cms.PSet( + DumpSummary = cms.untracked.bool(True), + DumpLVTree = cms.untracked.bool(False), + DumpMaterial = cms.untracked.bool(False), + DumpLVList = cms.untracked.bool(False), + DumpLV = cms.untracked.bool(False), + DumpSolid = cms.untracked.bool(False), + DumpAttributes = cms.untracked.bool(False), + DumpPV = cms.untracked.bool(False), + DumpRotation = cms.untracked.bool(False), + DumpReplica = cms.untracked.bool(False), + DumpTouch = cms.untracked.bool(False), + DumpSense = cms.untracked.bool(False), + DD4Hep = cms.untracked.bool(True), + Name = cms.untracked.string(''), + Names = cms.untracked.vstring(''), + MaterialFileName = cms.untracked.string('matfileDD4HepDB.txt'), + SolidFileName = cms.untracked.string('solidfileDD4HepDB.txt'), + LVFileName = cms.untracked.string('lvfileDD4HepDB.txt'), + PVFileName = cms.untracked.string('pvfileDD4HepDB.txt'), + TouchFileName = cms.untracked.string('touchfileDD4HepDB.txt'), + FileDetail = cms.untracked.bool(True), + type = cms.string('PrintGeomInfoAction') +)) diff --git a/SimG4Core/PrintGeomInfo/test/python/runDD4HEP_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runDD4HepXML_cfg.py similarity index 91% rename from SimG4Core/PrintGeomInfo/test/python/runDD4HEP_cfg.py rename to SimG4Core/PrintGeomInfo/test/python/runDD4HepXML_cfg.py index 0f4fabab119c3..369a04054df99 100644 --- a/SimG4Core/PrintGeomInfo/test/python/runDD4HEP_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runDD4HepXML_cfg.py @@ -2,11 +2,12 @@ from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep process = cms.Process('G4PrintGeometry',Run3_dd4hep) -process.load('Configuration.Geometry.GeometryDD4hepExtended2021_cff') +process.load('Configuration.Geometry.GeometryDD4hepExtended2021Reco_cff') #from Configuration.Eras.Era_Phase2C11_dd4hep_cff import Phase2C11_dd4hep #process = cms.Process('G4PrintGeometry',Phase2C11_dd4hep) -#process.load('Configuration.Geometry.GeometryDD4hepExtended2026D76_cff') +#process.load('Configuration.Geometry.GeometryDD4hepExtended2026D77Reco_cff') +#process.load('Configuration.Geometry.GeometryDD4hepExtended2026D83Reco_cff') process.load('FWCore.MessageService.MessageLogger_cfi') from SimG4Core.PrintGeomInfo.g4PrintGeomInfo_cfi import * diff --git a/SimG4Core/PrintGeomInfo/test/python/runDDDBigXML_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runDDDBigXML_cfg.py new file mode 100644 index 0000000000000..5a9280f668273 --- /dev/null +++ b/SimG4Core/PrintGeomInfo/test/python/runDDDBigXML_cfg.py @@ -0,0 +1,45 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_cff import Run3 +process = cms.Process('G4PrintGeometry',Run3) +process.load('SimG4Core.PrintGeomInfo.cmsExtendedGeometry2021_cfi') +process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cff") +process.load("Geometry.EcalCommonData.ecalSimulationParameters_cff") +process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cff") +process.load("Geometry.HcalCommonData.hcalDDDRecConstants_cfi") +process.load("Geometry.MuonNumbering.muonGeometryConstants_cff") +process.load("Geometry.MuonNumbering.muonOffsetESProducer_cff") +process.load('FWCore.MessageService.MessageLogger_cfi') + +from SimG4Core.PrintGeomInfo.g4PrintGeomInfo_cfi import * + +process = printGeomInfo(process) + +if hasattr(process,'MessageLogger'): + process.MessageLogger.G4cerr=dict() + process.MessageLogger.G4cout=dict() + +process.g4SimHits.Watchers = cms.VPSet(cms.PSet( + DumpSummary = cms.untracked.bool(True), + DumpLVTree = cms.untracked.bool(False), + DumpMaterial = cms.untracked.bool(False), + DumpLVList = cms.untracked.bool(False), + DumpLV = cms.untracked.bool(False), + DumpSolid = cms.untracked.bool(False), + DumpAttributes = cms.untracked.bool(False), + DumpPV = cms.untracked.bool(False), + DumpRotation = cms.untracked.bool(False), + DumpReplica = cms.untracked.bool(False), + DumpTouch = cms.untracked.bool(False), + DumpSense = cms.untracked.bool(False), + DD4Hep = cms.untracked.bool(False), + Name = cms.untracked.string(''), + Names = cms.untracked.vstring(''), + MaterialFileName = cms.untracked.string('matfileBigDDD.txt'), + SolidFileName = cms.untracked.string('solidfileBigDDD.txt'), + LVFileName = cms.untracked.string('lvfileBigDDD.txt'), + PVFileName = cms.untracked.string('pvfileBigDDD.txt'), + TouchFileName = cms.untracked.string('touchfileBigDDD.txt'), + FileDetail = cms.untracked.bool(True), + type = cms.string('PrintGeomInfoAction') +)) diff --git a/SimG4Core/PrintGeomInfo/test/python/runDDDDB_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runDDDDB_cfg.py new file mode 100644 index 0000000000000..f964ca32f164b --- /dev/null +++ b/SimG4Core/PrintGeomInfo/test/python/runDDDDB_cfg.py @@ -0,0 +1,44 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_cff import Run3 +process = cms.Process('G4PrintGeometry',Run3) +process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.GeometrySimDB_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2021_realistic', '') + +process.load('FWCore.MessageService.MessageLogger_cfi') + +from SimG4Core.PrintGeomInfo.g4PrintGeomInfo_cfi import * + +process = printGeomInfo(process) + +if hasattr(process,'MessageLogger'): + process.MessageLogger.G4cerr=dict() + process.MessageLogger.G4cout=dict() + +process.g4SimHits.Watchers = cms.VPSet(cms.PSet( + DumpSummary = cms.untracked.bool(True), + DumpLVTree = cms.untracked.bool(False), + DumpMaterial = cms.untracked.bool(False), + DumpLVList = cms.untracked.bool(False), + DumpLV = cms.untracked.bool(False), + DumpSolid = cms.untracked.bool(False), + DumpAttributes = cms.untracked.bool(False), + DumpPV = cms.untracked.bool(False), + DumpRotation = cms.untracked.bool(False), + DumpReplica = cms.untracked.bool(False), + DumpTouch = cms.untracked.bool(False), + DumpSense = cms.untracked.bool(False), + DD4Hep = cms.untracked.bool(False), + Name = cms.untracked.string(''), + Names = cms.untracked.vstring(''), + MaterialFileName = cms.untracked.string('matfileDDDDB.txt'), + SolidFileName = cms.untracked.string('solidfileDDDDB.txt'), + LVFileName = cms.untracked.string('lvfileDDDDB.txt'), + PVFileName = cms.untracked.string('pvfileDDDDB.txt'), + TouchFileName = cms.untracked.string('touchfileDDDDB.txt'), + FileDetail = cms.untracked.bool(True), + type = cms.string('PrintGeomInfoAction') +)) diff --git a/SimG4Core/PrintGeomInfo/test/python/runDDD_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runDDDXML_cfg.py similarity index 84% rename from SimG4Core/PrintGeomInfo/test/python/runDDD_cfg.py rename to SimG4Core/PrintGeomInfo/test/python/runDDDXML_cfg.py index 0ce969ee0229a..0538de1a251af 100644 --- a/SimG4Core/PrintGeomInfo/test/python/runDDD_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runDDDXML_cfg.py @@ -2,17 +2,17 @@ #from Configuration.Eras.Era_Run2_cff import Run2 #process = cms.Process('G4PrintGeometry',Run2) -#process.load('Configuration.Geometry.GeometryExtended2015_cff') -#process.load('Configuration.Geometry.GeometryExtended2017_cff') +#process.load('Configuration.Geometry.GeometryExtended2015Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2017Reco_cff') from Configuration.Eras.Era_Run3_cff import Run3 process = cms.Process('G4PrintGeometry',Run3) -process.load('Configuration.Geometry.GeometryExtended2021_cff') +process.load('Configuration.Geometry.GeometryExtended2021Reco_cff') #from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 #process = cms.Process('G4PrintGeometry',Phase2C11) -#process.load('Configuration.Geometry.GeometryExtended2026D77_cff') -#process.load('Configuration.Geometry.GeometryExtended2026D83_cff') +#process.load('Configuration.Geometry.GeometryExtended2026D77Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2026D83Reco_cff') process.load('FWCore.MessageService.MessageLogger_cfi') diff --git a/SimG4Core/PrintGeomInfo/test/python/runSens_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runSens_cfg.py index 078dfe5bb0c05..32b836f89fca3 100644 --- a/SimG4Core/PrintGeomInfo/test/python/runSens_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runSens_cfg.py @@ -3,12 +3,13 @@ process = cms.Process("PrintGeom") process.load('FWCore.MessageService.MessageLogger_cfi') -process.load('Configuration.Geometry.GeometryExtended2021_cff') -#process.load('Configuration.Geometry.GeometryExtended2026D41_cff') +process.load('Configuration.Geometry.GeometryExtended2021Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2026D41Reco_cff') #process.load('Geometry.CMSCommonData.cmsIdealGeometryXML_cfi') #process.load('Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi') #process.load("Geometry.EcalCommonData.ecalSimulationParameters_cff") #process.load('Geometry.HcalCommonData.hcalDDDSimConstants_cff') +#process.load('Geometry.HcalCommonData.hcalDDDRecConstants_cfi') process.MessageLogger.cerr.enable = False process.MessageLogger.files.SensDet = dict(extension="txt") diff --git a/SimG4Core/PrintGeomInfo/test/python/runSummary_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runSummary_cfg.py index e6d0d90319b33..f83807b3815bd 100644 --- a/SimG4Core/PrintGeomInfo/test/python/runSummary_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runSummary_cfg.py @@ -3,12 +3,12 @@ process = cms.Process("G4PrintGeometry") #process.load('Configuration.Geometry.GeometryIdeal_cff') -#process.load('Configuration.Geometry.GeometryExtended_cff') -#process.load('Configuration.Geometry.GeometryExtended2015_cff') -#process.load('Configuration.Geometry.GeometryExtended2017_cff') -process.load('Configuration.Geometry.GeometryExtended2021_cff') -#process.load('Configuration.Geometry.GeometryExtended2026D77_cff') -#process.load('Configuration.Geometry.GeometryExtended2026D83_cff') +#process.load('Configuration.Geometry.GeometryExtendedReco_cff') +#process.load('Configuration.Geometry.GeometryExtended2015Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2017Reco_cff') +process.load('Configuration.Geometry.GeometryExtended2021Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2026D77Reco_cff') +#process.load('Configuration.Geometry.GeometryExtended2026D83Reco_cff') process.load('FWCore.MessageService.MessageLogger_cfi') diff --git a/SimG4Core/PrintGeomInfo/test/python/run_MaterialBudgeInfo_cfg.py b/SimG4Core/PrintGeomInfo/test/python/run_MaterialBudgeInfo_cfg.py index 8914396c92c3b..82239fa27a13d 100644 --- a/SimG4Core/PrintGeomInfo/test/python/run_MaterialBudgeInfo_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/run_MaterialBudgeInfo_cfg.py @@ -7,6 +7,7 @@ process.load('Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi') process.load("Geometry.EcalCommonData.ecalSimulationParameters_cff") process.load('Geometry.HcalCommonData.hcalDDDSimConstants_cff') +process.load('Geometry.HcalCommonData.hcalDDDRecConstants_cfi') process.MessageLogger.cerr.enable = False process.MessageLogger.files.MatBudget = dict(extension = "txt") diff --git a/SimGeneral/Debugging/test/BuildFile.xml b/SimGeneral/Debugging/test/BuildFile.xml index bfebb9a82fac3..1f2a46f195910 100644 --- a/SimGeneral/Debugging/test/BuildFile.xml +++ b/SimGeneral/Debugging/test/BuildFile.xml @@ -8,8 +8,6 @@ - - diff --git a/SimGeneral/TrackingAnalysis/interface/TrackingParticleNumberOfLayers.h b/SimGeneral/TrackingAnalysis/interface/TrackingParticleNumberOfLayers.h index 8d62182dd64e5..2f5c14f2b3231 100644 --- a/SimGeneral/TrackingAnalysis/interface/TrackingParticleNumberOfLayers.h +++ b/SimGeneral/TrackingAnalysis/interface/TrackingParticleNumberOfLayers.h @@ -7,6 +7,8 @@ #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h" #include "SimDataFormats/TrackingHit/interface/PSimHit.h" +class TrackerTopology; + /** * This class calculates the number of tracker layers, pixel layers, * and strip mono+stereo layers "crossed" by TrackingParticle. @@ -50,7 +52,7 @@ class TrackingParticleNumberOfLayers { std::tuple>, std::unique_ptr>, std::unique_ptr>> - calculate(const edm::Handle &tps, const edm::EventSetup &iSetup) const; + calculate(const edm::Handle &tps, const TrackerTopology &tTopo) const; private: // used as multimap, but faster diff --git a/SimGeneral/TrackingAnalysis/plugins/TrackingParticleNumberOfLayersProducer.cc b/SimGeneral/TrackingAnalysis/plugins/TrackingParticleNumberOfLayersProducer.cc index f20ebc5a9830b..e4c493ffe4670 100644 --- a/SimGeneral/TrackingAnalysis/plugins/TrackingParticleNumberOfLayersProducer.cc +++ b/SimGeneral/TrackingAnalysis/plugins/TrackingParticleNumberOfLayersProducer.cc @@ -1,9 +1,11 @@ #include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "SimGeneral/TrackingAnalysis/interface/TrackingParticleNumberOfLayers.h" @@ -23,10 +25,12 @@ class TrackingParticleNumberOfLayersProducer : public edm::global::EDProducer<> private: edm::EDGetTokenT tpToken_; std::vector>> simHitTokens_; + edm::ESGetToken tTopoToken_; }; TrackingParticleNumberOfLayersProducer::TrackingParticleNumberOfLayersProducer(const edm::ParameterSet &iConfig) - : tpToken_(consumes(iConfig.getParameter("trackingParticles"))) { + : tpToken_(consumes(iConfig.getParameter("trackingParticles"))), + tTopoToken_(esConsumes()) { for (const auto &tag : iConfig.getParameter>("simHits")) { simHitTokens_.push_back(consumes>(tag)); } @@ -64,7 +68,7 @@ void TrackingParticleNumberOfLayersProducer::produce(edm::StreamID, iEvent.getByToken(tpToken_, htps); TrackingParticleNumberOfLayers algo(iEvent, simHitTokens_); - auto ret = algo.calculate(htps, iSetup); + auto ret = algo.calculate(htps, iSetup.getData(tTopoToken_)); iEvent.put(std::move(std::get(ret)), "trackerLayers"); iEvent.put(std::move(std::get(ret)), "pixelLayers"); iEvent.put(std::move(std::get(ret)), "stripStereoLayers"); diff --git a/SimGeneral/TrackingAnalysis/src/TrackingParticleNumberOfLayers.cc b/SimGeneral/TrackingAnalysis/src/TrackingParticleNumberOfLayers.cc index 4303b2f4c67d2..10089ca6e6258 100644 --- a/SimGeneral/TrackingAnalysis/src/TrackingParticleNumberOfLayers.cc +++ b/SimGeneral/TrackingAnalysis/src/TrackingParticleNumberOfLayers.cc @@ -1,11 +1,8 @@ #include "SimGeneral/TrackingAnalysis/interface/TrackingParticleNumberOfLayers.h" -#include "FWCore/Framework/interface/ESHandle.h" - #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "DataFormats/SiStripDetId/interface/StripSubdetector.h" #include "FWCore/Utilities/interface/isFinite.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" namespace { bool trackIdHitPairLess(const std::pair &a, @@ -47,12 +44,7 @@ std::tuple>, std::unique_ptr>, std::unique_ptr>> TrackingParticleNumberOfLayers::calculate(const edm::Handle &htps, - const edm::EventSetup &iSetup) const { - // Retrieve tracker topology from geometry - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); - const TrackerTopology &tTopo = *tTopoHandle; - + const TrackerTopology &tTopo) const { const TrackingParticleCollection &tps = *htps; std::vector valuesLayers(tps.size(), 0); std::vector valuesPixelLayers(tps.size(), 0); diff --git a/SimMuon/MCTruth/interface/MuonToSimAssociatorBase.h b/SimMuon/MCTruth/interface/MuonToSimAssociatorBase.h deleted file mode 100644 index ea641728df1ec..0000000000000 --- a/SimMuon/MCTruth/interface/MuonToSimAssociatorBase.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef MuonToSimAssociatorBase_h -#define MuonToSimAssociatorBase_h - -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/MuonReco/interface/Muon.h" -#include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h" - -class TrackerTopology; - -class MuonToSimAssociatorBase { -public: - MuonToSimAssociatorBase(); - virtual ~MuonToSimAssociatorBase(); - - enum MuonTrackType { InnerTk, OuterTk, GlobalTk, Segments }; - - struct RefToBaseSort { - template - bool operator()(const edm::RefToBase &r1, const edm::RefToBase &r2) const { - return (r1.id() == r2.id() ? r1.key() < r2.key() : r1.id() < r2.id()); - } - }; - typedef std::map, std::vector>, RefToBaseSort> - MuonToSimCollection; - typedef std::map, double>>> SimToMuonCollection; - - virtual void associateMuons(MuonToSimCollection &recoToSim, - SimToMuonCollection &simToReco, - const edm::RefToBaseVector &, - MuonTrackType, - const edm::RefVector &, - const edm::Event *event = nullptr, - const edm::EventSetup *setup = nullptr) const = 0; - - virtual void associateMuons(MuonToSimCollection &recoToSim, - SimToMuonCollection &simToReco, - const edm::Handle> &, - MuonTrackType, - const edm::Handle &, - const edm::Event *event = nullptr, - const edm::EventSetup *setup = nullptr) const = 0; -}; - -#endif diff --git a/SimMuon/MCTruth/interface/MuonToSimAssociatorByHits.h b/SimMuon/MCTruth/interface/MuonToSimAssociatorByHits.h deleted file mode 100644 index 82c76c9a4e8d6..0000000000000 --- a/SimMuon/MCTruth/interface/MuonToSimAssociatorByHits.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef MuonToSimAssociatorByHits_h -#define MuonToSimAssociatorByHits_h - -#include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "SimMuon/MCTruth/interface/MuonToSimAssociatorBase.h" - -#include "SimMuon/MCTruth/interface/MuonAssociatorByHitsHelper.h" -#include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h" - -class MuonToSimAssociatorByHits : public MuonToSimAssociatorBase { -public: - MuonToSimAssociatorByHits(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC); - ~MuonToSimAssociatorByHits() override; - - void associateMuons(MuonToSimCollection &recoToSim, - SimToMuonCollection &simToReco, - const edm::RefToBaseVector &, - MuonTrackType, - const edm::RefVector &, - const edm::Event *event = nullptr, - const edm::EventSetup *setup = nullptr) const override; - - void associateMuons(MuonToSimCollection &recoToSim, - SimToMuonCollection &simToReco, - const edm::Handle> &, - MuonTrackType, - const edm::Handle &, - const edm::Event *event = nullptr, - const edm::EventSetup *setup = nullptr) const override; - -private: - MuonAssociatorByHitsHelper helper_; - edm::ParameterSet const conf_; - TrackerHitAssociator::Config trackerHitAssociatorConfig_; -}; - -#endif diff --git a/SimMuon/MCTruth/plugins/BuildFile.xml b/SimMuon/MCTruth/plugins/BuildFile.xml index 1dc8c8c33d871..ba294d90ef1b3 100644 --- a/SimMuon/MCTruth/plugins/BuildFile.xml +++ b/SimMuon/MCTruth/plugins/BuildFile.xml @@ -6,10 +6,10 @@ + - diff --git a/SimMuon/MCTruth/plugins/MuonSimClassifier.cc b/SimMuon/MCTruth/plugins/MuonSimClassifier.cc index 7788dc18362aa..e6a18e89e2a2d 100644 --- a/SimMuon/MCTruth/plugins/MuonSimClassifier.cc +++ b/SimMuon/MCTruth/plugins/MuonSimClassifier.cc @@ -61,7 +61,6 @@ #include "SimDataFormats/Associations/interface/MuonToTrackingParticleAssociator.h" #include "SimDataFormats/TrackingAnalysis/interface/TrackingVertex.h" -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" #include "CommonTools/Utils/interface/StringCutObjectSelector.h" diff --git a/SimMuon/MCTruth/src/MuonToSimAssociatorBase.cc b/SimMuon/MCTruth/src/MuonToSimAssociatorBase.cc deleted file mode 100644 index e823d4c04f713..0000000000000 --- a/SimMuon/MCTruth/src/MuonToSimAssociatorBase.cc +++ /dev/null @@ -1,34 +0,0 @@ -// -*- C++ -*- -// -// Package: SimMuon/MCTruth -// Class : MuonToSimAssociatorBase -// -// Implementation: -// [Notes on implementation] -// -// Original Author: Christopher Jones -// Created: Tue, 06 Jan 2015 20:14:49 GMT -// - -// system include files - -// user include files -#include "FWCore/Utilities/interface/typelookup.h" -#include "SimMuon/MCTruth/interface/MuonToSimAssociatorBase.h" - -// -// constants, enums and typedefs -// - -// -// static data member definitions -// - -// -// constructors and destructor -// -MuonToSimAssociatorBase::MuonToSimAssociatorBase() {} - -MuonToSimAssociatorBase::~MuonToSimAssociatorBase() {} - -TYPELOOKUP_DATA_REG(MuonToSimAssociatorBase); diff --git a/SimMuon/MCTruth/src/MuonToSimAssociatorByHits.cc b/SimMuon/MCTruth/src/MuonToSimAssociatorByHits.cc deleted file mode 100644 index d34ce7951cdb5..0000000000000 --- a/SimMuon/MCTruth/src/MuonToSimAssociatorByHits.cc +++ /dev/null @@ -1,160 +0,0 @@ -#include "DataFormats/CSCRecHit/interface/CSCSegment.h" -#include "DataFormats/DTRecHit/interface/DTRecSegment4D.h" -#include "DataFormats/DetId/interface/DetId.h" -#include "DataFormats/MuonDetId/interface/MuonSubdetId.h" -#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" -#include "DataFormats/SiStripDetId/interface/StripSubdetector.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "Geometry/CommonDetUnit/interface/GeomDet.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "SimMuon/MCTruth/interface/MuonToSimAssociatorByHits.h" -#include "SimMuon/MCTruth/interface/TrackerMuonHitExtractor.h" -#include - -using namespace reco; -using namespace std; - -MuonToSimAssociatorByHits::MuonToSimAssociatorByHits(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC) - : helper_(conf), conf_(conf), trackerHitAssociatorConfig_(conf, std::move(iC)) { - TrackerMuonHitExtractor hitExtractor(conf_, std::move(iC)); - - // hack for consumes - RPCHitAssociator rpctruth(conf, std::move(iC)); - GEMHitAssociator gemtruth(conf, std::move(iC)); - DTHitAssociator dttruth(conf, std::move(iC)); - CSCHitAssociator muonTruth(conf, std::move(iC)); -} - -MuonToSimAssociatorByHits::~MuonToSimAssociatorByHits() {} - -void MuonToSimAssociatorByHits::associateMuons(MuonToSimCollection &recToSim, - SimToMuonCollection &simToRec, - const edm::Handle> &tCH, - MuonTrackType type, - const edm::Handle &tPCH, - const edm::Event *event, - const edm::EventSetup *setup) const { - edm::RefVector tpc(tPCH.id()); - for (unsigned int j = 0; j < tPCH->size(); j++) - tpc.push_back(edm::Ref(tPCH, j)); - - edm::RefToBaseVector muonBaseRefVector; - for (size_t i = 0; i < tCH->size(); ++i) - muonBaseRefVector.push_back(tCH->refAt(i)); - - associateMuons(recToSim, simToRec, muonBaseRefVector, type, tpc, event, setup); -} - -void MuonToSimAssociatorByHits::associateMuons(MuonToSimCollection &recToSim, - SimToMuonCollection &simToRec, - const edm::RefToBaseVector &muons, - MuonTrackType trackType, - const edm::RefVector &tPC, - const edm::Event *event, - const edm::EventSetup *setup) const { - /// PART 1: Fill MuonToSimAssociatorByHits::TrackHitsCollection - MuonAssociatorByHitsHelper::TrackHitsCollection muonHitRefs; - edm::OwnVector allTMRecHits; // this I will fill in only for tracker muon hits from - // segments - switch (trackType) { - case InnerTk: - for (edm::RefToBaseVector::const_iterator it = muons.begin(), ed = muons.end(); it != ed; ++it) { - edm::RefToBase mur = *it; - if (mur->track().isNonnull()) { - muonHitRefs.push_back(std::make_pair(mur->track()->recHitsBegin(), mur->track()->recHitsEnd())); - } else { - muonHitRefs.push_back(std::make_pair(allTMRecHits.data().end(), allTMRecHits.data().end())); - } - } - break; - case OuterTk: - for (edm::RefToBaseVector::const_iterator it = muons.begin(), ed = muons.end(); it != ed; ++it) { - edm::RefToBase mur = *it; - if (mur->outerTrack().isNonnull()) { - muonHitRefs.push_back(std::make_pair(mur->outerTrack()->recHitsBegin(), mur->outerTrack()->recHitsEnd())); - } else { - muonHitRefs.push_back(std::make_pair(allTMRecHits.data().end(), allTMRecHits.data().end())); - } - } - break; - case GlobalTk: - for (edm::RefToBaseVector::const_iterator it = muons.begin(), ed = muons.end(); it != ed; ++it) { - edm::RefToBase mur = *it; - if (mur->globalTrack().isNonnull()) { - muonHitRefs.push_back(std::make_pair(mur->globalTrack()->recHitsBegin(), mur->globalTrack()->recHitsEnd())); - } else { - muonHitRefs.push_back(std::make_pair(allTMRecHits.data().end(), allTMRecHits.data().end())); - } - } - break; - case Segments: { - TrackerMuonHitExtractor hitExtractor(conf_); - hitExtractor.init(*event, *setup); - // puts hits in the vector, and record indices - std::vector> muonHitIndices; - for (edm::RefToBaseVector::const_iterator it = muons.begin(), ed = muons.end(); it != ed; ++it) { - edm::RefToBase mur = *it; - std::pair indices(allTMRecHits.size(), allTMRecHits.size()); - if (mur->isTrackerMuon()) { - std::vector hits = hitExtractor.getMuonHits(*mur); - for (std::vector::const_iterator ith = hits.begin(), edh = hits.end(); ith != edh; - ++ith) { - allTMRecHits.push_back(**ith); - } - indices.second += hits.size(); - } - muonHitIndices.push_back(indices); - } - // convert indices into pairs of iterators to references - typedef std::pair index_pair; - trackingRecHit_iterator hitRefBegin = allTMRecHits.data().begin(); - for (std::vector>::const_iterator idxs = muonHitIndices.begin(), - idxend = muonHitIndices.end(); - idxs != idxend; - ++idxs) { - muonHitRefs.push_back(std::make_pair(hitRefBegin + idxs->first, hitRefBegin + idxs->second)); - } - - } break; - } - - /// PART 2: call the association routines - // Retrieve tracker topology from geometry - edm::ESHandle tTopoHand; - setup->get().get(tTopoHand); - const TrackerTopology *tTopo = tTopoHand.product(); - - // Tracker hit association - TrackerHitAssociator trackertruth(*event, trackerHitAssociatorConfig_); - // CSC hit association - CSCHitAssociator csctruth(*event, *setup, conf_); - // DT hit association - bool printRtS = true; - DTHitAssociator dttruth(*event, *setup, conf_, printRtS); - // RPC hit association - RPCHitAssociator rpctruth(*event, *setup, conf_); - // GEM hit association - GEMHitAssociator gemtruth(*event, *setup, conf_); - - MuonAssociatorByHitsHelper::Resources resources = { - tTopo, &trackertruth, &csctruth, &dttruth, &rpctruth, &gemtruth, {}}; - - auto recSimColl = helper_.associateRecoToSimIndices(muonHitRefs, tPC, resources); - for (auto it = recSimColl.begin(), ed = recSimColl.end(); it != ed; ++it) { - edm::RefToBase rec = muons[it->first]; - std::vector> &tpAss = recToSim[rec]; - for (auto const &a : it->second) { - tpAss.push_back(std::make_pair(tPC[a.idx], a.quality)); - } - } - auto simRecColl = helper_.associateSimToRecoIndices(muonHitRefs, tPC, resources); - for (auto it = simRecColl.begin(), ed = simRecColl.end(); it != ed; ++it) { - TrackingParticleRef sim = tPC[it->first]; - std::vector, double>> &recAss = simToRec[sim]; - for (auto const &a : it->second) { - recAss.push_back(std::make_pair(muons[a.idx], a.quality)); - } - } -} diff --git a/SimMuon/MCTruth/test/BuildFile.xml b/SimMuon/MCTruth/test/BuildFile.xml index 4e69410ccc547..25633ab5e59bd 100644 --- a/SimMuon/MCTruth/test/BuildFile.xml +++ b/SimMuon/MCTruth/test/BuildFile.xml @@ -5,7 +5,6 @@ - diff --git a/SimMuon/MCTruth/test/testAssociatorRecoMuon.cc b/SimMuon/MCTruth/test/testAssociatorRecoMuon.cc deleted file mode 100644 index 3d51f85ab2c6f..0000000000000 --- a/SimMuon/MCTruth/test/testAssociatorRecoMuon.cc +++ /dev/null @@ -1,164 +0,0 @@ -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include - -#include "SimMuon/MCTruth/interface/MuonToSimAssociatorBase.h" -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" - -#include -#include -#include - -class testAssociatorRecoMuon : public edm::EDAnalyzer { -public: - testAssociatorRecoMuon(const edm::ParameterSet &); - ~testAssociatorRecoMuon() override; - void analyze(const edm::Event &, const edm::EventSetup &) override; - -private: - edm::InputTag muonsTag; - edm::InputTag tpTag; - - std::string associatorLabel_; - - MuonToSimAssociatorBase::MuonTrackType trackType_; -}; - -#include "DataFormats/MuonReco/interface/Muon.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h" - -testAssociatorRecoMuon::testAssociatorRecoMuon(const edm::ParameterSet &parset) - : muonsTag(parset.getParameter("muonsTag")), - tpTag(parset.getParameter("tpTag")), - associatorLabel_(parset.getParameter("associatorLabel")) { - std::string trackType = parset.getParameter("trackType"); - if (trackType == "inner") - trackType_ = MuonToSimAssociatorBase::InnerTk; - else if (trackType == "outer") - trackType_ = MuonToSimAssociatorBase::OuterTk; - else if (trackType == "global") - trackType_ = MuonToSimAssociatorBase::GlobalTk; - else if (trackType == "segments") - trackType_ = MuonToSimAssociatorBase::Segments; - else - throw cms::Exception("Configuration") << "Track type '" << trackType << "' not supported.\n"; -} - -testAssociatorRecoMuon::~testAssociatorRecoMuon() {} - -void testAssociatorRecoMuon::analyze(const edm::Event &event, const edm::EventSetup &setup) { - edm::ESHandle associatorBase; - setup.get().get(associatorLabel_, associatorBase); - const MuonToSimAssociatorBase *assoByHits = associatorBase.product(); - if (assoByHits == nullptr) - throw cms::Exception("Configuration") - << "The Track Associator with label '" << associatorLabel_ << "' is not a MuonAssociatorByHits.\n"; - - edm::Handle> muonCollectionH; - LogTrace("testAssociatorRecoMuon") << "getting reco::Track collection " << muonsTag; - event.getByLabel(muonsTag, muonCollectionH); - - const edm::View muonCollection = *(muonCollectionH.product()); - LogTrace("testAssociatorRecoMuon") << "...size = " << muonCollection.size(); - - edm::Handle TPCollectionH; - LogTrace("testAssociatorRecoMuon") << "getting TrackingParticle collection " << tpTag; - event.getByLabel(tpTag, TPCollectionH); - - LogTrace("testAssociatorRecoMuon") << "...size = " << TPCollectionH->size(); - - edm::LogVerbatim("testAssociatorRecoMuon") << "\n === Event ID = " << event.id() << " ==="; - - // RECOTOSIM - edm::LogVerbatim("testAssociatorRecoMuon") << "\n ****************** Reco To Sim " - "****************** "; - - MuonToSimAssociatorBase::MuonToSimCollection recSimColl; - MuonToSimAssociatorBase::SimToMuonCollection simRecColl; - - assoByHits->associateMuons(recSimColl, simRecColl, muonCollectionH, trackType_, TPCollectionH, &event, &setup); - - edm::LogVerbatim("testAssociatorRecoMuon") << "\n There are " << muonCollection.size() << " reco::Muon " - << "(" << recSimColl.size() << " matched) \n"; - - for (edm::View::size_type i = 0; i < muonCollection.size(); ++i) { - edm::RefToBase track(muonCollectionH, i); - - if (recSimColl.find(track) != recSimColl.end()) { - std::vector> recSimAsso = recSimColl[track]; - - for (std::vector>::const_iterator IT = recSimAsso.begin(); - IT != recSimAsso.end(); - ++IT) { - TrackingParticleRef trpart = IT->first; - double purity = IT->second; - edm::LogVerbatim("testAssociatorRecoMuon") - << "reco::Muon #" << int(i) << " with pt = " << track->pt() << " associated to TrackingParticle #" - << trpart.key() << " (pdgId = " << trpart->pdgId() << ", pt = " << trpart->pt() - << ") with Quality = " << purity; - } - } else { - edm::LogVerbatim("testAssociatorRecoMuon") - << "reco::Muon #" << int(i) << " with pt = " << track->pt() << " NOT associated to any TrackingParticle" - << "\n"; - } - } - - // SIMTORECO - edm::LogVerbatim("testAssociatorRecoMuon") << "\n ****************** Sim To Reco " - "****************** "; - - edm::LogVerbatim("testAssociatorRecoMuon") << "\n There are " << TPCollectionH->size() << " TrackingParticles " - << "(" << simRecColl.size() << " matched) \n"; - - bool any_trackingParticle_matched = false; - - for (TrackingParticleCollection::size_type i = 0; i < TPCollectionH->size(); i++) { - TrackingParticleRef trpart(TPCollectionH, i); - - std::vector, double>> simRecAsso; - if (simRecColl.find(trpart) != simRecColl.end()) { - simRecAsso = simRecColl[trpart]; - - for (std::vector, double>>::const_iterator IT = simRecAsso.begin(); - IT != simRecAsso.end(); - ++IT) { - edm::RefToBase track = IT->first; - double quality = IT->second; - any_trackingParticle_matched = true; - - // find the purity from RecoToSim association (set purity = -1 for - // unmatched recoToSim) - double purity = -1.; - if (recSimColl.find(track) != recSimColl.end()) { - std::vector> recSimAsso = recSimColl[track]; - for (std::vector>::const_iterator ITS = recSimAsso.begin(); - ITS != recSimAsso.end(); - ++ITS) { - TrackingParticleRef tp(ITS->first); - if (tp == trpart) - purity = ITS->second; - } - } - - edm::LogVerbatim("testAssociatorRecoMuon") - << "TrackingParticle #" << int(i) << " with pdgId = " << trpart->pdgId() << ", pt = " << trpart->pt() - << " associated to reco::Muon #" << track.key() << " (pt = " << track->pt() - << ") with Quality = " << quality << " and Purity = " << purity; - } - } - } - if (!any_trackingParticle_matched) { - edm::LogVerbatim("testAssociatorRecoMuon") << "NO TrackingParticle associated to ANY input reco::Muon !" - << "\n"; - } -} -#include "FWCore/Framework/interface/MakerMacros.h" -DEFINE_FWK_MODULE(testAssociatorRecoMuon); diff --git a/SimPPS/PPSSimTrackProducer/plugins/PPSSimTrackProducer.cc b/SimPPS/PPSSimTrackProducer/plugins/PPSSimTrackProducer.cc index 020b4b1edaeab..956d2ffd0a336 100644 --- a/SimPPS/PPSSimTrackProducer/plugins/PPSSimTrackProducer.cc +++ b/SimPPS/PPSSimTrackProducer/plugins/PPSSimTrackProducer.cc @@ -39,8 +39,8 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/StreamID.h" #include "SimTransport/PPSProtonTransport/interface/ProtonTransport.h" +#include "CLHEP/Random/RandomEngine.h" #include "TRandom3.h" -#include "IOMC/RandomEngine/src/TRandomAdaptor.h" // // class declaration diff --git a/SimTracker/Records/BuildFile.xml b/SimTracker/Records/BuildFile.xml deleted file mode 100644 index eb2b497f90bb1..0000000000000 --- a/SimTracker/Records/BuildFile.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/SimTracker/Records/doc/Records.doc b/SimTracker/Records/doc/Records.doc deleted file mode 100644 index 1f4b9c14822c7..0000000000000 --- a/SimTracker/Records/doc/Records.doc +++ /dev/null @@ -1,42 +0,0 @@ - -/*! - -\page SimTracker_Records Package SimTracker/Records - -
- - - -Source code (CVS tag: @CVS_TAG@) - -Administrative privileges - -
- -\section desc Description - - -This package store the records of Track and Vertex Associators - -\subsection interface Public interface - - -- TrackAssociatorRecord -- VertexAssociatorRecord - -\subsection modules Modules - - - -\subsection tests Unit tests and examples - - - -\section status Status and planned development - -completed - -
-Last updated: -@DATE@ Author: G. Cerati -*/ - diff --git a/SimTracker/Records/interface/TrackAssociatorRecord.h b/SimTracker/Records/interface/TrackAssociatorRecord.h deleted file mode 100644 index afdb3f58a4c00..0000000000000 --- a/SimTracker/Records/interface/TrackAssociatorRecord.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef SimTracker_TrackAssociatorRecord_h -#define SimTracker_TrackAssociatorRecord_h - -/** \class TrackAssociatorRecord - * Record of Tracs Associators - * - * \author cerati - */ - -#include "FWCore/Framework/interface/DependentRecordImplementation.h" -#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" -#include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" -#include "TrackingTools/Records/interface/TrackingComponentsRecord.h" - -#include "FWCore/Utilities/interface/mplVector.h" - -class TrackAssociatorRecord - : public edm::eventsetup::DependentRecordImplementation< - TrackAssociatorRecord, - edm::mpl::Vector> {}; - -#endif diff --git a/SimTracker/Records/src/TrackAssociatorRecord.cc b/SimTracker/Records/src/TrackAssociatorRecord.cc deleted file mode 100644 index 624331aa332ea..0000000000000 --- a/SimTracker/Records/src/TrackAssociatorRecord.cc +++ /dev/null @@ -1,15 +0,0 @@ -// -*- C++ -*- -// -// Package: Records -// Class : TrackAssociatorRecord -// -// Implementation: -// -// -// Author: -// Created: Mon Sep 11 17:54:35 CEST 2006 - -#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" - -EVENTSETUP_RECORD_REG(TrackAssociatorRecord); diff --git a/SimTracker/TrackAssociation/BuildFile.xml b/SimTracker/TrackAssociation/BuildFile.xml index 02d1515f48a5e..c5221961b06c2 100644 --- a/SimTracker/TrackAssociation/BuildFile.xml +++ b/SimTracker/TrackAssociation/BuildFile.xml @@ -2,6 +2,7 @@ + @@ -10,8 +11,6 @@ - - diff --git a/SimTracker/TrackAssociation/interface/CosmicParametersDefinerForTP.h b/SimTracker/TrackAssociation/interface/CosmicParametersDefinerForTP.h index 04d04da681f7b..f7ebe562c639e 100644 --- a/SimTracker/TrackAssociation/interface/CosmicParametersDefinerForTP.h +++ b/SimTracker/TrackAssociation/interface/CosmicParametersDefinerForTP.h @@ -7,6 +7,9 @@ * \author Boris Mangano (UCSD) 5/7/2009 */ +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h" +#include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h" #include "SimTracker/TrackAssociation/interface/ParametersDefinerForTP.h" #include @@ -14,8 +17,8 @@ class CosmicParametersDefinerForTP : public ParametersDefinerForTP { public: - CosmicParametersDefinerForTP(){}; - ~CosmicParametersDefinerForTP() override{}; + CosmicParametersDefinerForTP(edm::ConsumesCollector iC); + ~CosmicParametersDefinerForTP() override; TrackingParticle::Vector momentum(const edm::Event &iEvent, const edm::EventSetup &iSetup, @@ -54,6 +57,7 @@ class CosmicParametersDefinerForTP : public ParametersDefinerForTP { } private: + const edm::ESGetToken geometryToken_; edm::Handle simHitsTPAssoc; }; diff --git a/SimTracker/TrackAssociation/interface/ParametersDefinerForTP.h b/SimTracker/TrackAssociation/interface/ParametersDefinerForTP.h index 25acef866c87a..ae28eadd8ccf8 100644 --- a/SimTracker/TrackAssociation/interface/ParametersDefinerForTP.h +++ b/SimTracker/TrackAssociation/interface/ParametersDefinerForTP.h @@ -9,18 +9,20 @@ #include +#include "DataFormats/BeamSpot/interface/BeamSpot.h" #include "DataFormats/Candidate/interface/Candidate.h" -#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #include "SimGeneral/TrackingAnalysis/interface/SimHitTPAssociationProducer.h" #include class ParametersDefinerForTP { public: - ParametersDefinerForTP(){}; - ParametersDefinerForTP(const edm::ParameterSet &iConfig); - virtual ~ParametersDefinerForTP(){}; + ParametersDefinerForTP(const edm::InputTag &beamspot, edm::ConsumesCollector iC); + virtual ~ParametersDefinerForTP(); typedef int Charge; ///< electric charge type typedef math::XYZPointD Point; ///< point in the space @@ -79,7 +81,9 @@ class ParametersDefinerForTP { return std::make_unique(*this); } - edm::InputTag beamSpotInputTag_; +protected: + const edm::EDGetTokenT bsToken_; + const edm::ESGetToken mfToken_; }; #endif diff --git a/SimTracker/TrackAssociation/plugins/BuildFile.xml b/SimTracker/TrackAssociation/plugins/BuildFile.xml index 53bafb604988e..fb3fec56f7d9d 100644 --- a/SimTracker/TrackAssociation/plugins/BuildFile.xml +++ b/SimTracker/TrackAssociation/plugins/BuildFile.xml @@ -1,10 +1,10 @@ - + diff --git a/SimTracker/TrackAssociation/plugins/CosmicParametersDefinerForTPESProducer.cc b/SimTracker/TrackAssociation/plugins/CosmicParametersDefinerForTPESProducer.cc deleted file mode 100644 index 4f38cca4d9c6c..0000000000000 --- a/SimTracker/TrackAssociation/plugins/CosmicParametersDefinerForTPESProducer.cc +++ /dev/null @@ -1,42 +0,0 @@ -#include "FWCore/Framework/interface/ESProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" -#include "SimTracker/TrackAssociation/plugins/CosmicParametersDefinerForTPESProducer.h" - -// system include files -#include - -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/ESProducer.h" -#include "FWCore/Framework/interface/ModuleFactory.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" - -CosmicParametersDefinerForTPESProducer::CosmicParametersDefinerForTPESProducer(const edm::ParameterSet &iConfig) { - // the following line is needed to tell the framework what - // data is being produced - std::string myName = iConfig.getParameter("ComponentName"); - setWhatProduced(this, myName); - - // now do what ever other initialization is needed - // conf_=iConfig; -} - -CosmicParametersDefinerForTPESProducer::~CosmicParametersDefinerForTPESProducer() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} - -// -// member functions -// - -// ------------ method called to produce the data ------------ -CosmicParametersDefinerForTPESProducer::ReturnType CosmicParametersDefinerForTPESProducer::produce( - const TrackAssociatorRecord &iRecord) { - return std::make_unique(); -} - -// define this as a plug-in -DEFINE_FWK_EVENTSETUP_MODULE(CosmicParametersDefinerForTPESProducer); diff --git a/SimTracker/TrackAssociation/plugins/CosmicParametersDefinerForTPESProducer.h b/SimTracker/TrackAssociation/plugins/CosmicParametersDefinerForTPESProducer.h deleted file mode 100644 index a97da1c8f435e..0000000000000 --- a/SimTracker/TrackAssociation/plugins/CosmicParametersDefinerForTPESProducer.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef TrackAssociation_CosmicParametersDefinerForTPESProducer_h -#define TrackAssociation_CosmicParametersDefinerForTPESProducer_h - -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" -#include "SimTracker/TrackAssociation/interface/CosmicParametersDefinerForTP.h" - -#include "FWCore/Framework/interface/ESProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include - -class CosmicParametersDefinerForTPESProducer : public edm::ESProducer { - typedef std::unique_ptr ReturnType; - -public: - CosmicParametersDefinerForTPESProducer(const edm::ParameterSet &p); - ~CosmicParametersDefinerForTPESProducer() override; - std::unique_ptr produce(const TrackAssociatorRecord &); -}; - -#endif diff --git a/SimTracker/TrackAssociation/plugins/ParametersDefinerForTPESProducer.cc b/SimTracker/TrackAssociation/plugins/ParametersDefinerForTPESProducer.cc deleted file mode 100644 index f2b7fbae166b1..0000000000000 --- a/SimTracker/TrackAssociation/plugins/ParametersDefinerForTPESProducer.cc +++ /dev/null @@ -1,42 +0,0 @@ -#include "FWCore/Framework/interface/ESProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" -#include "SimTracker/TrackAssociation/plugins/ParametersDefinerForTPESProducer.h" - -// system include files -#include - -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/ESProducer.h" -#include "FWCore/Framework/interface/ModuleFactory.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" - -ParametersDefinerForTPESProducer::ParametersDefinerForTPESProducer(const edm::ParameterSet &iConfig) : pset_(iConfig) { - // the following line is needed to tell the framework what - // data is being produced - std::string myName = iConfig.getParameter("ComponentName"); - setWhatProduced(this, myName); - - // now do what ever other initialization is needed - // conf_=iConfig; -} - -ParametersDefinerForTPESProducer::~ParametersDefinerForTPESProducer() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} - -// -// member functions -// - -// ------------ method called to produce the data ------------ -ParametersDefinerForTPESProducer::ReturnType ParametersDefinerForTPESProducer::produce( - const TrackAssociatorRecord &iRecord) { - return std::make_unique(pset_); -} - -// define this as a plug-in -DEFINE_FWK_EVENTSETUP_MODULE(ParametersDefinerForTPESProducer); diff --git a/SimTracker/TrackAssociation/plugins/ParametersDefinerForTPESProducer.h b/SimTracker/TrackAssociation/plugins/ParametersDefinerForTPESProducer.h deleted file mode 100644 index 8c3a9ca1e7463..0000000000000 --- a/SimTracker/TrackAssociation/plugins/ParametersDefinerForTPESProducer.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef TrackAssociation_ParametersDefinerForTPESProducer_h -#define TrackAssociation_ParametersDefinerForTPESProducer_h - -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" -#include "SimTracker/TrackAssociation/interface/ParametersDefinerForTP.h" - -#include "FWCore/Framework/interface/ESProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include - -class ParametersDefinerForTPESProducer : public edm::ESProducer { - typedef std::unique_ptr ReturnType; - -public: - ParametersDefinerForTPESProducer(const edm::ParameterSet &p); - ~ParametersDefinerForTPESProducer() override; - std::unique_ptr produce(const TrackAssociatorRecord &); - - edm::ParameterSet pset_; -}; - -#endif diff --git a/SimTracker/TrackAssociation/plugins/TrackTimeValueMapProducer.cc b/SimTracker/TrackAssociation/plugins/TrackTimeValueMapProducer.cc index b9e60eb98f298..6e7ab4e116b30 100644 --- a/SimTracker/TrackAssociation/plugins/TrackTimeValueMapProducer.cc +++ b/SimTracker/TrackAssociation/plugins/TrackTimeValueMapProducer.cc @@ -52,6 +52,7 @@ class TrackTimeValueMapProducer : public edm::global::EDProducer<> { const edm::EDGetTokenT trackingParticles_; const edm::EDGetTokenT trackingVertices_; const edm::EDGetTokenT> pileupSummaryInfo_; + const edm::ESGetToken builderToken_; // tracking particle associators by order of preference const std::vector> associators_; // eta bounds @@ -88,6 +89,7 @@ TrackTimeValueMapProducer::TrackTimeValueMapProducer(const edm::ParameterSet &co trackingVertices_(consumes(conf.getParameter("trackingVertexSrc"))), pileupSummaryInfo_( consumes>(conf.getParameter("pileupSummaryInfo"))), + builderToken_(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))), associators_(edm::vector_transform( conf.getParameter>("associators"), [this](const edm::InputTag &tag) { return this->consumes(tag); })), @@ -132,8 +134,7 @@ void TrackTimeValueMapProducer::produce(edm::StreamID sid, edm::Event &evt, cons evt.getByToken(pileupSummaryInfo_, pileupSummaryH); // transient track builder - edm::ESHandle theB; - es.get().get("TransientTrackBuilder", theB); + auto const &builder = es.getData(builderToken_); // associate the reco tracks / gsf Tracks std::vector associatedTracks; @@ -181,7 +182,7 @@ void TrackTimeValueMapProducer::produce(edm::StreamID sid, edm::Event &evt, cons } if (track_tps != associatedTracks.back().end() && track_tps->val.size() == 1) { - reco::TransientTrack tt = theB->build(*tkref); + reco::TransientTrack tt = builder.build(*tkref); float time = extractTrackVertexTime(*track_tps->val[0].first, tt); generalTrackTimes.push_back(time); } else { diff --git a/SimTracker/TrackAssociation/python/CosmicParametersDefinerForTP_cfi.py b/SimTracker/TrackAssociation/python/CosmicParametersDefinerForTP_cfi.py deleted file mode 100644 index 14a9cc14e62a5..0000000000000 --- a/SimTracker/TrackAssociation/python/CosmicParametersDefinerForTP_cfi.py +++ /dev/null @@ -1,5 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -CosmicParametersDefinerForTP = cms.ESProducer("CosmicParametersDefinerForTPESProducer", -ComponentName = cms.string('CosmicParametersDefinerForTP') -) diff --git a/SimTracker/TrackAssociation/python/LhcParametersDefinerForTP_cfi.py b/SimTracker/TrackAssociation/python/LhcParametersDefinerForTP_cfi.py deleted file mode 100644 index c294d39b79ab4..0000000000000 --- a/SimTracker/TrackAssociation/python/LhcParametersDefinerForTP_cfi.py +++ /dev/null @@ -1,6 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -LhcParametersDefinerForTP = cms.ESProducer("ParametersDefinerForTPESProducer", - ComponentName = cms.string('LhcParametersDefinerForTP'), - beamSpot = cms.untracked.InputTag('offlineBeamSpot') -) diff --git a/SimTracker/TrackAssociation/src/CosmicParametersDefinerForTP.cc b/SimTracker/TrackAssociation/src/CosmicParametersDefinerForTP.cc index a9db15efa708e..7477ff205906e 100644 --- a/SimTracker/TrackAssociation/src/CosmicParametersDefinerForTP.cc +++ b/SimTracker/TrackAssociation/src/CosmicParametersDefinerForTP.cc @@ -2,24 +2,20 @@ #include "DataFormats/GeometryVector/interface/GlobalVector.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/typelookup.h" -#include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h" -#include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "MagneticField/Engine/interface/MagneticField.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #include "SimTracker/TrackAssociation/interface/CosmicParametersDefinerForTP.h" #include "TrackingTools/PatternTools/interface/TSCBLBuilderNoMaterial.h" #include "TrackingTools/PatternTools/interface/TSCPBuilderNoMaterial.h" #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h" #include #include -#include #include -#include class TrajectoryStateClosestToBeamLineBuilder; +CosmicParametersDefinerForTP::CosmicParametersDefinerForTP(edm::ConsumesCollector iC) + : ParametersDefinerForTP(edm::InputTag("offlineBeamSpot"), iC), geometryToken_(iC.esConsumes()) {} +CosmicParametersDefinerForTP::~CosmicParametersDefinerForTP() = default; + TrackingParticle::Vector CosmicParametersDefinerForTP::momentum(const edm::Event &iEvent, const edm::EventSetup &iSetup, const TrackingParticleRef &tpr) const { @@ -29,16 +25,9 @@ TrackingParticle::Vector CosmicParametersDefinerForTP::momentum(const edm::Event using namespace std; using namespace reco; - ESHandle tracker; - iSetup.get().get(tracker); - edm::ESHandle theGeometry; - iSetup.get().get(theGeometry); - - edm::ESHandle theMF; - iSetup.get().get(theMF); - - edm::Handle bs; - iEvent.getByLabel(InputTag("offlineBeamSpot"), bs); + auto const &bs = iEvent.get(bsToken_); + auto const &geometry = iSetup.getData(geometryToken_); + auto const &mf = iSetup.getData(mfToken_); GlobalVector finalGV(0, 0, 0); GlobalPoint finalGP(0, 0, 0); @@ -64,7 +53,7 @@ TrackingParticle::Vector CosmicParametersDefinerForTP::momentum(const edm::Event SimHitTPAssociationProducer::simHitTPAssociationListGreater); for (auto ip = range.first; ip != range.second; ++ip) { TrackPSimHitRef it = ip->second; - const GeomDet *tmpDet = theGeometry->idToDet(DetId(it->detUnitId())); + const GeomDet *tmpDet = geometry.idToDet(DetId(it->detUnitId())); if (!tmpDet) { edm::LogVerbatim("CosmicParametersDefinerForTP") << "***WARNING in CosmicParametersDefinerForTP::momentum: no GeomDet " @@ -98,10 +87,10 @@ TrackingParticle::Vector CosmicParametersDefinerForTP::momentum(const edm::Event << "\t \t FINAL State at InnerMost Hit: pt = " << finalGV.perp() << ", pz = " << finalGV.z(); if (found) { - FreeTrajectoryState ftsAtProduction(finalGP, finalGV, TrackCharge(tpr->charge()), theMF.product()); + FreeTrajectoryState ftsAtProduction(finalGP, finalGV, TrackCharge(tpr->charge()), &mf); TSCBLBuilderNoMaterial tscblBuilder; TrajectoryStateClosestToBeamLine tsAtClosestApproach = - tscblBuilder(ftsAtProduction, *bs); // as in TrackProducerAlgorithm + tscblBuilder(ftsAtProduction, bs); // as in TrackProducerAlgorithm if (tsAtClosestApproach.isValid()) { GlobalVector p = tsAtClosestApproach.trackStateAtPCA().momentum(); @@ -135,16 +124,9 @@ TrackingParticle::Point CosmicParametersDefinerForTP::vertex(const edm::Event &i using namespace std; using namespace reco; - ESHandle tracker; - iSetup.get().get(tracker); - edm::ESHandle theGeometry; - iSetup.get().get(theGeometry); - - edm::ESHandle theMF; - iSetup.get().get(theMF); - - edm::Handle bs; - iEvent.getByLabel(InputTag("offlineBeamSpot"), bs); + auto const &bs = iEvent.get(bsToken_); + auto const &geometry = iSetup.getData(geometryToken_); + auto const &mf = iSetup.getData(mfToken_); GlobalVector finalGV(0, 0, 0); GlobalPoint finalGP(0, 0, 0); @@ -172,7 +154,7 @@ TrackingParticle::Point CosmicParametersDefinerForTP::vertex(const edm::Event &i SimHitTPAssociationProducer::simHitTPAssociationListGreater); for (auto ip = range.first; ip != range.second; ++ip) { TrackPSimHitRef it = ip->second; - const GeomDet *tmpDet = theGeometry->idToDet(DetId(it->detUnitId())); + const GeomDet *tmpDet = geometry.idToDet(DetId(it->detUnitId())); if (!tmpDet) { edm::LogVerbatim("CosmicParametersDefinerForTP") << "***WARNING in CosmicParametersDefinerForTP::vertex: no GeomDet " @@ -202,10 +184,10 @@ TrackingParticle::Point CosmicParametersDefinerForTP::vertex(const edm::Event &i << "\t \t FINAL State at InnerMost Hit: radius = " << finalGP.perp() << ", z = " << finalGP.z(); if (found) { - FreeTrajectoryState ftsAtProduction(finalGP, finalGV, TrackCharge(tpr->charge()), theMF.product()); + FreeTrajectoryState ftsAtProduction(finalGP, finalGV, TrackCharge(tpr->charge()), &mf); TSCBLBuilderNoMaterial tscblBuilder; TrajectoryStateClosestToBeamLine tsAtClosestApproach = - tscblBuilder(ftsAtProduction, *bs); // as in TrackProducerAlgorithm + tscblBuilder(ftsAtProduction, bs); // as in TrackProducerAlgorithm if (tsAtClosestApproach.isValid()) { GlobalPoint v = tsAtClosestApproach.trackStateAtPCA().position(); @@ -213,7 +195,7 @@ TrackingParticle::Point CosmicParametersDefinerForTP::vertex(const edm::Event &i } else { // to preserve old behaviour // would be better to flag this somehow to allow ignoring in downstream - vertex = TrackingParticle::Point(bs->x0(), bs->y0(), bs->z0()); + vertex = TrackingParticle::Point(bs.x0(), bs.y0(), bs.z0()); edm::LogVerbatim("CosmicParametersDefinerForTP") << "*** WARNING in CosmicParametersDefinerForTP::vertex: " "tsAtClosestApproach is not valid." << "\n"; @@ -234,5 +216,3 @@ TrackingParticle::Point CosmicParametersDefinerForTP::vertex(const edm::Event &i return vertex; } - -TYPELOOKUP_DATA_REG(CosmicParametersDefinerForTP); diff --git a/SimTracker/TrackAssociation/src/ParametersDefinerForTP.cc b/SimTracker/TrackAssociation/src/ParametersDefinerForTP.cc index f6db59790e482..08f87e3dc8b87 100644 --- a/SimTracker/TrackAssociation/src/ParametersDefinerForTP.cc +++ b/SimTracker/TrackAssociation/src/ParametersDefinerForTP.cc @@ -1,7 +1,6 @@ #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/GeometryVector/interface/GlobalVector.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Utilities/interface/typelookup.h" #include "MagneticField/Engine/interface/MagneticField.h" #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #include "SimTracker/TrackAssociation/interface/ParametersDefinerForTP.h" @@ -11,8 +10,10 @@ #include class TrajectoryStateClosestToBeamLineBuilder; -ParametersDefinerForTP::ParametersDefinerForTP(const edm::ParameterSet &iConfig) - : beamSpotInputTag_(iConfig.getUntrackedParameter("beamSpot", edm::InputTag("offlineBeamSpot"))) {} +ParametersDefinerForTP::ParametersDefinerForTP(const edm::InputTag &beamspot, edm::ConsumesCollector iC) + : bsToken_(iC.consumes(beamspot)), mfToken_(iC.esConsumes()) {} + +ParametersDefinerForTP::~ParametersDefinerForTP() = default; TrackingParticle::Vector ParametersDefinerForTP::momentum(const edm::Event &iEvent, const edm::EventSetup &iSetup, @@ -24,22 +25,17 @@ TrackingParticle::Vector ParametersDefinerForTP::momentum(const edm::Event &iEve using namespace edm; - edm::ESHandle theMF; - iSetup.get().get(theMF); - - edm::Handle bs; - iEvent.getByLabel(beamSpotInputTag_, bs); + auto const &bs = iEvent.get(bsToken_); + auto const &mf = iSetup.getData(mfToken_); TrackingParticle::Vector momentum(0, 0, 0); - FreeTrajectoryState ftsAtProduction(GlobalPoint(vtx.x(), vtx.y(), vtx.z()), - GlobalVector(lv.x(), lv.y(), lv.z()), - TrackCharge(charge), - theMF.product()); + FreeTrajectoryState ftsAtProduction( + GlobalPoint(vtx.x(), vtx.y(), vtx.z()), GlobalVector(lv.x(), lv.y(), lv.z()), TrackCharge(charge), &mf); TSCBLBuilderNoMaterial tscblBuilder; TrajectoryStateClosestToBeamLine tsAtClosestApproach = - tscblBuilder(ftsAtProduction, *bs); // as in TrackProducerAlgorithm + tscblBuilder(ftsAtProduction, bs); // as in TrackProducerAlgorithm if (tsAtClosestApproach.isValid()) { GlobalVector p = tsAtClosestApproach.trackStateAtPCA().momentum(); momentum = TrackingParticle::Vector(p.x(), p.y(), p.z()); @@ -56,29 +52,24 @@ TrackingParticle::Point ParametersDefinerForTP::vertex(const edm::Event &iEvent, // the base class: using namespace edm; - edm::ESHandle theMF; - iSetup.get().get(theMF); - - edm::Handle bs; - iEvent.getByLabel(beamSpotInputTag_, bs); + auto const &bs = iEvent.get(bsToken_); + auto const &mf = iSetup.getData(mfToken_); TrackingParticle::Point vertex(0, 0, 0); - FreeTrajectoryState ftsAtProduction(GlobalPoint(vtx.x(), vtx.y(), vtx.z()), - GlobalVector(lv.x(), lv.y(), lv.z()), - TrackCharge(charge), - theMF.product()); + FreeTrajectoryState ftsAtProduction( + GlobalPoint(vtx.x(), vtx.y(), vtx.z()), GlobalVector(lv.x(), lv.y(), lv.z()), TrackCharge(charge), &mf); TSCBLBuilderNoMaterial tscblBuilder; TrajectoryStateClosestToBeamLine tsAtClosestApproach = - tscblBuilder(ftsAtProduction, *bs); // as in TrackProducerAlgorithm + tscblBuilder(ftsAtProduction, bs); // as in TrackProducerAlgorithm if (tsAtClosestApproach.isValid()) { GlobalPoint v = tsAtClosestApproach.trackStateAtPCA().position(); vertex = TrackingParticle::Point(v.x(), v.y(), v.z()); } else { // to preserve old behaviour // would be better to flag this somehow to allow ignoring in downstream - vertex = TrackingParticle::Point(bs->x0(), bs->y0(), bs->z0()); + vertex = TrackingParticle::Point(bs.x0(), bs.y0(), bs.z0()); } return vertex; } @@ -91,23 +82,18 @@ std::tuple ParametersDefinerF const LorentzVector &lv) const { using namespace edm; - edm::ESHandle theMF; - iSetup.get().get(theMF); + auto const &bs = iEvent.get(bsToken_); + auto const &mf = iSetup.getData(mfToken_); - edm::Handle bs; - iEvent.getByLabel(beamSpotInputTag_, bs); - - TrackingParticle::Point vertex(bs->x0(), bs->y0(), bs->z0()); + TrackingParticle::Point vertex(bs.x0(), bs.y0(), bs.z0()); TrackingParticle::Vector momentum(0, 0, 0); - FreeTrajectoryState ftsAtProduction(GlobalPoint(vtx.x(), vtx.y(), vtx.z()), - GlobalVector(lv.x(), lv.y(), lv.z()), - TrackCharge(charge), - theMF.product()); + FreeTrajectoryState ftsAtProduction( + GlobalPoint(vtx.x(), vtx.y(), vtx.z()), GlobalVector(lv.x(), lv.y(), lv.z()), TrackCharge(charge), &mf); TSCBLBuilderNoMaterial tscblBuilder; TrajectoryStateClosestToBeamLine tsAtClosestApproach = - tscblBuilder(ftsAtProduction, *bs); // as in TrackProducerAlgorithm + tscblBuilder(ftsAtProduction, bs); // as in TrackProducerAlgorithm if (tsAtClosestApproach.isValid()) { GlobalPoint v = tsAtClosestApproach.trackStateAtPCA().position(); vertex = TrackingParticle::Point(v.x(), v.y(), v.z()); @@ -118,5 +104,3 @@ std::tuple ParametersDefinerF return std::make_tuple(momentum, vertex); } - -TYPELOOKUP_DATA_REG(ParametersDefinerForTP); diff --git a/SimTracker/TrackAssociatorProducers/plugins/TrackAssociatorByChi2Producer.cc b/SimTracker/TrackAssociatorProducers/plugins/TrackAssociatorByChi2Producer.cc index d2f22d5f9a1d1..16f0244d6942d 100644 --- a/SimTracker/TrackAssociatorProducers/plugins/TrackAssociatorByChi2Producer.cc +++ b/SimTracker/TrackAssociatorProducers/plugins/TrackAssociatorByChi2Producer.cc @@ -25,7 +25,6 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -45,7 +44,7 @@ class TrackAssociatorByChi2Producer : public edm::global::EDProducer<> { public: explicit TrackAssociatorByChi2Producer(const edm::ParameterSet&); - ~TrackAssociatorByChi2Producer() override; + ~TrackAssociatorByChi2Producer() override = default; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); @@ -54,34 +53,23 @@ class TrackAssociatorByChi2Producer : public edm::global::EDProducer<> { // ----------member data --------------------------- edm::EDGetTokenT bsToken_; + edm::ESGetToken magFieldToken_; + edm::EDPutTokenT tpPutToken_; + edm::EDPutTokenT genPutToken_; const double chi2cut_; const bool onlyDiagonal_; }; -// -// constants, enums and typedefs -// - -// -// static data member definitions -// - // // constructors and destructor // TrackAssociatorByChi2Producer::TrackAssociatorByChi2Producer(const edm::ParameterSet& iConfig) : bsToken_(consumes(iConfig.getParameter("beamSpot"))), + magFieldToken_(esConsumes()), + tpPutToken_(produces()), + genPutToken_(produces()), chi2cut_(iConfig.getParameter("chi2cut")), - onlyDiagonal_(iConfig.getParameter("onlyDiagonal")) { - //register your products - produces(); - produces(); -} - -TrackAssociatorByChi2Producer::~TrackAssociatorByChi2Producer() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} + onlyDiagonal_(iConfig.getParameter("onlyDiagonal")) {} // // member functions @@ -91,30 +79,14 @@ TrackAssociatorByChi2Producer::~TrackAssociatorByChi2Producer() { void TrackAssociatorByChi2Producer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { using namespace edm; - edm::ESHandle magField; - iSetup.get().get(magField); - - edm::Handle beamSpot; - iEvent.getByToken(bsToken_, beamSpot); - - { - std::unique_ptr impl( - new TrackAssociatorByChi2Impl(iEvent.productGetter(), *magField, *beamSpot, chi2cut_, onlyDiagonal_)); - - std::unique_ptr assoc( - new reco::TrackToTrackingParticleAssociator(std::move(impl))); - - iEvent.put(std::move(assoc)); - } - - { - std::unique_ptr impl( - new TrackGenAssociatorByChi2Impl(*magField, *beamSpot, chi2cut_, onlyDiagonal_)); - - std::unique_ptr assoc(new reco::TrackToGenParticleAssociator(std::move(impl))); + auto const& magField = iSetup.getData(magFieldToken_); + auto const& beamSpot = iEvent.get(bsToken_); - iEvent.put(std::move(assoc)); - } + iEvent.emplace( + tpPutToken_, + std::make_unique(iEvent.productGetter(), magField, beamSpot, chi2cut_, onlyDiagonal_)); + iEvent.emplace(genPutToken_, + std::make_unique(magField, beamSpot, chi2cut_, onlyDiagonal_)); } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ diff --git a/SimTracker/TrackAssociatorProducers/plugins/TrackAssociatorByHitsProducer.cc b/SimTracker/TrackAssociatorProducers/plugins/TrackAssociatorByHitsProducer.cc index 8ed6759319c2a..c87da5d4fcde5 100644 --- a/SimTracker/TrackAssociatorProducers/plugins/TrackAssociatorByHitsProducer.cc +++ b/SimTracker/TrackAssociatorProducers/plugins/TrackAssociatorByHitsProducer.cc @@ -26,7 +26,6 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Utilities/interface/EDGetToken.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -48,18 +47,19 @@ using SimHitTPAssociationList = TrackAssociatorByHitsImpl::SimHitTPAssociationLi class TrackAssociatorByHitsProducer : public edm::global::EDProducer<> { public: explicit TrackAssociatorByHitsProducer(const edm::ParameterSet&); - ~TrackAssociatorByHitsProducer() override; + ~TrackAssociatorByHitsProducer() override = default; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - void beginJob() override; void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; - void endJob() override; // ----------member data --------------------------- TrackerHitAssociator::Config trackerHitAssociatorConfig_; edm::EDGetTokenT simHitTpMapToken_; + edm::ESGetToken tTopoToken_; + edm::EDPutTokenT putToken_; + TrackAssociatorByHitsImpl::SimToRecoDenomType SimToRecoDenominator; const double quality_SimToReco; const double purity_SimToReco; @@ -85,6 +85,8 @@ class TrackAssociatorByHitsProducer : public edm::global::EDProducer<> { TrackAssociatorByHitsProducer::TrackAssociatorByHitsProducer(const edm::ParameterSet& iConfig) : trackerHitAssociatorConfig_(iConfig, consumesCollector()), simHitTpMapToken_(consumes(iConfig.getParameter("simHitTpMapTag"))), + tTopoToken_(esConsumes()), + putToken_(produces()), SimToRecoDenominator(TrackAssociatorByHitsImpl::denomnone), quality_SimToReco(iConfig.getParameter("Quality_SimToReco")), purity_SimToReco(iConfig.getParameter("Purity_SimToReco")), @@ -104,14 +106,6 @@ TrackAssociatorByHitsProducer::TrackAssociatorByHitsProducer(const edm::Paramete if (SimToRecoDenominator == TrackAssociatorByHitsImpl::denomnone) { throw cms::Exception("TrackAssociatorByHitsImpl") << "SimToRecoDenominator not specified as sim or reco"; } - - //register your products - produces(); -} - -TrackAssociatorByHitsProducer::~TrackAssociatorByHitsProducer() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) } // @@ -122,40 +116,26 @@ TrackAssociatorByHitsProducer::~TrackAssociatorByHitsProducer() { void TrackAssociatorByHitsProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { using namespace edm; - std::unique_ptr thAssoc(new TrackerHitAssociator(iEvent, trackerHitAssociatorConfig_)); - - edm::ESHandle tTopoHand; - iSetup.get().get(tTopoHand); - - edm::Handle simHitsTPAssoc; - //warning: make sure the TP collection used in the map is the same used in the associator! - iEvent.getByToken(simHitTpMapToken_, simHitsTPAssoc); - - std::unique_ptr impl( - new TrackAssociatorByHitsImpl(iEvent.productGetter(), - std::move(thAssoc), - &(*tTopoHand), - &(*simHitsTPAssoc), - SimToRecoDenominator, - quality_SimToReco, - purity_SimToReco, - cut_RecoToSim, - UsePixels, - UseGrouped, - UseSplitting, - ThreeHitTracksAreSpecial, - AbsoluteNumberOfHits)); - std::unique_ptr toPut( - new reco::TrackToTrackingParticleAssociator(std::move(impl))); - iEvent.put(std::move(toPut)); + auto thAssoc = std::make_unique(iEvent, trackerHitAssociatorConfig_); + + iEvent.emplace(putToken_, + std::make_unique( + iEvent.productGetter(), + std::move(thAssoc), + &iSetup.getData(tTopoToken_), + //warning: make sure the TP collection used in the map is the same used in the associator! + &iEvent.get(simHitTpMapToken_), + SimToRecoDenominator, + quality_SimToReco, + purity_SimToReco, + cut_RecoToSim, + UsePixels, + UseGrouped, + UseSplitting, + ThreeHitTracksAreSpecial, + AbsoluteNumberOfHits)); } -// ------------ method called once each job just before starting event loop ------------ -void TrackAssociatorByHitsProducer::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void TrackAssociatorByHitsProducer::endJob() {} - // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ void TrackAssociatorByHitsProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { //The following says we do not know what parameters are allowed so do no validation diff --git a/SimTracker/TrackAssociatorProducers/plugins/TrackAssociatorByPositionProducer.cc b/SimTracker/TrackAssociatorProducers/plugins/TrackAssociatorByPositionProducer.cc index 24748ee050e5a..2c554a1579518 100644 --- a/SimTracker/TrackAssociatorProducers/plugins/TrackAssociatorByPositionProducer.cc +++ b/SimTracker/TrackAssociatorProducers/plugins/TrackAssociatorByPositionProducer.cc @@ -41,7 +41,7 @@ using SimHitTPAssociationList = TrackAssociatorByPositionImpl::SimHitTPAssociati class TrackAssociatorByPositionProducer : public edm::global::EDProducer<> { public: explicit TrackAssociatorByPositionProducer(const edm::ParameterSet&); - ~TrackAssociatorByPositionProducer() override; + ~TrackAssociatorByPositionProducer() override = default; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); @@ -50,7 +50,9 @@ class TrackAssociatorByPositionProducer : public edm::global::EDProducer<> { // ----------member data --------------------------- edm::EDGetTokenT theSimHitTpMapToken; - std::string thePname; + edm::ESGetToken thePropagatorToken; + edm::ESGetToken theGeometryToken; + edm::EDPutTokenT thePutToken; double theQminCut; double theQCut; double thePositionMinimumDistance; @@ -59,10 +61,6 @@ class TrackAssociatorByPositionProducer : public edm::global::EDProducer<> { bool theConsiderAllSimHits; }; -// -// constants, enums and typedefs -// - // // static data member definitions // @@ -85,21 +83,15 @@ static TrackAssociatorByPositionImpl::Method parseMethodName(const std::string& // TrackAssociatorByPositionProducer::TrackAssociatorByPositionProducer(const edm::ParameterSet& iConfig) : theSimHitTpMapToken{consumes(iConfig.getParameter("simHitTpMapTag"))}, - thePname{iConfig.getParameter("propagator")}, + thePropagatorToken{esConsumes(edm::ESInputTag("", iConfig.getParameter("propagator")))}, + theGeometryToken{esConsumes()}, + thePutToken{produces()}, theQminCut{iConfig.getParameter("QminCut")}, theQCut{iConfig.getParameter("QCut")}, thePositionMinimumDistance{iConfig.getParameter("positionMinimumDistance")}, theMethod{parseMethodName(iConfig.getParameter("method"))}, theMinIfNoMatch{iConfig.getParameter("MinIfNoMatch")}, - theConsiderAllSimHits{iConfig.getParameter("ConsiderAllSimHits")} { - //register your products - produces(); -} - -TrackAssociatorByPositionProducer::~TrackAssociatorByPositionProducer() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} + theConsiderAllSimHits{iConfig.getParameter("ConsiderAllSimHits")} {} // // member functions @@ -109,33 +101,17 @@ TrackAssociatorByPositionProducer::~TrackAssociatorByPositionProducer() { void TrackAssociatorByPositionProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { - using namespace edm; - - Handle assocList; - iEvent.getByToken(theSimHitTpMapToken, assocList); - - edm::ESHandle theP; - iSetup.get().get(thePname, theP); - - edm::ESHandle theG; - iSetup.get().get(theG); - - std::unique_ptr impl{ - new TrackAssociatorByPositionImpl(iEvent.productGetter(), - theG.product(), - theP.product(), - assocList.product(), - theQminCut, - theQCut, - thePositionMinimumDistance, - theMethod, - theMinIfNoMatch, - theConsiderAllSimHits)}; - - std::unique_ptr toPut{ - new reco::TrackToTrackingParticleAssociator(std::move(impl))}; - - iEvent.put(std::move(toPut)); + iEvent.emplace(thePutToken, + std::make_unique(iEvent.productGetter(), + &iSetup.getData(theGeometryToken), + &iSetup.getData(thePropagatorToken), + &iEvent.get(theSimHitTpMapToken), + theQminCut, + theQCut, + thePositionMinimumDistance, + theMethod, + theMinIfNoMatch, + theConsiderAllSimHits)); } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ diff --git a/SimTracker/TrackHistory/BuildFile.xml b/SimTracker/TrackHistory/BuildFile.xml index dae2984c69973..22aebf3986744 100644 --- a/SimTracker/TrackHistory/BuildFile.xml +++ b/SimTracker/TrackHistory/BuildFile.xml @@ -11,7 +11,6 @@ - diff --git a/SimTracker/TrackHistory/interface/TrackClassifier.h b/SimTracker/TrackHistory/interface/TrackClassifier.h index 77b85204fd8d8..efac56b24d4f4 100644 --- a/SimTracker/TrackHistory/interface/TrackClassifier.h +++ b/SimTracker/TrackHistory/interface/TrackClassifier.h @@ -74,6 +74,7 @@ class TrackClassifier : public TrackCategories { edm::Handle mcInformation_; edm::ESHandle particleDataTable_; + edm::ESGetToken particleDataTableToken_; edm::ESHandle transientTrackBuilder_; edm::ESGetToken transientTrackBuilderToken_; diff --git a/SimTracker/TrackHistory/src/TrackClassifier.cc b/SimTracker/TrackHistory/src/TrackClassifier.cc index d98e433f62ca9..6b55f63f06357 100644 --- a/SimTracker/TrackHistory/src/TrackClassifier.cc +++ b/SimTracker/TrackHistory/src/TrackClassifier.cc @@ -19,6 +19,7 @@ TrackClassifier::TrackClassifier(edm::ParameterSet const &config, edm::ConsumesC tracer_(config, std::move(collector)), quality_(config, collector), magneticFieldToken_(collector.esConsumes()), + particleDataTableToken_(collector.esConsumes()), transientTrackBuilderToken_(collector.esConsumes()), tTopoHandToken_(collector.esConsumes()) { collector.consumes(hepMCLabel_); @@ -58,7 +59,7 @@ void TrackClassifier::newEvent(edm::Event const &event, edm::EventSetup const &s magneticField_ = setup.getHandle(magneticFieldToken_); // Get the partivle data table - setup.getData(particleDataTable_); + particleDataTable_ = setup.getHandle(particleDataTableToken_); // get the beam spot event.getByLabel(beamSpotLabel_, beamSpot_); diff --git a/SimTracker/TrackHistory/src/TrackHistory.cc b/SimTracker/TrackHistory/src/TrackHistory.cc index f52862a2b75d0..017b087625f53 100644 --- a/SimTracker/TrackHistory/src/TrackHistory.cc +++ b/SimTracker/TrackHistory/src/TrackHistory.cc @@ -1,5 +1,4 @@ -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" #include "SimTracker/TrackHistory/interface/TrackHistory.h" TrackHistory::TrackHistory(const edm::ParameterSet &config, edm::ConsumesCollector &&collector) : HistoryBase() { diff --git a/SimTracker/VertexAssociation/test/BuildFile.xml b/SimTracker/VertexAssociation/test/BuildFile.xml index 95b0652d71511..ca00dd96352d1 100644 --- a/SimTracker/VertexAssociation/test/BuildFile.xml +++ b/SimTracker/VertexAssociation/test/BuildFile.xml @@ -6,7 +6,6 @@ - diff --git a/SimTracker/VertexAssociation/test/testVertexAssociator.cc b/SimTracker/VertexAssociation/test/testVertexAssociator.cc index b238910f4254c..d03f73363d944 100644 --- a/SimTracker/VertexAssociation/test/testVertexAssociator.cc +++ b/SimTracker/VertexAssociation/test/testVertexAssociator.cc @@ -9,7 +9,6 @@ #include "SimDataFormats/Associations/interface/VertexToTrackingVertexAssociator.h" #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h" #include "SimDataFormats/TrackingAnalysis/interface/TrackingVertexContainer.h" -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" #include "SimTracker/VertexAssociation/test/testVertexAssociator.h" #include "CommonTools/Statistics/interface/ChiSquaredProbability.h" diff --git a/SimTransport/HectorProducer/src/HectorProducer.cc b/SimTransport/HectorProducer/src/HectorProducer.cc index 2b83376bee320..44c181bf1b794 100644 --- a/SimTransport/HectorProducer/src/HectorProducer.cc +++ b/SimTransport/HectorProducer/src/HectorProducer.cc @@ -8,7 +8,7 @@ #include "FWCore/Utilities/interface/RandomNumberGenerator.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "IOMC/RandomEngine/src/TRandomAdaptor.h" +#include "IOMC/RandomEngine/interface/TRandomAdaptor.h" // SimpleConfigurable replacement #include "FWCore/ParameterSet/interface/ParameterSet.h" diff --git a/TrackingTools/Configuration/python/TrackingTools_EventContent_cff.py b/TrackingTools/Configuration/python/TrackingTools_EventContent_cff.py index 742f4ec9db284..59950832d1b2c 100644 --- a/TrackingTools/Configuration/python/TrackingTools_EventContent_cff.py +++ b/TrackingTools/Configuration/python/TrackingTools_EventContent_cff.py @@ -8,8 +8,6 @@ ) from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal -phase2_hgcal.toModify( TrackingToolsAOD, - outputCommands = TrackingToolsAOD.outputCommands + ['keep recoGsfTracks_electronGsfTracksFromMultiCl_*_*']) #RECO content TrackingToolsRECO = cms.PSet( @@ -22,15 +20,6 @@ ) ) TrackingToolsRECO.outputCommands.extend(TrackingToolsAOD.outputCommands) -_phase2_hgcal_TrackingRECO_tokeep = [ - 'keep recoGsfTracks_electronGsfTracksFromMultiCl_*_*', - 'keep recoGsfTrackExtras_electronGsfTracksFromMultiCl_*_*', - 'keep recoTrackExtras_electronGsfTracksFromMultiCl_*_*', - 'keep TrackingRecHitsOwned_electronGsfTracksFromMultiCl_*_*', - 'keep *_electronMergedSeedsFromMultiCl_*_*' -] -phase2_hgcal.toModify( TrackingToolsRECO, - outputCommands = TrackingToolsRECO.outputCommands + _phase2_hgcal_TrackingRECO_tokeep) #FEVT content TrackingToolsFEVT = cms.PSet( diff --git a/TrackingTools/GsfTracking/python/CkfElectronCandidateMaker_cff.py b/TrackingTools/GsfTracking/python/CkfElectronCandidateMaker_cff.py index 69f0587d042ff..4637ff89f611b 100644 --- a/TrackingTools/GsfTracking/python/CkfElectronCandidateMaker_cff.py +++ b/TrackingTools/GsfTracking/python/CkfElectronCandidateMaker_cff.py @@ -69,7 +69,3 @@ # "forward" propagator for electrons from TrackingTools.GsfTracking.fwdGsfElectronPropagator_cff import * # TrajectoryFilter - -electronCkfTrackCandidatesFromMultiCl = electronCkfTrackCandidates.clone( - src = 'electronMergedSeedsFromMultiCl' -) diff --git a/TrackingTools/GsfTracking/python/GsfElectronGsfFit_cff.py b/TrackingTools/GsfTracking/python/GsfElectronGsfFit_cff.py index 1bd6d2c66f914..f5fa00d23d49b 100644 --- a/TrackingTools/GsfTracking/python/GsfElectronGsfFit_cff.py +++ b/TrackingTools/GsfTracking/python/GsfElectronGsfFit_cff.py @@ -17,7 +17,3 @@ fastSim.toModify(electronGsfTracks, src = "fastElectronCkfTrackCandidates", TTRHBuilder = "WithoutRefit") - -electronGsfTracksFromMultiCl = electronGsfTracks.clone( - src = 'electronCkfTrackCandidatesFromMultiCl' -) diff --git a/TrackingTools/GsfTracking/python/GsfElectronTracking_cff.py b/TrackingTools/GsfTracking/python/GsfElectronTracking_cff.py index 759fcfbcdd44b..01dd0c6e15801 100644 --- a/TrackingTools/GsfTracking/python/GsfElectronTracking_cff.py +++ b/TrackingTools/GsfTracking/python/GsfElectronTracking_cff.py @@ -6,17 +6,10 @@ electronSeedsTask = cms.Task(trackerDrivenElectronSeeds,ecalDrivenElectronSeeds,electronMergedSeeds) electronSeeds = cms.Sequence(electronSeedsTask) -_electronSeedsTaskFromMultiCl = electronSeedsTask.copy() -_electronSeedsTaskFromMultiCl.add(cms.Task(ecalDrivenElectronSeedsFromMultiCl,electronMergedSeedsFromMultiCl)) -_electronSeedsFromMultiCl = cms.Sequence(_electronSeedsTaskFromMultiCl) from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA pp_on_AA.toReplaceWith(electronSeedsTask, electronSeedsTask.copyAndExclude([trackerDrivenElectronSeeds])) -from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal -phase2_hgcal.toReplaceWith( - electronSeedsTask, _electronSeedsTaskFromMultiCl ) - from Configuration.Eras.Modifier_fastSim_cff import fastSim _fastSim_electronSeedsTask = electronSeedsTask.copy() _fastSim_electronSeedsTask.replace(trackerDrivenElectronSeeds, cms.Task(trackerDrivenElectronSeedsTmp,trackerDrivenElectronSeeds)) @@ -31,7 +24,6 @@ electronGsfTrackingTask = cms.Task(electronSeedsTask,electronCkfTrackCandidates,electronGsfTracks) electronGsfTracking = cms.Sequence(electronGsfTrackingTask) _electronGsfTrackingTask = electronGsfTrackingTask.copy() -_electronGsfTrackingTask.add(cms.Task(electronCkfTrackCandidatesFromMultiCl,electronGsfTracksFromMultiCl)) _fastSim_electronGsfTrackingTask = electronGsfTrackingTask.copy() _fastSim_electronGsfTrackingTask.replace(electronCkfTrackCandidates,fastElectronCkfTrackCandidates) fastSim.toReplaceWith(electronGsfTrackingTask,_fastSim_electronGsfTrackingTask) diff --git a/Utilities/RelMon/python/definitions.py b/Utilities/RelMon/python/definitions.py index 34d5b8ddb7e1d..7e37105ef4c0d 100755 --- a/Utilities/RelMon/python/definitions.py +++ b/Utilities/RelMon/python/definitions.py @@ -39,7 +39,7 @@ cat_names={FAIL:"Failing", NULL:"Null", SUCCESS:"Successful", - SKIPED: "Skiped"} + SKIPED: "Skipped"} # Names used internally cat_states={FAIL:-1, NULL:0, @@ -49,7 +49,7 @@ cat_classes={FAIL:"fail", NULL:"null", SUCCESS:"succes", - SKIPED: "skiped"} # 1s to avoid conflicts with blueoprint + SKIPED: "skipped"} # 1s to avoid conflicts with blueoprint #------------------------------------------------------------------------------- # Aggregation of names for the global directory diff --git a/Utilities/ReleaseScripts/python/cmsCodeRules/Formatter.py b/Utilities/ReleaseScripts/python/cmsCodeRules/Formatter.py index 46624b8e0810f..2e2a520c8cdf9 100644 --- a/Utilities/ReleaseScripts/python/cmsCodeRules/Formatter.py +++ b/Utilities/ReleaseScripts/python/cmsCodeRules/Formatter.py @@ -161,7 +161,7 @@ def writeRow(self, args, bold=False, cls=None) : else: self.outFile.write( " " + '\n') for arg in args: - if string.strip(str(arg)) == "" : arg = " " + if str(arg).strip() == "" : arg = " " if bold: self.outFile.write( ' ' ) else: self.outFile.write( " " ) self.outFile.write( arg ) @@ -175,7 +175,7 @@ def writeStyledRow(self, args, styles) : # we assume that headers are done by now !! self.outFile.write( " " + '\n') for arg, cellStyle in zip(args, styles): - if string.strip(str(arg)) == "" : arg = " " + if str(arg).strip() == "" : arg = " " cellStyle = cellStyle.strip() if cellStyle != '' : self.outFile.write( ' ' ) else: self.outFile.write( " " ) diff --git a/Utilities/ReleaseScripts/python/cmsCodeRules/pickleFileCreater.py b/Utilities/ReleaseScripts/python/cmsCodeRules/pickleFileCreater.py index ab549bc24d8b7..bc2dbdf287a1d 100644 --- a/Utilities/ReleaseScripts/python/cmsCodeRules/pickleFileCreater.py +++ b/Utilities/ReleaseScripts/python/cmsCodeRules/pickleFileCreater.py @@ -13,7 +13,7 @@ def createPickleFile(fileName, listRule, path = os.getcwd()): try: for filePath, lines in listRule: dict[filePath] = lines - file = open(join(path, fileName), 'w') + file = open(join(path, fileName), 'wb') pickle.dump(dict, file) file.close() except TypeError: diff --git a/Utilities/ReleaseScripts/python/cmsCodeRules/pickleFileParser.py b/Utilities/ReleaseScripts/python/cmsCodeRules/pickleFileParser.py index 5b8724b606efb..003edb225c5fa 100644 --- a/Utilities/ReleaseScripts/python/cmsCodeRules/pickleFileParser.py +++ b/Utilities/ReleaseScripts/python/cmsCodeRules/pickleFileParser.py @@ -24,7 +24,7 @@ def readPicFiles(directory, toSplit = False): ruleName = fileName[11:-4] rulesNames.append(ruleName) - file = open(file) + file = open(file, 'rb') ruleResult = pickle.load(file) if toSplit: ruleResult = splitToPackages(ruleResult) diff --git a/Utilities/StorageFactory/src/StatisticsSenderService.cc b/Utilities/StorageFactory/src/StatisticsSenderService.cc index edec9b4a394c2..53457f49e0b81 100644 --- a/Utilities/StorageFactory/src/StatisticsSenderService.cc +++ b/Utilities/StorageFactory/src/StatisticsSenderService.cc @@ -4,7 +4,7 @@ #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h" #include "FWCore/Catalog/interface/SiteLocalConfig.h" #include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/Utilities/src/Guid.h" +#include "FWCore/Utilities/interface/Guid.h" #include #include diff --git a/Validation/CaloTowers/test/macros/Makefile b/Validation/CaloTowers/test/macros/Makefile index 512662d43ad07..d9672956d121f 100644 --- a/Validation/CaloTowers/test/macros/Makefile +++ b/Validation/CaloTowers/test/macros/Makefile @@ -7,5 +7,5 @@ singlePi.exe : SinglePi.C $(GCC) RelValMacro.so : RelValMacro.C - $(eval tpypath := $(shell python get.py '$(CMSSW_FWLITE_INCLUDE_PATH)')) + $(eval tpypath := $(shell python3 get.py '$(CMSSW_FWLITE_INCLUDE_PATH)')) g++ -fPIC -shared RelValMacro.C -o RelValMacro.so -I $(tpypath)/include/ -I /cvmfs/cms.cern.ch/slc6_amd64_gcc491/external/python/2.7.6-eccfad/include/python2.7 -L /cvmfs/cms.cern.ch/slc6_amd64_gcc491/external/python/2.7.6-eccfad/lib -lpython2.7 -L $(tpypath)/lib -lboost_python -g `root-config --cflags --glibs` diff --git a/Validation/CaloTowers/test/macros/RelValHarvest.py b/Validation/CaloTowers/test/macros/RelValHarvest.py index 2099399448d39..86d412f71594e 100755 --- a/Validation/CaloTowers/test/macros/RelValHarvest.py +++ b/Validation/CaloTowers/test/macros/RelValHarvest.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys, os, re diff --git a/Validation/CaloTowers/test/macros/RelValHarvest_2018A.py b/Validation/CaloTowers/test/macros/RelValHarvest_2018A.py index 9ce3bef11437f..ae46f7a422d79 100755 --- a/Validation/CaloTowers/test/macros/RelValHarvest_2018A.py +++ b/Validation/CaloTowers/test/macros/RelValHarvest_2018A.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys, os, re diff --git a/Validation/CaloTowers/test/macros/RelValHarvest_2018B.py b/Validation/CaloTowers/test/macros/RelValHarvest_2018B.py index e6f0b80719ca0..8a657d176e669 100755 --- a/Validation/CaloTowers/test/macros/RelValHarvest_2018B.py +++ b/Validation/CaloTowers/test/macros/RelValHarvest_2018B.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys, os, re diff --git a/Validation/CaloTowers/test/macros/RelValMacro.C b/Validation/CaloTowers/test/macros/RelValMacro.C index 27dbfa6fdd375..bec48e04b3b32 100644 --- a/Validation/CaloTowers/test/macros/RelValMacro.C +++ b/Validation/CaloTowers/test/macros/RelValMacro.C @@ -28,870 +28,913 @@ #include #include -template -void prn(T1 s1, T2 s2) -{ - std::cout << "\t>> " << s1 << ": " << s2 << std::endl; +template +void prn(T1 s1, T2 s2) { + std::cout << "\t>> " << s1 << ": " << s2 << std::endl; } void RelValMacro(std::string seriesOfTubes); -void ProcessRelVal(TFile *ref_file, TFile *val_file, std::string ref_vers, std::string val_vers, std::string histName, std::string outLabel, int nRebin, double xAxisMin, double xAxisMax, double yAxisMin, double yAxisMax, - std::string dimSwitch, std::string statSwitch, std::string chi2Switch, std::string logSwitch, std::string ratioFlag, int refCol, int valCol, std::string xAxisTitle, std::string normFlag, std::string histName2 = ""); -template +void ProcessRelVal(TFile* ref_file, + TFile* val_file, + std::string ref_vers, + std::string val_vers, + std::string histName, + std::string outLabel, + int nRebin, + double xAxisMin, + double xAxisMax, + double yAxisMin, + double yAxisMax, + std::string dimSwitch, + std::string statSwitch, + std::string chi2Switch, + std::string logSwitch, + std::string ratioFlag, + int refCol, + int valCol, + std::string xAxisTitle, + std::string normFlag, + std::string histName2 = ""); +template void setObjProps(T obj); -class DirectoryFinder -{ +class DirectoryFinder { private: - std::map ptdMap; - TDirectory* findDirectory( TDirectory *target, std::string& s, int dig = 2); + std::map ptdMap; + TDirectory* findDirectory(TDirectory* target, std::string& s, int dig = 2); + public: - TDirectory* operator()(TDirectory *target, std::string& s); + TDirectory* operator()(TDirectory* target, std::string& s); } dfRef, dfVal; +void RelValMacro(std::string seriesOfTubes) { + //Split the string passed from the python3 driver + std::stringstream ss(seriesOfTubes); + std::string item; + std::vector props; + while (getline(ss, item, '|')) { + props.push_back(item); + } + std::string ref_vers = props[0]; + std::string val_vers = props[1]; + std::string rfname = props[2]; + std::string vfname = props[3]; + std::string histName = props[4]; + std::string ofileName = props[5]; + int nRebin = std::stoi(props[6]); + double xAxisMin = std::stod(props[7]); + double xAxisMax = std::stod(props[8]); + double yAxisMin = std::stod(props[9]); + double yAxisMax = std::stod(props[10]); + std::string dimFlag = props[11]; + std::string statFlag = props[12]; + std::string chi2Flag = props[13]; + std::string logFlag = props[14]; + std::string ratioFlag = props[15]; + int refCol = std::stoi(props[16]); + int valCol = std::stoi(props[17]); + std::string xAxisTitle = props[18]; + std::string histName2 = props[19]; + std::string normFlag = props[20]; + + if (strcmp(histName.c_str(), "HcalDigiTask/HcalDigiTask_signal_amplitude_HE") == 0) { + std::cout << "==================" << std::endl; + std::cout << xAxisMin << " " << xAxisMax << std::endl; + } + //Warning!!! This rootlogon hacks the root color pallate. This should probably be rewritten. + setColors(); + + TFile* Ref_File = new TFile(rfname.c_str()); + TFile* Val_File = new TFile(vfname.c_str()); + + if (Ref_File && Val_File) { + if (histName2 == "none") + histName2 = ""; + + //Make plot + ProcessRelVal(Ref_File, + Val_File, + ref_vers, + val_vers, + histName, + ofileName, + nRebin, + xAxisMin, + xAxisMax, + yAxisMin, + yAxisMax, + dimFlag, + statFlag, + chi2Flag, + logFlag, + ratioFlag, + refCol, + valCol, + xAxisTitle, + histName2, + normFlag); + } else { + if (!Ref_File) + std::cout << "Input root file \"" << rfname << "\" not found!!!" << std::endl; + if (!Val_File) + std::cout << "Input root file \"" << vfname << "\" not found!!!" << std::endl; + } + + // ProcessSubDetCT(Ref_File, Val_File, RelValStream, CT_nHist1, CT_nHist2, CT_nProf, CT_nHistTot, ref_vers, val_vers, harvest); + + return; +} -void RelValMacro(std::string seriesOfTubes) -{ - //Split the string passed from the python driver - std::stringstream ss(seriesOfTubes); - std::string item; - std::vector props; - while (getline(ss, item, '|')) { - props.push_back(item); +void ProcessRelVal(TFile* ref_file, + TFile* val_file, + std::string ref_vers, + std::string val_vers, + std::string histName, + std::string outLabel, + int nRebin, + double xAxisMin, + double xAxisMax, + double yAxisMin, + double yAxisMax, + std::string dimSwitch, + std::string statSwitch, + std::string chi2Switch, + std::string logSwitch, + std::string ratioFlag, + int refCol, + int valCol, + std::string xAxisTitle, + std::string histName2, + std::string normFlag) { + std::string NormHist = "HcalRecHitTask/N_HB"; + + //split directory off histName + int slashLoc = histName.rfind("/"); + std::string histDir = histName.substr(0, slashLoc); + if (slashLoc < histName.size() - 1) + histName = histName.substr(slashLoc + 1, histName.size()); + + int slashLocN = NormHist.rfind("/"); + std::string histDirN = NormHist.substr(0, slashLocN); + if (slashLocN < NormHist.size() - 1) + NormHist = NormHist.substr(slashLocN + 1, NormHist.size()); + + std::cout << "Processing \"" << histDir << "/" << histName << "\"" << std::endl; + + //Get objects from TFiles + TDirectory* refTD = dfRef(ref_file, histDir); + TObject* refObj = 0; + + TDirectory* refTDN = dfRef(ref_file, histDirN); + TObject* refObjN = 0; + + if (refTD) { + refObj = refTD->Get(histName.c_str()); + if (refObj) + refObj = refObj->Clone(); + } else { + std::cout << "Cannot find directory \"" << histDir << "\" in file \"" << ref_file->GetName() << "\"" << std::endl; + return; + } + if (!refObj) { + std::cout << "Cannot find histogram \"" << histDir << "/" << histName << "\" in file \"" << ref_file->GetName() + << "\"" << std::endl; + return; + } + + if (refTDN) { + refObjN = refTDN->Get(NormHist.c_str()); + if (refObjN) + refObjN = refObjN->Clone(); + } else { + std::cout << "Cannot find directory \"" << histDirN << "\" in file \"" << ref_file->GetName() << "\"" << std::endl; + } + if (!refObjN) { + std::cout << "Cannot find histogram \"" << histDirN << "/" << NormHist << "\" in file \"" << ref_file->GetName() + << "\"" << std::endl; + } + + TDirectory* valTD = dfVal(val_file, histDir); + TObject* valObj = 0; + TDirectory* valTDN = dfVal(val_file, histDirN); + TObject* valObjN = 0; + if (valTD) { + valObj = valTD->Get(histName.c_str()); + if (valObj) + valObj = valObj->Clone(); + } else { + std::cout << "Cannot find directory \"" << histDir << "\" in file \"" << val_file->GetName() << "\"" << std::endl; + return; + } + if (!valObj) { + std::cout << "Cannot find histogram \"" << histDir << "/" << histName << "\" in file \"" << val_file->GetName() + << "\"" << std::endl; + return; + } + + if (valTDN) { + valObjN = valTDN->Get(NormHist.c_str()); + if (valObjN) + valObjN = valObjN->Clone(); + } else { + std::cout << "Cannot find directory \"" << histDirN << "\" in file \"" << val_file->GetName() << "\"" << std::endl; + } + if (!valObjN) { + std::cout << "Cannot find histogram \"" << histDirN << "/" << NormHist << "\" in file \"" << val_file->GetName() + << "\"" << std::endl; + } + + //Try to continue processing even if N_HB is missing + //We only care if the ratio flag is set + //If we can't find any way to normalize the plots, unset the ratioflag + if (std::stoi(ratioFlag) == 1) { + if (!refTDN && !valTDN) { + std::cout << "Cannot find directory \"" << histDirN << "\" in either file \"" << std::endl; + ratioFlag = "0"; } - std::string ref_vers = props[0]; - std::string val_vers = props[1]; - std::string rfname = props[2]; - std::string vfname = props[3]; - std::string histName = props[4]; - std::string ofileName = props[5]; - int nRebin = std::stoi(props[6]); - double xAxisMin = std::stod(props[7]); - double xAxisMax = std::stod(props[8]); - double yAxisMin = std::stod(props[9]); - double yAxisMax = std::stod(props[10]); - std::string dimFlag = props[11]; - std::string statFlag = props[12]; - std::string chi2Flag = props[13]; - std::string logFlag = props[14]; - std::string ratioFlag = props[15]; - int refCol = std::stoi(props[16]); - int valCol = std::stoi(props[17]); - std::string xAxisTitle = props[18]; - std::string histName2 = props[19]; - std::string normFlag = props[20]; - - if(strcmp(histName.c_str(),"HcalDigiTask/HcalDigiTask_signal_amplitude_HE") == 0) { - - std::cout<<"=================="<Clone(); + std::cout << "Using histogram \"" << NormHist << "from file \"" << ref_file->GetName() << std::endl; + } else if (!refObjN) { + refObjN = valObjN->Clone(); + std::cout << "Using histogram \"" << NormHist << "from file \"" << val_file->GetName() << std::endl; } - //Warning!!! This rootlogon hacks the root color pallate. This should probably be rewritten. - setColors(); - - TFile* Ref_File = new TFile(rfname.c_str()); - TFile* Val_File = new TFile(vfname.c_str()); - - - if(Ref_File && Val_File) - { - - if(histName2 == "none") histName2 = ""; - - //Make plot - ProcessRelVal(Ref_File, Val_File, ref_vers, val_vers, histName, ofileName, nRebin, xAxisMin, xAxisMax, yAxisMin, yAxisMax, dimFlag, statFlag, chi2Flag, logFlag, ratioFlag, refCol, valCol, xAxisTitle, histName2, normFlag); - } - else - { - if(!Ref_File) std::cout << "Input root file \"" << rfname << "\" not found!!!" << std::endl; - if(!Val_File) std::cout << "Input root file \"" << vfname << "\" not found!!!" << std::endl; - } - - -// ProcessSubDetCT(Ref_File, Val_File, RelValStream, CT_nHist1, CT_nHist2, CT_nProf, CT_nHistTot, ref_vers, val_vers, harvest); + } // Make sure we can normalize ratio plots - return; -} + std::cout << "Loaded \"" << histDir << "/" << histName << "\"" << std::endl; -void ProcessRelVal(TFile *ref_file, TFile *val_file, std::string ref_vers, std::string val_vers, std::string histName, std::string outLabel, int nRebin, double xAxisMin, double xAxisMax, double yAxisMin, double yAxisMax, - std::string dimSwitch, std::string statSwitch, std::string chi2Switch, std::string logSwitch, std::string ratioFlag, int refCol, int valCol, std::string xAxisTitle, std::string histName2, std::string normFlag) -{ - std::string NormHist = "HcalRecHitTask/N_HB"; + //Format canvas + TCanvas* myc = 0; + if (dimSwitch.compare("PRwide") == 0) { + gStyle->SetPadLeftMargin(0.06); + gStyle->SetPadRightMargin(0.03); + myc = new TCanvas("myc", "", 1200, 600); + } else + myc = new TCanvas("myc", "", 800, 600); + // gStyle->SetOptStat(0); + myc->SetGrid(); - //split directory off histName - int slashLoc = histName.rfind("/"); - std::string histDir = histName.substr(0, slashLoc); - if(slashLoc < histName.size() - 1) histName = histName.substr(slashLoc + 1, histName.size()); + TPad *pad1, *pad2; - int slashLocN = NormHist.rfind("/"); - std::string histDirN = NormHist.substr(0, slashLocN); - if(slashLocN < NormHist.size() - 1) NormHist = NormHist.substr(slashLocN + 1, NormHist.size()); + // Ratio Flag - std::cout << "Processing \"" << histDir << "/" << histName << "\"" << std::endl; + float nRef = 1, nVal = 1; - //Get objects from TFiles - TDirectory *refTD = dfRef(ref_file, histDir); - TObject *refObj = 0; - - TDirectory *refTDN = dfRef(ref_file, histDirN); - TObject *refObjN = 0; - - if(refTD) - { - refObj = refTD->Get(histName.c_str()); - if(refObj) refObj = refObj->Clone(); - } - else - { - std::cout << "Cannot find directory \"" << histDir << "\" in file \"" << ref_file->GetName() << "\"" << std::endl; - return; - } - if(!refObj) - { - std::cout << "Cannot find histogram \"" << histDir << "/" << histName << "\" in file \"" << ref_file->GetName() << "\"" << std::endl; - return; - } + std::cout << "Ratio Flag: " << std::stoi(ratioFlag) << std::endl; + + if (std::stoi(ratioFlag) == 1) { + std::cout << "Histogram will include ratio" << std::endl; + + TH1* refN_HB = (TH1*)refObjN; + TH1* valN_HB = (TH1*)valObjN; + + nRef = refN_HB->Integral(); + nVal = valN_HB->Integral(); - if(refTDN) - { - refObjN = refTDN->Get(NormHist.c_str()); - if(refObjN) refObjN = refObjN->Clone(); + // Divide canvas into two pads + // myc->Divide(1,2,0,0); + pad1 = new TPad("pad1", "pad1", 0.0, 0.3, 1.0, 1.0, 0); + pad1->SetBottomMargin(1); // Upper and lower plots are joined (0) or separate (1) + pad1->SetGridx(); // Vertical grid + pad1->SetFillColor(kCyan - 10); //spandey + pad2 = new TPad("pad2", "pad2", 0.0, 0.03, 1.0, 0.3, 0); //spandey updated pad size + pad2->SetTopMargin(0); + pad2->SetBottomMargin(0.2); + pad2->SetGridx(); // vertical grid + pad2->SetGridy(); // horizontal grid + pad2->SetFillColor(kCyan - 10); //spandey + + pad1->Draw(); + pad2->Draw(); + + // float pad2width = pad2->GetWw(); + // float pad2height = pad2->GetWh() * pad2->GetAbsHNCD(); + // float x2pixels = 10; + // float y2pixels = 10; + // float x2size = x2pixels / pad2width; + // float y2size = y2pixels / pad2height; + + //Format pads + // myc->cd(1); + // pad1->cd(); + if (logSwitch.compare("Log") == 0 && dimSwitch.compare("2D") == 0) { + pad1->SetLogy(0); + pad1->SetLogz(1); + } else if (logSwitch.compare("Log") == 0) { + pad1->SetLogy(1); } - else - { - std::cout << "Cannot find directory \"" << histDirN << "\" in file \"" << ref_file->GetName() << "\"" << std::endl; + // pad2->cd(); + pad2->SetGridy(); + + // pad1->cd(); + } + + std::string xTitleCheck = xAxisTitle; + xTitleCheck = xTitleCheck.substr(1, 7); + + if (dimSwitch.compare("1D") == 0) { + //Get histograms from objects + TH1* ref_hist1 = (TH1*)refObj; + TH1* val_hist1 = (TH1*)valObj; + + // change what is embedded in DQM histos + setObjProps(ref_hist1); + setObjProps(val_hist1); + + //Rebin histograms -- has to be done first + if (nRebin != 1) { + ref_hist1->Rebin(nRebin); + val_hist1->Rebin(nRebin); } - if(!refObjN) - { - std::cout << "Cannot find histogram \"" << histDirN << "/" << NormHist << "\" in file \"" << ref_file->GetName() << "\"" << std::endl; + + TH1* ratio_hist1; + + // Ratio Flag + if (std::stoi(ratioFlag) == 1) { + //Let's normalize the val plot to have the same number of events as the ref plot + //But only if normFlag isn't tripped + if (normFlag.compare("Norm") == 0) + val_hist1->Scale(nRef / nVal); + + //Create Copies (Clones) to use in Ratio Plot + TH1* ref_hist1_clone = (TH1*)ref_hist1->Clone("ref_hist1_clone"); + TH1* val_hist1_clone = (TH1*)val_hist1->Clone("val_hist1_clone"); + + //Prepare clones for correct uncertainties + ref_hist1_clone->Sumw2(); + val_hist1_clone->Sumw2(); + + // Normalize (scale = n_ref/n_val) + //float n_ref = ref_hist1_clone->Integral(); + //float n_val = val_hist1_clone->Integral(); + //float scale = n_ref/n_val; + //val_hist1_clone->Scale(scale); + + //Create ratio histogram (val - ref)/ref + ratio_hist1 = (TH1*)val_hist1_clone; + ratio_hist1->Sumw2(); + ratio_hist1->Add(ref_hist1_clone, -1.); + ratio_hist1->Divide(ref_hist1_clone); + + // //Format Ratio Plot + // float pad2width = pad2->GetWw(); + // float pad2height = pad2->GetWh() * pad2->GetAbsHNDC(); + // float x2pixels = 100; + // float y2pixels = 15; + // float x2size = x2pixels / pad2width; + // float y2size = y2pixels / pad2height; + // + // TAxis* x2axis = ratio_hist1->GetXaxis(); + // TAxis* y2axis = ratio_hist1->GetYaxis(); + // + // x2axis->SetTitleOffset(2); + // x2axis->SetTitleSize(0.15); + // x2axis->SetLabelSize(x2size); + // + // y2axis->SetTitleOffset(0.3); + // y2axis->SetTitleSize(0.12); + // y2axis->SetRangeUser(0,2.5); + // y2axis->SetLabelSize(y2size); + + // Sanitizing axis inputs + //Min/Max Convetion: Default AxisMin = 0. Default AxisMax = -1. + //xAxis + if (xAxisMin == 0) + xAxisMin = ref_hist1->GetXaxis()->GetXmin(); + if (xAxisMax < 0) + xAxisMax = ref_hist1->GetXaxis()->GetXmax(); + + //Sanitize xAxis inputs + if (xAxisMin < ref_hist1->GetXaxis()->GetXmin()) + xAxisMin = ref_hist1->GetXaxis()->GetXmin(); + if (xAxisMax > ref_hist1->GetXaxis()->GetXmax()) + xAxisMax = ref_hist1->GetXaxis()->GetXmax(); + + ratio_hist1->SetTitle(""); + ratio_hist1->SetLineStyle(1); + ratio_hist1->SetMarkerStyle(1); + ratio_hist1->SetMarkerSize(0.02); + + //Format Ratio Plot + //lets get schwifty + float pad2width = pad2->GetWw(); + float pad2height = pad2->GetWh() * pad2->GetAbsHNDC(); + float x2pixels = 100; + float y2pixels = 15; + float x2size = x2pixels / pad2width; + float y2size = y2pixels / pad2height; + + TAxis* x2axis = ratio_hist1->GetXaxis(); + TAxis* y2axis = ratio_hist1->GetYaxis(); + + x2axis->SetTitleOffset(1.0); // Important for seeing x-axis title! + x2axis->SetTitleSize(0.1); //spandey + x2axis->SetLabelSize(x2size * 0.64); + x2axis->SetRangeUser(xAxisMin, xAxisMax); + + y2axis->SetTitle("(val - ref)/ref"); + y2axis->SetTitleOffset(0.3); + y2axis->SetTitleSize(0.12); + // y2axis->SetRangeUser(0,2.5); + y2axis->SetLabelSize(y2size); + y2axis->SetNdivisions(4); + + ratio_hist1->SetStats(kFALSE); } - TDirectory *valTD = dfVal(val_file, histDir); - TObject *valObj = 0; - TDirectory *valTDN = dfVal(val_file, histDirN); - TObject *valObjN = 0; - if(valTD) - { - valObj = valTD->Get(histName.c_str()); - if(valObj) valObj = valObj->Clone(); + //Set the colors, styles, titles, stat boxes and format axes for the histograms + ref_hist1->SetStats(kTRUE); + val_hist1->SetStats(kTRUE); + + if (statSwitch.compare("Stat") != 0 && statSwitch.compare("Statrv") != 0) { + ref_hist1->SetStats(kFALSE); + val_hist1->SetStats(kFALSE); } - else - { - std::cout << "Cannot find directory \"" << histDir << "\" in file \"" << val_file->GetName() << "\"" << std::endl; - return; + + //Min/Max Convetion: Default AxisMin = 0. Default AxisMax = -1. + //xAxis + if (xAxisMin == 0) + xAxisMin = ref_hist1->GetXaxis()->GetXmin(); + if (xAxisMax < 0) + xAxisMax = ref_hist1->GetXaxis()->GetXmax(); + + //Sanitize xAxis inputs + if (xAxisMin < ref_hist1->GetXaxis()->GetXmin()) + xAxisMin = ref_hist1->GetXaxis()->GetXmin(); + if (xAxisMax > ref_hist1->GetXaxis()->GetXmax()) + xAxisMax = ref_hist1->GetXaxis()->GetXmax(); + + if (xAxisMax > 0 || xAxisMin != 0) { + ref_hist1->GetXaxis()->SetRangeUser(xAxisMin, xAxisMax); + val_hist1->GetXaxis()->SetRangeUser(xAxisMin, xAxisMax); } - if(!valObj) - { - std::cout << "Cannot find histogram \"" << histDir << "/" << histName << "\" in file \"" << val_file->GetName() << "\"" << std::endl; - return; + //yAxis + if (yAxisMin != 0) + ref_hist1->SetMinimum(yAxisMin); + if (yAxisMax > 0) + ref_hist1->SetMaximum(yAxisMax); + else if (ref_hist1->GetMaximum() < val_hist1->GetMaximum() && val_hist1->GetMaximum() > 0) { + if (logSwitch.compare("Log") == 0) + ref_hist1->SetMaximum(2 * val_hist1->GetMaximum()); + else + ref_hist1->SetMaximum(1.05 * val_hist1->GetMaximum()); } - if(valTDN) - { - valObjN = valTDN->Get(NormHist.c_str()); - if(valObjN) valObjN = valObjN->Clone(); + //Title + // if (xTitleCheck != "NoTitle") ref_hist1->GetXaxis()->SetTitle(xAxisTitle.c_str()); + ref_hist1->GetXaxis()->SetTitle(""); + if (xTitleCheck != "NoTitle" && std::stoi(ratioFlag) == 1) + ratio_hist1->GetXaxis()->SetTitle(xAxisTitle.c_str()); + if (xTitleCheck != "NoTitle" && std::stoi(ratioFlag) != 1) + ref_hist1->GetXaxis()->SetTitle(xAxisTitle.c_str()); + + //Different histo colors and styles + ref_hist1->SetTitle(""); + ref_hist1->SetLineColor(refCol); + ref_hist1->SetLineStyle(1); + ref_hist1->SetMarkerSize(0.02); + + val_hist1->SetTitle(""); + val_hist1->SetLineColor(valCol); + val_hist1->SetLineStyle(2); + val_hist1->SetMarkerSize(0.02); + if (statSwitch.compare("Stat") != 0 && statSwitch.compare("Statrv") != 0) { + ref_hist1->SetLineWidth(2); + val_hist1->SetLineWidth(2); } - else - { - std::cout << "Cannot find directory \"" << histDirN << "\" in file \"" << val_file->GetName() << "\"" << std::endl; + + //Legend + TLegend* leg = new TLegend(0.50, 0.91, 0.84, 0.99, "", "brNDC"); + leg->SetBorderSize(2); + leg->SetFillStyle(1001); + leg->AddEntry(ref_hist1, ("CMSSW_" + ref_vers).c_str(), "l"); + leg->AddEntry(val_hist1, ("CMSSW_" + val_vers).c_str(), "l"); + + //It's time to draw (#yolo)! + if (chi2Switch.compare("Chi2") == 0) { + // Title Time + + //Draw and save histograms + if (std::stoi(ratioFlag) == 1) { + pad1->cd(); + } + ref_hist1->SetFillColor(40); //42 Originally, now 40 which is light brown + ref_hist1->Draw("hist"); + val_hist1->SetLineStyle(1); + if (statSwitch.compare("Statrv") == 0) + val_hist1->Draw("sames e0"); + else + val_hist1->Draw("same e0"); + + // Ratio Flag + if (std::stoi(ratioFlag) == 1) { + //Draw ratio + pad2->cd(); + //pad1->cd(); + ratio_hist1->Draw(); + pad1->cd(); + //pad2->cd(); + } + + //Get p-value from chi2 test + const float NCHI2MIN = 0.01; + + float pval; + char tempbuff[30]; + + pval = ref_hist1->Chi2Test(val_hist1); + + sprintf(tempbuff, "Chi2 p-value: %6.3E", pval); + + TPaveText* ptchi2 = new TPaveText(0.05, 0.92, 0.35, 0.99, "NDC"); + + if (pval > NCHI2MIN) + ptchi2->SetFillColor(kGreen); + else + ptchi2->SetFillColor(kRed); + + ptchi2->SetTextSize(0.03); + ptchi2->AddText(tempbuff); + ptchi2->Draw(); + } else { + // Title Time + + //Draw and save histograms + if (std::stoi(ratioFlag) == 1) { + pad1->cd(); + } + ref_hist1->Draw("hist"); + if (statSwitch.compare("Statrv") == 0) + val_hist1->Draw("hist sames"); + else + val_hist1->Draw("hist same"); + + // Ratio Flag + if (std::stoi(ratioFlag) == 1) { + //Draw ratio + pad2->cd(); + ratio_hist1->Draw(); + pad1->cd(); + } } - if(!valObjN) - { - std::cout << "Cannot find histogram \"" << histDirN << "/" << NormHist << "\" in file \"" << val_file->GetName() << "\"" << std::endl; + + //Stat Box where required + if (statSwitch.compare("Stat") == 0 || statSwitch.compare("Statrv") == 0) { + TPaveStats* ptstats_r = new TPaveStats(0.85, 0.86, 0.98, 0.98, "brNDC"); + ptstats_r->SetTextColor(refCol); + ref_hist1->GetListOfFunctions()->Add(ptstats_r); + ptstats_r->SetParent(ref_hist1->GetListOfFunctions()); + TPaveStats* ptstats_v = new TPaveStats(0.85, 0.74, 0.98, 0.86, "brNDC"); + ptstats_v->SetTextColor(valCol); + val_hist1->GetListOfFunctions()->Add(ptstats_v); + ptstats_v->SetParent(val_hist1->GetListOfFunctions()); + + ptstats_r->Draw(); + ptstats_v->Draw(); } - //Try to continue processing even if N_HB is missing - //We only care if the ratio flag is set - //If we can't find any way to normalize the plots, unset the ratioflag - if(std::stoi(ratioFlag) == 1){ - if(!refTDN && !valTDN) - { - std::cout << "Cannot find directory \"" << histDirN << "\" in either file \"" << std::endl; - ratioFlag = "0"; - } - - if(!refObjN && !valObjN) - { - std::cout << "Cannot find histogram \"" << histDirN << "/" << NormHist << "\" in either file \"" << std::endl; - ratioFlag = "0"; - } - else if(!valObjN) - { - valObjN = refObjN->Clone(); - std::cout << "Using histogram \"" << NormHist << "from file \"" << ref_file->GetName() << std::endl; - } - else if(!refObjN) - { - refObjN = valObjN->Clone(); - std::cout << "Using histogram \"" << NormHist << "from file \"" << val_file->GetName() << std::endl; - } - }// Make sure we can normalize ratio plots - - std::cout << "Loaded \"" << histDir << "/" << histName << "\"" << std::endl; - - //Format canvas - TCanvas *myc = 0; - if (dimSwitch.compare("PRwide") == 0) { - gStyle->SetPadLeftMargin(0.06); - gStyle->SetPadRightMargin(0.03); - myc = new TCanvas("myc", "", 1200, 600); - } else myc = new TCanvas("myc", "", 800, 600); -// gStyle->SetOptStat(0); - myc->SetGrid(); - - TPad *pad1, *pad2; - -// Ratio Flag - - float nRef =1, nVal = 1; - - std::cout << "Ratio Flag: " << std::stoi(ratioFlag) << std::endl; - - if(std::stoi(ratioFlag) == 1) { - - std::cout << "Histogram will include ratio" << std::endl; - - TH1* refN_HB = (TH1*)refObjN; - TH1* valN_HB = (TH1*)valObjN; - - nRef = refN_HB->Integral(); - nVal = valN_HB->Integral(); - - // Divide canvas into two pads - // myc->Divide(1,2,0,0); - pad1 = new TPad("pad1","pad1", 0.0, 0.3, 1.0, 1.0, 0); - pad1->SetBottomMargin(1); // Upper and lower plots are joined (0) or separate (1) - pad1->SetGridx(); // Vertical grid - pad1->SetFillColor(kCyan-10); //spandey - pad2 = new TPad("pad2","pad2", 0.0, 0.03, 1.0, 0.3, 0); //spandey updated pad size - pad2->SetTopMargin(0); - pad2->SetBottomMargin(0.2); - pad2->SetGridx(); // vertical grid - pad2->SetGridy(); // horizontal grid - pad2->SetFillColor(kCyan-10); //spandey - - pad1->Draw(); - pad2->Draw(); - - // float pad2width = pad2->GetWw(); - // float pad2height = pad2->GetWh() * pad2->GetAbsHNCD(); - // float x2pixels = 10; - // float y2pixels = 10; - // float x2size = x2pixels / pad2width; - // float y2size = y2pixels / pad2height; - - //Format pads - // myc->cd(1); - // pad1->cd(); - if(logSwitch.compare("Log") == 0 && dimSwitch.compare("2D") == 0) - { - pad1->SetLogy(0); - pad1->SetLogz(1); - } - else if(logSwitch.compare("Log") == 0) - { - pad1->SetLogy(1); - } -// pad2->cd(); - pad2->SetGridy(); - -// pad1->cd(); - + leg->Draw(); + + myc->SaveAs(outLabel.c_str()); + } + //Profiles not associated with histograms + else if (dimSwitch.compare("PR") == 0 || dimSwitch.compare("PRwide") == 0) { + //Get profiles from objects + TProfile* ref_prof = (TProfile*)refObj; + TProfile* val_prof = (TProfile*)valObj; + + // HACK to change what is embedded in DQM histos + setObjProps(ref_prof); + setObjProps(val_prof); + + //Legend + TLegend* leg = new TLegend(0.50, 0.91, 0.84, 0.99, "", "brNDC"); + leg->SetBorderSize(2); + leg->SetFillStyle(1001); + + //Ordinary profiles + if (dimSwitch.compare("PR") == 0) { + ref_prof->SetTitle(""); + ref_prof->SetErrorOption(""); + + val_prof->SetTitle(""); + val_prof->SetErrorOption(""); + + ref_prof->GetXaxis()->SetTitle(xAxisTitle.c_str()); + + if (statSwitch.compare("Stat") != 0 && statSwitch.compare("Statrv") != 0) { + ref_prof->SetStats(kFALSE); + val_prof->SetStats(kFALSE); + } + + ref_prof->SetLineColor(41); + ref_prof->SetLineStyle(1); + ref_prof->SetLineWidth(1); + ref_prof->SetMarkerColor(41); + ref_prof->SetMarkerStyle(21); + ref_prof->SetMarkerSize(0.8); + + val_prof->SetLineColor(43); + val_prof->SetLineStyle(1); + val_prof->SetLineWidth(1); + val_prof->SetMarkerColor(43); + val_prof->SetMarkerStyle(22); + val_prof->SetMarkerSize(1.0); + + if (ref_prof->GetMaximum() < val_prof->GetMaximum() && val_prof->GetMaximum() > 0) { + if (logSwitch.compare("Log") == 0) + ref_prof->SetMaximum(2 * val_prof->GetMaximum()); + else + ref_prof->SetMaximum(1.05 * val_prof->GetMaximum()); + } + + ref_prof->Draw("hist pl"); + val_prof->Draw("hist pl same"); + + leg->AddEntry(ref_prof, ("CMSSW_" + ref_vers).c_str(), "pl"); + leg->AddEntry(val_prof, ("CMSSW_" + val_vers).c_str(), "pl"); + } //Wide profiles + else if (dimSwitch.compare("PRwide") == 0) { + char temp[128]; + sprintf(temp, "%s_px_v", ref_prof->GetName()); + TH1* ref_fp = ref_prof->ProjectionX(); + TH1* val_fp = val_prof->ProjectionX(temp); + + ref_fp->SetTitle(""); + val_fp->SetTitle(""); + + ref_fp->GetXaxis()->SetTitle(xAxisTitle.c_str()); + + if (statSwitch.compare("Stat") != 0 && statSwitch.compare("Statrv") != 0) { + ref_fp->SetStats(kFALSE); + val_fp->SetStats(kFALSE); + } + + int nbins = ref_fp->GetNbinsX(); + for (int j = 1; j < nbins; j++) { + ref_fp->SetBinError(j, 0.); + val_fp->SetBinError(j, 0.); + } + ref_fp->SetLineWidth(0); + ref_fp->SetLineColor(0); // 5 yellow + ref_fp->SetLineStyle(1); + ref_fp->SetMarkerColor(2); + ref_fp->SetMarkerStyle(20); + ref_fp->SetMarkerSize(0.5); + + val_fp->SetLineWidth(0); + val_fp->SetLineColor(0); // 45 blue + val_fp->SetLineStyle(2); + val_fp->SetMarkerColor(4); + val_fp->SetMarkerStyle(22); + val_fp->SetMarkerSize(0.5); + + if (ref_fp->GetMaximum() < val_fp->GetMaximum() && val_fp->GetMaximum() > 0) { + if (logSwitch.compare("Log") == 0) + ref_fp->SetMaximum(2 * val_fp->GetMaximum()); + else + ref_fp->SetMaximum(1.05 * val_fp->GetMaximum()); + } + + ref_fp->Draw("p9"); + val_fp->Draw("p9same"); + + leg->AddEntry(ref_fp, ("CMSSW_" + ref_vers).c_str(), "lp"); + leg->AddEntry(val_fp, ("CMSSW_" + val_vers).c_str(), "lp"); } - - - std::string xTitleCheck = xAxisTitle; - xTitleCheck = xTitleCheck.substr(1, 7); - - if (dimSwitch.compare("1D") == 0) - { - //Get histograms from objects - TH1* ref_hist1 = (TH1*)refObj; - TH1* val_hist1 = (TH1*)valObj; - - // change what is embedded in DQM histos - setObjProps(ref_hist1); - setObjProps(val_hist1); - - //Rebin histograms -- has to be done first - if (nRebin != 1) { - ref_hist1->Rebin(nRebin); - val_hist1->Rebin(nRebin); - } - - TH1* ratio_hist1; - - // Ratio Flag - if(std::stoi(ratioFlag) == 1){ - //Let's normalize the val plot to have the same number of events as the ref plot - //But only if normFlag isn't tripped - if(normFlag.compare("Norm") == 0) - val_hist1->Scale(nRef/nVal); - - //Create Copies (Clones) to use in Ratio Plot - TH1* ref_hist1_clone = (TH1*)ref_hist1->Clone("ref_hist1_clone"); - TH1* val_hist1_clone = (TH1*)val_hist1->Clone("val_hist1_clone"); - - //Prepare clones for correct uncertainties - ref_hist1_clone->Sumw2(); - val_hist1_clone->Sumw2(); - - // Normalize (scale = n_ref/n_val) - //float n_ref = ref_hist1_clone->Integral(); - //float n_val = val_hist1_clone->Integral(); - //float scale = n_ref/n_val; - //val_hist1_clone->Scale(scale); - - //Create ratio histogram (val - ref)/ref - ratio_hist1 = (TH1*)val_hist1_clone; - ratio_hist1->Sumw2(); - ratio_hist1->Add(ref_hist1_clone,-1.); - ratio_hist1->Divide(ref_hist1_clone); - -// //Format Ratio Plot -// float pad2width = pad2->GetWw(); -// float pad2height = pad2->GetWh() * pad2->GetAbsHNDC(); -// float x2pixels = 100; -// float y2pixels = 15; -// float x2size = x2pixels / pad2width; -// float y2size = y2pixels / pad2height; -// -// TAxis* x2axis = ratio_hist1->GetXaxis(); -// TAxis* y2axis = ratio_hist1->GetYaxis(); -// -// x2axis->SetTitleOffset(2); -// x2axis->SetTitleSize(0.15); -// x2axis->SetLabelSize(x2size); -// -// y2axis->SetTitleOffset(0.3); -// y2axis->SetTitleSize(0.12); -// y2axis->SetRangeUser(0,2.5); -// y2axis->SetLabelSize(y2size); - -// Sanitizing axis inputs - //Min/Max Convetion: Default AxisMin = 0. Default AxisMax = -1. - //xAxis - if (xAxisMin == 0) xAxisMin = ref_hist1->GetXaxis()->GetXmin(); - if (xAxisMax < 0) xAxisMax = ref_hist1->GetXaxis()->GetXmax(); - - //Sanitize xAxis inputs - if (xAxisMin < ref_hist1->GetXaxis()->GetXmin()) xAxisMin = ref_hist1->GetXaxis()->GetXmin(); - if (xAxisMax > ref_hist1->GetXaxis()->GetXmax()) xAxisMax = ref_hist1->GetXaxis()->GetXmax(); - - ratio_hist1->SetTitle(""); - ratio_hist1->SetLineStyle(1); - ratio_hist1->SetMarkerStyle(1); - ratio_hist1->SetMarkerSize(0.02); - - //Format Ratio Plot - //lets get schwifty - float pad2width = pad2->GetWw(); - float pad2height = pad2->GetWh() * pad2->GetAbsHNDC() ; - float x2pixels = 100; - float y2pixels = 15; - float x2size = x2pixels / pad2width; - float y2size = y2pixels / pad2height; - - TAxis* x2axis = ratio_hist1->GetXaxis(); - TAxis* y2axis = ratio_hist1->GetYaxis(); - - - x2axis->SetTitleOffset(1.0); // Important for seeing x-axis title! - x2axis->SetTitleSize(0.1); //spandey - x2axis->SetLabelSize(x2size*0.64); - x2axis->SetRangeUser(xAxisMin, xAxisMax); - - y2axis->SetTitle("(val - ref)/ref"); - y2axis->SetTitleOffset(0.3); - y2axis->SetTitleSize(0.12); - // y2axis->SetRangeUser(0,2.5); - y2axis->SetLabelSize(y2size); - y2axis->SetNdivisions(4); - - ratio_hist1->SetStats(kFALSE); - - } - - //Set the colors, styles, titles, stat boxes and format axes for the histograms - ref_hist1->SetStats(kTRUE); - val_hist1->SetStats(kTRUE); - - if (statSwitch.compare("Stat") != 0 && statSwitch.compare("Statrv") != 0) { - ref_hist1->SetStats(kFALSE); - val_hist1->SetStats(kFALSE); - } - - - //Min/Max Convetion: Default AxisMin = 0. Default AxisMax = -1. - //xAxis - if (xAxisMin == 0) xAxisMin = ref_hist1->GetXaxis()->GetXmin(); - if (xAxisMax < 0) xAxisMax = ref_hist1->GetXaxis()->GetXmax(); - - //Sanitize xAxis inputs - if (xAxisMin < ref_hist1->GetXaxis()->GetXmin()) xAxisMin = ref_hist1->GetXaxis()->GetXmin(); - if (xAxisMax > ref_hist1->GetXaxis()->GetXmax()) xAxisMax = ref_hist1->GetXaxis()->GetXmax(); - - if (xAxisMax > 0 || xAxisMin != 0) { - ref_hist1->GetXaxis()->SetRangeUser(xAxisMin, xAxisMax); - val_hist1->GetXaxis()->SetRangeUser(xAxisMin, xAxisMax); - - } - //yAxis - if (yAxisMin != 0) ref_hist1->SetMinimum(yAxisMin); - if (yAxisMax > 0) ref_hist1->SetMaximum(yAxisMax); - else if (ref_hist1->GetMaximum() < val_hist1->GetMaximum() && - val_hist1->GetMaximum() > 0) { - if (logSwitch.compare("Log") == 0) ref_hist1->SetMaximum(2 * val_hist1->GetMaximum()); - else ref_hist1->SetMaximum(1.05 * val_hist1->GetMaximum()); - } - - //Title -// if (xTitleCheck != "NoTitle") ref_hist1->GetXaxis()->SetTitle(xAxisTitle.c_str()); - ref_hist1->GetXaxis()->SetTitle(""); - if (xTitleCheck != "NoTitle" && std::stoi(ratioFlag) == 1) ratio_hist1->GetXaxis()->SetTitle(xAxisTitle.c_str()); - if (xTitleCheck != "NoTitle" && std::stoi(ratioFlag) != 1) ref_hist1->GetXaxis()->SetTitle(xAxisTitle.c_str()); - - //Different histo colors and styles - ref_hist1->SetTitle(""); - ref_hist1->SetLineColor(refCol); - ref_hist1->SetLineStyle(1); - ref_hist1->SetMarkerSize(0.02); - - val_hist1->SetTitle(""); - val_hist1->SetLineColor(valCol); - val_hist1->SetLineStyle(2); - val_hist1->SetMarkerSize(0.02); - if(statSwitch.compare("Stat") != 0 && statSwitch.compare("Statrv") != 0) - { - ref_hist1->SetLineWidth(2); - val_hist1->SetLineWidth(2); - } - - //Legend - TLegend *leg = new TLegend(0.50, 0.91, 0.84, 0.99, "", "brNDC"); - leg->SetBorderSize(2); - leg->SetFillStyle(1001); - leg->AddEntry(ref_hist1, ("CMSSW_" + ref_vers).c_str(), "l"); - leg->AddEntry(val_hist1, ("CMSSW_" + val_vers).c_str(), "l"); - - //It's time to draw (#yolo)! - if (chi2Switch.compare("Chi2") == 0) { - - // Title Time - - //Draw and save histograms - if(std::stoi(ratioFlag) == 1){ - pad1->cd(); - } - ref_hist1->SetFillColor(40);//42 Originally, now 40 which is light brown - ref_hist1->Draw("hist"); - val_hist1->SetLineStyle(1); - if (statSwitch.compare("Statrv") == 0) val_hist1->Draw("sames e0"); - else val_hist1->Draw("same e0"); - - // Ratio Flag - if(std::stoi(ratioFlag) == 1){ - //Draw ratio - pad2->cd(); - //pad1->cd(); - ratio_hist1->Draw(); - pad1->cd(); - //pad2->cd(); - } - - //Get p-value from chi2 test - const float NCHI2MIN = 0.01; - - float pval; - char tempbuff[30]; - - pval = ref_hist1->Chi2Test(val_hist1); - - sprintf(tempbuff, "Chi2 p-value: %6.3E", pval); - - TPaveText* ptchi2 = new TPaveText(0.05, 0.92, 0.35, 0.99, "NDC"); - - if (pval > NCHI2MIN) ptchi2->SetFillColor(kGreen); - else ptchi2->SetFillColor(kRed); - - ptchi2->SetTextSize(0.03); - ptchi2->AddText(tempbuff); - ptchi2->Draw(); - } else { - - // Title Time - - - //Draw and save histograms - if(std::stoi(ratioFlag) == 1){ - pad1->cd(); - } - ref_hist1->Draw("hist"); - if (statSwitch.compare("Statrv") == 0) val_hist1->Draw("hist sames"); - else val_hist1->Draw("hist same"); - - - // Ratio Flag - if(std::stoi(ratioFlag) == 1){ - //Draw ratio - pad2->cd(); - ratio_hist1->Draw(); - pad1->cd(); - } - } - - //Stat Box where required - if (statSwitch.compare("Stat") == 0 || statSwitch.compare("Statrv") == 0) { - TPaveStats* ptstats_r = new TPaveStats(0.85, 0.86, 0.98, 0.98, "brNDC"); - ptstats_r->SetTextColor(refCol); - ref_hist1->GetListOfFunctions()->Add(ptstats_r); - ptstats_r->SetParent(ref_hist1->GetListOfFunctions()); - TPaveStats* ptstats_v = new TPaveStats(0.85, 0.74, 0.98, 0.86, "brNDC"); - ptstats_v->SetTextColor(valCol); - val_hist1->GetListOfFunctions()->Add(ptstats_v); - ptstats_v->SetParent(val_hist1->GetListOfFunctions()); - - ptstats_r->Draw(); - ptstats_v->Draw(); - } - - leg->Draw(); - - myc->SaveAs(outLabel.c_str()); + + leg->Draw(""); + + myc->SaveAs(outLabel.c_str()); + } //Timing Histograms (special: read two lines at once) + else if (dimSwitch.compare("TM") == 0) { + //split directory off histName + int slashLoc2 = histName2.rfind("/"); + std::string histDir2 = histName2.substr(0, slashLoc2); + if (slashLoc2 < histName2.size() - 1) + histName2 = histName2.substr(slashLoc2 + 1, histName2.size()); + + //Get objects from TFiles + TDirectory* refTD2 = dfRef(ref_file, histDir2); + TObject* refObj2 = refTD->Get(histName2.c_str())->Clone(); + TDirectory* valTD2 = dfVal(val_file, histDir2); + TObject* valObj2 = valTD->Get(histName2.c_str())->Clone(); + + TH2* ref_hist2 = (TH2*)refObj; + TProfile* ref_prof = (TProfile*)refObj2; + + ref_hist2->SetMarkerStyle(21); + ref_prof->SetMarkerStyle(21); + ref_hist2->SetMarkerSize(0.02); + ref_prof->SetMarkerSize(0.02); + + TH2* val_hist2 = (TH2F*)valObj; + TProfile* val_prof = (TProfile*)valObj2; + + val_hist2->SetMarkerStyle(21); + val_prof->SetMarkerStyle(21); + val_hist2->SetMarkerSize(0.02); + val_prof->SetMarkerSize(0.02); + + // HACK to change what is embedded in DQM histos + setObjProps(ref_hist2); + setObjProps(val_hist2); + + //Min/Max Convention: Default AxisMin = 0. Default AxisMax = -1. + //xAxis + if (xAxisMin == 0) + xAxisMin = ref_hist2->GetXaxis()->GetXmin(); + if (xAxisMax < 0) + xAxisMax = ref_hist2->GetXaxis()->GetXmax(); + + if (xAxisMax > 0 || xAxisMin != 0) { + ref_hist2->GetXaxis()->SetRangeUser(xAxisMin, xAxisMax); + val_hist2->GetXaxis()->SetRangeUser(xAxisMin, xAxisMax); } - //Profiles not associated with histograms - else if (dimSwitch.compare("PR") == 0 || dimSwitch.compare("PRwide") == 0) - { - //Get profiles from objects - TProfile* ref_prof = (TProfile*)refObj; - TProfile* val_prof = (TProfile*)valObj; - - // HACK to change what is embedded in DQM histos - setObjProps(ref_prof); - setObjProps(val_prof); - - //Legend - TLegend* leg = new TLegend(0.50, 0.91, 0.84, 0.99, "", "brNDC"); - leg->SetBorderSize(2); - leg->SetFillStyle(1001); - - //Ordinary profiles - if(dimSwitch.compare("PR") == 0) - { - ref_prof->SetTitle(""); - ref_prof->SetErrorOption(""); - - val_prof->SetTitle(""); - val_prof->SetErrorOption(""); - - ref_prof->GetXaxis()->SetTitle(xAxisTitle.c_str()); - - if (statSwitch.compare("Stat") != 0 && statSwitch.compare("Statrv") != 0) { - ref_prof->SetStats(kFALSE); - val_prof->SetStats(kFALSE); - } - - ref_prof->SetLineColor(41); - ref_prof->SetLineStyle(1); - ref_prof->SetLineWidth(1); - ref_prof->SetMarkerColor(41); - ref_prof->SetMarkerStyle(21); - ref_prof->SetMarkerSize(0.8); - - val_prof->SetLineColor(43); - val_prof->SetLineStyle(1); - val_prof->SetLineWidth(1); - val_prof->SetMarkerColor(43); - val_prof->SetMarkerStyle(22); - val_prof->SetMarkerSize(1.0); - - if (ref_prof->GetMaximum() < val_prof->GetMaximum() && - val_prof->GetMaximum() > 0) { - if (logSwitch.compare("Log") == 0) ref_prof->SetMaximum(2 * val_prof->GetMaximum()); - else ref_prof->SetMaximum(1.05 * val_prof->GetMaximum()); - } - - ref_prof->Draw("hist pl"); - val_prof->Draw("hist pl same"); - - leg->AddEntry(ref_prof, ("CMSSW_" + ref_vers).c_str(), "pl"); - leg->AddEntry(val_prof, ("CMSSW_" + val_vers).c_str(), "pl"); - }//Wide profiles - else if(dimSwitch.compare("PRwide") == 0) - { - char temp[128]; - sprintf(temp, "%s_px_v", ref_prof->GetName()); - TH1* ref_fp = ref_prof->ProjectionX(); - TH1* val_fp = val_prof->ProjectionX(temp); - - ref_fp->SetTitle(""); - val_fp->SetTitle(""); - - ref_fp->GetXaxis()->SetTitle(xAxisTitle.c_str()); - - if(statSwitch.compare("Stat") != 0 && statSwitch.compare("Statrv") != 0) - { - ref_fp->SetStats(kFALSE); - val_fp->SetStats(kFALSE); - } - - int nbins = ref_fp->GetNbinsX(); - for (int j = 1; j < nbins; j++) { - ref_fp->SetBinError(j, 0.); - val_fp->SetBinError(j, 0.); - } - ref_fp->SetLineWidth(0); - ref_fp->SetLineColor(0); // 5 yellow - ref_fp->SetLineStyle(1); - ref_fp->SetMarkerColor(2); - ref_fp->SetMarkerStyle(20); - ref_fp->SetMarkerSize(0.5); - - val_fp->SetLineWidth(0); - val_fp->SetLineColor(0); // 45 blue - val_fp->SetLineStyle(2); - val_fp->SetMarkerColor(4); - val_fp->SetMarkerStyle(22); - val_fp->SetMarkerSize(0.5); - - if (ref_fp->GetMaximum() < val_fp->GetMaximum() && - val_fp->GetMaximum() > 0) { - if (logSwitch.compare("Log") == 0) ref_fp->SetMaximum(2 * val_fp->GetMaximum()); - else ref_fp->SetMaximum(1.05 * val_fp->GetMaximum()); - } - - ref_fp->Draw("p9"); - val_fp->Draw("p9same"); - - leg->AddEntry(ref_fp, ("CMSSW_" + ref_vers).c_str(), "lp"); - leg->AddEntry(val_fp, ("CMSSW_" + val_vers).c_str(), "lp"); - - } - - leg->Draw(""); - - myc->SaveAs(outLabel.c_str()); - }//Timing Histograms (special: read two lines at once) - else if (dimSwitch.compare("TM") == 0) - { - //split directory off histName - int slashLoc2 = histName2.rfind("/"); - std::string histDir2 = histName2.substr(0, slashLoc2); - if(slashLoc2 < histName2.size() - 1) histName2 = histName2.substr(slashLoc2 + 1, histName2.size()); - - //Get objects from TFiles - TDirectory *refTD2 = dfRef(ref_file, histDir2); - TObject *refObj2 = refTD->Get(histName2.c_str())->Clone(); - TDirectory *valTD2 = dfVal(val_file, histDir2); - TObject *valObj2 = valTD->Get(histName2.c_str())->Clone(); - - TH2* ref_hist2 = (TH2*)refObj; - TProfile* ref_prof = (TProfile*)refObj2; - - ref_hist2->SetMarkerStyle(21); - ref_prof ->SetMarkerStyle(21); - ref_hist2->SetMarkerSize(0.02); - ref_prof ->SetMarkerSize(0.02); - - TH2* val_hist2 = (TH2F*)valObj; - TProfile* val_prof = (TProfile*)valObj2; - - val_hist2->SetMarkerStyle(21); - val_prof ->SetMarkerStyle(21); - val_hist2->SetMarkerSize(0.02); - val_prof ->SetMarkerSize(0.02); - - // HACK to change what is embedded in DQM histos - setObjProps(ref_hist2); - setObjProps(val_hist2); - - //Min/Max Convention: Default AxisMin = 0. Default AxisMax = -1. - //xAxis - if (xAxisMin == 0) xAxisMin = ref_hist2->GetXaxis()->GetXmin(); - if (xAxisMax < 0) xAxisMax = ref_hist2->GetXaxis()->GetXmax(); - - if (xAxisMax > 0 || xAxisMin != 0) { - ref_hist2->GetXaxis()->SetRangeUser(xAxisMin, xAxisMax); - val_hist2->GetXaxis()->SetRangeUser(xAxisMin, xAxisMax); - } - //yAxis - if (yAxisMin != 0) ref_hist2->SetMinimum(yAxisMin); - if (yAxisMax > 0) ref_hist2->SetMaximum(yAxisMax); - else if (ref_hist2->GetMaximum() < val_hist2->GetMaximum() && - val_hist2->GetMaximum() > 0) { - if (logSwitch == "Log") ref_hist2->SetMaximum(2 * val_hist2->GetMaximum()); - else ref_hist2->SetMaximum(1.05 * val_hist2->GetMaximum()); - } - - //AF - if (yAxisMax > 0 || yAxisMin != 0) { - ref_hist2->GetYaxis()->SetRangeUser(yAxisMin, yAxisMax); - val_hist2->GetYaxis()->SetRangeUser(yAxisMin, yAxisMax); - } - - //Legend - TLegend* leg = new TLegend(0.50, 0.91, 0.84, 0.99, "", "brNDC"); - leg->SetBorderSize(2); - leg->SetFillStyle(1001); - - ref_hist2->GetXaxis()->SetTitle(xAxisTitle.c_str()); - ref_hist2->SetStats(kFALSE); - - ref_hist2->SetTitle(""); - val_hist2->SetTitle(""); - - ref_hist2->SetMarkerColor(refCol); // rose - ref_hist2->Draw(); - ref_prof->SetLineColor(41); - ref_prof->Draw("same"); - - val_hist2->SetMarkerColor(valCol); - val_hist2->Draw("same"); - val_prof->SetLineColor(45); - val_prof->Draw("same"); - - leg->AddEntry(ref_prof, ("CMSSW_" + ref_vers).c_str(), "pl"); - leg->AddEntry(val_prof, ("CMSSW_" + val_vers).c_str(), "pl"); - - leg->Draw(""); - - myc->SaveAs(outLabel.c_str()); - - if(refObj2) delete refObj2; - if(valObj2) delete valObj2; + //yAxis + if (yAxisMin != 0) + ref_hist2->SetMinimum(yAxisMin); + if (yAxisMax > 0) + ref_hist2->SetMaximum(yAxisMax); + else if (ref_hist2->GetMaximum() < val_hist2->GetMaximum() && val_hist2->GetMaximum() > 0) { + if (logSwitch == "Log") + ref_hist2->SetMaximum(2 * val_hist2->GetMaximum()); + else + ref_hist2->SetMaximum(1.05 * val_hist2->GetMaximum()); } - else if(dimSwitch.compare("2D") == 0) - { - - myc->SetGrid(0, 0); - - //Get histograms from objects - TH2* ref_hist2D = (TH2*)refObj; - TH2* val_hist2D = (TH2*)valObj; - - ref_hist2D->SetStats(kFALSE); - val_hist2D->SetStats(kFALSE); - - // HACK to change what is embedded in DQM histos - setObjProps(ref_hist2D); - setObjProps(val_hist2D); - - ref_hist2D->SetTitle(""); - val_hist2D->SetTitle(""); - - // special zoom on HB/HE depth1 - //if (n2D == 1) { - // ref_hist2D->GetXaxis()->SetRangeUser(-29., 28.); - // val_hist2D->GetXaxis()->SetRangeUser(-29., 28.); - //} - - //Min/Max Convetion: Default AxisMin = 0. Default AxisMax = -1. - //xAxis - if (xAxisMax > 0 || xAxisMin != 0) { - ref_hist2D->GetXaxis()->SetRangeUser(xAxisMin, xAxisMax); - val_hist2D->GetXaxis()->SetRangeUser(xAxisMin, xAxisMax); - } - //yAxis - if (yAxisMax > 0 || yAxisMin != 0) { - ref_hist2D->GetYaxis()->SetRangeUser(yAxisMin, yAxisMax); - val_hist2D->GetYaxis()->SetRangeUser(yAxisMin, yAxisMax); - } - //Set bin minimum to 0 - ref_hist2D->SetMinimum(0.0); - val_hist2D->SetMinimum(0.0); - - TLegend *leg1 = new TLegend(0.50, 0.91, 0.84, 0.99, "", "brNDC"); - leg1->SetBorderSize(2); - leg1->SetFillStyle(1001); - leg1->AddEntry(ref_hist2D, ("CMSSW_" + ref_vers).c_str(), "l"); - - if (xTitleCheck != "NoTitle") ref_hist2D->GetXaxis()->SetTitle(xAxisTitle.c_str()); - ref_hist2D->Draw("colz"); - leg1->Draw(); - myc->SaveAs(("ref_" + outLabel).c_str()); - - TLegend *leg2 = new TLegend(0.50, 0.91, 0.84, 0.99, "", "brNDC"); - leg2->SetBorderSize(2); - leg2->SetFillStyle(1001); - leg2->AddEntry(val_hist2D, ("CMSSW_" + val_vers).c_str(), "l"); - - if (xTitleCheck != "NoTitle") val_hist2D->GetXaxis()->SetTitle(xAxisTitle.c_str()); - val_hist2D->Draw("colz"); - leg2->Draw(); - myc->SaveAs(("val_" + outLabel).c_str()); + + //AF + if (yAxisMax > 0 || yAxisMin != 0) { + ref_hist2->GetYaxis()->SetRangeUser(yAxisMin, yAxisMax); + val_hist2->GetYaxis()->SetRangeUser(yAxisMin, yAxisMax); } - if(myc) delete myc; - if(refObj) delete refObj; - if(valObj) delete valObj; + //Legend + TLegend* leg = new TLegend(0.50, 0.91, 0.84, 0.99, "", "brNDC"); + leg->SetBorderSize(2); + leg->SetFillStyle(1001); - return; -} + ref_hist2->GetXaxis()->SetTitle(xAxisTitle.c_str()); + ref_hist2->SetStats(kFALSE); -TDirectory* DirectoryFinder::operator()(TDirectory *target, std::string& s) -{ - if(ptdMap.find(s) == ptdMap.end()) return (ptdMap[s] = findDirectory(target, s)); - else return ptdMap[s]; -} + ref_hist2->SetTitle(""); + val_hist2->SetTitle(""); + + ref_hist2->SetMarkerColor(refCol); // rose + ref_hist2->Draw(); + ref_prof->SetLineColor(41); + ref_prof->Draw("same"); -TDirectory* DirectoryFinder::findDirectory( TDirectory *target, std::string& s, int dig) -{ - TDirectory *retval = 0; + val_hist2->SetMarkerColor(valCol); + val_hist2->Draw("same"); + val_prof->SetLineColor(45); + val_prof->Draw("same"); - // loop over all keys in this directory - TIter nextkey(target->GetListOfKeys()); - TKey *key, *oldkey=0; - while((key = (TKey*)nextkey())) - { + leg->AddEntry(ref_prof, ("CMSSW_" + ref_vers).c_str(), "pl"); + leg->AddEntry(val_prof, ("CMSSW_" + val_vers).c_str(), "pl"); - //std::cout << "Found " << key->ReadObj()->GetName() << std::endl; + leg->Draw(""); - //keep only the highest cycle number for each key - if (oldkey && !strcmp(oldkey->GetName(),key->GetName())) continue; + myc->SaveAs(outLabel.c_str()); - // read object from file -// target->cd(); - TObject *obj = key->ReadObj(); -// obj->Print(); + if (refObj2) + delete refObj2; + if (valObj2) + delete valObj2; + } else if (dimSwitch.compare("2D") == 0) { + myc->SetGrid(0, 0); - if(obj->IsA()->InheritsFrom(TDirectory::Class())) - { - // it's a subdirectory - //std::cout << "Found subdirectory " << obj->GetName() << std::endl; + //Get histograms from objects + TH2* ref_hist2D = (TH2*)refObj; + TH2* val_hist2D = (TH2*)valObj; - if(strcmp(s.c_str(), obj->GetName()) == 0) return (TDirectory*)obj; + ref_hist2D->SetStats(kFALSE); + val_hist2D->SetStats(kFALSE); - if((retval = findDirectory((TDirectory*)obj, s, dig-1))) break; + // HACK to change what is embedded in DQM histos + setObjProps(ref_hist2D); + setObjProps(val_hist2D); - } else if(dig < 1){ - break; - } + ref_hist2D->SetTitle(""); + val_hist2D->SetTitle(""); + // special zoom on HB/HE depth1 + //if (n2D == 1) { + // ref_hist2D->GetXaxis()->SetRangeUser(-29., 28.); + // val_hist2D->GetXaxis()->SetRangeUser(-29., 28.); + //} + + //Min/Max Convetion: Default AxisMin = 0. Default AxisMax = -1. + //xAxis + if (xAxisMax > 0 || xAxisMin != 0) { + ref_hist2D->GetXaxis()->SetRangeUser(xAxisMin, xAxisMax); + val_hist2D->GetXaxis()->SetRangeUser(xAxisMin, xAxisMax); + } + //yAxis + if (yAxisMax > 0 || yAxisMin != 0) { + ref_hist2D->GetYaxis()->SetRangeUser(yAxisMin, yAxisMax); + val_hist2D->GetYaxis()->SetRangeUser(yAxisMin, yAxisMax); } + //Set bin minimum to 0 + ref_hist2D->SetMinimum(0.0); + val_hist2D->SetMinimum(0.0); + + TLegend* leg1 = new TLegend(0.50, 0.91, 0.84, 0.99, "", "brNDC"); + leg1->SetBorderSize(2); + leg1->SetFillStyle(1001); + leg1->AddEntry(ref_hist2D, ("CMSSW_" + ref_vers).c_str(), "l"); + + if (xTitleCheck != "NoTitle") + ref_hist2D->GetXaxis()->SetTitle(xAxisTitle.c_str()); + ref_hist2D->Draw("colz"); + leg1->Draw(); + myc->SaveAs(("ref_" + outLabel).c_str()); + + TLegend* leg2 = new TLegend(0.50, 0.91, 0.84, 0.99, "", "brNDC"); + leg2->SetBorderSize(2); + leg2->SetFillStyle(1001); + leg2->AddEntry(val_hist2D, ("CMSSW_" + val_vers).c_str(), "l"); + + if (xTitleCheck != "NoTitle") + val_hist2D->GetXaxis()->SetTitle(xAxisTitle.c_str()); + val_hist2D->Draw("colz"); + leg2->Draw(); + myc->SaveAs(("val_" + outLabel).c_str()); + } + + if (myc) + delete myc; + if (refObj) + delete refObj; + if (valObj) + delete valObj; + + return; +} - return retval; +TDirectory* DirectoryFinder::operator()(TDirectory* target, std::string& s) { + if (ptdMap.find(s) == ptdMap.end()) + return (ptdMap[s] = findDirectory(target, s)); + else + return ptdMap[s]; } -template -void setObjProps(T obj) -{ - obj->GetXaxis()->SetLabelSize(0.04); - obj->GetYaxis()->SetLabelSize(0.04); - obj->GetXaxis()->SetTitleSize(0.045); +TDirectory* DirectoryFinder::findDirectory(TDirectory* target, std::string& s, int dig) { + TDirectory* retval = 0; + + // loop over all keys in this directory + TIter nextkey(target->GetListOfKeys()); + TKey *key, *oldkey = 0; + while ((key = (TKey*)nextkey())) { + //std::cout << "Found " << key->ReadObj()->GetName() << std::endl; + + //keep only the highest cycle number for each key + if (oldkey && !strcmp(oldkey->GetName(), key->GetName())) + continue; + + // read object from file + // target->cd(); + TObject* obj = key->ReadObj(); + // obj->Print(); - obj->GetXaxis()->SetTickLength(-0.015); - obj->GetYaxis()->SetTickLength(-0.015); + if (obj->IsA()->InheritsFrom(TDirectory::Class())) { + // it's a subdirectory + //std::cout << "Found subdirectory " << obj->GetName() << std::endl; - obj->GetXaxis()->SetLabelOffset(0.02); - obj->GetYaxis()->SetLabelOffset(0.02); - - obj->GetXaxis()->SetTitleOffset(1.3); + if (strcmp(s.c_str(), obj->GetName()) == 0) + return (TDirectory*)obj; + + if ((retval = findDirectory((TDirectory*)obj, s, dig - 1))) + break; + + } else if (dig < 1) { + break; + } + } + + return retval; } +template +void setObjProps(T obj) { + obj->GetXaxis()->SetLabelSize(0.04); + obj->GetYaxis()->SetLabelSize(0.04); + obj->GetXaxis()->SetTitleSize(0.045); -BOOST_PYTHON_MODULE(RelValMacro) -{ - using namespace boost::python; - def("RelValMacro", RelValMacro); + obj->GetXaxis()->SetTickLength(-0.015); + obj->GetYaxis()->SetTickLength(-0.015); + + obj->GetXaxis()->SetLabelOffset(0.02); + obj->GetYaxis()->SetLabelOffset(0.02); + + obj->GetXaxis()->SetTitleOffset(1.3); } +BOOST_PYTHON_MODULE(RelValMacro) { + using namespace boost::python; + def("RelValMacro", RelValMacro); +} diff --git a/Validation/CaloTowers/test/macros/RelValMacro.py b/Validation/CaloTowers/test/macros/RelValMacro.py index d8f14f0f108f7..58c6a8aa9610c 100755 --- a/Validation/CaloTowers/test/macros/RelValMacro.py +++ b/Validation/CaloTowers/test/macros/RelValMacro.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 #RelValMacro.py import sys diff --git a/Validation/Configuration/python/gemSimValid_cff.py b/Validation/Configuration/python/gemSimValid_cff.py index b45d16afc5a93..211018176001e 100644 --- a/Validation/Configuration/python/gemSimValid_cff.py +++ b/Validation/Configuration/python/gemSimValid_cff.py @@ -3,5 +3,9 @@ from Validation.MuonGEMHits.MuonGEMHits_cff import * from Validation.MuonGEMDigis.MuonGEMDigis_cff import * from Validation.MuonGEMRecHits.MuonGEMRecHits_cff import * +from DQM.GEM.GEMDQM_cff import * -gemSimValid = cms.Sequence(gemSimValidation*gemDigiValidation*gemLocalRecoValidation) +GEMDigiSource.modeRelVal = True +GEMRecHitSource.modeRelVal = True + +gemSimValid = cms.Sequence(GEMDQMForRelval*gemSimValidation*gemDigiValidation*gemLocalRecoValidation) diff --git a/Validation/EcalClusters/test/macro/InstructionsForScripts b/Validation/EcalClusters/test/macro/InstructionsForScripts index f8eb98f467772..eeb5320a46eee 100644 --- a/Validation/EcalClusters/test/macro/InstructionsForScripts +++ b/Validation/EcalClusters/test/macro/InstructionsForScripts @@ -34,13 +34,13 @@ e.g. how to plot performace vs. ET: > root -l FitEt.C > out.et > grep Result out.et > output -> python plotMeanVsET.py +> python3 plotMeanVsET.py ( Which takes file 'output' as an input and produces plot_MeanVsET.C ) > root -l plot_MeanVsET.C or -> python plotEffSigmaVsET.py +> python3 plotEffSigmaVsET.py > root -l plot_EffSigmaVsET.C //------------------------------------- diff --git a/Validation/EcalDigis/BuildFile.xml b/Validation/EcalDigis/plugins/BuildFile.xml similarity index 100% rename from Validation/EcalDigis/BuildFile.xml rename to Validation/EcalDigis/plugins/BuildFile.xml diff --git a/Validation/EcalDigis/plugins/CollHandle.cpp b/Validation/EcalDigis/plugins/CollHandle.cpp new file mode 100644 index 0000000000000..7159e44635070 --- /dev/null +++ b/Validation/EcalDigis/plugins/CollHandle.cpp @@ -0,0 +1 @@ +#include "CollHandle.h" diff --git a/Validation/EcalDigis/src/CollHandle.h b/Validation/EcalDigis/plugins/CollHandle.h similarity index 100% rename from Validation/EcalDigis/src/CollHandle.h rename to Validation/EcalDigis/plugins/CollHandle.h diff --git a/Validation/EcalDigis/src/EcalBarrelDigisValidation.cc b/Validation/EcalDigis/plugins/EcalBarrelDigisValidation.cc similarity index 99% rename from Validation/EcalDigis/src/EcalBarrelDigisValidation.cc rename to Validation/EcalDigis/plugins/EcalBarrelDigisValidation.cc index 50a2a3e9e65a2..8f6b4a426937e 100644 --- a/Validation/EcalDigis/src/EcalBarrelDigisValidation.cc +++ b/Validation/EcalDigis/plugins/EcalBarrelDigisValidation.cc @@ -5,7 +5,7 @@ * */ -#include +#include "EcalBarrelDigisValidation.h" #include "CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h" #include "DQMServices/Core/interface/DQMStore.h" diff --git a/Validation/EcalDigis/interface/EcalBarrelDigisValidation.h b/Validation/EcalDigis/plugins/EcalBarrelDigisValidation.h similarity index 97% rename from Validation/EcalDigis/interface/EcalBarrelDigisValidation.h rename to Validation/EcalDigis/plugins/EcalBarrelDigisValidation.h index e4189daacf201..6c25581a22b4b 100644 --- a/Validation/EcalDigis/interface/EcalBarrelDigisValidation.h +++ b/Validation/EcalDigis/plugins/EcalBarrelDigisValidation.h @@ -31,7 +31,6 @@ #include #include "DQMServices/Core/interface/DQMEDAnalyzer.h" -#include #include "CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h" class EcalBarrelDigisValidation : public DQMEDAnalyzer { diff --git a/Validation/EcalDigis/src/EcalDigisValidation.cc b/Validation/EcalDigis/plugins/EcalDigisValidation.cc similarity index 99% rename from Validation/EcalDigis/src/EcalDigisValidation.cc rename to Validation/EcalDigis/plugins/EcalDigisValidation.cc index b686d162cdf43..073f99c432049 100644 --- a/Validation/EcalDigis/src/EcalDigisValidation.cc +++ b/Validation/EcalDigis/plugins/EcalDigisValidation.cc @@ -5,7 +5,7 @@ * */ -#include +#include "EcalDigisValidation.h" #include #include #include diff --git a/Validation/EcalDigis/interface/EcalDigisValidation.h b/Validation/EcalDigis/plugins/EcalDigisValidation.h similarity index 98% rename from Validation/EcalDigis/interface/EcalDigisValidation.h rename to Validation/EcalDigis/plugins/EcalDigisValidation.h index 66e4cf56b20cd..a5a5b4e109c79 100644 --- a/Validation/EcalDigis/interface/EcalDigisValidation.h +++ b/Validation/EcalDigis/plugins/EcalDigisValidation.h @@ -37,7 +37,6 @@ #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" #include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h" #include "SimDataFormats/CrossingFrame/interface/MixCollection.h" -#include #include "CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h" #include diff --git a/Validation/EcalDigis/src/EcalEndcapDigisValidation.cc b/Validation/EcalDigis/plugins/EcalEndcapDigisValidation.cc similarity index 99% rename from Validation/EcalDigis/src/EcalEndcapDigisValidation.cc rename to Validation/EcalDigis/plugins/EcalEndcapDigisValidation.cc index 5559830376041..17884bdf2e688 100644 --- a/Validation/EcalDigis/src/EcalEndcapDigisValidation.cc +++ b/Validation/EcalDigis/plugins/EcalEndcapDigisValidation.cc @@ -5,7 +5,7 @@ * */ -#include +#include "EcalEndcapDigisValidation.h" #include "CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h" using namespace cms; diff --git a/Validation/EcalDigis/interface/EcalEndcapDigisValidation.h b/Validation/EcalDigis/plugins/EcalEndcapDigisValidation.h similarity index 97% rename from Validation/EcalDigis/interface/EcalEndcapDigisValidation.h rename to Validation/EcalDigis/plugins/EcalEndcapDigisValidation.h index 333fa60b5dfc9..e1080fed12560 100644 --- a/Validation/EcalDigis/interface/EcalEndcapDigisValidation.h +++ b/Validation/EcalDigis/plugins/EcalEndcapDigisValidation.h @@ -25,7 +25,6 @@ #include "DataFormats/EcalDigi/interface/EEDataFrame.h" #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" -#include #include "CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h" #include diff --git a/Validation/EcalDigis/src/EcalMixingModuleValidation.cc b/Validation/EcalDigis/plugins/EcalMixingModuleValidation.cc similarity index 99% rename from Validation/EcalDigis/src/EcalMixingModuleValidation.cc rename to Validation/EcalDigis/plugins/EcalMixingModuleValidation.cc index b1b255d48ab22..4581dfb837bfe 100644 --- a/Validation/EcalDigis/src/EcalMixingModuleValidation.cc +++ b/Validation/EcalDigis/plugins/EcalMixingModuleValidation.cc @@ -5,7 +5,7 @@ * */ -#include +#include "EcalMixingModuleValidation.h" #include #include #include diff --git a/Validation/EcalDigis/interface/EcalMixingModuleValidation.h b/Validation/EcalDigis/plugins/EcalMixingModuleValidation.h similarity index 98% rename from Validation/EcalDigis/interface/EcalMixingModuleValidation.h rename to Validation/EcalDigis/plugins/EcalMixingModuleValidation.h index 2f47e0dbbfaa0..093ce2a4fc4c3 100644 --- a/Validation/EcalDigis/interface/EcalMixingModuleValidation.h +++ b/Validation/EcalDigis/plugins/EcalMixingModuleValidation.h @@ -55,7 +55,7 @@ #include "CondFormats/ESObjects/interface/ESPedestals.h" #include "CondFormats/DataRecord/interface/ESPedestalsRcd.h" #include "CondFormats/ESObjects/interface/ESIntercalibConstants.h" -#include +#include "EcalBarrelDigisValidation.h" #include "CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" diff --git a/Validation/EcalDigis/src/EcalPreshowerDigisValidation.cc b/Validation/EcalDigis/plugins/EcalPreshowerDigisValidation.cc similarity index 97% rename from Validation/EcalDigis/src/EcalPreshowerDigisValidation.cc rename to Validation/EcalDigis/plugins/EcalPreshowerDigisValidation.cc index 322eecc9acc70..9139f1db3a14b 100644 --- a/Validation/EcalDigis/src/EcalPreshowerDigisValidation.cc +++ b/Validation/EcalDigis/plugins/EcalPreshowerDigisValidation.cc @@ -5,7 +5,7 @@ * */ -#include +#include "EcalPreshowerDigisValidation.h" EcalPreshowerDigisValidation::EcalPreshowerDigisValidation(const edm::ParameterSet& ps) : ESdigiCollectionToken_(consumes(ps.getParameter("ESdigiCollection"))) { diff --git a/Validation/EcalDigis/interface/EcalPreshowerDigisValidation.h b/Validation/EcalDigis/plugins/EcalPreshowerDigisValidation.h similarity index 100% rename from Validation/EcalDigis/interface/EcalPreshowerDigisValidation.h rename to Validation/EcalDigis/plugins/EcalPreshowerDigisValidation.h diff --git a/Validation/EcalDigis/src/EcalPreshowerNoiseDistrib.cc b/Validation/EcalDigis/plugins/EcalPreshowerNoiseDistrib.cc similarity index 97% rename from Validation/EcalDigis/src/EcalPreshowerNoiseDistrib.cc rename to Validation/EcalDigis/plugins/EcalPreshowerNoiseDistrib.cc index c60c0c2a21847..2b01b7965f7c6 100644 --- a/Validation/EcalDigis/src/EcalPreshowerNoiseDistrib.cc +++ b/Validation/EcalDigis/plugins/EcalPreshowerNoiseDistrib.cc @@ -3,7 +3,7 @@ * */ -#include +#include "EcalPreshowerNoiseDistrib.h" EcalPreshowerNoiseDistrib::EcalPreshowerNoiseDistrib(const edm::ParameterSet& ps) : ESdigiCollectionToken_(consumes(ps.getParameter("ESdigiCollection"))) { diff --git a/Validation/EcalDigis/interface/EcalPreshowerNoiseDistrib.h b/Validation/EcalDigis/plugins/EcalPreshowerNoiseDistrib.h similarity index 100% rename from Validation/EcalDigis/interface/EcalPreshowerNoiseDistrib.h rename to Validation/EcalDigis/plugins/EcalPreshowerNoiseDistrib.h diff --git a/Validation/EcalDigis/src/EcalSRPCompat.h b/Validation/EcalDigis/plugins/EcalSRPCompat.h similarity index 100% rename from Validation/EcalDigis/src/EcalSRPCompat.h rename to Validation/EcalDigis/plugins/EcalSRPCompat.h diff --git a/Validation/EcalDigis/src/EcalSelectiveReadoutValidation.cc b/Validation/EcalDigis/plugins/EcalSelectiveReadoutValidation.cc similarity index 99% rename from Validation/EcalDigis/src/EcalSelectiveReadoutValidation.cc rename to Validation/EcalDigis/plugins/EcalSelectiveReadoutValidation.cc index 2a20282ca1fa1..ea99ee03f7d33 100644 --- a/Validation/EcalDigis/src/EcalSelectiveReadoutValidation.cc +++ b/Validation/EcalDigis/plugins/EcalSelectiveReadoutValidation.cc @@ -4,9 +4,9 @@ * */ -#include "Validation/EcalDigis/interface/EcalSelectiveReadoutValidation.h" +#include "EcalSelectiveReadoutValidation.h" -#include "Validation/EcalDigis/src/ecalDccMap.h" +#include "ecalDccMap.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Framework/interface/ESHandle.h" diff --git a/Validation/EcalDigis/interface/EcalSelectiveReadoutValidation.h b/Validation/EcalDigis/plugins/EcalSelectiveReadoutValidation.h similarity index 99% rename from Validation/EcalDigis/interface/EcalSelectiveReadoutValidation.h rename to Validation/EcalDigis/plugins/EcalSelectiveReadoutValidation.h index d732bf4eaa6e4..223cc4b78c5b2 100644 --- a/Validation/EcalDigis/interface/EcalSelectiveReadoutValidation.h +++ b/Validation/EcalDigis/plugins/EcalSelectiveReadoutValidation.h @@ -32,7 +32,7 @@ #include "CondFormats/DataRecord/interface/EcalTPGLutGroupRcd.h" #include "CondFormats/DataRecord/interface/EcalTPGPhysicsConstRcd.h" -#include "Validation/EcalDigis/src/CollHandle.h" +#include "CollHandle.h" #include #include diff --git a/Validation/EcalDigis/plugins/SealModule.cc b/Validation/EcalDigis/plugins/SealModule.cc new file mode 100644 index 0000000000000..19ce1aad55160 --- /dev/null +++ b/Validation/EcalDigis/plugins/SealModule.cc @@ -0,0 +1,24 @@ +#include "FWCore/PluginManager/interface/ModuleDef.h" + +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "EcalDigisValidation.h" +DEFINE_FWK_MODULE(EcalDigisValidation); + +#include "EcalBarrelDigisValidation.h" +DEFINE_FWK_MODULE(EcalBarrelDigisValidation); + +#include "EcalEndcapDigisValidation.h" +DEFINE_FWK_MODULE(EcalEndcapDigisValidation); + +#include "EcalPreshowerDigisValidation.h" +DEFINE_FWK_MODULE(EcalPreshowerDigisValidation); + +#include "EcalPreshowerNoiseDistrib.h" +DEFINE_FWK_MODULE(EcalPreshowerNoiseDistrib); + +#include "EcalMixingModuleValidation.h" +DEFINE_FWK_MODULE(EcalMixingModuleValidation); + +#include "EcalSelectiveReadoutValidation.h" +DEFINE_FWK_MODULE(EcalSelectiveReadoutValidation); diff --git a/Validation/EcalDigis/src/ecalDccMap.h b/Validation/EcalDigis/plugins/ecalDccMap.h similarity index 100% rename from Validation/EcalDigis/src/ecalDccMap.h rename to Validation/EcalDigis/plugins/ecalDccMap.h diff --git a/Validation/EcalDigis/src/CollHandle.cpp b/Validation/EcalDigis/src/CollHandle.cpp deleted file mode 100644 index a3af9f60031fd..0000000000000 --- a/Validation/EcalDigis/src/CollHandle.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "Validation/EcalDigis/src/CollHandle.h" diff --git a/Validation/EcalDigis/src/SealModule.cc b/Validation/EcalDigis/src/SealModule.cc deleted file mode 100644 index 44318b52dedd9..0000000000000 --- a/Validation/EcalDigis/src/SealModule.cc +++ /dev/null @@ -1,24 +0,0 @@ -#include "FWCore/PluginManager/interface/ModuleDef.h" - -#include "FWCore/Framework/interface/MakerMacros.h" - -#include -DEFINE_FWK_MODULE(EcalDigisValidation); - -#include -DEFINE_FWK_MODULE(EcalBarrelDigisValidation); - -#include -DEFINE_FWK_MODULE(EcalEndcapDigisValidation); - -#include -DEFINE_FWK_MODULE(EcalPreshowerDigisValidation); - -#include -DEFINE_FWK_MODULE(EcalPreshowerNoiseDistrib); - -#include -DEFINE_FWK_MODULE(EcalMixingModuleValidation); - -#include "Validation/EcalDigis/interface/EcalSelectiveReadoutValidation.h" -DEFINE_FWK_MODULE(EcalSelectiveReadoutValidation); diff --git a/Validation/Geometry/macros/MatBudgetVolume.C b/Validation/Geometry/macros/MatBudgetVolume.C index f23e4ec71245f..6e64e0c08c6d5 100644 --- a/Validation/Geometry/macros/MatBudgetVolume.C +++ b/Validation/Geometry/macros/MatBudgetVolume.C @@ -14,9 +14,19 @@ // Make the 2-D plots as a function of eta and phi with same parameter // meanings as those of *etaPhiPlot* // -// etaPhiPlotComp(fileName1, fileName2, plot, ifEta, tag, debug) +// etaPhiPlotComp(fileName1, fileName2, plot, ifEta, tag, txt, debug) // Compares material budget plots from 2 different files // +// etaPhiPlotComp4(filePreFix, tag, plot, ifEta, debug) +// Compares material budget plots from 4 different files: +// dddXML, dd4hepXML, dddDB, dd4hepDB +// +// filePreFix (std::string) Prefix to all 4 file names which will be followed +// by one of dddXML/dd4hepXML/dddDB/dd4hepDB strings +// and finally with *tag* and ".root" +// txt (std::string) Part of the y-title coming after #frac for the plot +// ("{DDD}/{DD4Hep}") +// /////////////////////////////////////////////////////////////////////////////// // include files @@ -56,8 +66,13 @@ void etaPhiPlotComp(TString fileName1 = "matbdg_run3.root", std::string plot = "intl", bool ifEta = true, std::string tag = "Run3", + std::string txt = "{DDD}/{DD4Hep}", bool debug = false); - +void etaPhiPlotComp4(std::string filePreFix = "files/matbdgRun3", + std::string tag = "pre6", + std::string plot = "radl", + bool ifEta = true, + bool debug = false); void setStyle(); const int nlay = 13; @@ -227,7 +242,8 @@ void etaPhi2DPlot(TString fileName, std::string plot, bool drawLeg, double maxEt cc1->Modified(); } -void etaPhiPlotComp(TString fileName1, TString fileName2, std::string plot, bool ifEta, std::string tag, bool debug) { +void etaPhiPlotComp( + TString fileName1, TString fileName2, std::string plot, bool ifEta, std::string tag, std::string txt, bool debug) { setStyle(); gStyle->SetOptTitle(0); TFile *file1 = new TFile(fileName1); @@ -243,14 +259,14 @@ void etaPhiPlotComp(TString fileName1, TString fileName2, std::string plot, bool std::string xtit = "#eta"; std::string ztit = "Eta"; - std::string ytit = "none"; + char ytit[40]; if (plot == "radl") { - ytit = "#frac{DDD}{DD4Hep} for MB (X_{0})"; + sprintf(ytit, "#frac%s for MB (X_{0})", txt.c_str()); } else if (plot == "step") { - ytit = "#frac{DDD}{DD4Hep} for MB (Step Length)"; + sprintf(ytit, "#frac%s for MB (Step Length)", txt.c_str()); } else { plot = "intl"; - ytit = "#frac{DDD}{DD4Hep} for MB (#lambda)"; + sprintf(ytit, "#frac%s for MB (#lambda)", txt.c_str()); } if (!ifEta) { xtit = "#phi"; @@ -277,7 +293,7 @@ void etaPhiPlotComp(TString fileName1, TString fileName2, std::string plot, bool yy2.push_back(prof2->GetBinContent(k)); dy1.push_back(prof1->GetBinError(k)); dy2.push_back(prof2->GetBinError(k)); - xx0.push_back(prof1->GetBinLowEdge(k) + prof2->GetBinWidth(k)); + xx0.push_back(prof1->GetBinLowEdge(k) + prof1->GetBinWidth(k)); } } } @@ -323,6 +339,154 @@ void etaPhiPlotComp(TString fileName1, TString fileName2, std::string plot, bool } } } + if (graphs.size() > 0) { + std::string cname = "c_" + plot + ztit + "Ratio" + tag; + TCanvas *cc1 = new TCanvas(cname.c_str(), cname.c_str(), 700, 600); + cc1->SetLeftMargin(0.10); + cc1->SetRightMargin(0.10); + TH1F *vFrame = cc1->DrawFrame(xlow, 0.5, xhigh, 1.5); + vFrame->GetXaxis()->SetRangeUser(xlow, xhigh); + vFrame->GetXaxis()->SetLabelSize(0.03); + vFrame->GetXaxis()->SetTitleSize(0.035); + vFrame->GetXaxis()->SetTitleOffset(0.4); + vFrame->GetXaxis()->SetTitle(xtit.c_str()); + vFrame->GetYaxis()->SetRangeUser(0.9, 1.1); + vFrame->GetYaxis()->SetLabelSize(0.03); + vFrame->GetYaxis()->SetTitleSize(0.035); + vFrame->GetYaxis()->SetTitleOffset(1.3); + vFrame->GetYaxis()->SetTitle(ytit); + for (unsigned int i = 0; i < graphs.size(); ++i) + graphs[i]->Draw("P"); + leg->Draw("sames"); + cc1->Modified(); + } + } +} + +void etaPhiPlotComp4(std::string filePreFix, std::string tag, std::string plot, bool ifEta, bool debug) { + setStyle(); + gStyle->SetOptTitle(0); + const int files = 4; + std::string nametype[files] = {"dddXML", "dd4hepXML", "dddDB", "dd4hepDB"}; + int colortype[files] = {1, 2, 4, 6}; + TFile *file[files]; + char fname[40]; + bool ok(true); + for (int k1 = 0; k1 < files; ++k1) { + sprintf(fname, "%s%s%s.root", filePreFix.c_str(), nametype[k1].c_str(), tag.c_str()); + file[k1] = new TFile(fname); + if (file[k1] == nullptr) + ok = false; + } + if (ok) { + TDirectory *dir[files]; + for (int k1 = 0; k1 < files; ++k1) { + dir[k1] = (TDirectory *)(file[k1]->FindObjectAny("materialBudgetVolumeAnalysis")); + } + TLegend *leg = new TLegend(0.84, 0.69, 0.99, 0.99); + leg->SetBorderSize(1); + leg->SetFillColor(10); + leg->SetMargin(0.25); + leg->SetTextSize(0.028); + + std::string xtit = "#eta"; + std::string ztit = "Eta"; + std::string ytit = "none"; + if (plot == "radl") { + ytit = "#frac{Sample}{dddXML} for MB (X_{0})"; + } else if (plot == "step") { + ytit = "#frac{Sample}{dddXML} for MB (Step Length)"; + } else { + plot = "intl"; + ytit = "#frac{Sample}{dddXML} for MB (#lambda)"; + } + if (!ifEta) { + xtit = "#phi"; + ztit = "Phi"; + } + + std::vector graphs; + std::vector index; + char hname[20], titlex[50]; + int nb(0); + double xlow(0), xhigh(0); + for (int i = 0; i < ngrp; ++i) { + std::vector xx0, yy0[files], dy0[files]; + for (int j = 0; j < nlayers[i]; ++j) { + int ii = nflayer[i] + j; + sprintf(hname, "%s%s%s", plot.c_str(), ztit.c_str(), names[ii].c_str()); + TProfile *prof[files]; + bool okf(true); + for (int k1 = 0; k1 < files; ++k1) { + dir[k1]->GetObject(hname, prof[k1]); + if (dir[k1] == nullptr) + okf = false; + } + if (okf) { + int nb = prof[0]->GetNbinsX(); + for (int k = 1; k <= nb; ++k) { + xx0.push_back(prof[0]->GetBinLowEdge(k) + prof[0]->GetBinWidth(k)); + for (int k1 = 0; k1 < files; ++k1) { + yy0[k1].push_back(prof[k1]->GetBinContent(k)); + dy0[k1].push_back(prof[k1]->GetBinError(k)); + } + } + } + } + int ii = nflayer[i]; + for (int k1 = 1; k1 < files; ++k1) { + std::vector xx, yy, dx, dy; + double sumNum(0), sumDen(0), maxtmp(0), maxDev(0), dmaxDev(0); + for (unsigned int k = 0; k < xx0.size(); ++k) { + if ((yy0[0][k] > 0) && (yy0[k1][k] > 0)) { + double rat = yy0[k1][k] / yy0[0][k]; + double drt = rat * sqrt((dy0[k1][k] / yy0[k1][k]) * (dy0[k1][k] / yy0[k1][k]) + + (dy0[0][k] / yy0[0][k]) * (dy0[0][k] / yy0[0][k])); + xx.push_back(xx0[k]); + dx.push_back(0); + yy.push_back(rat); + dy.push_back(drt); + if (debug) { + std::cout << nametype[k1] << ":" << title[ii] << " [" << (xx.size() - 1) << "] " << xx0[k] << " Ratio " + << rat << " +- " << drt << std::endl; + } + double temp1 = (rat > 1.0) ? 1.0 / rat : rat; + double temp2 = (rat > 1.0) ? drt / (rat * rat) : drt; + double temp0 = (fabs(1.0 - temp1) / (temp2 * temp2)); + sumNum += temp0; + sumDen += (1.0 / (temp2 * temp2)); + if (temp0 >= maxtmp) { + maxtmp = temp0; + maxDev = fabs(1.0 - temp1); + dmaxDev = temp2; + } + } + } + sumNum = (sumDen > 0) ? (sumNum / sumDen) : 0; + sumDen = (sumDen > 0) ? 1.0 / sqrt(sumDen) : 0; + std::cout << title[ii] << " in " << nametype[k1] << " Mean " << sumNum << " +- " << sumDen << " Max " << maxDev + << " +- " << dmaxDev << std::endl; + if (xx.size() > 0) { + TGraphErrors *graph = new TGraphErrors(xx.size(), &xx[0], &yy[0], &dx[0], &dy[0]); + graph->SetLineColor(colortype[k1]); + graph->SetFillColor(colorLay[ii]); + graph->SetMarkerStyle(styleLay[ii]); + if (k1 == 1) { + sprintf(titlex, "%s", title[ii].c_str()); + leg->AddEntry(graph, titlex, "lep"); + } + graphs.push_back(graph); + if (nb == 0) { + sprintf(hname, "%s%s%s", plot.c_str(), ztit.c_str(), names[0].c_str()); + TProfile *prof; + dir[0]->GetObject(hname, prof); + nb = prof->GetNbinsX(); + xlow = prof->GetBinLowEdge(1); + xhigh = prof->GetBinLowEdge(nb) + prof->GetBinWidth(nb); + } + } + } + } if (graphs.size() > 0) { std::string cname = "c_" + plot + ztit + "Ratio" + tag; TCanvas *cc1 = new TCanvas(cname.c_str(), cname.c_str(), 700, 600); @@ -343,6 +507,16 @@ void etaPhiPlotComp(TString fileName1, TString fileName2, std::string plot, bool graphs[i]->Draw("P"); leg->Draw("sames"); cc1->Modified(); + double ymx = 0.68; + for (int k1 = 1; k1 < files; ++k1) { + TPaveText *txt1 = new TPaveText(0.84, ymx - 0.03, 0.99, ymx, "blNDC"); + txt1->SetFillColor(0); + sprintf(fname, "%s", nametype[k1].c_str()); + txt1->AddText(fname); + ((TText *)txt1->GetListOfLines()->Last())->SetTextColor(colortype[k1]); + txt1->Draw(); + ymx -= 0.03; + } } } } diff --git a/Validation/Geometry/test/MaterialBudget.py b/Validation/Geometry/test/MaterialBudget.py index 3528a2da4b7a0..56cdbbf9939af 100644 --- a/Validation/Geometry/test/MaterialBudget.py +++ b/Validation/Geometry/test/MaterialBudget.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 # Pure trick to start ROOT in batch mode, pass this only option to it # and the rest of the command line options to this code. diff --git a/Validation/Geometry/test/dddvsdb/sortCompositeMaterials.py b/Validation/Geometry/test/dddvsdb/sortCompositeMaterials.py index 27fef1ad1cd5f..2b220da16078c 100755 --- a/Validation/Geometry/test/dddvsdb/sortCompositeMaterials.py +++ b/Validation/Geometry/test/dddvsdb/sortCompositeMaterials.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 import sys import xml.etree.ElementTree as ET diff --git a/Validation/Geometry/test/runMaterialBudgetVolumeBigDD4HepXML_cfg.py b/Validation/Geometry/test/runMaterialBudgetVolumeBigDD4HepXML_cfg.py new file mode 100644 index 0000000000000..741178c68e48f --- /dev/null +++ b/Validation/Geometry/test/runMaterialBudgetVolumeBigDD4HepXML_cfg.py @@ -0,0 +1,49 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep +process = cms.Process('PROD',Run3_dd4hep) +process.load("Configuration.Geometry.GeometryDD4hepExtended2021Reco_cff") +process.load("Configuration.Geometry.GeometryDD4hep_cff") +process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cff") +process.load("Geometry.EcalCommonData.ecalSimulationParameters_cff") +process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cff") +process.load("Geometry.HcalCommonData.hcalDDDRecConstants_cfi") +process.load("Geometry.MuonNumbering.muonGeometryConstants_cff") +process.load("Geometry.MuonNumbering.muonOffsetESProducer_cff") + +process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") +process.load("Configuration.StandardSequences.MagneticField_cff") +process.load("SimG4Core.Application.g4SimHits_cfi") +process.load("Validation.Geometry.materialBudgetVolume_cfi") + +process.load("IOMC.RandomEngine.IOMC_cff") +process.RandomNumberGeneratorService.g4SimHits.initialSeed = 9876 + +process.load('FWCore.MessageService.MessageLogger_cfi') +process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(1000) +if hasattr(process,'MessageLogger'): + process.MessageLogger.MaterialBudget=dict() + +process.source = cms.Source("PoolSource", + noEventSort = cms.untracked.bool(True), + duplicateCheckMode = cms.untracked.string("noDuplicateCheck"), + fileNames = cms.untracked.vstring('file:single_neutrino_random.root') +) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(-1) +) + +process.TFileService = cms.Service("TFileService", + fileName = cms.string('matbdgRun3dd4hepBigXML.root') +) + +process.DDDetectorESProducer.confGeomXMLFiles = cms.FileInPath("SimG4Core/PrintGeomInfo/data/dd4hep/cmsExtendedGeometry2021.xml") +process.g4SimHits.UseMagneticField = False +process.g4SimHits.Physics.type = 'SimG4Core/Physics/DummyPhysics' +process.g4SimHits.StackingAction.TrackNeutrino = True +process.g4SimHits.Physics.DummyEMPhysics = True +process.g4SimHits.Physics.CutsPerRegion = False + +process.load("Validation.Geometry.materialBudgetVolumeAnalysis_cfi") +process.p1 = cms.Path(process.g4SimHits+process.materialBudgetVolumeAnalysis) diff --git a/Validation/Geometry/test/runMaterialBudgetVolumeBigDDDXML_cfg.py b/Validation/Geometry/test/runMaterialBudgetVolumeBigDDDXML_cfg.py new file mode 100644 index 0000000000000..5a5c14cdbaad7 --- /dev/null +++ b/Validation/Geometry/test/runMaterialBudgetVolumeBigDDDXML_cfg.py @@ -0,0 +1,47 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_cff import Run3 +process = cms.Process('PROD',Run3) +process.load('SimG4Core.PrintGeomInfo.cmsExtendedGeometry2021_cfi') +process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cff") +process.load("Geometry.EcalCommonData.ecalSimulationParameters_cff") +process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cff") +process.load("Geometry.HcalCommonData.hcalDDDRecConstants_cfi") +process.load("Geometry.MuonNumbering.muonGeometryConstants_cff") +process.load("Geometry.MuonNumbering.muonOffsetESProducer_cff") + +process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") +process.load("Configuration.StandardSequences.MagneticField_cff") +process.load("SimG4Core.Application.g4SimHits_cfi") +process.load("Validation.Geometry.materialBudgetVolume_cfi") + +process.load("IOMC.RandomEngine.IOMC_cff") +process.RandomNumberGeneratorService.g4SimHits.initialSeed = 9876 + +process.load('FWCore.MessageService.MessageLogger_cfi') +process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(1000) +if hasattr(process,'MessageLogger'): + process.MessageLogger.MaterialBudget=dict() + +process.source = cms.Source("PoolSource", + noEventSort = cms.untracked.bool(True), + duplicateCheckMode = cms.untracked.string("noDuplicateCheck"), + fileNames = cms.untracked.vstring('file:single_neutrino_random.root') +) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(-1) +) + +process.TFileService = cms.Service("TFileService", + fileName = cms.string('matbdgRun3dddBigXML.root') +) + +process.g4SimHits.UseMagneticField = False +process.g4SimHits.Physics.type = 'SimG4Core/Physics/DummyPhysics' +process.g4SimHits.StackingAction.TrackNeutrino = True +process.g4SimHits.Physics.DummyEMPhysics = True +process.g4SimHits.Physics.CutsPerRegion = False + +process.load("Validation.Geometry.materialBudgetVolumeAnalysis_cfi") +process.p1 = cms.Path(process.g4SimHits+process.materialBudgetVolumeAnalysis) diff --git a/Validation/Geometry/test/runMaterialBudgetVolumeDB_cfg.py b/Validation/Geometry/test/runMaterialBudgetVolumeDB_cfg.py new file mode 100644 index 0000000000000..d694f84d40756 --- /dev/null +++ b/Validation/Geometry/test/runMaterialBudgetVolumeDB_cfg.py @@ -0,0 +1,49 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_cff import Run3 +process = cms.Process('PROD',Run3) +#from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep +#process = cms.Process('PROD',Run3_dd4hep) +process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.GeometrySimDB_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2021_realistic', '') +#process.GlobalTag = GlobalTag(process.GlobalTag, '120X_mcRun3_2021_realistic_dd4hep_v1', '') + +process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") +process.load("Configuration.StandardSequences.MagneticField_cff") +process.load("SimG4Core.Application.g4SimHits_cfi") +process.load("Validation.Geometry.materialBudgetVolume_cfi") + +process.load("IOMC.RandomEngine.IOMC_cff") +process.RandomNumberGeneratorService.g4SimHits.initialSeed = 9876 + +process.load('FWCore.MessageService.MessageLogger_cfi') +process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(1000) +if hasattr(process,'MessageLogger'): + process.MessageLogger.MaterialBudget=dict() + +process.source = cms.Source("PoolSource", + noEventSort = cms.untracked.bool(True), + duplicateCheckMode = cms.untracked.string("noDuplicateCheck"), + fileNames = cms.untracked.vstring('file:single_neutrino_random.root') +) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(-1) +) + +process.TFileService = cms.Service("TFileService", + fileName = cms.string('matbdgRun3dddDB.root') +# fileName = cms.string('matbdgRun3dd4hepDB.root') +) + +process.g4SimHits.UseMagneticField = False +process.g4SimHits.Physics.type = 'SimG4Core/Physics/DummyPhysics' +process.g4SimHits.StackingAction.TrackNeutrino = True +process.g4SimHits.Physics.DummyEMPhysics = True +process.g4SimHits.Physics.CutsPerRegion = False + +process.load("Validation.Geometry.materialBudgetVolumeAnalysis_cfi") +process.p1 = cms.Path(process.g4SimHits+process.materialBudgetVolumeAnalysis) diff --git a/Validation/Geometry/test/runMaterialBudgetVolume_cfg.py b/Validation/Geometry/test/runMaterialBudgetVolumeXML_cfg.py similarity index 92% rename from Validation/Geometry/test/runMaterialBudgetVolume_cfg.py rename to Validation/Geometry/test/runMaterialBudgetVolumeXML_cfg.py index 242fc32406876..074e76ca52656 100644 --- a/Validation/Geometry/test/runMaterialBudgetVolume_cfg.py +++ b/Validation/Geometry/test/runMaterialBudgetVolumeXML_cfg.py @@ -34,9 +34,9 @@ ) process.TFileService = cms.Service("TFileService", - fileName = cms.string('matbdg_run3.root') -# fileName = cms.string('matbdg_run3_dd4hep.root') -# fileName = cms.string('matbdg_phase2.root') + fileName = cms.string('matbdgRun3dddXML.root') +# fileName = cms.string('matbdgRun3dd4hepXML.root') +# fileName = cms.string('matbdgPhase2XML.root') ) process.g4SimHits.UseMagneticField = False diff --git a/Validation/Geometry/test/runMaterialDumpAnalyser.sh b/Validation/Geometry/test/runMaterialDumpAnalyser.sh index 38e71a988b612..156ceee326c62 100755 --- a/Validation/Geometry/test/runMaterialDumpAnalyser.sh +++ b/Validation/Geometry/test/runMaterialDumpAnalyser.sh @@ -128,7 +128,7 @@ fi for t in BeamPipe Tracker PixBar PixFwdMinus PixFwdPlus TIB TOB TIDB TIDF TEC TkStrct InnerServices; do if [ ! -e matbdg_${t}.root ]; then - python runP_Tracker.py geom=${geometry} label=$t >& /dev/null & + python3 runP_Tracker.py geom=${geometry} label=$t >& /dev/null & fi done @@ -137,7 +137,7 @@ waitPendingJobs # Always run the comparison at this stage, since you are guaranteed that all the ingredients are there for t in BeamPipe Tracker PixBar PixFwdMinus PixFwdPlus TIB TOB TIDB TIDF TEC TkStrct InnerServices; do - python MaterialBudget.py -s -d ${t} + python3 MaterialBudget.py -s -d ${t} if [ $? -ne 0 ]; then echo "Error while producing simulation material for ${t}, aborting" exit 1 diff --git a/Validation/Geometry/test/runMaterialDumpAnalyser_PhaseI.sh b/Validation/Geometry/test/runMaterialDumpAnalyser_PhaseI.sh index ff2897c8e51fc..401b945210175 100755 --- a/Validation/Geometry/test/runMaterialDumpAnalyser_PhaseI.sh +++ b/Validation/Geometry/test/runMaterialDumpAnalyser_PhaseI.sh @@ -134,7 +134,7 @@ fi for t in BeamPipe Tracker PixBar PixFwdMinus PixFwdPlus TIB TOB TIDB TIDF TEC TkStrct InnerServices; do if [ ! -e matbdg_${t}.root ]; then - python runP_Tracker.py geom=${geometry} label=$t >& /dev/null & + python3 runP_Tracker.py geom=${geometry} label=$t >& /dev/null & fi done @@ -143,7 +143,7 @@ waitPendingJobs # Always run the comparison at this stage, since you are guaranteed that all the ingredients are there for t in TrackerSum Pixel Strip InnerTracker BeamPipe Tracker PixBar PixFwdMinus PixFwdPlus TIB TOB TIDB TIDF TEC TkStrct InnerServices; do - python MaterialBudget.py -s -d ${t} + python3 MaterialBudget.py -s -d ${t} if [ $? -ne 0 ]; then echo "Error while producing simulation material for ${t}, aborting" exit 1 diff --git a/Validation/Geometry/test/runMaterialDumpAnalyser_PhaseII.sh b/Validation/Geometry/test/runMaterialDumpAnalyser_PhaseII.sh index 5310ec722df6e..71a18afa7f2f2 100755 --- a/Validation/Geometry/test/runMaterialDumpAnalyser_PhaseII.sh +++ b/Validation/Geometry/test/runMaterialDumpAnalyser_PhaseII.sh @@ -135,7 +135,7 @@ fi for t in BeamPipe Tracker Phase2PixelBarrel Phase2OTBarrel Phase2PixelEndcap Phase2OTForward; do if [ ! -e matbdg_${t}.root ]; then - python runP_Tracker.py geom=${geometry} label=$t >& /dev/null & + python3 runP_Tracker.py geom=${geometry} label=$t >& /dev/null & fi done @@ -144,7 +144,7 @@ waitPendingJobs # Always run the comparison at this stage, since you are guaranteed that all the ingredients are there for t in BeamPipe Tracker TrackerSumPhaseII Phase2PixelBarrel Phase2OTBarrel Phase2PixelEndcap Phase2OTForward; do - python MaterialBudget.py -s -d ${t} + python3 MaterialBudget.py -s -d ${t} if [ $? -ne 0 ]; then echo "Error while producing simulation material for ${t}, aborting" exit 1 diff --git a/Validation/Geometry/test/runP_Tracker.py b/Validation/Geometry/test/runP_Tracker.py index ddb375343ed84..48d531fc4ce9b 100644 --- a/Validation/Geometry/test/runP_Tracker.py +++ b/Validation/Geometry/test/runP_Tracker.py @@ -1,6 +1,6 @@ # In order to produce everything that you need in one go, use the command: # -# for t in {'BeamPipe','Tracker','PixBar','PixFwdMinus','PixFwdPlus','TIB','TOB','TIDB','TIDF','TEC','TkStrct','InnerServices'}; do python runP_Tracker.py geom=XYZ label=$t >& /dev/null &; done +# for t in {'BeamPipe','Tracker','PixBar','PixFwdMinus','PixFwdPlus','TIB','TOB','TIDB','TIDF','TEC','TkStrct','InnerServices'}; do python3 runP_Tracker.py geom=XYZ label=$t >& /dev/null &; done from __future__ import print_function import FWCore.ParameterSet.Config as cms @@ -21,7 +21,7 @@ The default component to be monitored is the Tracker. If other components need to be studied, they must be supplied, one at a time, - at the command line, e.g.: python runP_Tracker.py + at the command line, e.g.: python3 runP_Tracker.py label="XYZ" """ diff --git a/Validation/HGCalValidation/interface/HGCalValidator.h b/Validation/HGCalValidation/interface/HGCalValidator.h index 870ac532e508f..a8ada8df47e26 100644 --- a/Validation/HGCalValidation/interface/HGCalValidator.h +++ b/Validation/HGCalValidation/interface/HGCalValidator.h @@ -62,14 +62,18 @@ class HGCalValidator : public DQMGlobalEDAnalyzer { edm::ESGetToken caloGeomToken_; edm::InputTag label_lcl; std::vector label_tst; + edm::InputTag label_simTSFromCP; edm::InputTag associator_; edm::InputTag associatorSim_; const bool SaveGeneralInfo_; const bool doCaloParticlePlots_; const bool doCaloParticleSelection_; const bool doSimClustersPlots_; + edm::InputTag label_SimClustersPlots_, label_SimClustersLevel_; const bool doLayerClustersPlots_; + edm::InputTag label_layerClustersPlots_, label_LCToCPLinking_; const bool doTrackstersPlots_; + edm::InputTag label_TSToCPLinking_; std::vector label_clustersmask; const edm::FileInPath cummatbudinxo_; @@ -77,6 +81,7 @@ class HGCalValidator : public DQMGlobalEDAnalyzer { edm::EDGetTokenT> simClusters_; edm::EDGetTokenT layerclusters_; std::vector> label_tstTokens; + edm::EDGetTokenT simTrackstersFromCPs_; edm::EDGetTokenT> label_cp_effic; edm::EDGetTokenT> label_cp_fake; edm::EDGetTokenT> simVertices_; diff --git a/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h b/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h index 3c0faa5186922..a7d3500ef3b0b 100644 --- a/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h +++ b/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h @@ -229,6 +229,7 @@ class HGVHistoProducerAlgo { std::vector thicknesses); void bookTracksterHistos(DQMStore::IBooker& ibook, Histograms& histograms, unsigned int layers); + void bookTracksterCPLinkingHistos(DQMStore::IBooker& ibook, Histograms& histograms); void layerClusters_to_CaloParticles(const Histograms& histograms, edm::Handle clusterHandle, @@ -253,10 +254,11 @@ class HGVHistoProducerAlgo { unsigned int layers, const hgcal::RecoToSimCollectionWithSimClusters& recSimColl, const hgcal::SimToRecoCollectionWithSimClusters& simRecColl) const; - void tracksters_to_CaloParticles(const Histograms& histograms, + void tracksters_to_SimTracksters(const Histograms& histograms, int count, const ticl::TracksterCollection& Tracksters, const reco::CaloClusterCollection& layerClusters, + const ticl::TracksterCollection& simTSFromCP, std::vector const& cP, std::vector const& cPIndices, std::vector const& cPSelectedIndices, @@ -305,6 +307,7 @@ class HGVHistoProducerAlgo { int count, const ticl::TracksterCollection& Tracksters, const reco::CaloClusterCollection& layerClusters, + const ticl::TracksterCollection& simTSFromCP, std::vector const& cP, std::vector const& cPIndices, std::vector const& cPSelectedIndices, diff --git a/Validation/HGCalValidation/plugins/HGCalHitCalibration.cc b/Validation/HGCalValidation/plugins/HGCalHitCalibration.cc index 284b939e22697..af04c1d778245 100644 --- a/Validation/HGCalValidation/plugins/HGCalHitCalibration.cc +++ b/Validation/HGCalValidation/plugins/HGCalHitCalibration.cc @@ -393,9 +393,9 @@ void HGCalHitCalibration::fillDescriptions(edm::ConfigurationDescriptions& descr desc.add("recHitsEE", edm::InputTag("HGCalRecHit", "HGCEERecHits")); desc.add("recHitsFH", edm::InputTag("HGCalRecHit", "HGCHEFRecHits")); desc.add("recHitsBH", edm::InputTag("HGCalRecHit", "HGCHEBRecHits")); - desc.add("hgcalMultiClusters", edm::InputTag("particleFlowClusterHGCalFromMultiCl")); - desc.add("electrons", edm::InputTag("ecalDrivenGsfElectronsFromMultiCl")); - desc.add("photons", edm::InputTag("photonsFromMultiCl")); + desc.add("hgcalMultiClusters", edm::InputTag("particleFlowClusterHGCal")); + desc.add("electrons", edm::InputTag("ecalDrivenGsfElectronsHGC")); + desc.add("photons", edm::InputTag("photonsHGC")); descriptions.add("hgcalHitCalibrationDefault", desc); } diff --git a/Validation/HGCalValidation/plugins/HGCalSimHitValidation.cc b/Validation/HGCalValidation/plugins/HGCalSimHitValidation.cc index a121f956a8575..1459e75b40693 100644 --- a/Validation/HGCalValidation/plugins/HGCalSimHitValidation.cc +++ b/Validation/HGCalValidation/plugins/HGCalSimHitValidation.cc @@ -185,10 +185,9 @@ void HGCalSimHitValidation::analyzeHits(std::vector& hits) { double time = hits[i].time(); uint32_t id_ = hits[i].id(); int cell, sector, subsector(0), layer, zside; - int subdet(0), cell2(0), type(0); + int cell2(0), type(0); if (hgcons_->waferHexagon8()) { HGCSiliconDetId detId = HGCSiliconDetId(id_); - subdet = ForwardEmpty; cell = detId.cellU(); cell2 = detId.cellV(); sector = detId.waferU(); @@ -198,7 +197,6 @@ void HGCalSimHitValidation::analyzeHits(std::vector& hits) { zside = detId.zside(); } else if (hgcons_->tileTrapezoid()) { HGCScintillatorDetId detId = HGCScintillatorDetId(id_); - subdet = ForwardEmpty; sector = detId.ietaAbs(); cell = detId.iphi(); subsector = 1; @@ -206,6 +204,7 @@ void HGCalSimHitValidation::analyzeHits(std::vector& hits) { layer = detId.layer(); zside = detId.zside(); } else { + int subdet; HGCalTestNumbering::unpackHexagonIndex(id_, subdet, zside, layer, sector, type, cell); } nused++; diff --git a/Validation/HGCalValidation/plugins/HGCalValidator.cc b/Validation/HGCalValidation/plugins/HGCalValidator.cc index a44dad1b64e3e..df997d298fdb0 100644 --- a/Validation/HGCalValidation/plugins/HGCalValidator.cc +++ b/Validation/HGCalValidation/plugins/HGCalValidator.cc @@ -12,14 +12,20 @@ HGCalValidator::HGCalValidator(const edm::ParameterSet& pset) : caloGeomToken_(esConsumes()), label_lcl(pset.getParameter("label_lcl")), label_tst(pset.getParameter>("label_tst")), + label_simTSFromCP(pset.getParameter("label_simTSFromCP")), associator_(pset.getUntrackedParameter("associator")), associatorSim_(pset.getUntrackedParameter("associatorSim")), SaveGeneralInfo_(pset.getUntrackedParameter("SaveGeneralInfo")), doCaloParticlePlots_(pset.getUntrackedParameter("doCaloParticlePlots")), doCaloParticleSelection_(pset.getUntrackedParameter("doCaloParticleSelection")), doSimClustersPlots_(pset.getUntrackedParameter("doSimClustersPlots")), + label_SimClustersPlots_(pset.getParameter("label_SimClusters")), + label_SimClustersLevel_(pset.getParameter("label_SimClustersLevel")), doLayerClustersPlots_(pset.getUntrackedParameter("doLayerClustersPlots")), + label_layerClustersPlots_(pset.getParameter("label_layerClusterPlots")), + label_LCToCPLinking_(pset.getParameter("label_LCToCPLinking")), doTrackstersPlots_(pset.getUntrackedParameter("doTrackstersPlots")), + label_TSToCPLinking_(pset.getParameter("label_TSToCPLinking")), label_clustersmask(pset.getParameter>("LayerClustersInputMask")), cummatbudinxo_(pset.getParameter("cummatbudinxo")) { //In this way we can easily generalize to associations between other objects also. @@ -50,6 +56,8 @@ HGCalValidator::HGCalValidator(const edm::ParameterSet& pset) label_tstTokens.push_back(consumes(itag)); } + simTrackstersFromCPs_ = consumes(label_simTSFromCP); + associatorMapRtS = consumes(associator_); associatorMapStR = consumes(associator_); @@ -118,14 +126,14 @@ void HGCalValidator::bookHistograms(DQMStore::IBooker& ibook, //Booking histograms concerning with simClusters if (doSimClustersPlots_) { ibook.cd(); - ibook.setCurrentFolder(dirName_ + "simClusters/ClusterLevel"); + ibook.setCurrentFolder(dirName_ + label_SimClustersPlots_.label() + "/" + label_SimClustersLevel_.label()); histoProducerAlgo_->bookSimClusterHistos( ibook, histograms.histoProducerAlgo, totallayers_to_monitor_, thicknesses_to_monitor_); for (unsigned int ws = 0; ws < label_clustersmask.size(); ws++) { ibook.cd(); InputTag algo = label_clustersmask[ws]; - string dirName = dirName_ + "simClusters/"; + string dirName = dirName_ + label_SimClustersPlots_.label() + "/"; if (!algo.process().empty()) dirName += algo.process() + "_"; LogDebug("HGCalValidator") << dirName << "\n"; @@ -152,19 +160,19 @@ void HGCalValidator::bookHistograms(DQMStore::IBooker& ibook, //Booking histograms concerning with hgcal layer clusters if (doLayerClustersPlots_) { ibook.cd(); - ibook.setCurrentFolder(dirName_ + "hgcalLayerClusters/ClusterLevel"); + ibook.setCurrentFolder(dirName_ + label_layerClustersPlots_.label() + "/ClusterLevel"); histoProducerAlgo_->bookClusterHistos_ClusterLevel(ibook, histograms.histoProducerAlgo, totallayers_to_monitor_, thicknesses_to_monitor_, cummatbudinxo_.fullPath()); ibook.cd(); - ibook.setCurrentFolder(dirName_ + "hgcalLayerClusters/LCtoCP_association"); + ibook.setCurrentFolder(dirName_ + label_layerClustersPlots_.label() + "/" + label_LCToCPLinking_.label()); histoProducerAlgo_->bookClusterHistos_LCtoCP_association( ibook, histograms.histoProducerAlgo, totallayers_to_monitor_); ibook.cd(); - ibook.setCurrentFolder(dirName_ + "hgcalLayerClusters/CellLevel"); + ibook.setCurrentFolder(dirName_ + label_layerClustersPlots_.label() + "/CellLevel"); histoProducerAlgo_->bookClusterHistos_CellLevel( ibook, histograms.histoProducerAlgo, totallayers_to_monitor_, thicknesses_to_monitor_); } @@ -192,9 +200,11 @@ void HGCalValidator::bookHistograms(DQMStore::IBooker& ibook, ibook.setCurrentFolder(dirName); - //Booking histograms concerning for HGCal tracksters + //Booking histograms concerning HGCal tracksters if (doTrackstersPlots_) { histoProducerAlgo_->bookTracksterHistos(ibook, histograms.histoProducerAlgo, totallayers_to_monitor_); + ibook.setCurrentFolder(dirName + "/" + label_TSToCPLinking_.label()); + histoProducerAlgo_->bookTracksterCPLinkingHistos(ibook, histograms.histoProducerAlgo); } } //end of booking Tracksters loop } @@ -242,6 +252,10 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, event.getByToken(label_cp_effic, caloParticleHandle); std::vector const& caloParticles = *caloParticleHandle; + edm::Handle simTracksterFromCPHandle; + event.getByToken(simTrackstersFromCPs_, simTracksterFromCPHandle); + ticl::TracksterCollection const& simTrackstersFromCPs = *simTracksterFromCPHandle; + edm::ESHandle geom = setup.getHandle(caloGeomToken_); tools_->setGeometry(*geom); histoProducerAlgo_->setRecHitTools(tools_); @@ -386,6 +400,7 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, wml, tracksters, clusters, + simTrackstersFromCPs, caloParticles, cPIndices, selected_cPeff, diff --git a/Validation/HGCalValidation/python/HGCalValidator_cfi.py b/Validation/HGCalValidation/python/HGCalValidator_cfi.py index 6c339f4312de4..23824c5c514e2 100644 --- a/Validation/HGCalValidation/python/HGCalValidator_cfi.py +++ b/Validation/HGCalValidation/python/HGCalValidator_cfi.py @@ -25,6 +25,7 @@ #2DLayerClusters, PFClusters, Tracksters label_lcl = layerClusterCaloParticleAssociation.label_lc, label_tst = cms.VInputTag(labelTst), + label_simTSFromCP = cms.InputTag("ticlSimTracksters"), associator = cms.untracked.InputTag("layerClusterCaloParticleAssociationProducer"), @@ -38,10 +39,15 @@ doCaloParticleSelection = cms.untracked.bool(True), #SimCluster related plots doSimClustersPlots = cms.untracked.bool(True), + label_SimClusters = cms.InputTag("SimClusters"), + label_SimClustersLevel = cms.InputTag("ClusterLevel"), #Layer Cluster related plots doLayerClustersPlots = cms.untracked.bool(True), + label_layerClusterPlots = cms.InputTag("hgcalLayerClusters"), + label_LCToCPLinking = cms.InputTag("LCToCP_association"), #Trackster related plots doTrackstersPlots = cms.untracked.bool(True), + label_TSToCPLinking = cms.InputTag("TSToCP_linking"), #The cumulative material budget in front of each layer. To be more specific, it #is the material budget just in front of the active material (not including it). diff --git a/Validation/HGCalValidation/python/HGVHistoProducerAlgoBlock_cfi.py b/Validation/HGCalValidation/python/HGVHistoProducerAlgoBlock_cfi.py index 4170cddd32176..0a38bcd016585 100644 --- a/Validation/HGCalValidation/python/HGVHistoProducerAlgoBlock_cfi.py +++ b/Validation/HGCalValidation/python/HGVHistoProducerAlgoBlock_cfi.py @@ -1,7 +1,6 @@ import FWCore.ParameterSet.Config as cms HGVHistoProducerAlgoBlock = cms.PSet( - minEta = cms.double(-4.5), maxEta = cms.double(4.5), nintEta = cms.int32(100), @@ -179,5 +178,4 @@ minZ = cms.double(-550.), maxZ = cms.double(550.), nintZ = cms.int32(1100) - ) diff --git a/Validation/HGCalValidation/python/PostProcessorHGCAL_cfi.py b/Validation/HGCalValidation/python/PostProcessorHGCAL_cfi.py index 1b607fd13e996..f4a3ef5ca1f2a 100644 --- a/Validation/HGCalValidation/python/PostProcessorHGCAL_cfi.py +++ b/Validation/HGCalValidation/python/PostProcessorHGCAL_cfi.py @@ -1,7 +1,9 @@ import FWCore.ParameterSet.Config as cms from DQMServices.Core.DQMEDHarvester import DQMEDHarvester from RecoHGCal.TICL.iterativeTICL_cff import ticlIterLabelsMerge +from Validation.HGCalValidation.HGCalValidator_cfi import hgcalValidator +prefix = 'HGCAL/HGCalValidator/' maxlayerzm = 50# last layer of BH -z maxlayerzp = 100# last layer of BH +z @@ -15,8 +17,9 @@ eff_layers.extend(["merge_eta_layer{:02d} 'LayerCluster Merge Rate vs #eta Layer{:02d} in z-' NumMerge_LayerCluster_Eta_perlayer{:02d} Denom_LayerCluster_Eta_perlayer{:02d}".format(i, i%maxlayerzm+1, i, i) if (i51 @@ -1664,10 +1667,10 @@ _common_energy_score = dict(removeEmptyBins=True, xbinlabelsize=10, xbinlabeloption="d") _common_energy_score["ymax"] = 1. _common_energy_score["xmax"] = 1.0 -_energyscore_cp2mcl = PlotOnSideGroup("Energy_vs_Score_CaloParticlesToTracksters", Plot("Energy_vs_Score_caloparticle2trackster", drawStyle="COLZ", adjustMarginRight=0.1, **_common_energy_score), ncols=1) +_energyscore_cp2ts = PlotOnSideGroup("Energy_vs_Score_CaloParticlesToTracksters", Plot("Energy_vs_Score_caloparticle2trackster", drawStyle="COLZ", adjustMarginRight=0.1, **_common_energy_score), ncols=1) _common_energy_score["ymax"] = 1. _common_energy_score["xmax"] = 1.0 -_energyscore_mcl2cp = PlotOnSideGroup("Energy_vs_Score_TrackstersToCaloParticles", Plot("Energy_vs_Score_trackster2caloparticle", drawStyle="COLZ", adjustMarginRight=0.1, **_common_energy_score), ncols=1) +_energyscore_ts2cp = PlotOnSideGroup("Energy_vs_Score_TrackstersToCaloParticles", Plot("Energy_vs_Score_trackster2caloparticle", drawStyle="COLZ", adjustMarginRight=0.1, **_common_energy_score), ncols=1) #Coming back to the usual box definition _common = {"stat": True, "drawStyle": "hist", "staty": 0.65 } @@ -2268,7 +2271,7 @@ _distancebetseedandmaxcellvsclusterenergy_perthickperlayer_scint_BH_zplus ] -def append_hgcalLayerClustersPlots(collection = "hgcalLayerClusters", name_collection = layerClustersLabel, extended = False): +def append_hgcalLayerClustersPlots(collection = hgcalValidator.label_layerClusterPlots._InputTag__moduleLabel, name_collection = layerClustersLabel, extended = False): print('extended : ',extended) regions_ClusterLevel = ["General: Cluster Level", "Z-minus: Cluster Level", "Z-plus: Cluster Level"] regions_CellLevel = ["Z-minus: Cell Level", "Z-plus: Cell Level"] @@ -2309,7 +2312,7 @@ def append_hgcalLayerClustersPlots(collection = "hgcalLayerClusters", name_colle purpose=PlotPurpose.Timing, page=layerClustersLabel, section=reg)) for reg, setPlot in zip(regions_LCtoCP_association, setPlots_LCtoCP_association): hgcalLayerClustersPlotter.append(collection+"_"+reg, [ - _hgcalFolders(collection + "/LCtoCP_association") + _hgcalFolders(collection + "/" + lcToCP_linking) ], PlotFolder( *setPlot, loopSubFolders=False, @@ -2317,7 +2320,7 @@ def append_hgcalLayerClustersPlots(collection = "hgcalLayerClusters", name_colle #================================================================================================= def _hgcalsimClustersFolders(lastDirName): - return "DQMData/Run 1/HGCAL/Run summary/HGCalValidator/simClusters/"+lastDirName + return "DQMData/Run 1/HGCAL/Run summary/HGCalValidator/" + hgcalValidator.label_SimClusters._InputTag__moduleLabel + "/"+lastDirName sc_clusterlevel = [ # number of layer clusters per event in a) 120um, b) 200um, c) 300um, d) scint @@ -2409,7 +2412,7 @@ def _hgcalsimClustersFolders(lastDirName): hgcalSimClustersPlotter = Plotter() def append_hgcalSimClustersPlots(collection, name_collection): - if collection == "ClusterLevel": + if collection == hgcalValidator.label_SimClustersLevel._InputTag__moduleLabel: hgcalSimClustersPlotter.append(collection, [ _hgcalsimClustersFolders(collection) ], PlotFolder( @@ -2429,22 +2432,10 @@ def append_hgcalSimClustersPlots(collection, name_collection): def _hgcalFolders(lastDirName="hgcalLayerClusters"): return "DQMData/Run 1/HGCAL/Run summary/HGCalValidator/"+lastDirName -_trackstersAllPlots = [ - _efficiencies, - _purities, - _duplicates, - _fakes, - _merges, +_trackstersPlots = [ _trackster_eppe, _trackster_xyz, _tottracksternum, - _score_caloparticle_to_tracksters, - _score_trackster_to_caloparticles, - _sharedEnergy_caloparticle_to_trackster, - _sharedEnergy_trackster_to_caloparticle, - #_energyscore_cp2mcl_mcl2cp, - _energyscore_cp2mcl, - _energyscore_mcl2cp, _clusternum_in_trackster, _clusternum_in_trackster_vs_layer, _clusternum_in_trackster_perlayer_zminus_EE, @@ -2457,16 +2448,38 @@ def _hgcalFolders(lastDirName="hgcalLayerClusters"): _multiplicityOfLCinTST, ] +_trackstersToCPLinkPlots = [ + _efficiencies, + _purities, + _duplicates, + _fakes, + _merges, + _score_caloparticle_to_tracksters, + _score_trackster_to_caloparticles, + _sharedEnergy_caloparticle_to_trackster, + _sharedEnergy_trackster_to_caloparticle, + _energyscore_cp2ts, + _energyscore_ts2cp, +] + hgcalTrackstersPlotter = Plotter() def append_hgcalTrackstersPlots(collection = 'ticlTrackstersMerge', name_collection = "TrackstersMerge"): - # Appending all plots for MCs + # Appending generic plots for Tracksters hgcalTrackstersPlotter.append(collection, [ _hgcalFolders(collection) ], PlotFolder( - *_trackstersAllPlots, + *_trackstersPlots, loopSubFolders=False, purpose=PlotPurpose.Timing, page="Tracksters", section=name_collection)) + # Appending plots for Tracksters to CP linking + hgcalTrackstersPlotter.append(collection, [ + _hgcalFolders(collection + "/" + tsToCP_linking) + ], PlotFolder( + *_trackstersToCPLinkPlots, + loopSubFolders=False, + purpose=PlotPurpose.Timing, page=tsToCP_linking.replace('TSToCP_','TICL-'), section=name_collection)) + #We append here two PlotFolder because we want the text to be in percent #and the number of events are different in zplus and zminus #hgcalTrackstersPlotter.append("Multiplicity", [ diff --git a/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py b/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py old mode 100644 new mode 100755 index 5f89042a14cf2..5ee6e3884f473 --- a/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py +++ b/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py @@ -8,14 +8,16 @@ from RecoHGCal.TICL.iterativeTICL_cff import ticlIterLabels, ticlIterLabelsMerge from Validation.RecoTrack.plotting.validation import SeparateValidation, SimpleValidation, SimpleSample +from Validation.HGCalValidation.HGCalValidator_cfi import hgcalValidator import Validation.HGCalValidation.hgcalPlots as hgcalPlots import Validation.RecoTrack.plotting.plotting as plotting -simClustersIters = ["ClusterLevel","ticlSimTracksters"] +simClustersIters = [hgcalValidator.label_SimClustersLevel._InputTag__moduleLabel, "ticlSimTracksters"] trackstersIters = ['ticlTracksters'+iteration for iteration in ticlIterLabelsMerge] trackstersIters.extend(["ticlSimTracksters"]) -hitLabel = 'recHits' +hitCalLabel = 'hitCalibration' +hitValLabel = 'hitValidation' layerClustersLabel = 'layerClusters' trackstersLabel = 'tracksters' trackstersWithEdgesLabel = 'trackstersWithEdges' @@ -23,7 +25,7 @@ allLabel = 'all' collection_choices = [allLabel] -collection_choices.extend([hitLabel]+[layerClustersLabel]+[trackstersLabel]+[trackstersWithEdgesLabel]+[simLabel]) +collection_choices.extend([hitCalLabel]+[hitValLabel]+[layerClustersLabel]+[trackstersLabel]+[trackstersWithEdgesLabel]+[simLabel]) def main(opts): @@ -51,7 +53,7 @@ def main(opts): #layerClusters def plot_LC(): hgclayclus = [hgcalPlots.hgcalLayerClustersPlotter] - hgcalPlots.append_hgcalLayerClustersPlots("hgcalLayerClusters", "Layer Clusters", extendedFlag) + hgcalPlots.append_hgcalLayerClustersPlots(hgcalValidator.label_layerClusterPlots._InputTag__moduleLabel, "Layer Clusters", extendedFlag) val.doPlots(hgclayclus, plotterDrawArgs=drawArgs) #simClusters @@ -101,7 +103,7 @@ def plot_hitCal(): val.doPlots(hgchitcalib, plotterDrawArgs=drawArgs) - plotDict = {hitLabel:[plot_hitVal, plot_hitCal], layerClustersLabel:[plot_LC], trackstersLabel:[plot_Tst], trackstersWithEdgesLabel:[plot_TstEdges], simLabel:[plot_SC, plot_CP]} + plotDict = {hitCalLabel:[plot_hitCal], hitValLabel:[plot_hitVal], layerClustersLabel:[plot_LC], trackstersLabel:[plot_Tst], trackstersWithEdgesLabel:[plot_TstEdges], simLabel:[plot_SC, plot_CP]} if (opts.collection != allLabel): for task in plotDict[opts.collection]: diff --git a/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc b/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc index 6940700adfb0a..15200eac0cb2c 100644 --- a/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc +++ b/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc @@ -16,8 +16,8 @@ const double ScoreCutLCtoCP_ = 0.1; const double ScoreCutCPtoLC_ = 0.1; const double ScoreCutLCtoSC_ = 0.1; const double ScoreCutSCtoLC_ = 0.1; -const double ScoreCutTSTtoCPFakeMerge_ = 0.6; -const double ScoreCutCPtoTSTEffDup_ = 0.2; +const double ScoreCutTStoCPFakeMerge_ = 0.6; +const double ScoreCutCPtoTSEffDup_ = 0.2; HGVHistoProducerAlgo::HGVHistoProducerAlgo(const edm::ParameterSet& pset) : //parameters for eta @@ -965,108 +965,6 @@ void HGVHistoProducerAlgo::bookClusterHistos_CellLevel(DQMStore::IBooker& ibook, //---------------------------------------------------------------------------------------------------------------------------- void HGVHistoProducerAlgo::bookTracksterHistos(DQMStore::IBooker& ibook, Histograms& histograms, unsigned int layers) { - histograms.h_score_trackster2caloparticle.push_back(ibook.book1D( - "Score_trackster2caloparticle", "Score of Trackster per CaloParticle", nintScore_, minScore_, maxScore_)); - histograms.h_score_caloparticle2trackster.push_back(ibook.book1D( - "Score_caloparticle2trackster", "Score of CaloParticle per Trackster", nintScore_, minScore_, maxScore_)); - histograms.h_energy_vs_score_trackster2caloparticle.push_back( - ibook.book2D("Energy_vs_Score_trackster2caloparticle", - "Energy vs Score of Trackster per CaloParticle", - nintScore_, - minScore_, - maxScore_, - nintSharedEneFrac_, - minTSTSharedEneFrac_, - maxTSTSharedEneFrac_)); - histograms.h_energy_vs_score_caloparticle2trackster.push_back( - ibook.book2D("Energy_vs_Score_caloparticle2trackster", - "Energy vs Score of CaloParticle per Trackster", - nintScore_, - minScore_, - maxScore_, - nintSharedEneFrac_, - minTSTSharedEneFrac_, - maxTSTSharedEneFrac_)); - - //back to all Tracksters - histograms.h_num_trackster_eta.push_back( - ibook.book1D("Num_Trackster_Eta", "Num Trackster Eta per Trackster ", nintEta_, minEta_, maxEta_)); - histograms.h_numMerge_trackster_eta.push_back( - ibook.book1D("NumMerge_Trackster_Eta", "Num Merge Trackster Eta per Trackster ", nintEta_, minEta_, maxEta_)); - histograms.h_denom_trackster_eta.push_back( - ibook.book1D("Denom_Trackster_Eta", "Denom Trackster Eta per Trackster", nintEta_, minEta_, maxEta_)); - histograms.h_num_trackster_phi.push_back( - ibook.book1D("Num_Trackster_Phi", "Num Trackster Phi per Trackster ", nintPhi_, minPhi_, maxPhi_)); - histograms.h_numMerge_trackster_phi.push_back( - ibook.book1D("NumMerge_Trackster_Phi", "Num Merge Trackster Phi per Trackster", nintPhi_, minPhi_, maxPhi_)); - histograms.h_denom_trackster_phi.push_back( - ibook.book1D("Denom_Trackster_Phi", "Denom Trackster Phi per Trackster", nintPhi_, minPhi_, maxPhi_)); - histograms.h_sharedenergy_trackster2caloparticle.push_back( - ibook.book1D("SharedEnergy_trackster2caloparticle", - "Shared Energy of Trackster per Calo Particle in each layer", - nintSharedEneFrac_, - minTSTSharedEneFrac_, - maxTSTSharedEneFrac_)); - histograms.h_sharedenergy_trackster2caloparticle_vs_eta.push_back( - ibook.bookProfile("SharedEnergy_trackster2caloparticle_vs_eta", - "Shared Energy of Trackster vs #eta per best Calo Particle in each layer", - nintEta_, - minEta_, - maxEta_, - minTSTSharedEneFrac_, - maxTSTSharedEneFrac_)); - histograms.h_sharedenergy_trackster2caloparticle_vs_phi.push_back( - ibook.bookProfile("SharedEnergy_trackster2caloparticle_vs_phi", - "Shared Energy of Trackster vs #phi per best Calo Particle in each layer", - nintPhi_, - minPhi_, - maxPhi_, - minTSTSharedEneFrac_, - maxTSTSharedEneFrac_)); - histograms.h_sharedenergy_caloparticle2trackster.push_back(ibook.book1D("SharedEnergy_caloparticle2trackster", - "Shared Energy of CaloParticle per Trackster", - nintSharedEneFrac_, - minTSTSharedEneFrac_, - maxTSTSharedEneFrac_)); - histograms.h_sharedenergy_caloparticle2trackster_assoc.push_back( - ibook.book1D("SharedEnergy_caloparticle2trackster_assoc", - "Shared Energy of Associated CaloParticle per Trackster", - nintSharedEneFrac_, - minTSTSharedEneFrac_, - maxTSTSharedEneFrac_)); - histograms.h_sharedenergy_caloparticle2trackster_vs_eta.push_back( - ibook.bookProfile("SharedEnergy_caloparticle2trackster_vs_eta", - "Shared Energy of CaloParticle vs #eta per best Trackster", - nintEta_, - minEta_, - maxEta_, - minTSTSharedEneFrac_, - maxTSTSharedEneFrac_)); - histograms.h_sharedenergy_caloparticle2trackster_vs_phi.push_back( - ibook.bookProfile("SharedEnergy_caloparticle2trackster_vs_phi", - "Shared Energy of CaloParticle vs #phi per best Trackster", - nintPhi_, - minPhi_, - maxPhi_, - minTSTSharedEneFrac_, - maxTSTSharedEneFrac_)); - histograms.h_numEff_caloparticle_eta.push_back(ibook.book1D( - "NumEff_CaloParticle_Eta", "Num Efficiency CaloParticle Eta per Trackster", nintEta_, minEta_, maxEta_)); - histograms.h_num_caloparticle_eta.push_back( - ibook.book1D("Num_CaloParticle_Eta", "Num Purity CaloParticle Eta per Trackster", nintEta_, minEta_, maxEta_)); - histograms.h_numDup_trackster_eta.push_back( - ibook.book1D("NumDup_Trackster_Eta", "Num Duplicate Trackster vs Eta", nintEta_, minEta_, maxEta_)); - histograms.h_denom_caloparticle_eta.push_back( - ibook.book1D("Denom_CaloParticle_Eta", "Denom CaloParticle Eta per Trackster", nintEta_, minEta_, maxEta_)); - histograms.h_numEff_caloparticle_phi.push_back(ibook.book1D( - "NumEff_CaloParticle_Phi", "Num Efficiency CaloParticle Phi per Trackster", nintPhi_, minPhi_, maxPhi_)); - histograms.h_num_caloparticle_phi.push_back( - ibook.book1D("Num_CaloParticle_Phi", "Num Purity CaloParticle Phi per Trackster", nintPhi_, minPhi_, maxPhi_)); - histograms.h_numDup_trackster_phi.push_back( - ibook.book1D("NumDup_Trackster_Phi", "Num Duplicate Trackster vs Phi", nintPhi_, minPhi_, maxPhi_)); - histograms.h_denom_caloparticle_phi.push_back( - ibook.book1D("Denom_CaloParticle_Phi", "Denom CaloParticle Phi per Trackster", nintPhi_, minPhi_, maxPhi_)); - std::unordered_map clusternum_in_trackster_perlayer; clusternum_in_trackster_perlayer.clear(); @@ -1197,6 +1095,113 @@ void HGVHistoProducerAlgo::bookTracksterHistos(DQMStore::IBooker& ibook, Histogr ibook.book1D("trackster_layersnum", "Number of layers of the Trackster", 2 * layers, 0., (float)2 * layers)); } +void HGVHistoProducerAlgo::bookTracksterCPLinkingHistos(DQMStore::IBooker& ibook, Histograms& histograms) { + histograms.h_score_trackster2caloparticle.push_back(ibook.book1D( + "Score_trackster2caloparticle", "Score of Trackster per CaloParticle", nintScore_, minScore_, maxScore_)); + histograms.h_score_caloparticle2trackster.push_back(ibook.book1D( + "Score_caloparticle2trackster", "Score of CaloParticle per Trackster", nintScore_, minScore_, maxScore_)); + histograms.h_energy_vs_score_trackster2caloparticle.push_back( + ibook.book2D("Energy_vs_Score_trackster2caloparticle", + "Energy vs Score of Trackster per CaloParticle", + nintScore_, + minScore_, + maxScore_, + nintSharedEneFrac_, + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + histograms.h_energy_vs_score_caloparticle2trackster.push_back( + ibook.book2D("Energy_vs_Score_caloparticle2trackster", + "Energy vs Score of CaloParticle per Trackster", + nintScore_, + minScore_, + maxScore_, + nintSharedEneFrac_, + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + + //back to all Tracksters + histograms.h_num_trackster_eta.push_back( + ibook.book1D("Num_Trackster_Eta", "Num Trackster Eta per Trackster ", nintEta_, minEta_, maxEta_)); + histograms.h_numMerge_trackster_eta.push_back( + ibook.book1D("NumMerge_Trackster_Eta", "Num Merge Trackster Eta per Trackster ", nintEta_, minEta_, maxEta_)); + histograms.h_denom_trackster_eta.push_back( + ibook.book1D("Denom_Trackster_Eta", "Denom Trackster Eta per Trackster", nintEta_, minEta_, maxEta_)); + histograms.h_num_trackster_phi.push_back( + ibook.book1D("Num_Trackster_Phi", "Num Trackster Phi per Trackster ", nintPhi_, minPhi_, maxPhi_)); + histograms.h_numMerge_trackster_phi.push_back( + ibook.book1D("NumMerge_Trackster_Phi", "Num Merge Trackster Phi per Trackster", nintPhi_, minPhi_, maxPhi_)); + histograms.h_denom_trackster_phi.push_back( + ibook.book1D("Denom_Trackster_Phi", "Denom Trackster Phi per Trackster", nintPhi_, minPhi_, maxPhi_)); + + histograms.h_sharedenergy_trackster2caloparticle.push_back( + ibook.book1D("SharedEnergy_trackster2caloparticle", + "Shared Energy of Trackster per Calo Particle in each layer", + nintSharedEneFrac_, + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + histograms.h_sharedenergy_trackster2caloparticle_vs_eta.push_back( + ibook.bookProfile("SharedEnergy_trackster2caloparticle_vs_eta", + "Shared Energy of Trackster vs #eta per best Calo Particle in each layer", + nintEta_, + minEta_, + maxEta_, + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + histograms.h_sharedenergy_trackster2caloparticle_vs_phi.push_back( + ibook.bookProfile("SharedEnergy_trackster2caloparticle_vs_phi", + "Shared Energy of Trackster vs #phi per best Calo Particle in each layer", + nintPhi_, + minPhi_, + maxPhi_, + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + + histograms.h_sharedenergy_caloparticle2trackster.push_back(ibook.book1D("SharedEnergy_caloparticle2trackster", + "Shared Energy of CaloParticle per Trackster", + nintSharedEneFrac_, + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + histograms.h_sharedenergy_caloparticle2trackster_assoc.push_back( + ibook.book1D("SharedEnergy_caloparticle2trackster_assoc", + "Shared Energy of Associated CaloParticle per Trackster", + nintSharedEneFrac_, + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + histograms.h_sharedenergy_caloparticle2trackster_vs_eta.push_back( + ibook.bookProfile("SharedEnergy_caloparticle2trackster_vs_eta", + "Shared Energy of CaloParticle vs #eta per best Trackster", + nintEta_, + minEta_, + maxEta_, + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + histograms.h_sharedenergy_caloparticle2trackster_vs_phi.push_back( + ibook.bookProfile("SharedEnergy_caloparticle2trackster_vs_phi", + "Shared Energy of CaloParticle vs #phi per best Trackster", + nintPhi_, + minPhi_, + maxPhi_, + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + + histograms.h_numEff_caloparticle_eta.push_back(ibook.book1D( + "NumEff_CaloParticle_Eta", "Num Efficiency CaloParticle Eta per Trackster", nintEta_, minEta_, maxEta_)); + histograms.h_num_caloparticle_eta.push_back( + ibook.book1D("Num_CaloParticle_Eta", "Num Purity CaloParticle Eta per Trackster", nintEta_, minEta_, maxEta_)); + histograms.h_numDup_trackster_eta.push_back( + ibook.book1D("NumDup_Trackster_Eta", "Num Duplicate Trackster vs Eta", nintEta_, minEta_, maxEta_)); + histograms.h_denom_caloparticle_eta.push_back( + ibook.book1D("Denom_CaloParticle_Eta", "Denom CaloParticle Eta per Trackster", nintEta_, minEta_, maxEta_)); + histograms.h_numEff_caloparticle_phi.push_back(ibook.book1D( + "NumEff_CaloParticle_Phi", "Num Efficiency CaloParticle Phi per Trackster", nintPhi_, minPhi_, maxPhi_)); + histograms.h_num_caloparticle_phi.push_back( + ibook.book1D("Num_CaloParticle_Phi", "Num Purity CaloParticle Phi per Trackster", nintPhi_, minPhi_, maxPhi_)); + histograms.h_numDup_trackster_phi.push_back( + ibook.book1D("NumDup_Trackster_Phi", "Num Duplicate Trackster vs Phi", nintPhi_, minPhi_, maxPhi_)); + histograms.h_denom_caloparticle_phi.push_back( + ibook.book1D("Denom_CaloParticle_Phi", "Denom CaloParticle Phi per Trackster", nintPhi_, minPhi_, maxPhi_)); +} + void HGVHistoProducerAlgo::fill_info_histos(const Histograms& histograms, unsigned int layers) const { //We will save some info straight from geometry to avoid mistakes from updates //----------- TODO ---------------------------------------------------------- @@ -2004,8 +2009,7 @@ void HGVHistoProducerAlgo::fill_generic_cluster_histos(const Histograms& histogr for (const auto& cpId : cPIndices) { if (cP[cpId].eta() >= 0.) { caloparteneplus = caloparteneplus + cP[cpId].energy(); - } - if (cP[cpId].eta() < 0.) { + } else if (cP[cpId].eta() < 0.) { caloparteneminus = caloparteneminus + cP[cpId].energy(); } } @@ -2168,8 +2172,7 @@ void HGVHistoProducerAlgo::fill_generic_cluster_histos(const Histograms& histogr bigamoth.push_back(nthhits200p); bigamoth.push_back(nthhits300p); bigamoth.push_back(nthhitsscintp); - } - if (zside < 0) { + } else if (zside < 0) { bigamoth.push_back(nthhits120m); bigamoth.push_back(nthhits200m); bigamoth.push_back(nthhits300m); @@ -2268,29 +2271,31 @@ void HGVHistoProducerAlgo::fill_generic_cluster_histos(const Histograms& histogr histograms.h_longdepthbarycentre_zminus[count]->Fill(sumldbarmi / sumeneallclusmi); } -void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histograms, +void HGVHistoProducerAlgo::tracksters_to_SimTracksters(const Histograms& histograms, int count, const ticl::TracksterCollection& tracksters, const reco::CaloClusterCollection& layerClusters, + const ticl::TracksterCollection& simTSFromCP, std::vector const& cP, std::vector const& cPIndices, std::vector const& cPSelectedIndices, std::unordered_map const& hitMap, unsigned int layers) const { auto nTracksters = tracksters.size(); + auto nSimTracksters = simTSFromCP.size(); //Consider CaloParticles coming from the hard scatterer, excluding the PU contribution. auto nCaloParticles = cPIndices.size(); - std::unordered_map> detIdToCaloParticleId_Map; + std::unordered_map> detIdSimTSId_Map; std::unordered_map> detIdToTracksterId_Map; std::vector tracksters_fakemerge(nTracksters, 0); std::vector tracksters_duplicate(nTracksters, 0); - // this contains the ids of the CaloParticles contributing with at least one hit to the Trackster and the reconstruction error - //cpsInLayerCluster[trackster][CPids] - //Connects a Trackster with all related CaloParticles. - std::vector>> cpsInTrackster; - cpsInTrackster.resize(nTracksters); + // this contains the ids of the SimTracksters contributing with at least one hit to the Trackster and the reconstruction error + //stsInTrackster[trackster][STSids] + //Connects a Trackster with all related SimTracksters. + std::vector>> stsInTrackster; + stsInTrackster.resize(nTracksters); //cPOnLayer[caloparticle][layer] //This defines a "calo particle on layer" concept. It is only filled in case @@ -2310,7 +2315,11 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr } } - for (const auto& cpId : cPIndices) { + for (unsigned int iSTS = 0; iSTS < nSimTracksters; ++iSTS) { + const auto& cpId = simTSFromCP[iSTS].seedIndex(); + if (std::find(cPIndices.begin(), cPIndices.end(), cpId) == cPIndices.end()) + continue; + //take sim clusters const SimClusterRefVector& simClusterRefVector = cP[cpId].simClusters(); //loop through sim clusters @@ -2333,20 +2342,18 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr //So, keep in mind that in case of multiple CaloParticles contributing in the same cell //the fraction is the sum over all calo particles. So, something like: //detid: (caloparticle 1, sum of hits fractions in that detid over all cp) , (caloparticle 2, sum of hits fractions in that detid over all cp), (caloparticle 3, sum of hits fractions in that detid over all cp) ... - auto hit_find_it = detIdToCaloParticleId_Map.find(hitid); - if (hit_find_it == detIdToCaloParticleId_Map.end()) { - detIdToCaloParticleId_Map[hitid] = std::vector(); - detIdToCaloParticleId_Map[hitid].emplace_back( - HGVHistoProducerAlgo::detIdInfoInCluster{cpId, it_haf.second}); + auto hit_find_it = detIdSimTSId_Map.find(hitid); + if (hit_find_it == detIdSimTSId_Map.end()) { + detIdSimTSId_Map[hitid] = std::vector(); + detIdSimTSId_Map[hitid].emplace_back(HGVHistoProducerAlgo::detIdInfoInCluster{iSTS, it_haf.second}); } else { - auto findHitIt = std::find(detIdToCaloParticleId_Map[hitid].begin(), - detIdToCaloParticleId_Map[hitid].end(), - HGVHistoProducerAlgo::detIdInfoInCluster{cpId, it_haf.second}); - if (findHitIt != detIdToCaloParticleId_Map[hitid].end()) { + auto findHitIt = std::find(detIdSimTSId_Map[hitid].begin(), + detIdSimTSId_Map[hitid].end(), + HGVHistoProducerAlgo::detIdInfoInCluster{iSTS, it_haf.second}); + if (findHitIt != detIdSimTSId_Map[hitid].end()) { findHitIt->fraction += it_haf.second; } else { - detIdToCaloParticleId_Map[hitid].emplace_back( - HGVHistoProducerAlgo::detIdInfoInCluster{cpId, it_haf.second}); + detIdSimTSId_Map[hitid].emplace_back(HGVHistoProducerAlgo::detIdInfoInCluster{iSTS, it_haf.second}); } } //Since the current hit from sim cluster has a reconstructed hit with the same detid, @@ -2370,7 +2377,7 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr } } // end of loop through simhits } // end of loop through SimClusters - } // end of loop through CaloParticles + } // end of loop through SimTracksters auto apply_LCMultiplicity = [](const ticl::Trackster& trackster, const reco::CaloClusterCollection& layerClusters) { std::vector> hits_and_fractions_norm; @@ -2389,25 +2396,25 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr if (tracksters[tstId].vertices().empty()) continue; - std::unordered_map CPEnergyInTST; + std::unordered_map CPEnergyInTS; int maxCPId_byNumberOfHits = -1; - unsigned int maxCPNumberOfHitsInTST = 0; + unsigned int maxCPNumberOfHitsInTS = 0; int maxCPId_byEnergy = -1; - float maxEnergySharedTSTandCP = 0.f; - float energyFractionOfTSTinCP = 0.f; - float energyFractionOfCPinTST = 0.f; + float maxEnergySharedTSandCP = 0.f; + float energyFractionOfTSinCP = 0.f; + float energyFractionOfCPinTS = 0.f; //In case of matched rechit-simhit, so matched //CaloParticle-LayerCluster-Trackster, he counts and saves the number of //rechits related to the maximum energy CaloParticle out of all //CaloParticles related to that layer cluster and Trackster. - std::unordered_map occurrencesCPinTST; - unsigned int numberOfNoiseHitsInTST = 0; - unsigned int numberOfHaloHitsInTST = 0; + std::unordered_map occurrencesCPinTS; + unsigned int numberOfNoiseHitsInTS = 0; + unsigned int numberOfHaloHitsInTS = 0; const auto tst_hitsAndFractions = apply_LCMultiplicity(tracksters[tstId], layerClusters); - const auto numberOfHitsInTST = tst_hitsAndFractions.size(); + const auto numberOfHitsInTS = tst_hitsAndFractions.size(); //hitsToCaloParticleId is a vector of ints, one for each rechit of the //layer cluster under study. If negative, there is no simhit from any CaloParticle related. @@ -2426,12 +2433,12 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr // TP There represent Real Cells(P) that have been assigned // to a CaloParticle (hence the T) - std::vector hitsToCaloParticleId(numberOfHitsInTST); + std::vector hitsToCaloParticleId(numberOfHitsInTS); //Det id of the first hit just to make the lcLayerId variable //which maps the layers in -z: 0->51 and in +z: 52->103 //Loop through the hits of the trackster under study - for (unsigned int hitId = 0; hitId < numberOfHitsInTST; hitId++) { + for (unsigned int hitId = 0; hitId < numberOfHitsInTS; hitId++) { const auto rh_detid = tst_hitsAndFractions[hitId].first; const auto rhFraction = tst_hitsAndFractions[hitId].second; @@ -2455,8 +2462,8 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr detIdToTracksterId_Map[rh_detid].emplace_back( HGVHistoProducerAlgo::detIdInfoInTrackster{tstId, tstId, rhFraction}); - //Check whether the rechit of the layer cluster under study has a sim hit in the same cell. - auto hit_find_in_CP = detIdToCaloParticleId_Map.find(rh_detid); + //Check whether the rechit of the trackster under study has a sim hit in the same cell. + auto hit_find_in_STS = detIdSimTSId_Map.find(rh_detid); // if the fraction is zero or the hit does not belong to any calo // particle, set the caloparticleId for the hit to -1 this will @@ -2466,34 +2473,34 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr // real hit that has been marked as halo. if (rhFraction == 0.) { hitsToCaloParticleId[hitId] = -2; - numberOfHaloHitsInTST++; + numberOfHaloHitsInTS++; } - if (hit_find_in_CP == detIdToCaloParticleId_Map.end()) { + if (hit_find_in_STS == detIdSimTSId_Map.end()) { hitsToCaloParticleId[hitId] -= 1; } else { - auto maxCPEnergyInTST = 0.f; + auto maxCPEnergyInTS = 0.f; auto maxCPId = -1; - for (const auto& h : hit_find_in_CP->second) { + for (const auto& h : hit_find_in_STS->second) { auto shared_fraction = std::min(rhFraction, h.fraction); //We are in the case where there are calo particles with simhits connected via detid with the rechit under study //So, from all layers clusters, find the rechits that are connected with a calo particle and save/calculate the //energy of that calo particle as the sum over all rechits of the rechits energy weighted //by the caloparticle's fraction related to that rechit. - CPEnergyInTST[h.clusterId] += shared_fraction * hit->energy(); + const auto cpId = simTSFromCP[h.clusterId].seedIndex(); + CPEnergyInTS[cpId] += shared_fraction * hit->energy(); //Here cPOnLayer[caloparticle][layer] describe above is set. //Here for Tracksters with matched rechit the CP fraction times hit energy is added and saved . - cPOnLayer[h.clusterId][lcLayerId].layerClusterIdToEnergyAndScore[tstId].first += - shared_fraction * hit->energy(); - cPOnLayer[h.clusterId][lcLayerId].layerClusterIdToEnergyAndScore[tstId].second = FLT_MAX; - //cpsInTrackster[trackster][CPids] - //Connects a Trackster with all related CaloParticles. - cpsInTrackster[tstId].emplace_back(h.clusterId, FLT_MAX); - //From all CaloParticles related to a layer cluster, he saves id and energy of the calo particle + cPOnLayer[cpId][lcLayerId].layerClusterIdToEnergyAndScore[tstId].first += shared_fraction * hit->energy(); + cPOnLayer[cpId][lcLayerId].layerClusterIdToEnergyAndScore[tstId].second = FLT_MAX; + //stsInTrackster[trackster][STSids] + //Connects a Trackster with all related SimTracksters. + stsInTrackster[tstId].emplace_back(h.clusterId, FLT_MAX); + //From all CaloParticles related to a layer cluster, it saves id and energy of the calo particle //that after simhit-rechit matching in layer has the maximum energy. - if (shared_fraction > maxCPEnergyInTST) { + if (shared_fraction > maxCPEnergyInTS) { //energy is used only here. cpid is saved for Tracksters - maxCPEnergyInTST = CPEnergyInTST[h.clusterId]; - maxCPId = h.clusterId; + maxCPEnergyInTS = CPEnergyInTS[cpId]; + maxCPId = cpId; } } //Keep in mind here maxCPId could be zero. So, below ask for negative not including zero to count noise. @@ -2506,26 +2513,26 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr //In case of matched rechit-simhit, he counts and saves the number of rechits related to the maximum energy CaloParticle. for (auto c : hitsToCaloParticleId) { if (c < 0) { - numberOfNoiseHitsInTST++; + numberOfNoiseHitsInTS++; } else { - occurrencesCPinTST[c]++; + occurrencesCPinTS[c]++; } } //Below from all maximum energy CaloParticles, he saves the one with the largest amount //of related rechits. - for (auto& c : occurrencesCPinTST) { - if (c.second > maxCPNumberOfHitsInTST) { + for (auto& c : occurrencesCPinTS) { + if (c.second > maxCPNumberOfHitsInTS) { maxCPId_byNumberOfHits = c.first; - maxCPNumberOfHitsInTST = c.second; + maxCPNumberOfHitsInTS = c.second; } } //Find the CaloParticle that has the maximum energy shared with the Trackster under study. - for (auto& c : CPEnergyInTST) { - if (c.second > maxEnergySharedTSTandCP) { + for (auto& c : CPEnergyInTS) { + if (c.second > maxEnergySharedTSandCP) { maxCPId_byEnergy = c.first; - maxEnergySharedTSTandCP = c.second; + maxEnergySharedTSandCP = c.second; } } //The energy of the CaloParticle that found to have the maximum energy shared with the Trackster under study. @@ -2535,33 +2542,33 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr for (unsigned int j = 0; j < layers * 2; ++j) { totalCPEnergyFromLayerCP = totalCPEnergyFromLayerCP + cPOnLayer[maxCPId_byEnergy][j].energy; } - energyFractionOfCPinTST = maxEnergySharedTSTandCP / totalCPEnergyFromLayerCP; + energyFractionOfCPinTS = maxEnergySharedTSandCP / totalCPEnergyFromLayerCP; if (tracksters[tstId].raw_energy() > 0.f) { - energyFractionOfTSTinCP = maxEnergySharedTSTandCP / tracksters[tstId].raw_energy(); + energyFractionOfTSinCP = maxEnergySharedTSandCP / tracksters[tstId].raw_energy(); } } LogDebug("HGCalValidator") << std::setw(12) << "Trackster" << "\t" //LogDebug("HGCalValidator") - << std::setw(10) << "mulcl energy" + << std::setw(10) << "energy" << "\t" << std::setw(5) << "nhits" << "\t" << std::setw(12) << "noise hits" << "\t" << std::setw(22) << "maxCPId_byNumberOfHits" << "\t" << std::setw(8) << "nhitsCP" << "\t" << std::setw(16) << "maxCPId_byEnergy" - << "\t" << std::setw(23) << "maxEnergySharedTSTandCP" + << "\t" << std::setw(23) << "maxEnergySharedTSandCP" << "\t" << std::setw(22) << "totalCPEnergyFromAllLayerCP" - << "\t" << std::setw(22) << "energyFractionOfTSTinCP" - << "\t" << std::setw(25) << "energyFractionOfCPinTST" + << "\t" << std::setw(22) << "energyFractionOfTSinCP" + << "\t" << std::setw(25) << "energyFractionOfCPinTS" << "\t" << std::endl; LogDebug("HGCalValidator") << std::setw(12) << tstId << "\t" //LogDebug("HGCalValidator") << std::setw(10) << tracksters[tstId].raw_energy() << "\t" << std::setw(5) - << numberOfHitsInTST << "\t" << std::setw(12) << numberOfNoiseHitsInTST << "\t" + << numberOfHitsInTS << "\t" << std::setw(12) << numberOfNoiseHitsInTS << "\t" << std::setw(22) << maxCPId_byNumberOfHits << "\t" << std::setw(8) - << maxCPNumberOfHitsInTST << "\t" << std::setw(16) << maxCPId_byEnergy << "\t" - << std::setw(23) << maxEnergySharedTSTandCP << "\t" << std::setw(22) - << totalCPEnergyFromLayerCP << "\t" << std::setw(22) << energyFractionOfTSTinCP << "\t" - << std::setw(25) << energyFractionOfCPinTST << std::endl; + << maxCPNumberOfHitsInTS << "\t" << std::setw(16) << maxCPId_byEnergy << "\t" + << std::setw(23) << maxEnergySharedTSandCP << "\t" << std::setw(22) + << totalCPEnergyFromLayerCP << "\t" << std::setw(22) << energyFractionOfTSinCP << "\t" + << std::setw(25) << energyFractionOfCPinTS << std::endl; } //end of loop through Tracksters @@ -2571,25 +2578,25 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr continue; // find the unique CaloParticles id contributing to the Tracksters - //cpsInTrackster[trackster][CPids] - std::sort(cpsInTrackster[tstId].begin(), cpsInTrackster[tstId].end()); - auto last = std::unique(cpsInTrackster[tstId].begin(), cpsInTrackster[tstId].end()); - cpsInTrackster[tstId].erase(last, cpsInTrackster[tstId].end()); + //stsInTrackster[trackster][STSids] + std::sort(stsInTrackster[tstId].begin(), stsInTrackster[tstId].end()); + auto last = std::unique(stsInTrackster[tstId].begin(), stsInTrackster[tstId].end()); + stsInTrackster[tstId].erase(last, stsInTrackster[tstId].end()); - if (tracksters[tstId].raw_energy() == 0. && !cpsInTrackster[tstId].empty()) { + if (tracksters[tstId].raw_energy() == 0. && !stsInTrackster[tstId].empty()) { //Loop through all CaloParticles contributing to Trackster tstId. - for (auto& cpPair : cpsInTrackster[tstId]) { + for (auto& stsPair : stsInTrackster[tstId]) { //In case of a Trackster with zero energy but related CaloParticles the score is set to 1. - cpPair.second = 1.; - LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId << "\t CP id: \t" << cpPair.first << "\t score \t" - << cpPair.second << std::endl; - histograms.h_score_trackster2caloparticle[count]->Fill(cpPair.second); + stsPair.second = 1.; + LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId << "\t SimTrackster id: \t" << stsPair.first + << "\t score \t" << stsPair.second << std::endl; + histograms.h_score_trackster2caloparticle[count]->Fill(stsPair.second); } continue; } const auto tst_hitsAndFractions = apply_LCMultiplicity(tracksters[tstId], layerClusters); - ; + // Compute the correct normalization float invTracksterEnergyWeight = 0.f; for (const auto& haf : tst_hitsAndFractions) { @@ -2601,52 +2608,53 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr for (unsigned int i = 0; i < tst_hitsAndFractions.size(); ++i) { const auto rh_detid = tst_hitsAndFractions[i].first; const auto rhFraction = tst_hitsAndFractions[i].second; - bool hitWithNoCP = false; + bool hitWithNoSTS = false; - auto hit_find_in_CP = detIdToCaloParticleId_Map.find(rh_detid); - if (hit_find_in_CP == detIdToCaloParticleId_Map.end()) - hitWithNoCP = true; + auto hit_find_in_STS = detIdSimTSId_Map.find(rh_detid); + if (hit_find_in_STS == detIdSimTSId_Map.end()) + hitWithNoSTS = true; auto itcheck = hitMap.find(rh_detid); const HGCRecHit* hit = itcheck->second; float hitEnergyWeight = hit->energy() * hit->energy(); - for (auto& cpPair : cpsInTrackster[tstId]) { + for (auto& stsPair : stsInTrackster[tstId]) { float cpFraction = 0.f; - if (!hitWithNoCP) { - auto findHitIt = std::find(detIdToCaloParticleId_Map[rh_detid].begin(), - detIdToCaloParticleId_Map[rh_detid].end(), - HGVHistoProducerAlgo::detIdInfoInCluster{cpPair.first, 0.f}); - if (findHitIt != detIdToCaloParticleId_Map[rh_detid].end()) { + if (!hitWithNoSTS) { + auto findHitIt = std::find(detIdSimTSId_Map[rh_detid].begin(), + detIdSimTSId_Map[rh_detid].end(), + HGVHistoProducerAlgo::detIdInfoInCluster{stsPair.first, 0.f}); + if (findHitIt != detIdSimTSId_Map[rh_detid].end()) { cpFraction = findHitIt->fraction; } } - if (cpPair.second == FLT_MAX) { - cpPair.second = 0.f; + if (stsPair.second == FLT_MAX) { + stsPair.second = 0.f; } - cpPair.second += + stsPair.second += (rhFraction - cpFraction) * (rhFraction - cpFraction) * hitEnergyWeight * invTracksterEnergyWeight; } } //end of loop through rechits of trackster //In case of a Trackster with some energy but none related CaloParticles print some info. - if (cpsInTrackster[tstId].empty()) + if (stsInTrackster[tstId].empty()) LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId << "\tCP id:\t-1 " << "\t score \t-1" << "\n"; - const auto score = std::min_element(std::begin(cpsInTrackster[tstId]), - std::end(cpsInTrackster[tstId]), + const auto score = std::min_element(std::begin(stsInTrackster[tstId]), + std::end(stsInTrackster[tstId]), [](const auto& obj1, const auto& obj2) { return obj1.second < obj2.second; }); - for (auto& cpPair : cpsInTrackster[tstId]) { - LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId << "\t CP id: \t" << cpPair.first << "\t score \t" - << cpPair.second << std::endl; + for (auto& stsPair : stsInTrackster[tstId]) { + const auto& cpId = simTSFromCP[stsPair.first].seedIndex(); + LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId << "\t CP id: \t" << cpId << "\t score \t" + << stsPair.second << std::endl; float sharedeneCPallLayers = 0.; for (unsigned int j = 0; j < layers * 2; ++j) { - auto const& cp_linked = cPOnLayer[cpPair.first][j].layerClusterIdToEnergyAndScore[tstId]; + auto const& cp_linked = cPOnLayer[cpId][j].layerClusterIdToEnergyAndScore[tstId]; sharedeneCPallLayers += cp_linked.first; } LogDebug("HGCalValidator") << "sharedeneCPallLayers " << sharedeneCPallLayers << std::endl; - if (cpPair.first == score->first) { + if (stsPair.first == score->first) { histograms.h_score_trackster2caloparticle[count]->Fill(score->second); histograms.h_sharedenergy_trackster2caloparticle[count]->Fill(sharedeneCPallLayers / tracksters[tstId].raw_energy()); @@ -2654,9 +2662,9 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr score->second, sharedeneCPallLayers / tracksters[tstId].raw_energy()); } } - auto assocFakeMerge = std::count_if(std::begin(cpsInTrackster[tstId]), - std::end(cpsInTrackster[tstId]), - [](const auto& obj) { return obj.second < ScoreCutTSTtoCPFakeMerge_; }); + auto assocFakeMerge = std::count_if(std::begin(stsInTrackster[tstId]), + std::end(stsInTrackster[tstId]), + [](const auto& obj) { return obj.second < ScoreCutTStoCPFakeMerge_; }); tracksters_fakemerge[tstId] = assocFakeMerge; } //end of loop through Tracksters @@ -2679,7 +2687,11 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr // Here we do fill the plots to compute the different metrics linked to // gen-level, namely efficiency an duplicate. In this loop we should restrict // only to the selected caloParaticles. - for (const auto& cpId : cPSelectedIndices) { + for (unsigned int iSTS = 0; iSTS < nSimTracksters; ++iSTS) { + const auto& cpId = simTSFromCP[iSTS].seedIndex(); + if (std::find(cPSelectedIndices.begin(), cPSelectedIndices.end(), cpId) == cPSelectedIndices.end()) + continue; + //We need to keep the Tracksters ids that are related to //CaloParticle under study for the final filling of the score. std::vector cpId_tstId_related; @@ -2694,39 +2706,39 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr continue; int tstWithMaxEnergyInCP = -1; //This is the maximum energy related to Trackster per layer. - float maxEnergyTSTperlayerinCP = 0.f; - float CPEnergyFractionInTSTperlayer = 0.f; + float maxEnergyTSperlayerinCP = 0.f; + float CPEnergyFractionInTSperlayer = 0.f; //Remember and not confused by name. layerClusterIdToEnergyAndScore contains the Trackster id. for (const auto& tst : cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore) { - if (tst.second.first > maxEnergyTSTperlayerinCP) { - maxEnergyTSTperlayerinCP = tst.second.first; + if (tst.second.first > maxEnergyTSperlayerinCP) { + maxEnergyTSperlayerinCP = tst.second.first; tstWithMaxEnergyInCP = tst.first; } } if (CPenergy > 0.f) - CPEnergyFractionInTSTperlayer = maxEnergyTSTperlayerinCP / CPenergy; + CPEnergyFractionInTSperlayer = maxEnergyTSperlayerinCP / CPenergy; LogDebug("HGCalValidator") << std::setw(8) << "LayerId:\t" << std::setw(12) << "caloparticle\t" << std::setw(15) << "cp total energy\t" << std::setw(15) << "cpEnergyOnLayer\t" << std::setw(14) << "CPNhitsOnLayer\t" << std::setw(18) << "tstWithMaxEnergyInCP\t" << std::setw(15) - << "maxEnergyTSTinCP\t" << std::setw(20) << "CPEnergyFractionInTST" + << "maxEnergyTSinCP\t" << std::setw(20) << "CPEnergyFractionInTS" << "\n"; LogDebug("HGCalValidator") << std::setw(8) << layerId << "\t" << std::setw(12) << cpId << "\t" << std::setw(15) - << cP[cpId].energy() << "\t" << std::setw(15) << CPenergy << "\t" << std::setw(14) - << CPNumberOfHits << "\t" << std::setw(18) << tstWithMaxEnergyInCP << "\t" - << std::setw(15) << maxEnergyTSTperlayerinCP << "\t" << std::setw(20) - << CPEnergyFractionInTSTperlayer << "\n"; + << simTSFromCP[iSTS].raw_energy() << "\t" << std::setw(15) << CPenergy << "\t" + << std::setw(14) << CPNumberOfHits << "\t" << std::setw(18) << tstWithMaxEnergyInCP + << "\t" << std::setw(15) << maxEnergyTSperlayerinCP << "\t" << std::setw(20) + << CPEnergyFractionInTSperlayer << "\n"; for (unsigned int i = 0; i < CPNumberOfHits; ++i) { auto& cp_hitDetId = cPOnLayer[cpId][layerId].hits_and_fractions[i].first; auto& cpFraction = cPOnLayer[cpId][layerId].hits_and_fractions[i].second; - bool hitWithNoTST = false; + bool hitWithNoTS = false; if (cpFraction == 0.f) continue; //hopefully this should never happen - auto hit_find_in_TST = detIdToTracksterId_Map.find(cp_hitDetId); - if (hit_find_in_TST == detIdToTracksterId_Map.end()) - hitWithNoTST = true; + auto hit_find_in_TS = detIdToTracksterId_Map.find(cp_hitDetId); + if (hit_find_in_TS == detIdToTracksterId_Map.end()) + hitWithNoTS = true; auto itcheck = hitMap.find(cp_hitDetId); const HGCRecHit* hit = itcheck->second; float hitEnergyWeight = hit->energy() * hit->energy(); @@ -2738,7 +2750,7 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr } float tstFraction = 0.f; - if (!hitWithNoTST) { + if (!hitWithNoTS) { auto findHitIt = std::find(detIdToTracksterId_Map[cp_hitDetId].begin(), detIdToTracksterId_Map[cp_hitDetId].end(), HGVHistoProducerAlgo::detIdInfoInTrackster{tracksterId, 0, 0.f}); @@ -2765,7 +2777,7 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr } //end of loop through sim hits of current calo particle if (cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore.empty()) - LogDebug("HGCalValidator") << "CP Id: \t" << cpId << "\t TST id:\t-1 " + LogDebug("HGCalValidator") << "CP Id: \t" << cpId << "\t TS id:\t-1 " << "\t layer \t " << layerId << " Sub score in \t -1" << "\n"; @@ -2806,7 +2818,7 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr score3d[cpId][tstId] = score3d[cpId][tstId] * invCPEnergyWeight; tstSharedEnergyFrac[cpId][tstId] = (tstSharedEnergy[cpId][tstId] / CPenergy); - LogDebug("HGCalValidator") << "CP Id: \t" << cpId << "\t TST id: \t" << tstId << "\t score \t" // + LogDebug("HGCalValidator") << "CP Id: \t" << cpId << "\t TS id: \t" << tstId << "\t score \t" // << score3d[cpId][tstId] << "\t" << "invCPEnergyWeight \t" << invCPEnergyWeight << "\t" << "Trackste energy: \t" << tracksters[tstId].raw_energy() << "\t" @@ -2821,40 +2833,41 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr // Fill the numerator for the efficiency calculation. The efficiency is computed by considering the energy shared between a Trackster and a _corresponding_ caloParticle. The threshold is configurable via python. if (!cp_considered_efficient && tstSharedEnergyFrac[cpId][tstId] >= minTSTSharedEneFracEfficiency_) { cp_considered_efficient = true; - histograms.h_numEff_caloparticle_eta[count]->Fill(cP[cpId].g4Tracks()[0].momentum().eta()); - histograms.h_numEff_caloparticle_phi[count]->Fill(cP[cpId].g4Tracks()[0].momentum().phi()); + histograms.h_numEff_caloparticle_eta[count]->Fill(simTSFromCP[iSTS].barycenter().eta()); + histograms.h_numEff_caloparticle_phi[count]->Fill(simTSFromCP[iSTS].barycenter().phi()); } } //end of loop through Tracksters - auto is_assoc = [&](const auto& v) -> bool { return v < ScoreCutCPtoTSTEffDup_; }; + auto is_assoc = [&](const auto& v) -> bool { return v < ScoreCutCPtoTSEffDup_; }; auto assocDup = std::count_if(std::begin(score3d[cpId]), std::end(score3d[cpId]), is_assoc); if (assocDup > 0) { - histograms.h_num_caloparticle_eta[count]->Fill(cP[cpId].g4Tracks()[0].momentum().eta()); - histograms.h_num_caloparticle_phi[count]->Fill(cP[cpId].g4Tracks()[0].momentum().phi()); + histograms.h_num_caloparticle_eta[count]->Fill(simTSFromCP[iSTS].barycenter().eta()); + histograms.h_num_caloparticle_phi[count]->Fill(simTSFromCP[iSTS].barycenter().phi()); auto best = std::min_element(std::begin(score3d[cpId]), std::end(score3d[cpId])); auto bestTstId = std::distance(std::begin(score3d[cpId]), best); histograms.h_sharedenergy_caloparticle2trackster_vs_eta[count]->Fill( - cP[cpId].g4Tracks()[0].momentum().eta(), tracksters[bestTstId].raw_energy() / CPenergy); + simTSFromCP[iSTS].barycenter().eta(), tracksters[bestTstId].raw_energy() / CPenergy); histograms.h_sharedenergy_caloparticle2trackster_vs_phi[count]->Fill( - cP[cpId].g4Tracks()[0].momentum().phi(), tracksters[bestTstId].raw_energy() / CPenergy); - LogDebug("HGCalValidator") << count << " " << cP[cpId].g4Tracks()[0].momentum().eta() << " " - << cP[cpId].g4Tracks()[0].momentum().phi() << " " << tracksters[bestTstId].raw_energy() + simTSFromCP[iSTS].barycenter().phi(), tracksters[bestTstId].raw_energy() / CPenergy); + LogDebug("HGCalValidator") << count << " " << simTSFromCP[iSTS].barycenter().eta() << " " + << simTSFromCP[iSTS].barycenter().phi() << " " << tracksters[bestTstId].raw_energy() << " " << CPenergy << " " << (tracksters[bestTstId].raw_energy() / CPenergy) << " " << tstSharedEnergyFrac[cpId][bestTstId] << '\n'; histograms.h_sharedenergy_caloparticle2trackster_assoc[count]->Fill(tstSharedEnergyFrac[cpId][bestTstId]); - } - if (assocDup >= 2) { - auto match = std::find_if(std::begin(score3d[cpId]), std::end(score3d[cpId]), is_assoc); - while (match != score3d[cpId].end()) { - tracksters_duplicate[std::distance(std::begin(score3d[cpId]), match)] = 1; - match = std::find_if(std::next(match), std::end(score3d[cpId]), is_assoc); + + if (assocDup >= 2) { + auto match = std::find_if(std::begin(score3d[cpId]), std::end(score3d[cpId]), is_assoc); + while (match != score3d[cpId].end()) { + tracksters_duplicate[std::distance(std::begin(score3d[cpId]), match)] = 1; + match = std::find_if(std::next(match), std::end(score3d[cpId]), is_assoc); + } } } - histograms.h_denom_caloparticle_eta[count]->Fill(cP[cpId].g4Tracks()[0].momentum().eta()); - histograms.h_denom_caloparticle_phi[count]->Fill(cP[cpId].g4Tracks()[0].momentum().phi()); + histograms.h_denom_caloparticle_eta[count]->Fill(simTSFromCP[iSTS].barycenter().eta()); + histograms.h_denom_caloparticle_phi[count]->Fill(simTSFromCP[iSTS].barycenter().phi()); } //end of loop through CaloParticles @@ -2873,25 +2886,27 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr if (assocFakeMerge > 0) { histograms.h_num_trackster_eta[count]->Fill(tracksters[tstId].barycenter().eta()); histograms.h_num_trackster_phi[count]->Fill(tracksters[tstId].barycenter().phi()); - auto best = std::min_element(std::begin(cpsInTrackster[tstId]), - std::end(cpsInTrackster[tstId]), + auto best = std::min_element(std::begin(stsInTrackster[tstId]), + std::end(stsInTrackster[tstId]), [](const auto& obj1, const auto& obj2) { return obj1.second < obj2.second; }); //This is the shared energy taking the best caloparticle in each layer float sharedeneCPallLayers = 0.; //Loop through all layers for (unsigned int j = 0; j < layers * 2; ++j) { - auto const& best_cp_linked = cPOnLayer[best->first][j].layerClusterIdToEnergyAndScore[tstId]; + auto const& best_cp_linked = + cPOnLayer[simTSFromCP[best->first].seedIndex()][j].layerClusterIdToEnergyAndScore[tstId]; sharedeneCPallLayers += best_cp_linked.first; } //end of loop through layers histograms.h_sharedenergy_trackster2caloparticle_vs_eta[count]->Fill( tracksters[tstId].barycenter().eta(), sharedeneCPallLayers / tracksters[tstId].raw_energy()); histograms.h_sharedenergy_trackster2caloparticle_vs_phi[count]->Fill( tracksters[tstId].barycenter().phi(), sharedeneCPallLayers / tracksters[tstId].raw_energy()); - } - if (assocFakeMerge >= 2) { - histograms.h_numMerge_trackster_eta[count]->Fill(tracksters[tstId].barycenter().eta()); - histograms.h_numMerge_trackster_phi[count]->Fill(tracksters[tstId].barycenter().phi()); + + if (assocFakeMerge >= 2) { + histograms.h_numMerge_trackster_eta[count]->Fill(tracksters[tstId].barycenter().eta()); + histograms.h_numMerge_trackster_phi[count]->Fill(tracksters[tstId].barycenter().phi()); + } } histograms.h_denom_trackster_eta[count]->Fill(tracksters[tstId].barycenter().eta()); histograms.h_denom_trackster_phi[count]->Fill(tracksters[tstId].barycenter().phi()); @@ -2902,6 +2917,7 @@ void HGVHistoProducerAlgo::fill_trackster_histos(const Histograms& histograms, int count, const ticl::TracksterCollection& tracksters, const reco::CaloClusterCollection& layerClusters, + const ticl::TracksterCollection& simTSFromCP, std::vector const& cP, std::vector const& cPIndices, std::vector const& cPSelectedIndices, @@ -3082,8 +3098,8 @@ void HGVHistoProducerAlgo::fill_trackster_histos(const Histograms& histograms, histograms.h_conttracksternum[count]->Fill(totNContTstZp + totNContTstZm); histograms.h_nonconttracksternum[count]->Fill(totNNotContTstZp + totNNotContTstZm); - tracksters_to_CaloParticles( - histograms, count, tracksters, layerClusters, cP, cPIndices, cPSelectedIndices, hitMap, layers); + tracksters_to_SimTracksters( + histograms, count, tracksters, layerClusters, simTSFromCP, cP, cPIndices, cPSelectedIndices, hitMap, layers); } double HGVHistoProducerAlgo::distance2(const double x1, diff --git a/Validation/MuonGEMDigis/plugins/GEMCoPadDigiValidation.cc b/Validation/MuonGEMDigis/plugins/GEMCoPadDigiValidation.cc index 9c4e46a2bce01..757394ef21ec3 100644 --- a/Validation/MuonGEMDigis/plugins/GEMCoPadDigiValidation.cc +++ b/Validation/MuonGEMDigis/plugins/GEMCoPadDigiValidation.cc @@ -19,7 +19,7 @@ void GEMCoPadDigiValidation::bookHistograms(DQMStore::IBooker& booker, const GEMGeometry* gem = &setup.getData(geomTokenBeginRun_); // NOTE Occupancy - booker.setCurrentFolder("MuonGEMDigisV/GEMDigisTask/CoPad/Occupancy"); + booker.setCurrentFolder("GEM/CoPad"); for (const auto& region : gem->regions()) { Int_t region_id = region->region(); @@ -77,8 +77,6 @@ void GEMCoPadDigiValidation::bookHistograms(DQMStore::IBooker& booker, // NOTE Bunch Crossing if (detail_plot_) { - booker.setCurrentFolder("MuonGEMDigisV/GEMDigisTask/CoPad/BunchCrossing"); - for (const auto& region : gem->regions()) { Int_t region_id = region->region(); for (const auto& station : region->stations()) { diff --git a/Validation/MuonGEMDigis/plugins/GEMPadDigiClusterValidation.cc b/Validation/MuonGEMDigis/plugins/GEMPadDigiClusterValidation.cc index 64fde1839ace2..d9004a338823d 100644 --- a/Validation/MuonGEMDigis/plugins/GEMPadDigiClusterValidation.cc +++ b/Validation/MuonGEMDigis/plugins/GEMPadDigiClusterValidation.cc @@ -23,7 +23,7 @@ void GEMPadDigiClusterValidation::bookHistograms(DQMStore::IBooker& booker, edm::EventSetup const& setup) { const GEMGeometry* gem = &setup.getData(geomTokenBeginRun_); // NOTE Occupancy - booker.setCurrentFolder("MuonGEMDigisV/GEMDigisTask/PadCluster/ClusterSize"); + booker.setCurrentFolder("GEM/PadCluster"); TString cls_title = "Cluster Size Distribution"; TString cls_x_title = "Cluster size"; @@ -31,7 +31,6 @@ void GEMPadDigiClusterValidation::bookHistograms(DQMStore::IBooker& booker, me_cls_ = booker.book1D("cls", cls_title + ";" + cls_x_title + ";" + "Entries", 10, 0.5, 10.5); // NOTE Occupancy - booker.setCurrentFolder("MuonGEMDigisV/GEMDigisTask/PadCluster/Occupancy"); for (const auto& region : gem->regions()) { Int_t region_id = region->region(); @@ -45,7 +44,7 @@ void GEMPadDigiClusterValidation::bookHistograms(DQMStore::IBooker& booker, if (detail_plot_) { me_detail_occ_det_[key2] = bookDetectorOccupancy(booker, key2, station, "pad", "Pad Cluster"); me_detail_pad_cluster_occ_det_[key2] = - bookDetectorOccupancy(booker, key2, station, "matched_pad", "Pad Cluster"); + bookDetectorOccupancy(booker, key2, station, "sim_matched", "Pad Cluster"); } const auto& superChamberVec = station->superChambers(); @@ -78,7 +77,7 @@ void GEMPadDigiClusterValidation::bookHistograms(DQMStore::IBooker& booker, me_pad_cluster_occ_eta_[key3] = bookHist1D(booker, key3, - "matched_pad_occ_eta", + "sim_matched_occ_eta", "Matched Pad Cluster Eta Occupancy", 16, eta_range_[station_id * 2 + 0], @@ -86,7 +85,7 @@ void GEMPadDigiClusterValidation::bookHistograms(DQMStore::IBooker& booker, "#eta"); me_pad_cluster_occ_phi_[key3] = bookHist1D( - booker, key3, "matched_pad_occ_phi", "Matched Pad Cluster Phi Occupancy", 36, -5, 355, "#phi [degrees]"); + booker, key3, "sim_matched_occ_phi", "Matched Pad Cluster Phi Occupancy", 36, -5, 355, "#phi [degrees]"); if (detail_plot_) { me_detail_occ_xy_[key3] = bookXYOccupancy(booker, key3, "pad", "Pad Cluster"); @@ -113,8 +112,6 @@ void GEMPadDigiClusterValidation::bookHistograms(DQMStore::IBooker& booker, // NOTE Bunch Crossing if (detail_plot_) { - booker.setCurrentFolder("MuonGEMDigisV/GEMDigisTask/PadCluster/BunchCrossing"); - for (const auto& region : gem->regions()) { Int_t region_id = region->region(); for (const auto& station : region->stations()) { diff --git a/Validation/MuonGEMDigis/plugins/GEMPadDigiValidation.cc b/Validation/MuonGEMDigis/plugins/GEMPadDigiValidation.cc index 49b75e18f0e19..6ec855d99ee71 100644 --- a/Validation/MuonGEMDigis/plugins/GEMPadDigiValidation.cc +++ b/Validation/MuonGEMDigis/plugins/GEMPadDigiValidation.cc @@ -23,7 +23,7 @@ void GEMPadDigiValidation::bookHistograms(DQMStore::IBooker& booker, const GEMGeometry* gem = &setup.getData(geomTokenBeginRun_); // NOTE Occupancy - booker.setCurrentFolder("MuonGEMDigisV/GEMDigisTask/Pad/Occupancy"); + booker.setCurrentFolder("GEM/Pad"); for (const auto& region : gem->regions()) { Int_t region_id = region->region(); @@ -37,7 +37,7 @@ void GEMPadDigiValidation::bookHistograms(DQMStore::IBooker& booker, if (detail_plot_) { me_detail_occ_det_[key2] = bookDetectorOccupancy(booker, key2, station, "pad", "Pad"); - me_detail_pad_occ_det_[key2] = bookDetectorOccupancy(booker, key2, station, "matched_pad", "Matched Pad"); + me_detail_pad_occ_det_[key2] = bookDetectorOccupancy(booker, key2, station, "sim_matched", "Matched Pad"); } const auto& superChamberVec = station->superChambers(); @@ -70,7 +70,7 @@ void GEMPadDigiValidation::bookHistograms(DQMStore::IBooker& booker, me_pad_occ_eta_[key3] = bookHist1D(booker, key3, - "matched_pad_occ_eta", + "sim_matched_occ_eta", "Matched Pad Eta Occupancy", 16, eta_range_[station_id * 2 + 0], @@ -78,7 +78,7 @@ void GEMPadDigiValidation::bookHistograms(DQMStore::IBooker& booker, "#eta"); me_pad_occ_phi_[key3] = - bookHist1D(booker, key3, "matched_pad_occ_phi", "Matched Pad Phi Occupancy", 36, -5, 355, "#phi [degrees]"); + bookHist1D(booker, key3, "sim_matched_occ_phi", "Matched Pad Phi Occupancy", 36, -5, 355, "#phi [degrees]"); if (detail_plot_) { me_detail_occ_xy_[key3] = bookXYOccupancy(booker, key3, "pad", "Pad"); @@ -105,8 +105,6 @@ void GEMPadDigiValidation::bookHistograms(DQMStore::IBooker& booker, // NOTE Bunch Crossing if (detail_plot_) { - booker.setCurrentFolder("MuonGEMDigisV/GEMDigisTask/Pad/BunchCrossing"); - for (const auto& region : gem->regions()) { Int_t region_id = region->region(); for (const auto& station : region->stations()) { diff --git a/Validation/MuonGEMDigis/plugins/GEMStripDigiValidation.cc b/Validation/MuonGEMDigis/plugins/GEMStripDigiValidation.cc index 5f16dae976aff..61b2b45d7b1b8 100644 --- a/Validation/MuonGEMDigis/plugins/GEMStripDigiValidation.cc +++ b/Validation/MuonGEMDigis/plugins/GEMStripDigiValidation.cc @@ -28,49 +28,51 @@ void GEMStripDigiValidation::bookHistograms(DQMStore::IBooker& booker, } // NOTE Bunch Crossing - booker.setCurrentFolder("MuonGEMDigisV/GEMDigisTask/Strip/BunchCrossing"); + booker.setCurrentFolder("GEM/Digis"); - me_bx_ = booker.book1D("strip_bx", "Strip Digi Bunch Crossing", 5, -2.5, 2.5); + if (detail_plot_) { + me_detail_bx_ = booker.book1D("bx", "Strip Digi Bunch Crossing", 5, -2.5, 2.5); - for (const auto& region : gem->regions()) { - if (region == nullptr) { - edm::LogError(kLogCategory_) << "Null region"; - continue; - } - Int_t region_id = region->region(); - for (const auto& station : region->stations()) { - if (station == nullptr) { - edm::LogError(kLogCategory_) << "Null station for region = " << region_id; + for (const auto& region : gem->regions()) { + if (region == nullptr) { + edm::LogError(kLogCategory_) << "Null region"; continue; } - Int_t station_id = station->station(); + Int_t region_id = region->region(); + for (const auto& station : region->stations()) { + if (station == nullptr) { + edm::LogError(kLogCategory_) << "Null station for region = " << region_id; + continue; + } + Int_t station_id = station->station(); - const auto& superChamberVec = station->superChambers(); - if (superChamberVec.empty()) { - edm::LogError(kLogCategory_) << "Super chambers missing for region = " << region_id - << " and station = " << station_id; - continue; - } - const GEMSuperChamber* super_chamber = superChamberVec.front(); - if (super_chamber == nullptr) { - edm::LogError(kLogCategory_) << "Failed to find super chamber for region = " << region_id - << " and station = " << station_id; - continue; - } - for (const auto& chamber : super_chamber->chambers()) { - Int_t layer_id = chamber->id().layer(); - ME3IdsKey key3(region_id, station_id, layer_id); + const auto& superChamberVec = station->superChambers(); + if (superChamberVec.empty()) { + edm::LogError(kLogCategory_) << "Super chambers missing for region = " << region_id + << " and station = " << station_id; + continue; + } + const GEMSuperChamber* super_chamber = superChamberVec.front(); + if (super_chamber == nullptr) { + edm::LogError(kLogCategory_) << "Failed to find super chamber for region = " << region_id + << " and station = " << station_id; + continue; + } + for (const auto& chamber : super_chamber->chambers()) { + Int_t layer_id = chamber->id().layer(); + ME3IdsKey key3(region_id, station_id, layer_id); - me_bx_layer_[key3] = - bookHist1D(booker, key3, "strip_bx", "Strip Digi Bunch Crossing", 5, -2.5, 2.5, "Bunch crossing"); - } // chamber loop - } // station loop - } // region loop + me_detail_bx_layer_[key3] = + bookHist1D(booker, key3, "bx", "Strip Digi Bunch Crossing", 5, -2.5, 2.5, "Bunch crossing"); + } // chamber loop + } // station loop + } // region loop + } // NOTE Occupancy - booker.setCurrentFolder("MuonGEMDigisV/GEMDigisTask/Strip/Occupancy"); - - me_total_strip_ = booker.book1D("total_strips_per_event", "Number of strip digi per event", 50, -0.5, 395.5); + if (detail_plot_) + me_detail_total_strip_all_ = + booker.book1D("total_strips_per_event", "Number of strip digi per event", 50, -0.5, 395.5); for (const auto& region : gem->regions()) { Int_t region_id = region->region(); @@ -82,6 +84,8 @@ void GEMStripDigiValidation::bookHistograms(DQMStore::IBooker& booker, Int_t station_id = station->station(); ME2IdsKey key2{region_id, station_id}; + me_occ_pid_[key2] = bookPIDHist(booker, key2, "sim_occ_pid", "Particle population"); + if (detail_plot_) { me_detail_total_strip_[key2] = bookHist1D(booker, key2, "total_strips_per_event", "Number of strip digs per event", 50, -0.5, 99.5); @@ -89,7 +93,7 @@ void GEMStripDigiValidation::bookHistograms(DQMStore::IBooker& booker, me_detail_occ_det_[key2] = bookDetectorOccupancy(booker, key2, station, "strip", "Strip Digi"); me_detail_strip_occ_det_[key2] = - bookDetectorOccupancy(booker, key2, station, "matched_strip", "Matched Strip Digi"); + bookDetectorOccupancy(booker, key2, station, "sim_matched_strip", "Matched Strip Digi"); } const auto& superChamberVec = station->superChambers(); @@ -97,6 +101,11 @@ void GEMStripDigiValidation::bookHistograms(DQMStore::IBooker& booker, edm::LogError(kLogCategory_) << "Super chambers missing or null for region = " << region_id << " and station = " << station_id; } else { + for (const auto& etaPart : superChamberVec[0]->chambers()[0]->etaPartitions()) { + Int_t ieta = etaPart->id().ieta(); + ME3IdsKey key{region_id, station_id, ieta}; + me_occ_pid_eta_[key] = bookPIDHist(booker, key2, ieta, "sim_occ_pid", "Particle population"); + } for (const auto& chamber : superChamberVec[0]->chambers()) { if (chamber == nullptr) { edm::LogError(kLogCategory_) << "Null chamber for region, station, super chamber = (" << region_id << ", " @@ -114,14 +123,12 @@ void GEMStripDigiValidation::bookHistograms(DQMStore::IBooker& booker, continue; } - me_occ_pid_[key3] = bookPIDHist(booker, key3, "strip_occ_pid", "Number of entreis for each particle"); - if (detail_plot_) { Int_t num_strips = etaPartitionsVec.front()->nstrips(); me_detail_strip_occ_eta_[key3] = bookHist1D(booker, key3, - "matched_strip_occ_eta", + "sim_matched_occ_eta", "Matched Strip Eta Occupancy", 16, eta_range_[station_id * 2 + 0], @@ -129,13 +136,13 @@ void GEMStripDigiValidation::bookHistograms(DQMStore::IBooker& booker, "#eta"); me_detail_strip_occ_phi_[key3] = bookHist1D( - booker, key3, "matched_strip_occ_phi", "Matched Strip Phi Occupancy", 36, -5, 355, "#phi [degrees]"); + booker, key3, "sim_matched_occ_phi", "Matched Strip Phi Occupancy", 36, -5, 355, "#phi [degrees]"); me_detail_occ_xy_[key3] = bookXYOccupancy(booker, key3, "strip", "Strip Digi"); me_detail_occ_strip_[key3] = bookHist1D(booker, key3, - "strip_occ_strip", + "occ_strip", "Strip Digi Occupancy per strip number", num_strips, 0.5, @@ -223,10 +230,10 @@ void GEMStripDigiValidation::analyze(const edm::Event& event, const edm::EventSe Float_t digi_g_r = strip_global_pos.perp(); Float_t digi_g_abs_z = std::abs(strip_global_pos.z()); - me_bx_->Fill(bx); - me_bx_layer_[key3]->Fill(bx); - if (detail_plot_) { + me_detail_bx_->Fill(bx); + me_detail_bx_layer_[key3]->Fill(bx); + me_detail_occ_zr_[region_id]->Fill(digi_g_abs_z, digi_g_r); me_detail_occ_det_[key2]->Fill(bin_x, ieta); me_detail_occ_xy_[key3]->Fill(digi_g_x, digi_g_y); @@ -234,8 +241,8 @@ void GEMStripDigiValidation::analyze(const edm::Event& event, const edm::EventSe } } } // range loop - me_total_strip_->Fill(total_strip); if (detail_plot_) { + me_detail_total_strip_all_->Fill(total_strip); for (const auto& region : gem->regions()) { Int_t region_id = region->region(); for (const auto& station : region->stations()) { @@ -262,6 +269,7 @@ void GEMStripDigiValidation::analyze(const edm::Event& event, const edm::EventSe Int_t ieta = simhit_gemid.ieta(); Int_t num_layers = simhit_gemid.nlayers(); + ME3IdsKey key{region_id, station_id, ieta}; ME2IdsKey key2{region_id, station_id}; ME3IdsKey key3{region_id, station_id, layer_id}; @@ -286,7 +294,8 @@ void GEMStripDigiValidation::analyze(const edm::Event& event, const edm::EventSe Int_t pid = simhit.particleType(); Int_t pid_idx = getPidIdx(pid); - me_occ_pid_[key3]->Fill(pid_idx); + me_occ_pid_[key2]->Fill(pid_idx); + me_occ_pid_eta_[key]->Fill(pid_idx); if (detail_plot_) { if (isMuonSimHit(simhit)) { diff --git a/Validation/MuonGEMDigis/plugins/GEMStripDigiValidation.h b/Validation/MuonGEMDigis/plugins/GEMStripDigiValidation.h index ebfa7faccbba9..9111e0f1095a3 100644 --- a/Validation/MuonGEMDigis/plugins/GEMStripDigiValidation.h +++ b/Validation/MuonGEMDigis/plugins/GEMStripDigiValidation.h @@ -25,7 +25,7 @@ class GEMStripDigiValidation : public GEMBaseValidation { // NOTE Monitor elements // Occupaancy - MonitorElement* me_total_strip_; + MonitorElement* me_detail_total_strip_all_; MEMap2Ids me_detail_total_strip_; MEMap1Ids me_detail_occ_zr_; MEMap2Ids me_detail_occ_det_; @@ -33,11 +33,12 @@ class GEMStripDigiValidation : public GEMBaseValidation { MEMap3Ids me_detail_occ_strip_; // Bunch Crossing - MonitorElement* me_bx_; - MEMap3Ids me_bx_layer_; + MonitorElement* me_detail_bx_; + MEMap3Ids me_detail_bx_layer_; // Strip that matches the SimHit - MEMap3Ids me_occ_pid_; + MEMap2Ids me_occ_pid_; + MEMap3Ids me_occ_pid_eta_; MEMap3Ids me_detail_strip_occ_eta_; MEMap3Ids me_detail_strip_occ_phi_; MEMap2Ids me_detail_strip_occ_det_; diff --git a/Validation/MuonGEMDigis/plugins/MuonGEMDigisHarvestor.cc b/Validation/MuonGEMDigis/plugins/MuonGEMDigisHarvestor.cc index c43ac05d08f6e..badfbfd6ef756 100644 --- a/Validation/MuonGEMDigis/plugins/MuonGEMDigisHarvestor.cc +++ b/Validation/MuonGEMDigis/plugins/MuonGEMDigisHarvestor.cc @@ -14,13 +14,13 @@ MuonGEMDigisHarvestor::MuonGEMDigisHarvestor(const edm::ParameterSet& pset) MuonGEMDigisHarvestor::~MuonGEMDigisHarvestor() {} void MuonGEMDigisHarvestor::dqmEndJob(DQMStore::IBooker& booker, DQMStore::IGetter& getter) { - TString simhit_occ_folder = "MuonGEMHitsV/GEMHitsTask/Occupancy/"; - TString occ_folder = "MuonGEMDigisV/GEMDigisTask/Strip/Occupancy/"; - TString eff_folder = "MuonGEMDigisV/GEMDigisTask/Strip/Efficiency/"; - TString occ_folder_pad = "MuonGEMDigisV/GEMDigisTask/Pad/Occupancy/"; - TString eff_folder_pad = "MuonGEMDigisV/GEMDigisTask/Pad/Efficiency/"; - TString occ_folder_cluster = "MuonGEMDigisV/GEMDigisTask/PadCluster/Occupancy/"; - TString eff_folder_cluster = "MuonGEMDigisV/GEMDigisTask/PadCluster/Efficiency/"; + TString simhit_occ_folder = "GEM/SimHits/"; + TString occ_folder = "GEM/Digis/"; + TString eff_folder = "GEM/Digis/"; + TString occ_folder_pad = "GEM/Pad/"; + TString eff_folder_pad = "GEM/Pad/"; + TString occ_folder_cluster = "GEM/PadCluster/"; + TString eff_folder_cluster = "GEM/PadCluster/"; for (Int_t region_id : region_ids_) { for (Int_t station_id : station_ids_) { @@ -29,9 +29,9 @@ void MuonGEMDigisHarvestor::dqmEndJob(DQMStore::IBooker& booker, DQMStore::IGett if (detail_plot_) { // NOTE Detector Component efficiency - TString strip_det_name = "matched_strip_occ_det" + name_suffix_re_st; - TString pad_det_name = "matched_pad_occ_det" + name_suffix_re_st; - TString simhit_det_name = "muon_simhit_occ_det" + name_suffix_re_st; + TString strip_det_name = "sim_matched_occ_det" + name_suffix_re_st; + TString pad_det_name = "sim_matched_occ_det" + name_suffix_re_st; + TString simhit_det_name = "sim_muon_occ_det" + name_suffix_re_st; TString strip_det_path = occ_folder + strip_det_name; TString pad_det_path = occ_folder_pad + pad_det_name; TString cluster_det_path = occ_folder_cluster + pad_det_name; @@ -51,9 +51,9 @@ void MuonGEMDigisHarvestor::dqmEndJob(DQMStore::IBooker& booker, DQMStore::IGett TString title_suffix_re_st_ly = GEMUtils::getSuffixTitle(region_id, station_id, layer_id); // NOTE eta efficiency - TString strip_eta_name = "matched_strip_occ_eta" + name_suffix_re_st_ly; - TString pad_eta_name = "matched_pad_occ_eta" + name_suffix_re_st_ly; - TString simhit_eta_name = "muon_simhit_occ_eta" + name_suffix_re_st_ly; + TString strip_eta_name = "sim_matched_occ_eta" + name_suffix_re_st_ly; + TString pad_eta_name = "sim_matched_occ_eta" + name_suffix_re_st_ly; + TString simhit_eta_name = "sim_muon_occ_eta" + name_suffix_re_st_ly; TString strip_eta_path = occ_folder + strip_eta_name; TString pad_eta_path = occ_folder_pad + pad_eta_name; TString cluster_eta_path = occ_folder_cluster + pad_eta_name; @@ -67,9 +67,9 @@ void MuonGEMDigisHarvestor::dqmEndJob(DQMStore::IBooker& booker, DQMStore::IGett bookEff1D(booker, getter, cluster_eta_path, simhit_eta_path, eff_folder_cluster, eff_eta_name, eff_eta_title); // NOTE phi efficiency - TString strip_phi_name = "matched_strip_occ_phi" + name_suffix_re_st_ly; - TString pad_phi_name = "matched_pad_occ_phi" + name_suffix_re_st_ly; - TString simhit_phi_name = "muon_simhit_occ_phi" + name_suffix_re_st_ly; + TString strip_phi_name = "sim_matched_occ_phi" + name_suffix_re_st_ly; + TString pad_phi_name = "sim_matched_occ_phi" + name_suffix_re_st_ly; + TString simhit_phi_name = "sim_muon_occ_phi" + name_suffix_re_st_ly; TString strip_phi_path = occ_folder + strip_phi_name; TString pad_phi_path = occ_folder_pad + pad_phi_name; TString cluster_phi_path = occ_folder_cluster + pad_phi_name; diff --git a/Validation/MuonGEMDigis/python/PostProcessor_cff.py b/Validation/MuonGEMDigis/python/PostProcessor_cff.py index b4596553189cb..35b931a4dbb01 100644 --- a/Validation/MuonGEMDigis/python/PostProcessor_cff.py +++ b/Validation/MuonGEMDigis/python/PostProcessor_cff.py @@ -12,4 +12,4 @@ MuonGEMDigisPostProcessors = cms.Sequence(gemDigiHarvesting) from Configuration.Eras.Modifier_phase2_common_cff import phase2_common -phase2_common.toModify( gemDigiHarvesting, stationIds = (1, 2) ) +phase2_common.toModify( gemDigiHarvesting, stationIds = (0, 1, 2) ) diff --git a/Validation/MuonGEMHits/interface/GEMBaseValidation.h b/Validation/MuonGEMHits/interface/GEMBaseValidation.h index d2e65497cc520..e5cd5bf17a16f 100644 --- a/Validation/MuonGEMHits/interface/GEMBaseValidation.h +++ b/Validation/MuonGEMHits/interface/GEMBaseValidation.h @@ -61,6 +61,10 @@ class GEMBaseValidation : public DQMEDAnalyzer { template dqm::impl::MonitorElement* bookPIDHist(DQMStore::IBooker& booker, const T& key, const char* name, const char* title); + template + dqm::impl::MonitorElement* bookPIDHist( + DQMStore::IBooker& booker, const T& key, Int_t ieta, const char* name, const char* title); + template dqm::impl::MonitorElement* bookHist1D(DQMStore::IBooker& booker, const T& key, @@ -220,8 +224,8 @@ dqm::impl::MonitorElement* GEMBaseValidation::bookPIDHist(DQMStore::IBooker& boo const char* title) { auto name_suffix = GEMUtils::getSuffixName(key); auto title_suffix = GEMUtils::getSuffixTitle(key); - TString x_title = "Particle Name"; - TString y_title = "Entries"; + TString x_title = "Particle Type"; + TString y_title = "Particles"; TString hist_name = TString::Format("%s%s", name, name_suffix.Data()); TString hist_title = TString::Format("%s :%s;%s;%s", title, title_suffix.Data(), x_title.Data(), y_title.Data()); Int_t nbinsx = pid_list_.size(); @@ -236,6 +240,28 @@ dqm::impl::MonitorElement* GEMBaseValidation::bookPIDHist(DQMStore::IBooker& boo return hist; } +template +dqm::impl::MonitorElement* GEMBaseValidation::bookPIDHist( + DQMStore::IBooker& booker, const T& key, Int_t ieta, const char* name, const char* title) { + auto name_suffix = GEMUtils::getSuffixName(key); + auto title_suffix = GEMUtils::getSuffixTitle(key); + TString x_title = "Particle Type"; + TString y_title = "Particles"; + TString hist_name = TString::Format("%s%s-E%d", name, name_suffix.Data(), ieta); + TString hist_title = + TString::Format("%s :%s-E%d;%s;%s", title, title_suffix.Data(), ieta, x_title.Data(), y_title.Data()); + Int_t nbinsx = pid_list_.size(); + auto hist = booker.book1D(hist_name, hist_title, nbinsx + 1, 0, nbinsx + 1); + TDatabasePDG* pdgDB = TDatabasePDG::Instance(); + for (Int_t idx = 0; idx < nbinsx; idx++) { + Int_t bin = idx + 1; + auto particle_name = pdgDB->GetParticle(pid_list_[idx])->GetName(); + hist->setBinLabel(bin, particle_name); + } + hist->setBinLabel(nbinsx + 1, "others"); + return hist; +} + template dqm::impl::MonitorElement* GEMBaseValidation::bookHist1D(DQMStore::IBooker& booker, const T& key, diff --git a/Validation/MuonGEMHits/plugins/GEMSimHitValidation.cc b/Validation/MuonGEMHits/plugins/GEMSimHitValidation.cc index 082f1d28d3e07..f383c9d8d446a 100644 --- a/Validation/MuonGEMHits/plugins/GEMSimHitValidation.cc +++ b/Validation/MuonGEMHits/plugins/GEMSimHitValidation.cc @@ -19,7 +19,7 @@ void GEMSimHitValidation::bookHistograms(DQMStore::IBooker& booker, edm::Run con const GEMGeometry* gem = &setup.getData(geomTokenBeginRun_); // NOTE Time of flight - booker.setCurrentFolder("MuonGEMHitsV/GEMHitsTask/TimeOfFlight"); + booker.setCurrentFolder("GEM/SimHits"); TString tof_xtitle = "Time of flight [ns]"; TString tof_ytitle = "Entries"; @@ -33,11 +33,11 @@ void GEMSimHitValidation::bookHistograms(DQMStore::IBooker& booker, edm::Run con const auto [tof_min, tof_max] = getTOFRange(station_id); ME2IdsKey key2{region_id, station_id}; - me_tof_mu_[key2] = - bookHist1D(booker, key2, "tof_muon", "SimHit TOF (Muon only)", 20, tof_min, tof_max, tof_xtitle, tof_ytitle); + me_tof_mu_[key2] = bookHist1D( + booker, key2, "sim_tof_muon", "SimHit TOF (Muon only)", 20, tof_min, tof_max, tof_xtitle, tof_ytitle); me_tof_others_[key2] = bookHist1D( - booker, key2, "tof_others", "SimHit TOF (Other Particles)", 20, tof_min, tof_max, tof_xtitle, tof_ytitle); + booker, key2, "sim_tof_others", "SimHit TOF (Other Particles)", 20, tof_min, tof_max, tof_xtitle, tof_ytitle); } // station loop } // region loop @@ -61,10 +61,10 @@ void GEMSimHitValidation::bookHistograms(DQMStore::IBooker& booker, edm::Run con ME3IdsKey key3{region_id, station_id, layer_id}; me_detail_tof_[key3] = bookHist1D( - booker, key3, "tof", "Time of Flight of Muon SimHits", 40, tof_min, tof_max, tof_xtitle, tof_ytitle); + booker, key3, "sim_tof", "Time of Flight of Muon SimHits", 40, tof_min, tof_max, tof_xtitle, tof_ytitle); me_detail_tof_mu_[key3] = bookHist1D( - booker, key3, "tof_muon", "SimHit TOF (Muon only)", 40, tof_min, tof_max, tof_xtitle, tof_ytitle); + booker, key3, "sim_tof_muon", "SimHit TOF (Muon only)", 40, tof_min, tof_max, tof_xtitle, tof_ytitle); } // chamber loop } // end else } // station loop @@ -72,22 +72,20 @@ void GEMSimHitValidation::bookHistograms(DQMStore::IBooker& booker, edm::Run con } // detail plot // NOTE Energy Loss - booker.setCurrentFolder("MuonGEMHitsV/GEMHitsTask/EnergyLoss"); - TString eloss_xtitle = "Energy loss [eV]"; TString eloss_ytitle = "Entries / 0.5 keV"; for (const auto& station : gem->regions()[0]->stations()) { Int_t station_id = station->station(); - auto eloss_mu_name = TString::Format("eloss_muon_st%d", station_id); - auto eloss_mu_title = TString::Format("SimHit Energy Loss (Muon only) : Station %d", station_id); + auto eloss_mu_name = TString::Format("sim_eloss_muon_GE%d1", station_id); + auto eloss_mu_title = TString::Format("SimHit Energy Loss (Muon only) : GE%d1", station_id); me_eloss_mu_[station_id] = booker.book1D(eloss_mu_name, eloss_mu_title + ";" + eloss_xtitle + ";" + eloss_ytitle, 20, 0.0, 10.0); - auto eloss_others_name = TString::Format("eloss_others_st%d", station_id); - auto eloss_others_title = TString::Format("SimHit Energy Loss (Other Particles) : Station %d", station_id); + auto eloss_others_name = TString::Format("sim_eloss_others_GE%d1", station_id); + auto eloss_others_title = TString::Format("SimHit Energy Loss (Other Particles) : GE%d1", station_id); me_eloss_others_[station_id] = booker.book1D(eloss_others_name, eloss_others_title + ";" + eloss_xtitle + ";" + eloss_ytitle, 20, 0.0, 10.0); @@ -107,12 +105,12 @@ void GEMSimHitValidation::bookHistograms(DQMStore::IBooker& booker, edm::Run con Int_t layer_id = chamber->id().layer(); ME3IdsKey key3{region_id, station_id, layer_id}; - me_detail_eloss_[key3] = - bookHist1D(booker, key3, "eloss", "SimHit Energy Loss", 60, 0.0, 6000.0, eloss_xtitle, eloss_ytitle); + me_detail_eloss_[key3] = bookHist1D( + booker, key3, "sim_eloss", "SimHit Energy Loss", 60, 0.0, 6000.0, eloss_xtitle, eloss_ytitle); me_detail_eloss_mu_[key3] = bookHist1D(booker, key3, - "eloss_muon", + "sim_eloss_muon", "SimHit Energy Loss (Muon Only)", 60, 0.0, @@ -127,21 +125,19 @@ void GEMSimHitValidation::bookHistograms(DQMStore::IBooker& booker, edm::Run con } // detail plot // NOTE Occupancy - booker.setCurrentFolder("MuonGEMHitsV/GEMHitsTask/Occupancy"); - for (const auto& region : gem->regions()) { Int_t region_id = region->region(); if (detail_plot_) - me_detail_occ_zr_[region_id] = bookZROccupancy(booker, region_id, "simhit", "SimHit"); + me_detail_occ_zr_[region_id] = bookZROccupancy(booker, region_id, "sim_simhit", "SimHit"); for (const auto& station : region->stations()) { Int_t station_id = station->station(); ME2IdsKey key2{region_id, station_id}; if (detail_plot_) { - me_detail_occ_det_[key2] = bookDetectorOccupancy(booker, key2, station, "simhit", "SimHit"); - me_detail_occ_det_mu_[key2] = bookDetectorOccupancy(booker, key2, station, "muon_simhit", "Muon SimHit"); + me_detail_occ_det_[key2] = bookDetectorOccupancy(booker, key2, station, "sim_simhit", "SimHit"); + me_detail_occ_det_mu_[key2] = bookDetectorOccupancy(booker, key2, station, "sim_muon_simhit", "Muon SimHit"); } const auto& superChamberVec = station->superChambers(); @@ -156,20 +152,20 @@ void GEMSimHitValidation::bookHistograms(DQMStore::IBooker& booker, edm::Run con me_occ_eta_mu_[key3] = bookHist1D(booker, key3, - "muon_simhit_occ_eta", + "sim_muon_occ_eta", "Muon SimHit Eta Occupancy", 16, eta_range_[station_id * 2 + 0], eta_range_[station_id * 2 + 1], "#eta"); - me_occ_phi_mu_[key3] = bookHist1D( - booker, key3, "muon_simhit_occ_phi", "Muon SimHit Phi Occupancy", 36, -5, 355, "#phi [degrees]"); + me_occ_phi_mu_[key3] = + bookHist1D(booker, key3, "sim_muon_occ_phi", "Muon SimHit Phi Occupancy", 36, -5, 355, "#phi [degrees]"); - me_occ_pid_[key3] = bookPIDHist(booker, key3, "simhit_occ_pid", "Number of entries for each paritcle"); + me_occ_pid_[key3] = bookPIDHist(booker, key3, "sim_occ_pid", "Particle population"); if (detail_plot_) - me_detail_occ_xy_[key3] = bookXYOccupancy(booker, key3, "simhit", "SimHit"); + me_detail_occ_xy_[key3] = bookXYOccupancy(booker, key3, "sim_simhit", "SimHit"); } // layer loop } // end else } // station loop diff --git a/Validation/MuonGEMHits/test/Compare.py b/Validation/MuonGEMHits/test/Compare.py index 4913361e0676a..5d05ec1e69a64 100755 --- a/Validation/MuonGEMHits/test/Compare.py +++ b/Validation/MuonGEMHits/test/Compare.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ Copied from GEMCode/GEMValidation diff --git a/Validation/MuonGEMHits/test/MakePlot.py b/Validation/MuonGEMHits/test/MakePlot.py index 73785eb33932c..d4b45741e6f95 100755 --- a/Validation/MuonGEMHits/test/MakePlot.py +++ b/Validation/MuonGEMHits/test/MakePlot.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ Copied from GEMCode/GEMValidation diff --git a/Validation/MuonGEMHits/test/phiView.py b/Validation/MuonGEMHits/test/phiView.py index 1fbd821d1e1e1..cbb8cb4b77628 100755 --- a/Validation/MuonGEMHits/test/phiView.py +++ b/Validation/MuonGEMHits/test/phiView.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ Copied from GEMCode/GEMValidation diff --git a/Validation/MuonGEMRecHits/plugins/GEMRecHitValidation.cc b/Validation/MuonGEMRecHits/plugins/GEMRecHitValidation.cc index 8c3bc0525a7d1..c43d85b49b77f 100644 --- a/Validation/MuonGEMRecHits/plugins/GEMRecHitValidation.cc +++ b/Validation/MuonGEMRecHits/plugins/GEMRecHitValidation.cc @@ -26,27 +26,27 @@ void GEMRecHitValidation::bookHistograms(DQMStore::IBooker& booker, edm::Run con const GEMGeometry* gem = &setup.getData(geomTokenBeginRun_); // NOTE Cluster Size - booker.setCurrentFolder("MuonGEMRecHitsV/GEMRecHitsTask/ClusterSize"); + booker.setCurrentFolder("GEM/RecHits"); TString cls_title = "Cluster Size Distribution"; TString cls_x_title = "Cluster size"; - me_cls_ = booker.book1D("cls", cls_title + ";" + cls_x_title + ";" + "Entries", 10, 0.5, 10.5); + if (detail_plot_) { + me_detail_cls_total_ = booker.book1D("cls", cls_title + ";" + cls_x_title + ";" + "Entries", 10, 0.5, 10.5); - for (const auto& station : gem->regions()[0]->stations()) { - Int_t station_id = station->station(); - for (const auto& roll : station->superChambers()[0]->chambers()[0]->etaPartitions()) { - Int_t ieta = roll->id().ieta(); - ME2IdsKey key{station_id, ieta}; - me_cls_roll_[key] = booker.book1D(Form("cls_GE%d1_iEta%d", station_id, ieta), - Form("Cluster Size Distribution : GE%d1 iEta %d", station_id, ieta), - 10, - 0.5, - 10.5); + for (const auto& station : gem->regions()[0]->stations()) { + Int_t station_id = station->station(); + for (const auto& roll : station->superChambers()[0]->chambers()[0]->etaPartitions()) { + Int_t ieta = roll->id().ieta(); + ME2IdsKey key{station_id, ieta}; + me_detail_cls_roll_[key] = booker.book1D(Form("cls_GE%d1-E%d", station_id, ieta), + Form("Cluster Size Distribution : GE%d1-E%d", station_id, ieta), + 10, + 0.5, + 10.5); + } } - } - if (detail_plot_) { for (const auto& region : gem->regions()) { Int_t region_id = region->region(); @@ -74,32 +74,24 @@ void GEMRecHitValidation::bookHistograms(DQMStore::IBooker& booker, edm::Run con } // detail plot // NOTE Residual - booker.setCurrentFolder("MuonGEMRecHitsV/GEMRecHitsTask/Residual"); - for (const auto& station : gem->regions()[0]->stations()) { Int_t station_id = station->station(); for (const auto& roll : station->superChambers()[0]->chambers()[0]->etaPartitions()) { Int_t ieta = roll->id().ieta(); ME2IdsKey key{station_id, ieta}; - me_residual_x_[key] = booker.book1D(Form("residual_x_GE%d1_R%d", station_id, ieta), - Form("Residual in X : GE%d1 iEta %d; Residual in X [cm]", station_id, ieta), - 60, - -2, - 2); - - me_residual_y_[key] = booker.book1D(Form("residual_y_GE%d1_iEta%d", station_id, ieta), - Form("Residual in Y : GE%d1 iEta %d; Residual in Y [cm]", station_id, ieta), + me_residual_y_[key] = booker.book1D(Form("residual_y_GE%d1-E%d", station_id, ieta), + Form("Residual in Y : GE%d1-E%d; Residual in Y [cm]", station_id, ieta), 60, -15, 15); - me_residual_rphi_[key] = booker.book1D( - Form("residual_rphi_GE%d1_iEta%d", station_id, ieta), - Form("Residual in R #times #phi : GE%d1 iEta %d; Residual in r #times #phi [cm]", station_id, ieta), - 60, - -15, - 15); + me_residual_rphi_[key] = + booker.book1D(Form("residual_rphi_GE%d1-E%d", station_id, ieta), + Form("Residual in R #times #phi : GE%d1-E%d; Residual in r #times #phi [cm]", station_id, ieta), + 60, + -15, + 15); } } @@ -119,9 +111,6 @@ void GEMRecHitValidation::bookHistograms(DQMStore::IBooker& booker, edm::Run con Int_t ieta = roll->id().ieta(); ME4IdsKey key4{region_id, station_id, layer_id, ieta}; - me_detail_residual_x_[key4] = - bookHist1D(booker, key4, "residual_x", "Residual in x", 60, -2, 2, "Residual in x [cm]"); - me_detail_residual_y_[key4] = bookHist1D(booker, key4, "residual_y", "Residual in y", 60, -15, 15, "Residual in y [cm]"); @@ -141,8 +130,6 @@ void GEMRecHitValidation::bookHistograms(DQMStore::IBooker& booker, edm::Run con } // detail plot // NOTE Pull - booker.setCurrentFolder("MuonGEMRecHitsV/GEMRecHitsTask/Pull"); - if (detail_plot_) { for (const auto& station : gem->regions()[0]->stations()) { Int_t station_id = station->station(); @@ -150,17 +137,11 @@ void GEMRecHitValidation::bookHistograms(DQMStore::IBooker& booker, edm::Run con Int_t ieta = roll->id().ieta(); ME2IdsKey key{station_id, ieta}; - me_detail_pull_x_[key] = booker.book1D(Form("pull_x_GE%d1_iEta%d", station_id, ieta), - Form("Pull in X : GE%d1 iEta %d", station_id, ieta), - 60, - -3, - 3); - - me_detail_pull_y_[key] = booker.book1D(Form("pull_y_GE%d1_iEta%d", station_id, ieta), - Form("Pull in Y : GE%d1 iEta %d", station_id, ieta), - 60, - -3, - 3); + me_detail_pull_x_[key] = booker.book1D( + Form("pull_x_GE%d1-E%d", station_id, ieta), Form("Pull in X : GE%d1-E%d", station_id, ieta), 60, -3, 3); + + me_detail_pull_y_[key] = booker.book1D( + Form("pull_y_GE%d1-E%d", station_id, ieta), Form("Pull in Y : GE%d1-E%d", station_id, ieta), 60, -3, 3); } } @@ -190,7 +171,6 @@ void GEMRecHitValidation::bookHistograms(DQMStore::IBooker& booker, edm::Run con } // detail plot // NOTE Occupancy - booker.setCurrentFolder("MuonGEMRecHitsV/GEMRecHitsTask/Occupancy"); for (const auto& region : gem->regions()) { Int_t region_id = region->region(); @@ -202,8 +182,7 @@ void GEMRecHitValidation::bookHistograms(DQMStore::IBooker& booker, edm::Run con ME2IdsKey key2{region_id, station_id}; if (detail_plot_) - me_detail_rechit_occ_det_[key2] = - bookDetectorOccupancy(booker, key2, station, "matched_rechit", "Matched RecHit"); + me_detail_rechit_occ_det_[key2] = bookDetectorOccupancy(booker, key2, station, "sim_matched", "Matched RecHit"); const auto& superChamberVec = station->superChambers(); if (!superChamberVec.empty() && superChamberVec[0] != nullptr) { @@ -213,24 +192,9 @@ void GEMRecHitValidation::bookHistograms(DQMStore::IBooker& booker, edm::Run con Int_t num_eta_partitions = chamber->nEtaPartitions(); - me_total_rechit_[key3] = - bookHist1D(booker, key3, "total_rechit", "Number of rec hits per event", 25, -0.5, 24.5); - - me_occ_pid_[key3] = bookPIDHist(booker, key3, "rechit_occ_pid", "Number of entreis for each particle"); - - me_occ_ieta_[key3] = bookHist1D(booker, - key3, - "rechit_occ_ieta", - "Rechit Occupancy per eta partition", - num_eta_partitions, - 0.5, - num_eta_partitions + 0.5); - - me_occ_phi_[key3] = bookHist1D(booker, key3, "rechit_occ_phi", "Rechit Phi Occupancy", 108, -5, 355); - me_rechit_occ_eta_[key3] = bookHist1D(booker, key3, - "matched_rechit_occ_eta", + "sim_matched_occ_eta", "Matched RecHit Eta Occupancy", 16, eta_range_[station_id * 2 + 0], @@ -238,9 +202,24 @@ void GEMRecHitValidation::bookHistograms(DQMStore::IBooker& booker, edm::Run con "|#eta|"); me_rechit_occ_phi_[key3] = - bookHist1D(booker, key3, "matched_rechit_occ_phi", "Matched RecHit Phi Occupancy", 36, -5, 355, "#phi"); + bookHist1D(booker, key3, "sim_matched_occ_phi", "Matched RecHit Phi Occupancy", 36, -5, 355, "#phi"); if (detail_plot_) { + me_detail_total_rechit_[key3] = + bookHist1D(booker, key3, "total_rechit", "Number of rec hits per event", 25, -0.5, 24.5); + + me_detail_occ_pid_[key3] = bookPIDHist(booker, key3, "sim_occ_pid", "Number of entreis for each particle"); + + me_detail_occ_ieta_[key3] = bookHist1D(booker, + key3, + "occ_ieta", + "Rechit Occupancy per eta partition", + num_eta_partitions, + 0.5, + num_eta_partitions + 0.5); + + me_detail_occ_phi_[key3] = bookHist1D(booker, key3, "occ_phi", "Rechit Phi Occupancy", 108, -5, 355); + me_detail_occ_xy_[key3] = bookXYOccupancy(booker, key3, "rechit", "RecHit"); me_detail_occ_polar_[key3] = bookPolarOccupancy(booker, key3, "rechit", "RecHit"); @@ -313,15 +292,14 @@ void GEMRecHitValidation::analyze(const edm::Event& event, const edm::EventSetup Int_t cls = rechit.clusterSize(); cls = cls > 10 ? 10 : cls; - me_cls_roll_[key]->Fill(cls); - me_occ_ieta_[key3]->Fill(ieta); - me_occ_phi_[key3]->Fill(rechit_g_phi); total_rechit[key3]++; - me_cls_->Fill(cls); - if (detail_plot_) { + me_detail_cls_total_->Fill(cls); me_detail_cls_[key4]->Fill(cls); + me_detail_cls_roll_[key]->Fill(cls); + me_detail_occ_ieta_[key3]->Fill(ieta); + me_detail_occ_phi_[key3]->Fill(rechit_g_phi); me_detail_occ_zr_[region_id]->Fill(rechit_g_abs_z, rechit_g_r); me_detail_occ_xy_[key3]->Fill(rechit_g_x, rechit_g_y); me_detail_occ_polar_[key3]->Fill(rechit_g_phi, rechit_g_r); @@ -343,20 +321,24 @@ void GEMRecHitValidation::analyze(const edm::Event& event, const edm::EventSetup } } } - Int_t max_pid = 0; - Int_t max_count = 0; - for (auto& [pid, count] : pid_count) { - if (max_count < count) { - max_pid = pid; - max_count = count; + if (detail_plot_) { + Int_t max_pid = 0; + Int_t max_count = 0; + for (auto& [pid, count] : pid_count) { + if (max_count < count) { + max_pid = pid; + max_count = count; + } } + Int_t pid_idx = getPidIdx(max_pid); + me_detail_occ_pid_[key3]->Fill(pid_idx); } - Int_t pid_idx = getPidIdx(max_pid); - me_occ_pid_[key3]->Fill(pid_idx); } - for (auto [key, num_total_rechit] : total_rechit) { - me_total_rechit_[key]->Fill(num_total_rechit); + if (detail_plot_) { + for (auto [key, num_total_rechit] : total_rechit) { + me_detail_total_rechit_[key]->Fill(num_total_rechit); + } } // NOTE @@ -428,7 +410,6 @@ void GEMRecHitValidation::analyze(const edm::Event& event, const edm::EventSetup Float_t pull_x = residual_x / resolution_x; Float_t pull_y = residual_y / resolution_y; - me_residual_x_[key]->Fill(residual_x); me_residual_y_[key]->Fill(residual_y); me_residual_rphi_[key]->Fill(residual_rphi); @@ -438,7 +419,6 @@ void GEMRecHitValidation::analyze(const edm::Event& event, const edm::EventSetup if (detail_plot_) { me_detail_rechit_occ_det_[key2]->Fill(det_occ_bin_x, ieta); - me_detail_residual_x_[key4]->Fill(residual_x); me_detail_residual_y_[key4]->Fill(residual_y); me_detail_residual_rphi_[key4]->Fill(residual_rphi); diff --git a/Validation/MuonGEMRecHits/plugins/GEMRecHitValidation.h b/Validation/MuonGEMRecHits/plugins/GEMRecHitValidation.h index 0806ed15e7ce8..d016dded50cd9 100644 --- a/Validation/MuonGEMRecHits/plugins/GEMRecHitValidation.h +++ b/Validation/MuonGEMRecHits/plugins/GEMRecHitValidation.h @@ -25,15 +25,13 @@ class GEMRecHitValidation : public GEMBaseValidation { edm::ESGetToken geomTokenBeginRun_; // MonitorElement - MonitorElement* me_cls_; - MEMap2Ids me_cls_roll_; + MonitorElement* me_detail_cls_total_; + MEMap2Ids me_detail_cls_roll_; MEMap4Ids me_detail_cls_; // Residual - MEMap2Ids me_residual_x_; MEMap2Ids me_residual_y_; MEMap2Ids me_residual_rphi_; - MEMap4Ids me_detail_residual_x_; MEMap4Ids me_detail_residual_y_; MEMap4Ids me_detail_residual_rphi_; @@ -43,10 +41,10 @@ class GEMRecHitValidation : public GEMBaseValidation { MEMap4Ids me_detail_pull_y_la_; // Occupancy - MEMap3Ids me_total_rechit_; - MEMap3Ids me_occ_pid_; - MEMap3Ids me_occ_ieta_; - MEMap3Ids me_occ_phi_; + MEMap3Ids me_detail_total_rechit_; + MEMap3Ids me_detail_occ_pid_; + MEMap3Ids me_detail_occ_ieta_; + MEMap3Ids me_detail_occ_phi_; MEMap1Ids me_detail_occ_zr_; MEMap3Ids me_detail_occ_xy_; MEMap3Ids me_detail_occ_polar_; diff --git a/Validation/MuonGEMRecHits/plugins/MuonGEMRecHitsHarvestor.cc b/Validation/MuonGEMRecHits/plugins/MuonGEMRecHitsHarvestor.cc index b48a758fc9078..c7eb84980f5e9 100644 --- a/Validation/MuonGEMRecHits/plugins/MuonGEMRecHitsHarvestor.cc +++ b/Validation/MuonGEMRecHits/plugins/MuonGEMRecHitsHarvestor.cc @@ -15,9 +15,9 @@ MuonGEMRecHitsHarvestor::MuonGEMRecHitsHarvestor(const edm::ParameterSet& pset) MuonGEMRecHitsHarvestor::~MuonGEMRecHitsHarvestor() {} void MuonGEMRecHitsHarvestor::dqmEndJob(DQMStore::IBooker& booker, DQMStore::IGetter& getter) { - TString simhit_occ_folder = "MuonGEMHitsV/GEMHitsTask/Occupancy/"; - TString occ_folder = "MuonGEMRecHitsV/GEMRecHitsTask/Occupancy/"; - TString eff_folder = "MuonGEMRecHitsV/GEMRecHitsTask/Efficiency/"; + TString simhit_occ_folder = "GEM/SimHits/"; + TString occ_folder = "GEM/RecHits/"; + TString eff_folder = "GEM/RecHits/"; for (const auto& region_id : region_ids_) { for (const auto& station_id : station_ids_) { @@ -26,8 +26,8 @@ void MuonGEMRecHitsHarvestor::dqmEndJob(DQMStore::IBooker& booker, DQMStore::IGe if (detail_plot_) { // NOTE Detector Component - TString rechit_det_path = occ_folder + "matched_rechit_occ_det" + name_suf_re_st; - TString simhit_det_path = simhit_occ_folder + "muon_simhit_occ_det" + name_suf_re_st; + TString rechit_det_path = occ_folder + "sim_matched_occ_det" + name_suf_re_st; + TString simhit_det_path = simhit_occ_folder + "sim_muon_occ_det" + name_suf_re_st; TString eff_det_name = "eff_det" + name_suf_re_st; TString eff_det_title = "Detector Component Efficiency :" + title_suf_re_st; @@ -41,8 +41,8 @@ void MuonGEMRecHitsHarvestor::dqmEndJob(DQMStore::IBooker& booker, DQMStore::IGe TString title_suf_re_st_ly = GEMUtils::getSuffixTitle(region_id, station_id, layer_id); // NOTE Eta - TString rechit_eta_path = occ_folder + "matched_rechit_occ_eta" + name_suf_re_st_ly; - TString simhit_eta_path = simhit_occ_folder + "muon_simhit_occ_eta" + name_suf_re_st_ly; + TString rechit_eta_path = occ_folder + "sim_matched_occ_eta" + name_suf_re_st_ly; + TString simhit_eta_path = simhit_occ_folder + "sim_muon_occ_eta" + name_suf_re_st_ly; TString eff_eta_name = "eff_eta" + name_suf_re_st_ly; TString eff_eta_title = "Eta Efficiency :" + title_suf_re_st_ly; @@ -50,8 +50,8 @@ void MuonGEMRecHitsHarvestor::dqmEndJob(DQMStore::IBooker& booker, DQMStore::IGe bookEff1D(booker, getter, rechit_eta_path, simhit_eta_path, eff_folder, eff_eta_name, eff_eta_title); // NOTE Phi - TString rechit_phi_path = occ_folder + "matched_rechit_occ_phi" + name_suf_re_st_ly; - TString simhit_phi_path = simhit_occ_folder + "muon_simhit_occ_phi" + name_suf_re_st_ly; + TString rechit_phi_path = occ_folder + "sim_matched_occ_phi" + name_suf_re_st_ly; + TString simhit_phi_path = simhit_occ_folder + "sim_muon_occ_phi" + name_suf_re_st_ly; TString eff_phi_name = "eff_phi" + name_suf_re_st_ly; TString eff_phi_title = "Phi Efficiency :" + title_suf_re_st_ly; diff --git a/Validation/MuonGEMRecHits/python/PostProcessor_cff.py b/Validation/MuonGEMRecHits/python/PostProcessor_cff.py index 1d422ae8efca4..73117cbf2f08e 100644 --- a/Validation/MuonGEMRecHits/python/PostProcessor_cff.py +++ b/Validation/MuonGEMRecHits/python/PostProcessor_cff.py @@ -12,4 +12,4 @@ MuonGEMRecHitsPostProcessors = cms.Sequence( gemRecHitHarvesting ) from Configuration.Eras.Modifier_phase2_common_cff import phase2_common -phase2_common.toModify( gemRecHitHarvesting, stationIds = (1, 2) ) +phase2_common.toModify( gemRecHitHarvesting, stationIds = (0, 1, 2) ) diff --git a/Validation/Performance/scripts/cmsScimarkParser.py b/Validation/Performance/scripts/cmsScimarkParser.py index c85194f24d640..68ffa1e365842 100755 --- a/Validation/Performance/scripts/cmsScimarkParser.py +++ b/Validation/Performance/scripts/cmsScimarkParser.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 #Script cloned from cmsTiming_parser.py from __future__ import print_function diff --git a/Validation/Performance/scripts/cmsScimarkStop.py b/Validation/Performance/scripts/cmsScimarkStop.py index f70ea1c658fc2..243229ed32f45 100755 --- a/Validation/Performance/scripts/cmsScimarkStop.py +++ b/Validation/Performance/scripts/cmsScimarkStop.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 #Script to #1-check for cmsScimarkLaunch (infinite loop) scripts #2-kill them diff --git a/Validation/Performance/scripts/cmsSimplememchecker_parser.py b/Validation/Performance/scripts/cmsSimplememchecker_parser.py index 9a0203b631ae6..aad34a5153eb0 100755 --- a/Validation/Performance/scripts/cmsSimplememchecker_parser.py +++ b/Validation/Performance/scripts/cmsSimplememchecker_parser.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 from __future__ import print_function diff --git a/Validation/Performance/scripts/cmsTiming_parser.py b/Validation/Performance/scripts/cmsTiming_parser.py index 0f5ceacf2c3fc..f5103790bb56e 100755 --- a/Validation/Performance/scripts/cmsTiming_parser.py +++ b/Validation/Performance/scripts/cmsTiming_parser.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 from __future__ import print_function from builtins import range diff --git a/Validation/RecoB/scripts/cuy.py b/Validation/RecoB/scripts/cuy.py index 856872a9f688e..8de1976c55d2c 100755 --- a/Validation/RecoB/scripts/cuy.py +++ b/Validation/RecoB/scripts/cuy.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 #____________________________________________________________ # # cuy diff --git a/Validation/RecoB/scripts/plotFactory.py b/Validation/RecoB/scripts/plotFactory.py index 26ef54dd094ae..72f3d51005af9 100755 --- a/Validation/RecoB/scripts/plotFactory.py +++ b/Validation/RecoB/scripts/plotFactory.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ####### diff --git a/Validation/RecoEgamma/plugins/BuildFile.xml b/Validation/RecoEgamma/plugins/BuildFile.xml index 2403d4c81724f..e0f92d206aa53 100644 --- a/Validation/RecoEgamma/plugins/BuildFile.xml +++ b/Validation/RecoEgamma/plugins/BuildFile.xml @@ -18,7 +18,6 @@ - diff --git a/Validation/RecoEgamma/plugins/TkConvValidator.cc b/Validation/RecoEgamma/plugins/TkConvValidator.cc index 31c0e77a15a4e..ee356afeb1e52 100644 --- a/Validation/RecoEgamma/plugins/TkConvValidator.cc +++ b/Validation/RecoEgamma/plugins/TkConvValidator.cc @@ -21,7 +21,6 @@ #include "SimDataFormats/TrackingAnalysis/interface/TrackingVertexContainer.h" // #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h" -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "Geometry/CommonDetUnit/interface/GeomDet.h" diff --git a/Validation/RecoEgamma/python/ElectronMcFakeValidator_gedGsfElectrons_cfi.py b/Validation/RecoEgamma/python/ElectronMcFakeValidator_gedGsfElectrons_cfi.py index 40ddb99769c5e..1282976882da5 100644 --- a/Validation/RecoEgamma/python/ElectronMcFakeValidator_gedGsfElectrons_cfi.py +++ b/Validation/RecoEgamma/python/ElectronMcFakeValidator_gedGsfElectrons_cfi.py @@ -66,10 +66,8 @@ from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal phase2_hgcal.toModify( electronMcFakeValidator, - electronCollection = 'ecalDrivenGsfElectronsFromMultiCl', - electronCoreCollection = 'ecalDrivenGsfElectronCoresFromMultiCl', - electronTrackCollection = 'electronGsfTracksFromMultiCl', - electronSeedCollection = 'electronMergedSeedsFromMultiCl', + electronCollection = 'ecalDrivenGsfElectronsHGC', + electronCoreCollection = 'ecalDrivenGsfElectronCoresHGC', MaxAbsEta = cms.double(3.0), histosCfg = dict( Nbineta = 60 , diff --git a/Validation/RecoEgamma/python/ElectronMcSignalValidatorMiniAOD_cfi.py b/Validation/RecoEgamma/python/ElectronMcSignalValidatorMiniAOD_cfi.py index 6dd1014349172..44ff038e33eea 100644 --- a/Validation/RecoEgamma/python/ElectronMcSignalValidatorMiniAOD_cfi.py +++ b/Validation/RecoEgamma/python/ElectronMcSignalValidatorMiniAOD_cfi.py @@ -61,8 +61,8 @@ phase2_hgcal.toModify( electronMcSignalValidatorMiniAOD, - # electrons = cms.InputTag("slimmedElectronsFromMultiCl"), - electrons_endcaps=cms.InputTag("slimmedElectronsFromMultiCl"), + # electrons = cms.InputTag("slimmedElectronsHGC"), + electrons_endcaps=cms.InputTag("slimmedElectronsHGC"), MaxAbsEta=cms.double(3.0), histosCfg=dict( Nbineta=60, diff --git a/Validation/RecoEgamma/python/ElectronMcSignalValidatorPt1000_gedGsfElectrons_cfi.py b/Validation/RecoEgamma/python/ElectronMcSignalValidatorPt1000_gedGsfElectrons_cfi.py index 96bfa3c814d53..1f78607019781 100644 --- a/Validation/RecoEgamma/python/ElectronMcSignalValidatorPt1000_gedGsfElectrons_cfi.py +++ b/Validation/RecoEgamma/python/ElectronMcSignalValidatorPt1000_gedGsfElectrons_cfi.py @@ -72,10 +72,10 @@ from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal phase2_hgcal.toModify( electronMcSignalValidatorPt1000, - electronCollection = 'ecalDrivenGsfElectronsFromMultiCl', - electronCoreCollection = 'ecalDrivenGsfElectronCoresFromMultiCl', - electronTrackCollection = 'electronGsfTracksFromMultiCl', - electronSeedCollection = 'electronMergedSeedsFromMultiCl', + electronCollection = 'ecalDrivenGsfElectronsHGC', + electronCoreCollection = 'ecalDrivenGsfElectronCoresHGC', + electronTrackCollection = 'electronGsfTracks', + electronSeedCollection = 'electronMergedSeeds', MaxAbsEta = cms.double(3.0), histosCfg = dict( Nbineta = 60 , diff --git a/Validation/RecoEgamma/python/ElectronMcSignalValidator_gedGsfElectrons_cfi.py b/Validation/RecoEgamma/python/ElectronMcSignalValidator_gedGsfElectrons_cfi.py index ad86f5cb79e05..f3f47c4a18352 100644 --- a/Validation/RecoEgamma/python/ElectronMcSignalValidator_gedGsfElectrons_cfi.py +++ b/Validation/RecoEgamma/python/ElectronMcSignalValidator_gedGsfElectrons_cfi.py @@ -78,10 +78,10 @@ electronMcSignalValidator, # electronCollection = cms.InputTag("ecalDrivenGsfElectrons"), # electronCoreCollection = cms.InputTag("ecalDrivenGsfElectronCores"), - electronCollection = 'ecalDrivenGsfElectronsFromMultiCl', - electronCoreCollection = 'ecalDrivenGsfElectronCoresFromMultiCl', - electronTrackCollection = 'electronGsfTracksFromMultiCl', - electronSeedCollection = 'electronMergedSeedsFromMultiCl', + electronCollection = 'ecalDrivenGsfElectronsHGC', + electronCoreCollection = 'ecalDrivenGsfElectronCoresHGC', + electronTrackCollection = 'electronGsfTracks', + electronSeedCollection = 'electronMergedSeeds', MaxAbsEta = cms.double(3.0), histosCfg = dict( Nbineta = 60 , diff --git a/Validation/RecoEgamma/test/OvalFile.Pt1000 b/Validation/RecoEgamma/test/OvalFile.Pt1000 index 06c6f26f64607..bed33c1ac8a70 100644 --- a/Validation/RecoEgamma/test/OvalFile.Pt1000 +++ b/Validation/RecoEgamma/test/OvalFile.Pt1000 @@ -1022,7 +1022,7 @@ Process uncleaned superclusters - +
diff --git a/Validation/RecoEgamma/test/electronValidation.csh b/Validation/RecoEgamma/test/electronValidation.csh index e06368bd294a3..0c5d1a86922c8 100755 --- a/Validation/RecoEgamma/test/electronValidation.csh +++ b/Validation/RecoEgamma/test/electronValidation.csh @@ -31,7 +31,7 @@ # # VAL_HISTOS : name of the file describing the histograms to extract and generate. # VAL_ANALYZER : name of the analyzer used. -# VAL_CONFIGURATION : name of the cmsRun python configuration used. +# VAL_CONFIGURATION : name of the cmsRun python3 configuration used. # # DD_SAMPLE : short chosen name for the current dataset ; used in web pages # and used to build the subdirectory where the web pages will be diff --git a/Validation/RecoEgamma/test/electronValidationCheck_Env.py b/Validation/RecoEgamma/test/electronValidationCheck_Env.py index 35ceea649ee4e..46b50f1dce084 100644 --- a/Validation/RecoEgamma/test/electronValidationCheck_Env.py +++ b/Validation/RecoEgamma/test/electronValidationCheck_Env.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 # -*-coding: utf-8 -*- from __future__ import print_function diff --git a/Validation/RecoEgamma/test/electronWget.py b/Validation/RecoEgamma/test/electronWget.py index b22682ee9b3a1..288338307fab8 100755 --- a/Validation/RecoEgamma/test/electronWget.py +++ b/Validation/RecoEgamma/test/electronWget.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os, sys if len(sys.argv) > 1: diff --git a/Validation/RecoEgamma/test/makeWebpage.py b/Validation/RecoEgamma/test/makeWebpage.py index 47d7527edf6a6..5a7729c8bca35 100755 --- a/Validation/RecoEgamma/test/makeWebpage.py +++ b/Validation/RecoEgamma/test/makeWebpage.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ## This script writes an index.html page ## displaying all plots contained in the diff --git a/Validation/RecoMuon/plugins/BuildFile.xml b/Validation/RecoMuon/plugins/BuildFile.xml index 44f272c4ebb8a..63b5e07f234b1 100644 --- a/Validation/RecoMuon/plugins/BuildFile.xml +++ b/Validation/RecoMuon/plugins/BuildFile.xml @@ -9,7 +9,6 @@ - diff --git a/Validation/RecoMuon/plugins/MuonTrackValidator.cc b/Validation/RecoMuon/plugins/MuonTrackValidator.cc index ea517c08da5f9..a97faafe11f35 100644 --- a/Validation/RecoMuon/plugins/MuonTrackValidator.cc +++ b/Validation/RecoMuon/plugins/MuonTrackValidator.cc @@ -8,11 +8,8 @@ #include "SimDataFormats/Vertex/interface/SimVertexContainer.h" #include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h" -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h" #include "TrackingTools/PatternTools/interface/TSCBLBuilderNoMaterial.h" -#include "SimTracker/TrackAssociation/plugins/ParametersDefinerForTPESProducer.h" -#include "SimTracker/TrackAssociation/plugins/CosmicParametersDefinerForTPESProducer.h" #include "SimTracker/TrackAssociation/interface/TrackingParticleIP.h" #include "TMath.h" @@ -369,13 +366,7 @@ void MuonTrackValidator::analyze(const edm::Event& event, const edm::EventSetup& edm::Handle > puinfoH; int PU_NumInteractions(-1); - edm::ESHandle Lhc_parametersDefinerTP; - edm::ESHandle _Cosmic_parametersDefinerTP; - std::unique_ptr Cosmic_parametersDefinerTP; - if (parametersDefiner == "LhcParametersDefinerForTP") { - Lhc_parametersDefinerTP = setup.getHandle(tpDefinerEsToken); - // PileupSummaryInfo is contained only in collision events event.getByToken(pileupinfo_Token, puinfoH); for (std::vector::const_iterator puInfoIt = puinfoH->begin(); puInfoIt != puinfoH->end(); @@ -387,20 +378,11 @@ void MuonTrackValidator::analyze(const edm::Event& event, const edm::EventSetup& } } else if (parametersDefiner == "CosmicParametersDefinerForTP") { - //setup.get().get(parametersDefiner, _Cosmic_parametersDefinerTP); - _Cosmic_parametersDefinerTP = setup.getHandle(cosmictpDefinerEsToken); - - //Since we modify the object, we must clone it - Cosmic_parametersDefinerTP = _Cosmic_parametersDefinerTP->clone(); - edm::Handle simHitsTPAssoc; //warning: make sure the TP collection used in the map is the same used here event.getByToken(_simHitTpMapTag, simHitsTPAssoc); - Cosmic_parametersDefinerTP->initEvent(simHitsTPAssoc); + cosmicParametersDefinerTP_->initEvent(simHitsTPAssoc); cosmictpSelector.initEvent(simHitsTPAssoc); - } else { - edm::LogError("MuonTrackValidator") << "Unexpected label: parametersDefiner = " << parametersDefiner.c_str() - << "\n"; } TrackingParticleRefVector TPrefV; @@ -514,8 +496,8 @@ void MuonTrackValidator::analyze(const edm::Event& event, const edm::EventSetup& continue; momentumTP = tp.momentum(); vertexTP = tp.vertex(); - TrackingParticle::Vector momentum = Lhc_parametersDefinerTP->momentum(event, setup, tpr); - TrackingParticle::Point vertex = Lhc_parametersDefinerTP->vertex(event, setup, tpr); + TrackingParticle::Vector momentum = lhcParametersDefinerTP_->momentum(event, setup, tpr); + TrackingParticle::Point vertex = lhcParametersDefinerTP_->vertex(event, setup, tpr); dxySim = TrackingParticleIP::dxy(vertex, momentum, bs.position()); dzSim = TrackingParticleIP::dz(vertex, momentum, bs.position()); } @@ -524,8 +506,8 @@ void MuonTrackValidator::analyze(const edm::Event& event, const edm::EventSetup& edm::LogVerbatim("MuonTrackValidator") << "TrackingParticle " << i; if (!cosmictpSelector(tpr, &bs, event, setup)) continue; - momentumTP = Cosmic_parametersDefinerTP->momentum(event, setup, tpr); - vertexTP = Cosmic_parametersDefinerTP->vertex(event, setup, tpr); + momentumTP = cosmicParametersDefinerTP_->momentum(event, setup, tpr); + vertexTP = cosmicParametersDefinerTP_->vertex(event, setup, tpr); dxySim = TrackingParticleIP::dxy(vertexTP, momentumTP, bs.position()); dzSim = TrackingParticleIP::dz(vertexTP, momentumTP, bs.position()); } @@ -796,16 +778,16 @@ void MuonTrackValidator::analyze(const edm::Event& event, const edm::EventSetup& if (!(Track_is_matched && tpSelector(*tpp))) continue; else { - momentumTP = Lhc_parametersDefinerTP->momentum(event, setup, tpr); - vertexTP = Lhc_parametersDefinerTP->vertex(event, setup, tpr); + momentumTP = lhcParametersDefinerTP_->momentum(event, setup, tpr); + vertexTP = lhcParametersDefinerTP_->vertex(event, setup, tpr); } } else if (parametersDefiner == "CosmicParametersDefinerForTP") { // following reco plots are made only from tracks associated to selected signal TPs if (!(Track_is_matched && cosmictpSelector(tpr, &bs, event, setup))) continue; else { - momentumTP = Cosmic_parametersDefinerTP->momentum(event, setup, tpr); - vertexTP = Cosmic_parametersDefinerTP->vertex(event, setup, tpr); + momentumTP = cosmicParametersDefinerTP_->momentum(event, setup, tpr); + vertexTP = cosmicParametersDefinerTP_->vertex(event, setup, tpr); } } diff --git a/Validation/RecoMuon/plugins/MuonTrackValidator.h b/Validation/RecoMuon/plugins/MuonTrackValidator.h index c4d2693cd1d30..517329ba21f7c 100644 --- a/Validation/RecoMuon/plugins/MuonTrackValidator.h +++ b/Validation/RecoMuon/plugins/MuonTrackValidator.h @@ -14,7 +14,6 @@ #include "SimDataFormats/Associations/interface/TrackAssociation.h" #include "DQMServices/Core/interface/DQMEDAnalyzer.h" -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" #include "SimTracker/TrackAssociation/interface/ParametersDefinerForTP.h" #include "SimTracker/TrackAssociation/interface/CosmicParametersDefinerForTP.h" @@ -26,12 +25,7 @@ class MuonTrackValidator : public DQMEDAnalyzer, protected MuonTrackValidatorBase { public: /// Constructor - MuonTrackValidator(const edm::ParameterSet& pset) - : MuonTrackValidatorBase(pset), - tpDefinerEsToken( - esConsumes(edm::ESInputTag("", parametersDefiner))), - cosmictpDefinerEsToken( - esConsumes(edm::ESInputTag("", parametersDefiner))) { + MuonTrackValidator(const edm::ParameterSet& pset) : MuonTrackValidatorBase(pset) { dirName_ = pset.getParameter("dirName"); associatormap = pset.getParameter("associatormap"); UseAssociators = pset.getParameter("UseAssociators"); @@ -78,6 +72,14 @@ class MuonTrackValidator : public DQMEDAnalyzer, protected MuonTrackValidatorBas simToRecoCollection_Token = consumes(associatormap); recoToSimCollection_Token = consumes(associatormap); + if (parametersDefiner == "LhcParametersDefinerForTP") { + lhcParametersDefinerTP_ = std::make_unique(bsSrc, consumesCollector()); + } else if (parametersDefiner == "CosmicParametersDefinerForTP") { + cosmicParametersDefinerTP_ = std::make_unique(consumesCollector()); + } else { + throw cms::Exception("Configuration") << "Unexpected label: parametersDefiner = " << parametersDefiner; + } + _simHitTpMapTag = mayConsume( pset.getParameter("simHitTpMapTag")); @@ -167,8 +169,8 @@ class MuonTrackValidator : public DQMEDAnalyzer, protected MuonTrackValidatorBas edm::EDGetTokenT recoToSimCollection_Token; edm::EDGetTokenT _simHitTpMapTag; - const edm::ESGetToken tpDefinerEsToken; - const edm::ESGetToken cosmictpDefinerEsToken; + std::unique_ptr lhcParametersDefinerTP_; + std::unique_ptr cosmicParametersDefinerTP_; bool UseAssociators; bool useGEMs_; diff --git a/Validation/RecoMuon/python/MuonTrackValidator_cfi.py b/Validation/RecoMuon/python/MuonTrackValidator_cfi.py index 4785a51f4cb74..9a5cffece8e4d 100644 --- a/Validation/RecoMuon/python/MuonTrackValidator_cfi.py +++ b/Validation/RecoMuon/python/MuonTrackValidator_cfi.py @@ -1,7 +1,5 @@ import FWCore.ParameterSet.Config as cms -from SimTracker.TrackAssociation.LhcParametersDefinerForTP_cfi import * -from SimTracker.TrackAssociation.CosmicParametersDefinerForTP_cfi import * from Validation.RecoMuon.selectors_cff import * from Validation.RecoMuon.histoParameters_cff import * diff --git a/Validation/RecoMuon/python/muonValidation_cff.py b/Validation/RecoMuon/python/muonValidation_cff.py index 315e6b118c09c..b3f715e0fcb26 100644 --- a/Validation/RecoMuon/python/muonValidation_cff.py +++ b/Validation/RecoMuon/python/muonValidation_cff.py @@ -8,9 +8,6 @@ from Validation.RecoMuon.associators_cff import * from Validation.RecoMuon.histoParameters_cff import * -from SimTracker.TrackAssociation.LhcParametersDefinerForTP_cfi import * -from SimTracker.TrackAssociation.CosmicParametersDefinerForTP_cfi import * - from Validation.RecoMuon.RecoMuonValidator_cff import * import Validation.RecoMuon.MuonTrackValidator_cfi diff --git a/Validation/RecoMuon/python/tabp_muonValidation_cff.py b/Validation/RecoMuon/python/tabp_muonValidation_cff.py index 24dc0a8bacfab..bb284dbd10295 100644 --- a/Validation/RecoMuon/python/tabp_muonValidation_cff.py +++ b/Validation/RecoMuon/python/tabp_muonValidation_cff.py @@ -7,9 +7,6 @@ from Validation.RecoMuon.associators_cff import * import Validation.RecoMuon.MuonTrackValidator_cfi -from SimTracker.TrackAssociation.LhcParametersDefinerForTP_cfi import * -from SimTracker.TrackAssociation.CosmicParametersDefinerForTP_cfi import * - trkMuonTrackVTrackAssoc = Validation.RecoMuon.MuonTrackValidator_cfi.muonTrackValidator.clone() trkMuonTrackVTrackAssoc.associatormap = 'tpToTkmuTrackAssociation' trkMuonTrackVTrackAssoc.associators = ('trackAssociatorByHits',) diff --git a/Validation/RecoMuon/test/README b/Validation/RecoMuon/test/README index 3e304edbc3099..4d8a074a7b840 100644 --- a/Validation/RecoMuon/test/README +++ b/Validation/RecoMuon/test/README @@ -5,13 +5,13 @@ Muon Summary Validation script New Muon Validation: from CMSSW_10_1_0_pre1 * set the input data in: new_userparams.py -* then run: python new_muonReleaseSummary.py +* then run: python3 new_muonReleaseSummary.py ------------------------------- Old Muon Validation: up to CMSSW_10_1_0_pre1 * set the input data in: userparams.py -* then run: python muonReleaseSummary.py +* then run: python3 muonReleaseSummary.py diff --git a/Validation/RecoMuon/test/genericMuonReleaseSummary.py b/Validation/RecoMuon/test/genericMuonReleaseSummary.py index 905656187b368..7dc183c0b1851 100644 --- a/Validation/RecoMuon/test/genericMuonReleaseSummary.py +++ b/Validation/RecoMuon/test/genericMuonReleaseSummary.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 from __future__ import print_function import os diff --git a/Validation/RecoMuon/test/macro/IsoValHistoPublisher.C b/Validation/RecoMuon/test/macro/IsoValHistoPublisher.C index 3fe3057db8fe9..6c515b057c442 100644 --- a/Validation/RecoMuon/test/macro/IsoValHistoPublisher.C +++ b/Validation/RecoMuon/test/macro/IsoValHistoPublisher.C @@ -6,29 +6,26 @@ // Uncomment the following line for some extra debug information // #define DEBUG -void IsoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="REF_FILE") { +void IsoValHistoPublisher(const char* newFile = "NEW_FILE", const char* refFile = "REF_FILE") { cout << ">> Starting IsoValHistoPublisher(" << newFile << "," << refFile << ")..." << endl; - //==== To be replaced from python ==================== + //==== To be replaced from python3 ==================== const char* dataType = "DATATYPE"; const char* refLabel("REF_LABEL, REF_RELEASE REFSELECTION"); const char* newLabel("NEW_LABEL, NEW_RELEASE NEWSELECTION"); - - + // ==== Initial settings and loads //gROOT->ProcessLine(".x HistoCompare_Tracks.C"); //gROOT ->Reset(); - gROOT ->SetBatch(); - gErrorIgnoreLevel = kWarning; // Get rid of the info messages + gROOT->SetBatch(); + gErrorIgnoreLevel = kWarning; // Get rid of the info messages SetGlobalStyle(); - - - // ==== Some cleaning... is this needed? + + // ==== Some cleaning... is this needed? delete gROOT->GetListOfFiles()->FindObject(refFile); - delete gROOT->GetListOfFiles()->FindObject(newFile); - + delete gROOT->GetListOfFiles()->FindObject(newFile); // ==== Opening files, moving to the right branch and getting the list of sub-branches cout << ">> Openning file, moving to the right branch and getting sub-branches..." << endl; @@ -41,10 +38,9 @@ void IsoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="RE cerr << "ERROR: Could not find keys!!!" << endl; return; } - TDirectory* sdir = gDirectory; + TDirectory* sdir = gDirectory; for (unsigned int i = 0; i < sl->GetEntries(); i++) cout << " + " << sl->At(i)->GetName() << endl; - cout << ">> Finding references..." << endl; TFile* rfile = new TFile(refFile); @@ -54,122 +50,156 @@ void IsoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="RE cerr << "ERROR: Could not find keys!!!" << endl; return; } - TDirectory* rdir = gDirectory; + TDirectory* rdir = gDirectory; for (unsigned int i = 0; i < sl->GetEntries(); i++) cout << " + " << sl->At(i)->GetName() << endl; - - - + //==== Iterate now over histograms and collections cout << ">> Iterating over histograms and collections..." << endl; - TIter iter_r( rl ); - TIter iter_s( sl ); + TIter iter_r(rl); + TIter iter_s(sl); TKey* rKey = 0; TKey* sKey = 0; TString rcollname; TString scollname; - while ( (rKey = (TKey*)iter_r()) ) { + while ((rKey = (TKey*)iter_r())) { TString myName = rKey->GetName(); #ifdef DEBUG cout << "DEBUG: Checking key " << myName << endl; #endif rcollname = myName; sKey = (TKey*)iter_s(); - if (!sKey) continue; + if (!sKey) + continue; scollname = sKey->GetName(); - if ( (rcollname != scollname) && (rcollname+"FS" != scollname) && (rcollname != scollname+"FS") ) { + if ((rcollname != scollname) && (rcollname + "FS" != scollname) && (rcollname != scollname + "FS")) { cerr << "ERROR: Different collection names, please check: " << rcollname << " : " << scollname << endl; cout << "ERROR: Different collection names, please check: " << rcollname << " : " << scollname << endl; continue; } - + // ==== Now let's go for the plotting... - cout << ">> Comparing plots in " << myName << "..." << endl; - cerr << ">> Comparing plots in " << myName << "..." << endl; + cout << ">> Comparing plots in " << myName << "..." << endl; + cerr << ">> Comparing plots in " << myName << "..." << endl; TString newDir("NEW_RELEASE/NEWSELECTION/NEW_LABEL/"); - newDir+=myName; - gSystem->mkdir(newDir,kTRUE); - - bool logy [] = {false, false, false, false }; - bool doKolmo [] = {true, true, true, true }; - Double_t norm [] = {0.,0.,0.,0.}; + newDir += myName; + gSystem->mkdir(newDir, kTRUE); + + bool logy[] = {false, false, false, false}; + bool doKolmo[] = {true, true, true, true}; + Double_t norm[] = {0., 0., 0., 0.}; //===== Tracker, ECAL Deposits - const char* plots1 [] = {"sumPt", "emEt", "sumPt_cd", "emEt_cd"}; + const char* plots1[] = {"sumPt", "emEt", "sumPt_cd", "emEt_cd"}; Plot4Histograms(newDir + "/muonIso1", - rdir, sdir, - rcollname, scollname, - "IsoHistos1", "Tracker, ECAL Deposits", - refLabel, newLabel, - plots1, 0, - logy, doKolmo, norm); - + rdir, + sdir, + rcollname, + scollname, + "IsoHistos1", + "Tracker, ECAL Deposits", + refLabel, + newLabel, + plots1, + 0, + logy, + doKolmo, + norm); + //===== HCAL and HO Isolation Distributions - const char* plots2 [] = {"hadEt", "hoEt", "hadEt_cd", "hoEt_cd"}; + const char* plots2[] = {"hadEt", "hoEt", "hadEt_cd", "hoEt_cd"}; Plot4Histograms(newDir + "/muonIso2", - rdir, sdir, - rcollname, scollname, - "IsoHistos2", "HCAL, HO Deposits", - refLabel, newLabel, - plots2, 0, - logy, doKolmo,norm); - + rdir, + sdir, + rcollname, + scollname, + "IsoHistos2", + "HCAL, HO Deposits", + refLabel, + newLabel, + plots2, + 0, + logy, + doKolmo, + norm); + //===== N_Tracks, N_Jets around #mu - const char* plots3 [] = {"nTracks", "nJets", "nTracks_cd", "nJets_cd"}; + const char* plots3[] = {"nTracks", "nJets", "nTracks_cd", "nJets_cd"}; Plot4Histograms(newDir + "/muonIso3", - rdir, sdir, - rcollname, scollname, - "IsoHistos3", "Number of tracks, jets around #mu", - refLabel, newLabel, - plots3, 0, - logy, doKolmo,norm); - - + rdir, + sdir, + rcollname, + scollname, + "IsoHistos3", + "Number of tracks, jets around #mu", + refLabel, + newLabel, + plots3, + 0, + logy, + doKolmo, + norm); + //===== avg Pt, weighted Et around #mu - const char* plots4 [] = {"avgPt", "weightedEt", "avgPt_cd", "weightedEt_cd"}; + const char* plots4[] = {"avgPt", "weightedEt", "avgPt_cd", "weightedEt_cd"}; Plot4Histograms(newDir + "/muonIso4", - rdir, sdir, - rcollname, scollname, - "IsoHistos4", "Average p_{T}, weighted E_{T} aroun #mu", - refLabel, newLabel, - plots4, 0, - logy, doKolmo,norm); - - + rdir, + sdir, + rcollname, + scollname, + "IsoHistos4", + "Average p_{T}, weighted E_{T} aroun #mu", + refLabel, + newLabel, + plots4, + 0, + logy, + doKolmo, + norm); + //===== Tracker and CAL deposits vs muon pT - const char* plots5 [] = {"muonPt_sumPt", "muonPt_emEt", "muonPt_hadEt", "muonPt_hoEt"}; - Double_t norm2 [] = {-999.,-999.,-999.,-999.}; + const char* plots5[] = {"muonPt_sumPt", "muonPt_emEt", "muonPt_hadEt", "muonPt_hoEt"}; + Double_t norm2[] = {-999., -999., -999., -999.}; Plot4Histograms(newDir + "/muonIso5", - rdir, sdir, - rcollname, scollname, - "IsoHistos5", "Trk, CAL Isolations vs. #mu p_{T}", - refLabel, newLabel, - plots5, 0, - logy, doKolmo,norm2); - + rdir, + sdir, + rcollname, + scollname, + "IsoHistos5", + "Trk, CAL Isolations vs. #mu p_{T}", + refLabel, + newLabel, + plots5, + 0, + logy, + doKolmo, + norm2); + //===== NTracks, NJets, avgPt, weightedEt vs Muon pT - const char* plots6 [] = {"muonPt_nTracks", "muonPt_nJets", "muonPt_avgPt", "muonPt_weightedEt"}; + const char* plots6[] = {"muonPt_nTracks", "muonPt_nJets", "muonPt_avgPt", "muonPt_weightedEt"}; Plot4Histograms(newDir + "/muonIso6", - rdir, sdir, - rcollname, scollname, - "IsoHistos6", "Other stuff vs #mu p_{T}", - refLabel, newLabel, - plots6, 0, - logy, doKolmo,norm2); - - + rdir, + sdir, + rcollname, + scollname, + "IsoHistos6", + "Other stuff vs #mu p_{T}", + refLabel, + newLabel, + plots6, + 0, + logy, + doKolmo, + norm2); + //// Merge pdf histograms together into larger files, and name them based on the collection names - TString mergefile = "merged_iso.pdf"; // File name where partial pdfs will be merged - TString destfile = newDir + "/../" + myName + ".pdf"; // Destination file name - TString gscommand = "gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile="+ mergefile + " " - +newDir+"/muonIso1.pdf " - +newDir+"/muonIso2.pdf " - +newDir+"/muonIso3.pdf " - +newDir+"/muonIso4.pdf " - +newDir+"/muonIso5.pdf " - +newDir+"/muonIso6.pdf "; + TString mergefile = "merged_iso.pdf"; // File name where partial pdfs will be merged + TString destfile = newDir + "/../" + myName + ".pdf"; // Destination file name + TString gscommand = "gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=" + mergefile + " " + newDir + + "/muonIso1.pdf " + newDir + "/muonIso2.pdf " + newDir + "/muonIso3.pdf " + newDir + + "/muonIso4.pdf " + newDir + "/muonIso5.pdf " + newDir + "/muonIso6.pdf "; cout << ">> Merging partial pdfs to " << mergefile << "..." << endl; #ifdef DEBUG cout << "DEBUG: ...with command \"" << gscommand << "\"" << endl; @@ -179,11 +209,10 @@ void IsoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="RE gSystem->Rename(mergefile, destfile); cout << ">> Deleting partial pdf files" << endl; - gSystem->Exec("rm -rf "+newDir+"/*.pdf"); + gSystem->Exec("rm -rf " + newDir + "/*.pdf"); cout << " ... Done" << endl; } // end of "while loop" - cout << ">> Removing the relval files from ROOT before closing..." << endl; gROOT->GetListOfFiles()->Remove(sfile); gROOT->GetListOfFiles()->Remove(rfile); diff --git a/Validation/RecoMuon/test/macro/RecoMuonValHistoPublisher.C b/Validation/RecoMuon/test/macro/RecoMuonValHistoPublisher.C index 36cdbd17850e4..610f0cdd590db 100644 --- a/Validation/RecoMuon/test/macro/RecoMuonValHistoPublisher.C +++ b/Validation/RecoMuon/test/macro/RecoMuonValHistoPublisher.C @@ -7,32 +7,27 @@ // Uncomment the following line to get more debuggin output // #define DEBUG -void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="REF_FILE") { +void RecoMuonValHistoPublisher(const char* newFile = "NEW_FILE", const char* refFile = "REF_FILE") { cout << ">> Starting RecoMuonValHistoPublisher(" << newFile << "," << refFile << ")..." << endl; - //==== To be replaced from python ==================== - + //==== To be replaced from python3 ==================== + const char* dataType = "DATATYPE"; const char* refLabel("REF_LABEL, REF_RELEASE REFSELECTION"); const char* newLabel("NEW_LABEL, NEW_RELEASE NEWSELECTION"); const char* fastSim = "IS_FSIM"; - // ==== Initial settings and loads //gROOT->ProcessLine(".x HistoCompare_Tracks.C"); //gROOT ->Reset(); - gROOT ->SetBatch(); - gErrorIgnoreLevel = kWarning; // Get rid of the info messages - + gROOT->SetBatch(); + gErrorIgnoreLevel = kWarning; // Get rid of the info messages SetGlobalStyle(); - - // ==== Some cleaning... is this needed? + // ==== Some cleaning... is this needed? delete gROOT->GetListOfFiles()->FindObject(refFile); - delete gROOT->GetListOfFiles()->FindObject(newFile); - - + delete gROOT->GetListOfFiles()->FindObject(newFile); // ==== Opening files, moving to the right branch and getting the list of sub-branches cout << ">> Openning file, moving to the right branch and getting sub-branches..." << endl; @@ -45,10 +40,10 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil cerr << "ERROR: Could not find keys!!!" << endl; return; } - TDirectory* sdir = gDirectory; + TDirectory* sdir = gDirectory; for (unsigned int i = 0; i < sl->GetEntries(); i++) cout << " + " << sl->At(i)->GetName() << endl; - + cout << ">> Finding references..." << endl; TFile* rfile = new TFile(refFile); TList* rl = getListOfBranches(dataType, rfile, "RecoMuonV"); @@ -57,95 +52,118 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil cerr << "ERROR: Could not find keys!!!" << endl; return; } - TDirectory* rdir = gDirectory; + TDirectory* rdir = gDirectory; for (unsigned int i = 0; i < sl->GetEntries(); i++) cout << " + " << sl->At(i)->GetName() << endl; Float_t maxPT; TString File = newFile; - if (File.Contains("SingleMuPt1000") ||File.Contains("WpM")||File.Contains("ZpMM") ) maxPT=1400.; - else if(File.Contains("SingleMuPt10")) {maxPT = 70.;} - else if (File.Contains("SingleMuPt100")) {maxPT = 400.;} - else maxPT = 400.; + if (File.Contains("SingleMuPt1000") || File.Contains("WpM") || File.Contains("ZpMM")) + maxPT = 1400.; + else if (File.Contains("SingleMuPt10")) { + maxPT = 70.; + } else if (File.Contains("SingleMuPt100")) { + maxPT = 400.; + } else + maxPT = 400.; - TIter iter_r( rl ); - TIter iter_s( sl ); + TIter iter_r(rl); + TIter iter_s(sl); TKey* rKey = 0; TKey* sKey = 0; TString rcollname; TString scollname; - while ( (rKey = (TKey*)iter_r()) ) { + while ((rKey = (TKey*)iter_r())) { TString myName = rKey->GetName(); #ifdef DEBUG cout << "DEBUG: Checking key " << myName << endl; #endif rcollname = myName; sKey = (TKey*)iter_s(); - if (!sKey) continue; + if (!sKey) + continue; scollname = sKey->GetName(); - if ( (rcollname != scollname) && (rcollname+"FS" != scollname) && (rcollname != scollname+"FS") ) { + if ((rcollname != scollname) && (rcollname + "FS" != scollname) && (rcollname != scollname + "FS")) { cerr << "ERROR: Different collection names, please check: " << rcollname << " : " << scollname << endl; cout << "ERROR: Different collection names, please check: " << rcollname << " : " << scollname << endl; continue; } // ==== Now let's go for the plotting... - cout << ">> Comparing plots in " << myName << "..." << endl; - cerr << ">> Comparing plots in " << myName << "..." << endl; + cout << ">> Comparing plots in " << myName << "..." << endl; + cerr << ">> Comparing plots in " << myName << "..." << endl; TString newDir("NEW_RELEASE/NEWSELECTION/NEW_LABEL/"); - newDir+=myName; - gSystem->mkdir(newDir,kTRUE); + newDir += myName; + gSystem->mkdir(newDir, kTRUE); bool resolx = false; - bool *resol = &resolx; - bool logy [] = {false, false, false, false }; - bool doKolmo [] = {true, true, true, true }; - Double_t minx [] = {-1E100, -1E100, -1E100, 5., -1E100, -1E100 }; - Double_t maxx [] = {-1E100, -1E100,-1E100, maxPT, -1E100, -1E100 }; - - Double_t norm [] = {0.,0.,-999.,-999.,0.,0.}; //Normalize to first histogram + bool* resol = &resolx; + bool logy[] = {false, false, false, false}; + bool doKolmo[] = {true, true, true, true}; + Double_t minx[] = {-1E100, -1E100, -1E100, 5., -1E100, -1E100}; + Double_t maxx[] = {-1E100, -1E100, -1E100, maxPT, -1E100, -1E100}; - - //===== reco muon distributions: GLB + Double_t norm[] = {0., 0., -999., -999., 0., 0.}; //Normalize to first histogram + + //===== reco muon distributions: GLB //TString baseh = Form("RecoMuon_MuonAssoc_Glb%s/",fastSim); - const char* plots1[] = {"RecoMuon_MuonAssoc_Glb/ErrPt", - "RecoMuon_MuonAssoc_Glb/ErrP", - "RecoMuon_MuonAssoc_Glb/ErrPt_vs_Eta_Sigma", - "RecoMuon_MuonAssoc_Glb/ErrPt_vs_Pt_Sigma"}; - const char* plotst1[] = {"GlobalMuon(GLB) #Delta p_{T}/p_{T}", - "GlobalMuon(GLB) #Delta p/p", - "GlobalMuon(GLB) #Delta p_{T}/p_{T} vs #sigma(#eta)", - "GlobalMuon(GLB) #Delta p_{T}/p_{T} vs #sigma(p_{T})"}; + const char* plots1[] = {"RecoMuon_MuonAssoc_Glb/ErrPt", + "RecoMuon_MuonAssoc_Glb/ErrP", + "RecoMuon_MuonAssoc_Glb/ErrPt_vs_Eta_Sigma", + "RecoMuon_MuonAssoc_Glb/ErrPt_vs_Pt_Sigma"}; + const char* plotst1[] = {"GlobalMuon(GLB) #Delta p_{T}/p_{T}", + "GlobalMuon(GLB) #Delta p/p", + "GlobalMuon(GLB) #Delta p_{T}/p_{T} vs #sigma(#eta)", + "GlobalMuon(GLB) #Delta p_{T}/p_{T} vs #sigma(p_{T})"}; Plot4Histograms(newDir + "/muonRecoGlb", - rdir, sdir, - rcollname, scollname, - "RecHistosGlb", "Distributions for GlobalMuons (GLB)", - refLabel, newLabel, - plots1, plotst1, - logy, doKolmo, norm,resol,minx,maxx); - - + rdir, + sdir, + rcollname, + scollname, + "RecHistosGlb", + "Distributions for GlobalMuons (GLB)", + refLabel, + newLabel, + plots1, + plotst1, + logy, + doKolmo, + norm, + resol, + minx, + maxx); + //==== efficiencies and fractions GLB - const char* plots2 [] = {"RecoMuon_MuonAssoc_Glb/EffP", - "RecoMuon_MuonAssoc_Glb/EffEta", - "RecoMuon_MuonAssoc_Glb/FractP", - "RecoMuon_MuonAssoc_Glb/FractEta"}; - const char* plotst2[] = {"GlobalMuon(GLB) #epsilon vs. p", - "GlobalMuon(GLB) #epsilon vs. #eta", - "GlobalMuon(GLB) fraction vs. p", - "GlobalMuon(GLB) fraction vs. #eta"}; - Double_t minx1 [] = {5., -1E100, 5., -1E100, -1E100, -1E100 }; - Double_t maxx1 [] = {maxPT, -1E100,maxPT, -1E100, -1E100, -1E100 }; - Double_t norm2 [] = {-999.,-999.,-999.,-999.,-999.,-999.}; //Normalize to first histogram + const char* plots2[] = {"RecoMuon_MuonAssoc_Glb/EffP", + "RecoMuon_MuonAssoc_Glb/EffEta", + "RecoMuon_MuonAssoc_Glb/FractP", + "RecoMuon_MuonAssoc_Glb/FractEta"}; + const char* plotst2[] = {"GlobalMuon(GLB) #epsilon vs. p", + "GlobalMuon(GLB) #epsilon vs. #eta", + "GlobalMuon(GLB) fraction vs. p", + "GlobalMuon(GLB) fraction vs. #eta"}; + Double_t minx1[] = {5., -1E100, 5., -1E100, -1E100, -1E100}; + Double_t maxx1[] = {maxPT, -1E100, maxPT, -1E100, -1E100, -1E100}; + Double_t norm2[] = {-999., -999., -999., -999., -999., -999.}; //Normalize to first histogram Plot4Histograms(newDir + "/muonRecoGlbEff", - rdir, sdir, - rcollname, scollname, - "RecEffHistosGlb", "Distributions for GlobalMuons (GLB), efficiencies and fractions", - refLabel, newLabel, - plots2, plotst2, - logy, doKolmo,norm2,resol,minx1,maxx1); - + rdir, + sdir, + rcollname, + scollname, + "RecEffHistosGlb", + "Distributions for GlobalMuons (GLB), efficiencies and fractions", + refLabel, + newLabel, + plots2, + plotst2, + logy, + doKolmo, + norm2, + resol, + minx1, + maxx1); + /* //===== reco muon distributions: GLBPF baseh = Form("RecoMuon_MuonAssoc_GlbPF%s/",fastSim); @@ -175,141 +193,187 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil plots4, plotst4, logy, doKolmo, norm); */ - + //===== reco muon distributions: STA //baseh = Form("RecoMuon_MuonAssoc_Sta%s/",fastSim); - const char* plots5 [] = {"RecoMuon_MuonAssoc_Sta/ErrPt", - "RecoMuon_MuonAssoc_Sta/ErrP", - "RecoMuon_MuonAssoc_Sta/ErrPt_vs_Eta_Sigma", - "RecoMuon_MuonAssoc_Sta/ErrPt_vs_Pt_Sigma"}; - const char* plotst5[] = {"StandAloneMuon(STA) #Delta p_{T}/p_{T}", - "StandAloneMuon(STA) #Delta p/p", - "StandAloneMuon(STA) #Delta p_{T}/p_{T} vs #sigma(#eta)", - "StandAloneMuon(STA) #Delta p_{T}/p_{T} vs #sigma(p_{T})"}; + const char* plots5[] = {"RecoMuon_MuonAssoc_Sta/ErrPt", + "RecoMuon_MuonAssoc_Sta/ErrP", + "RecoMuon_MuonAssoc_Sta/ErrPt_vs_Eta_Sigma", + "RecoMuon_MuonAssoc_Sta/ErrPt_vs_Pt_Sigma"}; + const char* plotst5[] = {"StandAloneMuon(STA) #Delta p_{T}/p_{T}", + "StandAloneMuon(STA) #Delta p/p", + "StandAloneMuon(STA) #Delta p_{T}/p_{T} vs #sigma(#eta)", + "StandAloneMuon(STA) #Delta p_{T}/p_{T} vs #sigma(p_{T})"}; Plot4Histograms(newDir + "/muonRecoSta", - rdir, sdir, - rcollname, scollname, - "RecHistosSta", "Distributions for StandAloneMuons (STA)", - refLabel, newLabel, - plots5, plotst5, - logy, doKolmo, norm,resol, minx,maxx); - - - + rdir, + sdir, + rcollname, + scollname, + "RecHistosSta", + "Distributions for StandAloneMuons (STA)", + refLabel, + newLabel, + plots5, + plotst5, + logy, + doKolmo, + norm, + resol, + minx, + maxx); + //==== efficiencies and fractions STA - const char* plots6 [] = {"RecoMuon_MuonAssoc_Sta/EffP", - "RecoMuon_MuonAssoc_Sta/EffEta", - "RecoMuon_MuonAssoc_Sta/FractP", - "RecoMuon_MuonAssoc_Sta/FractEta"}; - const char* plotst6[] = {"StandAloneMuon(STA) #epsilon vs. p", - "StandAloneMuon(STA) #epsilon vs. #eta", - "StandAloneMuon(STA) fraction vs. p", - "StandAloneMuon(STA) fraction vs. #eta"}; + const char* plots6[] = {"RecoMuon_MuonAssoc_Sta/EffP", + "RecoMuon_MuonAssoc_Sta/EffEta", + "RecoMuon_MuonAssoc_Sta/FractP", + "RecoMuon_MuonAssoc_Sta/FractEta"}; + const char* plotst6[] = {"StandAloneMuon(STA) #epsilon vs. p", + "StandAloneMuon(STA) #epsilon vs. #eta", + "StandAloneMuon(STA) fraction vs. p", + "StandAloneMuon(STA) fraction vs. #eta"}; Plot4Histograms(newDir + "/muonRecoStaEff", - rdir, sdir, - rcollname, scollname, - "RecEffHistosSta", "Distributions for StandAloneMuons (STA), efficiencies and fractions", - refLabel, newLabel, - plots6, plotst6, - logy, doKolmo, norm2,resol,minx1,maxx1); - - + rdir, + sdir, + rcollname, + scollname, + "RecEffHistosSta", + "Distributions for StandAloneMuons (STA), efficiencies and fractions", + refLabel, + newLabel, + plots6, + plotst6, + logy, + doKolmo, + norm2, + resol, + minx1, + maxx1); - //===== reco muon distributions: TRK + //===== reco muon distributions: TRK //baseh = Form("RecoMuon_MuonAssoc_Trk%s/",fastSim); - const char* plots7 [] = {"RecoMuon_MuonAssoc_Trk/ErrPt", - "RecoMuon_MuonAssoc_Trk/ErrP", - "RecoMuon_MuonAssoc_Trk/ErrPt_vs_Eta_Sigma", - "RecoMuon_MuonAssoc_Trk/ErrPt_vs_Pt_Sigma"}; - const char* plotst7[] = {"TrackerMuon(TRK) #Delta p_{T}/p_{T}", - "TrackerMuon(TRK) #Delta p/p", - "TrackerMuon(TRK) #Delta p_{T}/p_{T} vs #sigma(#eta)", - "TrackerMuon(TRK) #Delta p_{T}/p_{T} vs #sigma(p_{T})"}; + const char* plots7[] = {"RecoMuon_MuonAssoc_Trk/ErrPt", + "RecoMuon_MuonAssoc_Trk/ErrP", + "RecoMuon_MuonAssoc_Trk/ErrPt_vs_Eta_Sigma", + "RecoMuon_MuonAssoc_Trk/ErrPt_vs_Pt_Sigma"}; + const char* plotst7[] = {"TrackerMuon(TRK) #Delta p_{T}/p_{T}", + "TrackerMuon(TRK) #Delta p/p", + "TrackerMuon(TRK) #Delta p_{T}/p_{T} vs #sigma(#eta)", + "TrackerMuon(TRK) #Delta p_{T}/p_{T} vs #sigma(p_{T})"}; Plot4Histograms(newDir + "/muonRecoTrk", - rdir, sdir, - rcollname, scollname, - "RecHistosTrk", "Distributions for TrackerMuons (TRK)", - refLabel, newLabel, - plots7, plotst7, - logy, doKolmo, norm,resol,minx,maxx); - + rdir, + sdir, + rcollname, + scollname, + "RecHistosTrk", + "Distributions for TrackerMuons (TRK)", + refLabel, + newLabel, + plots7, + plotst7, + logy, + doKolmo, + norm, + resol, + minx, + maxx); - - //==== efficiencies and fractions TRK - const char* plots8 [] = {"RecoMuon_MuonAssoc_Trk/EffP", - "RecoMuon_MuonAssoc_Trk/EffEta", - "RecoMuon_MuonAssoc_Trk/FractP", - "RecoMuon_MuonAssoc_Trk/FractEta"}; - const char* plotst8[] = {"TrackerMuon(TRK) #epsilon vs. p", - "TrackerMuon(TRK) #epsilon vs. #eta", - "TrackerMuon(TRK) fraction vs. p", - "TrackerMuon(TRK) fraction vs. #eta"}; + //==== efficiencies and fractions TRK + const char* plots8[] = {"RecoMuon_MuonAssoc_Trk/EffP", + "RecoMuon_MuonAssoc_Trk/EffEta", + "RecoMuon_MuonAssoc_Trk/FractP", + "RecoMuon_MuonAssoc_Trk/FractEta"}; + const char* plotst8[] = {"TrackerMuon(TRK) #epsilon vs. p", + "TrackerMuon(TRK) #epsilon vs. #eta", + "TrackerMuon(TRK) fraction vs. p", + "TrackerMuon(TRK) fraction vs. #eta"}; Plot4Histograms(newDir + "/muonRecoTrkEff", - rdir, sdir, - rcollname, scollname, - "RecEffHistosTrk", "Distributions for TrackerMuons (TRK), efficiencies and fractions", - refLabel, newLabel, - plots8, plotst8, - logy, doKolmo, norm2,resol,minx1,maxx1); + rdir, + sdir, + rcollname, + scollname, + "RecEffHistosTrk", + "Distributions for TrackerMuons (TRK), efficiencies and fractions", + refLabel, + newLabel, + plots8, + plotst8, + logy, + doKolmo, + norm2, + resol, + minx1, + maxx1); - // //===== reco muon distributions: Tight Muons // //baseh = Form("RecoMuon_MuonAssoc_Tgt%s/",fastSim); - const char* plots9 [] = {"RecoMuon_MuonAssoc_Tgt/ErrPt", - "RecoMuon_MuonAssoc_Tgt/ErrP", - "RecoMuon_MuonAssoc_Tgt/ErrPt_vs_Eta_Sigma", - "RecoMuon_MuonAssoc_Tgt/ErrPt_vs_Pt_Sigma"}; - const char* plotst9[] = {"Tight Muon #Delta p_{T}/p_{T}", - "Tight Muon #Delta p/p", - "Tight Muon #Delta p_{T}/p_{T} vs #sigma(#eta)", - "Tight Muon #Delta p_{T}/p_{T} vs #sigma(p_{T})"}; + const char* plots9[] = {"RecoMuon_MuonAssoc_Tgt/ErrPt", + "RecoMuon_MuonAssoc_Tgt/ErrP", + "RecoMuon_MuonAssoc_Tgt/ErrPt_vs_Eta_Sigma", + "RecoMuon_MuonAssoc_Tgt/ErrPt_vs_Pt_Sigma"}; + const char* plotst9[] = {"Tight Muon #Delta p_{T}/p_{T}", + "Tight Muon #Delta p/p", + "Tight Muon #Delta p_{T}/p_{T} vs #sigma(#eta)", + "Tight Muon #Delta p_{T}/p_{T} vs #sigma(p_{T})"}; Plot4Histograms(newDir + "/muonRecoTgt", - rdir, sdir, - rcollname, scollname, - "RecHistosTgt", "Distributions for Tight Muons", - refLabel, newLabel, - plots9, plotst9, - logy, doKolmo, norm,resol,minx,maxx); - + rdir, + sdir, + rcollname, + scollname, + "RecHistosTgt", + "Distributions for Tight Muons", + refLabel, + newLabel, + plots9, + plotst9, + logy, + doKolmo, + norm, + resol, + minx, + maxx); - - //==== efficiencies and fractions Tight Muons - const char* plots10 [] = {"RecoMuon_MuonAssoc_Tgt/EffP", - "RecoMuon_MuonAssoc_Tgt/EffEta", - "RecoMuon_MuonAssoc_Tgt/FractP", - "RecoMuon_MuonAssoc_Tgt/FractEta"}; - const char* plotst10[] = {"Tight Muon #epsilon vs. p", - "Tight Muon #epsilon vs. #eta", - "Tight Muon fraction vs. p", - "Tight Muon fraction vs. #eta"}; + //==== efficiencies and fractions Tight Muons + const char* plots10[] = {"RecoMuon_MuonAssoc_Tgt/EffP", + "RecoMuon_MuonAssoc_Tgt/EffEta", + "RecoMuon_MuonAssoc_Tgt/FractP", + "RecoMuon_MuonAssoc_Tgt/FractEta"}; + const char* plotst10[] = {"Tight Muon #epsilon vs. p", + "Tight Muon #epsilon vs. #eta", + "Tight Muon fraction vs. p", + "Tight Muon fraction vs. #eta"}; Plot4Histograms(newDir + "/muonRecoTgtEff", - rdir, sdir, - rcollname, scollname, - "RecEffHistosTgt", "Distributions for Tight Muons, efficiencies and fractions", - refLabel, newLabel, - plots10, plotst10, - logy, doKolmo, norm2,resol,minx1,maxx1); - - - + rdir, + sdir, + rcollname, + scollname, + "RecEffHistosTgt", + "Distributions for Tight Muons, efficiencies and fractions", + refLabel, + newLabel, + plots10, + plotst10, + logy, + doKolmo, + norm2, + resol, + minx1, + maxx1); + // // Merge pdf histograms together into larger files, and name them based on the collection names // - TString mergefile = "merged_recomuonval.pdf"; // File name where partial pdfs will be merged - TString destfile = newDir + "/../" + myName + ".pdf"; // Destination file name - TString gscommand = "gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile="+ mergefile + " " - +newDir+"/muonRecoGlb.pdf " - +newDir+"/muonRecoGlbEff.pdf " - // +newDir+"/muonRecoGlbPF.pdf " - // +newDir+"/muonRecoGlbPFEff.pdf " - +newDir+"/muonRecoSta.pdf " - +newDir+"/muonRecoStaEff.pdf " - +newDir+"/muonRecoTrk.pdf " - +newDir+"/muonRecoTrkEff.pdf " - +newDir+"/muonRecoTgt.pdf " - +newDir+"/muonRecoTgtEff.pdf "; + TString mergefile = "merged_recomuonval.pdf"; // File name where partial pdfs will be merged + TString destfile = newDir + "/../" + myName + ".pdf"; // Destination file name + TString gscommand = "gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=" + mergefile + " " + newDir + + "/muonRecoGlb.pdf " + newDir + + "/muonRecoGlbEff.pdf " + // +newDir+"/muonRecoGlbPF.pdf " + // +newDir+"/muonRecoGlbPFEff.pdf " + + newDir + "/muonRecoSta.pdf " + newDir + "/muonRecoStaEff.pdf " + newDir + + "/muonRecoTrk.pdf " + newDir + "/muonRecoTrkEff.pdf " + newDir + "/muonRecoTgt.pdf " + newDir + + "/muonRecoTgtEff.pdf "; cout << ">> Merging partial pdfs to " << mergefile << "..." << endl; #ifdef DEBUG @@ -319,16 +383,16 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil cout << ">> Moving " << mergefile << " to " << destfile << "..." << endl; gSystem->Rename(mergefile, destfile); cout << " ... Done" << endl; - + cout << ">> Deleting partial pdf files" << endl; - gSystem->Exec("rm -r "+newDir+"/*.pdf"); - + gSystem->Exec("rm -r " + newDir + "/*.pdf"); + } // end of "while loop" - + cout << ">> Removing the relval files from ROOT before closing..." << endl; gROOT->GetListOfFiles()->Remove(sfile); gROOT->GetListOfFiles()->Remove(rfile); - + #ifdef DEBUG cout << "DEBUG: Exiting!" << endl; cerr << "DEBUG: Exiting!" << endl; diff --git a/Validation/RecoMuon/test/macro/RecoValHistoPublisher.C b/Validation/RecoMuon/test/macro/RecoValHistoPublisher.C index 392bb18f56453..ed2d3806b6f3a 100644 --- a/Validation/RecoMuon/test/macro/RecoValHistoPublisher.C +++ b/Validation/RecoMuon/test/macro/RecoValHistoPublisher.C @@ -6,32 +6,27 @@ // Uncomment the following line for some extra debug information // #define DEBUG -void RecoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="REF_FILE") { +void RecoValHistoPublisher(const char* newFile = "NEW_FILE", const char* refFile = "REF_FILE") { cout << ">> Starting RecoValHistoPublisher(" << newFile << "," << refFile << ")..." << endl; - //==== To be replaced from python ==================== - + //==== To be replaced from python3 ==================== + const char* dataType = "DATATYPE"; const char* refLabel("REF_LABEL, REF_RELEASE REFSELECTION"); const char* newLabel("NEW_LABEL, NEW_RELEASE NEWSELECTION"); - // ==== Initial settings and loads //gROOT->ProcessLine(".x HistoCompare_Tracks.C"); //gROOT ->Reset(); - gROOT ->SetBatch(); - gErrorIgnoreLevel = kWarning; // Get rid of the info messages + gROOT->SetBatch(); + gErrorIgnoreLevel = kWarning; // Get rid of the info messages - SetGlobalStyle(); - - // ==== Some cleaning... is this needed? + // ==== Some cleaning... is this needed? delete gROOT->GetListOfFiles()->FindObject(refFile); - delete gROOT->GetListOfFiles()->FindObject(newFile); + delete gROOT->GetListOfFiles()->FindObject(newFile); - - // ==== Opening files, moving to the right branch and getting the list of sub-branches cout << ">> Openning file, moving to the right branch and getting sub-branches..." << endl; @@ -43,10 +38,10 @@ void RecoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R cerr << "ERROR: Could not find keys!!!" << endl; return; } - TDirectory* sdir = gDirectory; + TDirectory* sdir = gDirectory; for (unsigned int i = 0; i < sl->GetEntries(); i++) cout << " + " << sl->At(i)->GetName() << endl; - + cout << ">> Finding references..." << endl; TFile* rfile = new TFile(refFile); TList* rl = getListOfBranches(dataType, rfile, "MuonRecoAnalyzer"); @@ -55,15 +50,14 @@ void RecoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R cerr << "ERROR: Could not find keys!!!" << endl; return; } - TDirectory* rdir = gDirectory; + TDirectory* rdir = gDirectory; for (unsigned int i = 0; i < sl->GetEntries(); i++) cout << " + " << sl->At(i)->GetName() << endl; - // Get the number of events for the normalization: TH1F *sevt, *revt; - sdir->GetObject("RecoMuonV/RecoMuon_MuonAssoc_Glb/NMuon",sevt); - rdir->GetObject("RecoMuonV/RecoMuon_MuonAssoc_Glb/NMuon",revt); + sdir->GetObject("RecoMuonV/RecoMuon_MuonAssoc_Glb/NMuon", sevt); + rdir->GetObject("RecoMuonV/RecoMuon_MuonAssoc_Glb/NMuon", revt); /* if (sevt && revt) { if (revt->GetEntries()>0) @@ -79,123 +73,174 @@ void RecoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R cout << "WARNING: Missing normalization histos!" << endl; } */ - Float_t maxPT; + Float_t maxPT; TString File = newFile; - if(File.Contains("SingleMuPt10")) {maxPT = 70.;} - else if (File.Contains("SingleMuPt100")) {maxPT = 400.;} - else if (File.Contains("SingleMuPt1000") ||File.Contains("WpM")||File.Contains("ZpMM") ) maxPT=1400.; else maxPT = 300.; + if (File.Contains("SingleMuPt10")) { + maxPT = 70.; + } else if (File.Contains("SingleMuPt100")) { + maxPT = 400.; + } else if (File.Contains("SingleMuPt1000") || File.Contains("WpM") || File.Contains("ZpMM")) + maxPT = 1400.; + else + maxPT = 300.; //==== Iterate now over histograms and collections cout << ">> Iterating over histograms and collections..." << endl; - TIter iter_r( rl ); - TIter iter_s( sl ); + TIter iter_r(rl); + TIter iter_s(sl); TKey* rKey = 0; TKey* sKey = 0; TString rcollname; TString scollname; - while ( (rKey = (TKey*)iter_r()) ) { + while ((rKey = (TKey*)iter_r())) { TString myName = rKey->GetName(); #ifdef DEBUG cout << "DEBUG: Checking key " << myName << endl; #endif rcollname = myName; sKey = (TKey*)iter_s(); - if (!sKey) continue; + if (!sKey) + continue; scollname = sKey->GetName(); - if ( (rcollname != scollname) && (rcollname+"FS" != scollname) && (rcollname != scollname+"FS") ) { + if ((rcollname != scollname) && (rcollname + "FS" != scollname) && (rcollname != scollname + "FS")) { cerr << "ERROR: Different collection names, please check: " << rcollname << " : " << scollname << endl; cout << "ERROR: Different collection names, please check: " << rcollname << " : " << scollname << endl; continue; } // ==== Now let's go for the plotting... - cout << ">> Comparing plots in " << myName << "..." << endl; - cerr << ">> Comparing plots in " << myName << "..." << endl; + cout << ">> Comparing plots in " << myName << "..." << endl; + cerr << ">> Comparing plots in " << myName << "..." << endl; TString newDir("NEW_RELEASE/NEWSELECTION/NEW_LABEL/"); - newDir+=myName; - gSystem->mkdir(newDir,kTRUE); - + newDir += myName; + gSystem->mkdir(newDir, kTRUE); + bool resolx = false; - bool *resol = &resolx; - bool logy [] = {false, false, false, false }; - bool doKolmo [] = {true, true, true, true }; - Double_t minx [] = {-1E100, -1E100, 5., -1E100, -1E100, -1E100 }; - Double_t maxx [] = {-1E100, -1E100,maxPT, -1E100, -1E100, -1E100 }; - Double_t snorm [] = {0.,0.,0.,0.,0.,0.}; + bool* resol = &resolx; + bool logy[] = {false, false, false, false}; + bool doKolmo[] = {true, true, true, true}; + Double_t minx[] = {-1E100, -1E100, 5., -1E100, -1E100, -1E100}; + Double_t maxx[] = {-1E100, -1E100, maxPT, -1E100, -1E100, -1E100}; + Double_t snorm[] = {0., 0., 0., 0., 0., 0.}; //===== reco muon distributions: GLB_GLB - const char* plots1 [] = {"GlbMuon_Glb_eta", "GlbMuon_Glb_phi", "GlbMuon_Glb_pt", "GlbMuon_Glb_chi2OverDf"}; - const char* plotst1 [] = {"GlobalMuon(GLB) #eta", "GlobalMuon(GLB) #phi", "GlobalMuon(GLB) pT", "GlobalMuon(GLB) #chi^{2}/ndf"}; + const char* plots1[] = {"GlbMuon_Glb_eta", "GlbMuon_Glb_phi", "GlbMuon_Glb_pt", "GlbMuon_Glb_chi2OverDf"}; + const char* plotst1[] = { + "GlobalMuon(GLB) #eta", "GlobalMuon(GLB) #phi", "GlobalMuon(GLB) pT", "GlobalMuon(GLB) #chi^{2}/ndf"}; Plot4Histograms(newDir + "/muonReco1", - rdir, sdir, - rcollname, scollname, - "RecoHistos1", "Distributions for GlobalMuons (GLB)", - refLabel, newLabel, - plots1, plotst1, - logy, doKolmo, snorm,resol, minx,maxx); - - + rdir, + sdir, + rcollname, + scollname, + "RecoHistos1", + "Distributions for GlobalMuons (GLB)", + refLabel, + newLabel, + plots1, + plotst1, + logy, + doKolmo, + snorm, + resol, + minx, + maxx); + //===== reco muon distributions: GLB_STA - const char* plots2 [] = {"GlbMuon_Sta_eta", "GlbMuon_Sta_phi", "GlbMuon_Sta_pt", "GlbMuon_Sta_chi2OverDf"}; - const char* plotst2 [] = {"GlobalMuon(STA) #eta", "GlobalMuon(STA) #phi", "GlobalMuon(STA) p_T", "GlobalMuon(STA) #chi^{2}/ndf"}; - Double_t minx1 [] = {-1E100,-1E100, 5., -1E100, -1E100 }; - Double_t maxx1 [] = {-1E100, -1E100,maxPT, -1E100, -1E100 }; + const char* plots2[] = {"GlbMuon_Sta_eta", "GlbMuon_Sta_phi", "GlbMuon_Sta_pt", "GlbMuon_Sta_chi2OverDf"}; + const char* plotst2[] = { + "GlobalMuon(STA) #eta", "GlobalMuon(STA) #phi", "GlobalMuon(STA) p_T", "GlobalMuon(STA) #chi^{2}/ndf"}; + Double_t minx1[] = {-1E100, -1E100, 5., -1E100, -1E100}; + Double_t maxx1[] = {-1E100, -1E100, maxPT, -1E100, -1E100}; Plot4Histograms(newDir + "/muonReco2", - rdir, sdir, - rcollname, scollname, - "RecoHistos2", "Distributions for GlobalMuons (STA)", - refLabel, newLabel, - plots2, plotst2, - logy, doKolmo, snorm,resol, minx1,maxx1); - - + rdir, + sdir, + rcollname, + scollname, + "RecoHistos2", + "Distributions for GlobalMuons (STA)", + refLabel, + newLabel, + plots2, + plotst2, + logy, + doKolmo, + snorm, + resol, + minx1, + maxx1); + //===== reco muon distributions: GLB_TK - const char* plots3 [] = {"GlbMuon_Tk_eta", "GlbMuon_Tk_phi", "GlbMuon_Tk_pt", "GlbMuon_Tk_chi2OverDf"}; - const char* plotst3 [] = {"GlobalMuon(TK) #eta", "GlobalMuon(TK) #phi", "GlobalMuon(TK) pT", "GlobalMuon(TK) #chi^{2}/ndf"}; + const char* plots3[] = {"GlbMuon_Tk_eta", "GlbMuon_Tk_phi", "GlbMuon_Tk_pt", "GlbMuon_Tk_chi2OverDf"}; + const char* plotst3[] = { + "GlobalMuon(TK) #eta", "GlobalMuon(TK) #phi", "GlobalMuon(TK) pT", "GlobalMuon(TK) #chi^{2}/ndf"}; Plot4Histograms(newDir + "/muonReco3", - rdir, sdir, - rcollname, scollname, - "RecoHistos3", "Distributions for GlobalMuons (TK)", - refLabel, newLabel, - plots3, plotst3, - logy, doKolmo, snorm,resol,minx1,maxx1); - - + rdir, + sdir, + rcollname, + scollname, + "RecoHistos3", + "Distributions for GlobalMuons (TK)", + refLabel, + newLabel, + plots3, + plotst3, + logy, + doKolmo, + snorm, + resol, + minx1, + maxx1); + //===== reco muon distributions: STA - const char* plots4 [] = {"StaMuon_eta", "StaMuon_phi", "StaMuon_pt", "StaMuon_chi2OverDf"}; - const char* plotst4 [] = {"StaMuon #eta", "StaMuon #phi", "StaMuon p_T", "StaMuon #chi^{2}/ndf"}; + const char* plots4[] = {"StaMuon_eta", "StaMuon_phi", "StaMuon_pt", "StaMuon_chi2OverDf"}; + const char* plotst4[] = {"StaMuon #eta", "StaMuon #phi", "StaMuon p_T", "StaMuon #chi^{2}/ndf"}; Plot4Histograms(newDir + "/muonReco4", - rdir, sdir, - rcollname, scollname, - "RecoHistos4", "Distributions for StandAlone Muons", - refLabel, newLabel, - plots4, plotst4, - logy, doKolmo, snorm,resol,minx1,maxx1); - - + rdir, + sdir, + rcollname, + scollname, + "RecoHistos4", + "Distributions for StandAlone Muons", + refLabel, + newLabel, + plots4, + plotst4, + logy, + doKolmo, + snorm, + resol, + minx1, + maxx1); + //===== reco muon distributions: Tracker Muons - const char* plots5 [] = {"TkMuon_eta", "TkMuon_phi", "TkMuon_pt", "TkMuon_chi2OverDf"}; - const char* plotst5 [] = {"TkMuon #eta", "TkMuon #phi", "TkMuon p_T", "TkMuon #chi^{2}/ndf"}; + const char* plots5[] = {"TkMuon_eta", "TkMuon_phi", "TkMuon_pt", "TkMuon_chi2OverDf"}; + const char* plotst5[] = {"TkMuon #eta", "TkMuon #phi", "TkMuon p_T", "TkMuon #chi^{2}/ndf"}; Plot4Histograms(newDir + "/muonReco5", - rdir, sdir, - rcollname, scollname, - "RecoHistos5", "Distributions for Tracker Muons", - refLabel, newLabel, - plots5, plotst5, - logy, doKolmo, snorm,resol,minx1,maxx1); - - + rdir, + sdir, + rcollname, + scollname, + "RecoHistos5", + "Distributions for Tracker Muons", + refLabel, + newLabel, + plots5, + plotst5, + logy, + doKolmo, + snorm, + resol, + minx1, + maxx1); + //// Merge pdf histograms together into larger files, and name them based on the collection names - TString mergefile = "merged_reco.pdf"; // File name where partial pdfs will be merged - TString destfile = newDir + "/../" + myName + ".pdf"; // Destination file name - TString gscommand = "gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile="+ mergefile + " " - +newDir+"/muonReco1.pdf " - +newDir+"/muonReco2.pdf " - +newDir+"/muonReco3.pdf " - +newDir+"/muonReco4.pdf " - +newDir+"/muonReco5.pdf "; + TString mergefile = "merged_reco.pdf"; // File name where partial pdfs will be merged + TString destfile = newDir + "/../" + myName + ".pdf"; // Destination file name + TString gscommand = "gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=" + mergefile + " " + newDir + + "/muonReco1.pdf " + newDir + "/muonReco2.pdf " + newDir + "/muonReco3.pdf " + newDir + + "/muonReco4.pdf " + newDir + "/muonReco5.pdf "; cout << ">> Merging partial pdfs to " << mergefile << "..." << endl; #ifdef DEBUG @@ -204,17 +249,17 @@ void RecoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R gSystem->Exec(gscommand); cout << ">> Moving " << mergefile << " to " << destfile << "..." << endl; gSystem->Rename(mergefile, destfile); - + cout << ">> Deleting partial pdf files" << endl; - gSystem->Exec("rm -r "+newDir+"/*.pdf"); + gSystem->Exec("rm -r " + newDir + "/*.pdf"); cout << " ... Done" << endl; - + } // end of "while loop" - + cout << ">> Removing the relval files from ROOT before closing..." << endl; gROOT->GetListOfFiles()->Remove(sfile); gROOT->GetListOfFiles()->Remove(rfile); - + #ifdef DEBUG cout << "DEBUG: Exiting!" << endl; cerr << "DEBUG: Exiting!" << endl; diff --git a/Validation/RecoMuon/test/macro/SeedValHistoPublisher.C b/Validation/RecoMuon/test/macro/SeedValHistoPublisher.C index 1e14cc19e186b..acfd0a6366395 100644 --- a/Validation/RecoMuon/test/macro/SeedValHistoPublisher.C +++ b/Validation/RecoMuon/test/macro/SeedValHistoPublisher.C @@ -3,39 +3,33 @@ #include "TMath.h" #include "macro/PlotHelpers.C" - //Uncomment the following line to get some more output //#define DEBUG 1 -void SeedValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="REF_FILE") { +void SeedValHistoPublisher(const char* newFile = "NEW_FILE", const char* refFile = "REF_FILE") { cout << ">> Starting SeedValHistoPublisher(" << newFile << "," << refFile << ")..." << endl; - //==== To be replaced from python ==================== - + //==== To be replaced from python3 ==================== + const char* dataType = "DATATYPE"; const char* refLabel("REF_LABEL, REF_RELEASE REFSELECTION"); const char* newLabel("NEW_LABEL, NEW_RELEASE NEWSELECTION"); - // ==== Initial settings and loads //gROOT->ProcessLine(".x HistoCompare_Tracks.C"); //gROOT ->Reset(); - gROOT ->SetBatch(); - gErrorIgnoreLevel = kWarning; // Get rid of the info messages + gROOT->SetBatch(); + gErrorIgnoreLevel = kWarning; // Get rid of the info messages - SetGlobalStyle(); - - // ==== Some cleaning... is this needed? + // ==== Some cleaning... is this needed? delete gROOT->GetListOfFiles()->FindObject(refFile); - delete gROOT->GetListOfFiles()->FindObject(newFile); - - + delete gROOT->GetListOfFiles()->FindObject(newFile); // ==== Opening files, moving to the right branch and getting the list of sub-branches cout << ">> Openning file, moving to the right branch and getting sub-branches..." << endl; - + cout << ">> Finding sources..." << endl; TFile* sfile = new TFile(newFile); TList* sl = getListOfBranches(dataType, sfile, "Seeds"); @@ -44,10 +38,10 @@ void SeedValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R cerr << "ERROR: Could not find keys!!!" << endl; return; } - TDirectory* sdir = gDirectory; + TDirectory* sdir = gDirectory; for (unsigned int i = 0; i < sl->GetEntries(); i++) cout << " + " << sl->At(i)->GetName() << endl; - + cout << ">> Finding references..." << endl; TFile* rfile = new TFile(refFile); TList* rl = getListOfBranches(dataType, rfile, "Seeds"); @@ -56,20 +50,15 @@ void SeedValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R cerr << "ERROR: Could not find keys!!!" << endl; return; } - TDirectory* rdir = gDirectory; + TDirectory* rdir = gDirectory; for (unsigned int i = 0; i < sl->GetEntries(); i++) cout << " + " << sl->At(i)->GetName() << endl; - - - - - //==== Get the number of events for the normalization: cout << ">> Find out number of events for normalization..." << endl; TH1F *sevt, *revt; - sdir->GetObject("RecoMuonV/RecoMuon_TrackAssoc/Muons/NMuon",sevt); - rdir->GetObject("RecoMuonV/RecoMuon_TrackAssoc/Muons/NMuon",revt); + sdir->GetObject("RecoMuonV/RecoMuon_TrackAssoc/Muons/NMuon", sevt); + rdir->GetObject("RecoMuonV/RecoMuon_TrackAssoc/Muons/NMuon", revt); /* if (sevt && revt) { if (revt->GetEntries()>0) @@ -84,39 +73,39 @@ void SeedValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R //==== Iterate now over histograms and collections cout << ">> Iterating over histograms and collections..." << endl; - TIter iter_r( rl ); - TIter iter_s( sl ); + TIter iter_r(rl); + TIter iter_s(sl); TKey* rKey = 0; TKey* sKey = 0; TString rcollname; TString scollname; - while ( (rKey = (TKey*)iter_r()) ) { + while ((rKey = (TKey*)iter_r())) { TString myName = rKey->GetName(); #ifdef DEBUG cout << "DEBUG: Checking key " << myName << endl; #endif rcollname = myName; sKey = (TKey*)iter_s(); - if (!sKey) continue; + if (!sKey) + continue; scollname = sKey->GetName(); - if ( (rcollname != scollname) && (rcollname+"FS" != scollname) && (rcollname != scollname+"FS") ) { + if ((rcollname != scollname) && (rcollname + "FS" != scollname) && (rcollname != scollname + "FS")) { cerr << "ERROR: Different collection names, please check: " << rcollname << " : " << scollname << endl; cout << "ERROR: Different collection names, please check: " << rcollname << " : " << scollname << endl; continue; } - + // ==== Now let's go for the plotting... - cout << ">> Comparing plots in " << myName << "..." << endl; - cerr << ">> Comparing plots in " << myName << "..." << endl; + cout << ">> Comparing plots in " << myName << "..." << endl; + cerr << ">> Comparing plots in " << myName << "..." << endl; TString newDir("NEW_RELEASE/NEWSELECTION/NEW_LABEL/"); - newDir+=myName; - gSystem->mkdir(newDir,kTRUE); + newDir += myName; + gSystem->mkdir(newDir, kTRUE); - - bool logy [] = {false, true, false, true }; - bool doKolmo [] = {true, true, true, true }; - Double_t norm [] = {0.,0.,0.,0.,0.,0.}; + bool logy[] = {false, true, false, true}; + bool doKolmo[] = {true, true, true, true}; + Double_t norm[] = {0., 0., 0., 0., 0., 0.}; /* const char* plots [] = {"", "", "", ""}; const char* plotsl[] = {"", "", "", ""}; @@ -130,23 +119,29 @@ void SeedValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R */ //===== muon seeds plots, first page: - const char* plots1 [] = {"seedEta_", "seedEtaErr_", "seedPhi_", "seedPhiErr_"}; + const char* plots1[] = {"seedEta_", "seedEtaErr_", "seedPhi_", "seedPhiErr_"}; const char* plotsl1[] = {"seed #eta", "seed #eta error", "seed #phi", "seed #phi error"}; Plot4Histograms(newDir + "/muonSeed1", - rdir, sdir, - rcollname, scollname, - "Seeds1", "Seeds eta and phi", - refLabel, newLabel, - plots1, plotsl1, - logy, doKolmo, norm); - + rdir, + sdir, + rcollname, + scollname, + "Seeds1", + "Seeds eta and phi", + refLabel, + newLabel, + plots1, + plotsl1, + logy, + doKolmo, + norm); // ====== muon seeds plots, second page: // NOTE: Originally in one page, now split in two pages // const char* plots2 [] = {"seedPt_", "seedPtErrOverPt_", "seedPz_", "seedPzErrOverPz_"}; // const char* plotsl2[] = {"seed P_{T}", "seed P_{T} Err/P_{T}", "seed P_{Z}", "seed P_{Z} Err/P_{Z}"}; // Plot4Histograms(newDir + "/muonSeed2", - // rdir, sdir, + // rdir, sdir, // rcollname, scollname, // "Seeds2", "Seeds momenta", // refLabel, newLabel, @@ -156,35 +151,44 @@ void SeedValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R // const char* plots3 [] = {"NumberOfRecHitsPerSeed_", "seedPErrOverP_", "", ""}; // const char* plotsl3[] = {"Nr RecHits per seed", "seed P Err/P", "", ""}; // Plot4Histograms(newDir + "/muonSeed3", - // rdir, sdir, + // rdir, sdir, // rcollname, scollname, // "Seeds3", "Seeds hits and momentum", // refLabel, newLabel, // plots3, plotsl3, // logy, doKolmo); - - bool logy2 [] = {false, true, false, true, false, true}; - bool doKolmo2[] = {true, true, true, true, true, true}; - const char* plots2 [] = {"seedPt_", "seedPtErrOverPt_", "seedPz_", "seedPzErrOverPz_", - "NumberOfRecHitsPerSeed_", "seedPErrOverP_"}; - const char* plotsl2 [] = {"seed P_{T}", "seed P_{T} Err/P_{T}", "seed P_{Z}", "seed P_{Z} Err/P_{Z}", - "Nr RecHits per seed", "seed P Err/P"}; + + bool logy2[] = {false, true, false, true, false, true}; + bool doKolmo2[] = {true, true, true, true, true, true}; + const char* plots2[] = { + "seedPt_", "seedPtErrOverPt_", "seedPz_", "seedPzErrOverPz_", "NumberOfRecHitsPerSeed_", "seedPErrOverP_"}; + const char* plotsl2[] = {"seed P_{T}", + "seed P_{T} Err/P_{T}", + "seed P_{Z}", + "seed P_{Z} Err/P_{Z}", + "Nr RecHits per seed", + "seed P Err/P"}; Plot6Histograms(newDir + "/muonSeed2", - rdir, sdir, - rcollname, scollname, - "Seeds2", "Seeds momenta and hits", - refLabel, newLabel, - plots2, plotsl2, - logy2, doKolmo2, norm); - - + rdir, + sdir, + rcollname, + scollname, + "Seeds2", + "Seeds momenta and hits", + refLabel, + newLabel, + plots2, + plotsl2, + logy2, + doKolmo2, + norm); + //// Merge pdf histograms together into larger files, and name them based on the collection names - TString mergefile = "merged_seed.pdf"; // File name where partial pdfs will be merged - TString destfile = newDir + "/../" + myName + ".pdf"; // Destination file name - TString gscommand = "gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=" + mergefile + " " - + newDir + "/muonSeed1.pdf " - + newDir + "/muonSeed2.pdf "; - // + newDir + "/muonSeed3.pdf "; + TString mergefile = "merged_seed.pdf"; // File name where partial pdfs will be merged + TString destfile = newDir + "/../" + myName + ".pdf"; // Destination file name + TString gscommand = "gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=" + mergefile + " " + newDir + + "/muonSeed1.pdf " + newDir + "/muonSeed2.pdf "; + // + newDir + "/muonSeed3.pdf "; cout << ">> Merging partial pdfs to " << mergefile << "..." << endl; #ifdef DEBUG cout << "DEBUG: ...with command \"" << gscommand << "\"" << endl; @@ -192,13 +196,13 @@ void SeedValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R gSystem->Exec(gscommand); cout << ">> Moving " << mergefile << " to " << destfile << "..." << endl; gSystem->Rename(mergefile, destfile); - + cout << ">> Deleting partial pdf files" << endl; - gSystem->Exec("rm -r "+newDir+"/*.pdf"); + gSystem->Exec("rm -r " + newDir + "/*.pdf"); cout << " ... Done" << endl; - + } // end of "while loop" - + cout << ">> Removing the relval files from ROOT before closing..." << endl; gROOT->GetListOfFiles()->Remove(sfile); gROOT->GetListOfFiles()->Remove(rfile); diff --git a/Validation/RecoMuon/test/macro/TrackValHistoPublisher.C b/Validation/RecoMuon/test/macro/TrackValHistoPublisher.C index 2fac61fc73bbe..3d6a1554b9a7a 100644 --- a/Validation/RecoMuon/test/macro/TrackValHistoPublisher.C +++ b/Validation/RecoMuon/test/macro/TrackValHistoPublisher.C @@ -3,113 +3,101 @@ #include "TMath.h" #include "macro/PlotHelpers.C" - //Uncomment the following line to get some more output //#define DEBUG 1 TList* GetListOfBranches(const char* dataType, TFile* file) { if (TString(dataType) == "HLT") { - if(file->cd("DQMData/Run 1/HLT")) + if (file->cd("DQMData/Run 1/HLT")) file->cd("DQMData/Run 1/HLT/Run summary/Muon/MultiTrack"); - else + else file->cd("DQMData/HLT/Muon/MultiTrack"); - } - else if (TString(dataType) == "RECO") { - if(file->cd("DQMData/Run 1/RecoMuonV")) + } else if (TString(dataType) == "RECO") { + if (file->cd("DQMData/Run 1/RecoMuonV")) file->cd("DQMData/Run 1/RecoMuonV/Run summary/MultiTrack"); - else if(file->cd("DQMData/Run 1/Muons/Run summary/RecoMuonV")) + else if (file->cd("DQMData/Run 1/Muons/Run summary/RecoMuonV")) file->cd("DQMData/Run 1/Muons/Run summary/RecoMuonV/MultiTrack"); - else + else file->cd("DQMData/RecoMuonV/MultiTrack"); - } - else { + } else { cout << "ERROR: Data type " << dataType << " not allowed: only RECO and HLT are considered" << endl; return 0; } - TDirectory * dir=gDirectory; + TDirectory* dir = gDirectory; TList* sl = GetListOfDirectories(dir); - + if (sl->GetSize() == 0) { cout << "ERROR: No DQM muon reco histos found in NEW file " << endl; delete sl; return 0; } - + return sl; } +void TrackValHistoPublisher(const char* newFile = "NEW_FILE", const char* refFile = "REF_FILE") { + cout << ">> Starting TrackValHistoPublisher(" << newFile << "," << refFile << ")..." << endl; + //==== To be replaced from python3 ==================== -void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="REF_FILE") { - - cout << ">> Starting TrackValHistoPublisher(" - << newFile << "," << refFile << ")..." << endl; - - //==== To be replaced from python ==================== - const char* dataType = "DATATYPE"; const char* refLabel("REF_LABEL, REF_RELEASE REFSELECTION"); const char* newLabel("NEW_LABEL, NEW_RELEASE NEWSELECTION"); - // ==== Initial settings and loads //gROOT->ProcessLine(".x HistoCompare_Tracks.C"); //gROOT ->Reset(); - gROOT ->SetBatch(); - gErrorIgnoreLevel = kWarning; // Get rid of the info messages + gROOT->SetBatch(); + gErrorIgnoreLevel = kWarning; // Get rid of the info messages - SetGlobalStyle(); Float_t maxPT; TString File = newFile; - if (File.Contains("SingleMuPt1000") ||File.Contains("WpM")||File.Contains("ZpMM") ) maxPT=1400.; - else if (File.Contains("SingleMuPt100")) {maxPT = 400.;} - else if(File.Contains("SingleMuPt10")) {maxPT = 70.;} - else maxPT = 400.; + if (File.Contains("SingleMuPt1000") || File.Contains("WpM") || File.Contains("ZpMM")) + maxPT = 1400.; + else if (File.Contains("SingleMuPt100")) { + maxPT = 400.; + } else if (File.Contains("SingleMuPt10")) { + maxPT = 70.; + } else + maxPT = 400.; - bool ctf=1; + bool ctf = 1; bool resol = false; - // ==== Some cleaning... is this needed? + // ==== Some cleaning... is this needed? delete gROOT->GetListOfFiles()->FindObject(refFile); - delete gROOT->GetListOfFiles()->FindObject(newFile); - - + delete gROOT->GetListOfFiles()->FindObject(newFile); // ==== Opening files, moving to the right branch and getting the list of sub-branches cout << ">> Openning file, moving to the right branch and getting sub-branches..." << endl; cout << ">> Finding sources..." << endl; - TFile * sfile = new TFile(newFile); + TFile* sfile = new TFile(newFile); TList* sl = GetListOfBranches(dataType, sfile); if (!sl) { cout << "ERROR: Could not find keys!!!" << endl; cerr << "ERROR: Could not find keys!!!" << endl; return; } - TDirectory* sdir = gDirectory; + TDirectory* sdir = gDirectory; for (unsigned int i = 0; i < sl->GetEntries(); i++) cout << " + " << sl->At(i)->GetName() << endl; cout << ">> Finding references..." << endl; - TFile * rfile = new TFile(refFile); + TFile* rfile = new TFile(refFile); TList* rl = GetListOfBranches(dataType, rfile); if (!rl) { cout << "ERROR: Could not find keys!!!" << endl; cerr << "ERROR: Could not find keys!!!" << endl; return; } - TDirectory* rdir = gDirectory; + TDirectory* rdir = gDirectory; for (unsigned int i = 0; i < sl->GetEntries(); i++) cout << " + " << sl->At(i)->GetName() << endl; - - - - - //==== Find if the collection has muon associator or track associator cout << ">> Find if the collection has muon associator or track associator..." << endl; @@ -117,11 +105,11 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" bool hasOnlyMuonAssociatorInSig = true; bool hasOnlyTrackAssociatorInRef = true; bool hasOnlyTrackAssociatorInSig = true; - TIter iter_r0( rl ); - TIter iter_s0( sl ); + TIter iter_r0(rl); + TIter iter_s0(sl); TKey* rKey = 0; TKey* sKey = 0; - + /*while ( (rKey = (TKey*)iter_r0()) ) { TString myName = rKey->GetName(); if ( !(myName.Contains("TkAsso")) && !(myName.Contains("MuonAssociation")) ) { @@ -149,19 +137,17 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" cout << " + Has Only Track Associator (reference): " << hasOnlyTrackAssociatorInRef << endl; cout << " + Has Only Track Associator (signal): " << hasOnlyTrackAssociatorInSig << endl; cout << " + Consider only Muon Associator: " << considerOnlyMuonAssociator << endl; - - //==== Iterate now over histograms and collections cout << ">> Iterating over histograms and collections..." << endl; - TIter iter_r( rl ); - TIter iter_s( sl ); + TIter iter_r(rl); + TIter iter_s(sl); TString scollname; TString rcollname; - - TKey *myNext2=0; - while ( (rKey = (TKey*)iter_r()) ) { + + TKey* myNext2 = 0; + while ((rKey = (TKey*)iter_r())) { TString myName = rKey->GetName(); #ifdef DEBUG cout << "DEBUG: Checking key " << myName << endl; @@ -185,299 +171,381 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" if (myNext2) { sKey = myNext2; myNext2 = 0; - } - else { + } else { sKey = (TKey*)iter_s(); } - if (!sKey) continue; + if (!sKey) + continue; TString myName2 = sKey->GetName(); /* this was thought for when there are different names */ if (myName2 != myName) { - myNext2 = (TKey*)iter_s(); - TKey* myTemp = sKey; + myNext2 = (TKey*)iter_s(); + TKey* myTemp = sKey; sKey = myNext2; myName2 = sKey->GetName(); myNext2 = myTemp; - if(myName2 != myName) - {myNext2 = (TKey*)iter_s(); - TKey* myTemp = sKey; - sKey = myNext2; - myName2 = sKey->GetName(); - myNext2 = myTemp; - } + if (myName2 != myName) { + myNext2 = (TKey*)iter_s(); + TKey* myTemp = sKey; + sKey = myNext2; + myName2 = sKey->GetName(); + myNext2 = myTemp; + } } - - scollname=myName2; + + scollname = myName2; #ifdef DEBUG cout << "DEBUG: Comparing " << rcollname << " and " << scollname << endl; #endif - if ( - (myName == myName2) || (myName+"FS" == myName2) || (myName == myName2+"FS" ) - || (myName.Contains("extractedGlobalMuons") && myName2.Contains("globalMuons") ) - || (myName.Contains("globalMuons") && myName2.Contains("extractedGlobalMuons") ) - ) { + if ((myName == myName2) || (myName + "FS" == myName2) || (myName == myName2 + "FS") || + (myName.Contains("extractedGlobalMuons") && myName2.Contains("globalMuons")) || + (myName.Contains("globalMuons") && myName2.Contains("extractedGlobalMuons"))) { rcollname = rKey->GetName(); scollname = sKey->GetName(); - } - else if ( (rcollname != scollname) && (rcollname+"FS" != scollname) && (rcollname != scollname+"FS") ) { + } else if ((rcollname != scollname) && (rcollname + "FS" != scollname) && (rcollname != scollname + "FS")) { bool goodAsWell = false; - if (rcollname.BeginsWith("StandAloneMuons_UpdAtVtx") && - scollname.BeginsWith("StandAloneMuons_UpdAtVtx")) { - if (rcollname.Contains("MuonAssociation")==scollname.Contains("MuonAssociation")){} - goodAsWell = true; + if (rcollname.BeginsWith("StandAloneMuons_UpdAtVtx") && scollname.BeginsWith("StandAloneMuons_UpdAtVtx")) { + if (rcollname.Contains("MuonAssociation") == scollname.Contains("MuonAssociation")) { + } + goodAsWell = true; } - if (rcollname.BeginsWith("hltL2Muons_UpdAtVtx") && - scollname.BeginsWith("hltL2Muons_UpdAtVtx")) { - if (rcollname.Contains("MuonAssociation")==scollname.Contains("MuonAssociation")){} - goodAsWell = true; + if (rcollname.BeginsWith("hltL2Muons_UpdAtVtx") && scollname.BeginsWith("hltL2Muons_UpdAtVtx")) { + if (rcollname.Contains("MuonAssociation") == scollname.Contains("MuonAssociation")) { + } + goodAsWell = true; } if (rcollname.BeginsWith("hltL3Tk") && scollname.BeginsWith("hltL3Tk")) { - if (rcollname.Contains("MuonAssociation")==scollname.Contains("MuonAssociation")){} - goodAsWell = true; + if (rcollname.Contains("MuonAssociation") == scollname.Contains("MuonAssociation")) { + } + goodAsWell = true; } // TString isGood = (goodAsWell? "good": "NOT good"); // cout << " -- The two collections: " << rcollname << " : " << scollname << " -> " << isGood << endl; - if (! goodAsWell) { - - if (rcollname.Contains("SET") && !scollname.Contains("SET")) { - while (rcollname.Contains("SET")) { - if ((rKey = (TKey*)iter_r())) rcollname = rKey->GetName(); - } - } - else if (scollname.Contains("SET") && !rcollname.Contains("SET")) { - while (scollname.Contains("SET")) { - if ((sKey = (TKey*)iter_s())) scollname = sKey->GetName(); - } - } - - if (rcollname.Contains("dyt") && !scollname.Contains("dyt")) { - while (rcollname.Contains("dyt")) { - if ((rKey = (TKey*)iter_r())) rcollname = rKey->GetName(); - } - } - else if (scollname.Contains("dyt") && !rcollname.Contains("dyt")) { - while (scollname.Contains("dyt")) { - if ((sKey = (TKey*)iter_s())) scollname = sKey->GetName(); - } - } - - if (rcollname.Contains("refitted") && !scollname.Contains("refitted")) { - while (rcollname.Contains("refitted")) { - if ((rKey = (TKey*)iter_r())) rcollname = rKey->GetName(); - } - } - else if (scollname.Contains("refitted") && !rcollname.Contains("refitted")) { - while (scollname.Contains("refitted")) { - if ((sKey = (TKey*)iter_s())) scollname = sKey->GetName(); - } - } - - if ( (rcollname != scollname) && - (rcollname+"FS" != scollname) && - (rcollname != scollname+"FS") ) { - cout << " Different collection names, please check: " << rcollname - << " : " << scollname << endl; - continue; - } - else { - // cout << " The NEW collections: " << rcollname << " : " << scollname << endl; - myName = rKey->GetName(); - } + if (!goodAsWell) { + if (rcollname.Contains("SET") && !scollname.Contains("SET")) { + while (rcollname.Contains("SET")) { + if ((rKey = (TKey*)iter_r())) + rcollname = rKey->GetName(); + } + } else if (scollname.Contains("SET") && !rcollname.Contains("SET")) { + while (scollname.Contains("SET")) { + if ((sKey = (TKey*)iter_s())) + scollname = sKey->GetName(); + } + } + + if (rcollname.Contains("dyt") && !scollname.Contains("dyt")) { + while (rcollname.Contains("dyt")) { + if ((rKey = (TKey*)iter_r())) + rcollname = rKey->GetName(); + } + } else if (scollname.Contains("dyt") && !rcollname.Contains("dyt")) { + while (scollname.Contains("dyt")) { + if ((sKey = (TKey*)iter_s())) + scollname = sKey->GetName(); + } + } + + if (rcollname.Contains("refitted") && !scollname.Contains("refitted")) { + while (rcollname.Contains("refitted")) { + if ((rKey = (TKey*)iter_r())) + rcollname = rKey->GetName(); + } + } else if (scollname.Contains("refitted") && !rcollname.Contains("refitted")) { + while (scollname.Contains("refitted")) { + if ((sKey = (TKey*)iter_s())) + scollname = sKey->GetName(); + } + } + + if ((rcollname != scollname) && (rcollname + "FS" != scollname) && (rcollname != scollname + "FS")) { + cout << " Different collection names, please check: " << rcollname << " : " << scollname << endl; + continue; + } else { + // cout << " The NEW collections: " << rcollname << " : " << scollname << endl; + myName = rKey->GetName(); + } } } // ==== Now let's go for the plotting... - // cout << ">> Comparing plots in " << myName << "..." << endl; - //cerr << ">> Comparing plots in " << myName << "..." << endl; + // cout << ">> Comparing plots in " << myName << "..." << endl; + //cerr << ">> Comparing plots in " << myName << "..." << endl; TString newDir("NEW_RELEASE/NEWSELECTION/NEW_LABEL/"); - newDir+=myName; - gSystem->mkdir(newDir,kTRUE); - - bool logyfalse [] = {false, false, false, false, false, false }; - bool doKolmo [] = {true, true, true, true, true, true }; - Double_t norm [] = {-999.,-999.,-999.,-999.,-999.,-999.}; - Double_t minx [] = {-1E100, -1E100, 5., 5., -1E100, -1E100 }; - Double_t maxx [] = {-1E100, -1E100, maxPT, maxPT, -1E100, -1E100 }; - Double_t miny [] = {0.5, -1E100, 0, -1E100, 0.5, -1E100 }; - Double_t maxy [] = {1.0125, -1E100, 1.025, -1E100, 1.0125, -1E100 }; + newDir += myName; + gSystem->mkdir(newDir, kTRUE); + + bool logyfalse[] = {false, false, false, false, false, false}; + bool doKolmo[] = {true, true, true, true, true, true}; + Double_t norm[] = {-999., -999., -999., -999., -999., -999.}; + Double_t minx[] = {-1E100, -1E100, 5., 5., -1E100, -1E100}; + Double_t maxx[] = {-1E100, -1E100, maxPT, maxPT, -1E100, -1E100}; + Double_t miny[] = {0.5, -1E100, 0, -1E100, 0.5, -1E100}; + Double_t maxy[] = {1.0125, -1E100, 1.025, -1E100, 1.0125, -1E100}; ////////////////////////////////////// /////////// CTF ////////////////////// ////////////////////////////////////// - if (ctf) { //===== building - - const char* plots0[] = {"effic", "fakerate", "efficPt", "fakeratePt"}; + + const char* plots0[] = {"effic", "fakerate", "efficPt", "fakeratePt"}; const char* plotsl0[] = {"efficiency vs #eta", "fakerate vs #eta", "efficiency vs Pt", "fakerate vs Pt"}; - bool logy0 [] = {false, false, false, false }; + bool logy0[] = {false, false, false, false}; Plot4Histograms(newDir + "/building", - rdir, sdir, - rcollname, scollname, - "Seeds", "Efficiency Vs Pt and Vs #eta", - refLabel, newLabel, - plots0, plotsl0, - logy0, doKolmo, norm,0,minx,maxx,miny,maxy); - cout<<"HICE EL HISTO "<> Merging partial pdfs to " << mergefile << "..." << endl; #ifdef DEBUG cout << "DEBUG: ...with command \"" << gscommand << "\"" << endl; @@ -487,10 +555,10 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" gSystem->Rename(mergefile, destfile); cout << ">> Deleting partial pdf files" << endl; - gSystem->Exec("rm -rf "+newDir+"/*.pdf"); + gSystem->Exec("rm -rf " + newDir + "/*.pdf"); cout << " ... Done" << endl; } // end of "while loop" - + cout << ">> Removing the relval files from ROOT before closing..." << endl; gROOT->GetListOfFiles()->Remove(sfile); gROOT->GetListOfFiles()->Remove(rfile); @@ -500,4 +568,3 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" cerr << "DEBUG: Exiting!" << endl; #endif } - diff --git a/Validation/RecoMuon/test/macro/new_TrackValHistoPublisher.C b/Validation/RecoMuon/test/macro/new_TrackValHistoPublisher.C index 0a1fdc66c3856..b83286b26e457 100644 --- a/Validation/RecoMuon/test/macro/new_TrackValHistoPublisher.C +++ b/Validation/RecoMuon/test/macro/new_TrackValHistoPublisher.C @@ -9,34 +9,39 @@ bool DEBUG = false; TList* GetListOfBranches(const char* dataType, TFile* file) { if (TString(dataType) == "HLT") { file->cd("DQMData/Run 1/HLT/Run summary/Muon/MuonTrack"); - } - else if (TString(dataType) == "RECO") { + } else if (TString(dataType) == "RECO") { file->cd("DQMData/Run 1/Muons/Run summary/RecoMuonV/MuonTrack"); - } - else { + } else { cout << "ERROR: Data type " << dataType << " not allowed: only RECO and HLT are considered" << endl; cerr << "ERROR: Data type " << dataType << " not allowed: only RECO and HLT are considered" << endl; return 0; } - TDirectory * dir=gDirectory; + TDirectory* dir = gDirectory; TList* sl = GetListOfDirectories(dir); - + if (sl->GetSize() == 0) { cout << "ERROR: No DQM muon reco histos found in NEW file " << endl; cerr << "ERROR: No DQM muon reco histos found in NEW file " << endl; delete sl; return 0; } - + return sl; } -void plotOptReset(bool logx[6], bool logy[6], bool doKolmo[6], Double_t norm[6], - Double_t minx[6], Double_t maxx[6], Double_t miny[6], Double_t maxy[6], const char* drawopt[6], - TString plots[6], TString titles[6]) { - - for(int i=0; i<6; ++i) { +void plotOptReset(bool logx[6], + bool logy[6], + bool doKolmo[6], + Double_t norm[6], + Double_t minx[6], + Double_t maxx[6], + Double_t miny[6], + Double_t maxy[6], + const char* drawopt[6], + TString plots[6], + TString titles[6]) { + for (int i = 0; i < 6; ++i) { logx[i] = false; logy[i] = false; doKolmo[i] = true; @@ -46,37 +51,34 @@ void plotOptReset(bool logx[6], bool logy[6], bool doKolmo[6], Double_t norm[6], miny[i] = 0; maxy[i] = 0; drawopt[i] = ""; - plots[i] = ""; - titles[i] = ""; + plots[i] = ""; + titles[i] = ""; } } -void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="REF_FILE") { +void new_TrackValHistoPublisher(const char* newFile = "NEW_FILE", const char* refFile = "REF_FILE") { + cout << ">> Starting new_TrackValHistoPublisher(" << newFile << "," << refFile << ")..." << endl; - cout << ">> Starting new_TrackValHistoPublisher(" - << newFile << "," << refFile << ")..." << endl; + //==== To be replaced from python3 ==================== - //==== To be replaced from python ==================== - const char* dataType = "DATATYPE"; const char* refLabel("REF_LABEL, REF_RELEASE REFSELECTION"); const char* newLabel("NEW_LABEL, NEW_RELEASE NEWSELECTION"); - // ==== Initial settings and loads - gROOT ->SetBatch(); - gErrorIgnoreLevel = kWarning; // Get rid of the info messages + gROOT->SetBatch(); + gErrorIgnoreLevel = kWarning; // Get rid of the info messages SetGlobalStyle(); - // ==== Some cleaning... is this needed? + // ==== Some cleaning... is this needed? delete gROOT->GetListOfFiles()->FindObject(refFile); - delete gROOT->GetListOfFiles()->FindObject(newFile); - + delete gROOT->GetListOfFiles()->FindObject(newFile); + // ==== Opening files, moving to the right branch and getting the list of sub-branches cout << ">> Opening files, moving to the right branch and getting the list of sub-branches..." << endl; cout << ">> Finding new DQM file ..." << endl; - TFile * sfile = new TFile(newFile); + TFile* sfile = new TFile(newFile); TList* sl = GetListOfBranches(dataType, sfile); if (!sl) { @@ -84,15 +86,15 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi cerr << "ERROR: Could not find keys!!!" << endl; return; } - TDirectory* sdir = gDirectory; + TDirectory* sdir = gDirectory; if (DEBUG) { for (unsigned int i = 0; i < sl->GetEntries(); i++) cout << " + " << sl->At(i)->GetName() << endl; } - + cout << ">> Finding reference DQM file ..." << endl; - TFile * rfile = new TFile(refFile); + TFile* rfile = new TFile(refFile); TList* rl = GetListOfBranches(dataType, rfile); if (!rl) { @@ -100,7 +102,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi cerr << "ERROR: Could not find keys!!!" << endl; return; } - TDirectory* rdir = gDirectory; + TDirectory* rdir = gDirectory; if (DEBUG) { for (unsigned int i = 0; i < rl->GetEntries(); i++) @@ -110,31 +112,32 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi //==== Iterate now over histograms and collections cout << ">> Iterating over histograms and collections..." << endl; - bool logy[6] = {false, false, false, false, false, false }; - bool logx[6] = {false, false, false, false, false, false }; - bool doKolmo[6] = {true, true, true, true, true, true }; - Double_t norm[6] = {-1.,-1.,-1.,-1.,-1.,-1.}; // initial default: do not normalize + bool logy[6] = {false, false, false, false, false, false}; + bool logx[6] = {false, false, false, false, false, false}; + bool doKolmo[6] = {true, true, true, true, true, true}; + Double_t norm[6] = {-1., -1., -1., -1., -1., -1.}; // initial default: do not normalize Double_t minx[6] = {0, 0, 0, 0, 0, 0}; Double_t maxx[6] = {0, 0, 0, 0, 0, 0}; Double_t miny[6] = {0, 0, 0, 0, 0, 0}; Double_t maxy[6] = {0, 0, 0, 0, 0, 0}; const char* drawopt[6] = {"", "", "", "", "", ""}; - TString plots[6] = {"", "", "", "", "", ""}; - TString titles[6] = {"", "", "", "", "", ""}; + TString plots[6] = {"", "", "", "", "", ""}; + TString titles[6] = {"", "", "", "", "", ""}; TString rcollname; TString scollname; - TIter iter_r( rl ); - TIter iter_s( sl ); + TIter iter_r(rl); + TIter iter_s(sl); TString newDirBase("NEW_RELEASE/NEWSELECTION/NEW_LABEL/"); TKey* rKey = 0; // before CMSSW_10_1_0_pre1 a few collection names were different bool NEWcollNames = false; TString Ref_CMSSW_Release("REF_RELEASE"); - if (Ref_CMSSW_Release.Contains("CMSSW_9") || Ref_CMSSW_Release.Contains("CMSSW_10_0")) NEWcollNames=true; + if (Ref_CMSSW_Release.Contains("CMSSW_9") || Ref_CMSSW_Release.Contains("CMSSW_10_0")) + NEWcollNames = true; - while ( (rKey = (TKey*)iter_r()) ) { + while ((rKey = (TKey*)iter_r())) { TString myName = rKey->GetName(); rcollname = myName; if (DEBUG) { @@ -144,386 +147,553 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi TString myName2 = myName; if (NEWcollNames) { - if (myName=="NEWprobeTrks") myName2="probeTrks"; - else if (myName=="NEWprobeTrks_TkAsso") myName2="probeTrks_TkAsso"; - else if (myName=="NEWseedsOfSTAmuons") myName2="seedsOfSTAmuons"; - else if (myName=="NEWseedsOfDisplacedSTAmuons") myName2="seedsOfDisplacedSTAmuons"; - else if (myName=="NEWcutsRecoTrkMuons") myName2="cutsRecoTrkMuons"; - else if (myName=="NEWextractGemMuons") myName2="extractGemMuons"; - else if (myName=="NEWextractMe0Muons") myName2="extractMe0Muons"; + if (myName == "NEWprobeTrks") + myName2 = "probeTrks"; + else if (myName == "NEWprobeTrks_TkAsso") + myName2 = "probeTrks_TkAsso"; + else if (myName == "NEWseedsOfSTAmuons") + myName2 = "seedsOfSTAmuons"; + else if (myName == "NEWseedsOfDisplacedSTAmuons") + myName2 = "seedsOfDisplacedSTAmuons"; + else if (myName == "NEWcutsRecoTrkMuons") + myName2 = "cutsRecoTrkMuons"; + else if (myName == "NEWextractGemMuons") + myName2 = "extractGemMuons"; + else if (myName == "NEWextractMe0Muons") + myName2 = "extractMe0Muons"; } scollname = myName2; - + if (DEBUG) { cout << " Comparing " << rcollname << " and " << scollname << endl; cerr << " Comparing " << rcollname << " and " << scollname << endl; } // ==== Now let's go for the plotting... - TString newDir = newDirBase+myName2; - cout<<"creating directory: "<mkdir(newDir,kTRUE); - + TString newDir = newDirBase + myName2; + cout << "creating directory: " << newDir << endl; + gSystem->mkdir(newDir, kTRUE); + // efficiency and fake rate Vs eta and phi - plotOptReset(logx,logy,doKolmo,norm,minx,maxx,miny,maxy,drawopt,plots,titles); - plots[0]="effic_vs_eta" ; titles[0]="Efficiency vs #eta"; - plots[1]="fakerate_vs_eta" ; titles[1]="Fake rate vs #eta" ; - plots[2]="effic_vs_phi" ; titles[2]="Efficiency vs #phi" ; - plots[3]="fakerate_vs_phi" ; titles[3]="Fake rate vs #phi" ; - - miny[0]=-0.0001; - miny[1]=-0.0001; - miny[2]=-0.0001; - miny[3]=-0.0001; - - maxy[0]=1.09; - maxy[1]=1.09; - maxy[2]=1.09; - maxy[3]=1.09; - + plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles); + plots[0] = "effic_vs_eta"; + titles[0] = "Efficiency vs #eta"; + plots[1] = "fakerate_vs_eta"; + titles[1] = "Fake rate vs #eta"; + plots[2] = "effic_vs_phi"; + titles[2] = "Efficiency vs #phi"; + plots[3] = "fakerate_vs_phi"; + titles[3] = "Fake rate vs #phi"; + + miny[0] = -0.0001; + miny[1] = -0.0001; + miny[2] = -0.0001; + miny[3] = -0.0001; + + maxy[0] = 1.09; + maxy[1] = 1.09; + maxy[2] = 1.09; + maxy[3] = 1.09; + Plot4Histograms(newDir + "/eff_eta_phi", - rdir, sdir, - rcollname, scollname, - "eff_eta_phi", "Efficiency vs eta and Vs phi", - refLabel, newLabel, - plots, titles, drawopt, - logy, logx, doKolmo, norm, minx, maxx, miny, maxy); - + rdir, + sdir, + rcollname, + scollname, + "eff_eta_phi", + "Efficiency vs eta and Vs phi", + refLabel, + newLabel, + plots, + titles, + drawopt, + logy, + logx, + doKolmo, + norm, + minx, + maxx, + miny, + maxy); // efficiency and fake rate Vs pt - plotOptReset(logx,logy,doKolmo,norm,minx,maxx,miny,maxy,drawopt,plots,titles); - plots[0]="effic_vs_pt" ; titles[0]="Efficiency vs pt"; - plots[1]="fakerate_vs_pt" ; titles[1]="Fake rate vs pt" ; - plots[2]="num_simul_pT" ; titles[2]="N of simulated tracks vs pt" ; - plots[3]="num_reco_pT" ; titles[3]="N of reco track vs pt" ; - - logx[0]=true; - logx[1]=true; - logx[2]=true; - logx[3]=true; - - drawopt[0]=""; - drawopt[1]=""; - drawopt[2]="hist"; - drawopt[3]="hist"; - - norm[0]= -1.; - norm[1]= -1.; - norm[2]= 2.; - norm[3]= 2.; - - miny[0]= -0.0001; - miny[1]= -0.0001; - miny[2]= 0.; - miny[3]= 0.; - - maxy[0]= 1.09; - maxy[1]= 1.09; - maxy[2]= 0.; - maxy[3]= 0.; + plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles); + plots[0] = "effic_vs_pt"; + titles[0] = "Efficiency vs pt"; + plots[1] = "fakerate_vs_pt"; + titles[1] = "Fake rate vs pt"; + plots[2] = "num_simul_pT"; + titles[2] = "N of simulated tracks vs pt"; + plots[3] = "num_reco_pT"; + titles[3] = "N of reco track vs pt"; + + logx[0] = true; + logx[1] = true; + logx[2] = true; + logx[3] = true; + + drawopt[0] = ""; + drawopt[1] = ""; + drawopt[2] = "hist"; + drawopt[3] = "hist"; + + norm[0] = -1.; + norm[1] = -1.; + norm[2] = 2.; + norm[3] = 2.; + + miny[0] = -0.0001; + miny[1] = -0.0001; + miny[2] = 0.; + miny[3] = 0.; + + maxy[0] = 1.09; + maxy[1] = 1.09; + maxy[2] = 0.; + maxy[3] = 0.; Plot4Histograms(newDir + "/eff_pt", - rdir, sdir, - rcollname, scollname, - "eff_pt", "Efficiency vs pt and sim,reco distributions", - refLabel, newLabel, - plots, titles, drawopt, - logy, logx, doKolmo, norm, minx, maxx, miny, maxy); - + rdir, + sdir, + rcollname, + scollname, + "eff_pt", + "Efficiency vs pt and sim,reco distributions", + refLabel, + newLabel, + plots, + titles, + drawopt, + logy, + logx, + doKolmo, + norm, + minx, + maxx, + miny, + maxy); // efficiency and fake rate vs Number of Hits; Hit multiplicity per track; Ave.N.hits vs eta - plotOptReset(logx,logy,doKolmo,norm,minx,maxx,miny,maxy,drawopt,plots,titles); - plots[0]="effic_vs_hit" ; titles[0]="Efficiency vs Number of hits"; - plots[1]="fakerate_vs_hit" ; titles[1]="Fake rate vs Number of hits" ; - plots[2]="nhits" ; titles[2]="number of hits per track" ; - plots[3]="nhits_vs_eta_prof" ; titles[3]="mean number of Hits vs eta" ; - - drawopt[0]=""; - drawopt[1]=""; - drawopt[2]="hist"; - drawopt[3]=""; - - norm[0]= -1.; - norm[1]= -1.; - norm[2]= 0.; - norm[3]= -1.; - - miny[0]= -0.0001; - miny[1]= -0.0001; - miny[2]= 0.; - miny[3]= 0.; - - maxy[0]= 1.09; - maxy[1]= 0.; - maxy[2]= 0.; - maxy[3]= 0.; + plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles); + plots[0] = "effic_vs_hit"; + titles[0] = "Efficiency vs Number of hits"; + plots[1] = "fakerate_vs_hit"; + titles[1] = "Fake rate vs Number of hits"; + plots[2] = "nhits"; + titles[2] = "number of hits per track"; + plots[3] = "nhits_vs_eta_prof"; + titles[3] = "mean number of Hits vs eta"; + + drawopt[0] = ""; + drawopt[1] = ""; + drawopt[2] = "hist"; + drawopt[3] = ""; + + norm[0] = -1.; + norm[1] = -1.; + norm[2] = 0.; + norm[3] = -1.; + + miny[0] = -0.0001; + miny[1] = -0.0001; + miny[2] = 0.; + miny[3] = 0.; + + maxy[0] = 1.09; + maxy[1] = 0.; + maxy[2] = 0.; + maxy[3] = 0.; Plot4Histograms(newDir + "/eff_hits", - rdir, sdir, - rcollname, scollname, - "eff_hits", "Efficiency vs Number of hits and hit multiplicity per track", - refLabel, newLabel, - plots, titles, drawopt, - logy, logx, doKolmo, norm, minx, maxx, miny, maxy); - + rdir, + sdir, + rcollname, + scollname, + "eff_hits", + "Efficiency vs Number of hits and hit multiplicity per track", + refLabel, + newLabel, + plots, + titles, + drawopt, + logy, + logx, + doKolmo, + norm, + minx, + maxx, + miny, + maxy); + // efficiency and fake rate vs PU - plotOptReset(logx,logy,doKolmo,norm,minx,maxx,miny,maxy,drawopt,plots,titles); - plots[0]="effic_vs_pu" ; titles[0]="Efficiency vs n.PU interactions"; - plots[1]="fakerate_vs_pu" ; titles[1]="Fake rate vs n.PU interactions" ; + plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles); + plots[0] = "effic_vs_pu"; + titles[0] = "Efficiency vs n.PU interactions"; + plots[1] = "fakerate_vs_pu"; + titles[1] = "Fake rate vs n.PU interactions"; //maxx[0]= 100.; //maxx[1]= 100.; - miny[0]= -0.0001; - miny[1]= 0.; + miny[0] = -0.0001; + miny[1] = 0.; - maxy[0]= 1.09; - maxy[1]= 0.; + maxy[0] = 1.09; + maxy[1] = 0.; norm[1] = -1; Plot4Histograms(newDir + "/eff_pu", - rdir, sdir, - rcollname, scollname, - "eff_pu", "Efficiency vs n.PU interactions", - refLabel, newLabel, - plots, titles, drawopt, - logy, logx, doKolmo, norm, minx, maxx, miny, maxy); - + rdir, + sdir, + rcollname, + scollname, + "eff_pu", + "Efficiency vs n.PU interactions", + refLabel, + newLabel, + plots, + titles, + drawopt, + logy, + logx, + doKolmo, + norm, + minx, + maxx, + miny, + maxy); + // skip other plots for seeds if (!scollname.Contains("seeds")) { - - //===== normalized chi2, chi2 probability, ave. norm. chi2 vs eta; ave. pt bias vs eta - plotOptReset(logx,logy,doKolmo,norm,minx,maxx,miny,maxy,drawopt,plots,titles); - plots[0]="chi2" ; titles[0]="Track #chi^{2}"; - plots[1]="chi2prob" ; titles[1]="Probability of track #chi^{2}"; - plots[2]="chi2_vs_eta_prof" ; titles[2]="Mean normalized #chi^{2} vs #eta" ; - - drawopt[0]="hist"; - drawopt[1]="hist"; - drawopt[2]=""; - - norm[0]= 0.; - norm[1]= 0.; - norm[2]= -1.; - - logy[0]=true; - logy[1]=false; - logy[2]=false; - - Plot4Histograms(newDir + "/chi2", - rdir, sdir, - rcollname, scollname, - "chi2", "chi2 distributions", - refLabel, newLabel, - plots, titles, drawopt, - logy, logx, doKolmo, norm, minx, maxx, miny, maxy); - - //===== pull distributions - plotOptReset(logx,logy,doKolmo,norm,minx,maxx,miny,maxy,drawopt,plots,titles); - plots[0]="ptpull" ; titles[0]="p_{T} Pull"; - plots[1]="qoverppull" ; titles[1]="q/p Pull" ; - plots[2]="phipull" ; titles[2]="#phi Pull" ; - plots[3]="thetapull" ; titles[3]="#theta Pull" ; - plots[4]="dxypull" ; titles[4]="dxy Pull" ; - plots[5]="dzpull" ; titles[5]="dz Pull" ; - - logy[0]=true; - logy[1]=true; - logy[2]=true; - logy[3]=true; - logy[4]=true; - logy[5]=true; - - drawopt[0]="hist"; - drawopt[1]="hist"; - drawopt[2]="hist"; - drawopt[3]="hist"; - drawopt[4]="hist"; - drawopt[5]="hist"; - - norm[0]= 2.; - norm[1]= 2.; - norm[2]= 2.; - norm[3]= 2.; - norm[4]= 2.; - norm[5]= 2.; - - Plot6Histograms(newDir + "/pulls", - rdir, sdir, - rcollname, scollname, - "pulls", "pull distributions", - refLabel, newLabel, - plots, titles, drawopt, - logy, logx, doKolmo, norm, minx, maxx, miny, maxy); - - - //===== residual distributions (projected on Y-axis from the 2D histos with residuals vs eta) - plotOptReset(logx,logy,doKolmo,norm,minx,maxx,miny,maxy,drawopt,plots,titles); - plots[0]="ptres_vs_eta" ; titles[0]="p_{T} Relative Residual"; - plots[1]="etares_vs_eta" ; titles[1]="#eta Residual" ; - plots[2]="phires_vs_eta" ; titles[2]="#phi Residual" ; - plots[3]="thetaCotres_vs_eta" ; titles[3]="cot(#theta) Residual" ; - plots[4]="dxyres_vs_eta" ; titles[4]="dxy Residual" ; - plots[5]="dzres_vs_eta" ; titles[5]="dz Residual" ; - - logy[0]=true; - logy[1]=true; - logy[2]=true; - logy[3]=true; - logy[4]=true; - logy[5]=true; - - drawopt[0]="hist"; - drawopt[1]="hist"; - drawopt[2]="hist"; - drawopt[3]="hist"; - drawopt[4]="hist"; - drawopt[5]="hist"; - - norm[0]= 2.; - norm[1]= 2.; - norm[2]= 2.; - norm[3]= 2.; - norm[4]= 2.; - norm[5]= 2.; - - Plot6Histograms(newDir + "/residuals", - rdir, sdir, - rcollname, scollname, - "residuals", "residual distributions", - refLabel, newLabel, - plots, titles, drawopt, - logy, logx, doKolmo, norm, minx, maxx, miny, maxy); - - - //===== resolutions vs eta; pt relative bias vs eta - plotOptReset(logx,logy,doKolmo,norm,minx,maxx,miny,maxy,drawopt,plots,titles); - plots[0]="phires_vs_eta_Sigma" ; titles[0]="width #phi Residual vs #eta"; - plots[1]="thetaCotres_vs_eta_Sigma" ; titles[1]="width cot(#theta) Residual vs #eta" ; - plots[2]="dxyres_vs_eta_Sigma" ; titles[2]="width dxy Residual vs #eta" ; - plots[3]="dzres_vs_eta_Sigma" ; titles[3]="width dz Residual vs #eta" ; - plots[4]="ptres_vs_eta_Sigma" ; titles[4]="width p_{T} Relative Residual vs #eta" ; - plots[5]="ptres_vs_eta_Mean" ; titles[5]="mean p_{T} Relative Residual vs #eta" ; - - logy[0]=true; - logy[1]=true; - logy[2]=true; - logy[3]=true; - logy[4]=true; - logy[5]=false; - - Plot6Histograms(newDir + "/resol_eta", - rdir, sdir, - rcollname, scollname, - "resol_eta", "resolutions vs eta", - refLabel, newLabel, - plots, titles, drawopt, - logy, logx, doKolmo, norm, minx, maxx, miny, maxy); - - //===== resolutions vs pt; pt relative bias vs eta - plotOptReset(logx,logy,doKolmo,norm,minx,maxx,miny,maxy,drawopt,plots,titles); - plots[0]="phires_vs_pt_Sigma" ; titles[0]="width #phi Residual vs p_{T}"; - plots[1]="thetaCotres_vs_pt_Sigma" ; titles[1]="width cot(#theta) Residual vs p_{T}" ; - plots[2]="dxyres_vs_pt_Sigma" ; titles[2]="width dxy Residual vs p_{T}" ; - plots[3]="dzres_vs_pt_Sigma" ; titles[3]="width dz Residual vs p_{T}" ; - plots[4]="ptres_vs_pt_Sigma" ; titles[4]="width p_{T} Relative Residual vs p_{T}" ; - plots[5]="ptres_vs_pt_Mean" ; titles[5]="mean p_{T} Relative Residual vs p_{T}" ; - - logx[0]=true; - logx[1]=true; - logx[2]=true; - logx[3]=true; - logx[4]=true; - logx[5]=true; - - logy[0]=true; - logy[1]=true; - logy[2]=true; - logy[3]=true; - logy[4]=true; - logy[5]=false; - - Plot6Histograms(newDir + "/resol_pt", - rdir, sdir, - rcollname, scollname, - "resol_pt", "resolutions vs pt", - refLabel, newLabel, - plots, titles, drawopt, - logy, logx, doKolmo, norm, minx, maxx, miny, maxy); - - - // ================= charge misid rate vs eta, pt, n.hits, PU - plotOptReset(logx,logy,doKolmo,norm,minx,maxx,miny,maxy,drawopt,plots,titles); - plots[0]="chargeMisId_vs_eta" ; titles[0]="Charge MisId rate vs #eta"; - plots[1]="chargeMisId_vs_pt" ; titles[1]="Charge MisID rate vs p_{T}" ; - plots[2]="chargeMisId_vs_hit" ; titles[2]="Charge MisID rate vs number of RecHits" ; - plots[3]="chargeMisId_vs_pu" ; titles[3]="Charge MisID rate vs n.PU interactions" ; - - logx[0]=false; - logx[1]=true; - logx[2]=false; - logx[3]=false; - - //maxx[0]= 0.; - //maxx[1]= 0.; - //maxx[2]= 0.; - //maxx[3]= 100.; - - miny[0]= -0.0001; - miny[1]= 0.; - miny[2]= -0.0001; - miny[3]= 0.; - - maxy[0]= 0.; - maxy[1]= 0.; - maxy[2]= 0.; - maxy[3]= 0.; - - Plot4Histograms(newDir + "/chargeMisId", - rdir, sdir, - rcollname, scollname, - "chargeMisId", "charge misId rate vs eta, pt, nhits, PU", - refLabel, newLabel, - plots, titles, drawopt, - logy, logx, doKolmo, norm, minx, maxx, miny, maxy); - - } // if (!scollname.Contains("seeds")) + //===== normalized chi2, chi2 probability, ave. norm. chi2 vs eta; ave. pt bias vs eta + plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles); + plots[0] = "chi2"; + titles[0] = "Track #chi^{2}"; + plots[1] = "chi2prob"; + titles[1] = "Probability of track #chi^{2}"; + plots[2] = "chi2_vs_eta_prof"; + titles[2] = "Mean normalized #chi^{2} vs #eta"; + + drawopt[0] = "hist"; + drawopt[1] = "hist"; + drawopt[2] = ""; + + norm[0] = 0.; + norm[1] = 0.; + norm[2] = -1.; + + logy[0] = true; + logy[1] = false; + logy[2] = false; + + Plot4Histograms(newDir + "/chi2", + rdir, + sdir, + rcollname, + scollname, + "chi2", + "chi2 distributions", + refLabel, + newLabel, + plots, + titles, + drawopt, + logy, + logx, + doKolmo, + norm, + minx, + maxx, + miny, + maxy); + + //===== pull distributions + plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles); + plots[0] = "ptpull"; + titles[0] = "p_{T} Pull"; + plots[1] = "qoverppull"; + titles[1] = "q/p Pull"; + plots[2] = "phipull"; + titles[2] = "#phi Pull"; + plots[3] = "thetapull"; + titles[3] = "#theta Pull"; + plots[4] = "dxypull"; + titles[4] = "dxy Pull"; + plots[5] = "dzpull"; + titles[5] = "dz Pull"; + + logy[0] = true; + logy[1] = true; + logy[2] = true; + logy[3] = true; + logy[4] = true; + logy[5] = true; + + drawopt[0] = "hist"; + drawopt[1] = "hist"; + drawopt[2] = "hist"; + drawopt[3] = "hist"; + drawopt[4] = "hist"; + drawopt[5] = "hist"; + + norm[0] = 2.; + norm[1] = 2.; + norm[2] = 2.; + norm[3] = 2.; + norm[4] = 2.; + norm[5] = 2.; + + Plot6Histograms(newDir + "/pulls", + rdir, + sdir, + rcollname, + scollname, + "pulls", + "pull distributions", + refLabel, + newLabel, + plots, + titles, + drawopt, + logy, + logx, + doKolmo, + norm, + minx, + maxx, + miny, + maxy); + + //===== residual distributions (projected on Y-axis from the 2D histos with residuals vs eta) + plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles); + plots[0] = "ptres_vs_eta"; + titles[0] = "p_{T} Relative Residual"; + plots[1] = "etares_vs_eta"; + titles[1] = "#eta Residual"; + plots[2] = "phires_vs_eta"; + titles[2] = "#phi Residual"; + plots[3] = "thetaCotres_vs_eta"; + titles[3] = "cot(#theta) Residual"; + plots[4] = "dxyres_vs_eta"; + titles[4] = "dxy Residual"; + plots[5] = "dzres_vs_eta"; + titles[5] = "dz Residual"; + + logy[0] = true; + logy[1] = true; + logy[2] = true; + logy[3] = true; + logy[4] = true; + logy[5] = true; + + drawopt[0] = "hist"; + drawopt[1] = "hist"; + drawopt[2] = "hist"; + drawopt[3] = "hist"; + drawopt[4] = "hist"; + drawopt[5] = "hist"; + + norm[0] = 2.; + norm[1] = 2.; + norm[2] = 2.; + norm[3] = 2.; + norm[4] = 2.; + norm[5] = 2.; + + Plot6Histograms(newDir + "/residuals", + rdir, + sdir, + rcollname, + scollname, + "residuals", + "residual distributions", + refLabel, + newLabel, + plots, + titles, + drawopt, + logy, + logx, + doKolmo, + norm, + minx, + maxx, + miny, + maxy); + + //===== resolutions vs eta; pt relative bias vs eta + plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles); + plots[0] = "phires_vs_eta_Sigma"; + titles[0] = "width #phi Residual vs #eta"; + plots[1] = "thetaCotres_vs_eta_Sigma"; + titles[1] = "width cot(#theta) Residual vs #eta"; + plots[2] = "dxyres_vs_eta_Sigma"; + titles[2] = "width dxy Residual vs #eta"; + plots[3] = "dzres_vs_eta_Sigma"; + titles[3] = "width dz Residual vs #eta"; + plots[4] = "ptres_vs_eta_Sigma"; + titles[4] = "width p_{T} Relative Residual vs #eta"; + plots[5] = "ptres_vs_eta_Mean"; + titles[5] = "mean p_{T} Relative Residual vs #eta"; + + logy[0] = true; + logy[1] = true; + logy[2] = true; + logy[3] = true; + logy[4] = true; + logy[5] = false; + + Plot6Histograms(newDir + "/resol_eta", + rdir, + sdir, + rcollname, + scollname, + "resol_eta", + "resolutions vs eta", + refLabel, + newLabel, + plots, + titles, + drawopt, + logy, + logx, + doKolmo, + norm, + minx, + maxx, + miny, + maxy); + + //===== resolutions vs pt; pt relative bias vs eta + plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles); + plots[0] = "phires_vs_pt_Sigma"; + titles[0] = "width #phi Residual vs p_{T}"; + plots[1] = "thetaCotres_vs_pt_Sigma"; + titles[1] = "width cot(#theta) Residual vs p_{T}"; + plots[2] = "dxyres_vs_pt_Sigma"; + titles[2] = "width dxy Residual vs p_{T}"; + plots[3] = "dzres_vs_pt_Sigma"; + titles[3] = "width dz Residual vs p_{T}"; + plots[4] = "ptres_vs_pt_Sigma"; + titles[4] = "width p_{T} Relative Residual vs p_{T}"; + plots[5] = "ptres_vs_pt_Mean"; + titles[5] = "mean p_{T} Relative Residual vs p_{T}"; + + logx[0] = true; + logx[1] = true; + logx[2] = true; + logx[3] = true; + logx[4] = true; + logx[5] = true; + + logy[0] = true; + logy[1] = true; + logy[2] = true; + logy[3] = true; + logy[4] = true; + logy[5] = false; + + Plot6Histograms(newDir + "/resol_pt", + rdir, + sdir, + rcollname, + scollname, + "resol_pt", + "resolutions vs pt", + refLabel, + newLabel, + plots, + titles, + drawopt, + logy, + logx, + doKolmo, + norm, + minx, + maxx, + miny, + maxy); + + // ================= charge misid rate vs eta, pt, n.hits, PU + plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles); + plots[0] = "chargeMisId_vs_eta"; + titles[0] = "Charge MisId rate vs #eta"; + plots[1] = "chargeMisId_vs_pt"; + titles[1] = "Charge MisID rate vs p_{T}"; + plots[2] = "chargeMisId_vs_hit"; + titles[2] = "Charge MisID rate vs number of RecHits"; + plots[3] = "chargeMisId_vs_pu"; + titles[3] = "Charge MisID rate vs n.PU interactions"; + + logx[0] = false; + logx[1] = true; + logx[2] = false; + logx[3] = false; + + //maxx[0]= 0.; + //maxx[1]= 0.; + //maxx[2]= 0.; + //maxx[3]= 100.; + + miny[0] = -0.0001; + miny[1] = 0.; + miny[2] = -0.0001; + miny[3] = 0.; + + maxy[0] = 0.; + maxy[1] = 0.; + maxy[2] = 0.; + maxy[3] = 0.; + + Plot4Histograms(newDir + "/chargeMisId", + rdir, + sdir, + rcollname, + scollname, + "chargeMisId", + "charge misId rate vs eta, pt, nhits, PU", + refLabel, + newLabel, + plots, + titles, + drawopt, + logy, + logx, + doKolmo, + norm, + minx, + maxx, + miny, + maxy); + + } // if (!scollname.Contains("seeds")) //// Merge pdf files together and rename the merged pdf after the collection name - TString mergefile = "merged_plots.pdf"; // File name where partial pdfs will be merged - TString destfile = newDir + "/../" + myName + ".pdf"; // Destination file name - TString gscommand = "gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=" + mergefile + " " - + newDir + "/eff_eta_phi.pdf " - + newDir + "/eff_pt.pdf " - + newDir + "/eff_hits.pdf " - + newDir + "/eff_pu.pdf " - + newDir + "/chi2.pdf " - + newDir + "/pulls.pdf " - + newDir + "/residuals.pdf " - + newDir + "/resol_eta.pdf " - + newDir + "/resol_pt.pdf " - + newDir + "/chargeMisId.pdf "; + TString mergefile = "merged_plots.pdf"; // File name where partial pdfs will be merged + TString destfile = newDir + "/../" + myName + ".pdf"; // Destination file name + TString gscommand = "gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=" + mergefile + " " + newDir + + "/eff_eta_phi.pdf " + newDir + "/eff_pt.pdf " + newDir + "/eff_hits.pdf " + newDir + + "/eff_pu.pdf " + newDir + "/chi2.pdf " + newDir + "/pulls.pdf " + newDir + "/residuals.pdf " + + newDir + "/resol_eta.pdf " + newDir + "/resol_pt.pdf " + newDir + "/chargeMisId.pdf "; if (scollname.Contains("seeds")) - gscommand = "gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=" + mergefile + " " - + newDir + "/eff_eta_phi.pdf " - + newDir + "/eff_pt.pdf " - + newDir + "/eff_hits.pdf " - + newDir + "/eff_pu.pdf "; - + gscommand = "gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=" + mergefile + " " + newDir + + "/eff_eta_phi.pdf " + newDir + "/eff_pt.pdf " + newDir + "/eff_hits.pdf " + newDir + "/eff_pu.pdf "; + cout << ">> Merging partial pdfs to " << mergefile << "..." << endl; - if (DEBUG) cout << " ...with command \"" << gscommand << "\"" << endl; + if (DEBUG) + cout << " ...with command \"" << gscommand << "\"" << endl; gSystem->Exec(gscommand); cout << ">> Moving " << mergefile << " to " << destfile << "..." << endl; gSystem->Rename(mergefile, destfile); cout << ">> Deleting partial pdf files" << endl; - gSystem->Exec("rm -rf "+newDir+"/*.pdf"); + gSystem->Exec("rm -rf " + newDir + "/*.pdf"); cout << " ... Done" << endl; - - } // end of "while loop" + + } // end of "while loop" /////////////////////////////////////////////////////////////////////////////// // comparison plots of Muon and Track associators on the probeTracks @@ -548,10 +718,12 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi } if (DEBUG) { - cout << " Comparing MuonAssociatorByHits with quickTrackAssociatorByHits on probeTracks (for the new release)" << endl; - cerr << " Comparing MuonAssociatorByHits with quickTrackAssociatorByHits on probeTracks (for the new release)" << endl; + cout << " Comparing MuonAssociatorByHits with quickTrackAssociatorByHits on probeTracks (for the new release)" + << endl; + cerr << " Comparing MuonAssociatorByHits with quickTrackAssociatorByHits on probeTracks (for the new release)" + << endl; } - + sfile->cd("DQMData/Run 1/Muons/Run summary/RecoMuonV/MuonTrack"); sdir = gDirectory; rcollname = "probeTrks_TkAsso"; @@ -560,7 +732,8 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi // for releases before CMSSW_10_1_0_pre1 and New Muon Validation TString New_CMSSW_Release("NEW_RELEASE"); bool NEWprobeTrksNames = false; - if (New_CMSSW_Release.Contains("CMSSW_9") || New_CMSSW_Release.Contains("CMSSW_10_0")) NEWprobeTrksNames=true; + if (New_CMSSW_Release.Contains("CMSSW_9") || New_CMSSW_Release.Contains("CMSSW_10_0")) + NEWprobeTrksNames = true; if (NEWprobeTrksNames) { rcollname = "NEWprobeTrks_TkAsso"; scollname = "NEWprobeTrks"; @@ -570,106 +743,154 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi const char* _newLabel("NEW_LABEL, NEW_RELEASE NEWSELECTION MuonAssociatorByHits"); // efficiency and fake rate Vs eta and phi - plotOptReset(logx,logy,doKolmo,norm,minx,maxx,miny,maxy,drawopt,plots,titles); - plots[0]="effic_vs_eta" ; titles[0]="Efficiency vs #eta"; - plots[1]="fakerate_vs_eta" ; titles[1]="Fake rate vs #eta" ; - plots[2]="effic_vs_pt" ; titles[2]="Efficiency vs pt" ; - plots[3]="fakerate_vs_pt" ; titles[3]="Fake rate vs pt" ; - - logx[0]=false; - logx[1]=false; - logx[2]=true; - logx[3]=true; - - miny[0]=-0.0001; - miny[1]=-0.0001; - miny[2]=-0.0001; - miny[3]=-0.0001; - - maxy[0]=1.09; - maxy[1]=0.; - maxy[2]=1.09; - maxy[3]=0.; + plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles); + plots[0] = "effic_vs_eta"; + titles[0] = "Efficiency vs #eta"; + plots[1] = "fakerate_vs_eta"; + titles[1] = "Fake rate vs #eta"; + plots[2] = "effic_vs_pt"; + titles[2] = "Efficiency vs pt"; + plots[3] = "fakerate_vs_pt"; + titles[3] = "Fake rate vs pt"; + + logx[0] = false; + logx[1] = false; + logx[2] = true; + logx[3] = true; + + miny[0] = -0.0001; + miny[1] = -0.0001; + miny[2] = -0.0001; + miny[3] = -0.0001; + + maxy[0] = 1.09; + maxy[1] = 0.; + maxy[2] = 1.09; + maxy[3] = 0.; Plot4Histograms(dir_MABH_vs_TABH + "/eff_pt_eta", - sdir, sdir, - rcollname, scollname, - "eff_pt_eta_MABHvsTABH", "Efficiency vs eta and pt - Muon vs Track Associator", - _refLabel, _newLabel, - plots, titles, drawopt, - logy, logx, doKolmo, norm, minx, maxx, miny, maxy); + sdir, + sdir, + rcollname, + scollname, + "eff_pt_eta_MABHvsTABH", + "Efficiency vs eta and pt - Muon vs Track Associator", + _refLabel, + _newLabel, + plots, + titles, + drawopt, + logy, + logx, + doKolmo, + norm, + minx, + maxx, + miny, + maxy); // efficiency and fake rate Vs N.hits and phi - plotOptReset(logx,logy,doKolmo,norm,minx,maxx,miny,maxy,drawopt,plots,titles); - plots[0]="effic_vs_hit" ; titles[0]="Efficiency vs Number of hits"; - plots[1]="fakerate_vs_hit" ; titles[1]="Fake rate vs Number of hits" ; - plots[2]="effic_vs_phi" ; titles[2]="Efficiency vs #phi" ; - plots[3]="fakerate_vs_phi" ; titles[3]="Fake rate vs #phi" ; - - miny[0]=-0.0001; - miny[1]=-0.0001; - miny[2]=-0.0001; - miny[3]=-0.0001; - - maxy[0]=1.09; - maxy[1]=0.; - maxy[2]=1.09; - maxy[3]=0.; - + plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles); + plots[0] = "effic_vs_hit"; + titles[0] = "Efficiency vs Number of hits"; + plots[1] = "fakerate_vs_hit"; + titles[1] = "Fake rate vs Number of hits"; + plots[2] = "effic_vs_phi"; + titles[2] = "Efficiency vs #phi"; + plots[3] = "fakerate_vs_phi"; + titles[3] = "Fake rate vs #phi"; + + miny[0] = -0.0001; + miny[1] = -0.0001; + miny[2] = -0.0001; + miny[3] = -0.0001; + + maxy[0] = 1.09; + maxy[1] = 0.; + maxy[2] = 1.09; + maxy[3] = 0.; + Plot4Histograms(dir_MABH_vs_TABH + "/eff_phi_hits", - sdir, sdir, - rcollname, scollname, - "eff_phi_hits_MABHvsTABH", "Efficiency vs phi and N. hits - Muon vs Track Associator", - _refLabel, _newLabel, - plots, titles, drawopt, - logy, logx, doKolmo, norm, minx, maxx, miny, maxy); - + sdir, + sdir, + rcollname, + scollname, + "eff_phi_hits_MABHvsTABH", + "Efficiency vs phi and N. hits - Muon vs Track Associator", + _refLabel, + _newLabel, + plots, + titles, + drawopt, + logy, + logx, + doKolmo, + norm, + minx, + maxx, + miny, + maxy); + // efficiency and fake rate Vs PU - plotOptReset(logx,logy,doKolmo,norm,minx,maxx,miny,maxy,drawopt,plots,titles); - plots[0]="effic_vs_pu" ; titles[0]="Efficiency vs n.PU interactions"; - plots[1]="fakerate_vs_pu" ; titles[1]="Fake rate vs n.PU interactions" ; - + plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles); + plots[0] = "effic_vs_pu"; + titles[0] = "Efficiency vs n.PU interactions"; + plots[1] = "fakerate_vs_pu"; + titles[1] = "Fake rate vs n.PU interactions"; + //maxx[0]= 100.; //maxx[1]= 100.; - - miny[0]= -0.0001; - miny[1]= 0.; - - maxy[0]= 1.09; - maxy[1]= 0.; + + miny[0] = -0.0001; + miny[1] = 0.; + + maxy[0] = 1.09; + maxy[1] = 0.; norm[1] = -1; - + PlotNHistograms(dir_MABH_vs_TABH + "/eff_pu", - sdir, sdir, - rcollname, scollname, - "eff_pu_MABHvsTABH", "Efficiency vs N.PU interactions - Muon vs Track Associator", - _refLabel, _newLabel, - 4, plots, titles, drawopt, - logy, logx, doKolmo, norm, minx, maxx, miny, maxy); - - //// Merge pdf files together and rename the merged pdf after the - TString _destfile = newDirBase + "probeTrks_MABH_vs_TABH" + ".pdf"; // Destination file name - TString _gscommand = "gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=" + _destfile + " " - + dir_MABH_vs_TABH + "/eff_pt_eta.pdf " - + dir_MABH_vs_TABH + "/eff_phi_hits.pdf " - + dir_MABH_vs_TABH + "/eff_pu.pdf "; - + sdir, + sdir, + rcollname, + scollname, + "eff_pu_MABHvsTABH", + "Efficiency vs N.PU interactions - Muon vs Track Associator", + _refLabel, + _newLabel, + 4, + plots, + titles, + drawopt, + logy, + logx, + doKolmo, + norm, + minx, + maxx, + miny, + maxy); + + //// Merge pdf files together and rename the merged pdf after the + TString _destfile = newDirBase + "probeTrks_MABH_vs_TABH" + ".pdf"; // Destination file name + TString _gscommand = "gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=" + _destfile + " " + dir_MABH_vs_TABH + + "/eff_pt_eta.pdf " + dir_MABH_vs_TABH + "/eff_phi_hits.pdf " + dir_MABH_vs_TABH + "/eff_pu.pdf "; + cout << ">> Merging partial pdfs to " << _destfile << "..." << endl; - if (DEBUG) cout << " ...with command \"" << _gscommand << "\"" << endl; + if (DEBUG) + cout << " ...with command \"" << _gscommand << "\"" << endl; gSystem->Exec(_gscommand); - + cout << ">> Deleting partial pdf files" << endl; - gSystem->Exec("rm -rf "+ dir_MABH_vs_TABH +"/eff_*.pdf"); + gSystem->Exec("rm -rf " + dir_MABH_vs_TABH + "/eff_*.pdf"); cout << " ... Done" << endl; - + cout << ">> Removing the relval files from ROOT before closing..." << endl; gROOT->GetListOfFiles()->Remove(sfile); gROOT->GetListOfFiles()->Remove(rfile); - + if (DEBUG) { cout << " Exiting!" << endl; cerr << " Exiting!" << endl; } } - diff --git a/Validation/RecoMuon/test/muonReleaseSummary.py b/Validation/RecoMuon/test/muonReleaseSummary.py index a2459b6080df5..0adb4139d6037 100644 --- a/Validation/RecoMuon/test/muonReleaseSummary.py +++ b/Validation/RecoMuon/test/muonReleaseSummary.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 from __future__ import print_function import os diff --git a/Validation/RecoMuon/test/muonReleaseValidation.py b/Validation/RecoMuon/test/muonReleaseValidation.py index a994084a9bb04..f5046d5415ea6 100755 --- a/Validation/RecoMuon/test/muonReleaseValidation.py +++ b/Validation/RecoMuon/test/muonReleaseValidation.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 from __future__ import print_function import os diff --git a/Validation/RecoMuon/test/muonReleaseValidationFastSim.py b/Validation/RecoMuon/test/muonReleaseValidationFastSim.py index e75e56930d22b..d5dbf59b173c2 100755 --- a/Validation/RecoMuon/test/muonReleaseValidationFastSim.py +++ b/Validation/RecoMuon/test/muonReleaseValidationFastSim.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 from __future__ import print_function import os @@ -157,7 +157,7 @@ def do_validation(samples, GlobalTag, trackquality, trackalgorithm): if(os.path.isfile(newdir+'/val.'+sample+'.rootytootie' )!=True): #search the primary dataset - cmd='python $DBSCMD_HOME/dbsCommandLine.py "find dataset where dataset like *' + cmd='python3 $DBSCMD_HOME/dbsCommandLine.py "find dataset where dataset like *' #search for correct EventContent (and site) if (FastSimUse=="True"): cmd+=sample+'/'+NewRelease+'-'+GlobalTagUse+'*GEN-SIM-DIGI-RECO* AND site like *cern* "' @@ -176,7 +176,7 @@ def do_validation(samples, GlobalTag, trackquality, trackalgorithm): if(dataset!="" or DBS==False): print('dataset found ', dataset[:-1]) #Find and format the list of files - cmd2='python $DBSCMD_HOME/dbsCommandLine.py "find file where dataset like '+ dataset[:-1] +'"|grep ' + sample + cmd2='python3 $DBSCMD_HOME/dbsCommandLine.py "find file where dataset like '+ dataset[:-1] +'"|grep ' + sample thisFile=0 for thisFilename in os.popen(cmd2).readlines(): @@ -202,13 +202,13 @@ def do_validation(samples, GlobalTag, trackquality, trackalgorithm): if (FastSimUse=="True"): cmd3=cmd else: - cmd3='python $DBSCMD_HOME/dbsCommandLine.py "find dataset.parent where dataset like '+ dataset[:-1] +'"|grep ' + sample + cmd3='python3 $DBSCMD_HOME/dbsCommandLine.py "find dataset.parent where dataset like '+ dataset[:-1] +'"|grep ' + sample parentdataset=os.popen(cmd3).readline() print('Parent DataSet: ', parentdataset, '\n') #Check if a dataset is found if parentdataset!="": - cmd4='python $DBSCMD_HOME/dbsCommandLine.py "find file where dataset like '+ parentdataset[:-1] +'"|grep ' + sample + cmd4='python3 $DBSCMD_HOME/dbsCommandLine.py "find file where dataset like '+ parentdataset[:-1] +'"|grep ' + sample filenames+='secFiles.extend( [\n' first=True for line in os.popen(cmd4).readlines(): diff --git a/Validation/RecoMuon/test/new_muonReleaseSummary.py b/Validation/RecoMuon/test/new_muonReleaseSummary.py index 2564b853bc84e..4bbca2e230fe4 100644 --- a/Validation/RecoMuon/test/new_muonReleaseSummary.py +++ b/Validation/RecoMuon/test/new_muonReleaseSummary.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 from __future__ import print_function import os diff --git a/Validation/RecoMuon/test/new_userparams.py b/Validation/RecoMuon/test/new_userparams.py index 2b37fdd45041f..c489fa1fafd70 100644 --- a/Validation/RecoMuon/test/new_userparams.py +++ b/Validation/RecoMuon/test/new_userparams.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 import os import shutil diff --git a/Validation/RecoMuon/test/userparams.py b/Validation/RecoMuon/test/userparams.py index d0ba82c0db54e..e614e27c12aff 100644 --- a/Validation/RecoMuon/test/userparams.py +++ b/Validation/RecoMuon/test/userparams.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 import os import shutil diff --git a/Validation/RecoParticleFlow/Makefile b/Validation/RecoParticleFlow/Makefile index be9f3e878a40e..32accc7c01cac 100644 --- a/Validation/RecoParticleFlow/Makefile +++ b/Validation/RecoParticleFlow/Makefile @@ -6,7 +6,7 @@ conf: cd ${TMPDIR} && ${RELVALCMD} conf reco 0 dumpconf: - cd ${TMPDIR}/conf && python -c 'import step3; print step3.process.dumpPython()' > step3_dump.py + cd ${TMPDIR}/conf && python3 -c 'import step3; print step3.process.dumpPython()' > step3_dump.py cp ${TMPDIR}/conf/step3.py test/crab/ cp ${TMPDIR}/conf/step3_dump.py test/crab/ @@ -15,9 +15,9 @@ QCD: QCD_reco QCD_dqm QCD_reco: cd ${TMPDIR} && ${RELVALCMD} QCD reco 0 -#Need to expand the CMSSW python configuration +#Need to expand the CMSSW python3 configuration QCD_dumpconf: - cd ${TMPDIR}/QCD && python -c 'import step3_RAW2DIGI_L1Reco_RECO_RECOSIM_EI_PAT as step3; print step3.process.dumpPython()' > step3_dump.py + cd ${TMPDIR}/QCD && python3 -c 'import step3_RAW2DIGI_L1Reco_RECO_RECOSIM_EI_PAT as step3; print step3.process.dumpPython()' > step3_dump.py cp ${TMPDIR}/QCD/step3_dump.py crab/ QCDPU_reco: diff --git a/Validation/RecoParticleFlow/README.md b/Validation/RecoParticleFlow/README.md index dd13b13509cfc..7e879e02403a1 100644 --- a/Validation/RecoParticleFlow/README.md +++ b/Validation/RecoParticleFlow/README.md @@ -34,7 +34,7 @@ Create input file lists under test/tmp/das_cache (You can modify which datasets are being used in the end of datasets.py script) ~~~ -cd test; python datasets.py; cd .. +cd test; python3 datasets.py; cd .. ~~~ Proceed to RECO step, about 30 minutes @@ -123,7 +123,7 @@ be included in the DQM step, so delete files you don't want to study. Note that the default era, condition, and samples are now set to 2021. Change CONDITIONS and ERA in test/run_relval.sh when trying other era, before trying the above commands. Also check (and if necessary, update) input samples and conf.Site.storageSite specified in $CMSSW_BASE/src/Validation/RecoParticleFlow/crab/multicrab.py (default storage site is T2_US_Caltech, but change it to your favorite site you have access to. use crab checkwrite --site= to check your permission). -Take note that the CMSSW python configuration for running the RECO sequence is dumped into `crab/step3_dump.py`. +Take note that the CMSSW python3 configuration for running the RECO sequence is dumped into `crab/step3_dump.py`. # Running DQM steps from existing MINIAOD samples diff --git a/Validation/RecoParticleFlow/test/compare.py b/Validation/RecoParticleFlow/test/compare.py index e2830d9e3e276..6d394038a5615 100644 --- a/Validation/RecoParticleFlow/test/compare.py +++ b/Validation/RecoParticleFlow/test/compare.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys import os import ROOT diff --git a/Validation/RecoParticleFlow/test/datasets.py b/Validation/RecoParticleFlow/test/datasets.py index b6012e09f8e2b..f500cb0ce6bec 100644 --- a/Validation/RecoParticleFlow/test/datasets.py +++ b/Validation/RecoParticleFlow/test/datasets.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function #Hack to get ROOT to ignore command line arguments that we want @@ -113,7 +113,7 @@ def cache_das_filenames(self): nfiles = 0 with open(self.get_das_cache_filename(), "w") as fi: - for line in ret.split("\n"): + for line in ret.decode().split("\n"): if line.endswith(".root"): fi.write(self.global_file_prefix + line + "\n") nfiles += 1 diff --git a/Validation/RecoParticleFlow/test/offsetStack.py b/Validation/RecoParticleFlow/test/offsetStack.py index 57e822ba5d02b..8894e57de2363 100644 --- a/Validation/RecoParticleFlow/test/offsetStack.py +++ b/Validation/RecoParticleFlow/test/offsetStack.py @@ -1,5 +1,5 @@ #chad harrington 2019 -#execute as python test/offsetStack.py -f HS_old:tmp/HS_old/DQMTotal.root HS:tmp/HS/DQMTotal.root -o . +#execute as python3 test/offsetStack.py -f HS_old:tmp/HS_old/DQMTotal.root HS:tmp/HS/DQMTotal.root -o . import argparse import ROOT diff --git a/Validation/RecoTau/Tools/GetRecoTauVFromDQM_MC_cff.py b/Validation/RecoTau/Tools/GetRecoTauVFromDQM_MC_cff.py index 3e0a044e2d327..9e65453b8c8b6 100644 --- a/Validation/RecoTau/Tools/GetRecoTauVFromDQM_MC_cff.py +++ b/Validation/RecoTau/Tools/GetRecoTauVFromDQM_MC_cff.py @@ -4,7 +4,7 @@ import ROOT if len(sys.argv) < 4: - print("Error. Expected at least 3 arguments\n\nUsage: python GetRecoTauVFromDQM_MC_cff.py InputFile OutputFile EventType") + print("Error. Expected at least 3 arguments\n\nUsage: python3 GetRecoTauVFromDQM_MC_cff.py InputFile OutputFile EventType") sys.exit() diff --git a/Validation/RecoTau/Tools/MergeFilesAndCalculateEfficiencies_cfg.py b/Validation/RecoTau/Tools/MergeFilesAndCalculateEfficiencies_cfg.py index 0338fc3415ab4..e2ad83494eea4 100644 --- a/Validation/RecoTau/Tools/MergeFilesAndCalculateEfficiencies_cfg.py +++ b/Validation/RecoTau/Tools/MergeFilesAndCalculateEfficiencies_cfg.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ MergeFilesAndCalculateEfficiencies.py diff --git a/Validation/RecoTau/Tools/MultipleCompare.py b/Validation/RecoTau/Tools/MultipleCompare.py index 25912db77d95e..cc5b1ed0124b3 100644 --- a/Validation/RecoTau/Tools/MultipleCompare.py +++ b/Validation/RecoTau/Tools/MultipleCompare.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 from __future__ import print_function from builtins import range @@ -47,7 +47,7 @@ def LoadCommandlineOptions(argv): parser.add_option('--minYaxis',metavar='number',type=float, dest="minYaxis", default=0, help="Sets the minimum range on Y axis in the main pad") parser.add_option('--rebin', dest="rebin", type=int, default=-1, help="Sets the rebinning scale") parser.add_option('--branding','-b',metavar='branding', type=str,help='Define a branding to label the plots (in the top right corner)',dest='branding',default = None) - #parser.add_option('--search,-s',metavar='searchStrings', type=str,help='Sets the label to put in the plots for ref file',dest='testLabel',default = None) No idea on how to tell python to use all the strings before a new option, thus moving this from option to argument (but may be empty) + #parser.add_option('--search,-s',metavar='searchStrings', type=str,help='Sets the label to put in the plots for ref file',dest='testLabel',default = None) No idea on how to tell python3 to use all the strings before a new option, thus moving this from option to argument (but may be empty) (options,toPlot) = parser.parse_args() if options.help: diff --git a/Validation/RecoTau/Tools/RefreshWebPage.py b/Validation/RecoTau/Tools/RefreshWebPage.py index 23c3b675badd9..b4f0e1bef50f2 100644 --- a/Validation/RecoTau/Tools/RefreshWebPage.py +++ b/Validation/RecoTau/Tools/RefreshWebPage.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function import os diff --git a/Validation/RecoTau/Tools/SteerMultipleCompare.py b/Validation/RecoTau/Tools/SteerMultipleCompare.py index 4e6550fb344fe..1a48a782ad222 100644 --- a/Validation/RecoTau/Tools/SteerMultipleCompare.py +++ b/Validation/RecoTau/Tools/SteerMultipleCompare.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 from __future__ import print_function import sys diff --git a/Validation/RecoTau/Tools/makeLayoutFileForGui.py b/Validation/RecoTau/Tools/makeLayoutFileForGui.py index bcf03b875526c..697884d11f4e7 100644 --- a/Validation/RecoTau/Tools/makeLayoutFileForGui.py +++ b/Validation/RecoTau/Tools/makeLayoutFileForGui.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ###################################################################################################################################################### # SHIFT LAYOUTS ###################################################################################################################################################### diff --git a/Validation/RecoTau/python/ValidationOptions_cff.py b/Validation/RecoTau/python/ValidationOptions_cff.py index cdb4da0be92e6..022273e4469cb 100644 --- a/Validation/RecoTau/python/ValidationOptions_cff.py +++ b/Validation/RecoTau/python/ValidationOptions_cff.py @@ -155,7 +155,7 @@ def checkOptionsForBadInput(): sys.exit() def calledBycmsRun(): - ''' Returns true of this python file is being called via cmsRun ''' + ''' Returns true of this python3 file is being called via cmsRun ''' if sys.argv[0].find('cmsRun') == -1: return False else: diff --git a/Validation/RecoTau/python/compare.py b/Validation/RecoTau/python/compare.py index 71a9b85070ba7..f1b74f571a0ea 100644 --- a/Validation/RecoTau/python/compare.py +++ b/Validation/RecoTau/python/compare.py @@ -17,7 +17,7 @@ argc = len(argvs) if argc != 2: - print('Please specify the runtype : python tauPOGplot.py ') + print('Please specify the runtype : python3 tauPOGplot.py ') sys.exit(0) runtype = argvs[1] diff --git a/Validation/RecoTau/python/runTauDisplay.py b/Validation/RecoTau/python/runTauDisplay.py index cd81c28924bb7..1349b05498965 100644 --- a/Validation/RecoTau/python/runTauDisplay.py +++ b/Validation/RecoTau/python/runTauDisplay.py @@ -35,7 +35,7 @@ argc = len(argvs) if argc != 2: - print('Please specify the runtype : python runTauDisplay.py ') + print('Please specify the runtype : python3 runTauDisplay.py ') sys.exit(0) runtype = argvs[1] diff --git a/Validation/RecoTau/test/CreateDataRegistry.py b/Validation/RecoTau/test/CreateDataRegistry.py index b0eaedfdd3175..7dd3e3c49e14c 100755 --- a/Validation/RecoTau/test/CreateDataRegistry.py +++ b/Validation/RecoTau/test/CreateDataRegistry.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import FWCore.ParameterSet.Config as cms import Validation.RecoTau.DBSApi_cff as mydbs diff --git a/Validation/RecoTau/test/LXBatchValidation.py b/Validation/RecoTau/test/LXBatchValidation.py index fc66f7b6864ee..f0d9e92cbc94a 100755 --- a/Validation/RecoTau/test/LXBatchValidation.py +++ b/Validation/RecoTau/test/LXBatchValidation.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Script to submit Tau Validation jobs to lxbatch # Author: Evan Friis evan.klose.friis@cern.ch @@ -17,7 +17,7 @@ sys.exit() if options.nJobs == 0: - print("Must specify nJobs > 0. Run 'python LXBatchValidation.py help' for options") + print("Must specify nJobs > 0. Run 'python3 LXBatchValidation.py help' for options") sys.exit() if options.maxEvents == -1 and options.nJobs > 1: diff --git a/Validation/RecoTau/test/UtilityCommands.csh b/Validation/RecoTau/test/UtilityCommands.csh index 97af326f94139..5887779d8abd1 100644 --- a/Validation/RecoTau/test/UtilityCommands.csh +++ b/Validation/RecoTau/test/UtilityCommands.csh @@ -13,10 +13,10 @@ alias MergeBatchJob 'cmsRun ${VALTOOLS}/MergeFilesAndCalculateEfficiencies_cfg.p alias MergeGridJob 'cmsRun ${VALTOOLS}/MergeFilesAndCalculateEfficiencies_cfg.py' alias Compare 'cmsRun ${VALTOOLS}/Compare_cfg.py' alias Summarize 'cmsRun ${VALTOOLS}/SummaryPlots_cfg.py' -alias PerformanceCurves 'python ${VALTOOLS}/PlotPerformanceCurves.py' -alias MultipleCompare 'python ${VALTOOLS}/MultipleCompare.py' -alias BuildWebpage 'python ${VALTOOLS}/BuildWebpage.py' -alias SubmitResults 'python ${PFVALTOOLS}/submit.py' +alias PerformanceCurves 'python3 ${VALTOOLS}/PlotPerformanceCurves.py' +alias MultipleCompare 'python3 ${VALTOOLS}/MultipleCompare.py' +alias BuildWebpage 'python3 ${VALTOOLS}/BuildWebpage.py' +alias SubmitResults 'python3 ${PFVALTOOLS}/submit.py' alias getZTTRecoFiles 'dbs search --query="find dataset where release = CMSSW_3_1_0_pre10 and primds = RelValZTT and tier like *RECO* and dataset not like *FastSim*" --createCFF=tempZTTRecoFiles' alias removeLogs 'rm -r $VALTEST/LSFJOB_[0-9]*' diff --git a/Validation/RecoTau/test/UtilityCommands.sh b/Validation/RecoTau/test/UtilityCommands.sh index fb9b2e4caf39a..300bd55084286 100644 --- a/Validation/RecoTau/test/UtilityCommands.sh +++ b/Validation/RecoTau/test/UtilityCommands.sh @@ -13,10 +13,10 @@ alias MergeBatchJob='cmsRun ${VALTOOLS}/MergeFilesAndCalculateEfficiencies_cfg.p alias MergeGridJob='cmsRun ${VALTOOLS}/MergeFilesAndCalculateEfficiencies_cfg.py' alias Compare='cmsRun ${VALTOOLS}/Compare_cfg.py' alias Summarize='cmsRun ${VALTOOLS}/SummaryPlots_cfg.py' -alias MultipleCompare='python ${VALTOOLS}/MultipleCompare.py' -alias PerformanceCurves='python ${VALTOOLS}/PlotPerformanceCurves.py' -alias BuildWebpage='python ${VALTOOLS}/RefreshWebPage.py' -alias SubmitResults='python ${PFVALTOOLS}/submit.py' +alias MultipleCompare='python3 ${VALTOOLS}/MultipleCompare.py' +alias PerformanceCurves='python3 ${VALTOOLS}/PlotPerformanceCurves.py' +alias BuildWebpage='python3 ${VALTOOLS}/RefreshWebPage.py' +alias SubmitResults='python3 ${PFVALTOOLS}/submit.py' alias getZTTRecoFiles='dbs search --query="find dataset where release = CMSSW_3_1_0_pre10 and primds = RelValZTT and tier like *RECO* and dataset not like *FastSim*" --createCFF=tempZTTRecoFiles' alias removeLogs='rm -r $VALTEST/LSFJOB_[0-9]*' diff --git a/Validation/RecoTrack/interface/MultiTrackValidator.h b/Validation/RecoTrack/interface/MultiTrackValidator.h index 607ae67e7b90a..af85f02708fe6 100644 --- a/Validation/RecoTrack/interface/MultiTrackValidator.h +++ b/Validation/RecoTrack/interface/MultiTrackValidator.h @@ -20,7 +20,6 @@ #include "CommonTools/RecoAlgos/interface/CosmicTrackingParticleSelector.h" #include "SimTracker/Common/interface/TrackingParticleSelector.h" #include "CommonTools/RecoAlgos/interface/RecoTrackSelectorBase.h" -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" #include "SimTracker/TrackAssociation/interface/ParametersDefinerForTP.h" #include "CommonTools/Utils/interface/DynArray.h" #include "DataFormats/Common/interface/ValueMap.h" @@ -56,8 +55,7 @@ class MultiTrackValidator : public DQMGlobalEDAnalyzer tTopoEsToken; - std::string parametersDefiner; - const edm::ESGetToken tpDefinerEsToken; + std::unique_ptr parametersDefinerTP_; const bool parametersDefinerIsCosmic_; //these are used by MTVGenPs @@ -104,7 +102,6 @@ class MultiTrackValidator : public DQMGlobalEDAnalyzer - diff --git a/Validation/RecoTrack/plugins/MultiTrackValidator.cc b/Validation/RecoTrack/plugins/MultiTrackValidator.cc index d7347a52ba992..e91d2d62fee89 100644 --- a/Validation/RecoTrack/plugins/MultiTrackValidator.cc +++ b/Validation/RecoTrack/plugins/MultiTrackValidator.cc @@ -12,6 +12,7 @@ #include "SimDataFormats/Track/interface/SimTrackContainer.h" #include "SimDataFormats/Vertex/interface/SimVertexContainer.h" #include "SimDataFormats/Associations/interface/TrackToTrackingParticleAssociator.h" +#include "SimTracker/TrackAssociation/interface/CosmicParametersDefinerForTP.h" #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h" #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h" #include "SimDataFormats/TrackingAnalysis/interface/TrackingVertex.h" @@ -20,8 +21,6 @@ #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h" #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h" #include "TrackingTools/PatternTools/interface/TSCBLBuilderNoMaterial.h" -#include "SimTracker/TrackAssociation/plugins/ParametersDefinerForTPESProducer.h" -#include "SimTracker/TrackAssociation/plugins/CosmicParametersDefinerForTPESProducer.h" #include "SimTracker/TrackAssociation/interface/TrackingParticleIP.h" #include "DataFormats/TrackReco/interface/DeDxData.h" @@ -48,9 +47,7 @@ namespace { MultiTrackValidator::MultiTrackValidator(const edm::ParameterSet& pset) : tTopoEsToken(esConsumes()), - parametersDefiner(pset.getParameter("parametersDefiner")), - tpDefinerEsToken(esConsumes(edm::ESInputTag("", parametersDefiner))), - parametersDefinerIsCosmic_(parametersDefiner == "CosmicParametersDefinerForTP"), + parametersDefinerIsCosmic_(pset.getParameter("parametersDefiner") == "CosmicParametersDefinerForTP"), associators(pset.getUntrackedParameter>("associators")), label(pset.getParameter>("label")), ignoremissingtkcollection_(pset.getUntrackedParameter("ignoremissingtrackcollection", false)), @@ -118,6 +115,12 @@ MultiTrackValidator::MultiTrackValidator(const edm::ParameterSet& pset) edm::InputTag beamSpotTag = pset.getParameter("beamSpot"); bsSrc = consumes(beamSpotTag); + if (parametersDefinerIsCosmic_) { + parametersDefinerTP_ = std::make_unique(consumesCollector()); + } else { + parametersDefinerTP_ = std::make_unique(beamSpotTag, consumesCollector()); + } + ParameterSet psetForHistoProducerAlgo = pset.getParameter("histoProducerAlgoBlock"); histoProducerAlgo_ = std::make_unique(psetForHistoProducerAlgo, doSeedPlots_); @@ -420,7 +423,6 @@ const reco::Vertex::Point* MultiTrackValidator::getRecoPVPosition( void MultiTrackValidator::tpParametersAndSelection( const Histograms& histograms, const TrackingParticleRefVector& tPCeff, - const ParametersDefinerForTP& parametersDefinerTP, const edm::Event& event, const edm::EventSetup& setup, const reco::BeamSpot& bs, @@ -433,7 +435,7 @@ void MultiTrackValidator::tpParametersAndSelection( for (size_t j = 0; j < tPCeff.size(); ++j) { const TrackingParticleRef& tpr = tPCeff[j]; - auto const& rec = parametersDefinerTP.momentumAndVertex(event, setup, tpr); + auto const& rec = parametersDefinerTP_->momentumAndVertex(event, setup, tpr); TrackingParticle::Vector const& momentum = std::get<0>(rec); TrackingParticle::Point const& vertex = std::get<1>(rec); if (doSimPlots_) { @@ -466,7 +468,7 @@ void MultiTrackValidator::tpParametersAndSelection( if (tpSelector(tp)) { selected_tPCeff.push_back(j); - momVert_tPCeff.emplace_back(parametersDefinerTP.momentumAndVertex(event, setup, tpr)); + momVert_tPCeff.emplace_back(parametersDefinerTP_->momentumAndVertex(event, setup, tpr)); } ++j; } @@ -589,10 +591,6 @@ void MultiTrackValidator::dqmAnalyze(const edm::Event& event, << "====================================================\n" << "\n"; - const auto& parametersDefinerTPHandle = setup.getHandle(tpDefinerEsToken); - //Since we modify the object, we must clone it - auto parametersDefinerTP = parametersDefinerTPHandle->clone(); - const TrackerTopology& ttopo = setup.getData(tTopoEsToken); // FIXME: we really need to move to edm::View for reading the @@ -643,7 +641,7 @@ void MultiTrackValidator::dqmAnalyze(const edm::Event& event, edm::Handle simHitsTPAssoc; //warning: make sure the TP collection used in the map is the same used in the MTV! event.getByToken(_simHitTpMapTag, simHitsTPAssoc); - parametersDefinerTP->initEvent(simHitsTPAssoc); + parametersDefinerTP_->initEvent(simHitsTPAssoc); cosmictpSelector.initEvent(simHitsTPAssoc); } @@ -719,7 +717,7 @@ void MultiTrackValidator::dqmAnalyze(const edm::Event& event, // for "efficiency" TPs. std::vector selected_tPCeff; std::vector> momVert_tPCeff; - tpParametersAndSelection(histograms, tPCeff, *parametersDefinerTP, event, setup, bs, momVert_tPCeff, selected_tPCeff); + tpParametersAndSelection(histograms, tPCeff, event, setup, bs, momVert_tPCeff, selected_tPCeff); //calculate dR for TPs declareDynArray(float, tPCeff.size(), dR_tPCeff); @@ -1167,8 +1165,8 @@ void MultiTrackValidator::dqmAnalyze(const edm::Event& event, if (doResolutionPlots_[www]) { //Get tracking particle parameters at point of closest approach to the beamline TrackingParticleRef tpr = tpFound->val.begin()->first; - TrackingParticle::Vector momentumTP = parametersDefinerTP->momentum(event, setup, tpr); - TrackingParticle::Point vertexTP = parametersDefinerTP->vertex(event, setup, tpr); + TrackingParticle::Vector momentumTP = parametersDefinerTP_->momentum(event, setup, tpr); + TrackingParticle::Point vertexTP = parametersDefinerTP_->vertex(event, setup, tpr); int chargeTP = tpr->charge(); histoProducerAlgo_->fill_ResoAndPull_recoTrack_histos( diff --git a/Validation/RecoTrack/plugins/MultiTrackValidatorGenPs.cc b/Validation/RecoTrack/plugins/MultiTrackValidatorGenPs.cc index 733b8324270bf..5bf7d80e0b0e5 100644 --- a/Validation/RecoTrack/plugins/MultiTrackValidatorGenPs.cc +++ b/Validation/RecoTrack/plugins/MultiTrackValidatorGenPs.cc @@ -17,8 +17,6 @@ #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h" #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h" #include "TrackingTools/PatternTools/interface/TSCBLBuilderNoMaterial.h" -#include "SimTracker/TrackAssociation/plugins/ParametersDefinerForTPESProducer.h" -#include "SimTracker/TrackAssociation/plugins/CosmicParametersDefinerForTPESProducer.h" #include "DataFormats/TrackReco/interface/DeDxData.h" #include "DataFormats/Common/interface/ValueMap.h" @@ -74,7 +72,6 @@ void MultiTrackValidatorGenPs::dqmAnalyze(const edm::Event& event, << "====================================================\n" << "\n"; - const auto& parametersDefinerTP = &setup.getData(tpDefinerEsToken); const TrackerTopology& ttopo = setup.getData(tTopoEsToken); edm::Handle TPCollectionHeff; @@ -201,8 +198,8 @@ void MultiTrackValidatorGenPs::dqmAnalyze(const edm::Event& event, momentumTP = tp->momentum(); vertexTP = tp->vertex(); //Calcualte the impact parameters w.r.t. PCA - TrackingParticle::Vector momentum = parametersDefinerTP->momentum(event, setup, *tp); - TrackingParticle::Point vertex = parametersDefinerTP->vertex(event, setup, *tp); + TrackingParticle::Vector momentum = parametersDefinerTP_->momentum(event, setup, *tp); + TrackingParticle::Point vertex = parametersDefinerTP_->vertex(event, setup, *tp); dxyGen = (-vertex.x() * sin(momentum.phi()) + vertex.y() * cos(momentum.phi())); dzGen = vertex.z() - (vertex.x() * momentum.x() + vertex.y() * momentum.y()) / sqrt(momentum.perp2()) * momentum.z() / sqrt(momentum.perp2()); @@ -210,8 +207,8 @@ void MultiTrackValidatorGenPs::dqmAnalyze(const edm::Event& event, //If the GenParticle is comics, get the momentum and vertex at PCA else { //if(! cosmictpSelector(*tp,&bs,event,setup)) continue; - momentumTP = parametersDefinerTP->momentum(event, setup, *tp); - vertexTP = parametersDefinerTP->vertex(event, setup, *tp); + momentumTP = parametersDefinerTP_->momentum(event, setup, *tp); + vertexTP = parametersDefinerTP_->vertex(event, setup, *tp); dxyGen = (-vertexTP.x() * sin(momentumTP.phi()) + vertexTP.y() * cos(momentumTP.phi())); dzGen = vertexTP.z() - (vertexTP.x() * momentumTP.x() + vertexTP.y() * momentumTP.y()) / sqrt(momentumTP.perp2()) * momentumTP.z() / sqrt(momentumTP.perp2()); @@ -387,8 +384,8 @@ void MultiTrackValidatorGenPs::dqmAnalyze(const edm::Event& event, */ //Get tracking particle parameters at point of closest approach to the beamline - TrackingParticle::Vector momentumTP = parametersDefinerTP->momentum(event, setup, *(tpr.get())); - TrackingParticle::Point vertexTP = parametersDefinerTP->vertex(event, setup, *(tpr.get())); + TrackingParticle::Vector momentumTP = parametersDefinerTP_->momentum(event, setup, *(tpr.get())); + TrackingParticle::Point vertexTP = parametersDefinerTP_->vertex(event, setup, *(tpr.get())); int chargeTP = tpr->charge(); histoProducerAlgo_->fill_ResoAndPull_recoTrack_histos( diff --git a/Validation/RecoTrack/plugins/TrackingNtuple.cc b/Validation/RecoTrack/plugins/TrackingNtuple.cc index 2ada7708a4cd5..4f82fe9dd366d 100644 --- a/Validation/RecoTrack/plugins/TrackingNtuple.cc +++ b/Validation/RecoTrack/plugins/TrackingNtuple.cc @@ -71,11 +71,10 @@ #include "DataFormats/VertexReco/interface/Vertex.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" #include "SimDataFormats/Associations/interface/TrackToTrackingParticleAssociator.h" #include "SimGeneral/TrackingAnalysis/interface/SimHitTPAssociationProducer.h" #include "SimTracker/TrackerHitAssociation/interface/ClusterTPAssociation.h" -#include "SimTracker/TrackAssociation/plugins/ParametersDefinerForTPESProducer.h" +#include "SimTracker/TrackAssociation/interface/ParametersDefinerForTP.h" #include "SimTracker/TrackAssociation/interface/TrackingParticleIP.h" #include "SimTracker/TrackAssociation/interface/trackAssociationChi2.h" #include "SimTracker/TrackAssociation/interface/trackHitsToClusterRefs.h" @@ -90,7 +89,7 @@ #include "Validation/RecoTrack/interface/trackFromSeedFitFailed.h" -#include "RecoTracker/FinalTrackSelectors/plugins/getBestVertex.h" +#include "RecoTracker/FinalTrackSelectors/interface/getBestVertex.h" #include #include @@ -637,7 +636,6 @@ class TrackingNtuple : public edm::one::EDAnalyzer { const edm::ESGetToken ttrhToken_; const edm::ESGetToken tTopoToken_; const edm::ESGetToken tGeomToken_; - const edm::ESGetToken paramsDefineToken_; std::vector>> seedTokens_; std::vector>> seedStopInfoTokens_; @@ -669,7 +667,6 @@ class TrackingNtuple : public edm::one::EDAnalyzer { std::vector>> stripUseMaskTokens_; std::string builderName_; - std::string parametersDefinerName_; const bool includeSeeds_; const bool addSeedCurvCov_; const bool includeAllHits_; @@ -681,6 +678,7 @@ class TrackingNtuple : public edm::one::EDAnalyzer { const bool simHitBySignificance_; HistoryBase tracer_; + ParametersDefinerForTP parametersDefiner_; TTree* t; @@ -1305,8 +1303,6 @@ TrackingNtuple::TrackingNtuple(const edm::ParameterSet& iConfig) ttrhToken_(esConsumes(edm::ESInputTag("", iConfig.getUntrackedParameter("TTRHBuilder")))), tTopoToken_(esConsumes()), tGeomToken_(esConsumes()), - paramsDefineToken_( - esConsumes(edm::ESInputTag("", iConfig.getUntrackedParameter("parametersDefiner")))), trackToken_(consumes>(iConfig.getUntrackedParameter("tracks"))), clusterTPMapToken_(consumes(iConfig.getUntrackedParameter("clusterTPMap"))), simHitTPMapToken_(consumes( @@ -1349,7 +1345,8 @@ TrackingNtuple::TrackingNtuple(const edm::ParameterSet& iConfig) includeOOT_(iConfig.getUntrackedParameter("includeOOT")), keepEleSimHits_(iConfig.getUntrackedParameter("keepEleSimHits")), saveSimHitsP3_(iConfig.getUntrackedParameter("saveSimHitsP3")), - simHitBySignificance_(iConfig.getUntrackedParameter("simHitBySignificance")) { + simHitBySignificance_(iConfig.getUntrackedParameter("simHitBySignificance")), + parametersDefiner_(iConfig.getUntrackedParameter("beamSpot"), consumesCollector()) { if (includeSeeds_) { seedTokens_ = edm::vector_transform(iConfig.getUntrackedParameter>("seedTracks"), @@ -3694,8 +3691,6 @@ void TrackingNtuple::fillTrackingParticles(const edm::Event& iEvent, const reco::TrackToTrackingParticleAssociator& associatorByHits, const std::vector& tpHitList, const TrackingParticleRefKeyToCount& tpKeyToClusterCount) { - const ParametersDefinerForTP* parametersDefiner = &iSetup.getData(paramsDefineToken_); - // Number of 3D layers for TPs edm::Handle> tpNLayersH; iEvent.getByToken(tpNLayersToken_, tpNLayersH); @@ -3765,8 +3760,8 @@ void TrackingNtuple::fillTrackingParticles(const edm::Event& iEvent, sim_decayVtxIdx.push_back(decayIdx); //Calcualte the impact parameters w.r.t. PCA - TrackingParticle::Vector momentum = parametersDefiner->momentum(iEvent, iSetup, tp); - TrackingParticle::Point vertex = parametersDefiner->vertex(iEvent, iSetup, tp); + TrackingParticle::Vector momentum = parametersDefiner_.momentum(iEvent, iSetup, tp); + TrackingParticle::Point vertex = parametersDefiner_.vertex(iEvent, iSetup, tp); auto dxySim = TrackingParticleIP::dxy(vertex, momentum, bs.position()); auto dzSim = TrackingParticleIP::dz(vertex, momentum, bs.position()); const double lambdaSim = M_PI / 2 - momentum.theta(); @@ -4003,7 +3998,6 @@ void TrackingNtuple::fillDescriptions(edm::ConfigurationDescriptions& descriptio desc.addUntracked("trackingParticleNstripstereolayers", edm::InputTag("trackingParticleNumberOfLayersProducer", "stripStereoLayers")); desc.addUntracked("TTRHBuilder", "WithTrackAngle"); - desc.addUntracked("parametersDefiner", "LhcParametersDefinerForTP"); desc.addUntracked("includeSeeds", false); desc.addUntracked("addSeedCurvCov", false); desc.addUntracked("includeAllHits", false); diff --git a/Validation/RecoTrack/python/HLTmultiTrackValidator_cfi.py b/Validation/RecoTrack/python/HLTmultiTrackValidator_cfi.py index f0fe65b025298..f17cacbeac8a6 100644 --- a/Validation/RecoTrack/python/HLTmultiTrackValidator_cfi.py +++ b/Validation/RecoTrack/python/HLTmultiTrackValidator_cfi.py @@ -1,10 +1,5 @@ import FWCore.ParameterSet.Config as cms -from SimTracker.TrackAssociation.LhcParametersDefinerForTP_cfi import * -hltLhcParametersDefinerForTP = LhcParametersDefinerForTP.clone() -hltLhcParametersDefinerForTP.ComponentName = cms.string('hltLhcParametersDefinerForTP') -hltLhcParametersDefinerForTP.beamSpot = cms.untracked.InputTag('hltOnlineBeamSpot') - from Validation.RecoTrack.associators_cff import * from Validation.RecoTrack.MultiTrackValidator_cfi import * diff --git a/Validation/RecoTrack/python/MultiTrackValidatorGenPs_cfi.py b/Validation/RecoTrack/python/MultiTrackValidatorGenPs_cfi.py index 4c5ae57ca169a..3e26b1199089c 100644 --- a/Validation/RecoTrack/python/MultiTrackValidatorGenPs_cfi.py +++ b/Validation/RecoTrack/python/MultiTrackValidatorGenPs_cfi.py @@ -2,8 +2,6 @@ from Validation.RecoTrack.TrackingParticleSelectionForEfficiency_cfi import * from Validation.RecoTrack.GenParticleSelectionsForEfficiency_cff import * -from SimTracker.TrackAssociation.LhcParametersDefinerForTP_cfi import * -from SimTracker.TrackAssociation.CosmicParametersDefinerForTP_cfi import * from Validation.RecoTrack.MTVHistoProducerAlgoForTrackerBlock_cfi import * from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer diff --git a/Validation/RecoTrack/python/MultiTrackValidator_cff.py b/Validation/RecoTrack/python/MultiTrackValidator_cff.py index bc7ee7d8b3a55..b224c2bd67441 100644 --- a/Validation/RecoTrack/python/MultiTrackValidator_cff.py +++ b/Validation/RecoTrack/python/MultiTrackValidator_cff.py @@ -2,6 +2,4 @@ from DQMServices.Core.DQM_cfg import * from Validation.RecoTrack.MultiTrackValidator_cfi import * -from SimTracker.TrackAssociation.LhcParametersDefinerForTP_cfi import * -from SimTracker.TrackAssociation.CosmicParametersDefinerForTP_cfi import * diff --git a/Validation/RecoTrack/python/MultiTrackValidator_cfi.py b/Validation/RecoTrack/python/MultiTrackValidator_cfi.py index 1b452537c835f..4598b999fba83 100644 --- a/Validation/RecoTrack/python/MultiTrackValidator_cfi.py +++ b/Validation/RecoTrack/python/MultiTrackValidator_cfi.py @@ -1,8 +1,6 @@ import FWCore.ParameterSet.Config as cms from Validation.RecoTrack.TrackingParticleSelectionForEfficiency_cfi import * -from SimTracker.TrackAssociation.LhcParametersDefinerForTP_cfi import * -from SimTracker.TrackAssociation.CosmicParametersDefinerForTP_cfi import * from Validation.RecoTrack.MTVHistoProducerAlgoForTrackerBlock_cfi import * from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer diff --git a/Validation/RecoTrack/python/TrackValidation_cff.py b/Validation/RecoTrack/python/TrackValidation_cff.py index 5190b7cd4328f..0b3b973da0d53 100644 --- a/Validation/RecoTrack/python/TrackValidation_cff.py +++ b/Validation/RecoTrack/python/TrackValidation_cff.py @@ -6,8 +6,6 @@ from SimTracker.TrackAssociation.trackingParticleRecoTrackAsssociation_cfi import * import Validation.RecoTrack.MultiTrackValidator_cfi from Validation.RecoTrack.trajectorySeedTracks_cfi import trajectorySeedTracks as _trajectorySeedTracks -from SimTracker.TrackAssociation.LhcParametersDefinerForTP_cfi import * -from SimTracker.TrackAssociation.CosmicParametersDefinerForTP_cfi import * from Validation.RecoTrack.PostProcessorTracker_cfi import * import Validation.RecoTrack.cutsRecoTracks_cfi as cutsRecoTracks_cfi #from . import cutsRecoTracks_cfi diff --git a/Validation/RecoTrack/python/plotting/validation.py b/Validation/RecoTrack/python/plotting/validation.py index e19487b27489f..3b208d4bb943e 100644 --- a/Validation/RecoTrack/python/plotting/validation.py +++ b/Validation/RecoTrack/python/plotting/validation.py @@ -6,6 +6,7 @@ import shutil import subprocess import urllib.request +import multiprocessing import ROOT ROOT.gROOT.SetBatch(True) @@ -1266,14 +1267,23 @@ def doPlots(self, plotters, plotterDrawArgs={}, **kwargs): def _doPlotsForPlotter(self, plotter, sample, limitSubFoldersOnlyTo=None): plotterInstance = plotter.readDirs(*self._openFiles) + manager = multiprocessing.Manager() + return_dict = manager.dict() + proc = [] + iProc = 0 for plotterFolder, dqmSubFolder in plotterInstance.iterFolders(limitSubFoldersOnlyTo=limitSubFoldersOnlyTo): if sample is not None and not _processPlotsForSample(plotterFolder, sample): continue - plotFiles = self._doPlots(plotterFolder, dqmSubFolder) - if len(plotFiles) > 0: - self._htmlReport.addPlots(plotterFolder, dqmSubFolder, plotFiles) - - def _doPlots(self, plotterFolder, dqmSubFolder): + p = multiprocessing.Process(target=self._doPlots, args=(plotterFolder, dqmSubFolder, iProc, return_dict)) + proc.append((plotterFolder, dqmSubFolder, p)) + p.start() + iProc += 1 + for i in range(iProc): + proc[i][2].join() + if len(return_dict[i]) > 0: + self._htmlReport.addPlots(proc[i][0], proc[i][1], return_dict[i]) + + def _doPlots(self, plotterFolder, dqmSubFolder, iProc, return_dict): plotterFolder.create(self._openFiles, self._labels, dqmSubFolder) newsubdir = self._subdirprefix+plotterFolder.getSelectionName(dqmSubFolder) newdir = os.path.join(self._newdir, newsubdir) @@ -1303,7 +1313,7 @@ def _doPlots(self, plotterFolder, dqmSubFolder): urllib.request.urlretrieve("https://raw.githubusercontent.com/musella/php-plots/master/%s"%d, "%s/%s"%(newdir,d)) print("Created plots in %s" % newdir) - return list(map(lambda n: n.replace(newdir, newsubdir), fileList)) + return_dict[iProc] = list(map(lambda n: n.replace(newdir, newsubdir), fileList)) class SeparateValidation: #Similar to the SimpleValidation diff --git a/Validation/RecoTrack/test/fakeAnalysis/analysis.py b/Validation/RecoTrack/test/fakeAnalysis/analysis.py index 9fba01be7d8cb..67a4a227cf7bf 100644 --- a/Validation/RecoTrack/test/fakeAnalysis/analysis.py +++ b/Validation/RecoTrack/test/fakeAnalysis/analysis.py @@ -825,7 +825,7 @@ def ClassifyEventFakes(ntuple_file, nEvents = 100, return_fakes = False, real_cr Returns a dictionary of class items, with class index as a key and number of fakes in the class as the value. ''' i = 0 - results = {class_item: 0 for class_item in classes} # This line has issues with the python version, worked with Python 2.17.12. Comment something to compile with older version + results = {class_item: 0 for class_item in classes} # This line has issues with the python3 version, worked with Python 2.17.12. Comment something to compile with older version fake_list = [] for event in ntuple_file: fakes = FindFakes(event) diff --git a/Validation/RecoVertex/README.md b/Validation/RecoVertex/README.md index 98afa2fdb597e..0eaba4d33ea4a 100644 --- a/Validation/RecoVertex/README.md +++ b/Validation/RecoVertex/README.md @@ -4,10 +4,10 @@ INTRODUCTION This small README file is here to guide you in the process of running the Vertex Validation, slimmed version, on RelVal samples, in case you want to perform test on tracking and vertexing. The idea here is not -to give you pre-cooked python configuration files, but to teach you +to give you pre-cooked python3 configuration files, but to teach you how you could use the most common tool available in CMS to perform the same. We will mainly use cmsDriver and its powerful option to create -the python cfg that we will run, and das_client to explore and find +the python3 cfg that we will run, and das_client to explore and find suitable samples to run upon. At the end of this page there is the description of other standalone analyzers, configurations and Root macros. Let start with order. PREREQUISITES @@ -64,7 +64,7 @@ RUN RECO AND VERTEX VALIDATION ============================== Inn order to run the vertex validation starting from RAW file, you -need to create a proper python cfg. As said, instead of preparing a +need to create a proper python3 cfg. As said, instead of preparing a pre-cooked one, we think its more useful to give you the cmsDriver command that will dynamically prepare it for you. To obtain such a cfg file, issue the following command: @@ -73,7 +73,7 @@ file, issue the following command: cmsDriver.py step3 --conditions auto:run2_mc -n 100 --eventcontent DQM -s RAW2DIGI,RECO,VALIDATION:vertexValidationStandalone --datatier DQMIO --filein filelist:gen_sim_digi_raw_files.txt --fileout step3_VertexValidation.root --customise SLHCUpgradeSimulations/Configuration/postLS1Customs.customisePostLS1 --magField 38T_PostLS1 ``` -This will create the python configuration file **and will +This will create the python3 configuration file **and will automatically run cmsRun on it. If instead you want to just produce the configuration, e.g. for inspection and further customization, you can add the option: diff --git a/Validation/RecoVertex/src/PrimaryVertexAnalyzer4PUSlimmed.cc b/Validation/RecoVertex/src/PrimaryVertexAnalyzer4PUSlimmed.cc index 3e4ad5e3246e9..b11fef25e0c7e 100644 --- a/Validation/RecoVertex/src/PrimaryVertexAnalyzer4PUSlimmed.cc +++ b/Validation/RecoVertex/src/PrimaryVertexAnalyzer4PUSlimmed.cc @@ -14,7 +14,6 @@ #include "SimDataFormats/TrackingAnalysis/interface/TrackingVertexContainer.h" // associator -#include "SimTracker/Records/interface/TrackAssociatorRecord.h" #include "SimTracker/VertexAssociation/interface/calculateVertexSharedTracks.h" // DQM diff --git a/Validation/RecoVertex/test/V0PerformanceValidation.py b/Validation/RecoVertex/test/V0PerformanceValidation.py index b9b1e04527c69..abe7e4e1e7aaa 100644 --- a/Validation/RecoVertex/test/V0PerformanceValidation.py +++ b/Validation/RecoVertex/test/V0PerformanceValidation.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 from __future__ import print_function import os diff --git a/Validation/RecoVertex/test/vertexCompare.py b/Validation/RecoVertex/test/vertexCompare.py index f60d1212b88e9..8a21ae11fb766 100755 --- a/Validation/RecoVertex/test/vertexCompare.py +++ b/Validation/RecoVertex/test/vertexCompare.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # This is an example of plotting the standard vertex validation # plots from an explicit set of DQM root files. diff --git a/Validation/RecoVertex/test/vertexPerformanceValidation.py b/Validation/RecoVertex/test/vertexPerformanceValidation.py index 9f6a8d06b3ef9..4b79c756419cc 100755 --- a/Validation/RecoVertex/test/vertexPerformanceValidation.py +++ b/Validation/RecoVertex/test/vertexPerformanceValidation.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 from Validation.RecoTrack.plotting.validation import Sample, Validation import Validation.RecoTrack.plotting.validation as validation diff --git a/Validation/SiTrackerPhase2V/plugins/Phase2TrackerValidateDigi.cc b/Validation/SiTrackerPhase2V/plugins/Phase2TrackerValidateDigi.cc index b1d88cbb80d1e..b865c5c444f5d 100644 --- a/Validation/SiTrackerPhase2V/plugins/Phase2TrackerValidateDigi.cc +++ b/Validation/SiTrackerPhase2V/plugins/Phase2TrackerValidateDigi.cc @@ -38,12 +38,13 @@ #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" #include "SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLink.h" -#include "SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerFwd.h" // DQM Histograming #include "DQMServices/Core/interface/MonitorElement.h" #include "DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h" +using Phase2TrackerGeomDetUnit = PixelGeomDetUnit; + // // constructors // diff --git a/Validation/Tools/python/GenObject.py b/Validation/Tools/python/GenObject.py index 6aeb53b468316..5adc5273aa2b8 100755 --- a/Validation/Tools/python/GenObject.py +++ b/Validation/Tools/python/GenObject.py @@ -1504,7 +1504,7 @@ def printTuple (chain): @staticmethod def _convertStringToParameters (string): - """Convert comma-separated string into a python list of + """Convert comma-separated string into a python3 list of parameters. Currently only understands strings, floats, and integers.""" retval = []